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

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 (285) hide show
  1. package/dist/aggregate/index.cjs.map +1 -1
  2. package/dist/aggregate/index.d.cts +3 -3
  3. package/dist/aggregate/index.d.ts +3 -3
  4. package/dist/aggregate/index.js +5 -5
  5. package/dist/attestation/index.cjs.map +1 -1
  6. package/dist/attestation/index.d.cts +4 -4
  7. package/dist/attestation/index.d.ts +4 -4
  8. package/dist/attestation/index.js +6 -6
  9. package/dist/blobs/index.cjs.map +1 -1
  10. package/dist/blobs/index.d.cts +6 -6
  11. package/dist/blobs/index.d.ts +6 -6
  12. package/dist/blobs/index.js +6 -6
  13. package/dist/bundle/index.cjs +21173 -21341
  14. package/dist/bundle/index.cjs.map +1 -1
  15. package/dist/bundle/index.d.cts +15 -6
  16. package/dist/bundle/index.d.ts +15 -6
  17. package/dist/bundle/index.js +58 -193
  18. package/dist/bundle/index.js.map +1 -1
  19. package/dist/{chunk-CQYEDODS.js → chunk-35U5YNRR.js} +3 -3
  20. package/dist/{chunk-NV4IHBZS.js → chunk-3XJU3OHE.js} +5 -5
  21. package/dist/{chunk-OTWT6BAJ.js → chunk-4BB4T3O7.js} +12 -2
  22. package/dist/chunk-4BB4T3O7.js.map +1 -0
  23. package/dist/{chunk-IVZWHIEK.js → chunk-4HEGG5NJ.js} +5 -5
  24. package/dist/{chunk-WE2BUQD2.js → chunk-4TCMCCC3.js} +5 -3
  25. package/dist/{chunk-5YTXYPES.js → chunk-5A2FVGHT.js} +5 -5
  26. package/dist/{chunk-NSXNXLYM.js → chunk-5GZC2ZM3.js} +2 -2
  27. package/dist/{chunk-JYNH4FIM.js → chunk-77WF53XY.js} +4 -4
  28. package/dist/{chunk-O5XKZCUD.js → chunk-7X4EF35A.js} +5 -5
  29. package/dist/{chunk-SQKAECUL.js → chunk-7ZCTUI26.js} +2 -2
  30. package/dist/{chunk-J6RGRZOY.js → chunk-AO3QSMCU.js} +2 -2
  31. package/dist/{chunk-JDCPRJVS.js → chunk-AONK5GCC.js} +4 -4
  32. package/dist/{chunk-FRRJIUSI.js → chunk-B5CSNGSE.js} +17 -9
  33. package/dist/chunk-B5CSNGSE.js.map +1 -0
  34. package/dist/{chunk-IY24WS2P.js → chunk-BCMHJYVT.js} +4 -4
  35. package/dist/{chunk-IY24WS2P.js.map → chunk-BCMHJYVT.js.map} +1 -1
  36. package/dist/{chunk-TYMDCIQM.js → chunk-C472BRJ4.js} +4 -4
  37. package/dist/{chunk-MBXKRHSS.js → chunk-CCNRFAL3.js} +2 -2
  38. package/dist/{chunk-BZW5IL43.js → chunk-DCA2BDHA.js} +4 -4
  39. package/dist/{chunk-JBBWALNI.js → chunk-DCICHSRS.js} +2 -2
  40. package/dist/{chunk-2XA2ZML4.js → chunk-FG6IQ3ZL.js} +3 -3
  41. package/dist/{chunk-C2RJVZZL.js → chunk-G4GW5VOS.js} +2 -2
  42. package/dist/{chunk-U2XSUCDF.js → chunk-GEWIFM4J.js} +2 -2
  43. package/dist/{chunk-TNH5SLCD.js → chunk-HD4QCT2O.js} +2 -2
  44. package/dist/{chunk-I3IYTUUI.js → chunk-HHJ5DZCZ.js} +3 -3
  45. package/dist/{chunk-6QAZ5O6X.js → chunk-IEIADIPM.js} +2 -2
  46. package/dist/{chunk-YPIOFSN3.js → chunk-IHAISFXP.js} +2 -2
  47. package/dist/{chunk-GJTKMME7.js → chunk-JKM2AVVH.js} +2 -2
  48. package/dist/{chunk-EYK72OTL.js → chunk-JRMOSIH4.js} +5 -5
  49. package/dist/chunk-JRMOSIH4.js.map +1 -0
  50. package/dist/{chunk-S45MDEEF.js → chunk-LMWVNF6X.js} +2 -2
  51. package/dist/{chunk-TA6HPKWQ.js → chunk-LR7CODVN.js} +1 -1
  52. package/dist/chunk-LR7CODVN.js.map +1 -0
  53. package/dist/{chunk-TAMRU7A2.js → chunk-OKV7S356.js} +4 -4
  54. package/dist/{chunk-HYJMAV53.js → chunk-OWAMTSAI.js} +93 -93
  55. package/dist/chunk-OWAMTSAI.js.map +1 -0
  56. package/dist/{chunk-IW4L4X65.js → chunk-P5A4E53B.js} +2 -2
  57. package/dist/{chunk-JOK73NDT.js → chunk-P7OL22JP.js} +3 -3
  58. package/dist/{chunk-7PH4OPBZ.js → chunk-QOXZM3L2.js} +762 -134
  59. package/dist/chunk-QOXZM3L2.js.map +1 -0
  60. package/dist/chunk-R43KS34V.js +399 -0
  61. package/dist/chunk-R43KS34V.js.map +1 -0
  62. package/dist/{chunk-TGIJTNM3.js → chunk-R5ZECURV.js} +2 -2
  63. package/dist/{chunk-KOAJ3TZM.js → chunk-RFEXGW3L.js} +2 -2
  64. package/dist/{chunk-F5ILTHMU.js → chunk-RNQPDV75.js} +5 -5
  65. package/dist/{chunk-WWVJXBOT.js → chunk-SGM7CK7R.js} +5 -5
  66. package/dist/{chunk-7MRT7EPB.js → chunk-SOQE5DUV.js} +3 -3
  67. package/dist/{chunk-F5GWNSE2.js → chunk-TOMSCJRV.js} +3 -3
  68. package/dist/{chunk-F5GWNSE2.js.map → chunk-TOMSCJRV.js.map} +1 -1
  69. package/dist/{chunk-ZONKSLF2.js → chunk-TQMQZOMX.js} +2 -2
  70. package/dist/{chunk-3HNKR65T.js → chunk-U6LTLN7O.js} +3 -3
  71. package/dist/{chunk-UU6M64HI.js → chunk-UAK2AMO2.js} +4 -4
  72. package/dist/{chunk-37VGJM3T.js → chunk-WQ3KAGOV.js} +2 -2
  73. package/dist/{chunk-C6W5KVDV.js → chunk-XC32SZPW.js} +35 -35
  74. package/dist/chunk-XC32SZPW.js.map +1 -0
  75. package/dist/{chunk-AI4USDRI.js → chunk-XQO4TAJS.js} +4 -4
  76. package/dist/{chunk-SQOK5UM6.js → chunk-ZBENTRFS.js} +2 -2
  77. package/dist/{chunk-6QE4DUYC.js → chunk-ZDITTESU.js} +2 -2
  78. package/dist/consent/index.cjs.map +1 -1
  79. package/dist/consent/index.d.cts +5 -5
  80. package/dist/consent/index.d.ts +5 -5
  81. package/dist/consent/index.js +3 -3
  82. package/dist/{crypto-456N7UVX.js → crypto-2LU6XUFF.js} +3 -3
  83. package/dist/{delegation-DP4COTXB.js → delegation-6ABSJGXV.js} +5 -5
  84. package/dist/derivations/index.cjs.map +1 -1
  85. package/dist/derivations/index.d.cts +6 -6
  86. package/dist/derivations/index.d.ts +6 -6
  87. package/dist/derivations/index.js +4 -4
  88. package/dist/{dev-unlock-CpKSkl2c.d.ts → dev-unlock-BlhRHr6p.d.ts} +1 -1
  89. package/dist/{dev-unlock-CY0HIZA0.d.cts → dev-unlock-DURe4IvF.d.cts} +1 -1
  90. package/dist/{errors-Dkc_fi-S.d.cts → errors-B2tUcRPg.d.cts} +19 -5
  91. package/dist/{errors-Dkc_fi-S.d.ts → errors-B2tUcRPg.d.ts} +19 -5
  92. package/dist/executor-JKMSEB34.js +8 -0
  93. package/dist/executor-UYXSQB4D.js +12 -0
  94. package/dist/executor-VJSCTBWY.js +8 -0
  95. package/dist/{fanout-sidecar-YXNAEZ33.js → fanout-sidecar-ZQT4Y7PF.js} +2 -2
  96. package/dist/forget/index.js +4 -4
  97. package/dist/guards/index.cjs.map +1 -1
  98. package/dist/guards/index.d.cts +6 -6
  99. package/dist/guards/index.d.ts +6 -6
  100. package/dist/guards/index.js +6 -6
  101. package/dist/{hash-BSd0-_L8.d.cts → hash-CqRZfDZH.d.cts} +1 -1
  102. package/dist/{hash-BnBQx39y.d.ts → hash-cF4iWaBV.d.ts} +1 -1
  103. package/dist/history/index.cjs.map +1 -1
  104. package/dist/history/index.d.cts +6 -6
  105. package/dist/history/index.d.ts +6 -6
  106. package/dist/history/index.js +5 -5
  107. package/dist/i18n/index.cjs.map +1 -1
  108. package/dist/i18n/index.d.cts +5 -5
  109. package/dist/i18n/index.d.ts +5 -5
  110. package/dist/i18n/index.js +6 -6
  111. package/dist/index-B8MoIS7B.d.ts +70 -0
  112. package/dist/{index-Bm9hIY7t.d.ts → index-BLff_E35.d.ts} +2 -2
  113. package/dist/{index-tZqVB9g5.d.cts → index-BthnP2MA.d.cts} +2 -2
  114. package/dist/index-da0M3NnR.d.cts +70 -0
  115. package/dist/index.cjs +25861 -25119
  116. package/dist/index.cjs.map +1 -1
  117. package/dist/index.d.cts +135 -80
  118. package/dist/index.d.ts +135 -80
  119. package/dist/index.js +93 -52
  120. package/dist/index.js.map +1 -1
  121. package/dist/indexing/index.cjs.map +1 -1
  122. package/dist/indexing/index.js +4 -4
  123. package/dist/issue-KLRMW5DH.js +12 -0
  124. package/dist/kernel/index.cjs +657 -0
  125. package/dist/kernel/index.cjs.map +1 -0
  126. package/dist/kernel/index.d.cts +11 -0
  127. package/dist/kernel/index.d.ts +11 -0
  128. package/dist/kernel/index.js +40 -0
  129. package/dist/{ledger-I7JUYP4L.js → ledger-VOS2X3WJ.js} +5 -5
  130. package/dist/materialized-views/index.cjs.map +1 -1
  131. package/dist/materialized-views/index.d.cts +6 -6
  132. package/dist/materialized-views/index.d.ts +6 -6
  133. package/dist/materialized-views/index.js +8 -8
  134. package/dist/{mime-magic-CjSyakO4.d.ts → mime-magic-BswIvWkR.d.ts} +1 -1
  135. package/dist/{mime-magic-BnJCGJzB.d.cts → mime-magic-CCrP-iXJ.d.cts} +1 -1
  136. package/dist/{ulid-B2L_aqVA.d.ts → multi-bundle-6s5nKAZX.d.ts} +114 -58
  137. package/dist/{ulid-LaxfH2tK.d.cts → multi-bundle-WhYiJEgV.d.cts} +114 -58
  138. package/dist/noydb-2PI2ZBX6.js +38 -0
  139. package/dist/overlay-views/index.cjs.map +1 -1
  140. package/dist/overlay-views/index.d.cts +6 -6
  141. package/dist/overlay-views/index.d.ts +6 -6
  142. package/dist/overlay-views/index.js +4 -4
  143. package/dist/periods/index.cjs.map +1 -1
  144. package/dist/periods/index.d.cts +5 -5
  145. package/dist/periods/index.d.ts +5 -5
  146. package/dist/periods/index.js +5 -5
  147. package/dist/{public-envelope-5XRTUNKF.js → public-envelope-IJJMWSTJ.js} +4 -4
  148. package/dist/query/index.cjs.map +1 -1
  149. package/dist/query/index.d.cts +3 -3
  150. package/dist/query/index.d.ts +3 -3
  151. package/dist/query/index.js +7 -7
  152. package/dist/registry-GAIFVWXF.js +8 -0
  153. package/dist/registry-J77ZUQ7G.js +8 -0
  154. package/dist/{registry-NWHOLD5M.js → registry-JGEVJ6YC.js} +3 -3
  155. package/dist/{revoke-5IEK22KT.js → revoke-WUY4AYRJ.js} +6 -6
  156. package/dist/sealed-record/index.cjs.map +1 -1
  157. package/dist/sealed-record/index.d.cts +1 -1
  158. package/dist/sealed-record/index.d.ts +1 -1
  159. package/dist/sealed-record/index.js +2 -2
  160. package/dist/session/index.cjs.map +1 -1
  161. package/dist/session/index.d.cts +6 -6
  162. package/dist/session/index.d.ts +6 -6
  163. package/dist/session/index.js +3 -3
  164. package/dist/shadow/index.cjs.map +1 -1
  165. package/dist/shadow/index.d.cts +5 -5
  166. package/dist/shadow/index.d.ts +5 -5
  167. package/dist/shadow/index.js +2 -2
  168. package/dist/{signer-I6YARZQA.js → signer-UJF3CFDC.js} +5 -5
  169. package/dist/snapshots/index.cjs.map +1 -1
  170. package/dist/snapshots/index.d.cts +5 -5
  171. package/dist/snapshots/index.d.ts +5 -5
  172. package/dist/snapshots/index.js +4 -4
  173. package/dist/{stale-CPESGAPL.js → stale-PW6VBGSP.js} +2 -2
  174. package/dist/store/index.cjs.map +1 -1
  175. package/dist/store/index.d.cts +5 -5
  176. package/dist/store/index.d.ts +5 -5
  177. package/dist/store/index.js +2 -2
  178. package/dist/{strategy-WtB-jXYv.d.cts → strategy-BWmgRPA2.d.cts} +1 -1
  179. package/dist/{strategy-54eIwox5.d.ts → strategy-D47TC5X6.d.ts} +1 -1
  180. package/dist/sync/index.cjs.map +1 -1
  181. package/dist/sync/index.d.cts +4 -4
  182. package/dist/sync/index.d.ts +4 -4
  183. package/dist/sync/index.js +4 -4
  184. package/dist/team/index.cjs +10 -3
  185. package/dist/team/index.cjs.map +1 -1
  186. package/dist/team/index.d.cts +5 -5
  187. package/dist/team/index.d.ts +5 -5
  188. package/dist/team/index.js +8 -8
  189. package/dist/{transition-guard-Dmpqzg-_.d.cts → transition-guard-C3NxfVKk.d.cts} +1 -1
  190. package/dist/{transition-guard-D4bfIAiW.d.ts → transition-guard-CQH5263l.d.ts} +1 -1
  191. package/dist/tx/index.cjs +1 -1
  192. package/dist/tx/index.cjs.map +1 -1
  193. package/dist/tx/index.d.cts +5 -5
  194. package/dist/tx/index.d.ts +5 -5
  195. package/dist/tx/index.js +3 -3
  196. package/dist/{types-DLfWFr6U.d.ts → types-BGRX6sPT.d.ts} +546 -580
  197. package/dist/{types-DyOI6XZ_.d.cts → types-COQ6qJZh.d.cts} +546 -580
  198. package/dist/ulid-DRH25k3y.d.cts +66 -0
  199. package/dist/ulid-DRH25k3y.d.ts +66 -0
  200. package/dist/util/index.cjs.map +1 -1
  201. package/dist/util/index.js +1 -1
  202. package/dist/{with-materialized-view-DNULSxoP.d.ts → with-materialized-view-Cj-6fuav.d.ts} +1 -1
  203. package/dist/{with-materialized-view-CeZYGJVf.d.cts → with-materialized-view-D4U-KrBH.d.cts} +1 -1
  204. package/dist/{with-overlayed-view-kdcPGHih.d.cts → with-overlayed-view-BKjdUPRx.d.cts} +1 -1
  205. package/dist/{with-overlayed-view-C9joG7UZ.d.ts → with-overlayed-view-COp_7EEy.d.ts} +1 -1
  206. package/dist/{with-rollup-DJDbrxjf.d.ts → with-rollup-B1_ZjG02.d.ts} +1 -1
  207. package/dist/{with-rollup-s58XAeWO.d.cts → with-rollup-C-Bok_o2.d.cts} +1 -1
  208. package/package.json +13 -3
  209. package/dist/chunk-7PH4OPBZ.js.map +0 -1
  210. package/dist/chunk-C6W5KVDV.js.map +0 -1
  211. package/dist/chunk-EYK72OTL.js.map +0 -1
  212. package/dist/chunk-FRRJIUSI.js.map +0 -1
  213. package/dist/chunk-HYJMAV53.js.map +0 -1
  214. package/dist/chunk-JTI57WRT.js +0 -164
  215. package/dist/chunk-JTI57WRT.js.map +0 -1
  216. package/dist/chunk-OTWT6BAJ.js.map +0 -1
  217. package/dist/chunk-TA6HPKWQ.js.map +0 -1
  218. package/dist/chunk-ZC7J6ZYV.js +0 -7
  219. package/dist/chunk-ZC7J6ZYV.js.map +0 -1
  220. package/dist/executor-4IEW4KG5.js +0 -8
  221. package/dist/executor-KYJCJCIN.js +0 -12
  222. package/dist/executor-W7VIBOBZ.js +0 -8
  223. package/dist/issue-JXC6T2QR.js +0 -12
  224. package/dist/noydb-ZZCRF6TE.js +0 -38
  225. package/dist/registry-ATRHOG5B.js +0 -8
  226. package/dist/registry-LEHB26TY.js +0 -8
  227. package/dist/state-vault-JR3CFGNP.js +0 -14
  228. package/dist/vault-group-BB246VIM.js +0 -804
  229. package/dist/vault-group-BB246VIM.js.map +0 -1
  230. /package/dist/{chunk-CQYEDODS.js.map → chunk-35U5YNRR.js.map} +0 -0
  231. /package/dist/{chunk-NV4IHBZS.js.map → chunk-3XJU3OHE.js.map} +0 -0
  232. /package/dist/{chunk-IVZWHIEK.js.map → chunk-4HEGG5NJ.js.map} +0 -0
  233. /package/dist/{chunk-WE2BUQD2.js.map → chunk-4TCMCCC3.js.map} +0 -0
  234. /package/dist/{chunk-5YTXYPES.js.map → chunk-5A2FVGHT.js.map} +0 -0
  235. /package/dist/{chunk-NSXNXLYM.js.map → chunk-5GZC2ZM3.js.map} +0 -0
  236. /package/dist/{chunk-JYNH4FIM.js.map → chunk-77WF53XY.js.map} +0 -0
  237. /package/dist/{chunk-O5XKZCUD.js.map → chunk-7X4EF35A.js.map} +0 -0
  238. /package/dist/{chunk-SQKAECUL.js.map → chunk-7ZCTUI26.js.map} +0 -0
  239. /package/dist/{chunk-J6RGRZOY.js.map → chunk-AO3QSMCU.js.map} +0 -0
  240. /package/dist/{chunk-JDCPRJVS.js.map → chunk-AONK5GCC.js.map} +0 -0
  241. /package/dist/{chunk-TYMDCIQM.js.map → chunk-C472BRJ4.js.map} +0 -0
  242. /package/dist/{chunk-MBXKRHSS.js.map → chunk-CCNRFAL3.js.map} +0 -0
  243. /package/dist/{chunk-BZW5IL43.js.map → chunk-DCA2BDHA.js.map} +0 -0
  244. /package/dist/{chunk-JBBWALNI.js.map → chunk-DCICHSRS.js.map} +0 -0
  245. /package/dist/{chunk-2XA2ZML4.js.map → chunk-FG6IQ3ZL.js.map} +0 -0
  246. /package/dist/{chunk-C2RJVZZL.js.map → chunk-G4GW5VOS.js.map} +0 -0
  247. /package/dist/{chunk-U2XSUCDF.js.map → chunk-GEWIFM4J.js.map} +0 -0
  248. /package/dist/{chunk-TNH5SLCD.js.map → chunk-HD4QCT2O.js.map} +0 -0
  249. /package/dist/{chunk-I3IYTUUI.js.map → chunk-HHJ5DZCZ.js.map} +0 -0
  250. /package/dist/{chunk-6QAZ5O6X.js.map → chunk-IEIADIPM.js.map} +0 -0
  251. /package/dist/{chunk-YPIOFSN3.js.map → chunk-IHAISFXP.js.map} +0 -0
  252. /package/dist/{chunk-GJTKMME7.js.map → chunk-JKM2AVVH.js.map} +0 -0
  253. /package/dist/{chunk-S45MDEEF.js.map → chunk-LMWVNF6X.js.map} +0 -0
  254. /package/dist/{chunk-TAMRU7A2.js.map → chunk-OKV7S356.js.map} +0 -0
  255. /package/dist/{chunk-IW4L4X65.js.map → chunk-P5A4E53B.js.map} +0 -0
  256. /package/dist/{chunk-JOK73NDT.js.map → chunk-P7OL22JP.js.map} +0 -0
  257. /package/dist/{chunk-TGIJTNM3.js.map → chunk-R5ZECURV.js.map} +0 -0
  258. /package/dist/{chunk-KOAJ3TZM.js.map → chunk-RFEXGW3L.js.map} +0 -0
  259. /package/dist/{chunk-F5ILTHMU.js.map → chunk-RNQPDV75.js.map} +0 -0
  260. /package/dist/{chunk-WWVJXBOT.js.map → chunk-SGM7CK7R.js.map} +0 -0
  261. /package/dist/{chunk-7MRT7EPB.js.map → chunk-SOQE5DUV.js.map} +0 -0
  262. /package/dist/{chunk-ZONKSLF2.js.map → chunk-TQMQZOMX.js.map} +0 -0
  263. /package/dist/{chunk-3HNKR65T.js.map → chunk-U6LTLN7O.js.map} +0 -0
  264. /package/dist/{chunk-UU6M64HI.js.map → chunk-UAK2AMO2.js.map} +0 -0
  265. /package/dist/{chunk-37VGJM3T.js.map → chunk-WQ3KAGOV.js.map} +0 -0
  266. /package/dist/{chunk-AI4USDRI.js.map → chunk-XQO4TAJS.js.map} +0 -0
  267. /package/dist/{chunk-SQOK5UM6.js.map → chunk-ZBENTRFS.js.map} +0 -0
  268. /package/dist/{chunk-6QE4DUYC.js.map → chunk-ZDITTESU.js.map} +0 -0
  269. /package/dist/{crypto-456N7UVX.js.map → crypto-2LU6XUFF.js.map} +0 -0
  270. /package/dist/{delegation-DP4COTXB.js.map → delegation-6ABSJGXV.js.map} +0 -0
  271. /package/dist/{executor-4IEW4KG5.js.map → executor-JKMSEB34.js.map} +0 -0
  272. /package/dist/{executor-KYJCJCIN.js.map → executor-UYXSQB4D.js.map} +0 -0
  273. /package/dist/{executor-W7VIBOBZ.js.map → executor-VJSCTBWY.js.map} +0 -0
  274. /package/dist/{fanout-sidecar-YXNAEZ33.js.map → fanout-sidecar-ZQT4Y7PF.js.map} +0 -0
  275. /package/dist/{issue-JXC6T2QR.js.map → issue-KLRMW5DH.js.map} +0 -0
  276. /package/dist/{ledger-I7JUYP4L.js.map → kernel/index.js.map} +0 -0
  277. /package/dist/{noydb-ZZCRF6TE.js.map → ledger-VOS2X3WJ.js.map} +0 -0
  278. /package/dist/{public-envelope-5XRTUNKF.js.map → noydb-2PI2ZBX6.js.map} +0 -0
  279. /package/dist/{registry-ATRHOG5B.js.map → public-envelope-IJJMWSTJ.js.map} +0 -0
  280. /package/dist/{registry-LEHB26TY.js.map → registry-GAIFVWXF.js.map} +0 -0
  281. /package/dist/{registry-NWHOLD5M.js.map → registry-J77ZUQ7G.js.map} +0 -0
  282. /package/dist/{revoke-5IEK22KT.js.map → registry-JGEVJ6YC.js.map} +0 -0
  283. /package/dist/{signer-I6YARZQA.js.map → revoke-WUY4AYRJ.js.map} +0 -0
  284. /package/dist/{stale-CPESGAPL.js.map → signer-UJF3CFDC.js.map} +0 -0
  285. /package/dist/{state-vault-JR3CFGNP.js.map → stale-PW6VBGSP.js.map} +0 -0
@@ -7,12 +7,12 @@ import {
7
7
  decodeIdxId,
8
8
  encodeIdxId,
9
9
  isIdxId
10
- } from "../chunk-3HNKR65T.js";
10
+ } from "../chunk-U6LTLN7O.js";
11
11
  import {
12
12
  CollectionIndexes
13
- } from "../chunk-GJTKMME7.js";
14
- import "../chunk-U2XSUCDF.js";
15
- import "../chunk-OTWT6BAJ.js";
13
+ } from "../chunk-JKM2AVVH.js";
14
+ import "../chunk-GEWIFM4J.js";
15
+ import "../chunk-4BB4T3O7.js";
16
16
 
17
17
  // src/indexing/active.ts
18
18
  function withIndexing() {
@@ -0,0 +1,12 @@
1
+ import {
2
+ issueAttestationCore
3
+ } from "./chunk-RNQPDV75.js";
4
+ import "./chunk-OKV7S356.js";
5
+ import "./chunk-FZU343FL.js";
6
+ import "./chunk-LR7CODVN.js";
7
+ import "./chunk-WQ3KAGOV.js";
8
+ import "./chunk-4BB4T3O7.js";
9
+ export {
10
+ issueAttestationCore
11
+ };
12
+ //# sourceMappingURL=issue-KLRMW5DH.js.map
@@ -0,0 +1,657 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/kernel/index.ts
21
+ var kernel_exports = {};
22
+ __export(kernel_exports, {
23
+ CrossShardJoinError: () => CrossShardJoinError,
24
+ DataResidencyError: () => DataResidencyError,
25
+ NoAccessError: () => NoAccessError,
26
+ ReservedVaultNameError: () => ReservedVaultNameError,
27
+ ShardProvisioningError: () => ShardProvisioningError,
28
+ UnknownShardError: () => UnknownShardError,
29
+ ValidationError: () => ValidationError,
30
+ VaultTemplateNotFoundError: () => VaultTemplateNotFoundError,
31
+ generateULID: () => generateULID,
32
+ groupAndReduce: () => groupAndReduce,
33
+ readPath: () => readPath,
34
+ reduceRecords: () => reduceRecords,
35
+ sha256Hex: () => sha256Hex
36
+ });
37
+ module.exports = __toCommonJS(kernel_exports);
38
+
39
+ // src/money/fixed-point.ts
40
+ function expandExponent(s) {
41
+ const m = /^([+-]?)(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/.exec(s);
42
+ if (!m) return s;
43
+ const sign = m[1] === "-" ? "-" : "";
44
+ const intp = m[2];
45
+ const frac = m[3] ?? "";
46
+ const exp = Number(m[4]);
47
+ const digits = intp + frac;
48
+ const pointPos = intp.length + exp;
49
+ let body;
50
+ if (pointPos <= 0) {
51
+ body = "0." + "0".repeat(-pointPos) + digits;
52
+ } else if (pointPos >= digits.length) {
53
+ body = digits + "0".repeat(pointPos - digits.length);
54
+ } else {
55
+ body = digits.slice(0, pointPos) + "." + digits.slice(pointPos);
56
+ }
57
+ return sign + body;
58
+ }
59
+ function toCanonicalDecimalString(input) {
60
+ let s;
61
+ if (typeof input === "number") {
62
+ if (!Number.isFinite(input)) return null;
63
+ s = String(input);
64
+ } else {
65
+ s = input.trim();
66
+ }
67
+ s = expandExponent(s);
68
+ if (s.startsWith("+")) s = s.slice(1);
69
+ if (!/^-?(\d+(\.\d*)?|\.\d+)$/.test(s)) return null;
70
+ return s;
71
+ }
72
+ function shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, mode) {
73
+ switch (mode) {
74
+ case "up":
75
+ return true;
76
+ case "down":
77
+ return false;
78
+ case "ceil":
79
+ return !negative;
80
+ case "floor":
81
+ return negative;
82
+ case "half-up":
83
+ return firstDiscarded >= 5;
84
+ case "half-down":
85
+ return firstDiscarded > 5 || firstDiscarded === 5 && hasMoreNonZeroAfterFirst;
86
+ case "half-even":
87
+ if (firstDiscarded > 5) return true;
88
+ if (firstDiscarded < 5) return false;
89
+ return hasMoreNonZeroAfterFirst || lastKeptDigit % 2 === 1;
90
+ }
91
+ }
92
+ function parseToScaledInt(input, scale, rounding) {
93
+ const canonical = toCanonicalDecimalString(input);
94
+ if (canonical === null) return { ok: false, reason: "nonfinite" };
95
+ const negative = canonical.startsWith("-");
96
+ const unsigned = negative ? canonical.slice(1) : canonical;
97
+ const dot = unsigned.indexOf(".");
98
+ const intPart = dot === -1 ? unsigned : unsigned.slice(0, dot);
99
+ const fracPart = dot === -1 ? "" : unsigned.slice(dot + 1);
100
+ const intDigits = intPart === "" ? "0" : intPart;
101
+ if (fracPart.length <= scale) {
102
+ const keep2 = fracPart.padEnd(scale, "0");
103
+ const magnitude2 = BigInt(intDigits + keep2);
104
+ return { ok: true, value: negative && magnitude2 !== 0n ? -magnitude2 : magnitude2 };
105
+ }
106
+ const keep = fracPart.slice(0, scale);
107
+ const tail = fracPart.slice(scale);
108
+ const magnitudeDigits = intDigits + keep;
109
+ let magnitude = BigInt(magnitudeDigits);
110
+ if (/^0+$/.test(tail)) {
111
+ return { ok: true, value: negative && magnitude !== 0n ? -magnitude : magnitude };
112
+ }
113
+ if (rounding === void 0) return { ok: false, reason: "precision" };
114
+ const lastKeptDigit = Number(magnitudeDigits[magnitudeDigits.length - 1]);
115
+ const firstDiscarded = Number(tail[0]);
116
+ const hasMoreNonZeroAfterFirst = /[1-9]/.test(tail.slice(1));
117
+ if (shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, rounding)) {
118
+ magnitude += 1n;
119
+ }
120
+ return { ok: true, value: negative && magnitude !== 0n ? -magnitude : magnitude };
121
+ }
122
+ function formatScaledInt(value, scale) {
123
+ const negative = value < 0n;
124
+ const abs = (negative ? -value : value).toString();
125
+ if (scale === 0) return (negative ? "-" : "") + abs;
126
+ const padded = abs.padStart(scale + 1, "0");
127
+ const cut = padded.length - scale;
128
+ const intPart = padded.slice(0, cut);
129
+ const fracPart = padded.slice(cut);
130
+ return (negative ? "-" : "") + intPart + "." + fracPart;
131
+ }
132
+
133
+ // src/money/iso4217.ts
134
+ var MINOR_UNITS = {
135
+ // 2-decimal majors
136
+ EUR: 2,
137
+ USD: 2,
138
+ GBP: 2,
139
+ CHF: 2,
140
+ CAD: 2,
141
+ AUD: 2,
142
+ NZD: 2,
143
+ SGD: 2,
144
+ HKD: 2,
145
+ CNY: 2,
146
+ INR: 2,
147
+ BRL: 2,
148
+ MXN: 2,
149
+ ZAR: 2,
150
+ RUB: 2,
151
+ TRY: 2,
152
+ PLN: 2,
153
+ SEK: 2,
154
+ NOK: 2,
155
+ DKK: 2,
156
+ CZK: 2,
157
+ HUF: 2,
158
+ RON: 2,
159
+ ILS: 2,
160
+ THB: 2,
161
+ PHP: 2,
162
+ MYR: 2,
163
+ IDR: 2,
164
+ AED: 2,
165
+ SAR: 2,
166
+ QAR: 2,
167
+ EGP: 2,
168
+ // 0-decimal
169
+ JPY: 0,
170
+ KRW: 0,
171
+ ISK: 0,
172
+ CLP: 0,
173
+ VND: 0,
174
+ XOF: 0,
175
+ XAF: 0,
176
+ PYG: 0,
177
+ // 3-decimal
178
+ BHD: 3,
179
+ KWD: 3,
180
+ OMR: 3,
181
+ TND: 3,
182
+ JOD: 3,
183
+ IQD: 3,
184
+ LYD: 3
185
+ };
186
+ function scaleForCurrency(code) {
187
+ const v = MINOR_UNITS[code];
188
+ return v === void 0 ? null : v;
189
+ }
190
+
191
+ // src/errors.ts
192
+ var NoydbError = class extends Error {
193
+ /** Machine-readable error code. Stable across library versions. */
194
+ code;
195
+ constructor(code, message) {
196
+ super(message);
197
+ this.name = "NoydbError";
198
+ this.code = code;
199
+ }
200
+ };
201
+ var NoAccessError = class extends NoydbError {
202
+ constructor(message = "No access \u2014 user does not have a key for this collection") {
203
+ super("NO_ACCESS", message);
204
+ this.name = "NoAccessError";
205
+ }
206
+ };
207
+ var ReservedVaultNameError = class extends NoydbError {
208
+ /** The rejected vault name. */
209
+ vaultName;
210
+ constructor(vaultName) {
211
+ super(
212
+ "RESERVED_VAULT_NAME",
213
+ `"${vaultName}" is a reserved internal vault name and cannot be used as a group name or partition key`
214
+ );
215
+ this.name = "ReservedVaultNameError";
216
+ this.vaultName = vaultName;
217
+ }
218
+ };
219
+ var ValidationError = class extends NoydbError {
220
+ constructor(message = "Validation error") {
221
+ super("VALIDATION_ERROR", message);
222
+ this.name = "ValidationError";
223
+ }
224
+ };
225
+ var GroupCardinalityError = class extends NoydbError {
226
+ /** The field being grouped on. */
227
+ field;
228
+ /** Observed number of distinct groups at the moment the cap tripped. */
229
+ cardinality;
230
+ /** The cap that was exceeded. */
231
+ maxGroups;
232
+ constructor(field, cardinality, maxGroups) {
233
+ super(
234
+ "GROUP_CARDINALITY",
235
+ `.groupBy("${field}") produced ${cardinality} distinct groups, exceeding the ${maxGroups}-group ceiling. This is almost always a query mistake \u2014 grouping on a high-uniqueness field like "id" or "createdAt" produces one bucket per record. Narrow the query with .where() before grouping, or group on a lower-cardinality field (status, category, clientId). If you genuinely need high-cardinality grouping, file an issue with your use case.`
236
+ );
237
+ this.name = "GroupCardinalityError";
238
+ this.field = field;
239
+ this.cardinality = cardinality;
240
+ this.maxGroups = maxGroups;
241
+ }
242
+ };
243
+ var UnknownShardError = class extends NoydbError {
244
+ partitionKey;
245
+ constructor(partitionKey, groupName) {
246
+ super(
247
+ "SHARD_UNKNOWN",
248
+ `No shard for partition key "${partitionKey}" in vault group "${groupName}" and autoCreate is disabled. Call group.createShard(${JSON.stringify(partitionKey)}) first, or enable sharding.autoCreate.`
249
+ );
250
+ this.name = "UnknownShardError";
251
+ this.partitionKey = partitionKey;
252
+ }
253
+ };
254
+ var ShardProvisioningError = class extends NoydbError {
255
+ vaultId;
256
+ constructor(vaultId, partitionKey) {
257
+ super(
258
+ "SHARD_PROVISIONING",
259
+ `Registry has a row for partition "${partitionKey}" (vault "${vaultId}") but that vault is not provisioned in the store. Refusing to recreate it \u2014 the registry and store have diverged. Investigate before retrying.`
260
+ );
261
+ this.name = "ShardProvisioningError";
262
+ this.vaultId = vaultId;
263
+ }
264
+ };
265
+ var DataResidencyError = class extends NoydbError {
266
+ vaultId;
267
+ requiredRegion;
268
+ backendRegion;
269
+ constructor(vaultId, requiredRegion, backendRegion) {
270
+ super(
271
+ "DATA_RESIDENCY",
272
+ `Shard "${vaultId}" requires region "${requiredRegion}" but its placement backend declares region ${backendRegion === void 0 ? "(none)" : `"${backendRegion}"`}. Refusing to provision \u2014 route this shard to a region-correct backend via routeStore({ vaultRoutes }) (e.g. a region-encoded partition key) before retrying.`
273
+ );
274
+ this.name = "DataResidencyError";
275
+ this.vaultId = vaultId;
276
+ this.requiredRegion = requiredRegion;
277
+ this.backendRegion = backendRegion;
278
+ }
279
+ };
280
+ var CrossShardJoinError = class extends NoydbError {
281
+ constructor(message) {
282
+ super("CROSS_SHARD_JOIN", message);
283
+ this.name = "CrossShardJoinError";
284
+ }
285
+ };
286
+ var VaultTemplateNotFoundError = class extends NoydbError {
287
+ templateName;
288
+ constructor(templateName) {
289
+ super(
290
+ "VAULT_TEMPLATE_NOT_FOUND",
291
+ `No vault template registered under "${templateName}". Register it with createLobby(db).withVaultTemplate(${JSON.stringify(templateName)}, { version, configure }) before opening the vault group (@klum-db/lobby).`
292
+ );
293
+ this.name = "VaultTemplateNotFoundError";
294
+ this.templateName = templateName;
295
+ }
296
+ };
297
+
298
+ // src/money/descriptor.ts
299
+ var MoneyUnsupportedError = class extends NoydbError {
300
+ constructor(field, message) {
301
+ super(
302
+ "MONEY_UNSUPPORTED",
303
+ message ?? `money: operation is not supported on field "${field}" \u2014 use sum() and count() and divide at the boundary`
304
+ );
305
+ this.field = field;
306
+ this.name = "MoneyUnsupportedError";
307
+ }
308
+ field;
309
+ };
310
+
311
+ // src/query/predicate.ts
312
+ function readPath(record, path) {
313
+ if (record === null || record === void 0) return void 0;
314
+ if (!path.includes(".")) {
315
+ return record[path];
316
+ }
317
+ const segments = path.split(".");
318
+ let cursor = record;
319
+ for (const segment of segments) {
320
+ if (cursor === null || cursor === void 0) return void 0;
321
+ cursor = cursor[segment];
322
+ }
323
+ return cursor;
324
+ }
325
+
326
+ // src/aggregate/aggregation.ts
327
+ function reduceRecords(records, spec) {
328
+ const state = {};
329
+ for (const key of Object.keys(spec)) {
330
+ state[key] = spec[key].init();
331
+ }
332
+ for (const record of records) {
333
+ for (const key of Object.keys(spec)) {
334
+ state[key] = spec[key].step(state[key], record);
335
+ }
336
+ }
337
+ const result = {};
338
+ for (const key of Object.keys(spec)) {
339
+ result[key] = spec[key].finalize(state[key]);
340
+ }
341
+ return result;
342
+ }
343
+
344
+ // src/aggregate/canonical-key.ts
345
+ function canonicalGroupKey(fields, row) {
346
+ const sorted = [...fields].sort();
347
+ const parts = [];
348
+ for (const name of sorted) {
349
+ const v = row[name];
350
+ const serialised = v === void 0 ? "undefined" : JSON.stringify(v);
351
+ parts.push(`${name}=${serialised}`);
352
+ }
353
+ return parts.join("|");
354
+ }
355
+
356
+ // src/money/money-reducer.ts
357
+ function toScaledIntFromAny(v, scale) {
358
+ if (typeof v === "bigint") return v;
359
+ if (typeof v === "number") {
360
+ const r = parseToScaledInt(v, scale);
361
+ return r.ok ? r.value : null;
362
+ }
363
+ if (typeof v === "string") {
364
+ if (!v.includes(".")) {
365
+ try {
366
+ return BigInt(v);
367
+ } catch {
368
+ return null;
369
+ }
370
+ }
371
+ const r = parseToScaledInt(v, scale);
372
+ return r.ok ? r.value : null;
373
+ }
374
+ return null;
375
+ }
376
+ function readMoney(record, field, desc) {
377
+ const raw = readPath(record, field);
378
+ if (raw === null || raw === void 0) return null;
379
+ if (desc.mode === "fixed") {
380
+ const cur = desc.fixedCurrency;
381
+ const value2 = toScaledIntFromAny(raw, desc.scaleFor(cur));
382
+ return value2 === null ? null : { currency: cur, value: value2 };
383
+ }
384
+ if (typeof raw !== "object") return null;
385
+ const o = raw;
386
+ if (typeof o.currency !== "string") return null;
387
+ const scale = desc.allows(o.currency) ? desc.scaleFor(o.currency) : 0;
388
+ const value = toScaledIntFromAny(o.amount, scale);
389
+ return value === null ? null : { currency: o.currency, value };
390
+ }
391
+ function targetScaleFor(desc, currency) {
392
+ if (desc.allows(currency)) return desc.scaleFor(currency);
393
+ const s = scaleForCurrency(currency);
394
+ if (s === null) {
395
+ throw new Error(`money: cannot determine scale for conversion target "${currency}"`);
396
+ }
397
+ return s;
398
+ }
399
+ function parseRate(rate) {
400
+ const s = String(rate).trim();
401
+ const neg = s.startsWith("-");
402
+ const body = neg ? s.slice(1) : s;
403
+ const dot = body.indexOf(".");
404
+ const intPart = dot === -1 ? body : body.slice(0, dot);
405
+ const fracPart = dot === -1 ? "" : body.slice(dot + 1);
406
+ const int = BigInt((intPart === "" ? "0" : intPart) + fracPart);
407
+ return { int: neg ? -int : int, scale: fracPart.length };
408
+ }
409
+ function divRoundHalfEven(n, d) {
410
+ const q = n / d;
411
+ const r = n % d;
412
+ const twiceR = (r < 0n ? -r : r) * 2n;
413
+ if (twiceR < d) return q;
414
+ if (twiceR > d) return q + (n < 0n ? -1n : 1n);
415
+ return q % 2n === 0n ? q : q + (n < 0n ? -1n : 1n);
416
+ }
417
+ function convertScaled(value, srcScale, rate, targetScale) {
418
+ const { int: rateInt, scale: rateScale } = parseRate(rate);
419
+ const product = value * rateInt;
420
+ const curScale = srcScale + rateScale;
421
+ if (curScale === targetScale) return product;
422
+ if (curScale < targetScale) return product * 10n ** BigInt(targetScale - curScale);
423
+ return divRoundHalfEven(product, 10n ** BigInt(curScale - targetScale));
424
+ }
425
+ function finalizeSum(state, desc, convertTo, fx) {
426
+ if (convertTo !== void 0) {
427
+ if (fx === void 0) {
428
+ throw new Error(`money: sum convertTo "${convertTo}" requires an fx rate map`);
429
+ }
430
+ const targetScale = targetScaleFor(desc, convertTo);
431
+ let total = 0n;
432
+ for (const [cur, v] of state) {
433
+ if (cur === convertTo) {
434
+ total += convertScaled(v, desc.scaleFor(cur), 1, targetScale);
435
+ continue;
436
+ }
437
+ const rate = fx[`${cur}->${convertTo}`];
438
+ if (rate === void 0) {
439
+ throw new Error(`money: no fx rate for "${cur}->${convertTo}"`);
440
+ }
441
+ total += convertScaled(v, desc.scaleFor(cur), rate, targetScale);
442
+ }
443
+ return formatScaledInt(total, targetScale);
444
+ }
445
+ if (desc.mode === "fixed") {
446
+ const cur = desc.fixedCurrency;
447
+ return formatScaledInt(state.get(cur) ?? 0n, desc.scaleFor(cur));
448
+ }
449
+ const out = {};
450
+ for (const [cur, v] of state) out[cur] = formatScaledInt(v, desc.scaleFor(cur));
451
+ return out;
452
+ }
453
+ function moneySumReducer(field, desc, convertTo, fx) {
454
+ return {
455
+ op: "sum",
456
+ field,
457
+ init: () => /* @__PURE__ */ new Map(),
458
+ step: (state, record) => {
459
+ const m = readMoney(record, field, desc);
460
+ if (m) state.set(m.currency, (state.get(m.currency) ?? 0n) + m.value);
461
+ return state;
462
+ },
463
+ remove: (state, record) => {
464
+ const m = readMoney(record, field, desc);
465
+ if (m) state.set(m.currency, (state.get(m.currency) ?? 0n) - m.value);
466
+ return state;
467
+ },
468
+ finalize: (state) => finalizeSum(state, desc, convertTo, fx)
469
+ };
470
+ }
471
+ function extremum(values, op) {
472
+ let out = values[0];
473
+ for (let i = 1; i < values.length; i++) {
474
+ const v = values[i];
475
+ if (op === "min" ? v < out : v > out) out = v;
476
+ }
477
+ return out;
478
+ }
479
+ function moneyMinMaxReducer(op, field, desc) {
480
+ return {
481
+ op,
482
+ field,
483
+ init: () => /* @__PURE__ */ new Map(),
484
+ step: (state, record) => {
485
+ const m = readMoney(record, field, desc);
486
+ if (m) {
487
+ const arr = state.get(m.currency);
488
+ if (arr) arr.push(m.value);
489
+ else state.set(m.currency, [m.value]);
490
+ }
491
+ return state;
492
+ },
493
+ remove: (state, record) => {
494
+ const m = readMoney(record, field, desc);
495
+ if (m) {
496
+ const arr = state.get(m.currency);
497
+ if (arr) {
498
+ const idx = arr.indexOf(m.value);
499
+ if (idx >= 0) arr.splice(idx, 1);
500
+ }
501
+ }
502
+ return state;
503
+ },
504
+ finalize: (state) => {
505
+ if (desc.mode === "fixed") {
506
+ const cur = desc.fixedCurrency;
507
+ const arr = state.get(cur);
508
+ if (!arr || arr.length === 0) return null;
509
+ return formatScaledInt(extremum(arr, op), desc.scaleFor(cur));
510
+ }
511
+ const out = {};
512
+ for (const [cur, arr] of state) {
513
+ if (arr.length > 0) out[cur] = formatScaledInt(extremum(arr, op), desc.scaleFor(cur));
514
+ }
515
+ return out;
516
+ }
517
+ };
518
+ }
519
+ function wrapMoneyReducers(spec, moneyFields) {
520
+ let changed = false;
521
+ const out = {};
522
+ for (const [key, reducer] of Object.entries(spec)) {
523
+ const field = reducer.field;
524
+ const desc = field ? moneyFields[field] : void 0;
525
+ if (desc && reducer.op === "avg") {
526
+ throw new MoneyUnsupportedError(
527
+ field,
528
+ `avg() is not supported on money field "${field}" in v1 \u2014 use sum() and count() and divide at the boundary.`
529
+ );
530
+ }
531
+ if (desc && (reducer.op === "sum" || reducer.op === "min" || reducer.op === "max")) {
532
+ changed = true;
533
+ out[key] = reducer.op === "sum" ? moneySumReducer(field, desc, reducer.convertTo, reducer.fx) : moneyMinMaxReducer(reducer.op, field, desc);
534
+ } else {
535
+ out[key] = reducer;
536
+ }
537
+ }
538
+ return changed ? out : spec;
539
+ }
540
+
541
+ // src/aggregate/groupby.ts
542
+ var GROUPBY_WARN_CARDINALITY = 1e4;
543
+ var GROUPBY_MAX_CARDINALITY = 1e5;
544
+ var warnedCardinalityFields = /* @__PURE__ */ new Set();
545
+ function warnCardinalityApproaching(fields, observed) {
546
+ const key = JSON.stringify([...fields].sort());
547
+ if (warnedCardinalityFields.has(key)) return;
548
+ warnedCardinalityFields.add(key);
549
+ const label = `[${fields.join(", ")}]`;
550
+ console.warn(
551
+ `[noy-db] .groupBy(${label}) produced ${observed} distinct groups, ${Math.round(observed / GROUPBY_MAX_CARDINALITY * 100)}% of the ${GROUPBY_MAX_CARDINALITY}-group ceiling. Narrow the query with .where() before grouping, or switch to a lower-cardinality field.`
552
+ );
553
+ }
554
+ function groupAndReduce(records, fieldOrFields, spec, moneyFields) {
555
+ const fields = typeof fieldOrFields === "string" ? [fieldOrFields] : fieldOrFields;
556
+ if (fields.length === 0) {
557
+ throw new Error(".groupBy() requires at least one field");
558
+ }
559
+ if (moneyFields) {
560
+ spec = wrapMoneyReducers(spec, moneyFields);
561
+ }
562
+ const buckets = /* @__PURE__ */ new Map();
563
+ const fieldLabel = fields.length === 1 ? fields[0] : `[${fields.join(", ")}]`;
564
+ for (const record of records) {
565
+ const keyValues = {};
566
+ for (const f of fields) {
567
+ keyValues[f] = readPath(record, f);
568
+ }
569
+ const dedupKey = canonicalGroupKey(fields, keyValues);
570
+ let bucket = buckets.get(dedupKey);
571
+ if (bucket === void 0) {
572
+ if (buckets.size >= GROUPBY_MAX_CARDINALITY) {
573
+ throw new GroupCardinalityError(
574
+ fieldLabel,
575
+ buckets.size + 1,
576
+ GROUPBY_MAX_CARDINALITY
577
+ );
578
+ }
579
+ bucket = { keyValues, records: [] };
580
+ buckets.set(dedupKey, bucket);
581
+ }
582
+ bucket.records.push(record);
583
+ }
584
+ if (buckets.size >= GROUPBY_WARN_CARDINALITY) {
585
+ warnCardinalityApproaching(fields, buckets.size);
586
+ }
587
+ const reducerKeys = Object.keys(spec);
588
+ const out = [];
589
+ for (const bucket of buckets.values()) {
590
+ const state = {};
591
+ for (const rk of reducerKeys) {
592
+ state[rk] = spec[rk].init();
593
+ }
594
+ for (const record of bucket.records) {
595
+ for (const rk of reducerKeys) {
596
+ state[rk] = spec[rk].step(state[rk], record);
597
+ }
598
+ }
599
+ const row = {};
600
+ for (const f of fields) {
601
+ row[f] = bucket.keyValues[f];
602
+ }
603
+ for (const rk of reducerKeys) {
604
+ row[rk] = spec[rk].finalize(state[rk]);
605
+ }
606
+ out.push(row);
607
+ }
608
+ return out;
609
+ }
610
+
611
+ // src/bundle/ulid.ts
612
+ var CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
613
+ function encodeBase32(value, length) {
614
+ let out = "";
615
+ let v = value;
616
+ for (let i = 0; i < length; i++) {
617
+ out = CROCKFORD_ALPHABET[v % 32] + out;
618
+ v = Math.floor(v / 32);
619
+ }
620
+ return out;
621
+ }
622
+ function generateULID() {
623
+ const now = Date.now();
624
+ const timestampHigh = Math.floor(now / 16777216);
625
+ const timestampLow = now & 16777215;
626
+ const tsPart = encodeBase32(timestampHigh, 5) + encodeBase32(timestampLow, 5);
627
+ const randBytes = new Uint8Array(10);
628
+ crypto.getRandomValues(randBytes);
629
+ const rand1 = randBytes[0] * 2 ** 32 + (randBytes[1] << 24 >>> 0) + (randBytes[2] << 16) + (randBytes[3] << 8) + randBytes[4];
630
+ const rand2 = randBytes[5] * 2 ** 32 + (randBytes[6] << 24 >>> 0) + (randBytes[7] << 16) + (randBytes[8] << 8) + randBytes[9];
631
+ const randPart = encodeBase32(rand1, 8) + encodeBase32(rand2, 8);
632
+ return tsPart + randPart;
633
+ }
634
+
635
+ // src/crypto.ts
636
+ var subtle = globalThis.crypto.subtle;
637
+ async function sha256Hex(data) {
638
+ const hash = await subtle.digest("SHA-256", data);
639
+ return Array.from(new Uint8Array(hash)).map((b) => b.toString(16).padStart(2, "0")).join("");
640
+ }
641
+ // Annotate the CommonJS export names for ESM import in node:
642
+ 0 && (module.exports = {
643
+ CrossShardJoinError,
644
+ DataResidencyError,
645
+ NoAccessError,
646
+ ReservedVaultNameError,
647
+ ShardProvisioningError,
648
+ UnknownShardError,
649
+ ValidationError,
650
+ VaultTemplateNotFoundError,
651
+ generateULID,
652
+ groupAndReduce,
653
+ readPath,
654
+ reduceRecords,
655
+ sha256Hex
656
+ });
657
+ //# sourceMappingURL=index.cjs.map