@noy-db/hub 0.2.0-pre.13 → 0.2.0-pre.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aggregate/index.cjs +56 -56
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +2 -2
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/aggregate/index.js +4 -4
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +5 -5
- package/dist/attestation/index.d.ts +5 -5
- package/dist/attestation/index.js +5 -5
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +6 -6
- package/dist/blobs/index.d.ts +6 -6
- package/dist/blobs/index.js +4 -4
- package/dist/bundle/index.cjs +559 -76
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +7 -7
- package/dist/bundle/index.d.ts +7 -7
- package/dist/bundle/index.js +8 -8
- package/dist/{chunk-YWBHS25M.js → chunk-3EWXMOK3.js} +8 -267
- package/dist/chunk-3EWXMOK3.js.map +1 -0
- package/dist/{chunk-SJ24GHID.js → chunk-4TBBMHVC.js} +2 -2
- package/dist/{chunk-NKGY3C53.js → chunk-535SSHBS.js} +8 -1
- package/dist/{chunk-NKGY3C53.js.map → chunk-535SSHBS.js.map} +1 -1
- package/dist/{chunk-HQXOEWLZ.js → chunk-56DJ7JVK.js} +3 -3
- package/dist/{chunk-KKB42D3Q.js → chunk-5LQG6ZO2.js} +2 -2
- package/dist/{chunk-TDECYU4Y.js → chunk-6AJBSQU4.js} +2 -2
- package/dist/{chunk-O2JW656W.js → chunk-6RR3MNMG.js} +3 -3
- package/dist/{chunk-P5MW7BG2.js → chunk-7EFFHEN5.js} +57 -50
- package/dist/chunk-7EFFHEN5.js.map +1 -0
- package/dist/{chunk-7TEI2K2A.js → chunk-7HT2MEZ5.js} +4 -4
- package/dist/{chunk-WQKZIQIL.js → chunk-7PS7EOCF.js} +3 -3
- package/dist/{chunk-C3WRKABE.js → chunk-A5ZOOZFB.js} +3 -3
- package/dist/{chunk-5NISHSBO.js → chunk-AAVWKNZW.js} +2 -2
- package/dist/{chunk-SOU42FGB.js → chunk-BIYRQQV6.js} +4 -4
- package/dist/{chunk-ILWQGTNH.js → chunk-BQ65SS5A.js} +2 -2
- package/dist/{chunk-CWFQTAD4.js → chunk-C5T5AFWN.js} +4 -4
- package/dist/chunk-CJORTUJ2.js +524 -0
- package/dist/chunk-CJORTUJ2.js.map +1 -0
- package/dist/{chunk-SYSKC237.js → chunk-COFPAMX6.js} +5 -5
- package/dist/{chunk-D5Y3HIC6.js → chunk-CZI2A4MQ.js} +3 -3
- package/dist/{chunk-KJF7EPUE.js → chunk-DKO2QFSA.js} +2 -2
- package/dist/{chunk-QFYVGJLI.js → chunk-DQU36Q7I.js} +2 -2
- package/dist/{chunk-NIUXQDWD.js → chunk-EGD5DXFT.js} +2 -2
- package/dist/{chunk-NJMKHRQI.js → chunk-EYVQHAGH.js} +267 -67
- package/dist/chunk-EYVQHAGH.js.map +1 -0
- package/dist/{chunk-KHQ3N5AB.js → chunk-F4OJZIWQ.js} +4 -4
- package/dist/{chunk-3OUCWHV6.js → chunk-FWPKCXTN.js} +2 -2
- package/dist/{chunk-QIVFGU2M.js → chunk-HOR4R722.js} +3 -3
- package/dist/{chunk-NP6EZT44.js → chunk-IQLVUT37.js} +2 -2
- package/dist/{chunk-4VCQH32J.js → chunk-JD3OZAI4.js} +2 -2
- package/dist/{chunk-J67BP5EP.js → chunk-KI6HAJWL.js} +3 -3
- package/dist/{chunk-AYNF7PVX.js → chunk-KIP6JLTF.js} +2 -2
- package/dist/{chunk-PW26DAXS.js → chunk-L2FE64BU.js} +3 -3
- package/dist/{chunk-QAWCVWCX.js → chunk-LX3CB26H.js} +4 -4
- package/dist/{chunk-VAK6NQAK.js → chunk-NSCVNK5K.js} +4 -4
- package/dist/{chunk-4YDZ7JPZ.js → chunk-NU6Q3FOR.js} +4 -4
- package/dist/chunk-NU6Q3FOR.js.map +1 -0
- package/dist/{chunk-3XZRRBFW.js → chunk-OHVFWCJP.js} +2 -2
- package/dist/{chunk-TEQGXA7L.js → chunk-PE4AQGFH.js} +4 -4
- package/dist/{chunk-UNQEWORI.js → chunk-TS26M2SB.js} +2 -2
- package/dist/{chunk-FNVFT4HZ.js → chunk-VU7SWWT5.js} +2 -2
- package/dist/{chunk-GZJ5JBED.js → chunk-WBAYSNUQ.js} +3 -3
- package/dist/{chunk-HHZ77DHM.js → chunk-WGHU7BLI.js} +2 -2
- package/dist/{chunk-GL3Z7LH7.js → chunk-X73VS74Y.js} +2 -2
- package/dist/{chunk-WIBHRONM.js → chunk-XWH4MXIU.js} +2 -2
- package/dist/{chunk-M6KXHRIA.js → chunk-YHPM5D7Y.js} +3 -3
- package/dist/{chunk-E3DIBDKA.js → chunk-YULZKK4F.js} +2 -2
- package/dist/{chunk-JWFNOD2T.js → chunk-Z4DO7YSI.js} +2 -2
- package/dist/{chunk-JPOQMXGT.js → chunk-ZNQYHJXX.js} +2 -2
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +6 -6
- package/dist/consent/index.d.ts +6 -6
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-YXH6SAOW.js → crypto-QXQOHMHF.js} +3 -3
- package/dist/{delegation-K5ERUH6A.js → delegation-NIQ43IPU.js} +5 -5
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +7 -7
- package/dist/derivations/index.d.ts +7 -7
- package/dist/derivations/index.js +4 -4
- package/dist/{dev-unlock-BW0GNBEV.d.ts → dev-unlock-iAS8z9jc.d.ts} +1 -1
- package/dist/{dev-unlock-a7SOtaV0.d.cts → dev-unlock-nVkuRLLe.d.cts} +1 -1
- package/dist/executor-6ZDSDZ6V.js +8 -0
- package/dist/executor-HSSRXDOB.js +11 -0
- package/dist/executor-IDZDAFNH.js +8 -0
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +7 -7
- package/dist/guards/index.d.ts +7 -7
- package/dist/guards/index.js +3 -3
- package/dist/{hash-B0cLQcq_.d.cts → hash-Cv6byZs7.d.cts} +1 -1
- package/dist/{hash-uMNIAAW8.d.ts → hash-DHOnRarj.d.ts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +7 -7
- package/dist/history/index.d.ts +7 -7
- package/dist/history/index.js +4 -4
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +6 -6
- package/dist/i18n/index.d.ts +6 -6
- package/dist/i18n/index.js +5 -5
- package/dist/{immutable-guard-B0h-ipLz.d.ts → immutable-guard-BehB1YGB.d.ts} +1 -1
- package/dist/{immutable-guard-BZIcYhYX.d.cts → immutable-guard-yBEOYmif.d.cts} +1 -1
- package/dist/{index-CUVOMtgg.d.cts → index-D95VK1Qy.d.cts} +11 -3
- package/dist/{index-Cqzp4tt9.d.ts → index-XNB2r6bX.d.ts} +11 -3
- package/dist/index.cjs +700 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +145 -15
- package/dist/index.d.ts +145 -15
- package/dist/index.js +164 -48
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs +92 -31
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.d.cts +3 -3
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +4 -4
- package/dist/issue-ADVS4OVP.js +12 -0
- package/dist/{lazy-builder-D5GU14TS.d.ts → lazy-builder-ChSqcF5t.d.ts} +1 -1
- package/dist/{lazy-builder-Ci5_YG73.d.cts → lazy-builder-eYZzLEL1.d.cts} +1 -1
- package/dist/{ledger-64TTQMRS.js → ledger-CWSE3BLF.js} +4 -4
- package/dist/materialized-views/index.cjs +2 -2
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +7 -7
- package/dist/materialized-views/index.d.ts +7 -7
- package/dist/materialized-views/index.js +7 -7
- package/dist/noydb-GZGFBA4E.js +35 -0
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +7 -7
- package/dist/overlay-views/index.d.ts +7 -7
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +6 -6
- package/dist/periods/index.d.ts +6 -6
- package/dist/periods/index.js +4 -4
- package/dist/{predicate-Bt5ft-9c.d.cts → predicate-BmhBSPCH.d.cts} +59 -2
- package/dist/{predicate-Bt5ft-9c.d.ts → predicate-BmhBSPCH.d.ts} +59 -2
- package/dist/{public-envelope-MHG6YVXW.js → public-envelope-SYHEYQ3X.js} +3 -3
- package/dist/query/index.cjs +580 -195
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +6 -6
- package/dist/{registry-PV4G3OPA.js → registry-DK5YWAAA.js} +3 -3
- package/dist/registry-IUZQVVBB.js +8 -0
- package/dist/registry-XGLNADIE.js +8 -0
- package/dist/{revoke-5BOLVJ3N.js → revoke-ZDFKMR5E.js} +5 -5
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +7 -7
- package/dist/session/index.d.ts +7 -7
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +6 -6
- package/dist/shadow/index.d.ts +6 -6
- package/dist/shadow/index.js +2 -2
- package/dist/{signer-GRIYBA22.js → signer-P5D7Y72U.js} +4 -4
- package/dist/snapshots/index.cjs.map +1 -1
- package/dist/snapshots/index.d.cts +6 -6
- package/dist/snapshots/index.d.ts +6 -6
- package/dist/snapshots/index.js +3 -3
- package/dist/{stale-LZYMMDDS.js → stale-JH67FU57.js} +2 -2
- package/dist/{state-vault-QFJWU23A.js → state-vault-TMXZRTY5.js} +3 -3
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +6 -6
- package/dist/store/index.d.ts +6 -6
- package/dist/store/index.js +2 -2
- package/dist/{strategy-CrS7PnbE.d.ts → strategy-CbneC7bS.d.cts} +1 -1
- package/dist/{strategy-CrS7PnbE.d.cts → strategy-CbneC7bS.d.ts} +1 -1
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +5 -5
- package/dist/sync/index.d.ts +5 -5
- package/dist/sync/index.js +3 -3
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +6 -6
- package/dist/team/index.d.ts +6 -6
- package/dist/team/index.js +7 -7
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +6 -6
- package/dist/tx/index.d.ts +6 -6
- package/dist/tx/index.js +3 -3
- package/dist/{types-pax34sec.d.ts → types-4t1-tWS4.d.ts} +77 -9
- package/dist/{types-CDwSSXiI.d.cts → types-BpPV5uyy.d.cts} +77 -9
- package/dist/{ulid-7bCSgIgb.d.cts → ulid-CiPrpGqm.d.cts} +1 -1
- package/dist/{ulid-C_t4hL3d.d.ts → ulid-DAfenvFd.d.ts} +1 -1
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{vault-group-UO4YUZOG.js → vault-group-KOM7QRJG.js} +125 -11
- package/dist/vault-group-KOM7QRJG.js.map +1 -0
- package/dist/{with-derivation-D8wFlb6V.d.cts → with-derivation-DBqJB3dQ.d.cts} +1 -1
- package/dist/{with-derivation-BjdOxUBn.d.ts → with-derivation-OK9M2sJE.d.ts} +1 -1
- package/dist/{with-materialized-view-DJb-HO65.d.ts → with-materialized-view-Dt-ufPWQ.d.ts} +1 -1
- package/dist/{with-materialized-view-5QMF1rS_.d.cts → with-materialized-view-NzuxYPDF.d.cts} +1 -1
- package/dist/{with-overlayed-view-DDNflPvC.d.cts → with-overlayed-view-CC0_ocy-.d.cts} +1 -1
- package/dist/{with-overlayed-view-CkqTefbz.d.ts → with-overlayed-view-eDvMs6LO.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-4YDZ7JPZ.js.map +0 -1
- package/dist/chunk-NJMKHRQI.js.map +0 -1
- package/dist/chunk-P5MW7BG2.js.map +0 -1
- package/dist/chunk-TV3YZ35S.js +0 -90
- package/dist/chunk-TV3YZ35S.js.map +0 -1
- package/dist/chunk-YWBHS25M.js.map +0 -1
- package/dist/executor-AVJ7UEWA.js +0 -8
- package/dist/executor-IQO3KGXQ.js +0 -11
- package/dist/executor-VT7TKGE4.js +0 -8
- package/dist/issue-ZH27C23Y.js +0 -12
- package/dist/noydb-O76SKBST.js +0 -35
- package/dist/registry-2PKBQDCH.js +0 -8
- package/dist/registry-4VXFKCBJ.js +0 -8
- package/dist/vault-group-UO4YUZOG.js.map +0 -1
- /package/dist/{chunk-SJ24GHID.js.map → chunk-4TBBMHVC.js.map} +0 -0
- /package/dist/{chunk-HQXOEWLZ.js.map → chunk-56DJ7JVK.js.map} +0 -0
- /package/dist/{chunk-KKB42D3Q.js.map → chunk-5LQG6ZO2.js.map} +0 -0
- /package/dist/{chunk-TDECYU4Y.js.map → chunk-6AJBSQU4.js.map} +0 -0
- /package/dist/{chunk-O2JW656W.js.map → chunk-6RR3MNMG.js.map} +0 -0
- /package/dist/{chunk-7TEI2K2A.js.map → chunk-7HT2MEZ5.js.map} +0 -0
- /package/dist/{chunk-WQKZIQIL.js.map → chunk-7PS7EOCF.js.map} +0 -0
- /package/dist/{chunk-C3WRKABE.js.map → chunk-A5ZOOZFB.js.map} +0 -0
- /package/dist/{chunk-5NISHSBO.js.map → chunk-AAVWKNZW.js.map} +0 -0
- /package/dist/{chunk-SOU42FGB.js.map → chunk-BIYRQQV6.js.map} +0 -0
- /package/dist/{chunk-ILWQGTNH.js.map → chunk-BQ65SS5A.js.map} +0 -0
- /package/dist/{chunk-CWFQTAD4.js.map → chunk-C5T5AFWN.js.map} +0 -0
- /package/dist/{chunk-SYSKC237.js.map → chunk-COFPAMX6.js.map} +0 -0
- /package/dist/{chunk-D5Y3HIC6.js.map → chunk-CZI2A4MQ.js.map} +0 -0
- /package/dist/{chunk-KJF7EPUE.js.map → chunk-DKO2QFSA.js.map} +0 -0
- /package/dist/{chunk-QFYVGJLI.js.map → chunk-DQU36Q7I.js.map} +0 -0
- /package/dist/{chunk-NIUXQDWD.js.map → chunk-EGD5DXFT.js.map} +0 -0
- /package/dist/{chunk-KHQ3N5AB.js.map → chunk-F4OJZIWQ.js.map} +0 -0
- /package/dist/{chunk-3OUCWHV6.js.map → chunk-FWPKCXTN.js.map} +0 -0
- /package/dist/{chunk-QIVFGU2M.js.map → chunk-HOR4R722.js.map} +0 -0
- /package/dist/{chunk-NP6EZT44.js.map → chunk-IQLVUT37.js.map} +0 -0
- /package/dist/{chunk-4VCQH32J.js.map → chunk-JD3OZAI4.js.map} +0 -0
- /package/dist/{chunk-J67BP5EP.js.map → chunk-KI6HAJWL.js.map} +0 -0
- /package/dist/{chunk-AYNF7PVX.js.map → chunk-KIP6JLTF.js.map} +0 -0
- /package/dist/{chunk-PW26DAXS.js.map → chunk-L2FE64BU.js.map} +0 -0
- /package/dist/{chunk-QAWCVWCX.js.map → chunk-LX3CB26H.js.map} +0 -0
- /package/dist/{chunk-VAK6NQAK.js.map → chunk-NSCVNK5K.js.map} +0 -0
- /package/dist/{chunk-3XZRRBFW.js.map → chunk-OHVFWCJP.js.map} +0 -0
- /package/dist/{chunk-TEQGXA7L.js.map → chunk-PE4AQGFH.js.map} +0 -0
- /package/dist/{chunk-UNQEWORI.js.map → chunk-TS26M2SB.js.map} +0 -0
- /package/dist/{chunk-FNVFT4HZ.js.map → chunk-VU7SWWT5.js.map} +0 -0
- /package/dist/{chunk-GZJ5JBED.js.map → chunk-WBAYSNUQ.js.map} +0 -0
- /package/dist/{chunk-HHZ77DHM.js.map → chunk-WGHU7BLI.js.map} +0 -0
- /package/dist/{chunk-GL3Z7LH7.js.map → chunk-X73VS74Y.js.map} +0 -0
- /package/dist/{chunk-WIBHRONM.js.map → chunk-XWH4MXIU.js.map} +0 -0
- /package/dist/{chunk-M6KXHRIA.js.map → chunk-YHPM5D7Y.js.map} +0 -0
- /package/dist/{chunk-E3DIBDKA.js.map → chunk-YULZKK4F.js.map} +0 -0
- /package/dist/{chunk-JWFNOD2T.js.map → chunk-Z4DO7YSI.js.map} +0 -0
- /package/dist/{chunk-JPOQMXGT.js.map → chunk-ZNQYHJXX.js.map} +0 -0
- /package/dist/{crypto-YXH6SAOW.js.map → crypto-QXQOHMHF.js.map} +0 -0
- /package/dist/{delegation-K5ERUH6A.js.map → delegation-NIQ43IPU.js.map} +0 -0
- /package/dist/{executor-AVJ7UEWA.js.map → executor-6ZDSDZ6V.js.map} +0 -0
- /package/dist/{executor-IQO3KGXQ.js.map → executor-HSSRXDOB.js.map} +0 -0
- /package/dist/{executor-VT7TKGE4.js.map → executor-IDZDAFNH.js.map} +0 -0
- /package/dist/{issue-ZH27C23Y.js.map → issue-ADVS4OVP.js.map} +0 -0
- /package/dist/{ledger-64TTQMRS.js.map → ledger-CWSE3BLF.js.map} +0 -0
- /package/dist/{noydb-O76SKBST.js.map → noydb-GZGFBA4E.js.map} +0 -0
- /package/dist/{public-envelope-MHG6YVXW.js.map → public-envelope-SYHEYQ3X.js.map} +0 -0
- /package/dist/{registry-2PKBQDCH.js.map → registry-DK5YWAAA.js.map} +0 -0
- /package/dist/{registry-4VXFKCBJ.js.map → registry-IUZQVVBB.js.map} +0 -0
- /package/dist/{registry-PV4G3OPA.js.map → registry-XGLNADIE.js.map} +0 -0
- /package/dist/{revoke-5BOLVJ3N.js.map → revoke-ZDFKMR5E.js.map} +0 -0
- /package/dist/{signer-GRIYBA22.js.map → signer-P5D7Y72U.js.map} +0 -0
- /package/dist/{stale-LZYMMDDS.js.map → stale-JH67FU57.js.map} +0 -0
- /package/dist/{state-vault-QFJWU23A.js.map → state-vault-TMXZRTY5.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureCollectionDEK
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-A5ZOOZFB.js";
|
|
4
4
|
import {
|
|
5
5
|
envelopePayloadHash
|
|
6
6
|
} from "./chunk-Z6FNBOTC.js";
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
decrypt,
|
|
12
12
|
encrypt
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YULZKK4F.js";
|
|
14
14
|
import {
|
|
15
15
|
DictKeyMissingError,
|
|
16
16
|
LocaleNotSpecifiedError,
|
|
17
17
|
MissingTranslationError,
|
|
18
18
|
PermissionDeniedError
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-535SSHBS.js";
|
|
20
20
|
|
|
21
21
|
// src/i18n/policy.ts
|
|
22
22
|
function resolvePolicy(onMissing, layer) {
|
|
@@ -586,4 +586,4 @@ export {
|
|
|
586
586
|
isDictKeyDescriptor,
|
|
587
587
|
DictionaryHandle
|
|
588
588
|
};
|
|
589
|
-
//# sourceMappingURL=chunk-
|
|
589
|
+
//# sourceMappingURL=chunk-7HT2MEZ5.js.map
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
decrypt,
|
|
6
6
|
encrypt
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YULZKK4F.js";
|
|
8
8
|
import {
|
|
9
9
|
ConflictError
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-535SSHBS.js";
|
|
11
11
|
|
|
12
12
|
// src/attestation/signer.ts
|
|
13
13
|
import { generateDocSigningKeyPair } from "@noy-db/attestation";
|
|
@@ -54,4 +54,4 @@ export {
|
|
|
54
54
|
loadSigner,
|
|
55
55
|
loadOrCreateSigner
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-7PS7EOCF.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
generateSalt,
|
|
13
13
|
unwrapKey,
|
|
14
14
|
wrapKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YULZKK4F.js";
|
|
16
16
|
import {
|
|
17
17
|
ConflictError,
|
|
18
18
|
DirectoryDisabledError,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
PermissionDeniedError,
|
|
25
25
|
PrivilegeEscalationError,
|
|
26
26
|
ValidationError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-535SSHBS.js";
|
|
28
28
|
|
|
29
29
|
// src/directory/storage.ts
|
|
30
30
|
var META_COLLECTION = "_meta";
|
|
@@ -894,4 +894,4 @@ export {
|
|
|
894
894
|
hasImportCapability,
|
|
895
895
|
evaluateImportCapability
|
|
896
896
|
};
|
|
897
|
-
//# sourceMappingURL=chunk-
|
|
897
|
+
//# sourceMappingURL=chunk-A5ZOOZFB.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ScriptViolationError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-535SSHBS.js";
|
|
4
4
|
|
|
5
5
|
// src/i18n/script.ts
|
|
6
6
|
var LATIN_BASE = /* @__PURE__ */ new Set([
|
|
@@ -136,4 +136,4 @@ export {
|
|
|
136
136
|
inferScripts,
|
|
137
137
|
enforceScript
|
|
138
138
|
};
|
|
139
|
-
//# sourceMappingURL=chunk-
|
|
139
|
+
//# sourceMappingURL=chunk-AAVWKNZW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ATTESTATIONS_COLLECTION,
|
|
3
3
|
loadOrCreateSigner
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7PS7EOCF.js";
|
|
5
5
|
import {
|
|
6
6
|
generateULID
|
|
7
7
|
} from "./chunk-FZU343FL.js";
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
} from "./chunk-GC4V7RU7.js";
|
|
11
11
|
import {
|
|
12
12
|
encrypt
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YULZKK4F.js";
|
|
14
14
|
import {
|
|
15
15
|
AttestationError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-535SSHBS.js";
|
|
17
17
|
|
|
18
18
|
// src/attestation/issue.ts
|
|
19
19
|
import {
|
|
@@ -56,4 +56,4 @@ async function issueAttestationCore(ctx, args) {
|
|
|
56
56
|
export {
|
|
57
57
|
issueAttestationCore
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-BIYRQQV6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ReadOnlyFrameError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-535SSHBS.js";
|
|
4
4
|
|
|
5
5
|
// src/shadow/vault-frame.ts
|
|
6
6
|
var VaultFrame = class {
|
|
@@ -76,4 +76,4 @@ export {
|
|
|
76
76
|
VaultFrame,
|
|
77
77
|
CollectionFrame
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
79
|
+
//# sourceMappingURL=chunk-BQ65SS5A.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
wrapDbWithPredicates
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5LQG6ZO2.js";
|
|
4
4
|
import {
|
|
5
5
|
canonicalGroupKey,
|
|
6
6
|
groupAndReduce
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3EWXMOK3.js";
|
|
8
8
|
import {
|
|
9
9
|
MaterializedViewTooLargeError
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-535SSHBS.js";
|
|
11
11
|
|
|
12
12
|
// src/materialized-views/executor.ts
|
|
13
13
|
var DEFAULT_MAX_ROWS = 1e5;
|
|
@@ -144,4 +144,4 @@ async function listOutputIds(outputColl) {
|
|
|
144
144
|
export {
|
|
145
145
|
MaterializedViewExecutor
|
|
146
146
|
};
|
|
147
|
-
//# sourceMappingURL=chunk-
|
|
147
|
+
//# sourceMappingURL=chunk-C5T5AFWN.js.map
|
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NoydbError
|
|
3
|
+
} from "./chunk-535SSHBS.js";
|
|
4
|
+
|
|
5
|
+
// src/money/iso4217.ts
|
|
6
|
+
var MINOR_UNITS = {
|
|
7
|
+
// 2-decimal majors
|
|
8
|
+
EUR: 2,
|
|
9
|
+
USD: 2,
|
|
10
|
+
GBP: 2,
|
|
11
|
+
CHF: 2,
|
|
12
|
+
CAD: 2,
|
|
13
|
+
AUD: 2,
|
|
14
|
+
NZD: 2,
|
|
15
|
+
SGD: 2,
|
|
16
|
+
HKD: 2,
|
|
17
|
+
CNY: 2,
|
|
18
|
+
INR: 2,
|
|
19
|
+
BRL: 2,
|
|
20
|
+
MXN: 2,
|
|
21
|
+
ZAR: 2,
|
|
22
|
+
RUB: 2,
|
|
23
|
+
TRY: 2,
|
|
24
|
+
PLN: 2,
|
|
25
|
+
SEK: 2,
|
|
26
|
+
NOK: 2,
|
|
27
|
+
DKK: 2,
|
|
28
|
+
CZK: 2,
|
|
29
|
+
HUF: 2,
|
|
30
|
+
RON: 2,
|
|
31
|
+
ILS: 2,
|
|
32
|
+
THB: 2,
|
|
33
|
+
PHP: 2,
|
|
34
|
+
MYR: 2,
|
|
35
|
+
IDR: 2,
|
|
36
|
+
AED: 2,
|
|
37
|
+
SAR: 2,
|
|
38
|
+
QAR: 2,
|
|
39
|
+
EGP: 2,
|
|
40
|
+
// 0-decimal
|
|
41
|
+
JPY: 0,
|
|
42
|
+
KRW: 0,
|
|
43
|
+
ISK: 0,
|
|
44
|
+
CLP: 0,
|
|
45
|
+
VND: 0,
|
|
46
|
+
XOF: 0,
|
|
47
|
+
XAF: 0,
|
|
48
|
+
PYG: 0,
|
|
49
|
+
// 3-decimal
|
|
50
|
+
BHD: 3,
|
|
51
|
+
KWD: 3,
|
|
52
|
+
OMR: 3,
|
|
53
|
+
TND: 3,
|
|
54
|
+
JOD: 3,
|
|
55
|
+
IQD: 3,
|
|
56
|
+
LYD: 3
|
|
57
|
+
};
|
|
58
|
+
function scaleForCurrency(code) {
|
|
59
|
+
const v = MINOR_UNITS[code];
|
|
60
|
+
return v === void 0 ? null : v;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/money/descriptor.ts
|
|
64
|
+
var MoneyPrecisionError = class extends NoydbError {
|
|
65
|
+
constructor(field, value, scale) {
|
|
66
|
+
super(
|
|
67
|
+
"MONEY_PRECISION",
|
|
68
|
+
`money: value ${JSON.stringify(value)} for field "${field}" exceeds scale ${scale} and no rounding mode is configured`
|
|
69
|
+
);
|
|
70
|
+
this.field = field;
|
|
71
|
+
this.value = value;
|
|
72
|
+
this.scale = scale;
|
|
73
|
+
this.name = "MoneyPrecisionError";
|
|
74
|
+
}
|
|
75
|
+
field;
|
|
76
|
+
value;
|
|
77
|
+
scale;
|
|
78
|
+
};
|
|
79
|
+
var MoneyCurrencyError = class extends NoydbError {
|
|
80
|
+
constructor(currency, reason, field) {
|
|
81
|
+
super(
|
|
82
|
+
"MONEY_CURRENCY",
|
|
83
|
+
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`
|
|
84
|
+
);
|
|
85
|
+
this.currency = currency;
|
|
86
|
+
this.reason = reason;
|
|
87
|
+
this.field = field;
|
|
88
|
+
this.name = "MoneyCurrencyError";
|
|
89
|
+
}
|
|
90
|
+
currency;
|
|
91
|
+
reason;
|
|
92
|
+
field;
|
|
93
|
+
};
|
|
94
|
+
var MoneyUnsupportedError = class extends NoydbError {
|
|
95
|
+
constructor(field, message) {
|
|
96
|
+
super(
|
|
97
|
+
"MONEY_UNSUPPORTED",
|
|
98
|
+
message ?? `money: operation is not supported on field "${field}" \u2014 use sum() and count() and divide at the boundary`
|
|
99
|
+
);
|
|
100
|
+
this.field = field;
|
|
101
|
+
this.name = "MoneyUnsupportedError";
|
|
102
|
+
}
|
|
103
|
+
field;
|
|
104
|
+
};
|
|
105
|
+
function isMultiOptions(o) {
|
|
106
|
+
return "currencies" in o;
|
|
107
|
+
}
|
|
108
|
+
function money(options) {
|
|
109
|
+
const hasFixed = "currency" in options;
|
|
110
|
+
const hasMulti = "currencies" in options;
|
|
111
|
+
if (hasFixed && hasMulti) {
|
|
112
|
+
throw new TypeError("money: `currency` and `currencies` are mutually exclusive");
|
|
113
|
+
}
|
|
114
|
+
if (!hasFixed && !hasMulti) {
|
|
115
|
+
throw new TypeError("money: one of `currency` or `currencies` is required");
|
|
116
|
+
}
|
|
117
|
+
const rounding = options.rounding;
|
|
118
|
+
if (isMultiOptions(options)) {
|
|
119
|
+
const overrides = options.scaleOverrides ?? {};
|
|
120
|
+
const allowList = options.currencies;
|
|
121
|
+
const allows = (c) => allowList === "any" ? true : allowList.includes(c);
|
|
122
|
+
const scaleFor = (c) => {
|
|
123
|
+
if (!allows(c)) throw new MoneyCurrencyError(c, "not-allowed");
|
|
124
|
+
const s = overrides[c] ?? scaleForCurrency(c);
|
|
125
|
+
if (s === null || s === void 0) throw new MoneyCurrencyError(c, "unknown-scale");
|
|
126
|
+
return s;
|
|
127
|
+
};
|
|
128
|
+
if (allowList !== "any") for (const c of allowList) scaleFor(c);
|
|
129
|
+
const soleCurrency = () => allowList !== "any" && allowList.length === 1 ? allowList[0] : void 0;
|
|
130
|
+
return {
|
|
131
|
+
_noydbMoney: true,
|
|
132
|
+
mode: "multi",
|
|
133
|
+
options,
|
|
134
|
+
rounding,
|
|
135
|
+
fixedCurrency: void 0,
|
|
136
|
+
scaleFor,
|
|
137
|
+
allows,
|
|
138
|
+
soleCurrency
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const currency = options.currency;
|
|
142
|
+
const resolvedScale = options.scale ?? scaleForCurrency(currency);
|
|
143
|
+
if (resolvedScale === null || resolvedScale === void 0) {
|
|
144
|
+
throw new MoneyCurrencyError(currency, "unknown-scale");
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
_noydbMoney: true,
|
|
148
|
+
mode: "fixed",
|
|
149
|
+
options,
|
|
150
|
+
rounding,
|
|
151
|
+
fixedCurrency: currency,
|
|
152
|
+
scaleFor(c) {
|
|
153
|
+
if (c !== currency) throw new MoneyCurrencyError(c, "not-allowed");
|
|
154
|
+
return resolvedScale;
|
|
155
|
+
},
|
|
156
|
+
allows: (c) => c === currency,
|
|
157
|
+
soleCurrency: () => currency
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function isMoneyDescriptor(x) {
|
|
161
|
+
return typeof x === "object" && x !== null && x._noydbMoney === true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/money/fixed-point.ts
|
|
165
|
+
function expandExponent(s) {
|
|
166
|
+
const m = /^([+-]?)(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/.exec(s);
|
|
167
|
+
if (!m) return s;
|
|
168
|
+
const sign = m[1] === "-" ? "-" : "";
|
|
169
|
+
const intp = m[2];
|
|
170
|
+
const frac = m[3] ?? "";
|
|
171
|
+
const exp = Number(m[4]);
|
|
172
|
+
const digits = intp + frac;
|
|
173
|
+
const pointPos = intp.length + exp;
|
|
174
|
+
let body;
|
|
175
|
+
if (pointPos <= 0) {
|
|
176
|
+
body = "0." + "0".repeat(-pointPos) + digits;
|
|
177
|
+
} else if (pointPos >= digits.length) {
|
|
178
|
+
body = digits + "0".repeat(pointPos - digits.length);
|
|
179
|
+
} else {
|
|
180
|
+
body = digits.slice(0, pointPos) + "." + digits.slice(pointPos);
|
|
181
|
+
}
|
|
182
|
+
return sign + body;
|
|
183
|
+
}
|
|
184
|
+
function toCanonicalDecimalString(input) {
|
|
185
|
+
let s;
|
|
186
|
+
if (typeof input === "number") {
|
|
187
|
+
if (!Number.isFinite(input)) return null;
|
|
188
|
+
s = String(input);
|
|
189
|
+
} else {
|
|
190
|
+
s = input.trim();
|
|
191
|
+
}
|
|
192
|
+
s = expandExponent(s);
|
|
193
|
+
if (s.startsWith("+")) s = s.slice(1);
|
|
194
|
+
if (!/^-?(\d+(\.\d*)?|\.\d+)$/.test(s)) return null;
|
|
195
|
+
return s;
|
|
196
|
+
}
|
|
197
|
+
function shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, mode) {
|
|
198
|
+
switch (mode) {
|
|
199
|
+
case "up":
|
|
200
|
+
return true;
|
|
201
|
+
case "down":
|
|
202
|
+
return false;
|
|
203
|
+
case "ceil":
|
|
204
|
+
return !negative;
|
|
205
|
+
case "floor":
|
|
206
|
+
return negative;
|
|
207
|
+
case "half-up":
|
|
208
|
+
return firstDiscarded >= 5;
|
|
209
|
+
case "half-down":
|
|
210
|
+
return firstDiscarded > 5 || firstDiscarded === 5 && hasMoreNonZeroAfterFirst;
|
|
211
|
+
case "half-even":
|
|
212
|
+
if (firstDiscarded > 5) return true;
|
|
213
|
+
if (firstDiscarded < 5) return false;
|
|
214
|
+
return hasMoreNonZeroAfterFirst || lastKeptDigit % 2 === 1;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function parseToScaledInt(input, scale, rounding) {
|
|
218
|
+
const canonical = toCanonicalDecimalString(input);
|
|
219
|
+
if (canonical === null) return { ok: false, reason: "nonfinite" };
|
|
220
|
+
const negative = canonical.startsWith("-");
|
|
221
|
+
const unsigned = negative ? canonical.slice(1) : canonical;
|
|
222
|
+
const dot = unsigned.indexOf(".");
|
|
223
|
+
const intPart = dot === -1 ? unsigned : unsigned.slice(0, dot);
|
|
224
|
+
const fracPart = dot === -1 ? "" : unsigned.slice(dot + 1);
|
|
225
|
+
const intDigits = intPart === "" ? "0" : intPart;
|
|
226
|
+
if (fracPart.length <= scale) {
|
|
227
|
+
const keep2 = fracPart.padEnd(scale, "0");
|
|
228
|
+
const magnitude2 = BigInt(intDigits + keep2);
|
|
229
|
+
return { ok: true, value: negative && magnitude2 !== 0n ? -magnitude2 : magnitude2 };
|
|
230
|
+
}
|
|
231
|
+
const keep = fracPart.slice(0, scale);
|
|
232
|
+
const tail = fracPart.slice(scale);
|
|
233
|
+
const magnitudeDigits = intDigits + keep;
|
|
234
|
+
let magnitude = BigInt(magnitudeDigits);
|
|
235
|
+
if (/^0+$/.test(tail)) {
|
|
236
|
+
return { ok: true, value: negative && magnitude !== 0n ? -magnitude : magnitude };
|
|
237
|
+
}
|
|
238
|
+
if (rounding === void 0) return { ok: false, reason: "precision" };
|
|
239
|
+
const lastKeptDigit = Number(magnitudeDigits[magnitudeDigits.length - 1]);
|
|
240
|
+
const firstDiscarded = Number(tail[0]);
|
|
241
|
+
const hasMoreNonZeroAfterFirst = /[1-9]/.test(tail.slice(1));
|
|
242
|
+
if (shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, rounding)) {
|
|
243
|
+
magnitude += 1n;
|
|
244
|
+
}
|
|
245
|
+
return { ok: true, value: negative && magnitude !== 0n ? -magnitude : magnitude };
|
|
246
|
+
}
|
|
247
|
+
function decimalScaleOf(input) {
|
|
248
|
+
const s = toCanonicalDecimalString(input);
|
|
249
|
+
if (s === null) return null;
|
|
250
|
+
const dot = s.indexOf(".");
|
|
251
|
+
return dot === -1 ? 0 : s.length - dot - 1;
|
|
252
|
+
}
|
|
253
|
+
function rescaleScaledInt(value, fromScale, toScale, rounding = "half-up") {
|
|
254
|
+
if (toScale >= fromScale) return value * 10n ** BigInt(toScale - fromScale);
|
|
255
|
+
const drop = fromScale - toScale;
|
|
256
|
+
const negative = value < 0n;
|
|
257
|
+
const absStr = (negative ? -value : value).toString().padStart(drop + 1, "0");
|
|
258
|
+
const keptStr = absStr.slice(0, absStr.length - drop);
|
|
259
|
+
const tail = absStr.slice(absStr.length - drop);
|
|
260
|
+
let magnitude = BigInt(keptStr);
|
|
261
|
+
if (!/^0+$/.test(tail)) {
|
|
262
|
+
const lastKeptDigit = Number(keptStr[keptStr.length - 1]);
|
|
263
|
+
const firstDiscarded = Number(tail[0]);
|
|
264
|
+
const hasMoreNonZeroAfterFirst = /[1-9]/.test(tail.slice(1));
|
|
265
|
+
if (shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAfterFirst, rounding)) {
|
|
266
|
+
magnitude += 1n;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return negative && magnitude !== 0n ? -magnitude : magnitude;
|
|
270
|
+
}
|
|
271
|
+
function formatScaledInt(value, scale) {
|
|
272
|
+
const negative = value < 0n;
|
|
273
|
+
const abs = (negative ? -value : value).toString();
|
|
274
|
+
if (scale === 0) return (negative ? "-" : "") + abs;
|
|
275
|
+
const padded = abs.padStart(scale + 1, "0");
|
|
276
|
+
const cut = padded.length - scale;
|
|
277
|
+
const intPart = padded.slice(0, cut);
|
|
278
|
+
const fracPart = padded.slice(cut);
|
|
279
|
+
return (negative ? "-" : "") + intPart + "." + fracPart;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// src/money/where.ts
|
|
283
|
+
function isMoneyValueObject(v) {
|
|
284
|
+
return typeof v === "object" && v !== null && "currency" in v;
|
|
285
|
+
}
|
|
286
|
+
function parseOperand(field, raw, desc) {
|
|
287
|
+
let amount;
|
|
288
|
+
let currency;
|
|
289
|
+
if (desc.mode === "fixed") {
|
|
290
|
+
currency = desc.fixedCurrency;
|
|
291
|
+
amount = raw;
|
|
292
|
+
} else if (isMoneyValueObject(raw)) {
|
|
293
|
+
currency = String(raw.currency);
|
|
294
|
+
amount = raw.amount;
|
|
295
|
+
} else {
|
|
296
|
+
const sole = desc.soleCurrency();
|
|
297
|
+
if (sole === void 0) {
|
|
298
|
+
throw new MoneyUnsupportedError(
|
|
299
|
+
`where("${field}"): field is multi-currency \u2014 compare against { amount, currency }, not a bare amount`
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
currency = sole;
|
|
303
|
+
amount = raw;
|
|
304
|
+
}
|
|
305
|
+
if (typeof amount !== "number" && typeof amount !== "string") {
|
|
306
|
+
throw new MoneyUnsupportedError(
|
|
307
|
+
`where("${field}"): operand ${JSON.stringify(raw)} is not a money amount`
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
const r = parseToScaledInt(amount, desc.scaleFor(currency), desc.rounding);
|
|
311
|
+
if (!r.ok) {
|
|
312
|
+
throw new MoneyUnsupportedError(
|
|
313
|
+
`where("${field}"): operand ${JSON.stringify(amount)} is not a finite decimal`
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
return { scaled: r.value.toString(), currency };
|
|
317
|
+
}
|
|
318
|
+
function moneyFieldClause(field, op, value, desc) {
|
|
319
|
+
switch (op) {
|
|
320
|
+
case "==":
|
|
321
|
+
case "!=":
|
|
322
|
+
case "<":
|
|
323
|
+
case "<=":
|
|
324
|
+
case ">":
|
|
325
|
+
case ">=": {
|
|
326
|
+
const e = parseOperand(field, value, desc);
|
|
327
|
+
return withMoney(field, op, value, desc, [e]);
|
|
328
|
+
}
|
|
329
|
+
case "between": {
|
|
330
|
+
if (!Array.isArray(value) || value.length !== 2) {
|
|
331
|
+
throw new MoneyUnsupportedError(`where("${field}"): 'between' needs a [lo, hi] tuple`);
|
|
332
|
+
}
|
|
333
|
+
const lo = parseOperand(field, value[0], desc);
|
|
334
|
+
const hi = parseOperand(field, value[1], desc);
|
|
335
|
+
if (lo.currency !== hi.currency) {
|
|
336
|
+
throw new MoneyUnsupportedError(
|
|
337
|
+
`where("${field}"): 'between' bounds mix currencies (${lo.currency} vs ${hi.currency})`
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
return withMoney(field, op, value, desc, [lo, hi]);
|
|
341
|
+
}
|
|
342
|
+
case "in": {
|
|
343
|
+
if (!Array.isArray(value)) {
|
|
344
|
+
throw new MoneyUnsupportedError(`where("${field}"): 'in' needs an array of amounts`);
|
|
345
|
+
}
|
|
346
|
+
return withMoney(field, op, value, desc, value.map((v) => parseOperand(field, v, desc)));
|
|
347
|
+
}
|
|
348
|
+
default:
|
|
349
|
+
throw new MoneyUnsupportedError(
|
|
350
|
+
`where("${field}"): operator '${op}' is not supported on a money field`
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function withMoney(field, op, originalValue, desc, entries) {
|
|
355
|
+
const money2 = { mode: desc.mode, entries };
|
|
356
|
+
const value = desc.mode !== "fixed" ? originalValue : entries.length === 1 && op !== "in" && op !== "between" ? entries[0].scaled : entries.map((e) => e.scaled);
|
|
357
|
+
return { type: "field", field, op, value, money: money2 };
|
|
358
|
+
}
|
|
359
|
+
function readStored(actual, operand) {
|
|
360
|
+
let amount;
|
|
361
|
+
let currency;
|
|
362
|
+
if (operand.mode === "fixed") {
|
|
363
|
+
if (typeof actual !== "string" && typeof actual !== "number") return null;
|
|
364
|
+
amount = actual;
|
|
365
|
+
currency = operand.entries[0]?.currency ?? "";
|
|
366
|
+
} else {
|
|
367
|
+
if (!isMoneyValueObject(actual)) return null;
|
|
368
|
+
if (typeof actual.currency !== "string") return null;
|
|
369
|
+
amount = actual.amount;
|
|
370
|
+
currency = actual.currency;
|
|
371
|
+
}
|
|
372
|
+
if (typeof amount !== "string" && typeof amount !== "number") return null;
|
|
373
|
+
try {
|
|
374
|
+
return { scaled: BigInt(amount).toString(), currency };
|
|
375
|
+
} catch {
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function evaluateMoneyClause(actual, op, operand) {
|
|
380
|
+
const stored = readStored(actual, operand);
|
|
381
|
+
if (stored === null) return op === "!=";
|
|
382
|
+
const a = BigInt(stored.scaled);
|
|
383
|
+
if (op === "in") {
|
|
384
|
+
return operand.entries.some(
|
|
385
|
+
(e2) => e2.currency === stored.currency && BigInt(e2.scaled) === a
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
if (op === "between") {
|
|
389
|
+
const [lo, hi] = operand.entries;
|
|
390
|
+
if (!lo || !hi || lo.currency !== stored.currency) return false;
|
|
391
|
+
return a >= BigInt(lo.scaled) && a <= BigInt(hi.scaled);
|
|
392
|
+
}
|
|
393
|
+
const e = operand.entries[0];
|
|
394
|
+
if (!e) return false;
|
|
395
|
+
if (e.currency !== stored.currency) return op === "!=";
|
|
396
|
+
const b = BigInt(e.scaled);
|
|
397
|
+
switch (op) {
|
|
398
|
+
case "==":
|
|
399
|
+
return a === b;
|
|
400
|
+
case "!=":
|
|
401
|
+
return a !== b;
|
|
402
|
+
case "<":
|
|
403
|
+
return a < b;
|
|
404
|
+
case "<=":
|
|
405
|
+
return a <= b;
|
|
406
|
+
case ">":
|
|
407
|
+
return a > b;
|
|
408
|
+
case ">=":
|
|
409
|
+
return a >= b;
|
|
410
|
+
default:
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// src/query/predicate.ts
|
|
416
|
+
function readPath(record, path) {
|
|
417
|
+
if (record === null || record === void 0) return void 0;
|
|
418
|
+
if (!path.includes(".")) {
|
|
419
|
+
return record[path];
|
|
420
|
+
}
|
|
421
|
+
const segments = path.split(".");
|
|
422
|
+
let cursor = record;
|
|
423
|
+
for (const segment of segments) {
|
|
424
|
+
if (cursor === null || cursor === void 0) return void 0;
|
|
425
|
+
cursor = cursor[segment];
|
|
426
|
+
}
|
|
427
|
+
return cursor;
|
|
428
|
+
}
|
|
429
|
+
function evaluateFieldClause(record, clause) {
|
|
430
|
+
const actual = readPath(record, clause.field);
|
|
431
|
+
const { op, value } = clause;
|
|
432
|
+
if (clause.money) return evaluateMoneyClause(actual, op, clause.money);
|
|
433
|
+
switch (op) {
|
|
434
|
+
case "==":
|
|
435
|
+
return actual === value;
|
|
436
|
+
case "!=":
|
|
437
|
+
return actual !== value;
|
|
438
|
+
case "<":
|
|
439
|
+
return isComparable(actual, value) && actual < value;
|
|
440
|
+
case "<=":
|
|
441
|
+
return isComparable(actual, value) && actual <= value;
|
|
442
|
+
case ">":
|
|
443
|
+
return isComparable(actual, value) && actual > value;
|
|
444
|
+
case ">=":
|
|
445
|
+
return isComparable(actual, value) && actual >= value;
|
|
446
|
+
case "in":
|
|
447
|
+
return Array.isArray(value) && value.includes(actual);
|
|
448
|
+
case "contains":
|
|
449
|
+
if (typeof actual === "string") return typeof value === "string" && actual.includes(value);
|
|
450
|
+
if (Array.isArray(actual)) return actual.includes(value);
|
|
451
|
+
return false;
|
|
452
|
+
case "startsWith":
|
|
453
|
+
return typeof actual === "string" && typeof value === "string" && actual.startsWith(value);
|
|
454
|
+
case "between": {
|
|
455
|
+
if (!Array.isArray(value) || value.length !== 2) return false;
|
|
456
|
+
const [lo, hi] = value;
|
|
457
|
+
if (!isComparable(actual, lo) || !isComparable(actual, hi)) return false;
|
|
458
|
+
return actual >= lo && actual <= hi;
|
|
459
|
+
}
|
|
460
|
+
default: {
|
|
461
|
+
const _exhaustive = op;
|
|
462
|
+
void _exhaustive;
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function isComparable(a, b) {
|
|
468
|
+
if (typeof a === "number" && typeof b === "number") return true;
|
|
469
|
+
if (typeof a === "string" && typeof b === "string") return true;
|
|
470
|
+
if (a instanceof Date && b instanceof Date) return true;
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
function evaluateClause(record, clause, fnRecord) {
|
|
474
|
+
switch (clause.type) {
|
|
475
|
+
case "field":
|
|
476
|
+
return evaluateFieldClause(record, clause);
|
|
477
|
+
case "filter":
|
|
478
|
+
return clause.fn(fnRecord !== void 0 ? fnRecord : record);
|
|
479
|
+
case "wherePredicate":
|
|
480
|
+
return clause.fn(fnRecord !== void 0 ? fnRecord : record, clause.ctx);
|
|
481
|
+
case "crossJoin":
|
|
482
|
+
throw new Error(
|
|
483
|
+
`evaluateClause: 'crossJoin' clauses are expansion primitives and are not evaluated per-record. This is a query planner routing error \u2014 crossJoin clauses must be extracted from the clause list before calling evaluateClause or filterRecords.`
|
|
484
|
+
);
|
|
485
|
+
case "group":
|
|
486
|
+
if (clause.op === "and") {
|
|
487
|
+
for (const child of clause.clauses) {
|
|
488
|
+
if (!evaluateClause(record, child, fnRecord)) return false;
|
|
489
|
+
}
|
|
490
|
+
return true;
|
|
491
|
+
} else {
|
|
492
|
+
for (const child of clause.clauses) {
|
|
493
|
+
if (evaluateClause(record, child, fnRecord)) return true;
|
|
494
|
+
}
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
function hasFnClause(clauses) {
|
|
500
|
+
for (const c of clauses) {
|
|
501
|
+
if (c.type === "filter" || c.type === "wherePredicate") return true;
|
|
502
|
+
if (c.type === "group" && hasFnClause(c.clauses)) return true;
|
|
503
|
+
}
|
|
504
|
+
return false;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export {
|
|
508
|
+
parseToScaledInt,
|
|
509
|
+
decimalScaleOf,
|
|
510
|
+
rescaleScaledInt,
|
|
511
|
+
formatScaledInt,
|
|
512
|
+
scaleForCurrency,
|
|
513
|
+
MoneyPrecisionError,
|
|
514
|
+
MoneyCurrencyError,
|
|
515
|
+
MoneyUnsupportedError,
|
|
516
|
+
money,
|
|
517
|
+
isMoneyDescriptor,
|
|
518
|
+
moneyFieldClause,
|
|
519
|
+
readPath,
|
|
520
|
+
evaluateFieldClause,
|
|
521
|
+
evaluateClause,
|
|
522
|
+
hasFnClause
|
|
523
|
+
};
|
|
524
|
+
//# sourceMappingURL=chunk-CJORTUJ2.js.map
|