@noy-db/hub 0.2.0-pre.17 → 0.2.0-pre.19
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 +227 -3
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +3 -3
- package/dist/aggregate/index.d.ts +3 -3
- package/dist/aggregate/index.js +5 -4
- package/dist/aggregate/index.js.map +1 -1
- 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 +6 -6
- package/dist/blobs/index.cjs +4 -10
- 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 +6 -6
- package/dist/bundle/index.cjs +1587 -392
- 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 +10 -10
- package/dist/{chunk-NBBMMJ2H.js → chunk-3FSMVWBN.js} +4 -4
- package/dist/{chunk-HGVSHKZW.js → chunk-3Q2AOPLT.js} +100 -29
- package/dist/chunk-3Q2AOPLT.js.map +1 -0
- package/dist/{chunk-SHX5QBCI.js → chunk-4ULLGYPA.js} +3 -3
- package/dist/{chunk-CD2AVTEM.js → chunk-5IGWRMEC.js} +5 -5
- package/dist/{chunk-QO6RGLLD.js → chunk-6KESZO5D.js} +35 -7
- package/dist/chunk-6KESZO5D.js.map +1 -0
- package/dist/{chunk-GP3SDSH2.js → chunk-6OSOE6BY.js} +15 -2
- package/dist/chunk-6OSOE6BY.js.map +1 -0
- package/dist/{chunk-F4G63NTZ.js → chunk-7C6VFNIY.js} +2 -2
- package/dist/{chunk-XJV6OB4D.js → chunk-7HD67R6U.js} +2 -2
- package/dist/{chunk-UMLVJTYV.js → chunk-ADB7GPM3.js} +7 -4
- package/dist/chunk-ADB7GPM3.js.map +1 -0
- package/dist/{chunk-NYSYPFXJ.js → chunk-B6E5IRPJ.js} +3 -3
- package/dist/chunk-CYNTFU2D.js +129 -0
- package/dist/chunk-CYNTFU2D.js.map +1 -0
- package/dist/{chunk-ZEGSDPB7.js → chunk-DJF3FXW5.js} +35 -1
- package/dist/chunk-DJF3FXW5.js.map +1 -0
- package/dist/{chunk-3G3W65EQ.js → chunk-DY3EOJEN.js} +2 -2
- package/dist/{chunk-YYVZYTWW.js → chunk-E66DSTJP.js} +3 -3
- package/dist/{chunk-5LIROIDM.js → chunk-FBLAWK6A.js} +2 -2
- package/dist/{chunk-E77UKJYL.js → chunk-FPHRTW2Z.js} +5 -5
- package/dist/{state-vault-W2OEABNO.js → chunk-G4PYA575.js} +24 -7
- package/dist/chunk-G4PYA575.js.map +1 -0
- package/dist/{chunk-U5QCMH3W.js → chunk-GKQAU52M.js} +4 -4
- package/dist/{chunk-2FU2FTXD.js → chunk-GYAWXHFO.js} +2 -2
- package/dist/{chunk-ROPJVUG3.js → chunk-H42KZXNV.js} +5 -210
- package/dist/chunk-H42KZXNV.js.map +1 -0
- package/dist/{chunk-XPIHJ34I.js → chunk-IBVTH4JR.js} +4 -4
- package/dist/{chunk-C3HYQPV4.js → chunk-IVP5IVON.js} +2 -2
- package/dist/{chunk-BL5GYANC.js → chunk-KEDJDWWQ.js} +3 -3
- package/dist/{chunk-I5IUYN7B.js → chunk-KNKNOJFS.js} +3 -3
- package/dist/chunk-KNKNOJFS.js.map +1 -0
- package/dist/{chunk-D77ZQSQQ.js → chunk-KYGGXXT6.js} +829 -170
- package/dist/chunk-KYGGXXT6.js.map +1 -0
- package/dist/{chunk-J7RWBXFY.js → chunk-LSIIPKYT.js} +2 -2
- package/dist/{chunk-BSZOCSDZ.js → chunk-M3FPNTO2.js} +4 -4
- package/dist/{chunk-XMVHEWF6.js → chunk-MI36HL5G.js} +4 -4
- package/dist/{chunk-ROVO6NPJ.js → chunk-NN6IISZO.js} +58 -3
- package/dist/chunk-NN6IISZO.js.map +1 -0
- package/dist/{chunk-7H2GEJ3O.js → chunk-OBMYMKGO.js} +29 -6
- package/dist/{chunk-7H2GEJ3O.js.map → chunk-OBMYMKGO.js.map} +1 -1
- package/dist/{chunk-UNTGHX5A.js → chunk-OKOKPYWH.js} +2 -2
- package/dist/{chunk-WV7WV6JO.js → chunk-OY7RX2VL.js} +9 -15
- package/dist/chunk-OY7RX2VL.js.map +1 -0
- package/dist/{chunk-H2MRGONI.js → chunk-PTGQPWMV.js} +2 -2
- package/dist/{chunk-BJSLBUJ7.js → chunk-PWFTQHYX.js} +2 -2
- package/dist/{chunk-5AXTH4QZ.js → chunk-Q5MCHUXZ.js} +2 -2
- package/dist/{chunk-QHM6XEAH.js → chunk-S22UOMHM.js} +6 -6
- package/dist/{chunk-WIAOUFFB.js → chunk-S3XA7G35.js} +2 -2
- package/dist/{chunk-SISBMAPO.js → chunk-SHIUFIPW.js} +1 -1
- package/dist/chunk-SHIUFIPW.js.map +1 -0
- package/dist/{chunk-KCEHMDZF.js → chunk-U7JNBSS3.js} +3 -3
- package/dist/{chunk-ZNGPEV5J.js → chunk-V3VIRTTE.js} +3 -3
- package/dist/{chunk-TIDXB5DF.js → chunk-V5FZWQNN.js} +4 -4
- package/dist/chunk-VEIVAYJ7.js +361 -0
- package/dist/chunk-VEIVAYJ7.js.map +1 -0
- package/dist/{chunk-AEIKD3PP.js → chunk-VNUE6FHP.js} +3 -3
- package/dist/{chunk-DYYYUW5D.js → chunk-WFK2EVYU.js} +10 -2
- package/dist/chunk-WFK2EVYU.js.map +1 -0
- package/dist/{chunk-XMHUK5PN.js → chunk-X7FJMKT3.js} +2 -2
- package/dist/{chunk-FEJDVE3Z.js → chunk-XPH3FWME.js} +7 -2
- package/dist/{chunk-FEJDVE3Z.js.map → chunk-XPH3FWME.js.map} +1 -1
- package/dist/{chunk-SNMJ7SB3.js → chunk-Y5J63SMF.js} +5 -5
- package/dist/{chunk-M476FOQ7.js → chunk-YLRRU72W.js} +2 -2
- package/dist/{chunk-DWEBTE2W.js → chunk-YX333DPS.js} +4 -4
- package/dist/{chunk-BH3X5L6A.js → chunk-YZE6C3TQ.js} +3 -3
- 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-7BN2HDWG.js → crypto-B46VNH6X.js} +3 -3
- package/dist/{delegation-MGH5SODX.js → delegation-5HON72PV.js} +5 -5
- package/dist/derivations/index.cjs +82 -2
- 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 +8 -6
- package/dist/{dev-unlock-iXbYFAWl.d.cts → dev-unlock-BR1rMOS-.d.cts} +1 -1
- package/dist/{dev-unlock-CI1ijTML.d.ts → dev-unlock-whL49sxV.d.ts} +1 -1
- package/dist/{errors-Dz64FA65.d.cts → errors-DL-zTrrF.d.cts} +29 -1
- package/dist/{errors-Dz64FA65.d.ts → errors-DL-zTrrF.d.ts} +29 -1
- package/dist/executor-44R5CUS2.js +12 -0
- package/dist/executor-AOACUK7Z.js +8 -0
- package/dist/executor-OKFLQCDW.js +8 -0
- package/dist/{fanout-sidecar-FIJJ46YG.js → fanout-sidecar-DCQWJQ6S.js} +2 -2
- package/dist/forget/index.cjs.map +1 -1
- package/dist/forget/index.d.cts +1 -1
- package/dist/forget/index.d.ts +1 -1
- package/dist/forget/index.js +4 -4
- package/dist/guards/index.cjs +80 -3
- 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 +8 -4
- package/dist/{hash-tEcM5fnv.d.cts → hash-BEUBmmI4.d.cts} +1 -1
- package/dist/{hash-blk7Bkes.d.ts → hash-Dtb7FwWd.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 +5 -5
- package/dist/i18n/index.cjs +149 -132
- 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 +14 -14
- package/dist/{index-u-kWzSrL.d.cts → index-BM7O48Ur.d.cts} +85 -9
- package/dist/{index-C-SSRIxP.d.cts → index-BMmajblo.d.cts} +14 -0
- package/dist/{index-C-SSRIxP.d.ts → index-BMmajblo.d.ts} +14 -0
- package/dist/{index-DpU6KWof.d.ts → index-BelbyUwz.d.ts} +85 -9
- package/dist/index.cjs +2206 -992
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -16
- package/dist/index.d.ts +29 -16
- package/dist/index.js +76 -54
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.js +4 -4
- package/dist/issue-EPA2PSWP.js +12 -0
- package/dist/{ledger-LFVLHE5H.js → ledger-LS6GXCBP.js} +5 -5
- package/dist/materialized-views/index.cjs +257 -4
- 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 +8 -7
- package/dist/noydb-BVKFP74P.js +38 -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 +5 -5
- package/dist/{public-envelope-RXZNP3V6.js → public-envelope-AGU6SS4Z.js} +4 -4
- package/dist/query/index.cjs +320 -28
- 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 +7 -6
- package/dist/read-only-facade-EX6WZZBP.js +7 -0
- package/dist/registry-ERNAMRDE.js +8 -0
- package/dist/registry-EXTHSXQW.js +8 -0
- package/dist/{registry-SECUWSGY.js → registry-RDPTFXQ7.js} +3 -3
- package/dist/{revoke-B54H2S2W.js → revoke-IFLXEZA5.js} +6 -6
- package/dist/sealed-record/index.cjs.map +1 -1
- package/dist/sealed-record/index.d.cts +1 -1
- package/dist/sealed-record/index.d.ts +1 -1
- package/dist/sealed-record/index.js +2 -2
- 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-YSXZT574.js → signer-UNWOUJAK.js} +5 -5
- 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 +4 -4
- package/dist/{stale-TOA36SRK.js → stale-NTEV5SLX.js} +2 -2
- package/dist/state-vault-TUTFRTOA.js +14 -0
- package/dist/state-vault-TUTFRTOA.js.map +1 -0
- package/dist/store/index.cjs +8 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +13 -6
- package/dist/store/index.d.ts +13 -6
- package/dist/store/index.js +2 -2
- package/dist/{strategy-4M9jo172.d.ts → strategy-BDxQnnTX.d.ts} +315 -4
- package/dist/{strategy-CLC1j79g.d.cts → strategy-C5ol6NdV.d.cts} +315 -4
- 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 +4 -4
- 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 +8 -8
- package/dist/transition-guard-B1N82hMf.d.cts +165 -0
- package/dist/transition-guard-C__YeF3_.d.ts +165 -0
- 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-CljIHm_J.d.ts → types-CraiZOyO.d.ts} +609 -305
- package/dist/{types-CrSpRDuG.d.cts → types-D-gr5t0G.d.cts} +609 -305
- package/dist/{ulid-CrI7PPbA.d.cts → ulid-DQnSAP5W.d.cts} +1 -1
- package/dist/{ulid-CWfL2Vfv.d.ts → ulid-FFRRHkVf.d.ts} +1 -1
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{vault-group-DHAHFX2A.js → vault-group-27EV7KB4.js} +205 -8
- package/dist/vault-group-27EV7KB4.js.map +1 -0
- package/dist/{with-materialized-view-NzF71cG_.d.cts → with-materialized-view-BboqxyV3.d.cts} +1 -1
- package/dist/{with-materialized-view-B892zYZV.d.ts → with-materialized-view-CguCeVcT.d.ts} +1 -1
- package/dist/{with-overlayed-view-CR6m7CHe.d.ts → with-overlayed-view-DO08u_tx.d.ts} +1 -1
- package/dist/{with-overlayed-view-UI8qSGL4.d.cts → with-overlayed-view-mmsg5Of3.d.cts} +1 -1
- package/dist/with-rollup-_TyBzz3T.d.ts +47 -0
- package/dist/with-rollup-aaxOZcIb.d.cts +47 -0
- package/package.json +3 -3
- package/dist/chunk-D77ZQSQQ.js.map +0 -1
- package/dist/chunk-DYYYUW5D.js.map +0 -1
- package/dist/chunk-GP3SDSH2.js.map +0 -1
- package/dist/chunk-HGVSHKZW.js.map +0 -1
- package/dist/chunk-I5IUYN7B.js.map +0 -1
- package/dist/chunk-JDWE6JMX.js +0 -139
- package/dist/chunk-JDWE6JMX.js.map +0 -1
- package/dist/chunk-PDULVIBY.js +0 -63
- package/dist/chunk-PDULVIBY.js.map +0 -1
- package/dist/chunk-QO6RGLLD.js.map +0 -1
- package/dist/chunk-ROPJVUG3.js.map +0 -1
- package/dist/chunk-ROVO6NPJ.js.map +0 -1
- package/dist/chunk-SISBMAPO.js.map +0 -1
- package/dist/chunk-UMLVJTYV.js.map +0 -1
- package/dist/chunk-WV7WV6JO.js.map +0 -1
- package/dist/chunk-ZEGSDPB7.js.map +0 -1
- package/dist/executor-3W63Y44O.js +0 -11
- package/dist/executor-CFFWPWBJ.js +0 -8
- package/dist/executor-VDQQOR4F.js +0 -8
- package/dist/immutable-guard-B5M95nbq.d.ts +0 -82
- package/dist/immutable-guard-qN3zF8o1.d.cts +0 -82
- package/dist/issue-TTMGHQ2J.js +0 -12
- package/dist/noydb-36S6GQNC.js +0 -37
- package/dist/read-only-facade-ITU6L7BL.js +0 -7
- package/dist/registry-3YFLZ7WD.js +0 -8
- package/dist/registry-TGZISEWC.js +0 -8
- package/dist/state-vault-W2OEABNO.js.map +0 -1
- package/dist/vault-group-DHAHFX2A.js.map +0 -1
- package/dist/with-derivation-BZ2y4bzF.d.ts +0 -13
- package/dist/with-derivation-Bozs8DmD.d.cts +0 -13
- /package/dist/{chunk-NBBMMJ2H.js.map → chunk-3FSMVWBN.js.map} +0 -0
- /package/dist/{chunk-SHX5QBCI.js.map → chunk-4ULLGYPA.js.map} +0 -0
- /package/dist/{chunk-CD2AVTEM.js.map → chunk-5IGWRMEC.js.map} +0 -0
- /package/dist/{chunk-F4G63NTZ.js.map → chunk-7C6VFNIY.js.map} +0 -0
- /package/dist/{chunk-XJV6OB4D.js.map → chunk-7HD67R6U.js.map} +0 -0
- /package/dist/{chunk-NYSYPFXJ.js.map → chunk-B6E5IRPJ.js.map} +0 -0
- /package/dist/{chunk-3G3W65EQ.js.map → chunk-DY3EOJEN.js.map} +0 -0
- /package/dist/{chunk-YYVZYTWW.js.map → chunk-E66DSTJP.js.map} +0 -0
- /package/dist/{chunk-5LIROIDM.js.map → chunk-FBLAWK6A.js.map} +0 -0
- /package/dist/{chunk-E77UKJYL.js.map → chunk-FPHRTW2Z.js.map} +0 -0
- /package/dist/{chunk-U5QCMH3W.js.map → chunk-GKQAU52M.js.map} +0 -0
- /package/dist/{chunk-2FU2FTXD.js.map → chunk-GYAWXHFO.js.map} +0 -0
- /package/dist/{chunk-XPIHJ34I.js.map → chunk-IBVTH4JR.js.map} +0 -0
- /package/dist/{chunk-C3HYQPV4.js.map → chunk-IVP5IVON.js.map} +0 -0
- /package/dist/{chunk-BL5GYANC.js.map → chunk-KEDJDWWQ.js.map} +0 -0
- /package/dist/{chunk-J7RWBXFY.js.map → chunk-LSIIPKYT.js.map} +0 -0
- /package/dist/{chunk-BSZOCSDZ.js.map → chunk-M3FPNTO2.js.map} +0 -0
- /package/dist/{chunk-XMVHEWF6.js.map → chunk-MI36HL5G.js.map} +0 -0
- /package/dist/{chunk-UNTGHX5A.js.map → chunk-OKOKPYWH.js.map} +0 -0
- /package/dist/{chunk-H2MRGONI.js.map → chunk-PTGQPWMV.js.map} +0 -0
- /package/dist/{chunk-BJSLBUJ7.js.map → chunk-PWFTQHYX.js.map} +0 -0
- /package/dist/{chunk-5AXTH4QZ.js.map → chunk-Q5MCHUXZ.js.map} +0 -0
- /package/dist/{chunk-QHM6XEAH.js.map → chunk-S22UOMHM.js.map} +0 -0
- /package/dist/{chunk-WIAOUFFB.js.map → chunk-S3XA7G35.js.map} +0 -0
- /package/dist/{chunk-KCEHMDZF.js.map → chunk-U7JNBSS3.js.map} +0 -0
- /package/dist/{chunk-ZNGPEV5J.js.map → chunk-V3VIRTTE.js.map} +0 -0
- /package/dist/{chunk-TIDXB5DF.js.map → chunk-V5FZWQNN.js.map} +0 -0
- /package/dist/{chunk-AEIKD3PP.js.map → chunk-VNUE6FHP.js.map} +0 -0
- /package/dist/{chunk-XMHUK5PN.js.map → chunk-X7FJMKT3.js.map} +0 -0
- /package/dist/{chunk-SNMJ7SB3.js.map → chunk-Y5J63SMF.js.map} +0 -0
- /package/dist/{chunk-M476FOQ7.js.map → chunk-YLRRU72W.js.map} +0 -0
- /package/dist/{chunk-DWEBTE2W.js.map → chunk-YX333DPS.js.map} +0 -0
- /package/dist/{chunk-BH3X5L6A.js.map → chunk-YZE6C3TQ.js.map} +0 -0
- /package/dist/{crypto-7BN2HDWG.js.map → crypto-B46VNH6X.js.map} +0 -0
- /package/dist/{delegation-MGH5SODX.js.map → delegation-5HON72PV.js.map} +0 -0
- /package/dist/{executor-3W63Y44O.js.map → executor-44R5CUS2.js.map} +0 -0
- /package/dist/{executor-CFFWPWBJ.js.map → executor-AOACUK7Z.js.map} +0 -0
- /package/dist/{executor-VDQQOR4F.js.map → executor-OKFLQCDW.js.map} +0 -0
- /package/dist/{fanout-sidecar-FIJJ46YG.js.map → fanout-sidecar-DCQWJQ6S.js.map} +0 -0
- /package/dist/{issue-TTMGHQ2J.js.map → issue-EPA2PSWP.js.map} +0 -0
- /package/dist/{ledger-LFVLHE5H.js.map → ledger-LS6GXCBP.js.map} +0 -0
- /package/dist/{noydb-36S6GQNC.js.map → noydb-BVKFP74P.js.map} +0 -0
- /package/dist/{public-envelope-RXZNP3V6.js.map → public-envelope-AGU6SS4Z.js.map} +0 -0
- /package/dist/{read-only-facade-ITU6L7BL.js.map → read-only-facade-EX6WZZBP.js.map} +0 -0
- /package/dist/{registry-3YFLZ7WD.js.map → registry-ERNAMRDE.js.map} +0 -0
- /package/dist/{registry-SECUWSGY.js.map → registry-EXTHSXQW.js.map} +0 -0
- /package/dist/{registry-TGZISEWC.js.map → registry-RDPTFXQ7.js.map} +0 -0
- /package/dist/{revoke-B54H2S2W.js.map → revoke-IFLXEZA5.js.map} +0 -0
- /package/dist/{signer-YSXZT574.js.map → signer-UNWOUJAK.js.map} +0 -0
- /package/dist/{stale-TOA36SRK.js.map → stale-NTEV5SLX.js.map} +0 -0
package/dist/periods/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a4 as PeriodsStrategy } from '../types-D-gr5t0G.cjs';
|
|
2
|
+
export { a5 as CarryForwardContext, a6 as ClosePeriodOptions, a7 as OpenPeriodOptions, a8 as PERIODS_COLLECTION, a9 as PeriodRecord, aa as ReadOnlyCollection, ab as appendPeriodLedgerEntry, ac as assertTsWritable, ad as chainAnchor, ae as loadPeriods, af as validatePeriodName } from '../types-D-gr5t0G.cjs';
|
|
3
3
|
import '../lazy-builder-eYZzLEL1.cjs';
|
|
4
4
|
import '../predicate-BmhBSPCH.cjs';
|
|
5
|
-
import '../strategy-
|
|
6
|
-
import '../errors-
|
|
5
|
+
import '../strategy-C5ol6NdV.cjs';
|
|
6
|
+
import '../errors-DL-zTrrF.cjs';
|
|
7
7
|
import '../strategy-BSxFXGzb.cjs';
|
|
8
|
-
import '../index-
|
|
9
|
-
import '../index-
|
|
8
|
+
import '../index-BMmajblo.cjs';
|
|
9
|
+
import '../index-BM7O48Ur.cjs';
|
|
10
10
|
import '@noy-db/attestation';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/periods/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a4 as PeriodsStrategy } from '../types-CraiZOyO.js';
|
|
2
|
+
export { a5 as CarryForwardContext, a6 as ClosePeriodOptions, a7 as OpenPeriodOptions, a8 as PERIODS_COLLECTION, a9 as PeriodRecord, aa as ReadOnlyCollection, ab as appendPeriodLedgerEntry, ac as assertTsWritable, ad as chainAnchor, ae as loadPeriods, af as validatePeriodName } from '../types-CraiZOyO.js';
|
|
3
3
|
import '../lazy-builder-ChSqcF5t.js';
|
|
4
4
|
import '../predicate-BmhBSPCH.js';
|
|
5
|
-
import '../strategy-
|
|
6
|
-
import '../errors-
|
|
5
|
+
import '../strategy-BDxQnnTX.js';
|
|
6
|
+
import '../errors-DL-zTrrF.js';
|
|
7
7
|
import '../strategy-BSxFXGzb.js';
|
|
8
|
-
import '../index-
|
|
9
|
-
import '../index-
|
|
8
|
+
import '../index-BMmajblo.js';
|
|
9
|
+
import '../index-BelbyUwz.js';
|
|
10
10
|
import '@noy-db/attestation';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/periods/index.js
CHANGED
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
loadPeriods,
|
|
7
7
|
validatePeriodName,
|
|
8
8
|
withPeriods
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-YZE6C3TQ.js";
|
|
10
10
|
import "../chunk-UF3BUNQZ.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-YX333DPS.js";
|
|
12
12
|
import "../chunk-PDVP3C2I.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-SHIUFIPW.js";
|
|
14
|
+
import "../chunk-OKOKPYWH.js";
|
|
15
|
+
import "../chunk-DJF3FXW5.js";
|
|
16
16
|
export {
|
|
17
17
|
PERIODS_COLLECTION,
|
|
18
18
|
appendPeriodLedgerEntry,
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
resolveLocale,
|
|
13
13
|
savePublicEnvelope,
|
|
14
14
|
validatePublicEnvelopeInput
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-E66DSTJP.js";
|
|
16
|
+
import "./chunk-SHIUFIPW.js";
|
|
17
|
+
import "./chunk-DJF3FXW5.js";
|
|
18
18
|
export {
|
|
19
19
|
DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
|
|
20
20
|
PUBLIC_ENVELOPE_FIELDS,
|
|
@@ -28,4 +28,4 @@ export {
|
|
|
28
28
|
savePublicEnvelope,
|
|
29
29
|
validatePublicEnvelopeInput
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=public-envelope-
|
|
31
|
+
//# sourceMappingURL=public-envelope-AGU6SS4Z.js.map
|
package/dist/query/index.cjs
CHANGED
|
@@ -275,6 +275,18 @@ var IndexWriteFailureError = class extends NoydbError {
|
|
|
275
275
|
this.cause = args.cause;
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
|
+
var LocaleNotSpecifiedError = class extends NoydbError {
|
|
279
|
+
/** The field name that required a locale. */
|
|
280
|
+
field;
|
|
281
|
+
constructor(field, message) {
|
|
282
|
+
super(
|
|
283
|
+
"LOCALE_NOT_SPECIFIED",
|
|
284
|
+
message ?? `Cannot read i18nText field "${field}" without a locale. Pass { locale } to get()/list()/query() or set a default via openVault(name, { locale }).`
|
|
285
|
+
);
|
|
286
|
+
this.name = "LocaleNotSpecifiedError";
|
|
287
|
+
this.field = field;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
278
290
|
var JoinTooLargeError = class extends NoydbError {
|
|
279
291
|
leftRows;
|
|
280
292
|
rightRows;
|
|
@@ -568,6 +580,198 @@ function hasFnClause(clauses) {
|
|
|
568
580
|
return false;
|
|
569
581
|
}
|
|
570
582
|
|
|
583
|
+
// src/i18n/policy.ts
|
|
584
|
+
function resolvePolicy(onMissing, layer) {
|
|
585
|
+
const explicit = onMissing && typeof onMissing === "object" ? onMissing[layer] : void 0;
|
|
586
|
+
const scalar = typeof onMissing === "string" ? onMissing : void 0;
|
|
587
|
+
const layerDefault = layer === "guard" ? "substitute" : void 0;
|
|
588
|
+
return explicit ?? layerDefault ?? scalar ?? "throw";
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// src/i18n/script.ts
|
|
592
|
+
var LATIN_BASE = /* @__PURE__ */ new Set([
|
|
593
|
+
"en",
|
|
594
|
+
"fr",
|
|
595
|
+
"de",
|
|
596
|
+
"es",
|
|
597
|
+
"it",
|
|
598
|
+
"pt",
|
|
599
|
+
"nl",
|
|
600
|
+
"sv",
|
|
601
|
+
"no",
|
|
602
|
+
"da",
|
|
603
|
+
"fi",
|
|
604
|
+
"is",
|
|
605
|
+
"pl",
|
|
606
|
+
"cs",
|
|
607
|
+
"sk",
|
|
608
|
+
"hu",
|
|
609
|
+
"ro",
|
|
610
|
+
"hr",
|
|
611
|
+
"sl",
|
|
612
|
+
"et",
|
|
613
|
+
"lv",
|
|
614
|
+
"lt",
|
|
615
|
+
"tr",
|
|
616
|
+
"vi",
|
|
617
|
+
"id",
|
|
618
|
+
"ms",
|
|
619
|
+
"tl",
|
|
620
|
+
"sw",
|
|
621
|
+
"af",
|
|
622
|
+
"ca",
|
|
623
|
+
"gl",
|
|
624
|
+
"eu",
|
|
625
|
+
"cy",
|
|
626
|
+
"ga"
|
|
627
|
+
]);
|
|
628
|
+
var SCRIPT_TABLE = {
|
|
629
|
+
th: ["Thai"],
|
|
630
|
+
ko: ["Hangul", "Han"],
|
|
631
|
+
ja: ["Han", "Hiragana", "Katakana"],
|
|
632
|
+
zh: ["Han"],
|
|
633
|
+
ar: ["Arabic"],
|
|
634
|
+
fa: ["Arabic"],
|
|
635
|
+
ur: ["Arabic"],
|
|
636
|
+
ru: ["Cyrillic"],
|
|
637
|
+
uk: ["Cyrillic"],
|
|
638
|
+
bg: ["Cyrillic"],
|
|
639
|
+
sr: ["Cyrillic"],
|
|
640
|
+
he: ["Hebrew"],
|
|
641
|
+
el: ["Greek"],
|
|
642
|
+
hi: ["Devanagari"],
|
|
643
|
+
ta: ["Tamil"],
|
|
644
|
+
km: ["Khmer"],
|
|
645
|
+
lo: ["Lao"],
|
|
646
|
+
my: ["Myanmar"]
|
|
647
|
+
};
|
|
648
|
+
var SUBTAG_SCRIPTS = {
|
|
649
|
+
Latn: ["Latin"],
|
|
650
|
+
Cyrl: ["Cyrillic", "Latin"],
|
|
651
|
+
Hans: ["Han", "Latin"],
|
|
652
|
+
Hant: ["Han", "Latin"],
|
|
653
|
+
Thai: ["Thai", "Latin"],
|
|
654
|
+
Arab: ["Arabic", "Latin"]
|
|
655
|
+
};
|
|
656
|
+
function inferScripts(locale) {
|
|
657
|
+
const parts = locale.split("-");
|
|
658
|
+
const subtag = parts.find((t) => /^[A-Z][a-z]{3}$/.test(t));
|
|
659
|
+
if (subtag && SUBTAG_SCRIPTS[subtag]) return SUBTAG_SCRIPTS[subtag];
|
|
660
|
+
const base = (parts[0] ?? "").toLowerCase();
|
|
661
|
+
if (LATIN_BASE.has(base)) return ["Latin"];
|
|
662
|
+
const primary = SCRIPT_TABLE[base];
|
|
663
|
+
if (primary) return [...primary, "Latin"];
|
|
664
|
+
return ["Latin"];
|
|
665
|
+
}
|
|
666
|
+
var BASELINE = String.raw`\p{White_Space}\p{Script=Common}\p{Script=Inherited}\p{Mark}`;
|
|
667
|
+
|
|
668
|
+
// src/i18n/core.ts
|
|
669
|
+
function toChain(fallback) {
|
|
670
|
+
return Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
|
|
671
|
+
}
|
|
672
|
+
function pickFromChain(value, chain) {
|
|
673
|
+
for (const fb of chain) {
|
|
674
|
+
if (fb === "any") {
|
|
675
|
+
const any = Object.values(value).find((v) => v !== "");
|
|
676
|
+
if (any !== void 0) return any;
|
|
677
|
+
} else if (value[fb] !== void 0 && value[fb] !== "") {
|
|
678
|
+
return value[fb];
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return void 0;
|
|
682
|
+
}
|
|
683
|
+
function resolveI18nText(value, locale, fallback, field, opts) {
|
|
684
|
+
if (locale === "raw") {
|
|
685
|
+
return value;
|
|
686
|
+
}
|
|
687
|
+
if (!locale) {
|
|
688
|
+
throw new LocaleNotSpecifiedError(field ?? "<unknown>");
|
|
689
|
+
}
|
|
690
|
+
if (value[locale] !== void 0 && value[locale] !== "") {
|
|
691
|
+
return value[locale];
|
|
692
|
+
}
|
|
693
|
+
const policy = opts?.policy ?? "throw";
|
|
694
|
+
const callerChain = toChain(fallback);
|
|
695
|
+
const callerHit = pickFromChain(value, callerChain);
|
|
696
|
+
if (callerHit !== void 0) return callerHit;
|
|
697
|
+
if (policy === "substitute") {
|
|
698
|
+
const subHit = pickFromChain(value, toChain(opts?.substitute));
|
|
699
|
+
if (subHit !== void 0) return subHit;
|
|
700
|
+
if (opts?.smartSubstitute) {
|
|
701
|
+
const smartHit = pickNearestScript(value, locale);
|
|
702
|
+
if (smartHit !== void 0) return smartHit;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (policy === "throw") {
|
|
706
|
+
throw new LocaleNotSpecifiedError(
|
|
707
|
+
field ?? "<unknown>",
|
|
708
|
+
`No translation available for locale "${locale}"` + (callerChain.length > 0 ? ` or fallback chain [${callerChain.join(", ")}]` : "") + "."
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
return null;
|
|
712
|
+
}
|
|
713
|
+
function pickNearestScript(value, target) {
|
|
714
|
+
const targetScript = inferScripts(target)[0] ?? "Latin";
|
|
715
|
+
let best;
|
|
716
|
+
for (const [loc, v] of Object.entries(value)) {
|
|
717
|
+
if (typeof v !== "string" || v === "") continue;
|
|
718
|
+
const s = inferScripts(loc)[0] ?? "Latin";
|
|
719
|
+
const score = s === targetScript ? 0 : s === "Latin" ? 1 : 2;
|
|
720
|
+
if (best === void 0 || score < best.score) best = { score, v };
|
|
721
|
+
if (score === 0) break;
|
|
722
|
+
}
|
|
723
|
+
return best?.v;
|
|
724
|
+
}
|
|
725
|
+
function applyAtPath(obj, path, locale, fallback, opts) {
|
|
726
|
+
const arrayIdx = path.indexOf("[].");
|
|
727
|
+
if (arrayIdx !== -1) {
|
|
728
|
+
const arrayKey = path.slice(0, arrayIdx);
|
|
729
|
+
const restPath = path.slice(arrayIdx + 3);
|
|
730
|
+
const arr = obj[arrayKey];
|
|
731
|
+
if (!Array.isArray(arr)) return obj;
|
|
732
|
+
return {
|
|
733
|
+
...obj,
|
|
734
|
+
[arrayKey]: arr.map((item) => {
|
|
735
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return item;
|
|
736
|
+
return applyAtPath(item, restPath, locale, fallback, opts);
|
|
737
|
+
})
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
const dotIdx = path.indexOf(".");
|
|
741
|
+
if (dotIdx !== -1) {
|
|
742
|
+
const head = path.slice(0, dotIdx);
|
|
743
|
+
const rest = path.slice(dotIdx + 1);
|
|
744
|
+
const nested = obj[head];
|
|
745
|
+
if (!nested || typeof nested !== "object" || Array.isArray(nested)) return obj;
|
|
746
|
+
return {
|
|
747
|
+
...obj,
|
|
748
|
+
[head]: applyAtPath(nested, rest, locale, fallback, opts)
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
const raw = obj[path];
|
|
752
|
+
if (raw === void 0 || raw === null) return obj;
|
|
753
|
+
if (typeof raw !== "object" || Array.isArray(raw)) return obj;
|
|
754
|
+
return {
|
|
755
|
+
...obj,
|
|
756
|
+
[path]: resolveI18nText(raw, locale, fallback, path, opts)
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
function applyI18nLocale(record, i18nFields, locale, fallback, layer = "read") {
|
|
760
|
+
const fieldNames = Object.keys(i18nFields);
|
|
761
|
+
if (fieldNames.length === 0) return record;
|
|
762
|
+
let result = record;
|
|
763
|
+
for (const [field, descriptor] of Object.entries(i18nFields)) {
|
|
764
|
+
const { onMissing, substitute, smartSubstitute } = descriptor.options;
|
|
765
|
+
const opts = {
|
|
766
|
+
policy: resolvePolicy(onMissing, layer),
|
|
767
|
+
...substitute !== void 0 ? { substitute } : {},
|
|
768
|
+
...smartSubstitute ? { smartSubstitute } : {}
|
|
769
|
+
};
|
|
770
|
+
result = applyAtPath(result, field, locale, fallback, opts);
|
|
771
|
+
}
|
|
772
|
+
return result;
|
|
773
|
+
}
|
|
774
|
+
|
|
571
775
|
// src/query/join.ts
|
|
572
776
|
var DEFAULT_JOIN_MAX_ROWS = 5e4;
|
|
573
777
|
var JOIN_WARN_FRACTION = 0.8;
|
|
@@ -596,15 +800,15 @@ function warnCeilingApproaching(target, side, rows, maxRows) {
|
|
|
596
800
|
`[noy-db] .join() ${side} side is at ${pct}% of the ${maxRows}-row ceiling for target "${target}" (${rows} rows). Streaming joins over scan() are not yet supported for collections that need to exceed this.`
|
|
597
801
|
);
|
|
598
802
|
}
|
|
599
|
-
function applyJoins(rows, joins, context) {
|
|
803
|
+
function applyJoins(rows, joins, context, locale) {
|
|
600
804
|
if (joins.length === 0) return [...rows];
|
|
601
805
|
let result = [...rows];
|
|
602
806
|
for (const leg of joins) {
|
|
603
|
-
result = applyOneJoin(result, leg, context);
|
|
807
|
+
result = applyOneJoin(result, leg, context, locale);
|
|
604
808
|
}
|
|
605
809
|
return result;
|
|
606
810
|
}
|
|
607
|
-
function applyOneJoin(leftRows, leg, context) {
|
|
811
|
+
function applyOneJoin(leftRows, leg, context, locale) {
|
|
608
812
|
if (leg.isDictJoin) {
|
|
609
813
|
const dictSource = context.resolveDictSource?.(leg.field);
|
|
610
814
|
if (!dictSource) {
|
|
@@ -659,24 +863,27 @@ function applyOneJoin(leftRows, leg, context) {
|
|
|
659
863
|
if (rightSnapshot.length > maxRows * JOIN_WARN_FRACTION) {
|
|
660
864
|
warnCeilingApproaching(leg.target, "right", rightSnapshot.length, maxRows);
|
|
661
865
|
}
|
|
866
|
+
const effLocale = locale ?? context.defaultLocale;
|
|
867
|
+
const i18nResolve = effLocale !== void 0 && source.i18nFields !== void 0 ? (right) => right !== null && typeof right === "object" ? applyI18nLocale(right, source.i18nFields, effLocale, void 0, "join") : right : void 0;
|
|
662
868
|
const strategy = leg.strategy ?? (source.lookupById ? "nested" : "hash");
|
|
663
869
|
if (strategy === "nested" && source.lookupById) {
|
|
664
870
|
const lookup = (id) => source.lookupById?.(id);
|
|
665
|
-
return nestedLoopJoin(leftRows, leg, lookup);
|
|
871
|
+
return nestedLoopJoin(leftRows, leg, lookup, i18nResolve);
|
|
666
872
|
}
|
|
667
|
-
return hashJoin(leftRows, leg, rightSnapshot);
|
|
873
|
+
return hashJoin(leftRows, leg, rightSnapshot, i18nResolve);
|
|
668
874
|
}
|
|
669
|
-
function nestedLoopJoin(leftRows, leg, lookupById) {
|
|
875
|
+
function nestedLoopJoin(leftRows, leg, lookupById, i18nResolve) {
|
|
670
876
|
const out = [];
|
|
671
877
|
for (const left of leftRows) {
|
|
672
878
|
const rawId = readPath(left, leg.field);
|
|
673
879
|
const key = coerceRefKey(rawId);
|
|
674
|
-
|
|
880
|
+
let right = key === null ? void 0 : lookupById(key);
|
|
881
|
+
if (i18nResolve && right !== void 0) right = i18nResolve(right);
|
|
675
882
|
out.push(attachJoin(left, leg, right, rawId));
|
|
676
883
|
}
|
|
677
884
|
return out;
|
|
678
885
|
}
|
|
679
|
-
function hashJoin(leftRows, leg, rightSnapshot) {
|
|
886
|
+
function hashJoin(leftRows, leg, rightSnapshot, i18nResolve) {
|
|
680
887
|
const rightMap = /* @__PURE__ */ new Map();
|
|
681
888
|
for (const record of rightSnapshot) {
|
|
682
889
|
const rawId = readPath(record, "id");
|
|
@@ -689,7 +896,8 @@ function hashJoin(leftRows, leg, rightSnapshot) {
|
|
|
689
896
|
for (const left of leftRows) {
|
|
690
897
|
const rawId = readPath(left, leg.field);
|
|
691
898
|
const key = coerceRefKey(rawId);
|
|
692
|
-
|
|
899
|
+
let right = key === null ? void 0 : rightMap.get(key);
|
|
900
|
+
if (i18nResolve && right !== void 0) right = i18nResolve(right);
|
|
693
901
|
out.push(attachJoin(left, leg, right, rawId));
|
|
694
902
|
}
|
|
695
903
|
return out;
|
|
@@ -1110,6 +1318,21 @@ function formatCurrency(decimal, currency, scale, locale) {
|
|
|
1110
1318
|
});
|
|
1111
1319
|
return fmt.format(decimal);
|
|
1112
1320
|
}
|
|
1321
|
+
function moneyScaledValue(stored, desc) {
|
|
1322
|
+
let raw;
|
|
1323
|
+
if (desc.mode === "fixed") {
|
|
1324
|
+
raw = stored;
|
|
1325
|
+
} else {
|
|
1326
|
+
if (!isMoneyValueObject2(stored)) return null;
|
|
1327
|
+
raw = stored.amount;
|
|
1328
|
+
}
|
|
1329
|
+
if (typeof raw !== "string" && typeof raw !== "number") return null;
|
|
1330
|
+
try {
|
|
1331
|
+
return BigInt(String(raw));
|
|
1332
|
+
} catch {
|
|
1333
|
+
return null;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1113
1336
|
function decodeValue(stored, desc) {
|
|
1114
1337
|
let currency;
|
|
1115
1338
|
let scaledIntString;
|
|
@@ -1347,11 +1570,16 @@ var Query = class _Query {
|
|
|
1347
1570
|
this.predicates
|
|
1348
1571
|
);
|
|
1349
1572
|
}
|
|
1350
|
-
/**
|
|
1351
|
-
|
|
1573
|
+
/**
|
|
1574
|
+
* Sort by a field. Subsequent calls are tie-breakers. Pass
|
|
1575
|
+
* `{ by: 'label' }` to sort a `dictKey`/`staticDict` field by its resolved
|
|
1576
|
+
* label at the query locale instead of the stored code (#285).
|
|
1577
|
+
*/
|
|
1578
|
+
orderBy(field, direction = "asc", opts) {
|
|
1579
|
+
const entry = opts?.by === "label" ? { field, direction, by: "label" } : { field, direction };
|
|
1352
1580
|
return new _Query(
|
|
1353
1581
|
this.source,
|
|
1354
|
-
{ ...this.plan, orderBy: [...this.plan.orderBy,
|
|
1582
|
+
{ ...this.plan, orderBy: [...this.plan.orderBy, entry] },
|
|
1355
1583
|
this.joinContext,
|
|
1356
1584
|
this.aggregateStrategy,
|
|
1357
1585
|
this.predicates
|
|
@@ -1554,16 +1782,21 @@ var Query = class _Query {
|
|
|
1554
1782
|
* carries any join legs, they are applied after `where` / `orderBy`
|
|
1555
1783
|
* / `limit` / `offset` narrow the left set. See the `.join()` doc
|
|
1556
1784
|
* for the ordering rationale.
|
|
1785
|
+
*
|
|
1786
|
+
* `opts.locale` (#285 §3) resolves JOINED right-side i18n fields at the
|
|
1787
|
+
* `join` layer to that locale; without it, the owning collection's default
|
|
1788
|
+
* locale applies, and a locale-less query leaves joined i18n fields raw.
|
|
1789
|
+
* (Left/base i18n fields are resolved by `get`/`list`, not here.)
|
|
1557
1790
|
*/
|
|
1558
|
-
toArray() {
|
|
1559
|
-
const base = this.decodeMoney(executePlanWithSource(this.source, this.plan, this.joinContext));
|
|
1791
|
+
toArray(opts) {
|
|
1792
|
+
const base = this.decodeMoney(executePlanWithSource(this.source, this.plan, this.joinContext, opts?.locale));
|
|
1560
1793
|
if (this.plan.joins.length === 0) return base;
|
|
1561
1794
|
if (!this.joinContext) {
|
|
1562
1795
|
throw new Error(
|
|
1563
1796
|
`Query.toArray(): plan carries ${this.plan.joins.length} join leg(s) but no JoinContext is attached. This usually means the Query was constructed via the raw Query constructor with a plan that had joins pre-populated. Use collection.query().join(...) instead.`
|
|
1564
1797
|
);
|
|
1565
1798
|
}
|
|
1566
|
-
return applyJoins(base, this.plan.joins, this.joinContext);
|
|
1799
|
+
return applyJoins(base, this.plan.joins, this.joinContext, opts?.locale);
|
|
1567
1800
|
}
|
|
1568
1801
|
/**
|
|
1569
1802
|
* Decode this source's money fields on read (stored scaled-int → canonical
|
|
@@ -1582,9 +1815,9 @@ var Query = class _Query {
|
|
|
1582
1815
|
if (!moneyFields || Object.keys(moneyFields).length === 0) return records;
|
|
1583
1816
|
return records.map((r) => decodeMoneyFields(r, moneyFields, "raw"));
|
|
1584
1817
|
}
|
|
1585
|
-
/** Return the first matching record, or null. Joins are applied. */
|
|
1586
|
-
first() {
|
|
1587
|
-
const arr = this.limit(1).toArray();
|
|
1818
|
+
/** Return the first matching record, or null. Joins are applied. `opts.locale` resolves joined i18n fields (#285 §3). */
|
|
1819
|
+
first(opts) {
|
|
1820
|
+
const arr = this.limit(1).toArray(opts);
|
|
1588
1821
|
return arr[0] ?? null;
|
|
1589
1822
|
}
|
|
1590
1823
|
/**
|
|
@@ -1827,7 +2060,7 @@ var Query = class _Query {
|
|
|
1827
2060
|
return serializePlan(this.plan);
|
|
1828
2061
|
}
|
|
1829
2062
|
};
|
|
1830
|
-
function executePlanWithSource(source, plan, joinContext) {
|
|
2063
|
+
function executePlanWithSource(source, plan, joinContext, locale) {
|
|
1831
2064
|
const hasCrossJoins = plan.clauses.some((c) => c.type === "crossJoin");
|
|
1832
2065
|
let result;
|
|
1833
2066
|
if (hasCrossJoins) {
|
|
@@ -1842,7 +2075,8 @@ function executePlanWithSource(source, plan, joinContext) {
|
|
|
1842
2075
|
result = remainingClauses.length === 0 ? [...candidates] : filterRecords(candidates, remainingClauses, fnViewDecoder(source));
|
|
1843
2076
|
}
|
|
1844
2077
|
if (plan.orderBy.length > 0) {
|
|
1845
|
-
|
|
2078
|
+
const labelMaps = buildOrderLabelMaps(plan.orderBy, joinContext, locale);
|
|
2079
|
+
result = sortRecords(result, plan.orderBy, source.moneyFields, labelMaps);
|
|
1846
2080
|
}
|
|
1847
2081
|
if (plan.offset > 0) {
|
|
1848
2082
|
result = result.slice(plan.offset);
|
|
@@ -1999,17 +2233,55 @@ function applyCrossJoin(leftRel, clause, rightSource) {
|
|
|
1999
2233
|
}
|
|
2000
2234
|
return expanded;
|
|
2001
2235
|
}
|
|
2002
|
-
function sortRecords(records, orderBy) {
|
|
2236
|
+
function sortRecords(records, orderBy, moneyFields, labelMaps) {
|
|
2003
2237
|
return [...records].sort((a, b) => {
|
|
2004
|
-
for (const { field, direction } of orderBy) {
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
const
|
|
2238
|
+
for (const { field, direction, by } of orderBy) {
|
|
2239
|
+
let av = readField(a, field);
|
|
2240
|
+
let bv = readField(b, field);
|
|
2241
|
+
const labelMap = by === "label" ? labelMaps?.get(field) : void 0;
|
|
2242
|
+
if (labelMap) {
|
|
2243
|
+
av = (typeof av === "string" ? labelMap.get(av) : void 0) ?? av;
|
|
2244
|
+
bv = (typeof bv === "string" ? labelMap.get(bv) : void 0) ?? bv;
|
|
2245
|
+
const cmp2 = compareValues(av, bv);
|
|
2246
|
+
if (cmp2 !== 0) return direction === "asc" ? cmp2 : -cmp2;
|
|
2247
|
+
continue;
|
|
2248
|
+
}
|
|
2249
|
+
const desc = moneyFields?.[field];
|
|
2250
|
+
const cmp = desc ? compareMoney(av, bv, desc) : compareValues(av, bv);
|
|
2008
2251
|
if (cmp !== 0) return direction === "asc" ? cmp : -cmp;
|
|
2009
2252
|
}
|
|
2010
2253
|
return 0;
|
|
2011
2254
|
});
|
|
2012
2255
|
}
|
|
2256
|
+
function buildOrderLabelMaps(orderBy, joinContext, locale) {
|
|
2257
|
+
if (!joinContext?.resolveDictSource) return void 0;
|
|
2258
|
+
const resolveDict = joinContext.resolveDictSource.bind(joinContext);
|
|
2259
|
+
let maps;
|
|
2260
|
+
for (const { field, by } of orderBy) {
|
|
2261
|
+
if (by !== "label") continue;
|
|
2262
|
+
const dictSource = resolveDict(field);
|
|
2263
|
+
if (!dictSource) continue;
|
|
2264
|
+
const loc = locale ?? dictSource.displayLocale;
|
|
2265
|
+
if (loc === void 0) continue;
|
|
2266
|
+
const codeToLabel = /* @__PURE__ */ new Map();
|
|
2267
|
+
for (const entry of dictSource.snapshot()) {
|
|
2268
|
+
const k = entry["key"];
|
|
2269
|
+
const labels = entry["labels"];
|
|
2270
|
+
const label = labels?.[loc];
|
|
2271
|
+
if (typeof k === "string" && typeof label === "string") codeToLabel.set(k, label);
|
|
2272
|
+
}
|
|
2273
|
+
;
|
|
2274
|
+
(maps ??= /* @__PURE__ */ new Map()).set(field, codeToLabel);
|
|
2275
|
+
}
|
|
2276
|
+
return maps;
|
|
2277
|
+
}
|
|
2278
|
+
function compareMoney(a, b, desc) {
|
|
2279
|
+
const av = moneyScaledValue(a, desc);
|
|
2280
|
+
const bv = moneyScaledValue(b, desc);
|
|
2281
|
+
if (av === null) return bv === null ? 0 : 1;
|
|
2282
|
+
if (bv === null) return -1;
|
|
2283
|
+
return av < bv ? -1 : av > bv ? 1 : 0;
|
|
2284
|
+
}
|
|
2013
2285
|
function readField(record, field) {
|
|
2014
2286
|
if (record === null || record === void 0) return void 0;
|
|
2015
2287
|
if (!field.includes(".")) {
|
|
@@ -2631,9 +2903,29 @@ var GroupedAggregation = class {
|
|
|
2631
2903
|
upstreams;
|
|
2632
2904
|
dictLabelResolver;
|
|
2633
2905
|
fields;
|
|
2634
|
-
/**
|
|
2635
|
-
|
|
2636
|
-
|
|
2906
|
+
/**
|
|
2907
|
+
* Execute the query, group, reduce, and return an array of rows.
|
|
2908
|
+
*
|
|
2909
|
+
* `opts` (#285 query-form MV grouping): when a `locale` + `i18nFields` are
|
|
2910
|
+
* given, the declared group-key `i18nText` fields are resolved to that locale
|
|
2911
|
+
* at the `mv` layer BEFORE bucketing — so an i18n group key is a stable string
|
|
2912
|
+
* instead of a raw `{locale}` map. The MV executor passes the MV's
|
|
2913
|
+
* `i18nLocale`/`i18nFields`; ordinary `.run()` callers pass nothing and are
|
|
2914
|
+
* unaffected.
|
|
2915
|
+
*/
|
|
2916
|
+
run(opts) {
|
|
2917
|
+
let records = this.executeRecords();
|
|
2918
|
+
if (opts?.locale !== void 0 && opts.i18nFields !== void 0) {
|
|
2919
|
+
const groupI18n = {};
|
|
2920
|
+
for (const f of this.fields) {
|
|
2921
|
+
const d = opts.i18nFields[f];
|
|
2922
|
+
if (d !== void 0) groupI18n[f] = d;
|
|
2923
|
+
}
|
|
2924
|
+
if (Object.keys(groupI18n).length > 0) {
|
|
2925
|
+
records = records.map((r) => applyI18nLocale(r, groupI18n, opts.locale, void 0, "mv"));
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
return groupAndReduce(records, this.fields, this.spec);
|
|
2637
2929
|
}
|
|
2638
2930
|
/**
|
|
2639
2931
|
* Execute the query, group, reduce, and resolve `<field>Label` for
|