@noy-db/hub 0.3.0-pre.3 → 0.3.0-pre.5

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 (388) hide show
  1. package/dist/adapter/index.d.ts +2 -2
  2. package/dist/adapter/index.js +1 -1
  3. package/dist/aggregate/index.d.ts +3 -3
  4. package/dist/aggregate/index.js +4 -4
  5. package/dist/api-JOXUNSKP.js +20 -0
  6. package/dist/as/index.d.ts +4 -4
  7. package/dist/as/index.js +12 -9
  8. package/dist/at/index.d.ts +2 -2
  9. package/dist/attestation/index.d.ts +3 -3
  10. package/dist/attestation/index.js +21 -18
  11. package/dist/attestation/index.js.map +1 -1
  12. package/dist/{backup-NGRJ46SH.js → backup-OPONO6Q5.js} +12 -9
  13. package/dist/{backup-NGRJ46SH.js.map → backup-OPONO6Q5.js.map} +1 -1
  14. package/dist/blobs/index.d.ts +4 -4
  15. package/dist/blobs/index.js +11 -8
  16. package/dist/blobs/index.js.map +1 -1
  17. package/dist/bundle/index.d.ts +5 -5
  18. package/dist/bundle/index.js +21 -18
  19. package/dist/bundle/index.js.map +1 -1
  20. package/dist/{bundle-B-P3_Jvb.d.ts → bundle-Bs13EZtX.d.ts} +1 -1
  21. package/dist/by/index.js +2 -2
  22. package/dist/cargo/index.d.ts +4 -4
  23. package/dist/cargo/index.js +23 -20
  24. package/dist/{chunk-VBYVKOMJ.js → chunk-3QRQOBS7.js} +3 -3
  25. package/dist/{chunk-JFYIHLU3.js → chunk-3Y4QLJ6K.js} +2 -2
  26. package/dist/{chunk-BZIWKN74.js → chunk-43ISXURO.js} +2 -2
  27. package/dist/{chunk-PYWW4KLO.js → chunk-44UTIDE2.js} +9 -9
  28. package/dist/{chunk-7IP75FP2.js → chunk-4K3MQ5S3.js} +2 -2
  29. package/dist/chunk-5EWYUR5P.js +37 -0
  30. package/dist/chunk-5EWYUR5P.js.map +1 -0
  31. package/dist/{chunk-2KSPDSWI.js → chunk-5MRE3C4Q.js} +5 -5
  32. package/dist/{chunk-PUNJAEY6.js → chunk-6HNKCKFZ.js} +7 -7
  33. package/dist/{chunk-PJDK2PPQ.js → chunk-6RXPSMKR.js} +3 -3
  34. package/dist/{chunk-6DP5HBQD.js → chunk-6UOSONVI.js} +9 -9
  35. package/dist/{chunk-YN66UOXT.js → chunk-7SY3PTED.js} +25 -9
  36. package/dist/{chunk-YN66UOXT.js.map → chunk-7SY3PTED.js.map} +1 -1
  37. package/dist/{chunk-UP6EMMDI.js → chunk-A4DWPOP3.js} +10 -10
  38. package/dist/{chunk-MCJAUQGE.js → chunk-A5DYVMDR.js} +3 -3
  39. package/dist/{chunk-MIOLJG2R.js → chunk-AF5ZRTZ4.js} +5 -2
  40. package/dist/chunk-AF5ZRTZ4.js.map +1 -0
  41. package/dist/{chunk-TICO2I2O.js → chunk-BKGIWGCX.js} +2 -2
  42. package/dist/{chunk-O5DNEXQC.js → chunk-BMQOH7MM.js} +2 -2
  43. package/dist/{chunk-3UDPDRUC.js → chunk-EWR7HL3K.js} +4 -4
  44. package/dist/{chunk-CVXLJIAV.js → chunk-FH52CDEW.js} +5 -5
  45. package/dist/chunk-G4MGYGSS.js +130 -0
  46. package/dist/chunk-G4MGYGSS.js.map +1 -0
  47. package/dist/{chunk-FELHYKIO.js → chunk-G7RDYYTE.js} +2 -2
  48. package/dist/{chunk-N2FP26NH.js → chunk-GBTUANXF.js} +16 -297
  49. package/dist/chunk-GBTUANXF.js.map +1 -0
  50. package/dist/{chunk-DHIN36UC.js → chunk-GQOT6QJR.js} +8 -8
  51. package/dist/{chunk-DGUR3CC4.js → chunk-GXGK22QU.js} +2 -2
  52. package/dist/{chunk-YTIAXSUE.js → chunk-GZZL5R73.js} +4 -4
  53. package/dist/{chunk-E4YJUNPU.js → chunk-H5XRIJX3.js} +7 -7
  54. package/dist/{chunk-DA34OEZU.js → chunk-H7RYPVMJ.js} +2 -2
  55. package/dist/{chunk-2ZORB5RW.js → chunk-HBKDR7R3.js} +3 -3
  56. package/dist/{chunk-ZNI3RTFV.js → chunk-HMXLN43G.js} +2 -2
  57. package/dist/{chunk-BYW7EU5L.js → chunk-HY6ZGGEC.js} +2 -2
  58. package/dist/{chunk-ADBMJDBW.js → chunk-IEUIUSBO.js} +449 -1077
  59. package/dist/chunk-IEUIUSBO.js.map +1 -0
  60. package/dist/{chunk-OVIVYAQL.js → chunk-LEA7WJEZ.js} +25 -10
  61. package/dist/chunk-LEA7WJEZ.js.map +1 -0
  62. package/dist/{chunk-5Z3RNFJC.js → chunk-LIP6JWYK.js} +3 -3
  63. package/dist/{chunk-OCDUQUAP.js → chunk-LN22XH4B.js} +1 -1
  64. package/dist/chunk-LN22XH4B.js.map +1 -0
  65. package/dist/chunk-LP7BEXCT.js +32 -0
  66. package/dist/chunk-LP7BEXCT.js.map +1 -0
  67. package/dist/{chunk-IJW6K6UX.js → chunk-LPRPVCNY.js} +5 -5
  68. package/dist/{chunk-6EVZXETK.js → chunk-M66NAZA4.js} +3 -3
  69. package/dist/{chunk-HGQG3VIP.js → chunk-N5YVZHCB.js} +2 -2
  70. package/dist/chunk-NO272T7Q.js +194 -0
  71. package/dist/chunk-NO272T7Q.js.map +1 -0
  72. package/dist/{chunk-NIA5VQ7G.js → chunk-NQVZB3S7.js} +29 -11
  73. package/dist/chunk-NQVZB3S7.js.map +1 -0
  74. package/dist/{chunk-6OQ7NKMZ.js → chunk-O2DB4C3M.js} +6 -6
  75. package/dist/{chunk-LHYQE3BP.js → chunk-OFBFAVLI.js} +6 -6
  76. package/dist/{chunk-IWVWB7BZ.js → chunk-OJU3CPFA.js} +12 -12
  77. package/dist/{chunk-ZFME46HJ.js → chunk-OPTFANOX.js} +3 -3
  78. package/dist/chunk-OPTFANOX.js.map +1 -0
  79. package/dist/{chunk-5EZAJEES.js → chunk-OVO2RZAE.js} +81 -27
  80. package/dist/chunk-OVO2RZAE.js.map +1 -0
  81. package/dist/{chunk-6I2YPLAG.js → chunk-P27Z66EB.js} +7 -7
  82. package/dist/{chunk-7MHVHGQZ.js → chunk-P2LDXRGP.js} +2 -2
  83. package/dist/chunk-P3NGV5RV.js +41 -0
  84. package/dist/chunk-P3NGV5RV.js.map +1 -0
  85. package/dist/{chunk-NPVICKZE.js → chunk-P5WXDYMD.js} +8 -197
  86. package/dist/chunk-P5WXDYMD.js.map +1 -0
  87. package/dist/{chunk-CPAROOKP.js → chunk-PGFY7IRW.js} +12 -41
  88. package/dist/chunk-PGFY7IRW.js.map +1 -0
  89. package/dist/{chunk-Z44OY24N.js → chunk-PI5CG2OV.js} +9 -5
  90. package/dist/chunk-PI5CG2OV.js.map +1 -0
  91. package/dist/{chunk-6RASM2J4.js → chunk-QKVILR7N.js} +2 -2
  92. package/dist/{chunk-LKBLAUOB.js → chunk-QNTEDPWP.js} +3 -3
  93. package/dist/{chunk-P6UXDALK.js → chunk-RDHAGBEB.js} +3 -3
  94. package/dist/{chunk-XRE4JOEO.js → chunk-RTS23VIJ.js} +2 -2
  95. package/dist/{chunk-5ZPWVNL3.js → chunk-S2WKOCTU.js} +2 -2
  96. package/dist/chunk-SAJJWVNQ.js +135 -0
  97. package/dist/chunk-SAJJWVNQ.js.map +1 -0
  98. package/dist/{chunk-VHEEU4ZO.js → chunk-SW56GSYC.js} +2 -2
  99. package/dist/{chunk-46YGCU6Z.js → chunk-T2EGAXPM.js} +2 -2
  100. package/dist/{chunk-LES2Z7B4.js → chunk-T45LAT2Y.js} +2 -2
  101. package/dist/{chunk-4NMFWOS2.js → chunk-T65UZXR6.js} +3 -3
  102. package/dist/{chunk-2N4MUSF3.js → chunk-TB5RNNJ4.js} +7 -7
  103. package/dist/chunk-TCIUO62Z.js +29 -0
  104. package/dist/chunk-TCIUO62Z.js.map +1 -0
  105. package/dist/chunk-THNJ3IKU.js +17 -0
  106. package/dist/chunk-THNJ3IKU.js.map +1 -0
  107. package/dist/{chunk-U6OM4E67.js → chunk-TL7QR5T6.js} +20 -15
  108. package/dist/chunk-TL7QR5T6.js.map +1 -0
  109. package/dist/{chunk-L4IRFTIF.js → chunk-TLJOJBZD.js} +3 -23
  110. package/dist/chunk-TLJOJBZD.js.map +1 -0
  111. package/dist/chunk-TQ3REHVF.js +95 -0
  112. package/dist/chunk-TQ3REHVF.js.map +1 -0
  113. package/dist/{chunk-6CNLU4TO.js → chunk-TYGW5TOR.js} +7 -7
  114. package/dist/{chunk-BLZRNHMG.js → chunk-U23JUUPX.js} +8 -1
  115. package/dist/{chunk-BLZRNHMG.js.map → chunk-U23JUUPX.js.map} +1 -1
  116. package/dist/{chunk-U5DWHU3S.js → chunk-U24XHXNK.js} +2 -2
  117. package/dist/chunk-ULIHDPKL.js +94 -0
  118. package/dist/chunk-ULIHDPKL.js.map +1 -0
  119. package/dist/chunk-UOEWDCUX.js +69 -0
  120. package/dist/chunk-UOEWDCUX.js.map +1 -0
  121. package/dist/{chunk-NTHKOFVL.js → chunk-VFRNWE5P.js} +52 -8
  122. package/dist/chunk-VFRNWE5P.js.map +1 -0
  123. package/dist/{chunk-4DZGZ7II.js → chunk-VMJ5URU7.js} +8 -8
  124. package/dist/chunk-VMJ5URU7.js.map +1 -0
  125. package/dist/{chunk-YDP2SA5K.js → chunk-VPCMJ5Z4.js} +5 -5
  126. package/dist/{chunk-ZAWD6O46.js → chunk-VRPBEOWU.js} +2 -2
  127. package/dist/{chunk-AY4P6PHN.js → chunk-VWGCJUTV.js} +2 -2
  128. package/dist/{chunk-IIK7W3AN.js → chunk-XJR3COJO.js} +5 -5
  129. package/dist/{chunk-ZD4D7UM6.js → chunk-XYYW64LB.js} +2 -2
  130. package/dist/{chunk-4NZCZUGL.js → chunk-YFF2RP3X.js} +2 -2
  131. package/dist/{chunk-WVIIJPTJ.js → chunk-Z3FZC5GV.js} +7 -7
  132. package/dist/{chunk-55HDKLI3.js → chunk-Z5PIUYNB.js} +8 -8
  133. package/dist/{chunk-ZRDYQZYH.js → chunk-Z7KI4WHR.js} +2 -2
  134. package/dist/{chunk-BV7KNFJY.js → chunk-ZBDK7T6X.js} +9 -9
  135. package/dist/chunk-ZKF6HH7V.js +120 -0
  136. package/dist/chunk-ZKF6HH7V.js.map +1 -0
  137. package/dist/{chunk-P6DN5QU7.js → chunk-ZKYMKF2S.js} +8 -8
  138. package/dist/{chunk-NMRKAGHE.js → chunk-ZROMNP7Q.js} +2 -2
  139. package/dist/{chunk-5A6TC3RQ.js → chunk-ZT4GWVTX.js} +29 -14
  140. package/dist/chunk-ZT4GWVTX.js.map +1 -0
  141. package/dist/classified/index.d.ts +4 -4
  142. package/dist/classified/index.js +3 -3
  143. package/dist/collection-facade-THH4ASGX.js +39 -0
  144. package/dist/computed-BMMEFRFJ.js +11 -0
  145. package/dist/config-drift-3UIJVI5G.js +24 -0
  146. package/dist/config-drift-3UIJVI5G.js.map +1 -0
  147. package/dist/consent/index.d.ts +3 -3
  148. package/dist/consent/index.js +10 -7
  149. package/dist/consent/index.js.map +1 -1
  150. package/dist/crdt/index.d.ts +3 -3
  151. package/dist/delegation-BQNIEHZE.js +25 -0
  152. package/dist/derivations/index.d.ts +4 -4
  153. package/dist/derivations/index.js +12 -9
  154. package/dist/describe/index.d.ts +1 -1
  155. package/dist/{describe-0tiXAjoO.d.ts → describe-C6iHNlqJ.d.ts} +9 -0
  156. package/dist/{dev-unlock-B_s9DUWa.d.ts → dev-unlock-Cqd5Xv5J.d.ts} +1 -1
  157. package/dist/{enclave-IS7HZSQ7.js → enclave-YN6223OG.js} +21 -8
  158. package/dist/executor-CBTNU5VZ.js +9 -0
  159. package/dist/executor-DJHNSTIR.js +9 -0
  160. package/dist/executor-FGISLQIN.js +21 -0
  161. package/dist/export-accessible-P7SLRLK3.js +23 -0
  162. package/dist/extract-partition-6JGY3KYR.js +36 -0
  163. package/dist/{fanout-sidecar-DDKRG2MX.js → fanout-sidecar-WS22Q5WH.js} +12 -9
  164. package/dist/{fanout-sidecar-DDKRG2MX.js.map → fanout-sidecar-WS22Q5WH.js.map} +1 -1
  165. package/dist/fence-watcher-DHQ775JB.js +69 -0
  166. package/dist/fence-watcher-DHQ775JB.js.map +1 -0
  167. package/dist/find-RNBG7LBY.js +11 -0
  168. package/dist/forget/index.js +10 -7
  169. package/dist/forget/index.js.map +1 -1
  170. package/dist/guards/index.d.ts +4 -4
  171. package/dist/guards/index.js +3 -3
  172. package/dist/{hash-CWxn7sf6.d.ts → hash-D8Q5MJLA.d.ts} +1 -1
  173. package/dist/history/index.d.ts +4 -4
  174. package/dist/history/index.js +12 -9
  175. package/dist/history/index.js.map +1 -1
  176. package/dist/i18n/index.d.ts +3 -3
  177. package/dist/i18n/index.js +14 -11
  178. package/dist/i18n/index.js.map +1 -1
  179. package/dist/in/index.d.ts +2 -2
  180. package/dist/{index-D05bV0_g.d.ts → index-D4GQe1Rx.d.ts} +818 -49
  181. package/dist/{index-DTMUUwwW.d.ts → index-DRxk8q_7.d.ts} +3 -3
  182. package/dist/index.d.ts +54 -18
  183. package/dist/index.js +1022 -123
  184. package/dist/index.js.map +1 -1
  185. package/dist/indexing/index.d.ts +3 -3
  186. package/dist/indexing/index.js +4 -4
  187. package/dist/issue-W5QG53B5.js +19 -0
  188. package/dist/json-schema-I22JCYCG.js +44 -0
  189. package/dist/json-schema-I22JCYCG.js.map +1 -0
  190. package/dist/kernel/index.d.ts +3 -3
  191. package/dist/kernel/index.js +13 -10
  192. package/dist/lazy/index.d.ts +21 -0
  193. package/dist/lazy/index.js +12 -0
  194. package/dist/{ledger-YUAJUNFP.js → ledger-KZWBKAG5.js} +12 -9
  195. package/dist/liberate-AQ7OWBZZ.js +24 -0
  196. package/dist/link-set-UQEIYQAM.js +31 -0
  197. package/dist/materialized-views/index.d.ts +4 -4
  198. package/dist/materialized-views/index.js +16 -13
  199. package/dist/{mime-magic-Qr_4HjP6.d.ts → mime-magic-DmwT7OzZ.d.ts} +1 -1
  200. package/dist/noydb-WQZNAECY.js +60 -0
  201. package/dist/on/index.d.ts +2 -2
  202. package/dist/on/index.js +10 -7
  203. package/dist/overlay-views/index.d.ts +4 -4
  204. package/dist/overlay-views/index.js +4 -4
  205. package/dist/periods/index.d.ts +3 -3
  206. package/dist/periods/index.js +13 -10
  207. package/dist/pod/index.d.ts +3 -3
  208. package/dist/pod/index.js +12 -9
  209. package/dist/{policy-LRE6HTO5.js → policy-YIKUH4AD.js} +5 -5
  210. package/dist/portability/index.d.ts +3 -3
  211. package/dist/portability/index.js +8 -8
  212. package/dist/{public-envelope-WVRRUVAJ.js → public-envelope-MRN5YYZZ.js} +4 -4
  213. package/dist/query/index.d.ts +2 -2
  214. package/dist/query/index.js +6 -6
  215. package/dist/register-V5AQTXNI.js +21 -0
  216. package/dist/registry-IMNMHWTM.js +17 -0
  217. package/dist/registry-K6VUQXKV.js +19 -0
  218. package/dist/registry-ZVO3T4M5.js +9 -0
  219. package/dist/request-withdrawal-EHALV66Y.js +31 -0
  220. package/dist/request-withdrawal-EHALV66Y.js.map +1 -0
  221. package/dist/{reveal-WSUHXCSS.js → reveal-TBLTFWQ2.js} +6 -5
  222. package/dist/{reveal-WSUHXCSS.js.map → reveal-TBLTFWQ2.js.map} +1 -1
  223. package/dist/revoke-MHAUAESM.js +24 -0
  224. package/dist/revoke-MHAUAESM.js.map +1 -0
  225. package/dist/sealed-record/index.d.ts +3 -3
  226. package/dist/sealed-record/index.js +13 -10
  227. package/dist/sealed-record/index.js.map +1 -1
  228. package/dist/session/index.d.ts +4 -4
  229. package/dist/session/index.js +10 -7
  230. package/dist/session/index.js.map +1 -1
  231. package/dist/shadow/index.d.ts +3 -3
  232. package/dist/shadow/index.js +2 -2
  233. package/dist/signer-PQ74YXRY.js +25 -0
  234. package/dist/signer-PQ74YXRY.js.map +1 -0
  235. package/dist/snapshots/index.d.ts +3 -3
  236. package/dist/snapshots/index.js +11 -8
  237. package/dist/snapshots/index.js.map +1 -1
  238. package/dist/{stale-LX4BR43V.js → stale-7Q62KVI3.js} +2 -2
  239. package/dist/stale-7Q62KVI3.js.map +1 -0
  240. package/dist/storage-3FKGLQMC.js +23 -0
  241. package/dist/storage-3FKGLQMC.js.map +1 -0
  242. package/dist/{store-coordination-provider-KTRIC6PR.js → store-coordination-provider-JJCEMTAE.js} +3 -3
  243. package/dist/sync/index.d.ts +2 -2
  244. package/dist/sync/index.js +10 -7
  245. package/dist/sync/index.js.map +1 -1
  246. package/dist/team/index.d.ts +45 -6
  247. package/dist/team/index.js +25 -15
  248. package/dist/tiers/index.d.ts +2 -2
  249. package/dist/tiers/index.js +11 -8
  250. package/dist/to/index.d.ts +2 -2
  251. package/dist/to/index.js +1 -1
  252. package/dist/{transition-guard-C1Pyz8nH.d.ts → transition-guard-C4hvR-Ac.d.ts} +1 -1
  253. package/dist/tx/index.d.ts +3 -3
  254. package/dist/tx/index.js +3 -3
  255. package/dist/ui/index.d.ts +1 -1
  256. package/dist/util/index.js +1 -1
  257. package/dist/validators-Ctgkj5qd.d.ts +101 -0
  258. package/dist/{vault-diff-Fn0WeY2w.d.ts → vault-diff-B1Ir6EGs.d.ts} +1 -1
  259. package/dist/{verify-SW6J63Q2.js → verify-YB5LQHNA.js} +11 -7
  260. package/dist/{verify-SW6J63Q2.js.map → verify-YB5LQHNA.js.map} +1 -1
  261. package/dist/walk-T65TZDN2.js +241 -0
  262. package/dist/walk-T65TZDN2.js.map +1 -0
  263. package/dist/with/index.d.ts +3 -3
  264. package/dist/with/index.js +12 -9
  265. package/dist/{with-materialized-view-NKxs6iK5.d.ts → with-materialized-view-Bp65kKdQ.d.ts} +1 -1
  266. package/dist/{with-overlayed-view-B4fPYHwV.d.ts → with-overlayed-view-BRhdQNrK.d.ts} +1 -1
  267. package/dist/{with-rollup-Bl0sRFEt.d.ts → with-rollup-bQRPc3y1.d.ts} +1 -1
  268. package/dist/withdraw-accessible-JMX2TCPX.js +28 -0
  269. package/dist/withdraw-accessible-JMX2TCPX.js.map +1 -0
  270. package/package.json +7 -3
  271. package/dist/api-LORZ2EZU.js +0 -17
  272. package/dist/chunk-4DZGZ7II.js.map +0 -1
  273. package/dist/chunk-5A6TC3RQ.js.map +0 -1
  274. package/dist/chunk-5EZAJEES.js.map +0 -1
  275. package/dist/chunk-ADBMJDBW.js.map +0 -1
  276. package/dist/chunk-CPAROOKP.js.map +0 -1
  277. package/dist/chunk-L4IRFTIF.js.map +0 -1
  278. package/dist/chunk-MIOLJG2R.js.map +0 -1
  279. package/dist/chunk-N2FP26NH.js.map +0 -1
  280. package/dist/chunk-NIA5VQ7G.js.map +0 -1
  281. package/dist/chunk-NPVICKZE.js.map +0 -1
  282. package/dist/chunk-NTHKOFVL.js.map +0 -1
  283. package/dist/chunk-OCDUQUAP.js.map +0 -1
  284. package/dist/chunk-OVIVYAQL.js.map +0 -1
  285. package/dist/chunk-QLQS5A7X.js +0 -524
  286. package/dist/chunk-QLQS5A7X.js.map +0 -1
  287. package/dist/chunk-U6OM4E67.js.map +0 -1
  288. package/dist/chunk-Z44OY24N.js.map +0 -1
  289. package/dist/chunk-ZFME46HJ.js.map +0 -1
  290. package/dist/collection-facade-XPVRHBGU.js +0 -36
  291. package/dist/delegation-4HUHUE6T.js +0 -22
  292. package/dist/executor-ANFBCOYA.js +0 -9
  293. package/dist/executor-IKT47SH2.js +0 -9
  294. package/dist/executor-OIECZXTV.js +0 -18
  295. package/dist/export-accessible-NZWCFZHL.js +0 -20
  296. package/dist/extract-partition-52LX6RQH.js +0 -33
  297. package/dist/issue-F4SYPJGJ.js +0 -16
  298. package/dist/liberate-6LDETRIW.js +0 -21
  299. package/dist/noydb-WQNBVJIG.js +0 -54
  300. package/dist/registry-6HZ2JSQ7.js +0 -14
  301. package/dist/registry-GPXZQ7DT.js +0 -9
  302. package/dist/registry-USYD2ECC.js +0 -16
  303. package/dist/request-withdrawal-54V4L6CR.js +0 -28
  304. package/dist/revoke-JV26NTQD.js +0 -21
  305. package/dist/signer-AE56T5HE.js +0 -22
  306. package/dist/validators-Dzn7T-3x.d.ts +0 -62
  307. package/dist/withdraw-accessible-DGA4V2TP.js +0 -25
  308. /package/dist/{api-LORZ2EZU.js.map → api-JOXUNSKP.js.map} +0 -0
  309. /package/dist/{chunk-VBYVKOMJ.js.map → chunk-3QRQOBS7.js.map} +0 -0
  310. /package/dist/{chunk-JFYIHLU3.js.map → chunk-3Y4QLJ6K.js.map} +0 -0
  311. /package/dist/{chunk-BZIWKN74.js.map → chunk-43ISXURO.js.map} +0 -0
  312. /package/dist/{chunk-PYWW4KLO.js.map → chunk-44UTIDE2.js.map} +0 -0
  313. /package/dist/{chunk-7IP75FP2.js.map → chunk-4K3MQ5S3.js.map} +0 -0
  314. /package/dist/{chunk-2KSPDSWI.js.map → chunk-5MRE3C4Q.js.map} +0 -0
  315. /package/dist/{chunk-PUNJAEY6.js.map → chunk-6HNKCKFZ.js.map} +0 -0
  316. /package/dist/{chunk-PJDK2PPQ.js.map → chunk-6RXPSMKR.js.map} +0 -0
  317. /package/dist/{chunk-6DP5HBQD.js.map → chunk-6UOSONVI.js.map} +0 -0
  318. /package/dist/{chunk-UP6EMMDI.js.map → chunk-A4DWPOP3.js.map} +0 -0
  319. /package/dist/{chunk-MCJAUQGE.js.map → chunk-A5DYVMDR.js.map} +0 -0
  320. /package/dist/{chunk-TICO2I2O.js.map → chunk-BKGIWGCX.js.map} +0 -0
  321. /package/dist/{chunk-O5DNEXQC.js.map → chunk-BMQOH7MM.js.map} +0 -0
  322. /package/dist/{chunk-3UDPDRUC.js.map → chunk-EWR7HL3K.js.map} +0 -0
  323. /package/dist/{chunk-CVXLJIAV.js.map → chunk-FH52CDEW.js.map} +0 -0
  324. /package/dist/{chunk-FELHYKIO.js.map → chunk-G7RDYYTE.js.map} +0 -0
  325. /package/dist/{chunk-DHIN36UC.js.map → chunk-GQOT6QJR.js.map} +0 -0
  326. /package/dist/{chunk-DGUR3CC4.js.map → chunk-GXGK22QU.js.map} +0 -0
  327. /package/dist/{chunk-YTIAXSUE.js.map → chunk-GZZL5R73.js.map} +0 -0
  328. /package/dist/{chunk-E4YJUNPU.js.map → chunk-H5XRIJX3.js.map} +0 -0
  329. /package/dist/{chunk-DA34OEZU.js.map → chunk-H7RYPVMJ.js.map} +0 -0
  330. /package/dist/{chunk-2ZORB5RW.js.map → chunk-HBKDR7R3.js.map} +0 -0
  331. /package/dist/{chunk-ZNI3RTFV.js.map → chunk-HMXLN43G.js.map} +0 -0
  332. /package/dist/{chunk-BYW7EU5L.js.map → chunk-HY6ZGGEC.js.map} +0 -0
  333. /package/dist/{chunk-5Z3RNFJC.js.map → chunk-LIP6JWYK.js.map} +0 -0
  334. /package/dist/{chunk-IJW6K6UX.js.map → chunk-LPRPVCNY.js.map} +0 -0
  335. /package/dist/{chunk-6EVZXETK.js.map → chunk-M66NAZA4.js.map} +0 -0
  336. /package/dist/{chunk-HGQG3VIP.js.map → chunk-N5YVZHCB.js.map} +0 -0
  337. /package/dist/{chunk-6OQ7NKMZ.js.map → chunk-O2DB4C3M.js.map} +0 -0
  338. /package/dist/{chunk-LHYQE3BP.js.map → chunk-OFBFAVLI.js.map} +0 -0
  339. /package/dist/{chunk-IWVWB7BZ.js.map → chunk-OJU3CPFA.js.map} +0 -0
  340. /package/dist/{chunk-6I2YPLAG.js.map → chunk-P27Z66EB.js.map} +0 -0
  341. /package/dist/{chunk-7MHVHGQZ.js.map → chunk-P2LDXRGP.js.map} +0 -0
  342. /package/dist/{chunk-6RASM2J4.js.map → chunk-QKVILR7N.js.map} +0 -0
  343. /package/dist/{chunk-LKBLAUOB.js.map → chunk-QNTEDPWP.js.map} +0 -0
  344. /package/dist/{chunk-P6UXDALK.js.map → chunk-RDHAGBEB.js.map} +0 -0
  345. /package/dist/{chunk-XRE4JOEO.js.map → chunk-RTS23VIJ.js.map} +0 -0
  346. /package/dist/{chunk-5ZPWVNL3.js.map → chunk-S2WKOCTU.js.map} +0 -0
  347. /package/dist/{chunk-VHEEU4ZO.js.map → chunk-SW56GSYC.js.map} +0 -0
  348. /package/dist/{chunk-46YGCU6Z.js.map → chunk-T2EGAXPM.js.map} +0 -0
  349. /package/dist/{chunk-LES2Z7B4.js.map → chunk-T45LAT2Y.js.map} +0 -0
  350. /package/dist/{chunk-4NMFWOS2.js.map → chunk-T65UZXR6.js.map} +0 -0
  351. /package/dist/{chunk-2N4MUSF3.js.map → chunk-TB5RNNJ4.js.map} +0 -0
  352. /package/dist/{chunk-6CNLU4TO.js.map → chunk-TYGW5TOR.js.map} +0 -0
  353. /package/dist/{chunk-U5DWHU3S.js.map → chunk-U24XHXNK.js.map} +0 -0
  354. /package/dist/{chunk-YDP2SA5K.js.map → chunk-VPCMJ5Z4.js.map} +0 -0
  355. /package/dist/{chunk-ZAWD6O46.js.map → chunk-VRPBEOWU.js.map} +0 -0
  356. /package/dist/{chunk-AY4P6PHN.js.map → chunk-VWGCJUTV.js.map} +0 -0
  357. /package/dist/{chunk-IIK7W3AN.js.map → chunk-XJR3COJO.js.map} +0 -0
  358. /package/dist/{chunk-ZD4D7UM6.js.map → chunk-XYYW64LB.js.map} +0 -0
  359. /package/dist/{chunk-4NZCZUGL.js.map → chunk-YFF2RP3X.js.map} +0 -0
  360. /package/dist/{chunk-WVIIJPTJ.js.map → chunk-Z3FZC5GV.js.map} +0 -0
  361. /package/dist/{chunk-55HDKLI3.js.map → chunk-Z5PIUYNB.js.map} +0 -0
  362. /package/dist/{chunk-ZRDYQZYH.js.map → chunk-Z7KI4WHR.js.map} +0 -0
  363. /package/dist/{chunk-BV7KNFJY.js.map → chunk-ZBDK7T6X.js.map} +0 -0
  364. /package/dist/{chunk-P6DN5QU7.js.map → chunk-ZKYMKF2S.js.map} +0 -0
  365. /package/dist/{chunk-NMRKAGHE.js.map → chunk-ZROMNP7Q.js.map} +0 -0
  366. /package/dist/{collection-facade-XPVRHBGU.js.map → collection-facade-THH4ASGX.js.map} +0 -0
  367. /package/dist/{delegation-4HUHUE6T.js.map → computed-BMMEFRFJ.js.map} +0 -0
  368. /package/dist/{enclave-IS7HZSQ7.js.map → delegation-BQNIEHZE.js.map} +0 -0
  369. /package/dist/{executor-ANFBCOYA.js.map → enclave-YN6223OG.js.map} +0 -0
  370. /package/dist/{executor-IKT47SH2.js.map → executor-CBTNU5VZ.js.map} +0 -0
  371. /package/dist/{executor-OIECZXTV.js.map → executor-DJHNSTIR.js.map} +0 -0
  372. /package/dist/{export-accessible-NZWCFZHL.js.map → executor-FGISLQIN.js.map} +0 -0
  373. /package/dist/{extract-partition-52LX6RQH.js.map → export-accessible-P7SLRLK3.js.map} +0 -0
  374. /package/dist/{issue-F4SYPJGJ.js.map → extract-partition-6JGY3KYR.js.map} +0 -0
  375. /package/dist/{ledger-YUAJUNFP.js.map → find-RNBG7LBY.js.map} +0 -0
  376. /package/dist/{liberate-6LDETRIW.js.map → issue-W5QG53B5.js.map} +0 -0
  377. /package/dist/{noydb-WQNBVJIG.js.map → lazy/index.js.map} +0 -0
  378. /package/dist/{policy-LRE6HTO5.js.map → ledger-KZWBKAG5.js.map} +0 -0
  379. /package/dist/{public-envelope-WVRRUVAJ.js.map → liberate-AQ7OWBZZ.js.map} +0 -0
  380. /package/dist/{registry-6HZ2JSQ7.js.map → link-set-UQEIYQAM.js.map} +0 -0
  381. /package/dist/{registry-GPXZQ7DT.js.map → noydb-WQZNAECY.js.map} +0 -0
  382. /package/dist/{registry-USYD2ECC.js.map → policy-YIKUH4AD.js.map} +0 -0
  383. /package/dist/{request-withdrawal-54V4L6CR.js.map → public-envelope-MRN5YYZZ.js.map} +0 -0
  384. /package/dist/{revoke-JV26NTQD.js.map → register-V5AQTXNI.js.map} +0 -0
  385. /package/dist/{signer-AE56T5HE.js.map → registry-IMNMHWTM.js.map} +0 -0
  386. /package/dist/{stale-LX4BR43V.js.map → registry-K6VUQXKV.js.map} +0 -0
  387. /package/dist/{withdraw-accessible-DGA4V2TP.js.map → registry-ZVO3T4M5.js.map} +0 -0
  388. /package/dist/{store-coordination-provider-KTRIC6PR.js.map → store-coordination-provider-JJCEMTAE.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,6 +1,11 @@
1
+ import {
2
+ DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
3
+ PUBLIC_ENVELOPE_FIELDS,
4
+ resolveSchema
5
+ } from "./chunk-WXSYDNBT.js";
1
6
  import {
2
7
  UserApi
3
- } from "./chunk-MCJAUQGE.js";
8
+ } from "./chunk-A5DYVMDR.js";
4
9
  import {
5
10
  DEFAULT_FRESHNESS_MS,
6
11
  PERSONAL_POLICY,
@@ -8,15 +13,11 @@ import {
8
13
  checkGate,
9
14
  describeGate,
10
15
  mergePolicy
11
- } from "./chunk-2ZORB5RW.js";
16
+ } from "./chunk-HBKDR7R3.js";
12
17
  import {
13
18
  Collection,
14
- ComputedFieldError,
15
19
  ELEVATION_AUDIT_COLLECTION,
16
20
  ElevatedHandle,
17
- LinkEndpointError,
18
- LinkIntegrityError,
19
- Lru,
20
21
  Noydb,
21
22
  QuickUnlockStore,
22
23
  RefIntegrityError,
@@ -24,161 +25,181 @@ import {
24
25
  RefScopeError,
25
26
  Vault,
26
27
  createNoydb,
27
- derivePersistedSchema,
28
28
  describeAllUsersAuth,
29
29
  describeAuthConfig,
30
30
  describeUserAuth,
31
31
  diagramAuthConfig,
32
- estimateRecordBytes,
33
- evalComputedFields,
34
- isLinkCollectionName,
35
32
  isRefArray,
36
- isZodSchema,
37
33
  memoryStore,
38
- parseBytes,
39
- persistSchemaIfNeeded,
40
34
  ref,
41
35
  refArray,
42
36
  withArchive
43
- } from "./chunk-ADBMJDBW.js";
37
+ } from "./chunk-IEUIUSBO.js";
38
+ import "./chunk-TQ3REHVF.js";
39
+ import {
40
+ NO_SEQUENCE,
41
+ SequenceStore,
42
+ compileSequenceFormat,
43
+ resolveSequenceKey,
44
+ withSequence
45
+ } from "./chunk-P27Z66EB.js";
44
46
  import {
45
47
  META_COLLECTION,
46
48
  POLICY_RECORD_ID,
47
49
  loadVaultPolicy,
48
50
  saveVaultPolicy
49
- } from "./chunk-LES2Z7B4.js";
51
+ } from "./chunk-T45LAT2Y.js";
52
+ import {
53
+ LinkEndpointError
54
+ } from "./chunk-G4MGYGSS.js";
55
+ import {
56
+ LinkIntegrityError,
57
+ isLinkCollectionName
58
+ } from "./chunk-P3NGV5RV.js";
50
59
  import {
51
60
  DELEGATIONS_COLLECTION,
52
61
  issueDelegation,
53
62
  loadActiveDelegations,
54
63
  revokeDelegation
55
- } from "./chunk-YDP2SA5K.js";
64
+ } from "./chunk-VPCMJ5Z4.js";
56
65
  import {
57
- DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
58
- PUBLIC_ENVELOPE_FIELDS,
59
- resolveSchema
60
- } from "./chunk-WXSYDNBT.js";
66
+ persistSchemaIfNeeded
67
+ } from "./chunk-SAJJWVNQ.js";
61
68
  import {
62
- NO_SEQUENCE,
63
- SequenceStore,
64
- compileSequenceFormat,
65
- resolveSequenceKey,
66
- withSequence
67
- } from "./chunk-6I2YPLAG.js";
69
+ derivePersistedSchema,
70
+ isZodSchema
71
+ } from "./chunk-ULIHDPKL.js";
72
+ import "./chunk-YFF2RP3X.js";
73
+ import {
74
+ NO_SEARCH,
75
+ tokenize,
76
+ withSearch
77
+ } from "./chunk-A4DWPOP3.js";
78
+ import {
79
+ ComputedFieldError,
80
+ evalComputedFields
81
+ } from "./chunk-5EWYUR5P.js";
68
82
  import {
69
83
  WithdrawalRequestError,
70
84
  approveWithdrawal,
71
85
  listWithdrawalRequests,
72
86
  rejectWithdrawal,
73
87
  requestWithdrawal
74
- } from "./chunk-IIK7W3AN.js";
75
- import "./chunk-4NZCZUGL.js";
76
- import {
77
- NO_SEARCH,
78
- tokenize,
79
- withSearch
80
- } from "./chunk-UP6EMMDI.js";
81
- import "./chunk-YN66UOXT.js";
88
+ } from "./chunk-XJR3COJO.js";
89
+ import "./chunk-7SY3PTED.js";
82
90
  import {
83
91
  isDiscriminant
84
92
  } from "./chunk-PY4KJPYU.js";
85
- import "./chunk-ZRDYQZYH.js";
93
+ import "./chunk-Z7KI4WHR.js";
86
94
  import {
87
95
  classified,
88
96
  luhnCheck
89
- } from "./chunk-NTHKOFVL.js";
97
+ } from "./chunk-VFRNWE5P.js";
90
98
  import {
91
99
  ClassifiedNeverStoredError,
92
100
  ClassifiedValidationError,
93
101
  isClassifiedFieldSpec,
94
102
  isClassifiedGroup,
95
103
  resolveClassifiedFields
96
- } from "./chunk-MIOLJG2R.js";
97
- import "./chunk-4DZGZ7II.js";
98
- import "./chunk-HGQG3VIP.js";
104
+ } from "./chunk-AF5ZRTZ4.js";
105
+ import "./chunk-VMJ5URU7.js";
106
+ import "./chunk-N5YVZHCB.js";
99
107
  import {
100
108
  withCargo
101
- } from "./chunk-5ZPWVNL3.js";
109
+ } from "./chunk-S2WKOCTU.js";
102
110
  import {
103
111
  CustodyApi,
104
112
  NO_CARGO,
105
113
  NO_CUSTODY,
106
114
  withCustody
107
- } from "./chunk-Z44OY24N.js";
115
+ } from "./chunk-PI5CG2OV.js";
108
116
  import {
109
117
  DEED_RECORD_ID,
110
118
  createDeedOwner,
111
119
  isDeedVault,
112
120
  liberateVault,
113
121
  loadDeedMarker
114
- } from "./chunk-BV7KNFJY.js";
122
+ } from "./chunk-ZBDK7T6X.js";
115
123
  import {
116
124
  diffVault
117
125
  } from "./chunk-LB7FD65R.js";
118
126
  import {
119
127
  withdrawAccessibleData
120
- } from "./chunk-6CNLU4TO.js";
128
+ } from "./chunk-TYGW5TOR.js";
121
129
  import {
122
130
  exportAccessibleData
123
- } from "./chunk-7MHVHGQZ.js";
131
+ } from "./chunk-P2LDXRGP.js";
124
132
  import "./chunk-BGIZAFY7.js";
125
133
  import {
126
134
  fuseRetrieval
127
135
  } from "./chunk-AURFOK3D.js";
128
- import "./chunk-JFYIHLU3.js";
136
+ import "./chunk-3Y4QLJ6K.js";
137
+ import "./chunk-H7RYPVMJ.js";
138
+ import {
139
+ PERIODS_COLLECTION
140
+ } from "./chunk-GZZL5R73.js";
141
+ import "./chunk-GHVIKOHT.js";
129
142
  import {
130
143
  immutableGuard,
131
144
  transitionGuard,
132
145
  withGuard
133
- } from "./chunk-46YGCU6Z.js";
146
+ } from "./chunk-T2EGAXPM.js";
134
147
  import "./chunk-YMUGBZN2.js";
135
148
  import "./chunk-RUIMKQTA.js";
136
- import "./chunk-DGUR3CC4.js";
149
+ import "./chunk-GXGK22QU.js";
137
150
  import {
138
151
  CollectionFrame,
139
152
  VaultFrame
140
- } from "./chunk-BZIWKN74.js";
153
+ } from "./chunk-43ISXURO.js";
141
154
  import {
142
155
  TxCollection,
143
156
  TxContext,
144
157
  TxVault,
145
158
  runTransaction
146
- } from "./chunk-4NMFWOS2.js";
159
+ } from "./chunk-T65UZXR6.js";
147
160
  import {
148
161
  withDerivation,
149
162
  withRollup
150
- } from "./chunk-ZNI3RTFV.js";
151
- import "./chunk-P6UXDALK.js";
152
- import "./chunk-ZD4D7UM6.js";
163
+ } from "./chunk-HMXLN43G.js";
164
+ import "./chunk-RDHAGBEB.js";
165
+ import "./chunk-XYYW64LB.js";
153
166
  import {
154
167
  withMaterializedView
155
- } from "./chunk-U5DWHU3S.js";
156
- import "./chunk-CVXLJIAV.js";
157
- import "./chunk-5Z3RNFJC.js";
158
- import "./chunk-BYW7EU5L.js";
168
+ } from "./chunk-U24XHXNK.js";
169
+ import "./chunk-FH52CDEW.js";
170
+ import "./chunk-LIP6JWYK.js";
171
+ import "./chunk-HY6ZGGEC.js";
159
172
  import {
160
173
  withOverlayedView
161
- } from "./chunk-XRE4JOEO.js";
162
- import "./chunk-NMRKAGHE.js";
163
- import "./chunk-ZAWD6O46.js";
174
+ } from "./chunk-RTS23VIJ.js";
175
+ import "./chunk-ZROMNP7Q.js";
176
+ import "./chunk-VRPBEOWU.js";
164
177
  import {
165
178
  importExternalObjects,
166
179
  memoryObjectProjection
167
180
  } from "./chunk-4Q6HSHHL.js";
168
- import "./chunk-2KSPDSWI.js";
169
- import "./chunk-LKBLAUOB.js";
181
+ import "./chunk-5MRE3C4Q.js";
182
+ import "./chunk-QNTEDPWP.js";
183
+ import {
184
+ withLazy
185
+ } from "./chunk-THNJ3IKU.js";
186
+ import {
187
+ Lru,
188
+ estimateRecordBytes,
189
+ parseBytes
190
+ } from "./chunk-NO272T7Q.js";
170
191
  import {
171
192
  mergeCrdtStates,
172
193
  resolveCrdtSnapshot
173
194
  } from "./chunk-6S7T6WC4.js";
174
195
  import {
175
196
  decryptExtractedPartition
176
- } from "./chunk-6DP5HBQD.js";
197
+ } from "./chunk-6UOSONVI.js";
177
198
  import {
178
199
  SCHEMAS_COLLECTION,
179
200
  loadPersistedSchema,
180
201
  savePersistedSchema
181
- } from "./chunk-U6OM4E67.js";
202
+ } from "./chunk-TL7QR5T6.js";
182
203
  import {
183
204
  MemoryRecipientSealer,
184
205
  MemorySealingKeyProvider,
@@ -189,7 +210,7 @@ import {
189
210
  parseSealedEnvelope,
190
211
  saveSealedPassphrase,
191
212
  sealRsaOaepTlv
192
- } from "./chunk-AY4P6PHN.js";
213
+ } from "./chunk-VWGCJUTV.js";
193
214
  import {
194
215
  BLOB_CHUNKS_COLLECTION,
195
216
  BLOB_COLLECTION,
@@ -201,13 +222,13 @@ import {
201
222
  detectMagic,
202
223
  detectMimeType,
203
224
  isPreCompressed
204
- } from "./chunk-55HDKLI3.js";
225
+ } from "./chunk-Z5PIUYNB.js";
205
226
  import {
206
227
  createBundleStore,
207
228
  createPodStore,
208
229
  wrapBundleStore,
209
230
  wrapPodStore
210
- } from "./chunk-VHEEU4ZO.js";
231
+ } from "./chunk-SW56GSYC.js";
211
232
  import {
212
233
  NOYDB_BUNDLE_FORMAT_VERSION,
213
234
  NOYDB_BUNDLE_MAGIC,
@@ -221,7 +242,7 @@ import {
221
242
  resetBrotliSupportCache,
222
243
  writeNoydbBundle,
223
244
  writePod
224
- } from "./chunk-3UDPDRUC.js";
245
+ } from "./chunk-EWR7HL3K.js";
225
246
  import {
226
247
  PUBLIC_ENVELOPE_RECORD_ID,
227
248
  isPublicEnvelope,
@@ -229,15 +250,10 @@ import {
229
250
  readPublicEnvelope,
230
251
  savePublicEnvelope,
231
252
  validatePublicEnvelopeInput
232
- } from "./chunk-VBYVKOMJ.js";
253
+ } from "./chunk-3QRQOBS7.js";
233
254
  import {
234
255
  CONSENT_AUDIT_COLLECTION
235
- } from "./chunk-ZFME46HJ.js";
236
- import "./chunk-DA34OEZU.js";
237
- import {
238
- PERIODS_COLLECTION
239
- } from "./chunk-YTIAXSUE.js";
240
- import "./chunk-GHVIKOHT.js";
256
+ } from "./chunk-OPTFANOX.js";
241
257
  import {
242
258
  DICT_COLLECTION_PREFIX,
243
259
  DictionaryHandle,
@@ -247,19 +263,20 @@ import {
247
263
  isDictKeyDescriptor,
248
264
  isStaticDictDescriptor,
249
265
  staticDict
250
- } from "./chunk-PYWW4KLO.js";
266
+ } from "./chunk-44UTIDE2.js";
251
267
  import {
252
- SYNC_CREDENTIALS_COLLECTION,
253
268
  credentialStatus,
254
269
  deleteCredential,
255
270
  getCredential,
256
271
  listCredentials,
257
- putCredential
258
- } from "./chunk-NIA5VQ7G.js";
272
+ putCredential,
273
+ withTeam
274
+ } from "./chunk-NQVZB3S7.js";
259
275
  import {
260
276
  MAGIC_LINK_CONTENT_INFO_PREFIX,
261
277
  MAGIC_LINK_GRANTS_COLLECTION,
262
278
  MAGIC_LINK_KEK_INFO_PREFIX,
279
+ NO_TEAM,
263
280
  deriveMagicLinkContentKey,
264
281
  enrollAuthenticator,
265
282
  findAuthenticator,
@@ -274,7 +291,7 @@ import {
274
291
  rotatePassphrase,
275
292
  unwrapMagicLinkGrant,
276
293
  writeMagicLinkGrant
277
- } from "./chunk-OVIVYAQL.js";
294
+ } from "./chunk-LEA7WJEZ.js";
278
295
  import {
279
296
  burnPaperRecoveryEntry,
280
297
  hasRecoveryEnrolled,
@@ -288,17 +305,12 @@ import {
288
305
  unwrapDeksFromBlob,
289
306
  unwrapDeksFromPaperEntry,
290
307
  unwrapDeksFromShamirEntry
291
- } from "./chunk-IJW6K6UX.js";
292
- import {
293
- assertTierAccess,
294
- dekKey,
295
- effectiveClearance
296
- } from "./chunk-O5DNEXQC.js";
308
+ } from "./chunk-LPRPVCNY.js";
297
309
  import {
298
310
  PresenceHandle,
299
311
  SyncEngine,
300
312
  SyncTransaction
301
- } from "./chunk-LHYQE3BP.js";
313
+ } from "./chunk-OFBFAVLI.js";
302
314
  import {
303
315
  BUNDLE_STORE_POLICY,
304
316
  INDEXED_STORE_POLICY,
@@ -306,6 +318,12 @@ import {
306
318
  SyncScheduler
307
319
  } from "./chunk-VQNJ7UZL.js";
308
320
  import {
321
+ assertTierAccess,
322
+ dekKey,
323
+ effectiveClearance
324
+ } from "./chunk-BMQOH7MM.js";
325
+ import {
326
+ SYNC_CREDENTIALS_COLLECTION,
309
327
  WeakPassphraseError,
310
328
  assertStrongPassphrase,
311
329
  buildRecipientKeyringFile,
@@ -317,7 +335,7 @@ import {
317
335
  listUsers,
318
336
  listUsersWithEnvelopes,
319
337
  validatePassphrase
320
- } from "./chunk-5A6TC3RQ.js";
338
+ } from "./chunk-ZT4GWVTX.js";
321
339
  import {
322
340
  DIRECTORY_RECORD_ID,
323
341
  VISIBILITY_RECORD_PREFIX,
@@ -331,7 +349,7 @@ import {
331
349
  readUserVisibility,
332
350
  saveUserEnvelope,
333
351
  visibilityRecordId
334
- } from "./chunk-2N4MUSF3.js";
352
+ } from "./chunk-TB5RNNJ4.js";
335
353
  import {
336
354
  PolicyEnforcer,
337
355
  activeSessionCount,
@@ -346,7 +364,7 @@ import {
346
364
  revokeAllSessions,
347
365
  revokeSession,
348
366
  validateSessionPolicy
349
- } from "./chunk-PJDK2PPQ.js";
367
+ } from "./chunk-6RXPSMKR.js";
350
368
  import {
351
369
  generateULID,
352
370
  isULID
@@ -354,7 +372,7 @@ import {
354
372
  import {
355
373
  CollectionInstant,
356
374
  VaultInstant
357
- } from "./chunk-WVIIJPTJ.js";
375
+ } from "./chunk-Z3FZC5GV.js";
358
376
  import {
359
377
  diff,
360
378
  formatDiff
@@ -363,7 +381,7 @@ import {
363
381
  LedgerStore,
364
382
  applyPatch,
365
383
  computePatch
366
- } from "./chunk-DHIN36UC.js";
384
+ } from "./chunk-GQOT6QJR.js";
367
385
  import {
368
386
  LEDGER_COLLECTION,
369
387
  LEDGER_DELTAS_COLLECTION
@@ -375,15 +393,26 @@ import {
375
393
  paddedIndex,
376
394
  parseIndex,
377
395
  sha256Hex
378
- } from "./chunk-6EVZXETK.js";
379
- import "./chunk-6OQ7NKMZ.js";
380
- import "./chunk-FELHYKIO.js";
396
+ } from "./chunk-M66NAZA4.js";
397
+ import "./chunk-O2DB4C3M.js";
398
+ import "./chunk-G7RDYYTE.js";
381
399
  import {
382
400
  validateSchemaInput,
383
401
  validateSchemaOutput
384
- } from "./chunk-5EZAJEES.js";
385
- import "./chunk-6RASM2J4.js";
386
- import "./chunk-CPAROOKP.js";
402
+ } from "./chunk-OVO2RZAE.js";
403
+ import "./chunk-QKVILR7N.js";
404
+ import {
405
+ NOYDB_BACKUP_VERSION,
406
+ NOYDB_FORMAT_VERSION,
407
+ NOYDB_KEYRING_VERSION,
408
+ NOYDB_SYNC_VERSION,
409
+ SealedHandle,
410
+ createStore
411
+ } from "./chunk-LN22XH4B.js";
412
+ import "./chunk-PGFY7IRW.js";
413
+ import "./chunk-TCIUO62Z.js";
414
+ import "./chunk-UOEWDCUX.js";
415
+ import "./chunk-LP7BEXCT.js";
387
416
  import {
388
417
  base64ToBuffer,
389
418
  bufferToBase64,
@@ -392,15 +421,7 @@ import {
392
421
  derivePresenceKey,
393
422
  encryptBytes,
394
423
  encryptDeterministic
395
- } from "./chunk-L4IRFTIF.js";
396
- import {
397
- NOYDB_BACKUP_VERSION,
398
- NOYDB_FORMAT_VERSION,
399
- NOYDB_KEYRING_VERSION,
400
- NOYDB_SYNC_VERSION,
401
- SealedHandle,
402
- createStore
403
- } from "./chunk-OCDUQUAP.js";
424
+ } from "./chunk-TLJOJBZD.js";
404
425
  import {
405
426
  DEFAULT_CROSS_JOIN_MAX_ROWS,
406
427
  DEFAULT_JOIN_MAX_ROWS,
@@ -410,10 +431,10 @@ import {
410
431
  buildLiveQuery,
411
432
  executePlan,
412
433
  resetJoinWarnings
413
- } from "./chunk-N2FP26NH.js";
434
+ } from "./chunk-GBTUANXF.js";
414
435
  import {
415
436
  CollectionIndexes
416
- } from "./chunk-TICO2I2O.js";
437
+ } from "./chunk-BKGIWGCX.js";
417
438
  import {
418
439
  Aggregation,
419
440
  GROUPBY_MAX_CARDINALITY,
@@ -432,22 +453,13 @@ import {
432
453
  reduceRecords,
433
454
  reducerBuilder,
434
455
  sum
435
- } from "./chunk-NPVICKZE.js";
456
+ } from "./chunk-P5WXDYMD.js";
436
457
  import {
437
- MoneyCurrencyError,
438
- MoneyPrecisionError,
439
- MoneyUnsupportedError,
440
- decimalScaleOf,
441
458
  evaluateClause,
442
459
  evaluateFieldClause,
443
- formatScaledInt,
444
- isMoneyDescriptor,
445
- money,
446
- parseToScaledInt,
447
- readPath,
448
- rescaleScaledInt,
449
- scaleForCurrency
450
- } from "./chunk-QLQS5A7X.js";
460
+ installMoneyEngine,
461
+ readPath
462
+ } from "./chunk-ZKF6HH7V.js";
451
463
  import {
452
464
  applyI18nLocale,
453
465
  enforceScript,
@@ -457,7 +469,7 @@ import {
457
469
  resolveI18nText,
458
470
  resolvePolicy,
459
471
  validateI18nTextValue
460
- } from "./chunk-7IP75FP2.js";
472
+ } from "./chunk-4K3MQ5S3.js";
461
473
  import {
462
474
  AlreadyElevatedError,
463
475
  AmendmentForbiddenError,
@@ -567,6 +579,7 @@ import {
567
579
  StaticDictReadonlyError,
568
580
  StoreCapabilityError,
569
581
  TamperedError,
582
+ TeamNotEnabledError,
570
583
  TierDemoteDeniedError,
571
584
  TierNotGrantedError,
572
585
  TiersNotEnabledError,
@@ -580,7 +593,7 @@ import {
580
593
  UserEnvelopeOversizedError,
581
594
  ValidationError,
582
595
  VaultTemplateNotFoundError
583
- } from "./chunk-BLZRNHMG.js";
596
+ } from "./chunk-U23JUUPX.js";
584
597
  import "./chunk-PZ5AY32C.js";
585
598
 
586
599
  // src/kernel/debug.ts
@@ -1332,6 +1345,888 @@ function withDeferredNumbering(config) {
1332
1345
  };
1333
1346
  }
1334
1347
 
1348
+ // src/with-shape/money/iso4217.ts
1349
+ var MINOR_UNITS = {
1350
+ // 2-decimal majors
1351
+ EUR: 2,
1352
+ USD: 2,
1353
+ GBP: 2,
1354
+ CHF: 2,
1355
+ CAD: 2,
1356
+ AUD: 2,
1357
+ NZD: 2,
1358
+ SGD: 2,
1359
+ HKD: 2,
1360
+ CNY: 2,
1361
+ INR: 2,
1362
+ BRL: 2,
1363
+ MXN: 2,
1364
+ ZAR: 2,
1365
+ RUB: 2,
1366
+ TRY: 2,
1367
+ PLN: 2,
1368
+ SEK: 2,
1369
+ NOK: 2,
1370
+ DKK: 2,
1371
+ CZK: 2,
1372
+ HUF: 2,
1373
+ RON: 2,
1374
+ ILS: 2,
1375
+ THB: 2,
1376
+ PHP: 2,
1377
+ MYR: 2,
1378
+ IDR: 2,
1379
+ AED: 2,
1380
+ SAR: 2,
1381
+ QAR: 2,
1382
+ EGP: 2,
1383
+ // 0-decimal
1384
+ JPY: 0,
1385
+ KRW: 0,
1386
+ ISK: 0,
1387
+ CLP: 0,
1388
+ VND: 0,
1389
+ XOF: 0,
1390
+ XAF: 0,
1391
+ PYG: 0,
1392
+ // 3-decimal
1393
+ BHD: 3,
1394
+ KWD: 3,
1395
+ OMR: 3,
1396
+ TND: 3,
1397
+ JOD: 3,
1398
+ IQD: 3,
1399
+ LYD: 3
1400
+ };
1401
+ function scaleForCurrency(code) {
1402
+ const v = MINOR_UNITS[code];
1403
+ return v === void 0 ? null : v;
1404
+ }
1405
+
1406
+ // src/with-shape/money/fixed-point.ts
1407
+ function expandExponent(s) {
1408
+ const m = /^([+-]?)(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/.exec(s);
1409
+ if (!m) return s;
1410
+ const sign = m[1] === "-" ? "-" : "";
1411
+ const intp = m[2];
1412
+ const frac = m[3] ?? "";
1413
+ const exp = Number(m[4]);
1414
+ const digits = intp + frac;
1415
+ const pointPos = intp.length + exp;
1416
+ let body;
1417
+ if (pointPos <= 0) {
1418
+ body = "0." + "0".repeat(-pointPos) + digits;
1419
+ } else if (pointPos >= digits.length) {
1420
+ body = digits + "0".repeat(pointPos - digits.length);
1421
+ } else {
1422
+ body = digits.slice(0, pointPos) + "." + digits.slice(pointPos);
1423
+ }
1424
+ return sign + body;
1425
+ }
1426
+ function toCanonicalDecimalString(input) {
1427
+ let s;
1428
+ if (typeof input === "number") {
1429
+ if (!Number.isFinite(input)) return null;
1430
+ s = String(input);
1431
+ } else {
1432
+ s = input.trim();
1433
+ }
1434
+ s = expandExponent(s);
1435
+ if (s.startsWith("+")) s = s.slice(1);
1436
+ if (!/^-?(\d+(\.\d*)?|\.\d+)$/.test(s)) return null;
1437
+ return s;
1438
+ }
1439
+ function shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, mode) {
1440
+ switch (mode) {
1441
+ case "up":
1442
+ return true;
1443
+ case "down":
1444
+ return false;
1445
+ case "ceil":
1446
+ return !negative;
1447
+ case "floor":
1448
+ return negative;
1449
+ case "half-up":
1450
+ return firstDiscarded >= 5;
1451
+ case "half-down":
1452
+ return firstDiscarded > 5 || firstDiscarded === 5 && hasMoreNonZeroAfterFirst;
1453
+ case "half-even":
1454
+ if (firstDiscarded > 5) return true;
1455
+ if (firstDiscarded < 5) return false;
1456
+ return hasMoreNonZeroAfterFirst || lastKeptDigit % 2 === 1;
1457
+ }
1458
+ }
1459
+ function parseToScaledInt(input, scale, rounding) {
1460
+ const canonical = toCanonicalDecimalString(input);
1461
+ if (canonical === null) return { ok: false, reason: "nonfinite" };
1462
+ const negative = canonical.startsWith("-");
1463
+ const unsigned = negative ? canonical.slice(1) : canonical;
1464
+ const dot = unsigned.indexOf(".");
1465
+ const intPart = dot === -1 ? unsigned : unsigned.slice(0, dot);
1466
+ const fracPart = dot === -1 ? "" : unsigned.slice(dot + 1);
1467
+ const intDigits = intPart === "" ? "0" : intPart;
1468
+ if (fracPart.length <= scale) {
1469
+ const keep2 = fracPart.padEnd(scale, "0");
1470
+ const magnitude2 = BigInt(intDigits + keep2);
1471
+ return { ok: true, value: negative && magnitude2 !== 0n ? -magnitude2 : magnitude2 };
1472
+ }
1473
+ const keep = fracPart.slice(0, scale);
1474
+ const tail = fracPart.slice(scale);
1475
+ const magnitudeDigits = intDigits + keep;
1476
+ let magnitude = BigInt(magnitudeDigits);
1477
+ if (/^0+$/.test(tail)) {
1478
+ return { ok: true, value: negative && magnitude !== 0n ? -magnitude : magnitude };
1479
+ }
1480
+ if (rounding === void 0) return { ok: false, reason: "precision" };
1481
+ const lastKeptDigit = Number(magnitudeDigits[magnitudeDigits.length - 1]);
1482
+ const firstDiscarded = Number(tail[0]);
1483
+ const hasMoreNonZeroAfterFirst = /[1-9]/.test(tail.slice(1));
1484
+ if (shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, rounding)) {
1485
+ magnitude += 1n;
1486
+ }
1487
+ return { ok: true, value: negative && magnitude !== 0n ? -magnitude : magnitude };
1488
+ }
1489
+ function decimalScaleOf(input) {
1490
+ const s = toCanonicalDecimalString(input);
1491
+ if (s === null) return null;
1492
+ const dot = s.indexOf(".");
1493
+ return dot === -1 ? 0 : s.length - dot - 1;
1494
+ }
1495
+ function rescaleScaledInt(value, fromScale, toScale, rounding = "half-up") {
1496
+ if (toScale >= fromScale) return value * 10n ** BigInt(toScale - fromScale);
1497
+ const drop = fromScale - toScale;
1498
+ const negative = value < 0n;
1499
+ const absStr = (negative ? -value : value).toString().padStart(drop + 1, "0");
1500
+ const keptStr = absStr.slice(0, absStr.length - drop);
1501
+ const tail = absStr.slice(absStr.length - drop);
1502
+ let magnitude = BigInt(keptStr);
1503
+ if (!/^0+$/.test(tail)) {
1504
+ const lastKeptDigit = Number(keptStr[keptStr.length - 1]);
1505
+ const firstDiscarded = Number(tail[0]);
1506
+ const hasMoreNonZeroAfterFirst = /[1-9]/.test(tail.slice(1));
1507
+ if (shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, rounding)) {
1508
+ magnitude += 1n;
1509
+ }
1510
+ }
1511
+ return negative && magnitude !== 0n ? -magnitude : magnitude;
1512
+ }
1513
+ function formatScaledInt(value, scale) {
1514
+ const negative = value < 0n;
1515
+ const abs = (negative ? -value : value).toString();
1516
+ if (scale === 0) return (negative ? "-" : "") + abs;
1517
+ const padded = abs.padStart(scale + 1, "0");
1518
+ const cut = padded.length - scale;
1519
+ const intPart = padded.slice(0, cut);
1520
+ const fracPart = padded.slice(cut);
1521
+ return (negative ? "-" : "") + intPart + "." + fracPart;
1522
+ }
1523
+
1524
+ // src/with-shape/money/paths.ts
1525
+ var SEGMENT_RE = /^(\*|[^.[\]*]+)(\[\])?$/;
1526
+ var parseCache = /* @__PURE__ */ new Map();
1527
+ function parseMoneyPath(path) {
1528
+ const cached = parseCache.get(path);
1529
+ if (cached) return cached;
1530
+ if (typeof path !== "string" || path.length === 0) {
1531
+ throw new ValidationError("moneyFields: path must be a non-empty string");
1532
+ }
1533
+ const segments = [];
1534
+ for (const part of path.split(".")) {
1535
+ const m = SEGMENT_RE.exec(part);
1536
+ if (!m) {
1537
+ throw new ValidationError(
1538
+ `moneyFields: invalid path "${path}" \u2014 segment "${part}" must be a key, "key[]", "*", or "*[]"`
1539
+ );
1540
+ }
1541
+ const array = m[2] === "[]";
1542
+ segments.push(
1543
+ m[1] === "*" ? { kind: "wildcard", array } : { kind: "key", key: m[1], array }
1544
+ );
1545
+ }
1546
+ parseCache.set(path, segments);
1547
+ return segments;
1548
+ }
1549
+ function isSimpleMoneyPath(path) {
1550
+ return !path.includes(".") && !path.includes("[") && !path.includes("*");
1551
+ }
1552
+ function validateMoneyFieldPaths(moneyFields) {
1553
+ for (const path of Object.keys(moneyFields)) parseMoneyPath(path);
1554
+ }
1555
+ function transformAtMoneyPath(node, path, segments, index, visit, lenient) {
1556
+ if (node === null || node === void 0) return node;
1557
+ const seg = segments[index];
1558
+ const last = index === segments.length - 1;
1559
+ if (seg.kind === "key") {
1560
+ if (typeof node !== "object" || Array.isArray(node)) {
1561
+ if (lenient) return node;
1562
+ throw new ValidationError(
1563
+ `moneyFields: path "${path}" expected an object at segment "${seg.key}", got ${Array.isArray(node) ? "an array" : typeof node}`
1564
+ );
1565
+ }
1566
+ const obj2 = node;
1567
+ if (!(seg.key in obj2) || obj2[seg.key] === null || obj2[seg.key] === void 0) return node;
1568
+ if (seg.array) {
1569
+ const arr = obj2[seg.key];
1570
+ if (!Array.isArray(arr)) {
1571
+ if (lenient) return node;
1572
+ throw new ValidationError(
1573
+ `moneyFields: path "${path}" declares "${seg.key}[]" but the value is not an array`
1574
+ );
1575
+ }
1576
+ const cloned = [...arr];
1577
+ if (last) {
1578
+ for (let i = 0; i < cloned.length; i++) visit(cloned, i);
1579
+ } else {
1580
+ for (let i = 0; i < cloned.length; i++) {
1581
+ cloned[i] = transformAtMoneyPath(cloned[i], path, segments, index + 1, visit, lenient);
1582
+ }
1583
+ }
1584
+ return { ...obj2, [seg.key]: cloned };
1585
+ }
1586
+ const clone2 = { ...obj2 };
1587
+ if (last) {
1588
+ visit(clone2, seg.key);
1589
+ } else {
1590
+ clone2[seg.key] = transformAtMoneyPath(clone2[seg.key], path, segments, index + 1, visit, lenient);
1591
+ }
1592
+ return clone2;
1593
+ }
1594
+ if (seg.array) {
1595
+ if (!Array.isArray(node)) {
1596
+ if (lenient) return node;
1597
+ throw new ValidationError(`moneyFields: path "${path}" declares "*[]" but the value is not an array`);
1598
+ }
1599
+ const cloned = [...node];
1600
+ if (last) {
1601
+ for (let i = 0; i < cloned.length; i++) visit(cloned, i);
1602
+ } else {
1603
+ for (let i = 0; i < cloned.length; i++) {
1604
+ cloned[i] = transformAtMoneyPath(cloned[i], path, segments, index + 1, visit, lenient);
1605
+ }
1606
+ }
1607
+ return cloned;
1608
+ }
1609
+ if (typeof node !== "object" || Array.isArray(node)) {
1610
+ if (lenient) return node;
1611
+ throw new ValidationError(
1612
+ `moneyFields: path "${path}" applies "*" to a non-object (${Array.isArray(node) ? 'array \u2014 use "*[]"' : typeof node})`
1613
+ );
1614
+ }
1615
+ const obj = node;
1616
+ const clone = { ...obj };
1617
+ for (const key of Object.keys(obj)) {
1618
+ const v = clone[key];
1619
+ if (v === null || v === void 0) continue;
1620
+ if (last) visit(clone, key);
1621
+ else clone[key] = transformAtMoneyPath(v, path, segments, index + 1, visit, lenient);
1622
+ }
1623
+ return clone;
1624
+ }
1625
+
1626
+ // src/with-shape/money/normalize.ts
1627
+ function isMoneyValueObject(v) {
1628
+ return typeof v === "object" && v !== null && "currency" in v;
1629
+ }
1630
+ function quantizeAmount(field, input, scale, rounding) {
1631
+ const r = parseToScaledInt(input, scale, rounding);
1632
+ if (!r.ok) {
1633
+ if (r.reason === "precision") throw new MoneyPrecisionError(field, input, scale);
1634
+ throw new TypeError(`money: field "${field}" value ${JSON.stringify(input)} is not a finite decimal`);
1635
+ }
1636
+ return r.value.toString();
1637
+ }
1638
+ function canonicalizeStoredMoney(record, moneyFields) {
1639
+ if (record === null || record === void 0) return record;
1640
+ if (!moneyFields || Object.keys(moneyFields).length === 0) return record;
1641
+ return decodeMoneyFields(record, moneyFields, "raw");
1642
+ }
1643
+ function canonicalizeIncomingMoney(record, moneyFields) {
1644
+ if (!moneyFields || Object.keys(moneyFields).length === 0) return record;
1645
+ try {
1646
+ return decodeMoneyFields(
1647
+ quantizeMoneyFields(record, moneyFields),
1648
+ moneyFields,
1649
+ "raw"
1650
+ );
1651
+ } catch {
1652
+ return record;
1653
+ }
1654
+ }
1655
+ function quantizeValue(field, raw, desc) {
1656
+ if (desc.mode === "fixed") {
1657
+ const currency2 = desc.fixedCurrency;
1658
+ return quantizeAmount(field, raw, desc.scaleFor(currency2), desc.rounding);
1659
+ }
1660
+ let amount;
1661
+ let currency;
1662
+ if (isMoneyValueObject(raw)) {
1663
+ currency = String(raw.currency);
1664
+ amount = raw.amount;
1665
+ } else {
1666
+ const sole = desc.soleCurrency();
1667
+ if (sole === void 0) {
1668
+ throw new TypeError(
1669
+ `money: field "${field}" is multi-currency \u2014 write { amount, currency }, not a bare amount`
1670
+ );
1671
+ }
1672
+ currency = sole;
1673
+ amount = raw;
1674
+ }
1675
+ const scale = desc.scaleFor(currency);
1676
+ return { amount: quantizeAmount(field, amount, scale, desc.rounding), currency };
1677
+ }
1678
+ function quantizeMoneyFields(record, moneyFields) {
1679
+ let out = { ...record };
1680
+ for (const [path, desc] of Object.entries(moneyFields)) {
1681
+ if (isSimpleMoneyPath(path)) {
1682
+ const raw = out[path];
1683
+ if (raw === null || raw === void 0) continue;
1684
+ out[path] = quantizeValue(path, raw, desc);
1685
+ continue;
1686
+ }
1687
+ out = transformAtMoneyPath(
1688
+ out,
1689
+ path,
1690
+ parseMoneyPath(path),
1691
+ 0,
1692
+ (container, key) => {
1693
+ const raw = container[key];
1694
+ if (raw === null || raw === void 0) return;
1695
+ container[key] = quantizeValue(path, raw, desc);
1696
+ },
1697
+ /* lenient */
1698
+ false
1699
+ );
1700
+ }
1701
+ return out;
1702
+ }
1703
+ function formatCurrency(decimal, currency, scale, locale) {
1704
+ const fmt = new Intl.NumberFormat(locale, {
1705
+ style: "currency",
1706
+ currency,
1707
+ minimumFractionDigits: scale,
1708
+ maximumFractionDigits: scale
1709
+ });
1710
+ return fmt.format(decimal);
1711
+ }
1712
+ function moneyScaledValue(stored, desc) {
1713
+ let raw;
1714
+ if (desc.mode === "fixed") {
1715
+ raw = stored;
1716
+ } else {
1717
+ if (!isMoneyValueObject(stored)) return null;
1718
+ raw = stored.amount;
1719
+ }
1720
+ if (typeof raw !== "string" && typeof raw !== "number") return null;
1721
+ try {
1722
+ return BigInt(String(raw));
1723
+ } catch {
1724
+ return null;
1725
+ }
1726
+ }
1727
+ function decodeValue(stored, desc) {
1728
+ let currency;
1729
+ let scaledIntString;
1730
+ if (desc.mode === "fixed") {
1731
+ if (typeof stored !== "string" && typeof stored !== "number") return null;
1732
+ currency = desc.fixedCurrency;
1733
+ scaledIntString = String(stored);
1734
+ } else {
1735
+ if (!isMoneyValueObject(stored)) return null;
1736
+ const amount = stored.amount;
1737
+ if (typeof stored.currency !== "string" || typeof amount !== "string" && typeof amount !== "number") return null;
1738
+ currency = stored.currency;
1739
+ scaledIntString = String(amount);
1740
+ }
1741
+ const scale = desc.scaleFor(currency);
1742
+ let decimal;
1743
+ try {
1744
+ decimal = formatScaledInt(BigInt(scaledIntString), scale);
1745
+ } catch {
1746
+ return null;
1747
+ }
1748
+ return {
1749
+ decoded: desc.mode === "fixed" ? decimal : { amount: decimal, currency },
1750
+ decimal,
1751
+ currency,
1752
+ scale
1753
+ };
1754
+ }
1755
+ function decodeMoneyFields(record, moneyFields, locale) {
1756
+ let out = { ...record };
1757
+ const format = locale !== "raw";
1758
+ const fmtLocale = typeof locale === "string" && locale !== "raw" ? locale : "en-US";
1759
+ for (const [path, desc] of Object.entries(moneyFields)) {
1760
+ if (isSimpleMoneyPath(path)) {
1761
+ const stored = out[path];
1762
+ if (stored === null || stored === void 0) continue;
1763
+ const r = decodeValue(stored, desc);
1764
+ if (r === null) continue;
1765
+ out[path] = r.decoded;
1766
+ if (format) {
1767
+ out[`${path}Formatted`] = formatCurrency(r.decimal, r.currency, r.scale, fmtLocale);
1768
+ out[`${path}Number`] = Number(r.decimal);
1769
+ }
1770
+ continue;
1771
+ }
1772
+ out = transformAtMoneyPath(
1773
+ out,
1774
+ path,
1775
+ parseMoneyPath(path),
1776
+ 0,
1777
+ (container, key) => {
1778
+ const stored = container[key];
1779
+ if (stored === null || stored === void 0) return;
1780
+ const r = decodeValue(stored, desc);
1781
+ if (r === null) return;
1782
+ container[key] = r.decoded;
1783
+ if (format && typeof key === "string" && !Array.isArray(container)) {
1784
+ container[`${key}Formatted`] = formatCurrency(r.decimal, r.currency, r.scale, fmtLocale);
1785
+ container[`${key}Number`] = Number(r.decimal);
1786
+ }
1787
+ },
1788
+ /* lenient */
1789
+ true
1790
+ );
1791
+ }
1792
+ return out;
1793
+ }
1794
+
1795
+ // src/with-shape/money/where.ts
1796
+ function isMoneyValueObject2(v) {
1797
+ return typeof v === "object" && v !== null && "currency" in v;
1798
+ }
1799
+ function parseOperand(field, raw, desc) {
1800
+ let amount;
1801
+ let currency;
1802
+ if (desc.mode === "fixed") {
1803
+ currency = desc.fixedCurrency;
1804
+ amount = raw;
1805
+ } else if (isMoneyValueObject2(raw)) {
1806
+ currency = String(raw.currency);
1807
+ amount = raw.amount;
1808
+ } else {
1809
+ const sole = desc.soleCurrency();
1810
+ if (sole === void 0) {
1811
+ throw new MoneyUnsupportedError(
1812
+ `where("${field}"): field is multi-currency \u2014 compare against { amount, currency }, not a bare amount`
1813
+ );
1814
+ }
1815
+ currency = sole;
1816
+ amount = raw;
1817
+ }
1818
+ if (typeof amount !== "number" && typeof amount !== "string") {
1819
+ throw new MoneyUnsupportedError(
1820
+ `where("${field}"): operand ${JSON.stringify(raw)} is not a money amount`
1821
+ );
1822
+ }
1823
+ const r = parseToScaledInt(amount, desc.scaleFor(currency), desc.rounding);
1824
+ if (!r.ok) {
1825
+ throw new MoneyUnsupportedError(
1826
+ `where("${field}"): operand ${JSON.stringify(amount)} is not a finite decimal`
1827
+ );
1828
+ }
1829
+ return { scaled: r.value.toString(), currency };
1830
+ }
1831
+ function moneyFieldClause(field, op, value, desc) {
1832
+ switch (op) {
1833
+ case "==":
1834
+ case "!=":
1835
+ case "<":
1836
+ case "<=":
1837
+ case ">":
1838
+ case ">=": {
1839
+ const e = parseOperand(field, value, desc);
1840
+ return withMoney(field, op, value, desc, [e]);
1841
+ }
1842
+ case "between": {
1843
+ if (!Array.isArray(value) || value.length !== 2) {
1844
+ throw new MoneyUnsupportedError(`where("${field}"): 'between' needs a [lo, hi] tuple`);
1845
+ }
1846
+ const lo = parseOperand(field, value[0], desc);
1847
+ const hi = parseOperand(field, value[1], desc);
1848
+ if (lo.currency !== hi.currency) {
1849
+ throw new MoneyUnsupportedError(
1850
+ `where("${field}"): 'between' bounds mix currencies (${lo.currency} vs ${hi.currency})`
1851
+ );
1852
+ }
1853
+ return withMoney(field, op, value, desc, [lo, hi]);
1854
+ }
1855
+ case "in": {
1856
+ if (!Array.isArray(value)) {
1857
+ throw new MoneyUnsupportedError(`where("${field}"): 'in' needs an array of amounts`);
1858
+ }
1859
+ return withMoney(field, op, value, desc, value.map((v) => parseOperand(field, v, desc)));
1860
+ }
1861
+ default:
1862
+ throw new MoneyUnsupportedError(
1863
+ `where("${field}"): operator '${op}' is not supported on a money field`
1864
+ );
1865
+ }
1866
+ }
1867
+ function withMoney(field, op, originalValue, desc, entries) {
1868
+ const money2 = { mode: desc.mode, entries };
1869
+ const value = desc.mode !== "fixed" ? originalValue : entries.length === 1 && op !== "in" && op !== "between" ? entries[0].scaled : entries.map((e) => e.scaled);
1870
+ return { type: "field", field, op, value, money: money2 };
1871
+ }
1872
+ function readStored(actual, operand) {
1873
+ let amount;
1874
+ let currency;
1875
+ if (operand.mode === "fixed") {
1876
+ if (typeof actual !== "string" && typeof actual !== "number") return null;
1877
+ amount = actual;
1878
+ currency = operand.entries[0]?.currency ?? "";
1879
+ } else {
1880
+ if (!isMoneyValueObject2(actual)) return null;
1881
+ if (typeof actual.currency !== "string") return null;
1882
+ amount = actual.amount;
1883
+ currency = actual.currency;
1884
+ }
1885
+ if (typeof amount !== "string" && typeof amount !== "number") return null;
1886
+ try {
1887
+ return { scaled: BigInt(amount).toString(), currency };
1888
+ } catch {
1889
+ return null;
1890
+ }
1891
+ }
1892
+ function evaluateMoneyClause(actual, op, operand) {
1893
+ const stored = readStored(actual, operand);
1894
+ if (stored === null) return op === "!=";
1895
+ const a = BigInt(stored.scaled);
1896
+ if (op === "in") {
1897
+ return operand.entries.some(
1898
+ (e2) => e2.currency === stored.currency && BigInt(e2.scaled) === a
1899
+ );
1900
+ }
1901
+ if (op === "between") {
1902
+ const [lo, hi] = operand.entries;
1903
+ if (!lo || !hi || lo.currency !== stored.currency) return false;
1904
+ return a >= BigInt(lo.scaled) && a <= BigInt(hi.scaled);
1905
+ }
1906
+ const e = operand.entries[0];
1907
+ if (!e) return false;
1908
+ if (e.currency !== stored.currency) return op === "!=";
1909
+ const b = BigInt(e.scaled);
1910
+ switch (op) {
1911
+ case "==":
1912
+ return a === b;
1913
+ case "!=":
1914
+ return a !== b;
1915
+ case "<":
1916
+ return a < b;
1917
+ case "<=":
1918
+ return a <= b;
1919
+ case ">":
1920
+ return a > b;
1921
+ case ">=":
1922
+ return a >= b;
1923
+ default:
1924
+ return false;
1925
+ }
1926
+ }
1927
+
1928
+ // src/with-shape/money/money-reducer.ts
1929
+ function toScaledIntFromAny(v, scale) {
1930
+ if (typeof v === "bigint") return v;
1931
+ if (typeof v === "number") {
1932
+ const r = parseToScaledInt(v, scale);
1933
+ return r.ok ? r.value : null;
1934
+ }
1935
+ if (typeof v === "string") {
1936
+ if (!v.includes(".")) {
1937
+ try {
1938
+ return BigInt(v);
1939
+ } catch {
1940
+ return null;
1941
+ }
1942
+ }
1943
+ const r = parseToScaledInt(v, scale);
1944
+ return r.ok ? r.value : null;
1945
+ }
1946
+ return null;
1947
+ }
1948
+ function readMoney(record, field, desc) {
1949
+ const raw = readPath(record, field);
1950
+ if (raw === null || raw === void 0) return null;
1951
+ if (desc.mode === "fixed") {
1952
+ const cur = desc.fixedCurrency;
1953
+ const value2 = toScaledIntFromAny(raw, desc.scaleFor(cur));
1954
+ return value2 === null ? null : { currency: cur, value: value2 };
1955
+ }
1956
+ if (typeof raw !== "object") return null;
1957
+ const o = raw;
1958
+ if (typeof o.currency !== "string") return null;
1959
+ const scale = desc.allows(o.currency) ? desc.scaleFor(o.currency) : 0;
1960
+ const value = toScaledIntFromAny(o.amount, scale);
1961
+ return value === null ? null : { currency: o.currency, value };
1962
+ }
1963
+ function targetScaleFor(desc, currency) {
1964
+ if (desc.allows(currency)) return desc.scaleFor(currency);
1965
+ const s = scaleForCurrency(currency);
1966
+ if (s === null) {
1967
+ throw new Error(`money: cannot determine scale for conversion target "${currency}"`);
1968
+ }
1969
+ return s;
1970
+ }
1971
+ function parseRate(rate) {
1972
+ const s = String(rate).trim();
1973
+ const neg = s.startsWith("-");
1974
+ const body = neg ? s.slice(1) : s;
1975
+ const dot = body.indexOf(".");
1976
+ const intPart = dot === -1 ? body : body.slice(0, dot);
1977
+ const fracPart = dot === -1 ? "" : body.slice(dot + 1);
1978
+ const int = BigInt((intPart === "" ? "0" : intPart) + fracPart);
1979
+ return { int: neg ? -int : int, scale: fracPart.length };
1980
+ }
1981
+ function divRoundHalfEven(n, d) {
1982
+ const q = n / d;
1983
+ const r = n % d;
1984
+ const twiceR = (r < 0n ? -r : r) * 2n;
1985
+ if (twiceR < d) return q;
1986
+ if (twiceR > d) return q + (n < 0n ? -1n : 1n);
1987
+ return q % 2n === 0n ? q : q + (n < 0n ? -1n : 1n);
1988
+ }
1989
+ function convertScaled(value, srcScale, rate, targetScale) {
1990
+ const { int: rateInt, scale: rateScale } = parseRate(rate);
1991
+ const product = value * rateInt;
1992
+ const curScale = srcScale + rateScale;
1993
+ if (curScale === targetScale) return product;
1994
+ if (curScale < targetScale) return product * 10n ** BigInt(targetScale - curScale);
1995
+ return divRoundHalfEven(product, 10n ** BigInt(curScale - targetScale));
1996
+ }
1997
+ function finalizeSum(state, desc, convertTo, fx) {
1998
+ if (convertTo !== void 0) {
1999
+ if (fx === void 0) {
2000
+ throw new Error(`money: sum convertTo "${convertTo}" requires an fx rate map`);
2001
+ }
2002
+ const targetScale = targetScaleFor(desc, convertTo);
2003
+ let total = 0n;
2004
+ for (const [cur, v] of state) {
2005
+ if (cur === convertTo) {
2006
+ total += convertScaled(v, desc.scaleFor(cur), 1, targetScale);
2007
+ continue;
2008
+ }
2009
+ const rate = fx[`${cur}->${convertTo}`];
2010
+ if (rate === void 0) {
2011
+ throw new Error(`money: no fx rate for "${cur}->${convertTo}"`);
2012
+ }
2013
+ total += convertScaled(v, desc.scaleFor(cur), rate, targetScale);
2014
+ }
2015
+ return formatScaledInt(total, targetScale);
2016
+ }
2017
+ if (desc.mode === "fixed") {
2018
+ const cur = desc.fixedCurrency;
2019
+ return formatScaledInt(state.get(cur) ?? 0n, desc.scaleFor(cur));
2020
+ }
2021
+ const out = {};
2022
+ for (const [cur, v] of state) out[cur] = formatScaledInt(v, desc.scaleFor(cur));
2023
+ return out;
2024
+ }
2025
+ function moneySumReducer(field, desc, convertTo, fx) {
2026
+ return {
2027
+ op: "sum",
2028
+ field,
2029
+ init: () => /* @__PURE__ */ new Map(),
2030
+ step: (state, record) => {
2031
+ const m = readMoney(record, field, desc);
2032
+ if (m) state.set(m.currency, (state.get(m.currency) ?? 0n) + m.value);
2033
+ return state;
2034
+ },
2035
+ remove: (state, record) => {
2036
+ const m = readMoney(record, field, desc);
2037
+ if (m) state.set(m.currency, (state.get(m.currency) ?? 0n) - m.value);
2038
+ return state;
2039
+ },
2040
+ finalize: (state) => finalizeSum(state, desc, convertTo, fx)
2041
+ };
2042
+ }
2043
+ function extremum(values, op) {
2044
+ let out = values[0];
2045
+ for (let i = 1; i < values.length; i++) {
2046
+ const v = values[i];
2047
+ if (op === "min" ? v < out : v > out) out = v;
2048
+ }
2049
+ return out;
2050
+ }
2051
+ function moneyMinMaxReducer(op, field, desc) {
2052
+ return {
2053
+ op,
2054
+ field,
2055
+ init: () => /* @__PURE__ */ new Map(),
2056
+ step: (state, record) => {
2057
+ const m = readMoney(record, field, desc);
2058
+ if (m) {
2059
+ const arr = state.get(m.currency);
2060
+ if (arr) arr.push(m.value);
2061
+ else state.set(m.currency, [m.value]);
2062
+ }
2063
+ return state;
2064
+ },
2065
+ remove: (state, record) => {
2066
+ const m = readMoney(record, field, desc);
2067
+ if (m) {
2068
+ const arr = state.get(m.currency);
2069
+ if (arr) {
2070
+ const idx = arr.indexOf(m.value);
2071
+ if (idx >= 0) arr.splice(idx, 1);
2072
+ }
2073
+ }
2074
+ return state;
2075
+ },
2076
+ finalize: (state) => {
2077
+ if (desc.mode === "fixed") {
2078
+ const cur = desc.fixedCurrency;
2079
+ const arr = state.get(cur);
2080
+ if (!arr || arr.length === 0) return null;
2081
+ return formatScaledInt(extremum(arr, op), desc.scaleFor(cur));
2082
+ }
2083
+ const out = {};
2084
+ for (const [cur, arr] of state) {
2085
+ if (arr.length > 0) out[cur] = formatScaledInt(extremum(arr, op), desc.scaleFor(cur));
2086
+ }
2087
+ return out;
2088
+ }
2089
+ };
2090
+ }
2091
+ function wrapMoneyReducers(spec, moneyFields) {
2092
+ let changed = false;
2093
+ const out = {};
2094
+ for (const [key, reducer] of Object.entries(spec)) {
2095
+ const field = reducer.field;
2096
+ const desc = field ? moneyFields[field] : void 0;
2097
+ if (desc && reducer.op === "avg") {
2098
+ throw new MoneyUnsupportedError(
2099
+ field,
2100
+ `avg() is not supported on money field "${field}" in v1 \u2014 use sum() and count() and divide at the boundary.`
2101
+ );
2102
+ }
2103
+ if (desc && (reducer.op === "sum" || reducer.op === "min" || reducer.op === "max")) {
2104
+ changed = true;
2105
+ out[key] = reducer.op === "sum" ? moneySumReducer(field, desc, reducer.convertTo, reducer.fx) : moneyMinMaxReducer(reducer.op, field, desc);
2106
+ } else {
2107
+ out[key] = reducer;
2108
+ }
2109
+ }
2110
+ return changed ? out : spec;
2111
+ }
2112
+
2113
+ // src/with-shape/money/engine.ts
2114
+ function linkMoneyEngine() {
2115
+ installMoneyEngine({
2116
+ quantizeMoneyFields,
2117
+ decodeMoneyFields,
2118
+ canonicalizeStoredMoney,
2119
+ canonicalizeIncomingMoney,
2120
+ moneyScaledValue,
2121
+ validateMoneyFieldPaths,
2122
+ moneyFieldClause,
2123
+ evaluateMoneyClause,
2124
+ wrapMoneyReducers
2125
+ });
2126
+ }
2127
+
2128
+ // src/with-shape/money/descriptor.ts
2129
+ var MoneyPrecisionError = class extends NoydbError {
2130
+ constructor(field, value, scale) {
2131
+ super(
2132
+ "MONEY_PRECISION",
2133
+ `money: value ${JSON.stringify(value)} for field "${field}" exceeds scale ${scale} and no rounding mode is configured`
2134
+ );
2135
+ this.field = field;
2136
+ this.value = value;
2137
+ this.scale = scale;
2138
+ this.name = "MoneyPrecisionError";
2139
+ }
2140
+ field;
2141
+ value;
2142
+ scale;
2143
+ };
2144
+ var MoneyCurrencyError = class extends NoydbError {
2145
+ constructor(currency, reason, field) {
2146
+ super(
2147
+ "MONEY_CURRENCY",
2148
+ reason === "not-allowed" ? `money: currency "${currency}" is not allowed${field ? ` for field "${field}"` : ""}` : `money: no scale known for currency "${currency}"${field ? ` (field "${field}")` : ""} \u2014 pass an explicit scale / scaleOverrides`
2149
+ );
2150
+ this.currency = currency;
2151
+ this.reason = reason;
2152
+ this.field = field;
2153
+ this.name = "MoneyCurrencyError";
2154
+ }
2155
+ currency;
2156
+ reason;
2157
+ field;
2158
+ };
2159
+ var MoneyUnsupportedError = class extends NoydbError {
2160
+ constructor(field, message) {
2161
+ super(
2162
+ "MONEY_UNSUPPORTED",
2163
+ message ?? `money: operation is not supported on field "${field}" \u2014 use sum() and count() and divide at the boundary`
2164
+ );
2165
+ this.field = field;
2166
+ this.name = "MoneyUnsupportedError";
2167
+ }
2168
+ field;
2169
+ };
2170
+ function isMultiOptions(o) {
2171
+ return "currencies" in o;
2172
+ }
2173
+ function money(options) {
2174
+ linkMoneyEngine();
2175
+ const hasFixed = "currency" in options;
2176
+ const hasMulti = "currencies" in options;
2177
+ if (hasFixed && hasMulti) {
2178
+ throw new TypeError("money: `currency` and `currencies` are mutually exclusive");
2179
+ }
2180
+ if (!hasFixed && !hasMulti) {
2181
+ throw new TypeError("money: one of `currency` or `currencies` is required");
2182
+ }
2183
+ const rounding = options.rounding;
2184
+ if (isMultiOptions(options)) {
2185
+ const overrides = options.scaleOverrides ?? {};
2186
+ const allowList = options.currencies;
2187
+ const allows = (c) => allowList === "any" ? true : allowList.includes(c);
2188
+ const scaleFor = (c) => {
2189
+ if (!allows(c)) throw new MoneyCurrencyError(c, "not-allowed");
2190
+ const s = overrides[c] ?? scaleForCurrency(c);
2191
+ if (s === null || s === void 0) throw new MoneyCurrencyError(c, "unknown-scale");
2192
+ return s;
2193
+ };
2194
+ if (allowList !== "any") for (const c of allowList) scaleFor(c);
2195
+ const soleCurrency = () => allowList !== "any" && allowList.length === 1 ? allowList[0] : void 0;
2196
+ return {
2197
+ _noydbMoney: true,
2198
+ mode: "multi",
2199
+ options,
2200
+ rounding,
2201
+ fixedCurrency: void 0,
2202
+ scaleFor,
2203
+ allows,
2204
+ soleCurrency
2205
+ };
2206
+ }
2207
+ const currency = options.currency;
2208
+ const resolvedScale = options.scale ?? scaleForCurrency(currency);
2209
+ if (resolvedScale === null || resolvedScale === void 0) {
2210
+ throw new MoneyCurrencyError(currency, "unknown-scale");
2211
+ }
2212
+ return {
2213
+ _noydbMoney: true,
2214
+ mode: "fixed",
2215
+ options,
2216
+ rounding,
2217
+ fixedCurrency: currency,
2218
+ scaleFor(c) {
2219
+ if (c !== currency) throw new MoneyCurrencyError(c, "not-allowed");
2220
+ return resolvedScale;
2221
+ },
2222
+ allows: (c) => c === currency,
2223
+ soleCurrency: () => currency
2224
+ };
2225
+ }
2226
+ function isMoneyDescriptor(x) {
2227
+ return typeof x === "object" && x !== null && x._noydbMoney === true;
2228
+ }
2229
+
1335
2230
  // src/with-shape/money/arith.ts
1336
2231
  function parseAmount(label, amount, scale, rounding) {
1337
2232
  const r = parseToScaledInt(amount, scale, rounding);
@@ -1560,6 +2455,7 @@ export {
1560
2455
  NO_CUSTODY,
1561
2456
  NO_SEARCH,
1562
2457
  NO_SEQUENCE,
2458
+ NO_TEAM,
1563
2459
  NetworkError,
1564
2460
  NoAccessError,
1565
2461
  NonAdditiveSchemaChangeError,
@@ -1632,6 +2528,7 @@ export {
1632
2528
  SyncScheduler,
1633
2529
  SyncTransaction,
1634
2530
  TamperedError,
2531
+ TeamNotEnabledError,
1635
2532
  TierDemoteDeniedError,
1636
2533
  TierNotGrantedError,
1637
2534
  TiersNotEnabledError,
@@ -1876,6 +2773,7 @@ export {
1876
2773
  withDerivation,
1877
2774
  withGuard,
1878
2775
  withHealthCheck,
2776
+ withLazy,
1879
2777
  withLogging,
1880
2778
  withMaterializedView,
1881
2779
  withMetrics,
@@ -1884,6 +2782,7 @@ export {
1884
2782
  withRollup,
1885
2783
  withSearch,
1886
2784
  withSequence,
2785
+ withTeam,
1887
2786
  withdrawAccessibleData,
1888
2787
  wrapBundleStore,
1889
2788
  wrapPodStore,