@noy-db/hub 0.2.0-pre.3 → 0.2.0-pre.31

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 (384) hide show
  1. package/README.md +126 -0
  2. package/dist/adapter/index.d.ts +9 -0
  3. package/dist/adapter/index.js +14 -0
  4. package/dist/aggregate/index.d.ts +3 -2
  5. package/dist/aggregate/index.js +10 -8
  6. package/dist/aggregate/index.js.map +1 -1
  7. package/dist/attestation/index.d.ts +7 -5
  8. package/dist/attestation/index.js +7 -6
  9. package/dist/attestation/index.js.map +1 -1
  10. package/dist/blobs/index.d.ts +9 -7
  11. package/dist/blobs/index.js +12 -6
  12. package/dist/blobs/index.js.map +1 -1
  13. package/dist/bundle/index.d.ts +29 -18
  14. package/dist/bundle/index.js +53 -192
  15. package/dist/bundle/index.js.map +1 -1
  16. package/dist/{chunk-75QDHSE4.js → chunk-2QDWRK3B.js} +5 -5
  17. package/dist/{chunk-74JEQFMT.js → chunk-2UT7HJJR.js} +5 -5
  18. package/dist/chunk-2UT7HJJR.js.map +1 -0
  19. package/dist/{chunk-FCDO7UAO.js → chunk-2ZYIN3BL.js} +2 -2
  20. package/dist/{chunk-BFI3RS42.js → chunk-33EQCZXE.js} +2 -2
  21. package/dist/chunk-33EQCZXE.js.map +1 -0
  22. package/dist/{chunk-WRLHNG6H.js → chunk-4K4QKYK4.js} +4 -4
  23. package/dist/chunk-4K4QKYK4.js.map +1 -0
  24. package/dist/{chunk-HGZ7DC5H.js → chunk-4L6N56B4.js} +2 -2
  25. package/dist/chunk-4L6N56B4.js.map +1 -0
  26. package/dist/{chunk-YMYK7US4.js → chunk-4YD7VZH4.js} +2 -2
  27. package/dist/chunk-4YD7VZH4.js.map +1 -0
  28. package/dist/{chunk-ZUMGGHRB.js → chunk-5PTX7PKD.js} +4 -4
  29. package/dist/{chunk-QAU5HM6Q.js → chunk-6EKRQ7QF.js} +3 -3
  30. package/dist/{chunk-ZC2AAE6J.js → chunk-7GPQPLGO.js} +19 -4
  31. package/dist/chunk-7GPQPLGO.js.map +1 -0
  32. package/dist/{chunk-EPK6A3WJ.js → chunk-A3JMGXPG.js} +2 -2
  33. package/dist/chunk-A3JMGXPG.js.map +1 -0
  34. package/dist/{chunk-FXQYZNOW.js → chunk-A7DNZVAV.js} +1 -1
  35. package/dist/chunk-A7DNZVAV.js.map +1 -0
  36. package/dist/{chunk-UMLVJTYV.js → chunk-ADB7GPM3.js} +7 -4
  37. package/dist/chunk-ADB7GPM3.js.map +1 -0
  38. package/dist/{chunk-YL2DR3HY.js → chunk-ASIGWYRA.js} +2 -2
  39. package/dist/chunk-ASIGWYRA.js.map +1 -0
  40. package/dist/{chunk-2EYC3WDT.js → chunk-AWU4JF7C.js} +93 -93
  41. package/dist/chunk-AWU4JF7C.js.map +1 -0
  42. package/dist/chunk-BEZ2EV43.js +129 -0
  43. package/dist/chunk-BEZ2EV43.js.map +1 -0
  44. package/dist/{chunk-IS5HWQO7.js → chunk-CIZDUAHI.js} +30 -4
  45. package/dist/chunk-CIZDUAHI.js.map +1 -0
  46. package/dist/{chunk-4OQWR46B.js → chunk-CUPTCF4R.js} +5 -5
  47. package/dist/chunk-CUPTCF4R.js.map +1 -0
  48. package/dist/{chunk-5ZGZ6HIZ.js → chunk-DEE4CRYN.js} +30 -7
  49. package/dist/chunk-DEE4CRYN.js.map +1 -0
  50. package/dist/{chunk-UOF74WQY.js → chunk-E2MDPPOC.js} +37 -2
  51. package/dist/chunk-E2MDPPOC.js.map +1 -0
  52. package/dist/{chunk-SAVQ6E2O.js → chunk-FFKQ65YX.js} +10 -3
  53. package/dist/chunk-FFKQ65YX.js.map +1 -0
  54. package/dist/{chunk-2XLVPKXG.js → chunk-G7ALNCQH.js} +10 -2
  55. package/dist/chunk-G7ALNCQH.js.map +1 -0
  56. package/dist/chunk-GGXN73NM.js +252 -0
  57. package/dist/chunk-GGXN73NM.js.map +1 -0
  58. package/dist/{chunk-UVPGJXVO.js → chunk-JOJPBZSZ.js} +5 -5
  59. package/dist/{chunk-YDLAFP36.js → chunk-JZ5DS4DP.js} +346 -3
  60. package/dist/chunk-JZ5DS4DP.js.map +1 -0
  61. package/dist/{chunk-KMI2NBBF.js → chunk-K4JID2ZE.js} +44 -8
  62. package/dist/chunk-K4JID2ZE.js.map +1 -0
  63. package/dist/{aggregate/index.cjs → chunk-K6NVSHAH.js} +241 -210
  64. package/dist/chunk-K6NVSHAH.js.map +1 -0
  65. package/dist/chunk-KJ3K5VZM.js +524 -0
  66. package/dist/chunk-KJ3K5VZM.js.map +1 -0
  67. package/dist/chunk-L5HHBOMS.js +232 -0
  68. package/dist/chunk-L5HHBOMS.js.map +1 -0
  69. package/dist/{chunk-YK72A4IT.js → chunk-LBILABKZ.js} +4 -4
  70. package/dist/chunk-LXKBG52H.js +151 -0
  71. package/dist/chunk-LXKBG52H.js.map +1 -0
  72. package/dist/{chunk-NGSPBLLE.js → chunk-MPIZQGFA.js} +50 -20
  73. package/dist/chunk-MPIZQGFA.js.map +1 -0
  74. package/dist/{chunk-4X2S7PBF.js → chunk-MRJPSXPE.js} +84 -70
  75. package/dist/chunk-MRJPSXPE.js.map +1 -0
  76. package/dist/{chunk-6S3LLAQ5.js → chunk-MSMDDDDJ.js} +3 -3
  77. package/dist/{chunk-6S3LLAQ5.js.map → chunk-MSMDDDDJ.js.map} +1 -1
  78. package/dist/{chunk-GAUBWHAF.js → chunk-OCYFFBZS.js} +4 -4
  79. package/dist/{chunk-NCO2JGKK.js → chunk-PDVP3C2I.js} +1 -1
  80. package/dist/chunk-PDVP3C2I.js.map +1 -0
  81. package/dist/chunk-PZ5AY32C.js +10 -0
  82. package/dist/{chunk-P6256WTJ.js → chunk-QBLPY44S.js} +3 -3
  83. package/dist/chunk-QBLPY44S.js.map +1 -0
  84. package/dist/{query/index.cjs → chunk-QGBBQKDS.js} +706 -831
  85. package/dist/chunk-QGBBQKDS.js.map +1 -0
  86. package/dist/{chunk-FS7A4XNF.js → chunk-QWJCNXH2.js} +3 -3
  87. package/dist/chunk-QXWJQ7UU.js +380 -0
  88. package/dist/chunk-QXWJQ7UU.js.map +1 -0
  89. package/dist/{chunk-GDTCGIPX.js → chunk-RCB6GWTC.js} +27 -5
  90. package/dist/chunk-RCB6GWTC.js.map +1 -0
  91. package/dist/{chunk-K5PVGKE4.js → chunk-SAAJYSVV.js} +2 -2
  92. package/dist/{chunk-G7PAZ3TD.js → chunk-SHJ3BRTZ.js} +46 -10
  93. package/dist/chunk-SHJ3BRTZ.js.map +1 -0
  94. package/dist/chunk-SQXTKZL7.js +125 -0
  95. package/dist/chunk-SQXTKZL7.js.map +1 -0
  96. package/dist/chunk-STNPB3UM.js +9 -0
  97. package/dist/chunk-STNPB3UM.js.map +1 -0
  98. package/dist/{chunk-NSLTPGEN.js → chunk-TMUMMAWV.js} +12 -2
  99. package/dist/{chunk-NSLTPGEN.js.map → chunk-TMUMMAWV.js.map} +1 -1
  100. package/dist/{chunk-LS3JLEIB.js → chunk-TZGWI5AX.js} +4 -4
  101. package/dist/{chunk-GD3BGKAR.js → chunk-UBF5JEOJ.js} +44 -5
  102. package/dist/chunk-UBF5JEOJ.js.map +1 -0
  103. package/dist/{chunk-T6HQMVML.js → chunk-W5NVNJDX.js} +5250 -801
  104. package/dist/chunk-W5NVNJDX.js.map +1 -0
  105. package/dist/chunk-XAYDHD2O.js +123 -0
  106. package/dist/chunk-XAYDHD2O.js.map +1 -0
  107. package/dist/{chunk-LOL725S4.js → chunk-XYW2CSCI.js} +31 -3
  108. package/dist/chunk-XYW2CSCI.js.map +1 -0
  109. package/dist/{chunk-TLFUDXVV.js → chunk-ZCMOS4H2.js} +31 -10
  110. package/dist/chunk-ZCMOS4H2.js.map +1 -0
  111. package/dist/{chunk-FBMXWVGP.js → chunk-ZK66B5EY.js} +450 -30
  112. package/dist/chunk-ZK66B5EY.js.map +1 -0
  113. package/dist/{chunk-GVXBHCZ2.js → chunk-ZPJSQPQH.js} +66 -7
  114. package/dist/chunk-ZPJSQPQH.js.map +1 -0
  115. package/dist/consent/index.d.ts +8 -6
  116. package/dist/consent/index.js +4 -3
  117. package/dist/consent/index.js.map +1 -1
  118. package/dist/crdt/index.js +1 -0
  119. package/dist/crdt/index.js.map +1 -1
  120. package/dist/{crypto-H2Y3DDFW.js → crypto-OSIV2IIW.js} +8 -3
  121. package/dist/{ulid-CiM2OAeM.d.ts → decrypt-partition-CXS5KopB.d.ts} +37 -82
  122. package/dist/{delegation-QSC7G5QC.js → delegation-BQTRJATI.js} +6 -5
  123. package/dist/derivations/index.d.ts +11 -9
  124. package/dist/derivations/index.js +9 -6
  125. package/dist/{dev-unlock-Cf2B7Kih.d.ts → dev-unlock-CnHTTVea.d.ts} +1 -1
  126. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  127. package/dist/errors-BAWO5Z5a.d.ts +1500 -0
  128. package/dist/executor-KYSKFJ2R.js +9 -0
  129. package/dist/executor-M7W3NEKR.js +9 -0
  130. package/dist/executor-VDTDGWO6.js +13 -0
  131. package/dist/{fanout-sidecar-NRBWSLRK.js → fanout-sidecar-AZALISHB.js} +3 -2
  132. package/dist/fanout-sidecar-AZALISHB.js.map +1 -0
  133. package/dist/forget/index.d.ts +1 -0
  134. package/dist/forget/index.js +15 -0
  135. package/dist/guards/index.d.ts +16 -8
  136. package/dist/guards/index.js +12 -5
  137. package/dist/{hash-gVn_uKhp.d.ts → hash-oc5paYl0.d.ts} +1 -1
  138. package/dist/history/index.d.ts +9 -7
  139. package/dist/history/index.js +10 -7
  140. package/dist/history/index.js.map +1 -1
  141. package/dist/i18n/index.d.ts +8 -6
  142. package/dist/i18n/index.js +116 -15
  143. package/dist/i18n/index.js.map +1 -1
  144. package/dist/index-BMmajblo.d.ts +362 -0
  145. package/dist/index-BmhGztUi.d.ts +93 -0
  146. package/dist/{types-D9eB0Rvh.d.ts → index-DHn9lEP0.d.ts} +4305 -1523
  147. package/dist/{index-BF1B2HB9.d.ts → index-Ddm8D3Oo.d.ts} +186 -1151
  148. package/dist/index.d.ts +342 -70
  149. package/dist/index.js +420 -112
  150. package/dist/index.js.map +1 -1
  151. package/dist/indexing/index.d.ts +3 -3
  152. package/dist/indexing/index.js +5 -4
  153. package/dist/indexing/index.js.map +1 -1
  154. package/dist/issue-DPHRF2TI.js +13 -0
  155. package/dist/kernel/index.d.ts +11 -0
  156. package/dist/kernel/index.js +50 -0
  157. package/dist/{lazy-builder-Rpd-V3jP.d.ts → lazy-builder-ChSqcF5t.d.ts} +2 -2
  158. package/dist/{ledger-WOEJUYTP.js → ledger-CI7GSMLB.js} +7 -6
  159. package/dist/materialized-views/index.d.ts +23 -20
  160. package/dist/materialized-views/index.js +9 -7
  161. package/dist/mime-magic-JeLKHRng.d.ts +103 -0
  162. package/dist/noydb-NAU2DTFP.js +40 -0
  163. package/dist/overlay-views/index.d.ts +32 -12
  164. package/dist/overlay-views/index.js +7 -6
  165. package/dist/periods/index.d.ts +8 -6
  166. package/dist/periods/index.js +7 -6
  167. package/dist/{predicate-Dnu81tsS.d.cts → predicate-BmhBSPCH.d.ts} +87 -5
  168. package/dist/{public-envelope-OHQ5UZFM.js → public-envelope-MFMBFJLZ.js} +5 -4
  169. package/dist/query/index.d.ts +4 -3
  170. package/dist/query/index.js +14 -6
  171. package/dist/read-only-facade-3OQRZ3VS.js +8 -0
  172. package/dist/registry-IX5WKK4F.js +8 -0
  173. package/dist/registry-LMHO5265.js +11 -0
  174. package/dist/registry-TXCKWH26.js +9 -0
  175. package/dist/registry-VFEDQSYV.js +9 -0
  176. package/dist/revoke-5PUOZPJJ.js +18 -0
  177. package/dist/revoke-5PUOZPJJ.js.map +1 -0
  178. package/dist/sealed-record/index.d.ts +123 -0
  179. package/dist/sealed-record/index.js +43 -0
  180. package/dist/sealed-record/index.js.map +1 -0
  181. package/dist/session/index.d.ts +9 -7
  182. package/dist/session/index.js +4 -3
  183. package/dist/session/index.js.map +1 -1
  184. package/dist/shadow/index.d.ts +8 -6
  185. package/dist/shadow/index.js +3 -2
  186. package/dist/shadow/index.js.map +1 -1
  187. package/dist/{signer-M4K5HBLD.js → signer-UB5TQOZ6.js} +6 -5
  188. package/dist/signer-UB5TQOZ6.js.map +1 -0
  189. package/dist/snapshots/index.d.ts +30 -0
  190. package/dist/snapshots/index.js +153 -0
  191. package/dist/snapshots/index.js.map +1 -0
  192. package/dist/{stale-PAGCS4K5.js → stale-J3TUF5C5.js} +3 -2
  193. package/dist/stale-J3TUF5C5.js.map +1 -0
  194. package/dist/store/index.d.ts +15 -6
  195. package/dist/store/index.js +3 -2
  196. package/dist/{strategy-DSTrsZ8t.d.ts → strategy-8QGs5KQE.d.ts} +475 -7
  197. package/dist/sync/index.d.ts +7 -5
  198. package/dist/sync/index.js +5 -4
  199. package/dist/sync/index.js.map +1 -1
  200. package/dist/team/index.d.ts +8 -6
  201. package/dist/team/index.js +9 -8
  202. package/dist/transition-guard-Dy3NioQr.d.ts +165 -0
  203. package/dist/tx/index.d.ts +26 -8
  204. package/dist/tx/index.js +10 -5
  205. package/dist/tx/index.js.map +1 -1
  206. package/dist/ulid-DRH25k3y.d.ts +66 -0
  207. package/dist/{ulid-COREQ2RQ.js → ulid-KEPZMD2N.js} +2 -1
  208. package/dist/ulid-KEPZMD2N.js.map +1 -0
  209. package/dist/util/index.d.ts +2 -0
  210. package/dist/util/index.js +6 -1
  211. package/dist/util/index.js.map +1 -1
  212. package/dist/{with-materialized-view-qtoJ3xKJ.d.ts → with-materialized-view-DIVeez0W.d.ts} +2 -2
  213. package/dist/{with-overlayed-view-DFaRfgMr.d.ts → with-overlayed-view-DVZrc5Hb.d.ts} +2 -2
  214. package/dist/with-rollup-CbU-O4wP.d.ts +47 -0
  215. package/dist/zod-HAJM7LMS.js +14763 -0
  216. package/dist/zod-HAJM7LMS.js.map +1 -0
  217. package/package.json +73 -191
  218. package/dist/aggregate/index.cjs.map +0 -1
  219. package/dist/aggregate/index.d.cts +0 -38
  220. package/dist/attestation/index.cjs +0 -305
  221. package/dist/attestation/index.cjs.map +0 -1
  222. package/dist/attestation/index.d.cts +0 -52
  223. package/dist/blobs/index.cjs +0 -1480
  224. package/dist/blobs/index.cjs.map +0 -1
  225. package/dist/blobs/index.d.cts +0 -46
  226. package/dist/bundle/index.cjs +0 -18561
  227. package/dist/bundle/index.cjs.map +0 -1
  228. package/dist/bundle/index.d.cts +0 -176
  229. package/dist/chunk-2EYC3WDT.js.map +0 -1
  230. package/dist/chunk-2XLVPKXG.js.map +0 -1
  231. package/dist/chunk-4OQWR46B.js.map +0 -1
  232. package/dist/chunk-4UBOTYP5.js +0 -1367
  233. package/dist/chunk-4UBOTYP5.js.map +0 -1
  234. package/dist/chunk-4X2S7PBF.js.map +0 -1
  235. package/dist/chunk-5YHWBPOT.js +0 -19
  236. package/dist/chunk-5YHWBPOT.js.map +0 -1
  237. package/dist/chunk-5ZGZ6HIZ.js.map +0 -1
  238. package/dist/chunk-74JEQFMT.js.map +0 -1
  239. package/dist/chunk-A6SWRXUQ.js +0 -118
  240. package/dist/chunk-A6SWRXUQ.js.map +0 -1
  241. package/dist/chunk-BFI3RS42.js.map +0 -1
  242. package/dist/chunk-EMEX37ZN.js +0 -51
  243. package/dist/chunk-EMEX37ZN.js.map +0 -1
  244. package/dist/chunk-EPK6A3WJ.js.map +0 -1
  245. package/dist/chunk-FBMXWVGP.js.map +0 -1
  246. package/dist/chunk-FXQYZNOW.js.map +0 -1
  247. package/dist/chunk-G7PAZ3TD.js.map +0 -1
  248. package/dist/chunk-GD3BGKAR.js.map +0 -1
  249. package/dist/chunk-GDTCGIPX.js.map +0 -1
  250. package/dist/chunk-GVXBHCZ2.js.map +0 -1
  251. package/dist/chunk-HGZ7DC5H.js.map +0 -1
  252. package/dist/chunk-IS5HWQO7.js.map +0 -1
  253. package/dist/chunk-KMI2NBBF.js.map +0 -1
  254. package/dist/chunk-KYKMKLJ6.js +0 -340
  255. package/dist/chunk-KYKMKLJ6.js.map +0 -1
  256. package/dist/chunk-LOL725S4.js.map +0 -1
  257. package/dist/chunk-MRIBLZL3.js +0 -86
  258. package/dist/chunk-MRIBLZL3.js.map +0 -1
  259. package/dist/chunk-NCO2JGKK.js.map +0 -1
  260. package/dist/chunk-NGSPBLLE.js.map +0 -1
  261. package/dist/chunk-P6256WTJ.js.map +0 -1
  262. package/dist/chunk-SAVQ6E2O.js.map +0 -1
  263. package/dist/chunk-T6HQMVML.js.map +0 -1
  264. package/dist/chunk-TLFUDXVV.js.map +0 -1
  265. package/dist/chunk-UMLVJTYV.js.map +0 -1
  266. package/dist/chunk-UOF74WQY.js.map +0 -1
  267. package/dist/chunk-WRLHNG6H.js.map +0 -1
  268. package/dist/chunk-YDLAFP36.js.map +0 -1
  269. package/dist/chunk-YL2DR3HY.js.map +0 -1
  270. package/dist/chunk-YMYK7US4.js.map +0 -1
  271. package/dist/chunk-ZC2AAE6J.js.map +0 -1
  272. package/dist/consent/index.cjs +0 -204
  273. package/dist/consent/index.cjs.map +0 -1
  274. package/dist/consent/index.d.cts +0 -25
  275. package/dist/crdt/index.cjs +0 -152
  276. package/dist/crdt/index.cjs.map +0 -1
  277. package/dist/crdt/index.d.cts +0 -30
  278. package/dist/derivations/index.cjs +0 -351
  279. package/dist/derivations/index.cjs.map +0 -1
  280. package/dist/derivations/index.d.cts +0 -72
  281. package/dist/dev-unlock-De3mjQWv.d.cts +0 -263
  282. package/dist/executor-BZKFZVRC.js +0 -8
  283. package/dist/executor-GFZFDQXV.js +0 -8
  284. package/dist/executor-KT2IOZVP.js +0 -11
  285. package/dist/fanout-sidecar-NRBWSLRK.js.map +0 -1
  286. package/dist/guards/index.cjs +0 -322
  287. package/dist/guards/index.cjs.map +0 -1
  288. package/dist/guards/index.d.cts +0 -31
  289. package/dist/hash-vBCB0-Ps.d.cts +0 -63
  290. package/dist/history/index.cjs +0 -1222
  291. package/dist/history/index.cjs.map +0 -1
  292. package/dist/history/index.d.cts +0 -63
  293. package/dist/i18n/index.cjs +0 -840
  294. package/dist/i18n/index.cjs.map +0 -1
  295. package/dist/i18n/index.d.cts +0 -39
  296. package/dist/index-DVkvrgpm.d.cts +0 -2290
  297. package/dist/index.cjs +0 -23590
  298. package/dist/index.cjs.map +0 -1
  299. package/dist/index.d.cts +0 -778
  300. package/dist/indexing/index.cjs +0 -738
  301. package/dist/indexing/index.cjs.map +0 -1
  302. package/dist/indexing/index.d.cts +0 -36
  303. package/dist/issue-BAJ7ZB4S.js +0 -12
  304. package/dist/lazy-builder-C-rPfWG0.d.cts +0 -304
  305. package/dist/materialized-views/index.cjs +0 -837
  306. package/dist/materialized-views/index.cjs.map +0 -1
  307. package/dist/materialized-views/index.d.cts +0 -184
  308. package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
  309. package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
  310. package/dist/noydb-XNQSKXGO.js +0 -34
  311. package/dist/overlay-views/index.cjs +0 -359
  312. package/dist/overlay-views/index.cjs.map +0 -1
  313. package/dist/overlay-views/index.d.cts +0 -82
  314. package/dist/periods/index.cjs +0 -1041
  315. package/dist/periods/index.cjs.map +0 -1
  316. package/dist/periods/index.d.cts +0 -22
  317. package/dist/predicate-Dnu81tsS.d.ts +0 -185
  318. package/dist/query/index.cjs.map +0 -1
  319. package/dist/query/index.d.cts +0 -3
  320. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  321. package/dist/registry-2IEARCGT.js +0 -7
  322. package/dist/registry-CDHASH73.js +0 -10
  323. package/dist/registry-EMGLZGR6.js +0 -8
  324. package/dist/registry-NQALYR77.js +0 -8
  325. package/dist/revoke-7JOVLZFD.js +0 -17
  326. package/dist/session/index.cjs +0 -495
  327. package/dist/session/index.cjs.map +0 -1
  328. package/dist/session/index.d.cts +0 -46
  329. package/dist/shadow/index.cjs +0 -133
  330. package/dist/shadow/index.cjs.map +0 -1
  331. package/dist/shadow/index.d.cts +0 -17
  332. package/dist/store/index.cjs +0 -1083
  333. package/dist/store/index.cjs.map +0 -1
  334. package/dist/store/index.d.cts +0 -492
  335. package/dist/strategy-BSxFXGzb.d.cts +0 -110
  336. package/dist/strategy-DSTrsZ8t.d.cts +0 -601
  337. package/dist/sync/index.cjs +0 -1062
  338. package/dist/sync/index.cjs.map +0 -1
  339. package/dist/sync/index.d.cts +0 -43
  340. package/dist/team/index.cjs +0 -2798
  341. package/dist/team/index.cjs.map +0 -1
  342. package/dist/team/index.d.cts +0 -118
  343. package/dist/tx/index.cjs +0 -544
  344. package/dist/tx/index.cjs.map +0 -1
  345. package/dist/tx/index.d.cts +0 -21
  346. package/dist/types-CSLcfytP.d.cts +0 -12493
  347. package/dist/ulid-CG2YvAbg.d.cts +0 -603
  348. package/dist/util/index.cjs +0 -230
  349. package/dist/util/index.cjs.map +0 -1
  350. package/dist/util/index.d.cts +0 -77
  351. package/dist/with-derivation-Bzpj6UTv.d.ts +0 -13
  352. package/dist/with-derivation-DWajFh4K.d.cts +0 -13
  353. package/dist/with-guard-DF_Ul3DT.d.cts +0 -18
  354. package/dist/with-guard-DR7U-l4v.d.ts +0 -18
  355. package/dist/with-materialized-view-_piodoIz.d.cts +0 -27
  356. package/dist/with-overlayed-view-DwzCKxn2.d.cts +0 -13
  357. /package/dist/{crypto-H2Y3DDFW.js.map → adapter/index.js.map} +0 -0
  358. /package/dist/{chunk-75QDHSE4.js.map → chunk-2QDWRK3B.js.map} +0 -0
  359. /package/dist/{chunk-FCDO7UAO.js.map → chunk-2ZYIN3BL.js.map} +0 -0
  360. /package/dist/{chunk-ZUMGGHRB.js.map → chunk-5PTX7PKD.js.map} +0 -0
  361. /package/dist/{chunk-QAU5HM6Q.js.map → chunk-6EKRQ7QF.js.map} +0 -0
  362. /package/dist/{chunk-UVPGJXVO.js.map → chunk-JOJPBZSZ.js.map} +0 -0
  363. /package/dist/{chunk-YK72A4IT.js.map → chunk-LBILABKZ.js.map} +0 -0
  364. /package/dist/{chunk-GAUBWHAF.js.map → chunk-OCYFFBZS.js.map} +0 -0
  365. /package/dist/{delegation-QSC7G5QC.js.map → chunk-PZ5AY32C.js.map} +0 -0
  366. /package/dist/{chunk-FS7A4XNF.js.map → chunk-QWJCNXH2.js.map} +0 -0
  367. /package/dist/{chunk-K5PVGKE4.js.map → chunk-SAAJYSVV.js.map} +0 -0
  368. /package/dist/{chunk-LS3JLEIB.js.map → chunk-TZGWI5AX.js.map} +0 -0
  369. /package/dist/{executor-BZKFZVRC.js.map → crypto-OSIV2IIW.js.map} +0 -0
  370. /package/dist/{executor-GFZFDQXV.js.map → delegation-BQTRJATI.js.map} +0 -0
  371. /package/dist/{executor-KT2IOZVP.js.map → executor-KYSKFJ2R.js.map} +0 -0
  372. /package/dist/{issue-BAJ7ZB4S.js.map → executor-M7W3NEKR.js.map} +0 -0
  373. /package/dist/{ledger-WOEJUYTP.js.map → executor-VDTDGWO6.js.map} +0 -0
  374. /package/dist/{noydb-XNQSKXGO.js.map → forget/index.js.map} +0 -0
  375. /package/dist/{public-envelope-OHQ5UZFM.js.map → issue-DPHRF2TI.js.map} +0 -0
  376. /package/dist/{read-only-facade-ITU6L7BL.js.map → kernel/index.js.map} +0 -0
  377. /package/dist/{registry-2IEARCGT.js.map → ledger-CI7GSMLB.js.map} +0 -0
  378. /package/dist/{registry-CDHASH73.js.map → noydb-NAU2DTFP.js.map} +0 -0
  379. /package/dist/{registry-EMGLZGR6.js.map → public-envelope-MFMBFJLZ.js.map} +0 -0
  380. /package/dist/{registry-NQALYR77.js.map → read-only-facade-3OQRZ3VS.js.map} +0 -0
  381. /package/dist/{revoke-7JOVLZFD.js.map → registry-IX5WKK4F.js.map} +0 -0
  382. /package/dist/{signer-M4K5HBLD.js.map → registry-LMHO5265.js.map} +0 -0
  383. /package/dist/{stale-PAGCS4K5.js.map → registry-TXCKWH26.js.map} +0 -0
  384. /package/dist/{ulid-COREQ2RQ.js.map → registry-VFEDQSYV.js.map} +0 -0
@@ -1,3 +1,5 @@
1
+ import { N as NoydbError } from './errors-BAWO5Z5a.js';
2
+
1
3
  /**
2
4
  * Aggregation reducers for the query DSL.
3
5
  *
@@ -57,6 +59,35 @@ interface Reducer<R, S = R> {
57
59
  remove?(state: S, record: unknown): S;
58
60
  /** Collapse the internal state into the user-visible result. */
59
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>;
60
91
  }
61
92
  /**
62
93
  * Common options accepted by every reducer factory.
@@ -75,6 +106,13 @@ interface Reducer<R, S = R> {
75
106
  interface ReducerOptions<TSeed = unknown> {
76
107
  /** constraint #2 — seed is plumbed through but unused in. */
77
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>;
78
116
  }
79
117
  /**
80
118
  * Count the number of records that match the query. Ignores field
@@ -308,6 +346,410 @@ declare class Aggregation<R> {
308
346
  */
309
347
  declare function buildLiveAggregation<V>(recompute: () => V, upstreams: readonly AggregationUpstream[]): LiveAggregation<V>;
310
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
+ * Per-layer i18n resolution policy.
437
+ *
438
+ * `onMissing` governs what happens when a multilingual field is resolved
439
+ * to a target locale that is absent. It may be a single scalar policy or
440
+ * a per-layer map, so a field can be lenient at the app read boundary but
441
+ * strict inside a materialized view.
442
+ *
443
+ * Effective policy for layer `λ`:
444
+ *
445
+ * ```
446
+ * explicit(λ) = typeof onMissing === 'object' ? onMissing[λ] : undefined
447
+ * scalar = typeof onMissing === 'string' ? onMissing : undefined
448
+ * policy(λ) = explicit(λ) ?? layerDefault(λ) ?? scalar ?? 'throw'
449
+ * ```
450
+ *
451
+ * - `layerDefault('guard') = 'substitute'` — guards are lenient unless
452
+ * EXPLICITLY overridden; they never inherit a scalar policy (a guard
453
+ * reading a display value must not hard-fail on a missing locale).
454
+ * - every other layer has no default, so it inherits the scalar, else
455
+ * falls back to `'throw'` (today's behavior — zero breaking change).
456
+ *
457
+ * @public
458
+ */
459
+ type OnMissing = 'substitute' | 'null' | 'throw';
460
+ /**
461
+ * The contexts in which a multilingual field is resolved. Each can carry
462
+ * its own `onMissing` policy.
463
+ *
464
+ * - `read` — ordinary app reads (`get`/`list`/query projection).
465
+ * - `guard` — a guard callback reading a value.
466
+ * - `join` — a joined record expanded onto a row.
467
+ * - `mv` — materialized-view input.
468
+ * - `derivation` — derivation input.
469
+ * - `export` — bundle/public-envelope export.
470
+ */
471
+ type Layer = 'read' | 'guard' | 'join' | 'mv' | 'derivation' | 'export';
472
+ /** Field-level policy: a single scalar, or a per-layer map. */
473
+ type OnMissingPolicy = OnMissing | Partial<Record<Layer, OnMissing>>;
474
+ /**
475
+ * Resolve the effective `OnMissing` for a layer from a field's declared
476
+ * policy. See module docs for the resolution rule.
477
+ */
478
+ declare function resolvePolicy(onMissing: OnMissingPolicy | undefined, layer: Layer): OnMissing;
479
+
480
+ /**
481
+ * i18nText schema type —
482
+ *
483
+ * `i18nText({ languages, required })` creates a descriptor for a
484
+ * multi-language content field whose value is stored as a
485
+ * `{ [locale]: string }` map (e.g. `{ en: 'Consulting', th: 'ที่ปรึกษา' }`).
486
+ *
487
+ * On put, the descriptor validates that required languages are present.
488
+ * On read (when a `locale` option is passed), the map is collapsed to the
489
+ * caller's locale string via the fallback chain.
490
+ *
491
+ * Design decisions
492
+ * ────────────────
493
+ *
494
+ * **Descriptor pattern (not a Zod type).**
495
+ * `i18nText()` returns a plain descriptor object used in the collection's
496
+ * `i18nFields` option — same pattern as `ref()` / `dictKey()`. This keeps
497
+ * `@noy-db/core` at zero runtime dependencies and avoids Zod v3 field-type
498
+ * constraints. TypeScript inference is handled via the descriptor's type.
499
+ *
500
+ * **Enforcement at the collection boundary.**
501
+ * The `required` option is checked by `Collection.put()` via the compartment's
502
+ * registered `i18nFields`. Failed validation throws `MissingTranslationError`
503
+ * — a distinct class from `SchemaValidationError` so callers can tell
504
+ * "wrong shape" from "missing translations".
505
+ *
506
+ * **Resolution is post-decryption.**
507
+ * Locale resolution happens AFTER `decryptRecord()`, as a pure in-memory
508
+ * transform. No additional crypto work is needed. The resolved record is
509
+ * returned in place of the stored one, with i18nText fields replaced by
510
+ * their locale-resolved strings.
511
+ *
512
+ * **`locale: 'raw'`.**
513
+ * Passing `{ locale: 'raw' }` skips resolution and returns the full
514
+ * `{ [locale]: string }` map — useful for bilingual exports, admin UIs,
515
+ * and any context where all translations must be visible at once.
516
+ *
517
+ * **Out of scope.**
518
+ * Pluralization, RTL rendering, date/number formatting, per-locale CRDT
519
+ * merging.
520
+ */
521
+
522
+ /** Flatten an intersection into a single object literal for nicer hovers. */
523
+ type Prettify<T> = {
524
+ [K in keyof T]: T[K];
525
+ } & {};
526
+ /**
527
+ * The stored shape of a multilingual field, inferred from its `required`
528
+ * mode — so the compiler forces you to handle an absent optional locale
529
+ * (`string | undefined`) instead of silently yielding `undefined`.
530
+ *
531
+ * Mirrors `i18nText({ languages, required })`:
532
+ * - `'all'` (default) — every locale required: `{ th: string; en: string }`
533
+ * - `'any'` — every locale optional: `{ th?: string; en?: string }`
534
+ * (the "at least one present" guarantee is runtime-only — not expressible
535
+ * in TypeScript — so each key is optional)
536
+ * - `readonly L[]` — listed locales required, the rest optional:
537
+ * `I18nMap<'th'|'en', ['th']>` → `{ th: string; en?: string }`
538
+ *
539
+ * @example
540
+ * ```ts
541
+ * type Lang = 'th' | 'en'
542
+ * interface Contact {
543
+ * name: I18nMap<Lang, 'any'> // { th?: string; en?: string }
544
+ * legalName: I18nMap<Lang, ['th']> // { th: string; en?: string }
545
+ * slug: I18nMap<Lang> // { th: string; en: string }
546
+ * }
547
+ * ```
548
+ *
549
+ * @public
550
+ */
551
+ type I18nMap<Langs extends string, Required extends 'all' | 'any' | readonly Langs[] = 'all'> = Required extends 'all' ? Record<Langs, string> : Required extends 'any' ? Partial<Record<Langs, string>> : Required extends readonly (infer R extends Langs)[] ? Prettify<Record<R, string> & Partial<Record<Exclude<Langs, R>, string>>> : never;
552
+ /**
553
+ * Options for `i18nText()`.
554
+ *
555
+ * `languages` declares the full set of supported locales. `required`
556
+ * controls which must be present on every `put()`.
557
+ *
558
+ * `autoTranslate` is the per-field opt-in for the `plaintextTranslator`
559
+ * hook. When `true` and a `plaintextTranslator` is configured
560
+ * on `createNoydb()`, missing translations are generated before `put()`.
561
+ * Default: `false`.
562
+ */
563
+ interface I18nTextOptions {
564
+ /** All supported locale codes (BCP 47). */
565
+ readonly languages: readonly string[];
566
+ /**
567
+ * Which locales must be present on every `put()`.
568
+ *
569
+ * - `'all'` — every declared language must be present.
570
+ * - `'any'` — at least one declared language must be present.
571
+ * - `string[]` — listed locales are required; others are optional.
572
+ */
573
+ readonly required: 'all' | 'any' | readonly string[];
574
+ /**
575
+ * Per-field opt-in for the `plaintextTranslator` hook.
576
+ * When `true`, missing required translations are auto-generated
577
+ * before `put()` if a translator is configured. Default: `false`.
578
+ */
579
+ readonly autoTranslate?: boolean;
580
+ /**
581
+ * What to do when this field is resolved to a locale that is absent.
582
+ * A single policy, or a per-layer map (read/guard/join/mv/derivation/
583
+ * export). Default `'throw'` — today's behavior, zero breaking change.
584
+ * See {@link OnMissingPolicy}.
585
+ *
586
+ * NOTE (current wiring): ALL layers are enforced — `read` (`get`/`list`),
587
+ * `guard`, `derivation`, `mv`, `join`, `export`. Guard / derivation
588
+ * `ctx.vault` reads resolve under their own layer policy (`guard` defaults to
589
+ * the lenient `'substitute'`). The `mv` layer fires for materialized views
590
+ * that declare `{ i18nLocale, i18nFields }` — UNION (group-key i18n fields
591
+ * resolve before the unified-row bucketing) and query-form (resolved in
592
+ * `GroupedAggregation.run` before `groupAndReduce`); grouping a raw i18n field
593
+ * without a locale throws. The `join` layer resolves a joined right-side i18n
594
+ * field to the query locale (`toArray({ locale })` or the vault default; raw
595
+ * when locale-less). The `export` layer fires for
596
+ * `exportStream`/`exportJSON({ resolveLabels })` — records collapse to the
597
+ * export locale.
598
+ */
599
+ readonly onMissing?: OnMissingPolicy;
600
+ /**
601
+ * Ordered preferred-substitute locales used when `onMissing` resolves
602
+ * to `'substitute'` and the target locale is absent. `'any'` as an
603
+ * element means "first non-empty value". A caller-supplied `fallback`
604
+ * at read time takes precedence over this declared list.
605
+ */
606
+ readonly substitute?: readonly string[];
607
+ /**
608
+ * #285 smart-substitute. When `true`, a missing-locale `substitute` walk that
609
+ * misses the explicit chain prefers the available locale whose script is
610
+ * nearest the target (same script, then Latin) rather than an arbitrary value
611
+ * — e.g. a missing Thai label prefers another Thai (or Latin) translation over
612
+ * an unreadable script. Default `false` (legacy first-non-empty behavior).
613
+ */
614
+ readonly smartSubstitute?: boolean;
615
+ /**
616
+ * Per-locale script enforcement (write-time). `'auto'` infers the
617
+ * allowed Unicode scripts per locale (asymmetric Latin tolerance); an
618
+ * object overrides per slot. Absent ⇒ no check. See `./script.ts`.
619
+ */
620
+ readonly script?: 'auto' | Partial<Record<string, readonly string[]>>;
621
+ /**
622
+ * What to do when a slot's value contains characters outside its
623
+ * allowed script set. Default `'reject'`.
624
+ */
625
+ readonly onScriptViolation?: 'reject' | 'filter' | 'warn';
626
+ /**
627
+ * #435 v1.x — eager-fill empty locale slots from the substitute chain at
628
+ * write time, recording provenance in the internal `_i18nFilled` marker.
629
+ * Mutually exclusive with an EXPLICIT `'throw'` onMissing policy (densify
630
+ * fills every hole, so a throw would be unreachable). Without an explicit
631
+ * `substitute`, fills from `'any'` (first non-empty). Default absent.
632
+ */
633
+ readonly densifyOnWrite?: boolean;
634
+ }
635
+ /**
636
+ * Descriptor returned by `i18nText()`. Attach to the collection's
637
+ * `i18nFields` option:
638
+ *
639
+ * ```ts
640
+ * const lineItems = company.collection<LineItem>('line-items', {
641
+ * i18nFields: {
642
+ * description: i18nText({ languages: ['en', 'th'], required: 'all' }),
643
+ * },
644
+ * })
645
+ * ```
646
+ */
647
+ interface I18nTextDescriptor {
648
+ readonly _noydbI18nText: true;
649
+ readonly options: I18nTextOptions;
650
+ }
651
+ /**
652
+ * Create an `I18nTextDescriptor` for a multi-language content field.
653
+ *
654
+ * @param options Language list + enforcement mode.
655
+ *
656
+ * @example
657
+ * ```ts
658
+ * i18nText({ languages: ['en', 'th'], required: 'all' })
659
+ * i18nText({ languages: ['en', 'th'], required: ['th'], autoTranslate: true })
660
+ * ```
661
+ */
662
+ declare function i18nText(options: I18nTextOptions): I18nTextDescriptor;
663
+ /** Runtime predicate for detecting an `I18nTextDescriptor`. */
664
+ declare function isI18nTextDescriptor(x: unknown): x is I18nTextDescriptor;
665
+ /**
666
+ * Validate that a value is a valid `{ [locale]: string }` map and that
667
+ * all required locales are present. Throws `MissingTranslationError`
668
+ * when the required constraint is violated.
669
+ *
670
+ * Called by `Collection.put()` for each registered `i18nField`.
671
+ *
672
+ * @param value The raw field value from the record being put.
673
+ * @param field The field name (used in the thrown error message).
674
+ * @param descriptor The `i18nText()` descriptor for this field.
675
+ */
676
+ declare function validateI18nTextValue(value: unknown, field: string, descriptor: I18nTextDescriptor): void;
677
+ /**
678
+ * Resolve an i18nText value (`{ [locale]: string }` map) to a string
679
+ * for the given locale.
680
+ *
681
+ * @param value The stored locale map.
682
+ * @param locale The requested locale code, or `'raw'` to return the map.
683
+ * @param fallback Single locale or ordered list; use `'any'` as the last
684
+ * element to fall back to any available translation.
685
+ * @param field Field name used in `LocaleNotSpecifiedError` messages.
686
+ * @returns The resolved string, OR the original map when `locale === 'raw'`.
687
+ */
688
+ /** Options for the policy-aware form of {@link resolveI18nText}. */
689
+ interface ResolveI18nOptions {
690
+ /** Effective policy for the resolution layer. Default `'throw'`. */
691
+ readonly policy?: OnMissing;
692
+ /** Declared substitute chain; applied only under policy `'substitute'`. */
693
+ readonly substitute?: readonly string[];
694
+ /**
695
+ * #285 smart-substitute. When `true` and policy is `'substitute'`, after the
696
+ * explicit chain misses, pick the available locale whose script is nearest the
697
+ * target (same script first, then Latin's broad readability) instead of an
698
+ * arbitrary value. Default `false`.
699
+ */
700
+ readonly smartSubstitute?: boolean;
701
+ }
702
+ declare function resolveI18nText(value: Record<string, string>, locale: string, fallback?: string | readonly string[], field?: string): string | Record<string, string>;
703
+ declare function resolveI18nText(value: Record<string, string>, locale: string, fallback: string | readonly string[] | undefined, field: string | undefined, opts: ResolveI18nOptions): string | Record<string, string> | null;
704
+ /**
705
+ * Return all leaf values at `path`, expanding `[].` array wildcards.
706
+ *
707
+ * - `'name'` → `[obj.name]`
708
+ * - `'address.lineOne'` → `[obj.address.lineOne]`
709
+ * - `'contacts[].title'` → `[obj.contacts[0].title, obj.contacts[1].title, …]`
710
+ *
711
+ * Returns an empty array when the path does not resolve (missing key,
712
+ * wrong type, etc.). Used by `enforceI18nOnPut` to validate nested fields.
713
+ */
714
+ declare function getAtPath(obj: Record<string, unknown>, path: string): unknown[];
715
+ /**
716
+ * Mutate `obj` in-place, setting `value` at the nested `path`.
717
+ * Supports dot notation (`'address.lineOne'`) but not array wildcards —
718
+ * auto-translate on `contacts[].title` style paths is not supported.
719
+ */
720
+ declare function setAtPathInPlace(obj: Record<string, unknown>, path: string, value: unknown): void;
721
+ /**
722
+ * Apply locale resolution to a single record, returning a new copy.
723
+ *
724
+ * For each field registered as an `i18nText` descriptor:
725
+ * - If `locale === 'raw'`, the field value is left as the stored map.
726
+ * - Otherwise, the field value is replaced with the resolved string.
727
+ *
728
+ * Field paths support dot notation (`'address.lineOne'`) and array
729
+ * wildcards (`'contacts[].title'`). Top-level fields work as before.
730
+ *
731
+ * @param record The decrypted record.
732
+ * @param i18nFields Map of field path → `I18nTextDescriptor`.
733
+ * @param locale The requested locale (or `'raw'`).
734
+ * @param fallback Fallback chain (optional).
735
+ * @param layer Resolution layer (default `'read'`). Each field's
736
+ * `onMissing` policy is resolved for this layer, so the
737
+ * same record resolves leniently on a get but strictly
738
+ * inside an mv/derivation.
739
+ */
740
+ declare function applyI18nLocale(record: Record<string, unknown>, i18nFields: Record<string, I18nTextDescriptor>, locale: string, fallback?: string | readonly string[], layer?: Layer): Record<string, unknown>;
741
+ /**
742
+ * Remove the internal densify provenance marker (`_i18nFilled`) from a
743
+ * read-facing record (#435). NON-mutating: returns the same object when the
744
+ * marker is absent, otherwise a shallow copy without the marker.
745
+ *
746
+ * MUST be applied on every user-facing read return — even locale-less ones,
747
+ * which bypass {@link applyI18nLocale}. MUST NOT be applied on the internal
748
+ * prior-read path (decryptRecord / resolveDensifyPrior), where densify needs
749
+ * the marker.
750
+ */
751
+ declare function stripI18nFilled<T extends Record<string, unknown>>(record: T): T;
752
+
311
753
  /**
312
754
  * Query DSL `.groupBy()` —.
313
755
  *
@@ -430,6 +872,12 @@ declare abstract class GroupedQueryBase {
430
872
  * for composite keys.
431
873
  */
432
874
  protected readonly dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined;
875
+ /**
876
+ * Money field descriptors for the backing collection — used to
877
+ * rewrite `sum`/`min`/`max` over money fields into exact BigInt
878
+ * reducers when `.aggregate(spec)` is terminated.
879
+ */
880
+ protected readonly moneyFields?: Record<string, MoneyDescriptor> | undefined;
433
881
  /**
434
882
  * Field set this grouped query buckets on. Stored in declaration
435
883
  * order — the same order is preserved on every result row by
@@ -444,7 +892,15 @@ declare abstract class GroupedQueryBase {
444
892
  * `undefined` — `<field>Label` projection has no meaningful shape
445
893
  * for composite keys.
446
894
  */
447
- dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined);
895
+ dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined,
896
+ /**
897
+ * Money field descriptors for the backing collection — used to
898
+ * rewrite `sum`/`min`/`max` over money fields into exact BigInt
899
+ * reducers when `.aggregate(spec)` is terminated.
900
+ */
901
+ moneyFields?: Record<string, MoneyDescriptor> | undefined);
902
+ /** Apply money-aware reducer rewriting when money fields are declared. */
903
+ protected wrapSpec<Spec extends AggregateSpec>(spec: Spec): Spec;
448
904
  }
449
905
  /**
450
906
  * Chainable wrapper returned by `Query.groupBy(field)`. Terminates
@@ -484,7 +940,7 @@ declare class GroupedQueryN<T, F extends readonly string[]> extends GroupedQuery
484
940
  * bucket would be created — the consumer doesn't have to wait for
485
941
  * the full partition to materialize before the error fires.
486
942
  */
487
- declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFields: string | readonly string[], spec: AggregateSpec): R[];
943
+ declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFields: string | readonly string[], spec: AggregateSpec, moneyFields?: Record<string, MoneyDescriptor>): R[];
488
944
  /**
489
945
  * Grouped aggregation wrapper — the `.groupBy(field).aggregate(spec)`
490
946
  * terminal. Shape mirrors `Aggregation<R>` from aggregate.ts: two
@@ -511,8 +967,20 @@ declare class GroupedAggregation<R> {
511
967
  *. Present when the grouping field is a dictKey.
512
968
  */
513
969
  dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined);
514
- /** Execute the query, group, reduce, and return an array of rows. */
515
- run(): R[];
970
+ /**
971
+ * Execute the query, group, reduce, and return an array of rows.
972
+ *
973
+ * `opts` (#285 query-form MV grouping): when a `locale` + `i18nFields` are
974
+ * given, the declared group-key `i18nText` fields are resolved to that locale
975
+ * at the `mv` layer BEFORE bucketing — so an i18n group key is a stable string
976
+ * instead of a raw `{locale}` map. The MV executor passes the MV's
977
+ * `i18nLocale`/`i18nFields`; ordinary `.run()` callers pass nothing and are
978
+ * unaffected.
979
+ */
980
+ run(opts?: {
981
+ locale?: string;
982
+ i18nFields?: Record<string, I18nTextDescriptor>;
983
+ }): R[];
516
984
  /**
517
985
  * Execute the query, group, reduce, and resolve `<field>Label` for
518
986
  * each result row when the grouping field is a `dictKey` and a
@@ -582,14 +1050,14 @@ interface AggregateStrategy {
582
1050
  * Build a `GroupedQuery<T, F>` for `Query.groupBy(field)`. Same
583
1051
  * closure / upstream inputs as `aggregate` plus the group key field.
584
1052
  */
585
- 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>): GroupedQuery<T, F>;
1053
+ 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>;
586
1054
  /**
587
1055
  * Variadic-keyed sibling — builds a `GroupedQueryN<T, F>` for
588
1056
  * `Query.groupBy(...fields)`. No dictLabelResolver — `<field>Label`
589
1057
  * projection only applies to single-field groupings, which dispatch
590
1058
  * through `groupBy` above.
591
1059
  */
592
- groupByN<T, F extends readonly string[]>(executeRecords: () => readonly unknown[], fields: F, upstreams: readonly AggregationUpstream[]): GroupedQueryN<T, F>;
1060
+ groupByN<T, F extends readonly string[]>(executeRecords: () => readonly unknown[], fields: F, upstreams: readonly AggregationUpstream[], moneyFields?: Record<string, MoneyDescriptor>): GroupedQueryN<T, F>;
593
1061
  /**
594
1062
  * Terminal streaming aggregator for `ScanBuilder.aggregate(spec)`.
595
1063
  * Takes an async iterable of decrypted records + the spec and
@@ -598,4 +1066,4 @@ interface AggregateStrategy {
598
1066
  scanAggregate<Spec extends AggregateSpec>(iter: AsyncIterable<unknown>, spec: Spec): Promise<AggregateResult<Spec>>;
599
1067
  }
600
1068
 
601
- export { type AggregateStrategy as A, GROUPBY_MAX_CARDINALITY as G, type LiveAggregation as L, 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 };
1069
+ export { type AggregateStrategy as A, buildLiveAggregation as B, count as C, groupAndReduce as D, max as E, min as F, GROUPBY_MAX_CARDINALITY as G, reduceRecords as H, type I18nMap as I, resetGroupByWarnings as J, sum as K, type Layer as L, type RoundingMode as M, MoneyCurrencyError as N, type OnMissing as O, type MoneyDescriptor as P, type MoneyOptions as Q, type ResolveI18nOptions as R, type MoneyOptionsFixed as S, type MoneyOptionsMulti as T, MoneyPrecisionError as U, MoneyUnsupportedError as V, isMoneyDescriptor as W, money as X, type I18nTextDescriptor as a, type I18nTextOptions as b, type OnMissingPolicy as c, applyI18nLocale as d, isI18nTextDescriptor as e, resolvePolicy as f, getAtPath as g, stripI18nFilled as h, i18nText as i, type AggregateResult as j, type AggregateSpec as k, Aggregation as l, type AggregationUpstream as m, GROUPBY_WARN_CARDINALITY as n, GroupedAggregation as o, GroupedQuery as p, GroupedQueryN as q, resolveI18nText as r, setAtPathInPlace as s, type GroupedRow as t, type GroupedRowN as u, validateI18nTextValue as v, type LiveAggregation as w, type Reducer as x, type ReducerOptions as y, avg as z };
@@ -1,9 +1,11 @@
1
- import { aK as SyncStrategy } from '../types-D9eB0Rvh.js';
2
- import '../lazy-builder-Rpd-V3jP.js';
3
- import '../predicate-Dnu81tsS.js';
4
- import '../strategy-DSTrsZ8t.js';
1
+ import { aS as SyncStrategy } from '../index-DHn9lEP0.js';
2
+ import '../lazy-builder-ChSqcF5t.js';
3
+ import '../predicate-BmhBSPCH.js';
4
+ import '../strategy-8QGs5KQE.js';
5
+ import '../errors-BAWO5Z5a.js';
5
6
  import '../strategy-BSxFXGzb.js';
6
- import '../index-BF1B2HB9.js';
7
+ import '../index-BMmajblo.js';
8
+ import '../index-Ddm8D3Oo.js';
7
9
  import '@noy-db/attestation';
8
10
 
9
11
  /**
@@ -2,11 +2,12 @@ import {
2
2
  PresenceHandle,
3
3
  SyncEngine,
4
4
  SyncTransaction
5
- } from "../chunk-LS3JLEIB.js";
5
+ } from "../chunk-TZGWI5AX.js";
6
6
  import "../chunk-2QR2PQTT.js";
7
- import "../chunk-FXQYZNOW.js";
8
- import "../chunk-UOF74WQY.js";
9
- import "../chunk-YDLAFP36.js";
7
+ import "../chunk-A7DNZVAV.js";
8
+ import "../chunk-E2MDPPOC.js";
9
+ import "../chunk-JZ5DS4DP.js";
10
+ import "../chunk-PZ5AY32C.js";
10
11
 
11
12
  // src/team/sync-active.ts
12
13
  function withSync() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/team/sync-active.ts"],"sourcesContent":["/**\n * Active sync strategy — `withSync()` returns the real implementation\n * that wires the `SyncEngine`, `SyncTransaction`, and `PresenceHandle`\n * constructors into the Noydb / Vault / Collection hot paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withSync } from '@noy-db/hub/sync'\n *\n * const db = await createNoydb({\n * store: localStore,\n * sync: remoteStore,\n * user: ...,\n * syncStrategy: withSync(),\n * })\n * ```\n *\n * The factory delegates to the existing `sync.ts`,\n * `sync-transaction.ts`, and `presence.ts` modules. Splitting the\n * import chain through this file is what lets tsup tree-shake the\n * ~856 LOC of replication + presence machinery out of the default\n * bundle when no `withSync()` import is present.\n *\n * Keyring + grant/revoke/magic-link/delegation stay in the always-on\n * core (or tree-shake via direct named imports) — those are required\n * for any multi-user vault, even purely local ones.\n *\n * @public\n */\n\nimport type { SyncStrategy, BuildSyncEngineOptions } from './sync-strategy.js'\nimport type { PresenceHandleOpts } from './presence.js'\nimport type { Vault } from '../vault.js'\nimport { SyncEngine } from './sync.js'\nimport { SyncTransaction } from './sync-transaction.js'\nimport { PresenceHandle } from './presence.js'\n\nexport function withSync(): SyncStrategy {\n return {\n buildSyncEngine(opts: BuildSyncEngineOptions): SyncEngine {\n return new SyncEngine(opts)\n },\n buildSyncTransaction(vault: Vault, engine: SyncEngine): SyncTransaction {\n return new SyncTransaction(vault, engine)\n },\n buildPresence<P>(opts: PresenceHandleOpts): PresenceHandle<P> {\n return new PresenceHandle<P>(opts)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;AAuCO,SAAS,WAAyB;AACvC,SAAO;AAAA,IACL,gBAAgB,MAA0C;AACxD,aAAO,IAAI,WAAW,IAAI;AAAA,IAC5B;AAAA,IACA,qBAAqB,OAAc,QAAqC;AACtE,aAAO,IAAI,gBAAgB,OAAO,MAAM;AAAA,IAC1C;AAAA,IACA,cAAiB,MAA6C;AAC5D,aAAO,IAAI,eAAkB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/team/sync-active.ts"],"sourcesContent":["/**\n * Active sync strategy — `withSync()` returns the real implementation\n * that wires the `SyncEngine`, `SyncTransaction`, and `PresenceHandle`\n * constructors into the Noydb / Vault / Collection hot paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withSync } from '@noy-db/hub/sync'\n *\n * const db = await createNoydb({\n * store: localStore,\n * sync: remoteStore,\n * user: ...,\n * syncStrategy: withSync(),\n * })\n * ```\n *\n * The factory delegates to the existing `sync.ts`,\n * `sync-transaction.ts`, and `presence.ts` modules. Splitting the\n * import chain through this file is what lets tsup tree-shake the\n * ~856 LOC of replication + presence machinery out of the default\n * bundle when no `withSync()` import is present.\n *\n * Keyring + grant/revoke/magic-link/delegation stay in the always-on\n * core (or tree-shake via direct named imports) — those are required\n * for any multi-user vault, even purely local ones.\n *\n * @public\n */\n\nimport type { SyncStrategy, BuildSyncEngineOptions } from './sync-strategy.js'\nimport type { PresenceHandleOpts } from './presence.js'\nimport type { Vault } from '../vault.js'\nimport { SyncEngine } from './sync.js'\nimport { SyncTransaction } from './sync-transaction.js'\nimport { PresenceHandle } from './presence.js'\n\nexport function withSync(): SyncStrategy {\n return {\n buildSyncEngine(opts: BuildSyncEngineOptions): SyncEngine {\n return new SyncEngine(opts)\n },\n buildSyncTransaction(vault: Vault, engine: SyncEngine): SyncTransaction {\n return new SyncTransaction(vault, engine)\n },\n buildPresence<P>(opts: PresenceHandleOpts): PresenceHandle<P> {\n return new PresenceHandle<P>(opts)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;AAuCO,SAAS,WAAyB;AACvC,SAAO;AAAA,IACL,gBAAgB,MAA0C;AACxD,aAAO,IAAI,WAAW,IAAI;AAAA,IAC5B;AAAA,IACA,qBAAqB,OAAc,QAAqC;AACtE,aAAO,IAAI,gBAAgB,OAAO,MAAM;AAAA,IAC1C;AAAA,IACA,cAAiB,MAA6C;AAC5D,aAAO,IAAI,eAAkB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;","names":[]}
@@ -1,10 +1,12 @@
1
- import { aO as NoydbStore, aM as UnlockedKeyring } from '../types-D9eB0Rvh.js';
2
- export { bc as BundleRecipient, b$ as EnrollAuthenticatorOptions, c0 as EnrollAuthenticatorWrappingDEKsOptions, c1 as EnrollAuthenticatorWrappingKEKOptions, cw as ListUsersOptions, cV as PaperRecoveryEntry, d1 as PresenceHandle, dm as RecoverPassphraseInput, dn as RecoverPassphraseResult, dp as RecoverUserOptions, dq as RecoveryProof, dt as RotatePassphraseInput, dF as SlotRewrapCeremony, dG as SlotRewrapContext, dN as SyncEngine, dV as SyncTransaction, e6 as UpdateAuthenticatorOptions, el as WrappedDeksBlob, er as buildRecipientKeyringFile, es as burnPaperRecoveryEntry, fb as changeSecret, fc as createOwnerKeyring, ev as deriveMagicLinkContentKey, ew as enrollAuthenticator, fd as ensureCollectionDEK, ey as evaluateExportCapability, ez as evaluateImportCapability, eA as findAuthenticator, fe as grant, eB as hasExportCapability, eC as hasImportCapability, eE as isMagicLinkGrantExpired, eJ as listMagicLinkGrants, eK as listUsers, eL as listUsersWithEnvelopes, ff as loadKeyring, eN as loadPaperRecoveryEntries, eQ as magicLinkGrantRecordId, eR as mintPaperRecoveryEntry, eT as mintWrappedDeksBlob, fg as persistKeyring, eV as readMagicLinkGrantRecord, eH as recoverPassphrase, eW as recoverUser, eX as removeAuthenticator, fh as revoke, e_ as revokeMagicLinkGrant, eI as rotatePassphrase, e$ as savePaperRecoveryEntries, f2 as unwrapDeksFromBlob, f3 as unwrapDeksFromPaperEntry, f5 as unwrapMagicLinkGrant, fi as updateAuthenticator, fj as updateKeyringIdentity, fa as writeMagicLinkGrant } from '../types-D9eB0Rvh.js';
3
- import '../lazy-builder-Rpd-V3jP.js';
4
- import '../predicate-Dnu81tsS.js';
5
- import '../strategy-DSTrsZ8t.js';
1
+ import { aW as NoydbStore, aU as UnlockedKeyring } from '../index-DHn9lEP0.js';
2
+ export { be as BundleRecipient, cj as EnrollAuthenticatorOptions, ck as EnrollAuthenticatorWrappingDEKsOptions, cl as EnrollAuthenticatorWrappingKEKOptions, d1 as ListUsersOptions, ds as PaperRecoveryEntry, dA as PresenceHandle, dV as RecoverPassphraseInput, dW as RecoverPassphraseResult, dX as RecoverUserOptions, dY as RecoveryProof, e4 as RotatePassphraseInput, en as SlotRewrapCeremony, eo as SlotRewrapContext, ew as SyncEngine, eE as SyncTransaction, eU as UpdateAuthenticatorOptions, fe as WrappedDeksBlob, fm as buildRecipientKeyringFile, fn as burnPaperRecoveryEntry, gl as changeSecret, gm as createOwnerKeyring, fr as deriveMagicLinkContentKey, fs as enrollAuthenticator, gn as ensureCollectionDEK, fv as evaluateExportCapability, fw as evaluateImportCapability, fy as findAuthenticator, go as grant, fz as hasExportCapability, fA as hasImportCapability, fD as isMagicLinkGrantExpired, fJ as listMagicLinkGrants, fK as listUsers, fL as listUsersWithEnvelopes, gp as loadKeyring, fO as loadPaperRecoveryEntries, fR as magicLinkGrantRecordId, fS as mintPaperRecoveryEntry, fU as mintWrappedDeksBlob, gq as persistKeyring, fX as readMagicLinkGrantRecord, fG as recoverPassphrase, fY as recoverUser, f_ as removeAuthenticator, gr as revoke, g3 as revokeMagicLinkGrant, fH as rotatePassphrase, g5 as savePaperRecoveryEntries, g9 as unwrapDeksFromBlob, ga as unwrapDeksFromPaperEntry, gc as unwrapMagicLinkGrant, gs as updateAuthenticator, gt as updateKeyringIdentity, gk as writeMagicLinkGrant } from '../index-DHn9lEP0.js';
3
+ import '../lazy-builder-ChSqcF5t.js';
4
+ import '../predicate-BmhBSPCH.js';
5
+ import '../strategy-8QGs5KQE.js';
6
+ import '../errors-BAWO5Z5a.js';
6
7
  import '../strategy-BSxFXGzb.js';
7
- import '../index-BF1B2HB9.js';
8
+ import '../index-BMmajblo.js';
9
+ import '../index-Ddm8D3Oo.js';
8
10
  import '@noy-db/attestation';
9
11
 
10
12
  /**