@noy-db/hub 0.2.0-pre.9 → 0.3.0-pre.10
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/README.md +129 -3
- package/dist/aggregate/index.d.ts +5 -2
- package/dist/aggregate/index.js +25 -16
- package/dist/aggregate/index.js.map +1 -1
- package/dist/api-TX2EX2FX.js +20 -0
- package/dist/as/index.d.ts +6 -0
- package/dist/as/index.js +30 -0
- package/dist/at/index.d.ts +4 -0
- package/dist/at/index.js +1 -0
- package/dist/attestation/index.d.ts +14 -47
- package/dist/attestation/index.js +60 -10
- package/dist/attestation/index.js.map +1 -1
- package/dist/backup-R7NTDFKY.js +225 -0
- package/dist/backup-R7NTDFKY.js.map +1 -0
- package/dist/blobs/index.d.ts +5 -8
- package/dist/blobs/index.js +25 -12
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.d.ts +15 -70
- package/dist/bundle/index.js +45 -476
- package/dist/bundle/index.js.map +1 -1
- package/dist/{ulid-CJ8RzRrm.d.ts → bundle-D6GxiUfq.d.ts} +31 -86
- package/dist/by/index.d.ts +1 -0
- package/dist/by/index.js +11 -0
- package/dist/cargo/index.d.ts +7 -0
- package/dist/cargo/index.js +95 -0
- package/dist/chunk-2OV5NVE7.js +95 -0
- package/dist/chunk-2OV5NVE7.js.map +1 -0
- package/dist/chunk-2OZXVKVP.js +367 -0
- package/dist/chunk-2OZXVKVP.js.map +1 -0
- package/dist/{chunk-HNRHLRDC.js → chunk-2REPHKET.js} +6 -5
- package/dist/chunk-2REPHKET.js.map +1 -0
- package/dist/{chunk-PE2FR4J3.js → chunk-3JXPAHOZ.js} +17 -17
- package/dist/chunk-3JXPAHOZ.js.map +1 -0
- package/dist/{chunk-H2X3ISXG.js → chunk-3MATJ6O4.js} +7 -7
- package/dist/chunk-3MATJ6O4.js.map +1 -0
- package/dist/{chunk-PP6W64Y3.js → chunk-3OPY6MK2.js} +132 -3
- package/dist/chunk-3OPY6MK2.js.map +1 -0
- package/dist/{chunk-T7JEBOGN.js → chunk-3QSIU3UT.js} +49 -71
- package/dist/chunk-3QSIU3UT.js.map +1 -0
- package/dist/{chunk-ZYWZWG6G.js → chunk-4OMCIY6F.js} +32 -12
- package/dist/chunk-4OMCIY6F.js.map +1 -0
- package/dist/chunk-4Q6HSHHL.js +90 -0
- package/dist/chunk-4Q6HSHHL.js.map +1 -0
- package/dist/chunk-5I35DOHK.js +94 -0
- package/dist/chunk-5I35DOHK.js.map +1 -0
- package/dist/chunk-5VG4IJR7.js +235 -0
- package/dist/chunk-5VG4IJR7.js.map +1 -0
- package/dist/chunk-5YESYH2C.js +155 -0
- package/dist/chunk-5YESYH2C.js.map +1 -0
- package/dist/chunk-6G5ORS5D.js +202 -0
- package/dist/chunk-6G5ORS5D.js.map +1 -0
- package/dist/{chunk-VTKGMEPP.js → chunk-6P5XCKSD.js} +13 -3
- package/dist/chunk-6P5XCKSD.js.map +1 -0
- package/dist/{chunk-J66GRPNH.js → chunk-6S7T6WC4.js} +2 -2
- package/dist/chunk-6S7T6WC4.js.map +1 -0
- package/dist/{chunk-U26HQ6KJ.js → chunk-7BWJHO2A.js} +4 -4
- package/dist/chunk-7BWJHO2A.js.map +1 -0
- package/dist/chunk-7P2SDJG3.js +279 -0
- package/dist/chunk-7P2SDJG3.js.map +1 -0
- package/dist/chunk-ANB77BVV.js +150 -0
- package/dist/chunk-ANB77BVV.js.map +1 -0
- package/dist/chunk-AURFOK3D.js +35 -0
- package/dist/chunk-AURFOK3D.js.map +1 -0
- package/dist/chunk-BKARNZJN.js +382 -0
- package/dist/chunk-BKARNZJN.js.map +1 -0
- package/dist/{chunk-3BFJOWSU.js → chunk-BQISD5ZV.js} +35 -7
- package/dist/chunk-BQISD5ZV.js.map +1 -0
- package/dist/{chunk-2GLDA55J.js → chunk-BUAQ7YI3.js} +260 -135
- package/dist/chunk-BUAQ7YI3.js.map +1 -0
- package/dist/{chunk-2WUSG3IT.js → chunk-CB7CWSKW.js} +5 -5
- package/dist/chunk-CB7CWSKW.js.map +1 -0
- package/dist/chunk-CHFZDSE4.js +1 -0
- package/dist/{aggregate/index.cjs → chunk-DFVUTGT2.js} +206 -222
- package/dist/chunk-DFVUTGT2.js.map +1 -0
- package/dist/chunk-DJ7KIPLV.js +23 -0
- package/dist/chunk-DJ7KIPLV.js.map +1 -0
- package/dist/chunk-DSKDQP3G.js +14066 -0
- package/dist/chunk-DSKDQP3G.js.map +1 -0
- package/dist/{chunk-5T22KDPN.js → chunk-DV4HUP5G.js} +10 -8
- package/dist/chunk-DV4HUP5G.js.map +1 -0
- package/dist/chunk-EOXAAJTY.js +621 -0
- package/dist/chunk-EOXAAJTY.js.map +1 -0
- package/dist/chunk-ET67AY6B.js +74 -0
- package/dist/chunk-ET67AY6B.js.map +1 -0
- package/dist/chunk-F4CEK5YM.js +123 -0
- package/dist/chunk-F4CEK5YM.js.map +1 -0
- package/dist/chunk-FORYWFN6.js +130 -0
- package/dist/chunk-FORYWFN6.js.map +1 -0
- package/dist/{chunk-JWRVQKRZ.js → chunk-FRP6D2DM.js} +21 -20
- package/dist/chunk-FRP6D2DM.js.map +1 -0
- package/dist/chunk-FUOE7UUV.js +341 -0
- package/dist/chunk-FUOE7UUV.js.map +1 -0
- package/dist/chunk-G4JYND6L.js +42 -0
- package/dist/chunk-G4JYND6L.js.map +1 -0
- package/dist/{chunk-53XBRIRT.js → chunk-G6XV4H65.js} +9 -9
- package/dist/chunk-G6XV4H65.js.map +1 -0
- package/dist/chunk-GHVIKOHT.js +1 -0
- package/dist/{chunk-PX35GA7L.js → chunk-GNMXXTMN.js} +11 -9
- package/dist/chunk-GNMXXTMN.js.map +1 -0
- package/dist/chunk-GYGLAVCX.js +19 -0
- package/dist/chunk-GYGLAVCX.js.map +1 -0
- package/dist/chunk-HPWKV3YB.js +21 -0
- package/dist/chunk-HPWKV3YB.js.map +1 -0
- package/dist/chunk-HY3AUMFI.js +41 -0
- package/dist/chunk-HY3AUMFI.js.map +1 -0
- package/dist/chunk-HYR4WZZ3.js +69 -0
- package/dist/chunk-HYR4WZZ3.js.map +1 -0
- package/dist/chunk-I7FD46FF.js +9 -0
- package/dist/chunk-I7FD46FF.js.map +1 -0
- package/dist/{chunk-TFBP23BX.js → chunk-ICXIFFYZ.js} +66 -7
- package/dist/chunk-ICXIFFYZ.js.map +1 -0
- package/dist/{chunk-TV3YZ35S.js → chunk-IGJCYUT5.js} +17 -8
- package/dist/chunk-IGJCYUT5.js.map +1 -0
- package/dist/{chunk-F3GDRNUT.js → chunk-IVLTXX4W.js} +36 -68
- package/dist/chunk-IVLTXX4W.js.map +1 -0
- package/dist/{chunk-DONMZAD2.js → chunk-J4LPNIGK.js} +62 -169
- package/dist/chunk-J4LPNIGK.js.map +1 -0
- package/dist/chunk-JJZ2LW6T.js +36 -0
- package/dist/chunk-JJZ2LW6T.js.map +1 -0
- package/dist/chunk-JK733I5V.js +23 -0
- package/dist/chunk-JK733I5V.js.map +1 -0
- package/dist/{chunk-3YPCK6JX.js → chunk-KJ2BCBTL.js} +181 -422
- package/dist/chunk-KJ2BCBTL.js.map +1 -0
- package/dist/chunk-KNZB6JMR.js +129 -0
- package/dist/chunk-KNZB6JMR.js.map +1 -0
- package/dist/{chunk-OIF6LZUR.js → chunk-KPZS5QAQ.js} +30 -11
- package/dist/chunk-KPZS5QAQ.js.map +1 -0
- package/dist/chunk-LB7FD65R.js +163 -0
- package/dist/chunk-LB7FD65R.js.map +1 -0
- package/dist/{chunk-DO7C2TOG.js → chunk-LEJIKBBB.js} +3 -3
- package/dist/{chunk-DO7C2TOG.js.map → chunk-LEJIKBBB.js.map} +1 -1
- package/dist/{chunk-O3VZPBZG.js → chunk-LL2NIVUR.js} +56 -13
- package/dist/chunk-LL2NIVUR.js.map +1 -0
- package/dist/chunk-LP7BEXCT.js +32 -0
- package/dist/chunk-LP7BEXCT.js.map +1 -0
- package/dist/chunk-MCHVVJIA.js +968 -0
- package/dist/chunk-MCHVVJIA.js.map +1 -0
- package/dist/chunk-NO272T7Q.js +194 -0
- package/dist/chunk-NO272T7Q.js.map +1 -0
- package/dist/{chunk-22DWZL57.js → chunk-NUEQU36L.js} +70 -267
- package/dist/chunk-NUEQU36L.js.map +1 -0
- package/dist/chunk-O45M6LDB.js +38 -0
- package/dist/chunk-O45M6LDB.js.map +1 -0
- package/dist/chunk-OBKWYKYC.js +117 -0
- package/dist/chunk-OBKWYKYC.js.map +1 -0
- package/dist/{chunk-DJHHA6XH.js → chunk-OHHKHSJP.js} +50 -20
- package/dist/chunk-OHHKHSJP.js.map +1 -0
- package/dist/chunk-OT76OZL6.js +45 -0
- package/dist/chunk-OT76OZL6.js.map +1 -0
- package/dist/chunk-OVYRLHPE.js +150 -0
- package/dist/chunk-OVYRLHPE.js.map +1 -0
- package/dist/{chunk-ML236QKC.js → chunk-OXCSVM3B.js} +5 -5
- package/dist/chunk-OXCSVM3B.js.map +1 -0
- package/dist/chunk-P33LUIML.js +205 -0
- package/dist/chunk-P33LUIML.js.map +1 -0
- package/dist/{chunk-DL3HWOQ5.js → chunk-PLS64NCS.js} +10 -8
- package/dist/chunk-PLS64NCS.js.map +1 -0
- package/dist/{chunk-SYMWGEET.js → chunk-PS2NEWEX.js} +3 -3
- package/dist/chunk-PS2NEWEX.js.map +1 -0
- package/dist/chunk-PY4KJPYU.js +9 -0
- package/dist/chunk-PY4KJPYU.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-QA2KUPCP.js +45 -0
- package/dist/chunk-QA2KUPCP.js.map +1 -0
- package/dist/chunk-QOC3VYL2.js +30 -0
- package/dist/chunk-QOC3VYL2.js.map +1 -0
- package/dist/{chunk-BVRYKATC.js → chunk-QSFOZUYL.js} +62 -34
- package/dist/chunk-QSFOZUYL.js.map +1 -0
- package/dist/chunk-RHK32N73.js +30 -0
- package/dist/chunk-RHK32N73.js.map +1 -0
- package/dist/{chunk-K3DK3NU5.js → chunk-RW3Y22MW.js} +20 -5
- package/dist/chunk-RW3Y22MW.js.map +1 -0
- package/dist/{chunk-B6PB7JLN.js → chunk-S7VFUQM2.js} +541 -6
- package/dist/chunk-S7VFUQM2.js.map +1 -0
- package/dist/chunk-SVLR4POP.js +64 -0
- package/dist/chunk-SVLR4POP.js.map +1 -0
- package/dist/chunk-T7WSLRAU.js +49 -0
- package/dist/chunk-T7WSLRAU.js.map +1 -0
- package/dist/{chunk-WPLVTJ5D.js → chunk-TAKWLZZX.js} +285 -63
- package/dist/chunk-TAKWLZZX.js.map +1 -0
- package/dist/chunk-THNJ3IKU.js +17 -0
- package/dist/chunk-THNJ3IKU.js.map +1 -0
- package/dist/{chunk-XJFLDA7A.js → chunk-TMBXVJKT.js} +9 -6
- package/dist/chunk-TMBXVJKT.js.map +1 -0
- package/dist/chunk-TWKKOM55.js +54 -0
- package/dist/chunk-TWKKOM55.js.map +1 -0
- package/dist/chunk-U3WZCU7E.js +14 -0
- package/dist/chunk-U3WZCU7E.js.map +1 -0
- package/dist/{chunk-Z6FNBOTC.js → chunk-UF362QVH.js} +15 -17
- package/dist/chunk-UF362QVH.js.map +1 -0
- package/dist/chunk-UN4FVIBH.js +135 -0
- package/dist/chunk-UN4FVIBH.js.map +1 -0
- package/dist/chunk-VEAVKDDB.js +29 -0
- package/dist/chunk-VEAVKDDB.js.map +1 -0
- package/dist/chunk-VEPTFUJY.js +29 -0
- package/dist/chunk-VEPTFUJY.js.map +1 -0
- package/dist/chunk-VJV7GKQK.js +662 -0
- package/dist/chunk-VJV7GKQK.js.map +1 -0
- package/dist/{chunk-2QR2PQTT.js → chunk-VQNJ7UZL.js} +5 -3
- package/dist/chunk-VQNJ7UZL.js.map +1 -0
- package/dist/chunk-VQRAIPYF.js +50 -0
- package/dist/chunk-VQRAIPYF.js.map +1 -0
- package/dist/{chunk-DFMLEQZB.js → chunk-VRIYFLBA.js} +5 -10
- package/dist/chunk-VRIYFLBA.js.map +1 -0
- package/dist/chunk-VWM3DAVB.js +265 -0
- package/dist/chunk-VWM3DAVB.js.map +1 -0
- package/dist/{chunk-NONAAENK.js → chunk-VWRRVE6D.js} +11 -4
- package/dist/chunk-VWRRVE6D.js.map +1 -0
- package/dist/chunk-VYYM3MEN.js +98 -0
- package/dist/chunk-VYYM3MEN.js.map +1 -0
- package/dist/chunk-WBJIQSLL.js +167 -0
- package/dist/chunk-WBJIQSLL.js.map +1 -0
- package/dist/chunk-WIGQB62E.js +164 -0
- package/dist/chunk-WIGQB62E.js.map +1 -0
- package/dist/{chunk-EMIGCR7X.js → chunk-WXSYDNBT.js} +2 -2
- package/dist/chunk-WXSYDNBT.js.map +1 -0
- package/dist/chunk-WZSCE6RM.js +466 -0
- package/dist/chunk-WZSCE6RM.js.map +1 -0
- package/dist/chunk-XGDAPN6M.js +255 -0
- package/dist/chunk-XGDAPN6M.js.map +1 -0
- package/dist/{chunk-QODLLGQ7.js → chunk-XH7XP3OL.js} +372 -37
- package/dist/chunk-XH7XP3OL.js.map +1 -0
- package/dist/chunk-XREOISSI.js +40 -0
- package/dist/chunk-XREOISSI.js.map +1 -0
- package/dist/chunk-XUBPSPKD.js +164 -0
- package/dist/chunk-XUBPSPKD.js.map +1 -0
- package/dist/chunk-Y3A5CB5G.js +247 -0
- package/dist/chunk-Y3A5CB5G.js.map +1 -0
- package/dist/{chunk-I5FOWO4J.js → chunk-YCXCR7VG.js} +52 -73
- package/dist/chunk-YCXCR7VG.js.map +1 -0
- package/dist/{chunk-A3JMGXPG.js → chunk-YMUGBZN2.js} +2 -2
- package/dist/chunk-YMUGBZN2.js.map +1 -0
- package/dist/chunk-YMVQD5Q5.js +453 -0
- package/dist/chunk-YMVQD5Q5.js.map +1 -0
- package/dist/chunk-YN5IAHN6.js +32 -0
- package/dist/chunk-YN5IAHN6.js.map +1 -0
- package/dist/{chunk-FZU343FL.js → chunk-ZJADGNYF.js} +2 -2
- package/dist/chunk-ZJADGNYF.js.map +1 -0
- package/dist/chunk-ZYJ55N7N.js +86 -0
- package/dist/chunk-ZYJ55N7N.js.map +1 -0
- package/dist/classified/index.d.ts +16 -0
- package/dist/classified/index.js +40 -0
- package/dist/classified-marker-H6YSHYNK.js +24 -0
- package/dist/classified-marker-H6YSHYNK.js.map +1 -0
- package/dist/collection-facade-LVD22JLM.js +39 -0
- package/dist/computed-EXDMQODG.js +11 -0
- package/dist/consent/index.d.ts +4 -7
- package/dist/consent/index.js +13 -5
- package/dist/consent/index.js.map +1 -1
- package/dist/crdt/index.d.ts +5 -2
- package/dist/crdt/index.js +3 -2
- package/dist/crdt/index.js.map +1 -1
- package/dist/dead-filter-HQIE2YG7.js +28 -0
- package/dist/dead-filter-HQIE2YG7.js.map +1 -0
- package/dist/decrypt-partition-IHtxEnTi.d.ts +21 -0
- package/dist/delegation-BJP73GAP.js +25 -0
- package/dist/derivations/index.d.ts +6 -9
- package/dist/derivations/index.js +18 -6
- package/dist/derive-BME7HDWO.js +21 -0
- package/dist/{dev-unlock-B4kDxep_.d.ts → dev-unlock-Bmm2pgJ0.d.ts} +1 -1
- package/dist/discriminant-BN9REW3o.d.ts +60 -0
- package/dist/enclave-NHORSWSF.js +125 -0
- package/dist/executor-FE6X4LFX.js +9 -0
- package/dist/executor-KSHKRJXP.js +25 -0
- package/dist/executor-ZHTJJICG.js +9 -0
- package/dist/export-accessible-DACHM5VT.js +23 -0
- package/dist/extract-partition-RNENZZ4T.js +36 -0
- package/dist/fanout-sidecar-OFWN3NM7.js +74 -0
- package/dist/fanout-sidecar-OFWN3NM7.js.map +1 -0
- package/dist/fence-watcher-DHQ775JB.js +69 -0
- package/dist/fence-watcher-DHQ775JB.js.map +1 -0
- package/dist/find-BNGBJNKP.js +11 -0
- package/dist/forget/index.d.ts +36 -0
- package/dist/forget/index.js +25 -0
- package/dist/forget/index.js.map +1 -0
- package/dist/guards/index.d.ts +12 -9
- package/dist/guards/index.js +12 -5
- package/dist/{hash-DdpVypUp.d.cts → hash-DAJjMsCE.d.ts} +10 -1
- package/dist/history/index.d.ts +5 -8
- package/dist/history/index.js +25 -12
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.d.ts +25 -8
- package/dist/i18n/index.js +137 -29
- package/dist/i18n/index.js.map +1 -1
- package/dist/in/index.d.ts +4 -0
- package/dist/in/index.js +1 -0
- package/dist/in/index.js.map +1 -0
- package/dist/index-B9QdHytu.d.ts +123 -0
- package/dist/index-DjWbxsjb.d.ts +23579 -0
- package/dist/index-qwuNvO2B.d.ts +144 -0
- package/dist/index.d.ts +1179 -449
- package/dist/index.js +2524 -312
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.d.ts +5 -3
- package/dist/indexing/index.js +6 -5
- package/dist/indexing/index.js.map +1 -1
- package/dist/issue-NDI4CVZU.js +19 -0
- package/dist/issue-NDI4CVZU.js.map +1 -0
- package/dist/json-schema-I22JCYCG.js +44 -0
- package/dist/json-schema-I22JCYCG.js.map +1 -0
- package/dist/lazy/index.d.ts +20 -0
- package/dist/lazy/index.js +12 -0
- package/dist/lazy/index.js.map +1 -0
- package/dist/ledger-6NDS2EO4.js +42 -0
- package/dist/ledger-6NDS2EO4.js.map +1 -0
- package/dist/liberate-HN3RIGIP.js +24 -0
- package/dist/liberate-HN3RIGIP.js.map +1 -0
- package/dist/link-set-SJB2MVJV.js +31 -0
- package/dist/link-set-SJB2MVJV.js.map +1 -0
- package/dist/materialized-views/index.d.ts +23 -20
- package/dist/materialized-views/index.js +26 -12
- package/dist/mime-magic-bBj5OgUC.d.ts +103 -0
- package/dist/noydb-BWF6EPIR.js +66 -0
- package/dist/noydb-BWF6EPIR.js.map +1 -0
- package/dist/on/index.d.ts +4 -0
- package/dist/on/index.js +17 -0
- package/dist/on/index.js.map +1 -0
- package/dist/overlay-views/index.d.ts +26 -11
- package/dist/overlay-views/index.js +7 -6
- package/dist/periods/index.d.ts +4 -7
- package/dist/periods/index.js +27 -9
- package/dist/pod/index.d.ts +62 -0
- package/dist/pod/index.js +67 -0
- package/dist/pod/index.js.map +1 -0
- package/dist/policy-WGNAG5H6.js +41 -0
- package/dist/policy-WGNAG5H6.js.map +1 -0
- package/dist/portability/index.d.ts +19 -0
- package/dist/portability/index.js +43 -0
- package/dist/portability/index.js.map +1 -0
- package/dist/post-register-CWKBQRC7.js +55 -0
- package/dist/post-register-CWKBQRC7.js.map +1 -0
- package/dist/{public-envelope-BW6OXORV.js → public-envelope-EJLVIFX7.js} +6 -5
- package/dist/public-envelope-EJLVIFX7.js.map +1 -0
- package/dist/query/index.d.ts +4 -3
- package/dist/query/index.js +24 -13
- package/dist/read-only-facade-CHCKSEPD.js +8 -0
- package/dist/read-only-facade-CHCKSEPD.js.map +1 -0
- package/dist/register-SBIX7TVV.js +23 -0
- package/dist/register-SBIX7TVV.js.map +1 -0
- package/dist/registry-3EQG6OOE.js +18 -0
- package/dist/registry-3EQG6OOE.js.map +1 -0
- package/dist/registry-CA327ACV.js +9 -0
- package/dist/registry-CA327ACV.js.map +1 -0
- package/dist/registry-E7OXOTSV.js +19 -0
- package/dist/registry-E7OXOTSV.js.map +1 -0
- package/dist/registry-VW6P6A3J.js +8 -0
- package/dist/registry-VW6P6A3J.js.map +1 -0
- package/dist/request-withdrawal-KAH2AAXC.js +31 -0
- package/dist/request-withdrawal-KAH2AAXC.js.map +1 -0
- package/dist/reveal-R3JLHMUF.js +38 -0
- package/dist/reveal-R3JLHMUF.js.map +1 -0
- package/dist/revoke-IXLOJ3IH.js +24 -0
- package/dist/revoke-IXLOJ3IH.js.map +1 -0
- package/dist/satellites/index.d.ts +4 -0
- package/dist/satellites/index.js +8 -0
- package/dist/satellites/index.js.map +1 -0
- package/dist/sealed-record/index.d.ts +68 -0
- package/dist/sealed-record/index.js +71 -0
- package/dist/sealed-record/index.js.map +1 -0
- package/dist/session/index.d.ts +5 -8
- package/dist/session/index.js +13 -5
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.d.ts +4 -7
- package/dist/shadow/index.js +4 -3
- package/dist/shadow/index.js.map +1 -1
- package/dist/signer-Y46N2GJ3.js +25 -0
- package/dist/signer-Y46N2GJ3.js.map +1 -0
- package/dist/snapshots/index.d.ts +5 -8
- package/dist/snapshots/index.js +19 -11
- package/dist/snapshots/index.js.map +1 -1
- package/dist/{stale-6ZDBTQT7.js → stale-Z7IW6RIL.js} +3 -2
- package/dist/stale-Z7IW6RIL.js.map +1 -0
- package/dist/storage-ADNP2UWI.js +23 -0
- package/dist/storage-ADNP2UWI.js.map +1 -0
- package/dist/store-coordination-provider-DTDMI6VL.js +142 -0
- package/dist/store-coordination-provider-DTDMI6VL.js.map +1 -0
- package/dist/subject-index-CyOgGMJL.d.ts +380 -0
- package/dist/sync/index.d.ts +3 -6
- package/dist/sync/index.js +13 -6
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.d.ts +46 -10
- package/dist/team/index.js +35 -18
- package/dist/tiers/index.d.ts +4 -0
- package/dist/tiers/index.js +39 -0
- package/dist/tiers/index.js.map +1 -0
- package/dist/to/index.d.ts +4 -0
- package/dist/to/index.js +16 -0
- package/dist/to/index.js.map +1 -0
- package/dist/transition-guard-DI-krBsZ.d.ts +165 -0
- package/dist/tx/index.d.ts +22 -9
- package/dist/tx/index.js +13 -8
- package/dist/tx/index.js.map +1 -1
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ulid-DRH25k3y.d.ts +66 -0
- package/dist/ulid-PTAIMDG4.js +10 -0
- package/dist/ulid-PTAIMDG4.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +7 -2
- package/dist/util/index.js.map +1 -1
- package/dist/validators-BUcli5Nh.d.ts +101 -0
- package/dist/vault-diff-Z2DUayMe.d.ts +147 -0
- package/dist/verify-JPF2YR5E.js +139 -0
- package/dist/verify-JPF2YR5E.js.map +1 -0
- package/dist/walk-XYA2O3LW.js +241 -0
- package/dist/walk-XYA2O3LW.js.map +1 -0
- package/dist/with/index.d.ts +37 -0
- package/dist/with/index.js +31 -0
- package/dist/with/index.js.map +1 -0
- package/dist/{with-materialized-view-BLkQxoQN.d.ts → with-materialized-view-BUmzlXue.d.ts} +1 -1
- package/dist/{with-overlayed-view-CRsSEwHR.d.ts → with-overlayed-view-m4FaXXTO.d.ts} +2 -3
- package/dist/with-rollup-DEKGI9vb.d.ts +47 -0
- package/dist/withdraw-accessible-WLV4MTEN.js +28 -0
- package/dist/withdraw-accessible-WLV4MTEN.js.map +1 -0
- package/dist/zod-HAJM7LMS.js +14763 -0
- package/dist/zod-HAJM7LMS.js.map +1 -0
- package/package.json +122 -202
- package/dist/aggregate/index.cjs.map +0 -1
- package/dist/aggregate/index.d.cts +0 -38
- package/dist/attestation/index.cjs +0 -305
- package/dist/attestation/index.cjs.map +0 -1
- package/dist/attestation/index.d.cts +0 -52
- package/dist/blobs/index.cjs +0 -1480
- package/dist/blobs/index.cjs.map +0 -1
- package/dist/blobs/index.d.cts +0 -46
- package/dist/bundle/index.cjs +0 -19264
- package/dist/bundle/index.cjs.map +0 -1
- package/dist/bundle/index.d.cts +0 -176
- package/dist/chunk-22DWZL57.js.map +0 -1
- package/dist/chunk-2GLDA55J.js.map +0 -1
- package/dist/chunk-2QR2PQTT.js.map +0 -1
- package/dist/chunk-2WUSG3IT.js.map +0 -1
- package/dist/chunk-3BFJOWSU.js.map +0 -1
- package/dist/chunk-3YPCK6JX.js.map +0 -1
- package/dist/chunk-53XBRIRT.js.map +0 -1
- package/dist/chunk-5T22KDPN.js.map +0 -1
- package/dist/chunk-5XHKQ56N.js +0 -340
- package/dist/chunk-5XHKQ56N.js.map +0 -1
- package/dist/chunk-6CME4UEK.js +0 -10329
- package/dist/chunk-6CME4UEK.js.map +0 -1
- package/dist/chunk-6STK5TQP.js +0 -139
- package/dist/chunk-6STK5TQP.js.map +0 -1
- package/dist/chunk-A3JMGXPG.js.map +0 -1
- package/dist/chunk-B6PB7JLN.js.map +0 -1
- package/dist/chunk-BVRYKATC.js.map +0 -1
- package/dist/chunk-DE6GKS6G.js +0 -79
- package/dist/chunk-DE6GKS6G.js.map +0 -1
- package/dist/chunk-DFMLEQZB.js.map +0 -1
- package/dist/chunk-DJHHA6XH.js.map +0 -1
- package/dist/chunk-DL3HWOQ5.js.map +0 -1
- package/dist/chunk-DONMZAD2.js.map +0 -1
- package/dist/chunk-EMIGCR7X.js.map +0 -1
- package/dist/chunk-F3GDRNUT.js.map +0 -1
- package/dist/chunk-FZU343FL.js.map +0 -1
- package/dist/chunk-H2X3ISXG.js.map +0 -1
- package/dist/chunk-HNRHLRDC.js.map +0 -1
- package/dist/chunk-I5FOWO4J.js.map +0 -1
- package/dist/chunk-J66GRPNH.js.map +0 -1
- package/dist/chunk-JWRVQKRZ.js.map +0 -1
- package/dist/chunk-K3DK3NU5.js.map +0 -1
- package/dist/chunk-ML236QKC.js.map +0 -1
- package/dist/chunk-NONAAENK.js.map +0 -1
- package/dist/chunk-O3VZPBZG.js.map +0 -1
- package/dist/chunk-OIF6LZUR.js.map +0 -1
- package/dist/chunk-OQ6PIGHA.js +0 -19
- package/dist/chunk-OQ6PIGHA.js.map +0 -1
- package/dist/chunk-PE2FR4J3.js.map +0 -1
- package/dist/chunk-PP6W64Y3.js.map +0 -1
- package/dist/chunk-PX35GA7L.js.map +0 -1
- package/dist/chunk-QEILDE6R.js +0 -793
- package/dist/chunk-QEILDE6R.js.map +0 -1
- package/dist/chunk-QODLLGQ7.js.map +0 -1
- package/dist/chunk-RAZ4OVLL.js +0 -51
- package/dist/chunk-RAZ4OVLL.js.map +0 -1
- package/dist/chunk-SYMWGEET.js.map +0 -1
- package/dist/chunk-T7JEBOGN.js.map +0 -1
- package/dist/chunk-TFBP23BX.js.map +0 -1
- package/dist/chunk-TV3YZ35S.js.map +0 -1
- package/dist/chunk-U26HQ6KJ.js.map +0 -1
- package/dist/chunk-UF3BUNQZ.js +0 -1
- package/dist/chunk-UMLVJTYV.js +0 -20
- package/dist/chunk-UMLVJTYV.js.map +0 -1
- package/dist/chunk-VTKGMEPP.js.map +0 -1
- package/dist/chunk-W6EQLGMB.js +0 -100
- package/dist/chunk-W6EQLGMB.js.map +0 -1
- package/dist/chunk-WIRRPTFH.js +0 -17
- package/dist/chunk-WIRRPTFH.js.map +0 -1
- package/dist/chunk-WPLVTJ5D.js.map +0 -1
- package/dist/chunk-XJFLDA7A.js.map +0 -1
- package/dist/chunk-Z6FNBOTC.js.map +0 -1
- package/dist/chunk-ZYWZWG6G.js.map +0 -1
- package/dist/consent/index.cjs +0 -204
- package/dist/consent/index.cjs.map +0 -1
- package/dist/consent/index.d.cts +0 -25
- package/dist/crdt/index.cjs +0 -152
- package/dist/crdt/index.cjs.map +0 -1
- package/dist/crdt/index.d.cts +0 -30
- package/dist/crypto-HTZ4FJOP.js +0 -44
- package/dist/delegation-RI54P6I5.js +0 -17
- package/dist/derivations/index.cjs +0 -351
- package/dist/derivations/index.cjs.map +0 -1
- package/dist/derivations/index.d.cts +0 -72
- package/dist/dev-unlock-BIoEFbwm.d.cts +0 -263
- package/dist/executor-5PNY7LGW.js +0 -8
- package/dist/executor-B4QIYGZX.js +0 -8
- package/dist/executor-BWXXDQ7K.js +0 -11
- package/dist/fanout-sidecar-OKPMMPLG.js +0 -51
- package/dist/fanout-sidecar-OKPMMPLG.js.map +0 -1
- package/dist/guards/index.cjs +0 -322
- package/dist/guards/index.cjs.map +0 -1
- package/dist/guards/index.d.cts +0 -31
- package/dist/hash-HJqD14vS.d.ts +0 -63
- package/dist/history/index.cjs +0 -1222
- package/dist/history/index.cjs.map +0 -1
- package/dist/history/index.d.cts +0 -63
- package/dist/i18n/index.cjs +0 -1100
- package/dist/i18n/index.cjs.map +0 -1
- package/dist/i18n/index.d.cts +0 -39
- package/dist/index-4fBVt8j9.d.cts +0 -2387
- package/dist/index-D8I_pyJD.d.ts +0 -2387
- package/dist/index.cjs +0 -24487
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -776
- package/dist/indexing/index.cjs +0 -742
- package/dist/indexing/index.cjs.map +0 -1
- package/dist/indexing/index.d.cts +0 -36
- package/dist/issue-VGDPP4B5.js +0 -12
- package/dist/lazy-builder-7tIpFyWN.d.ts +0 -304
- package/dist/lazy-builder-wY4pMCEe.d.cts +0 -304
- package/dist/ledger-TMRZYNVJ.js +0 -33
- package/dist/materialized-views/index.cjs +0 -854
- package/dist/materialized-views/index.cjs.map +0 -1
- package/dist/materialized-views/index.d.cts +0 -186
- package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
- package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
- package/dist/noydb-G725ZSZG.js +0 -34
- package/dist/overlay-views/index.cjs +0 -359
- package/dist/overlay-views/index.cjs.map +0 -1
- package/dist/overlay-views/index.d.cts +0 -82
- package/dist/periods/index.cjs +0 -1041
- package/dist/periods/index.cjs.map +0 -1
- package/dist/periods/index.d.cts +0 -22
- package/dist/predicate-BSAGEyu5.d.cts +0 -209
- package/dist/predicate-BSAGEyu5.d.ts +0 -209
- package/dist/query/index.cjs +0 -2375
- package/dist/query/index.cjs.map +0 -1
- package/dist/query/index.d.cts +0 -3
- package/dist/read-only-facade-ITU6L7BL.js +0 -7
- package/dist/registry-3QP3YKQS.js +0 -8
- package/dist/registry-DKEXOJVO.js +0 -7
- package/dist/registry-OJIOSBV6.js +0 -10
- package/dist/registry-USRVT6YF.js +0 -8
- package/dist/revoke-JCC7N56X.js +0 -17
- package/dist/session/index.cjs +0 -495
- package/dist/session/index.cjs.map +0 -1
- package/dist/session/index.d.cts +0 -46
- package/dist/shadow/index.cjs +0 -133
- package/dist/shadow/index.cjs.map +0 -1
- package/dist/shadow/index.d.cts +0 -17
- package/dist/signer-72QAUSVW.js +0 -18
- package/dist/snapshots/index.cjs +0 -937
- package/dist/snapshots/index.cjs.map +0 -1
- package/dist/snapshots/index.d.cts +0 -28
- package/dist/store/index.cjs +0 -1083
- package/dist/store/index.cjs.map +0 -1
- package/dist/store/index.d.cts +0 -492
- package/dist/store/index.d.ts +0 -492
- package/dist/store/index.js +0 -37
- package/dist/strategy-BSxFXGzb.d.cts +0 -110
- package/dist/strategy-BSxFXGzb.d.ts +0 -110
- package/dist/strategy-DSTrsZ8t.d.cts +0 -601
- package/dist/strategy-DSTrsZ8t.d.ts +0 -601
- package/dist/sync/index.cjs +0 -1062
- package/dist/sync/index.cjs.map +0 -1
- package/dist/sync/index.d.cts +0 -43
- package/dist/team/index.cjs +0 -2798
- package/dist/team/index.cjs.map +0 -1
- package/dist/team/index.d.cts +0 -118
- package/dist/tx/index.cjs +0 -544
- package/dist/tx/index.cjs.map +0 -1
- package/dist/tx/index.d.cts +0 -21
- package/dist/types-Df28QFKb.d.ts +0 -12818
- package/dist/types-DyXYr8rE.d.cts +0 -12818
- package/dist/ulid-COREQ2RQ.js +0 -9
- package/dist/ulid-Drr7ykr6.d.cts +0 -603
- package/dist/util/index.cjs +0 -230
- package/dist/util/index.cjs.map +0 -1
- package/dist/util/index.d.cts +0 -77
- package/dist/with-derivation-DFnFByiQ.d.ts +0 -13
- package/dist/with-derivation-DU3Sjazm.d.cts +0 -13
- package/dist/with-guard-ByyxmEe7.d.cts +0 -18
- package/dist/with-guard-qube6BMI.d.ts +0 -18
- package/dist/with-materialized-view-BmEToIR1.d.cts +0 -27
- package/dist/with-overlayed-view-BMsQQbWm.d.cts +0 -13
- /package/dist/{chunk-UF3BUNQZ.js.map → api-TX2EX2FX.js.map} +0 -0
- /package/dist/{store → as}/index.js.map +0 -0
- /package/dist/{crypto-HTZ4FJOP.js.map → at/index.js.map} +0 -0
- /package/dist/{delegation-RI54P6I5.js.map → by/index.js.map} +0 -0
- /package/dist/{executor-5PNY7LGW.js.map → cargo/index.js.map} +0 -0
- /package/dist/{executor-B4QIYGZX.js.map → chunk-CHFZDSE4.js.map} +0 -0
- /package/dist/{executor-BWXXDQ7K.js.map → chunk-GHVIKOHT.js.map} +0 -0
- /package/dist/{issue-VGDPP4B5.js.map → chunk-PZ5AY32C.js.map} +0 -0
- /package/dist/{ledger-TMRZYNVJ.js.map → classified/index.js.map} +0 -0
- /package/dist/{noydb-G725ZSZG.js.map → collection-facade-LVD22JLM.js.map} +0 -0
- /package/dist/{public-envelope-BW6OXORV.js.map → computed-EXDMQODG.js.map} +0 -0
- /package/dist/{read-only-facade-ITU6L7BL.js.map → delegation-BJP73GAP.js.map} +0 -0
- /package/dist/{registry-3QP3YKQS.js.map → derive-BME7HDWO.js.map} +0 -0
- /package/dist/{registry-DKEXOJVO.js.map → enclave-NHORSWSF.js.map} +0 -0
- /package/dist/{registry-OJIOSBV6.js.map → executor-FE6X4LFX.js.map} +0 -0
- /package/dist/{registry-USRVT6YF.js.map → executor-KSHKRJXP.js.map} +0 -0
- /package/dist/{revoke-JCC7N56X.js.map → executor-ZHTJJICG.js.map} +0 -0
- /package/dist/{signer-72QAUSVW.js.map → export-accessible-DACHM5VT.js.map} +0 -0
- /package/dist/{stale-6ZDBTQT7.js.map → extract-partition-RNENZZ4T.js.map} +0 -0
- /package/dist/{ulid-COREQ2RQ.js.map → find-BNGBJNKP.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -3,86 +3,239 @@ import {
|
|
|
3
3
|
issueDelegation,
|
|
4
4
|
loadActiveDelegations,
|
|
5
5
|
revokeDelegation
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DV4HUP5G.js";
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
|
|
9
|
+
PUBLIC_ENVELOPE_FIELDS,
|
|
10
|
+
resolveSchema
|
|
11
|
+
} from "./chunk-WXSYDNBT.js";
|
|
12
|
+
import {
|
|
13
|
+
UserApi
|
|
14
|
+
} from "./chunk-BKARNZJN.js";
|
|
7
15
|
import {
|
|
8
|
-
Collection,
|
|
9
16
|
DEFAULT_FRESHNESS_MS,
|
|
17
|
+
PERSONAL_POLICY,
|
|
18
|
+
STRICT_POLICY,
|
|
19
|
+
checkGate,
|
|
20
|
+
describeGate,
|
|
21
|
+
mergePolicy
|
|
22
|
+
} from "./chunk-2OZXVKVP.js";
|
|
23
|
+
import {
|
|
24
|
+
Collection,
|
|
10
25
|
ELEVATION_AUDIT_COLLECTION,
|
|
11
26
|
ElevatedHandle,
|
|
12
|
-
Lru,
|
|
13
|
-
META_COLLECTION,
|
|
14
27
|
Noydb,
|
|
15
|
-
PERSONAL_POLICY,
|
|
16
|
-
POLICY_RECORD_ID,
|
|
17
28
|
QuickUnlockStore,
|
|
18
29
|
RefIntegrityError,
|
|
19
30
|
RefRegistry,
|
|
20
31
|
RefScopeError,
|
|
21
|
-
STRICT_POLICY,
|
|
22
|
-
UserApi,
|
|
23
32
|
Vault,
|
|
24
|
-
checkGate,
|
|
25
33
|
createNoydb,
|
|
26
|
-
derivePersistedSchema,
|
|
27
34
|
describeAllUsersAuth,
|
|
28
35
|
describeAuthConfig,
|
|
29
|
-
describeGate,
|
|
30
36
|
describeUserAuth,
|
|
31
37
|
diagramAuthConfig,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
mergePolicy,
|
|
36
|
-
parseBytes,
|
|
37
|
-
persistSchemaIfNeeded,
|
|
38
|
+
isRefArray,
|
|
39
|
+
isViaFieldSpec,
|
|
40
|
+
memoryStore,
|
|
38
41
|
ref,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
refArray,
|
|
43
|
+
via,
|
|
44
|
+
withArchive
|
|
45
|
+
} from "./chunk-DSKDQP3G.js";
|
|
46
|
+
import "./chunk-VYYM3MEN.js";
|
|
43
47
|
import {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
NO_SEQUENCE,
|
|
49
|
+
SequenceStore,
|
|
50
|
+
compileSequenceFormat,
|
|
51
|
+
resolveSequenceKey,
|
|
52
|
+
withSequence
|
|
53
|
+
} from "./chunk-6G5ORS5D.js";
|
|
54
|
+
import {
|
|
55
|
+
META_COLLECTION,
|
|
56
|
+
POLICY_RECORD_ID,
|
|
57
|
+
loadVaultPolicy,
|
|
58
|
+
saveVaultPolicy
|
|
59
|
+
} from "./chunk-G4JYND6L.js";
|
|
60
|
+
import {
|
|
61
|
+
LinkEndpointError
|
|
62
|
+
} from "./chunk-FORYWFN6.js";
|
|
63
|
+
import {
|
|
64
|
+
LinkIntegrityError,
|
|
65
|
+
isLinkCollectionName
|
|
66
|
+
} from "./chunk-HY3AUMFI.js";
|
|
67
|
+
import "./chunk-VQRAIPYF.js";
|
|
68
|
+
import {
|
|
69
|
+
persistSchemaIfNeeded
|
|
70
|
+
} from "./chunk-WBJIQSLL.js";
|
|
71
|
+
import "./chunk-XREOISSI.js";
|
|
72
|
+
import {
|
|
73
|
+
NO_SEARCH,
|
|
74
|
+
tokenize,
|
|
75
|
+
withSearch
|
|
76
|
+
} from "./chunk-VJV7GKQK.js";
|
|
77
|
+
import {
|
|
78
|
+
derivePersistedSchema,
|
|
79
|
+
isZodSchema
|
|
80
|
+
} from "./chunk-5I35DOHK.js";
|
|
81
|
+
import {
|
|
82
|
+
ComputedFieldError,
|
|
83
|
+
evalComputedFields
|
|
84
|
+
} from "./chunk-O45M6LDB.js";
|
|
85
|
+
import "./chunk-GYGLAVCX.js";
|
|
86
|
+
import {
|
|
87
|
+
WithdrawalRequestError,
|
|
88
|
+
approveWithdrawal,
|
|
89
|
+
listWithdrawalRequests,
|
|
90
|
+
rejectWithdrawal,
|
|
91
|
+
requestWithdrawal
|
|
92
|
+
} from "./chunk-WIGQB62E.js";
|
|
93
|
+
import "./chunk-XGDAPN6M.js";
|
|
94
|
+
import {
|
|
95
|
+
isDiscriminant
|
|
96
|
+
} from "./chunk-PY4KJPYU.js";
|
|
97
|
+
import "./chunk-QOC3VYL2.js";
|
|
98
|
+
import {
|
|
99
|
+
classified,
|
|
100
|
+
luhnCheck
|
|
101
|
+
} from "./chunk-Y3A5CB5G.js";
|
|
102
|
+
import {
|
|
103
|
+
ClassifiedNeverStoredError,
|
|
104
|
+
ClassifiedValidationError,
|
|
105
|
+
isClassifiedFieldSpec,
|
|
106
|
+
isClassifiedGroup,
|
|
107
|
+
resolveClassifiedFields
|
|
108
|
+
} from "./chunk-VWM3DAVB.js";
|
|
109
|
+
import "./chunk-7P2SDJG3.js";
|
|
110
|
+
import "./chunk-RHK32N73.js";
|
|
111
|
+
import {
|
|
112
|
+
withCargo
|
|
113
|
+
} from "./chunk-U3WZCU7E.js";
|
|
114
|
+
import {
|
|
115
|
+
CustodyApi,
|
|
116
|
+
NO_CARGO,
|
|
117
|
+
NO_CUSTODY,
|
|
118
|
+
withCustody
|
|
119
|
+
} from "./chunk-ZYJ55N7N.js";
|
|
120
|
+
import {
|
|
121
|
+
DEED_RECORD_ID,
|
|
122
|
+
createDeedOwner,
|
|
123
|
+
isDeedVault,
|
|
124
|
+
liberateVault,
|
|
125
|
+
loadDeedMarker
|
|
126
|
+
} from "./chunk-UN4FVIBH.js";
|
|
127
|
+
import {
|
|
128
|
+
fuseRetrieval
|
|
129
|
+
} from "./chunk-AURFOK3D.js";
|
|
130
|
+
import {
|
|
131
|
+
withdrawAccessibleData
|
|
132
|
+
} from "./chunk-OBKWYKYC.js";
|
|
133
|
+
import {
|
|
134
|
+
exportAccessibleData
|
|
135
|
+
} from "./chunk-OT76OZL6.js";
|
|
136
|
+
import "./chunk-TWKKOM55.js";
|
|
137
|
+
import {
|
|
138
|
+
diffVault
|
|
139
|
+
} from "./chunk-LB7FD65R.js";
|
|
140
|
+
import "./chunk-DJ7KIPLV.js";
|
|
141
|
+
import {
|
|
142
|
+
PERIODS_COLLECTION
|
|
143
|
+
} from "./chunk-FRP6D2DM.js";
|
|
144
|
+
import "./chunk-GHVIKOHT.js";
|
|
145
|
+
import {
|
|
146
|
+
immutableGuard,
|
|
147
|
+
transitionGuard,
|
|
148
|
+
withGuard
|
|
149
|
+
} from "./chunk-F4CEK5YM.js";
|
|
150
|
+
import "./chunk-YMUGBZN2.js";
|
|
151
|
+
import "./chunk-JK733I5V.js";
|
|
152
|
+
import "./chunk-VWRRVE6D.js";
|
|
153
|
+
import {
|
|
154
|
+
CollectionFrame,
|
|
155
|
+
VaultFrame
|
|
156
|
+
} from "./chunk-VRIYFLBA.js";
|
|
48
157
|
import {
|
|
49
158
|
TxCollection,
|
|
50
159
|
TxContext,
|
|
51
160
|
TxVault,
|
|
52
161
|
runTransaction
|
|
53
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-ICXIFFYZ.js";
|
|
54
163
|
import {
|
|
55
|
-
withDerivation
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
import "./chunk-
|
|
164
|
+
withDerivation,
|
|
165
|
+
withRollup
|
|
166
|
+
} from "./chunk-KNZB6JMR.js";
|
|
167
|
+
import "./chunk-XUBPSPKD.js";
|
|
168
|
+
import "./chunk-FUOE7UUV.js";
|
|
169
|
+
import "./chunk-LEJIKBBB.js";
|
|
59
170
|
import {
|
|
60
171
|
withMaterializedView
|
|
61
|
-
} from "./chunk-
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import
|
|
64
|
-
|
|
172
|
+
} from "./chunk-RW3Y22MW.js";
|
|
173
|
+
import "./chunk-LL2NIVUR.js";
|
|
174
|
+
import {
|
|
175
|
+
buildLookupSnapshot
|
|
176
|
+
} from "./chunk-WZSCE6RM.js";
|
|
177
|
+
import "./chunk-3QSIU3UT.js";
|
|
178
|
+
import "./chunk-2REPHKET.js";
|
|
65
179
|
import {
|
|
66
180
|
withOverlayedView
|
|
67
|
-
} from "./chunk-
|
|
68
|
-
import "./chunk-
|
|
69
|
-
import "./chunk-
|
|
70
|
-
import
|
|
181
|
+
} from "./chunk-PS2NEWEX.js";
|
|
182
|
+
import "./chunk-OHHKHSJP.js";
|
|
183
|
+
import "./chunk-6P5XCKSD.js";
|
|
184
|
+
import {
|
|
185
|
+
importExternalObjects,
|
|
186
|
+
memoryObjectProjection
|
|
187
|
+
} from "./chunk-4Q6HSHHL.js";
|
|
188
|
+
import "./chunk-BQISD5ZV.js";
|
|
189
|
+
import "./chunk-CB7CWSKW.js";
|
|
190
|
+
import {
|
|
191
|
+
withLazy
|
|
192
|
+
} from "./chunk-THNJ3IKU.js";
|
|
193
|
+
import {
|
|
194
|
+
Lru,
|
|
195
|
+
estimateRecordBytes,
|
|
196
|
+
parseBytes
|
|
197
|
+
} from "./chunk-NO272T7Q.js";
|
|
71
198
|
import {
|
|
72
199
|
mergeCrdtStates,
|
|
73
200
|
resolveCrdtSnapshot
|
|
74
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-6S7T6WC4.js";
|
|
202
|
+
import {
|
|
203
|
+
decryptExtractedPartition
|
|
204
|
+
} from "./chunk-5VG4IJR7.js";
|
|
205
|
+
import {
|
|
206
|
+
SCHEMAS_COLLECTION,
|
|
207
|
+
loadPersistedSchema,
|
|
208
|
+
savePersistedSchema
|
|
209
|
+
} from "./chunk-T7WSLRAU.js";
|
|
75
210
|
import {
|
|
76
211
|
MemoryRecipientSealer,
|
|
77
212
|
MemorySealingKeyProvider,
|
|
78
|
-
SCHEMAS_COLLECTION,
|
|
79
213
|
SEALED_PASSPHRASE_RECORD_ID,
|
|
80
|
-
|
|
214
|
+
aesGcmOpen,
|
|
81
215
|
loadSealedPassphrase,
|
|
216
|
+
parseRsaOaepTlv,
|
|
82
217
|
parseSealedEnvelope,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} from "./chunk-
|
|
218
|
+
saveSealedPassphrase,
|
|
219
|
+
sealRsaOaepTlv
|
|
220
|
+
} from "./chunk-YCXCR7VG.js";
|
|
221
|
+
import {
|
|
222
|
+
BLOB_CHUNKS_COLLECTION,
|
|
223
|
+
BLOB_COLLECTION,
|
|
224
|
+
BLOB_INDEX_COLLECTION,
|
|
225
|
+
BLOB_SLOTS_PREFIX,
|
|
226
|
+
BLOB_VERSIONS_PREFIX,
|
|
227
|
+
BlobSet,
|
|
228
|
+
DEFAULT_CHUNK_SIZE,
|
|
229
|
+
detectMagic,
|
|
230
|
+
detectMimeType,
|
|
231
|
+
isPreCompressed
|
|
232
|
+
} from "./chunk-XH7XP3OL.js";
|
|
233
|
+
import {
|
|
234
|
+
createBundleStore,
|
|
235
|
+
createPodStore,
|
|
236
|
+
wrapBundleStore,
|
|
237
|
+
wrapPodStore
|
|
238
|
+
} from "./chunk-5YESYH2C.js";
|
|
86
239
|
import {
|
|
87
240
|
NOYDB_BUNDLE_FORMAT_VERSION,
|
|
88
241
|
NOYDB_BUNDLE_MAGIC,
|
|
@@ -91,9 +244,12 @@ import {
|
|
|
91
244
|
readNoydbBundle,
|
|
92
245
|
readNoydbBundleHeader,
|
|
93
246
|
readNoydbBundlePublicEnvelope,
|
|
247
|
+
readPod,
|
|
248
|
+
readPodHeader,
|
|
94
249
|
resetBrotliSupportCache,
|
|
95
|
-
writeNoydbBundle
|
|
96
|
-
|
|
250
|
+
writeNoydbBundle,
|
|
251
|
+
writePod
|
|
252
|
+
} from "./chunk-QSFOZUYL.js";
|
|
97
253
|
import {
|
|
98
254
|
PUBLIC_ENVELOPE_RECORD_ID,
|
|
99
255
|
isPublicEnvelope,
|
|
@@ -101,140 +257,106 @@ import {
|
|
|
101
257
|
readPublicEnvelope,
|
|
102
258
|
savePublicEnvelope,
|
|
103
259
|
validatePublicEnvelopeInput
|
|
104
|
-
} from "./chunk-
|
|
260
|
+
} from "./chunk-OXCSVM3B.js";
|
|
105
261
|
import {
|
|
106
262
|
CONSENT_AUDIT_COLLECTION
|
|
107
|
-
} from "./chunk-
|
|
108
|
-
import
|
|
109
|
-
PERIODS_COLLECTION
|
|
110
|
-
} from "./chunk-JWRVQKRZ.js";
|
|
111
|
-
import "./chunk-UF3BUNQZ.js";
|
|
112
|
-
import {
|
|
113
|
-
withGuard
|
|
114
|
-
} from "./chunk-OQ6PIGHA.js";
|
|
115
|
-
import "./chunk-A3JMGXPG.js";
|
|
116
|
-
import "./chunk-UMLVJTYV.js";
|
|
117
|
-
import "./chunk-NONAAENK.js";
|
|
118
|
-
import {
|
|
119
|
-
CollectionFrame,
|
|
120
|
-
VaultFrame
|
|
121
|
-
} from "./chunk-DFMLEQZB.js";
|
|
122
|
-
import {
|
|
123
|
-
enforceScript,
|
|
124
|
-
inferScripts
|
|
125
|
-
} from "./chunk-6STK5TQP.js";
|
|
263
|
+
} from "./chunk-TMBXVJKT.js";
|
|
264
|
+
import "./chunk-JJZ2LW6T.js";
|
|
126
265
|
import {
|
|
127
|
-
DICT_COLLECTION_PREFIX,
|
|
128
|
-
DictionaryHandle,
|
|
129
|
-
applyI18nLocale,
|
|
130
|
-
dictCollectionName,
|
|
131
266
|
dictKey,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
isDictKeyDescriptor,
|
|
135
|
-
isI18nTextDescriptor,
|
|
136
|
-
resolveI18nText,
|
|
137
|
-
resolvePolicy,
|
|
138
|
-
validateI18nTextValue
|
|
139
|
-
} from "./chunk-22DWZL57.js";
|
|
267
|
+
staticDict
|
|
268
|
+
} from "./chunk-ET67AY6B.js";
|
|
140
269
|
import {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
withHealthCheck,
|
|
146
|
-
withLogging,
|
|
147
|
-
withMetrics,
|
|
148
|
-
withRetry,
|
|
149
|
-
wrapBundleStore,
|
|
150
|
-
wrapStore
|
|
151
|
-
} from "./chunk-QEILDE6R.js";
|
|
270
|
+
DICT_COLLECTION_PREFIX,
|
|
271
|
+
LookupHandle,
|
|
272
|
+
dictCollectionName
|
|
273
|
+
} from "./chunk-NUEQU36L.js";
|
|
152
274
|
import {
|
|
153
|
-
SYNC_CREDENTIALS_COLLECTION,
|
|
154
275
|
credentialStatus,
|
|
155
276
|
deleteCredential,
|
|
156
277
|
getCredential,
|
|
157
278
|
listCredentials,
|
|
158
|
-
putCredential
|
|
159
|
-
|
|
279
|
+
putCredential,
|
|
280
|
+
withTeam
|
|
281
|
+
} from "./chunk-4OMCIY6F.js";
|
|
160
282
|
import {
|
|
161
283
|
MAGIC_LINK_CONTENT_INFO_PREFIX,
|
|
162
284
|
MAGIC_LINK_GRANTS_COLLECTION,
|
|
163
285
|
MAGIC_LINK_KEK_INFO_PREFIX,
|
|
164
|
-
|
|
165
|
-
PolicyDeniedError,
|
|
166
|
-
RecoveryNotEnrolledError,
|
|
167
|
-
RecoveryProfileNotImplementedError,
|
|
168
|
-
burnPaperRecoveryEntry,
|
|
286
|
+
NO_TEAM,
|
|
169
287
|
deriveMagicLinkContentKey,
|
|
170
288
|
enrollAuthenticator,
|
|
171
289
|
findAuthenticator,
|
|
172
|
-
hasRecoveryEnrolled,
|
|
173
290
|
isMagicLinkGrantExpired,
|
|
174
291
|
listMagicLinkGrants,
|
|
175
|
-
loadPaperRecoveryEntries,
|
|
176
|
-
loadShamirRecoveryEntries,
|
|
177
292
|
magicLinkGrantRecordId,
|
|
178
|
-
mintPaperRecoveryEntry,
|
|
179
|
-
mintShamirRecoveryEntry,
|
|
180
|
-
mintWrappedDeksBlob,
|
|
181
293
|
readMagicLinkGrantRecord,
|
|
182
294
|
recoverPassphrase,
|
|
183
295
|
recoverUser,
|
|
184
296
|
removeAuthenticator,
|
|
185
297
|
revokeMagicLinkGrant,
|
|
186
298
|
rotatePassphrase,
|
|
299
|
+
unwrapMagicLinkGrant,
|
|
300
|
+
writeMagicLinkGrant
|
|
301
|
+
} from "./chunk-KJ2BCBTL.js";
|
|
302
|
+
import {
|
|
303
|
+
burnPaperRecoveryEntry,
|
|
304
|
+
hasRecoveryEnrolled,
|
|
305
|
+
loadPaperRecoveryEntries,
|
|
306
|
+
loadShamirRecoveryEntries,
|
|
307
|
+
mintPaperRecoveryEntry,
|
|
308
|
+
mintShamirRecoveryEntry,
|
|
309
|
+
mintWrappedDeksBlob,
|
|
187
310
|
savePaperRecoveryEntries,
|
|
188
311
|
saveShamirRecoveryEntries,
|
|
189
312
|
unwrapDeksFromBlob,
|
|
190
313
|
unwrapDeksFromPaperEntry,
|
|
191
|
-
unwrapDeksFromShamirEntry
|
|
192
|
-
|
|
193
|
-
writeMagicLinkGrant
|
|
194
|
-
} from "./chunk-3YPCK6JX.js";
|
|
195
|
-
import {
|
|
196
|
-
assertTierAccess,
|
|
197
|
-
dekKey,
|
|
198
|
-
effectiveClearance
|
|
199
|
-
} from "./chunk-U26HQ6KJ.js";
|
|
314
|
+
unwrapDeksFromShamirEntry
|
|
315
|
+
} from "./chunk-P33LUIML.js";
|
|
200
316
|
import {
|
|
201
317
|
PresenceHandle,
|
|
202
318
|
SyncEngine,
|
|
203
319
|
SyncTransaction
|
|
204
|
-
} from "./chunk-
|
|
320
|
+
} from "./chunk-TAKWLZZX.js";
|
|
205
321
|
import {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
322
|
+
BUNDLE_STORE_POLICY,
|
|
323
|
+
INDEXED_STORE_POLICY,
|
|
324
|
+
POD_STORE_POLICY,
|
|
325
|
+
SyncScheduler
|
|
326
|
+
} from "./chunk-VQNJ7UZL.js";
|
|
327
|
+
import {
|
|
328
|
+
assertTierAccess,
|
|
329
|
+
dekKey,
|
|
330
|
+
effectiveClearance
|
|
331
|
+
} from "./chunk-7BWJHO2A.js";
|
|
332
|
+
import {
|
|
333
|
+
SYNC_CREDENTIALS_COLLECTION,
|
|
211
334
|
WeakPassphraseError,
|
|
212
335
|
assertStrongPassphrase,
|
|
213
336
|
buildRecipientKeyringFile,
|
|
214
|
-
deleteUserEnvelope,
|
|
215
|
-
deleteUserVisibility,
|
|
216
337
|
estimateEntropy,
|
|
217
338
|
evaluateExportCapability,
|
|
218
339
|
evaluateImportCapability,
|
|
219
340
|
hasExportCapability,
|
|
220
341
|
hasImportCapability,
|
|
221
|
-
listUserEnvelopeIds,
|
|
222
342
|
listUsers,
|
|
223
343
|
listUsersWithEnvelopes,
|
|
344
|
+
validatePassphrase
|
|
345
|
+
} from "./chunk-J4LPNIGK.js";
|
|
346
|
+
import {
|
|
347
|
+
DIRECTORY_RECORD_ID,
|
|
348
|
+
VISIBILITY_RECORD_PREFIX,
|
|
349
|
+
deleteUserEnvelope,
|
|
350
|
+
deleteUserVisibility,
|
|
351
|
+
listUserEnvelopeIds,
|
|
224
352
|
loadUserEnvelope,
|
|
225
353
|
persistDirectoryConfig,
|
|
226
354
|
persistUserVisibility,
|
|
227
355
|
readDirectoryConfig,
|
|
228
356
|
readUserVisibility,
|
|
229
357
|
saveUserEnvelope,
|
|
230
|
-
validatePassphrase,
|
|
231
358
|
visibilityRecordId
|
|
232
|
-
} from "./chunk-
|
|
233
|
-
import {
|
|
234
|
-
BUNDLE_STORE_POLICY,
|
|
235
|
-
INDEXED_STORE_POLICY,
|
|
236
|
-
SyncScheduler
|
|
237
|
-
} from "./chunk-2QR2PQTT.js";
|
|
359
|
+
} from "./chunk-OVYRLHPE.js";
|
|
238
360
|
import {
|
|
239
361
|
PolicyEnforcer,
|
|
240
362
|
activeSessionCount,
|
|
@@ -249,24 +371,28 @@ import {
|
|
|
249
371
|
revokeAllSessions,
|
|
250
372
|
revokeSession,
|
|
251
373
|
validateSessionPolicy
|
|
252
|
-
} from "./chunk-
|
|
374
|
+
} from "./chunk-3MATJ6O4.js";
|
|
253
375
|
import {
|
|
254
376
|
generateULID,
|
|
255
377
|
isULID
|
|
256
|
-
} from "./chunk-
|
|
378
|
+
} from "./chunk-ZJADGNYF.js";
|
|
257
379
|
import {
|
|
258
380
|
CollectionInstant,
|
|
259
|
-
VaultInstant
|
|
381
|
+
VaultInstant
|
|
382
|
+
} from "./chunk-IVLTXX4W.js";
|
|
383
|
+
import {
|
|
260
384
|
diff,
|
|
261
385
|
formatDiff
|
|
262
|
-
} from "./chunk-
|
|
386
|
+
} from "./chunk-SVLR4POP.js";
|
|
263
387
|
import {
|
|
264
|
-
LEDGER_COLLECTION,
|
|
265
|
-
LEDGER_DELTAS_COLLECTION,
|
|
266
388
|
LedgerStore,
|
|
267
389
|
applyPatch,
|
|
268
390
|
computePatch
|
|
269
|
-
} from "./chunk-
|
|
391
|
+
} from "./chunk-3JXPAHOZ.js";
|
|
392
|
+
import {
|
|
393
|
+
LEDGER_COLLECTION,
|
|
394
|
+
LEDGER_DELTAS_COLLECTION
|
|
395
|
+
} from "./chunk-I7FD46FF.js";
|
|
270
396
|
import {
|
|
271
397
|
canonicalJson,
|
|
272
398
|
envelopePayloadHash,
|
|
@@ -274,7 +400,35 @@ import {
|
|
|
274
400
|
paddedIndex,
|
|
275
401
|
parseIndex,
|
|
276
402
|
sha256Hex
|
|
277
|
-
} from "./chunk-
|
|
403
|
+
} from "./chunk-UF362QVH.js";
|
|
404
|
+
import "./chunk-ANB77BVV.js";
|
|
405
|
+
import "./chunk-HPWKV3YB.js";
|
|
406
|
+
import {
|
|
407
|
+
validateSchemaInput,
|
|
408
|
+
validateSchemaOutput
|
|
409
|
+
} from "./chunk-MCHVVJIA.js";
|
|
410
|
+
import "./chunk-QA2KUPCP.js";
|
|
411
|
+
import "./chunk-2OV5NVE7.js";
|
|
412
|
+
import "./chunk-VEPTFUJY.js";
|
|
413
|
+
import "./chunk-HYR4WZZ3.js";
|
|
414
|
+
import "./chunk-LP7BEXCT.js";
|
|
415
|
+
import {
|
|
416
|
+
base64ToBuffer,
|
|
417
|
+
bufferToBase64,
|
|
418
|
+
decryptBytes,
|
|
419
|
+
decryptDeterministic,
|
|
420
|
+
derivePresenceKey,
|
|
421
|
+
encryptBytes,
|
|
422
|
+
encryptDeterministic
|
|
423
|
+
} from "./chunk-3OPY6MK2.js";
|
|
424
|
+
import {
|
|
425
|
+
NOYDB_BACKUP_VERSION,
|
|
426
|
+
NOYDB_FORMAT_VERSION,
|
|
427
|
+
NOYDB_KEYRING_VERSION,
|
|
428
|
+
NOYDB_SYNC_VERSION,
|
|
429
|
+
SealedHandle,
|
|
430
|
+
createStore
|
|
431
|
+
} from "./chunk-YN5IAHN6.js";
|
|
278
432
|
import {
|
|
279
433
|
DEFAULT_CROSS_JOIN_MAX_ROWS,
|
|
280
434
|
DEFAULT_JOIN_MAX_ROWS,
|
|
@@ -284,17 +438,10 @@ import {
|
|
|
284
438
|
buildLiveQuery,
|
|
285
439
|
executePlan,
|
|
286
440
|
resetJoinWarnings
|
|
287
|
-
} from "./chunk-
|
|
441
|
+
} from "./chunk-BUAQ7YI3.js";
|
|
288
442
|
import {
|
|
289
443
|
CollectionIndexes
|
|
290
|
-
} from "./chunk-
|
|
291
|
-
import {
|
|
292
|
-
avg,
|
|
293
|
-
count,
|
|
294
|
-
max,
|
|
295
|
-
min,
|
|
296
|
-
sum
|
|
297
|
-
} from "./chunk-W6EQLGMB.js";
|
|
444
|
+
} from "./chunk-KPZS5QAQ.js";
|
|
298
445
|
import {
|
|
299
446
|
Aggregation,
|
|
300
447
|
GROUPBY_MAX_CARDINALITY,
|
|
@@ -302,56 +449,65 @@ import {
|
|
|
302
449
|
GroupedAggregation,
|
|
303
450
|
GroupedQuery,
|
|
304
451
|
GroupedQueryN,
|
|
452
|
+
avg,
|
|
453
|
+
count,
|
|
305
454
|
groupAndReduce,
|
|
306
|
-
|
|
307
|
-
|
|
455
|
+
max,
|
|
456
|
+
min,
|
|
457
|
+
moneyMax,
|
|
458
|
+
moneyMin,
|
|
459
|
+
moneySum,
|
|
460
|
+
reduceRecords,
|
|
461
|
+
reducerBuilder,
|
|
462
|
+
sum
|
|
463
|
+
} from "./chunk-DFVUTGT2.js";
|
|
308
464
|
import {
|
|
309
465
|
evaluateClause,
|
|
310
466
|
evaluateFieldClause,
|
|
311
467
|
readPath
|
|
312
|
-
} from "./chunk-
|
|
313
|
-
import {
|
|
314
|
-
BLOB_CHUNKS_COLLECTION,
|
|
315
|
-
BLOB_COLLECTION,
|
|
316
|
-
BLOB_INDEX_COLLECTION,
|
|
317
|
-
BLOB_SLOTS_PREFIX,
|
|
318
|
-
BLOB_VERSIONS_PREFIX,
|
|
319
|
-
BlobSet,
|
|
320
|
-
DEFAULT_CHUNK_SIZE,
|
|
321
|
-
detectMagic,
|
|
322
|
-
detectMimeType,
|
|
323
|
-
isPreCompressed
|
|
324
|
-
} from "./chunk-QODLLGQ7.js";
|
|
325
|
-
import "./chunk-3BFJOWSU.js";
|
|
468
|
+
} from "./chunk-IGJCYUT5.js";
|
|
326
469
|
import {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
470
|
+
applyI18nLocale,
|
|
471
|
+
enforceScript,
|
|
472
|
+
getAtPath,
|
|
473
|
+
i18nText,
|
|
474
|
+
inferScripts,
|
|
475
|
+
isDictCollectionName,
|
|
476
|
+
isDictKeyDescriptor,
|
|
477
|
+
isI18nTextDescriptor,
|
|
478
|
+
isStaticDictDescriptor,
|
|
479
|
+
resolveI18nText,
|
|
480
|
+
resolvePolicy,
|
|
481
|
+
setAtPathInPlace,
|
|
482
|
+
validateI18nTextValue
|
|
483
|
+
} from "./chunk-EOXAAJTY.js";
|
|
333
484
|
import {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
decryptBytes,
|
|
337
|
-
decryptDeterministic,
|
|
338
|
-
derivePresenceKey,
|
|
339
|
-
encryptBytes,
|
|
340
|
-
encryptDeterministic
|
|
341
|
-
} from "./chunk-PP6W64Y3.js";
|
|
485
|
+
installViaBinder
|
|
486
|
+
} from "./chunk-VEAVKDDB.js";
|
|
342
487
|
import {
|
|
343
488
|
AlreadyElevatedError,
|
|
344
489
|
AmendmentForbiddenError,
|
|
345
490
|
AttestationError,
|
|
491
|
+
AttestationNotEnabledError,
|
|
346
492
|
BackupCorruptedError,
|
|
347
493
|
BackupLedgerError,
|
|
348
494
|
BundleIntegrityError,
|
|
349
495
|
BundleSealMismatchError,
|
|
350
496
|
BundleVersionConflictError,
|
|
497
|
+
CargoNotEnabledError,
|
|
498
|
+
ClassifiedConfigError,
|
|
499
|
+
ClassifiedNotEnabledError,
|
|
500
|
+
ClassifiedRevealError,
|
|
501
|
+
ClassifiedRotationError,
|
|
502
|
+
ClassifiedVerifyError,
|
|
351
503
|
ConflictError,
|
|
352
504
|
CrossJoinSourceUnknownError,
|
|
353
505
|
CrossJoinTooLargeError,
|
|
506
|
+
CustodyNotEnabledError,
|
|
354
507
|
DanglingReferenceError,
|
|
508
|
+
DataResidencyError,
|
|
509
|
+
DebugPlaintextError,
|
|
510
|
+
DebugReservedFieldError,
|
|
355
511
|
DecryptionError,
|
|
356
512
|
DelegationTargetMissingError,
|
|
357
513
|
DerivationCapExceededError,
|
|
@@ -363,10 +519,16 @@ import {
|
|
|
363
519
|
DictKeyMissingError,
|
|
364
520
|
DirectoryDisabledError,
|
|
365
521
|
ElevationExpiredError,
|
|
522
|
+
EmbeddingDimMismatchError,
|
|
523
|
+
EmbeddingModelMismatchError,
|
|
524
|
+
EnclaveNotSupportedError,
|
|
366
525
|
ExportCapabilityError,
|
|
367
526
|
FieldFrozenError,
|
|
527
|
+
FieldNotQueryableError,
|
|
368
528
|
FilenameSanitizationError,
|
|
529
|
+
ForgetStrategyNotConfiguredError,
|
|
369
530
|
GroupCardinalityError,
|
|
531
|
+
IllegalTransitionError,
|
|
370
532
|
ImportCapabilityError,
|
|
371
533
|
IndexRequiredError,
|
|
372
534
|
IndexWriteFailureError,
|
|
@@ -377,6 +539,7 @@ import {
|
|
|
377
539
|
KeyringExpiredError,
|
|
378
540
|
LedgerContentionError,
|
|
379
541
|
LocaleNotSpecifiedError,
|
|
542
|
+
ManagedRecoveryNotEnrolledError,
|
|
380
543
|
MaterializedViewConfigError,
|
|
381
544
|
MaterializedViewCycleError,
|
|
382
545
|
MaterializedViewSourceUnknownError,
|
|
@@ -388,6 +551,7 @@ import {
|
|
|
388
551
|
NonAdditiveSchemaChangeError,
|
|
389
552
|
NotFoundError,
|
|
390
553
|
NoydbError,
|
|
554
|
+
NumberingUncertaintyError,
|
|
391
555
|
OverlayBaseIsVirtualError,
|
|
392
556
|
OverlayCollectionUnavailableError,
|
|
393
557
|
OverlayIdMismatchError,
|
|
@@ -395,33 +559,109 @@ import {
|
|
|
395
559
|
PathEscapeError,
|
|
396
560
|
PeriodClosedError,
|
|
397
561
|
PermissionDeniedError,
|
|
562
|
+
PodVersionConflictError,
|
|
563
|
+
PolicyDeniedError,
|
|
564
|
+
PortabilityNotEnabledError,
|
|
398
565
|
PrivilegeEscalationError,
|
|
399
566
|
QuiesceTimeoutError,
|
|
400
567
|
ReadOnlyAtInstantError,
|
|
401
568
|
ReadOnlyError,
|
|
402
569
|
ReadOnlyFrameError,
|
|
570
|
+
RecordCekNotFoundError,
|
|
403
571
|
RecordLockedError,
|
|
572
|
+
RecoveryNotEnrolledError,
|
|
573
|
+
RecoveryProfileNotImplementedError,
|
|
404
574
|
ReservedCollectionNameError,
|
|
575
|
+
ReservedVaultNameError,
|
|
576
|
+
RestrictRefUnresolvableError,
|
|
577
|
+
STATE_VAULT_NAME,
|
|
405
578
|
SchemaFenceError,
|
|
406
579
|
SchemaLockedError,
|
|
407
580
|
SchemaUpdateError,
|
|
408
581
|
SchemaValidationError,
|
|
409
582
|
ScriptViolationError,
|
|
583
|
+
SealedRecordExpiredError,
|
|
584
|
+
SealedRecordMismatchError,
|
|
585
|
+
SealedRecordNotEnabledError,
|
|
586
|
+
SearchNotEnabledError,
|
|
587
|
+
SequenceContentionError,
|
|
588
|
+
SequenceNotEnabledError,
|
|
589
|
+
SequenceOfflineError,
|
|
410
590
|
SessionExpiredError,
|
|
411
591
|
SessionNotFoundError,
|
|
412
592
|
SessionPolicyError,
|
|
593
|
+
ShardProvisioningError,
|
|
413
594
|
SnapshotNotFoundError,
|
|
595
|
+
StaticDictReadonlyError,
|
|
414
596
|
StoreCapabilityError,
|
|
415
597
|
TamperedError,
|
|
598
|
+
TeamNotEnabledError,
|
|
416
599
|
TierDemoteDeniedError,
|
|
417
600
|
TierNotGrantedError,
|
|
601
|
+
TiersNotEnabledError,
|
|
418
602
|
TranslatorNotConfiguredError,
|
|
419
|
-
|
|
420
|
-
|
|
603
|
+
USER_ENVELOPE_COLLECTION,
|
|
604
|
+
USER_ENVELOPE_MAX_BYTES,
|
|
605
|
+
UniqueConstraintError,
|
|
606
|
+
UnknownDictCodeError,
|
|
607
|
+
UnknownLookupKeyError,
|
|
608
|
+
UnknownShardError,
|
|
609
|
+
UnsupportedIndexOptionError,
|
|
610
|
+
UserEnvelopeOversizedError,
|
|
611
|
+
ValidationError,
|
|
612
|
+
VaultTemplateNotFoundError
|
|
613
|
+
} from "./chunk-S7VFUQM2.js";
|
|
614
|
+
import "./chunk-PZ5AY32C.js";
|
|
421
615
|
|
|
422
|
-
// src/
|
|
423
|
-
function
|
|
424
|
-
|
|
616
|
+
// src/kernel/debug.ts
|
|
617
|
+
function readPlaintextRecord(envelope) {
|
|
618
|
+
if (envelope._iv !== "") {
|
|
619
|
+
throw new Error(
|
|
620
|
+
"readPlaintextRecord: envelope is encrypted (non-empty _iv) \u2014 decrypt via the vault, not this helper"
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
if (envelope._debug !== void 0) {
|
|
624
|
+
const record = {};
|
|
625
|
+
for (const [key, value] of Object.entries(envelope)) {
|
|
626
|
+
if (!key.startsWith("_")) record[key] = value;
|
|
627
|
+
}
|
|
628
|
+
return record;
|
|
629
|
+
}
|
|
630
|
+
if (!envelope._data) return null;
|
|
631
|
+
return JSON.parse(envelope._data);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// src/with-shape/introspection/projection.ts
|
|
635
|
+
function applyListProjection(desc, record, opts) {
|
|
636
|
+
const out = { ...record };
|
|
637
|
+
for (const f of desc.fields) {
|
|
638
|
+
if (f.classified !== void 0) {
|
|
639
|
+
const list = f.classified.list;
|
|
640
|
+
if (list === "omit") {
|
|
641
|
+
delete out[f.key];
|
|
642
|
+
continue;
|
|
643
|
+
}
|
|
644
|
+
if ("mask" in list) {
|
|
645
|
+
out[f.key] = list.mask.replace(/\$\{(\w+)\}/g, (_m, rider) => {
|
|
646
|
+
const v = record[`${f.key}_${rider}`];
|
|
647
|
+
return v === void 0 || v === null ? "\u2022" : `${v}`;
|
|
648
|
+
});
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
out[f.key] = record[`${f.key}_${list.rider}`];
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
if (opts?.sensitivity !== void 0 && (f.sensitivity === "pii" || f.sensitivity === "secret")) {
|
|
655
|
+
if (opts.sensitivity === "omit") delete out[f.key];
|
|
656
|
+
else out[f.key] = "\u2022\u2022\u2022";
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return out;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// src/with-shape/schema-update/strategies.ts
|
|
663
|
+
function blindUpdate() {
|
|
664
|
+
return { name: "blindUpdate", onSchemaDelta: () => ({ action: "allow" }) };
|
|
425
665
|
}
|
|
426
666
|
function additiveOnly() {
|
|
427
667
|
return {
|
|
@@ -457,7 +697,7 @@ function lockSchema(opts) {
|
|
|
457
697
|
};
|
|
458
698
|
}
|
|
459
699
|
|
|
460
|
-
// src/schema-update/cutover.ts
|
|
700
|
+
// src/with-shape/schema-update/cutover.ts
|
|
461
701
|
function coordinatedCutover(opts) {
|
|
462
702
|
return {
|
|
463
703
|
name: "coordinatedCutover",
|
|
@@ -470,162 +710,2004 @@ function coordinatedCutover(opts) {
|
|
|
470
710
|
};
|
|
471
711
|
}
|
|
472
712
|
|
|
473
|
-
// src/
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
713
|
+
// src/with-store/route-store.ts
|
|
714
|
+
var BLOB_CHUNKS = "_blob_chunks";
|
|
715
|
+
var BLOB_INDEX = "_blob_index";
|
|
716
|
+
var BLOB_SLOTS = "_blob_slots_";
|
|
717
|
+
var BLOB_VERSIONS = "_blob_versions_";
|
|
718
|
+
function routeStore(opts) {
|
|
719
|
+
const primary = opts.default;
|
|
720
|
+
const blobsIsSimple = opts.blobs && "get" in opts.blobs;
|
|
721
|
+
const simpleBlobStore = blobsIsSimple ? opts.blobs : void 0;
|
|
722
|
+
const tieredBlobs = !blobsIsSimple ? opts.blobs : void 0;
|
|
723
|
+
const blobThreshold = tieredBlobs?.threshold ?? 400 * 1024;
|
|
724
|
+
const allStores = /* @__PURE__ */ new Set([primary]);
|
|
725
|
+
if (simpleBlobStore) allStores.add(simpleBlobStore);
|
|
726
|
+
if (tieredBlobs?.large) allStores.add(tieredBlobs.large);
|
|
727
|
+
if (tieredBlobs?.small) allStores.add(tieredBlobs.small);
|
|
728
|
+
if (opts.age?.cold) allStores.add(opts.age.cold);
|
|
729
|
+
if (opts.routes) for (const s of Object.values(opts.routes)) allStores.add(s);
|
|
730
|
+
if (opts.vaultRoutes) for (const s of Object.values(opts.vaultRoutes)) allStores.add(s);
|
|
731
|
+
if (opts.blobRoutes) for (const s of Object.values(opts.blobRoutes)) allStores.add(s);
|
|
732
|
+
if (opts.overflow) allStores.add(opts.overflow);
|
|
733
|
+
if (opts.blobLifecycle?.archiveStore) allStores.add(opts.blobLifecycle.archiveStore);
|
|
734
|
+
const overrides = /* @__PURE__ */ new Map();
|
|
735
|
+
const suspended = /* @__PURE__ */ new Set();
|
|
736
|
+
const writeQueues = /* @__PURE__ */ new Map();
|
|
737
|
+
const NULL_STORE = {
|
|
738
|
+
name: "suspended",
|
|
739
|
+
async get() {
|
|
740
|
+
return null;
|
|
741
|
+
},
|
|
742
|
+
async put() {
|
|
743
|
+
},
|
|
744
|
+
async delete() {
|
|
745
|
+
},
|
|
746
|
+
async list() {
|
|
747
|
+
return [];
|
|
748
|
+
},
|
|
749
|
+
async loadAll() {
|
|
750
|
+
return {};
|
|
751
|
+
},
|
|
752
|
+
async saveAll() {
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
function routeNameFor(vault, collection) {
|
|
756
|
+
if (opts.vaultRoutes) {
|
|
757
|
+
for (const prefix of Object.keys(opts.vaultRoutes)) {
|
|
758
|
+
if (vault.startsWith(prefix)) return prefix;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
if (opts.routes && !collection.startsWith("_") && opts.routes[collection]) {
|
|
762
|
+
return collection;
|
|
763
|
+
}
|
|
764
|
+
if (isBlobChunks(collection) && (simpleBlobStore || tieredBlobs)) return "blobs";
|
|
765
|
+
if (opts.routeBlobMeta && isBlobMeta(collection) && (simpleBlobStore || tieredBlobs)) return "blobs";
|
|
766
|
+
if (opts.age && !collection.startsWith("_")) {
|
|
767
|
+
}
|
|
768
|
+
return "default";
|
|
769
|
+
}
|
|
770
|
+
const quotaExceeded = false;
|
|
771
|
+
function resolveOriginalStore(route) {
|
|
772
|
+
if (route === "blobs") return simpleBlobStore ?? tieredBlobs?.large ?? primary;
|
|
773
|
+
if (route === "cold") return opts.age?.cold ?? primary;
|
|
774
|
+
if (opts.routes?.[route]) return opts.routes[route];
|
|
775
|
+
if (opts.vaultRoutes?.[route]) return opts.vaultRoutes[route];
|
|
776
|
+
return primary;
|
|
777
|
+
}
|
|
778
|
+
function maybeQueueWrite(routeName, method, vault, collection, id, envelope, expectedVersion) {
|
|
779
|
+
if (!suspended.has(routeName)) return false;
|
|
780
|
+
const queue = writeQueues.get(routeName);
|
|
781
|
+
if (!queue) return false;
|
|
782
|
+
if (queue.writes.length >= queue.maxSize) {
|
|
783
|
+
queue.writes.shift();
|
|
784
|
+
}
|
|
785
|
+
queue.writes.push({
|
|
786
|
+
method,
|
|
787
|
+
vault,
|
|
788
|
+
collection,
|
|
789
|
+
id,
|
|
790
|
+
...envelope !== void 0 ? { envelope } : {},
|
|
791
|
+
...expectedVersion !== void 0 ? { expectedVersion } : {}
|
|
792
|
+
});
|
|
793
|
+
return true;
|
|
794
|
+
}
|
|
795
|
+
function isBlobChunks(collection) {
|
|
796
|
+
return collection === BLOB_CHUNKS;
|
|
797
|
+
}
|
|
798
|
+
function isBlobMeta(collection) {
|
|
799
|
+
return collection === BLOB_INDEX || collection.startsWith(BLOB_SLOTS) || collection.startsWith(BLOB_VERSIONS);
|
|
800
|
+
}
|
|
801
|
+
function isInternal(collection) {
|
|
802
|
+
return collection.startsWith("_");
|
|
803
|
+
}
|
|
804
|
+
function storeFor(vault, collection) {
|
|
805
|
+
const rName = routeNameFor(vault, collection);
|
|
806
|
+
if (suspended.has(rName)) return NULL_STORE;
|
|
807
|
+
if (overrides.has(rName)) return overrides.get(rName);
|
|
808
|
+
if (opts.vaultRoutes) {
|
|
809
|
+
for (const [prefix, store2] of Object.entries(opts.vaultRoutes)) {
|
|
810
|
+
if (vault.startsWith(prefix)) return store2;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
if (opts.routes && !isInternal(collection) && opts.routes[collection]) {
|
|
814
|
+
return opts.routes[collection];
|
|
815
|
+
}
|
|
816
|
+
if (isBlobChunks(collection)) {
|
|
817
|
+
if (simpleBlobStore) return simpleBlobStore;
|
|
818
|
+
if (tieredBlobs) return tieredBlobs.large;
|
|
819
|
+
}
|
|
820
|
+
if (opts.routeBlobMeta && isBlobMeta(collection)) {
|
|
821
|
+
if (simpleBlobStore) return simpleBlobStore;
|
|
822
|
+
if (tieredBlobs) return tieredBlobs.large;
|
|
823
|
+
}
|
|
824
|
+
if (quotaExceeded && opts.overflow) return opts.overflow;
|
|
825
|
+
return primary;
|
|
826
|
+
}
|
|
827
|
+
function blobStoreForSize(dataSize) {
|
|
828
|
+
if (!tieredBlobs) return simpleBlobStore ?? primary;
|
|
829
|
+
if (dataSize <= blobThreshold) {
|
|
830
|
+
return tieredBlobs.small ?? primary;
|
|
831
|
+
}
|
|
832
|
+
return tieredBlobs.large;
|
|
833
|
+
}
|
|
834
|
+
function isCold(collection, envelope, before) {
|
|
835
|
+
if (!opts.age) return false;
|
|
836
|
+
if (isInternal(collection)) return false;
|
|
837
|
+
if (opts.age.collections && opts.age.collections.length > 0) {
|
|
838
|
+
if (!opts.age.collections.includes(collection)) return false;
|
|
839
|
+
}
|
|
840
|
+
const cutoffIso = before ?? (opts.age.coldAfterDays != null ? new Date(Date.now() - opts.age.coldAfterDays * 24 * 60 * 60 * 1e3).toISOString() : void 0);
|
|
841
|
+
if (cutoffIso === void 0) return false;
|
|
842
|
+
return envelope._ts < cutoffIso;
|
|
843
|
+
}
|
|
844
|
+
const store = {
|
|
845
|
+
name: buildName(),
|
|
846
|
+
...opts.age?.cold ? { capabilities: { ...primary.capabilities, coldArchival: true } } : primary.capabilities ? { capabilities: { ...primary.capabilities, coldArchival: false } } : {},
|
|
847
|
+
async get(vault, collection, id) {
|
|
848
|
+
const s = storeFor(vault, collection);
|
|
849
|
+
const result = await s.get(vault, collection, id);
|
|
850
|
+
if (result === null && opts.age && !isInternal(collection)) {
|
|
851
|
+
if (!opts.age.collections?.length || opts.age.collections.includes(collection)) {
|
|
852
|
+
return opts.age.cold.get(vault, collection, id);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return result;
|
|
856
|
+
},
|
|
857
|
+
async put(vault, collection, id, envelope, expectedVersion) {
|
|
858
|
+
const rn = routeNameFor(vault, collection);
|
|
859
|
+
if (maybeQueueWrite(rn, "put", vault, collection, id, envelope, expectedVersion)) return;
|
|
860
|
+
if (isBlobChunks(collection) && tieredBlobs) {
|
|
861
|
+
const dataSize = envelope._data.length;
|
|
862
|
+
const s2 = blobStoreForSize(dataSize);
|
|
863
|
+
return s2.put(vault, collection, id, envelope, expectedVersion);
|
|
864
|
+
}
|
|
865
|
+
const s = storeFor(vault, collection);
|
|
866
|
+
if (opts.age && !isInternal(collection)) {
|
|
867
|
+
opts.age.cold.delete(vault, collection, id).catch(() => {
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
return s.put(vault, collection, id, envelope, expectedVersion);
|
|
871
|
+
},
|
|
872
|
+
async delete(vault, collection, id) {
|
|
873
|
+
const rn = routeNameFor(vault, collection);
|
|
874
|
+
if (maybeQueueWrite(rn, "delete", vault, collection, id)) return;
|
|
875
|
+
const s = storeFor(vault, collection);
|
|
876
|
+
await s.delete(vault, collection, id);
|
|
877
|
+
if (opts.age && !isInternal(collection)) {
|
|
878
|
+
await opts.age.cold.delete(vault, collection, id).catch(() => {
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
async list(vault, collection) {
|
|
883
|
+
const s = storeFor(vault, collection);
|
|
884
|
+
const ids = await s.list(vault, collection);
|
|
885
|
+
if (opts.age && !isInternal(collection)) {
|
|
886
|
+
if (!opts.age.collections?.length || opts.age.collections.includes(collection)) {
|
|
887
|
+
const coldIds = await opts.age.cold.list(vault, collection).catch(() => []);
|
|
888
|
+
if (coldIds.length > 0) {
|
|
889
|
+
const merged = new Set(ids);
|
|
890
|
+
for (const id of coldIds) merged.add(id);
|
|
891
|
+
return [...merged];
|
|
892
|
+
}
|
|
520
893
|
}
|
|
521
894
|
}
|
|
895
|
+
return ids;
|
|
896
|
+
},
|
|
897
|
+
async loadAll(vault) {
|
|
898
|
+
const stores = getStoresForVault(vault);
|
|
899
|
+
const snapshots = await Promise.all(
|
|
900
|
+
stores.map((s) => s.loadAll(vault).catch(() => ({})))
|
|
901
|
+
);
|
|
902
|
+
return mergeSnapshots(snapshots);
|
|
903
|
+
},
|
|
904
|
+
async saveAll(vault, data) {
|
|
905
|
+
const partitioned = /* @__PURE__ */ new Map();
|
|
906
|
+
for (const [collection, records] of Object.entries(data)) {
|
|
907
|
+
const s = storeFor(vault, collection);
|
|
908
|
+
if (!partitioned.has(s)) partitioned.set(s, {});
|
|
909
|
+
partitioned.get(s)[collection] = records;
|
|
910
|
+
}
|
|
911
|
+
await Promise.all(
|
|
912
|
+
[...partitioned.entries()].map(([s, snap]) => s.saveAll(vault, snap))
|
|
913
|
+
);
|
|
914
|
+
},
|
|
915
|
+
async compact(vault, compactOpts) {
|
|
916
|
+
if (!opts.age) return 0;
|
|
917
|
+
let migrated = 0;
|
|
918
|
+
const collections = opts.age.collections?.length ? opts.age.collections : Object.keys(await primary.loadAll(vault).catch(() => ({})));
|
|
919
|
+
for (const collection of collections) {
|
|
920
|
+
const ids = await primary.list(vault, collection).catch(() => []);
|
|
921
|
+
for (const id of ids) {
|
|
922
|
+
const envelope = await primary.get(vault, collection, id);
|
|
923
|
+
if (!envelope) continue;
|
|
924
|
+
if (isCold(collection, envelope, compactOpts?.before)) {
|
|
925
|
+
await opts.age.cold.put(vault, collection, id, envelope);
|
|
926
|
+
await primary.delete(vault, collection, id);
|
|
927
|
+
migrated++;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return migrated;
|
|
932
|
+
},
|
|
933
|
+
// ── Runtime override / suspend ──────────────────────
|
|
934
|
+
override(route, overrideStore, overrideOpts) {
|
|
935
|
+
if (overrideOpts?.hydrate) {
|
|
936
|
+
return (async () => {
|
|
937
|
+
overrides.set(route, overrideStore);
|
|
938
|
+
})();
|
|
939
|
+
}
|
|
940
|
+
overrides.set(route, overrideStore);
|
|
941
|
+
},
|
|
942
|
+
clearOverride(route) {
|
|
943
|
+
overrides.delete(route);
|
|
944
|
+
},
|
|
945
|
+
suspend(route, suspendOpts) {
|
|
946
|
+
suspended.add(route);
|
|
947
|
+
if (suspendOpts?.queue) {
|
|
948
|
+
writeQueues.set(route, {
|
|
949
|
+
writes: [],
|
|
950
|
+
maxSize: suspendOpts.maxQueueSize ?? 1e4
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
async resume(route) {
|
|
955
|
+
suspended.delete(route);
|
|
956
|
+
const queue = writeQueues.get(route);
|
|
957
|
+
if (!queue || queue.writes.length === 0) {
|
|
958
|
+
writeQueues.delete(route);
|
|
959
|
+
return 0;
|
|
960
|
+
}
|
|
961
|
+
let replayed = 0;
|
|
962
|
+
const target = overrides.get(route) ?? resolveOriginalStore(route);
|
|
963
|
+
for (const write of queue.writes) {
|
|
964
|
+
try {
|
|
965
|
+
if (write.method === "put" && write.envelope) {
|
|
966
|
+
await target.put(write.vault, write.collection, write.id, write.envelope, write.expectedVersion);
|
|
967
|
+
} else if (write.method === "delete") {
|
|
968
|
+
await target.delete(write.vault, write.collection, write.id);
|
|
969
|
+
}
|
|
970
|
+
replayed++;
|
|
971
|
+
} catch {
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
writeQueues.delete(route);
|
|
975
|
+
return replayed;
|
|
976
|
+
},
|
|
977
|
+
routeStatus() {
|
|
978
|
+
const ov = {};
|
|
979
|
+
for (const [k, v] of overrides) ov[k] = v.name ?? "unnamed";
|
|
980
|
+
const q = {};
|
|
981
|
+
for (const [k, v] of writeQueues) q[k] = v.writes.length;
|
|
982
|
+
return { overrides: ov, suspended: [...suspended], queued: q };
|
|
983
|
+
},
|
|
984
|
+
resolveBackend(vaultId) {
|
|
985
|
+
if (opts.vaultRoutes) {
|
|
986
|
+
for (const [prefix, s] of Object.entries(opts.vaultRoutes)) {
|
|
987
|
+
if (vaultId.startsWith(prefix)) return s;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
return primary;
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
if (anyHas("listVaults")) {
|
|
994
|
+
store.listVaults = async () => {
|
|
995
|
+
const results = await Promise.all(
|
|
996
|
+
[...allStores].filter((s) => s.listVaults !== void 0).map((s) => s.listVaults().catch(() => []))
|
|
997
|
+
);
|
|
998
|
+
return [...new Set(results.flat())];
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
if (anyHas("ping")) {
|
|
1002
|
+
store.ping = async () => {
|
|
1003
|
+
const results = await Promise.all(
|
|
1004
|
+
[...allStores].filter((s) => s.ping !== void 0).map((s) => s.ping().catch(() => false))
|
|
1005
|
+
);
|
|
1006
|
+
return results.some(Boolean);
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
return store;
|
|
1010
|
+
function buildName() {
|
|
1011
|
+
const names = [...allStores].map((s) => s.name ?? "?").join("+");
|
|
1012
|
+
return `route(${names})`;
|
|
1013
|
+
}
|
|
1014
|
+
function anyHas(method) {
|
|
1015
|
+
return [...allStores].some((s) => s[method]);
|
|
1016
|
+
}
|
|
1017
|
+
function getStoresForVault(vault) {
|
|
1018
|
+
const stores = /* @__PURE__ */ new Set();
|
|
1019
|
+
if (opts.vaultRoutes) {
|
|
1020
|
+
for (const [prefix, s] of Object.entries(opts.vaultRoutes)) {
|
|
1021
|
+
if (vault.startsWith(prefix)) {
|
|
1022
|
+
stores.add(s);
|
|
1023
|
+
return [...stores];
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
stores.add(primary);
|
|
1028
|
+
if (simpleBlobStore) stores.add(simpleBlobStore);
|
|
1029
|
+
if (tieredBlobs?.large) stores.add(tieredBlobs.large);
|
|
1030
|
+
if (tieredBlobs?.small && tieredBlobs.small !== primary) stores.add(tieredBlobs.small);
|
|
1031
|
+
if (opts.age?.cold) stores.add(opts.age.cold);
|
|
1032
|
+
if (opts.routes) {
|
|
1033
|
+
for (const s of Object.values(opts.routes)) stores.add(s);
|
|
1034
|
+
}
|
|
1035
|
+
return [...stores];
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
function mergeSnapshots(snapshots) {
|
|
1039
|
+
const merged = {};
|
|
1040
|
+
for (const snap of snapshots) {
|
|
1041
|
+
for (const [collection, records] of Object.entries(snap)) {
|
|
1042
|
+
if (!merged[collection]) {
|
|
1043
|
+
merged[collection] = { ...records };
|
|
1044
|
+
continue;
|
|
1045
|
+
}
|
|
1046
|
+
for (const [id, envelope] of Object.entries(records)) {
|
|
1047
|
+
const existing = merged[collection][id];
|
|
1048
|
+
if (!existing || envelope._ts >= existing._ts) {
|
|
1049
|
+
merged[collection][id] = envelope;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
return merged;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
// src/with-store/store-middleware.ts
|
|
1058
|
+
function wrapStore(store, ...middlewares) {
|
|
1059
|
+
let result = store;
|
|
1060
|
+
for (let i = middlewares.length - 1; i >= 0; i--) {
|
|
1061
|
+
result = middlewares[i](result);
|
|
1062
|
+
}
|
|
1063
|
+
return result;
|
|
1064
|
+
}
|
|
1065
|
+
function withRetry(opts = {}) {
|
|
1066
|
+
const maxRetries = opts.maxRetries ?? 3;
|
|
1067
|
+
const backoffMs = opts.backoffMs ?? 500;
|
|
1068
|
+
const jitter = opts.jitter ?? 0.3;
|
|
1069
|
+
const retryOn = opts.retryOn ? new Set(opts.retryOn) : null;
|
|
1070
|
+
function shouldRetry(err) {
|
|
1071
|
+
if (!retryOn) return true;
|
|
1072
|
+
if (err && typeof err === "object" && "code" in err) {
|
|
1073
|
+
return retryOn.has(err.code);
|
|
1074
|
+
}
|
|
1075
|
+
return true;
|
|
1076
|
+
}
|
|
1077
|
+
async function retryable(fn) {
|
|
1078
|
+
let lastError;
|
|
1079
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1080
|
+
try {
|
|
1081
|
+
return await fn();
|
|
1082
|
+
} catch (err) {
|
|
1083
|
+
lastError = err;
|
|
1084
|
+
if (attempt >= maxRetries || !shouldRetry(err)) throw err;
|
|
1085
|
+
const delay = backoffMs * Math.pow(2, attempt) * (1 + Math.random() * jitter);
|
|
1086
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
throw lastError;
|
|
1090
|
+
}
|
|
1091
|
+
return (next) => ({
|
|
1092
|
+
...next,
|
|
1093
|
+
name: next.name ? `retry(${next.name})` : "retry",
|
|
1094
|
+
get: (v, c, id) => retryable(() => next.get(v, c, id)),
|
|
1095
|
+
put: (v, c, id, env, ev) => retryable(() => next.put(v, c, id, env, ev)),
|
|
1096
|
+
delete: (v, c, id) => retryable(() => next.delete(v, c, id)),
|
|
1097
|
+
list: (v, c) => retryable(() => next.list(v, c)),
|
|
1098
|
+
loadAll: (v) => retryable(() => next.loadAll(v)),
|
|
1099
|
+
saveAll: (v, d) => retryable(() => next.saveAll(v, d))
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
var LOG_LEVELS = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
1103
|
+
function withLogging(opts = {}) {
|
|
1104
|
+
const minLevel = LOG_LEVELS[opts.level ?? "info"];
|
|
1105
|
+
const logger = opts.logger ?? console;
|
|
1106
|
+
const logData = opts.logData ?? false;
|
|
1107
|
+
function log(level, method, args, durationMs) {
|
|
1108
|
+
if (LOG_LEVELS[level] < minLevel) return;
|
|
1109
|
+
const parts = [`[noydb:${method}]`, ...Object.entries(args).map(([k, v]) => `${k}=${String(v)}`)];
|
|
1110
|
+
if (durationMs !== void 0) parts.push(`${durationMs}ms`);
|
|
1111
|
+
logger[level](parts.join(" "));
|
|
1112
|
+
}
|
|
1113
|
+
function timed(method, args, fn) {
|
|
1114
|
+
const start = Date.now();
|
|
1115
|
+
return fn().then(
|
|
1116
|
+
(result) => {
|
|
1117
|
+
log("debug", method, args, Date.now() - start);
|
|
1118
|
+
return result;
|
|
1119
|
+
},
|
|
1120
|
+
(err) => {
|
|
1121
|
+
log("error", method, { ...args, error: err.message }, Date.now() - start);
|
|
1122
|
+
throw err;
|
|
1123
|
+
}
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
return (next) => ({
|
|
1127
|
+
...next,
|
|
1128
|
+
name: next.name ? `log(${next.name})` : "log",
|
|
1129
|
+
get: (v, c, id) => timed("get", { vault: v, collection: c, id }, () => next.get(v, c, id)),
|
|
1130
|
+
put: (v, c, id, env, ev) => timed("put", {
|
|
1131
|
+
vault: v,
|
|
1132
|
+
collection: c,
|
|
1133
|
+
id,
|
|
1134
|
+
version: env._v,
|
|
1135
|
+
...logData ? { data: env._data.slice(0, 40) + "..." } : {}
|
|
1136
|
+
}, () => next.put(v, c, id, env, ev)),
|
|
1137
|
+
delete: (v, c, id) => timed("delete", { vault: v, collection: c, id }, () => next.delete(v, c, id)),
|
|
1138
|
+
list: (v, c) => timed("list", { vault: v, collection: c }, () => next.list(v, c)),
|
|
1139
|
+
loadAll: (v) => timed("loadAll", { vault: v }, () => next.loadAll(v)),
|
|
1140
|
+
saveAll: (v, d) => timed("saveAll", { vault: v }, () => next.saveAll(v, d))
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
function withMetrics(opts) {
|
|
1144
|
+
function tracked(method, vault, fn, collection, id) {
|
|
1145
|
+
const start = Date.now();
|
|
1146
|
+
return fn().then(
|
|
1147
|
+
(result) => {
|
|
1148
|
+
opts.onOperation({
|
|
1149
|
+
method,
|
|
1150
|
+
vault,
|
|
1151
|
+
...collection !== void 0 ? { collection } : {},
|
|
1152
|
+
...id !== void 0 ? { id } : {},
|
|
1153
|
+
durationMs: Date.now() - start,
|
|
1154
|
+
success: true
|
|
1155
|
+
});
|
|
1156
|
+
return result;
|
|
1157
|
+
},
|
|
1158
|
+
(err) => {
|
|
1159
|
+
opts.onOperation({
|
|
1160
|
+
method,
|
|
1161
|
+
vault,
|
|
1162
|
+
...collection !== void 0 ? { collection } : {},
|
|
1163
|
+
...id !== void 0 ? { id } : {},
|
|
1164
|
+
durationMs: Date.now() - start,
|
|
1165
|
+
success: false,
|
|
1166
|
+
error: err
|
|
1167
|
+
});
|
|
1168
|
+
throw err;
|
|
1169
|
+
}
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
return (next) => ({
|
|
1173
|
+
...next,
|
|
1174
|
+
name: next.name ? `metrics(${next.name})` : "metrics",
|
|
1175
|
+
get: (v, c, id) => tracked("get", v, () => next.get(v, c, id), c, id),
|
|
1176
|
+
put: (v, c, id, env, ev) => tracked("put", v, () => next.put(v, c, id, env, ev), c, id),
|
|
1177
|
+
delete: (v, c, id) => tracked("delete", v, () => next.delete(v, c, id), c, id),
|
|
1178
|
+
list: (v, c) => tracked("list", v, () => next.list(v, c), c),
|
|
1179
|
+
loadAll: (v) => tracked("loadAll", v, () => next.loadAll(v)),
|
|
1180
|
+
saveAll: (v, d) => tracked("saveAll", v, () => next.saveAll(v, d))
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
function withCircuitBreaker(opts = {}) {
|
|
1184
|
+
const threshold = opts.failureThreshold ?? 5;
|
|
1185
|
+
const resetMs = opts.resetTimeoutMs ?? 3e4;
|
|
1186
|
+
let state = "closed";
|
|
1187
|
+
let failures = 0;
|
|
1188
|
+
let lastFailureTime = 0;
|
|
1189
|
+
function recordSuccess() {
|
|
1190
|
+
if (state === "half-open") {
|
|
1191
|
+
state = "closed";
|
|
1192
|
+
failures = 0;
|
|
1193
|
+
opts.onClose?.();
|
|
1194
|
+
}
|
|
1195
|
+
failures = 0;
|
|
1196
|
+
}
|
|
1197
|
+
function recordFailure() {
|
|
1198
|
+
failures++;
|
|
1199
|
+
lastFailureTime = Date.now();
|
|
1200
|
+
if (failures >= threshold && state === "closed") {
|
|
1201
|
+
state = "open";
|
|
1202
|
+
opts.onOpen?.();
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
function canAttempt() {
|
|
1206
|
+
if (state === "closed") return true;
|
|
1207
|
+
if (state === "open") {
|
|
1208
|
+
if (Date.now() - lastFailureTime >= resetMs) {
|
|
1209
|
+
state = "half-open";
|
|
1210
|
+
return true;
|
|
1211
|
+
}
|
|
1212
|
+
return false;
|
|
1213
|
+
}
|
|
1214
|
+
return true;
|
|
1215
|
+
}
|
|
1216
|
+
async function guarded(fn, fallback) {
|
|
1217
|
+
if (!canAttempt()) return fallback;
|
|
1218
|
+
try {
|
|
1219
|
+
const result = await fn();
|
|
1220
|
+
recordSuccess();
|
|
1221
|
+
return result;
|
|
1222
|
+
} catch (err) {
|
|
1223
|
+
recordFailure();
|
|
1224
|
+
throw err;
|
|
522
1225
|
}
|
|
523
1226
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
1227
|
+
return (next) => ({
|
|
1228
|
+
...next,
|
|
1229
|
+
name: next.name ? `cb(${next.name})` : "cb",
|
|
1230
|
+
get: (v, c, id) => guarded(() => next.get(v, c, id), null),
|
|
1231
|
+
put: (v, c, id, env, ev) => guarded(() => next.put(v, c, id, env, ev), void 0),
|
|
1232
|
+
delete: (v, c, id) => guarded(() => next.delete(v, c, id), void 0),
|
|
1233
|
+
list: (v, c) => guarded(() => next.list(v, c), []),
|
|
1234
|
+
loadAll: (v) => guarded(() => next.loadAll(v), {}),
|
|
1235
|
+
saveAll: (v, d) => guarded(() => next.saveAll(v, d), void 0)
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
function withCache(opts = {}) {
|
|
1239
|
+
const maxEntries = opts.maxEntries ?? 500;
|
|
1240
|
+
const ttlMs = opts.ttlMs ?? 6e4;
|
|
1241
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1242
|
+
function cacheKey(vault, collection, id) {
|
|
1243
|
+
return `${vault}\0${collection}\0${id}`;
|
|
1244
|
+
}
|
|
1245
|
+
function getFromCache(key) {
|
|
1246
|
+
const entry = cache.get(key);
|
|
1247
|
+
if (!entry) return void 0;
|
|
1248
|
+
if (ttlMs > 0 && Date.now() - entry.cachedAt > ttlMs) {
|
|
1249
|
+
cache.delete(key);
|
|
1250
|
+
return void 0;
|
|
1251
|
+
}
|
|
1252
|
+
cache.delete(key);
|
|
1253
|
+
cache.set(key, entry);
|
|
1254
|
+
return entry.envelope;
|
|
1255
|
+
}
|
|
1256
|
+
function setInCache(key, envelope) {
|
|
1257
|
+
if (cache.size >= maxEntries) {
|
|
1258
|
+
const oldest = cache.keys().next().value;
|
|
1259
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
1260
|
+
}
|
|
1261
|
+
cache.set(key, { envelope, cachedAt: Date.now() });
|
|
1262
|
+
}
|
|
1263
|
+
function invalidate(key) {
|
|
1264
|
+
cache.delete(key);
|
|
1265
|
+
}
|
|
1266
|
+
return (next) => ({
|
|
1267
|
+
...next,
|
|
1268
|
+
name: next.name ? `cache(${next.name})` : "cache",
|
|
1269
|
+
async get(vault, collection, id) {
|
|
1270
|
+
const key = cacheKey(vault, collection, id);
|
|
1271
|
+
const cached = getFromCache(key);
|
|
1272
|
+
if (cached !== void 0) return cached;
|
|
1273
|
+
const result = await next.get(vault, collection, id);
|
|
1274
|
+
setInCache(key, result);
|
|
1275
|
+
return result;
|
|
1276
|
+
},
|
|
1277
|
+
async put(vault, collection, id, env, ev) {
|
|
1278
|
+
invalidate(cacheKey(vault, collection, id));
|
|
1279
|
+
await next.put(vault, collection, id, env, ev);
|
|
1280
|
+
setInCache(cacheKey(vault, collection, id), env);
|
|
1281
|
+
},
|
|
1282
|
+
async delete(vault, collection, id) {
|
|
1283
|
+
invalidate(cacheKey(vault, collection, id));
|
|
1284
|
+
await next.delete(vault, collection, id);
|
|
1285
|
+
},
|
|
1286
|
+
list: (v, c) => next.list(v, c),
|
|
1287
|
+
loadAll: (v) => next.loadAll(v),
|
|
1288
|
+
saveAll: (v, d) => next.saveAll(v, d)
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
function withHealthCheck(opts = {}) {
|
|
1292
|
+
const intervalMs = opts.checkIntervalMs ?? 3e4;
|
|
1293
|
+
const failThreshold = opts.suspendAfterFailures ?? 3;
|
|
1294
|
+
const successThreshold = opts.resumeAfterSuccess ?? 1;
|
|
1295
|
+
let isSuspended = false;
|
|
1296
|
+
let consecutiveFailures = 0;
|
|
1297
|
+
let consecutiveSuccesses = 0;
|
|
1298
|
+
return (next) => {
|
|
1299
|
+
const checkFn = opts.check ?? (next.ping ? () => next.ping() : async () => {
|
|
1300
|
+
await next.list("__health__", "__ping__");
|
|
1301
|
+
return true;
|
|
1302
|
+
});
|
|
1303
|
+
async function doCheck() {
|
|
1304
|
+
try {
|
|
1305
|
+
const ok = await checkFn();
|
|
1306
|
+
if (ok) {
|
|
1307
|
+
consecutiveFailures = 0;
|
|
1308
|
+
consecutiveSuccesses++;
|
|
1309
|
+
if (isSuspended && consecutiveSuccesses >= successThreshold) {
|
|
1310
|
+
isSuspended = false;
|
|
1311
|
+
consecutiveSuccesses = 0;
|
|
1312
|
+
opts.onResume?.();
|
|
1313
|
+
}
|
|
1314
|
+
} else {
|
|
1315
|
+
throw new Error("Health check returned false");
|
|
1316
|
+
}
|
|
1317
|
+
} catch {
|
|
1318
|
+
consecutiveSuccesses = 0;
|
|
1319
|
+
consecutiveFailures++;
|
|
1320
|
+
if (!isSuspended && consecutiveFailures >= failThreshold) {
|
|
1321
|
+
isSuspended = true;
|
|
1322
|
+
consecutiveFailures = 0;
|
|
1323
|
+
opts.onSuspend?.();
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
setInterval(() => {
|
|
1328
|
+
void doCheck();
|
|
1329
|
+
}, intervalMs);
|
|
1330
|
+
const wrapped = {
|
|
1331
|
+
...next,
|
|
1332
|
+
name: next.name ? `health(${next.name})` : "health",
|
|
1333
|
+
async get(v, c, id) {
|
|
1334
|
+
return isSuspended ? null : next.get(v, c, id);
|
|
1335
|
+
},
|
|
1336
|
+
async put(v, c, id, env, ev) {
|
|
1337
|
+
if (!isSuspended) await next.put(v, c, id, env, ev);
|
|
1338
|
+
},
|
|
1339
|
+
async delete(v, c, id) {
|
|
1340
|
+
if (!isSuspended) await next.delete(v, c, id);
|
|
1341
|
+
},
|
|
1342
|
+
async list(v, c) {
|
|
1343
|
+
return isSuspended ? [] : next.list(v, c);
|
|
1344
|
+
},
|
|
1345
|
+
async loadAll(v) {
|
|
1346
|
+
return isSuspended ? {} : next.loadAll(v);
|
|
1347
|
+
},
|
|
1348
|
+
async saveAll(v, d) {
|
|
1349
|
+
if (!isSuspended) await next.saveAll(v, d);
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
return wrapped;
|
|
529
1353
|
};
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
// src/with-commit/numbering/descriptor.ts
|
|
1357
|
+
function withDeferredNumbering(config) {
|
|
530
1358
|
return {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
1359
|
+
series: config.series,
|
|
1360
|
+
collection: config.collection,
|
|
1361
|
+
field: config.field,
|
|
1362
|
+
settleWindowMs: config.settleWindowMs ?? 0
|
|
1363
|
+
};
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
// src/via/money/iso4217.ts
|
|
1367
|
+
var MINOR_UNITS = {
|
|
1368
|
+
// 2-decimal majors
|
|
1369
|
+
EUR: 2,
|
|
1370
|
+
USD: 2,
|
|
1371
|
+
GBP: 2,
|
|
1372
|
+
CHF: 2,
|
|
1373
|
+
CAD: 2,
|
|
1374
|
+
AUD: 2,
|
|
1375
|
+
NZD: 2,
|
|
1376
|
+
SGD: 2,
|
|
1377
|
+
HKD: 2,
|
|
1378
|
+
CNY: 2,
|
|
1379
|
+
INR: 2,
|
|
1380
|
+
BRL: 2,
|
|
1381
|
+
MXN: 2,
|
|
1382
|
+
ZAR: 2,
|
|
1383
|
+
RUB: 2,
|
|
1384
|
+
TRY: 2,
|
|
1385
|
+
PLN: 2,
|
|
1386
|
+
SEK: 2,
|
|
1387
|
+
NOK: 2,
|
|
1388
|
+
DKK: 2,
|
|
1389
|
+
CZK: 2,
|
|
1390
|
+
HUF: 2,
|
|
1391
|
+
RON: 2,
|
|
1392
|
+
ILS: 2,
|
|
1393
|
+
THB: 2,
|
|
1394
|
+
PHP: 2,
|
|
1395
|
+
MYR: 2,
|
|
1396
|
+
IDR: 2,
|
|
1397
|
+
AED: 2,
|
|
1398
|
+
SAR: 2,
|
|
1399
|
+
QAR: 2,
|
|
1400
|
+
EGP: 2,
|
|
1401
|
+
// 0-decimal
|
|
1402
|
+
JPY: 0,
|
|
1403
|
+
KRW: 0,
|
|
1404
|
+
ISK: 0,
|
|
1405
|
+
CLP: 0,
|
|
1406
|
+
VND: 0,
|
|
1407
|
+
XOF: 0,
|
|
1408
|
+
XAF: 0,
|
|
1409
|
+
PYG: 0,
|
|
1410
|
+
// 3-decimal
|
|
1411
|
+
BHD: 3,
|
|
1412
|
+
KWD: 3,
|
|
1413
|
+
OMR: 3,
|
|
1414
|
+
TND: 3,
|
|
1415
|
+
JOD: 3,
|
|
1416
|
+
IQD: 3,
|
|
1417
|
+
LYD: 3
|
|
1418
|
+
};
|
|
1419
|
+
function scaleForCurrency(code) {
|
|
1420
|
+
const v = MINOR_UNITS[code];
|
|
1421
|
+
return v === void 0 ? null : v;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
// src/via/money/fixed-point.ts
|
|
1425
|
+
function expandExponent(s) {
|
|
1426
|
+
const m = /^([+-]?)(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/.exec(s);
|
|
1427
|
+
if (!m) return s;
|
|
1428
|
+
const sign = m[1] === "-" ? "-" : "";
|
|
1429
|
+
const intp = m[2];
|
|
1430
|
+
const frac = m[3] ?? "";
|
|
1431
|
+
const exp = Number(m[4]);
|
|
1432
|
+
const digits = intp + frac;
|
|
1433
|
+
const pointPos = intp.length + exp;
|
|
1434
|
+
let body;
|
|
1435
|
+
if (pointPos <= 0) {
|
|
1436
|
+
body = "0." + "0".repeat(-pointPos) + digits;
|
|
1437
|
+
} else if (pointPos >= digits.length) {
|
|
1438
|
+
body = digits + "0".repeat(pointPos - digits.length);
|
|
1439
|
+
} else {
|
|
1440
|
+
body = digits.slice(0, pointPos) + "." + digits.slice(pointPos);
|
|
1441
|
+
}
|
|
1442
|
+
return sign + body;
|
|
1443
|
+
}
|
|
1444
|
+
function toCanonicalDecimalString(input) {
|
|
1445
|
+
let s;
|
|
1446
|
+
if (typeof input === "number") {
|
|
1447
|
+
if (!Number.isFinite(input)) return null;
|
|
1448
|
+
s = String(input);
|
|
1449
|
+
} else {
|
|
1450
|
+
s = input.trim();
|
|
1451
|
+
}
|
|
1452
|
+
s = expandExponent(s);
|
|
1453
|
+
if (s.startsWith("+")) s = s.slice(1);
|
|
1454
|
+
if (!/^-?(\d+(\.\d*)?|\.\d+)$/.test(s)) return null;
|
|
1455
|
+
return s;
|
|
1456
|
+
}
|
|
1457
|
+
function shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, mode) {
|
|
1458
|
+
switch (mode) {
|
|
1459
|
+
case "up":
|
|
1460
|
+
return true;
|
|
1461
|
+
case "down":
|
|
1462
|
+
return false;
|
|
1463
|
+
case "ceil":
|
|
1464
|
+
return !negative;
|
|
1465
|
+
case "floor":
|
|
1466
|
+
return negative;
|
|
1467
|
+
case "half-up":
|
|
1468
|
+
return firstDiscarded >= 5;
|
|
1469
|
+
case "half-down":
|
|
1470
|
+
return firstDiscarded > 5 || firstDiscarded === 5 && hasMoreNonZeroAfterFirst;
|
|
1471
|
+
case "half-even":
|
|
1472
|
+
if (firstDiscarded > 5) return true;
|
|
1473
|
+
if (firstDiscarded < 5) return false;
|
|
1474
|
+
return hasMoreNonZeroAfterFirst || lastKeptDigit % 2 === 1;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
function parseToScaledInt(input, scale, rounding) {
|
|
1478
|
+
const canonical = toCanonicalDecimalString(input);
|
|
1479
|
+
if (canonical === null) return { ok: false, reason: "nonfinite" };
|
|
1480
|
+
const negative = canonical.startsWith("-");
|
|
1481
|
+
const unsigned = negative ? canonical.slice(1) : canonical;
|
|
1482
|
+
const dot = unsigned.indexOf(".");
|
|
1483
|
+
const intPart = dot === -1 ? unsigned : unsigned.slice(0, dot);
|
|
1484
|
+
const fracPart = dot === -1 ? "" : unsigned.slice(dot + 1);
|
|
1485
|
+
const intDigits = intPart === "" ? "0" : intPart;
|
|
1486
|
+
if (fracPart.length <= scale) {
|
|
1487
|
+
const keep2 = fracPart.padEnd(scale, "0");
|
|
1488
|
+
const magnitude2 = BigInt(intDigits + keep2);
|
|
1489
|
+
return { ok: true, value: negative && magnitude2 !== 0n ? -magnitude2 : magnitude2 };
|
|
1490
|
+
}
|
|
1491
|
+
const keep = fracPart.slice(0, scale);
|
|
1492
|
+
const tail = fracPart.slice(scale);
|
|
1493
|
+
const magnitudeDigits = intDigits + keep;
|
|
1494
|
+
let magnitude = BigInt(magnitudeDigits);
|
|
1495
|
+
if (/^0+$/.test(tail)) {
|
|
1496
|
+
return { ok: true, value: negative && magnitude !== 0n ? -magnitude : magnitude };
|
|
1497
|
+
}
|
|
1498
|
+
if (rounding === void 0) return { ok: false, reason: "precision" };
|
|
1499
|
+
const lastKeptDigit = Number(magnitudeDigits[magnitudeDigits.length - 1]);
|
|
1500
|
+
const firstDiscarded = Number(tail[0]);
|
|
1501
|
+
const hasMoreNonZeroAfterFirst = /[1-9]/.test(tail.slice(1));
|
|
1502
|
+
if (shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, rounding)) {
|
|
1503
|
+
magnitude += 1n;
|
|
1504
|
+
}
|
|
1505
|
+
return { ok: true, value: negative && magnitude !== 0n ? -magnitude : magnitude };
|
|
1506
|
+
}
|
|
1507
|
+
function decimalScaleOf(input) {
|
|
1508
|
+
const s = toCanonicalDecimalString(input);
|
|
1509
|
+
if (s === null) return null;
|
|
1510
|
+
const dot = s.indexOf(".");
|
|
1511
|
+
return dot === -1 ? 0 : s.length - dot - 1;
|
|
1512
|
+
}
|
|
1513
|
+
function rescaleScaledInt(value, fromScale, toScale, rounding = "half-up") {
|
|
1514
|
+
if (toScale >= fromScale) return value * 10n ** BigInt(toScale - fromScale);
|
|
1515
|
+
const drop = fromScale - toScale;
|
|
1516
|
+
const negative = value < 0n;
|
|
1517
|
+
const absStr = (negative ? -value : value).toString().padStart(drop + 1, "0");
|
|
1518
|
+
const keptStr = absStr.slice(0, absStr.length - drop);
|
|
1519
|
+
const tail = absStr.slice(absStr.length - drop);
|
|
1520
|
+
let magnitude = BigInt(keptStr);
|
|
1521
|
+
if (!/^0+$/.test(tail)) {
|
|
1522
|
+
const lastKeptDigit = Number(keptStr[keptStr.length - 1]);
|
|
1523
|
+
const firstDiscarded = Number(tail[0]);
|
|
1524
|
+
const hasMoreNonZeroAfterFirst = /[1-9]/.test(tail.slice(1));
|
|
1525
|
+
if (shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, rounding)) {
|
|
1526
|
+
magnitude += 1n;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
return negative && magnitude !== 0n ? -magnitude : magnitude;
|
|
1530
|
+
}
|
|
1531
|
+
function formatScaledInt(value, scale) {
|
|
1532
|
+
const negative = value < 0n;
|
|
1533
|
+
const abs = (negative ? -value : value).toString();
|
|
1534
|
+
if (scale === 0) return (negative ? "-" : "") + abs;
|
|
1535
|
+
const padded = abs.padStart(scale + 1, "0");
|
|
1536
|
+
const cut = padded.length - scale;
|
|
1537
|
+
const intPart = padded.slice(0, cut);
|
|
1538
|
+
const fracPart = padded.slice(cut);
|
|
1539
|
+
return (negative ? "-" : "") + intPart + "." + fracPart;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// src/via/money/paths.ts
|
|
1543
|
+
var SEGMENT_RE = /^(\*|[^.[\]*]+)(\[\])?$/;
|
|
1544
|
+
var parseCache = /* @__PURE__ */ new Map();
|
|
1545
|
+
function parseMoneyPath(path) {
|
|
1546
|
+
const cached = parseCache.get(path);
|
|
1547
|
+
if (cached) return cached;
|
|
1548
|
+
if (typeof path !== "string" || path.length === 0) {
|
|
1549
|
+
throw new ValidationError("moneyFields: path must be a non-empty string");
|
|
1550
|
+
}
|
|
1551
|
+
const segments = [];
|
|
1552
|
+
for (const part of path.split(".")) {
|
|
1553
|
+
const m = SEGMENT_RE.exec(part);
|
|
1554
|
+
if (!m) {
|
|
1555
|
+
throw new ValidationError(
|
|
1556
|
+
`moneyFields: invalid path "${path}" \u2014 segment "${part}" must be a key, "key[]", "*", or "*[]"`
|
|
1557
|
+
);
|
|
1558
|
+
}
|
|
1559
|
+
const array = m[2] === "[]";
|
|
1560
|
+
segments.push(
|
|
1561
|
+
m[1] === "*" ? { kind: "wildcard", array } : { kind: "key", key: m[1], array }
|
|
1562
|
+
);
|
|
1563
|
+
}
|
|
1564
|
+
parseCache.set(path, segments);
|
|
1565
|
+
return segments;
|
|
1566
|
+
}
|
|
1567
|
+
function isSimpleMoneyPath(path) {
|
|
1568
|
+
return !path.includes(".") && !path.includes("[") && !path.includes("*");
|
|
1569
|
+
}
|
|
1570
|
+
function validateMoneyFieldPaths(moneyFields) {
|
|
1571
|
+
for (const path of Object.keys(moneyFields)) parseMoneyPath(path);
|
|
1572
|
+
}
|
|
1573
|
+
function transformAtMoneyPath(node, path, segments, index, visit, lenient) {
|
|
1574
|
+
if (node === null || node === void 0) return node;
|
|
1575
|
+
const seg = segments[index];
|
|
1576
|
+
const last = index === segments.length - 1;
|
|
1577
|
+
if (seg.kind === "key") {
|
|
1578
|
+
if (typeof node !== "object" || Array.isArray(node)) {
|
|
1579
|
+
if (lenient) return node;
|
|
1580
|
+
throw new ValidationError(
|
|
1581
|
+
`moneyFields: path "${path}" expected an object at segment "${seg.key}", got ${Array.isArray(node) ? "an array" : typeof node}`
|
|
1582
|
+
);
|
|
538
1583
|
}
|
|
1584
|
+
const obj2 = node;
|
|
1585
|
+
if (!(seg.key in obj2) || obj2[seg.key] === null || obj2[seg.key] === void 0) return node;
|
|
1586
|
+
if (seg.array) {
|
|
1587
|
+
const arr = obj2[seg.key];
|
|
1588
|
+
if (!Array.isArray(arr)) {
|
|
1589
|
+
if (lenient) return node;
|
|
1590
|
+
throw new ValidationError(
|
|
1591
|
+
`moneyFields: path "${path}" declares "${seg.key}[]" but the value is not an array`
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
const cloned = [...arr];
|
|
1595
|
+
if (last) {
|
|
1596
|
+
for (let i = 0; i < cloned.length; i++) visit(cloned, i);
|
|
1597
|
+
} else {
|
|
1598
|
+
for (let i = 0; i < cloned.length; i++) {
|
|
1599
|
+
cloned[i] = transformAtMoneyPath(cloned[i], path, segments, index + 1, visit, lenient);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
return { ...obj2, [seg.key]: cloned };
|
|
1603
|
+
}
|
|
1604
|
+
const clone2 = { ...obj2 };
|
|
1605
|
+
if (last) {
|
|
1606
|
+
visit(clone2, seg.key);
|
|
1607
|
+
} else {
|
|
1608
|
+
clone2[seg.key] = transformAtMoneyPath(clone2[seg.key], path, segments, index + 1, visit, lenient);
|
|
1609
|
+
}
|
|
1610
|
+
return clone2;
|
|
1611
|
+
}
|
|
1612
|
+
if (seg.array) {
|
|
1613
|
+
if (!Array.isArray(node)) {
|
|
1614
|
+
if (lenient) return node;
|
|
1615
|
+
throw new ValidationError(`moneyFields: path "${path}" declares "*[]" but the value is not an array`);
|
|
1616
|
+
}
|
|
1617
|
+
const cloned = [...node];
|
|
1618
|
+
if (last) {
|
|
1619
|
+
for (let i = 0; i < cloned.length; i++) visit(cloned, i);
|
|
1620
|
+
} else {
|
|
1621
|
+
for (let i = 0; i < cloned.length; i++) {
|
|
1622
|
+
cloned[i] = transformAtMoneyPath(cloned[i], path, segments, index + 1, visit, lenient);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
return cloned;
|
|
1626
|
+
}
|
|
1627
|
+
if (typeof node !== "object" || Array.isArray(node)) {
|
|
1628
|
+
if (lenient) return node;
|
|
1629
|
+
throw new ValidationError(
|
|
1630
|
+
`moneyFields: path "${path}" applies "*" to a non-object (${Array.isArray(node) ? 'array \u2014 use "*[]"' : typeof node})`
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
const obj = node;
|
|
1634
|
+
const clone = { ...obj };
|
|
1635
|
+
for (const key of Object.keys(obj)) {
|
|
1636
|
+
const v = clone[key];
|
|
1637
|
+
if (v === null || v === void 0) continue;
|
|
1638
|
+
if (last) visit(clone, key);
|
|
1639
|
+
else clone[key] = transformAtMoneyPath(v, path, segments, index + 1, visit, lenient);
|
|
1640
|
+
}
|
|
1641
|
+
return clone;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
// src/via/money/normalize.ts
|
|
1645
|
+
function isMoneyValueObject(v) {
|
|
1646
|
+
return typeof v === "object" && v !== null && "currency" in v;
|
|
1647
|
+
}
|
|
1648
|
+
function quantizeAmount(field, input, scale, rounding) {
|
|
1649
|
+
const r = parseToScaledInt(input, scale, rounding);
|
|
1650
|
+
if (!r.ok) {
|
|
1651
|
+
if (r.reason === "precision") throw new MoneyPrecisionError(field, input, scale);
|
|
1652
|
+
throw new TypeError(`money: field "${field}" value ${JSON.stringify(input)} is not a finite decimal`);
|
|
1653
|
+
}
|
|
1654
|
+
return r.value.toString();
|
|
1655
|
+
}
|
|
1656
|
+
function canonicalizeStoredMoney(record, moneyFields) {
|
|
1657
|
+
if (record === null || record === void 0) return record;
|
|
1658
|
+
if (!moneyFields || Object.keys(moneyFields).length === 0) return record;
|
|
1659
|
+
return decodeMoneyFields(record, moneyFields, "raw");
|
|
1660
|
+
}
|
|
1661
|
+
function canonicalizeIncomingMoney(record, moneyFields) {
|
|
1662
|
+
if (!moneyFields || Object.keys(moneyFields).length === 0) return record;
|
|
1663
|
+
try {
|
|
1664
|
+
return decodeMoneyFields(
|
|
1665
|
+
quantizeMoneyFields(record, moneyFields),
|
|
1666
|
+
moneyFields,
|
|
1667
|
+
"raw"
|
|
1668
|
+
);
|
|
1669
|
+
} catch {
|
|
1670
|
+
return record;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
function quantizeValue(field, raw, desc) {
|
|
1674
|
+
if (desc.mode === "fixed") {
|
|
1675
|
+
const currency2 = desc.fixedCurrency;
|
|
1676
|
+
return quantizeAmount(field, raw, desc.scaleFor(currency2), desc.rounding);
|
|
1677
|
+
}
|
|
1678
|
+
let amount;
|
|
1679
|
+
let currency;
|
|
1680
|
+
if (isMoneyValueObject(raw)) {
|
|
1681
|
+
currency = String(raw.currency);
|
|
1682
|
+
amount = raw.amount;
|
|
1683
|
+
} else {
|
|
1684
|
+
const sole = desc.soleCurrency();
|
|
1685
|
+
if (sole === void 0) {
|
|
1686
|
+
throw new TypeError(
|
|
1687
|
+
`money: field "${field}" is multi-currency \u2014 write { amount, currency }, not a bare amount`
|
|
1688
|
+
);
|
|
1689
|
+
}
|
|
1690
|
+
currency = sole;
|
|
1691
|
+
amount = raw;
|
|
1692
|
+
}
|
|
1693
|
+
const scale = desc.scaleFor(currency);
|
|
1694
|
+
return { amount: quantizeAmount(field, amount, scale, desc.rounding), currency };
|
|
1695
|
+
}
|
|
1696
|
+
function quantizeMoneyFields(record, moneyFields) {
|
|
1697
|
+
let out = { ...record };
|
|
1698
|
+
for (const [path, desc] of Object.entries(moneyFields)) {
|
|
1699
|
+
if (isSimpleMoneyPath(path)) {
|
|
1700
|
+
const raw = out[path];
|
|
1701
|
+
if (raw === null || raw === void 0) continue;
|
|
1702
|
+
out[path] = quantizeValue(path, raw, desc);
|
|
1703
|
+
continue;
|
|
1704
|
+
}
|
|
1705
|
+
out = transformAtMoneyPath(
|
|
1706
|
+
out,
|
|
1707
|
+
path,
|
|
1708
|
+
parseMoneyPath(path),
|
|
1709
|
+
0,
|
|
1710
|
+
(container, key) => {
|
|
1711
|
+
const raw = container[key];
|
|
1712
|
+
if (raw === null || raw === void 0) return;
|
|
1713
|
+
container[key] = quantizeValue(path, raw, desc);
|
|
1714
|
+
},
|
|
1715
|
+
/* lenient */
|
|
1716
|
+
false
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
return out;
|
|
1720
|
+
}
|
|
1721
|
+
function formatCurrency(decimal, currency, scale, locale) {
|
|
1722
|
+
const fmt = new Intl.NumberFormat(locale, {
|
|
1723
|
+
style: "currency",
|
|
1724
|
+
currency,
|
|
1725
|
+
minimumFractionDigits: scale,
|
|
1726
|
+
maximumFractionDigits: scale
|
|
1727
|
+
});
|
|
1728
|
+
return fmt.format(decimal);
|
|
1729
|
+
}
|
|
1730
|
+
function moneyScaledValue(stored, desc) {
|
|
1731
|
+
let raw;
|
|
1732
|
+
if (desc.mode === "fixed") {
|
|
1733
|
+
raw = stored;
|
|
1734
|
+
} else {
|
|
1735
|
+
if (!isMoneyValueObject(stored)) return null;
|
|
1736
|
+
raw = stored.amount;
|
|
1737
|
+
}
|
|
1738
|
+
if (typeof raw !== "string" && typeof raw !== "number") return null;
|
|
1739
|
+
try {
|
|
1740
|
+
return BigInt(String(raw));
|
|
1741
|
+
} catch {
|
|
1742
|
+
return null;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
function canonicalizeMoneyIndexKey(field, rawValue, moneyFields) {
|
|
1746
|
+
const desc = moneyFields[field];
|
|
1747
|
+
if (!desc || desc.mode !== "fixed") return void 0;
|
|
1748
|
+
return moneyScaledValue(rawValue, desc)?.toString();
|
|
1749
|
+
}
|
|
1750
|
+
function decodeValue(stored, desc) {
|
|
1751
|
+
let currency;
|
|
1752
|
+
let scaledIntString;
|
|
1753
|
+
if (desc.mode === "fixed") {
|
|
1754
|
+
if (typeof stored !== "string" && typeof stored !== "number") return null;
|
|
1755
|
+
currency = desc.fixedCurrency;
|
|
1756
|
+
scaledIntString = String(stored);
|
|
1757
|
+
} else {
|
|
1758
|
+
if (!isMoneyValueObject(stored)) return null;
|
|
1759
|
+
const amount = stored.amount;
|
|
1760
|
+
if (typeof stored.currency !== "string" || typeof amount !== "string" && typeof amount !== "number") return null;
|
|
1761
|
+
currency = stored.currency;
|
|
1762
|
+
scaledIntString = String(amount);
|
|
1763
|
+
}
|
|
1764
|
+
const scale = desc.scaleFor(currency);
|
|
1765
|
+
let decimal;
|
|
1766
|
+
try {
|
|
1767
|
+
decimal = formatScaledInt(BigInt(scaledIntString), scale);
|
|
1768
|
+
} catch {
|
|
1769
|
+
return null;
|
|
1770
|
+
}
|
|
1771
|
+
return {
|
|
1772
|
+
decoded: desc.mode === "fixed" ? decimal : { amount: decimal, currency },
|
|
1773
|
+
decimal,
|
|
1774
|
+
currency,
|
|
1775
|
+
scale
|
|
539
1776
|
};
|
|
540
1777
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
1778
|
+
function presentVirtualMoneyFields(record, moneyFields, virtualMoney, locale) {
|
|
1779
|
+
let out = record;
|
|
1780
|
+
const format = locale !== "raw";
|
|
1781
|
+
const fmtLocale = typeof locale === "string" && locale !== "raw" ? locale : "en-US";
|
|
1782
|
+
for (const field of virtualMoney) {
|
|
1783
|
+
const desc = moneyFields[field];
|
|
1784
|
+
if (!desc || desc.mode !== "fixed") continue;
|
|
1785
|
+
const raw = out[field];
|
|
1786
|
+
if (raw === null || raw === void 0) continue;
|
|
1787
|
+
if (typeof raw !== "number" && typeof raw !== "string") continue;
|
|
1788
|
+
const currency = desc.fixedCurrency;
|
|
1789
|
+
const scale = desc.scaleFor(currency);
|
|
1790
|
+
const r = parseToScaledInt(raw, scale, desc.rounding);
|
|
1791
|
+
if (!r.ok) continue;
|
|
1792
|
+
if (out === record) out = { ...record };
|
|
1793
|
+
const decimal = formatScaledInt(r.value, scale);
|
|
1794
|
+
out[field] = decimal;
|
|
1795
|
+
if (format) {
|
|
1796
|
+
out[`${field}Formatted`] = formatCurrency(decimal, currency, scale, fmtLocale);
|
|
1797
|
+
out[`${field}Number`] = Number(decimal);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
return out;
|
|
1801
|
+
}
|
|
1802
|
+
function decodeMoneyFields(record, moneyFields, locale) {
|
|
1803
|
+
let out = { ...record };
|
|
1804
|
+
const format = locale !== "raw";
|
|
1805
|
+
const fmtLocale = typeof locale === "string" && locale !== "raw" ? locale : "en-US";
|
|
1806
|
+
for (const [path, desc] of Object.entries(moneyFields)) {
|
|
1807
|
+
if (isSimpleMoneyPath(path)) {
|
|
1808
|
+
const stored = out[path];
|
|
1809
|
+
if (stored === null || stored === void 0) continue;
|
|
1810
|
+
const r = decodeValue(stored, desc);
|
|
1811
|
+
if (r === null) continue;
|
|
1812
|
+
out[path] = r.decoded;
|
|
1813
|
+
if (format) {
|
|
1814
|
+
out[`${path}Formatted`] = formatCurrency(r.decimal, r.currency, r.scale, fmtLocale);
|
|
1815
|
+
out[`${path}Number`] = Number(r.decimal);
|
|
551
1816
|
}
|
|
552
|
-
|
|
1817
|
+
continue;
|
|
553
1818
|
}
|
|
554
|
-
|
|
1819
|
+
out = transformAtMoneyPath(
|
|
1820
|
+
out,
|
|
1821
|
+
path,
|
|
1822
|
+
parseMoneyPath(path),
|
|
1823
|
+
0,
|
|
1824
|
+
(container, key) => {
|
|
1825
|
+
const stored = container[key];
|
|
1826
|
+
if (stored === null || stored === void 0) return;
|
|
1827
|
+
const r = decodeValue(stored, desc);
|
|
1828
|
+
if (r === null) return;
|
|
1829
|
+
container[key] = r.decoded;
|
|
1830
|
+
if (format && typeof key === "string" && !Array.isArray(container)) {
|
|
1831
|
+
container[`${key}Formatted`] = formatCurrency(r.decimal, r.currency, r.scale, fmtLocale);
|
|
1832
|
+
container[`${key}Number`] = Number(r.decimal);
|
|
1833
|
+
}
|
|
1834
|
+
},
|
|
1835
|
+
/* lenient */
|
|
1836
|
+
true
|
|
1837
|
+
);
|
|
555
1838
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
1839
|
+
return out;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
// src/via/money/where.ts
|
|
1843
|
+
function isMoneyValueObject2(v) {
|
|
1844
|
+
return typeof v === "object" && v !== null && "currency" in v;
|
|
1845
|
+
}
|
|
1846
|
+
function parseOperand(field, raw, desc) {
|
|
1847
|
+
let amount;
|
|
1848
|
+
let currency;
|
|
1849
|
+
if (desc.mode === "fixed") {
|
|
1850
|
+
currency = desc.fixedCurrency;
|
|
1851
|
+
amount = raw;
|
|
1852
|
+
} else if (isMoneyValueObject2(raw)) {
|
|
1853
|
+
currency = String(raw.currency);
|
|
1854
|
+
amount = raw.amount;
|
|
1855
|
+
} else {
|
|
1856
|
+
const sole = desc.soleCurrency();
|
|
1857
|
+
if (sole === void 0) {
|
|
1858
|
+
throw new MoneyUnsupportedError(
|
|
1859
|
+
`where("${field}"): field is multi-currency \u2014 compare against { amount, currency }, not a bare amount`
|
|
563
1860
|
);
|
|
564
1861
|
}
|
|
565
|
-
|
|
1862
|
+
currency = sole;
|
|
1863
|
+
amount = raw;
|
|
1864
|
+
}
|
|
1865
|
+
if (typeof amount !== "number" && typeof amount !== "string") {
|
|
1866
|
+
throw new MoneyUnsupportedError(
|
|
1867
|
+
`where("${field}"): operand ${JSON.stringify(raw)} is not a money amount`
|
|
1868
|
+
);
|
|
1869
|
+
}
|
|
1870
|
+
const r = parseToScaledInt(amount, desc.scaleFor(currency), desc.rounding);
|
|
1871
|
+
if (!r.ok) {
|
|
1872
|
+
throw new MoneyUnsupportedError(
|
|
1873
|
+
`where("${field}"): operand ${JSON.stringify(amount)} is not a finite decimal`
|
|
1874
|
+
);
|
|
1875
|
+
}
|
|
1876
|
+
return { scaled: r.value.toString(), currency };
|
|
1877
|
+
}
|
|
1878
|
+
function moneyFieldClause(field, op, value, desc) {
|
|
1879
|
+
switch (op) {
|
|
1880
|
+
case "==":
|
|
1881
|
+
case "!=":
|
|
1882
|
+
case "<":
|
|
1883
|
+
case "<=":
|
|
1884
|
+
case ">":
|
|
1885
|
+
case ">=": {
|
|
1886
|
+
const e = parseOperand(field, value, desc);
|
|
1887
|
+
return { mode: desc.mode, entries: [e] };
|
|
1888
|
+
}
|
|
1889
|
+
case "between": {
|
|
1890
|
+
if (!Array.isArray(value) || value.length !== 2) {
|
|
1891
|
+
throw new MoneyUnsupportedError(`where("${field}"): 'between' needs a [lo, hi] tuple`);
|
|
1892
|
+
}
|
|
1893
|
+
const lo = parseOperand(field, value[0], desc);
|
|
1894
|
+
const hi = parseOperand(field, value[1], desc);
|
|
1895
|
+
if (lo.currency !== hi.currency) {
|
|
1896
|
+
throw new MoneyUnsupportedError(
|
|
1897
|
+
`where("${field}"): 'between' bounds mix currencies (${lo.currency} vs ${hi.currency})`
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
return { mode: desc.mode, entries: [lo, hi] };
|
|
1901
|
+
}
|
|
1902
|
+
case "in": {
|
|
1903
|
+
if (!Array.isArray(value)) {
|
|
1904
|
+
throw new MoneyUnsupportedError(`where("${field}"): 'in' needs an array of amounts`);
|
|
1905
|
+
}
|
|
1906
|
+
return { mode: desc.mode, entries: value.map((v) => parseOperand(field, v, desc)) };
|
|
1907
|
+
}
|
|
1908
|
+
default:
|
|
1909
|
+
throw new MoneyUnsupportedError(
|
|
1910
|
+
`where("${field}"): operator '${op}' is not supported on a money field`
|
|
1911
|
+
);
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
function moneyIndexProbe(op, payload) {
|
|
1915
|
+
if (payload.mode !== "fixed") return void 0;
|
|
1916
|
+
if (op === "==") return payload.entries[0]?.scaled;
|
|
1917
|
+
if (op === "in") return payload.entries.map((e) => e.scaled);
|
|
1918
|
+
return void 0;
|
|
1919
|
+
}
|
|
1920
|
+
function readStored(actual, operand) {
|
|
1921
|
+
let amount;
|
|
1922
|
+
let currency;
|
|
1923
|
+
if (operand.mode === "fixed") {
|
|
1924
|
+
if (typeof actual !== "string" && typeof actual !== "number") return null;
|
|
1925
|
+
amount = actual;
|
|
1926
|
+
currency = operand.entries[0]?.currency ?? "";
|
|
1927
|
+
} else {
|
|
1928
|
+
if (!isMoneyValueObject2(actual)) return null;
|
|
1929
|
+
if (typeof actual.currency !== "string") return null;
|
|
1930
|
+
amount = actual.amount;
|
|
1931
|
+
currency = actual.currency;
|
|
1932
|
+
}
|
|
1933
|
+
if (typeof amount !== "string" && typeof amount !== "number") return null;
|
|
1934
|
+
try {
|
|
1935
|
+
return { scaled: BigInt(amount).toString(), currency };
|
|
1936
|
+
} catch {
|
|
1937
|
+
return null;
|
|
566
1938
|
}
|
|
567
|
-
return collectionsFromObject(candidate, idKey, filter);
|
|
568
1939
|
}
|
|
569
|
-
function
|
|
570
|
-
const
|
|
571
|
-
if (
|
|
572
|
-
|
|
1940
|
+
function evaluateMoneyClause(actual, op, operand) {
|
|
1941
|
+
const stored = readStored(actual, operand);
|
|
1942
|
+
if (stored === null) return op === "!=";
|
|
1943
|
+
const a = BigInt(stored.scaled);
|
|
1944
|
+
if (op === "in") {
|
|
1945
|
+
return operand.entries.some(
|
|
1946
|
+
(e2) => e2.currency === stored.currency && BigInt(e2.scaled) === a
|
|
1947
|
+
);
|
|
573
1948
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if (
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
1949
|
+
if (op === "between") {
|
|
1950
|
+
const [lo, hi] = operand.entries;
|
|
1951
|
+
if (!lo || !hi || lo.currency !== stored.currency) return false;
|
|
1952
|
+
return a >= BigInt(lo.scaled) && a <= BigInt(hi.scaled);
|
|
1953
|
+
}
|
|
1954
|
+
const e = operand.entries[0];
|
|
1955
|
+
if (!e) return false;
|
|
1956
|
+
if (e.currency !== stored.currency) return op === "!=";
|
|
1957
|
+
const b = BigInt(e.scaled);
|
|
1958
|
+
switch (op) {
|
|
1959
|
+
case "==":
|
|
1960
|
+
return a === b;
|
|
1961
|
+
case "!=":
|
|
1962
|
+
return a !== b;
|
|
1963
|
+
case "<":
|
|
1964
|
+
return a < b;
|
|
1965
|
+
case "<=":
|
|
1966
|
+
return a <= b;
|
|
1967
|
+
case ">":
|
|
1968
|
+
return a > b;
|
|
1969
|
+
case ">=":
|
|
1970
|
+
return a >= b;
|
|
1971
|
+
default:
|
|
1972
|
+
return false;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
// src/via/money/money-reducer.ts
|
|
1977
|
+
function toScaledIntFromAny(v, scale) {
|
|
1978
|
+
if (typeof v === "bigint") return v;
|
|
1979
|
+
if (typeof v === "number") {
|
|
1980
|
+
const r = parseToScaledInt(v, scale);
|
|
1981
|
+
return r.ok ? r.value : null;
|
|
1982
|
+
}
|
|
1983
|
+
if (typeof v === "string") {
|
|
1984
|
+
if (!v.includes(".")) {
|
|
1985
|
+
try {
|
|
1986
|
+
return BigInt(v);
|
|
1987
|
+
} catch {
|
|
1988
|
+
return null;
|
|
1989
|
+
}
|
|
584
1990
|
}
|
|
585
|
-
|
|
1991
|
+
const r = parseToScaledInt(v, scale);
|
|
1992
|
+
return r.ok ? r.value : null;
|
|
1993
|
+
}
|
|
1994
|
+
return null;
|
|
1995
|
+
}
|
|
1996
|
+
function readMoney(record, field, desc) {
|
|
1997
|
+
const raw = readPath(record, field);
|
|
1998
|
+
if (raw === null || raw === void 0) return null;
|
|
1999
|
+
if (desc.mode === "fixed") {
|
|
2000
|
+
const cur = desc.fixedCurrency;
|
|
2001
|
+
const value2 = toScaledIntFromAny(raw, desc.scaleFor(cur));
|
|
2002
|
+
return value2 === null ? null : { currency: cur, value: value2 };
|
|
586
2003
|
}
|
|
2004
|
+
if (typeof raw !== "object") return null;
|
|
2005
|
+
const o = raw;
|
|
2006
|
+
if (typeof o.currency !== "string") return null;
|
|
2007
|
+
const scale = desc.allows(o.currency) ? desc.scaleFor(o.currency) : 0;
|
|
2008
|
+
const value = toScaledIntFromAny(o.amount, scale);
|
|
2009
|
+
return value === null ? null : { currency: o.currency, value };
|
|
2010
|
+
}
|
|
2011
|
+
function targetScaleFor(desc, currency) {
|
|
2012
|
+
if (desc.allows(currency)) return desc.scaleFor(currency);
|
|
2013
|
+
const s = scaleForCurrency(currency);
|
|
2014
|
+
if (s === null) {
|
|
2015
|
+
throw new Error(`money: cannot determine scale for conversion target "${currency}"`);
|
|
2016
|
+
}
|
|
2017
|
+
return s;
|
|
2018
|
+
}
|
|
2019
|
+
function parseRate(rate) {
|
|
2020
|
+
const s = String(rate).trim();
|
|
2021
|
+
const neg = s.startsWith("-");
|
|
2022
|
+
const body = neg ? s.slice(1) : s;
|
|
2023
|
+
const dot = body.indexOf(".");
|
|
2024
|
+
const intPart = dot === -1 ? body : body.slice(0, dot);
|
|
2025
|
+
const fracPart = dot === -1 ? "" : body.slice(dot + 1);
|
|
2026
|
+
const int = BigInt((intPart === "" ? "0" : intPart) + fracPart);
|
|
2027
|
+
return { int: neg ? -int : int, scale: fracPart.length };
|
|
2028
|
+
}
|
|
2029
|
+
function divRoundHalfEven(n, d) {
|
|
2030
|
+
const q = n / d;
|
|
2031
|
+
const r = n % d;
|
|
2032
|
+
const twiceR = (r < 0n ? -r : r) * 2n;
|
|
2033
|
+
if (twiceR < d) return q;
|
|
2034
|
+
if (twiceR > d) return q + (n < 0n ? -1n : 1n);
|
|
2035
|
+
return q % 2n === 0n ? q : q + (n < 0n ? -1n : 1n);
|
|
2036
|
+
}
|
|
2037
|
+
function convertScaled(value, srcScale, rate, targetScale) {
|
|
2038
|
+
const { int: rateInt, scale: rateScale } = parseRate(rate);
|
|
2039
|
+
const product = value * rateInt;
|
|
2040
|
+
const curScale = srcScale + rateScale;
|
|
2041
|
+
if (curScale === targetScale) return product;
|
|
2042
|
+
if (curScale < targetScale) return product * 10n ** BigInt(targetScale - curScale);
|
|
2043
|
+
return divRoundHalfEven(product, 10n ** BigInt(curScale - targetScale));
|
|
2044
|
+
}
|
|
2045
|
+
function finalizeSum(state, desc, convertTo, fx) {
|
|
2046
|
+
if (convertTo !== void 0) {
|
|
2047
|
+
if (fx === void 0) {
|
|
2048
|
+
throw new Error(`money: sum convertTo "${convertTo}" requires an fx rate map`);
|
|
2049
|
+
}
|
|
2050
|
+
const targetScale = targetScaleFor(desc, convertTo);
|
|
2051
|
+
let total = 0n;
|
|
2052
|
+
for (const [cur, v] of state) {
|
|
2053
|
+
if (cur === convertTo) {
|
|
2054
|
+
total += convertScaled(v, desc.scaleFor(cur), 1, targetScale);
|
|
2055
|
+
continue;
|
|
2056
|
+
}
|
|
2057
|
+
const rate = fx[`${cur}->${convertTo}`];
|
|
2058
|
+
if (rate === void 0) {
|
|
2059
|
+
throw new Error(`money: no fx rate for "${cur}->${convertTo}"`);
|
|
2060
|
+
}
|
|
2061
|
+
total += convertScaled(v, desc.scaleFor(cur), rate, targetScale);
|
|
2062
|
+
}
|
|
2063
|
+
return formatScaledInt(total, targetScale);
|
|
2064
|
+
}
|
|
2065
|
+
if (desc.mode === "fixed") {
|
|
2066
|
+
const cur = desc.fixedCurrency;
|
|
2067
|
+
return formatScaledInt(state.get(cur) ?? 0n, desc.scaleFor(cur));
|
|
2068
|
+
}
|
|
2069
|
+
const out = {};
|
|
2070
|
+
for (const [cur, v] of state) out[cur] = formatScaledInt(v, desc.scaleFor(cur));
|
|
587
2071
|
return out;
|
|
588
2072
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
return
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
2073
|
+
function moneySumReducer(field, desc, convertTo, fx) {
|
|
2074
|
+
return {
|
|
2075
|
+
op: "sum",
|
|
2076
|
+
field,
|
|
2077
|
+
init: () => /* @__PURE__ */ new Map(),
|
|
2078
|
+
step: (state, record) => {
|
|
2079
|
+
const m = readMoney(record, field, desc);
|
|
2080
|
+
if (m) state.set(m.currency, (state.get(m.currency) ?? 0n) + m.value);
|
|
2081
|
+
return state;
|
|
2082
|
+
},
|
|
2083
|
+
remove: (state, record) => {
|
|
2084
|
+
const m = readMoney(record, field, desc);
|
|
2085
|
+
if (m) state.set(m.currency, (state.get(m.currency) ?? 0n) - m.value);
|
|
2086
|
+
return state;
|
|
2087
|
+
},
|
|
2088
|
+
finalize: (state) => finalizeSum(state, desc, convertTo, fx)
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
function extremum(values, op) {
|
|
2092
|
+
let out = values[0];
|
|
2093
|
+
for (let i = 1; i < values.length; i++) {
|
|
2094
|
+
const v = values[i];
|
|
2095
|
+
if (op === "min" ? v < out : v > out) out = v;
|
|
2096
|
+
}
|
|
2097
|
+
return out;
|
|
2098
|
+
}
|
|
2099
|
+
function moneyMinMaxReducer(op, field, desc) {
|
|
2100
|
+
return {
|
|
2101
|
+
op,
|
|
2102
|
+
field,
|
|
2103
|
+
init: () => /* @__PURE__ */ new Map(),
|
|
2104
|
+
step: (state, record) => {
|
|
2105
|
+
const m = readMoney(record, field, desc);
|
|
2106
|
+
if (m) {
|
|
2107
|
+
const arr = state.get(m.currency);
|
|
2108
|
+
if (arr) arr.push(m.value);
|
|
2109
|
+
else state.set(m.currency, [m.value]);
|
|
2110
|
+
}
|
|
2111
|
+
return state;
|
|
2112
|
+
},
|
|
2113
|
+
remove: (state, record) => {
|
|
2114
|
+
const m = readMoney(record, field, desc);
|
|
2115
|
+
if (m) {
|
|
2116
|
+
const arr = state.get(m.currency);
|
|
2117
|
+
if (arr) {
|
|
2118
|
+
const idx = arr.indexOf(m.value);
|
|
2119
|
+
if (idx >= 0) arr.splice(idx, 1);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
return state;
|
|
2123
|
+
},
|
|
2124
|
+
finalize: (state) => {
|
|
2125
|
+
if (desc.mode === "fixed") {
|
|
2126
|
+
const cur = desc.fixedCurrency;
|
|
2127
|
+
const arr = state.get(cur);
|
|
2128
|
+
if (!arr || arr.length === 0) return null;
|
|
2129
|
+
return formatScaledInt(extremum(arr, op), desc.scaleFor(cur));
|
|
2130
|
+
}
|
|
2131
|
+
const out = {};
|
|
2132
|
+
for (const [cur, arr] of state) {
|
|
2133
|
+
if (arr.length > 0) out[cur] = formatScaledInt(extremum(arr, op), desc.scaleFor(cur));
|
|
2134
|
+
}
|
|
2135
|
+
return out;
|
|
2136
|
+
}
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
function wrapMoneyReducers(spec, moneyFields) {
|
|
2140
|
+
let changed = false;
|
|
2141
|
+
const out = {};
|
|
2142
|
+
for (const [key, reducer] of Object.entries(spec)) {
|
|
2143
|
+
const field = reducer.field;
|
|
2144
|
+
const desc = field ? moneyFields[field] : void 0;
|
|
2145
|
+
if (desc && reducer.op === "avg") {
|
|
2146
|
+
throw new MoneyUnsupportedError(
|
|
2147
|
+
field,
|
|
2148
|
+
`avg() is not supported on money field "${field}" in v1 \u2014 use sum() and count() and divide at the boundary.`
|
|
2149
|
+
);
|
|
2150
|
+
}
|
|
2151
|
+
if (desc && (reducer.op === "sum" || reducer.op === "min" || reducer.op === "max")) {
|
|
2152
|
+
changed = true;
|
|
2153
|
+
out[key] = reducer.op === "sum" ? moneySumReducer(field, desc, reducer.convertTo, reducer.fx) : moneyMinMaxReducer(reducer.op, field, desc);
|
|
2154
|
+
} else {
|
|
2155
|
+
out[key] = reducer;
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
return changed ? out : spec;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
// src/via/money/binding.ts
|
|
2162
|
+
function moneyBinding(moneyFields, virtualMoneyFields) {
|
|
2163
|
+
validateMoneyFieldPaths(moneyFields);
|
|
2164
|
+
const hasVirtualMoney = virtualMoneyFields !== void 0 && virtualMoneyFields.size > 0;
|
|
2165
|
+
const ordinaryPresentFields = hasVirtualMoney ? Object.fromEntries(Object.entries(moneyFields).filter(([f]) => !virtualMoneyFields.has(f))) : moneyFields;
|
|
2166
|
+
return {
|
|
2167
|
+
brand: "money",
|
|
2168
|
+
posture: { encryptedAtRest: "envelope", queryable: "ordered", exportable: true, forgettable: true },
|
|
2169
|
+
covers: (field) => field in moneyFields,
|
|
2170
|
+
ingest: (r) => canonicalizeIncomingMoney(r, moneyFields),
|
|
2171
|
+
canonicalizeStored: (r) => canonicalizeStoredMoney(r, moneyFields),
|
|
2172
|
+
encodeWrite: (r) => quantizeMoneyFields(r, moneyFields),
|
|
2173
|
+
present: (r, ctx) => decodeMoneyFields(r, ordinaryPresentFields, typeof ctx.locale === "string" ? ctx.locale : void 0),
|
|
2174
|
+
...hasVirtualMoney ? {
|
|
2175
|
+
presentLate: (r, ctx) => presentVirtualMoneyFields(r, moneyFields, virtualMoneyFields, typeof ctx.locale === "string" ? ctx.locale : void 0)
|
|
2176
|
+
} : {},
|
|
2177
|
+
buildClause: (field, op, value) => {
|
|
2178
|
+
const desc = moneyFields[field];
|
|
2179
|
+
if (!desc) return void 0;
|
|
2180
|
+
return moneyFieldClause(field, op, value, desc);
|
|
2181
|
+
},
|
|
2182
|
+
evaluateClause: (actual, op, payload) => evaluateMoneyClause(actual, op, payload),
|
|
2183
|
+
indexProbe: (op, payload) => moneyIndexProbe(op, payload),
|
|
2184
|
+
canonicalizeIndexKey: (field, rawValue) => canonicalizeMoneyIndexKey(field, rawValue, moneyFields),
|
|
2185
|
+
decodeResults: (r) => decodeMoneyFields(r, moneyFields, "raw"),
|
|
2186
|
+
compareForOrder: (field, a, b) => {
|
|
2187
|
+
const desc = moneyFields[field];
|
|
2188
|
+
if (!desc) return void 0;
|
|
2189
|
+
const av = moneyScaledValue(a, desc);
|
|
2190
|
+
const bv = moneyScaledValue(b, desc);
|
|
2191
|
+
if (av === null) return bv === null ? 0 : 1;
|
|
2192
|
+
if (bv === null) return -1;
|
|
2193
|
+
return av < bv ? -1 : av > bv ? 1 : 0;
|
|
2194
|
+
},
|
|
2195
|
+
wrapReducers: (spec) => wrapMoneyReducers(spec, moneyFields)
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
function linkMoneyVia() {
|
|
2199
|
+
installViaBinder("money", (cfg) => {
|
|
2200
|
+
const c = cfg;
|
|
2201
|
+
return moneyBinding(c.moneyFields, c.virtualMoneyFields);
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
// src/via/money/descriptor.ts
|
|
2206
|
+
var MoneyPrecisionError = class extends NoydbError {
|
|
2207
|
+
constructor(field, value, scale) {
|
|
2208
|
+
super(
|
|
2209
|
+
"MONEY_PRECISION",
|
|
2210
|
+
`money: value ${JSON.stringify(value)} for field "${field}" exceeds scale ${scale} and no rounding mode is configured`
|
|
2211
|
+
);
|
|
2212
|
+
this.field = field;
|
|
2213
|
+
this.value = value;
|
|
2214
|
+
this.scale = scale;
|
|
2215
|
+
this.name = "MoneyPrecisionError";
|
|
2216
|
+
}
|
|
2217
|
+
field;
|
|
2218
|
+
value;
|
|
2219
|
+
scale;
|
|
2220
|
+
};
|
|
2221
|
+
var MoneyCurrencyError = class extends NoydbError {
|
|
2222
|
+
constructor(currency, reason, field) {
|
|
2223
|
+
super(
|
|
2224
|
+
"MONEY_CURRENCY",
|
|
2225
|
+
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`
|
|
2226
|
+
);
|
|
2227
|
+
this.currency = currency;
|
|
2228
|
+
this.reason = reason;
|
|
2229
|
+
this.field = field;
|
|
2230
|
+
this.name = "MoneyCurrencyError";
|
|
2231
|
+
}
|
|
2232
|
+
currency;
|
|
2233
|
+
reason;
|
|
2234
|
+
field;
|
|
2235
|
+
};
|
|
2236
|
+
var MoneyUnsupportedError = class extends NoydbError {
|
|
2237
|
+
constructor(field, message) {
|
|
2238
|
+
super(
|
|
2239
|
+
"MONEY_UNSUPPORTED",
|
|
2240
|
+
message ?? `money: operation is not supported on field "${field}" \u2014 use sum() and count() and divide at the boundary`
|
|
2241
|
+
);
|
|
2242
|
+
this.field = field;
|
|
2243
|
+
this.name = "MoneyUnsupportedError";
|
|
2244
|
+
}
|
|
2245
|
+
field;
|
|
2246
|
+
};
|
|
2247
|
+
function isMultiOptions(o) {
|
|
2248
|
+
return "currencies" in o;
|
|
2249
|
+
}
|
|
2250
|
+
function money(options) {
|
|
2251
|
+
linkMoneyVia();
|
|
2252
|
+
const hasFixed = "currency" in options;
|
|
2253
|
+
const hasMulti = "currencies" in options;
|
|
2254
|
+
if (hasFixed && hasMulti) {
|
|
2255
|
+
throw new TypeError("money: `currency` and `currencies` are mutually exclusive");
|
|
2256
|
+
}
|
|
2257
|
+
if (!hasFixed && !hasMulti) {
|
|
2258
|
+
throw new TypeError("money: one of `currency` or `currencies` is required");
|
|
2259
|
+
}
|
|
2260
|
+
const rounding = options.rounding;
|
|
2261
|
+
if (isMultiOptions(options)) {
|
|
2262
|
+
const overrides = options.scaleOverrides ?? {};
|
|
2263
|
+
const allowList = options.currencies;
|
|
2264
|
+
const allows = (c) => allowList === "any" ? true : allowList.includes(c);
|
|
2265
|
+
const scaleFor = (c) => {
|
|
2266
|
+
if (!allows(c)) throw new MoneyCurrencyError(c, "not-allowed");
|
|
2267
|
+
const s = overrides[c] ?? scaleForCurrency(c);
|
|
2268
|
+
if (s === null || s === void 0) throw new MoneyCurrencyError(c, "unknown-scale");
|
|
2269
|
+
return s;
|
|
2270
|
+
};
|
|
2271
|
+
if (allowList !== "any") for (const c of allowList) scaleFor(c);
|
|
2272
|
+
const soleCurrency = () => allowList !== "any" && allowList.length === 1 ? allowList[0] : void 0;
|
|
2273
|
+
return {
|
|
2274
|
+
_noydbMoney: true,
|
|
2275
|
+
_viaBrand: "money",
|
|
2276
|
+
mode: "multi",
|
|
2277
|
+
options,
|
|
2278
|
+
rounding,
|
|
2279
|
+
fixedCurrency: void 0,
|
|
2280
|
+
scaleFor,
|
|
2281
|
+
allows,
|
|
2282
|
+
soleCurrency
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
const currency = options.currency;
|
|
2286
|
+
const resolvedScale = options.scale ?? scaleForCurrency(currency);
|
|
2287
|
+
if (resolvedScale === null || resolvedScale === void 0) {
|
|
2288
|
+
throw new MoneyCurrencyError(currency, "unknown-scale");
|
|
2289
|
+
}
|
|
2290
|
+
return {
|
|
2291
|
+
_noydbMoney: true,
|
|
2292
|
+
_viaBrand: "money",
|
|
2293
|
+
mode: "fixed",
|
|
2294
|
+
options,
|
|
2295
|
+
rounding,
|
|
2296
|
+
fixedCurrency: currency,
|
|
2297
|
+
scaleFor(c) {
|
|
2298
|
+
if (c !== currency) throw new MoneyCurrencyError(c, "not-allowed");
|
|
2299
|
+
return resolvedScale;
|
|
2300
|
+
},
|
|
2301
|
+
allows: (c) => c === currency,
|
|
2302
|
+
soleCurrency: () => currency
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
function isMoneyDescriptor(x) {
|
|
2306
|
+
return typeof x === "object" && x !== null && x._noydbMoney === true;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
// src/via/money/arith.ts
|
|
2310
|
+
function parseAmount(label, amount, scale, rounding) {
|
|
2311
|
+
const r = parseToScaledInt(amount, scale, rounding);
|
|
2312
|
+
if (!r.ok) {
|
|
2313
|
+
throw new MoneyUnsupportedError(
|
|
2314
|
+
r.reason === "precision" ? `${label}: amount ${JSON.stringify(amount)} has more precision than scale ${scale} and no rounding mode is configured` : `${label}: amount ${JSON.stringify(amount)} is not a finite decimal`
|
|
2315
|
+
);
|
|
2316
|
+
}
|
|
2317
|
+
return r.value;
|
|
2318
|
+
}
|
|
2319
|
+
function resolveScale(label, amount, explicit) {
|
|
2320
|
+
if (explicit !== void 0) {
|
|
2321
|
+
if (!Number.isInteger(explicit) || explicit < 0) {
|
|
2322
|
+
throw new MoneyUnsupportedError(`${label}: scale must be a non-negative integer`);
|
|
2323
|
+
}
|
|
2324
|
+
return explicit;
|
|
2325
|
+
}
|
|
2326
|
+
const inferred = decimalScaleOf(amount);
|
|
2327
|
+
if (inferred === null) {
|
|
2328
|
+
throw new MoneyUnsupportedError(`${label}: amount ${JSON.stringify(amount)} is not a finite decimal`);
|
|
2329
|
+
}
|
|
2330
|
+
return inferred;
|
|
2331
|
+
}
|
|
2332
|
+
function mulRate(amount, rate, opts = {}) {
|
|
2333
|
+
const scale = resolveScale("mulRate", amount, opts.scale);
|
|
2334
|
+
const rounding = opts.rounding ?? "half-up";
|
|
2335
|
+
const a = parseAmount("mulRate", amount, scale, rounding);
|
|
2336
|
+
const rateScale = decimalScaleOf(rate);
|
|
2337
|
+
if (rateScale === null) {
|
|
2338
|
+
throw new MoneyUnsupportedError(`mulRate: rate ${JSON.stringify(rate)} is not a finite decimal`);
|
|
2339
|
+
}
|
|
2340
|
+
const r = parseToScaledInt(rate, rateScale);
|
|
2341
|
+
if (!r.ok) {
|
|
2342
|
+
throw new MoneyUnsupportedError(`mulRate: rate ${JSON.stringify(rate)} is not a finite decimal`);
|
|
2343
|
+
}
|
|
2344
|
+
const product = a * r.value;
|
|
2345
|
+
return formatScaledInt(rescaleScaledInt(product, scale + rateScale, scale, rounding), scale);
|
|
2346
|
+
}
|
|
2347
|
+
function allocate(amount, weights, opts = {}) {
|
|
2348
|
+
if (weights.length === 0) {
|
|
2349
|
+
throw new MoneyUnsupportedError("allocate: weights must not be empty");
|
|
2350
|
+
}
|
|
2351
|
+
const scale = resolveScale("allocate", amount, opts.scale);
|
|
2352
|
+
const a = parseAmount("allocate", amount, scale);
|
|
2353
|
+
let weightScale = 0;
|
|
2354
|
+
for (const w of weights) {
|
|
2355
|
+
const s = decimalScaleOf(w);
|
|
2356
|
+
if (s === null) {
|
|
2357
|
+
throw new MoneyUnsupportedError(`allocate: weight ${JSON.stringify(w)} is not a finite decimal`);
|
|
2358
|
+
}
|
|
2359
|
+
if (s > weightScale) weightScale = s;
|
|
2360
|
+
}
|
|
2361
|
+
const scaledWeights = weights.map((w) => {
|
|
2362
|
+
const r = parseToScaledInt(w, weightScale);
|
|
2363
|
+
if (!r.ok || r.value < 0n) {
|
|
2364
|
+
throw new MoneyUnsupportedError(`allocate: weight ${JSON.stringify(w)} must be a non-negative decimal`);
|
|
2365
|
+
}
|
|
2366
|
+
return r.value;
|
|
2367
|
+
});
|
|
2368
|
+
const sumW = scaledWeights.reduce((acc, w) => acc + w, 0n);
|
|
2369
|
+
if (sumW === 0n) {
|
|
2370
|
+
throw new MoneyUnsupportedError("allocate: weights must not all be zero");
|
|
2371
|
+
}
|
|
2372
|
+
const negative = a < 0n;
|
|
2373
|
+
const mag = negative ? -a : a;
|
|
2374
|
+
const base = [];
|
|
2375
|
+
const remainders = [];
|
|
2376
|
+
let distributed = 0n;
|
|
2377
|
+
for (let i = 0; i < scaledWeights.length; i++) {
|
|
2378
|
+
const product = mag * scaledWeights[i];
|
|
2379
|
+
const share = product / sumW;
|
|
2380
|
+
base.push(share);
|
|
2381
|
+
distributed += share;
|
|
2382
|
+
remainders.push({ index: i, rem: product % sumW });
|
|
2383
|
+
}
|
|
2384
|
+
let leftover = mag - distributed;
|
|
2385
|
+
remainders.sort((x, y) => y.rem > x.rem ? 1 : y.rem < x.rem ? -1 : x.index - y.index);
|
|
2386
|
+
for (const { index } of remainders) {
|
|
2387
|
+
if (leftover === 0n) break;
|
|
2388
|
+
base[index] = base[index] + 1n;
|
|
2389
|
+
leftover -= 1n;
|
|
2390
|
+
}
|
|
2391
|
+
return base.map((p) => formatScaledInt(negative && p !== 0n ? -p : p, scale));
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
// src/via/money/branded.ts
|
|
2395
|
+
function asMoney(value) {
|
|
2396
|
+
if (!isMoneyLike(value)) {
|
|
2397
|
+
throw new MoneyUnsupportedError(`asMoney: ${JSON.stringify(value)} is not a finite decimal`);
|
|
2398
|
+
}
|
|
2399
|
+
return String(value).trim();
|
|
2400
|
+
}
|
|
2401
|
+
function isMoneyString(value) {
|
|
2402
|
+
return typeof value === "string" && isMoneyLike(value);
|
|
2403
|
+
}
|
|
2404
|
+
function moneyNumber(value) {
|
|
2405
|
+
if (!isMoneyLike(value)) {
|
|
2406
|
+
throw new MoneyUnsupportedError(`moneyNumber: ${JSON.stringify(value)} is not a finite decimal`);
|
|
2407
|
+
}
|
|
2408
|
+
return Number(value);
|
|
2409
|
+
}
|
|
2410
|
+
function isMoneyLike(value) {
|
|
2411
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
2412
|
+
if (typeof value !== "string") return false;
|
|
2413
|
+
return decimalScaleOf(value) !== null;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
// src/via/computed/descriptor.ts
|
|
2417
|
+
function computed(fn, opts) {
|
|
2418
|
+
return {
|
|
2419
|
+
_viaBrand: "computed",
|
|
2420
|
+
fn,
|
|
2421
|
+
...opts?.deps !== void 0 ? { deps: opts.deps } : {},
|
|
2422
|
+
mode: opts?.mode ?? "materialized"
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
function isComputedDescriptor(x) {
|
|
2426
|
+
return typeof x === "object" && x !== null && x._viaBrand === "computed";
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
// src/via/lookup/binding.ts
|
|
2430
|
+
function hasLabelSource(desc) {
|
|
2431
|
+
return !(desc.backing === "static" && desc.table === void 0);
|
|
2432
|
+
}
|
|
2433
|
+
async function fetchLookupLabel(desc, key, effLocale, fieldFallback, cfg) {
|
|
2434
|
+
if (desc.backing === "collection") {
|
|
2435
|
+
const getRow = cfg.getLookupBacking?.(desc);
|
|
2436
|
+
const row = getRow ? await getRow(key) : void 0;
|
|
2437
|
+
const labelField = desc.present?.label;
|
|
2438
|
+
if (!row || labelField === void 0) return void 0;
|
|
2439
|
+
const raw = row[labelField];
|
|
2440
|
+
if (desc.present?.by !== void 0) {
|
|
2441
|
+
return raw && typeof raw === "object" ? raw[effLocale] : void 0;
|
|
2442
|
+
}
|
|
2443
|
+
return typeof raw === "string" ? raw : void 0;
|
|
2444
|
+
}
|
|
2445
|
+
return cfg.lookupLabelResolver?.(desc.dimension, key, effLocale, fieldFallback);
|
|
2446
|
+
}
|
|
2447
|
+
async function runLookupPresent(record, ctx, cfg) {
|
|
2448
|
+
const fields = Object.entries(cfg.lookupFields).filter(([, d]) => hasLabelSource(d));
|
|
2449
|
+
if (fields.length === 0) return record;
|
|
2450
|
+
const locale = typeof ctx.locale === "string" ? ctx.locale : void 0;
|
|
2451
|
+
const fallback = ctx.fallback;
|
|
2452
|
+
const layer = ctx.layer;
|
|
2453
|
+
if (locale === "raw") return record;
|
|
2454
|
+
const hasStaticDisplay = fields.some(([, d]) => d.backing === "static" && d.displayLocale !== void 0);
|
|
2455
|
+
if (!locale && !hasStaticDisplay) return record;
|
|
2456
|
+
let result = record;
|
|
2457
|
+
const withLabels = { ...result };
|
|
2458
|
+
for (const [field, desc] of fields) {
|
|
2459
|
+
const policy = desc.onMissing ? resolvePolicy(desc.onMissing, layer) : "null";
|
|
2460
|
+
const fieldFallback = policy === "substitute" ? fallback ?? desc.substitute : fallback;
|
|
2461
|
+
const effLocale = locale ?? (desc.backing === "static" ? desc.displayLocale : void 0);
|
|
2462
|
+
const resolveKey = async (key) => {
|
|
2463
|
+
if (!effLocale) {
|
|
2464
|
+
if (policy === "throw") {
|
|
2465
|
+
throw new LocaleNotSpecifiedError(field, `lookup "${field}": no locale active to resolve key "${key}".`);
|
|
2466
|
+
}
|
|
2467
|
+
return null;
|
|
2468
|
+
}
|
|
2469
|
+
const label = await fetchLookupLabel(desc, key, effLocale, fieldFallback, cfg);
|
|
2470
|
+
if (label === void 0) {
|
|
2471
|
+
if (policy === "throw") {
|
|
2472
|
+
throw new LocaleNotSpecifiedError(field, `lookup "${field}": no label for key "${key}" in locale "${effLocale}".`);
|
|
2473
|
+
}
|
|
2474
|
+
return null;
|
|
2475
|
+
}
|
|
2476
|
+
return label;
|
|
2477
|
+
};
|
|
2478
|
+
if (field.includes("[].")) {
|
|
2479
|
+
const parts = field.split("[].");
|
|
2480
|
+
const arrayKey = parts[0];
|
|
2481
|
+
const leaf = parts[1];
|
|
2482
|
+
if (!leaf || leaf.includes(".")) continue;
|
|
2483
|
+
const arr = withLabels[arrayKey];
|
|
2484
|
+
if (!Array.isArray(arr)) continue;
|
|
2485
|
+
const labelKey = `${leaf}Label`;
|
|
2486
|
+
withLabels[arrayKey] = await Promise.all(
|
|
2487
|
+
arr.map(async (el) => {
|
|
2488
|
+
if (!el || typeof el !== "object" || Array.isArray(el)) return el;
|
|
2489
|
+
const k = el[leaf];
|
|
2490
|
+
if (typeof k !== "string") return el;
|
|
2491
|
+
return { ...el, [labelKey]: await resolveKey(k) };
|
|
2492
|
+
})
|
|
2493
|
+
);
|
|
2494
|
+
continue;
|
|
2495
|
+
}
|
|
2496
|
+
const val = result[field];
|
|
2497
|
+
if (Array.isArray(val)) {
|
|
2498
|
+
withLabels[`${field}Label`] = await Promise.all(
|
|
2499
|
+
val.map(async (k) => ({ key: k, label: typeof k === "string" ? await resolveKey(k) : null }))
|
|
2500
|
+
);
|
|
2501
|
+
} else if (typeof val === "string") {
|
|
2502
|
+
const label = await resolveKey(val);
|
|
2503
|
+
if (label !== null) withLabels[`${field}Label`] = label;
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
result = withLabels;
|
|
2507
|
+
return result;
|
|
2508
|
+
}
|
|
2509
|
+
function buildLookupDescribeFragment(cfg) {
|
|
2510
|
+
const lookupFields = {};
|
|
2511
|
+
for (const [field, desc] of Object.entries(cfg.lookupFields)) {
|
|
2512
|
+
lookupFields[field] = {
|
|
2513
|
+
...desc.dimension !== "" ? { dimension: desc.dimension } : {},
|
|
2514
|
+
backing: desc.backing,
|
|
2515
|
+
vocabulary: desc.vocabulary,
|
|
2516
|
+
key: desc.key,
|
|
2517
|
+
onDelete: desc.onDelete,
|
|
2518
|
+
...desc.altKeys !== void 0 ? { altKeys: desc.altKeys } : {},
|
|
2519
|
+
...desc.present !== void 0 ? { present: desc.present } : {},
|
|
2520
|
+
...desc.sortBy !== void 0 ? { sortBy: desc.sortBy } : {},
|
|
2521
|
+
// #657 — static tier: when no `keys` was explicitly declared but a
|
|
2522
|
+
// `table` was (the staticDict()-equivalent `lookup(dim, {backing:
|
|
2523
|
+
// 'static', table})` shape), the table's own key set IS the
|
|
2524
|
+
// statically-known closed-vocabulary set the DescribedField.lookup
|
|
2525
|
+
// docblock promises ("declared `keys`, OR a static table's own
|
|
2526
|
+
// keys"). Reserved/matrix tiers never carry `table`, so this branch
|
|
2527
|
+
// never fires for them — their `keys` emission is unchanged.
|
|
2528
|
+
...desc.keys !== void 0 ? { keys: desc.keys } : desc.backing === "static" && desc.table !== void 0 ? { keys: Object.keys(desc.table) } : {}
|
|
2529
|
+
};
|
|
2530
|
+
}
|
|
2531
|
+
return { lookupFields };
|
|
2532
|
+
}
|
|
2533
|
+
function getAltIndexOrThrow(field, desc, cfg) {
|
|
2534
|
+
try {
|
|
2535
|
+
return cfg.getAltIndex?.(desc);
|
|
2536
|
+
} catch (err) {
|
|
2537
|
+
if (err instanceof Error && err.message.includes("lazy-mode")) {
|
|
2538
|
+
throw new ValidationError(
|
|
2539
|
+
`lookup: altKeys on "${field}" require the backing collection "${desc.dimension}" to be prefetch-enabled (lazy mode unsupported); open it without {prefetch:false} or drop altKeys.`
|
|
2540
|
+
);
|
|
2541
|
+
}
|
|
2542
|
+
throw err;
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
function runLookupIngest(record, cfg) {
|
|
2546
|
+
const withAltKeys = Object.entries(cfg.lookupFields).filter(([, d]) => (d.altKeys?.length ?? 0) > 0);
|
|
2547
|
+
if (withAltKeys.length === 0) return record;
|
|
2548
|
+
let result = record;
|
|
2549
|
+
for (const [field, desc] of withAltKeys) {
|
|
2550
|
+
const backing = getAltIndexOrThrow(field, desc, cfg);
|
|
2551
|
+
if (!backing || backing.altIndex.size === 0) continue;
|
|
2552
|
+
if (field.includes("[].")) {
|
|
2553
|
+
const [arrayKey, leaf] = field.split("[].");
|
|
2554
|
+
if (!leaf || leaf.includes(".")) continue;
|
|
2555
|
+
const arr = record[arrayKey];
|
|
2556
|
+
if (!Array.isArray(arr)) continue;
|
|
2557
|
+
let changed = false;
|
|
2558
|
+
const normalized = arr.map((item) => {
|
|
2559
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return item;
|
|
2560
|
+
const value2 = item[leaf];
|
|
2561
|
+
if (typeof value2 !== "string") return item;
|
|
2562
|
+
const canonical2 = backing.altIndex.get(value2);
|
|
2563
|
+
if (canonical2 === void 0 || canonical2 === value2) return item;
|
|
2564
|
+
changed = true;
|
|
2565
|
+
return { ...item, [leaf]: canonical2 };
|
|
2566
|
+
});
|
|
2567
|
+
if (!changed) continue;
|
|
2568
|
+
if (result === record) result = { ...record };
|
|
2569
|
+
result[arrayKey] = normalized;
|
|
2570
|
+
continue;
|
|
2571
|
+
}
|
|
2572
|
+
const values = getAtPath(record, field);
|
|
2573
|
+
if (values.length !== 1) continue;
|
|
2574
|
+
const value = values[0];
|
|
2575
|
+
if (Array.isArray(value)) {
|
|
2576
|
+
if (value.length === 0) continue;
|
|
2577
|
+
let changed = false;
|
|
2578
|
+
const normalized = value.map((el) => {
|
|
2579
|
+
if (typeof el !== "string") return el;
|
|
2580
|
+
const canonical2 = backing.altIndex.get(el);
|
|
2581
|
+
if (canonical2 === void 0 || canonical2 === el) return el;
|
|
2582
|
+
changed = true;
|
|
2583
|
+
return canonical2;
|
|
2584
|
+
});
|
|
2585
|
+
if (!changed) continue;
|
|
2586
|
+
if (result === record) result = { ...record };
|
|
2587
|
+
setAtPathInPlace(result, field, normalized);
|
|
2588
|
+
continue;
|
|
2589
|
+
}
|
|
2590
|
+
if (typeof value !== "string") continue;
|
|
2591
|
+
const canonical = backing.altIndex.get(value);
|
|
2592
|
+
if (canonical === void 0 || canonical === value) continue;
|
|
2593
|
+
if (result === record) result = { ...record };
|
|
2594
|
+
setAtPathInPlace(result, field, canonical);
|
|
2595
|
+
}
|
|
2596
|
+
return result;
|
|
2597
|
+
}
|
|
2598
|
+
async function runLookupEnforceWrite(record, cfg) {
|
|
2599
|
+
for (const [field, desc] of Object.entries(cfg.lookupFields)) {
|
|
2600
|
+
if (desc.vocabulary !== "closed") continue;
|
|
2601
|
+
for (const value of getAtPath(record, field)) {
|
|
2602
|
+
if (Array.isArray(value)) {
|
|
2603
|
+
for (const el of value) {
|
|
2604
|
+
if (typeof el !== "string") continue;
|
|
2605
|
+
const known2 = cfg.membership ? await cfg.membership(field, el) : true;
|
|
2606
|
+
if (!known2) throw new UnknownLookupKeyError(desc.dimension, field, el);
|
|
2607
|
+
}
|
|
2608
|
+
continue;
|
|
2609
|
+
}
|
|
2610
|
+
if (typeof value !== "string") continue;
|
|
2611
|
+
const known = cfg.membership ? await cfg.membership(field, value) : true;
|
|
2612
|
+
if (!known) throw new UnknownLookupKeyError(desc.dimension, field, value);
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
function compareLookupOrder(field, a, b, cfg) {
|
|
2617
|
+
if (typeof a !== "string" || typeof b !== "string") return void 0;
|
|
2618
|
+
const desc = cfg.lookupFields[field];
|
|
2619
|
+
if (!desc || desc.sortBy === void 0) return void 0;
|
|
2620
|
+
const rows = desc.backing === "static" ? desc.table ? new Map(Object.entries(desc.table)) : void 0 : cfg.snapshotFor?.(desc);
|
|
2621
|
+
if (!rows) return void 0;
|
|
2622
|
+
return buildLookupSnapshot(desc.dimension, rows, desc).compareKeys(a, b, desc.displayLocale ?? "");
|
|
2623
|
+
}
|
|
2624
|
+
function resolveLookupOrderLabel(field, key, locale, cfg) {
|
|
2625
|
+
const desc = cfg.lookupFields[field];
|
|
2626
|
+
if (!desc) return void 0;
|
|
2627
|
+
const rows = desc.backing === "static" ? desc.table ? new Map(Object.entries(desc.table)) : void 0 : cfg.snapshotFor?.(desc);
|
|
2628
|
+
if (!rows) return void 0;
|
|
2629
|
+
return buildLookupSnapshot(desc.dimension, rows, desc).label(key, locale ?? desc.displayLocale ?? "");
|
|
2630
|
+
}
|
|
2631
|
+
function lookupBinding(cfg) {
|
|
2632
|
+
return {
|
|
2633
|
+
brand: "lookup",
|
|
2634
|
+
posture: { encryptedAtRest: "envelope", queryable: "full", exportable: true, forgettable: false },
|
|
2635
|
+
reservedPrefixes: ["_dict_", "_lookup_"],
|
|
2636
|
+
covers: (field) => field in cfg.lookupFields,
|
|
2637
|
+
ingest: (record) => runLookupIngest(record, cfg),
|
|
2638
|
+
enforceWrite: (record) => runLookupEnforceWrite(record, cfg),
|
|
2639
|
+
present: async (record, ctx) => runLookupPresent(record, ctx, cfg),
|
|
2640
|
+
compareForOrder: (field, a, b) => compareLookupOrder(field, a, b, cfg),
|
|
2641
|
+
resolveOrderLabel: (field, key, locale) => resolveLookupOrderLabel(field, key, locale, cfg),
|
|
2642
|
+
describeFragment: () => buildLookupDescribeFragment(cfg)
|
|
2643
|
+
};
|
|
2644
|
+
}
|
|
2645
|
+
function linkLookupVia() {
|
|
2646
|
+
installViaBinder("lookup", (c) => lookupBinding(c));
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
// src/via/lookup/descriptor.ts
|
|
2650
|
+
function warnIfSortByNeedsDisplayLocale(dimension, opts) {
|
|
2651
|
+
if (opts?.sortBy !== void 0 && opts.present?.by !== void 0 && opts.displayLocale === void 0) {
|
|
2652
|
+
console.warn(
|
|
2653
|
+
`[noy-db] lookup("${dimension}"): sortBy "${opts.sortBy}" is locale-keyed (present.by is set) but no displayLocale is declared \u2014 a locale-less orderBy() will silently sort by the raw stored key instead of the resolved label. Declare displayLocale, or sort via orderBy(field, dir, { by: 'label' }), which resolves at the query's own per-call locale.`
|
|
2654
|
+
);
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
function lookup(dimension, opts) {
|
|
2658
|
+
linkLookupVia();
|
|
2659
|
+
warnIfSortByNeedsDisplayLocale(dimension, opts);
|
|
2660
|
+
return {
|
|
2661
|
+
_viaBrand: "lookup",
|
|
2662
|
+
dimension,
|
|
2663
|
+
key: opts?.key ?? "id",
|
|
2664
|
+
vocabulary: opts?.vocabulary ?? "open",
|
|
2665
|
+
backing: opts?.backing ?? "collection",
|
|
2666
|
+
onDelete: opts?.onDelete ?? "restrict",
|
|
2667
|
+
...opts?.altKeys !== void 0 ? { altKeys: opts.altKeys } : {},
|
|
2668
|
+
...opts?.present !== void 0 ? { present: opts.present } : {},
|
|
2669
|
+
...opts?.sortBy !== void 0 ? { sortBy: opts.sortBy } : {},
|
|
2670
|
+
...opts?.keys !== void 0 ? { keys: opts.keys } : {},
|
|
2671
|
+
...opts?.table !== void 0 ? { table: opts.table } : {},
|
|
2672
|
+
...opts?.displayLocale !== void 0 ? { displayLocale: opts.displayLocale } : {},
|
|
2673
|
+
...opts?.onMissing !== void 0 ? { onMissing: opts.onMissing } : {},
|
|
2674
|
+
...opts?.substitute !== void 0 ? { substitute: opts.substitute } : {},
|
|
2675
|
+
...opts?.labels !== void 0 ? { labels: opts.labels } : {}
|
|
2676
|
+
};
|
|
2677
|
+
}
|
|
2678
|
+
function enumOf(keys) {
|
|
2679
|
+
linkLookupVia();
|
|
2680
|
+
return {
|
|
2681
|
+
_viaBrand: "lookup",
|
|
2682
|
+
dimension: "",
|
|
2683
|
+
key: "id",
|
|
2684
|
+
vocabulary: "closed",
|
|
2685
|
+
backing: "static",
|
|
2686
|
+
onDelete: "restrict",
|
|
2687
|
+
keys
|
|
2688
|
+
};
|
|
2689
|
+
}
|
|
2690
|
+
function dict(dimension, opts) {
|
|
2691
|
+
linkLookupVia();
|
|
2692
|
+
return {
|
|
2693
|
+
_viaBrand: "lookup",
|
|
2694
|
+
dimension,
|
|
2695
|
+
key: "id",
|
|
2696
|
+
vocabulary: opts?.vocabulary ?? "open",
|
|
2697
|
+
backing: "reserved",
|
|
2698
|
+
onDelete: opts?.onDelete ?? "restrict",
|
|
2699
|
+
...opts?.keys !== void 0 ? { keys: opts.keys } : {},
|
|
2700
|
+
...opts?.present !== void 0 ? { present: opts.present } : {},
|
|
2701
|
+
...opts?.onMissing !== void 0 ? { onMissing: opts.onMissing } : {},
|
|
2702
|
+
...opts?.substitute !== void 0 ? { substitute: opts.substitute } : {}
|
|
2703
|
+
};
|
|
623
2704
|
}
|
|
624
2705
|
export {
|
|
625
2706
|
Aggregation,
|
|
626
2707
|
AlreadyElevatedError,
|
|
627
2708
|
AmendmentForbiddenError,
|
|
628
2709
|
AttestationError,
|
|
2710
|
+
AttestationNotEnabledError,
|
|
629
2711
|
BLOB_CHUNKS_COLLECTION,
|
|
630
2712
|
BLOB_COLLECTION,
|
|
631
2713
|
BLOB_INDEX_COLLECTION,
|
|
@@ -639,13 +2721,25 @@ export {
|
|
|
639
2721
|
BundleSealMismatchError,
|
|
640
2722
|
BundleVersionConflictError,
|
|
641
2723
|
CONSENT_AUDIT_COLLECTION,
|
|
2724
|
+
CargoNotEnabledError,
|
|
2725
|
+
ClassifiedConfigError,
|
|
2726
|
+
ClassifiedNeverStoredError,
|
|
2727
|
+
ClassifiedNotEnabledError,
|
|
2728
|
+
ClassifiedRevealError,
|
|
2729
|
+
ClassifiedRotationError,
|
|
2730
|
+
ClassifiedValidationError,
|
|
2731
|
+
ClassifiedVerifyError,
|
|
642
2732
|
Collection,
|
|
643
2733
|
CollectionFrame,
|
|
644
2734
|
CollectionIndexes,
|
|
645
2735
|
CollectionInstant,
|
|
2736
|
+
ComputedFieldError,
|
|
646
2737
|
ConflictError,
|
|
647
2738
|
CrossJoinSourceUnknownError,
|
|
648
2739
|
CrossJoinTooLargeError,
|
|
2740
|
+
CustodyApi,
|
|
2741
|
+
CustodyNotEnabledError,
|
|
2742
|
+
DEED_RECORD_ID,
|
|
649
2743
|
DEFAULT_CHUNK_SIZE,
|
|
650
2744
|
DEFAULT_CROSS_JOIN_MAX_ROWS,
|
|
651
2745
|
DEFAULT_FRESHNESS_MS,
|
|
@@ -655,6 +2749,9 @@ export {
|
|
|
655
2749
|
DICT_COLLECTION_PREFIX,
|
|
656
2750
|
DIRECTORY_RECORD_ID,
|
|
657
2751
|
DanglingReferenceError,
|
|
2752
|
+
DataResidencyError,
|
|
2753
|
+
DebugPlaintextError,
|
|
2754
|
+
DebugReservedFieldError,
|
|
658
2755
|
DecryptionError,
|
|
659
2756
|
DelegationTargetMissingError,
|
|
660
2757
|
DerivationCapExceededError,
|
|
@@ -664,14 +2761,19 @@ export {
|
|
|
664
2761
|
DerivationOutputUnknownError,
|
|
665
2762
|
DictKeyInUseError,
|
|
666
2763
|
DictKeyMissingError,
|
|
667
|
-
DictionaryHandle,
|
|
2764
|
+
LookupHandle as DictionaryHandle,
|
|
668
2765
|
DirectoryDisabledError,
|
|
669
2766
|
ELEVATION_AUDIT_COLLECTION,
|
|
670
2767
|
ElevatedHandle,
|
|
671
2768
|
ElevationExpiredError,
|
|
2769
|
+
EmbeddingDimMismatchError,
|
|
2770
|
+
EmbeddingModelMismatchError,
|
|
2771
|
+
EnclaveNotSupportedError,
|
|
672
2772
|
ExportCapabilityError,
|
|
673
2773
|
FieldFrozenError,
|
|
2774
|
+
FieldNotQueryableError,
|
|
674
2775
|
FilenameSanitizationError,
|
|
2776
|
+
ForgetStrategyNotConfiguredError,
|
|
675
2777
|
GROUPBY_MAX_CARDINALITY,
|
|
676
2778
|
GROUPBY_WARN_CARDINALITY,
|
|
677
2779
|
GroupCardinalityError,
|
|
@@ -679,6 +2781,7 @@ export {
|
|
|
679
2781
|
GroupedQuery,
|
|
680
2782
|
GroupedQueryN,
|
|
681
2783
|
INDEXED_STORE_POLICY,
|
|
2784
|
+
IllegalTransitionError,
|
|
682
2785
|
ImportCapabilityError,
|
|
683
2786
|
IndexRequiredError,
|
|
684
2787
|
IndexWriteFailureError,
|
|
@@ -691,6 +2794,8 @@ export {
|
|
|
691
2794
|
LEDGER_DELTAS_COLLECTION,
|
|
692
2795
|
LedgerContentionError,
|
|
693
2796
|
LedgerStore,
|
|
2797
|
+
LinkEndpointError,
|
|
2798
|
+
LinkIntegrityError,
|
|
694
2799
|
LocaleNotSpecifiedError,
|
|
695
2800
|
Lru,
|
|
696
2801
|
MAGIC_LINK_CONTENT_INFO_PREFIX,
|
|
@@ -706,6 +2811,9 @@ export {
|
|
|
706
2811
|
MemorySealingKeyProvider,
|
|
707
2812
|
MigrationRequiredError,
|
|
708
2813
|
MissingTranslationError,
|
|
2814
|
+
MoneyCurrencyError,
|
|
2815
|
+
MoneyPrecisionError,
|
|
2816
|
+
MoneyUnsupportedError,
|
|
709
2817
|
NOYDB_BACKUP_VERSION,
|
|
710
2818
|
NOYDB_BUNDLE_FORMAT_VERSION,
|
|
711
2819
|
NOYDB_BUNDLE_MAGIC,
|
|
@@ -713,26 +2821,35 @@ export {
|
|
|
713
2821
|
NOYDB_FORMAT_VERSION,
|
|
714
2822
|
NOYDB_KEYRING_VERSION,
|
|
715
2823
|
NOYDB_SYNC_VERSION,
|
|
2824
|
+
NO_CARGO,
|
|
2825
|
+
NO_CUSTODY,
|
|
2826
|
+
NO_SEARCH,
|
|
2827
|
+
NO_SEQUENCE,
|
|
2828
|
+
NO_TEAM,
|
|
716
2829
|
NetworkError,
|
|
717
2830
|
NoAccessError,
|
|
718
2831
|
NonAdditiveSchemaChangeError,
|
|
719
2832
|
NotFoundError,
|
|
720
2833
|
Noydb,
|
|
721
2834
|
NoydbError,
|
|
2835
|
+
NumberingUncertaintyError,
|
|
722
2836
|
OverlayBaseIsVirtualError,
|
|
723
2837
|
OverlayCollectionUnavailableError,
|
|
724
2838
|
OverlayIdMismatchError,
|
|
725
2839
|
OverlayNameCollisionError,
|
|
726
2840
|
PERIODS_COLLECTION,
|
|
727
2841
|
PERSONAL_POLICY,
|
|
2842
|
+
POD_STORE_POLICY,
|
|
728
2843
|
POLICY_RECORD_ID,
|
|
729
2844
|
PUBLIC_ENVELOPE_FIELDS,
|
|
730
2845
|
PUBLIC_ENVELOPE_RECORD_ID,
|
|
731
2846
|
PathEscapeError,
|
|
732
2847
|
PeriodClosedError,
|
|
733
2848
|
PermissionDeniedError,
|
|
2849
|
+
PodVersionConflictError,
|
|
734
2850
|
PolicyDeniedError,
|
|
735
2851
|
PolicyEnforcer,
|
|
2852
|
+
PortabilityNotEnabledError,
|
|
736
2853
|
PresenceHandle,
|
|
737
2854
|
PrivilegeEscalationError,
|
|
738
2855
|
Query,
|
|
@@ -741,6 +2858,7 @@ export {
|
|
|
741
2858
|
ReadOnlyAtInstantError,
|
|
742
2859
|
ReadOnlyError,
|
|
743
2860
|
ReadOnlyFrameError,
|
|
2861
|
+
RecordCekNotFoundError,
|
|
744
2862
|
RecordLockedError,
|
|
745
2863
|
RecoveryNotEnrolledError,
|
|
746
2864
|
RecoveryProfileNotImplementedError,
|
|
@@ -748,8 +2866,11 @@ export {
|
|
|
748
2866
|
RefRegistry,
|
|
749
2867
|
RefScopeError,
|
|
750
2868
|
ReservedCollectionNameError,
|
|
2869
|
+
ReservedVaultNameError,
|
|
2870
|
+
RestrictRefUnresolvableError,
|
|
751
2871
|
SCHEMAS_COLLECTION,
|
|
752
2872
|
SEALED_PASSPHRASE_RECORD_ID,
|
|
2873
|
+
STATE_VAULT_NAME,
|
|
753
2874
|
STRICT_POLICY,
|
|
754
2875
|
SYNC_CREDENTIALS_COLLECTION,
|
|
755
2876
|
ScanBuilder,
|
|
@@ -758,23 +2879,41 @@ export {
|
|
|
758
2879
|
SchemaUpdateError,
|
|
759
2880
|
SchemaValidationError,
|
|
760
2881
|
ScriptViolationError,
|
|
2882
|
+
SealedHandle,
|
|
2883
|
+
SealedRecordExpiredError,
|
|
2884
|
+
SealedRecordMismatchError,
|
|
2885
|
+
SealedRecordNotEnabledError,
|
|
2886
|
+
SearchNotEnabledError,
|
|
2887
|
+
SequenceContentionError,
|
|
2888
|
+
SequenceNotEnabledError,
|
|
2889
|
+
SequenceOfflineError,
|
|
2890
|
+
SequenceStore,
|
|
761
2891
|
SessionExpiredError,
|
|
762
2892
|
SessionNotFoundError,
|
|
763
2893
|
SessionPolicyError,
|
|
2894
|
+
ShardProvisioningError,
|
|
764
2895
|
SnapshotNotFoundError,
|
|
2896
|
+
StaticDictReadonlyError,
|
|
765
2897
|
StoreCapabilityError,
|
|
766
2898
|
SyncEngine,
|
|
767
2899
|
SyncScheduler,
|
|
768
2900
|
SyncTransaction,
|
|
769
2901
|
TamperedError,
|
|
2902
|
+
TeamNotEnabledError,
|
|
770
2903
|
TierDemoteDeniedError,
|
|
771
2904
|
TierNotGrantedError,
|
|
2905
|
+
TiersNotEnabledError,
|
|
772
2906
|
TranslatorNotConfiguredError,
|
|
773
2907
|
TxCollection,
|
|
774
2908
|
TxContext,
|
|
775
2909
|
TxVault,
|
|
776
2910
|
USER_ENVELOPE_COLLECTION,
|
|
777
2911
|
USER_ENVELOPE_MAX_BYTES,
|
|
2912
|
+
UniqueConstraintError,
|
|
2913
|
+
UnknownDictCodeError,
|
|
2914
|
+
UnknownLookupKeyError,
|
|
2915
|
+
UnknownShardError,
|
|
2916
|
+
UnsupportedIndexOptionError,
|
|
778
2917
|
UserApi,
|
|
779
2918
|
UserEnvelopeOversizedError,
|
|
780
2919
|
VISIBILITY_RECORD_PREFIX,
|
|
@@ -782,12 +2921,19 @@ export {
|
|
|
782
2921
|
Vault,
|
|
783
2922
|
VaultFrame,
|
|
784
2923
|
VaultInstant,
|
|
2924
|
+
VaultTemplateNotFoundError,
|
|
785
2925
|
WeakPassphraseError,
|
|
2926
|
+
WithdrawalRequestError,
|
|
786
2927
|
activeSessionCount,
|
|
787
2928
|
additiveOnly,
|
|
2929
|
+
aesGcmOpen,
|
|
2930
|
+
allocate,
|
|
788
2931
|
applyI18nLocale,
|
|
789
2932
|
applyJoins,
|
|
2933
|
+
applyListProjection,
|
|
790
2934
|
applyPatch,
|
|
2935
|
+
approveWithdrawal,
|
|
2936
|
+
asMoney,
|
|
791
2937
|
assertStrongPassphrase,
|
|
792
2938
|
assertTierAccess,
|
|
793
2939
|
avg,
|
|
@@ -799,18 +2945,24 @@ export {
|
|
|
799
2945
|
burnPaperRecoveryEntry,
|
|
800
2946
|
canonicalJson,
|
|
801
2947
|
checkGate,
|
|
2948
|
+
classified,
|
|
802
2949
|
clearDevUnlock,
|
|
2950
|
+
compileSequenceFormat,
|
|
803
2951
|
computePatch,
|
|
2952
|
+
computed,
|
|
804
2953
|
coordinatedCutover,
|
|
805
2954
|
count,
|
|
806
2955
|
createBundleStore,
|
|
2956
|
+
createDeedOwner,
|
|
807
2957
|
createEnforcer,
|
|
808
2958
|
createNoydb,
|
|
2959
|
+
createPodStore,
|
|
809
2960
|
createSession,
|
|
810
2961
|
createStore,
|
|
811
2962
|
credentialStatus,
|
|
812
2963
|
decryptBytes,
|
|
813
2964
|
decryptDeterministic,
|
|
2965
|
+
decryptExtractedPartition,
|
|
814
2966
|
dekKey,
|
|
815
2967
|
deleteCredential,
|
|
816
2968
|
deleteUserEnvelope,
|
|
@@ -825,6 +2977,7 @@ export {
|
|
|
825
2977
|
detectMagic,
|
|
826
2978
|
detectMimeType,
|
|
827
2979
|
diagramAuthConfig,
|
|
2980
|
+
dict,
|
|
828
2981
|
dictCollectionName,
|
|
829
2982
|
dictKey,
|
|
830
2983
|
diff,
|
|
@@ -835,16 +2988,21 @@ export {
|
|
|
835
2988
|
encryptDeterministic,
|
|
836
2989
|
enforceScript,
|
|
837
2990
|
enrollAuthenticator,
|
|
2991
|
+
enumOf as enum,
|
|
2992
|
+
enumOf,
|
|
838
2993
|
envelopePayloadHash,
|
|
839
2994
|
estimateEntropy,
|
|
840
2995
|
estimateRecordBytes,
|
|
2996
|
+
evalComputedFields,
|
|
841
2997
|
evaluateClause,
|
|
842
2998
|
evaluateExportCapability,
|
|
843
2999
|
evaluateFieldClause,
|
|
844
3000
|
evaluateImportCapability,
|
|
845
3001
|
executePlan,
|
|
3002
|
+
exportAccessibleData,
|
|
846
3003
|
findAuthenticator,
|
|
847
3004
|
formatDiff,
|
|
3005
|
+
fuseRetrieval,
|
|
848
3006
|
generateULID,
|
|
849
3007
|
getCredential,
|
|
850
3008
|
groupAndReduce,
|
|
@@ -854,26 +3012,42 @@ export {
|
|
|
854
3012
|
hasRecoveryEnrolled,
|
|
855
3013
|
hashEntry,
|
|
856
3014
|
i18nText,
|
|
3015
|
+
immutableGuard,
|
|
3016
|
+
importExternalObjects,
|
|
857
3017
|
inferScripts,
|
|
3018
|
+
isClassifiedFieldSpec,
|
|
3019
|
+
isClassifiedGroup,
|
|
3020
|
+
isComputedDescriptor,
|
|
3021
|
+
isDeedVault,
|
|
858
3022
|
isDevUnlockActive,
|
|
859
3023
|
isDictCollectionName,
|
|
860
3024
|
isDictKeyDescriptor,
|
|
3025
|
+
isDiscriminant,
|
|
861
3026
|
isI18nTextDescriptor,
|
|
3027
|
+
isLinkCollectionName,
|
|
862
3028
|
isMagicLinkGrantExpired,
|
|
3029
|
+
isMoneyDescriptor,
|
|
3030
|
+
isMoneyString,
|
|
863
3031
|
isPreCompressed,
|
|
864
3032
|
isPublicEnvelope,
|
|
3033
|
+
isRefArray,
|
|
865
3034
|
isSessionAlive,
|
|
3035
|
+
isStaticDictDescriptor,
|
|
866
3036
|
isULID,
|
|
3037
|
+
isViaFieldSpec,
|
|
867
3038
|
isZodSchema,
|
|
868
3039
|
issueDelegation,
|
|
869
3040
|
recoverPassphrase as keyringRecoverPassphrase,
|
|
870
3041
|
rotatePassphrase as keyringRotatePassphrase,
|
|
3042
|
+
liberateVault,
|
|
871
3043
|
listCredentials,
|
|
872
3044
|
listMagicLinkGrants,
|
|
873
3045
|
listUserEnvelopeIds,
|
|
874
3046
|
listUsers,
|
|
875
3047
|
listUsersWithEnvelopes,
|
|
3048
|
+
listWithdrawalRequests,
|
|
876
3049
|
loadActiveDelegations,
|
|
3050
|
+
loadDeedMarker,
|
|
877
3051
|
loadDevUnlock,
|
|
878
3052
|
loadPaperRecoveryEntries,
|
|
879
3053
|
loadPersistedSchema,
|
|
@@ -883,17 +3057,28 @@ export {
|
|
|
883
3057
|
loadUserEnvelope,
|
|
884
3058
|
loadVaultPolicy,
|
|
885
3059
|
lockSchema,
|
|
3060
|
+
lookup,
|
|
3061
|
+
luhnCheck,
|
|
886
3062
|
magicLinkGrantRecordId,
|
|
887
3063
|
max,
|
|
3064
|
+
memoryObjectProjection,
|
|
3065
|
+
memoryStore,
|
|
888
3066
|
mergeCrdtStates,
|
|
889
3067
|
mergePolicy,
|
|
890
3068
|
min,
|
|
891
3069
|
mintPaperRecoveryEntry,
|
|
892
3070
|
mintShamirRecoveryEntry,
|
|
893
3071
|
mintWrappedDeksBlob,
|
|
3072
|
+
money,
|
|
3073
|
+
moneyMax,
|
|
3074
|
+
moneyMin,
|
|
3075
|
+
moneyNumber,
|
|
3076
|
+
moneySum,
|
|
3077
|
+
mulRate,
|
|
894
3078
|
paddedIndex,
|
|
895
3079
|
parseBytes,
|
|
896
3080
|
parseIndex,
|
|
3081
|
+
parseRsaOaepTlv,
|
|
897
3082
|
parseSealedEnvelope,
|
|
898
3083
|
persistDirectoryConfig,
|
|
899
3084
|
persistSchemaIfNeeded,
|
|
@@ -905,18 +3090,27 @@ export {
|
|
|
905
3090
|
readNoydbBundleHeader,
|
|
906
3091
|
readNoydbBundlePublicEnvelope,
|
|
907
3092
|
readPath,
|
|
3093
|
+
readPlaintextRecord,
|
|
3094
|
+
readPod,
|
|
3095
|
+
readPodHeader,
|
|
908
3096
|
readPublicEnvelope,
|
|
909
3097
|
readUserVisibility,
|
|
910
3098
|
recoverUser,
|
|
911
3099
|
reduceRecords,
|
|
3100
|
+
reducerBuilder,
|
|
912
3101
|
ref,
|
|
3102
|
+
refArray,
|
|
3103
|
+
rejectWithdrawal,
|
|
913
3104
|
removeAuthenticator,
|
|
3105
|
+
requestWithdrawal,
|
|
914
3106
|
resetBrotliSupportCache,
|
|
915
3107
|
resetJoinWarnings,
|
|
3108
|
+
resolveClassifiedFields,
|
|
916
3109
|
resolveCrdtSnapshot,
|
|
917
3110
|
resolveI18nText,
|
|
918
3111
|
resolvePolicy,
|
|
919
3112
|
resolveSchema as resolvePublicEnvelopeSchema,
|
|
3113
|
+
resolveSequenceKey,
|
|
920
3114
|
resolveSession,
|
|
921
3115
|
revokeAllSessions,
|
|
922
3116
|
revokeDelegation,
|
|
@@ -931,8 +3125,13 @@ export {
|
|
|
931
3125
|
saveShamirRecoveryEntries,
|
|
932
3126
|
saveUserEnvelope,
|
|
933
3127
|
saveVaultPolicy,
|
|
3128
|
+
scaleForCurrency,
|
|
3129
|
+
sealRsaOaepTlv,
|
|
934
3130
|
sha256Hex,
|
|
3131
|
+
staticDict,
|
|
935
3132
|
sum,
|
|
3133
|
+
tokenize,
|
|
3134
|
+
transitionGuard,
|
|
936
3135
|
unwrapDeksFromBlob,
|
|
937
3136
|
unwrapDeksFromPaperEntry,
|
|
938
3137
|
unwrapDeksFromShamirEntry,
|
|
@@ -943,20 +3142,33 @@ export {
|
|
|
943
3142
|
validateSchemaInput,
|
|
944
3143
|
validateSchemaOutput,
|
|
945
3144
|
validateSessionPolicy,
|
|
3145
|
+
via,
|
|
946
3146
|
visibilityRecordId,
|
|
3147
|
+
withArchive,
|
|
947
3148
|
withCache,
|
|
3149
|
+
withCargo,
|
|
948
3150
|
withCircuitBreaker,
|
|
3151
|
+
withCustody,
|
|
3152
|
+
withDeferredNumbering,
|
|
949
3153
|
withDerivation,
|
|
950
3154
|
withGuard,
|
|
951
3155
|
withHealthCheck,
|
|
3156
|
+
withLazy,
|
|
952
3157
|
withLogging,
|
|
953
3158
|
withMaterializedView,
|
|
954
3159
|
withMetrics,
|
|
955
3160
|
withOverlayedView,
|
|
956
3161
|
withRetry,
|
|
3162
|
+
withRollup,
|
|
3163
|
+
withSearch,
|
|
3164
|
+
withSequence,
|
|
3165
|
+
withTeam,
|
|
3166
|
+
withdrawAccessibleData,
|
|
957
3167
|
wrapBundleStore,
|
|
3168
|
+
wrapPodStore,
|
|
958
3169
|
wrapStore,
|
|
959
3170
|
writeMagicLinkGrant,
|
|
960
|
-
writeNoydbBundle
|
|
3171
|
+
writeNoydbBundle,
|
|
3172
|
+
writePod
|
|
961
3173
|
};
|
|
962
3174
|
//# sourceMappingURL=index.js.map
|