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

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 (265) 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 +1452 -16
  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-7CEGU63S.js → chunk-4BHFNKTP.js} +2 -2
  23. package/dist/{chunk-5OEJ6GOT.js → chunk-5ARRXIVR.js} +2 -2
  24. package/dist/{chunk-77DWLQRY.js → chunk-6AD5TBF2.js} +31 -3
  25. package/dist/chunk-6AD5TBF2.js.map +1 -0
  26. package/dist/{chunk-YM7LFCG7.js → chunk-6BYBVRZU.js} +3 -3
  27. package/dist/{chunk-73YLDCNF.js → chunk-7JJE3OMJ.js} +5 -5
  28. package/dist/{chunk-GKI4SDP7.js → chunk-7LVRIW4G.js} +4 -4
  29. package/dist/{chunk-O6EJ6WTI.js → chunk-AGRC7NQQ.js} +62 -2
  30. package/dist/chunk-AGRC7NQQ.js.map +1 -0
  31. package/dist/{chunk-IMYKDWB4.js → chunk-B7GGYNKQ.js} +2 -2
  32. package/dist/{chunk-BDV7INMP.js → chunk-BXOUVUES.js} +4 -4
  33. package/dist/{chunk-FO3UEG4S.js → chunk-C2CIIQRG.js} +2 -2
  34. package/dist/{chunk-ZROPXHJY.js → chunk-CHBXWJZQ.js} +2 -2
  35. package/dist/{chunk-RYIL3PI2.js → chunk-CILT6V3V.js} +2 -2
  36. package/dist/{chunk-YVZRTCGG.js → chunk-DLTU4M2I.js} +6 -6
  37. package/dist/{chunk-GAUEWM7D.js → chunk-EKNUBIIQ.js} +4 -4
  38. package/dist/{chunk-QCXNMCHN.js → chunk-GFPR7VJS.js} +4 -4
  39. package/dist/{chunk-V2PZC6AW.js → chunk-HBAJDI2N.js} +5 -5
  40. package/dist/{chunk-PVUUIWHY.js → chunk-HLGDYFWR.js} +10 -3
  41. package/dist/chunk-HLGDYFWR.js.map +1 -0
  42. package/dist/{chunk-RRNA5GKT.js → chunk-IEPT7HVP.js} +2 -2
  43. package/dist/{chunk-R233SLY3.js → chunk-IUBHXEPJ.js} +2 -2
  44. package/dist/{chunk-CH22FZHT.js → chunk-L6BYRCYB.js} +2 -2
  45. package/dist/{chunk-PC3ZZBTO.js → chunk-LOA2VCMS.js} +5 -5
  46. package/dist/{chunk-TGALXXLV.js → chunk-LSEW3ZZ2.js} +3 -3
  47. package/dist/{chunk-Y26YV5R3.js → chunk-LWSD4QPT.js} +3 -3
  48. package/dist/{chunk-SLV4LAKX.js → chunk-LYNNZEQD.js} +1 -1
  49. package/dist/chunk-LYNNZEQD.js.map +1 -0
  50. package/dist/{chunk-26NK23DZ.js → chunk-M45IRXDM.js} +3 -3
  51. package/dist/{chunk-CXJG63MA.js → chunk-NP6EZT44.js} +20 -6
  52. package/dist/chunk-NP6EZT44.js.map +1 -0
  53. package/dist/{chunk-ZBBW7YQN.js → chunk-O53RIZCC.js} +5 -5
  54. package/dist/chunk-OPDTLHFA.js +783 -0
  55. package/dist/chunk-OPDTLHFA.js.map +1 -0
  56. package/dist/{chunk-LSTBFLL2.js → chunk-P3Z5Y2TS.js} +2 -2
  57. package/dist/{chunk-QSOYKKMD.js → chunk-P4EDT5ZP.js} +2 -2
  58. package/dist/{chunk-PC6ZEDRL.js → chunk-RHQYVHFH.js} +2 -2
  59. package/dist/{chunk-3DGHRDCX.js → chunk-RRDWXNBQ.js} +3 -3
  60. package/dist/{chunk-6MFH4BMK.js → chunk-SJJQKNMP.js} +4 -4
  61. package/dist/{chunk-EBVBE7UK.js → chunk-SZ4N3IL5.js} +5 -5
  62. package/dist/{chunk-MPOLUAMI.js → chunk-TMHJEYW7.js} +497 -57
  63. package/dist/chunk-TMHJEYW7.js.map +1 -0
  64. package/dist/{chunk-JQ4NEJJ6.js → chunk-UA6G45ME.js} +3 -3
  65. package/dist/{chunk-6YLPHBKR.js → chunk-UOC7JMZO.js} +13 -4
  66. package/dist/chunk-UOC7JMZO.js.map +1 -0
  67. package/dist/{chunk-DAP2XL7Q.js → chunk-VOXMU6LB.js} +2 -2
  68. package/dist/chunk-WNRGOVLG.js +64 -0
  69. package/dist/chunk-WNRGOVLG.js.map +1 -0
  70. package/dist/{chunk-YW5DBAPG.js → chunk-WUG3E423.js} +4 -4
  71. package/dist/{chunk-LJXYPGRH.js → chunk-XHM2SARW.js} +3 -3
  72. package/dist/{chunk-RC6SU5NO.js → chunk-XSIFXX54.js} +2 -2
  73. package/dist/{chunk-CXFOITNS.js → chunk-ZC7MNVYN.js} +2 -2
  74. package/dist/{chunk-6T2UDBKG.js → chunk-ZCFS7U4J.js} +2 -2
  75. package/dist/consent/index.cjs.map +1 -1
  76. package/dist/consent/index.d.cts +4 -4
  77. package/dist/consent/index.d.ts +4 -4
  78. package/dist/consent/index.js +3 -3
  79. package/dist/{crypto-2CRLG4F4.js → crypto-AJB72OKN.js} +3 -3
  80. package/dist/{delegation-ZTRT2PRV.js → delegation-6FCWDRUS.js} +5 -5
  81. package/dist/derivations/index.cjs.map +1 -1
  82. package/dist/derivations/index.d.cts +5 -5
  83. package/dist/derivations/index.d.ts +5 -5
  84. package/dist/derivations/index.js +4 -4
  85. package/dist/{dev-unlock-BH6y3Hx0.d.ts → dev-unlock-D3mpVFRc.d.ts} +1 -1
  86. package/dist/{dev-unlock-H1Xwxc3U.d.cts → dev-unlock-ckqa_Nso.d.cts} +1 -1
  87. package/dist/executor-7KSCEIFA.js +8 -0
  88. package/dist/executor-D2QMNGRJ.js +8 -0
  89. package/dist/executor-O5AZK7UW.js +11 -0
  90. package/dist/{fanout-sidecar-F3ZRFU4H.js → fanout-sidecar-ZSKEQ6NI.js} +2 -2
  91. package/dist/guards/index.cjs +53 -1
  92. package/dist/guards/index.cjs.map +1 -1
  93. package/dist/guards/index.d.cts +12 -6
  94. package/dist/guards/index.d.ts +12 -6
  95. package/dist/guards/index.js +5 -3
  96. package/dist/{hash-D89JdDbj.d.ts → hash-CTZVkXLx.d.ts} +1 -1
  97. package/dist/{hash-_sDFvtmX.d.cts → hash-rDSSd_oW.d.cts} +1 -1
  98. package/dist/history/index.cjs.map +1 -1
  99. package/dist/history/index.d.cts +5 -5
  100. package/dist/history/index.d.ts +5 -5
  101. package/dist/history/index.js +5 -5
  102. package/dist/i18n/index.cjs.map +1 -1
  103. package/dist/i18n/index.d.cts +4 -4
  104. package/dist/i18n/index.d.ts +4 -4
  105. package/dist/i18n/index.js +6 -6
  106. package/dist/immutable-guard-C51vAHuh.d.cts +67 -0
  107. package/dist/immutable-guard-DyD0qg2k.d.ts +67 -0
  108. package/dist/index-CkFHr4OP.d.ts +1190 -0
  109. package/dist/index-Cmop06zJ.d.cts +1190 -0
  110. package/dist/index.cjs +1620 -58
  111. package/dist/index.cjs.map +1 -1
  112. package/dist/index.d.cts +46 -13
  113. package/dist/index.d.ts +46 -13
  114. package/dist/index.js +76 -44
  115. package/dist/index.js.map +1 -1
  116. package/dist/indexing/index.cjs.map +1 -1
  117. package/dist/indexing/index.js +2 -2
  118. package/dist/issue-YIYG4OW5.js +12 -0
  119. package/dist/{ledger-NYCGJX2D.js → ledger-5JMVF7PY.js} +5 -5
  120. package/dist/materialized-views/index.cjs.map +1 -1
  121. package/dist/materialized-views/index.d.cts +5 -6
  122. package/dist/materialized-views/index.d.ts +5 -6
  123. package/dist/materialized-views/index.js +6 -6
  124. package/dist/noydb-D5SLAJ6V.js +34 -0
  125. package/dist/overlay-views/index.cjs.map +1 -1
  126. package/dist/overlay-views/index.d.cts +5 -5
  127. package/dist/overlay-views/index.d.ts +5 -5
  128. package/dist/overlay-views/index.js +4 -4
  129. package/dist/periods/index.cjs.map +1 -1
  130. package/dist/periods/index.d.cts +4 -4
  131. package/dist/periods/index.d.ts +4 -4
  132. package/dist/periods/index.js +5 -5
  133. package/dist/{public-envelope-QOXZEHKH.js → public-envelope-PFLZI5MO.js} +4 -4
  134. package/dist/query/index.cjs +293 -10
  135. package/dist/query/index.cjs.map +1 -1
  136. package/dist/query/index.d.cts +2 -2
  137. package/dist/query/index.d.ts +2 -2
  138. package/dist/query/index.js +4 -4
  139. package/dist/registry-BVQ5ITMF.js +8 -0
  140. package/dist/registry-JLP3QOLD.js +8 -0
  141. package/dist/{registry-ST2VNFZC.js → registry-NCY445U5.js} +3 -3
  142. package/dist/{revoke-RT7QYB4G.js → revoke-7RLGQWZ7.js} +6 -6
  143. package/dist/session/index.cjs.map +1 -1
  144. package/dist/session/index.d.cts +5 -5
  145. package/dist/session/index.d.ts +5 -5
  146. package/dist/session/index.js +3 -3
  147. package/dist/shadow/index.cjs.map +1 -1
  148. package/dist/shadow/index.d.cts +4 -4
  149. package/dist/shadow/index.d.ts +4 -4
  150. package/dist/shadow/index.js +2 -2
  151. package/dist/{signer-QNU66JF5.js → signer-6JF44I4A.js} +5 -5
  152. package/dist/snapshots/index.cjs.map +1 -1
  153. package/dist/snapshots/index.d.cts +4 -4
  154. package/dist/snapshots/index.d.ts +4 -4
  155. package/dist/snapshots/index.js +4 -4
  156. package/dist/{stale-VKXSXJF4.js → stale-UBLP3RJ3.js} +2 -2
  157. package/dist/store/index.cjs.map +1 -1
  158. package/dist/store/index.d.cts +4 -4
  159. package/dist/store/index.d.ts +4 -4
  160. package/dist/store/index.js +2 -2
  161. package/dist/strategy-rtpKDfTC.d.cts +2029 -0
  162. package/dist/strategy-rtpKDfTC.d.ts +2029 -0
  163. package/dist/sync/index.cjs.map +1 -1
  164. package/dist/sync/index.d.cts +3 -3
  165. package/dist/sync/index.d.ts +3 -3
  166. package/dist/sync/index.js +4 -4
  167. package/dist/team/index.cjs.map +1 -1
  168. package/dist/team/index.d.cts +4 -4
  169. package/dist/team/index.d.ts +4 -4
  170. package/dist/team/index.js +8 -8
  171. package/dist/tx/index.cjs +8 -1
  172. package/dist/tx/index.cjs.map +1 -1
  173. package/dist/tx/index.d.cts +4 -4
  174. package/dist/tx/index.d.ts +4 -4
  175. package/dist/tx/index.js +3 -3
  176. package/dist/{types-DiSXn3a4.d.cts → types-BGwjsDef.d.cts} +511 -6
  177. package/dist/{types-CD8mc8zR.d.ts → types-DRdfwgTG.d.ts} +511 -6
  178. package/dist/{ulid-DQ1hcJvZ.d.cts → ulid-D4d0Xto3.d.cts} +1 -1
  179. package/dist/{ulid-8p83wbR4.d.ts → ulid-DOTPZ5_h.d.ts} +1 -1
  180. package/dist/util/index.cjs.map +1 -1
  181. package/dist/util/index.js +1 -1
  182. package/dist/vault-group-Z4KB75ZH.js +450 -0
  183. package/dist/vault-group-Z4KB75ZH.js.map +1 -0
  184. package/dist/{with-derivation-DWMTpgEH.d.ts → with-derivation-B082Y_WQ.d.ts} +1 -1
  185. package/dist/{with-derivation-CVT7-dUt.d.cts → with-derivation-CB1EdcFF.d.cts} +1 -1
  186. package/dist/{with-materialized-view-BTTU3BNK.d.cts → with-materialized-view-CzRg1Dpr.d.cts} +1 -1
  187. package/dist/{with-materialized-view-X0CoL8-L.d.ts → with-materialized-view-Dw4SwjKl.d.ts} +1 -1
  188. package/dist/{with-overlayed-view-DcacRRsS.d.cts → with-overlayed-view-C9YFKXzn.d.cts} +1 -1
  189. package/dist/{with-overlayed-view-DQjO_DSG.d.ts → with-overlayed-view-CaCXeW26.d.ts} +1 -1
  190. package/package.json +3 -3
  191. package/dist/chunk-2LPPNWF6.js +0 -340
  192. package/dist/chunk-2LPPNWF6.js.map +0 -1
  193. package/dist/chunk-6YLPHBKR.js.map +0 -1
  194. package/dist/chunk-77DWLQRY.js.map +0 -1
  195. package/dist/chunk-C3WE6UJY.js +0 -19
  196. package/dist/chunk-C3WE6UJY.js.map +0 -1
  197. package/dist/chunk-CXJG63MA.js.map +0 -1
  198. package/dist/chunk-MPOLUAMI.js.map +0 -1
  199. package/dist/chunk-O6EJ6WTI.js.map +0 -1
  200. package/dist/chunk-PVUUIWHY.js.map +0 -1
  201. package/dist/chunk-SLV4LAKX.js.map +0 -1
  202. package/dist/executor-S76VN45G.js +0 -8
  203. package/dist/executor-UCXLIGLW.js +0 -11
  204. package/dist/executor-ZCNZJMGR.js +0 -8
  205. package/dist/index-B8bjExET.d.cts +0 -2434
  206. package/dist/index-DfUbNad8.d.ts +0 -2434
  207. package/dist/issue-IVTVSKWW.js +0 -12
  208. package/dist/noydb-SH4RLE47.js +0 -34
  209. package/dist/registry-UFIK7CSR.js +0 -8
  210. package/dist/registry-ZGYYSM5I.js +0 -8
  211. package/dist/strategy-CT2LCKAX.d.cts +0 -613
  212. package/dist/strategy-CT2LCKAX.d.ts +0 -613
  213. package/dist/with-guard-BRvt53da.d.ts +0 -18
  214. package/dist/with-guard-Dx2zZnTA.d.cts +0 -18
  215. /package/dist/{chunk-7CEGU63S.js.map → chunk-4BHFNKTP.js.map} +0 -0
  216. /package/dist/{chunk-5OEJ6GOT.js.map → chunk-5ARRXIVR.js.map} +0 -0
  217. /package/dist/{chunk-YM7LFCG7.js.map → chunk-6BYBVRZU.js.map} +0 -0
  218. /package/dist/{chunk-73YLDCNF.js.map → chunk-7JJE3OMJ.js.map} +0 -0
  219. /package/dist/{chunk-GKI4SDP7.js.map → chunk-7LVRIW4G.js.map} +0 -0
  220. /package/dist/{chunk-IMYKDWB4.js.map → chunk-B7GGYNKQ.js.map} +0 -0
  221. /package/dist/{chunk-BDV7INMP.js.map → chunk-BXOUVUES.js.map} +0 -0
  222. /package/dist/{chunk-FO3UEG4S.js.map → chunk-C2CIIQRG.js.map} +0 -0
  223. /package/dist/{chunk-ZROPXHJY.js.map → chunk-CHBXWJZQ.js.map} +0 -0
  224. /package/dist/{chunk-RYIL3PI2.js.map → chunk-CILT6V3V.js.map} +0 -0
  225. /package/dist/{chunk-YVZRTCGG.js.map → chunk-DLTU4M2I.js.map} +0 -0
  226. /package/dist/{chunk-GAUEWM7D.js.map → chunk-EKNUBIIQ.js.map} +0 -0
  227. /package/dist/{chunk-QCXNMCHN.js.map → chunk-GFPR7VJS.js.map} +0 -0
  228. /package/dist/{chunk-V2PZC6AW.js.map → chunk-HBAJDI2N.js.map} +0 -0
  229. /package/dist/{chunk-RRNA5GKT.js.map → chunk-IEPT7HVP.js.map} +0 -0
  230. /package/dist/{chunk-R233SLY3.js.map → chunk-IUBHXEPJ.js.map} +0 -0
  231. /package/dist/{chunk-CH22FZHT.js.map → chunk-L6BYRCYB.js.map} +0 -0
  232. /package/dist/{chunk-PC3ZZBTO.js.map → chunk-LOA2VCMS.js.map} +0 -0
  233. /package/dist/{chunk-TGALXXLV.js.map → chunk-LSEW3ZZ2.js.map} +0 -0
  234. /package/dist/{chunk-Y26YV5R3.js.map → chunk-LWSD4QPT.js.map} +0 -0
  235. /package/dist/{chunk-26NK23DZ.js.map → chunk-M45IRXDM.js.map} +0 -0
  236. /package/dist/{chunk-ZBBW7YQN.js.map → chunk-O53RIZCC.js.map} +0 -0
  237. /package/dist/{chunk-LSTBFLL2.js.map → chunk-P3Z5Y2TS.js.map} +0 -0
  238. /package/dist/{chunk-QSOYKKMD.js.map → chunk-P4EDT5ZP.js.map} +0 -0
  239. /package/dist/{chunk-PC6ZEDRL.js.map → chunk-RHQYVHFH.js.map} +0 -0
  240. /package/dist/{chunk-3DGHRDCX.js.map → chunk-RRDWXNBQ.js.map} +0 -0
  241. /package/dist/{chunk-6MFH4BMK.js.map → chunk-SJJQKNMP.js.map} +0 -0
  242. /package/dist/{chunk-EBVBE7UK.js.map → chunk-SZ4N3IL5.js.map} +0 -0
  243. /package/dist/{chunk-JQ4NEJJ6.js.map → chunk-UA6G45ME.js.map} +0 -0
  244. /package/dist/{chunk-DAP2XL7Q.js.map → chunk-VOXMU6LB.js.map} +0 -0
  245. /package/dist/{chunk-YW5DBAPG.js.map → chunk-WUG3E423.js.map} +0 -0
  246. /package/dist/{chunk-LJXYPGRH.js.map → chunk-XHM2SARW.js.map} +0 -0
  247. /package/dist/{chunk-RC6SU5NO.js.map → chunk-XSIFXX54.js.map} +0 -0
  248. /package/dist/{chunk-CXFOITNS.js.map → chunk-ZC7MNVYN.js.map} +0 -0
  249. /package/dist/{chunk-6T2UDBKG.js.map → chunk-ZCFS7U4J.js.map} +0 -0
  250. /package/dist/{crypto-2CRLG4F4.js.map → crypto-AJB72OKN.js.map} +0 -0
  251. /package/dist/{delegation-ZTRT2PRV.js.map → delegation-6FCWDRUS.js.map} +0 -0
  252. /package/dist/{executor-S76VN45G.js.map → executor-7KSCEIFA.js.map} +0 -0
  253. /package/dist/{executor-UCXLIGLW.js.map → executor-D2QMNGRJ.js.map} +0 -0
  254. /package/dist/{executor-ZCNZJMGR.js.map → executor-O5AZK7UW.js.map} +0 -0
  255. /package/dist/{fanout-sidecar-F3ZRFU4H.js.map → fanout-sidecar-ZSKEQ6NI.js.map} +0 -0
  256. /package/dist/{issue-IVTVSKWW.js.map → issue-YIYG4OW5.js.map} +0 -0
  257. /package/dist/{ledger-NYCGJX2D.js.map → ledger-5JMVF7PY.js.map} +0 -0
  258. /package/dist/{noydb-SH4RLE47.js.map → noydb-D5SLAJ6V.js.map} +0 -0
  259. /package/dist/{public-envelope-QOXZEHKH.js.map → public-envelope-PFLZI5MO.js.map} +0 -0
  260. /package/dist/{registry-ST2VNFZC.js.map → registry-BVQ5ITMF.js.map} +0 -0
  261. /package/dist/{registry-UFIK7CSR.js.map → registry-JLP3QOLD.js.map} +0 -0
  262. /package/dist/{registry-ZGYYSM5I.js.map → registry-NCY445U5.js.map} +0 -0
  263. /package/dist/{revoke-RT7QYB4G.js.map → revoke-7RLGQWZ7.js.map} +0 -0
  264. /package/dist/{signer-QNU66JF5.js.map → signer-6JF44I4A.js.map} +0 -0
  265. /package/dist/{stale-VKXSXJF4.js.map → stale-UBLP3RJ3.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-BGwjsDef.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-BGwjsDef.cjs';
3
3
  import '../lazy-builder-Ci5_YG73.cjs';
4
4
  import '../predicate-Bt5ft-9c.cjs';
5
- import '../strategy-CT2LCKAX.cjs';
5
+ import '../strategy-rtpKDfTC.cjs';
6
6
  import '../strategy-BSxFXGzb.cjs';
7
- import '../index-B8bjExET.cjs';
7
+ import '../index-Cmop06zJ.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-DRdfwgTG.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-DRdfwgTG.js';
3
3
  import '../lazy-builder-D5GU14TS.js';
4
4
  import '../predicate-Bt5ft-9c.js';
5
- import '../strategy-CT2LCKAX.js';
5
+ import '../strategy-rtpKDfTC.js';
6
6
  import '../strategy-BSxFXGzb.js';
7
- import '../index-DfUbNad8.js';
7
+ import '../index-CkFHr4OP.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-RRDWXNBQ.js";
10
10
  import "../chunk-UF3BUNQZ.js";
11
- import "../chunk-6MFH4BMK.js";
11
+ import "../chunk-SJJQKNMP.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-LYNNZEQD.js";
14
+ import "../chunk-IUBHXEPJ.js";
15
+ import "../chunk-AGRC7NQQ.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-UA6G45ME.js";
16
+ import "./chunk-LYNNZEQD.js";
17
+ import "./chunk-AGRC7NQQ.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-PFLZI5MO.js.map
@@ -501,6 +501,263 @@ 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
+
504
761
  // src/query/builder.ts
505
762
  var EMPTY_PLAN = {
506
763
  clauses: [],
@@ -947,6 +1204,10 @@ var Query = class _Query {
947
1204
  * partition boundaries without an API break.
948
1205
  */
949
1206
  aggregate(spec) {
1207
+ const moneyFields = this.source.moneyFields;
1208
+ if (moneyFields) {
1209
+ spec = wrapMoneyReducers(spec, moneyFields);
1210
+ }
950
1211
  const source = this.source;
951
1212
  const clauses = this.plan.clauses;
952
1213
  const joinCtx = this.joinContext;
@@ -994,13 +1255,15 @@ var Query = class _Query {
994
1255
  executeRecords,
995
1256
  field,
996
1257
  upstreams,
997
- dictLabelResolver
1258
+ dictLabelResolver,
1259
+ this.source.moneyFields
998
1260
  );
999
1261
  }
1000
1262
  return this.aggregateStrategy.groupByN(
1001
1263
  executeRecords,
1002
1264
  fields,
1003
- upstreams
1265
+ upstreams,
1266
+ this.source.moneyFields
1004
1267
  );
1005
1268
  }
1006
1269
  /**
@@ -1536,7 +1799,8 @@ function count(opts) {
1536
1799
  init: () => 0,
1537
1800
  step: (state) => state + 1,
1538
1801
  remove: (state) => state - 1,
1539
- finalize: (state) => state
1802
+ finalize: (state) => state,
1803
+ merge: (a, b) => a + b
1540
1804
  };
1541
1805
  }
1542
1806
  function sum(field, opts) {
@@ -1545,10 +1809,15 @@ function sum(field, opts) {
1545
1809
  return {
1546
1810
  op: "sum",
1547
1811
  field,
1812
+ // Money-only metadata, read by `wrapMoneyReducers`. No effect on a
1813
+ // generic numeric sum.
1814
+ ...opts?.convertTo !== void 0 ? { convertTo: opts.convertTo } : {},
1815
+ ...opts?.fx !== void 0 ? { fx: opts.fx } : {},
1548
1816
  init: () => 0,
1549
1817
  step: (state, record) => state + readNumber(record, field),
1550
1818
  remove: (state, record) => state - readNumber(record, field),
1551
- finalize: (state) => state
1819
+ finalize: (state) => state,
1820
+ merge: (a, b) => a + b
1552
1821
  };
1553
1822
  }
1554
1823
  function avg(field, opts) {
@@ -1566,7 +1835,8 @@ function avg(field, opts) {
1566
1835
  sum: state.sum - readNumber(record, field),
1567
1836
  count: state.count - 1
1568
1837
  }),
1569
- finalize: (state) => state.count === 0 ? null : state.sum / state.count
1838
+ finalize: (state) => state.count === 0 ? null : state.sum / state.count,
1839
+ merge: (a, b) => ({ sum: a.sum + b.sum, count: a.count + b.count })
1570
1840
  };
1571
1841
  }
1572
1842
  function pushValue(state, value) {
@@ -1596,7 +1866,8 @@ function min(field, opts) {
1596
1866
  if (v < out) out = v;
1597
1867
  }
1598
1868
  return out;
1599
- }
1869
+ },
1870
+ merge: (a, b) => ({ values: [...a.values, ...b.values] })
1600
1871
  };
1601
1872
  }
1602
1873
  function max(field, opts) {
@@ -1616,11 +1887,17 @@ function max(field, opts) {
1616
1887
  if (v > out) out = v;
1617
1888
  }
1618
1889
  return out;
1619
- }
1890
+ },
1891
+ merge: (a, b) => ({ values: [...a.values, ...b.values] })
1620
1892
  };
1621
1893
  }
1622
1894
  function readNumber(record, field) {
1623
1895
  const value = readPath(record, field);
1896
+ if (typeof value === "object" && value !== null && "amount" in value && "currency" in value) {
1897
+ throw new Error(
1898
+ `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`
1899
+ );
1900
+ }
1624
1901
  return typeof value === "number" && Number.isFinite(value) ? value : 0;
1625
1902
  }
1626
1903
 
@@ -1776,15 +2053,17 @@ function resetGroupByWarnings() {
1776
2053
  warnedCardinalityFields.clear();
1777
2054
  }
1778
2055
  var GroupedQueryBase = class {
1779
- constructor(executeRecords, fieldOrFields, upstreams, dictLabelResolver) {
2056
+ constructor(executeRecords, fieldOrFields, upstreams, dictLabelResolver, moneyFields) {
1780
2057
  this.executeRecords = executeRecords;
1781
2058
  this.upstreams = upstreams;
1782
2059
  this.dictLabelResolver = dictLabelResolver;
2060
+ this.moneyFields = moneyFields;
1783
2061
  this.fields = typeof fieldOrFields === "string" ? [fieldOrFields] : [...fieldOrFields];
1784
2062
  }
1785
2063
  executeRecords;
1786
2064
  upstreams;
1787
2065
  dictLabelResolver;
2066
+ moneyFields;
1788
2067
  /**
1789
2068
  * Field set this grouped query buckets on. Stored in declaration
1790
2069
  * order — the same order is preserved on every result row by
@@ -1792,6 +2071,10 @@ var GroupedQueryBase = class {
1792
2071
  * `[field]`.
1793
2072
  */
1794
2073
  fields;
2074
+ /** Apply money-aware reducer rewriting when money fields are declared. */
2075
+ wrapSpec(spec) {
2076
+ return this.moneyFields ? wrapMoneyReducers(spec, this.moneyFields) : spec;
2077
+ }
1795
2078
  };
1796
2079
  var GroupedQuery = class extends GroupedQueryBase {
1797
2080
  /**
@@ -1804,7 +2087,7 @@ var GroupedQuery = class extends GroupedQueryBase {
1804
2087
  return new GroupedAggregation(
1805
2088
  this.executeRecords,
1806
2089
  this.fields,
1807
- spec,
2090
+ this.wrapSpec(spec),
1808
2091
  this.upstreams,
1809
2092
  this.dictLabelResolver
1810
2093
  );
@@ -1815,7 +2098,7 @@ var GroupedQueryN = class extends GroupedQueryBase {
1815
2098
  return new GroupedAggregation(
1816
2099
  this.executeRecords,
1817
2100
  this.fields,
1818
- spec,
2101
+ this.wrapSpec(spec),
1819
2102
  this.upstreams,
1820
2103
  this.dictLabelResolver
1821
2104
  );