@noy-db/hub 0.2.0-pre.2 → 0.2.0-pre.21

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 (368) hide show
  1. package/README.md +126 -0
  2. package/dist/aggregate/index.cjs +643 -37
  3. package/dist/aggregate/index.cjs.map +1 -1
  4. package/dist/aggregate/index.d.cts +3 -2
  5. package/dist/aggregate/index.d.ts +3 -2
  6. package/dist/aggregate/index.js +9 -8
  7. package/dist/aggregate/index.js.map +1 -1
  8. package/dist/attestation/index.cjs.map +1 -1
  9. package/dist/attestation/index.d.cts +7 -5
  10. package/dist/attestation/index.d.ts +7 -5
  11. package/dist/attestation/index.js +6 -6
  12. package/dist/blobs/index.cjs +509 -22
  13. package/dist/blobs/index.cjs.map +1 -1
  14. package/dist/blobs/index.d.cts +9 -7
  15. package/dist/blobs/index.d.ts +9 -7
  16. package/dist/blobs/index.js +11 -6
  17. package/dist/blobs/index.js.map +1 -1
  18. package/dist/bundle/index.cjs +7886 -841
  19. package/dist/bundle/index.cjs.map +1 -1
  20. package/dist/bundle/index.d.cts +20 -18
  21. package/dist/bundle/index.d.ts +20 -18
  22. package/dist/bundle/index.js +24 -13
  23. package/dist/bundle/index.js.map +1 -1
  24. package/dist/{chunk-PFSNOPBQ.js → chunk-2XA2ZML4.js} +31 -3
  25. package/dist/chunk-2XA2ZML4.js.map +1 -0
  26. package/dist/{chunk-2PAQNPE3.js → chunk-37VGJM3T.js} +37 -2
  27. package/dist/chunk-37VGJM3T.js.map +1 -0
  28. package/dist/{chunk-7BRE6EUA.js → chunk-3HNKR65T.js} +4 -4
  29. package/dist/chunk-3HNKR65T.js.map +1 -0
  30. package/dist/{chunk-Y2RKOPNC.js → chunk-5YTXYPES.js} +46 -10
  31. package/dist/chunk-5YTXYPES.js.map +1 -0
  32. package/dist/{chunk-OVZDFEOR.js → chunk-6QAZ5O6X.js} +2 -2
  33. package/dist/chunk-6QAZ5O6X.js.map +1 -0
  34. package/dist/{chunk-RTZVQAJ7.js → chunk-6QE4DUYC.js} +19 -4
  35. package/dist/chunk-6QE4DUYC.js.map +1 -0
  36. package/dist/{chunk-7Q5PLD5C.js → chunk-7MRT7EPB.js} +3 -3
  37. package/dist/{chunk-E535SAN4.js → chunk-7PH4OPBZ.js} +4258 -520
  38. package/dist/chunk-7PH4OPBZ.js.map +1 -0
  39. package/dist/{chunk-PEULZC6M.js → chunk-A3JMGXPG.js} +8 -1
  40. package/dist/chunk-A3JMGXPG.js.map +1 -0
  41. package/dist/{chunk-UMLVJTYV.js → chunk-ADB7GPM3.js} +7 -4
  42. package/dist/chunk-ADB7GPM3.js.map +1 -0
  43. package/dist/{chunk-G6FRSBKK.js → chunk-AI4USDRI.js} +4 -4
  44. package/dist/chunk-BZW5IL43.js +151 -0
  45. package/dist/chunk-BZW5IL43.js.map +1 -0
  46. package/dist/chunk-C2RJVZZL.js +123 -0
  47. package/dist/chunk-C2RJVZZL.js.map +1 -0
  48. package/dist/{chunk-UND4XIB6.js → chunk-C6W5KVDV.js} +52 -38
  49. package/dist/chunk-C6W5KVDV.js.map +1 -0
  50. package/dist/chunk-CQYEDODS.js +125 -0
  51. package/dist/chunk-CQYEDODS.js.map +1 -0
  52. package/dist/{chunk-NWZ3I6R6.js → chunk-EYK72OTL.js} +5 -5
  53. package/dist/{chunk-7BUTTVMR.js → chunk-F5GWNSE2.js} +2 -2
  54. package/dist/{chunk-AHPFONIL.js → chunk-F5ILTHMU.js} +5 -5
  55. package/dist/{chunk-Q6W2CMEJ.js → chunk-FRRJIUSI.js} +18 -5
  56. package/dist/chunk-FRRJIUSI.js.map +1 -0
  57. package/dist/{chunk-YMYK7US4.js → chunk-GJTKMME7.js} +2 -2
  58. package/dist/chunk-GJTKMME7.js.map +1 -0
  59. package/dist/{chunk-EUYOGYGV.js → chunk-HYJMAV53.js} +6 -6
  60. package/dist/chunk-HYJMAV53.js.map +1 -0
  61. package/dist/{chunk-QPEXPHJR.js → chunk-I3IYTUUI.js} +4 -4
  62. package/dist/{chunk-3QAKZ37R.js → chunk-IVZWHIEK.js} +5 -5
  63. package/dist/{chunk-PLI5TV7N.js → chunk-IW4L4X65.js} +2 -2
  64. package/dist/chunk-IW4L4X65.js.map +1 -0
  65. package/dist/{chunk-3Z2TPHC4.js → chunk-IY24WS2P.js} +69 -5
  66. package/dist/chunk-IY24WS2P.js.map +1 -0
  67. package/dist/{chunk-HXJXPZRE.js → chunk-J6RGRZOY.js} +10 -3
  68. package/dist/chunk-J6RGRZOY.js.map +1 -0
  69. package/dist/{chunk-3S4BJX25.js → chunk-JBBWALNI.js} +2 -2
  70. package/dist/chunk-JBBWALNI.js.map +1 -0
  71. package/dist/{chunk-7Z23ZFLV.js → chunk-JDCPRJVS.js} +5 -5
  72. package/dist/chunk-JDCPRJVS.js.map +1 -0
  73. package/dist/{chunk-243PNUA6.js → chunk-JOK73NDT.js} +3 -3
  74. package/dist/chunk-JTI57WRT.js +164 -0
  75. package/dist/chunk-JTI57WRT.js.map +1 -0
  76. package/dist/{chunk-VRBCTEKQ.js → chunk-JYNH4FIM.js} +233 -11
  77. package/dist/chunk-JYNH4FIM.js.map +1 -0
  78. package/dist/{chunk-TBKOGSYR.js → chunk-KOAJ3TZM.js} +27 -5
  79. package/dist/chunk-KOAJ3TZM.js.map +1 -0
  80. package/dist/{chunk-YTXSFG3C.js → chunk-MBXKRHSS.js} +50 -20
  81. package/dist/chunk-MBXKRHSS.js.map +1 -0
  82. package/dist/{chunk-MUWOSVEP.js → chunk-NSXNXLYM.js} +10 -2
  83. package/dist/chunk-NSXNXLYM.js.map +1 -0
  84. package/dist/{chunk-J4KLMEUL.js → chunk-NV4IHBZS.js} +664 -51
  85. package/dist/chunk-NV4IHBZS.js.map +1 -0
  86. package/dist/{chunk-LRAZDV5X.js → chunk-O5XKZCUD.js} +31 -8
  87. package/dist/chunk-O5XKZCUD.js.map +1 -0
  88. package/dist/{chunk-W3XXT26A.js → chunk-OTWT6BAJ.js} +358 -3
  89. package/dist/chunk-OTWT6BAJ.js.map +1 -0
  90. package/dist/{chunk-XG3PTSCD.js → chunk-PDVP3C2I.js} +1 -1
  91. package/dist/chunk-PDVP3C2I.js.map +1 -0
  92. package/dist/{chunk-GIV6DWBG.js → chunk-S45MDEEF.js} +44 -5
  93. package/dist/chunk-S45MDEEF.js.map +1 -0
  94. package/dist/{chunk-VK5EER6C.js → chunk-SQKAECUL.js} +2 -2
  95. package/dist/{chunk-FAQVNJD4.js → chunk-SQOK5UM6.js} +12 -2
  96. package/dist/{chunk-FAQVNJD4.js.map → chunk-SQOK5UM6.js.map} +1 -1
  97. package/dist/chunk-STNPB3UM.js +9 -0
  98. package/dist/chunk-STNPB3UM.js.map +1 -0
  99. package/dist/{chunk-YS3POABP.js → chunk-TA6HPKWQ.js} +1 -1
  100. package/dist/chunk-TA6HPKWQ.js.map +1 -0
  101. package/dist/{chunk-4HIL6AHQ.js → chunk-TAMRU7A2.js} +4 -4
  102. package/dist/{chunk-QXQRKXCU.js → chunk-TGIJTNM3.js} +2 -2
  103. package/dist/chunk-TNH5SLCD.js +361 -0
  104. package/dist/chunk-TNH5SLCD.js.map +1 -0
  105. package/dist/{chunk-VPSUZLOJ.js → chunk-TYMDCIQM.js} +31 -5
  106. package/dist/chunk-TYMDCIQM.js.map +1 -0
  107. package/dist/chunk-U2XSUCDF.js +524 -0
  108. package/dist/chunk-U2XSUCDF.js.map +1 -0
  109. package/dist/{chunk-3Y53S2SA.js → chunk-UU6M64HI.js} +4 -4
  110. package/dist/{chunk-VCGTOS2A.js → chunk-WE2BUQD2.js} +3 -3
  111. package/dist/chunk-WE2BUQD2.js.map +1 -0
  112. package/dist/{chunk-JYQTXEIO.js → chunk-WWVJXBOT.js} +449 -29
  113. package/dist/chunk-WWVJXBOT.js.map +1 -0
  114. package/dist/chunk-YPIOFSN3.js +129 -0
  115. package/dist/chunk-YPIOFSN3.js.map +1 -0
  116. package/dist/chunk-ZC7J6ZYV.js +7 -0
  117. package/dist/chunk-ZC7J6ZYV.js.map +1 -0
  118. package/dist/{chunk-5ZGZ6HIZ.js → chunk-ZONKSLF2.js} +30 -7
  119. package/dist/chunk-ZONKSLF2.js.map +1 -0
  120. package/dist/consent/index.cjs.map +1 -1
  121. package/dist/consent/index.d.cts +8 -6
  122. package/dist/consent/index.d.ts +8 -6
  123. package/dist/consent/index.js +3 -3
  124. package/dist/{crypto-5ZDIY3NG.js → crypto-456N7UVX.js} +7 -3
  125. package/dist/{delegation-QYXZW25W.js → delegation-DP4COTXB.js} +5 -5
  126. package/dist/derivations/index.cjs +124 -6
  127. package/dist/derivations/index.cjs.map +1 -1
  128. package/dist/derivations/index.d.cts +11 -9
  129. package/dist/derivations/index.d.ts +11 -9
  130. package/dist/derivations/index.js +8 -6
  131. package/dist/{dev-unlock-DQCNDfFp.d.cts → dev-unlock-CY0HIZA0.d.cts} +1 -1
  132. package/dist/{dev-unlock-utkybTKb.d.ts → dev-unlock-CpKSkl2c.d.ts} +1 -1
  133. package/dist/discriminant-BN9REW3o.d.cts +60 -0
  134. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  135. package/dist/errors-Dkc_fi-S.d.cts +1467 -0
  136. package/dist/errors-Dkc_fi-S.d.ts +1467 -0
  137. package/dist/executor-4IEW4KG5.js +8 -0
  138. package/dist/executor-KYJCJCIN.js +12 -0
  139. package/dist/executor-W7VIBOBZ.js +8 -0
  140. package/dist/{fanout-sidecar-VJ52RIEY.js → fanout-sidecar-YXNAEZ33.js} +2 -2
  141. package/dist/fanout-sidecar-YXNAEZ33.js.map +1 -0
  142. package/dist/forget/index.cjs +43 -0
  143. package/dist/forget/index.cjs.map +1 -0
  144. package/dist/forget/index.d.cts +1 -0
  145. package/dist/forget/index.d.ts +1 -0
  146. package/dist/forget/index.js +14 -0
  147. package/dist/guards/index.cjs +144 -4
  148. package/dist/guards/index.cjs.map +1 -1
  149. package/dist/guards/index.d.cts +16 -8
  150. package/dist/guards/index.d.ts +16 -8
  151. package/dist/guards/index.js +13 -7
  152. package/dist/{hash-jDowCrK2.d.cts → hash-BSd0-_L8.d.cts} +1 -1
  153. package/dist/{hash-DcoYWfJ_.d.ts → hash-BnBQx39y.d.ts} +1 -1
  154. package/dist/history/index.cjs +28 -5
  155. package/dist/history/index.cjs.map +1 -1
  156. package/dist/history/index.d.cts +9 -7
  157. package/dist/history/index.d.ts +9 -7
  158. package/dist/history/index.js +9 -7
  159. package/dist/history/index.js.map +1 -1
  160. package/dist/i18n/index.cjs +356 -26
  161. package/dist/i18n/index.cjs.map +1 -1
  162. package/dist/i18n/index.d.cts +8 -6
  163. package/dist/i18n/index.d.ts +8 -6
  164. package/dist/i18n/index.js +36 -15
  165. package/dist/i18n/index.js.map +1 -1
  166. package/dist/index-BMmajblo.d.cts +362 -0
  167. package/dist/index-BMmajblo.d.ts +362 -0
  168. package/dist/{index-BCKdioeh.d.ts → index-Bm9hIY7t.d.ts} +169 -1127
  169. package/dist/{index-BMjrzNZr.d.cts → index-tZqVB9g5.d.cts} +169 -1127
  170. package/dist/index.cjs +10286 -2168
  171. package/dist/index.cjs.map +1 -1
  172. package/dist/index.d.cts +258 -23
  173. package/dist/index.d.ts +258 -23
  174. package/dist/index.js +443 -110
  175. package/dist/index.js.map +1 -1
  176. package/dist/indexing/index.cjs +97 -32
  177. package/dist/indexing/index.cjs.map +1 -1
  178. package/dist/indexing/index.d.cts +3 -3
  179. package/dist/indexing/index.d.ts +3 -3
  180. package/dist/indexing/index.js +4 -4
  181. package/dist/issue-JXC6T2QR.js +12 -0
  182. package/dist/{lazy-builder-Rpd-V3jP.d.ts → lazy-builder-ChSqcF5t.d.ts} +2 -2
  183. package/dist/{lazy-builder-C-rPfWG0.d.cts → lazy-builder-eYZzLEL1.d.cts} +2 -2
  184. package/dist/{ledger-3IU5GMXA.js → ledger-I7JUYP4L.js} +6 -6
  185. package/dist/materialized-views/index.cjs +687 -13
  186. package/dist/materialized-views/index.cjs.map +1 -1
  187. package/dist/materialized-views/index.d.cts +23 -20
  188. package/dist/materialized-views/index.d.ts +23 -20
  189. package/dist/materialized-views/index.js +8 -7
  190. package/dist/mime-magic-BnJCGJzB.d.cts +103 -0
  191. package/dist/mime-magic-CjSyakO4.d.ts +103 -0
  192. package/dist/noydb-ZZCRF6TE.js +38 -0
  193. package/dist/overlay-views/index.cjs +58 -18
  194. package/dist/overlay-views/index.cjs.map +1 -1
  195. package/dist/overlay-views/index.d.cts +32 -12
  196. package/dist/overlay-views/index.d.ts +32 -12
  197. package/dist/overlay-views/index.js +6 -6
  198. package/dist/periods/index.cjs.map +1 -1
  199. package/dist/periods/index.d.cts +8 -6
  200. package/dist/periods/index.d.ts +8 -6
  201. package/dist/periods/index.js +6 -6
  202. package/dist/{predicate-Dnu81tsS.d.cts → predicate-BmhBSPCH.d.cts} +87 -5
  203. package/dist/{predicate-Dnu81tsS.d.ts → predicate-BmhBSPCH.d.ts} +87 -5
  204. package/dist/{public-envelope-U3CMEOMV.js → public-envelope-5XRTUNKF.js} +4 -4
  205. package/dist/query/index.cjs +1438 -130
  206. package/dist/query/index.cjs.map +1 -1
  207. package/dist/query/index.d.cts +4 -3
  208. package/dist/query/index.d.ts +4 -3
  209. package/dist/query/index.js +13 -6
  210. package/dist/read-only-facade-EX6WZZBP.js +7 -0
  211. package/dist/registry-ATRHOG5B.js +8 -0
  212. package/dist/registry-DKEXOJVO.js +7 -0
  213. package/dist/registry-LEHB26TY.js +8 -0
  214. package/dist/{registry-3ALP62P6.js → registry-NWHOLD5M.js} +3 -3
  215. package/dist/{revoke-KY2GB4KP.js → revoke-5IEK22KT.js} +6 -6
  216. package/dist/sealed-record/index.cjs +139 -0
  217. package/dist/sealed-record/index.cjs.map +1 -0
  218. package/dist/sealed-record/index.d.cts +123 -0
  219. package/dist/sealed-record/index.d.ts +123 -0
  220. package/dist/sealed-record/index.js +42 -0
  221. package/dist/sealed-record/index.js.map +1 -0
  222. package/dist/session/index.cjs.map +1 -1
  223. package/dist/session/index.d.cts +9 -7
  224. package/dist/session/index.d.ts +9 -7
  225. package/dist/session/index.js +3 -3
  226. package/dist/shadow/index.cjs.map +1 -1
  227. package/dist/shadow/index.d.cts +8 -6
  228. package/dist/shadow/index.d.ts +8 -6
  229. package/dist/shadow/index.js +2 -2
  230. package/dist/{signer-GRI5TZKH.js → signer-I6YARZQA.js} +5 -5
  231. package/dist/snapshots/index.cjs +937 -0
  232. package/dist/snapshots/index.cjs.map +1 -0
  233. package/dist/snapshots/index.d.cts +30 -0
  234. package/dist/snapshots/index.d.ts +30 -0
  235. package/dist/snapshots/index.js +152 -0
  236. package/dist/snapshots/index.js.map +1 -0
  237. package/dist/{stale-OTOF3FH7.js → stale-CPESGAPL.js} +2 -2
  238. package/dist/stale-CPESGAPL.js.map +1 -0
  239. package/dist/state-vault-JR3CFGNP.js +14 -0
  240. package/dist/state-vault-JR3CFGNP.js.map +1 -0
  241. package/dist/store/index.cjs +8 -0
  242. package/dist/store/index.cjs.map +1 -1
  243. package/dist/store/index.d.cts +15 -6
  244. package/dist/store/index.d.ts +15 -6
  245. package/dist/store/index.js +2 -2
  246. package/dist/{strategy-DSTrsZ8t.d.ts → strategy-54eIwox5.d.ts} +456 -7
  247. package/dist/{strategy-DSTrsZ8t.d.cts → strategy-WtB-jXYv.d.cts} +456 -7
  248. package/dist/sync/index.cjs.map +1 -1
  249. package/dist/sync/index.d.cts +7 -5
  250. package/dist/sync/index.d.ts +7 -5
  251. package/dist/sync/index.js +4 -4
  252. package/dist/team/index.cjs +1 -1
  253. package/dist/team/index.cjs.map +1 -1
  254. package/dist/team/index.d.cts +8 -6
  255. package/dist/team/index.d.ts +8 -6
  256. package/dist/team/index.js +8 -8
  257. package/dist/transition-guard-D4bfIAiW.d.ts +165 -0
  258. package/dist/transition-guard-Dmpqzg-_.d.cts +165 -0
  259. package/dist/tx/index.cjs +155 -5
  260. package/dist/tx/index.cjs.map +1 -1
  261. package/dist/tx/index.d.cts +27 -9
  262. package/dist/tx/index.d.ts +27 -9
  263. package/dist/tx/index.js +61 -4
  264. package/dist/tx/index.js.map +1 -1
  265. package/dist/{types-BoFFiskX.d.ts → types-DLfWFr6U.d.ts} +3997 -1262
  266. package/dist/{types-DJG8HG6F.d.cts → types-DyOI6XZ_.d.cts} +3997 -1262
  267. package/dist/{ulid-BmBgooGm.d.ts → ulid-B2L_aqVA.d.ts} +19 -19
  268. package/dist/{ulid-C7ms9oli.d.cts → ulid-LaxfH2tK.d.cts} +19 -19
  269. package/dist/util/index.cjs +7 -0
  270. package/dist/util/index.cjs.map +1 -1
  271. package/dist/util/index.d.cts +2 -0
  272. package/dist/util/index.d.ts +2 -0
  273. package/dist/util/index.js +5 -1
  274. package/dist/util/index.js.map +1 -1
  275. package/dist/vault-group-BB246VIM.js +804 -0
  276. package/dist/vault-group-BB246VIM.js.map +1 -0
  277. package/dist/{with-materialized-view-CqnRwI2S.d.ts → with-materialized-view-CeZYGJVf.d.cts} +2 -2
  278. package/dist/{with-materialized-view-BbEPFIIJ.d.cts → with-materialized-view-DNULSxoP.d.ts} +2 -2
  279. package/dist/{with-overlayed-view-Ct1fSJt-.d.ts → with-overlayed-view-C9joG7UZ.d.ts} +2 -2
  280. package/dist/{with-overlayed-view-bwlmmFjx.d.cts → with-overlayed-view-kdcPGHih.d.cts} +2 -2
  281. package/dist/with-rollup-DJDbrxjf.d.ts +47 -0
  282. package/dist/with-rollup-s58XAeWO.d.cts +47 -0
  283. package/package.json +35 -4
  284. package/dist/chunk-2PAQNPE3.js.map +0 -1
  285. package/dist/chunk-3S4BJX25.js.map +0 -1
  286. package/dist/chunk-3XHOCQK4.js +0 -118
  287. package/dist/chunk-3XHOCQK4.js.map +0 -1
  288. package/dist/chunk-3Z2TPHC4.js.map +0 -1
  289. package/dist/chunk-5ZGZ6HIZ.js.map +0 -1
  290. package/dist/chunk-7BRE6EUA.js.map +0 -1
  291. package/dist/chunk-7Z23ZFLV.js.map +0 -1
  292. package/dist/chunk-CXSCDO5T.js +0 -51
  293. package/dist/chunk-CXSCDO5T.js.map +0 -1
  294. package/dist/chunk-E535SAN4.js.map +0 -1
  295. package/dist/chunk-EUYOGYGV.js.map +0 -1
  296. package/dist/chunk-GIV6DWBG.js.map +0 -1
  297. package/dist/chunk-HXJXPZRE.js.map +0 -1
  298. package/dist/chunk-J4KLMEUL.js.map +0 -1
  299. package/dist/chunk-JYQTXEIO.js.map +0 -1
  300. package/dist/chunk-LRAZDV5X.js.map +0 -1
  301. package/dist/chunk-MRIBLZL3.js +0 -86
  302. package/dist/chunk-MRIBLZL3.js.map +0 -1
  303. package/dist/chunk-MUWOSVEP.js.map +0 -1
  304. package/dist/chunk-OVZDFEOR.js.map +0 -1
  305. package/dist/chunk-PEULZC6M.js.map +0 -1
  306. package/dist/chunk-PFSNOPBQ.js.map +0 -1
  307. package/dist/chunk-PLI5TV7N.js.map +0 -1
  308. package/dist/chunk-Q6W2CMEJ.js.map +0 -1
  309. package/dist/chunk-RTZVQAJ7.js.map +0 -1
  310. package/dist/chunk-TBKOGSYR.js.map +0 -1
  311. package/dist/chunk-UMLVJTYV.js.map +0 -1
  312. package/dist/chunk-UND4XIB6.js.map +0 -1
  313. package/dist/chunk-VCGTOS2A.js.map +0 -1
  314. package/dist/chunk-VE6YVP32.js +0 -19
  315. package/dist/chunk-VE6YVP32.js.map +0 -1
  316. package/dist/chunk-VPSUZLOJ.js.map +0 -1
  317. package/dist/chunk-VRBCTEKQ.js.map +0 -1
  318. package/dist/chunk-W3XXT26A.js.map +0 -1
  319. package/dist/chunk-XG3PTSCD.js.map +0 -1
  320. package/dist/chunk-Y2RKOPNC.js.map +0 -1
  321. package/dist/chunk-YMYK7US4.js.map +0 -1
  322. package/dist/chunk-YS3POABP.js.map +0 -1
  323. package/dist/chunk-YTXSFG3C.js.map +0 -1
  324. package/dist/executor-AS2IDHKZ.js +0 -11
  325. package/dist/executor-HLXFXNFM.js +0 -8
  326. package/dist/executor-HN6YBHZ5.js +0 -8
  327. package/dist/fanout-sidecar-VJ52RIEY.js.map +0 -1
  328. package/dist/issue-ORP37MVW.js +0 -12
  329. package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
  330. package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
  331. package/dist/noydb-5H3C24GG.js +0 -34
  332. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  333. package/dist/registry-7HE6VJGC.js +0 -8
  334. package/dist/registry-PSIPG2QR.js +0 -8
  335. package/dist/registry-RFGGMVNJ.js +0 -7
  336. package/dist/with-derivation-BKXXa8Vt.d.ts +0 -13
  337. package/dist/with-derivation-BjQ7q4NE.d.cts +0 -13
  338. package/dist/with-guard-C25yNjzd.d.ts +0 -18
  339. package/dist/with-guard-DQme5DKE.d.cts +0 -18
  340. /package/dist/{chunk-7Q5PLD5C.js.map → chunk-7MRT7EPB.js.map} +0 -0
  341. /package/dist/{chunk-G6FRSBKK.js.map → chunk-AI4USDRI.js.map} +0 -0
  342. /package/dist/{chunk-NWZ3I6R6.js.map → chunk-EYK72OTL.js.map} +0 -0
  343. /package/dist/{chunk-7BUTTVMR.js.map → chunk-F5GWNSE2.js.map} +0 -0
  344. /package/dist/{chunk-AHPFONIL.js.map → chunk-F5ILTHMU.js.map} +0 -0
  345. /package/dist/{chunk-QPEXPHJR.js.map → chunk-I3IYTUUI.js.map} +0 -0
  346. /package/dist/{chunk-3QAKZ37R.js.map → chunk-IVZWHIEK.js.map} +0 -0
  347. /package/dist/{chunk-243PNUA6.js.map → chunk-JOK73NDT.js.map} +0 -0
  348. /package/dist/{chunk-VK5EER6C.js.map → chunk-SQKAECUL.js.map} +0 -0
  349. /package/dist/{chunk-4HIL6AHQ.js.map → chunk-TAMRU7A2.js.map} +0 -0
  350. /package/dist/{chunk-QXQRKXCU.js.map → chunk-TGIJTNM3.js.map} +0 -0
  351. /package/dist/{chunk-3Y53S2SA.js.map → chunk-UU6M64HI.js.map} +0 -0
  352. /package/dist/{crypto-5ZDIY3NG.js.map → crypto-456N7UVX.js.map} +0 -0
  353. /package/dist/{delegation-QYXZW25W.js.map → delegation-DP4COTXB.js.map} +0 -0
  354. /package/dist/{executor-AS2IDHKZ.js.map → executor-4IEW4KG5.js.map} +0 -0
  355. /package/dist/{executor-HLXFXNFM.js.map → executor-KYJCJCIN.js.map} +0 -0
  356. /package/dist/{executor-HN6YBHZ5.js.map → executor-W7VIBOBZ.js.map} +0 -0
  357. /package/dist/{issue-ORP37MVW.js.map → forget/index.js.map} +0 -0
  358. /package/dist/{ledger-3IU5GMXA.js.map → issue-JXC6T2QR.js.map} +0 -0
  359. /package/dist/{noydb-5H3C24GG.js.map → ledger-I7JUYP4L.js.map} +0 -0
  360. /package/dist/{public-envelope-U3CMEOMV.js.map → noydb-ZZCRF6TE.js.map} +0 -0
  361. /package/dist/{read-only-facade-ITU6L7BL.js.map → public-envelope-5XRTUNKF.js.map} +0 -0
  362. /package/dist/{registry-3ALP62P6.js.map → read-only-facade-EX6WZZBP.js.map} +0 -0
  363. /package/dist/{registry-7HE6VJGC.js.map → registry-ATRHOG5B.js.map} +0 -0
  364. /package/dist/{registry-PSIPG2QR.js.map → registry-DKEXOJVO.js.map} +0 -0
  365. /package/dist/{registry-RFGGMVNJ.js.map → registry-LEHB26TY.js.map} +0 -0
  366. /package/dist/{revoke-KY2GB4KP.js.map → registry-NWHOLD5M.js.map} +0 -0
  367. /package/dist/{signer-GRI5TZKH.js.map → revoke-5IEK22KT.js.map} +0 -0
  368. /package/dist/{stale-OTOF3FH7.js.map → signer-I6YARZQA.js.map} +0 -0
@@ -1,10 +1,12 @@
1
- import { aO as NoydbStore, cG as NoydbBundleStore } from '../types-DJG8HG6F.cjs';
2
- export { by as BUNDLE_STORE_POLICY, cb as INDEXED_STORE_POLICY, cZ as PullMode, c$ as PullPolicy, d1 as PushMode, d3 as PushPolicy, dE as SyncPolicy, dF as SyncScheduler, dG as SyncSchedulerStatus } from '../types-DJG8HG6F.cjs';
3
- export { au as StoreCapabilityError } from '../index-BMjrzNZr.cjs';
4
- import '../lazy-builder-C-rPfWG0.cjs';
5
- import '../predicate-Dnu81tsS.cjs';
6
- import '../strategy-DSTrsZ8t.cjs';
1
+ import { aW as NoydbStore, aw as NoydbBundleStore } from '../types-DyOI6XZ_.cjs';
2
+ export { bK as BUNDLE_STORE_POLICY, cJ as INDEXED_STORE_POLICY, dF as PullMode, dH as PullPolicy, dJ as PushMode, dL as PushPolicy, eA as SyncPolicy, eB as SyncScheduler, eC as SyncSchedulerStatus } from '../types-DyOI6XZ_.cjs';
3
+ export { aA as StoreCapabilityError } from '../errors-Dkc_fi-S.cjs';
4
+ import '../lazy-builder-eYZzLEL1.cjs';
5
+ import '../predicate-BmhBSPCH.cjs';
6
+ import '../strategy-WtB-jXYv.cjs';
7
7
  import '../strategy-BSxFXGzb.cjs';
8
+ import '../index-BMmajblo.cjs';
9
+ import '../index-tZqVB9g5.cjs';
8
10
  import '@noy-db/attestation';
9
11
 
10
12
  interface WrapBundleStoreOptions {
@@ -278,6 +280,13 @@ interface RoutedNoydbStore extends NoydbStore {
278
280
  resume(route: OverrideTarget): Promise<number>;
279
281
  /** Snapshot the current override/suspend state for diagnostics. */
280
282
  routeStatus(): RouteStatus;
283
+ /**
284
+ * Resolve the physical backend a vault id maps to via the geographic
285
+ * `vaultRoutes` prefix routing (collection-independent), falling back to
286
+ * the `default` store. Used by the federation data-residency guard (#271)
287
+ * to read the placement backend's `capabilities.region`.
288
+ */
289
+ resolveBackend(vaultId: string): NoydbStore;
281
290
  }
282
291
  /**
283
292
  * Create a store multiplexer that dispatches operations to different backends
@@ -1,10 +1,12 @@
1
- import { aO as NoydbStore, cG as NoydbBundleStore } from '../types-BoFFiskX.js';
2
- export { by as BUNDLE_STORE_POLICY, cb as INDEXED_STORE_POLICY, cZ as PullMode, c$ as PullPolicy, d1 as PushMode, d3 as PushPolicy, dE as SyncPolicy, dF as SyncScheduler, dG as SyncSchedulerStatus } from '../types-BoFFiskX.js';
3
- export { au as StoreCapabilityError } from '../index-BCKdioeh.js';
4
- import '../lazy-builder-Rpd-V3jP.js';
5
- import '../predicate-Dnu81tsS.js';
6
- import '../strategy-DSTrsZ8t.js';
1
+ import { aW as NoydbStore, aw as NoydbBundleStore } from '../types-DLfWFr6U.js';
2
+ export { bK as BUNDLE_STORE_POLICY, cJ as INDEXED_STORE_POLICY, dF as PullMode, dH as PullPolicy, dJ as PushMode, dL as PushPolicy, eA as SyncPolicy, eB as SyncScheduler, eC as SyncSchedulerStatus } from '../types-DLfWFr6U.js';
3
+ export { aA as StoreCapabilityError } from '../errors-Dkc_fi-S.js';
4
+ import '../lazy-builder-ChSqcF5t.js';
5
+ import '../predicate-BmhBSPCH.js';
6
+ import '../strategy-54eIwox5.js';
7
7
  import '../strategy-BSxFXGzb.js';
8
+ import '../index-BMmajblo.js';
9
+ import '../index-Bm9hIY7t.js';
8
10
  import '@noy-db/attestation';
9
11
 
10
12
  interface WrapBundleStoreOptions {
@@ -278,6 +280,13 @@ interface RoutedNoydbStore extends NoydbStore {
278
280
  resume(route: OverrideTarget): Promise<number>;
279
281
  /** Snapshot the current override/suspend state for diagnostics. */
280
282
  routeStatus(): RouteStatus;
283
+ /**
284
+ * Resolve the physical backend a vault id maps to via the geographic
285
+ * `vaultRoutes` prefix routing (collection-independent), falling back to
286
+ * the `default` store. Used by the federation data-residency guard (#271)
287
+ * to read the placement backend's `capabilities.region`.
288
+ */
289
+ resolveBackend(vaultId: string): NoydbStore;
281
290
  }
282
291
  /**
283
292
  * Create a store multiplexer that dispatches operations to different backends
@@ -9,7 +9,7 @@ import {
9
9
  withRetry,
10
10
  wrapBundleStore,
11
11
  wrapStore
12
- } from "../chunk-MUWOSVEP.js";
12
+ } from "../chunk-NSXNXLYM.js";
13
13
  import {
14
14
  BUNDLE_STORE_POLICY,
15
15
  INDEXED_STORE_POLICY,
@@ -17,7 +17,7 @@ import {
17
17
  } from "../chunk-2QR2PQTT.js";
18
18
  import {
19
19
  StoreCapabilityError
20
- } from "../chunk-W3XXT26A.js";
20
+ } from "../chunk-OTWT6BAJ.js";
21
21
  export {
22
22
  BUNDLE_STORE_POLICY,
23
23
  INDEXED_STORE_POLICY,
@@ -1,3 +1,5 @@
1
+ import { N as NoydbError } from './errors-Dkc_fi-S.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,391 @@ 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
+ /**
628
+ * Descriptor returned by `i18nText()`. Attach to the collection's
629
+ * `i18nFields` option:
630
+ *
631
+ * ```ts
632
+ * const lineItems = company.collection<LineItem>('line-items', {
633
+ * i18nFields: {
634
+ * description: i18nText({ languages: ['en', 'th'], required: 'all' }),
635
+ * },
636
+ * })
637
+ * ```
638
+ */
639
+ interface I18nTextDescriptor {
640
+ readonly _noydbI18nText: true;
641
+ readonly options: I18nTextOptions;
642
+ }
643
+ /**
644
+ * Create an `I18nTextDescriptor` for a multi-language content field.
645
+ *
646
+ * @param options Language list + enforcement mode.
647
+ *
648
+ * @example
649
+ * ```ts
650
+ * i18nText({ languages: ['en', 'th'], required: 'all' })
651
+ * i18nText({ languages: ['en', 'th'], required: ['th'], autoTranslate: true })
652
+ * ```
653
+ */
654
+ declare function i18nText(options: I18nTextOptions): I18nTextDescriptor;
655
+ /** Runtime predicate for detecting an `I18nTextDescriptor`. */
656
+ declare function isI18nTextDescriptor(x: unknown): x is I18nTextDescriptor;
657
+ /**
658
+ * Validate that a value is a valid `{ [locale]: string }` map and that
659
+ * all required locales are present. Throws `MissingTranslationError`
660
+ * when the required constraint is violated.
661
+ *
662
+ * Called by `Collection.put()` for each registered `i18nField`.
663
+ *
664
+ * @param value The raw field value from the record being put.
665
+ * @param field The field name (used in the thrown error message).
666
+ * @param descriptor The `i18nText()` descriptor for this field.
667
+ */
668
+ declare function validateI18nTextValue(value: unknown, field: string, descriptor: I18nTextDescriptor): void;
669
+ /**
670
+ * Resolve an i18nText value (`{ [locale]: string }` map) to a string
671
+ * for the given locale.
672
+ *
673
+ * @param value The stored locale map.
674
+ * @param locale The requested locale code, or `'raw'` to return the map.
675
+ * @param fallback Single locale or ordered list; use `'any'` as the last
676
+ * element to fall back to any available translation.
677
+ * @param field Field name used in `LocaleNotSpecifiedError` messages.
678
+ * @returns The resolved string, OR the original map when `locale === 'raw'`.
679
+ */
680
+ /** Options for the policy-aware form of {@link resolveI18nText}. */
681
+ interface ResolveI18nOptions {
682
+ /** Effective policy for the resolution layer. Default `'throw'`. */
683
+ readonly policy?: OnMissing;
684
+ /** Declared substitute chain; applied only under policy `'substitute'`. */
685
+ readonly substitute?: readonly string[];
686
+ /**
687
+ * #285 smart-substitute. When `true` and policy is `'substitute'`, after the
688
+ * explicit chain misses, pick the available locale whose script is nearest the
689
+ * target (same script first, then Latin's broad readability) instead of an
690
+ * arbitrary value. Default `false`.
691
+ */
692
+ readonly smartSubstitute?: boolean;
693
+ }
694
+ declare function resolveI18nText(value: Record<string, string>, locale: string, fallback?: string | readonly string[], field?: string): string | Record<string, string>;
695
+ declare function resolveI18nText(value: Record<string, string>, locale: string, fallback: string | readonly string[] | undefined, field: string | undefined, opts: ResolveI18nOptions): string | Record<string, string> | null;
696
+ /**
697
+ * Return all leaf values at `path`, expanding `[].` array wildcards.
698
+ *
699
+ * - `'name'` → `[obj.name]`
700
+ * - `'address.lineOne'` → `[obj.address.lineOne]`
701
+ * - `'contacts[].title'` → `[obj.contacts[0].title, obj.contacts[1].title, …]`
702
+ *
703
+ * Returns an empty array when the path does not resolve (missing key,
704
+ * wrong type, etc.). Used by `enforceI18nOnPut` to validate nested fields.
705
+ */
706
+ declare function getAtPath(obj: Record<string, unknown>, path: string): unknown[];
707
+ /**
708
+ * Mutate `obj` in-place, setting `value` at the nested `path`.
709
+ * Supports dot notation (`'address.lineOne'`) but not array wildcards —
710
+ * auto-translate on `contacts[].title` style paths is not supported.
711
+ */
712
+ declare function setAtPathInPlace(obj: Record<string, unknown>, path: string, value: unknown): void;
713
+ /**
714
+ * Apply locale resolution to a single record, returning a new copy.
715
+ *
716
+ * For each field registered as an `i18nText` descriptor:
717
+ * - If `locale === 'raw'`, the field value is left as the stored map.
718
+ * - Otherwise, the field value is replaced with the resolved string.
719
+ *
720
+ * Field paths support dot notation (`'address.lineOne'`) and array
721
+ * wildcards (`'contacts[].title'`). Top-level fields work as before.
722
+ *
723
+ * @param record The decrypted record.
724
+ * @param i18nFields Map of field path → `I18nTextDescriptor`.
725
+ * @param locale The requested locale (or `'raw'`).
726
+ * @param fallback Fallback chain (optional).
727
+ * @param layer Resolution layer (default `'read'`). Each field's
728
+ * `onMissing` policy is resolved for this layer, so the
729
+ * same record resolves leniently on a get but strictly
730
+ * inside an mv/derivation.
731
+ */
732
+ declare function applyI18nLocale(record: Record<string, unknown>, i18nFields: Record<string, I18nTextDescriptor>, locale: string, fallback?: string | readonly string[], layer?: Layer): Record<string, unknown>;
733
+
311
734
  /**
312
735
  * Query DSL `.groupBy()` —.
313
736
  *
@@ -430,6 +853,12 @@ declare abstract class GroupedQueryBase {
430
853
  * for composite keys.
431
854
  */
432
855
  protected readonly dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined;
856
+ /**
857
+ * Money field descriptors for the backing collection — used to
858
+ * rewrite `sum`/`min`/`max` over money fields into exact BigInt
859
+ * reducers when `.aggregate(spec)` is terminated.
860
+ */
861
+ protected readonly moneyFields?: Record<string, MoneyDescriptor> | undefined;
433
862
  /**
434
863
  * Field set this grouped query buckets on. Stored in declaration
435
864
  * order — the same order is preserved on every result row by
@@ -444,7 +873,15 @@ declare abstract class GroupedQueryBase {
444
873
  * `undefined` — `<field>Label` projection has no meaningful shape
445
874
  * for composite keys.
446
875
  */
447
- dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined);
876
+ dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined,
877
+ /**
878
+ * Money field descriptors for the backing collection — used to
879
+ * rewrite `sum`/`min`/`max` over money fields into exact BigInt
880
+ * reducers when `.aggregate(spec)` is terminated.
881
+ */
882
+ moneyFields?: Record<string, MoneyDescriptor> | undefined);
883
+ /** Apply money-aware reducer rewriting when money fields are declared. */
884
+ protected wrapSpec<Spec extends AggregateSpec>(spec: Spec): Spec;
448
885
  }
449
886
  /**
450
887
  * Chainable wrapper returned by `Query.groupBy(field)`. Terminates
@@ -484,7 +921,7 @@ declare class GroupedQueryN<T, F extends readonly string[]> extends GroupedQuery
484
921
  * bucket would be created — the consumer doesn't have to wait for
485
922
  * the full partition to materialize before the error fires.
486
923
  */
487
- declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFields: string | readonly string[], spec: AggregateSpec): R[];
924
+ declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFields: string | readonly string[], spec: AggregateSpec, moneyFields?: Record<string, MoneyDescriptor>): R[];
488
925
  /**
489
926
  * Grouped aggregation wrapper — the `.groupBy(field).aggregate(spec)`
490
927
  * terminal. Shape mirrors `Aggregation<R>` from aggregate.ts: two
@@ -511,8 +948,20 @@ declare class GroupedAggregation<R> {
511
948
  *. Present when the grouping field is a dictKey.
512
949
  */
513
950
  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[];
951
+ /**
952
+ * Execute the query, group, reduce, and return an array of rows.
953
+ *
954
+ * `opts` (#285 query-form MV grouping): when a `locale` + `i18nFields` are
955
+ * given, the declared group-key `i18nText` fields are resolved to that locale
956
+ * at the `mv` layer BEFORE bucketing — so an i18n group key is a stable string
957
+ * instead of a raw `{locale}` map. The MV executor passes the MV's
958
+ * `i18nLocale`/`i18nFields`; ordinary `.run()` callers pass nothing and are
959
+ * unaffected.
960
+ */
961
+ run(opts?: {
962
+ locale?: string;
963
+ i18nFields?: Record<string, I18nTextDescriptor>;
964
+ }): R[];
516
965
  /**
517
966
  * Execute the query, group, reduce, and resolve `<field>Label` for
518
967
  * each result row when the grouping field is a `dictKey` and a
@@ -582,14 +1031,14 @@ interface AggregateStrategy {
582
1031
  * Build a `GroupedQuery<T, F>` for `Query.groupBy(field)`. Same
583
1032
  * closure / upstream inputs as `aggregate` plus the group key field.
584
1033
  */
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>;
1034
+ 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
1035
  /**
587
1036
  * Variadic-keyed sibling — builds a `GroupedQueryN<T, F>` for
588
1037
  * `Query.groupBy(...fields)`. No dictLabelResolver — `<field>Label`
589
1038
  * projection only applies to single-field groupings, which dispatch
590
1039
  * through `groupBy` above.
591
1040
  */
592
- groupByN<T, F extends readonly string[]>(executeRecords: () => readonly unknown[], fields: F, upstreams: readonly AggregationUpstream[]): GroupedQueryN<T, F>;
1041
+ groupByN<T, F extends readonly string[]>(executeRecords: () => readonly unknown[], fields: F, upstreams: readonly AggregationUpstream[], moneyFields?: Record<string, MoneyDescriptor>): GroupedQueryN<T, F>;
593
1042
  /**
594
1043
  * Terminal streaming aggregator for `ScanBuilder.aggregate(spec)`.
595
1044
  * Takes an async iterable of decrypted records + the spec and
@@ -598,4 +1047,4 @@ interface AggregateStrategy {
598
1047
  scanAggregate<Spec extends AggregateSpec>(iter: AsyncIterable<unknown>, spec: Spec): Promise<AggregateResult<Spec>>;
599
1048
  }
600
1049
 
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 };
1050
+ export { type AggregateStrategy as A, count as B, groupAndReduce as C, max as D, min as E, reduceRecords as F, GROUPBY_MAX_CARDINALITY as G, resetGroupByWarnings as H, type I18nMap as I, sum as J, type RoundingMode as K, type Layer as L, MoneyCurrencyError as M, type MoneyDescriptor as N, type OnMissing as O, type MoneyOptions as P, type MoneyOptionsFixed as Q, type ResolveI18nOptions as R, type MoneyOptionsMulti as S, MoneyPrecisionError as T, MoneyUnsupportedError as U, isMoneyDescriptor as V, money as W, type I18nTextDescriptor as a, type I18nTextOptions as b, type OnMissingPolicy as c, applyI18nLocale as d, isI18nTextDescriptor as e, resolvePolicy as f, getAtPath as g, type AggregateResult as h, i18nText as i, type AggregateSpec as j, Aggregation as k, type AggregationUpstream as l, GROUPBY_WARN_CARDINALITY as m, GroupedAggregation as n, GroupedQuery as o, GroupedQueryN as p, type GroupedRow as q, resolveI18nText as r, setAtPathInPlace as s, type GroupedRowN as t, type LiveAggregation as u, validateI18nTextValue as v, type Reducer as w, type ReducerOptions as x, avg as y, buildLiveAggregation as z };