@noy-db/hub 0.3.0-pre.2 → 0.3.0-pre.4
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.
- package/dist/adapter/index.d.ts +2 -2
- package/dist/adapter/index.js +1 -1
- package/dist/aggregate/index.d.ts +3 -3
- package/dist/aggregate/index.js +4 -4
- package/dist/api-JOXUNSKP.js +20 -0
- package/dist/as/index.d.ts +4 -4
- package/dist/as/index.js +12 -6
- package/dist/at/index.d.ts +2 -2
- package/dist/attestation/index.d.ts +3 -3
- package/dist/attestation/index.js +19 -13
- package/dist/attestation/index.js.map +1 -1
- package/dist/{backup-KMJQ66MF.js → backup-MOB27UUN.js} +12 -6
- package/dist/{backup-KMJQ66MF.js.map → backup-MOB27UUN.js.map} +1 -1
- package/dist/blobs/index.d.ts +4 -4
- package/dist/blobs/index.js +11 -5
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.d.ts +5 -5
- package/dist/bundle/index.js +21 -15
- package/dist/bundle/index.js.map +1 -1
- package/dist/{bundle-PwBGkhpe.d.ts → bundle-Bs13EZtX.d.ts} +1 -1
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.d.ts +4 -4
- package/dist/cargo/index.js +23 -17
- package/dist/{chunk-SMXWYP24.js → chunk-3QRQOBS7.js} +3 -3
- package/dist/{chunk-QHJW5EXU.js → chunk-3Y4QLJ6K.js} +2 -2
- package/dist/{chunk-NF5JWERG.js → chunk-43ISXURO.js} +2 -2
- package/dist/{chunk-5LUY7UTV.js → chunk-4K3MQ5S3.js} +2 -2
- package/dist/{chunk-QZISFCVG.js → chunk-5CY35H55.js} +11 -9
- package/dist/{chunk-QZISFCVG.js.map → chunk-5CY35H55.js.map} +1 -1
- package/dist/chunk-5EWYUR5P.js +37 -0
- package/dist/chunk-5EWYUR5P.js.map +1 -0
- package/dist/{chunk-Y22T3KQE.js → chunk-5MRE3C4Q.js} +5 -5
- package/dist/{chunk-M6OST55S.js → chunk-5W7AOFWA.js} +2 -2
- package/dist/{chunk-AXRXJTE2.js → chunk-6HNKCKFZ.js} +7 -7
- package/dist/{chunk-UAG5KWVA.js → chunk-6RXPSMKR.js} +3 -3
- package/dist/{chunk-TJYQIGAP.js → chunk-7J7JRYXW.js} +9 -5
- package/dist/chunk-7J7JRYXW.js.map +1 -0
- package/dist/{chunk-UDRIWL7A.js → chunk-A5DYVMDR.js} +3 -3
- package/dist/chunk-AF5ZRTZ4.js +108 -0
- package/dist/chunk-AF5ZRTZ4.js.map +1 -0
- package/dist/{chunk-I3TIKTJO.js → chunk-BKGIWGCX.js} +2 -2
- package/dist/{chunk-IO6GRPT6.js → chunk-BMQOH7MM.js} +2 -2
- package/dist/{chunk-26LGBE4T.js → chunk-CPXPHQGX.js} +6 -4
- package/dist/{chunk-26LGBE4T.js.map → chunk-CPXPHQGX.js.map} +1 -1
- package/dist/{chunk-FISN7WE4.js → chunk-EWR7HL3K.js} +4 -4
- package/dist/{chunk-AQTBSL7R.js → chunk-FH52CDEW.js} +5 -5
- package/dist/chunk-G4MGYGSS.js +130 -0
- package/dist/chunk-G4MGYGSS.js.map +1 -0
- package/dist/{chunk-UV5MFVO3.js → chunk-G7RDYYTE.js} +2 -2
- package/dist/{chunk-UIU2THRG.js → chunk-GBTUANXF.js} +16 -297
- package/dist/chunk-GBTUANXF.js.map +1 -0
- package/dist/{chunk-TEILUWOI.js → chunk-GOUNIHFA.js} +10 -10
- package/dist/{chunk-LXQT4WMP.js → chunk-GQOT6QJR.js} +8 -6
- package/dist/{chunk-LXQT4WMP.js.map → chunk-GQOT6QJR.js.map} +1 -1
- package/dist/{chunk-RUEKROOS.js → chunk-GXGK22QU.js} +2 -2
- package/dist/{chunk-IELYAOGG.js → chunk-GZZL5R73.js} +4 -4
- package/dist/{chunk-JNUWZ6D3.js → chunk-H5XRIJX3.js} +7 -5
- package/dist/{chunk-JNUWZ6D3.js.map → chunk-H5XRIJX3.js.map} +1 -1
- package/dist/{chunk-CWPPNPOH.js → chunk-H7RYPVMJ.js} +2 -2
- package/dist/{chunk-5N6CZTCY.js → chunk-HBKDR7R3.js} +3 -3
- package/dist/{chunk-KXGNJJXB.js → chunk-HLUKZ36Q.js} +9 -9
- package/dist/{chunk-LMTH2RM6.js → chunk-HMXLN43G.js} +2 -2
- package/dist/{chunk-BG3SPSR4.js → chunk-HY6ZGGEC.js} +2 -2
- package/dist/{chunk-UPJNJGGA.js → chunk-K5P46KB3.js} +27 -10
- package/dist/chunk-K5P46KB3.js.map +1 -0
- package/dist/chunk-KYY7L72M.js +106 -0
- package/dist/chunk-KYY7L72M.js.map +1 -0
- package/dist/{chunk-62QYRORB.js → chunk-LIP6JWYK.js} +3 -3
- package/dist/{chunk-5TDJ56JE.js → chunk-LN22XH4B.js} +1 -1
- package/dist/chunk-LN22XH4B.js.map +1 -0
- package/dist/chunk-LP7BEXCT.js +32 -0
- package/dist/chunk-LP7BEXCT.js.map +1 -0
- package/dist/{chunk-IGUYVGGI.js → chunk-LPRPVCNY.js} +5 -5
- package/dist/{chunk-AIWULCUO.js → chunk-M66NAZA4.js} +5 -3
- package/dist/{chunk-AIWULCUO.js.map → chunk-M66NAZA4.js.map} +1 -1
- package/dist/{chunk-KVOXU4T5.js → chunk-N5YVZHCB.js} +2 -2
- package/dist/{chunk-76722EBH.js → chunk-NB47TXGP.js} +14 -12
- package/dist/{chunk-76722EBH.js.map → chunk-NB47TXGP.js.map} +1 -1
- package/dist/chunk-NO272T7Q.js +194 -0
- package/dist/chunk-NO272T7Q.js.map +1 -0
- package/dist/{chunk-SRB2XEWB.js → chunk-O2DB4C3M.js} +8 -6
- package/dist/{chunk-SRB2XEWB.js.map → chunk-O2DB4C3M.js.map} +1 -1
- package/dist/{chunk-IUEN57TV.js → chunk-OFBFAVLI.js} +6 -6
- package/dist/{chunk-MTMJVJ5W.js → chunk-OPTFANOX.js} +5 -3
- package/dist/chunk-OPTFANOX.js.map +1 -0
- package/dist/{chunk-5O3AOPDT.js → chunk-OVO2RZAE.js} +212 -439
- package/dist/chunk-OVO2RZAE.js.map +1 -0
- package/dist/{chunk-GYGWYIOZ.js → chunk-P27Z66EB.js} +7 -5
- package/dist/{chunk-GYGWYIOZ.js.map → chunk-P27Z66EB.js.map} +1 -1
- package/dist/{chunk-HCIPRAGS.js → chunk-P2LDXRGP.js} +2 -2
- package/dist/chunk-P3NGV5RV.js +41 -0
- package/dist/chunk-P3NGV5RV.js.map +1 -0
- package/dist/{chunk-5R3ERCDH.js → chunk-P3V7JTB6.js} +25 -9
- package/dist/{chunk-5R3ERCDH.js.map → chunk-P3V7JTB6.js.map} +1 -1
- package/dist/{chunk-LV7M27WM.js → chunk-P5WXDYMD.js} +8 -197
- package/dist/chunk-P5WXDYMD.js.map +1 -0
- package/dist/chunk-PGFY7IRW.js +95 -0
- package/dist/chunk-PGFY7IRW.js.map +1 -0
- package/dist/chunk-QKVILR7N.js +25 -0
- package/dist/chunk-QKVILR7N.js.map +1 -0
- package/dist/{chunk-V7RWQRG7.js → chunk-QNTEDPWP.js} +3 -3
- package/dist/{chunk-Q7SS3IME.js → chunk-RDHAGBEB.js} +3 -3
- package/dist/{chunk-EIZUR2XW.js → chunk-RTS23VIJ.js} +2 -2
- package/dist/{chunk-LFLXAY2W.js → chunk-SEQ2JI3Y.js} +9 -7
- package/dist/{chunk-LFLXAY2W.js.map → chunk-SEQ2JI3Y.js.map} +1 -1
- package/dist/{chunk-AZAOEIKW.js → chunk-SW56GSYC.js} +2 -2
- package/dist/{chunk-TA66UMI4.js → chunk-T2EGAXPM.js} +2 -2
- package/dist/{chunk-SM3AVUHC.js → chunk-T45LAT2Y.js} +2 -2
- package/dist/{chunk-SKF73JOP.js → chunk-T65UZXR6.js} +3 -3
- package/dist/{chunk-ITNUCOXM.js → chunk-TB5RNNJ4.js} +7 -5
- package/dist/{chunk-ITNUCOXM.js.map → chunk-TB5RNNJ4.js.map} +1 -1
- package/dist/chunk-TCIUO62Z.js +29 -0
- package/dist/chunk-TCIUO62Z.js.map +1 -0
- package/dist/chunk-THNJ3IKU.js +17 -0
- package/dist/chunk-THNJ3IKU.js.map +1 -0
- package/dist/chunk-TLJOJBZD.js +404 -0
- package/dist/chunk-TLJOJBZD.js.map +1 -0
- package/dist/chunk-TQ3REHVF.js +95 -0
- package/dist/chunk-TQ3REHVF.js.map +1 -0
- package/dist/{chunk-DGDI2D4M.js → chunk-TVRQ3RYH.js} +28 -7
- package/dist/chunk-TVRQ3RYH.js.map +1 -0
- package/dist/{chunk-PSMV73A5.js → chunk-TYGW5TOR.js} +7 -7
- package/dist/{chunk-ZYUC53LT.js → chunk-U23JUUPX.js} +58 -2
- package/dist/{chunk-ZYUC53LT.js.map → chunk-U23JUUPX.js.map} +1 -1
- package/dist/{chunk-3YFXJ3ZP.js → chunk-U24XHXNK.js} +2 -2
- package/dist/chunk-ULIHDPKL.js +94 -0
- package/dist/chunk-ULIHDPKL.js.map +1 -0
- package/dist/chunk-UOEWDCUX.js +69 -0
- package/dist/chunk-UOEWDCUX.js.map +1 -0
- package/dist/{chunk-WWGT2MDV.js → chunk-VAWY44JW.js} +8 -8
- package/dist/{chunk-WWGT2MDV.js.map → chunk-VAWY44JW.js.map} +1 -1
- package/dist/chunk-VFRNWE5P.js +239 -0
- package/dist/chunk-VFRNWE5P.js.map +1 -0
- package/dist/{chunk-IPB7FTQX.js → chunk-VMJ5URU7.js} +10 -8
- package/dist/chunk-VMJ5URU7.js.map +1 -0
- package/dist/{chunk-VFQGRQIH.js → chunk-VPCMJ5Z4.js} +7 -5
- package/dist/{chunk-VFQGRQIH.js.map → chunk-VPCMJ5Z4.js.map} +1 -1
- package/dist/{chunk-VCTFO5CO.js → chunk-VRPBEOWU.js} +2 -2
- package/dist/{chunk-ZCGAHGUS.js → chunk-VWGCJUTV.js} +2 -2
- package/dist/{chunk-XXYIOFUB.js → chunk-XJR3COJO.js} +5 -5
- package/dist/{chunk-PKHL44ER.js → chunk-XYYW64LB.js} +2 -2
- package/dist/{chunk-IAGBDSCS.js → chunk-YFF2RP3X.js} +2 -2
- package/dist/{chunk-MD3Y6J3L.js → chunk-Z3FZC5GV.js} +7 -5
- package/dist/{chunk-MD3Y6J3L.js.map → chunk-Z3FZC5GV.js.map} +1 -1
- package/dist/{chunk-DFEMTNPJ.js → chunk-Z5PIUYNB.js} +10 -8
- package/dist/{chunk-DFEMTNPJ.js.map → chunk-Z5PIUYNB.js.map} +1 -1
- package/dist/{chunk-WYSO2NIH.js → chunk-Z7KI4WHR.js} +2 -2
- package/dist/chunk-ZKF6HH7V.js +120 -0
- package/dist/chunk-ZKF6HH7V.js.map +1 -0
- package/dist/{chunk-I2NOIW44.js → chunk-ZKYMKF2S.js} +8 -6
- package/dist/{chunk-I2NOIW44.js.map → chunk-ZKYMKF2S.js.map} +1 -1
- package/dist/{chunk-PSHOXR6C.js → chunk-ZPHDGUZZ.js} +737 -1082
- package/dist/chunk-ZPHDGUZZ.js.map +1 -0
- package/dist/{chunk-CMGR4ZEW.js → chunk-ZROMNP7Q.js} +2 -2
- package/dist/classified/index.d.ts +17 -0
- package/dist/classified/index.js +38 -0
- package/dist/collection-facade-MKEBZDWW.js +39 -0
- package/dist/computed-BMMEFRFJ.js +11 -0
- package/dist/config-drift-KGM7ZRW4.js +24 -0
- package/dist/config-drift-KGM7ZRW4.js.map +1 -0
- package/dist/consent/index.d.ts +3 -3
- package/dist/consent/index.js +10 -4
- package/dist/consent/index.js.map +1 -1
- package/dist/crdt/index.d.ts +3 -3
- package/dist/delegation-BQNIEHZE.js +25 -0
- package/dist/derivations/index.d.ts +4 -4
- package/dist/derivations/index.js +12 -6
- package/dist/describe/index.d.ts +1 -1
- package/dist/{describe-Ccd1hS7a.d.ts → describe-C6iHNlqJ.d.ts} +19 -0
- package/dist/{dev-unlock-h0K-UZTk.d.ts → dev-unlock-Cqd5Xv5J.d.ts} +1 -1
- package/dist/{enclave-UL5LW66V.js → enclave-YN6223OG.js} +47 -18
- package/dist/executor-CBTNU5VZ.js +9 -0
- package/dist/executor-DJHNSTIR.js +9 -0
- package/dist/executor-FGISLQIN.js +21 -0
- package/dist/export-accessible-P7SLRLK3.js +23 -0
- package/dist/extract-partition-RNVSFHAB.js +36 -0
- package/dist/{fanout-sidecar-GF3DJ6KR.js → fanout-sidecar-WS22Q5WH.js} +17 -14
- package/dist/fanout-sidecar-WS22Q5WH.js.map +1 -0
- package/dist/fence-watcher-DHQ775JB.js +69 -0
- package/dist/fence-watcher-DHQ775JB.js.map +1 -0
- package/dist/find-RNBG7LBY.js +11 -0
- package/dist/forget/index.js +10 -4
- package/dist/forget/index.js.map +1 -1
- package/dist/guards/index.d.ts +4 -4
- package/dist/guards/index.js +3 -3
- package/dist/{hash-CdSr06sm.d.ts → hash-D8Q5MJLA.d.ts} +7 -2
- package/dist/history/index.d.ts +4 -4
- package/dist/history/index.js +12 -6
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.js +14 -8
- package/dist/i18n/index.js.map +1 -1
- package/dist/in/index.d.ts +2 -2
- package/dist/{index-_6At2_9_.d.ts → index-D4GQe1Rx.d.ts} +1058 -49
- package/dist/{index-CGLLRtFc.d.ts → index-DRxk8q_7.d.ts} +3 -3
- package/dist/index.d.ts +60 -15
- package/dist/index.js +1081 -121
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +4 -4
- package/dist/issue-W5QG53B5.js +19 -0
- package/dist/json-schema-I22JCYCG.js +44 -0
- package/dist/json-schema-I22JCYCG.js.map +1 -0
- package/dist/kernel/index.d.ts +3 -3
- package/dist/kernel/index.js +13 -7
- package/dist/lazy/index.d.ts +21 -0
- package/dist/lazy/index.js +12 -0
- package/dist/{ledger-RYI35CDS.js → ledger-KZWBKAG5.js} +12 -6
- package/dist/liberate-GMGCHIND.js +24 -0
- package/dist/link-set-UQEIYQAM.js +31 -0
- package/dist/materialized-views/index.d.ts +4 -4
- package/dist/materialized-views/index.js +16 -10
- package/dist/{mime-magic-B4RoFj3B.d.ts → mime-magic-DmwT7OzZ.d.ts} +1 -1
- package/dist/noydb-KS2O2MRI.js +60 -0
- package/dist/on/index.d.ts +2 -2
- package/dist/on/index.js +10 -4
- package/dist/overlay-views/index.d.ts +4 -4
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.d.ts +3 -3
- package/dist/periods/index.js +13 -7
- package/dist/pod/index.d.ts +3 -3
- package/dist/pod/index.js +12 -6
- package/dist/{policy-IXK4FVXP.js → policy-YIKUH4AD.js} +5 -5
- package/dist/portability/index.d.ts +3 -3
- package/dist/portability/index.js +8 -8
- package/dist/{public-envelope-JHDQCPSX.js → public-envelope-MRN5YYZZ.js} +4 -4
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +6 -6
- package/dist/register-K6DDSIXN.js +21 -0
- package/dist/registry-IMNMHWTM.js +17 -0
- package/dist/registry-K6VUQXKV.js +19 -0
- package/dist/registry-ZVO3T4M5.js +9 -0
- package/dist/registry-ZVO3T4M5.js.map +1 -0
- package/dist/request-withdrawal-EHALV66Y.js +31 -0
- package/dist/request-withdrawal-EHALV66Y.js.map +1 -0
- package/dist/reveal-TBLTFWQ2.js +38 -0
- package/dist/reveal-TBLTFWQ2.js.map +1 -0
- package/dist/revoke-MHAUAESM.js +24 -0
- package/dist/revoke-MHAUAESM.js.map +1 -0
- package/dist/sealed-record/index.d.ts +3 -3
- package/dist/sealed-record/index.js +13 -7
- package/dist/sealed-record/index.js.map +1 -1
- package/dist/session/index.d.ts +4 -4
- package/dist/session/index.js +10 -4
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.d.ts +3 -3
- package/dist/shadow/index.js +2 -2
- package/dist/signer-PQ74YXRY.js +25 -0
- package/dist/signer-PQ74YXRY.js.map +1 -0
- package/dist/snapshots/index.d.ts +3 -3
- package/dist/snapshots/index.js +11 -5
- package/dist/snapshots/index.js.map +1 -1
- package/dist/{stale-3JWHNDIY.js → stale-7Q62KVI3.js} +2 -2
- package/dist/stale-7Q62KVI3.js.map +1 -0
- package/dist/storage-5E6YB2JY.js +21 -0
- package/dist/storage-5E6YB2JY.js.map +1 -0
- package/dist/{store-coordination-provider-3I7XWZZK.js → store-coordination-provider-JJCEMTAE.js} +3 -3
- package/dist/sync/index.d.ts +2 -2
- package/dist/sync/index.js +10 -4
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.d.ts +18 -4
- package/dist/team/index.js +24 -11
- package/dist/tiers/index.d.ts +2 -2
- package/dist/tiers/index.js +11 -5
- package/dist/to/index.d.ts +2 -2
- package/dist/to/index.js +1 -1
- package/dist/{transition-guard-DqodPNKw.d.ts → transition-guard-C4hvR-Ac.d.ts} +1 -1
- package/dist/tx/index.d.ts +3 -3
- package/dist/tx/index.js +3 -3
- package/dist/ui/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/validators-Ctgkj5qd.d.ts +101 -0
- package/dist/{vault-diff-BtpiBvic.d.ts → vault-diff-B1Ir6EGs.d.ts} +1 -1
- package/dist/verify-YB5LQHNA.js +139 -0
- package/dist/verify-YB5LQHNA.js.map +1 -0
- package/dist/walk-5C3GPKT2.js +241 -0
- package/dist/walk-5C3GPKT2.js.map +1 -0
- package/dist/with/index.d.ts +3 -3
- package/dist/with/index.js +12 -6
- package/dist/{with-materialized-view-DMmWtYfJ.d.ts → with-materialized-view-Bp65kKdQ.d.ts} +1 -1
- package/dist/{with-overlayed-view-D_IB2nkM.d.ts → with-overlayed-view-BRhdQNrK.d.ts} +1 -1
- package/dist/{with-rollup-em2wxoHP.d.ts → with-rollup-bQRPc3y1.d.ts} +1 -1
- package/dist/withdraw-accessible-JMX2TCPX.js +28 -0
- package/dist/withdraw-accessible-JMX2TCPX.js.map +1 -0
- package/package.json +11 -3
- package/dist/api-RW3KP7WU.js +0 -14
- package/dist/chunk-5O3AOPDT.js.map +0 -1
- package/dist/chunk-5TDJ56JE.js.map +0 -1
- package/dist/chunk-DGDI2D4M.js.map +0 -1
- package/dist/chunk-IPB7FTQX.js.map +0 -1
- package/dist/chunk-LV7M27WM.js.map +0 -1
- package/dist/chunk-M2YKN37S.js +0 -524
- package/dist/chunk-M2YKN37S.js.map +0 -1
- package/dist/chunk-MTMJVJ5W.js.map +0 -1
- package/dist/chunk-PSHOXR6C.js.map +0 -1
- package/dist/chunk-TJYQIGAP.js.map +0 -1
- package/dist/chunk-UIU2THRG.js.map +0 -1
- package/dist/chunk-UPJNJGGA.js.map +0 -1
- package/dist/collection-facade-GQAOGJP2.js +0 -33
- package/dist/delegation-UL5HKLER.js +0 -19
- package/dist/executor-2FWQRLMG.js +0 -15
- package/dist/executor-QZ7BXICW.js +0 -9
- package/dist/executor-Z5ZLJVTV.js +0 -9
- package/dist/export-accessible-KRV5W4GH.js +0 -17
- package/dist/extract-partition-GLKBOXFQ.js +0 -30
- package/dist/fanout-sidecar-GF3DJ6KR.js.map +0 -1
- package/dist/issue-Y6UVIR43.js +0 -13
- package/dist/liberate-CRPZEV7O.js +0 -18
- package/dist/noydb-LDEBLNHY.js +0 -50
- package/dist/registry-45RJNWGU.js +0 -9
- package/dist/registry-5GRV5VXI.js +0 -13
- package/dist/registry-WEUCHBO4.js +0 -11
- package/dist/request-withdrawal-GBPH2FDY.js +0 -25
- package/dist/revoke-TUFRGI6S.js +0 -18
- package/dist/signer-PNKTBVF7.js +0 -19
- package/dist/withdraw-accessible-FFS46EOD.js +0 -22
- /package/dist/{api-RW3KP7WU.js.map → api-JOXUNSKP.js.map} +0 -0
- /package/dist/{chunk-SMXWYP24.js.map → chunk-3QRQOBS7.js.map} +0 -0
- /package/dist/{chunk-QHJW5EXU.js.map → chunk-3Y4QLJ6K.js.map} +0 -0
- /package/dist/{chunk-NF5JWERG.js.map → chunk-43ISXURO.js.map} +0 -0
- /package/dist/{chunk-5LUY7UTV.js.map → chunk-4K3MQ5S3.js.map} +0 -0
- /package/dist/{chunk-Y22T3KQE.js.map → chunk-5MRE3C4Q.js.map} +0 -0
- /package/dist/{chunk-M6OST55S.js.map → chunk-5W7AOFWA.js.map} +0 -0
- /package/dist/{chunk-AXRXJTE2.js.map → chunk-6HNKCKFZ.js.map} +0 -0
- /package/dist/{chunk-UAG5KWVA.js.map → chunk-6RXPSMKR.js.map} +0 -0
- /package/dist/{chunk-UDRIWL7A.js.map → chunk-A5DYVMDR.js.map} +0 -0
- /package/dist/{chunk-I3TIKTJO.js.map → chunk-BKGIWGCX.js.map} +0 -0
- /package/dist/{chunk-IO6GRPT6.js.map → chunk-BMQOH7MM.js.map} +0 -0
- /package/dist/{chunk-FISN7WE4.js.map → chunk-EWR7HL3K.js.map} +0 -0
- /package/dist/{chunk-AQTBSL7R.js.map → chunk-FH52CDEW.js.map} +0 -0
- /package/dist/{chunk-UV5MFVO3.js.map → chunk-G7RDYYTE.js.map} +0 -0
- /package/dist/{chunk-TEILUWOI.js.map → chunk-GOUNIHFA.js.map} +0 -0
- /package/dist/{chunk-RUEKROOS.js.map → chunk-GXGK22QU.js.map} +0 -0
- /package/dist/{chunk-IELYAOGG.js.map → chunk-GZZL5R73.js.map} +0 -0
- /package/dist/{chunk-CWPPNPOH.js.map → chunk-H7RYPVMJ.js.map} +0 -0
- /package/dist/{chunk-5N6CZTCY.js.map → chunk-HBKDR7R3.js.map} +0 -0
- /package/dist/{chunk-KXGNJJXB.js.map → chunk-HLUKZ36Q.js.map} +0 -0
- /package/dist/{chunk-LMTH2RM6.js.map → chunk-HMXLN43G.js.map} +0 -0
- /package/dist/{chunk-BG3SPSR4.js.map → chunk-HY6ZGGEC.js.map} +0 -0
- /package/dist/{chunk-62QYRORB.js.map → chunk-LIP6JWYK.js.map} +0 -0
- /package/dist/{chunk-IGUYVGGI.js.map → chunk-LPRPVCNY.js.map} +0 -0
- /package/dist/{chunk-KVOXU4T5.js.map → chunk-N5YVZHCB.js.map} +0 -0
- /package/dist/{chunk-IUEN57TV.js.map → chunk-OFBFAVLI.js.map} +0 -0
- /package/dist/{chunk-HCIPRAGS.js.map → chunk-P2LDXRGP.js.map} +0 -0
- /package/dist/{chunk-V7RWQRG7.js.map → chunk-QNTEDPWP.js.map} +0 -0
- /package/dist/{chunk-Q7SS3IME.js.map → chunk-RDHAGBEB.js.map} +0 -0
- /package/dist/{chunk-EIZUR2XW.js.map → chunk-RTS23VIJ.js.map} +0 -0
- /package/dist/{chunk-AZAOEIKW.js.map → chunk-SW56GSYC.js.map} +0 -0
- /package/dist/{chunk-TA66UMI4.js.map → chunk-T2EGAXPM.js.map} +0 -0
- /package/dist/{chunk-SM3AVUHC.js.map → chunk-T45LAT2Y.js.map} +0 -0
- /package/dist/{chunk-SKF73JOP.js.map → chunk-T65UZXR6.js.map} +0 -0
- /package/dist/{chunk-PSMV73A5.js.map → chunk-TYGW5TOR.js.map} +0 -0
- /package/dist/{chunk-3YFXJ3ZP.js.map → chunk-U24XHXNK.js.map} +0 -0
- /package/dist/{chunk-VCTFO5CO.js.map → chunk-VRPBEOWU.js.map} +0 -0
- /package/dist/{chunk-ZCGAHGUS.js.map → chunk-VWGCJUTV.js.map} +0 -0
- /package/dist/{chunk-XXYIOFUB.js.map → chunk-XJR3COJO.js.map} +0 -0
- /package/dist/{chunk-PKHL44ER.js.map → chunk-XYYW64LB.js.map} +0 -0
- /package/dist/{chunk-IAGBDSCS.js.map → chunk-YFF2RP3X.js.map} +0 -0
- /package/dist/{chunk-WYSO2NIH.js.map → chunk-Z7KI4WHR.js.map} +0 -0
- /package/dist/{chunk-CMGR4ZEW.js.map → chunk-ZROMNP7Q.js.map} +0 -0
- /package/dist/{collection-facade-GQAOGJP2.js.map → classified/index.js.map} +0 -0
- /package/dist/{delegation-UL5HKLER.js.map → collection-facade-MKEBZDWW.js.map} +0 -0
- /package/dist/{enclave-UL5LW66V.js.map → computed-BMMEFRFJ.js.map} +0 -0
- /package/dist/{executor-2FWQRLMG.js.map → delegation-BQNIEHZE.js.map} +0 -0
- /package/dist/{executor-QZ7BXICW.js.map → enclave-YN6223OG.js.map} +0 -0
- /package/dist/{executor-Z5ZLJVTV.js.map → executor-CBTNU5VZ.js.map} +0 -0
- /package/dist/{export-accessible-KRV5W4GH.js.map → executor-DJHNSTIR.js.map} +0 -0
- /package/dist/{extract-partition-GLKBOXFQ.js.map → executor-FGISLQIN.js.map} +0 -0
- /package/dist/{issue-Y6UVIR43.js.map → export-accessible-P7SLRLK3.js.map} +0 -0
- /package/dist/{ledger-RYI35CDS.js.map → extract-partition-RNVSFHAB.js.map} +0 -0
- /package/dist/{liberate-CRPZEV7O.js.map → find-RNBG7LBY.js.map} +0 -0
- /package/dist/{noydb-LDEBLNHY.js.map → issue-W5QG53B5.js.map} +0 -0
- /package/dist/{policy-IXK4FVXP.js.map → lazy/index.js.map} +0 -0
- /package/dist/{public-envelope-JHDQCPSX.js.map → ledger-KZWBKAG5.js.map} +0 -0
- /package/dist/{registry-45RJNWGU.js.map → liberate-GMGCHIND.js.map} +0 -0
- /package/dist/{registry-5GRV5VXI.js.map → link-set-UQEIYQAM.js.map} +0 -0
- /package/dist/{registry-WEUCHBO4.js.map → noydb-KS2O2MRI.js.map} +0 -0
- /package/dist/{request-withdrawal-GBPH2FDY.js.map → policy-YIKUH4AD.js.map} +0 -0
- /package/dist/{revoke-TUFRGI6S.js.map → public-envelope-MRN5YYZZ.js.map} +0 -0
- /package/dist/{signer-PNKTBVF7.js.map → register-K6DDSIXN.js.map} +0 -0
- /package/dist/{stale-3JWHNDIY.js.map → registry-IMNMHWTM.js.map} +0 -0
- /package/dist/{withdraw-accessible-FFS46EOD.js.map → registry-K6VUQXKV.js.map} +0 -0
- /package/dist/{store-coordination-provider-3I7XWZZK.js.map → store-coordination-provider-JJCEMTAE.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
|
|
3
|
+
PUBLIC_ENVELOPE_FIELDS,
|
|
4
|
+
resolveSchema
|
|
5
|
+
} from "./chunk-WXSYDNBT.js";
|
|
6
|
+
import {
|
|
7
|
+
UserApi
|
|
8
|
+
} from "./chunk-A5DYVMDR.js";
|
|
1
9
|
import {
|
|
2
10
|
DEFAULT_FRESHNESS_MS,
|
|
3
11
|
PERSONAL_POLICY,
|
|
@@ -5,15 +13,11 @@ import {
|
|
|
5
13
|
checkGate,
|
|
6
14
|
describeGate,
|
|
7
15
|
mergePolicy
|
|
8
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HBKDR7R3.js";
|
|
9
17
|
import {
|
|
10
18
|
Collection,
|
|
11
|
-
ComputedFieldError,
|
|
12
19
|
ELEVATION_AUDIT_COLLECTION,
|
|
13
20
|
ElevatedHandle,
|
|
14
|
-
LinkEndpointError,
|
|
15
|
-
LinkIntegrityError,
|
|
16
|
-
Lru,
|
|
17
21
|
Noydb,
|
|
18
22
|
QuickUnlockStore,
|
|
19
23
|
RefIntegrityError,
|
|
@@ -21,153 +25,181 @@ import {
|
|
|
21
25
|
RefScopeError,
|
|
22
26
|
Vault,
|
|
23
27
|
createNoydb,
|
|
24
|
-
derivePersistedSchema,
|
|
25
28
|
describeAllUsersAuth,
|
|
26
29
|
describeAuthConfig,
|
|
27
30
|
describeUserAuth,
|
|
28
31
|
diagramAuthConfig,
|
|
29
|
-
estimateRecordBytes,
|
|
30
|
-
evalComputedFields,
|
|
31
|
-
isLinkCollectionName,
|
|
32
32
|
isRefArray,
|
|
33
|
-
isZodSchema,
|
|
34
33
|
memoryStore,
|
|
35
|
-
parseBytes,
|
|
36
|
-
persistSchemaIfNeeded,
|
|
37
34
|
ref,
|
|
38
35
|
refArray,
|
|
39
36
|
withArchive
|
|
40
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-ZPHDGUZZ.js";
|
|
38
|
+
import "./chunk-TQ3REHVF.js";
|
|
39
|
+
import {
|
|
40
|
+
NO_SEQUENCE,
|
|
41
|
+
SequenceStore,
|
|
42
|
+
compileSequenceFormat,
|
|
43
|
+
resolveSequenceKey,
|
|
44
|
+
withSequence
|
|
45
|
+
} from "./chunk-P27Z66EB.js";
|
|
41
46
|
import {
|
|
42
47
|
META_COLLECTION,
|
|
43
48
|
POLICY_RECORD_ID,
|
|
44
49
|
loadVaultPolicy,
|
|
45
50
|
saveVaultPolicy
|
|
46
|
-
} from "./chunk-
|
|
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";
|
|
47
59
|
import {
|
|
48
60
|
DELEGATIONS_COLLECTION,
|
|
49
61
|
issueDelegation,
|
|
50
62
|
loadActiveDelegations,
|
|
51
63
|
revokeDelegation
|
|
52
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-VPCMJ5Z4.js";
|
|
53
65
|
import {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
resolveSchema
|
|
57
|
-
} from "./chunk-WXSYDNBT.js";
|
|
66
|
+
persistSchemaIfNeeded
|
|
67
|
+
} from "./chunk-KYY7L72M.js";
|
|
58
68
|
import {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
withSequence
|
|
64
|
-
} from "./chunk-GYGWYIOZ.js";
|
|
69
|
+
derivePersistedSchema,
|
|
70
|
+
isZodSchema
|
|
71
|
+
} from "./chunk-ULIHDPKL.js";
|
|
72
|
+
import "./chunk-YFF2RP3X.js";
|
|
65
73
|
import {
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
NO_SEARCH,
|
|
75
|
+
tokenize,
|
|
76
|
+
withSearch
|
|
77
|
+
} from "./chunk-GOUNIHFA.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-
|
|
75
|
-
import "./chunk-
|
|
76
|
-
import {
|
|
77
|
-
NO_SEARCH,
|
|
78
|
-
tokenize,
|
|
79
|
-
withSearch
|
|
80
|
-
} from "./chunk-TEILUWOI.js";
|
|
81
|
-
import "./chunk-5R3ERCDH.js";
|
|
88
|
+
} from "./chunk-XJR3COJO.js";
|
|
89
|
+
import "./chunk-P3V7JTB6.js";
|
|
82
90
|
import {
|
|
83
91
|
isDiscriminant
|
|
84
92
|
} from "./chunk-PY4KJPYU.js";
|
|
85
|
-
import "./chunk-
|
|
86
|
-
import
|
|
87
|
-
|
|
93
|
+
import "./chunk-Z7KI4WHR.js";
|
|
94
|
+
import {
|
|
95
|
+
classified,
|
|
96
|
+
luhnCheck
|
|
97
|
+
} from "./chunk-VFRNWE5P.js";
|
|
98
|
+
import {
|
|
99
|
+
ClassifiedNeverStoredError,
|
|
100
|
+
ClassifiedValidationError,
|
|
101
|
+
isClassifiedFieldSpec,
|
|
102
|
+
isClassifiedGroup,
|
|
103
|
+
resolveClassifiedFields
|
|
104
|
+
} from "./chunk-AF5ZRTZ4.js";
|
|
105
|
+
import "./chunk-VMJ5URU7.js";
|
|
106
|
+
import "./chunk-N5YVZHCB.js";
|
|
88
107
|
import {
|
|
89
108
|
withCargo
|
|
90
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-5W7AOFWA.js";
|
|
91
110
|
import {
|
|
92
111
|
CustodyApi,
|
|
93
112
|
NO_CARGO,
|
|
94
113
|
NO_CUSTODY,
|
|
95
114
|
withCustody
|
|
96
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-7J7JRYXW.js";
|
|
97
116
|
import {
|
|
98
117
|
DEED_RECORD_ID,
|
|
99
118
|
createDeedOwner,
|
|
100
119
|
isDeedVault,
|
|
101
120
|
liberateVault,
|
|
102
121
|
loadDeedMarker
|
|
103
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-HLUKZ36Q.js";
|
|
123
|
+
import {
|
|
124
|
+
diffVault
|
|
125
|
+
} from "./chunk-LB7FD65R.js";
|
|
104
126
|
import {
|
|
105
127
|
withdrawAccessibleData
|
|
106
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-TYGW5TOR.js";
|
|
107
129
|
import {
|
|
108
130
|
exportAccessibleData
|
|
109
|
-
} from "./chunk-
|
|
110
|
-
import {
|
|
111
|
-
diffVault
|
|
112
|
-
} from "./chunk-LB7FD65R.js";
|
|
131
|
+
} from "./chunk-P2LDXRGP.js";
|
|
113
132
|
import "./chunk-BGIZAFY7.js";
|
|
114
133
|
import {
|
|
115
134
|
fuseRetrieval
|
|
116
135
|
} from "./chunk-AURFOK3D.js";
|
|
117
|
-
import "./chunk-
|
|
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";
|
|
118
142
|
import {
|
|
119
143
|
immutableGuard,
|
|
120
144
|
transitionGuard,
|
|
121
145
|
withGuard
|
|
122
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-T2EGAXPM.js";
|
|
123
147
|
import "./chunk-YMUGBZN2.js";
|
|
124
148
|
import "./chunk-RUIMKQTA.js";
|
|
125
|
-
import "./chunk-
|
|
149
|
+
import "./chunk-GXGK22QU.js";
|
|
126
150
|
import {
|
|
127
151
|
CollectionFrame,
|
|
128
152
|
VaultFrame
|
|
129
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-43ISXURO.js";
|
|
130
154
|
import {
|
|
131
155
|
TxCollection,
|
|
132
156
|
TxContext,
|
|
133
157
|
TxVault,
|
|
134
158
|
runTransaction
|
|
135
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-T65UZXR6.js";
|
|
136
160
|
import {
|
|
137
161
|
withDerivation,
|
|
138
162
|
withRollup
|
|
139
|
-
} from "./chunk-
|
|
140
|
-
import "./chunk-
|
|
141
|
-
import "./chunk-
|
|
163
|
+
} from "./chunk-HMXLN43G.js";
|
|
164
|
+
import "./chunk-RDHAGBEB.js";
|
|
165
|
+
import "./chunk-XYYW64LB.js";
|
|
142
166
|
import {
|
|
143
167
|
withMaterializedView
|
|
144
|
-
} from "./chunk-
|
|
145
|
-
import "./chunk-
|
|
146
|
-
import "./chunk-
|
|
147
|
-
import "./chunk-
|
|
168
|
+
} from "./chunk-U24XHXNK.js";
|
|
169
|
+
import "./chunk-FH52CDEW.js";
|
|
170
|
+
import "./chunk-LIP6JWYK.js";
|
|
171
|
+
import "./chunk-HY6ZGGEC.js";
|
|
148
172
|
import {
|
|
149
173
|
withOverlayedView
|
|
150
|
-
} from "./chunk-
|
|
151
|
-
import "./chunk-
|
|
152
|
-
import "./chunk-
|
|
174
|
+
} from "./chunk-RTS23VIJ.js";
|
|
175
|
+
import "./chunk-ZROMNP7Q.js";
|
|
176
|
+
import "./chunk-VRPBEOWU.js";
|
|
153
177
|
import {
|
|
154
178
|
importExternalObjects,
|
|
155
179
|
memoryObjectProjection
|
|
156
180
|
} from "./chunk-4Q6HSHHL.js";
|
|
157
|
-
import "./chunk-
|
|
158
|
-
import "./chunk-
|
|
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";
|
|
159
191
|
import {
|
|
160
192
|
mergeCrdtStates,
|
|
161
193
|
resolveCrdtSnapshot
|
|
162
194
|
} from "./chunk-6S7T6WC4.js";
|
|
163
195
|
import {
|
|
164
196
|
decryptExtractedPartition
|
|
165
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-5CY35H55.js";
|
|
166
198
|
import {
|
|
167
199
|
SCHEMAS_COLLECTION,
|
|
168
200
|
loadPersistedSchema,
|
|
169
201
|
savePersistedSchema
|
|
170
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-CPXPHQGX.js";
|
|
171
203
|
import {
|
|
172
204
|
MemoryRecipientSealer,
|
|
173
205
|
MemorySealingKeyProvider,
|
|
@@ -178,7 +210,7 @@ import {
|
|
|
178
210
|
parseSealedEnvelope,
|
|
179
211
|
saveSealedPassphrase,
|
|
180
212
|
sealRsaOaepTlv
|
|
181
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-VWGCJUTV.js";
|
|
182
214
|
import {
|
|
183
215
|
BLOB_CHUNKS_COLLECTION,
|
|
184
216
|
BLOB_COLLECTION,
|
|
@@ -190,13 +222,13 @@ import {
|
|
|
190
222
|
detectMagic,
|
|
191
223
|
detectMimeType,
|
|
192
224
|
isPreCompressed
|
|
193
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-Z5PIUYNB.js";
|
|
194
226
|
import {
|
|
195
227
|
createBundleStore,
|
|
196
228
|
createPodStore,
|
|
197
229
|
wrapBundleStore,
|
|
198
230
|
wrapPodStore
|
|
199
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-SW56GSYC.js";
|
|
200
232
|
import {
|
|
201
233
|
NOYDB_BUNDLE_FORMAT_VERSION,
|
|
202
234
|
NOYDB_BUNDLE_MAGIC,
|
|
@@ -210,7 +242,7 @@ import {
|
|
|
210
242
|
resetBrotliSupportCache,
|
|
211
243
|
writeNoydbBundle,
|
|
212
244
|
writePod
|
|
213
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-EWR7HL3K.js";
|
|
214
246
|
import {
|
|
215
247
|
PUBLIC_ENVELOPE_RECORD_ID,
|
|
216
248
|
isPublicEnvelope,
|
|
@@ -218,15 +250,10 @@ import {
|
|
|
218
250
|
readPublicEnvelope,
|
|
219
251
|
savePublicEnvelope,
|
|
220
252
|
validatePublicEnvelopeInput
|
|
221
|
-
} from "./chunk-
|
|
253
|
+
} from "./chunk-3QRQOBS7.js";
|
|
222
254
|
import {
|
|
223
255
|
CONSENT_AUDIT_COLLECTION
|
|
224
|
-
} from "./chunk-
|
|
225
|
-
import "./chunk-CWPPNPOH.js";
|
|
226
|
-
import {
|
|
227
|
-
PERIODS_COLLECTION
|
|
228
|
-
} from "./chunk-IELYAOGG.js";
|
|
229
|
-
import "./chunk-GHVIKOHT.js";
|
|
256
|
+
} from "./chunk-OPTFANOX.js";
|
|
230
257
|
import {
|
|
231
258
|
DICT_COLLECTION_PREFIX,
|
|
232
259
|
DictionaryHandle,
|
|
@@ -236,19 +263,21 @@ import {
|
|
|
236
263
|
isDictKeyDescriptor,
|
|
237
264
|
isStaticDictDescriptor,
|
|
238
265
|
staticDict
|
|
239
|
-
} from "./chunk-
|
|
266
|
+
} from "./chunk-SEQ2JI3Y.js";
|
|
240
267
|
import {
|
|
241
268
|
SYNC_CREDENTIALS_COLLECTION,
|
|
242
269
|
credentialStatus,
|
|
243
270
|
deleteCredential,
|
|
244
271
|
getCredential,
|
|
245
272
|
listCredentials,
|
|
246
|
-
putCredential
|
|
247
|
-
|
|
273
|
+
putCredential,
|
|
274
|
+
withTeam
|
|
275
|
+
} from "./chunk-TVRQ3RYH.js";
|
|
248
276
|
import {
|
|
249
277
|
MAGIC_LINK_CONTENT_INFO_PREFIX,
|
|
250
278
|
MAGIC_LINK_GRANTS_COLLECTION,
|
|
251
279
|
MAGIC_LINK_KEK_INFO_PREFIX,
|
|
280
|
+
NO_TEAM,
|
|
252
281
|
deriveMagicLinkContentKey,
|
|
253
282
|
enrollAuthenticator,
|
|
254
283
|
findAuthenticator,
|
|
@@ -263,7 +292,7 @@ import {
|
|
|
263
292
|
rotatePassphrase,
|
|
264
293
|
unwrapMagicLinkGrant,
|
|
265
294
|
writeMagicLinkGrant
|
|
266
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-K5P46KB3.js";
|
|
267
296
|
import {
|
|
268
297
|
burnPaperRecoveryEntry,
|
|
269
298
|
hasRecoveryEnrolled,
|
|
@@ -277,23 +306,23 @@ import {
|
|
|
277
306
|
unwrapDeksFromBlob,
|
|
278
307
|
unwrapDeksFromPaperEntry,
|
|
279
308
|
unwrapDeksFromShamirEntry
|
|
280
|
-
} from "./chunk-
|
|
281
|
-
import {
|
|
282
|
-
assertTierAccess,
|
|
283
|
-
dekKey,
|
|
284
|
-
effectiveClearance
|
|
285
|
-
} from "./chunk-IO6GRPT6.js";
|
|
309
|
+
} from "./chunk-LPRPVCNY.js";
|
|
286
310
|
import {
|
|
287
311
|
PresenceHandle,
|
|
288
312
|
SyncEngine,
|
|
289
313
|
SyncTransaction
|
|
290
|
-
} from "./chunk-
|
|
314
|
+
} from "./chunk-OFBFAVLI.js";
|
|
291
315
|
import {
|
|
292
316
|
BUNDLE_STORE_POLICY,
|
|
293
317
|
INDEXED_STORE_POLICY,
|
|
294
318
|
POD_STORE_POLICY,
|
|
295
319
|
SyncScheduler
|
|
296
320
|
} from "./chunk-VQNJ7UZL.js";
|
|
321
|
+
import {
|
|
322
|
+
assertTierAccess,
|
|
323
|
+
dekKey,
|
|
324
|
+
effectiveClearance
|
|
325
|
+
} from "./chunk-BMQOH7MM.js";
|
|
297
326
|
import {
|
|
298
327
|
WeakPassphraseError,
|
|
299
328
|
assertStrongPassphrase,
|
|
@@ -306,7 +335,7 @@ import {
|
|
|
306
335
|
listUsers,
|
|
307
336
|
listUsersWithEnvelopes,
|
|
308
337
|
validatePassphrase
|
|
309
|
-
} from "./chunk-
|
|
338
|
+
} from "./chunk-VAWY44JW.js";
|
|
310
339
|
import {
|
|
311
340
|
DIRECTORY_RECORD_ID,
|
|
312
341
|
VISIBILITY_RECORD_PREFIX,
|
|
@@ -320,7 +349,7 @@ import {
|
|
|
320
349
|
readUserVisibility,
|
|
321
350
|
saveUserEnvelope,
|
|
322
351
|
visibilityRecordId
|
|
323
|
-
} from "./chunk-
|
|
352
|
+
} from "./chunk-TB5RNNJ4.js";
|
|
324
353
|
import {
|
|
325
354
|
PolicyEnforcer,
|
|
326
355
|
activeSessionCount,
|
|
@@ -335,7 +364,7 @@ import {
|
|
|
335
364
|
revokeAllSessions,
|
|
336
365
|
revokeSession,
|
|
337
366
|
validateSessionPolicy
|
|
338
|
-
} from "./chunk-
|
|
367
|
+
} from "./chunk-6RXPSMKR.js";
|
|
339
368
|
import {
|
|
340
369
|
generateULID,
|
|
341
370
|
isULID
|
|
@@ -343,7 +372,7 @@ import {
|
|
|
343
372
|
import {
|
|
344
373
|
CollectionInstant,
|
|
345
374
|
VaultInstant
|
|
346
|
-
} from "./chunk-
|
|
375
|
+
} from "./chunk-Z3FZC5GV.js";
|
|
347
376
|
import {
|
|
348
377
|
diff,
|
|
349
378
|
formatDiff
|
|
@@ -352,7 +381,7 @@ import {
|
|
|
352
381
|
LedgerStore,
|
|
353
382
|
applyPatch,
|
|
354
383
|
computePatch
|
|
355
|
-
} from "./chunk-
|
|
384
|
+
} from "./chunk-GQOT6QJR.js";
|
|
356
385
|
import {
|
|
357
386
|
LEDGER_COLLECTION,
|
|
358
387
|
LEDGER_DELTAS_COLLECTION
|
|
@@ -364,20 +393,14 @@ import {
|
|
|
364
393
|
paddedIndex,
|
|
365
394
|
parseIndex,
|
|
366
395
|
sha256Hex
|
|
367
|
-
} from "./chunk-
|
|
368
|
-
import "./chunk-
|
|
369
|
-
import "./chunk-
|
|
396
|
+
} from "./chunk-M66NAZA4.js";
|
|
397
|
+
import "./chunk-O2DB4C3M.js";
|
|
398
|
+
import "./chunk-G7RDYYTE.js";
|
|
370
399
|
import {
|
|
371
|
-
base64ToBuffer,
|
|
372
|
-
bufferToBase64,
|
|
373
|
-
decryptBytes,
|
|
374
|
-
decryptDeterministic,
|
|
375
|
-
derivePresenceKey,
|
|
376
|
-
encryptBytes,
|
|
377
|
-
encryptDeterministic,
|
|
378
400
|
validateSchemaInput,
|
|
379
401
|
validateSchemaOutput
|
|
380
|
-
} from "./chunk-
|
|
402
|
+
} from "./chunk-OVO2RZAE.js";
|
|
403
|
+
import "./chunk-QKVILR7N.js";
|
|
381
404
|
import {
|
|
382
405
|
NOYDB_BACKUP_VERSION,
|
|
383
406
|
NOYDB_FORMAT_VERSION,
|
|
@@ -385,7 +408,20 @@ import {
|
|
|
385
408
|
NOYDB_SYNC_VERSION,
|
|
386
409
|
SealedHandle,
|
|
387
410
|
createStore
|
|
388
|
-
} from "./chunk-
|
|
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";
|
|
416
|
+
import {
|
|
417
|
+
base64ToBuffer,
|
|
418
|
+
bufferToBase64,
|
|
419
|
+
decryptBytes,
|
|
420
|
+
decryptDeterministic,
|
|
421
|
+
derivePresenceKey,
|
|
422
|
+
encryptBytes,
|
|
423
|
+
encryptDeterministic
|
|
424
|
+
} from "./chunk-TLJOJBZD.js";
|
|
389
425
|
import {
|
|
390
426
|
DEFAULT_CROSS_JOIN_MAX_ROWS,
|
|
391
427
|
DEFAULT_JOIN_MAX_ROWS,
|
|
@@ -395,10 +431,10 @@ import {
|
|
|
395
431
|
buildLiveQuery,
|
|
396
432
|
executePlan,
|
|
397
433
|
resetJoinWarnings
|
|
398
|
-
} from "./chunk-
|
|
434
|
+
} from "./chunk-GBTUANXF.js";
|
|
399
435
|
import {
|
|
400
436
|
CollectionIndexes
|
|
401
|
-
} from "./chunk-
|
|
437
|
+
} from "./chunk-BKGIWGCX.js";
|
|
402
438
|
import {
|
|
403
439
|
Aggregation,
|
|
404
440
|
GROUPBY_MAX_CARDINALITY,
|
|
@@ -417,22 +453,13 @@ import {
|
|
|
417
453
|
reduceRecords,
|
|
418
454
|
reducerBuilder,
|
|
419
455
|
sum
|
|
420
|
-
} from "./chunk-
|
|
456
|
+
} from "./chunk-P5WXDYMD.js";
|
|
421
457
|
import {
|
|
422
|
-
MoneyCurrencyError,
|
|
423
|
-
MoneyPrecisionError,
|
|
424
|
-
MoneyUnsupportedError,
|
|
425
|
-
decimalScaleOf,
|
|
426
458
|
evaluateClause,
|
|
427
459
|
evaluateFieldClause,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
parseToScaledInt,
|
|
432
|
-
readPath,
|
|
433
|
-
rescaleScaledInt,
|
|
434
|
-
scaleForCurrency
|
|
435
|
-
} from "./chunk-M2YKN37S.js";
|
|
460
|
+
installMoneyEngine,
|
|
461
|
+
readPath
|
|
462
|
+
} from "./chunk-ZKF6HH7V.js";
|
|
436
463
|
import {
|
|
437
464
|
applyI18nLocale,
|
|
438
465
|
enforceScript,
|
|
@@ -442,7 +469,7 @@ import {
|
|
|
442
469
|
resolveI18nText,
|
|
443
470
|
resolvePolicy,
|
|
444
471
|
validateI18nTextValue
|
|
445
|
-
} from "./chunk-
|
|
472
|
+
} from "./chunk-4K3MQ5S3.js";
|
|
446
473
|
import {
|
|
447
474
|
AlreadyElevatedError,
|
|
448
475
|
AmendmentForbiddenError,
|
|
@@ -454,6 +481,11 @@ import {
|
|
|
454
481
|
BundleSealMismatchError,
|
|
455
482
|
BundleVersionConflictError,
|
|
456
483
|
CargoNotEnabledError,
|
|
484
|
+
ClassifiedConfigError,
|
|
485
|
+
ClassifiedNotEnabledError,
|
|
486
|
+
ClassifiedRevealError,
|
|
487
|
+
ClassifiedRotationError,
|
|
488
|
+
ClassifiedVerifyError,
|
|
457
489
|
ConflictError,
|
|
458
490
|
CrossJoinSourceUnknownError,
|
|
459
491
|
CrossJoinTooLargeError,
|
|
@@ -547,6 +579,7 @@ import {
|
|
|
547
579
|
StaticDictReadonlyError,
|
|
548
580
|
StoreCapabilityError,
|
|
549
581
|
TamperedError,
|
|
582
|
+
TeamNotEnabledError,
|
|
550
583
|
TierDemoteDeniedError,
|
|
551
584
|
TierNotGrantedError,
|
|
552
585
|
TiersNotEnabledError,
|
|
@@ -560,7 +593,7 @@ import {
|
|
|
560
593
|
UserEnvelopeOversizedError,
|
|
561
594
|
ValidationError,
|
|
562
595
|
VaultTemplateNotFoundError
|
|
563
|
-
} from "./chunk-
|
|
596
|
+
} from "./chunk-U23JUUPX.js";
|
|
564
597
|
import "./chunk-PZ5AY32C.js";
|
|
565
598
|
|
|
566
599
|
// src/kernel/debug.ts
|
|
@@ -581,6 +614,34 @@ function readPlaintextRecord(envelope) {
|
|
|
581
614
|
return JSON.parse(envelope._data);
|
|
582
615
|
}
|
|
583
616
|
|
|
617
|
+
// src/with-shape/introspection/projection.ts
|
|
618
|
+
function applyListProjection(desc, record, opts) {
|
|
619
|
+
const out = { ...record };
|
|
620
|
+
for (const f of desc.fields) {
|
|
621
|
+
if (f.classified !== void 0) {
|
|
622
|
+
const list = f.classified.list;
|
|
623
|
+
if (list === "omit") {
|
|
624
|
+
delete out[f.key];
|
|
625
|
+
continue;
|
|
626
|
+
}
|
|
627
|
+
if ("mask" in list) {
|
|
628
|
+
out[f.key] = list.mask.replace(/\$\{(\w+)\}/g, (_m, rider) => {
|
|
629
|
+
const v = record[`${f.key}_${rider}`];
|
|
630
|
+
return v === void 0 || v === null ? "\u2022" : `${v}`;
|
|
631
|
+
});
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
out[f.key] = record[`${f.key}_${list.rider}`];
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
if (opts?.sensitivity !== void 0 && (f.sensitivity === "pii" || f.sensitivity === "secret")) {
|
|
638
|
+
if (opts.sensitivity === "omit") delete out[f.key];
|
|
639
|
+
else out[f.key] = "\u2022\u2022\u2022";
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return out;
|
|
643
|
+
}
|
|
644
|
+
|
|
584
645
|
// src/with-shape/schema-update/strategies.ts
|
|
585
646
|
function blindUpdate() {
|
|
586
647
|
return { name: "blindUpdate", onSchemaDelta: () => ({ action: "allow" }) };
|
|
@@ -1284,6 +1345,888 @@ function withDeferredNumbering(config) {
|
|
|
1284
1345
|
};
|
|
1285
1346
|
}
|
|
1286
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
|
+
|
|
1287
2230
|
// src/with-shape/money/arith.ts
|
|
1288
2231
|
function parseAmount(label, amount, scale, rounding) {
|
|
1289
2232
|
const r = parseToScaledInt(amount, scale, rounding);
|
|
@@ -1410,6 +2353,13 @@ export {
|
|
|
1410
2353
|
BundleVersionConflictError,
|
|
1411
2354
|
CONSENT_AUDIT_COLLECTION,
|
|
1412
2355
|
CargoNotEnabledError,
|
|
2356
|
+
ClassifiedConfigError,
|
|
2357
|
+
ClassifiedNeverStoredError,
|
|
2358
|
+
ClassifiedNotEnabledError,
|
|
2359
|
+
ClassifiedRevealError,
|
|
2360
|
+
ClassifiedRotationError,
|
|
2361
|
+
ClassifiedValidationError,
|
|
2362
|
+
ClassifiedVerifyError,
|
|
1413
2363
|
Collection,
|
|
1414
2364
|
CollectionFrame,
|
|
1415
2365
|
CollectionIndexes,
|
|
@@ -1505,6 +2455,7 @@ export {
|
|
|
1505
2455
|
NO_CUSTODY,
|
|
1506
2456
|
NO_SEARCH,
|
|
1507
2457
|
NO_SEQUENCE,
|
|
2458
|
+
NO_TEAM,
|
|
1508
2459
|
NetworkError,
|
|
1509
2460
|
NoAccessError,
|
|
1510
2461
|
NonAdditiveSchemaChangeError,
|
|
@@ -1577,6 +2528,7 @@ export {
|
|
|
1577
2528
|
SyncScheduler,
|
|
1578
2529
|
SyncTransaction,
|
|
1579
2530
|
TamperedError,
|
|
2531
|
+
TeamNotEnabledError,
|
|
1580
2532
|
TierDemoteDeniedError,
|
|
1581
2533
|
TierNotGrantedError,
|
|
1582
2534
|
TiersNotEnabledError,
|
|
@@ -1606,6 +2558,7 @@ export {
|
|
|
1606
2558
|
allocate,
|
|
1607
2559
|
applyI18nLocale,
|
|
1608
2560
|
applyJoins,
|
|
2561
|
+
applyListProjection,
|
|
1609
2562
|
applyPatch,
|
|
1610
2563
|
approveWithdrawal,
|
|
1611
2564
|
asMoney,
|
|
@@ -1620,6 +2573,7 @@ export {
|
|
|
1620
2573
|
burnPaperRecoveryEntry,
|
|
1621
2574
|
canonicalJson,
|
|
1622
2575
|
checkGate,
|
|
2576
|
+
classified,
|
|
1623
2577
|
clearDevUnlock,
|
|
1624
2578
|
compileSequenceFormat,
|
|
1625
2579
|
computePatch,
|
|
@@ -1685,6 +2639,8 @@ export {
|
|
|
1685
2639
|
immutableGuard,
|
|
1686
2640
|
importExternalObjects,
|
|
1687
2641
|
inferScripts,
|
|
2642
|
+
isClassifiedFieldSpec,
|
|
2643
|
+
isClassifiedGroup,
|
|
1688
2644
|
isDeedVault,
|
|
1689
2645
|
isDevUnlockActive,
|
|
1690
2646
|
isDictCollectionName,
|
|
@@ -1723,6 +2679,7 @@ export {
|
|
|
1723
2679
|
loadUserEnvelope,
|
|
1724
2680
|
loadVaultPolicy,
|
|
1725
2681
|
lockSchema,
|
|
2682
|
+
luhnCheck,
|
|
1726
2683
|
magicLinkGrantRecordId,
|
|
1727
2684
|
max,
|
|
1728
2685
|
memoryObjectProjection,
|
|
@@ -1769,6 +2726,7 @@ export {
|
|
|
1769
2726
|
requestWithdrawal,
|
|
1770
2727
|
resetBrotliSupportCache,
|
|
1771
2728
|
resetJoinWarnings,
|
|
2729
|
+
resolveClassifiedFields,
|
|
1772
2730
|
resolveCrdtSnapshot,
|
|
1773
2731
|
resolveI18nText,
|
|
1774
2732
|
resolvePolicy,
|
|
@@ -1815,6 +2773,7 @@ export {
|
|
|
1815
2773
|
withDerivation,
|
|
1816
2774
|
withGuard,
|
|
1817
2775
|
withHealthCheck,
|
|
2776
|
+
withLazy,
|
|
1818
2777
|
withLogging,
|
|
1819
2778
|
withMaterializedView,
|
|
1820
2779
|
withMetrics,
|
|
@@ -1823,6 +2782,7 @@ export {
|
|
|
1823
2782
|
withRollup,
|
|
1824
2783
|
withSearch,
|
|
1825
2784
|
withSequence,
|
|
2785
|
+
withTeam,
|
|
1826
2786
|
withdrawAccessibleData,
|
|
1827
2787
|
wrapBundleStore,
|
|
1828
2788
|
wrapPodStore,
|