@noy-db/hub 0.2.0-pre.11 → 0.2.0-pre.13

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 (269) hide show
  1. package/README.md +126 -0
  2. package/dist/aggregate/index.cjs +289 -12
  3. package/dist/aggregate/index.cjs.map +1 -1
  4. package/dist/aggregate/index.d.cts +2 -2
  5. package/dist/aggregate/index.d.ts +2 -2
  6. package/dist/aggregate/index.js +7 -7
  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 +3 -3
  10. package/dist/attestation/index.d.ts +3 -3
  11. package/dist/attestation/index.js +6 -6
  12. package/dist/blobs/index.cjs +28 -0
  13. package/dist/blobs/index.cjs.map +1 -1
  14. package/dist/blobs/index.d.cts +4 -4
  15. package/dist/blobs/index.d.ts +4 -4
  16. package/dist/blobs/index.js +5 -5
  17. package/dist/bundle/index.cjs +2024 -69
  18. package/dist/bundle/index.cjs.map +1 -1
  19. package/dist/bundle/index.d.cts +5 -5
  20. package/dist/bundle/index.d.ts +5 -5
  21. package/dist/bundle/index.js +9 -9
  22. package/dist/{chunk-LSTBFLL2.js → chunk-3OUCWHV6.js} +2 -2
  23. package/dist/{chunk-7CEGU63S.js → chunk-3XZRRBFW.js} +2 -2
  24. package/dist/{chunk-RC6SU5NO.js → chunk-4VCQH32J.js} +2 -2
  25. package/dist/{chunk-ZROPXHJY.js → chunk-4YDZ7JPZ.js} +2 -2
  26. package/dist/{chunk-IMYKDWB4.js → chunk-5NISHSBO.js} +2 -2
  27. package/dist/{chunk-ZBBW7YQN.js → chunk-7TEI2K2A.js} +5 -5
  28. package/dist/{chunk-6T2UDBKG.js → chunk-AYNF7PVX.js} +2 -2
  29. package/dist/{chunk-QCXNMCHN.js → chunk-C3WRKABE.js} +4 -4
  30. package/dist/{chunk-GAUEWM7D.js → chunk-CWFQTAD4.js} +4 -4
  31. package/dist/{chunk-QSOYKKMD.js → chunk-D5Y3HIC6.js} +2 -2
  32. package/dist/{chunk-R233SLY3.js → chunk-E3DIBDKA.js} +2 -2
  33. package/dist/chunk-FNVFT4HZ.js +64 -0
  34. package/dist/chunk-FNVFT4HZ.js.map +1 -0
  35. package/dist/{chunk-SLV4LAKX.js → chunk-GC4V7RU7.js} +1 -1
  36. package/dist/chunk-GC4V7RU7.js.map +1 -0
  37. package/dist/{chunk-5OEJ6GOT.js → chunk-GL3Z7LH7.js} +2 -2
  38. package/dist/{chunk-YW5DBAPG.js → chunk-GZJ5JBED.js} +4 -4
  39. package/dist/{chunk-LJXYPGRH.js → chunk-HHZ77DHM.js} +3 -3
  40. package/dist/{chunk-6MFH4BMK.js → chunk-HQXOEWLZ.js} +4 -4
  41. package/dist/{chunk-RYIL3PI2.js → chunk-ILWQGTNH.js} +2 -2
  42. package/dist/{chunk-3DGHRDCX.js → chunk-J67BP5EP.js} +3 -3
  43. package/dist/{chunk-PVUUIWHY.js → chunk-JPOQMXGT.js} +10 -3
  44. package/dist/chunk-JPOQMXGT.js.map +1 -0
  45. package/dist/{chunk-RRNA5GKT.js → chunk-JWFNOD2T.js} +2 -2
  46. package/dist/{chunk-BDV7INMP.js → chunk-KHQ3N5AB.js} +4 -4
  47. package/dist/{chunk-JQ4NEJJ6.js → chunk-KJF7EPUE.js} +3 -3
  48. package/dist/{chunk-FO3UEG4S.js → chunk-KKB42D3Q.js} +2 -2
  49. package/dist/{chunk-26NK23DZ.js → chunk-M6KXHRIA.js} +3 -3
  50. package/dist/{chunk-DAP2XL7Q.js → chunk-NIUXQDWD.js} +2 -2
  51. package/dist/{chunk-6YLPHBKR.js → chunk-NJMKHRQI.js} +145 -11
  52. package/dist/chunk-NJMKHRQI.js.map +1 -0
  53. package/dist/{chunk-O6EJ6WTI.js → chunk-NKGY3C53.js} +87 -2
  54. package/dist/chunk-NKGY3C53.js.map +1 -0
  55. package/dist/{chunk-CXJG63MA.js → chunk-NP6EZT44.js} +20 -6
  56. package/dist/chunk-NP6EZT44.js.map +1 -0
  57. package/dist/{chunk-Y26YV5R3.js → chunk-O2JW656W.js} +3 -3
  58. package/dist/{chunk-MPOLUAMI.js → chunk-P5MW7BG2.js} +665 -60
  59. package/dist/chunk-P5MW7BG2.js.map +1 -0
  60. package/dist/{chunk-TGALXXLV.js → chunk-PW26DAXS.js} +3 -3
  61. package/dist/{chunk-V2PZC6AW.js → chunk-QAWCVWCX.js} +5 -5
  62. package/dist/{chunk-CH22FZHT.js → chunk-QFYVGJLI.js} +2 -2
  63. package/dist/{chunk-YM7LFCG7.js → chunk-QIVFGU2M.js} +3 -3
  64. package/dist/{chunk-CXFOITNS.js → chunk-SJ24GHID.js} +2 -2
  65. package/dist/{chunk-EBVBE7UK.js → chunk-SOU42FGB.js} +5 -5
  66. package/dist/{chunk-YVZRTCGG.js → chunk-SYSKC237.js} +6 -6
  67. package/dist/{chunk-77DWLQRY.js → chunk-TDECYU4Y.js} +31 -3
  68. package/dist/chunk-TDECYU4Y.js.map +1 -0
  69. package/dist/{chunk-73YLDCNF.js → chunk-TEQGXA7L.js} +5 -5
  70. package/dist/{chunk-PC6ZEDRL.js → chunk-UNQEWORI.js} +2 -2
  71. package/dist/{chunk-PC3ZZBTO.js → chunk-VAK6NQAK.js} +5 -5
  72. package/dist/{chunk-GKI4SDP7.js → chunk-WQKZIQIL.js} +4 -4
  73. package/dist/chunk-YWBHS25M.js +783 -0
  74. package/dist/chunk-YWBHS25M.js.map +1 -0
  75. package/dist/chunk-ZC7J6ZYV.js +7 -0
  76. package/dist/chunk-ZC7J6ZYV.js.map +1 -0
  77. package/dist/consent/index.cjs.map +1 -1
  78. package/dist/consent/index.d.cts +4 -4
  79. package/dist/consent/index.d.ts +4 -4
  80. package/dist/consent/index.js +3 -3
  81. package/dist/{crypto-2CRLG4F4.js → crypto-YXH6SAOW.js} +3 -3
  82. package/dist/{delegation-ZTRT2PRV.js → delegation-K5ERUH6A.js} +5 -5
  83. package/dist/derivations/index.cjs.map +1 -1
  84. package/dist/derivations/index.d.cts +5 -5
  85. package/dist/derivations/index.d.ts +5 -5
  86. package/dist/derivations/index.js +4 -4
  87. package/dist/{dev-unlock-BH6y3Hx0.d.ts → dev-unlock-BW0GNBEV.d.ts} +1 -1
  88. package/dist/{dev-unlock-H1Xwxc3U.d.cts → dev-unlock-a7SOtaV0.d.cts} +1 -1
  89. package/dist/executor-AVJ7UEWA.js +8 -0
  90. package/dist/executor-IQO3KGXQ.js +11 -0
  91. package/dist/executor-VT7TKGE4.js +8 -0
  92. package/dist/{fanout-sidecar-F3ZRFU4H.js → fanout-sidecar-N6OJX6QR.js} +2 -2
  93. package/dist/guards/index.cjs +53 -1
  94. package/dist/guards/index.cjs.map +1 -1
  95. package/dist/guards/index.d.cts +12 -6
  96. package/dist/guards/index.d.ts +12 -6
  97. package/dist/guards/index.js +5 -3
  98. package/dist/{hash-_sDFvtmX.d.cts → hash-B0cLQcq_.d.cts} +1 -1
  99. package/dist/{hash-D89JdDbj.d.ts → hash-uMNIAAW8.d.ts} +1 -1
  100. package/dist/history/index.cjs.map +1 -1
  101. package/dist/history/index.d.cts +5 -5
  102. package/dist/history/index.d.ts +5 -5
  103. package/dist/history/index.js +5 -5
  104. package/dist/i18n/index.cjs.map +1 -1
  105. package/dist/i18n/index.d.cts +4 -4
  106. package/dist/i18n/index.d.ts +4 -4
  107. package/dist/i18n/index.js +6 -6
  108. package/dist/immutable-guard-B0h-ipLz.d.ts +67 -0
  109. package/dist/immutable-guard-BZIcYhYX.d.cts +67 -0
  110. package/dist/index-CUVOMtgg.d.cts +1216 -0
  111. package/dist/index-Cqzp4tt9.d.ts +1216 -0
  112. package/dist/index.cjs +2200 -106
  113. package/dist/index.cjs.map +1 -1
  114. package/dist/index.d.cts +55 -13
  115. package/dist/index.d.ts +55 -13
  116. package/dist/index.js +95 -44
  117. package/dist/index.js.map +1 -1
  118. package/dist/indexing/index.cjs.map +1 -1
  119. package/dist/indexing/index.js +2 -2
  120. package/dist/issue-ZH27C23Y.js +12 -0
  121. package/dist/{ledger-NYCGJX2D.js → ledger-64TTQMRS.js} +5 -5
  122. package/dist/materialized-views/index.cjs.map +1 -1
  123. package/dist/materialized-views/index.d.cts +5 -6
  124. package/dist/materialized-views/index.d.ts +5 -6
  125. package/dist/materialized-views/index.js +6 -6
  126. package/dist/noydb-O76SKBST.js +35 -0
  127. package/dist/overlay-views/index.cjs.map +1 -1
  128. package/dist/overlay-views/index.d.cts +5 -5
  129. package/dist/overlay-views/index.d.ts +5 -5
  130. package/dist/overlay-views/index.js +4 -4
  131. package/dist/periods/index.cjs.map +1 -1
  132. package/dist/periods/index.d.cts +4 -4
  133. package/dist/periods/index.d.ts +4 -4
  134. package/dist/periods/index.js +5 -5
  135. package/dist/{public-envelope-QOXZEHKH.js → public-envelope-MHG6YVXW.js} +4 -4
  136. package/dist/query/index.cjs +382 -17
  137. package/dist/query/index.cjs.map +1 -1
  138. package/dist/query/index.d.cts +2 -2
  139. package/dist/query/index.d.ts +2 -2
  140. package/dist/query/index.js +4 -4
  141. package/dist/registry-2PKBQDCH.js +8 -0
  142. package/dist/registry-4VXFKCBJ.js +8 -0
  143. package/dist/{registry-ST2VNFZC.js → registry-PV4G3OPA.js} +3 -3
  144. package/dist/{revoke-RT7QYB4G.js → revoke-5BOLVJ3N.js} +6 -6
  145. package/dist/session/index.cjs.map +1 -1
  146. package/dist/session/index.d.cts +5 -5
  147. package/dist/session/index.d.ts +5 -5
  148. package/dist/session/index.js +3 -3
  149. package/dist/shadow/index.cjs.map +1 -1
  150. package/dist/shadow/index.d.cts +4 -4
  151. package/dist/shadow/index.d.ts +4 -4
  152. package/dist/shadow/index.js +2 -2
  153. package/dist/{signer-QNU66JF5.js → signer-GRIYBA22.js} +5 -5
  154. package/dist/snapshots/index.cjs.map +1 -1
  155. package/dist/snapshots/index.d.cts +4 -4
  156. package/dist/snapshots/index.d.ts +4 -4
  157. package/dist/snapshots/index.js +4 -4
  158. package/dist/{stale-VKXSXJF4.js → stale-LZYMMDDS.js} +2 -2
  159. package/dist/state-vault-QFJWU23A.js +147 -0
  160. package/dist/state-vault-QFJWU23A.js.map +1 -0
  161. package/dist/store/index.cjs.map +1 -1
  162. package/dist/store/index.d.cts +4 -4
  163. package/dist/store/index.d.ts +4 -4
  164. package/dist/store/index.js +2 -2
  165. package/dist/strategy-CrS7PnbE.d.cts +2048 -0
  166. package/dist/strategy-CrS7PnbE.d.ts +2048 -0
  167. package/dist/sync/index.cjs.map +1 -1
  168. package/dist/sync/index.d.cts +3 -3
  169. package/dist/sync/index.d.ts +3 -3
  170. package/dist/sync/index.js +4 -4
  171. package/dist/team/index.cjs.map +1 -1
  172. package/dist/team/index.d.cts +4 -4
  173. package/dist/team/index.d.ts +4 -4
  174. package/dist/team/index.js +8 -8
  175. package/dist/tx/index.cjs +8 -1
  176. package/dist/tx/index.cjs.map +1 -1
  177. package/dist/tx/index.d.cts +4 -4
  178. package/dist/tx/index.d.ts +4 -4
  179. package/dist/tx/index.js +3 -3
  180. package/dist/{types-DiSXn3a4.d.cts → types-CDwSSXiI.d.cts} +709 -6
  181. package/dist/{types-CD8mc8zR.d.ts → types-pax34sec.d.ts} +709 -6
  182. package/dist/{ulid-DQ1hcJvZ.d.cts → ulid-7bCSgIgb.d.cts} +1 -1
  183. package/dist/{ulid-8p83wbR4.d.ts → ulid-C_t4hL3d.d.ts} +1 -1
  184. package/dist/util/index.cjs.map +1 -1
  185. package/dist/util/index.js +1 -1
  186. package/dist/vault-group-UO4YUZOG.js +493 -0
  187. package/dist/vault-group-UO4YUZOG.js.map +1 -0
  188. package/dist/{with-derivation-DWMTpgEH.d.ts → with-derivation-BjdOxUBn.d.ts} +1 -1
  189. package/dist/{with-derivation-CVT7-dUt.d.cts → with-derivation-D8wFlb6V.d.cts} +1 -1
  190. package/dist/{with-materialized-view-BTTU3BNK.d.cts → with-materialized-view-5QMF1rS_.d.cts} +1 -1
  191. package/dist/{with-materialized-view-X0CoL8-L.d.ts → with-materialized-view-DJb-HO65.d.ts} +1 -1
  192. package/dist/{with-overlayed-view-DQjO_DSG.d.ts → with-overlayed-view-CkqTefbz.d.ts} +1 -1
  193. package/dist/{with-overlayed-view-DcacRRsS.d.cts → with-overlayed-view-DDNflPvC.d.cts} +1 -1
  194. package/package.json +3 -3
  195. package/dist/chunk-2LPPNWF6.js +0 -340
  196. package/dist/chunk-2LPPNWF6.js.map +0 -1
  197. package/dist/chunk-6YLPHBKR.js.map +0 -1
  198. package/dist/chunk-77DWLQRY.js.map +0 -1
  199. package/dist/chunk-C3WE6UJY.js +0 -19
  200. package/dist/chunk-C3WE6UJY.js.map +0 -1
  201. package/dist/chunk-CXJG63MA.js.map +0 -1
  202. package/dist/chunk-MPOLUAMI.js.map +0 -1
  203. package/dist/chunk-O6EJ6WTI.js.map +0 -1
  204. package/dist/chunk-PVUUIWHY.js.map +0 -1
  205. package/dist/chunk-SLV4LAKX.js.map +0 -1
  206. package/dist/executor-S76VN45G.js +0 -8
  207. package/dist/executor-UCXLIGLW.js +0 -11
  208. package/dist/executor-ZCNZJMGR.js +0 -8
  209. package/dist/index-B8bjExET.d.cts +0 -2434
  210. package/dist/index-DfUbNad8.d.ts +0 -2434
  211. package/dist/issue-IVTVSKWW.js +0 -12
  212. package/dist/noydb-SH4RLE47.js +0 -34
  213. package/dist/registry-UFIK7CSR.js +0 -8
  214. package/dist/registry-ZGYYSM5I.js +0 -8
  215. package/dist/strategy-CT2LCKAX.d.cts +0 -613
  216. package/dist/strategy-CT2LCKAX.d.ts +0 -613
  217. package/dist/with-guard-BRvt53da.d.ts +0 -18
  218. package/dist/with-guard-Dx2zZnTA.d.cts +0 -18
  219. /package/dist/{chunk-LSTBFLL2.js.map → chunk-3OUCWHV6.js.map} +0 -0
  220. /package/dist/{chunk-7CEGU63S.js.map → chunk-3XZRRBFW.js.map} +0 -0
  221. /package/dist/{chunk-RC6SU5NO.js.map → chunk-4VCQH32J.js.map} +0 -0
  222. /package/dist/{chunk-ZROPXHJY.js.map → chunk-4YDZ7JPZ.js.map} +0 -0
  223. /package/dist/{chunk-IMYKDWB4.js.map → chunk-5NISHSBO.js.map} +0 -0
  224. /package/dist/{chunk-ZBBW7YQN.js.map → chunk-7TEI2K2A.js.map} +0 -0
  225. /package/dist/{chunk-6T2UDBKG.js.map → chunk-AYNF7PVX.js.map} +0 -0
  226. /package/dist/{chunk-QCXNMCHN.js.map → chunk-C3WRKABE.js.map} +0 -0
  227. /package/dist/{chunk-GAUEWM7D.js.map → chunk-CWFQTAD4.js.map} +0 -0
  228. /package/dist/{chunk-QSOYKKMD.js.map → chunk-D5Y3HIC6.js.map} +0 -0
  229. /package/dist/{chunk-R233SLY3.js.map → chunk-E3DIBDKA.js.map} +0 -0
  230. /package/dist/{chunk-5OEJ6GOT.js.map → chunk-GL3Z7LH7.js.map} +0 -0
  231. /package/dist/{chunk-YW5DBAPG.js.map → chunk-GZJ5JBED.js.map} +0 -0
  232. /package/dist/{chunk-LJXYPGRH.js.map → chunk-HHZ77DHM.js.map} +0 -0
  233. /package/dist/{chunk-6MFH4BMK.js.map → chunk-HQXOEWLZ.js.map} +0 -0
  234. /package/dist/{chunk-RYIL3PI2.js.map → chunk-ILWQGTNH.js.map} +0 -0
  235. /package/dist/{chunk-3DGHRDCX.js.map → chunk-J67BP5EP.js.map} +0 -0
  236. /package/dist/{chunk-RRNA5GKT.js.map → chunk-JWFNOD2T.js.map} +0 -0
  237. /package/dist/{chunk-BDV7INMP.js.map → chunk-KHQ3N5AB.js.map} +0 -0
  238. /package/dist/{chunk-JQ4NEJJ6.js.map → chunk-KJF7EPUE.js.map} +0 -0
  239. /package/dist/{chunk-FO3UEG4S.js.map → chunk-KKB42D3Q.js.map} +0 -0
  240. /package/dist/{chunk-26NK23DZ.js.map → chunk-M6KXHRIA.js.map} +0 -0
  241. /package/dist/{chunk-DAP2XL7Q.js.map → chunk-NIUXQDWD.js.map} +0 -0
  242. /package/dist/{chunk-Y26YV5R3.js.map → chunk-O2JW656W.js.map} +0 -0
  243. /package/dist/{chunk-TGALXXLV.js.map → chunk-PW26DAXS.js.map} +0 -0
  244. /package/dist/{chunk-V2PZC6AW.js.map → chunk-QAWCVWCX.js.map} +0 -0
  245. /package/dist/{chunk-CH22FZHT.js.map → chunk-QFYVGJLI.js.map} +0 -0
  246. /package/dist/{chunk-YM7LFCG7.js.map → chunk-QIVFGU2M.js.map} +0 -0
  247. /package/dist/{chunk-CXFOITNS.js.map → chunk-SJ24GHID.js.map} +0 -0
  248. /package/dist/{chunk-EBVBE7UK.js.map → chunk-SOU42FGB.js.map} +0 -0
  249. /package/dist/{chunk-YVZRTCGG.js.map → chunk-SYSKC237.js.map} +0 -0
  250. /package/dist/{chunk-73YLDCNF.js.map → chunk-TEQGXA7L.js.map} +0 -0
  251. /package/dist/{chunk-PC6ZEDRL.js.map → chunk-UNQEWORI.js.map} +0 -0
  252. /package/dist/{chunk-PC3ZZBTO.js.map → chunk-VAK6NQAK.js.map} +0 -0
  253. /package/dist/{chunk-GKI4SDP7.js.map → chunk-WQKZIQIL.js.map} +0 -0
  254. /package/dist/{crypto-2CRLG4F4.js.map → crypto-YXH6SAOW.js.map} +0 -0
  255. /package/dist/{delegation-ZTRT2PRV.js.map → delegation-K5ERUH6A.js.map} +0 -0
  256. /package/dist/{executor-S76VN45G.js.map → executor-AVJ7UEWA.js.map} +0 -0
  257. /package/dist/{executor-UCXLIGLW.js.map → executor-IQO3KGXQ.js.map} +0 -0
  258. /package/dist/{executor-ZCNZJMGR.js.map → executor-VT7TKGE4.js.map} +0 -0
  259. /package/dist/{fanout-sidecar-F3ZRFU4H.js.map → fanout-sidecar-N6OJX6QR.js.map} +0 -0
  260. /package/dist/{issue-IVTVSKWW.js.map → issue-ZH27C23Y.js.map} +0 -0
  261. /package/dist/{ledger-NYCGJX2D.js.map → ledger-64TTQMRS.js.map} +0 -0
  262. /package/dist/{noydb-SH4RLE47.js.map → noydb-O76SKBST.js.map} +0 -0
  263. /package/dist/{public-envelope-QOXZEHKH.js.map → public-envelope-MHG6YVXW.js.map} +0 -0
  264. /package/dist/{registry-ST2VNFZC.js.map → registry-2PKBQDCH.js.map} +0 -0
  265. /package/dist/{registry-UFIK7CSR.js.map → registry-4VXFKCBJ.js.map} +0 -0
  266. /package/dist/{registry-ZGYYSM5I.js.map → registry-PV4G3OPA.js.map} +0 -0
  267. /package/dist/{revoke-RT7QYB4G.js.map → revoke-5BOLVJ3N.js.map} +0 -0
  268. /package/dist/{signer-QNU66JF5.js.map → signer-GRIYBA22.js.map} +0 -0
  269. /package/dist/{stale-VKXSXJF4.js.map → stale-LZYMMDDS.js.map} +0 -0
@@ -1,10 +1,10 @@
1
- import { ag as PeriodsStrategy } from '../types-DiSXn3a4.cjs';
2
- export { ah as CarryForwardContext, ai as ClosePeriodOptions, aj as OpenPeriodOptions, ak as PERIODS_COLLECTION, al as PeriodRecord, am as ReadOnlyCollection, an as appendPeriodLedgerEntry, ao as assertTsWritable, ap as chainAnchor, aq as loadPeriods, ar as validatePeriodName } from '../types-DiSXn3a4.cjs';
1
+ import { ag as PeriodsStrategy } from '../types-CDwSSXiI.cjs';
2
+ export { ah as CarryForwardContext, ai as ClosePeriodOptions, aj as OpenPeriodOptions, ak as PERIODS_COLLECTION, al as PeriodRecord, am as ReadOnlyCollection, an as appendPeriodLedgerEntry, ao as assertTsWritable, ap as chainAnchor, aq as loadPeriods, ar as validatePeriodName } from '../types-CDwSSXiI.cjs';
3
3
  import '../lazy-builder-Ci5_YG73.cjs';
4
4
  import '../predicate-Bt5ft-9c.cjs';
5
- import '../strategy-CT2LCKAX.cjs';
5
+ import '../strategy-CrS7PnbE.cjs';
6
6
  import '../strategy-BSxFXGzb.cjs';
7
- import '../index-B8bjExET.cjs';
7
+ import '../index-CUVOMtgg.cjs';
8
8
  import '@noy-db/attestation';
9
9
 
10
10
  /**
@@ -1,10 +1,10 @@
1
- import { ag as PeriodsStrategy } from '../types-CD8mc8zR.js';
2
- export { ah as CarryForwardContext, ai as ClosePeriodOptions, aj as OpenPeriodOptions, ak as PERIODS_COLLECTION, al as PeriodRecord, am as ReadOnlyCollection, an as appendPeriodLedgerEntry, ao as assertTsWritable, ap as chainAnchor, aq as loadPeriods, ar as validatePeriodName } from '../types-CD8mc8zR.js';
1
+ import { ag as PeriodsStrategy } from '../types-pax34sec.js';
2
+ export { ah as CarryForwardContext, ai as ClosePeriodOptions, aj as OpenPeriodOptions, ak as PERIODS_COLLECTION, al as PeriodRecord, am as ReadOnlyCollection, an as appendPeriodLedgerEntry, ao as assertTsWritable, ap as chainAnchor, aq as loadPeriods, ar as validatePeriodName } from '../types-pax34sec.js';
3
3
  import '../lazy-builder-D5GU14TS.js';
4
4
  import '../predicate-Bt5ft-9c.js';
5
- import '../strategy-CT2LCKAX.js';
5
+ import '../strategy-CrS7PnbE.js';
6
6
  import '../strategy-BSxFXGzb.js';
7
- import '../index-DfUbNad8.js';
7
+ import '../index-Cqzp4tt9.js';
8
8
  import '@noy-db/attestation';
9
9
 
10
10
  /**
@@ -6,13 +6,13 @@ import {
6
6
  loadPeriods,
7
7
  validatePeriodName,
8
8
  withPeriods
9
- } from "../chunk-3DGHRDCX.js";
9
+ } from "../chunk-J67BP5EP.js";
10
10
  import "../chunk-UF3BUNQZ.js";
11
- import "../chunk-6MFH4BMK.js";
11
+ import "../chunk-HQXOEWLZ.js";
12
12
  import "../chunk-Z6FNBOTC.js";
13
- import "../chunk-SLV4LAKX.js";
14
- import "../chunk-R233SLY3.js";
15
- import "../chunk-O6EJ6WTI.js";
13
+ import "../chunk-GC4V7RU7.js";
14
+ import "../chunk-E3DIBDKA.js";
15
+ import "../chunk-NKGY3C53.js";
16
16
  export {
17
17
  PERIODS_COLLECTION,
18
18
  appendPeriodLedgerEntry,
@@ -12,9 +12,9 @@ import {
12
12
  resolveLocale,
13
13
  savePublicEnvelope,
14
14
  validatePublicEnvelopeInput
15
- } from "./chunk-JQ4NEJJ6.js";
16
- import "./chunk-SLV4LAKX.js";
17
- import "./chunk-O6EJ6WTI.js";
15
+ } from "./chunk-KJF7EPUE.js";
16
+ import "./chunk-GC4V7RU7.js";
17
+ import "./chunk-NKGY3C53.js";
18
18
  export {
19
19
  DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
20
20
  PUBLIC_ENVELOPE_FIELDS,
@@ -28,4 +28,4 @@ export {
28
28
  savePublicEnvelope,
29
29
  validatePublicEnvelopeInput
30
30
  };
31
- //# sourceMappingURL=public-envelope-QOXZEHKH.js.map
31
+ //# sourceMappingURL=public-envelope-MHG6YVXW.js.map
@@ -501,6 +501,307 @@ var NO_AGGREGATE = {
501
501
  }
502
502
  };
503
503
 
504
+ // src/money/fixed-point.ts
505
+ function formatScaledInt(value, scale) {
506
+ const negative = value < 0n;
507
+ const abs = (negative ? -value : value).toString();
508
+ if (scale === 0) return (negative ? "-" : "") + abs;
509
+ const padded = abs.padStart(scale + 1, "0");
510
+ const cut = padded.length - scale;
511
+ const intPart = padded.slice(0, cut);
512
+ const fracPart = padded.slice(cut);
513
+ return (negative ? "-" : "") + intPart + "." + fracPart;
514
+ }
515
+
516
+ // src/money/iso4217.ts
517
+ var MINOR_UNITS = {
518
+ // 2-decimal majors
519
+ EUR: 2,
520
+ USD: 2,
521
+ GBP: 2,
522
+ CHF: 2,
523
+ CAD: 2,
524
+ AUD: 2,
525
+ NZD: 2,
526
+ SGD: 2,
527
+ HKD: 2,
528
+ CNY: 2,
529
+ INR: 2,
530
+ BRL: 2,
531
+ MXN: 2,
532
+ ZAR: 2,
533
+ RUB: 2,
534
+ TRY: 2,
535
+ PLN: 2,
536
+ SEK: 2,
537
+ NOK: 2,
538
+ DKK: 2,
539
+ CZK: 2,
540
+ HUF: 2,
541
+ RON: 2,
542
+ ILS: 2,
543
+ THB: 2,
544
+ PHP: 2,
545
+ MYR: 2,
546
+ IDR: 2,
547
+ AED: 2,
548
+ SAR: 2,
549
+ QAR: 2,
550
+ EGP: 2,
551
+ // 0-decimal
552
+ JPY: 0,
553
+ KRW: 0,
554
+ ISK: 0,
555
+ CLP: 0,
556
+ VND: 0,
557
+ XOF: 0,
558
+ XAF: 0,
559
+ PYG: 0,
560
+ // 3-decimal
561
+ BHD: 3,
562
+ KWD: 3,
563
+ OMR: 3,
564
+ TND: 3,
565
+ JOD: 3,
566
+ IQD: 3,
567
+ LYD: 3
568
+ };
569
+ function scaleForCurrency(code) {
570
+ const v = MINOR_UNITS[code];
571
+ return v === void 0 ? null : v;
572
+ }
573
+
574
+ // src/money/descriptor.ts
575
+ var MoneyUnsupportedError = class extends NoydbError {
576
+ constructor(field, message) {
577
+ super(
578
+ "MONEY_UNSUPPORTED",
579
+ message ?? `money: operation is not supported on field "${field}" \u2014 use sum() and count() and divide at the boundary`
580
+ );
581
+ this.field = field;
582
+ this.name = "MoneyUnsupportedError";
583
+ }
584
+ field;
585
+ };
586
+
587
+ // src/money/money-reducer.ts
588
+ function toScaledInt(v) {
589
+ if (typeof v === "string" || typeof v === "number" || typeof v === "bigint") {
590
+ try {
591
+ return BigInt(v);
592
+ } catch {
593
+ return null;
594
+ }
595
+ }
596
+ return null;
597
+ }
598
+ function readMoney(record, field, desc) {
599
+ const raw = readPath(record, field);
600
+ if (raw === null || raw === void 0) return null;
601
+ if (desc.mode === "fixed") {
602
+ const value2 = toScaledInt(raw);
603
+ return value2 === null ? null : { currency: desc.fixedCurrency, value: value2 };
604
+ }
605
+ if (typeof raw !== "object") return null;
606
+ const o = raw;
607
+ if (typeof o.currency !== "string") return null;
608
+ const value = toScaledInt(o.amount);
609
+ return value === null ? null : { currency: o.currency, value };
610
+ }
611
+ function targetScaleFor(desc, currency) {
612
+ if (desc.allows(currency)) return desc.scaleFor(currency);
613
+ const s = scaleForCurrency(currency);
614
+ if (s === null) {
615
+ throw new Error(`money: cannot determine scale for conversion target "${currency}"`);
616
+ }
617
+ return s;
618
+ }
619
+ function parseRate(rate) {
620
+ const s = String(rate).trim();
621
+ const neg = s.startsWith("-");
622
+ const body = neg ? s.slice(1) : s;
623
+ const dot = body.indexOf(".");
624
+ const intPart = dot === -1 ? body : body.slice(0, dot);
625
+ const fracPart = dot === -1 ? "" : body.slice(dot + 1);
626
+ const int = BigInt((intPart === "" ? "0" : intPart) + fracPart);
627
+ return { int: neg ? -int : int, scale: fracPart.length };
628
+ }
629
+ function divRoundHalfEven(n, d) {
630
+ const q = n / d;
631
+ const r = n % d;
632
+ const twiceR = (r < 0n ? -r : r) * 2n;
633
+ if (twiceR < d) return q;
634
+ if (twiceR > d) return q + (n < 0n ? -1n : 1n);
635
+ return q % 2n === 0n ? q : q + (n < 0n ? -1n : 1n);
636
+ }
637
+ function convertScaled(value, srcScale, rate, targetScale) {
638
+ const { int: rateInt, scale: rateScale } = parseRate(rate);
639
+ const product = value * rateInt;
640
+ const curScale = srcScale + rateScale;
641
+ if (curScale === targetScale) return product;
642
+ if (curScale < targetScale) return product * 10n ** BigInt(targetScale - curScale);
643
+ return divRoundHalfEven(product, 10n ** BigInt(curScale - targetScale));
644
+ }
645
+ function finalizeSum(state, desc, convertTo, fx) {
646
+ if (convertTo !== void 0) {
647
+ if (fx === void 0) {
648
+ throw new Error(`money: sum convertTo "${convertTo}" requires an fx rate map`);
649
+ }
650
+ const targetScale = targetScaleFor(desc, convertTo);
651
+ let total = 0n;
652
+ for (const [cur, v] of state) {
653
+ if (cur === convertTo) {
654
+ total += convertScaled(v, desc.scaleFor(cur), 1, targetScale);
655
+ continue;
656
+ }
657
+ const rate = fx[`${cur}->${convertTo}`];
658
+ if (rate === void 0) {
659
+ throw new Error(`money: no fx rate for "${cur}->${convertTo}"`);
660
+ }
661
+ total += convertScaled(v, desc.scaleFor(cur), rate, targetScale);
662
+ }
663
+ return formatScaledInt(total, targetScale);
664
+ }
665
+ if (desc.mode === "fixed") {
666
+ const cur = desc.fixedCurrency;
667
+ return formatScaledInt(state.get(cur) ?? 0n, desc.scaleFor(cur));
668
+ }
669
+ const out = {};
670
+ for (const [cur, v] of state) out[cur] = formatScaledInt(v, desc.scaleFor(cur));
671
+ return out;
672
+ }
673
+ function moneySumReducer(field, desc, convertTo, fx) {
674
+ return {
675
+ op: "sum",
676
+ field,
677
+ init: () => /* @__PURE__ */ new Map(),
678
+ step: (state, record) => {
679
+ const m = readMoney(record, field, desc);
680
+ if (m) state.set(m.currency, (state.get(m.currency) ?? 0n) + m.value);
681
+ return state;
682
+ },
683
+ remove: (state, record) => {
684
+ const m = readMoney(record, field, desc);
685
+ if (m) state.set(m.currency, (state.get(m.currency) ?? 0n) - m.value);
686
+ return state;
687
+ },
688
+ finalize: (state) => finalizeSum(state, desc, convertTo, fx)
689
+ };
690
+ }
691
+ function extremum(values, op) {
692
+ let out = values[0];
693
+ for (let i = 1; i < values.length; i++) {
694
+ const v = values[i];
695
+ if (op === "min" ? v < out : v > out) out = v;
696
+ }
697
+ return out;
698
+ }
699
+ function moneyMinMaxReducer(op, field, desc) {
700
+ return {
701
+ op,
702
+ field,
703
+ init: () => /* @__PURE__ */ new Map(),
704
+ step: (state, record) => {
705
+ const m = readMoney(record, field, desc);
706
+ if (m) {
707
+ const arr = state.get(m.currency);
708
+ if (arr) arr.push(m.value);
709
+ else state.set(m.currency, [m.value]);
710
+ }
711
+ return state;
712
+ },
713
+ remove: (state, record) => {
714
+ const m = readMoney(record, field, desc);
715
+ if (m) {
716
+ const arr = state.get(m.currency);
717
+ if (arr) {
718
+ const idx = arr.indexOf(m.value);
719
+ if (idx >= 0) arr.splice(idx, 1);
720
+ }
721
+ }
722
+ return state;
723
+ },
724
+ finalize: (state) => {
725
+ if (desc.mode === "fixed") {
726
+ const cur = desc.fixedCurrency;
727
+ const arr = state.get(cur);
728
+ if (!arr || arr.length === 0) return null;
729
+ return formatScaledInt(extremum(arr, op), desc.scaleFor(cur));
730
+ }
731
+ const out = {};
732
+ for (const [cur, arr] of state) {
733
+ if (arr.length > 0) out[cur] = formatScaledInt(extremum(arr, op), desc.scaleFor(cur));
734
+ }
735
+ return out;
736
+ }
737
+ };
738
+ }
739
+ function wrapMoneyReducers(spec, moneyFields) {
740
+ let changed = false;
741
+ const out = {};
742
+ for (const [key, reducer] of Object.entries(spec)) {
743
+ const field = reducer.field;
744
+ const desc = field ? moneyFields[field] : void 0;
745
+ if (desc && reducer.op === "avg") {
746
+ throw new MoneyUnsupportedError(
747
+ field,
748
+ `avg() is not supported on money field "${field}" in v1 \u2014 use sum() and count() and divide at the boundary.`
749
+ );
750
+ }
751
+ if (desc && (reducer.op === "sum" || reducer.op === "min" || reducer.op === "max")) {
752
+ changed = true;
753
+ out[key] = reducer.op === "sum" ? moneySumReducer(field, desc, reducer.convertTo, reducer.fx) : moneyMinMaxReducer(reducer.op, field, desc);
754
+ } else {
755
+ out[key] = reducer;
756
+ }
757
+ }
758
+ return changed ? out : spec;
759
+ }
760
+
761
+ // src/money/normalize.ts
762
+ function isMoneyValueObject(v) {
763
+ return typeof v === "object" && v !== null && "currency" in v;
764
+ }
765
+ function formatCurrency(decimal, currency, scale, locale) {
766
+ const fmt = new Intl.NumberFormat(locale, {
767
+ style: "currency",
768
+ currency,
769
+ minimumFractionDigits: scale,
770
+ maximumFractionDigits: scale
771
+ });
772
+ return fmt.format(decimal);
773
+ }
774
+ function decodeMoneyFields(record, moneyFields, locale) {
775
+ const out = { ...record };
776
+ const format = locale !== "raw";
777
+ const fmtLocale = typeof locale === "string" && locale !== "raw" ? locale : "en-US";
778
+ for (const [field, desc] of Object.entries(moneyFields)) {
779
+ const stored = out[field];
780
+ if (stored === null || stored === void 0) continue;
781
+ let currency;
782
+ let scaledIntString;
783
+ if (desc.mode === "fixed") {
784
+ if (typeof stored !== "string" && typeof stored !== "number") continue;
785
+ currency = desc.fixedCurrency;
786
+ scaledIntString = String(stored);
787
+ } else {
788
+ if (!isMoneyValueObject(stored)) continue;
789
+ const amount = stored.amount;
790
+ if (typeof stored.currency !== "string" || typeof amount !== "string" && typeof amount !== "number") continue;
791
+ currency = stored.currency;
792
+ scaledIntString = String(amount);
793
+ }
794
+ const scale = desc.scaleFor(currency);
795
+ const decimal = formatScaledInt(BigInt(scaledIntString), scale);
796
+ out[field] = desc.mode === "fixed" ? decimal : { amount: decimal, currency };
797
+ if (format) {
798
+ out[`${field}Formatted`] = formatCurrency(decimal, currency, scale, fmtLocale);
799
+ out[`${field}Number`] = Number(decimal);
800
+ }
801
+ }
802
+ return out;
803
+ }
804
+
504
805
  // src/query/builder.ts
505
806
  var EMPTY_PLAN = {
506
807
  clauses: [],
@@ -870,7 +1171,7 @@ var Query = class _Query {
870
1171
  * for the ordering rationale.
871
1172
  */
872
1173
  toArray() {
873
- const base = executePlanWithSource(this.source, this.plan, this.joinContext);
1174
+ const base = this.decodeMoney(executePlanWithSource(this.source, this.plan, this.joinContext));
874
1175
  if (this.plan.joins.length === 0) return base;
875
1176
  if (!this.joinContext) {
876
1177
  throw new Error(
@@ -879,6 +1180,23 @@ var Query = class _Query {
879
1180
  }
880
1181
  return applyJoins(base, this.plan.joins, this.joinContext);
881
1182
  }
1183
+ /**
1184
+ * Decode this source's money fields on read (stored scaled-int → canonical
1185
+ * decimal), so `query().toArray()` agrees with `get()`/`sum()` on the value.
1186
+ * No-op when the source declares no money fields.
1187
+ *
1188
+ * The query layer carries no locale context, so we decode with `'raw'` —
1189
+ * canonical decimal, WITHOUT fabricating locale-formatted `<field>Formatted`
1190
+ * / `<field>Number` virtuals. Producing a guessed-locale string here would
1191
+ * just reintroduce #322's "two read paths disagree" failure on the virtual
1192
+ * field (e.g. it-IT via `get()` vs en-US here). Consumers who need formatted
1193
+ * money read through `get()`/`list()` with a locale.
1194
+ */
1195
+ decodeMoney(records) {
1196
+ const moneyFields = this.source.moneyFields;
1197
+ if (!moneyFields || Object.keys(moneyFields).length === 0) return records;
1198
+ return records.map((r) => decodeMoneyFields(r, moneyFields, "raw"));
1199
+ }
882
1200
  /** Return the first matching record, or null. Joins are applied. */
883
1201
  first() {
884
1202
  const arr = this.limit(1).toArray();
@@ -947,6 +1265,10 @@ var Query = class _Query {
947
1265
  * partition boundaries without an API break.
948
1266
  */
949
1267
  aggregate(spec) {
1268
+ const moneyFields = this.source.moneyFields;
1269
+ if (moneyFields) {
1270
+ spec = wrapMoneyReducers(spec, moneyFields);
1271
+ }
950
1272
  const source = this.source;
951
1273
  const clauses = this.plan.clauses;
952
1274
  const joinCtx = this.joinContext;
@@ -994,13 +1316,15 @@ var Query = class _Query {
994
1316
  executeRecords,
995
1317
  field,
996
1318
  upstreams,
997
- dictLabelResolver
1319
+ dictLabelResolver,
1320
+ this.source.moneyFields
998
1321
  );
999
1322
  }
1000
1323
  return this.aggregateStrategy.groupByN(
1001
1324
  executeRecords,
1002
1325
  fields,
1003
- upstreams
1326
+ upstreams,
1327
+ this.source.moneyFields
1004
1328
  );
1005
1329
  }
1006
1330
  /**
@@ -1536,7 +1860,8 @@ function count(opts) {
1536
1860
  init: () => 0,
1537
1861
  step: (state) => state + 1,
1538
1862
  remove: (state) => state - 1,
1539
- finalize: (state) => state
1863
+ finalize: (state) => state,
1864
+ merge: (a, b) => a + b
1540
1865
  };
1541
1866
  }
1542
1867
  function sum(field, opts) {
@@ -1545,10 +1870,15 @@ function sum(field, opts) {
1545
1870
  return {
1546
1871
  op: "sum",
1547
1872
  field,
1873
+ // Money-only metadata, read by `wrapMoneyReducers`. No effect on a
1874
+ // generic numeric sum.
1875
+ ...opts?.convertTo !== void 0 ? { convertTo: opts.convertTo } : {},
1876
+ ...opts?.fx !== void 0 ? { fx: opts.fx } : {},
1548
1877
  init: () => 0,
1549
1878
  step: (state, record) => state + readNumber(record, field),
1550
1879
  remove: (state, record) => state - readNumber(record, field),
1551
- finalize: (state) => state
1880
+ finalize: (state) => state,
1881
+ merge: (a, b) => a + b
1552
1882
  };
1553
1883
  }
1554
1884
  function avg(field, opts) {
@@ -1566,7 +1896,8 @@ function avg(field, opts) {
1566
1896
  sum: state.sum - readNumber(record, field),
1567
1897
  count: state.count - 1
1568
1898
  }),
1569
- finalize: (state) => state.count === 0 ? null : state.sum / state.count
1899
+ finalize: (state) => state.count === 0 ? null : state.sum / state.count,
1900
+ merge: (a, b) => ({ sum: a.sum + b.sum, count: a.count + b.count })
1570
1901
  };
1571
1902
  }
1572
1903
  function pushValue(state, value) {
@@ -1596,7 +1927,8 @@ function min(field, opts) {
1596
1927
  if (v < out) out = v;
1597
1928
  }
1598
1929
  return out;
1599
- }
1930
+ },
1931
+ merge: (a, b) => ({ values: [...a.values, ...b.values] })
1600
1932
  };
1601
1933
  }
1602
1934
  function max(field, opts) {
@@ -1616,11 +1948,17 @@ function max(field, opts) {
1616
1948
  if (v > out) out = v;
1617
1949
  }
1618
1950
  return out;
1619
- }
1951
+ },
1952
+ merge: (a, b) => ({ values: [...a.values, ...b.values] })
1620
1953
  };
1621
1954
  }
1622
1955
  function readNumber(record, field) {
1623
1956
  const value = readPath(record, field);
1957
+ if (typeof value === "object" && value !== null && "amount" in value && "currency" in value) {
1958
+ throw new Error(
1959
+ `aggregate: field "${field}" holds a money value but was not money-aware \u2014 declare it in the collection's moneyFields so sum/min/max stay exact`
1960
+ );
1961
+ }
1624
1962
  return typeof value === "number" && Number.isFinite(value) ? value : 0;
1625
1963
  }
1626
1964
 
@@ -1776,15 +2114,17 @@ function resetGroupByWarnings() {
1776
2114
  warnedCardinalityFields.clear();
1777
2115
  }
1778
2116
  var GroupedQueryBase = class {
1779
- constructor(executeRecords, fieldOrFields, upstreams, dictLabelResolver) {
2117
+ constructor(executeRecords, fieldOrFields, upstreams, dictLabelResolver, moneyFields) {
1780
2118
  this.executeRecords = executeRecords;
1781
2119
  this.upstreams = upstreams;
1782
2120
  this.dictLabelResolver = dictLabelResolver;
2121
+ this.moneyFields = moneyFields;
1783
2122
  this.fields = typeof fieldOrFields === "string" ? [fieldOrFields] : [...fieldOrFields];
1784
2123
  }
1785
2124
  executeRecords;
1786
2125
  upstreams;
1787
2126
  dictLabelResolver;
2127
+ moneyFields;
1788
2128
  /**
1789
2129
  * Field set this grouped query buckets on. Stored in declaration
1790
2130
  * order — the same order is preserved on every result row by
@@ -1792,6 +2132,10 @@ var GroupedQueryBase = class {
1792
2132
  * `[field]`.
1793
2133
  */
1794
2134
  fields;
2135
+ /** Apply money-aware reducer rewriting when money fields are declared. */
2136
+ wrapSpec(spec) {
2137
+ return this.moneyFields ? wrapMoneyReducers(spec, this.moneyFields) : spec;
2138
+ }
1795
2139
  };
1796
2140
  var GroupedQuery = class extends GroupedQueryBase {
1797
2141
  /**
@@ -1804,7 +2148,7 @@ var GroupedQuery = class extends GroupedQueryBase {
1804
2148
  return new GroupedAggregation(
1805
2149
  this.executeRecords,
1806
2150
  this.fields,
1807
- spec,
2151
+ this.wrapSpec(spec),
1808
2152
  this.upstreams,
1809
2153
  this.dictLabelResolver
1810
2154
  );
@@ -1815,7 +2159,7 @@ var GroupedQueryN = class extends GroupedQueryBase {
1815
2159
  return new GroupedAggregation(
1816
2160
  this.executeRecords,
1817
2161
  this.fields,
1818
- spec,
2162
+ this.wrapSpec(spec),
1819
2163
  this.upstreams,
1820
2164
  this.dictLabelResolver
1821
2165
  );
@@ -1969,12 +2313,29 @@ var ScanBuilder = class _ScanBuilder {
1969
2313
  * context throws with an actionable error.
1970
2314
  */
1971
2315
  joinContext;
1972
- constructor(pageProvider, pageSize = DEFAULT_SCAN_PAGE_SIZE, clauses = [], joins = [], joinContext) {
2316
+ /**
2317
+ * Money field descriptors for the backing collection. When present, yielded
2318
+ * records are decoded (stored scaled-int → canonical decimal) so `scan()`
2319
+ * agrees with `get()`/`list()`/`query().toArray()` — #322. Decoded with
2320
+ * `'raw'` (canonical decimal, no locale-formatted virtuals) since the scan
2321
+ * stream carries no locale context, mirroring `Query.toArray()`.
2322
+ */
2323
+ moneyFields;
2324
+ constructor(pageProvider, pageSize = DEFAULT_SCAN_PAGE_SIZE, clauses = [], joins = [], joinContext, moneyFields) {
1973
2325
  this.pageProvider = pageProvider;
1974
2326
  this.pageSize = pageSize;
1975
2327
  this.clauses = clauses;
1976
2328
  this.joins = joins;
1977
2329
  this.joinContext = joinContext;
2330
+ this.moneyFields = moneyFields;
2331
+ }
2332
+ /**
2333
+ * Decode this scan's money fields on a record (stored scaled-int → canonical
2334
+ * decimal). No-op when no money fields are declared. See {@link moneyFields}.
2335
+ */
2336
+ decodeMoney(record) {
2337
+ if (!this.moneyFields || Object.keys(this.moneyFields).length === 0) return record;
2338
+ return decodeMoneyFields(record, this.moneyFields, "raw");
1978
2339
  }
1979
2340
  /**
1980
2341
  * Add a field comparison. Runs per record as the scan stream
@@ -1996,7 +2357,8 @@ var ScanBuilder = class _ScanBuilder {
1996
2357
  this.pageSize,
1997
2358
  [...this.clauses, clause],
1998
2359
  this.joins,
1999
- this.joinContext
2360
+ this.joinContext,
2361
+ this.moneyFields
2000
2362
  );
2001
2363
  }
2002
2364
  /**
@@ -2015,7 +2377,8 @@ var ScanBuilder = class _ScanBuilder {
2015
2377
  this.pageSize,
2016
2378
  [...this.clauses, clause],
2017
2379
  this.joins,
2018
- this.joinContext
2380
+ this.joinContext,
2381
+ this.moneyFields
2019
2382
  );
2020
2383
  }
2021
2384
  /**
@@ -2126,7 +2489,8 @@ var ScanBuilder = class _ScanBuilder {
2126
2489
  this.pageSize,
2127
2490
  this.clauses,
2128
2491
  [...this.joins, leg],
2129
- this.joinContext
2492
+ this.joinContext,
2493
+ this.moneyFields
2130
2494
  );
2131
2495
  }
2132
2496
  /**
@@ -2143,10 +2507,11 @@ var ScanBuilder = class _ScanBuilder {
2143
2507
  while (true) {
2144
2508
  for (const record of page.items) {
2145
2509
  if (!this.recordMatches(record)) continue;
2510
+ const decoded = this.decodeMoney(record);
2146
2511
  if (joinResolvers === null) {
2147
- yield record;
2512
+ yield decoded;
2148
2513
  } else {
2149
- let attached = record;
2514
+ let attached = decoded;
2150
2515
  for (const resolver of joinResolvers) {
2151
2516
  attached = this.applyOneJoinStreaming(attached, resolver);
2152
2517
  }