@noy-db/hub 0.2.0-pre.16 → 0.2.0-pre.18

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 (306) hide show
  1. package/dist/aggregate/index.cjs.map +1 -1
  2. package/dist/aggregate/index.d.cts +3 -2
  3. package/dist/aggregate/index.d.ts +3 -2
  4. package/dist/aggregate/index.js +4 -4
  5. package/dist/attestation/index.cjs.map +1 -1
  6. package/dist/attestation/index.d.cts +5 -3
  7. package/dist/attestation/index.d.ts +5 -3
  8. package/dist/attestation/index.js +6 -6
  9. package/dist/blobs/index.cjs +226 -11
  10. package/dist/blobs/index.cjs.map +1 -1
  11. package/dist/blobs/index.d.cts +6 -4
  12. package/dist/blobs/index.d.ts +6 -4
  13. package/dist/blobs/index.js +6 -5
  14. package/dist/blobs/index.js.map +1 -1
  15. package/dist/bundle/index.cjs +2065 -352
  16. package/dist/bundle/index.cjs.map +1 -1
  17. package/dist/bundle/index.d.cts +7 -5
  18. package/dist/bundle/index.d.ts +7 -5
  19. package/dist/bundle/index.js +21 -10
  20. package/dist/bundle/index.js.map +1 -1
  21. package/dist/{chunk-6RR3MNMG.js → chunk-2U226RDC.js} +3 -3
  22. package/dist/{chunk-L2BNJ6HM.js → chunk-32XVU2LT.js} +3 -3
  23. package/dist/{chunk-X73VS74Y.js → chunk-33DAO2XG.js} +2 -2
  24. package/dist/chunk-45643PAU.js +151 -0
  25. package/dist/chunk-45643PAU.js.map +1 -0
  26. package/dist/{chunk-QSUK7YWK.js → chunk-4UI5T3K7.js} +4 -4
  27. package/dist/{chunk-G4SCICH5.js → chunk-5KKNBDCT.js} +2 -2
  28. package/dist/{chunk-DUREQF5W.js → chunk-647TFNYL.js} +34 -8
  29. package/dist/chunk-647TFNYL.js.map +1 -0
  30. package/dist/{chunk-E2CDVKMH.js → chunk-6FHCU3QO.js} +5 -5
  31. package/dist/{chunk-F4OJZIWQ.js → chunk-6Q5XRLKG.js} +4 -4
  32. package/dist/{chunk-HOR4R722.js → chunk-6XEGHIBA.js} +30 -4
  33. package/dist/chunk-6XEGHIBA.js.map +1 -0
  34. package/dist/{chunk-4TBBMHVC.js → chunk-6YEC7LLO.js} +2 -2
  35. package/dist/{chunk-ZNQYHJXX.js → chunk-AB7JF2KF.js} +2 -2
  36. package/dist/{chunk-UMLVJTYV.js → chunk-ADB7GPM3.js} +7 -4
  37. package/dist/chunk-ADB7GPM3.js.map +1 -0
  38. package/dist/{chunk-XL35NSEN.js → chunk-BUBJYIZ7.js} +3 -3
  39. package/dist/chunk-C2OYWD5S.js +125 -0
  40. package/dist/chunk-C2OYWD5S.js.map +1 -0
  41. package/dist/{chunk-KABJXG2F.js → chunk-CMISAJAE.js} +195 -17
  42. package/dist/chunk-CMISAJAE.js.map +1 -0
  43. package/dist/{chunk-3YWP3WBP.js → chunk-DKMPR76W.js} +5 -5
  44. package/dist/{chunk-BI6ETQPF.js → chunk-DR5I7Q6N.js} +4 -4
  45. package/dist/{chunk-667MB6AH.js → chunk-F2IJ2HGD.js} +1370 -232
  46. package/dist/chunk-F2IJ2HGD.js.map +1 -0
  47. package/dist/{chunk-6H2ZUNR7.js → chunk-FQRAYDS4.js} +4 -4
  48. package/dist/{chunk-535SSHBS.js → chunk-HMFC6M2G.js} +99 -2
  49. package/dist/chunk-HMFC6M2G.js.map +1 -0
  50. package/dist/{chunk-TS26M2SB.js → chunk-HOO5I3VG.js} +2 -2
  51. package/dist/{chunk-OMAMZKKD.js → chunk-HWK75CYX.js} +2 -2
  52. package/dist/{chunk-TKIY625R.js → chunk-HZOEBM67.js} +2 -2
  53. package/dist/{chunk-DLZ2ONOD.js → chunk-IQ4GMEYZ.js} +6 -6
  54. package/dist/{chunk-XWH4MXIU.js → chunk-K3NYRK7U.js} +2 -2
  55. package/dist/{chunk-7BQ4QWYX.js → chunk-KOURQXIU.js} +23 -6
  56. package/dist/chunk-KOURQXIU.js.map +1 -0
  57. package/dist/{chunk-7Z7KSVA5.js → chunk-KQ523X3A.js} +15 -2
  58. package/dist/chunk-KQ523X3A.js.map +1 -0
  59. package/dist/{chunk-JD3OZAI4.js → chunk-KTZ2MHQK.js} +2 -2
  60. package/dist/{chunk-F3BPIPLS.js → chunk-LGPSCKWZ.js} +1 -1
  61. package/dist/chunk-LGPSCKWZ.js.map +1 -0
  62. package/dist/{chunk-SCJPI4Z5.js → chunk-LQ3GD5LL.js} +5 -5
  63. package/dist/{chunk-AAVWKNZW.js → chunk-M3H7VSRV.js} +2 -2
  64. package/dist/{chunk-BR3AMFGS.js → chunk-MGB67HKX.js} +5 -5
  65. package/dist/{chunk-GNI5STXQ.js → chunk-P57D4KBG.js} +52 -38
  66. package/dist/chunk-P57D4KBG.js.map +1 -0
  67. package/dist/{chunk-Z6FNBOTC.js → chunk-PDVP3C2I.js} +1 -1
  68. package/dist/{chunk-Z6FNBOTC.js.map → chunk-PDVP3C2I.js.map} +1 -1
  69. package/dist/{chunk-OB2ZJQ2D.js → chunk-PGVEL5IZ.js} +3 -3
  70. package/dist/{chunk-YULZKK4F.js → chunk-QJKZ5WUP.js} +37 -2
  71. package/dist/chunk-QJKZ5WUP.js.map +1 -0
  72. package/dist/{chunk-BQ65SS5A.js → chunk-QPJ7Z4L3.js} +2 -2
  73. package/dist/{chunk-CZI2A4MQ.js → chunk-RQFG2YSV.js} +3 -3
  74. package/dist/{chunk-CJORTUJ2.js → chunk-RZWQNMMP.js} +2 -2
  75. package/dist/{chunk-FFXM3ZIF.js → chunk-T4T5I5L6.js} +3 -3
  76. package/dist/{chunk-QVIEAYTP.js → chunk-TFAN3NFD.js} +3 -3
  77. package/dist/{chunk-Z4DO7YSI.js → chunk-TPOHMOGX.js} +2 -2
  78. package/dist/{chunk-VLMPU56Q.js → chunk-TTS3RWL5.js} +2 -2
  79. package/dist/{chunk-IXBIFDEW.js → chunk-VVDSDOVV.js} +4 -4
  80. package/dist/{chunk-FWPKCXTN.js → chunk-WZCG3EZ6.js} +2 -2
  81. package/dist/{chunk-HBXJ37ZY.js → chunk-Y5XVB75E.js} +4 -4
  82. package/dist/chunk-YWYW2YNO.js +129 -0
  83. package/dist/chunk-YWYW2YNO.js.map +1 -0
  84. package/dist/{chunk-IQLVUT37.js → chunk-Z3BE5BRK.js} +2 -2
  85. package/dist/{chunk-42FEUPZQ.js → chunk-Z3I2WNGF.js} +58 -3
  86. package/dist/chunk-Z3I2WNGF.js.map +1 -0
  87. package/dist/{state-vault-TMXZRTY5.js → chunk-ZJ67TB4S.js} +24 -7
  88. package/dist/chunk-ZJ67TB4S.js.map +1 -0
  89. package/dist/consent/index.cjs.map +1 -1
  90. package/dist/consent/index.d.cts +6 -4
  91. package/dist/consent/index.d.ts +6 -4
  92. package/dist/consent/index.js +3 -3
  93. package/dist/{crypto-QXQOHMHF.js → crypto-FNK3XPCS.js} +7 -3
  94. package/dist/{delegation-NIQ43IPU.js → delegation-FMXNUWE6.js} +5 -5
  95. package/dist/derivations/index.cjs +82 -2
  96. package/dist/derivations/index.cjs.map +1 -1
  97. package/dist/derivations/index.d.cts +7 -5
  98. package/dist/derivations/index.d.ts +7 -5
  99. package/dist/derivations/index.js +8 -6
  100. package/dist/{dev-unlock-8XzcD2Z4.d.cts → dev-unlock-3_2b_vo6.d.cts} +1 -1
  101. package/dist/{dev-unlock-DR3upLd1.d.ts → dev-unlock-BMvwPr_E.d.ts} +1 -1
  102. package/dist/{strategy-BtW8fAjz.d.cts → errors-DUTlAt3Y.d.cts} +113 -727
  103. package/dist/{strategy-BtW8fAjz.d.ts → errors-DUTlAt3Y.d.ts} +113 -727
  104. package/dist/executor-IZ2NVXCY.js +11 -0
  105. package/dist/executor-THSEYEJG.js +8 -0
  106. package/dist/executor-WLFDUTOM.js +8 -0
  107. package/dist/{fanout-sidecar-67CMI3UT.js → fanout-sidecar-JGHXAJO5.js} +2 -2
  108. package/dist/forget/index.cjs +43 -0
  109. package/dist/forget/index.cjs.map +1 -0
  110. package/dist/forget/index.d.cts +1 -0
  111. package/dist/forget/index.d.ts +1 -0
  112. package/dist/forget/index.js +14 -0
  113. package/dist/guards/index.cjs +80 -3
  114. package/dist/guards/index.cjs.map +1 -1
  115. package/dist/guards/index.d.cts +7 -5
  116. package/dist/guards/index.d.ts +7 -5
  117. package/dist/guards/index.js +10 -6
  118. package/dist/{hash-CDjye9KV.d.ts → hash-BThBJFO1.d.ts} +1 -1
  119. package/dist/{hash-DuQ88_5W.d.cts → hash-BnWnL9bQ.d.cts} +1 -1
  120. package/dist/history/index.cjs +27 -4
  121. package/dist/history/index.cjs.map +1 -1
  122. package/dist/history/index.d.cts +7 -5
  123. package/dist/history/index.d.ts +7 -5
  124. package/dist/history/index.js +9 -7
  125. package/dist/history/index.js.map +1 -1
  126. package/dist/i18n/index.cjs +53 -0
  127. package/dist/i18n/index.cjs.map +1 -1
  128. package/dist/i18n/index.d.cts +6 -4
  129. package/dist/i18n/index.d.ts +6 -4
  130. package/dist/i18n/index.js +16 -8
  131. package/dist/i18n/index.js.map +1 -1
  132. package/dist/index-C-SSRIxP.d.cts +348 -0
  133. package/dist/index-C-SSRIxP.d.ts +348 -0
  134. package/dist/{index-C8Bk3-VF.d.cts → index-C6lgoUhK.d.cts} +47 -2
  135. package/dist/{index-nP99bXLg.d.ts → index-DP1JTWHZ.d.ts} +47 -2
  136. package/dist/index.cjs +3280 -1208
  137. package/dist/index.cjs.map +1 -1
  138. package/dist/index.d.cts +15 -12
  139. package/dist/index.d.ts +15 -12
  140. package/dist/index.js +149 -107
  141. package/dist/index.js.map +1 -1
  142. package/dist/indexing/index.cjs.map +1 -1
  143. package/dist/indexing/index.js +4 -4
  144. package/dist/issue-R2MWQO6K.js +12 -0
  145. package/dist/{ledger-A3LL253R.js → ledger-GXC2YA3A.js} +6 -6
  146. package/dist/materialized-views/index.cjs.map +1 -1
  147. package/dist/materialized-views/index.d.cts +7 -5
  148. package/dist/materialized-views/index.d.ts +7 -5
  149. package/dist/materialized-views/index.js +12 -12
  150. package/dist/noydb-RJL6FQ4B.js +37 -0
  151. package/dist/overlay-views/index.cjs.map +1 -1
  152. package/dist/overlay-views/index.d.cts +7 -5
  153. package/dist/overlay-views/index.d.ts +7 -5
  154. package/dist/overlay-views/index.js +4 -4
  155. package/dist/periods/index.cjs.map +1 -1
  156. package/dist/periods/index.d.cts +6 -4
  157. package/dist/periods/index.d.ts +6 -4
  158. package/dist/periods/index.js +6 -6
  159. package/dist/{public-envelope-YP2UWMLG.js → public-envelope-HXOFHY4N.js} +4 -4
  160. package/dist/query/index.cjs +30 -4
  161. package/dist/query/index.cjs.map +1 -1
  162. package/dist/query/index.d.cts +3 -2
  163. package/dist/query/index.d.ts +3 -2
  164. package/dist/query/index.js +6 -6
  165. package/dist/read-only-facade-EX6WZZBP.js +7 -0
  166. package/dist/registry-3T2RZC5A.js +8 -0
  167. package/dist/registry-DMS7OKBM.js +8 -0
  168. package/dist/{registry-UTA4CLQS.js → registry-WVXO6NH5.js} +3 -3
  169. package/dist/{revoke-HNMQZSCL.js → revoke-7LCWE2AH.js} +6 -6
  170. package/dist/sealed-record/index.cjs +139 -0
  171. package/dist/sealed-record/index.cjs.map +1 -0
  172. package/dist/sealed-record/index.d.cts +123 -0
  173. package/dist/sealed-record/index.d.ts +123 -0
  174. package/dist/sealed-record/index.js +42 -0
  175. package/dist/sealed-record/index.js.map +1 -0
  176. package/dist/session/index.cjs.map +1 -1
  177. package/dist/session/index.d.cts +7 -5
  178. package/dist/session/index.d.ts +7 -5
  179. package/dist/session/index.js +3 -3
  180. package/dist/shadow/index.cjs.map +1 -1
  181. package/dist/shadow/index.d.cts +6 -4
  182. package/dist/shadow/index.d.ts +6 -4
  183. package/dist/shadow/index.js +2 -2
  184. package/dist/{signer-DCMNKXSF.js → signer-HAVDLGOK.js} +5 -5
  185. package/dist/snapshots/index.cjs.map +1 -1
  186. package/dist/snapshots/index.d.cts +6 -4
  187. package/dist/snapshots/index.d.ts +6 -4
  188. package/dist/snapshots/index.js +4 -4
  189. package/dist/{stale-W5PQTRYH.js → stale-PGTEGJDI.js} +2 -2
  190. package/dist/stale-PGTEGJDI.js.map +1 -0
  191. package/dist/state-vault-QKQKN3H3.js +14 -0
  192. package/dist/state-vault-QKQKN3H3.js.map +1 -0
  193. package/dist/store/index.cjs.map +1 -1
  194. package/dist/store/index.d.cts +6 -4
  195. package/dist/store/index.d.ts +6 -4
  196. package/dist/store/index.js +2 -2
  197. package/dist/strategy-Diwh5lzS.d.ts +739 -0
  198. package/dist/strategy-nuyN8K5N.d.cts +739 -0
  199. package/dist/sync/index.cjs.map +1 -1
  200. package/dist/sync/index.d.cts +5 -3
  201. package/dist/sync/index.d.ts +5 -3
  202. package/dist/sync/index.js +4 -4
  203. package/dist/team/index.cjs.map +1 -1
  204. package/dist/team/index.d.cts +6 -4
  205. package/dist/team/index.d.ts +6 -4
  206. package/dist/team/index.js +8 -8
  207. package/dist/transition-guard--t3exQHF.d.cts +165 -0
  208. package/dist/transition-guard-BlI9Oy5K.d.ts +165 -0
  209. package/dist/tx/index.cjs.map +1 -1
  210. package/dist/tx/index.d.cts +6 -4
  211. package/dist/tx/index.d.ts +6 -4
  212. package/dist/tx/index.js +3 -3
  213. package/dist/{types-Bze6vkwm.d.cts → types-BpLPqyaO.d.cts} +1264 -513
  214. package/dist/{types-DrmBTscX.d.ts → types-Diqc2caK.d.ts} +1264 -513
  215. package/dist/{ulid-DbBVrNSt.d.ts → ulid-B1zNV8r9.d.ts} +1 -1
  216. package/dist/{ulid-DfZlAh0u.d.cts → ulid-DNiRB4Mx.d.cts} +1 -1
  217. package/dist/util/index.cjs.map +1 -1
  218. package/dist/util/index.js +1 -1
  219. package/dist/{vault-group-DX2HFQMX.js → vault-group-DPZVFRI5.js} +182 -6
  220. package/dist/vault-group-DPZVFRI5.js.map +1 -0
  221. package/dist/{with-materialized-view--4PsvMDu.d.cts → with-materialized-view-BdH_A_r6.d.cts} +1 -1
  222. package/dist/{with-materialized-view-QT1Tp7NO.d.ts → with-materialized-view-CzAgp_HJ.d.ts} +1 -1
  223. package/dist/{with-overlayed-view-BEXfpzSb.d.ts → with-overlayed-view-BJbqQnsR.d.ts} +1 -1
  224. package/dist/{with-overlayed-view-DlH5qmeB.d.cts → with-overlayed-view-C40rDPlu.d.cts} +1 -1
  225. package/dist/with-rollup-Bopu5UDZ.d.cts +47 -0
  226. package/dist/with-rollup-DrlGkxiE.d.ts +47 -0
  227. package/package.json +23 -3
  228. package/dist/chunk-42FEUPZQ.js.map +0 -1
  229. package/dist/chunk-535SSHBS.js.map +0 -1
  230. package/dist/chunk-667MB6AH.js.map +0 -1
  231. package/dist/chunk-7BQ4QWYX.js.map +0 -1
  232. package/dist/chunk-7Z7KSVA5.js.map +0 -1
  233. package/dist/chunk-DUREQF5W.js.map +0 -1
  234. package/dist/chunk-F3BPIPLS.js.map +0 -1
  235. package/dist/chunk-GNI5STXQ.js.map +0 -1
  236. package/dist/chunk-HOR4R722.js.map +0 -1
  237. package/dist/chunk-KABJXG2F.js.map +0 -1
  238. package/dist/chunk-OQSRJG6A.js +0 -63
  239. package/dist/chunk-OQSRJG6A.js.map +0 -1
  240. package/dist/chunk-UMLVJTYV.js.map +0 -1
  241. package/dist/chunk-YULZKK4F.js.map +0 -1
  242. package/dist/executor-6ZDSDZ6V.js +0 -8
  243. package/dist/executor-AZLS3KBK.js +0 -11
  244. package/dist/executor-IDZDAFNH.js +0 -8
  245. package/dist/immutable-guard-CRPvu24K.d.cts +0 -82
  246. package/dist/immutable-guard-Dov3WvwF.d.ts +0 -82
  247. package/dist/issue-RZP3VI6O.js +0 -12
  248. package/dist/noydb-WCMY2ZOW.js +0 -35
  249. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  250. package/dist/registry-EB6SISTA.js +0 -8
  251. package/dist/registry-IUZQVVBB.js +0 -8
  252. package/dist/state-vault-TMXZRTY5.js.map +0 -1
  253. package/dist/vault-group-DX2HFQMX.js.map +0 -1
  254. package/dist/with-derivation-CCqAchD5.d.cts +0 -13
  255. package/dist/with-derivation-_lySGdlm.d.ts +0 -13
  256. /package/dist/{chunk-6RR3MNMG.js.map → chunk-2U226RDC.js.map} +0 -0
  257. /package/dist/{chunk-L2BNJ6HM.js.map → chunk-32XVU2LT.js.map} +0 -0
  258. /package/dist/{chunk-X73VS74Y.js.map → chunk-33DAO2XG.js.map} +0 -0
  259. /package/dist/{chunk-QSUK7YWK.js.map → chunk-4UI5T3K7.js.map} +0 -0
  260. /package/dist/{chunk-G4SCICH5.js.map → chunk-5KKNBDCT.js.map} +0 -0
  261. /package/dist/{chunk-E2CDVKMH.js.map → chunk-6FHCU3QO.js.map} +0 -0
  262. /package/dist/{chunk-F4OJZIWQ.js.map → chunk-6Q5XRLKG.js.map} +0 -0
  263. /package/dist/{chunk-4TBBMHVC.js.map → chunk-6YEC7LLO.js.map} +0 -0
  264. /package/dist/{chunk-ZNQYHJXX.js.map → chunk-AB7JF2KF.js.map} +0 -0
  265. /package/dist/{chunk-XL35NSEN.js.map → chunk-BUBJYIZ7.js.map} +0 -0
  266. /package/dist/{chunk-3YWP3WBP.js.map → chunk-DKMPR76W.js.map} +0 -0
  267. /package/dist/{chunk-BI6ETQPF.js.map → chunk-DR5I7Q6N.js.map} +0 -0
  268. /package/dist/{chunk-6H2ZUNR7.js.map → chunk-FQRAYDS4.js.map} +0 -0
  269. /package/dist/{chunk-TS26M2SB.js.map → chunk-HOO5I3VG.js.map} +0 -0
  270. /package/dist/{chunk-OMAMZKKD.js.map → chunk-HWK75CYX.js.map} +0 -0
  271. /package/dist/{chunk-TKIY625R.js.map → chunk-HZOEBM67.js.map} +0 -0
  272. /package/dist/{chunk-DLZ2ONOD.js.map → chunk-IQ4GMEYZ.js.map} +0 -0
  273. /package/dist/{chunk-XWH4MXIU.js.map → chunk-K3NYRK7U.js.map} +0 -0
  274. /package/dist/{chunk-JD3OZAI4.js.map → chunk-KTZ2MHQK.js.map} +0 -0
  275. /package/dist/{chunk-SCJPI4Z5.js.map → chunk-LQ3GD5LL.js.map} +0 -0
  276. /package/dist/{chunk-AAVWKNZW.js.map → chunk-M3H7VSRV.js.map} +0 -0
  277. /package/dist/{chunk-BR3AMFGS.js.map → chunk-MGB67HKX.js.map} +0 -0
  278. /package/dist/{chunk-OB2ZJQ2D.js.map → chunk-PGVEL5IZ.js.map} +0 -0
  279. /package/dist/{chunk-BQ65SS5A.js.map → chunk-QPJ7Z4L3.js.map} +0 -0
  280. /package/dist/{chunk-CZI2A4MQ.js.map → chunk-RQFG2YSV.js.map} +0 -0
  281. /package/dist/{chunk-CJORTUJ2.js.map → chunk-RZWQNMMP.js.map} +0 -0
  282. /package/dist/{chunk-FFXM3ZIF.js.map → chunk-T4T5I5L6.js.map} +0 -0
  283. /package/dist/{chunk-QVIEAYTP.js.map → chunk-TFAN3NFD.js.map} +0 -0
  284. /package/dist/{chunk-Z4DO7YSI.js.map → chunk-TPOHMOGX.js.map} +0 -0
  285. /package/dist/{chunk-VLMPU56Q.js.map → chunk-TTS3RWL5.js.map} +0 -0
  286. /package/dist/{chunk-IXBIFDEW.js.map → chunk-VVDSDOVV.js.map} +0 -0
  287. /package/dist/{chunk-FWPKCXTN.js.map → chunk-WZCG3EZ6.js.map} +0 -0
  288. /package/dist/{chunk-HBXJ37ZY.js.map → chunk-Y5XVB75E.js.map} +0 -0
  289. /package/dist/{chunk-IQLVUT37.js.map → chunk-Z3BE5BRK.js.map} +0 -0
  290. /package/dist/{crypto-QXQOHMHF.js.map → crypto-FNK3XPCS.js.map} +0 -0
  291. /package/dist/{delegation-NIQ43IPU.js.map → delegation-FMXNUWE6.js.map} +0 -0
  292. /package/dist/{executor-6ZDSDZ6V.js.map → executor-IZ2NVXCY.js.map} +0 -0
  293. /package/dist/{executor-AZLS3KBK.js.map → executor-THSEYEJG.js.map} +0 -0
  294. /package/dist/{executor-IDZDAFNH.js.map → executor-WLFDUTOM.js.map} +0 -0
  295. /package/dist/{fanout-sidecar-67CMI3UT.js.map → fanout-sidecar-JGHXAJO5.js.map} +0 -0
  296. /package/dist/{issue-RZP3VI6O.js.map → forget/index.js.map} +0 -0
  297. /package/dist/{ledger-A3LL253R.js.map → issue-R2MWQO6K.js.map} +0 -0
  298. /package/dist/{noydb-WCMY2ZOW.js.map → ledger-GXC2YA3A.js.map} +0 -0
  299. /package/dist/{public-envelope-YP2UWMLG.js.map → noydb-RJL6FQ4B.js.map} +0 -0
  300. /package/dist/{read-only-facade-ITU6L7BL.js.map → public-envelope-HXOFHY4N.js.map} +0 -0
  301. /package/dist/{registry-EB6SISTA.js.map → read-only-facade-EX6WZZBP.js.map} +0 -0
  302. /package/dist/{registry-IUZQVVBB.js.map → registry-3T2RZC5A.js.map} +0 -0
  303. /package/dist/{registry-UTA4CLQS.js.map → registry-DMS7OKBM.js.map} +0 -0
  304. /package/dist/{revoke-HNMQZSCL.js.map → registry-WVXO6NH5.js.map} +0 -0
  305. /package/dist/{signer-DCMNKXSF.js.map → revoke-7LCWE2AH.js.map} +0 -0
  306. /package/dist/{stale-W5PQTRYH.js.map → signer-HAVDLGOK.js.map} +0 -0
@@ -0,0 +1,739 @@
1
+ import { N as NoydbError } from './errors-DUTlAt3Y.js';
2
+
3
+ /**
4
+ * Aggregation reducers for the query DSL.
5
+ *
6
+ * the reducer protocol plus five built-in factories
7
+ * (`count`, `sum`, `avg`, `min`, `max`) consumed by `Query.aggregate()`
8
+ * and, in the future, `Scan.aggregate()`. Every factory accepts
9
+ * an optional `{ seed }` parameter that is plumbed through the
10
+ * protocol but unused by the executor — that's the load-bearing
11
+ * half of constraint #2. When partition-aware aggregation
12
+ * lands, the seed carries the previous partition's running total into
13
+ * the next partition without requiring a protocol change.
14
+ *
15
+ * Reducers are intentionally generic over their internal state type
16
+ * `S` so compound reducers (avg keeps `{sum, count}`, min/max keep a
17
+ * value bag) can model internal bookkeeping without leaking the
18
+ * implementation through the accumulator's public shape. `finalize`
19
+ * collapses `S` back into the user-visible `R`.
20
+ *
21
+ * Reducers are pure data — `init` / `step` / `finalize` / optional
22
+ * `remove` are stateless functions that receive and return `S`. This
23
+ * is the shape that admits O(1) incremental maintenance in a future
24
+ * optimization (delta-aware `LiveAggregation` applies `step` or
25
+ * `remove` per delta), without blocking the simpler "full re-run on
26
+ * source change" that ships.
27
+ */
28
+ /**
29
+ * A single reducer: factory-produced, ready to plug into an
30
+ * `.aggregate()` spec.
31
+ *
32
+ * Type parameters:
33
+ * - `R` — user-visible result type (what the aggregation returns
34
+ * for this slot, e.g. `number` for `sum()`)
35
+ * - `S` — internal state type, defaults to `R` for simple reducers
36
+ * that don't need compound bookkeeping
37
+ *
38
+ * A reducer is stateless: every method is pure over `S`. `init()` is
39
+ * called once per aggregation run to build the initial state; `step()`
40
+ * folds a record into the state; `remove()` (optional) un-folds a
41
+ * record, enabling incremental live maintenance; `finalize()` reads
42
+ * the final answer out of the state at the end of the run.
43
+ */
44
+ interface Reducer<R, S = R> {
45
+ /** Build the initial state for a fresh aggregation run. */
46
+ init(): S;
47
+ /** Fold a record into the state. Returns the new state. */
48
+ step(state: S, record: unknown): S;
49
+ /**
50
+ * Un-fold a record from the state. Returns the new state.
51
+ *
52
+ * Optional — reducers without `remove` cannot be maintained
53
+ * incrementally and must be re-run from scratch when the underlying
54
+ * record set changes. `sum`, `count`, `avg` implement `remove` in
55
+ * O(1); `min` and `max` implement it in O(N) worst case (when the
56
+ * extremum itself is removed and the next extremum must be
57
+ * recomputed from the remaining contributing values).
58
+ */
59
+ remove?(state: S, record: unknown): S;
60
+ /** Collapse the internal state into the user-visible result. */
61
+ finalize(state: S): R;
62
+ /**
63
+ * Combine two independent partial states into one (then `finalize` once).
64
+ * Optional. MUST be associative + commutative with `init()` as identity.
65
+ * Never merge finalized results — only states. Enables parallel /
66
+ * hierarchical aggregation (e.g. cross-shard or advisor→firm rollup).
67
+ */
68
+ merge?(a: S, b: S): S;
69
+ /**
70
+ * Identifying operation tag stamped by each built-in factory.
71
+ * Used by `summariseAggregateOp` in the introspection walker to
72
+ * render human-readable aggregate descriptors in `dumpSchema()`.
73
+ * Optional so third-party custom reducers are unaffected.
74
+ */
75
+ readonly op?: 'count' | 'sum' | 'avg' | 'min' | 'max';
76
+ /**
77
+ * Field name for field-based reducers (`sum`, `avg`, `min`, `max`).
78
+ * Absent on `count` which aggregates over record count, not a field.
79
+ */
80
+ readonly field?: string;
81
+ /**
82
+ * Money-only: target currency for `sum` over a multi-currency money
83
+ * field. Consumed by `wrapMoneyReducers` to convert per-currency
84
+ * subtotals to one figure. Ignored for non-money fields.
85
+ */
86
+ readonly convertTo?: string;
87
+ /**
88
+ * Money-only: FX rate map (`'USD->EUR' → rate`) used with `convertTo`.
89
+ */
90
+ readonly fx?: Record<string, number | string>;
91
+ }
92
+ /**
93
+ * Common options accepted by every reducer factory.
94
+ *
95
+ * `seed` — optional initial value for the internal state. **Unused by
96
+ * the executor**, plumbed through the protocol for constraint
97
+ * #2 (partition-aware aggregation seam). In, partitioned
98
+ * aggregations will pass the previous partition's carry as `seed` so
99
+ * a long time series can be rolled forward one partition at a time
100
+ * without re-aggregating closed partitions.
101
+ *
102
+ * always uses `init()` with the factory's zero value, regardless
103
+ * of whether `seed` was passed. Do not remove the parameter — that's
104
+ * the whole point of having it exist now.
105
+ */
106
+ interface ReducerOptions<TSeed = unknown> {
107
+ /** constraint #2 — seed is plumbed through but unused in. */
108
+ readonly seed?: TSeed;
109
+ /**
110
+ * Money-only (honored by `sum` over a multi-currency money field):
111
+ * convert per-currency subtotals to this currency for a single figure.
112
+ */
113
+ readonly convertTo?: string;
114
+ /** Money-only: FX rate map (`'USD->EUR' → rate`) used with `convertTo`. */
115
+ readonly fx?: Record<string, number | string>;
116
+ }
117
+ /**
118
+ * Count the number of records that match the query. Ignores field
119
+ * values entirely — the count is over the number of records, not over
120
+ * the number of non-null field values in any column.
121
+ */
122
+ declare function count(opts?: ReducerOptions<number>): Reducer<number>;
123
+ /**
124
+ * Sum a numeric field across all matching records. Non-number values
125
+ * at the field path are coerced to 0 — consumers who want a different
126
+ * behavior (throw, skip, treat as NaN) should filter upstream via
127
+ * `.where()` or write a custom reducer.
128
+ */
129
+ declare function sum(field: string, opts?: ReducerOptions<number>): Reducer<number>;
130
+ /**
131
+ * Arithmetic mean of a numeric field across all matching records.
132
+ *
133
+ * Returns `null` for an empty result set (zero records is not a
134
+ * well-defined denominator — returning NaN would poison downstream
135
+ * arithmetic, and throwing would force every consumer to wrap in
136
+ * try/catch just to handle "no matches"). Consumers who want an
137
+ * explicit zero should coalesce with `?? 0`.
138
+ *
139
+ * Internal state is `{sum, count}` so the running average can be
140
+ * maintained incrementally — on each delta, both fields update in
141
+ * O(1) and `finalize` divides. Directly storing `avg` as state would
142
+ * not admit incremental removal without also tracking count.
143
+ */
144
+ declare function avg(field: string, opts?: ReducerOptions<{
145
+ sum: number;
146
+ count: number;
147
+ }>): Reducer<number | null, {
148
+ sum: number;
149
+ count: number;
150
+ }>;
151
+ interface MinMaxState {
152
+ /**
153
+ * Multiset of contributing field values. Stored as a plain array
154
+ * because we need to support `remove` and a plain array gives us
155
+ * O(1) push + O(N) worst-case removal — which matches the
156
+ * documented min/max removal complexity. A sorted structure would
157
+ * let us drop the O(N) rescan but adds complexity that doesn't
158
+ * need; consumers hitting the O(N) ceiling should file an issue.
159
+ */
160
+ readonly values: number[];
161
+ }
162
+ /**
163
+ * Smallest numeric value of a field across all matching records.
164
+ * Returns `null` for an empty result set. See `avg()` for the
165
+ * reasoning on `null` vs NaN vs throwing.
166
+ *
167
+ * Incremental complexity: O(1) for `step`, O(N) worst case for
168
+ * `remove` when the current minimum is removed (the state holds the
169
+ * full multiset of contributing values and `finalize` scans for the
170
+ * new minimum). Consumers with very large result sets and frequent
171
+ * removals of the current extremum should either accept the cost or
172
+ * wait for a future optimization.
173
+ */
174
+ declare function min(field: string, opts?: ReducerOptions<number>): Reducer<number | null, MinMaxState>;
175
+ /**
176
+ * Largest numeric value of a field across all matching records.
177
+ * Mirror of `min()` — see that doc for semantics, null-on-empty
178
+ * behavior, and the O(N) removal caveat.
179
+ */
180
+ declare function max(field: string, opts?: ReducerOptions<number>): Reducer<number | null, MinMaxState>;
181
+
182
+ /**
183
+ * Aggregate execution — the runtime behind `Query.aggregate()`.
184
+ *
185
+ * takes an `AggregateSpec` (a record of named reducers
186
+ * built from `reducers.ts`) and runs every reducer over the records
187
+ * produced by the underlying query. Two terminal surfaces:
188
+ *
189
+ * - `.run(): R` — synchronous one-shot reduction. Matches the
190
+ * existing `Query.toArray()` / `.first()` / `.count()` style.
191
+ * - `.live(): LiveAggregation<R>` — reactive primitive that
192
+ * re-runs the reduction whenever the query's source notifies of
193
+ * a change. uses naive full re-run; incremental delta
194
+ * maintenance is admitted by the reducer protocol (`remove()`)
195
+ * but not wired to the executor yet — a follow-up optimization
196
+ * can switch from full re-run to delta-based without breaking
197
+ * the public API. Consumers get correct, reactive values today.
198
+ *
199
+ * The `Aggregation<R>` wrapper is deliberately tiny — it exists so
200
+ * `.aggregate(spec)` can be chained with either `.run()` or `.live()`
201
+ * without the builder needing two separate terminal methods. It
202
+ * holds the closure over the query execution (produces the current
203
+ * matching record set) and the spec, and stitches them together in
204
+ * either mode.
205
+ *
206
+ * This file depends ONLY on `reducers.ts` — it has no knowledge of
207
+ * the `Query` class. Tests can therefore exercise the reduction
208
+ * surface with plain record arrays, without spinning up a Collection.
209
+ */
210
+
211
+ /**
212
+ * A named set of reducers, keyed by output field name. Each key
213
+ * becomes a field on the aggregated result.
214
+ *
215
+ * ```ts
216
+ * const spec = {
217
+ * total: sum('amount'),
218
+ * n: count(),
219
+ * avgAmount: avg('amount'),
220
+ * }
221
+ * ```
222
+ */
223
+ type AggregateSpec = Readonly<Record<string, Reducer<unknown, unknown>>>;
224
+ /**
225
+ * Map an `AggregateSpec` to its reduced result shape — each key
226
+ * carries the finalized result type from its reducer. A spec built
227
+ * from `{ total: sum('amount'), n: count() }` yields a result of
228
+ * `{ total: number, n: number }`.
229
+ *
230
+ * This uses a mapped type with a conditional to extract `R` from
231
+ * each `Reducer<R, _>`. The `infer` captures the user-visible result
232
+ * type, discarding the internal state type `S`.
233
+ */
234
+ type AggregateResult<Spec extends AggregateSpec> = {
235
+ [K in keyof Spec]: Spec[K] extends Reducer<infer R, unknown> ? R : never;
236
+ };
237
+ /**
238
+ * Pure reduction over a record array. Runs every reducer's
239
+ * `init → step* → finalize` pipeline exactly once over the records.
240
+ *
241
+ * Called by `Aggregation.run()` and by the live-mode refresh path.
242
+ * Exported for tests and for future `scan().aggregate()` reuse
243
+ * — the streaming path will call the same reducer protocol with a
244
+ * per-page loop instead of a single array.
245
+ */
246
+ declare function reduceRecords<Spec extends AggregateSpec>(records: readonly unknown[], spec: Spec): AggregateResult<Spec>;
247
+ /**
248
+ * A minimal reactive primitive for aggregation results.
249
+ *
250
+ * Same spirit as the `LiveQuery` in : frame-agnostic, a plain
251
+ * object with `value` / `error` fields and a `subscribe(cb)`
252
+ * notification channel that Vue / React / Solid adapters wrap in
253
+ * their own primitive. Intentionally NOT a Promise — aggregations
254
+ * have a well-defined "current value" at every instant, and the
255
+ * reactive consumer wants to read that value synchronously.
256
+ *
257
+ * Error semantics mirror `LiveQuery`: if a re-run throws, the
258
+ * previous successful `value` is preserved and the error is stored
259
+ * in `error` so consumers can render an error state without losing
260
+ * the last-known-good result. The throw does NOT propagate out of
261
+ * the source's change handler (which would tear down the upstream
262
+ * emitter).
263
+ *
264
+ * `stop()` tears down the upstream subscription. It is idempotent —
265
+ * calling it multiple times is safe — and subscribe calls after
266
+ * stop are no-ops (they immediately return a no-op unsubscribe).
267
+ * Always call `stop()` when done; Vue's `onUnmounted` is the
268
+ * canonical place. Raw consumers must do it themselves.
269
+ */
270
+ interface LiveAggregation<R> {
271
+ /** Current reduced value. Undefined only if the first compute threw. */
272
+ readonly value: R | undefined;
273
+ /** Last execution error, if any. Cleared on the next successful run. */
274
+ readonly error: unknown;
275
+ /** Notify on every recomputation (success or error). Returns unsubscribe. */
276
+ subscribe(cb: () => void): () => void;
277
+ /** Tear down the upstream subscription. Idempotent. */
278
+ stop(): void;
279
+ }
280
+ /**
281
+ * Upstream change-notification hook for live aggregation.
282
+ *
283
+ * Matches the shape that `QuerySource.subscribe` already uses — a
284
+ * single method that accepts a callback and returns an unsubscribe
285
+ * function. The `Aggregation` wrapper collects upstreams from the
286
+ * query's source and wires them into a single re-run trigger.
287
+ */
288
+ interface AggregationUpstream {
289
+ subscribe(cb: () => void): () => void;
290
+ }
291
+ /**
292
+ * Chainable wrapper returned by `Query.aggregate(spec)`. Holds the
293
+ * execute-records closure and the spec; terminal methods (`run`,
294
+ * `live`) stitch them together in either mode.
295
+ *
296
+ * Why a wrapper instead of two terminal methods on `Query` directly?
297
+ *
298
+ * The `.aggregate(spec)` call is where the spec is bound — both
299
+ * `.run()` and `.live()` need the same spec, and the consumer's
300
+ * fluent style is `query.where(...).aggregate(spec).run()` or
301
+ * `.aggregate(spec).live()`. Wrapping lets the spec be named once
302
+ * and reused for either terminal, and keeps the `Query` class
303
+ * from growing a pair of near-duplicate method overloads
304
+ * (`aggregateRun` / `aggregateLive`) that would be harder to
305
+ * discover.
306
+ */
307
+ declare class Aggregation<R> {
308
+ private readonly executeRecords;
309
+ private readonly spec;
310
+ private readonly upstreams;
311
+ constructor(executeRecords: () => readonly unknown[], spec: AggregateSpec, upstreams: readonly AggregationUpstream[]);
312
+ /**
313
+ * Execute the query and reduce the results synchronously.
314
+ * Returns the reduced shape matching the spec — e.g. a spec of
315
+ * `{ total: sum('amount'), n: count() }` returns
316
+ * `{ total: number, n: number }`.
317
+ */
318
+ run(): R;
319
+ /**
320
+ * Build a reactive `LiveAggregation<R>` that re-runs the reduction
321
+ * whenever any upstream source notifies of a change. The initial
322
+ * value is computed eagerly in the constructor, so consumers can
323
+ * read `live.value` immediately after calling `.live()`.
324
+ *
325
+ * Always call `live.stop()` when finished — it tears down the
326
+ * upstream subscriptions. Vue's `onUnmounted` is the canonical
327
+ * place.
328
+ *
329
+ * **Implementation note:** every upstream change triggers a full
330
+ * re-reduction. Incremental maintenance (O(1) per delta for
331
+ * sum/count/avg via the reducer protocol's `remove()` method) is a
332
+ * planned follow-up optimization — the protocol already supports
333
+ * it, but the executor doesn't drive it yet. Consumers get
334
+ * correct, reactive values today; future PRs can switch to
335
+ * delta-based maintenance without changing this API.
336
+ */
337
+ live(): LiveAggregation<R>;
338
+ }
339
+ /**
340
+ * Build a `LiveAggregation<V>` from a recompute closure and a list
341
+ * of upstreams. Exposed so sibling files in the query DSL
342
+ * (currently `groupby.ts`) can reuse the reactive primitive
343
+ * without reaching into `LiveAggregationImpl` directly. This keeps
344
+ * the implementation class private while still allowing planned
345
+ * composition with `.groupBy().aggregate().live()`.
346
+ */
347
+ declare function buildLiveAggregation<V>(recompute: () => V, upstreams: readonly AggregationUpstream[]): LiveAggregation<V>;
348
+
349
+ /**
350
+ * Pure fixed-point decimal core for the money descriptor.
351
+ *
352
+ * All conversion goes decimal-string ⇄ scaled `BigInt`. There is no
353
+ * floating-point arithmetic anywhere: a value like `123.45` becomes
354
+ * `12345n` purely by string manipulation, never by `value * 100` (which
355
+ * would reintroduce the very drift money() exists to eliminate). BigInt
356
+ * has no magnitude ceiling, so values past `Number.MAX_SAFE_INTEGER`
357
+ * stay exact end-to-end.
358
+ *
359
+ * This module knows nothing about currencies, descriptors, or storage —
360
+ * it is the isolated, exhaustively-tested arithmetic kernel.
361
+ */
362
+ type RoundingMode = 'half-up' | 'half-even' | 'half-down' | 'up' | 'down' | 'ceil' | 'floor';
363
+
364
+ /**
365
+ * The `money()` field descriptor — a branded schema-layer descriptor, a
366
+ * sibling of `i18nText()` / `dictKey()`. It owns currency, scale, and
367
+ * rounding policy for a field; the pure arithmetic lives in
368
+ * {@link ./fixed-point} and default scale resolution in
369
+ * {@link ./iso4217}.
370
+ *
371
+ * Two modes:
372
+ * - **fixed** `money({ currency: 'EUR' })` — one currency for the
373
+ * field; the value stores a bare scaled-integer string.
374
+ * - **multi** `money({ currencies: 'any' | [...] })` — currency travels
375
+ * per record; the value stores `{ amount, currency }`.
376
+ *
377
+ * `currency` and `currencies` are mutually exclusive.
378
+ */
379
+
380
+ interface MoneyOptionsFixed {
381
+ currency: string;
382
+ /** Override the ISO-4217 default scale (required for unlisted codes). */
383
+ scale?: number;
384
+ rounding?: RoundingMode;
385
+ }
386
+ interface MoneyOptionsMulti {
387
+ currencies: 'any' | readonly string[];
388
+ /** Per-currency scale overrides (required for unlisted codes). */
389
+ scaleOverrides?: Record<string, number>;
390
+ rounding?: RoundingMode;
391
+ }
392
+ type MoneyOptions = MoneyOptionsFixed | MoneyOptionsMulti;
393
+ interface MoneyDescriptor {
394
+ readonly _noydbMoney: true;
395
+ readonly mode: 'fixed' | 'multi';
396
+ readonly options: MoneyOptions;
397
+ readonly rounding: RoundingMode | undefined;
398
+ /** The currency for fixed mode; `undefined` in multi mode. */
399
+ readonly fixedCurrency: string | undefined;
400
+ /** Resolve the scale for a currency, throwing if not allowed / unknown. */
401
+ scaleFor(currency: string): number;
402
+ /** Whether this descriptor permits the given currency. */
403
+ allows(currency: string): boolean;
404
+ /**
405
+ * The single currency this descriptor implies, if any — fixed mode, or
406
+ * multi mode with exactly one allow-listed currency. Lets a multi field
407
+ * accept a bare amount unambiguously. `undefined` otherwise.
408
+ */
409
+ soleCurrency(): string | undefined;
410
+ }
411
+ /** Raised when a written value carries more precision than `scale` allows. */
412
+ declare class MoneyPrecisionError extends NoydbError {
413
+ readonly field: string;
414
+ readonly value: unknown;
415
+ readonly scale: number;
416
+ constructor(field: string, value: unknown, scale: number);
417
+ }
418
+ /** Raised when a currency is disallowed or has no resolvable scale. */
419
+ declare class MoneyCurrencyError extends NoydbError {
420
+ readonly currency: string;
421
+ readonly reason: 'not-allowed' | 'unknown-scale';
422
+ readonly field?: string | undefined;
423
+ constructor(currency: string, reason: 'not-allowed' | 'unknown-scale', field?: string | undefined);
424
+ }
425
+ /** Raised when an aggregate operation is not supported on a money field. */
426
+ declare class MoneyUnsupportedError extends NoydbError {
427
+ readonly field: string;
428
+ constructor(field: string, message?: string);
429
+ }
430
+ /** Create a {@link MoneyDescriptor}. */
431
+ declare function money(options: MoneyOptions): MoneyDescriptor;
432
+ /** Runtime predicate for detecting a {@link MoneyDescriptor}. */
433
+ declare function isMoneyDescriptor(x: unknown): x is MoneyDescriptor;
434
+
435
+ /**
436
+ * Query DSL `.groupBy()` —.
437
+ *
438
+ * Chains after `.where()` / `.filter()` / `.or()` / `.and()` on a
439
+ * Query and before a reducer spec, so consumers can compute
440
+ * per-bucket aggregates without folding in userland:
441
+ *
442
+ * ```ts
443
+ * const byClient = invoices.query()
444
+ * .where('status', '==', 'open')
445
+ * .groupBy('clientId')
446
+ * .aggregate({ total: sum('amount'), n: count() })
447
+ * .run()
448
+ * // → [ { clientId: 'c1', total: 5250, n: 3 }, … ]
449
+ * ```
450
+ *
451
+ * Execution pipeline:
452
+ *
453
+ * 1. Run the query's where/filter clauses (same candidate /
454
+ * filter pipeline as `.aggregate()` directly on Query).
455
+ * 2. Partition the matching records into buckets keyed by
456
+ * `readPath(record, field)`. JS `Map` preserves insertion
457
+ * order, so the first-seen key for a bucket determines its
458
+ * position in the result array — consumers who want a
459
+ * specific ordering should `.sort()` downstream.
460
+ * 3. Enforce cardinality: warn once per field at 10% of the cap
461
+ * (10_000 buckets), throw `GroupCardinalityError` at 100% of
462
+ * the cap (100_000 buckets).
463
+ * 4. For each bucket, build a per-group reducer state and
464
+ * step every record in the bucket through it.
465
+ * 5. Emit one result row per bucket, shaped as
466
+ * `{ [field]: key, ...reduced }`.
467
+ *
468
+ * **Null / undefined keys:** `Map` distinguishes `null` from
469
+ * `undefined`, so records with a missing group field get their own
470
+ * bucket, and records with an explicit `null` value get a separate
471
+ * bucket from that. Consumers who want them merged can coalesce
472
+ * upstream with `.filter()`.
473
+ *
474
+ * **Live mode:** `.groupBy().aggregate().live()` re-runs the full
475
+ * grouping pipeline on every source change. Per-bucket incremental
476
+ * delta maintenance is a future optimization — the reducer
477
+ * protocol's `remove()` hook admits it, but ships naive
478
+ * re-grouping for simplicity.
479
+ *
480
+ * **Type-level stable-key narrowing:** when
481
+ * `dictKey` lands, `groupBy<DictField>()` will narrow the group key
482
+ * type to the stable dictionary key rather than the resolved locale
483
+ * label. That prevents grouping by the locale-resolved label,
484
+ * which would produce different buckets per reader. types the
485
+ * key as `unknown` at the result shape; the dictKey narrowing
486
+ * layers on top without an API break.
487
+ *
488
+ * Partition-awareness seam: when partitioned collections land,
489
+ * per-partition grouping will need to merge sub-results across
490
+ * partitions. The reducer protocol's `{ seed }` parameter
491
+ * (already plumbed through in `reducers.ts`) is the mechanism —
492
+ * groupBy doesn't need its own seam for the moment, because it
493
+ * delegates to the reducer protocol for all per-bucket state.
494
+ */
495
+
496
+ /**
497
+ * Cardinality thresholds for `.groupBy()`. The warn threshold gives
498
+ * consumers a heads-up before the hard error; the cap is a fixed
499
+ * constant in (not overridable). A `{ maxGroups }` override
500
+ * can be added later without a break if a real consumer asks.
501
+ */
502
+ declare const GROUPBY_WARN_CARDINALITY = 10000;
503
+ declare const GROUPBY_MAX_CARDINALITY = 100000;
504
+ /**
505
+ * Test-only: clear the per-field cardinality warning dedup between
506
+ * tests. Production code never calls this — matching the
507
+ * `resetJoinWarnings` pattern in `join.ts`.
508
+ */
509
+ declare function resetGroupByWarnings(): void;
510
+ /**
511
+ * Result row shape for a grouped aggregation. Each row carries the
512
+ * group key value under the grouping field name plus every reducer
513
+ * output from the spec.
514
+ *
515
+ * types the group key as `unknown` at the result shape — the
516
+ * runtime read via `readPath` can return any value, and narrowing
517
+ * to a specific type would require the caller to assert at the
518
+ * call site. `dictKey` narrowing layers on top of this by
519
+ * adding an overload that constrains `F` when the grouping field
520
+ * is a `dictKey`.
521
+ */
522
+ type GroupedRow<F extends string, R> = {
523
+ [K in F]: unknown;
524
+ } & R;
525
+ /**
526
+ * Multi-key variant — result-row shape for variadic
527
+ * `.groupBy(...fields)`. Every grouped field name appears on the row
528
+ * (typed as `unknown` for the same reason as `GroupedRow`), plus the
529
+ * reducer outputs from the spec.
530
+ */
531
+ type GroupedRowN<F extends readonly string[], R> = {
532
+ [K in F[number]]: unknown;
533
+ } & R;
534
+ /**
535
+ * Shared base class for the chainable grouped-query wrappers. Holds
536
+ * the constructor + protected fields that both single-key
537
+ * `GroupedQuery<T, F>` and variadic `GroupedQueryN<T, F>` need; each
538
+ * subclass only overrides `aggregate()` with its own result-row
539
+ * generic.
540
+ *
541
+ * Not exported — implementation detail. Adding `.having()` /
542
+ * `.live()` / `.orderByGroup()` etc. in the future lands here once
543
+ * and both subclasses pick it up automatically.
544
+ *
545
+ * @internal
546
+ */
547
+ declare abstract class GroupedQueryBase {
548
+ protected readonly executeRecords: () => readonly unknown[];
549
+ protected readonly upstreams: readonly AggregationUpstream[];
550
+ /**
551
+ * Optional dict label resolver attached by the query builder when
552
+ * the grouping field is a dictKey. Variadic groupings always pass
553
+ * `undefined` — `<field>Label` projection has no meaningful shape
554
+ * for composite keys.
555
+ */
556
+ protected readonly dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined;
557
+ /**
558
+ * Money field descriptors for the backing collection — used to
559
+ * rewrite `sum`/`min`/`max` over money fields into exact BigInt
560
+ * reducers when `.aggregate(spec)` is terminated.
561
+ */
562
+ protected readonly moneyFields?: Record<string, MoneyDescriptor> | undefined;
563
+ /**
564
+ * Field set this grouped query buckets on. Stored in declaration
565
+ * order — the same order is preserved on every result row by
566
+ * `groupAndReduce`. For the single-field constructor, this is
567
+ * `[field]`.
568
+ */
569
+ protected readonly fields: readonly string[];
570
+ constructor(executeRecords: () => readonly unknown[], fieldOrFields: string | readonly string[], upstreams: readonly AggregationUpstream[],
571
+ /**
572
+ * Optional dict label resolver attached by the query builder when
573
+ * the grouping field is a dictKey. Variadic groupings always pass
574
+ * `undefined` — `<field>Label` projection has no meaningful shape
575
+ * for composite keys.
576
+ */
577
+ dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined,
578
+ /**
579
+ * Money field descriptors for the backing collection — used to
580
+ * rewrite `sum`/`min`/`max` over money fields into exact BigInt
581
+ * reducers when `.aggregate(spec)` is terminated.
582
+ */
583
+ moneyFields?: Record<string, MoneyDescriptor> | undefined);
584
+ /** Apply money-aware reducer rewriting when money fields are declared. */
585
+ protected wrapSpec<Spec extends AggregateSpec>(spec: Spec): Spec;
586
+ }
587
+ /**
588
+ * Chainable wrapper returned by `Query.groupBy(field)`. Terminates
589
+ * with `.aggregate(spec)` which returns a `GroupedAggregation`.
590
+ *
591
+ * Kept minimal — the only operation on a grouped query is
592
+ * aggregation. Ordering, limiting, and further filtering belong on
593
+ * the underlying `Query` before `.groupBy()` is called; applying
594
+ * them post-group would be a different operation (`having` /
595
+ * `groupOrderBy`), out of scope for.
596
+ */
597
+ declare class GroupedQuery<T, F extends string> extends GroupedQueryBase {
598
+ /**
599
+ * Build a grouped aggregation. Returns a `GroupedAggregation`
600
+ * with `.run()`, `.runAsync()`, and `.live()` terminals — same shape
601
+ * as the non-grouped `.aggregate()` wrapper, just with an array
602
+ * result (one row per bucket) instead of a single reduced object.
603
+ */
604
+ aggregate<Spec extends AggregateSpec>(spec: Spec): GroupedAggregation<GroupedRow<F, AggregateResult<Spec>>>;
605
+ }
606
+ /**
607
+ * Variadic-keyed sibling of `GroupedQuery<T, F>`. Constructed by the
608
+ * multi-arg `Query.groupBy(...fields)` overload. The runtime shape is
609
+ * identical — only the type-level result-row narrowing differs.
610
+ */
611
+ declare class GroupedQueryN<T, F extends readonly string[]> extends GroupedQueryBase {
612
+ aggregate<Spec extends AggregateSpec>(spec: Spec): GroupedAggregation<GroupedRowN<F, AggregateResult<Spec>>>;
613
+ }
614
+ /**
615
+ * Execute the group-and-reduce pipeline. Pure function over a
616
+ * record array and a spec — shared by `GroupedAggregation.run()`
617
+ * and the live-mode refresh path. Exported for tests and for any
618
+ * future `scan().groupBy().aggregate()` reuse.
619
+ *
620
+ * Enforces the cardinality cap incrementally during the partition
621
+ * loop, so a runaway grouping throws at the moment the 100_001st
622
+ * bucket would be created — the consumer doesn't have to wait for
623
+ * the full partition to materialize before the error fires.
624
+ */
625
+ declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFields: string | readonly string[], spec: AggregateSpec, moneyFields?: Record<string, MoneyDescriptor>): R[];
626
+ /**
627
+ * Grouped aggregation wrapper — the `.groupBy(field).aggregate(spec)`
628
+ * terminal. Shape mirrors `Aggregation<R>` from aggregate.ts: two
629
+ * terminals (`.run()` and `.live()`), spec bound at construction
630
+ * time, upstreams collected for live mode.
631
+ *
632
+ * The generic `R` is the per-row result shape (i.e. a single
633
+ * grouped row), and the terminals return `R[]` — one row per
634
+ * bucket.
635
+ */
636
+ declare class GroupedAggregation<R> {
637
+ private readonly executeRecords;
638
+ private readonly spec;
639
+ private readonly upstreams;
640
+ /**
641
+ * Optional dict label resolver for `<field>Label` projection
642
+ *. Present when the grouping field is a dictKey.
643
+ */
644
+ private readonly dictLabelResolver?;
645
+ private readonly fields;
646
+ constructor(executeRecords: () => readonly unknown[], fields: string | readonly string[], spec: AggregateSpec, upstreams: readonly AggregationUpstream[],
647
+ /**
648
+ * Optional dict label resolver for `<field>Label` projection
649
+ *. Present when the grouping field is a dictKey.
650
+ */
651
+ dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined);
652
+ /** Execute the query, group, reduce, and return an array of rows. */
653
+ run(): R[];
654
+ /**
655
+ * Execute the query, group, reduce, and resolve `<field>Label` for
656
+ * each result row when the grouping field is a `dictKey` and a
657
+ * `locale` is provided. Returns `R[]` synchronously when
658
+ * no locale is specified (identical to `.run()`).
659
+ *
660
+ * The `<field>Label` field is appended to each row. Rows whose group
661
+ * key has no dictionary entry get `<field>Label: undefined`.
662
+ *
663
+ * Dict-label resolution is single-field only — multi-key groupings
664
+ * do not produce a `<field>Label`. The resolver is only attached
665
+ * by the builder when `fields.length === 1`.
666
+ */
667
+ runAsync(opts?: {
668
+ locale?: string;
669
+ fallback?: string | readonly string[];
670
+ }): Promise<R[]>;
671
+ /**
672
+ * Build a reactive `LiveAggregation<R[]>` that re-runs the full
673
+ * group-and-reduce pipeline whenever any upstream source notifies
674
+ * of a change. Same error-isolation and idempotent-stop contract
675
+ * as `Aggregation.live()` — the implementation delegates to the
676
+ * same `LiveAggregationImpl` class by threading a fresh
677
+ * recompute closure through the existing constructor.
678
+ *
679
+ * uses naive full re-run on every change. Incremental
680
+ * per-bucket maintenance (apply `step` on inserted records,
681
+ * `remove` on deleted records, route by bucket key) is a future
682
+ * optimization — the reducer protocol admits it, but wiring
683
+ * delta-aware source subscriptions is a separate PR.
684
+ *
685
+ * Always call `live.stop()` when finished.
686
+ */
687
+ live(): LiveAggregation<R[]>;
688
+ }
689
+
690
+ /**
691
+ * Strategy seam between the core Query / ScanBuilder chain and the
692
+ * optional aggregate / groupBy subsystem. Core imports
693
+ * `AggregateStrategy` as a TYPE-ONLY symbol and `NO_AGGREGATE` as a
694
+ * tiny runtime stub.
695
+ *
696
+ * The heavy machinery — `Aggregation`, `GroupedQuery`, the
697
+ * reducer-step logic — is only reachable from `withAggregate()` in
698
+ * `./active.ts`, which is only exported through the
699
+ * `@noy-db/hub/aggregate` subpath. Consumers that don't import the
700
+ * subpath ship none of the ~886 LOC.
701
+ *
702
+ * @internal
703
+ */
704
+
705
+ /**
706
+ * Seam interface. `@internal` — will promote to public only when the
707
+ * aggregate subsystem is extracted into its own package.
708
+ *
709
+ * @internal
710
+ */
711
+ interface AggregateStrategy {
712
+ /**
713
+ * Build an `Aggregation<R>` for `Query.aggregate(spec)`. `executeRecords`
714
+ * is a closure that produces the matching record set when the
715
+ * aggregation runs. NO_AGGREGATE throws; the active strategy
716
+ * constructs a real `Aggregation`.
717
+ */
718
+ aggregate<Spec extends AggregateSpec>(executeRecords: () => readonly unknown[], spec: Spec, upstreams: readonly AggregationUpstream[]): Aggregation<AggregateResult<Spec>>;
719
+ /**
720
+ * Build a `GroupedQuery<T, F>` for `Query.groupBy(field)`. Same
721
+ * closure / upstream inputs as `aggregate` plus the group key field.
722
+ */
723
+ groupBy<T, F extends string>(executeRecords: () => readonly unknown[], field: F, upstreams: readonly AggregationUpstream[], dictLabelResolver?: (key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>, moneyFields?: Record<string, MoneyDescriptor>): GroupedQuery<T, F>;
724
+ /**
725
+ * Variadic-keyed sibling — builds a `GroupedQueryN<T, F>` for
726
+ * `Query.groupBy(...fields)`. No dictLabelResolver — `<field>Label`
727
+ * projection only applies to single-field groupings, which dispatch
728
+ * through `groupBy` above.
729
+ */
730
+ groupByN<T, F extends readonly string[]>(executeRecords: () => readonly unknown[], fields: F, upstreams: readonly AggregationUpstream[], moneyFields?: Record<string, MoneyDescriptor>): GroupedQueryN<T, F>;
731
+ /**
732
+ * Terminal streaming aggregator for `ScanBuilder.aggregate(spec)`.
733
+ * Takes an async iterable of decrypted records + the spec and
734
+ * returns the reduced result.
735
+ */
736
+ scanAggregate<Spec extends AggregateSpec>(iter: AsyncIterable<unknown>, spec: Spec): Promise<AggregateResult<Spec>>;
737
+ }
738
+
739
+ export { type AggregateStrategy as A, MoneyUnsupportedError as B, isMoneyDescriptor as C, money as D, GROUPBY_MAX_CARDINALITY as G, type LiveAggregation as L, MoneyCurrencyError as M, type Reducer as R, type AggregateResult as a, type AggregateSpec as b, Aggregation as c, type AggregationUpstream as d, GROUPBY_WARN_CARDINALITY as e, GroupedAggregation as f, GroupedQuery as g, GroupedQueryN as h, type GroupedRow as i, type GroupedRowN as j, type ReducerOptions as k, avg as l, buildLiveAggregation as m, count as n, groupAndReduce as o, max as p, min as q, reduceRecords as r, resetGroupByWarnings as s, sum as t, type RoundingMode as u, type MoneyDescriptor as v, type MoneyOptions as w, type MoneyOptionsFixed as x, type MoneyOptionsMulti as y, MoneyPrecisionError as z };