@noy-db/hub 0.2.0-pre.9 → 0.3.0-pre.10

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 (615) hide show
  1. package/README.md +129 -3
  2. package/dist/aggregate/index.d.ts +5 -2
  3. package/dist/aggregate/index.js +25 -16
  4. package/dist/aggregate/index.js.map +1 -1
  5. package/dist/api-TX2EX2FX.js +20 -0
  6. package/dist/as/index.d.ts +6 -0
  7. package/dist/as/index.js +30 -0
  8. package/dist/at/index.d.ts +4 -0
  9. package/dist/at/index.js +1 -0
  10. package/dist/attestation/index.d.ts +14 -47
  11. package/dist/attestation/index.js +60 -10
  12. package/dist/attestation/index.js.map +1 -1
  13. package/dist/backup-R7NTDFKY.js +225 -0
  14. package/dist/backup-R7NTDFKY.js.map +1 -0
  15. package/dist/blobs/index.d.ts +5 -8
  16. package/dist/blobs/index.js +25 -12
  17. package/dist/blobs/index.js.map +1 -1
  18. package/dist/bundle/index.d.ts +15 -70
  19. package/dist/bundle/index.js +45 -476
  20. package/dist/bundle/index.js.map +1 -1
  21. package/dist/{ulid-CJ8RzRrm.d.ts → bundle-D6GxiUfq.d.ts} +31 -86
  22. package/dist/by/index.d.ts +1 -0
  23. package/dist/by/index.js +11 -0
  24. package/dist/cargo/index.d.ts +7 -0
  25. package/dist/cargo/index.js +95 -0
  26. package/dist/chunk-2OV5NVE7.js +95 -0
  27. package/dist/chunk-2OV5NVE7.js.map +1 -0
  28. package/dist/chunk-2OZXVKVP.js +367 -0
  29. package/dist/chunk-2OZXVKVP.js.map +1 -0
  30. package/dist/{chunk-HNRHLRDC.js → chunk-2REPHKET.js} +6 -5
  31. package/dist/chunk-2REPHKET.js.map +1 -0
  32. package/dist/{chunk-PE2FR4J3.js → chunk-3JXPAHOZ.js} +17 -17
  33. package/dist/chunk-3JXPAHOZ.js.map +1 -0
  34. package/dist/{chunk-H2X3ISXG.js → chunk-3MATJ6O4.js} +7 -7
  35. package/dist/chunk-3MATJ6O4.js.map +1 -0
  36. package/dist/{chunk-PP6W64Y3.js → chunk-3OPY6MK2.js} +132 -3
  37. package/dist/chunk-3OPY6MK2.js.map +1 -0
  38. package/dist/{chunk-T7JEBOGN.js → chunk-3QSIU3UT.js} +49 -71
  39. package/dist/chunk-3QSIU3UT.js.map +1 -0
  40. package/dist/{chunk-ZYWZWG6G.js → chunk-4OMCIY6F.js} +32 -12
  41. package/dist/chunk-4OMCIY6F.js.map +1 -0
  42. package/dist/chunk-4Q6HSHHL.js +90 -0
  43. package/dist/chunk-4Q6HSHHL.js.map +1 -0
  44. package/dist/chunk-5I35DOHK.js +94 -0
  45. package/dist/chunk-5I35DOHK.js.map +1 -0
  46. package/dist/chunk-5VG4IJR7.js +235 -0
  47. package/dist/chunk-5VG4IJR7.js.map +1 -0
  48. package/dist/chunk-5YESYH2C.js +155 -0
  49. package/dist/chunk-5YESYH2C.js.map +1 -0
  50. package/dist/chunk-6G5ORS5D.js +202 -0
  51. package/dist/chunk-6G5ORS5D.js.map +1 -0
  52. package/dist/{chunk-VTKGMEPP.js → chunk-6P5XCKSD.js} +13 -3
  53. package/dist/chunk-6P5XCKSD.js.map +1 -0
  54. package/dist/{chunk-J66GRPNH.js → chunk-6S7T6WC4.js} +2 -2
  55. package/dist/chunk-6S7T6WC4.js.map +1 -0
  56. package/dist/{chunk-U26HQ6KJ.js → chunk-7BWJHO2A.js} +4 -4
  57. package/dist/chunk-7BWJHO2A.js.map +1 -0
  58. package/dist/chunk-7P2SDJG3.js +279 -0
  59. package/dist/chunk-7P2SDJG3.js.map +1 -0
  60. package/dist/chunk-ANB77BVV.js +150 -0
  61. package/dist/chunk-ANB77BVV.js.map +1 -0
  62. package/dist/chunk-AURFOK3D.js +35 -0
  63. package/dist/chunk-AURFOK3D.js.map +1 -0
  64. package/dist/chunk-BKARNZJN.js +382 -0
  65. package/dist/chunk-BKARNZJN.js.map +1 -0
  66. package/dist/{chunk-3BFJOWSU.js → chunk-BQISD5ZV.js} +35 -7
  67. package/dist/chunk-BQISD5ZV.js.map +1 -0
  68. package/dist/{chunk-2GLDA55J.js → chunk-BUAQ7YI3.js} +260 -135
  69. package/dist/chunk-BUAQ7YI3.js.map +1 -0
  70. package/dist/{chunk-2WUSG3IT.js → chunk-CB7CWSKW.js} +5 -5
  71. package/dist/chunk-CB7CWSKW.js.map +1 -0
  72. package/dist/chunk-CHFZDSE4.js +1 -0
  73. package/dist/{aggregate/index.cjs → chunk-DFVUTGT2.js} +206 -222
  74. package/dist/chunk-DFVUTGT2.js.map +1 -0
  75. package/dist/chunk-DJ7KIPLV.js +23 -0
  76. package/dist/chunk-DJ7KIPLV.js.map +1 -0
  77. package/dist/chunk-DSKDQP3G.js +14066 -0
  78. package/dist/chunk-DSKDQP3G.js.map +1 -0
  79. package/dist/{chunk-5T22KDPN.js → chunk-DV4HUP5G.js} +10 -8
  80. package/dist/chunk-DV4HUP5G.js.map +1 -0
  81. package/dist/chunk-EOXAAJTY.js +621 -0
  82. package/dist/chunk-EOXAAJTY.js.map +1 -0
  83. package/dist/chunk-ET67AY6B.js +74 -0
  84. package/dist/chunk-ET67AY6B.js.map +1 -0
  85. package/dist/chunk-F4CEK5YM.js +123 -0
  86. package/dist/chunk-F4CEK5YM.js.map +1 -0
  87. package/dist/chunk-FORYWFN6.js +130 -0
  88. package/dist/chunk-FORYWFN6.js.map +1 -0
  89. package/dist/{chunk-JWRVQKRZ.js → chunk-FRP6D2DM.js} +21 -20
  90. package/dist/chunk-FRP6D2DM.js.map +1 -0
  91. package/dist/chunk-FUOE7UUV.js +341 -0
  92. package/dist/chunk-FUOE7UUV.js.map +1 -0
  93. package/dist/chunk-G4JYND6L.js +42 -0
  94. package/dist/chunk-G4JYND6L.js.map +1 -0
  95. package/dist/{chunk-53XBRIRT.js → chunk-G6XV4H65.js} +9 -9
  96. package/dist/chunk-G6XV4H65.js.map +1 -0
  97. package/dist/chunk-GHVIKOHT.js +1 -0
  98. package/dist/{chunk-PX35GA7L.js → chunk-GNMXXTMN.js} +11 -9
  99. package/dist/chunk-GNMXXTMN.js.map +1 -0
  100. package/dist/chunk-GYGLAVCX.js +19 -0
  101. package/dist/chunk-GYGLAVCX.js.map +1 -0
  102. package/dist/chunk-HPWKV3YB.js +21 -0
  103. package/dist/chunk-HPWKV3YB.js.map +1 -0
  104. package/dist/chunk-HY3AUMFI.js +41 -0
  105. package/dist/chunk-HY3AUMFI.js.map +1 -0
  106. package/dist/chunk-HYR4WZZ3.js +69 -0
  107. package/dist/chunk-HYR4WZZ3.js.map +1 -0
  108. package/dist/chunk-I7FD46FF.js +9 -0
  109. package/dist/chunk-I7FD46FF.js.map +1 -0
  110. package/dist/{chunk-TFBP23BX.js → chunk-ICXIFFYZ.js} +66 -7
  111. package/dist/chunk-ICXIFFYZ.js.map +1 -0
  112. package/dist/{chunk-TV3YZ35S.js → chunk-IGJCYUT5.js} +17 -8
  113. package/dist/chunk-IGJCYUT5.js.map +1 -0
  114. package/dist/{chunk-F3GDRNUT.js → chunk-IVLTXX4W.js} +36 -68
  115. package/dist/chunk-IVLTXX4W.js.map +1 -0
  116. package/dist/{chunk-DONMZAD2.js → chunk-J4LPNIGK.js} +62 -169
  117. package/dist/chunk-J4LPNIGK.js.map +1 -0
  118. package/dist/chunk-JJZ2LW6T.js +36 -0
  119. package/dist/chunk-JJZ2LW6T.js.map +1 -0
  120. package/dist/chunk-JK733I5V.js +23 -0
  121. package/dist/chunk-JK733I5V.js.map +1 -0
  122. package/dist/{chunk-3YPCK6JX.js → chunk-KJ2BCBTL.js} +181 -422
  123. package/dist/chunk-KJ2BCBTL.js.map +1 -0
  124. package/dist/chunk-KNZB6JMR.js +129 -0
  125. package/dist/chunk-KNZB6JMR.js.map +1 -0
  126. package/dist/{chunk-OIF6LZUR.js → chunk-KPZS5QAQ.js} +30 -11
  127. package/dist/chunk-KPZS5QAQ.js.map +1 -0
  128. package/dist/chunk-LB7FD65R.js +163 -0
  129. package/dist/chunk-LB7FD65R.js.map +1 -0
  130. package/dist/{chunk-DO7C2TOG.js → chunk-LEJIKBBB.js} +3 -3
  131. package/dist/{chunk-DO7C2TOG.js.map → chunk-LEJIKBBB.js.map} +1 -1
  132. package/dist/{chunk-O3VZPBZG.js → chunk-LL2NIVUR.js} +56 -13
  133. package/dist/chunk-LL2NIVUR.js.map +1 -0
  134. package/dist/chunk-LP7BEXCT.js +32 -0
  135. package/dist/chunk-LP7BEXCT.js.map +1 -0
  136. package/dist/chunk-MCHVVJIA.js +968 -0
  137. package/dist/chunk-MCHVVJIA.js.map +1 -0
  138. package/dist/chunk-NO272T7Q.js +194 -0
  139. package/dist/chunk-NO272T7Q.js.map +1 -0
  140. package/dist/{chunk-22DWZL57.js → chunk-NUEQU36L.js} +70 -267
  141. package/dist/chunk-NUEQU36L.js.map +1 -0
  142. package/dist/chunk-O45M6LDB.js +38 -0
  143. package/dist/chunk-O45M6LDB.js.map +1 -0
  144. package/dist/chunk-OBKWYKYC.js +117 -0
  145. package/dist/chunk-OBKWYKYC.js.map +1 -0
  146. package/dist/{chunk-DJHHA6XH.js → chunk-OHHKHSJP.js} +50 -20
  147. package/dist/chunk-OHHKHSJP.js.map +1 -0
  148. package/dist/chunk-OT76OZL6.js +45 -0
  149. package/dist/chunk-OT76OZL6.js.map +1 -0
  150. package/dist/chunk-OVYRLHPE.js +150 -0
  151. package/dist/chunk-OVYRLHPE.js.map +1 -0
  152. package/dist/{chunk-ML236QKC.js → chunk-OXCSVM3B.js} +5 -5
  153. package/dist/chunk-OXCSVM3B.js.map +1 -0
  154. package/dist/chunk-P33LUIML.js +205 -0
  155. package/dist/chunk-P33LUIML.js.map +1 -0
  156. package/dist/{chunk-DL3HWOQ5.js → chunk-PLS64NCS.js} +10 -8
  157. package/dist/chunk-PLS64NCS.js.map +1 -0
  158. package/dist/{chunk-SYMWGEET.js → chunk-PS2NEWEX.js} +3 -3
  159. package/dist/chunk-PS2NEWEX.js.map +1 -0
  160. package/dist/chunk-PY4KJPYU.js +9 -0
  161. package/dist/chunk-PY4KJPYU.js.map +1 -0
  162. package/dist/chunk-PZ5AY32C.js +10 -0
  163. package/dist/chunk-QA2KUPCP.js +45 -0
  164. package/dist/chunk-QA2KUPCP.js.map +1 -0
  165. package/dist/chunk-QOC3VYL2.js +30 -0
  166. package/dist/chunk-QOC3VYL2.js.map +1 -0
  167. package/dist/{chunk-BVRYKATC.js → chunk-QSFOZUYL.js} +62 -34
  168. package/dist/chunk-QSFOZUYL.js.map +1 -0
  169. package/dist/chunk-RHK32N73.js +30 -0
  170. package/dist/chunk-RHK32N73.js.map +1 -0
  171. package/dist/{chunk-K3DK3NU5.js → chunk-RW3Y22MW.js} +20 -5
  172. package/dist/chunk-RW3Y22MW.js.map +1 -0
  173. package/dist/{chunk-B6PB7JLN.js → chunk-S7VFUQM2.js} +541 -6
  174. package/dist/chunk-S7VFUQM2.js.map +1 -0
  175. package/dist/chunk-SVLR4POP.js +64 -0
  176. package/dist/chunk-SVLR4POP.js.map +1 -0
  177. package/dist/chunk-T7WSLRAU.js +49 -0
  178. package/dist/chunk-T7WSLRAU.js.map +1 -0
  179. package/dist/{chunk-WPLVTJ5D.js → chunk-TAKWLZZX.js} +285 -63
  180. package/dist/chunk-TAKWLZZX.js.map +1 -0
  181. package/dist/chunk-THNJ3IKU.js +17 -0
  182. package/dist/chunk-THNJ3IKU.js.map +1 -0
  183. package/dist/{chunk-XJFLDA7A.js → chunk-TMBXVJKT.js} +9 -6
  184. package/dist/chunk-TMBXVJKT.js.map +1 -0
  185. package/dist/chunk-TWKKOM55.js +54 -0
  186. package/dist/chunk-TWKKOM55.js.map +1 -0
  187. package/dist/chunk-U3WZCU7E.js +14 -0
  188. package/dist/chunk-U3WZCU7E.js.map +1 -0
  189. package/dist/{chunk-Z6FNBOTC.js → chunk-UF362QVH.js} +15 -17
  190. package/dist/chunk-UF362QVH.js.map +1 -0
  191. package/dist/chunk-UN4FVIBH.js +135 -0
  192. package/dist/chunk-UN4FVIBH.js.map +1 -0
  193. package/dist/chunk-VEAVKDDB.js +29 -0
  194. package/dist/chunk-VEAVKDDB.js.map +1 -0
  195. package/dist/chunk-VEPTFUJY.js +29 -0
  196. package/dist/chunk-VEPTFUJY.js.map +1 -0
  197. package/dist/chunk-VJV7GKQK.js +662 -0
  198. package/dist/chunk-VJV7GKQK.js.map +1 -0
  199. package/dist/{chunk-2QR2PQTT.js → chunk-VQNJ7UZL.js} +5 -3
  200. package/dist/chunk-VQNJ7UZL.js.map +1 -0
  201. package/dist/chunk-VQRAIPYF.js +50 -0
  202. package/dist/chunk-VQRAIPYF.js.map +1 -0
  203. package/dist/{chunk-DFMLEQZB.js → chunk-VRIYFLBA.js} +5 -10
  204. package/dist/chunk-VRIYFLBA.js.map +1 -0
  205. package/dist/chunk-VWM3DAVB.js +265 -0
  206. package/dist/chunk-VWM3DAVB.js.map +1 -0
  207. package/dist/{chunk-NONAAENK.js → chunk-VWRRVE6D.js} +11 -4
  208. package/dist/chunk-VWRRVE6D.js.map +1 -0
  209. package/dist/chunk-VYYM3MEN.js +98 -0
  210. package/dist/chunk-VYYM3MEN.js.map +1 -0
  211. package/dist/chunk-WBJIQSLL.js +167 -0
  212. package/dist/chunk-WBJIQSLL.js.map +1 -0
  213. package/dist/chunk-WIGQB62E.js +164 -0
  214. package/dist/chunk-WIGQB62E.js.map +1 -0
  215. package/dist/{chunk-EMIGCR7X.js → chunk-WXSYDNBT.js} +2 -2
  216. package/dist/chunk-WXSYDNBT.js.map +1 -0
  217. package/dist/chunk-WZSCE6RM.js +466 -0
  218. package/dist/chunk-WZSCE6RM.js.map +1 -0
  219. package/dist/chunk-XGDAPN6M.js +255 -0
  220. package/dist/chunk-XGDAPN6M.js.map +1 -0
  221. package/dist/{chunk-QODLLGQ7.js → chunk-XH7XP3OL.js} +372 -37
  222. package/dist/chunk-XH7XP3OL.js.map +1 -0
  223. package/dist/chunk-XREOISSI.js +40 -0
  224. package/dist/chunk-XREOISSI.js.map +1 -0
  225. package/dist/chunk-XUBPSPKD.js +164 -0
  226. package/dist/chunk-XUBPSPKD.js.map +1 -0
  227. package/dist/chunk-Y3A5CB5G.js +247 -0
  228. package/dist/chunk-Y3A5CB5G.js.map +1 -0
  229. package/dist/{chunk-I5FOWO4J.js → chunk-YCXCR7VG.js} +52 -73
  230. package/dist/chunk-YCXCR7VG.js.map +1 -0
  231. package/dist/{chunk-A3JMGXPG.js → chunk-YMUGBZN2.js} +2 -2
  232. package/dist/chunk-YMUGBZN2.js.map +1 -0
  233. package/dist/chunk-YMVQD5Q5.js +453 -0
  234. package/dist/chunk-YMVQD5Q5.js.map +1 -0
  235. package/dist/chunk-YN5IAHN6.js +32 -0
  236. package/dist/chunk-YN5IAHN6.js.map +1 -0
  237. package/dist/{chunk-FZU343FL.js → chunk-ZJADGNYF.js} +2 -2
  238. package/dist/chunk-ZJADGNYF.js.map +1 -0
  239. package/dist/chunk-ZYJ55N7N.js +86 -0
  240. package/dist/chunk-ZYJ55N7N.js.map +1 -0
  241. package/dist/classified/index.d.ts +16 -0
  242. package/dist/classified/index.js +40 -0
  243. package/dist/classified-marker-H6YSHYNK.js +24 -0
  244. package/dist/classified-marker-H6YSHYNK.js.map +1 -0
  245. package/dist/collection-facade-LVD22JLM.js +39 -0
  246. package/dist/computed-EXDMQODG.js +11 -0
  247. package/dist/consent/index.d.ts +4 -7
  248. package/dist/consent/index.js +13 -5
  249. package/dist/consent/index.js.map +1 -1
  250. package/dist/crdt/index.d.ts +5 -2
  251. package/dist/crdt/index.js +3 -2
  252. package/dist/crdt/index.js.map +1 -1
  253. package/dist/dead-filter-HQIE2YG7.js +28 -0
  254. package/dist/dead-filter-HQIE2YG7.js.map +1 -0
  255. package/dist/decrypt-partition-IHtxEnTi.d.ts +21 -0
  256. package/dist/delegation-BJP73GAP.js +25 -0
  257. package/dist/derivations/index.d.ts +6 -9
  258. package/dist/derivations/index.js +18 -6
  259. package/dist/derive-BME7HDWO.js +21 -0
  260. package/dist/{dev-unlock-B4kDxep_.d.ts → dev-unlock-Bmm2pgJ0.d.ts} +1 -1
  261. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  262. package/dist/enclave-NHORSWSF.js +125 -0
  263. package/dist/executor-FE6X4LFX.js +9 -0
  264. package/dist/executor-KSHKRJXP.js +25 -0
  265. package/dist/executor-ZHTJJICG.js +9 -0
  266. package/dist/export-accessible-DACHM5VT.js +23 -0
  267. package/dist/extract-partition-RNENZZ4T.js +36 -0
  268. package/dist/fanout-sidecar-OFWN3NM7.js +74 -0
  269. package/dist/fanout-sidecar-OFWN3NM7.js.map +1 -0
  270. package/dist/fence-watcher-DHQ775JB.js +69 -0
  271. package/dist/fence-watcher-DHQ775JB.js.map +1 -0
  272. package/dist/find-BNGBJNKP.js +11 -0
  273. package/dist/forget/index.d.ts +36 -0
  274. package/dist/forget/index.js +25 -0
  275. package/dist/forget/index.js.map +1 -0
  276. package/dist/guards/index.d.ts +12 -9
  277. package/dist/guards/index.js +12 -5
  278. package/dist/{hash-DdpVypUp.d.cts → hash-DAJjMsCE.d.ts} +10 -1
  279. package/dist/history/index.d.ts +5 -8
  280. package/dist/history/index.js +25 -12
  281. package/dist/history/index.js.map +1 -1
  282. package/dist/i18n/index.d.ts +25 -8
  283. package/dist/i18n/index.js +137 -29
  284. package/dist/i18n/index.js.map +1 -1
  285. package/dist/in/index.d.ts +4 -0
  286. package/dist/in/index.js +1 -0
  287. package/dist/in/index.js.map +1 -0
  288. package/dist/index-B9QdHytu.d.ts +123 -0
  289. package/dist/index-DjWbxsjb.d.ts +23579 -0
  290. package/dist/index-qwuNvO2B.d.ts +144 -0
  291. package/dist/index.d.ts +1179 -449
  292. package/dist/index.js +2524 -312
  293. package/dist/index.js.map +1 -1
  294. package/dist/indexing/index.d.ts +5 -3
  295. package/dist/indexing/index.js +6 -5
  296. package/dist/indexing/index.js.map +1 -1
  297. package/dist/issue-NDI4CVZU.js +19 -0
  298. package/dist/issue-NDI4CVZU.js.map +1 -0
  299. package/dist/json-schema-I22JCYCG.js +44 -0
  300. package/dist/json-schema-I22JCYCG.js.map +1 -0
  301. package/dist/lazy/index.d.ts +20 -0
  302. package/dist/lazy/index.js +12 -0
  303. package/dist/lazy/index.js.map +1 -0
  304. package/dist/ledger-6NDS2EO4.js +42 -0
  305. package/dist/ledger-6NDS2EO4.js.map +1 -0
  306. package/dist/liberate-HN3RIGIP.js +24 -0
  307. package/dist/liberate-HN3RIGIP.js.map +1 -0
  308. package/dist/link-set-SJB2MVJV.js +31 -0
  309. package/dist/link-set-SJB2MVJV.js.map +1 -0
  310. package/dist/materialized-views/index.d.ts +23 -20
  311. package/dist/materialized-views/index.js +26 -12
  312. package/dist/mime-magic-bBj5OgUC.d.ts +103 -0
  313. package/dist/noydb-BWF6EPIR.js +66 -0
  314. package/dist/noydb-BWF6EPIR.js.map +1 -0
  315. package/dist/on/index.d.ts +4 -0
  316. package/dist/on/index.js +17 -0
  317. package/dist/on/index.js.map +1 -0
  318. package/dist/overlay-views/index.d.ts +26 -11
  319. package/dist/overlay-views/index.js +7 -6
  320. package/dist/periods/index.d.ts +4 -7
  321. package/dist/periods/index.js +27 -9
  322. package/dist/pod/index.d.ts +62 -0
  323. package/dist/pod/index.js +67 -0
  324. package/dist/pod/index.js.map +1 -0
  325. package/dist/policy-WGNAG5H6.js +41 -0
  326. package/dist/policy-WGNAG5H6.js.map +1 -0
  327. package/dist/portability/index.d.ts +19 -0
  328. package/dist/portability/index.js +43 -0
  329. package/dist/portability/index.js.map +1 -0
  330. package/dist/post-register-CWKBQRC7.js +55 -0
  331. package/dist/post-register-CWKBQRC7.js.map +1 -0
  332. package/dist/{public-envelope-BW6OXORV.js → public-envelope-EJLVIFX7.js} +6 -5
  333. package/dist/public-envelope-EJLVIFX7.js.map +1 -0
  334. package/dist/query/index.d.ts +4 -3
  335. package/dist/query/index.js +24 -13
  336. package/dist/read-only-facade-CHCKSEPD.js +8 -0
  337. package/dist/read-only-facade-CHCKSEPD.js.map +1 -0
  338. package/dist/register-SBIX7TVV.js +23 -0
  339. package/dist/register-SBIX7TVV.js.map +1 -0
  340. package/dist/registry-3EQG6OOE.js +18 -0
  341. package/dist/registry-3EQG6OOE.js.map +1 -0
  342. package/dist/registry-CA327ACV.js +9 -0
  343. package/dist/registry-CA327ACV.js.map +1 -0
  344. package/dist/registry-E7OXOTSV.js +19 -0
  345. package/dist/registry-E7OXOTSV.js.map +1 -0
  346. package/dist/registry-VW6P6A3J.js +8 -0
  347. package/dist/registry-VW6P6A3J.js.map +1 -0
  348. package/dist/request-withdrawal-KAH2AAXC.js +31 -0
  349. package/dist/request-withdrawal-KAH2AAXC.js.map +1 -0
  350. package/dist/reveal-R3JLHMUF.js +38 -0
  351. package/dist/reveal-R3JLHMUF.js.map +1 -0
  352. package/dist/revoke-IXLOJ3IH.js +24 -0
  353. package/dist/revoke-IXLOJ3IH.js.map +1 -0
  354. package/dist/satellites/index.d.ts +4 -0
  355. package/dist/satellites/index.js +8 -0
  356. package/dist/satellites/index.js.map +1 -0
  357. package/dist/sealed-record/index.d.ts +68 -0
  358. package/dist/sealed-record/index.js +71 -0
  359. package/dist/sealed-record/index.js.map +1 -0
  360. package/dist/session/index.d.ts +5 -8
  361. package/dist/session/index.js +13 -5
  362. package/dist/session/index.js.map +1 -1
  363. package/dist/shadow/index.d.ts +4 -7
  364. package/dist/shadow/index.js +4 -3
  365. package/dist/shadow/index.js.map +1 -1
  366. package/dist/signer-Y46N2GJ3.js +25 -0
  367. package/dist/signer-Y46N2GJ3.js.map +1 -0
  368. package/dist/snapshots/index.d.ts +5 -8
  369. package/dist/snapshots/index.js +19 -11
  370. package/dist/snapshots/index.js.map +1 -1
  371. package/dist/{stale-6ZDBTQT7.js → stale-Z7IW6RIL.js} +3 -2
  372. package/dist/stale-Z7IW6RIL.js.map +1 -0
  373. package/dist/storage-ADNP2UWI.js +23 -0
  374. package/dist/storage-ADNP2UWI.js.map +1 -0
  375. package/dist/store-coordination-provider-DTDMI6VL.js +142 -0
  376. package/dist/store-coordination-provider-DTDMI6VL.js.map +1 -0
  377. package/dist/subject-index-CyOgGMJL.d.ts +380 -0
  378. package/dist/sync/index.d.ts +3 -6
  379. package/dist/sync/index.js +13 -6
  380. package/dist/sync/index.js.map +1 -1
  381. package/dist/team/index.d.ts +46 -10
  382. package/dist/team/index.js +35 -18
  383. package/dist/tiers/index.d.ts +4 -0
  384. package/dist/tiers/index.js +39 -0
  385. package/dist/tiers/index.js.map +1 -0
  386. package/dist/to/index.d.ts +4 -0
  387. package/dist/to/index.js +16 -0
  388. package/dist/to/index.js.map +1 -0
  389. package/dist/transition-guard-DI-krBsZ.d.ts +165 -0
  390. package/dist/tx/index.d.ts +22 -9
  391. package/dist/tx/index.js +13 -8
  392. package/dist/tx/index.js.map +1 -1
  393. package/dist/ui/index.d.ts +4 -0
  394. package/dist/ui/index.js +1 -0
  395. package/dist/ui/index.js.map +1 -0
  396. package/dist/ulid-DRH25k3y.d.ts +66 -0
  397. package/dist/ulid-PTAIMDG4.js +10 -0
  398. package/dist/ulid-PTAIMDG4.js.map +1 -0
  399. package/dist/util/index.d.ts +2 -0
  400. package/dist/util/index.js +7 -2
  401. package/dist/util/index.js.map +1 -1
  402. package/dist/validators-BUcli5Nh.d.ts +101 -0
  403. package/dist/vault-diff-Z2DUayMe.d.ts +147 -0
  404. package/dist/verify-JPF2YR5E.js +139 -0
  405. package/dist/verify-JPF2YR5E.js.map +1 -0
  406. package/dist/walk-XYA2O3LW.js +241 -0
  407. package/dist/walk-XYA2O3LW.js.map +1 -0
  408. package/dist/with/index.d.ts +37 -0
  409. package/dist/with/index.js +31 -0
  410. package/dist/with/index.js.map +1 -0
  411. package/dist/{with-materialized-view-BLkQxoQN.d.ts → with-materialized-view-BUmzlXue.d.ts} +1 -1
  412. package/dist/{with-overlayed-view-CRsSEwHR.d.ts → with-overlayed-view-m4FaXXTO.d.ts} +2 -3
  413. package/dist/with-rollup-DEKGI9vb.d.ts +47 -0
  414. package/dist/withdraw-accessible-WLV4MTEN.js +28 -0
  415. package/dist/withdraw-accessible-WLV4MTEN.js.map +1 -0
  416. package/dist/zod-HAJM7LMS.js +14763 -0
  417. package/dist/zod-HAJM7LMS.js.map +1 -0
  418. package/package.json +122 -202
  419. package/dist/aggregate/index.cjs.map +0 -1
  420. package/dist/aggregate/index.d.cts +0 -38
  421. package/dist/attestation/index.cjs +0 -305
  422. package/dist/attestation/index.cjs.map +0 -1
  423. package/dist/attestation/index.d.cts +0 -52
  424. package/dist/blobs/index.cjs +0 -1480
  425. package/dist/blobs/index.cjs.map +0 -1
  426. package/dist/blobs/index.d.cts +0 -46
  427. package/dist/bundle/index.cjs +0 -19264
  428. package/dist/bundle/index.cjs.map +0 -1
  429. package/dist/bundle/index.d.cts +0 -176
  430. package/dist/chunk-22DWZL57.js.map +0 -1
  431. package/dist/chunk-2GLDA55J.js.map +0 -1
  432. package/dist/chunk-2QR2PQTT.js.map +0 -1
  433. package/dist/chunk-2WUSG3IT.js.map +0 -1
  434. package/dist/chunk-3BFJOWSU.js.map +0 -1
  435. package/dist/chunk-3YPCK6JX.js.map +0 -1
  436. package/dist/chunk-53XBRIRT.js.map +0 -1
  437. package/dist/chunk-5T22KDPN.js.map +0 -1
  438. package/dist/chunk-5XHKQ56N.js +0 -340
  439. package/dist/chunk-5XHKQ56N.js.map +0 -1
  440. package/dist/chunk-6CME4UEK.js +0 -10329
  441. package/dist/chunk-6CME4UEK.js.map +0 -1
  442. package/dist/chunk-6STK5TQP.js +0 -139
  443. package/dist/chunk-6STK5TQP.js.map +0 -1
  444. package/dist/chunk-A3JMGXPG.js.map +0 -1
  445. package/dist/chunk-B6PB7JLN.js.map +0 -1
  446. package/dist/chunk-BVRYKATC.js.map +0 -1
  447. package/dist/chunk-DE6GKS6G.js +0 -79
  448. package/dist/chunk-DE6GKS6G.js.map +0 -1
  449. package/dist/chunk-DFMLEQZB.js.map +0 -1
  450. package/dist/chunk-DJHHA6XH.js.map +0 -1
  451. package/dist/chunk-DL3HWOQ5.js.map +0 -1
  452. package/dist/chunk-DONMZAD2.js.map +0 -1
  453. package/dist/chunk-EMIGCR7X.js.map +0 -1
  454. package/dist/chunk-F3GDRNUT.js.map +0 -1
  455. package/dist/chunk-FZU343FL.js.map +0 -1
  456. package/dist/chunk-H2X3ISXG.js.map +0 -1
  457. package/dist/chunk-HNRHLRDC.js.map +0 -1
  458. package/dist/chunk-I5FOWO4J.js.map +0 -1
  459. package/dist/chunk-J66GRPNH.js.map +0 -1
  460. package/dist/chunk-JWRVQKRZ.js.map +0 -1
  461. package/dist/chunk-K3DK3NU5.js.map +0 -1
  462. package/dist/chunk-ML236QKC.js.map +0 -1
  463. package/dist/chunk-NONAAENK.js.map +0 -1
  464. package/dist/chunk-O3VZPBZG.js.map +0 -1
  465. package/dist/chunk-OIF6LZUR.js.map +0 -1
  466. package/dist/chunk-OQ6PIGHA.js +0 -19
  467. package/dist/chunk-OQ6PIGHA.js.map +0 -1
  468. package/dist/chunk-PE2FR4J3.js.map +0 -1
  469. package/dist/chunk-PP6W64Y3.js.map +0 -1
  470. package/dist/chunk-PX35GA7L.js.map +0 -1
  471. package/dist/chunk-QEILDE6R.js +0 -793
  472. package/dist/chunk-QEILDE6R.js.map +0 -1
  473. package/dist/chunk-QODLLGQ7.js.map +0 -1
  474. package/dist/chunk-RAZ4OVLL.js +0 -51
  475. package/dist/chunk-RAZ4OVLL.js.map +0 -1
  476. package/dist/chunk-SYMWGEET.js.map +0 -1
  477. package/dist/chunk-T7JEBOGN.js.map +0 -1
  478. package/dist/chunk-TFBP23BX.js.map +0 -1
  479. package/dist/chunk-TV3YZ35S.js.map +0 -1
  480. package/dist/chunk-U26HQ6KJ.js.map +0 -1
  481. package/dist/chunk-UF3BUNQZ.js +0 -1
  482. package/dist/chunk-UMLVJTYV.js +0 -20
  483. package/dist/chunk-UMLVJTYV.js.map +0 -1
  484. package/dist/chunk-VTKGMEPP.js.map +0 -1
  485. package/dist/chunk-W6EQLGMB.js +0 -100
  486. package/dist/chunk-W6EQLGMB.js.map +0 -1
  487. package/dist/chunk-WIRRPTFH.js +0 -17
  488. package/dist/chunk-WIRRPTFH.js.map +0 -1
  489. package/dist/chunk-WPLVTJ5D.js.map +0 -1
  490. package/dist/chunk-XJFLDA7A.js.map +0 -1
  491. package/dist/chunk-Z6FNBOTC.js.map +0 -1
  492. package/dist/chunk-ZYWZWG6G.js.map +0 -1
  493. package/dist/consent/index.cjs +0 -204
  494. package/dist/consent/index.cjs.map +0 -1
  495. package/dist/consent/index.d.cts +0 -25
  496. package/dist/crdt/index.cjs +0 -152
  497. package/dist/crdt/index.cjs.map +0 -1
  498. package/dist/crdt/index.d.cts +0 -30
  499. package/dist/crypto-HTZ4FJOP.js +0 -44
  500. package/dist/delegation-RI54P6I5.js +0 -17
  501. package/dist/derivations/index.cjs +0 -351
  502. package/dist/derivations/index.cjs.map +0 -1
  503. package/dist/derivations/index.d.cts +0 -72
  504. package/dist/dev-unlock-BIoEFbwm.d.cts +0 -263
  505. package/dist/executor-5PNY7LGW.js +0 -8
  506. package/dist/executor-B4QIYGZX.js +0 -8
  507. package/dist/executor-BWXXDQ7K.js +0 -11
  508. package/dist/fanout-sidecar-OKPMMPLG.js +0 -51
  509. package/dist/fanout-sidecar-OKPMMPLG.js.map +0 -1
  510. package/dist/guards/index.cjs +0 -322
  511. package/dist/guards/index.cjs.map +0 -1
  512. package/dist/guards/index.d.cts +0 -31
  513. package/dist/hash-HJqD14vS.d.ts +0 -63
  514. package/dist/history/index.cjs +0 -1222
  515. package/dist/history/index.cjs.map +0 -1
  516. package/dist/history/index.d.cts +0 -63
  517. package/dist/i18n/index.cjs +0 -1100
  518. package/dist/i18n/index.cjs.map +0 -1
  519. package/dist/i18n/index.d.cts +0 -39
  520. package/dist/index-4fBVt8j9.d.cts +0 -2387
  521. package/dist/index-D8I_pyJD.d.ts +0 -2387
  522. package/dist/index.cjs +0 -24487
  523. package/dist/index.cjs.map +0 -1
  524. package/dist/index.d.cts +0 -776
  525. package/dist/indexing/index.cjs +0 -742
  526. package/dist/indexing/index.cjs.map +0 -1
  527. package/dist/indexing/index.d.cts +0 -36
  528. package/dist/issue-VGDPP4B5.js +0 -12
  529. package/dist/lazy-builder-7tIpFyWN.d.ts +0 -304
  530. package/dist/lazy-builder-wY4pMCEe.d.cts +0 -304
  531. package/dist/ledger-TMRZYNVJ.js +0 -33
  532. package/dist/materialized-views/index.cjs +0 -854
  533. package/dist/materialized-views/index.cjs.map +0 -1
  534. package/dist/materialized-views/index.d.cts +0 -186
  535. package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
  536. package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
  537. package/dist/noydb-G725ZSZG.js +0 -34
  538. package/dist/overlay-views/index.cjs +0 -359
  539. package/dist/overlay-views/index.cjs.map +0 -1
  540. package/dist/overlay-views/index.d.cts +0 -82
  541. package/dist/periods/index.cjs +0 -1041
  542. package/dist/periods/index.cjs.map +0 -1
  543. package/dist/periods/index.d.cts +0 -22
  544. package/dist/predicate-BSAGEyu5.d.cts +0 -209
  545. package/dist/predicate-BSAGEyu5.d.ts +0 -209
  546. package/dist/query/index.cjs +0 -2375
  547. package/dist/query/index.cjs.map +0 -1
  548. package/dist/query/index.d.cts +0 -3
  549. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  550. package/dist/registry-3QP3YKQS.js +0 -8
  551. package/dist/registry-DKEXOJVO.js +0 -7
  552. package/dist/registry-OJIOSBV6.js +0 -10
  553. package/dist/registry-USRVT6YF.js +0 -8
  554. package/dist/revoke-JCC7N56X.js +0 -17
  555. package/dist/session/index.cjs +0 -495
  556. package/dist/session/index.cjs.map +0 -1
  557. package/dist/session/index.d.cts +0 -46
  558. package/dist/shadow/index.cjs +0 -133
  559. package/dist/shadow/index.cjs.map +0 -1
  560. package/dist/shadow/index.d.cts +0 -17
  561. package/dist/signer-72QAUSVW.js +0 -18
  562. package/dist/snapshots/index.cjs +0 -937
  563. package/dist/snapshots/index.cjs.map +0 -1
  564. package/dist/snapshots/index.d.cts +0 -28
  565. package/dist/store/index.cjs +0 -1083
  566. package/dist/store/index.cjs.map +0 -1
  567. package/dist/store/index.d.cts +0 -492
  568. package/dist/store/index.d.ts +0 -492
  569. package/dist/store/index.js +0 -37
  570. package/dist/strategy-BSxFXGzb.d.cts +0 -110
  571. package/dist/strategy-BSxFXGzb.d.ts +0 -110
  572. package/dist/strategy-DSTrsZ8t.d.cts +0 -601
  573. package/dist/strategy-DSTrsZ8t.d.ts +0 -601
  574. package/dist/sync/index.cjs +0 -1062
  575. package/dist/sync/index.cjs.map +0 -1
  576. package/dist/sync/index.d.cts +0 -43
  577. package/dist/team/index.cjs +0 -2798
  578. package/dist/team/index.cjs.map +0 -1
  579. package/dist/team/index.d.cts +0 -118
  580. package/dist/tx/index.cjs +0 -544
  581. package/dist/tx/index.cjs.map +0 -1
  582. package/dist/tx/index.d.cts +0 -21
  583. package/dist/types-Df28QFKb.d.ts +0 -12818
  584. package/dist/types-DyXYr8rE.d.cts +0 -12818
  585. package/dist/ulid-COREQ2RQ.js +0 -9
  586. package/dist/ulid-Drr7ykr6.d.cts +0 -603
  587. package/dist/util/index.cjs +0 -230
  588. package/dist/util/index.cjs.map +0 -1
  589. package/dist/util/index.d.cts +0 -77
  590. package/dist/with-derivation-DFnFByiQ.d.ts +0 -13
  591. package/dist/with-derivation-DU3Sjazm.d.cts +0 -13
  592. package/dist/with-guard-ByyxmEe7.d.cts +0 -18
  593. package/dist/with-guard-qube6BMI.d.ts +0 -18
  594. package/dist/with-materialized-view-BmEToIR1.d.cts +0 -27
  595. package/dist/with-overlayed-view-BMsQQbWm.d.cts +0 -13
  596. /package/dist/{chunk-UF3BUNQZ.js.map → api-TX2EX2FX.js.map} +0 -0
  597. /package/dist/{store → as}/index.js.map +0 -0
  598. /package/dist/{crypto-HTZ4FJOP.js.map → at/index.js.map} +0 -0
  599. /package/dist/{delegation-RI54P6I5.js.map → by/index.js.map} +0 -0
  600. /package/dist/{executor-5PNY7LGW.js.map → cargo/index.js.map} +0 -0
  601. /package/dist/{executor-B4QIYGZX.js.map → chunk-CHFZDSE4.js.map} +0 -0
  602. /package/dist/{executor-BWXXDQ7K.js.map → chunk-GHVIKOHT.js.map} +0 -0
  603. /package/dist/{issue-VGDPP4B5.js.map → chunk-PZ5AY32C.js.map} +0 -0
  604. /package/dist/{ledger-TMRZYNVJ.js.map → classified/index.js.map} +0 -0
  605. /package/dist/{noydb-G725ZSZG.js.map → collection-facade-LVD22JLM.js.map} +0 -0
  606. /package/dist/{public-envelope-BW6OXORV.js.map → computed-EXDMQODG.js.map} +0 -0
  607. /package/dist/{read-only-facade-ITU6L7BL.js.map → delegation-BJP73GAP.js.map} +0 -0
  608. /package/dist/{registry-3QP3YKQS.js.map → derive-BME7HDWO.js.map} +0 -0
  609. /package/dist/{registry-DKEXOJVO.js.map → enclave-NHORSWSF.js.map} +0 -0
  610. /package/dist/{registry-OJIOSBV6.js.map → executor-FE6X4LFX.js.map} +0 -0
  611. /package/dist/{registry-USRVT6YF.js.map → executor-KSHKRJXP.js.map} +0 -0
  612. /package/dist/{revoke-JCC7N56X.js.map → executor-ZHTJJICG.js.map} +0 -0
  613. /package/dist/{signer-72QAUSVW.js.map → export-accessible-DACHM5VT.js.map} +0 -0
  614. /package/dist/{stale-6ZDBTQT7.js.map → extract-partition-RNENZZ4T.js.map} +0 -0
  615. /package/dist/{ulid-COREQ2RQ.js.map → find-BNGBJNKP.js.map} +0 -0
@@ -1,15 +1,20 @@
1
+ import {
2
+ reducerBuilder
3
+ } from "./chunk-DFVUTGT2.js";
1
4
  import {
2
5
  evaluateClause,
6
+ hasFnClause,
3
7
  readPath
4
- } from "./chunk-TV3YZ35S.js";
8
+ } from "./chunk-IGJCYUT5.js";
5
9
  import {
6
10
  CrossJoinSourceUnknownError,
7
11
  CrossJoinTooLargeError,
8
12
  DanglingReferenceError,
13
+ FieldNotQueryableError,
9
14
  JoinTooLargeError
10
- } from "./chunk-B6PB7JLN.js";
15
+ } from "./chunk-S7VFUQM2.js";
11
16
 
12
- // src/query/join.ts
17
+ // src/kernel/query/join.ts
13
18
  var DEFAULT_JOIN_MAX_ROWS = 5e4;
14
19
  var JOIN_WARN_FRACTION = 0.8;
15
20
  function coerceRefKey(value) {
@@ -37,15 +42,15 @@ function warnCeilingApproaching(target, side, rows, maxRows) {
37
42
  `[noy-db] .join() ${side} side is at ${pct}% of the ${maxRows}-row ceiling for target "${target}" (${rows} rows). Streaming joins over scan() are not yet supported for collections that need to exceed this.`
38
43
  );
39
44
  }
40
- function applyJoins(rows, joins, context) {
45
+ function applyJoins(rows, joins, context, locale) {
41
46
  if (joins.length === 0) return [...rows];
42
47
  let result = [...rows];
43
48
  for (const leg of joins) {
44
- result = applyOneJoin(result, leg, context);
49
+ result = applyOneJoin(result, leg, context, locale);
45
50
  }
46
51
  return result;
47
52
  }
48
- function applyOneJoin(leftRows, leg, context) {
53
+ function applyOneJoin(leftRows, leg, context, locale) {
49
54
  if (leg.isDictJoin) {
50
55
  const dictSource = context.resolveDictSource?.(leg.field);
51
56
  if (!dictSource) {
@@ -100,24 +105,27 @@ function applyOneJoin(leftRows, leg, context) {
100
105
  if (rightSnapshot.length > maxRows * JOIN_WARN_FRACTION) {
101
106
  warnCeilingApproaching(leg.target, "right", rightSnapshot.length, maxRows);
102
107
  }
108
+ const effLocale = locale ?? context.defaultLocale;
109
+ const presentResolve = effLocale !== void 0 && source.presentForJoin !== void 0 ? (right) => right !== null && typeof right === "object" ? source.presentForJoin(right, effLocale) : right : void 0;
103
110
  const strategy = leg.strategy ?? (source.lookupById ? "nested" : "hash");
104
111
  if (strategy === "nested" && source.lookupById) {
105
112
  const lookup = (id) => source.lookupById?.(id);
106
- return nestedLoopJoin(leftRows, leg, lookup);
113
+ return nestedLoopJoin(leftRows, leg, lookup, presentResolve);
107
114
  }
108
- return hashJoin(leftRows, leg, rightSnapshot);
115
+ return hashJoin(leftRows, leg, rightSnapshot, presentResolve);
109
116
  }
110
- function nestedLoopJoin(leftRows, leg, lookupById) {
117
+ function nestedLoopJoin(leftRows, leg, lookupById, presentResolve) {
111
118
  const out = [];
112
119
  for (const left of leftRows) {
113
120
  const rawId = readPath(left, leg.field);
114
121
  const key = coerceRefKey(rawId);
115
- const right = key === null ? void 0 : lookupById(key);
122
+ let right = key === null ? void 0 : lookupById(key);
123
+ if (presentResolve && right !== void 0) right = presentResolve(right);
116
124
  out.push(attachJoin(left, leg, right, rawId));
117
125
  }
118
126
  return out;
119
127
  }
120
- function hashJoin(leftRows, leg, rightSnapshot) {
128
+ function hashJoin(leftRows, leg, rightSnapshot, presentResolve) {
121
129
  const rightMap = /* @__PURE__ */ new Map();
122
130
  for (const record of rightSnapshot) {
123
131
  const rawId = readPath(record, "id");
@@ -130,7 +138,8 @@ function hashJoin(leftRows, leg, rightSnapshot) {
130
138
  for (const left of leftRows) {
131
139
  const rawId = readPath(left, leg.field);
132
140
  const key = coerceRefKey(rawId);
133
- const right = key === null ? void 0 : rightMap.get(key);
141
+ let right = key === null ? void 0 : rightMap.get(key);
142
+ if (presentResolve && right !== void 0) right = presentResolve(right);
134
143
  out.push(attachJoin(left, leg, right, rawId));
135
144
  }
136
145
  return out;
@@ -164,7 +173,7 @@ function resetJoinWarnings() {
164
173
  warnedCeilingKeys.clear();
165
174
  }
166
175
 
167
- // src/query/live.ts
176
+ // src/kernel/query/live.ts
168
177
  function buildLiveQuery(recompute, upstreams) {
169
178
  return new LiveQueryImpl(recompute, upstreams);
170
179
  }
@@ -235,7 +244,7 @@ var LiveQueryImpl = class {
235
244
  }
236
245
  };
237
246
 
238
- // src/aggregate/strategy.ts
247
+ // src/with-lookup/aggregate/strategy.ts
239
248
  var NOT_ENABLED = new Error(
240
249
  'Aggregate / groupBy is not enabled on this Noydb instance. Import `{ withAggregate }` from "@noy-db/hub/aggregate" and pass it to `createNoydb({ aggregateStrategy: withAggregate() })`.'
241
250
  );
@@ -254,7 +263,7 @@ var NO_AGGREGATE = {
254
263
  }
255
264
  };
256
265
 
257
- // src/query/builder.ts
266
+ // src/kernel/query/builder.ts
258
267
  var EMPTY_PLAN = {
259
268
  clauses: [],
260
269
  orderBy: [],
@@ -307,6 +316,36 @@ var Query = class _Query {
307
316
  predicates
308
317
  );
309
318
  }
319
+ /**
320
+ * @internal — the ids of records matching this query's plan,
321
+ * recovered by reference identity: `executePlanWithSource` returns the
322
+ * ORIGINAL snapshot record references (money-decode and joins are applied
323
+ * later, in `toArray`), so each matched record is found in the id-paired
324
+ * `snapshotEntries()` map. Used by `collection.retrieve({ within })`.
325
+ * Throws if the source is not collection-backed (no `snapshotEntries`).
326
+ */
327
+ _idArray() {
328
+ const entries = this.source.snapshotEntries?.();
329
+ if (entries === void 0) {
330
+ throw new Error(
331
+ "Query._idArray(): the query source has no snapshotEntries(); retrieve({ within }) requires a collection-backed query (collection.query())."
332
+ );
333
+ }
334
+ if (this.plan.clauses.some((c) => c.type === "crossJoin")) {
335
+ throw new Error(
336
+ "Query._idArray(): retrieve({ within }) does not support crossJoin queries (cross-join produces new row objects, breaking id recovery). Use where/filter/and/or, or a projection .join()."
337
+ );
338
+ }
339
+ const refToId = /* @__PURE__ */ new Map();
340
+ for (const { id, record } of entries) refToId.set(record, id);
341
+ const matched = executePlanWithSource(this.source, this.plan, this.joinContext);
342
+ const ids = [];
343
+ for (const r of matched) {
344
+ const id = refToId.get(r);
345
+ if (id !== void 0) ids.push(id);
346
+ }
347
+ return ids;
348
+ }
310
349
  /**
311
350
  * Filter by a registered deterministic predicate. Requires
312
351
  * the Query to have been augmented with a predicates map (typically
@@ -346,9 +385,37 @@ var Query = class _Query {
346
385
  this.predicates
347
386
  );
348
387
  }
349
- /** Add a field comparison. Multiple where() calls are AND-combined. */
388
+ /**
389
+ * Add a field comparison. Multiple where() calls are AND-combined.
390
+ *
391
+ * A declared money field compares in MAJOR units: the operand
392
+ * (`10000`, `'10000.00'`, or `{ amount, currency }` in multi mode) is
393
+ * quantized into stored scaled-int space at build time and evaluated
394
+ * BigInt-exact per record. A malformed operand or a string operator
395
+ * (`contains`/`startsWith`) throws here, at the call site.
396
+ *
397
+ * Consults the Via pipeline's posture before building a clause (#629
398
+ * Task 8): a field whose posture is `queryable: 'none'` (e.g. a
399
+ * `blobFields` slot) throws `FieldNotQueryableError` here, at the call
400
+ * site. Every other posture is unaffected — the existing per-binding
401
+ * `buildClause` machinery runs exactly as before.
402
+ */
350
403
  where(field, op, value) {
351
- const clause = { type: "field", field, op, value };
404
+ const via = this.source.via;
405
+ if (via?.postureFor(field)?.queryable === "none") throw new FieldNotQueryableError(field);
406
+ const viaClause = via?.buildClause(field, op, value);
407
+ const clause = viaClause ? {
408
+ type: "field",
409
+ field,
410
+ op,
411
+ value,
412
+ via: {
413
+ brand: viaClause.brand,
414
+ payload: viaClause.payload,
415
+ evaluate: (actual, evalOp) => via.evaluateClause(viaClause, actual, evalOp),
416
+ indexValue: via.indexProbe(viaClause, op)
417
+ }
418
+ } : { type: "field", field, op, value };
352
419
  return new _Query(
353
420
  this.source,
354
421
  { ...this.plan, clauses: [...this.plan.clauses, clause] },
@@ -414,11 +481,21 @@ var Query = class _Query {
414
481
  this.predicates
415
482
  );
416
483
  }
417
- /** Sort by a field. Subsequent calls are tie-breakers. */
418
- orderBy(field, direction = "asc") {
484
+ /**
485
+ * Sort by a field. Subsequent calls are tie-breakers. Pass
486
+ * `{ by: 'label' }` to sort a `dictKey`/`staticDict` field by its resolved
487
+ * label at the query locale instead of the stored code.
488
+ *
489
+ * Consults the Via pipeline's posture (#629 Task 8): a field whose posture
490
+ * is `queryable: 'none'` throws `FieldNotQueryableError` here, at the call
491
+ * site — same gate as `where()`.
492
+ */
493
+ orderBy(field, direction = "asc", opts) {
494
+ if (this.source.via?.postureFor(field)?.queryable === "none") throw new FieldNotQueryableError(field);
495
+ const entry = opts?.by === "label" ? { field, direction, by: "label" } : { field, direction };
419
496
  return new _Query(
420
497
  this.source,
421
- { ...this.plan, orderBy: [...this.plan.orderBy, { field, direction }] },
498
+ { ...this.plan, orderBy: [...this.plan.orderBy, entry] },
422
499
  this.joinContext,
423
500
  this.aggregateStrategy,
424
501
  this.predicates
@@ -621,20 +698,44 @@ var Query = class _Query {
621
698
  * carries any join legs, they are applied after `where` / `orderBy`
622
699
  * / `limit` / `offset` narrow the left set. See the `.join()` doc
623
700
  * for the ordering rationale.
701
+ *
702
+ * `opts.locale` resolves JOINED right-side i18n fields at the
703
+ * `join` layer to that locale; without it, the owning collection's default
704
+ * locale applies, and a locale-less query leaves joined i18n fields raw.
705
+ * (Left/base i18n fields are resolved by `get`/`list`, not here.)
624
706
  */
625
- toArray() {
626
- const base = executePlanWithSource(this.source, this.plan, this.joinContext);
707
+ toArray(opts) {
708
+ const base = this.decodeVia(executePlanWithSource(this.source, this.plan, this.joinContext, opts?.locale));
627
709
  if (this.plan.joins.length === 0) return base;
628
710
  if (!this.joinContext) {
629
711
  throw new Error(
630
712
  `Query.toArray(): plan carries ${this.plan.joins.length} join leg(s) but no JoinContext is attached. This usually means the Query was constructed via the raw Query constructor with a plan that had joins pre-populated. Use collection.query().join(...) instead.`
631
713
  );
632
714
  }
633
- return applyJoins(base, this.plan.joins, this.joinContext);
715
+ return applyJoins(base, this.plan.joins, this.joinContext, opts?.locale);
634
716
  }
635
- /** Return the first matching record, or null. Joins are applied. */
636
- first() {
637
- const arr = this.limit(1).toArray();
717
+ /**
718
+ * Decode this source's Via-covered fields on read (e.g. money: stored
719
+ * scaled-int → canonical decimal), so `query().toArray()` agrees with
720
+ * `get()`/`sum()` on the value. No-op when the source's Via pipeline
721
+ * declares no result decode.
722
+ *
723
+ * The query layer carries no locale context, so money decodes with
724
+ * `'raw'` — canonical decimal, WITHOUT fabricating locale-formatted
725
+ * `<field>Formatted` / `<field>Number` virtuals. Producing a
726
+ * guessed-locale string here would reintroduce a "two read paths
727
+ * disagree" failure on the virtual field (e.g. it-IT via `get()` vs
728
+ * en-US here). Consumers who need formatted money read through
729
+ * `get()`/`list()` with a locale.
730
+ */
731
+ decodeVia(records) {
732
+ const via = this.source.via;
733
+ if (!via || !via.hasResultDecode) return records;
734
+ return records.map((r) => via.decodeResults(r));
735
+ }
736
+ /** Return the first matching record, or null. Joins are applied. `opts.locale` resolves joined i18n fields. */
737
+ first(opts) {
738
+ const arr = this.limit(1).toArray(opts);
638
739
  return arr[0] ?? null;
639
740
  }
640
741
  /**
@@ -657,49 +758,11 @@ var Query = class _Query {
657
758
  }
658
759
  const { candidates, remainingClauses } = candidateRecords(this.source, this.plan.clauses);
659
760
  if (remainingClauses.length === 0) return candidates.length;
660
- return filterRecords(candidates, remainingClauses).length;
761
+ return filterRecords(candidates, remainingClauses, fnViewDecoder(this.source)).length;
661
762
  }
662
- /**
663
- * Reduce the matching records through a named set of reducers.
664
- * the aggregation terminal.
665
- *
666
- * ```ts
667
- * const { total, n, avgAmount } = invoices.query()
668
- * .where('status', '==', 'open')
669
- * .aggregate({
670
- * total: sum('amount'),
671
- * n: count(),
672
- * avgAmount: avg('amount'),
673
- * })
674
- * .run()
675
- * ```
676
- *
677
- * Returns an `Aggregation<R>` wrapper with two terminals:
678
- * - `.run(): R` — synchronous one-shot reduction
679
- * - `.live(): LiveAggregation<R>` — reactive primitive that
680
- * re-runs the reduction whenever the source notifies of a
681
- * change. Always call `live.stop()` when finished.
682
- *
683
- * The reducer spec is bound here once and reused by both
684
- * terminals — this is why `.aggregate()` returns a wrapper instead
685
- * of being a direct terminal. Consumers who only need the static
686
- * value read `.run()`; consumers wiring a reactive UI read
687
- * `.live()`.
688
- *
689
- * Joins are intentionally NOT applied to aggregations in —
690
- * the same logic as `.count()`. Joins in are projection-only
691
- * (they attach an aliased field and never filter), so running
692
- * them just to throw the aliases away would be wasteful. If you
693
- * need a reducer that reads a joined field, open an issue —
694
- * aggregations-across-joins is explicitly out of scope for v1.
695
- *
696
- * Every reducer factory accepts an optional `{ seed }` parameter
697
- * that is plumbed through the protocol but unused by the
698
- * executor — that's constraint #2. When partition-aware
699
- * aggregation lands, the seed will carry running state across
700
- * partition boundaries without an API break.
701
- */
702
- aggregate(spec) {
763
+ aggregate(specOrBuild) {
764
+ let spec = typeof specOrBuild === "function" ? specOrBuild(reducerBuilder) : specOrBuild;
765
+ spec = this.source.via?.wrapReducers(spec) ?? spec;
703
766
  const source = this.source;
704
767
  const clauses = this.plan.clauses;
705
768
  const joinCtx = this.joinContext;
@@ -710,7 +773,7 @@ var Query = class _Query {
710
773
  return executeClausePipeline(source, clauses, joinCtx);
711
774
  }
712
775
  const { candidates, remainingClauses } = candidateRecords(source, clauses);
713
- return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses);
776
+ return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses, fnViewDecoder(source));
714
777
  };
715
778
  const upstreams = [];
716
779
  if (source.subscribe) {
@@ -733,7 +796,7 @@ var Query = class _Query {
733
796
  return executeClausePipeline(source, clauses, joinCtx);
734
797
  }
735
798
  const { candidates, remainingClauses } = candidateRecords(source, clauses);
736
- return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses);
799
+ return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses, fnViewDecoder(source));
737
800
  };
738
801
  const upstreams = [];
739
802
  if (source.subscribe) {
@@ -747,13 +810,15 @@ var Query = class _Query {
747
810
  executeRecords,
748
811
  field,
749
812
  upstreams,
750
- dictLabelResolver
813
+ dictLabelResolver,
814
+ this.source.via
751
815
  );
752
816
  }
753
817
  return this.aggregateStrategy.groupByN(
754
818
  executeRecords,
755
819
  fields,
756
- upstreams
820
+ upstreams,
821
+ this.source.via
757
822
  );
758
823
  }
759
824
  /**
@@ -871,7 +936,7 @@ var Query = class _Query {
871
936
  return serializePlan(this.plan);
872
937
  }
873
938
  };
874
- function executePlanWithSource(source, plan, joinContext) {
939
+ function executePlanWithSource(source, plan, joinContext, locale) {
875
940
  const hasCrossJoins = plan.clauses.some((c) => c.type === "crossJoin");
876
941
  let result;
877
942
  if (hasCrossJoins) {
@@ -883,10 +948,11 @@ function executePlanWithSource(source, plan, joinContext) {
883
948
  result = executeClausePipeline(source, plan.clauses, joinContext);
884
949
  } else {
885
950
  const { candidates, remainingClauses } = candidateRecords(source, plan.clauses);
886
- result = remainingClauses.length === 0 ? [...candidates] : filterRecords(candidates, remainingClauses);
951
+ result = remainingClauses.length === 0 ? [...candidates] : filterRecords(candidates, remainingClauses, fnViewDecoder(source));
887
952
  }
888
953
  if (plan.orderBy.length > 0) {
889
- result = sortRecords(result, plan.orderBy);
954
+ const labelMaps = buildOrderLabelMaps(plan.orderBy, joinContext, locale, source.via);
955
+ result = sortRecords(result, plan.orderBy, source.via, labelMaps);
890
956
  }
891
957
  if (plan.offset > 0) {
892
958
  result = result.slice(plan.offset);
@@ -906,11 +972,13 @@ function candidateRecords(source, clauses) {
906
972
  const clause = clauses[i];
907
973
  if (clause.type !== "field") continue;
908
974
  if (!indexes.has(clause.field)) continue;
975
+ if (clause.via && clause.via.indexValue === void 0) continue;
976
+ const probeValue = clause.via ? clause.via.indexValue : clause.value;
909
977
  let ids = null;
910
978
  if (clause.op === "==") {
911
- ids = indexes.lookupEqual(clause.field, clause.value);
912
- } else if (clause.op === "in" && Array.isArray(clause.value)) {
913
- ids = indexes.lookupIn(clause.field, clause.value);
979
+ ids = indexes.lookupEqual(clause.field, probeValue);
980
+ } else if (clause.op === "in" && Array.isArray(probeValue)) {
981
+ ids = indexes.lookupIn(clause.field, probeValue);
914
982
  }
915
983
  if (ids !== null) {
916
984
  const remaining = [];
@@ -951,13 +1019,20 @@ function executePlan(records, plan) {
951
1019
  }
952
1020
  return result;
953
1021
  }
954
- function filterRecords(records, clauses) {
1022
+ function fnViewDecoder(source) {
1023
+ const via = source.via;
1024
+ if (!via || !via.hasResultDecode) return void 0;
1025
+ return (r) => via.decodeResults(r);
1026
+ }
1027
+ function filterRecords(records, clauses, decodeForFns) {
955
1028
  if (clauses.length === 0) return [...records];
1029
+ const needsFnView = decodeForFns !== void 0 && hasFnClause(clauses);
956
1030
  const out = [];
957
1031
  for (const r of records) {
1032
+ const fnView = needsFnView ? decodeForFns(r) : void 0;
958
1033
  let matches = true;
959
1034
  for (const clause of clauses) {
960
- if (!evaluateClause(r, clause)) {
1035
+ if (!evaluateClause(r, clause, fnView)) {
961
1036
  matches = false;
962
1037
  break;
963
1038
  }
@@ -969,10 +1044,11 @@ function filterRecords(records, clauses) {
969
1044
  function executeClausePipeline(source, clauses, joinContext) {
970
1045
  let rel = [...source.snapshot()];
971
1046
  let filterBatch = [];
1047
+ const decodeForFns = fnViewDecoder(source);
972
1048
  for (const clause of clauses) {
973
1049
  if (clause.type === "crossJoin") {
974
1050
  if (filterBatch.length > 0) {
975
- rel = filterRecords(rel, filterBatch);
1051
+ rel = filterRecords(rel, filterBatch, decodeForFns);
976
1052
  filterBatch = [];
977
1053
  }
978
1054
  const rightSource = joinContext.resolveSource(clause.target);
@@ -985,7 +1061,7 @@ function executeClausePipeline(source, clauses, joinContext) {
985
1061
  }
986
1062
  }
987
1063
  if (filterBatch.length > 0) {
988
- rel = filterRecords(rel, filterBatch);
1064
+ rel = filterRecords(rel, filterBatch, decodeForFns);
989
1065
  }
990
1066
  return rel;
991
1067
  }
@@ -1034,17 +1110,55 @@ function applyCrossJoin(leftRel, clause, rightSource) {
1034
1110
  }
1035
1111
  return expanded;
1036
1112
  }
1037
- function sortRecords(records, orderBy) {
1113
+ function sortRecords(records, orderBy, via, labelMaps) {
1038
1114
  return [...records].sort((a, b) => {
1039
- for (const { field, direction } of orderBy) {
1040
- const av = readField(a, field);
1041
- const bv = readField(b, field);
1042
- const cmp = compareValues(av, bv);
1115
+ for (const { field, direction, by } of orderBy) {
1116
+ let av = readField(a, field);
1117
+ let bv = readField(b, field);
1118
+ const labelResolver = by === "label" ? labelMaps?.get(field) : void 0;
1119
+ if (labelResolver) {
1120
+ av = (typeof av === "string" ? labelResolver(av) : void 0) ?? av;
1121
+ bv = (typeof bv === "string" ? labelResolver(bv) : void 0) ?? bv;
1122
+ const cmp2 = compareValues(av, bv);
1123
+ if (cmp2 !== 0) return direction === "asc" ? cmp2 : -cmp2;
1124
+ continue;
1125
+ }
1126
+ const viaCmp = via?.compareForOrder(field, av, bv);
1127
+ const cmp = viaCmp !== void 0 ? viaCmp : compareValues(av, bv);
1043
1128
  if (cmp !== 0) return direction === "asc" ? cmp : -cmp;
1044
1129
  }
1045
1130
  return 0;
1046
1131
  });
1047
1132
  }
1133
+ function buildOrderLabelMaps(orderBy, joinContext, locale, via) {
1134
+ let maps;
1135
+ for (const { field, by } of orderBy) {
1136
+ if (by !== "label") continue;
1137
+ const dictSource = joinContext?.resolveDictSource?.(field);
1138
+ if (dictSource) {
1139
+ const loc = locale ?? dictSource.displayLocale;
1140
+ if (loc === void 0) continue;
1141
+ const codeToLabel = /* @__PURE__ */ new Map();
1142
+ for (const entry of dictSource.snapshot()) {
1143
+ const k = entry["key"];
1144
+ const labels = entry["labels"];
1145
+ const label = labels?.[loc];
1146
+ if (typeof k === "string" && typeof label === "string") codeToLabel.set(k, label);
1147
+ }
1148
+ ;
1149
+ (maps ??= /* @__PURE__ */ new Map()).set(field, (code) => codeToLabel.get(code));
1150
+ continue;
1151
+ }
1152
+ if (via) {
1153
+ const cache = /* @__PURE__ */ new Map();
1154
+ (maps ??= /* @__PURE__ */ new Map()).set(field, (code) => {
1155
+ if (!cache.has(code)) cache.set(code, via.resolveOrderLabel(field, code, locale));
1156
+ return cache.get(code);
1157
+ });
1158
+ }
1159
+ }
1160
+ return maps;
1161
+ }
1048
1162
  function readField(record, field) {
1049
1163
  if (record === null || record === void 0) return void 0;
1050
1164
  if (!field.includes(".")) {
@@ -1131,6 +1245,7 @@ function buildDictLabelResolver(joinCtx, field) {
1131
1245
  const dictSource = joinCtx.resolveDictSource(field);
1132
1246
  if (!dictSource) return void 0;
1133
1247
  const snapshot = dictSource.snapshot();
1248
+ const displayLocale = dictSource.displayLocale;
1134
1249
  const dictMap = /* @__PURE__ */ new Map();
1135
1250
  for (const entry of snapshot) {
1136
1251
  const k = entry["key"];
@@ -1140,9 +1255,11 @@ function buildDictLabelResolver(joinCtx, field) {
1140
1255
  }
1141
1256
  }
1142
1257
  return async (key, locale, fallback) => {
1258
+ const effLocale = locale || displayLocale;
1259
+ if (!effLocale) return void 0;
1143
1260
  const labels = dictMap.get(key);
1144
1261
  if (!labels) return void 0;
1145
- if (labels[locale] !== void 0) return labels[locale];
1262
+ if (labels[effLocale] !== void 0) return labels[effLocale];
1146
1263
  const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
1147
1264
  for (const fb of chain) {
1148
1265
  if (fb === "any") {
@@ -1156,7 +1273,7 @@ function buildDictLabelResolver(joinCtx, field) {
1156
1273
  };
1157
1274
  }
1158
1275
 
1159
- // src/query/scan-builder.ts
1276
+ // src/kernel/query/scan-builder.ts
1160
1277
  var DEFAULT_SCAN_PAGE_SIZE = 100;
1161
1278
  var ScanBuilder = class _ScanBuilder {
1162
1279
  pageProvider;
@@ -1182,12 +1299,31 @@ var ScanBuilder = class _ScanBuilder {
1182
1299
  * context throws with an actionable error.
1183
1300
  */
1184
1301
  joinContext;
1185
- constructor(pageProvider, pageSize = DEFAULT_SCAN_PAGE_SIZE, clauses = [], joins = [], joinContext) {
1302
+ /**
1303
+ * The backing collection's compiled Via pipeline (money now; more Via
1304
+ * features later). When it declares a result decode, yielded records
1305
+ * are decoded (e.g. money: stored scaled-int → canonical decimal) so
1306
+ * `scan()` agrees with `get()`/`list()`/`query().toArray()`. Decoded
1307
+ * with `'raw'` (canonical decimal, no locale-formatted virtuals) since
1308
+ * the scan stream carries no locale context, mirroring `Query.toArray()`.
1309
+ */
1310
+ via;
1311
+ constructor(pageProvider, pageSize = DEFAULT_SCAN_PAGE_SIZE, clauses = [], joins = [], joinContext, via) {
1186
1312
  this.pageProvider = pageProvider;
1187
1313
  this.pageSize = pageSize;
1188
1314
  this.clauses = clauses;
1189
1315
  this.joins = joins;
1190
1316
  this.joinContext = joinContext;
1317
+ this.via = via;
1318
+ }
1319
+ /**
1320
+ * Decode this scan's Via-covered fields on a record (e.g. money: stored
1321
+ * scaled-int → canonical decimal). No-op when the Via pipeline declares
1322
+ * no result decode. See {@link via}.
1323
+ */
1324
+ decodeVia(record) {
1325
+ if (!this.via || !this.via.hasResultDecode) return record;
1326
+ return this.via.decodeResults(record);
1191
1327
  }
1192
1328
  /**
1193
1329
  * Add a field comparison. Runs per record as the scan stream
@@ -1201,15 +1337,34 @@ var ScanBuilder = class _ScanBuilder {
1201
1337
  * the in-memory cache where indexes live. Index-accelerated scans
1202
1338
  * are a future optimization — the current implementation
1203
1339
  * evaluates clauses per record in O(1) per clause.
1340
+ *
1341
+ * Consults the Via pipeline's posture before building a clause (#629
1342
+ * Task 8): a field whose posture is `queryable: 'none'` throws
1343
+ * `FieldNotQueryableError` here, at the call site — same gate as
1344
+ * `Query.where()`.
1204
1345
  */
1205
1346
  where(field, op, value) {
1206
- const clause = { type: "field", field, op, value };
1347
+ const via = this.via;
1348
+ if (via?.postureFor(field)?.queryable === "none") throw new FieldNotQueryableError(field);
1349
+ const viaClause = via?.buildClause(field, op, value);
1350
+ const clause = viaClause ? {
1351
+ type: "field",
1352
+ field,
1353
+ op,
1354
+ value,
1355
+ via: {
1356
+ brand: viaClause.brand,
1357
+ payload: viaClause.payload,
1358
+ evaluate: (actual, evalOp) => via.evaluateClause(viaClause, actual, evalOp)
1359
+ }
1360
+ } : { type: "field", field, op, value };
1207
1361
  return new _ScanBuilder(
1208
1362
  this.pageProvider,
1209
1363
  this.pageSize,
1210
1364
  [...this.clauses, clause],
1211
1365
  this.joins,
1212
- this.joinContext
1366
+ this.joinContext,
1367
+ this.via
1213
1368
  );
1214
1369
  }
1215
1370
  /**
@@ -1228,7 +1383,8 @@ var ScanBuilder = class _ScanBuilder {
1228
1383
  this.pageSize,
1229
1384
  [...this.clauses, clause],
1230
1385
  this.joins,
1231
- this.joinContext
1386
+ this.joinContext,
1387
+ this.via
1232
1388
  );
1233
1389
  }
1234
1390
  /**
@@ -1339,7 +1495,8 @@ var ScanBuilder = class _ScanBuilder {
1339
1495
  this.pageSize,
1340
1496
  this.clauses,
1341
1497
  [...this.joins, leg],
1342
- this.joinContext
1498
+ this.joinContext,
1499
+ this.via
1343
1500
  );
1344
1501
  }
1345
1502
  /**
@@ -1356,10 +1513,11 @@ var ScanBuilder = class _ScanBuilder {
1356
1513
  while (true) {
1357
1514
  for (const record of page.items) {
1358
1515
  if (!this.recordMatches(record)) continue;
1516
+ const decoded = this.decodeVia(record);
1359
1517
  if (joinResolvers === null) {
1360
- yield record;
1518
+ yield decoded;
1361
1519
  } else {
1362
- let attached = record;
1520
+ let attached = decoded;
1363
1521
  for (const resolver of joinResolvers) {
1364
1522
  attached = this.applyOneJoinStreaming(attached, resolver);
1365
1523
  }
@@ -1483,43 +1641,9 @@ var ScanBuilder = class _ScanBuilder {
1483
1641
  }
1484
1642
  return merged;
1485
1643
  }
1486
- /**
1487
- * Reduce the scan stream through a named set of reducers and
1488
- * return the final aggregated shape.
1489
- *
1490
- * Memory is O(reducers): one mutable state slot per spec key.
1491
- * Records flow through the pipeline one at a time via
1492
- * `for await` and are discarded after their `step()` is applied
1493
- * — never collected into an array. This is the distinguishing
1494
- * property from `Query.aggregate()`, which materializes the full
1495
- * match set first.
1496
- *
1497
- * Reuses the same reducer protocol as `Query.aggregate()`,
1498
- * so `count()`, `sum(field)`, `avg(field)`, `min(field)`,
1499
- * `max(field)` all work unchanged. The `{ seed }` parameter
1500
- * plumbing from constraint #2 is honored transparently — the
1501
- * factories ignore it in and the scan executor never
1502
- * touches the per-reducer state construction.
1503
- *
1504
- * **Returns a Promise**, unlike `Query.aggregate().run()` which
1505
- * is synchronous. The scan is inherently async because it walks
1506
- * adapter pages, so the terminal has to be too. Consumers
1507
- * destructure with await:
1508
- *
1509
- * ```ts
1510
- * const { total, n } = await invoices.scan()
1511
- * .where('year', '==', 2025)
1512
- * .aggregate({ total: sum('amount'), n: count() })
1513
- * ```
1514
- *
1515
- * **No `.live()` in.** `scan().aggregate().live()` would
1516
- * require reconciling an unbounded streaming iteration with a
1517
- * change-stream subscription — a design problem, not just a code
1518
- * one. Consumers with huge collections and live needs should
1519
- * narrow with `.where()` enough to fit in the 50k `query()`
1520
- * limit and use `query().aggregate().live()` instead.
1521
- */
1522
- async aggregate(spec) {
1644
+ async aggregate(specOrBuild) {
1645
+ const spec = typeof specOrBuild === "function" ? specOrBuild(reducerBuilder) : specOrBuild;
1646
+ this.via?.refuseUnqueryableReducers(spec);
1523
1647
  const keys = Object.keys(spec);
1524
1648
  const state = {};
1525
1649
  for (const key of keys) {
@@ -1545,8 +1669,9 @@ var ScanBuilder = class _ScanBuilder {
1545
1669
  */
1546
1670
  recordMatches(record) {
1547
1671
  if (this.clauses.length === 0) return true;
1672
+ const fnView = this.via?.hasResultDecode && hasFnClause(this.clauses) ? this.decodeVia(record) : void 0;
1548
1673
  for (const clause of this.clauses) {
1549
- if (!evaluateClause(record, clause)) return false;
1674
+ if (!evaluateClause(record, clause, fnView)) return false;
1550
1675
  }
1551
1676
  return true;
1552
1677
  }
@@ -1569,4 +1694,4 @@ export {
1569
1694
  executePlan,
1570
1695
  ScanBuilder
1571
1696
  };
1572
- //# sourceMappingURL=chunk-2GLDA55J.js.map
1697
+ //# sourceMappingURL=chunk-BUAQ7YI3.js.map