@noy-db/hub 0.3.0-pre.9 → 0.4.0-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (968) hide show
  1. package/dist/aggregate/index.js +5 -5
  2. package/dist/api-3A3S4SHH.js +20 -0
  3. package/dist/as/index.js +11 -11
  4. package/dist/attestation/index.js +18 -18
  5. package/dist/backup-YPUEKIJC.js +242 -0
  6. package/dist/backup-YPUEKIJC.js.map +1 -0
  7. package/dist/blobs/index.js +13 -11
  8. package/dist/blobs/index.js.map +1 -1
  9. package/dist/broker/index.js +92 -0
  10. package/dist/broker/index.js.map +1 -0
  11. package/dist/bundle/index.js +25 -22
  12. package/dist/bundle/index.js.map +1 -1
  13. package/dist/by/index.js +2 -2
  14. package/dist/cargo/index.js +31 -32
  15. package/dist/chunk-2PCAVW2I.js +50 -0
  16. package/dist/chunk-3ELCWU56.js +344 -0
  17. package/dist/chunk-3ELCWU56.js.map +1 -0
  18. package/dist/chunk-4GPE63GU.js +111 -0
  19. package/dist/chunk-4GPE63GU.js.map +1 -0
  20. package/dist/chunk-554KLAAN.js +778 -0
  21. package/dist/chunk-5PFOMHTB.js +135 -0
  22. package/dist/chunk-5WZXVULX.js +209 -0
  23. package/dist/chunk-6HPG2YNX.js +38 -0
  24. package/dist/chunk-6HY2X62D.js +69 -0
  25. package/dist/chunk-6NQMXTYC.js +123 -0
  26. package/dist/chunk-6XE5TMPR.js +367 -0
  27. package/dist/chunk-A4FXFAKF.js +45 -0
  28. package/dist/chunk-A5BDDEXK.js +1537 -0
  29. package/dist/chunk-A5BDDEXK.js.map +1 -0
  30. package/dist/chunk-ANATMTOA.js +205 -0
  31. package/dist/chunk-BOKIKJJB.js +94 -0
  32. package/dist/chunk-CJ5KKU6X.js +49 -0
  33. package/dist/chunk-CZTLE22N.js +381 -0
  34. package/dist/chunk-CZTLE22N.js.map +1 -0
  35. package/dist/chunk-DDHM2TLX.js +164 -0
  36. package/dist/chunk-DDHM2TLX.js.map +1 -0
  37. package/dist/chunk-DRWBEDYO.js +37 -0
  38. package/dist/chunk-DRWBEDYO.js.map +1 -0
  39. package/dist/chunk-DSBQODMZ.js +202 -0
  40. package/dist/chunk-EO43ANYJ.js +382 -0
  41. package/dist/chunk-EWPOHMN2.js +255 -0
  42. package/dist/chunk-FH52K7EG.js +50 -0
  43. package/dist/chunk-FH52K7EG.js.map +1 -0
  44. package/dist/chunk-FXZDAV62.js +826 -0
  45. package/dist/chunk-FXZDAV62.js.map +1 -0
  46. package/dist/chunk-GDG5VVYG.js +167 -0
  47. package/dist/chunk-GDG5VVYG.js.map +1 -0
  48. package/dist/chunk-GULTLPFB.js +621 -0
  49. package/dist/chunk-GULTLPFB.js.map +1 -0
  50. package/dist/chunk-GWKAVKHI.js +71 -0
  51. package/dist/chunk-H2KSZMIX.js +164 -0
  52. package/dist/chunk-HOONYZY2.js +404 -0
  53. package/dist/chunk-HQBM64EE.js +957 -0
  54. package/dist/chunk-HQBM64EE.js.map +1 -0
  55. package/dist/chunk-IAO54J4R.js +333 -0
  56. package/dist/chunk-IAO54J4R.js.map +1 -0
  57. package/dist/chunk-IFJTPAQQ.js +150 -0
  58. package/dist/chunk-IFJTPAQQ.js.map +1 -0
  59. package/dist/chunk-IGJCYUT5.js +99 -0
  60. package/dist/chunk-IGJCYUT5.js.map +1 -0
  61. package/dist/chunk-IK43HLDQ.js +739 -0
  62. package/dist/chunk-IK43HLDQ.js.map +1 -0
  63. package/dist/chunk-ISMV2QVG.js +54 -0
  64. package/dist/chunk-IY23KFNZ.js +95 -0
  65. package/dist/chunk-JBBSYJHP.js +129 -0
  66. package/dist/chunk-JFCV5QIK.js +117 -0
  67. package/dist/chunk-JK733I5V.js +23 -0
  68. package/dist/chunk-JK733I5V.js.map +1 -0
  69. package/dist/chunk-JRBNCUNT.js +371 -0
  70. package/dist/chunk-JRBNCUNT.js.map +1 -0
  71. package/dist/chunk-JVBO4SZL.js +29 -0
  72. package/dist/chunk-JVBO4SZL.js.map +1 -0
  73. package/dist/chunk-KPZS5QAQ.js +151 -0
  74. package/dist/chunk-KPZS5QAQ.js.map +1 -0
  75. package/dist/chunk-KS6SAVCZ.js +247 -0
  76. package/dist/chunk-KS6SAVCZ.js.map +1 -0
  77. package/dist/chunk-LVGTA624.js +480 -0
  78. package/dist/chunk-LVGTA624.js.map +1 -0
  79. package/dist/chunk-M75ZZHSR.js +30 -0
  80. package/dist/chunk-MT62YSPZ.js +392 -0
  81. package/dist/chunk-MT62YSPZ.js.map +1 -0
  82. package/dist/chunk-N6WF5PKC.js +29 -0
  83. package/dist/chunk-NCCBLYEB.js +150 -0
  84. package/dist/chunk-OCVM6KDH.js +99 -0
  85. package/dist/chunk-ONTBCHCP.js +80 -0
  86. package/dist/chunk-PK6JIDQ4.js +14425 -0
  87. package/dist/chunk-PK6JIDQ4.js.map +1 -0
  88. package/dist/chunk-QDPZWTN2.js +74 -0
  89. package/dist/chunk-QDPZWTN2.js.map +1 -0
  90. package/dist/chunk-R3BLCFD2.js +130 -0
  91. package/dist/chunk-RA5VTXXG.js +173 -0
  92. package/dist/chunk-RA5VTXXG.js.map +1 -0
  93. package/dist/chunk-RDXW3OBQ.js +21 -0
  94. package/dist/chunk-RFI7GGFO.js +230 -0
  95. package/dist/chunk-RJ6K6K5M.js +36 -0
  96. package/dist/chunk-RJ6K6K5M.js.map +1 -0
  97. package/dist/chunk-RNG4VRP4.js +75 -0
  98. package/dist/chunk-RTEK4C4I.js +41 -0
  99. package/dist/chunk-S3BFKGET.js +369 -0
  100. package/dist/chunk-S3BFKGET.js.map +1 -0
  101. package/dist/chunk-S6Q37VGE.js +30 -0
  102. package/dist/chunk-SMIRGMS7.js +30 -0
  103. package/dist/chunk-SMIRGMS7.js.map +1 -0
  104. package/dist/chunk-SV6EAJEP.js +86 -0
  105. package/dist/chunk-T36RFODW.js +180 -0
  106. package/dist/chunk-T36RFODW.js.map +1 -0
  107. package/dist/chunk-T3GY65MA.js +367 -0
  108. package/dist/chunk-TAGR72IR.js +515 -0
  109. package/dist/chunk-TAGR72IR.js.map +1 -0
  110. package/dist/chunk-THVIPWRF.js +495 -0
  111. package/dist/chunk-THVIPWRF.js.map +1 -0
  112. package/dist/chunk-TIGPQDYP.js +14 -0
  113. package/dist/chunk-U6JMEH2P.js +261 -0
  114. package/dist/chunk-UC2ETWF3.js +34 -0
  115. package/dist/chunk-UDSR4X4L.js +235 -0
  116. package/dist/chunk-UHNGNKLV.js +2782 -0
  117. package/dist/chunk-UHNGNKLV.js.map +1 -0
  118. package/dist/chunk-VAIS3SOM.js +74 -0
  119. package/dist/chunk-VCBHAE4R.js +124 -0
  120. package/dist/chunk-VCTXU4AT.js +32 -0
  121. package/dist/chunk-VCTXU4AT.js.map +1 -0
  122. package/dist/chunk-VEALDPHW.js +524 -0
  123. package/dist/chunk-VEALDPHW.js.map +1 -0
  124. package/dist/chunk-VKCADNMR.js +589 -0
  125. package/dist/chunk-VRBTNCM4.js +720 -0
  126. package/dist/chunk-VRBTNCM4.js.map +1 -0
  127. package/dist/chunk-VYYM3MEN.js +98 -0
  128. package/dist/chunk-VYYM3MEN.js.map +1 -0
  129. package/dist/chunk-W2OG6JOL.js +1554 -0
  130. package/dist/chunk-W2OG6JOL.js.map +1 -0
  131. package/dist/chunk-W4TCUGQR.js +1128 -0
  132. package/dist/chunk-W4TCUGQR.js.map +1 -0
  133. package/dist/chunk-WG4QBZDN.js +283 -0
  134. package/dist/chunk-WG4QBZDN.js.map +1 -0
  135. package/dist/chunk-WHXXI3W5.js +135 -0
  136. package/dist/chunk-WHXXI3W5.js.map +1 -0
  137. package/dist/chunk-WKGF2TJR.js +45 -0
  138. package/dist/chunk-WNGGJWF7.js +36 -0
  139. package/dist/chunk-WOM2HTML.js +59 -0
  140. package/dist/chunk-WQIYTNJV.js +70 -0
  141. package/dist/chunk-WZSHL6DQ.js +59 -0
  142. package/dist/chunk-XDIAFPUM.js +42 -0
  143. package/dist/chunk-XJMBYYQK.js +40 -0
  144. package/dist/chunk-XTHCN77N.js +91 -0
  145. package/dist/chunk-XUW3PXHU.js +248 -0
  146. package/dist/chunk-XUW3PXHU.js.map +1 -0
  147. package/dist/chunk-YCH5GBN6.js +99 -0
  148. package/dist/chunk-YTGDPCPW.js +155 -0
  149. package/dist/chunk-YZQOGE2L.js +23 -0
  150. package/dist/chunk-Z4PD65VQ.js +265 -0
  151. package/dist/chunk-Z4PD65VQ.js.map +1 -0
  152. package/dist/chunk-ZXEZCY6F.js +85 -0
  153. package/dist/classified/index.js +5 -5
  154. package/dist/classified-marker-QWMASIT7.js +28 -0
  155. package/dist/classified-marker-QWMASIT7.js.map +1 -0
  156. package/dist/collection-facade-KMBWNCYP.js +44 -0
  157. package/dist/computed-DSMPXG2Y.js +11 -0
  158. package/dist/consent/index.js +9 -9
  159. package/dist/cover-QJRXINN5.js +52 -0
  160. package/dist/crdt/index.js +1 -1
  161. package/dist/dead-filter-66VGI6JV.js +28 -0
  162. package/dist/delegation-SU6CV3W7.js +25 -0
  163. package/dist/derivations/index.js +12 -12
  164. package/dist/derive-6RWU4EOA.js +21 -0
  165. package/dist/enclave-TKPN2G2U.js +141 -0
  166. package/dist/executor-KGNLJD6M.js +9 -0
  167. package/dist/executor-UX4FASYZ.js +26 -0
  168. package/dist/executor-XGIS6CR7.js +9 -0
  169. package/dist/export-accessible-LKW3QV22.js +23 -0
  170. package/dist/extract-partition-UP2ARO75.js +38 -0
  171. package/dist/fanout-sidecar-B5LVUMQX.js +74 -0
  172. package/dist/find-YS6XWB46.js +11 -0
  173. package/dist/forget/index.js +10 -10
  174. package/dist/forget/index.js.map +1 -1
  175. package/dist/guards/index.js +6 -6
  176. package/dist/history/index.js +14 -11
  177. package/dist/history/index.js.map +1 -1
  178. package/dist/i18n/index.js +21 -19
  179. package/dist/i18n/index.js.map +1 -1
  180. package/dist/index.d.ts +310 -1493
  181. package/dist/index.js +331 -191
  182. package/dist/index.js.map +1 -1
  183. package/dist/indexing/index.js +7 -7
  184. package/dist/indexing/index.js.map +1 -1
  185. package/dist/issue-3ACYX7LO.js +19 -0
  186. package/dist/kernel/best-effort-revert.d.ts +52 -0
  187. package/dist/kernel/cache/index.d.ts +10 -0
  188. package/dist/kernel/cache/lru.d.ts +97 -0
  189. package/dist/kernel/cache/policy.d.ts +32 -0
  190. package/dist/kernel/collection-config.d.ts +809 -0
  191. package/dist/kernel/collection.d.ts +1522 -0
  192. package/dist/kernel/constants.d.ts +18 -0
  193. package/dist/kernel/debug.d.ts +25 -0
  194. package/dist/kernel/enclave/broker/proof.d.ts +154 -0
  195. package/dist/kernel/enclave/classify/bidx.d.ts +77 -0
  196. package/dist/kernel/enclave/classify/compare.d.ts +10 -0
  197. package/dist/kernel/enclave/classify/digest.d.ts +8 -0
  198. package/dist/kernel/enclave/classify/find.d.ts +36 -0
  199. package/dist/kernel/enclave/classify/kofn.d.ts +7 -0
  200. package/dist/kernel/enclave/classify/normalize.d.ts +7 -0
  201. package/dist/kernel/enclave/classify/reveal.d.ts +10 -0
  202. package/dist/kernel/enclave/classify/vdig.d.ts +39 -0
  203. package/dist/kernel/enclave/classify/verify.d.ts +36 -0
  204. package/dist/kernel/enclave/classify/write.d.ts +8 -0
  205. package/dist/kernel/enclave/crypto.d.ts +263 -0
  206. package/dist/kernel/enclave/index.d.ts +79 -0
  207. package/dist/kernel/enclave/record-keys/deterministic.d.ts +55 -0
  208. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +79 -0
  209. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +107 -0
  210. package/dist/kernel/enclave/record-keys/record-codec.d.ts +328 -0
  211. package/dist/kernel/enclave/record-keys/sealed-slot.d.ts +14 -0
  212. package/dist/kernel/enclave/record-keys/sealed-slots.d.ts +123 -0
  213. package/dist/kernel/enclave/record-keys/sealing.d.ts +70 -0
  214. package/dist/kernel/enclave/record-keys/tombstone.d.ts +57 -0
  215. package/dist/kernel/env-check.d.ts +1 -0
  216. package/dist/kernel/errors.d.ts +1927 -0
  217. package/dist/kernel/events.d.ts +11 -0
  218. package/dist/kernel/lazy-count.d.ts +13 -0
  219. package/dist/kernel/memory-store.d.ts +17 -0
  220. package/dist/kernel/mutation.d.ts +14 -0
  221. package/dist/kernel/noydb.d.ts +836 -0
  222. package/dist/kernel/paths.d.ts +25 -0
  223. package/dist/kernel/query/builder.d.ts +520 -0
  224. package/dist/kernel/query/index.d.ts +31 -0
  225. package/dist/kernel/query/join.d.ts +205 -0
  226. package/dist/kernel/query/live.d.ts +111 -0
  227. package/dist/kernel/query/predicate.d.ts +139 -0
  228. package/dist/kernel/query/scan-builder.d.ts +334 -0
  229. package/dist/kernel/refs.d.ts +205 -0
  230. package/dist/kernel/schema.d.ts +134 -0
  231. package/dist/kernel/sync-policy.d.ts +188 -0
  232. package/dist/kernel/tier-visibility.d.ts +54 -0
  233. package/dist/kernel/types.d.ts +3245 -0
  234. package/dist/kernel/util/discriminant.d.ts +58 -0
  235. package/dist/kernel/util/index.d.ts +14 -0
  236. package/dist/kernel/util/sanitize-filename.d.ts +75 -0
  237. package/dist/kernel/validation.d.ts +130 -0
  238. package/dist/kernel/vault.d.ts +1744 -0
  239. package/dist/kernel/via/compose.d.ts +144 -0
  240. package/dist/kernel/via/dispatch.d.ts +195 -0
  241. package/dist/kernel/via/graph-wiring.d.ts +145 -0
  242. package/dist/kernel/via/graph.d.ts +166 -0
  243. package/dist/kernel/via/index.d.ts +200 -0
  244. package/dist/kernel/via/pipeline.d.ts +266 -0
  245. package/dist/kernel/via/reconcile.d.ts +153 -0
  246. package/dist/kernel/via/taint-binding.d.ts +66 -0
  247. package/dist/kernel/write-queue.d.ts +46 -0
  248. package/dist/ledger-PTK7XZYT.js +42 -0
  249. package/dist/legacy/bundle.d.ts +30 -0
  250. package/dist/legacy/kernel.d.ts +33 -0
  251. package/dist/liberate-MQQXBUCY.js +24 -0
  252. package/dist/link-set-SLJHDNRB.js +31 -0
  253. package/dist/materialized-views/index.js +20 -17
  254. package/dist/noydb-ANIW5FLE.js +69 -0
  255. package/dist/on/index.js +9 -9
  256. package/dist/overlay-views/index.js +4 -4
  257. package/dist/periods/index.js +12 -12
  258. package/dist/pod/index.js +13 -11
  259. package/dist/policy-YDLCOX4P.js +41 -0
  260. package/dist/port/as/index.d.ts +26 -0
  261. package/dist/port/at/index.d.ts +18 -0
  262. package/dist/port/by/default-provider.d.ts +9 -0
  263. package/dist/port/by/index.d.ts +17 -0
  264. package/dist/port/by/types.d.ts +86 -0
  265. package/dist/port/in/index.d.ts +21 -0
  266. package/dist/port/on/index.d.ts +27 -0
  267. package/dist/port/to/index.d.ts +19 -0
  268. package/dist/port/ui/index.d.ts +21 -0
  269. package/dist/port/with/blob-strategy.d.ts +98 -0
  270. package/dist/port/with/broker-strategy.d.ts +84 -0
  271. package/dist/port/with/capabilities.d.ts +31 -0
  272. package/dist/port/with/classified-marker.d.ts +9 -0
  273. package/dist/port/with/classified-strategy.d.ts +62 -0
  274. package/dist/port/with/computed-strategy.d.ts +19 -0
  275. package/dist/port/with/i18n-strategy.d.ts +175 -0
  276. package/dist/port/with/index.d.ts +18 -0
  277. package/dist/port/with/lazy-strategy.d.ts +48 -0
  278. package/dist/port/with/lookup-strategy.d.ts +129 -0
  279. package/dist/port/with/service-bus.d.ts +156 -0
  280. package/dist/port/with/team-strategy.d.ts +36 -0
  281. package/dist/port/with/write-hooks.d.ts +34 -0
  282. package/dist/portability/index.js +8 -8
  283. package/dist/post-register-2YHSADFI.js +60 -0
  284. package/dist/post-register-2YHSADFI.js.map +1 -0
  285. package/dist/purge-scope-FGNNLWHD.js +24 -0
  286. package/dist/purge-scope-FGNNLWHD.js.map +1 -0
  287. package/dist/query/index.js +12 -10
  288. package/dist/read-only-facade-CHCKSEPD.js +8 -0
  289. package/dist/register-PAM3ASRZ.js +23 -0
  290. package/dist/registry-4S2U2TR4.js +19 -0
  291. package/dist/registry-NPOWJHC4.js +9 -0
  292. package/dist/registry-VZ3CCI2R.js +18 -0
  293. package/dist/request-withdrawal-DI3H5WUI.js +31 -0
  294. package/dist/reveal-HWO4YMTJ.js +38 -0
  295. package/dist/reveal-HWO4YMTJ.js.map +1 -0
  296. package/dist/revoke-R5CZSVUT.js +24 -0
  297. package/dist/satellites/index.js +1 -1
  298. package/dist/sealed-record/index.js +12 -12
  299. package/dist/seed-3ZMF5EQA.js +231 -0
  300. package/dist/seed-3ZMF5EQA.js.map +1 -0
  301. package/dist/session/index.js +9 -9
  302. package/dist/shadow/index.js +2 -2
  303. package/dist/signer-MBVHW4WE.js +25 -0
  304. package/dist/snapshots/index.js +10 -10
  305. package/dist/stale-VZL4OGUB.js +29 -0
  306. package/dist/storage-3MEJUENZ.js +23 -0
  307. package/dist/store-coordination-provider-FKX3F6TQ.js +142 -0
  308. package/dist/sync/index.js +9 -9
  309. package/dist/team/index.js +15 -15
  310. package/dist/tiers/index.js +14 -10
  311. package/dist/to/index.js +1 -2
  312. package/dist/tx/index.js +3 -3
  313. package/dist/util/index.js +1 -1
  314. package/dist/verify-26Y5GNMK.js +140 -0
  315. package/dist/verify-26Y5GNMK.js.map +1 -0
  316. package/dist/via/blob/active.d.ts +34 -0
  317. package/dist/via/blob/binding.d.ts +86 -0
  318. package/dist/via/blob/index.d.ts +34 -0
  319. package/dist/via/classified/active.d.ts +3 -0
  320. package/dist/via/classified/binding.d.ts +83 -0
  321. package/dist/via/classified/config-drift.d.ts +34 -0
  322. package/dist/via/classified/descriptor.d.ts +66 -0
  323. package/dist/via/classified/errors.d.ts +19 -0
  324. package/dist/via/classified/guards.d.ts +23 -0
  325. package/dist/via/classified/index.d.ts +11 -0
  326. package/dist/via/classified/presets.d.ts +65 -0
  327. package/dist/via/classified/resolve.d.ts +9 -0
  328. package/dist/via/classified/strategy.d.ts +11 -0
  329. package/dist/via/classified/validators.d.ts +3 -0
  330. package/dist/via/classified/write.d.ts +4 -0
  331. package/dist/via/computed/binding.d.ts +34 -0
  332. package/dist/via/computed/descriptor.d.ts +35 -0
  333. package/dist/via/i18n/active.d.ts +28 -0
  334. package/dist/via/i18n/binding.d.ts +36 -0
  335. package/dist/via/i18n/core.d.ts +267 -0
  336. package/dist/via/i18n/densify.d.ts +24 -0
  337. package/dist/via/i18n/dictionary.d.ts +200 -0
  338. package/dist/via/i18n/index.d.ts +21 -0
  339. package/dist/via/i18n/policy.d.ts +44 -0
  340. package/dist/via/i18n/script.d.ts +26 -0
  341. package/dist/via/i18n/strategy.d.ts +13 -0
  342. package/dist/via/lookup/active.d.ts +19 -0
  343. package/dist/via/lookup/binding.d.ts +99 -0
  344. package/dist/via/lookup/descriptor.d.ts +123 -0
  345. package/dist/via/lookup/handle.d.ts +220 -0
  346. package/dist/via/lookup/index.d.ts +17 -0
  347. package/dist/via/lookup/registry.d.ts +228 -0
  348. package/dist/via/lookup/snapshot.d.ts +67 -0
  349. package/dist/via/money/arith.d.ts +68 -0
  350. package/dist/via/money/binding.d.ts +21 -0
  351. package/dist/via/money/branded.d.ts +61 -0
  352. package/dist/via/money/descriptor.d.ts +73 -0
  353. package/dist/via/money/fixed-point.d.ts +51 -0
  354. package/dist/via/money/index.d.ts +15 -0
  355. package/dist/via/money/iso4217.d.ts +6 -0
  356. package/dist/via/money/money-reducer.d.ts +33 -0
  357. package/dist/via/money/normalize.d.ts +105 -0
  358. package/dist/via/money/paths.d.ts +61 -0
  359. package/dist/via/money/where.d.ts +127 -0
  360. package/dist/walk-IPLXE36W.js +241 -0
  361. package/dist/with/index.js +11 -11
  362. package/dist/with-audit/attestation/active.d.ts +10 -0
  363. package/dist/with-audit/attestation/index.d.ts +16 -0
  364. package/dist/with-audit/attestation/issue.d.ts +29 -0
  365. package/dist/with-audit/attestation/revoke.d.ts +15 -0
  366. package/dist/with-audit/attestation/signer.d.ts +33 -0
  367. package/dist/with-audit/attestation/strategy.d.ts +44 -0
  368. package/dist/with-audit/attestation/vault-facade.d.ts +62 -0
  369. package/dist/with-audit/consent/active.d.ts +14 -0
  370. package/dist/with-audit/consent/consent.d.ts +114 -0
  371. package/dist/with-audit/consent/index.d.ts +14 -0
  372. package/dist/with-audit/consent/strategy.d.ts +36 -0
  373. package/dist/with-audit/forget/active.d.ts +31 -0
  374. package/dist/with-audit/forget/index.d.ts +28 -0
  375. package/dist/with-audit/forget/purge-scope.d.ts +54 -0
  376. package/dist/with-audit/forget/strategy.d.ts +199 -0
  377. package/dist/with-audit/forget/subject-index.d.ts +83 -0
  378. package/dist/with-audit/guards/executor.d.ts +26 -0
  379. package/dist/with-audit/guards/immutable-guard.d.ts +63 -0
  380. package/dist/with-audit/guards/index.d.ts +10 -0
  381. package/dist/with-audit/guards/read-only-facade.d.ts +31 -0
  382. package/dist/with-audit/guards/registry.d.ts +83 -0
  383. package/dist/with-audit/guards/transition-guard.d.ts +82 -0
  384. package/dist/with-audit/guards/types.d.ts +134 -0
  385. package/dist/with-audit/guards/with-guard.d.ts +15 -0
  386. package/dist/with-audit/periods/active.d.ts +11 -0
  387. package/dist/with-audit/periods/index.d.ts +18 -0
  388. package/dist/with-audit/periods/periods.d.ts +417 -0
  389. package/dist/with-audit/periods/strategy.d.ts +32 -0
  390. package/dist/with-audit/periods/vault-facade.d.ts +95 -0
  391. package/dist/with-audit/portability/active.d.ts +11 -0
  392. package/dist/with-audit/portability/export-accessible.d.ts +46 -0
  393. package/dist/with-audit/portability/index.d.ts +18 -0
  394. package/dist/with-audit/portability/request-withdrawal.d.ts +85 -0
  395. package/dist/with-audit/portability/strategy.d.ts +31 -0
  396. package/dist/with-audit/portability/withdraw-accessible.d.ts +82 -0
  397. package/dist/with-audit/sealed-record/active.d.ts +9 -0
  398. package/dist/with-audit/sealed-record/index.d.ts +55 -0
  399. package/dist/with-audit/sealed-record/strategy.d.ts +34 -0
  400. package/dist/with-audit/sealed-record/types.d.ts +27 -0
  401. package/dist/with-audit/tiers/active.d.ts +9 -0
  402. package/dist/with-audit/tiers/index.d.ts +394 -0
  403. package/dist/with-audit/tiers/strategy.d.ts +36 -0
  404. package/dist/with-cargo/active.d.ts +11 -0
  405. package/dist/with-cargo/adopt-partition.d.ts +81 -0
  406. package/dist/with-cargo/decrypt-partition.d.ts +19 -0
  407. package/dist/with-cargo/describe-extraction.d.ts +41 -0
  408. package/dist/with-cargo/extract-partition.d.ts +155 -0
  409. package/dist/with-cargo/index.d.ts +33 -0
  410. package/dist/with-cargo/strategy.d.ts +30 -0
  411. package/dist/with-cargo/vault-diff.d.ts +144 -0
  412. package/dist/with-cargo/walk-closure.d.ts +67 -0
  413. package/dist/with-commit/crdt/active.d.ts +25 -0
  414. package/dist/with-commit/crdt/crdt.d.ts +42 -0
  415. package/dist/with-commit/crdt/index.d.ts +16 -0
  416. package/dist/with-commit/crdt/strategy.d.ts +25 -0
  417. package/dist/with-commit/history/active.d.ts +40 -0
  418. package/dist/with-commit/history/diff.d.ts +23 -0
  419. package/dist/with-commit/history/history.d.ts +73 -0
  420. package/dist/with-commit/history/index.d.ts +30 -0
  421. package/dist/with-commit/history/ledger/constants.d.ts +37 -0
  422. package/dist/with-commit/history/ledger/entry.d.ts +195 -0
  423. package/dist/with-commit/history/ledger/hash.d.ts +30 -0
  424. package/dist/with-commit/history/ledger/index.d.ts +19 -0
  425. package/dist/with-commit/history/ledger/patch.d.ts +99 -0
  426. package/dist/with-commit/history/ledger/store.d.ts +356 -0
  427. package/dist/with-commit/history/strategy.d.ts +136 -0
  428. package/dist/with-commit/history/time-machine.d.ts +202 -0
  429. package/dist/with-commit/numbering/descriptor.d.ts +27 -0
  430. package/dist/with-commit/numbering/index.d.ts +69 -0
  431. package/dist/with-commit/sequence/active.d.ts +10 -0
  432. package/dist/with-commit/sequence/index.d.ts +150 -0
  433. package/dist/with-commit/sequence/strategy.d.ts +26 -0
  434. package/dist/with-commit/tx/active.d.ts +27 -0
  435. package/dist/with-commit/tx/dry-run.d.ts +29 -0
  436. package/dist/with-commit/tx/elevated-handle.d.ts +59 -0
  437. package/dist/with-commit/tx/index.d.ts +13 -0
  438. package/dist/with-commit/tx/invariants.d.ts +68 -0
  439. package/dist/with-commit/tx/strategy.d.ts +23 -0
  440. package/dist/with-commit/tx/transaction.d.ts +212 -0
  441. package/dist/with-fork/archive/engine.d.ts +71 -0
  442. package/dist/with-fork/archive/index.d.ts +23 -0
  443. package/dist/with-fork/shadow/active.d.ts +6 -0
  444. package/dist/with-fork/shadow/index.d.ts +14 -0
  445. package/dist/with-fork/shadow/strategy.d.ts +28 -0
  446. package/dist/with-fork/shadow/vault-frame.d.ts +93 -0
  447. package/dist/with-fork/snapshots/active.d.ts +20 -0
  448. package/dist/with-fork/snapshots/engine.d.ts +36 -0
  449. package/dist/with-fork/snapshots/index.d.ts +5 -0
  450. package/dist/with-fork/snapshots/noydb-facade.d.ts +64 -0
  451. package/dist/with-fork/snapshots/policy.d.ts +23 -0
  452. package/dist/with-fork/snapshots/scheduler.d.ts +34 -0
  453. package/dist/with-fork/snapshots/strategy.d.ts +48 -0
  454. package/dist/with-formula/computed/index.d.ts +48 -0
  455. package/dist/with-formula/computed/lazy.d.ts +13 -0
  456. package/dist/with-formula/derivations/executor.d.ts +61 -0
  457. package/dist/with-formula/derivations/fanout-sidecar.d.ts +75 -0
  458. package/dist/with-formula/derivations/index.d.ts +6 -0
  459. package/dist/with-formula/derivations/registry.d.ts +67 -0
  460. package/dist/with-formula/derivations/stale.d.ts +39 -0
  461. package/dist/with-formula/derivations/strategy-hash.d.ts +1 -0
  462. package/dist/with-formula/derivations/types.d.ts +248 -0
  463. package/dist/with-formula/derivations/with-derivation.d.ts +10 -0
  464. package/dist/with-formula/derivations/with-rollup.d.ts +34 -0
  465. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +73 -0
  466. package/dist/with-formula/materialized-views/executor.d.ts +80 -0
  467. package/dist/with-formula/materialized-views/index.d.ts +11 -0
  468. package/dist/with-formula/materialized-views/query-hash.d.ts +23 -0
  469. package/dist/with-formula/materialized-views/registry.d.ts +128 -0
  470. package/dist/with-formula/materialized-views/stale.d.ts +113 -0
  471. package/dist/with-formula/materialized-views/types.d.ts +399 -0
  472. package/dist/with-formula/materialized-views/with-materialized-view.d.ts +28 -0
  473. package/dist/with-formula/overlay-views/index.d.ts +5 -0
  474. package/dist/with-formula/overlay-views/registry.d.ts +42 -0
  475. package/dist/with-formula/overlay-views/types.d.ts +97 -0
  476. package/dist/with-formula/overlay-views/virtual-collection.d.ts +90 -0
  477. package/dist/with-formula/overlay-views/with-overlayed-view.d.ts +9 -0
  478. package/dist/with-lookup/aggregate/active.d.ts +33 -0
  479. package/dist/with-lookup/aggregate/aggregation.d.ts +166 -0
  480. package/dist/with-lookup/aggregate/canonical-key.d.ts +16 -0
  481. package/dist/with-lookup/aggregate/groupby.d.ts +280 -0
  482. package/dist/with-lookup/aggregate/index.d.ts +23 -0
  483. package/dist/with-lookup/aggregate/reducers.d.ts +257 -0
  484. package/dist/with-lookup/aggregate/strategy.d.ts +59 -0
  485. package/dist/with-lookup/embeddings/cosine.d.ts +2 -0
  486. package/dist/with-lookup/embeddings/descriptor.d.ts +8 -0
  487. package/dist/with-lookup/embeddings/index.d.ts +4 -0
  488. package/dist/with-lookup/embeddings/vec-id.d.ts +47 -0
  489. package/dist/with-lookup/embeddings/vector-set.d.ts +19 -0
  490. package/dist/with-lookup/indexing/active.d.ts +30 -0
  491. package/dist/with-lookup/indexing/collection-facade.d.ts +157 -0
  492. package/dist/with-lookup/indexing/eager-indexes.d.ts +122 -0
  493. package/dist/with-lookup/indexing/index.d.ts +27 -0
  494. package/dist/with-lookup/indexing/lazy-builder.d.ts +102 -0
  495. package/dist/with-lookup/indexing/persisted-indexes.d.ts +229 -0
  496. package/dist/with-lookup/indexing/strategy.d.ts +56 -0
  497. package/dist/with-lookup/indexing/unique-constraints.d.ts +74 -0
  498. package/dist/with-lookup/search/active.d.ts +10 -0
  499. package/dist/with-lookup/search/build-docs.d.ts +15 -0
  500. package/dist/with-lookup/search/collection-facade.d.ts +163 -0
  501. package/dist/with-lookup/search/fuse.d.ts +22 -0
  502. package/dist/with-lookup/search/index-store.d.ts +19 -0
  503. package/dist/with-lookup/search/index.d.ts +19 -0
  504. package/dist/with-lookup/search/inverted-index.d.ts +47 -0
  505. package/dist/with-lookup/search/persisted-index-store.d.ts +121 -0
  506. package/dist/with-lookup/search/retrieve-types.d.ts +29 -0
  507. package/dist/with-lookup/search/scan.d.ts +28 -0
  508. package/dist/with-lookup/search/segment.d.ts +15 -0
  509. package/dist/with-lookup/search/serialize.d.ts +4 -0
  510. package/dist/with-lookup/search/snippet.d.ts +5 -0
  511. package/dist/with-lookup/search/strategy.d.ts +41 -0
  512. package/dist/with-lookup/search/tokenize.d.ts +12 -0
  513. package/dist/with-party/auth-introspection/index.d.ts +44 -0
  514. package/dist/with-party/broker/active.d.ts +23 -0
  515. package/dist/with-party/broker/index.d.ts +28 -0
  516. package/dist/with-party/broker/seed.d.ts +77 -0
  517. package/dist/with-party/custody/active.d.ts +10 -0
  518. package/dist/with-party/custody/index.d.ts +69 -0
  519. package/dist/with-party/custody/liberate.d.ts +64 -0
  520. package/dist/with-party/custody/strategy.d.ts +48 -0
  521. package/dist/with-party/directory/cover/custom.d.ts +34 -0
  522. package/dist/with-party/directory/cover/index.d.ts +19 -0
  523. package/dist/with-party/directory/cover/schema.d.ts +39 -0
  524. package/dist/with-party/directory/cover/storage.d.ts +71 -0
  525. package/dist/with-party/directory/cover/types.d.ts +149 -0
  526. package/dist/with-party/directory/index.d.ts +11 -0
  527. package/dist/with-party/directory/storage.d.ts +33 -0
  528. package/dist/with-party/directory/types.d.ts +43 -0
  529. package/dist/with-party/directory/user-envelope/api.d.ts +201 -0
  530. package/dist/with-party/directory/user-envelope/index.d.ts +12 -0
  531. package/dist/with-party/directory/user-envelope/storage.d.ts +54 -0
  532. package/dist/with-party/directory/visibility.d.ts +47 -0
  533. package/dist/with-party/policy/engine.d.ts +60 -0
  534. package/dist/with-party/policy/index.d.ts +15 -0
  535. package/dist/with-party/policy/noydb-facade.d.ts +39 -0
  536. package/dist/with-party/policy/presets.d.ts +38 -0
  537. package/dist/with-party/policy/storage.d.ts +31 -0
  538. package/dist/with-party/session/active.d.ts +34 -0
  539. package/dist/with-party/session/dev-unlock.d.ts +128 -0
  540. package/dist/with-party/session/index.d.ts +23 -0
  541. package/dist/with-party/session/session-policy.d.ts +92 -0
  542. package/dist/with-party/session/session.d.ts +131 -0
  543. package/dist/with-party/session/strategy.d.ts +42 -0
  544. package/dist/with-party/session/unlock-state.d.ts +47 -0
  545. package/dist/with-party/sync/index.d.ts +31 -0
  546. package/dist/with-party/tab-coordination.d.ts +73 -0
  547. package/dist/with-party/tab-write-relay.d.ts +39 -0
  548. package/dist/with-party/team/active.d.ts +13 -0
  549. package/dist/with-party/team/authenticators.d.ts +95 -0
  550. package/dist/with-party/team/deed.d.ts +97 -0
  551. package/dist/with-party/team/delegation.d.ts +88 -0
  552. package/dist/with-party/team/index.d.ts +38 -0
  553. package/dist/with-party/team/keyring.d.ts +318 -0
  554. package/dist/with-party/team/magic-link-grant.d.ts +152 -0
  555. package/dist/with-party/team/managed-passphrase.d.ts +280 -0
  556. package/dist/with-party/team/noydb-facade.d.ts +484 -0
  557. package/dist/with-party/team/peer-recover.d.ts +81 -0
  558. package/dist/with-party/team/presence.d.ts +81 -0
  559. package/dist/with-party/team/recovery.d.ts +191 -0
  560. package/dist/with-party/team/reserved-secret-collections.d.ts +41 -0
  561. package/dist/with-party/team/rotate-recover.d.ts +275 -0
  562. package/dist/with-party/team/shamir-recovery-provider.d.ts +15 -0
  563. package/dist/with-party/team/strategy.d.ts +9 -0
  564. package/dist/with-party/team/sync-active.d.ts +33 -0
  565. package/dist/with-party/team/sync-credentials.d.ts +113 -0
  566. package/dist/with-party/team/sync-strategy.d.ts +67 -0
  567. package/dist/with-party/team/sync-transaction.d.ts +39 -0
  568. package/dist/with-party/team/sync.d.ts +174 -0
  569. package/dist/with-party/team/tiers.d.ts +39 -0
  570. package/dist/with-party/team/wrapped-deks.d.ts +86 -0
  571. package/dist/with-pod/backup.d.ts +74 -0
  572. package/dist/with-pod/bundle.d.ts +416 -0
  573. package/dist/with-pod/format.d.ts +207 -0
  574. package/dist/with-pod/index.d.ts +21 -0
  575. package/dist/with-pod/pod-store.d.ts +54 -0
  576. package/dist/with-pod/ulid.d.ts +64 -0
  577. package/dist/with-shape/blobs/blob-compaction.d.ts +170 -0
  578. package/dist/with-shape/blobs/blob-intent.d.ts +153 -0
  579. package/dist/with-shape/blobs/blob-set.d.ts +1286 -0
  580. package/dist/with-shape/blobs/export-blobs.d.ts +110 -0
  581. package/dist/with-shape/blobs/import-external.d.ts +50 -0
  582. package/dist/with-shape/blobs/mime-magic.d.ts +48 -0
  583. package/dist/with-shape/blobs/object-projection.d.ts +70 -0
  584. package/dist/with-shape/introspection/describe.d.ts +237 -0
  585. package/dist/with-shape/introspection/field-meta.d.ts +61 -0
  586. package/dist/with-shape/introspection/fields.d.ts +14 -0
  587. package/dist/with-shape/introspection/index.d.ts +12 -0
  588. package/dist/with-shape/introspection/json-schema.d.ts +13 -0
  589. package/dist/with-shape/introspection/meta.d.ts +22 -0
  590. package/dist/with-shape/introspection/projection.d.ts +13 -0
  591. package/dist/with-shape/introspection/types.d.ts +154 -0
  592. package/dist/with-shape/introspection/walk.d.ts +50 -0
  593. package/dist/with-shape/links/lazy-handle.d.ts +36 -0
  594. package/dist/with-shape/links/link-set.d.ts +67 -0
  595. package/dist/with-shape/links/names.d.ts +65 -0
  596. package/dist/with-shape/links/vault-facade.d.ts +211 -0
  597. package/dist/with-shape/persisted-schemas/canonicalize.d.ts +11 -0
  598. package/dist/with-shape/persisted-schemas/derive.d.ts +29 -0
  599. package/dist/with-shape/persisted-schemas/index.d.ts +21 -0
  600. package/dist/with-shape/persisted-schemas/register.d.ts +66 -0
  601. package/dist/with-shape/persisted-schemas/storage.d.ts +61 -0
  602. package/dist/with-shape/persisted-schemas/types.d.ts +54 -0
  603. package/dist/with-shape/satellites/dead-filter.d.ts +21 -0
  604. package/dist/with-shape/satellites/declare.d.ts +60 -0
  605. package/dist/with-shape/satellites/existence.d.ts +5 -0
  606. package/dist/with-shape/satellites/fanout.d.ts +38 -0
  607. package/dist/with-shape/satellites/forget.d.ts +47 -0
  608. package/dist/with-shape/satellites/index.d.ts +3 -0
  609. package/dist/with-shape/satellites/joined.d.ts +19 -0
  610. package/dist/with-shape/satellites/marker.d.ts +10 -0
  611. package/dist/with-shape/satellites/migrate-cek.d.ts +26 -0
  612. package/dist/with-shape/satellites/post-register.d.ts +6 -0
  613. package/dist/with-shape/satellites/proxy.d.ts +37 -0
  614. package/dist/with-shape/satellites/raw-target.d.ts +14 -0
  615. package/dist/with-shape/satellites/registry.d.ts +19 -0
  616. package/dist/with-shape/satellites/types.d.ts +37 -0
  617. package/dist/with-shape/satellites/validate.d.ts +17 -0
  618. package/dist/with-shape/schema-update/client-registry.d.ts +35 -0
  619. package/dist/with-shape/schema-update/cutover.d.ts +5 -0
  620. package/dist/with-shape/schema-update/delta.d.ts +2 -0
  621. package/dist/with-shape/schema-update/dispatch.d.ts +3 -0
  622. package/dist/with-shape/schema-update/fence-controller.d.ts +62 -0
  623. package/dist/with-shape/schema-update/fence-watcher.d.ts +37 -0
  624. package/dist/with-shape/schema-update/fence.d.ts +15 -0
  625. package/dist/with-shape/schema-update/gate.d.ts +16 -0
  626. package/dist/with-shape/schema-update/index.d.ts +6 -0
  627. package/dist/with-shape/schema-update/store-coordination-provider.d.ts +29 -0
  628. package/dist/with-shape/schema-update/strategies.d.ts +12 -0
  629. package/dist/with-shape/schema-update/types.d.ts +53 -0
  630. package/dist/with-store/index.d.ts +15 -0
  631. package/dist/with-store/lazy/active.d.ts +12 -0
  632. package/dist/with-store/lazy/index.d.ts +14 -0
  633. package/dist/with-store/lazy/strategy.d.ts +9 -0
  634. package/dist/with-store/route-store.d.ts +259 -0
  635. package/dist/with-store/store-middleware.d.ts +189 -0
  636. package/dist/withdraw-accessible-TZDATQVR.js +28 -0
  637. package/package.json +47 -55
  638. package/dist/adapter/index.d.ts +0 -4
  639. package/dist/adapter/index.js +0 -15
  640. package/dist/aggregate/index.d.ts +0 -41
  641. package/dist/api-HV4PDUWF.js +0 -20
  642. package/dist/as/index.d.ts +0 -6
  643. package/dist/at/index.d.ts +0 -4
  644. package/dist/attestation/index.d.ts +0 -19
  645. package/dist/backup-ODXO7OGA.js +0 -225
  646. package/dist/backup-ODXO7OGA.js.map +0 -1
  647. package/dist/blobs/index.d.ts +0 -43
  648. package/dist/bundle/index.d.ts +0 -121
  649. package/dist/bundle-DlSxo31R.d.ts +0 -548
  650. package/dist/by/index.d.ts +0 -1
  651. package/dist/cargo/index.d.ts +0 -8
  652. package/dist/chunk-2644KEGW.js +0 -247
  653. package/dist/chunk-2644KEGW.js.map +0 -1
  654. package/dist/chunk-2HVUKRNE.js +0 -21
  655. package/dist/chunk-2KOSJTMU.js +0 -69
  656. package/dist/chunk-2UQ4RMHV.js +0 -167
  657. package/dist/chunk-2UQ4RMHV.js.map +0 -1
  658. package/dist/chunk-2XE6LIXT.js +0 -515
  659. package/dist/chunk-2XE6LIXT.js.map +0 -1
  660. package/dist/chunk-34RRRIC3.js +0 -71
  661. package/dist/chunk-3C5CKXFI.js +0 -621
  662. package/dist/chunk-3C5CKXFI.js.map +0 -1
  663. package/dist/chunk-3I4KYWNP.js +0 -30
  664. package/dist/chunk-42KVY3OC.js +0 -86
  665. package/dist/chunk-4C4WBS4V.js +0 -13822
  666. package/dist/chunk-4C4WBS4V.js.map +0 -1
  667. package/dist/chunk-4G3IT7J7.js +0 -280
  668. package/dist/chunk-4G3IT7J7.js.map +0 -1
  669. package/dist/chunk-4RQ62VSR.js +0 -53
  670. package/dist/chunk-4RQ62VSR.js.map +0 -1
  671. package/dist/chunk-4ZSGSRBI.js +0 -1221
  672. package/dist/chunk-4ZSGSRBI.js.map +0 -1
  673. package/dist/chunk-5GAX2QOH.js +0 -132
  674. package/dist/chunk-5GAX2QOH.js.map +0 -1
  675. package/dist/chunk-5SAZMBW7.js +0 -202
  676. package/dist/chunk-5TZZUL5X.js +0 -30
  677. package/dist/chunk-6CU3FN74.js +0 -777
  678. package/dist/chunk-6G2SCQYS.js +0 -29
  679. package/dist/chunk-6G2SCQYS.js.map +0 -1
  680. package/dist/chunk-6MWUANRF.js +0 -29
  681. package/dist/chunk-6S7T6WC4.js +0 -111
  682. package/dist/chunk-6S7T6WC4.js.map +0 -1
  683. package/dist/chunk-6ULCYCMU.js +0 -74
  684. package/dist/chunk-7HAPHVRJ.js +0 -1695
  685. package/dist/chunk-7HAPHVRJ.js.map +0 -1
  686. package/dist/chunk-7IZQTCTR.js +0 -382
  687. package/dist/chunk-7ZANJ6JZ.js +0 -265
  688. package/dist/chunk-7ZANJ6JZ.js.map +0 -1
  689. package/dist/chunk-A2APWS32.js +0 -150
  690. package/dist/chunk-A2APWS32.js.map +0 -1
  691. package/dist/chunk-A4MAD6PO.js +0 -99
  692. package/dist/chunk-ANDBBA2P.js +0 -36
  693. package/dist/chunk-ANDBBA2P.js.map +0 -1
  694. package/dist/chunk-AUR7MRHA.js +0 -404
  695. package/dist/chunk-AYGZMQP5.js +0 -75
  696. package/dist/chunk-BGIZAFY7.js +0 -1
  697. package/dist/chunk-CJEMA2Z6.js +0 -230
  698. package/dist/chunk-CTSFKDGA.js +0 -40
  699. package/dist/chunk-CU62BBRB.js +0 -1465
  700. package/dist/chunk-CU62BBRB.js.map +0 -1
  701. package/dist/chunk-CWCCYH34.js +0 -23
  702. package/dist/chunk-DEYAO3N6.js +0 -589
  703. package/dist/chunk-DFIBOSOQ.js +0 -85
  704. package/dist/chunk-E5AHO65E.js +0 -150
  705. package/dist/chunk-FC3XK5JT.js +0 -99
  706. package/dist/chunk-FGOGS7CE.js +0 -662
  707. package/dist/chunk-FGOGS7CE.js.map +0 -1
  708. package/dist/chunk-GX2BYNCT.js +0 -117
  709. package/dist/chunk-GZ2MOPVX.js +0 -291
  710. package/dist/chunk-GZ2MOPVX.js.map +0 -1
  711. package/dist/chunk-H57P2SJB.js +0 -126
  712. package/dist/chunk-H57P2SJB.js.map +0 -1
  713. package/dist/chunk-HBTT7YQX.js +0 -94
  714. package/dist/chunk-HOCEGVGQ.js +0 -36
  715. package/dist/chunk-ICV32FPK.js +0 -50
  716. package/dist/chunk-IIP5WFVT.js +0 -462
  717. package/dist/chunk-IIP5WFVT.js.map +0 -1
  718. package/dist/chunk-IUKGIB2Q.js +0 -91
  719. package/dist/chunk-IWTYFS3D.js +0 -129
  720. package/dist/chunk-JC5R7P44.js +0 -355
  721. package/dist/chunk-JC5R7P44.js.map +0 -1
  722. package/dist/chunk-K2WCO3NX.js +0 -1
  723. package/dist/chunk-KBBWY46Y.js +0 -14
  724. package/dist/chunk-KBF5GSGX.js +0 -367
  725. package/dist/chunk-KCG3BHFG.js +0 -99
  726. package/dist/chunk-KCG3BHFG.js.map +0 -1
  727. package/dist/chunk-KNXN47MO.js +0 -155
  728. package/dist/chunk-KNXN47MO.js.map +0 -1
  729. package/dist/chunk-KWLD2D75.js +0 -38
  730. package/dist/chunk-KXKLKJW4.js +0 -49
  731. package/dist/chunk-KYC4LIEU.js +0 -123
  732. package/dist/chunk-LEOXZY36.js +0 -130
  733. package/dist/chunk-M5I354EE.js +0 -235
  734. package/dist/chunk-MK2BSS44.js +0 -34
  735. package/dist/chunk-MSVY7ULZ.js +0 -70
  736. package/dist/chunk-NNWK3PSY.js +0 -135
  737. package/dist/chunk-NSZ6J5DF.js +0 -59
  738. package/dist/chunk-NUEFXLZU.js +0 -59
  739. package/dist/chunk-NYVQCZ54.js +0 -261
  740. package/dist/chunk-OQAODTYR.js +0 -45
  741. package/dist/chunk-OV4CMJGR.js +0 -164
  742. package/dist/chunk-PEDZFFKW.js +0 -41
  743. package/dist/chunk-PF3FQCCF.js +0 -164
  744. package/dist/chunk-PF3FQCCF.js.map +0 -1
  745. package/dist/chunk-Q2KVKTC2.js +0 -823
  746. package/dist/chunk-Q2KVKTC2.js.map +0 -1
  747. package/dist/chunk-QJR3W3MF.js +0 -23
  748. package/dist/chunk-QJR3W3MF.js.map +0 -1
  749. package/dist/chunk-QTXQ6RNZ.js +0 -255
  750. package/dist/chunk-RJ5522XX.js +0 -453
  751. package/dist/chunk-RJ5522XX.js.map +0 -1
  752. package/dist/chunk-RMUXPHIH.js +0 -930
  753. package/dist/chunk-RMUXPHIH.js.map +0 -1
  754. package/dist/chunk-S6AQXDN4.js +0 -155
  755. package/dist/chunk-SSFC3IYA.js +0 -275
  756. package/dist/chunk-SSFC3IYA.js.map +0 -1
  757. package/dist/chunk-SZCHEDML.js +0 -209
  758. package/dist/chunk-TDPEJINP.js +0 -188
  759. package/dist/chunk-TDPEJINP.js.map +0 -1
  760. package/dist/chunk-TQ3REHVF.js +0 -95
  761. package/dist/chunk-TQ3REHVF.js.map +0 -1
  762. package/dist/chunk-UNJU345Q.js +0 -32
  763. package/dist/chunk-UNJU345Q.js.map +0 -1
  764. package/dist/chunk-V7RNIND6.js +0 -265
  765. package/dist/chunk-V7RNIND6.js.map +0 -1
  766. package/dist/chunk-VJ3NQK4K.js +0 -205
  767. package/dist/chunk-WNA6T3MA.js +0 -686
  768. package/dist/chunk-WNA6T3MA.js.map +0 -1
  769. package/dist/chunk-WVCQ75OK.js +0 -124
  770. package/dist/chunk-WXSYDNBT.js +0 -39
  771. package/dist/chunk-WXSYDNBT.js.map +0 -1
  772. package/dist/chunk-X66MXMR5.js +0 -42
  773. package/dist/chunk-XHD3L3JO.js +0 -930
  774. package/dist/chunk-XHD3L3JO.js.map +0 -1
  775. package/dist/chunk-XJK2WIYN.js +0 -430
  776. package/dist/chunk-XJK2WIYN.js.map +0 -1
  777. package/dist/chunk-XQ7UYPVN.js +0 -95
  778. package/dist/chunk-Y2OCKFZ3.js +0 -80
  779. package/dist/chunk-YBFOBRTO.js +0 -367
  780. package/dist/chunk-YLN33ADH.js +0 -97
  781. package/dist/chunk-YLN33ADH.js.map +0 -1
  782. package/dist/chunk-Z5YFRMG5.js +0 -45
  783. package/dist/chunk-ZWQFOXBR.js +0 -54
  784. package/dist/classified/index.d.ts +0 -16
  785. package/dist/classified-marker-IO5EBW7Q.js +0 -24
  786. package/dist/classified-marker-IO5EBW7Q.js.map +0 -1
  787. package/dist/collection-facade-3RAXG2OU.js +0 -38
  788. package/dist/computed-R62HGCO4.js +0 -11
  789. package/dist/consent/index.d.ts +0 -22
  790. package/dist/crdt/index.d.ts +0 -33
  791. package/dist/dead-filter-VNA4M3GP.js +0 -28
  792. package/dist/decrypt-partition-IHtxEnTi.d.ts +0 -21
  793. package/dist/delegation-ZKII5UBI.js +0 -25
  794. package/dist/derivations/index.d.ts +0 -69
  795. package/dist/derive-5D2C3WG4.js +0 -21
  796. package/dist/describe/index.d.ts +0 -4
  797. package/dist/describe/index.js +0 -1
  798. package/dist/dev-unlock-DDTafVO6.d.ts +0 -263
  799. package/dist/discriminant-BN9REW3o.d.ts +0 -60
  800. package/dist/enclave-EUBEJGPG.js +0 -125
  801. package/dist/executor-IL7SRNUZ.js +0 -23
  802. package/dist/executor-OUA2Y6YC.js +0 -9
  803. package/dist/executor-WAEI6PDV.js +0 -9
  804. package/dist/export-accessible-O55RKAGC.js +0 -23
  805. package/dist/extract-partition-VBGCBA6Q.js +0 -36
  806. package/dist/fanout-sidecar-CI5BCMQM.js +0 -74
  807. package/dist/find-FISGUWSK.js +0 -11
  808. package/dist/forget/index.d.ts +0 -36
  809. package/dist/guards/index.d.ts +0 -34
  810. package/dist/hash-DBkZfIBW.d.ts +0 -72
  811. package/dist/history/index.d.ts +0 -60
  812. package/dist/i18n/index.d.ts +0 -56
  813. package/dist/in/index.d.ts +0 -4
  814. package/dist/index-B9QdHytu.d.ts +0 -123
  815. package/dist/index-CyclmyDr.d.ts +0 -122
  816. package/dist/index-DzhNI2vE.d.ts +0 -23260
  817. package/dist/indexing/index.d.ts +0 -38
  818. package/dist/issue-EQAWIYFQ.js +0 -19
  819. package/dist/kernel/index.d.ts +0 -31
  820. package/dist/kernel/index.js +0 -60
  821. package/dist/lazy/index.d.ts +0 -20
  822. package/dist/ledger-AJA2SR3C.js +0 -42
  823. package/dist/liberate-SEGR4JLY.js +0 -24
  824. package/dist/link-set-YBAC2DQT.js +0 -31
  825. package/dist/materialized-views/index.d.ts +0 -182
  826. package/dist/mime-magic-CbV1quyp.d.ts +0 -103
  827. package/dist/noydb-AMEOU456.js +0 -65
  828. package/dist/on/index.d.ts +0 -4
  829. package/dist/overlay-views/index.d.ts +0 -97
  830. package/dist/periods/index.d.ts +0 -19
  831. package/dist/pod/index.d.ts +0 -62
  832. package/dist/policy-SDGRWVIL.js +0 -41
  833. package/dist/portability/index.d.ts +0 -19
  834. package/dist/post-register-MROIUA5O.js +0 -55
  835. package/dist/post-register-MROIUA5O.js.map +0 -1
  836. package/dist/public-envelope-J5PLQOW2.js +0 -32
  837. package/dist/query/index.d.ts +0 -4
  838. package/dist/read-only-facade-UCYNRE56.js +0 -8
  839. package/dist/register-OVJKW7BS.js +0 -23
  840. package/dist/registry-5RJSK5AJ.js +0 -9
  841. package/dist/registry-DQRNTWRL.js +0 -18
  842. package/dist/registry-LTGLERS7.js +0 -19
  843. package/dist/request-withdrawal-27O77D2V.js +0 -31
  844. package/dist/reveal-LT3I2K4P.js +0 -38
  845. package/dist/reveal-LT3I2K4P.js.map +0 -1
  846. package/dist/revoke-4N45G7D2.js +0 -24
  847. package/dist/revoke-4N45G7D2.js.map +0 -1
  848. package/dist/satellites/index.d.ts +0 -4
  849. package/dist/sealed-record/index.d.ts +0 -68
  850. package/dist/session/index.d.ts +0 -43
  851. package/dist/shadow/index.d.ts +0 -14
  852. package/dist/signer-XJCOV7JD.js +0 -25
  853. package/dist/signer-XJCOV7JD.js.map +0 -1
  854. package/dist/snapshots/index.d.ts +0 -25
  855. package/dist/stale-IYYXEH3U.js +0 -14
  856. package/dist/stale-IYYXEH3U.js.map +0 -1
  857. package/dist/storage-Y44CAPE6.js +0 -23
  858. package/dist/storage-Y44CAPE6.js.map +0 -1
  859. package/dist/store-coordination-provider-WKGAE2WI.js +0 -142
  860. package/dist/subject-index-CyOgGMJL.d.ts +0 -380
  861. package/dist/sync/index.d.ts +0 -40
  862. package/dist/team/index.d.ts +0 -154
  863. package/dist/tiers/index.d.ts +0 -4
  864. package/dist/to/index.d.ts +0 -4
  865. package/dist/transition-guard-BOUkzQU4.d.ts +0 -165
  866. package/dist/tx/index.d.ts +0 -34
  867. package/dist/ui/index.d.ts +0 -4
  868. package/dist/ulid-DRH25k3y.d.ts +0 -66
  869. package/dist/util/index.d.ts +0 -79
  870. package/dist/validators-B3SalxlJ.d.ts +0 -101
  871. package/dist/vault-diff-Dt9NkLzw.d.ts +0 -147
  872. package/dist/verify-GH6CWVSW.js +0 -139
  873. package/dist/verify-GH6CWVSW.js.map +0 -1
  874. package/dist/walk-76UCFXYV.js +0 -241
  875. package/dist/with/index.d.ts +0 -37
  876. package/dist/with-materialized-view-BP33v1Z6.d.ts +0 -27
  877. package/dist/with-overlayed-view-DntFpOKN.d.ts +0 -12
  878. package/dist/with-rollup-ClCHO6-4.d.ts +0 -47
  879. package/dist/withdraw-accessible-6J2UH3IN.js +0 -28
  880. package/dist/withdraw-accessible-6J2UH3IN.js.map +0 -1
  881. /package/dist/{adapter/index.js.map → api-3A3S4SHH.js.map} +0 -0
  882. /package/dist/{chunk-ICV32FPK.js.map → chunk-2PCAVW2I.js.map} +0 -0
  883. /package/dist/{chunk-6CU3FN74.js.map → chunk-554KLAAN.js.map} +0 -0
  884. /package/dist/{chunk-NNWK3PSY.js.map → chunk-5PFOMHTB.js.map} +0 -0
  885. /package/dist/{chunk-SZCHEDML.js.map → chunk-5WZXVULX.js.map} +0 -0
  886. /package/dist/{chunk-KWLD2D75.js.map → chunk-6HPG2YNX.js.map} +0 -0
  887. /package/dist/{chunk-2KOSJTMU.js.map → chunk-6HY2X62D.js.map} +0 -0
  888. /package/dist/{chunk-KYC4LIEU.js.map → chunk-6NQMXTYC.js.map} +0 -0
  889. /package/dist/{chunk-KBF5GSGX.js.map → chunk-6XE5TMPR.js.map} +0 -0
  890. /package/dist/{chunk-Z5YFRMG5.js.map → chunk-A4FXFAKF.js.map} +0 -0
  891. /package/dist/{chunk-VJ3NQK4K.js.map → chunk-ANATMTOA.js.map} +0 -0
  892. /package/dist/{chunk-HBTT7YQX.js.map → chunk-BOKIKJJB.js.map} +0 -0
  893. /package/dist/{chunk-KXKLKJW4.js.map → chunk-CJ5KKU6X.js.map} +0 -0
  894. /package/dist/{chunk-5SAZMBW7.js.map → chunk-DSBQODMZ.js.map} +0 -0
  895. /package/dist/{chunk-7IZQTCTR.js.map → chunk-EO43ANYJ.js.map} +0 -0
  896. /package/dist/{chunk-QTXQ6RNZ.js.map → chunk-EWPOHMN2.js.map} +0 -0
  897. /package/dist/{chunk-34RRRIC3.js.map → chunk-GWKAVKHI.js.map} +0 -0
  898. /package/dist/{chunk-OV4CMJGR.js.map → chunk-H2KSZMIX.js.map} +0 -0
  899. /package/dist/{chunk-AUR7MRHA.js.map → chunk-HOONYZY2.js.map} +0 -0
  900. /package/dist/{chunk-ZWQFOXBR.js.map → chunk-ISMV2QVG.js.map} +0 -0
  901. /package/dist/{chunk-XQ7UYPVN.js.map → chunk-IY23KFNZ.js.map} +0 -0
  902. /package/dist/{chunk-IWTYFS3D.js.map → chunk-JBBSYJHP.js.map} +0 -0
  903. /package/dist/{chunk-GX2BYNCT.js.map → chunk-JFCV5QIK.js.map} +0 -0
  904. /package/dist/{chunk-5TZZUL5X.js.map → chunk-M75ZZHSR.js.map} +0 -0
  905. /package/dist/{chunk-6MWUANRF.js.map → chunk-N6WF5PKC.js.map} +0 -0
  906. /package/dist/{chunk-E5AHO65E.js.map → chunk-NCCBLYEB.js.map} +0 -0
  907. /package/dist/{chunk-A4MAD6PO.js.map → chunk-OCVM6KDH.js.map} +0 -0
  908. /package/dist/{chunk-Y2OCKFZ3.js.map → chunk-ONTBCHCP.js.map} +0 -0
  909. /package/dist/{chunk-LEOXZY36.js.map → chunk-R3BLCFD2.js.map} +0 -0
  910. /package/dist/{chunk-2HVUKRNE.js.map → chunk-RDXW3OBQ.js.map} +0 -0
  911. /package/dist/{chunk-CJEMA2Z6.js.map → chunk-RFI7GGFO.js.map} +0 -0
  912. /package/dist/{chunk-AYGZMQP5.js.map → chunk-RNG4VRP4.js.map} +0 -0
  913. /package/dist/{chunk-PEDZFFKW.js.map → chunk-RTEK4C4I.js.map} +0 -0
  914. /package/dist/{chunk-3I4KYWNP.js.map → chunk-S6Q37VGE.js.map} +0 -0
  915. /package/dist/{chunk-42KVY3OC.js.map → chunk-SV6EAJEP.js.map} +0 -0
  916. /package/dist/{chunk-YBFOBRTO.js.map → chunk-T3GY65MA.js.map} +0 -0
  917. /package/dist/{chunk-KBBWY46Y.js.map → chunk-TIGPQDYP.js.map} +0 -0
  918. /package/dist/{chunk-NYVQCZ54.js.map → chunk-U6JMEH2P.js.map} +0 -0
  919. /package/dist/{chunk-MK2BSS44.js.map → chunk-UC2ETWF3.js.map} +0 -0
  920. /package/dist/{chunk-M5I354EE.js.map → chunk-UDSR4X4L.js.map} +0 -0
  921. /package/dist/{chunk-6ULCYCMU.js.map → chunk-VAIS3SOM.js.map} +0 -0
  922. /package/dist/{chunk-WVCQ75OK.js.map → chunk-VCBHAE4R.js.map} +0 -0
  923. /package/dist/{chunk-DEYAO3N6.js.map → chunk-VKCADNMR.js.map} +0 -0
  924. /package/dist/{chunk-OQAODTYR.js.map → chunk-WKGF2TJR.js.map} +0 -0
  925. /package/dist/{chunk-HOCEGVGQ.js.map → chunk-WNGGJWF7.js.map} +0 -0
  926. /package/dist/{chunk-NSZ6J5DF.js.map → chunk-WOM2HTML.js.map} +0 -0
  927. /package/dist/{chunk-MSVY7ULZ.js.map → chunk-WQIYTNJV.js.map} +0 -0
  928. /package/dist/{chunk-NUEFXLZU.js.map → chunk-WZSHL6DQ.js.map} +0 -0
  929. /package/dist/{chunk-X66MXMR5.js.map → chunk-XDIAFPUM.js.map} +0 -0
  930. /package/dist/{chunk-CTSFKDGA.js.map → chunk-XJMBYYQK.js.map} +0 -0
  931. /package/dist/{chunk-IUKGIB2Q.js.map → chunk-XTHCN77N.js.map} +0 -0
  932. /package/dist/{chunk-FC3XK5JT.js.map → chunk-YCH5GBN6.js.map} +0 -0
  933. /package/dist/{chunk-S6AQXDN4.js.map → chunk-YTGDPCPW.js.map} +0 -0
  934. /package/dist/{chunk-CWCCYH34.js.map → chunk-YZQOGE2L.js.map} +0 -0
  935. /package/dist/{chunk-DFIBOSOQ.js.map → chunk-ZXEZCY6F.js.map} +0 -0
  936. /package/dist/{api-HV4PDUWF.js.map → collection-facade-KMBWNCYP.js.map} +0 -0
  937. /package/dist/{chunk-BGIZAFY7.js.map → computed-DSMPXG2Y.js.map} +0 -0
  938. /package/dist/{chunk-K2WCO3NX.js.map → cover-QJRXINN5.js.map} +0 -0
  939. /package/dist/{dead-filter-VNA4M3GP.js.map → dead-filter-66VGI6JV.js.map} +0 -0
  940. /package/dist/{collection-facade-3RAXG2OU.js.map → delegation-SU6CV3W7.js.map} +0 -0
  941. /package/dist/{computed-R62HGCO4.js.map → derive-6RWU4EOA.js.map} +0 -0
  942. /package/dist/{delegation-ZKII5UBI.js.map → enclave-TKPN2G2U.js.map} +0 -0
  943. /package/dist/{derive-5D2C3WG4.js.map → executor-KGNLJD6M.js.map} +0 -0
  944. /package/dist/{describe/index.js.map → executor-UX4FASYZ.js.map} +0 -0
  945. /package/dist/{enclave-EUBEJGPG.js.map → executor-XGIS6CR7.js.map} +0 -0
  946. /package/dist/{executor-IL7SRNUZ.js.map → export-accessible-LKW3QV22.js.map} +0 -0
  947. /package/dist/{executor-OUA2Y6YC.js.map → extract-partition-UP2ARO75.js.map} +0 -0
  948. /package/dist/{fanout-sidecar-CI5BCMQM.js.map → fanout-sidecar-B5LVUMQX.js.map} +0 -0
  949. /package/dist/{executor-WAEI6PDV.js.map → find-YS6XWB46.js.map} +0 -0
  950. /package/dist/{export-accessible-O55RKAGC.js.map → issue-3ACYX7LO.js.map} +0 -0
  951. /package/dist/{extract-partition-VBGCBA6Q.js.map → ledger-PTK7XZYT.js.map} +0 -0
  952. /package/dist/{find-FISGUWSK.js.map → liberate-MQQXBUCY.js.map} +0 -0
  953. /package/dist/{issue-EQAWIYFQ.js.map → link-set-SLJHDNRB.js.map} +0 -0
  954. /package/dist/{kernel/index.js.map → noydb-ANIW5FLE.js.map} +0 -0
  955. /package/dist/{ledger-AJA2SR3C.js.map → policy-YDLCOX4P.js.map} +0 -0
  956. /package/dist/{liberate-SEGR4JLY.js.map → read-only-facade-CHCKSEPD.js.map} +0 -0
  957. /package/dist/{link-set-YBAC2DQT.js.map → register-PAM3ASRZ.js.map} +0 -0
  958. /package/dist/{noydb-AMEOU456.js.map → registry-4S2U2TR4.js.map} +0 -0
  959. /package/dist/{policy-SDGRWVIL.js.map → registry-NPOWJHC4.js.map} +0 -0
  960. /package/dist/{public-envelope-J5PLQOW2.js.map → registry-VZ3CCI2R.js.map} +0 -0
  961. /package/dist/{read-only-facade-UCYNRE56.js.map → request-withdrawal-DI3H5WUI.js.map} +0 -0
  962. /package/dist/{register-OVJKW7BS.js.map → revoke-R5CZSVUT.js.map} +0 -0
  963. /package/dist/{registry-5RJSK5AJ.js.map → signer-MBVHW4WE.js.map} +0 -0
  964. /package/dist/{registry-DQRNTWRL.js.map → stale-VZL4OGUB.js.map} +0 -0
  965. /package/dist/{registry-LTGLERS7.js.map → storage-3MEJUENZ.js.map} +0 -0
  966. /package/dist/{store-coordination-provider-WKGAE2WI.js.map → store-coordination-provider-FKX3F6TQ.js.map} +0 -0
  967. /package/dist/{walk-76UCFXYV.js.map → walk-IPLXE36W.js.map} +0 -0
  968. /package/dist/{request-withdrawal-27O77D2V.js.map → withdraw-accessible-TZDATQVR.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-lookup/embeddings/cosine.ts","../src/with-lookup/embeddings/descriptor.ts","../src/with-lookup/embeddings/vector-set.ts","../src/with-lookup/embeddings/vec-id.ts","../src/with-lookup/search/tokenize.ts","../src/with-lookup/search/scan.ts","../src/with-lookup/search/segment.ts","../src/with-lookup/search/inverted-index.ts","../src/with-lookup/search/snippet.ts","../src/with-lookup/search/index-store.ts","../src/with-lookup/search/build-docs.ts","../src/with-lookup/search/active.ts","../src/with-lookup/search/strategy.ts","../src/with-lookup/search/collection-facade.ts"],"sourcesContent":["/** Cosine similarity in [-1,1]; 0 on zero-norm or length mismatch (no NaN). (L2) */\nexport function cosine(a: Float32Array | number[], b: Float32Array | number[]): number {\n if (a.length !== b.length) return 0\n let dot = 0, na = 0, nb = 0\n for (let i = 0; i < a.length; i++) {\n const x = a[i]!, y = b[i]!\n dot += x * y; na += x * x; nb += y * y\n }\n if (na === 0 || nb === 0) return 0\n return dot / (Math.sqrt(na) * Math.sqrt(nb))\n}\n","/** Per-collection embedding config (L2). The encode hook is host/remote — no bundled model. */\nimport { getAtPath } from '../../via/i18n/core.js'\n\nexport interface EmbeddingDescriptor {\n readonly source: string | readonly string[]\n readonly encode: (text: string) => Promise<Float32Array>\n readonly dim: number\n readonly model: string\n}\n\n/** Concatenate the record's source-field text (skips empties; supports nested/[]-wildcard paths). */\nexport function embeddingSourceText(record: Record<string, unknown>, source: string | readonly string[]): string {\n const fields = typeof source === 'string' ? [source] : source\n const parts: string[] = []\n for (const f of fields) {\n for (const leaf of getAtPath(record, f)) {\n if (typeof leaf === 'string' && leaf !== '') parts.push(leaf)\n }\n }\n return parts.join(' ')\n}\n","/** In-memory vector set for L2 semantic retrieval. Loaded once per session from\n * decrypted _vec sidecars (injected loader), brute-force cosine kNN, model-guarded. */\nimport { cosine } from './cosine.js'\nimport { EmbeddingModelMismatchError } from '../../kernel/errors.js'\n\nexport interface StoredVector { readonly id: string; readonly vec: Float32Array; readonly model: string }\nexport interface VectorHit { readonly id: string; readonly score: number }\n\nexport class VectorSet {\n private vectors: StoredVector[] | undefined\n get loaded(): boolean { return this.vectors !== undefined }\n\n async ensureLoaded(load: () => Promise<StoredVector[]>): Promise<void> {\n if (this.vectors === undefined) this.vectors = await load()\n }\n\n markDirty(): void { this.vectors = undefined }\n\n cosineTopK(query: Float32Array, k: number, opts: { minScore?: number; expectModel?: string } = {}): VectorHit[] {\n const all = this.vectors ?? []\n const minScore = opts.minScore ?? -Infinity\n const hits: VectorHit[] = []\n for (const v of all) {\n if (opts.expectModel !== undefined && v.model !== opts.expectModel) {\n throw new EmbeddingModelMismatchError(opts.expectModel, v.model)\n }\n const score = cosine(query, v.vec)\n if (score >= minScore) hits.push({ id: v.id, score })\n }\n hits.sort((a, b) => b.score - a.score)\n return hits.slice(0, k)\n }\n}\n","/**\n * Collection-namespaced `_vec` side-car ids (#726).\n *\n * `_vec` embedding side-cars used to be keyed by the bare record id,\n * vault-wide — two collections sharing a record id shared one `_vec` row.\n * This was verified to be a clobber/crash bug, NOT a confidentiality leak:\n * every collection has its own DEK, and AES-GCM auth-tag verification means\n * decrypting a foreign collection's `_vec` row under the wrong DEK throws\n * `TamperedError` rather than returning wrong plaintext — no disclosure\n * mechanism exists. The real bug was id collision: a same-id write/forget in\n * one collection could clobber or delete the other collection's row, and a\n * collection whose `similarTo()` / cold semantic `retrieve()` encountered a\n * foreign same-id row crashed with an uncaught `TamperedError` (a DoS). The\n * store-collection bucket stays the literal `'_vec'`; the id becomes\n * composite: `${collection}/${recordId}`. Mirrors `encodeIdxId`\n * (`../indexing/persisted-indexes.js`).\n *\n * Decode is deliberately NOT split-on-`/`: the collection is always known\n * at the decode site (`ctx.name`), so `decodeVecId` strips that known\n * prefix — correct even when `recordId` itself contains `/`.\n *\n * Precondition: `collection` itself must not contain `/` — otherwise\n * `${collection}/${recordId}` is ambiguous (e.g. collection `'a'` would\n * misattribute collection `'a/b'`'s rows via prefix match in `isVecIdFor`).\n * Collection names are NOT currently restricted to a `/`-free charset by\n * `vault.collection()`, so `encodeVecId` enforces the precondition itself,\n * failing loud at the write boundary rather than silently misencoding.\n */\n\n/**\n * Encode the `_vec` side-car id for a (collection, recordId) pair.\n * Format: `<collection>/<recordId>` — no escaping; `recordId` may contain `/`.\n *\n * Throws if `collection` contains `/`: that would make the composite id\n * ambiguous against `isVecIdFor`'s prefix match (collection `'a'` would\n * appear to own collection `'a/b'`'s rows), reintroducing the clobber/crash\n * risk the namespacing fix exists to close.\n */\nexport function encodeVecId(collection: string, recordId: string): string {\n if (collection.includes('/')) {\n throw new Error(\n `encodeVecId: collection name \"${collection}\" must not contain \"/\" — ` +\n `it would make the \"${collection}/${recordId}\" _vec id ambiguous against another collection's rows.`,\n )\n }\n return `${collection}/${recordId}`\n}\n\n/**\n * Decode a `_vec` id back to the bare record id, given the KNOWN owning\n * collection — strips the `<collection>/` prefix rather than splitting on\n * `/`, so a `recordId` containing `/` round-trips correctly. Returns `null`\n * if `vecId` does not belong to `collection`.\n */\nexport function decodeVecId(collection: string, vecId: string): string | null {\n const prefix = `${collection}/`\n if (!vecId.startsWith(prefix)) return null\n return vecId.slice(prefix.length)\n}\n\n/** Predicate form of {@link decodeVecId} — used to filter `list()` results. */\nexport function isVecIdFor(collection: string, vecId: string): boolean {\n return vecId.startsWith(`${collection}/`)\n}\n","/**\n * Default text tokenizer for scan-mode search.\n *\n * NFKC-normalize → lowercase → split on Unicode letter/number runs. This is a\n * word-boundary tokenizer: it does **not** segment scripts written without\n * inter-word spaces (Thai, Lao, Khmer, CJK) — those collapse to one token per\n * run. For such data, a dictionary/ICU segmenter is the right `tokenizer`\n * (the engine takes one as a parameter); substring/`contains` matching is the\n * pragmatic fallback until then.\n */\nexport type Tokenizer = (text: string) => string[]\n\nconst WORD = /[\\p{L}\\p{N}]+/gu\n\nexport const tokenize: Tokenizer = (text: string): string[] => {\n if (!text) return []\n return text.normalize('NFKC').toLowerCase().match(WORD) ?? []\n}\n","/**\n * Scan-mode full-text search — ranks **already-decrypted** records by\n * BM25 against a tokenized query. Pure client-side: nothing is written to the\n * store, so this adds **zero** leakage (unlike a store-usable blind index,\n * which is a separate, gated opt-in).\n *\n * O(n) over the collection; intended for small/medium collections (the pilot's\n * scale) where moving the existing userland scan into the DB is the win.\n */\nimport { tokenize, type Tokenizer } from './tokenize.js'\n\nexport interface SearchOptions {\n /** Top-N by score (default: all matches). */\n readonly limit?: number\n /** `'any'` (default) = OR of query terms; `'all'` = every term must match. */\n readonly match?: 'any' | 'all'\n /** Treat the LAST query term as a prefix (typeahead). */\n readonly prefix?: boolean\n}\n\nexport interface SearchResult<T> {\n readonly id: string\n readonly score: number\n readonly record: T\n}\n\nexport interface SearchEntry<T> {\n readonly id: string\n readonly record: T\n}\n\nconst K1 = 1.2\nconst B = 0.75\n\n/** Coerce a field value to searchable text (numbers/booleans stringified). */\nfunction fieldText(record: unknown, field: string): string {\n const v = (record as Record<string, unknown>)[field]\n if (typeof v === 'string') return v\n if (v === null || v === undefined) return ''\n if (typeof v === 'number' || typeof v === 'boolean') return String(v)\n return ''\n}\n\nexport function searchScan<T>(\n entries: ReadonlyArray<SearchEntry<T>>,\n field: string,\n query: string,\n opts: SearchOptions = {},\n tokenizer: Tokenizer = tokenize,\n): SearchResult<T>[] {\n const queryTerms = tokenizer(query)\n if (queryTerms.length === 0) return []\n\n const match = opts.match ?? 'any'\n const usePrefix = opts.prefix ?? false\n const exactTerms = usePrefix ? queryTerms.slice(0, -1) : queryTerms\n const prefixTerm = usePrefix ? queryTerms[queryTerms.length - 1] : undefined\n\n // One tokenize pass per doc; collect corpus stats (df, avg length).\n const docs = entries.map((e) => ({ id: e.id, record: e.record, terms: tokenizer(fieldText(e.record, field)) }))\n const N = docs.length || 1\n const df = new Map<string, number>()\n let totalLen = 0\n for (const d of docs) {\n totalLen += d.terms.length\n for (const t of new Set(d.terms)) df.set(t, (df.get(t) ?? 0) + 1)\n }\n const avgdl = totalLen / N || 1\n\n // Document frequency for the prefix term: docs containing ANY term with it.\n let prefixDf = 0\n if (prefixTerm !== undefined) {\n for (const d of docs) {\n if (d.terms.some((t) => t.startsWith(prefixTerm))) prefixDf++\n }\n }\n\n const requiredCount = exactTerms.length + (prefixTerm !== undefined ? 1 : 0)\n const results: SearchResult<T>[] = []\n\n for (const d of docs) {\n const tf = new Map<string, number>()\n for (const t of d.terms) tf.set(t, (tf.get(t) ?? 0) + 1)\n\n const matched: { tf: number; df: number }[] = []\n for (const qt of exactTerms) {\n const c = tf.get(qt) ?? 0\n if (c > 0) matched.push({ tf: c, df: df.get(qt) ?? 0 })\n }\n if (prefixTerm !== undefined) {\n let ptf = 0\n for (const [t, c] of tf) if (t.startsWith(prefixTerm)) ptf += c\n if (ptf > 0) matched.push({ tf: ptf, df: prefixDf })\n }\n\n if (matched.length === 0) continue\n if (match === 'all' && matched.length < requiredCount) continue\n\n let score = 0\n for (const m of matched) {\n const idf = Math.log(1 + (N - m.df + 0.5) / (m.df + 0.5))\n const denom = m.tf + K1 * (1 - B + B * (d.terms.length / avgdl))\n score += idf * ((m.tf * (K1 + 1)) / (denom || 1))\n }\n results.push({ id: d.id, score, record: d.record })\n }\n\n results.sort((a, b) => b.score - a.score)\n return opts.limit !== undefined ? results.slice(0, opts.limit) : results\n}\n","/**\n * i18n word tokenizer for the L1 lexical index. Uses Intl.Segmenter\n * (standard ECMAScript — hub-portable) to dictionary-segment Thai/Lao/Khmer/CJK,\n * which the word-run `tokenize` cannot. Terms are matched in NFKC-lowercased form;\n * offsets index the ORIGINAL text so snippets slice the user's text.\n */\nimport type { Tokenizer } from './tokenize.js'\n\nconst SEGMENTER = new Intl.Segmenter(undefined, { granularity: 'word' })\n\nexport interface Token {\n readonly term: string\n readonly offset: number\n}\n\n/** Word-like tokens with NFKC-lowercased terms + original-text char offsets. */\nexport const segmentTokens = (text: string): Token[] => {\n const out: Token[] = []\n if (!text) return out\n for (const s of SEGMENTER.segment(text)) {\n if (s.isWordLike) out.push({ term: s.segment.normalize('NFKC').toLowerCase(), offset: s.index })\n }\n return out\n}\n\n/** Term-only tokenizer (the public `Tokenizer` shape) — for queries. */\nexport const segmentTokenizer: Tokenizer = (text: string): string[] =>\n segmentTokens(text).map((t) => t.term)\n","/**\n * In-memory inverted index for the L1 lexical retrieval layer. Built\n * client-side from already-decrypted records; nothing touches the store. BM25\n * mirrors src/search/scan.ts; multi-field with max-field combination so a record\n * ranks by its strongest field, which also supplies the snippet location.\n */\nimport { segmentTokens, segmentTokenizer } from './segment.js'\n\nconst K1 = 1.2\nconst B = 0.75\n\nexport interface IndexDoc {\n readonly id: string\n readonly fields: ReadonlyArray<{ readonly field: string; readonly locale?: string; readonly text: string }>\n}\n\nexport interface IndexHit {\n readonly id: string\n readonly score: number\n readonly field: string\n readonly locale?: string\n readonly text: string\n readonly offset: number\n}\n\nexport interface QueryOptions {\n readonly limit?: number\n readonly match?: 'any' | 'all'\n readonly prefix?: boolean\n readonly fields?: readonly string[]\n}\n\nexport interface IndexSnapshot {\n readonly v: 1\n readonly fieldStats: ReadonlyArray<[string, { df: [string, number][]; n: number; totalLen: number }]>\n readonly docs: ReadonlyArray<{\n id: string; field: string; locale?: string; text: string; len: number\n tf: [string, number][]; firstOffset: [string, number][]\n }>\n}\n\ninterface Doc {\n id: string\n field: string\n locale?: string\n text: string\n len: number\n tf: Map<string, number>\n firstOffset: Map<string, number>\n}\n\nexport class InvertedIndex {\n // per field: df (term -> #docs), N (#docs), totalLen\n private readonly fieldStats = new Map<string, { df: Map<string, number>; n: number; totalLen: number }>()\n private readonly docs: Doc[] = []\n\n static build(docs: ReadonlyArray<IndexDoc>): InvertedIndex {\n const idx = new InvertedIndex()\n for (const d of docs) {\n for (const f of d.fields) {\n const tokens = segmentTokens(f.text)\n const tf = new Map<string, number>()\n const firstOffset = new Map<string, number>()\n for (const t of tokens) {\n tf.set(t.term, (tf.get(t.term) ?? 0) + 1)\n if (!firstOffset.has(t.term)) firstOffset.set(t.term, t.offset)\n }\n const doc: Doc = { id: d.id, field: f.field, ...(f.locale !== undefined ? { locale: f.locale } : {}), text: f.text, len: tokens.length, tf, firstOffset }\n idx.docs.push(doc)\n let s = idx.fieldStats.get(f.field)\n if (!s) { s = { df: new Map(), n: 0, totalLen: 0 }; idx.fieldStats.set(f.field, s) }\n s.n += 1\n s.totalLen += doc.len\n for (const term of tf.keys()) s.df.set(term, (s.df.get(term) ?? 0) + 1)\n }\n }\n return idx\n }\n\n query(query: string, opts: QueryOptions = {}): IndexHit[] {\n const terms = segmentTokenizer(query)\n if (terms.length === 0) return []\n const usePrefix = opts.prefix ?? false\n const exact = usePrefix ? terms.slice(0, -1) : terms\n const prefix = usePrefix ? terms[terms.length - 1] : undefined\n const match = opts.match ?? 'any'\n const required = exact.length + (prefix !== undefined ? 1 : 0)\n\n // best (max-score) doc per record\n const best = new Map<string, IndexHit>()\n for (const doc of this.docs) {\n if (opts.fields !== undefined && !opts.fields.includes(doc.field)) continue\n const stats = this.fieldStats.get(doc.field)!\n const avgdl = stats.totalLen / stats.n || 1\n let score = 0\n let matchedCount = 0\n let snippetOffset = -1\n\n const scoreTerm = (tf: number, df: number, offset: number): void => {\n if (tf <= 0) return\n matchedCount += 1\n if (snippetOffset < 0 && offset >= 0) snippetOffset = offset\n const idf = Math.log(1 + (stats.n - df + 0.5) / (df + 0.5))\n const denom = tf + K1 * (1 - B + B * (doc.len / avgdl))\n score += idf * ((tf * (K1 + 1)) / (denom || 1))\n }\n\n for (const qt of exact) scoreTerm(doc.tf.get(qt) ?? 0, stats.df.get(qt) ?? 0, doc.firstOffset.get(qt) ?? -1)\n\n if (prefix !== undefined) {\n // Build a set of exact query terms so we don't double-count a term that\n // is both an exact match and starts with the prefix (defect 2 fix).\n const exactSet = new Set(exact)\n let ptf = 0\n let poff = -1\n for (const [term, c] of doc.tf) {\n if (term.startsWith(prefix) && !exactSet.has(term)) {\n ptf += c\n if (poff < 0) poff = doc.firstOffset.get(term) ?? -1\n }\n }\n if (ptf > 0) {\n // df for the prefix: count DISTINCT docs in this field that have any\n // prefix-matching term — mirrors scan.ts semantics (defect 1 fix).\n let pdf = 0\n for (const d of this.docs) {\n if (d.field === doc.field && [...d.tf.keys()].some((t) => t.startsWith(prefix))) pdf++\n }\n scoreTerm(ptf, pdf || 1, poff)\n }\n }\n\n if (matchedCount === 0) continue\n if (match === 'all' && matchedCount < required) continue\n\n const hit: IndexHit = {\n id: doc.id, score, field: doc.field, text: doc.text,\n offset: snippetOffset < 0 ? 0 : snippetOffset,\n ...(doc.locale !== undefined ? { locale: doc.locale } : {}),\n }\n const prev = best.get(doc.id)\n if (!prev || hit.score > prev.score) best.set(doc.id, hit)\n }\n\n const results = [...best.values()].sort((a, b) => b.score - a.score)\n return opts.limit !== undefined ? results.slice(0, opts.limit) : results\n }\n\n toSnapshot(): IndexSnapshot {\n return {\n v: 1,\n fieldStats: [...this.fieldStats].map(([f, s]) => [f, { df: [...s.df], n: s.n, totalLen: s.totalLen }]),\n docs: this.docs.map((d) => ({\n id: d.id, field: d.field, text: d.text, len: d.len,\n tf: [...d.tf], firstOffset: [...d.firstOffset],\n ...(d.locale !== undefined ? { locale: d.locale } : {}),\n })),\n }\n }\n\n static fromSnapshot(s: IndexSnapshot): InvertedIndex {\n const idx = new InvertedIndex()\n for (const [f, st] of s.fieldStats) idx.fieldStats.set(f, { df: new Map(st.df), n: st.n, totalLen: st.totalLen })\n for (const d of s.docs) {\n idx.docs.push({\n id: d.id, field: d.field, text: d.text, len: d.len,\n tf: new Map(d.tf), firstOffset: new Map(d.firstOffset),\n ...(d.locale !== undefined ? { locale: d.locale } : {}),\n })\n }\n return idx\n }\n}\n","/**\n * Minimal-disclosure snippet: a char-window around a match offset (L1).\n * Unicode-safe (operates on code points). `…` marks each truncated end.\n */\nexport function extractSnippet(text: string, offset: number, window = 80): string {\n const chars = Array.from(text)\n if (chars.length <= window) return text\n // offset is a UTF-16 index into `text`; map to a code-point index.\n const cpOffset = Array.from(text.slice(0, Math.max(0, offset))).length\n const half = Math.floor(window / 2)\n let start = Math.max(0, cpOffset - half)\n const end = Math.min(chars.length, start + window)\n start = Math.max(0, end - window)\n const body = chars.slice(start, end).join('')\n return `${start > 0 ? '…' : ''}${body}${end < chars.length ? '…' : ''}`\n}\n","/**\n * The index persistence seam (L1.5). MemoryIndexStore is session-scoped and\n * lazy; an opaque-blob backend implements the same interface so the\n * collection call-site is unchanged.\n */\nimport { InvertedIndex, type IndexDoc } from './inverted-index.js'\n\nexport interface IndexStore {\n ensureBuilt(build: () => ReadonlyArray<IndexDoc>): Promise<InvertedIndex>\n markDirty(): void\n flush(): Promise<void>\n readonly built: boolean\n}\n\nexport class MemoryIndexStore implements IndexStore {\n private index: InvertedIndex | undefined\n\n get built(): boolean { return this.index !== undefined }\n\n async ensureBuilt(build: () => ReadonlyArray<IndexDoc>): Promise<InvertedIndex> {\n if (this.index === undefined) this.index = InvertedIndex.build(build())\n return this.index\n }\n\n markDirty(): void { this.index = undefined }\n\n async flush(): Promise<void> { /* in-memory: nothing to persist */ }\n}\n","/**\n * Map a decrypted record's configured text fields → IndexDoc field entries\n * (L1). String, i18nText, dictKey, and blob-filename expansion. Uses\n * getAtPath for nested/[]-wildcard paths. Blob filenames are NOT inline on the\n * record — the collection pre-resolves them (one listSlots() per record, the\n * heaviest source) and feeds them to {@link buildBlobFieldEntries}.\n */\nimport { getAtPath } from '../../via/i18n/core.js'\nimport type { I18nTextDescriptor } from '../../via/i18n/core.js'\nimport type { DictKeyDescriptor, StaticDictDescriptor } from '../../via/i18n/dictionary.js'\nimport type { IndexDoc } from './inverted-index.js'\n\ntype FieldEntry = IndexDoc['fields'][number]\n\nexport function buildStringFieldEntries(\n record: Record<string, unknown>,\n textIndexes: readonly string[],\n only?: readonly string[],\n): FieldEntry[] {\n const fields = only ? textIndexes.filter((f) => only.includes(f)) : textIndexes\n const out: FieldEntry[] = []\n for (const field of fields) {\n for (const leaf of getAtPath(record, field)) {\n if (typeof leaf === 'string' && leaf !== '') out.push({ field, text: leaf })\n }\n }\n return out\n}\n\nexport function buildI18nFieldEntries(\n record: Record<string, unknown>,\n i18nFields: Record<string, I18nTextDescriptor>,\n textIndexes: readonly string[],\n only?: readonly string[],\n): FieldEntry[] {\n const fields = (only ? textIndexes.filter((f) => only.includes(f)) : textIndexes).filter((f) => f in i18nFields)\n const out: FieldEntry[] = []\n for (const field of fields) {\n for (const leaf of getAtPath(record, field)) {\n if (!leaf || typeof leaf !== 'object' || Array.isArray(leaf)) continue\n for (const [locale, val] of Object.entries(leaf as Record<string, unknown>)) {\n if (typeof val === 'string' && val !== '') out.push({ field, locale, text: val })\n }\n }\n }\n return out\n}\n\n/** label map: field -> (key -> { locale -> label }). Precomputed in the collection (async for dynamic dicts). */\nexport function buildDictKeyFieldEntries(\n record: Record<string, unknown>,\n dictKeyFields: Record<string, DictKeyDescriptor | StaticDictDescriptor>,\n labelMaps: Map<string, Map<string, Record<string, string>>>,\n textIndexes: readonly string[],\n only?: readonly string[],\n): FieldEntry[] {\n const fields = (only ? textIndexes.filter((f) => only.includes(f)) : textIndexes).filter((f) => f in dictKeyFields)\n const out: FieldEntry[] = []\n for (const field of fields) {\n const map = labelMaps.get(field)\n if (!map) continue\n for (const leaf of getAtPath(record, field)) {\n const keys = typeof leaf === 'string' ? [leaf] : Array.isArray(leaf) ? leaf.filter((k): k is string => typeof k === 'string') : []\n for (const key of keys) {\n const labels = map.get(key)\n if (!labels) continue\n for (const [locale, label] of Object.entries(labels)) {\n if (label !== '') out.push({ field, locale, text: label })\n }\n }\n }\n }\n return out\n}\n\n/**\n * Blob filenames precomputed in the collection (`field -> filenames[]`, from one\n * async `listSlots()` per record — the heaviest source, see {@link buildBlobFieldEntries}'s\n * caller). Bytes are never tokenized; only the slot `filename` is indexed.\n */\nexport function buildBlobFieldEntries(filenamesByField: Map<string, string[]>): FieldEntry[] {\n const out: FieldEntry[] = []\n for (const [field, names] of filenamesByField) {\n for (const name of names) if (name !== '') out.push({ field, text: name })\n }\n return out\n}\n","/**\n * Enable the search / retrieval capability.\n * Pass to `createNoydb({ searchStrategy: withSearch() })` to make a collection's\n * `search` / `retrieve` / `similarTo` / `warmIndex` / `flushIndex` methods live,\n * and to enable the put()-time embedding-vector compute for collections that\n * declare an `embeddings` config. The search/retrieval engine is dynamically\n * imported here, so it stays out of the floor bundle until opted in.\n */\nimport type { SearchStrategy } from './strategy.js'\n\nexport function withSearch(): SearchStrategy {\n return {\n async search(ctx, field, query, opts) {\n const { search } = await import('./collection-facade.js')\n return search(ctx, field, query, opts)\n },\n async retrieve(ctx, query, opts) {\n const { retrieve } = await import('./collection-facade.js')\n return retrieve(ctx, query, opts)\n },\n async similarTo(ctx, vector, opts) {\n const { similarTo } = await import('./collection-facade.js')\n return similarTo(ctx, vector, opts)\n },\n async warmIndex(ctx) {\n const { warmIndex } = await import('./collection-facade.js')\n return warmIndex(ctx)\n },\n async flushIndex(ctx) {\n const { flushIndex } = await import('./collection-facade.js')\n return flushIndex(ctx)\n },\n async embedOnWrite(ctx, id, record, version) {\n const { embedOnWrite } = await import('./collection-facade.js')\n return embedOnWrite(ctx, id, record, version)\n },\n async rebuildEmbeddings(ctx) {\n const { rebuildEmbeddings } = await import('./collection-facade.js')\n return rebuildEmbeddings(ctx)\n },\n }\n}\n","/**\n * Search capability strategy — the on-demand collection-level retrieval\n * operations the `Collection` routes through: scan-mode full-text `search`,\n * unified `retrieve` (lexical | semantic | hybrid), raw-vector `similarTo`, and\n * the lexical-index lifecycle (`warmIndex` / `flushIndex`). The active engine\n * ({@link withSearch}) dynamically imports the search/retrieval facade (keeping\n * it out of the floor bundle); {@link NO_SEARCH} throws.\n *\n * The embedding write-hook (`embedOnWrite`) is paired here too: opting into\n * `withSearch()` enables both the query surface AND the put()-time vector\n * compute — a vector that no gated `similarTo` / semantic `retrieve` could read\n * is dead weight, so embedding compute is not separately gatable. `Collection`\n * always assembles the per-call {@link SearchContext} and delegates here, so an\n * un-opted-in caller hits `NO_SEARCH`'s throw.\n * @internal\n */\nimport type { SearchContext } from './collection-facade.js'\nimport type { SearchOptions, SearchResult } from './index.js'\nimport type { RetrieveOptions, RetrieveHit } from './retrieve-types.js'\nimport { SearchNotEnabledError } from '../../kernel/errors.js'\n\nexport interface SearchStrategy {\n search<T>(ctx: SearchContext<T>, field: string, query: string, opts?: SearchOptions): Promise<SearchResult<T>[]>\n retrieve<T>(ctx: SearchContext<T>, query: string, opts?: RetrieveOptions<T>): Promise<RetrieveHit<T>[]>\n similarTo<T>(ctx: SearchContext<T>, vector: Float32Array, opts?: { k?: number; minScore?: number; includeRecord?: boolean }): Promise<RetrieveHit<T>[]>\n warmIndex<T>(ctx: SearchContext<T>): Promise<void>\n flushIndex<T>(ctx: SearchContext<T>): Promise<void>\n embedOnWrite<T>(ctx: SearchContext<T>, id: string, record: T, version: number): Promise<void>\n rebuildEmbeddings<T>(ctx: SearchContext<T>): Promise<{ rebuilt: number; skipped: number }>\n}\n\n/**\n * No-op stub — the floor default. Every capability method (and the embedding\n * write-hook) throws {@link SearchNotEnabledError}; opt in with\n * `searchStrategy: withSearch()` in createNoydb. @internal\n */\nexport const NO_SEARCH: SearchStrategy = {\n async search() { throw new SearchNotEnabledError() },\n async retrieve() { throw new SearchNotEnabledError() },\n async similarTo() { throw new SearchNotEnabledError() },\n async warmIndex() { throw new SearchNotEnabledError() },\n async flushIndex() { throw new SearchNotEnabledError() },\n async embedOnWrite() { throw new SearchNotEnabledError() },\n async rebuildEmbeddings() { throw new SearchNotEnabledError() },\n}\n","/**\n * Collection-level search / retrieval (`search` / `retrieve` / `similarTo` +\n * the lexical-index build/flush/warm machinery).\n *\n * This is the retrieval surface: a pure client-side lexical scan\n * (`search`), the persisted-or-in-memory inverted-index lifecycle\n * (`flushIndex` / `warmIndex` / `buildRetrievalDocs` + the dict-label / blob-\n * filename resolvers that feed it), and the lexical / semantic / hybrid\n * `retrieve` fan-out plus raw-vector kNN (`similarTo`). None of it touches the\n * write path — it reads the live eager cache and the encrypted `_vec` / `_ftindex`\n * side-cars.\n *\n * Every function takes a small {@link SearchContext} instead of `this`,\n * mirroring the `record-keys/` siblings.\n *\n * The `cache` is the SAME `Map` reference `Collection` owns (passed by\n * reference, never copied) so the index always builds over the live working\n * set. {@link buildPersistedIndexCallbacks} is special: it is invoked from the\n * `Collection` constructor *before* `this.codec` exists, so it takes a context\n * THUNK and resolves the context lazily at each callback invocation.\n *\n * Internal service — not exported as a `@noy-db/hub/*` subpath.\n */\nimport type { NoydbStore } from '../../kernel/types.js'\nimport type { RecordCodec } from '../../kernel/enclave/index.js'\nimport { stripI18nFilled, type I18nTextDescriptor } from '../../via/i18n/core.js'\nimport { isStaticDictDescriptor, type DictKeyDescriptor, type StaticDictDescriptor, type DictionaryHandle } from '../../via/i18n/dictionary.js'\nimport type { BlobSet } from '../../with-shape/blobs/blob-set.js'\nimport type { BlobFieldsConfig } from '../../with-shape/blobs/blob-compaction.js'\nimport type { Query } from '../../kernel/query/index.js'\nimport { embeddingSourceText, type VectorSet, type EmbeddingDescriptor, type StoredVector } from '../embeddings/index.js'\nimport { encodeVecId, decodeVecId, isVecIdFor } from '../embeddings/vec-id.js'\nimport { EmbeddingDimMismatchError } from '../../kernel/errors.js'\nimport { liveRecordIsElevated } from '../../kernel/tier-visibility.js'\nimport { searchScan, fuseRetrieval, type SearchOptions, type SearchResult } from './index.js'\nimport type { IndexStore } from './index-store.js'\nimport type { PersistedIndexCallbacks } from './persisted-index-store.js'\nimport { extractSnippet } from './snippet.js'\nimport { buildStringFieldEntries, buildI18nFieldEntries, buildDictKeyFieldEntries, buildBlobFieldEntries } from './build-docs.js'\nimport type { IndexDoc, IndexHit } from './inverted-index.js'\nimport type { RetrieveOptions, RetrieveHit } from './retrieve-types.js'\n\n/** Everything the moving search/retrieval methods touched on `this.*`. */\nexport interface SearchContext<T> {\n /** Collection name — error context + `_ftindex` row key. */\n readonly name: string\n /** Vault namespace the side-cars (`_vec`, `_ftindex`) live under. */\n readonly vault: string\n /** The ciphertext store. */\n readonly adapter: NoydbStore\n /** The record codec — decrypts the `_vec` / `_ftindex` side-car bodies. */\n readonly codec: RecordCodec<T>\n /** The eager working-set cache (SHARED `Map` reference, never copied). */\n readonly cache: Map<string, { record: T; version: number }>\n /** True in lazy mode — search/retrieve/warm require eager mode. */\n readonly lazy: boolean\n /** Declared text-index fields, or undefined. */\n readonly textIndexes: readonly string[] | undefined\n /** Declared i18n fields, or undefined. */\n readonly i18nFields: Record<string, I18nTextDescriptor> | undefined\n /** Declared dictionary-key fields, or undefined. */\n readonly dictKeyFields: Record<string, DictKeyDescriptor | StaticDictDescriptor> | undefined\n /** Declared blob fields, or undefined. */\n readonly blobFields: BlobFieldsConfig | undefined\n /** Dictionary handle resolver (dynamic dict-key labels), or undefined. */\n readonly getDictionary: ((name: string) => Promise<DictionaryHandle>) | undefined\n /** The lexical inverted-index store (in-memory or persisted), or undefined. */\n readonly searchIndexStore: IndexStore | undefined\n /** The vector set for semantic retrieval, or undefined. */\n readonly vectorSet: VectorSet | undefined\n /** The embeddings descriptor, or undefined. */\n readonly embeddings: EmbeddingDescriptor | undefined\n /** Hydrate the eager cache before reading it. */\n ensureHydrated(): Promise<void>\n /** Open the blob facade for a record (used to list indexed blob filenames). */\n blob(id: string): BlobSet\n}\n\n/**\n * Client-side lexical scan over the live eager cache. Eager mode only;\n * nothing searchable is written to the store.\n */\nexport async function search<T>(ctx: SearchContext<T>, field: string, query: string, opts: SearchOptions = {}): Promise<SearchResult<T>[]> {\n if (ctx.lazy) {\n throw new Error(\n `Collection \"${ctx.name}\": search() (scan mode) requires eager mode (prefetch: true). ` +\n `A store-usable blind index for lazy / at-scale search is a separate gated opt-in (#308).`,\n )\n }\n await ctx.ensureHydrated()\n const entries: { id: string; record: T }[] = []\n // Strip the internal densify marker from the user-facing records.\n // Non-mutating: never touches the cached record object. The search index\n // is built over the same (marker-free) record, which is fine — the marker\n // is never a searchable field.\n for (const [id, e] of ctx.cache) entries.push({ id, record: stripI18nFilled(e.record as Record<string, unknown>) as T })\n return searchScan(entries, field, query, opts)\n}\n\n/** L1 — build IndexDoc[] for the configured text fields over the live cache. */\nexport function buildRetrievalDocs<T>(\n ctx: SearchContext<T>,\n labelMaps: Map<string, Map<string, Record<string, string>>>,\n blobFilenames: Map<string, Map<string, string[]>>,\n only?: readonly string[],\n): IndexDoc[] {\n const docs: IndexDoc[] = []\n for (const [id, e] of ctx.cache) {\n const rec = stripI18nFilled(e.record as Record<string, unknown>)\n const fields = buildStringFieldEntries(rec, ctx.textIndexes ?? [], only)\n if (ctx.i18nFields) fields.push(...buildI18nFieldEntries(rec, ctx.i18nFields, ctx.textIndexes ?? [], only))\n if (ctx.dictKeyFields) fields.push(...buildDictKeyFieldEntries(rec, ctx.dictKeyFields, labelMaps, ctx.textIndexes ?? [], only))\n const blobNames = blobFilenames.get(id)\n if (blobNames) fields.push(...buildBlobFieldEntries(blobNames))\n if (fields.length > 0) docs.push({ id, fields })\n }\n return docs\n}\n\n/** L1 — true iff any configured text index is also a blob field (gates ALL slot I/O). */\nexport function hasIndexedBlobFields<T>(ctx: SearchContext<T>, only?: readonly string[]): boolean {\n if (!ctx.blobFields || !ctx.textIndexes) return false\n const fields = only ? ctx.textIndexes.filter((f) => only.includes(f)) : ctx.textIndexes\n return fields.some((f) => f in ctx.blobFields!)\n}\n\n/**\n * L1 — resolve `recordId -> (blobField -> filenames[])` by listing slots\n * for the configured blob fields of each cached record. Blob slot metadata is\n * NOT inline on the record: it lives in a separate `_blob_slots_*` collection,\n * so this costs ONE `blob(id).list()` (a `listSlots`) per record at build time\n * — the heaviest indexing source. Fully gated by {@link hasIndexedBlobFields};\n * non-blob (and blob-but-not-indexed) collections do ZERO slot I/O.\n */\nasync function resolveBlobFilenames<T>(ctx: SearchContext<T>, only?: readonly string[]): Promise<Map<string, Map<string, string[]>>> {\n const out = new Map<string, Map<string, string[]>>()\n if (!hasIndexedBlobFields(ctx, only)) return out\n const indexed = (only ? ctx.textIndexes!.filter((f) => only.includes(f)) : ctx.textIndexes!)\n .filter((f) => f in ctx.blobFields!)\n const indexedSet = new Set(indexed)\n for (const id of ctx.cache.keys()) {\n let slots\n try {\n slots = await ctx.blob(id).list()\n } catch {\n continue\n }\n let byField: Map<string, string[]> | undefined\n for (const slot of slots) {\n if (!indexedSet.has(slot.name) || !slot.filename) continue\n if (!byField) { byField = new Map(); out.set(id, byField) }\n const names = byField.get(slot.name)\n if (names) names.push(slot.filename)\n else byField.set(slot.name, [slot.filename])\n }\n }\n return out\n}\n\n/** L1 — field -> (key -> {locale->label}) for dictKey fields; static from table, dynamic via getDictionary().list(). */\nasync function resolveDictLabelMaps<T>(ctx: SearchContext<T>): Promise<Map<string, Map<string, Record<string, string>>>> {\n const maps = new Map<string, Map<string, Record<string, string>>>()\n if (!ctx.dictKeyFields || !ctx.textIndexes) return maps\n for (const field of ctx.textIndexes) {\n const desc = ctx.dictKeyFields[field]\n if (!desc) continue\n const m = new Map<string, Record<string, string>>()\n if (isStaticDictDescriptor(desc)) {\n for (const [key, labels] of Object.entries(desc.table)) m.set(key, labels as Record<string, string>)\n } else {\n if (ctx.getDictionary) {\n const handle = await ctx.getDictionary(desc.name)\n for (const e of await handle.list()) m.set(e.key, e.labels)\n }\n }\n maps.set(field, m)\n }\n return maps\n}\n\n/** L1.5 — force-persist the lexical index now (e.g. on save/idle). Persists only when textIndexPersist is enabled; a no-op otherwise. */\nexport async function flushIndex<T>(ctx: SearchContext<T>): Promise<void> {\n if (!ctx.searchIndexStore) return\n await ctx.ensureHydrated()\n const labelMaps = await resolveDictLabelMaps(ctx)\n const blobFilenames = await resolveBlobFilenames(ctx)\n await ctx.searchIndexStore.ensureBuilt(() => buildRetrievalDocs(ctx, labelMaps, blobFilenames))\n await ctx.searchIndexStore.flush?.()\n}\n\n/** L2 — load + decrypt all _vec sidecars into StoredVector[] for the VectorSet. */\nfunction buildVectorLoad<T>(ctx: SearchContext<T>): () => Promise<StoredVector[]> {\n return async () => {\n const ids = await ctx.adapter.list(ctx.vault, '_vec')\n const out: StoredVector[] = []\n for (const vecId of ids) {\n // #726: _vec is a vault-wide bucket namespaced by collection prefix —\n // skip rows belonging to other collections before touching this one's.\n if (!isVecIdFor(ctx.name, vecId)) continue\n const id = decodeVecId(ctx.name, vecId)!\n // #721 defense-in-depth: a _vec row carries no _tier of its own; the purge\n // on elevate is best-effort and cannot reach a legacy sidecar, so gate on\n // the owning record's live tier. Envelope peek, no decryption.\n if (await liveRecordIsElevated(ctx.adapter, ctx.vault, ctx.name, id)) continue\n const env = await ctx.adapter.get(ctx.vault, '_vec', vecId)\n if (!env) continue\n // #726 fails-safe: a row can pass isVecIdFor's prefix filter yet still\n // be undecryptable under THIS collection's DEK — a surviving legacy\n // bare-id row whose record id happens to start with `<thisCollection>/`,\n // or plain corruption. _vec sidecars are derived, re-derivable\n // artifacts (embedOnWrite regenerates them on the record's next put()),\n // so best-effort skip is correct: never let one poison row crash\n // similarTo()/retrieve() for the whole collection.\n let body: string | null\n try {\n body = await ctx.codec.decryptJsonString(env)\n } catch {\n continue\n }\n if (body === null) continue\n const parsed = JSON.parse(body) as { vec: number[]; model: string }\n out.push({ id, vec: new Float32Array(parsed.vec), model: parsed.model })\n }\n return out\n }\n}\n\n/**\n * L1.5 — build the PersistedIndexCallbacks bridge: crypto lives here\n * (collection has getDEK / encryptJsonString / decryptJsonString / adapter),\n * the index store itself is crypto-free.\n *\n * Fingerprint encoding: body-wrap approach — save(json, fp) stores\n * JSON.stringify({ fp, idx: json }) as the encrypted body so the standard\n * EncryptedEnvelope shape is never extended. load() decrypts and JSON.parses\n * the wrapper back out.\n *\n * Cache shape: ctx.cache stores { record, version } — currentFingerprint()\n * iterates over e.version.\n *\n * NOTE: this factory is invoked from the `Collection` constructor *before*\n * `this.codec` is assigned, so it takes a context THUNK and resolves the\n * context lazily inside each callback — by the time a callback actually runs,\n * the codec and cache are fully wired.\n */\nexport function buildPersistedIndexCallbacks<T>(provideCtx: () => SearchContext<T>): PersistedIndexCallbacks {\n const FT = '_ftindex'\n return {\n load: async () => {\n const ctx = provideCtx()\n const env = await ctx.adapter.get(ctx.vault, FT, ctx.name)\n if (!env) return null\n const body = await ctx.codec.decryptJsonString(env)\n if (body === null) return null\n try {\n const wrapped = JSON.parse(body) as { fp: { count: number; maxVersion: number }; idx: string }\n return { json: wrapped.idx, fingerprint: wrapped.fp }\n } catch {\n return null\n }\n },\n save: async (json, fp, isStale) => {\n const ctx = provideCtx()\n const body = JSON.stringify({ fp, idx: json })\n const env = await ctx.codec.encryptJsonString(body, fp.count)\n // #725 review: a purge (removePersisted) can land while the encrypt above was\n // in flight — check right before the write and skip it rather than resurrect a\n // purged/forgotten record's blob. PersistedIndexStore's own post-save epoch\n // check is the backstop for every other ordering (incl. a purge landing during\n // this very put).\n if (isStale()) return\n await ctx.adapter.put(ctx.vault, FT, ctx.name, env)\n },\n remove: async () => { const ctx = provideCtx(); await ctx.adapter.delete(ctx.vault, FT, ctx.name) },\n currentFingerprint: () => {\n const ctx = provideCtx()\n let maxVersion = 0\n for (const e of ctx.cache.values()) if (e.version > maxVersion) maxVersion = e.version\n return { count: ctx.cache.size, maxVersion }\n },\n }\n}\n\n/** L1 — pre-build the lexical index (e.g. on open) so the first retrieve() pays no build scan. */\nexport async function warmIndex<T>(ctx: SearchContext<T>): Promise<void> {\n if (!ctx.searchIndexStore) return\n if (ctx.lazy) {\n throw new Error(\n `Collection \"${ctx.name}\": warmIndex() requires eager mode (prefetch: true).`,\n )\n }\n await ctx.ensureHydrated()\n const built = ctx.searchIndexStore.built\n const labelMaps = built ? new Map() : await resolveDictLabelMaps(ctx)\n const blobFilenames = built ? new Map() : await resolveBlobFilenames(ctx)\n await ctx.searchIndexStore.ensureBuilt(() => buildRetrievalDocs(ctx, labelMaps, blobFilenames))\n}\n\n/** Retrieval. mode: 'lexical' (default) | 'semantic' (L2) | 'hybrid' (L3). */\nexport async function retrieve<T>(ctx: SearchContext<T>, query: string, opts: RetrieveOptions<T> = {}): Promise<RetrieveHit<T>[]> {\n const hits =\n opts.mode === 'semantic' ? await retrieveSemantic(ctx, query, opts)\n : opts.mode === 'hybrid' ? await retrieveHybrid(ctx, query, opts)\n : await retrieveLexical(ctx, query, opts)\n return opts.within ? applyWithin(hits, opts.within) : hits\n}\n\n/** L3 — keep only hits whose id matches the structured query, re-rank 1-based. */\nfunction applyWithin<T>(hits: RetrieveHit<T>[], within: Query<T>): RetrieveHit<T>[] {\n const ids = new Set(within._idArray())\n return hits.filter(h => ids.has(h.id)).map((h, i) => ({ ...h, rank: i + 1 }))\n}\n\n/** L1 — client-side lexical retrieval; ranked { id, score, field, snippet, locale? }. */\nasync function retrieveLexical<T>(ctx: SearchContext<T>, query: string, opts: RetrieveOptions<T>): Promise<RetrieveHit<T>[]> {\n if (!ctx.searchIndexStore) {\n throw new Error(`Collection \"${ctx.name}\": retrieve() requires a textIndexes config.`)\n }\n if (ctx.lazy) {\n throw new Error(\n `Collection \"${ctx.name}\": retrieve() requires eager mode (prefetch: true).`,\n )\n }\n await ctx.ensureHydrated()\n const built = ctx.searchIndexStore.built\n const labelMaps = built ? new Map() : await resolveDictLabelMaps(ctx)\n const blobFilenames = built ? new Map() : await resolveBlobFilenames(ctx)\n const index = await ctx.searchIndexStore.ensureBuilt(() => buildRetrievalDocs(ctx, labelMaps, blobFilenames))\n const hits = index.query(query, {\n ...(opts.limit !== undefined ? { limit: opts.limit } : {}),\n ...(opts.match ? { match: opts.match } : {}),\n ...(opts.prefix ? { prefix: opts.prefix } : {}),\n ...(opts.fields ? { fields: opts.fields } : {}),\n })\n const window = opts.snippetWindow ?? 80\n return hits.map((h: IndexHit, i: number) => {\n const base: RetrieveHit<T> = {\n id: h.id,\n score: h.score,\n rank: i + 1,\n field: h.field,\n snippet: extractSnippet(h.text, h.offset, window),\n ...(h.locale !== undefined ? { locale: h.locale } : {}),\n ...(opts.includeRecord\n ? (() => {\n const e = ctx.cache.get(h.id)\n return e ? { record: stripI18nFilled(e.record as Record<string, unknown>) as T } : {}\n })()\n : {}),\n }\n return base\n })\n}\n\n/** L3 — hybrid: fuse lexical (L1) + semantic (L2) by RRF. Requires embeddings. */\nasync function retrieveHybrid<T>(ctx: SearchContext<T>, query: string, opts: RetrieveOptions<T>): Promise<RetrieveHit<T>[]> {\n if (!ctx.embeddings) {\n throw new Error(`Collection \"${ctx.name}\": retrieve({mode:'hybrid'}) requires an embeddings config.`)\n }\n const [lex, sem] = await Promise.all([\n retrieveLexical(ctx, query, opts),\n retrieveSemantic(ctx, query, opts),\n ])\n return fuseRetrieval([lex, sem], opts.limit !== undefined ? { limit: opts.limit } : {})\n}\n\n/** L2 — semantic branch of retrieve(): encode query → similarTo(). */\nasync function retrieveSemantic<T>(ctx: SearchContext<T>, query: string, opts: RetrieveOptions<T>): Promise<RetrieveHit<T>[]> {\n if (!ctx.embeddings) throw new Error(`Collection \"${ctx.name}\": retrieve({mode:'semantic'}) requires an embeddings config.`)\n if (ctx.lazy) throw new Error(`Collection \"${ctx.name}\": retrieve() requires eager mode (prefetch: true).`)\n const qVec = await ctx.embeddings.encode(query)\n return similarTo(ctx, qVec, {\n ...(opts.limit !== undefined ? { k: opts.limit } : {}),\n ...(opts.minScore !== undefined ? { minScore: opts.minScore } : {}),\n ...(opts.includeRecord ? { includeRecord: true } : {}),\n })\n}\n\n/** L2 — raw-vector kNN over the encrypted vector set (decrypted in the trusted tier).\n * Snippet is '' for vector hits in v1 (semantic match isn't span-located). */\nexport async function similarTo<T>(ctx: SearchContext<T>, vector: Float32Array, opts: { k?: number; minScore?: number; includeRecord?: boolean } = {}): Promise<RetrieveHit<T>[]> {\n if (!ctx.embeddings || !ctx.vectorSet) throw new Error(`Collection \"${ctx.name}\": similarTo() requires an embeddings config.`)\n if (ctx.lazy) throw new Error(`Collection \"${ctx.name}\": similarTo() requires eager mode (prefetch: true).`)\n await ctx.ensureHydrated()\n await ctx.vectorSet.ensureLoaded(buildVectorLoad(ctx))\n const hits = ctx.vectorSet.cosineTopK(vector, opts.k ?? 10, {\n ...(opts.minScore !== undefined ? { minScore: opts.minScore } : {}),\n expectModel: ctx.embeddings.model,\n })\n return hits.map((h, i) => {\n const base: RetrieveHit<T> = { id: h.id, score: h.score, rank: i + 1, field: '(vector)', snippet: '' }\n if (opts.includeRecord) { const e = ctx.cache.get(h.id); if (e) (base as { record?: T }).record = stripI18nFilled(e.record as Record<string, unknown>) as T }\n return base\n })\n}\n\n/**\n * L2 — the embedding write-hook: derive a record's embedding vector at\n * write and persist it as the encrypted `_vec` side-car. Routed through the\n * search strategy so it runs only when `withSearch()` is opted in — computing\n * vectors that no gated `similarTo` / semantic `retrieve` could query would be\n * dead weight, so the compute is paired with the search capability. The caller\n * (`Collection.put`) only invokes this when `embeddings` is declared.\n */\nexport async function embedOnWrite<T>(ctx: SearchContext<T>, id: string, record: T, version: number): Promise<void> {\n if (!ctx.embeddings) return\n const text = embeddingSourceText(record as Record<string, unknown>, ctx.embeddings.source)\n const vec = await ctx.embeddings.encode(text)\n if (vec.length !== ctx.embeddings.dim) throw new EmbeddingDimMismatchError('embeddings', ctx.embeddings.dim, vec.length)\n const body = JSON.stringify({ vec: Array.from(vec), model: ctx.embeddings.model, dim: ctx.embeddings.dim })\n const vecEnv = await ctx.codec.encryptJsonString(body, version)\n await ctx.adapter.put(ctx.vault, '_vec', encodeVecId(ctx.name, id), vecEnv)\n ctx.vectorSet?.markDirty()\n}\n\n/**\n * Force-re-derive every eligible tier-0 record's `_vec` sidecar once (#788).\n * Opt-in bulk repair for the #726 re-namespace: legacy bare-id rows are\n * unreachable to `buildVectorLoad` (it only recognises `<collection>/<id>`\n * keys) and otherwise self-heal only when a record is next `put()` — this\n * lets an adopter recover recall immediately instead of waiting on writes.\n *\n * **Skips elevated records** (`liveRecordIsElevated`) rather than refusing\n * the whole walk — the OPPOSITE of `_applyCutoverTransform`'s\n * `assertCutoverTierSafe` refuse-whole-batch precedent. An elevated record is\n * SUPPOSED to have no `_vec` (`syncTierSearch` purges it on elevate);\n * re-embedding one here would write searchable plaintext-derived data above\n * tier 0. Load-bearing: never write a `_vec` row for an elevated record.\n *\n * Tombstones, delete markers, and a raw `get` racing a delete between `list`\n * and `get` all decrypt to `null` (`decryptRecord` already folds\n * tombstone/delete-marker into that null) and are skipped the same way.\n * Unconditional re-derive, no already-migrated check — safe to re-run after\n * a partial failure (each id is independently idempotent).\n */\nexport async function rebuildEmbeddings<T>(ctx: SearchContext<T>): Promise<{ rebuilt: number; skipped: number }> {\n if (!ctx.embeddings) return { rebuilt: 0, skipped: 0 }\n const ids = await ctx.adapter.list(ctx.vault, ctx.name)\n let rebuilt = 0\n let skipped = 0\n for (const id of ids) {\n if (await liveRecordIsElevated(ctx.adapter, ctx.vault, ctx.name, id)) { skipped++; continue }\n const env = await ctx.adapter.get(ctx.vault, ctx.name, id)\n if (!env) { skipped++; continue }\n const decoded = await ctx.codec.decryptRecord(env, { id })\n if (decoded === null) { skipped++; continue }\n await embedOnWrite(ctx, id, decoded, env._v ?? 1)\n rebuilt++\n }\n return { rebuilt, skipped }\n}\n\n/**\n * Sync the collection's SEARCH artifacts after a tier move (#721). Both the\n * lexical `_ftindex` blob and the `_vec/<id>` embedding are encrypted under\n * the tier-0 DEK and hold the record's derived plaintext (full field text /\n * a text-invertible vector), so leaving them means elevation never hid what\n * the record was searchable by — the `forget()` precedent, unapplied to\n * elevate. `null` → the record left tier 0: purge its `_vec` sidecar (mirrors\n * `Collection._purgeVector`), and invalidate the `_ftindex` blob (mirrors\n * `Collection._purgeSearchIndex`: deletes the persisted blob when persisted,\n * else drops the in-memory index) so the next `retrieve()` rebuilds from the\n * elevated-free `ctx.cache`. A record → it is tier-0 again: re-embed it via\n * {@link embedOnWrite}, then invalidate `_ftindex` so the rebuild includes it\n * again. No-op fast when the collection has neither a lexical index nor a\n * vector set.\n */\nexport async function syncTierSearch<T>(\n ctx: SearchContext<T>,\n id: string,\n record: T | null,\n version?: number,\n): Promise<void> {\n if (!ctx.searchIndexStore && !ctx.vectorSet) return\n if (record === null) {\n await ctx.adapter.delete(ctx.vault, '_vec', encodeVecId(ctx.name, id))\n ctx.vectorSet?.markDirty()\n } else {\n await embedOnWrite(ctx, id, record, version ?? 1)\n }\n const store = ctx.searchIndexStore\n if (store && 'removePersisted' in store) await (store as { removePersisted(): Promise<void> }).removePersisted()\n else store?.markDirty()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AACO,SAAS,OAAO,GAA4B,GAAoC;AACrF,MAAI,EAAE,WAAW,EAAE,OAAQ,QAAO;AAClC,MAAI,MAAM,GAAG,KAAK,GAAG,KAAK;AA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QAAI,YAAY,MAAM;AAAE;AAAW;AAAA,IAAS;AAC5C,UAAM,aAAa,KAAK,IAAI,SAAS,IAAI,MAAM,CAAC;AAChD;AAAA,EACF;AACA,SAAO,EAAE,SAAS,QAAQ;AAC5B;AAiBA,eAAsB,eACpB,KACA,IACA,QACA,SACe;AACf,MAAI,CAAC,IAAI,oBAAoB,CAAC,IAAI,UAAW;AAC7C,MAAI,WAAW,MAAM;AACnB,UAAM,IAAI,QAAQ,OAAO,IAAI,OAAO,QAAQ,YAAY,IAAI,MAAM,EAAE,CAAC;AACrE,QAAI,WAAW,UAAU;AAAA,EAC3B,OAAO;AACL,UAAM,aAAa,KAAK,IAAI,QAAQ,WAAW,CAAC;AAAA,EAClD;AACA,QAAM,QAAQ,IAAI;AAClB,MAAI,SAAS,qBAAqB,MAAO,OAAO,MAA+C,gBAAgB;AAAA,MAC1G,QAAO,UAAU;AACxB;","names":["K1","B","search","retrieve","similarTo","warmIndex","flushIndex","embedOnWrite","rebuildEmbeddings"]}
@@ -0,0 +1,54 @@
1
+ import {
2
+ QuiesceTimeoutError
3
+ } from "./chunk-W2OG6JOL.js";
4
+
5
+ // src/port/by/types.ts
6
+ function isQuorum(writers, generation, excludeWriterId) {
7
+ return writers.filter((w) => w.writerId !== excludeWriterId).every((w) => w.quiescedAtVersion === generation);
8
+ }
9
+ async function runDrainBarrier(provider, o, run) {
10
+ await provider.setFence(o.vault, { currentSchemaVersion: o.generation, fenceState: "draining" });
11
+ await o.onFlush();
12
+ const deadline = o.now() + o.quiesceTimeoutMs;
13
+ const seeded = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() });
14
+ if (!isQuorum(seeded, o.generation, o.writerId)) {
15
+ await new Promise((resolve, reject) => {
16
+ let settled = false;
17
+ const finish = (fn) => {
18
+ if (!settled) {
19
+ settled = true;
20
+ unsub();
21
+ fn();
22
+ }
23
+ };
24
+ const unsub = provider.observePresence(o.vault, (writers) => {
25
+ if (isQuorum(writers, o.generation, o.writerId)) finish(resolve);
26
+ });
27
+ const tick = async () => {
28
+ if (settled) return;
29
+ if (o.now() >= deadline) {
30
+ finish(
31
+ () => reject(
32
+ new QuiesceTimeoutError(
33
+ `Cutover of vault "${o.vault}" to generation ${o.generation} timed out after ${o.quiesceTimeoutMs}ms waiting for active writers to quiesce.`
34
+ )
35
+ )
36
+ );
37
+ return;
38
+ }
39
+ if (o.onPoll) await o.onPoll();
40
+ const w = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() });
41
+ if (isQuorum(w, o.generation, o.writerId)) finish(resolve);
42
+ else setTimeout(() => void tick(), 25);
43
+ };
44
+ void tick();
45
+ });
46
+ }
47
+ await run();
48
+ }
49
+
50
+ export {
51
+ isQuorum,
52
+ runDrainBarrier
53
+ };
54
+ //# sourceMappingURL=chunk-ISMV2QVG.js.map
@@ -0,0 +1,95 @@
1
+ import {
2
+ base64ToBuffer,
3
+ decryptBytesWithAAD,
4
+ encryptBytesWithAAD
5
+ } from "./chunk-HOONYZY2.js";
6
+ import {
7
+ TamperedError
8
+ } from "./chunk-W2OG6JOL.js";
9
+
10
+ // src/kernel/enclave/classify/compare.ts
11
+ var subtle = globalThis.crypto.subtle;
12
+ function ctEqualTags(a, b) {
13
+ if (a.length !== 32 || b.length !== 32) {
14
+ throw new Error(
15
+ `ctEqualTags: tags must be exactly 32 bytes (got ${a.length}/${b.length}) \u2014 caller bug; reduce comparands with blindedEqual first`
16
+ );
17
+ }
18
+ let diff = 0;
19
+ for (let i = 0; i < 32; i++) diff |= a[i] ^ b[i];
20
+ return diff === 0;
21
+ }
22
+ async function blindedEqual(a, b) {
23
+ const ke = await subtle.generateKey({ name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
24
+ const tagA = new Uint8Array(await subtle.sign("HMAC", ke, a));
25
+ const tagB = new Uint8Array(await subtle.sign("HMAC", ke, b));
26
+ return ctEqualTags(tagA, tagB);
27
+ }
28
+
29
+ // src/kernel/enclave/classify/vdig.ts
30
+ var subtle2 = globalThis.crypto.subtle;
31
+ var VDIG_SALT_DOMAIN = "noydb-classify-vdig";
32
+ function buildVdigAad(collection, recordId, field) {
33
+ return new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, recordId, field]));
34
+ }
35
+ async function deriveVdigSlotKey(cek, collection, field) {
36
+ const raw = await subtle2.exportKey("raw", cek);
37
+ const hkdf = await subtle2.importKey("raw", raw, "HKDF", false, ["deriveBits"]);
38
+ const salt = new TextEncoder().encode(VDIG_SALT_DOMAIN);
39
+ const info = new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, field]));
40
+ const bits = await subtle2.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info }, hkdf, 256);
41
+ return subtle2.importKey("raw", bits, { name: "AES-GCM", length: 256 }, false, ["encrypt", "decrypt"]);
42
+ }
43
+ async function sealVdigPayload(payload, cek, collection, recordId, field) {
44
+ const key = await deriveVdigSlotKey(cek, collection, field);
45
+ const { iv, data } = await encryptBytesWithAAD(
46
+ new TextEncoder().encode(JSON.stringify(payload)),
47
+ key,
48
+ buildVdigAad(collection, recordId, field)
49
+ );
50
+ return `${iv}:${data}`;
51
+ }
52
+ async function openVdigPayload(blob, cek, collection, recordId, field) {
53
+ const sep = blob.indexOf(":");
54
+ if (sep === -1) throw new TamperedError();
55
+ const ivPart = blob.slice(0, sep);
56
+ const dataPart = blob.slice(sep + 1);
57
+ try {
58
+ base64ToBuffer(ivPart);
59
+ base64ToBuffer(dataPart);
60
+ } catch {
61
+ throw new TamperedError();
62
+ }
63
+ const key = await deriveVdigSlotKey(cek, collection, field);
64
+ const bytes = await decryptBytesWithAAD(
65
+ ivPart,
66
+ dataPart,
67
+ key,
68
+ buildVdigAad(collection, recordId, field)
69
+ );
70
+ return JSON.parse(new TextDecoder().decode(bytes));
71
+ }
72
+
73
+ // src/kernel/enclave/classify/kofn.ts
74
+ function evaluateKofN(results, min) {
75
+ if (!Number.isInteger(min) || min < 1 || min > results.length) {
76
+ throw new Error(
77
+ `evaluateKofN: min ${min} out of range 1..${results.length} \u2014 caller bug (matchGroup validates bounds up front, before any PBKDF2)`
78
+ );
79
+ }
80
+ let count = 0;
81
+ for (const r of results) {
82
+ if (r) count += 1;
83
+ }
84
+ return count >= min;
85
+ }
86
+
87
+ export {
88
+ ctEqualTags,
89
+ blindedEqual,
90
+ deriveVdigSlotKey,
91
+ sealVdigPayload,
92
+ openVdigPayload,
93
+ evaluateKofN
94
+ };
95
+ //# sourceMappingURL=chunk-IY23KFNZ.js.map
@@ -0,0 +1,129 @@
1
+ import {
2
+ ValidationError
3
+ } from "./chunk-W2OG6JOL.js";
4
+
5
+ // src/with-formula/derivations/with-derivation.ts
6
+ function withDerivation(spec) {
7
+ if (!spec.source || spec.source.length === 0) {
8
+ throw new ValidationError("withDerivation: source collection name is required");
9
+ }
10
+ if (!spec.outputs || Object.keys(spec.outputs).length === 0) {
11
+ throw new ValidationError("withDerivation: outputs map must declare at least one output");
12
+ }
13
+ if (spec.deterministic !== true) {
14
+ throw new ValidationError("withDerivation: v1 only supports deterministic derivations");
15
+ }
16
+ if (typeof spec.derive !== "function") {
17
+ throw new ValidationError("withDerivation: derive must be a function");
18
+ }
19
+ if (spec.sources !== void 0) {
20
+ for (const extra of spec.sources) {
21
+ if (typeof extra !== "string" || extra.length === 0) {
22
+ throw new ValidationError("withDerivation: each entry in sources[] must be a non-empty string");
23
+ }
24
+ if (extra === spec.source) {
25
+ throw new ValidationError(
26
+ `withDerivation: sources[] must not contain the primary source "${spec.source}"`
27
+ );
28
+ }
29
+ }
30
+ }
31
+ if (spec.triggerBy !== void 0) {
32
+ for (const t of spec.triggerBy) {
33
+ if (typeof t?.collection !== "string" || t.collection.length === 0) {
34
+ throw new ValidationError("withDerivation: each triggerBy entry needs a non-empty `collection`");
35
+ }
36
+ if (t.collection === spec.source) {
37
+ throw new ValidationError(
38
+ `withDerivation: triggerBy.collection must not equal the source "${spec.source}" (use sources[] for same-id triggers)`
39
+ );
40
+ }
41
+ if (typeof t.on !== "string" || t.on.length === 0) {
42
+ throw new ValidationError(
43
+ `withDerivation: triggerBy on "${t.collection}" needs a non-empty \`on\` (the FK field on the source)`
44
+ );
45
+ }
46
+ if (t.maxFanout !== void 0 && (!Number.isInteger(t.maxFanout) || t.maxFanout < 1)) {
47
+ throw new ValidationError(
48
+ `withDerivation: triggerBy maxFanout on "${t.collection}" must be a positive integer (got ${String(t.maxFanout)}).`
49
+ );
50
+ }
51
+ }
52
+ }
53
+ const lifecycleMode = typeof spec.lifecycle === "string" ? spec.lifecycle : spec.lifecycle.mode;
54
+ for (const [outputKey, outputSpec] of Object.entries(spec.outputs)) {
55
+ if (outputSpec.shape === "record" && outputSpec.collection === spec.source) {
56
+ if (!outputSpec.denorm || outputSpec.denorm.length === 0) {
57
+ throw new ValidationError(
58
+ `withDerivation: self-write output "${outputKey}" (collection === source "${spec.source}") must declare \`denorm: [...]\` naming the fields it maintains.`
59
+ );
60
+ }
61
+ }
62
+ if (outputSpec.shape === "array") {
63
+ if (lifecycleMode !== "eager") {
64
+ throw new ValidationError(
65
+ `withDerivation: shape 'array' supports lifecycle 'eager' only in this release Output "${outputKey}" declared lifecycle '${lifecycleMode}'. Switch to \`lifecycle: "eager"\` or use shape: "record".`
66
+ );
67
+ }
68
+ if (typeof outputSpec.key !== "function") {
69
+ throw new ValidationError(
70
+ `withDerivation: shape 'array' output "${outputKey}" requires \`key: (out) => string\`.`
71
+ );
72
+ }
73
+ if (outputSpec.maxFanout !== void 0) {
74
+ if (!Number.isInteger(outputSpec.maxFanout) || outputSpec.maxFanout < 1) {
75
+ throw new ValidationError(
76
+ `withDerivation: maxFanout for output "${outputKey}" must be a positive integer (got ${String(outputSpec.maxFanout)}).`
77
+ );
78
+ }
79
+ }
80
+ }
81
+ }
82
+ return {
83
+ __noydb_strategy: "derivation",
84
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
+ spec
86
+ };
87
+ }
88
+
89
+ // src/with-formula/derivations/with-rollup.ts
90
+ function withRollup(config) {
91
+ const { from, key, into, field, compute } = config;
92
+ if (!from || from.length === 0) {
93
+ throw new ValidationError("withRollup: `from` (child collection) is required");
94
+ }
95
+ if (!into || into.length === 0) {
96
+ throw new ValidationError("withRollup: `into` (parent collection) is required");
97
+ }
98
+ if (from === into) {
99
+ throw new ValidationError("withRollup: `from` and `into` must be different collections");
100
+ }
101
+ if (!key || key.length === 0) {
102
+ throw new ValidationError("withRollup: `key` (FK field on the child) is required");
103
+ }
104
+ if (!field || field.length === 0) {
105
+ throw new ValidationError("withRollup: `field` (target field on the parent) is required");
106
+ }
107
+ if (typeof compute !== "function") {
108
+ throw new ValidationError("withRollup: `compute` must be a function");
109
+ }
110
+ const spec = {
111
+ source: into,
112
+ // the parent record is what carries the rolled-up field
113
+ deterministic: true,
114
+ rollup: { from, key, field, compute },
115
+ // Synthetic self-write output for registry / cycle bookkeeping. Dispatch
116
+ // patches `field` directly (value-equality guarded); the executor is not run.
117
+ outputs: { value: { shape: "record", collection: into, denorm: [field] } },
118
+ derive: () => ({ value: {} }),
119
+ // never invoked for a rollup strategy
120
+ lifecycle: "eager"
121
+ };
122
+ return { __noydb_strategy: "derivation", spec };
123
+ }
124
+
125
+ export {
126
+ withDerivation,
127
+ withRollup
128
+ };
129
+ //# sourceMappingURL=chunk-JBBSYJHP.js.map
@@ -0,0 +1,117 @@
1
+ import {
2
+ buildAccessibleBundle,
3
+ resolveAccessibleCollections
4
+ } from "./chunk-WKGF2TJR.js";
5
+ import {
6
+ sha256Hex
7
+ } from "./chunk-HOONYZY2.js";
8
+ import {
9
+ NOYDB_FORMAT_VERSION
10
+ } from "./chunk-VCTXU4AT.js";
11
+ import {
12
+ ReadOnlyError
13
+ } from "./chunk-W2OG6JOL.js";
14
+
15
+ // src/with-audit/portability/withdraw-accessible.ts
16
+ var FROZEN_SNAPSHOTS_COLLECTION = "_frozen_snapshots";
17
+ var ENC = new TextEncoder();
18
+ function randomId() {
19
+ const b = globalThis.crypto.getRandomValues(new Uint8Array(12));
20
+ return Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
21
+ }
22
+ async function freezeSnapshotOnly(vault, collections, opts) {
23
+ const { name: vaultName, adapter } = vault._introspectState();
24
+ const closure = [];
25
+ for (const c of collections) {
26
+ for (const id of await adapter.list(vaultName, c)) closure.push({ collection: c, id });
27
+ }
28
+ const withdrawalId = opts.withdrawalId ?? `wd-${randomId()}`;
29
+ const snap = {};
30
+ for (const { collection, id } of closure) {
31
+ const env = await adapter.get(vaultName, collection, id);
32
+ if (env) (snap[collection] ??= {})[id] = env;
33
+ }
34
+ const frozenAt = (/* @__PURE__ */ new Date()).toISOString();
35
+ const body = JSON.stringify({ withdrawalId, frozenAt, by: opts.actorUserId, collections: snap });
36
+ const sha = await sha256Hex(ENC.encode(body));
37
+ await adapter.put(
38
+ vaultName,
39
+ FROZEN_SNAPSHOTS_COLLECTION,
40
+ withdrawalId,
41
+ { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: frozenAt, _iv: "", _data: body, _by: opts.actorUserId },
42
+ 0
43
+ );
44
+ await vault._getLedgerOrNull()?.append({
45
+ op: "lifecycle",
46
+ collection: "",
47
+ id: "",
48
+ version: 0,
49
+ actor: opts.actorUserId,
50
+ payloadHash: "",
51
+ reason: `withdrawal-frozen-snapshot:${withdrawalId}:${sha}`
52
+ });
53
+ return { withdrawalId, sha256: sha, recordCount: closure.length, frozenAt };
54
+ }
55
+ async function freezeAndDeleteClosure(vault, collections, opts) {
56
+ const snapshot = opts.disposition === "freeze" ? await freezeSnapshotOnly(vault, collections, {
57
+ actorUserId: opts.actorUserId,
58
+ ...opts.withdrawalId ? { withdrawalId: opts.withdrawalId } : {}
59
+ }) : void 0;
60
+ const { name: vaultName, adapter } = vault._introspectState();
61
+ for (const c of collections) {
62
+ for (const id of await adapter.list(vaultName, c)) {
63
+ await vault.collection(c).delete(id);
64
+ }
65
+ }
66
+ return snapshot;
67
+ }
68
+ async function withdrawAccessibleData(vault, opts) {
69
+ const { keyring } = vault._introspectState();
70
+ const disposition = opts.disposition ?? "delete";
71
+ if (keyring.role === "owner" || keyring.role === "admin") {
72
+ throw new ReadOnlyError(
73
+ "unilateralWithdrawal is the scoped self-service path; an owner/admin should use extractPartition"
74
+ );
75
+ }
76
+ if (keyring.role === "custodian") {
77
+ throw new ReadOnlyError(
78
+ "a custodian cannot destructively withdraw/sever; use vault.custody.liberate for an audited ownership claim"
79
+ );
80
+ }
81
+ if (keyring.role === "client" || keyring.role === "viewer") {
82
+ throw new ReadOnlyError(
83
+ "read-only role cannot self-serve a destructive withdrawal \u2014 use requestWithdrawal (two-party)"
84
+ );
85
+ }
86
+ const collections = resolveAccessibleCollections(keyring, opts.scope, true);
87
+ if (!collections || collections.length === 0) {
88
+ throw new ReadOnlyError(
89
+ "unilateralWithdrawal requires rw access on the withdrawn collections \u2014 use requestWithdrawal for read-only scope"
90
+ );
91
+ }
92
+ const bundle = await buildAccessibleBundle(vault, collections, opts.reKey);
93
+ const snapshot = await freezeAndDeleteClosure(vault, collections, {
94
+ disposition,
95
+ actorUserId: keyring.userId,
96
+ ...opts.withdrawalId ? { withdrawalId: opts.withdrawalId } : {}
97
+ });
98
+ await vault._getLedgerOrNull()?.append({
99
+ op: "lifecycle",
100
+ collection: "",
101
+ id: "",
102
+ version: 0,
103
+ actor: keyring.userId,
104
+ payloadHash: "",
105
+ reason: `user-unilateral-withdrawal:${keyring.userId}:${disposition}:${opts.legalBasis}`
106
+ });
107
+ return snapshot ? { bundle, snapshot } : { bundle };
108
+ }
109
+
110
+ export {
111
+ FROZEN_SNAPSHOTS_COLLECTION,
112
+ randomId,
113
+ freezeSnapshotOnly,
114
+ freezeAndDeleteClosure,
115
+ withdrawAccessibleData
116
+ };
117
+ //# sourceMappingURL=chunk-JFCV5QIK.js.map
@@ -0,0 +1,23 @@
1
+ // src/with-audit/guards/read-only-facade.ts
2
+ var ReadOnlyVaultFacade = class {
3
+ _vault;
4
+ _layer;
5
+ constructor(vault, layer = "read") {
6
+ this._vault = vault;
7
+ this._layer = layer;
8
+ }
9
+ collection(name) {
10
+ const c = this._vault.collection(name);
11
+ const layer = this._layer;
12
+ return {
13
+ get: (id) => c.get(id, { _layer: layer }),
14
+ list: () => c.list({ _layer: layer }),
15
+ query: () => c.query()
16
+ };
17
+ }
18
+ };
19
+
20
+ export {
21
+ ReadOnlyVaultFacade
22
+ };
23
+ //# sourceMappingURL=chunk-JK733I5V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-audit/guards/read-only-facade.ts"],"sourcesContent":["import type { Vault } from '../../kernel/vault.js'\nimport type { Query } from '../../kernel/query/builder.js'\nimport type { Layer } from '../../via/i18n/policy.js'\nimport type { ReadOnlyVaultFacade as ReadOnlyVaultFacadeContract } from './types.js'\n\n/**\n * Minimal read-only wrapper over a `Vault`. Used as `ctx.vault` inside\n * guard / derivation callbacks so they can fetch related records without\n * acquiring any write capability.\n *\n * The `layer` tags every `get`/`list` read with the resolution layer it\n * belongs to. A guard-seeded facade reads at `'guard'`, a\n * derivation-seeded one at `'derivation'`, so i18nText / dictKey fields\n * resolve under that layer's `onMissing` policy instead of the `'read'`\n * policy — e.g. a guard read can `substitute` a missing locale (lenient\n * default) while the same field `throw`s on an ordinary app read.\n *\n * `query()` is left untagged: the query/aggregate pipeline reads raw\n * `{locale}` maps (no resolution call site), so a layer tag there would be\n * inert. Routing `mv`/`join` resolution through the pipeline is tracked\n * separately.\n */\nexport class ReadOnlyVaultFacade implements ReadOnlyVaultFacadeContract {\n private readonly _vault: Vault\n private readonly _layer: Layer\n\n constructor(vault: Vault, layer: Layer = 'read') {\n this._vault = vault\n this._layer = layer\n }\n\n collection<T = unknown>(name: string): {\n get(id: string): Promise<T | null>\n list(): Promise<T[]>\n query(): Query<T>\n } {\n const c = this._vault.collection<T>(name)\n const layer = this._layer\n return {\n get: (id: string) => c.get(id, { _layer: layer }),\n list: () => c.list({ _layer: layer }),\n query: () => c.query(),\n }\n }\n}\n"],"mappings":";AAsBO,IAAM,sBAAN,MAAiE;AAAA,EACrD;AAAA,EACA;AAAA,EAEjB,YAAY,OAAc,QAAe,QAAQ;AAC/C,SAAK,SAAS;AACd,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,WAAwB,MAItB;AACA,UAAM,IAAI,KAAK,OAAO,WAAc,IAAI;AACxC,UAAM,QAAQ,KAAK;AACnB,WAAO;AAAA,MACL,KAAK,CAAC,OAAe,EAAE,IAAI,IAAI,EAAE,QAAQ,MAAM,CAAC;AAAA,MAChD,MAAM,MAAM,EAAE,KAAK,EAAE,QAAQ,MAAM,CAAC;AAAA,MACpC,OAAO,MAAM,EAAE,MAAM;AAAA,IACvB;AAAA,EACF;AACF;","names":[]}