@noy-db/hub 0.2.0-pre.15 → 0.2.0-pre.17
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 +106 -10
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +3 -2
- package/dist/aggregate/index.d.ts +3 -2
- package/dist/aggregate/index.js +4 -4
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +5 -3
- package/dist/attestation/index.d.ts +5 -3
- package/dist/attestation/index.js +6 -6
- package/dist/blobs/index.cjs +226 -11
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +6 -4
- package/dist/blobs/index.d.ts +6 -4
- package/dist/blobs/index.js +6 -5
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.cjs +1268 -141
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +7 -5
- package/dist/bundle/index.d.ts +7 -5
- package/dist/bundle/index.js +21 -10
- package/dist/bundle/index.js.map +1 -1
- package/dist/{chunk-5LQG6ZO2.js → chunk-2FU2FTXD.js} +9 -4
- package/dist/chunk-2FU2FTXD.js.map +1 -0
- package/dist/{chunk-JD3OZAI4.js → chunk-3G3W65EQ.js} +2 -2
- package/dist/{chunk-XWH4MXIU.js → chunk-5AXTH4QZ.js} +2 -2
- package/dist/{chunk-4TBBMHVC.js → chunk-5LIROIDM.js} +2 -2
- package/dist/{chunk-3EWXMOK3.js → chunk-7H2GEJ3O.js} +28 -13
- package/dist/chunk-7H2GEJ3O.js.map +1 -0
- package/dist/{chunk-WGHU7BLI.js → chunk-AEIKD3PP.js} +52 -38
- package/dist/chunk-AEIKD3PP.js.map +1 -0
- package/dist/{chunk-KI6HAJWL.js → chunk-BH3X5L6A.js} +4 -4
- package/dist/{chunk-BQ65SS5A.js → chunk-BJSLBUJ7.js} +2 -2
- package/dist/{chunk-L2FE64BU.js → chunk-BL5GYANC.js} +3 -3
- package/dist/{chunk-A5ZOOZFB.js → chunk-BSZOCSDZ.js} +4 -4
- package/dist/{chunk-ZNQYHJXX.js → chunk-C3HYQPV4.js} +2 -2
- package/dist/{chunk-PE4AQGFH.js → chunk-CD2AVTEM.js} +5 -5
- package/dist/{chunk-7EFFHEN5.js → chunk-D77ZQSQQ.js} +852 -143
- package/dist/chunk-D77ZQSQQ.js.map +1 -0
- package/dist/{chunk-56DJ7JVK.js → chunk-DWEBTE2W.js} +5 -5
- package/dist/{chunk-Z4DO7YSI.js → chunk-DYYYUW5D.js} +2 -2
- package/dist/{chunk-NSCVNK5K.js → chunk-E77UKJYL.js} +5 -5
- package/dist/{chunk-KIP6JLTF.js → chunk-F4G63NTZ.js} +2 -2
- package/dist/{chunk-NU6Q3FOR.js → chunk-FEJDVE3Z.js} +12 -2
- package/dist/{chunk-NU6Q3FOR.js.map → chunk-FEJDVE3Z.js.map} +1 -1
- package/dist/{chunk-DQU36Q7I.js → chunk-GP3SDSH2.js} +14 -5
- package/dist/chunk-GP3SDSH2.js.map +1 -0
- package/dist/{chunk-IQLVUT37.js → chunk-H2MRGONI.js} +2 -2
- package/dist/{chunk-EYVQHAGH.js → chunk-HGVSHKZW.js} +8 -5
- package/dist/chunk-HGVSHKZW.js.map +1 -0
- package/dist/chunk-I5IUYN7B.js +125 -0
- package/dist/chunk-I5IUYN7B.js.map +1 -0
- package/dist/{chunk-CJORTUJ2.js → chunk-J7RWBXFY.js} +2 -2
- package/dist/{chunk-AAVWKNZW.js → chunk-JDWE6JMX.js} +2 -2
- package/dist/{chunk-6AJBSQU4.js → chunk-KCEHMDZF.js} +3 -3
- package/dist/{chunk-TS26M2SB.js → chunk-M476FOQ7.js} +2 -2
- package/dist/{chunk-F4OJZIWQ.js → chunk-NBBMMJ2H.js} +4 -4
- package/dist/{chunk-CZI2A4MQ.js → chunk-NYSYPFXJ.js} +3 -3
- package/dist/{chunk-EGD5DXFT.js → chunk-PDULVIBY.js} +14 -2
- package/dist/chunk-PDULVIBY.js.map +1 -0
- package/dist/{chunk-Z6FNBOTC.js → chunk-PDVP3C2I.js} +1 -1
- package/dist/{chunk-Z6FNBOTC.js.map → chunk-PDVP3C2I.js.map} +1 -1
- package/dist/{chunk-COFPAMX6.js → chunk-QHM6XEAH.js} +6 -6
- package/dist/{chunk-C5T5AFWN.js → chunk-QO6RGLLD.js} +12 -6
- package/dist/chunk-QO6RGLLD.js.map +1 -0
- package/dist/{chunk-7HT2MEZ5.js → chunk-ROPJVUG3.js} +23 -6
- package/dist/chunk-ROPJVUG3.js.map +1 -0
- package/dist/{chunk-VU7SWWT5.js → chunk-ROVO6NPJ.js} +11 -7
- package/dist/chunk-ROVO6NPJ.js.map +1 -0
- package/dist/{chunk-6RR3MNMG.js → chunk-SHX5QBCI.js} +3 -3
- package/dist/{chunk-GC4V7RU7.js → chunk-SISBMAPO.js} +1 -1
- package/dist/chunk-SISBMAPO.js.map +1 -0
- package/dist/{chunk-BIYRQQV6.js → chunk-SNMJ7SB3.js} +5 -5
- package/dist/{chunk-7PS7EOCF.js → chunk-TIDXB5DF.js} +4 -4
- package/dist/chunk-U5QCMH3W.js +151 -0
- package/dist/chunk-U5QCMH3W.js.map +1 -0
- package/dist/{chunk-YULZKK4F.js → chunk-UNTGHX5A.js} +37 -2
- package/dist/chunk-UNTGHX5A.js.map +1 -0
- package/dist/{chunk-FWPKCXTN.js → chunk-WIAOUFFB.js} +2 -2
- package/dist/{chunk-LX3CB26H.js → chunk-WV7WV6JO.js} +195 -17
- package/dist/chunk-WV7WV6JO.js.map +1 -0
- package/dist/{chunk-X73VS74Y.js → chunk-XJV6OB4D.js} +2 -2
- package/dist/{chunk-OHVFWCJP.js → chunk-XMHUK5PN.js} +49 -19
- package/dist/chunk-XMHUK5PN.js.map +1 -0
- package/dist/{chunk-WBAYSNUQ.js → chunk-XMVHEWF6.js} +4 -4
- package/dist/{chunk-HOR4R722.js → chunk-XPIHJ34I.js} +30 -4
- package/dist/chunk-XPIHJ34I.js.map +1 -0
- package/dist/{chunk-DKO2QFSA.js → chunk-YYVZYTWW.js} +3 -3
- package/dist/{chunk-535SSHBS.js → chunk-ZEGSDPB7.js} +81 -2
- package/dist/chunk-ZEGSDPB7.js.map +1 -0
- package/dist/{chunk-YHPM5D7Y.js → chunk-ZNGPEV5J.js} +63 -4
- package/dist/chunk-ZNGPEV5J.js.map +1 -0
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +6 -4
- package/dist/consent/index.d.ts +6 -4
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-QXQOHMHF.js → crypto-7BN2HDWG.js} +7 -3
- package/dist/{delegation-NIQ43IPU.js → delegation-MGH5SODX.js} +5 -5
- package/dist/derivations/index.cjs +24 -3
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +7 -5
- package/dist/derivations/index.d.ts +7 -5
- package/dist/derivations/index.js +4 -4
- package/dist/{dev-unlock-iAS8z9jc.d.ts → dev-unlock-CI1ijTML.d.ts} +1 -1
- package/dist/{dev-unlock-nVkuRLLe.d.cts → dev-unlock-iXbYFAWl.d.cts} +1 -1
- package/dist/{strategy-CbneC7bS.d.ts → errors-Dz64FA65.d.cts} +98 -727
- package/dist/{strategy-CbneC7bS.d.cts → errors-Dz64FA65.d.ts} +98 -727
- package/dist/executor-3W63Y44O.js +11 -0
- package/dist/executor-CFFWPWBJ.js +8 -0
- package/dist/executor-VDQQOR4F.js +8 -0
- package/dist/{fanout-sidecar-N6OJX6QR.js → fanout-sidecar-FIJJ46YG.js} +2 -2
- package/dist/forget/index.cjs +43 -0
- package/dist/forget/index.cjs.map +1 -0
- package/dist/forget/index.d.cts +1 -0
- package/dist/forget/index.d.ts +1 -0
- package/dist/forget/index.js +14 -0
- package/dist/guards/index.cjs +9 -5
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +7 -5
- package/dist/guards/index.d.ts +7 -5
- package/dist/guards/index.js +6 -6
- package/dist/{hash-DHOnRarj.d.ts → hash-blk7Bkes.d.ts} +1 -1
- package/dist/{hash-Cv6byZs7.d.cts → hash-tEcM5fnv.d.cts} +1 -1
- package/dist/history/index.cjs +27 -4
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +7 -5
- package/dist/history/index.d.ts +7 -5
- package/dist/history/index.js +9 -7
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.cjs +53 -0
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +6 -4
- package/dist/i18n/index.d.ts +6 -4
- package/dist/i18n/index.js +16 -8
- package/dist/i18n/index.js.map +1 -1
- package/dist/{immutable-guard-BehB1YGB.d.ts → immutable-guard-B5M95nbq.d.ts} +16 -1
- package/dist/{immutable-guard-yBEOYmif.d.cts → immutable-guard-qN3zF8o1.d.cts} +16 -1
- package/dist/index-C-SSRIxP.d.cts +348 -0
- package/dist/index-C-SSRIxP.d.ts +348 -0
- package/dist/{index-XNB2r6bX.d.ts → index-DpU6KWof.d.ts} +9 -1
- package/dist/{index-D95VK1Qy.d.cts → index-u-kWzSrL.d.cts} +9 -1
- package/dist/index.cjs +2715 -1302
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -12
- package/dist/index.d.ts +16 -12
- package/dist/index.js +132 -106
- 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-TTMGHQ2J.js +12 -0
- package/dist/{ledger-CWSE3BLF.js → ledger-LFVLHE5H.js} +6 -6
- package/dist/materialized-views/index.cjs +407 -5
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +7 -5
- package/dist/materialized-views/index.d.ts +7 -5
- package/dist/materialized-views/index.js +12 -12
- package/dist/noydb-36S6GQNC.js +37 -0
- package/dist/overlay-views/index.cjs +47 -17
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +28 -8
- package/dist/overlay-views/index.d.ts +28 -8
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +6 -4
- package/dist/periods/index.d.ts +6 -4
- package/dist/periods/index.js +6 -6
- package/dist/{public-envelope-SYHEYQ3X.js → public-envelope-RXZNP3V6.js} +4 -4
- package/dist/query/index.cjs +28 -11
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -2
- package/dist/query/index.d.ts +3 -2
- package/dist/query/index.js +6 -6
- package/dist/registry-3YFLZ7WD.js +8 -0
- package/dist/{registry-DK5YWAAA.js → registry-SECUWSGY.js} +3 -3
- package/dist/registry-TGZISEWC.js +8 -0
- package/dist/{revoke-ZDFKMR5E.js → revoke-B54H2S2W.js} +6 -6
- package/dist/sealed-record/index.cjs +139 -0
- package/dist/sealed-record/index.cjs.map +1 -0
- package/dist/sealed-record/index.d.cts +123 -0
- package/dist/sealed-record/index.d.ts +123 -0
- package/dist/sealed-record/index.js +42 -0
- package/dist/sealed-record/index.js.map +1 -0
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +7 -5
- package/dist/session/index.d.ts +7 -5
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +6 -4
- package/dist/shadow/index.d.ts +6 -4
- package/dist/shadow/index.js +2 -2
- package/dist/{signer-P5D7Y72U.js → signer-YSXZT574.js} +5 -5
- package/dist/snapshots/index.cjs.map +1 -1
- package/dist/snapshots/index.d.cts +6 -4
- package/dist/snapshots/index.d.ts +6 -4
- package/dist/snapshots/index.js +4 -4
- package/dist/{stale-JH67FU57.js → stale-TOA36SRK.js} +2 -2
- package/dist/stale-TOA36SRK.js.map +1 -0
- package/dist/{state-vault-TMXZRTY5.js → state-vault-W2OEABNO.js} +3 -3
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +6 -4
- package/dist/store/index.d.ts +6 -4
- package/dist/store/index.js +2 -2
- package/dist/strategy-4M9jo172.d.ts +739 -0
- package/dist/strategy-CLC1j79g.d.cts +739 -0
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +5 -3
- package/dist/sync/index.d.ts +5 -3
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +6 -4
- package/dist/team/index.d.ts +6 -4
- package/dist/team/index.js +8 -8
- package/dist/tx/index.cjs +66 -3
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +24 -6
- package/dist/tx/index.d.ts +24 -6
- package/dist/tx/index.js +9 -5
- package/dist/tx/index.js.map +1 -1
- package/dist/{types-4t1-tWS4.d.ts → types-CljIHm_J.d.ts} +1127 -606
- package/dist/{types-BpPV5uyy.d.cts → types-CrSpRDuG.d.cts} +1127 -606
- package/dist/{ulid-DAfenvFd.d.ts → ulid-CWfL2Vfv.d.ts} +1 -1
- package/dist/{ulid-CiPrpGqm.d.cts → ulid-CrI7PPbA.d.cts} +1 -1
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{vault-group-KOM7QRJG.js → vault-group-DHAHFX2A.js} +4 -4
- package/dist/{with-derivation-OK9M2sJE.d.ts → with-derivation-BZ2y4bzF.d.ts} +1 -1
- package/dist/{with-derivation-DBqJB3dQ.d.cts → with-derivation-Bozs8DmD.d.cts} +1 -1
- package/dist/{with-materialized-view-Dt-ufPWQ.d.ts → with-materialized-view-B892zYZV.d.ts} +1 -1
- package/dist/{with-materialized-view-NzuxYPDF.d.cts → with-materialized-view-NzF71cG_.d.cts} +1 -1
- package/dist/{with-overlayed-view-eDvMs6LO.d.ts → with-overlayed-view-CR6m7CHe.d.ts} +1 -1
- package/dist/{with-overlayed-view-CC0_ocy-.d.cts → with-overlayed-view-UI8qSGL4.d.cts} +1 -1
- package/package.json +23 -3
- package/dist/chunk-3EWXMOK3.js.map +0 -1
- package/dist/chunk-535SSHBS.js.map +0 -1
- package/dist/chunk-5LQG6ZO2.js.map +0 -1
- package/dist/chunk-7EFFHEN5.js.map +0 -1
- package/dist/chunk-7HT2MEZ5.js.map +0 -1
- package/dist/chunk-C5T5AFWN.js.map +0 -1
- package/dist/chunk-DQU36Q7I.js.map +0 -1
- package/dist/chunk-EGD5DXFT.js.map +0 -1
- package/dist/chunk-EYVQHAGH.js.map +0 -1
- package/dist/chunk-GC4V7RU7.js.map +0 -1
- package/dist/chunk-HOR4R722.js.map +0 -1
- package/dist/chunk-LX3CB26H.js.map +0 -1
- package/dist/chunk-OHVFWCJP.js.map +0 -1
- package/dist/chunk-VU7SWWT5.js.map +0 -1
- package/dist/chunk-WGHU7BLI.js.map +0 -1
- package/dist/chunk-YHPM5D7Y.js.map +0 -1
- package/dist/chunk-YULZKK4F.js.map +0 -1
- package/dist/executor-6ZDSDZ6V.js +0 -8
- package/dist/executor-HSSRXDOB.js +0 -11
- package/dist/executor-IDZDAFNH.js +0 -8
- package/dist/issue-ADVS4OVP.js +0 -12
- package/dist/noydb-GZGFBA4E.js +0 -35
- package/dist/registry-IUZQVVBB.js +0 -8
- package/dist/registry-XGLNADIE.js +0 -8
- /package/dist/{chunk-JD3OZAI4.js.map → chunk-3G3W65EQ.js.map} +0 -0
- /package/dist/{chunk-XWH4MXIU.js.map → chunk-5AXTH4QZ.js.map} +0 -0
- /package/dist/{chunk-4TBBMHVC.js.map → chunk-5LIROIDM.js.map} +0 -0
- /package/dist/{chunk-KI6HAJWL.js.map → chunk-BH3X5L6A.js.map} +0 -0
- /package/dist/{chunk-BQ65SS5A.js.map → chunk-BJSLBUJ7.js.map} +0 -0
- /package/dist/{chunk-L2FE64BU.js.map → chunk-BL5GYANC.js.map} +0 -0
- /package/dist/{chunk-A5ZOOZFB.js.map → chunk-BSZOCSDZ.js.map} +0 -0
- /package/dist/{chunk-ZNQYHJXX.js.map → chunk-C3HYQPV4.js.map} +0 -0
- /package/dist/{chunk-PE4AQGFH.js.map → chunk-CD2AVTEM.js.map} +0 -0
- /package/dist/{chunk-56DJ7JVK.js.map → chunk-DWEBTE2W.js.map} +0 -0
- /package/dist/{chunk-Z4DO7YSI.js.map → chunk-DYYYUW5D.js.map} +0 -0
- /package/dist/{chunk-NSCVNK5K.js.map → chunk-E77UKJYL.js.map} +0 -0
- /package/dist/{chunk-KIP6JLTF.js.map → chunk-F4G63NTZ.js.map} +0 -0
- /package/dist/{chunk-IQLVUT37.js.map → chunk-H2MRGONI.js.map} +0 -0
- /package/dist/{chunk-CJORTUJ2.js.map → chunk-J7RWBXFY.js.map} +0 -0
- /package/dist/{chunk-AAVWKNZW.js.map → chunk-JDWE6JMX.js.map} +0 -0
- /package/dist/{chunk-6AJBSQU4.js.map → chunk-KCEHMDZF.js.map} +0 -0
- /package/dist/{chunk-TS26M2SB.js.map → chunk-M476FOQ7.js.map} +0 -0
- /package/dist/{chunk-F4OJZIWQ.js.map → chunk-NBBMMJ2H.js.map} +0 -0
- /package/dist/{chunk-CZI2A4MQ.js.map → chunk-NYSYPFXJ.js.map} +0 -0
- /package/dist/{chunk-COFPAMX6.js.map → chunk-QHM6XEAH.js.map} +0 -0
- /package/dist/{chunk-6RR3MNMG.js.map → chunk-SHX5QBCI.js.map} +0 -0
- /package/dist/{chunk-BIYRQQV6.js.map → chunk-SNMJ7SB3.js.map} +0 -0
- /package/dist/{chunk-7PS7EOCF.js.map → chunk-TIDXB5DF.js.map} +0 -0
- /package/dist/{chunk-FWPKCXTN.js.map → chunk-WIAOUFFB.js.map} +0 -0
- /package/dist/{chunk-X73VS74Y.js.map → chunk-XJV6OB4D.js.map} +0 -0
- /package/dist/{chunk-WBAYSNUQ.js.map → chunk-XMVHEWF6.js.map} +0 -0
- /package/dist/{chunk-DKO2QFSA.js.map → chunk-YYVZYTWW.js.map} +0 -0
- /package/dist/{crypto-QXQOHMHF.js.map → crypto-7BN2HDWG.js.map} +0 -0
- /package/dist/{delegation-NIQ43IPU.js.map → delegation-MGH5SODX.js.map} +0 -0
- /package/dist/{executor-6ZDSDZ6V.js.map → executor-3W63Y44O.js.map} +0 -0
- /package/dist/{executor-HSSRXDOB.js.map → executor-CFFWPWBJ.js.map} +0 -0
- /package/dist/{executor-IDZDAFNH.js.map → executor-VDQQOR4F.js.map} +0 -0
- /package/dist/{fanout-sidecar-N6OJX6QR.js.map → fanout-sidecar-FIJJ46YG.js.map} +0 -0
- /package/dist/{issue-ADVS4OVP.js.map → forget/index.js.map} +0 -0
- /package/dist/{ledger-CWSE3BLF.js.map → issue-TTMGHQ2J.js.map} +0 -0
- /package/dist/{noydb-GZGFBA4E.js.map → ledger-LFVLHE5H.js.map} +0 -0
- /package/dist/{public-envelope-SYHEYQ3X.js.map → noydb-36S6GQNC.js.map} +0 -0
- /package/dist/{registry-DK5YWAAA.js.map → public-envelope-RXZNP3V6.js.map} +0 -0
- /package/dist/{registry-IUZQVVBB.js.map → registry-3YFLZ7WD.js.map} +0 -0
- /package/dist/{registry-XGLNADIE.js.map → registry-SECUWSGY.js.map} +0 -0
- /package/dist/{revoke-ZDFKMR5E.js.map → registry-TGZISEWC.js.map} +0 -0
- /package/dist/{signer-P5D7Y72U.js.map → revoke-B54H2S2W.js.map} +0 -0
- /package/dist/{stale-JH67FU57.js.map → signer-YSXZT574.js.map} +0 -0
- /package/dist/{state-vault-TMXZRTY5.js.map → state-vault-W2OEABNO.js.map} +0 -0
- /package/dist/{vault-group-KOM7QRJG.js.map → vault-group-DHAHFX2A.js.map} +0 -0
|
@@ -1,364 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Aggregation reducers for the query DSL.
|
|
3
|
-
*
|
|
4
|
-
* the reducer protocol plus five built-in factories
|
|
5
|
-
* (`count`, `sum`, `avg`, `min`, `max`) consumed by `Query.aggregate()`
|
|
6
|
-
* and, in the future, `Scan.aggregate()`. Every factory accepts
|
|
7
|
-
* an optional `{ seed }` parameter that is plumbed through the
|
|
8
|
-
* protocol but unused by the executor — that's the load-bearing
|
|
9
|
-
* half of constraint #2. When partition-aware aggregation
|
|
10
|
-
* lands, the seed carries the previous partition's running total into
|
|
11
|
-
* the next partition without requiring a protocol change.
|
|
12
|
-
*
|
|
13
|
-
* Reducers are intentionally generic over their internal state type
|
|
14
|
-
* `S` so compound reducers (avg keeps `{sum, count}`, min/max keep a
|
|
15
|
-
* value bag) can model internal bookkeeping without leaking the
|
|
16
|
-
* implementation through the accumulator's public shape. `finalize`
|
|
17
|
-
* collapses `S` back into the user-visible `R`.
|
|
18
|
-
*
|
|
19
|
-
* Reducers are pure data — `init` / `step` / `finalize` / optional
|
|
20
|
-
* `remove` are stateless functions that receive and return `S`. This
|
|
21
|
-
* is the shape that admits O(1) incremental maintenance in a future
|
|
22
|
-
* optimization (delta-aware `LiveAggregation` applies `step` or
|
|
23
|
-
* `remove` per delta), without blocking the simpler "full re-run on
|
|
24
|
-
* source change" that ships.
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* A single reducer: factory-produced, ready to plug into an
|
|
28
|
-
* `.aggregate()` spec.
|
|
29
|
-
*
|
|
30
|
-
* Type parameters:
|
|
31
|
-
* - `R` — user-visible result type (what the aggregation returns
|
|
32
|
-
* for this slot, e.g. `number` for `sum()`)
|
|
33
|
-
* - `S` — internal state type, defaults to `R` for simple reducers
|
|
34
|
-
* that don't need compound bookkeeping
|
|
35
|
-
*
|
|
36
|
-
* A reducer is stateless: every method is pure over `S`. `init()` is
|
|
37
|
-
* called once per aggregation run to build the initial state; `step()`
|
|
38
|
-
* folds a record into the state; `remove()` (optional) un-folds a
|
|
39
|
-
* record, enabling incremental live maintenance; `finalize()` reads
|
|
40
|
-
* the final answer out of the state at the end of the run.
|
|
41
|
-
*/
|
|
42
|
-
interface Reducer<R, S = R> {
|
|
43
|
-
/** Build the initial state for a fresh aggregation run. */
|
|
44
|
-
init(): S;
|
|
45
|
-
/** Fold a record into the state. Returns the new state. */
|
|
46
|
-
step(state: S, record: unknown): S;
|
|
47
|
-
/**
|
|
48
|
-
* Un-fold a record from the state. Returns the new state.
|
|
49
|
-
*
|
|
50
|
-
* Optional — reducers without `remove` cannot be maintained
|
|
51
|
-
* incrementally and must be re-run from scratch when the underlying
|
|
52
|
-
* record set changes. `sum`, `count`, `avg` implement `remove` in
|
|
53
|
-
* O(1); `min` and `max` implement it in O(N) worst case (when the
|
|
54
|
-
* extremum itself is removed and the next extremum must be
|
|
55
|
-
* recomputed from the remaining contributing values).
|
|
56
|
-
*/
|
|
57
|
-
remove?(state: S, record: unknown): S;
|
|
58
|
-
/** Collapse the internal state into the user-visible result. */
|
|
59
|
-
finalize(state: S): R;
|
|
60
|
-
/**
|
|
61
|
-
* Combine two independent partial states into one (then `finalize` once).
|
|
62
|
-
* Optional. MUST be associative + commutative with `init()` as identity.
|
|
63
|
-
* Never merge finalized results — only states. Enables parallel /
|
|
64
|
-
* hierarchical aggregation (e.g. cross-shard or advisor→firm rollup).
|
|
65
|
-
*/
|
|
66
|
-
merge?(a: S, b: S): S;
|
|
67
|
-
/**
|
|
68
|
-
* Identifying operation tag stamped by each built-in factory.
|
|
69
|
-
* Used by `summariseAggregateOp` in the introspection walker to
|
|
70
|
-
* render human-readable aggregate descriptors in `dumpSchema()`.
|
|
71
|
-
* Optional so third-party custom reducers are unaffected.
|
|
72
|
-
*/
|
|
73
|
-
readonly op?: 'count' | 'sum' | 'avg' | 'min' | 'max';
|
|
74
|
-
/**
|
|
75
|
-
* Field name for field-based reducers (`sum`, `avg`, `min`, `max`).
|
|
76
|
-
* Absent on `count` which aggregates over record count, not a field.
|
|
77
|
-
*/
|
|
78
|
-
readonly field?: string;
|
|
79
|
-
/**
|
|
80
|
-
* Money-only: target currency for `sum` over a multi-currency money
|
|
81
|
-
* field. Consumed by `wrapMoneyReducers` to convert per-currency
|
|
82
|
-
* subtotals to one figure. Ignored for non-money fields.
|
|
83
|
-
*/
|
|
84
|
-
readonly convertTo?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Money-only: FX rate map (`'USD->EUR' → rate`) used with `convertTo`.
|
|
87
|
-
*/
|
|
88
|
-
readonly fx?: Record<string, number | string>;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Common options accepted by every reducer factory.
|
|
92
|
-
*
|
|
93
|
-
* `seed` — optional initial value for the internal state. **Unused by
|
|
94
|
-
* the executor**, plumbed through the protocol for constraint
|
|
95
|
-
* #2 (partition-aware aggregation seam). In, partitioned
|
|
96
|
-
* aggregations will pass the previous partition's carry as `seed` so
|
|
97
|
-
* a long time series can be rolled forward one partition at a time
|
|
98
|
-
* without re-aggregating closed partitions.
|
|
99
|
-
*
|
|
100
|
-
* always uses `init()` with the factory's zero value, regardless
|
|
101
|
-
* of whether `seed` was passed. Do not remove the parameter — that's
|
|
102
|
-
* the whole point of having it exist now.
|
|
103
|
-
*/
|
|
104
|
-
interface ReducerOptions<TSeed = unknown> {
|
|
105
|
-
/** constraint #2 — seed is plumbed through but unused in. */
|
|
106
|
-
readonly seed?: TSeed;
|
|
107
|
-
/**
|
|
108
|
-
* Money-only (honored by `sum` over a multi-currency money field):
|
|
109
|
-
* convert per-currency subtotals to this currency for a single figure.
|
|
110
|
-
*/
|
|
111
|
-
readonly convertTo?: string;
|
|
112
|
-
/** Money-only: FX rate map (`'USD->EUR' → rate`) used with `convertTo`. */
|
|
113
|
-
readonly fx?: Record<string, number | string>;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Count the number of records that match the query. Ignores field
|
|
117
|
-
* values entirely — the count is over the number of records, not over
|
|
118
|
-
* the number of non-null field values in any column.
|
|
119
|
-
*/
|
|
120
|
-
declare function count(opts?: ReducerOptions<number>): Reducer<number>;
|
|
121
|
-
/**
|
|
122
|
-
* Sum a numeric field across all matching records. Non-number values
|
|
123
|
-
* at the field path are coerced to 0 — consumers who want a different
|
|
124
|
-
* behavior (throw, skip, treat as NaN) should filter upstream via
|
|
125
|
-
* `.where()` or write a custom reducer.
|
|
126
|
-
*/
|
|
127
|
-
declare function sum(field: string, opts?: ReducerOptions<number>): Reducer<number>;
|
|
128
|
-
/**
|
|
129
|
-
* Arithmetic mean of a numeric field across all matching records.
|
|
130
|
-
*
|
|
131
|
-
* Returns `null` for an empty result set (zero records is not a
|
|
132
|
-
* well-defined denominator — returning NaN would poison downstream
|
|
133
|
-
* arithmetic, and throwing would force every consumer to wrap in
|
|
134
|
-
* try/catch just to handle "no matches"). Consumers who want an
|
|
135
|
-
* explicit zero should coalesce with `?? 0`.
|
|
136
|
-
*
|
|
137
|
-
* Internal state is `{sum, count}` so the running average can be
|
|
138
|
-
* maintained incrementally — on each delta, both fields update in
|
|
139
|
-
* O(1) and `finalize` divides. Directly storing `avg` as state would
|
|
140
|
-
* not admit incremental removal without also tracking count.
|
|
141
|
-
*/
|
|
142
|
-
declare function avg(field: string, opts?: ReducerOptions<{
|
|
143
|
-
sum: number;
|
|
144
|
-
count: number;
|
|
145
|
-
}>): Reducer<number | null, {
|
|
146
|
-
sum: number;
|
|
147
|
-
count: number;
|
|
148
|
-
}>;
|
|
149
|
-
interface MinMaxState {
|
|
150
|
-
/**
|
|
151
|
-
* Multiset of contributing field values. Stored as a plain array
|
|
152
|
-
* because we need to support `remove` and a plain array gives us
|
|
153
|
-
* O(1) push + O(N) worst-case removal — which matches the
|
|
154
|
-
* documented min/max removal complexity. A sorted structure would
|
|
155
|
-
* let us drop the O(N) rescan but adds complexity that doesn't
|
|
156
|
-
* need; consumers hitting the O(N) ceiling should file an issue.
|
|
157
|
-
*/
|
|
158
|
-
readonly values: number[];
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Smallest numeric value of a field across all matching records.
|
|
162
|
-
* Returns `null` for an empty result set. See `avg()` for the
|
|
163
|
-
* reasoning on `null` vs NaN vs throwing.
|
|
164
|
-
*
|
|
165
|
-
* Incremental complexity: O(1) for `step`, O(N) worst case for
|
|
166
|
-
* `remove` when the current minimum is removed (the state holds the
|
|
167
|
-
* full multiset of contributing values and `finalize` scans for the
|
|
168
|
-
* new minimum). Consumers with very large result sets and frequent
|
|
169
|
-
* removals of the current extremum should either accept the cost or
|
|
170
|
-
* wait for a future optimization.
|
|
171
|
-
*/
|
|
172
|
-
declare function min(field: string, opts?: ReducerOptions<number>): Reducer<number | null, MinMaxState>;
|
|
173
|
-
/**
|
|
174
|
-
* Largest numeric value of a field across all matching records.
|
|
175
|
-
* Mirror of `min()` — see that doc for semantics, null-on-empty
|
|
176
|
-
* behavior, and the O(N) removal caveat.
|
|
177
|
-
*/
|
|
178
|
-
declare function max(field: string, opts?: ReducerOptions<number>): Reducer<number | null, MinMaxState>;
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Aggregate execution — the runtime behind `Query.aggregate()`.
|
|
182
|
-
*
|
|
183
|
-
* takes an `AggregateSpec` (a record of named reducers
|
|
184
|
-
* built from `reducers.ts`) and runs every reducer over the records
|
|
185
|
-
* produced by the underlying query. Two terminal surfaces:
|
|
186
|
-
*
|
|
187
|
-
* - `.run(): R` — synchronous one-shot reduction. Matches the
|
|
188
|
-
* existing `Query.toArray()` / `.first()` / `.count()` style.
|
|
189
|
-
* - `.live(): LiveAggregation<R>` — reactive primitive that
|
|
190
|
-
* re-runs the reduction whenever the query's source notifies of
|
|
191
|
-
* a change. uses naive full re-run; incremental delta
|
|
192
|
-
* maintenance is admitted by the reducer protocol (`remove()`)
|
|
193
|
-
* but not wired to the executor yet — a follow-up optimization
|
|
194
|
-
* can switch from full re-run to delta-based without breaking
|
|
195
|
-
* the public API. Consumers get correct, reactive values today.
|
|
196
|
-
*
|
|
197
|
-
* The `Aggregation<R>` wrapper is deliberately tiny — it exists so
|
|
198
|
-
* `.aggregate(spec)` can be chained with either `.run()` or `.live()`
|
|
199
|
-
* without the builder needing two separate terminal methods. It
|
|
200
|
-
* holds the closure over the query execution (produces the current
|
|
201
|
-
* matching record set) and the spec, and stitches them together in
|
|
202
|
-
* either mode.
|
|
203
|
-
*
|
|
204
|
-
* This file depends ONLY on `reducers.ts` — it has no knowledge of
|
|
205
|
-
* the `Query` class. Tests can therefore exercise the reduction
|
|
206
|
-
* surface with plain record arrays, without spinning up a Collection.
|
|
207
|
-
*/
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* A named set of reducers, keyed by output field name. Each key
|
|
211
|
-
* becomes a field on the aggregated result.
|
|
212
|
-
*
|
|
213
|
-
* ```ts
|
|
214
|
-
* const spec = {
|
|
215
|
-
* total: sum('amount'),
|
|
216
|
-
* n: count(),
|
|
217
|
-
* avgAmount: avg('amount'),
|
|
218
|
-
* }
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
type AggregateSpec = Readonly<Record<string, Reducer<unknown, unknown>>>;
|
|
222
|
-
/**
|
|
223
|
-
* Map an `AggregateSpec` to its reduced result shape — each key
|
|
224
|
-
* carries the finalized result type from its reducer. A spec built
|
|
225
|
-
* from `{ total: sum('amount'), n: count() }` yields a result of
|
|
226
|
-
* `{ total: number, n: number }`.
|
|
227
|
-
*
|
|
228
|
-
* This uses a mapped type with a conditional to extract `R` from
|
|
229
|
-
* each `Reducer<R, _>`. The `infer` captures the user-visible result
|
|
230
|
-
* type, discarding the internal state type `S`.
|
|
231
|
-
*/
|
|
232
|
-
type AggregateResult<Spec extends AggregateSpec> = {
|
|
233
|
-
[K in keyof Spec]: Spec[K] extends Reducer<infer R, unknown> ? R : never;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Pure reduction over a record array. Runs every reducer's
|
|
237
|
-
* `init → step* → finalize` pipeline exactly once over the records.
|
|
238
|
-
*
|
|
239
|
-
* Called by `Aggregation.run()` and by the live-mode refresh path.
|
|
240
|
-
* Exported for tests and for future `scan().aggregate()` reuse
|
|
241
|
-
* — the streaming path will call the same reducer protocol with a
|
|
242
|
-
* per-page loop instead of a single array.
|
|
243
|
-
*/
|
|
244
|
-
declare function reduceRecords<Spec extends AggregateSpec>(records: readonly unknown[], spec: Spec): AggregateResult<Spec>;
|
|
245
|
-
/**
|
|
246
|
-
* A minimal reactive primitive for aggregation results.
|
|
247
|
-
*
|
|
248
|
-
* Same spirit as the `LiveQuery` in : frame-agnostic, a plain
|
|
249
|
-
* object with `value` / `error` fields and a `subscribe(cb)`
|
|
250
|
-
* notification channel that Vue / React / Solid adapters wrap in
|
|
251
|
-
* their own primitive. Intentionally NOT a Promise — aggregations
|
|
252
|
-
* have a well-defined "current value" at every instant, and the
|
|
253
|
-
* reactive consumer wants to read that value synchronously.
|
|
254
|
-
*
|
|
255
|
-
* Error semantics mirror `LiveQuery`: if a re-run throws, the
|
|
256
|
-
* previous successful `value` is preserved and the error is stored
|
|
257
|
-
* in `error` so consumers can render an error state without losing
|
|
258
|
-
* the last-known-good result. The throw does NOT propagate out of
|
|
259
|
-
* the source's change handler (which would tear down the upstream
|
|
260
|
-
* emitter).
|
|
261
|
-
*
|
|
262
|
-
* `stop()` tears down the upstream subscription. It is idempotent —
|
|
263
|
-
* calling it multiple times is safe — and subscribe calls after
|
|
264
|
-
* stop are no-ops (they immediately return a no-op unsubscribe).
|
|
265
|
-
* Always call `stop()` when done; Vue's `onUnmounted` is the
|
|
266
|
-
* canonical place. Raw consumers must do it themselves.
|
|
267
|
-
*/
|
|
268
|
-
interface LiveAggregation<R> {
|
|
269
|
-
/** Current reduced value. Undefined only if the first compute threw. */
|
|
270
|
-
readonly value: R | undefined;
|
|
271
|
-
/** Last execution error, if any. Cleared on the next successful run. */
|
|
272
|
-
readonly error: unknown;
|
|
273
|
-
/** Notify on every recomputation (success or error). Returns unsubscribe. */
|
|
274
|
-
subscribe(cb: () => void): () => void;
|
|
275
|
-
/** Tear down the upstream subscription. Idempotent. */
|
|
276
|
-
stop(): void;
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Upstream change-notification hook for live aggregation.
|
|
280
|
-
*
|
|
281
|
-
* Matches the shape that `QuerySource.subscribe` already uses — a
|
|
282
|
-
* single method that accepts a callback and returns an unsubscribe
|
|
283
|
-
* function. The `Aggregation` wrapper collects upstreams from the
|
|
284
|
-
* query's source and wires them into a single re-run trigger.
|
|
285
|
-
*/
|
|
286
|
-
interface AggregationUpstream {
|
|
287
|
-
subscribe(cb: () => void): () => void;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Chainable wrapper returned by `Query.aggregate(spec)`. Holds the
|
|
291
|
-
* execute-records closure and the spec; terminal methods (`run`,
|
|
292
|
-
* `live`) stitch them together in either mode.
|
|
293
|
-
*
|
|
294
|
-
* Why a wrapper instead of two terminal methods on `Query` directly?
|
|
295
|
-
*
|
|
296
|
-
* The `.aggregate(spec)` call is where the spec is bound — both
|
|
297
|
-
* `.run()` and `.live()` need the same spec, and the consumer's
|
|
298
|
-
* fluent style is `query.where(...).aggregate(spec).run()` or
|
|
299
|
-
* `.aggregate(spec).live()`. Wrapping lets the spec be named once
|
|
300
|
-
* and reused for either terminal, and keeps the `Query` class
|
|
301
|
-
* from growing a pair of near-duplicate method overloads
|
|
302
|
-
* (`aggregateRun` / `aggregateLive`) that would be harder to
|
|
303
|
-
* discover.
|
|
304
|
-
*/
|
|
305
|
-
declare class Aggregation<R> {
|
|
306
|
-
private readonly executeRecords;
|
|
307
|
-
private readonly spec;
|
|
308
|
-
private readonly upstreams;
|
|
309
|
-
constructor(executeRecords: () => readonly unknown[], spec: AggregateSpec, upstreams: readonly AggregationUpstream[]);
|
|
310
|
-
/**
|
|
311
|
-
* Execute the query and reduce the results synchronously.
|
|
312
|
-
* Returns the reduced shape matching the spec — e.g. a spec of
|
|
313
|
-
* `{ total: sum('amount'), n: count() }` returns
|
|
314
|
-
* `{ total: number, n: number }`.
|
|
315
|
-
*/
|
|
316
|
-
run(): R;
|
|
317
|
-
/**
|
|
318
|
-
* Build a reactive `LiveAggregation<R>` that re-runs the reduction
|
|
319
|
-
* whenever any upstream source notifies of a change. The initial
|
|
320
|
-
* value is computed eagerly in the constructor, so consumers can
|
|
321
|
-
* read `live.value` immediately after calling `.live()`.
|
|
322
|
-
*
|
|
323
|
-
* Always call `live.stop()` when finished — it tears down the
|
|
324
|
-
* upstream subscriptions. Vue's `onUnmounted` is the canonical
|
|
325
|
-
* place.
|
|
326
|
-
*
|
|
327
|
-
* **Implementation note:** every upstream change triggers a full
|
|
328
|
-
* re-reduction. Incremental maintenance (O(1) per delta for
|
|
329
|
-
* sum/count/avg via the reducer protocol's `remove()` method) is a
|
|
330
|
-
* planned follow-up optimization — the protocol already supports
|
|
331
|
-
* it, but the executor doesn't drive it yet. Consumers get
|
|
332
|
-
* correct, reactive values today; future PRs can switch to
|
|
333
|
-
* delta-based maintenance without changing this API.
|
|
334
|
-
*/
|
|
335
|
-
live(): LiveAggregation<R>;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Build a `LiveAggregation<V>` from a recompute closure and a list
|
|
339
|
-
* of upstreams. Exposed so sibling files in the query DSL
|
|
340
|
-
* (currently `groupby.ts`) can reuse the reactive primitive
|
|
341
|
-
* without reaching into `LiveAggregationImpl` directly. This keeps
|
|
342
|
-
* the implementation class private while still allowing planned
|
|
343
|
-
* composition with `.groupBy().aggregate().live()`.
|
|
344
|
-
*/
|
|
345
|
-
declare function buildLiveAggregation<V>(recompute: () => V, upstreams: readonly AggregationUpstream[]): LiveAggregation<V>;
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Pure fixed-point decimal core for the money descriptor.
|
|
349
|
-
*
|
|
350
|
-
* All conversion goes decimal-string ⇄ scaled `BigInt`. There is no
|
|
351
|
-
* floating-point arithmetic anywhere: a value like `123.45` becomes
|
|
352
|
-
* `12345n` purely by string manipulation, never by `value * 100` (which
|
|
353
|
-
* would reintroduce the very drift money() exists to eliminate). BigInt
|
|
354
|
-
* has no magnitude ceiling, so values past `Number.MAX_SAFE_INTEGER`
|
|
355
|
-
* stay exact end-to-end.
|
|
356
|
-
*
|
|
357
|
-
* This module knows nothing about currencies, descriptors, or storage —
|
|
358
|
-
* it is the isolated, exhaustively-tested arithmetic kernel.
|
|
359
|
-
*/
|
|
360
|
-
type RoundingMode = 'half-up' | 'half-even' | 'half-down' | 'up' | 'down' | 'ceil' | 'floor';
|
|
361
|
-
|
|
362
1
|
/**
|
|
363
2
|
* All NOYDB error classes — a single import surface for `catch` blocks and
|
|
364
3
|
* `instanceof` checks.
|
|
@@ -402,6 +41,9 @@ type RoundingMode = 'half-up' | 'half-even' | 'half-down' | 'up' | 'down' | 'cei
|
|
|
402
41
|
* │ ├─ DictKeyInUseError
|
|
403
42
|
* │ ├─ MissingTranslationError
|
|
404
43
|
* │ ├─ LocaleNotSpecifiedError
|
|
44
|
+
* │ ├─ ScriptViolationError
|
|
45
|
+
* │ ├─ StaticDictReadonlyError
|
|
46
|
+
* │ ├─ UnknownDictCodeError
|
|
405
47
|
* │ └─ TranslatorNotConfiguredError
|
|
406
48
|
* ├─ Backup errors
|
|
407
49
|
* │ ├─ BackupLedgerError — hash-chain verification failed
|
|
@@ -416,6 +58,12 @@ type RoundingMode = 'half-up' | 'half-even' | 'half-down' | 'up' | 'down' | 'cei
|
|
|
416
58
|
* │ └─ SnapshotNotFoundError — snapshot key absent from snapshot store
|
|
417
59
|
* └─ Computed field errors
|
|
418
60
|
* └─ ComputedFieldError — computed function threw during a write
|
|
61
|
+
* └─ Erasure errors
|
|
62
|
+
* └─ ForgetStrategyNotConfiguredError — vault.forget() with no withForgetCascade
|
|
63
|
+
* └─ Sealed-record errors (record-scoped CEK sealing, #306)
|
|
64
|
+
* ├─ SealedRecordExpiredError — sealed CEK binding past expiresAt
|
|
65
|
+
* ├─ SealedRecordMismatchError — CEK sealed for record A used on record B
|
|
66
|
+
* └─ RecordCekNotFoundError — record missing or no per-record `_cek`
|
|
419
67
|
* ```
|
|
420
68
|
*
|
|
421
69
|
* ## Catching all NOYDB errors
|
|
@@ -1260,6 +908,40 @@ declare class ScriptViolationError extends NoydbError {
|
|
|
1260
908
|
readonly sample: string;
|
|
1261
909
|
constructor(field: string, locale: string, expected: readonly string[], sample: string, message?: string);
|
|
1262
910
|
}
|
|
911
|
+
/**
|
|
912
|
+
* Thrown when a mutation (`put`/`putAll`/`rename`/`delete`) is attempted
|
|
913
|
+
* against a dictionary name that is backed by a `staticDict()` descriptor.
|
|
914
|
+
*
|
|
915
|
+
* A static dict's labels are code constants with no per-vault storage and no
|
|
916
|
+
* mutation surface — a label change is a code deploy, not a runtime write.
|
|
917
|
+
* Distinct from the other dictionary errors so callers can tell a
|
|
918
|
+
* "this dict is read-only by construction" refusal from a missing-key or
|
|
919
|
+
* key-in-use failure. (#291)
|
|
920
|
+
*/
|
|
921
|
+
declare class StaticDictReadonlyError extends NoydbError {
|
|
922
|
+
/** The static dictionary name that was the target of the mutation. */
|
|
923
|
+
readonly dictionaryName: string;
|
|
924
|
+
constructor(dictionaryName: string);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Thrown at put-time when a record stores a code for a `staticDict()` field
|
|
928
|
+
* that is not in the descriptor's declared `keys` (a typo or a stale code).
|
|
929
|
+
*
|
|
930
|
+
* Codes are closed by construction, so an unknown code is treated as a bug by
|
|
931
|
+
* default. Opt out per descriptor with `{ validateCodes: false }`.
|
|
932
|
+
*
|
|
933
|
+
* Distinct from {@link LocaleNotSpecifiedError} (a read-hole) — this is a
|
|
934
|
+
* write-shape error. (#291)
|
|
935
|
+
*/
|
|
936
|
+
declare class UnknownDictCodeError extends NoydbError {
|
|
937
|
+
/** The static dictionary name. */
|
|
938
|
+
readonly dictionaryName: string;
|
|
939
|
+
/** The field that carried the unknown code. */
|
|
940
|
+
readonly field: string;
|
|
941
|
+
/** The offending code value. */
|
|
942
|
+
readonly code: string;
|
|
943
|
+
constructor(dictionaryName: string, field: string, code: string);
|
|
944
|
+
}
|
|
1263
945
|
/**
|
|
1264
946
|
* Thrown when a collection has an `i18nText` field with
|
|
1265
947
|
* `autoTranslate: true` but no `plaintextTranslator` was configured
|
|
@@ -1669,380 +1351,69 @@ declare class VaultTemplateNotFoundError extends NoydbError {
|
|
|
1669
1351
|
readonly templateName: string;
|
|
1670
1352
|
constructor(templateName: string);
|
|
1671
1353
|
}
|
|
1672
|
-
|
|
1673
1354
|
/**
|
|
1674
|
-
*
|
|
1675
|
-
*
|
|
1676
|
-
*
|
|
1677
|
-
*
|
|
1678
|
-
*
|
|
1679
|
-
*
|
|
1680
|
-
*
|
|
1681
|
-
* - **fixed** `money({ currency: 'EUR' })` — one currency for the
|
|
1682
|
-
* field; the value stores a bare scaled-integer string.
|
|
1683
|
-
* - **multi** `money({ currencies: 'any' | [...] })` — currency travels
|
|
1684
|
-
* per record; the value stores `{ amount, currency }`.
|
|
1685
|
-
*
|
|
1686
|
-
* `currency` and `currencies` are mutually exclusive.
|
|
1355
|
+
* Thrown when `vault.forget(subjectId)` is called on a vault whose
|
|
1356
|
+
* `createNoydb({ forgetStrategy })` declared no subject fields (the
|
|
1357
|
+
* default `NO_FORGET`). GDPR crypto-shred needs a declared subject →
|
|
1358
|
+
* record index to know which records belong to a data subject; without
|
|
1359
|
+
* one there is nothing to erase and a silent no-op would be a dangerous
|
|
1360
|
+
* false "erased" signal. Configure with
|
|
1361
|
+
* `forgetStrategy: withForgetCascade({ subjects: { invoices: 'buyerId' } })`.
|
|
1687
1362
|
*/
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
currency: string;
|
|
1691
|
-
/** Override the ISO-4217 default scale (required for unlisted codes). */
|
|
1692
|
-
scale?: number;
|
|
1693
|
-
rounding?: RoundingMode;
|
|
1694
|
-
}
|
|
1695
|
-
interface MoneyOptionsMulti {
|
|
1696
|
-
currencies: 'any' | readonly string[];
|
|
1697
|
-
/** Per-currency scale overrides (required for unlisted codes). */
|
|
1698
|
-
scaleOverrides?: Record<string, number>;
|
|
1699
|
-
rounding?: RoundingMode;
|
|
1700
|
-
}
|
|
1701
|
-
type MoneyOptions = MoneyOptionsFixed | MoneyOptionsMulti;
|
|
1702
|
-
interface MoneyDescriptor {
|
|
1703
|
-
readonly _noydbMoney: true;
|
|
1704
|
-
readonly mode: 'fixed' | 'multi';
|
|
1705
|
-
readonly options: MoneyOptions;
|
|
1706
|
-
readonly rounding: RoundingMode | undefined;
|
|
1707
|
-
/** The currency for fixed mode; `undefined` in multi mode. */
|
|
1708
|
-
readonly fixedCurrency: string | undefined;
|
|
1709
|
-
/** Resolve the scale for a currency, throwing if not allowed / unknown. */
|
|
1710
|
-
scaleFor(currency: string): number;
|
|
1711
|
-
/** Whether this descriptor permits the given currency. */
|
|
1712
|
-
allows(currency: string): boolean;
|
|
1713
|
-
/**
|
|
1714
|
-
* The single currency this descriptor implies, if any — fixed mode, or
|
|
1715
|
-
* multi mode with exactly one allow-listed currency. Lets a multi field
|
|
1716
|
-
* accept a bare amount unambiguously. `undefined` otherwise.
|
|
1717
|
-
*/
|
|
1718
|
-
soleCurrency(): string | undefined;
|
|
1719
|
-
}
|
|
1720
|
-
/** Raised when a written value carries more precision than `scale` allows. */
|
|
1721
|
-
declare class MoneyPrecisionError extends NoydbError {
|
|
1722
|
-
readonly field: string;
|
|
1723
|
-
readonly value: unknown;
|
|
1724
|
-
readonly scale: number;
|
|
1725
|
-
constructor(field: string, value: unknown, scale: number);
|
|
1726
|
-
}
|
|
1727
|
-
/** Raised when a currency is disallowed or has no resolvable scale. */
|
|
1728
|
-
declare class MoneyCurrencyError extends NoydbError {
|
|
1729
|
-
readonly currency: string;
|
|
1730
|
-
readonly reason: 'not-allowed' | 'unknown-scale';
|
|
1731
|
-
readonly field?: string | undefined;
|
|
1732
|
-
constructor(currency: string, reason: 'not-allowed' | 'unknown-scale', field?: string | undefined);
|
|
1733
|
-
}
|
|
1734
|
-
/** Raised when an aggregate operation is not supported on a money field. */
|
|
1735
|
-
declare class MoneyUnsupportedError extends NoydbError {
|
|
1736
|
-
readonly field: string;
|
|
1737
|
-
constructor(field: string, message?: string);
|
|
1363
|
+
declare class ForgetStrategyNotConfiguredError extends NoydbError {
|
|
1364
|
+
constructor(message?: string);
|
|
1738
1365
|
}
|
|
1739
|
-
/** Create a {@link MoneyDescriptor}. */
|
|
1740
|
-
declare function money(options: MoneyOptions): MoneyDescriptor;
|
|
1741
|
-
/** Runtime predicate for detecting a {@link MoneyDescriptor}. */
|
|
1742
|
-
declare function isMoneyDescriptor(x: unknown): x is MoneyDescriptor;
|
|
1743
|
-
|
|
1744
1366
|
/**
|
|
1745
|
-
*
|
|
1746
|
-
*
|
|
1747
|
-
*
|
|
1748
|
-
*
|
|
1749
|
-
*
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1752
|
-
* const byClient = invoices.query()
|
|
1753
|
-
* .where('status', '==', 'open')
|
|
1754
|
-
* .groupBy('clientId')
|
|
1755
|
-
* .aggregate({ total: sum('amount'), n: count() })
|
|
1756
|
-
* .run()
|
|
1757
|
-
* // → [ { clientId: 'c1', total: 5250, n: 3 }, … ]
|
|
1758
|
-
* ```
|
|
1759
|
-
*
|
|
1760
|
-
* Execution pipeline:
|
|
1761
|
-
*
|
|
1762
|
-
* 1. Run the query's where/filter clauses (same candidate /
|
|
1763
|
-
* filter pipeline as `.aggregate()` directly on Query).
|
|
1764
|
-
* 2. Partition the matching records into buckets keyed by
|
|
1765
|
-
* `readPath(record, field)`. JS `Map` preserves insertion
|
|
1766
|
-
* order, so the first-seen key for a bucket determines its
|
|
1767
|
-
* position in the result array — consumers who want a
|
|
1768
|
-
* specific ordering should `.sort()` downstream.
|
|
1769
|
-
* 3. Enforce cardinality: warn once per field at 10% of the cap
|
|
1770
|
-
* (10_000 buckets), throw `GroupCardinalityError` at 100% of
|
|
1771
|
-
* the cap (100_000 buckets).
|
|
1772
|
-
* 4. For each bucket, build a per-group reducer state and
|
|
1773
|
-
* step every record in the bucket through it.
|
|
1774
|
-
* 5. Emit one result row per bucket, shaped as
|
|
1775
|
-
* `{ [field]: key, ...reduced }`.
|
|
1776
|
-
*
|
|
1777
|
-
* **Null / undefined keys:** `Map` distinguishes `null` from
|
|
1778
|
-
* `undefined`, so records with a missing group field get their own
|
|
1779
|
-
* bucket, and records with an explicit `null` value get a separate
|
|
1780
|
-
* bucket from that. Consumers who want them merged can coalesce
|
|
1781
|
-
* upstream with `.filter()`.
|
|
1782
|
-
*
|
|
1783
|
-
* **Live mode:** `.groupBy().aggregate().live()` re-runs the full
|
|
1784
|
-
* grouping pipeline on every source change. Per-bucket incremental
|
|
1785
|
-
* delta maintenance is a future optimization — the reducer
|
|
1786
|
-
* protocol's `remove()` hook admits it, but ships naive
|
|
1787
|
-
* re-grouping for simplicity.
|
|
1788
|
-
*
|
|
1789
|
-
* **Type-level stable-key narrowing:** when
|
|
1790
|
-
* `dictKey` lands, `groupBy<DictField>()` will narrow the group key
|
|
1791
|
-
* type to the stable dictionary key rather than the resolved locale
|
|
1792
|
-
* label. That prevents grouping by the locale-resolved label,
|
|
1793
|
-
* which would produce different buckets per reader. types the
|
|
1794
|
-
* key as `unknown` at the result shape; the dictKey narrowing
|
|
1795
|
-
* layers on top without an API break.
|
|
1796
|
-
*
|
|
1797
|
-
* Partition-awareness seam: when partitioned collections land,
|
|
1798
|
-
* per-partition grouping will need to merge sub-results across
|
|
1799
|
-
* partitions. The reducer protocol's `{ seed }` parameter
|
|
1800
|
-
* (already plumbed through in `reducers.ts`) is the mechanism —
|
|
1801
|
-
* groupBy doesn't need its own seam for the moment, because it
|
|
1802
|
-
* delegates to the reducer protocol for all per-bucket state.
|
|
1367
|
+
* Thrown by `openSealedRecord()` when the sealed CEK's binding has passed its
|
|
1368
|
+
* `expiresAt`. Surfaced on two checks: a cheap fast-path check on the delivery
|
|
1369
|
+
* envelope's clear-text `expiresAt`, and the AUTHORITATIVE check on the
|
|
1370
|
+
* `expiresAt` inside the sealed binding (the latter cannot be forged by editing
|
|
1371
|
+
* the delivery envelope). Distinct from {@link KeyringExpiredError} (bundle-slot
|
|
1372
|
+
* expiry) so a host can tell "this single-record grant lapsed" from a keyring-
|
|
1373
|
+
* level expiry.
|
|
1803
1374
|
*/
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
* consumers a heads-up before the hard error; the cap is a fixed
|
|
1808
|
-
* constant in (not overridable). A `{ maxGroups }` override
|
|
1809
|
-
* can be added later without a break if a real consumer asks.
|
|
1810
|
-
*/
|
|
1811
|
-
declare const GROUPBY_WARN_CARDINALITY = 10000;
|
|
1812
|
-
declare const GROUPBY_MAX_CARDINALITY = 100000;
|
|
1813
|
-
/**
|
|
1814
|
-
* Test-only: clear the per-field cardinality warning dedup between
|
|
1815
|
-
* tests. Production code never calls this — matching the
|
|
1816
|
-
* `resetJoinWarnings` pattern in `join.ts`.
|
|
1817
|
-
*/
|
|
1818
|
-
declare function resetGroupByWarnings(): void;
|
|
1819
|
-
/**
|
|
1820
|
-
* Result row shape for a grouped aggregation. Each row carries the
|
|
1821
|
-
* group key value under the grouping field name plus every reducer
|
|
1822
|
-
* output from the spec.
|
|
1823
|
-
*
|
|
1824
|
-
* types the group key as `unknown` at the result shape — the
|
|
1825
|
-
* runtime read via `readPath` can return any value, and narrowing
|
|
1826
|
-
* to a specific type would require the caller to assert at the
|
|
1827
|
-
* call site. `dictKey` narrowing layers on top of this by
|
|
1828
|
-
* adding an overload that constrains `F` when the grouping field
|
|
1829
|
-
* is a `dictKey`.
|
|
1830
|
-
*/
|
|
1831
|
-
type GroupedRow<F extends string, R> = {
|
|
1832
|
-
[K in F]: unknown;
|
|
1833
|
-
} & R;
|
|
1834
|
-
/**
|
|
1835
|
-
* Multi-key variant — result-row shape for variadic
|
|
1836
|
-
* `.groupBy(...fields)`. Every grouped field name appears on the row
|
|
1837
|
-
* (typed as `unknown` for the same reason as `GroupedRow`), plus the
|
|
1838
|
-
* reducer outputs from the spec.
|
|
1839
|
-
*/
|
|
1840
|
-
type GroupedRowN<F extends readonly string[], R> = {
|
|
1841
|
-
[K in F[number]]: unknown;
|
|
1842
|
-
} & R;
|
|
1843
|
-
/**
|
|
1844
|
-
* Shared base class for the chainable grouped-query wrappers. Holds
|
|
1845
|
-
* the constructor + protected fields that both single-key
|
|
1846
|
-
* `GroupedQuery<T, F>` and variadic `GroupedQueryN<T, F>` need; each
|
|
1847
|
-
* subclass only overrides `aggregate()` with its own result-row
|
|
1848
|
-
* generic.
|
|
1849
|
-
*
|
|
1850
|
-
* Not exported — implementation detail. Adding `.having()` /
|
|
1851
|
-
* `.live()` / `.orderByGroup()` etc. in the future lands here once
|
|
1852
|
-
* and both subclasses pick it up automatically.
|
|
1853
|
-
*
|
|
1854
|
-
* @internal
|
|
1855
|
-
*/
|
|
1856
|
-
declare abstract class GroupedQueryBase {
|
|
1857
|
-
protected readonly executeRecords: () => readonly unknown[];
|
|
1858
|
-
protected readonly upstreams: readonly AggregationUpstream[];
|
|
1859
|
-
/**
|
|
1860
|
-
* Optional dict label resolver attached by the query builder when
|
|
1861
|
-
* the grouping field is a dictKey. Variadic groupings always pass
|
|
1862
|
-
* `undefined` — `<field>Label` projection has no meaningful shape
|
|
1863
|
-
* for composite keys.
|
|
1864
|
-
*/
|
|
1865
|
-
protected readonly dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined;
|
|
1866
|
-
/**
|
|
1867
|
-
* Money field descriptors for the backing collection — used to
|
|
1868
|
-
* rewrite `sum`/`min`/`max` over money fields into exact BigInt
|
|
1869
|
-
* reducers when `.aggregate(spec)` is terminated.
|
|
1870
|
-
*/
|
|
1871
|
-
protected readonly moneyFields?: Record<string, MoneyDescriptor> | undefined;
|
|
1872
|
-
/**
|
|
1873
|
-
* Field set this grouped query buckets on. Stored in declaration
|
|
1874
|
-
* order — the same order is preserved on every result row by
|
|
1875
|
-
* `groupAndReduce`. For the single-field constructor, this is
|
|
1876
|
-
* `[field]`.
|
|
1877
|
-
*/
|
|
1878
|
-
protected readonly fields: readonly string[];
|
|
1879
|
-
constructor(executeRecords: () => readonly unknown[], fieldOrFields: string | readonly string[], upstreams: readonly AggregationUpstream[],
|
|
1880
|
-
/**
|
|
1881
|
-
* Optional dict label resolver attached by the query builder when
|
|
1882
|
-
* the grouping field is a dictKey. Variadic groupings always pass
|
|
1883
|
-
* `undefined` — `<field>Label` projection has no meaningful shape
|
|
1884
|
-
* for composite keys.
|
|
1885
|
-
*/
|
|
1886
|
-
dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined,
|
|
1887
|
-
/**
|
|
1888
|
-
* Money field descriptors for the backing collection — used to
|
|
1889
|
-
* rewrite `sum`/`min`/`max` over money fields into exact BigInt
|
|
1890
|
-
* reducers when `.aggregate(spec)` is terminated.
|
|
1891
|
-
*/
|
|
1892
|
-
moneyFields?: Record<string, MoneyDescriptor> | undefined);
|
|
1893
|
-
/** Apply money-aware reducer rewriting when money fields are declared. */
|
|
1894
|
-
protected wrapSpec<Spec extends AggregateSpec>(spec: Spec): Spec;
|
|
1895
|
-
}
|
|
1896
|
-
/**
|
|
1897
|
-
* Chainable wrapper returned by `Query.groupBy(field)`. Terminates
|
|
1898
|
-
* with `.aggregate(spec)` which returns a `GroupedAggregation`.
|
|
1899
|
-
*
|
|
1900
|
-
* Kept minimal — the only operation on a grouped query is
|
|
1901
|
-
* aggregation. Ordering, limiting, and further filtering belong on
|
|
1902
|
-
* the underlying `Query` before `.groupBy()` is called; applying
|
|
1903
|
-
* them post-group would be a different operation (`having` /
|
|
1904
|
-
* `groupOrderBy`), out of scope for.
|
|
1905
|
-
*/
|
|
1906
|
-
declare class GroupedQuery<T, F extends string> extends GroupedQueryBase {
|
|
1907
|
-
/**
|
|
1908
|
-
* Build a grouped aggregation. Returns a `GroupedAggregation`
|
|
1909
|
-
* with `.run()`, `.runAsync()`, and `.live()` terminals — same shape
|
|
1910
|
-
* as the non-grouped `.aggregate()` wrapper, just with an array
|
|
1911
|
-
* result (one row per bucket) instead of a single reduced object.
|
|
1912
|
-
*/
|
|
1913
|
-
aggregate<Spec extends AggregateSpec>(spec: Spec): GroupedAggregation<GroupedRow<F, AggregateResult<Spec>>>;
|
|
1914
|
-
}
|
|
1915
|
-
/**
|
|
1916
|
-
* Variadic-keyed sibling of `GroupedQuery<T, F>`. Constructed by the
|
|
1917
|
-
* multi-arg `Query.groupBy(...fields)` overload. The runtime shape is
|
|
1918
|
-
* identical — only the type-level result-row narrowing differs.
|
|
1919
|
-
*/
|
|
1920
|
-
declare class GroupedQueryN<T, F extends readonly string[]> extends GroupedQueryBase {
|
|
1921
|
-
aggregate<Spec extends AggregateSpec>(spec: Spec): GroupedAggregation<GroupedRowN<F, AggregateResult<Spec>>>;
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* Execute the group-and-reduce pipeline. Pure function over a
|
|
1925
|
-
* record array and a spec — shared by `GroupedAggregation.run()`
|
|
1926
|
-
* and the live-mode refresh path. Exported for tests and for any
|
|
1927
|
-
* future `scan().groupBy().aggregate()` reuse.
|
|
1928
|
-
*
|
|
1929
|
-
* Enforces the cardinality cap incrementally during the partition
|
|
1930
|
-
* loop, so a runaway grouping throws at the moment the 100_001st
|
|
1931
|
-
* bucket would be created — the consumer doesn't have to wait for
|
|
1932
|
-
* the full partition to materialize before the error fires.
|
|
1933
|
-
*/
|
|
1934
|
-
declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFields: string | readonly string[], spec: AggregateSpec): R[];
|
|
1935
|
-
/**
|
|
1936
|
-
* Grouped aggregation wrapper — the `.groupBy(field).aggregate(spec)`
|
|
1937
|
-
* terminal. Shape mirrors `Aggregation<R>` from aggregate.ts: two
|
|
1938
|
-
* terminals (`.run()` and `.live()`), spec bound at construction
|
|
1939
|
-
* time, upstreams collected for live mode.
|
|
1940
|
-
*
|
|
1941
|
-
* The generic `R` is the per-row result shape (i.e. a single
|
|
1942
|
-
* grouped row), and the terminals return `R[]` — one row per
|
|
1943
|
-
* bucket.
|
|
1944
|
-
*/
|
|
1945
|
-
declare class GroupedAggregation<R> {
|
|
1946
|
-
private readonly executeRecords;
|
|
1947
|
-
private readonly spec;
|
|
1948
|
-
private readonly upstreams;
|
|
1949
|
-
/**
|
|
1950
|
-
* Optional dict label resolver for `<field>Label` projection
|
|
1951
|
-
*. Present when the grouping field is a dictKey.
|
|
1952
|
-
*/
|
|
1953
|
-
private readonly dictLabelResolver?;
|
|
1954
|
-
private readonly fields;
|
|
1955
|
-
constructor(executeRecords: () => readonly unknown[], fields: string | readonly string[], spec: AggregateSpec, upstreams: readonly AggregationUpstream[],
|
|
1956
|
-
/**
|
|
1957
|
-
* Optional dict label resolver for `<field>Label` projection
|
|
1958
|
-
*. Present when the grouping field is a dictKey.
|
|
1959
|
-
*/
|
|
1960
|
-
dictLabelResolver?: ((key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>) | undefined);
|
|
1961
|
-
/** Execute the query, group, reduce, and return an array of rows. */
|
|
1962
|
-
run(): R[];
|
|
1963
|
-
/**
|
|
1964
|
-
* Execute the query, group, reduce, and resolve `<field>Label` for
|
|
1965
|
-
* each result row when the grouping field is a `dictKey` and a
|
|
1966
|
-
* `locale` is provided. Returns `R[]` synchronously when
|
|
1967
|
-
* no locale is specified (identical to `.run()`).
|
|
1968
|
-
*
|
|
1969
|
-
* The `<field>Label` field is appended to each row. Rows whose group
|
|
1970
|
-
* key has no dictionary entry get `<field>Label: undefined`.
|
|
1971
|
-
*
|
|
1972
|
-
* Dict-label resolution is single-field only — multi-key groupings
|
|
1973
|
-
* do not produce a `<field>Label`. The resolver is only attached
|
|
1974
|
-
* by the builder when `fields.length === 1`.
|
|
1975
|
-
*/
|
|
1976
|
-
runAsync(opts?: {
|
|
1977
|
-
locale?: string;
|
|
1978
|
-
fallback?: string | readonly string[];
|
|
1979
|
-
}): Promise<R[]>;
|
|
1980
|
-
/**
|
|
1981
|
-
* Build a reactive `LiveAggregation<R[]>` that re-runs the full
|
|
1982
|
-
* group-and-reduce pipeline whenever any upstream source notifies
|
|
1983
|
-
* of a change. Same error-isolation and idempotent-stop contract
|
|
1984
|
-
* as `Aggregation.live()` — the implementation delegates to the
|
|
1985
|
-
* same `LiveAggregationImpl` class by threading a fresh
|
|
1986
|
-
* recompute closure through the existing constructor.
|
|
1987
|
-
*
|
|
1988
|
-
* uses naive full re-run on every change. Incremental
|
|
1989
|
-
* per-bucket maintenance (apply `step` on inserted records,
|
|
1990
|
-
* `remove` on deleted records, route by bucket key) is a future
|
|
1991
|
-
* optimization — the reducer protocol admits it, but wiring
|
|
1992
|
-
* delta-aware source subscriptions is a separate PR.
|
|
1993
|
-
*
|
|
1994
|
-
* Always call `live.stop()` when finished.
|
|
1995
|
-
*/
|
|
1996
|
-
live(): LiveAggregation<R[]>;
|
|
1375
|
+
declare class SealedRecordExpiredError extends NoydbError {
|
|
1376
|
+
readonly expiresAt: string;
|
|
1377
|
+
constructor(expiresAt: string);
|
|
1997
1378
|
}
|
|
1998
|
-
|
|
1999
1379
|
/**
|
|
2000
|
-
*
|
|
2001
|
-
*
|
|
2002
|
-
*
|
|
2003
|
-
*
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2008
|
-
* `@noy-db/hub/aggregate` subpath. Consumers that don't import the
|
|
2009
|
-
* subpath ship none of the ~886 LOC.
|
|
2010
|
-
*
|
|
2011
|
-
* @internal
|
|
1380
|
+
* Thrown by `openSealedRecord()` when the sealed binding's
|
|
1381
|
+
* `{collection, id}` does not match the record envelope the host is trying to
|
|
1382
|
+
* decrypt. This is the host-denial boundary: a CEK sealed for record A cannot
|
|
1383
|
+
* be replayed against record B's envelope. (A CEK sealed for a PRE-rotation
|
|
1384
|
+
* version of a record, applied to the POST-rotation live envelope, is a
|
|
1385
|
+
* different failure — the binding still matches `{collection, id}` so it gets
|
|
1386
|
+
* past this check, and the AES-GCM auth-tag failure surfaces as
|
|
1387
|
+
* {@link TamperedError} instead.)
|
|
2012
1388
|
*/
|
|
2013
|
-
|
|
1389
|
+
declare class SealedRecordMismatchError extends NoydbError {
|
|
1390
|
+
readonly expected: {
|
|
1391
|
+
collection: string;
|
|
1392
|
+
id: string;
|
|
1393
|
+
};
|
|
1394
|
+
readonly actual: {
|
|
1395
|
+
collection: string;
|
|
1396
|
+
id: string;
|
|
1397
|
+
};
|
|
1398
|
+
constructor(expected: {
|
|
1399
|
+
collection: string;
|
|
1400
|
+
id: string;
|
|
1401
|
+
}, actual: {
|
|
1402
|
+
collection: string;
|
|
1403
|
+
id: string;
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
2014
1406
|
/**
|
|
2015
|
-
*
|
|
2016
|
-
*
|
|
2017
|
-
*
|
|
2018
|
-
*
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
* constructs a real `Aggregation`.
|
|
2026
|
-
*/
|
|
2027
|
-
aggregate<Spec extends AggregateSpec>(executeRecords: () => readonly unknown[], spec: Spec, upstreams: readonly AggregationUpstream[]): Aggregation<AggregateResult<Spec>>;
|
|
2028
|
-
/**
|
|
2029
|
-
* Build a `GroupedQuery<T, F>` for `Query.groupBy(field)`. Same
|
|
2030
|
-
* closure / upstream inputs as `aggregate` plus the group key field.
|
|
2031
|
-
*/
|
|
2032
|
-
groupBy<T, F extends string>(executeRecords: () => readonly unknown[], field: F, upstreams: readonly AggregationUpstream[], dictLabelResolver?: (key: string, locale: string, fallback?: string | readonly string[]) => Promise<string | undefined>, moneyFields?: Record<string, MoneyDescriptor>): GroupedQuery<T, F>;
|
|
2033
|
-
/**
|
|
2034
|
-
* Variadic-keyed sibling — builds a `GroupedQueryN<T, F>` for
|
|
2035
|
-
* `Query.groupBy(...fields)`. No dictLabelResolver — `<field>Label`
|
|
2036
|
-
* projection only applies to single-field groupings, which dispatch
|
|
2037
|
-
* through `groupBy` above.
|
|
2038
|
-
*/
|
|
2039
|
-
groupByN<T, F extends readonly string[]>(executeRecords: () => readonly unknown[], fields: F, upstreams: readonly AggregationUpstream[], moneyFields?: Record<string, MoneyDescriptor>): GroupedQueryN<T, F>;
|
|
2040
|
-
/**
|
|
2041
|
-
* Terminal streaming aggregator for `ScanBuilder.aggregate(spec)`.
|
|
2042
|
-
* Takes an async iterable of decrypted records + the spec and
|
|
2043
|
-
* returns the reduced result.
|
|
2044
|
-
*/
|
|
2045
|
-
scanAggregate<Spec extends AggregateSpec>(iter: AsyncIterable<unknown>, spec: Spec): Promise<AggregateResult<Spec>>;
|
|
1407
|
+
* Thrown by `vault.sealRecordToHost()` / `vault.rotateRecordCek()` when the
|
|
1408
|
+
* target record has no live envelope, or its live envelope carries no `_cek`
|
|
1409
|
+
* (a legacy / non-`perRecordKeys` collection has nothing record-scoped to
|
|
1410
|
+
* seal — its body is keyed off the shared collection DEK, which sealing
|
|
1411
|
+
* deliberately never exposes).
|
|
1412
|
+
*/
|
|
1413
|
+
declare class RecordCekNotFoundError extends NoydbError {
|
|
1414
|
+
readonly collection: string;
|
|
1415
|
+
readonly id: string;
|
|
1416
|
+
constructor(collection: string, id: string);
|
|
2046
1417
|
}
|
|
2047
1418
|
|
|
2048
|
-
export {
|
|
1419
|
+
export { ForgetStrategyNotConfiguredError as $, AmendmentForbiddenError as A, BackupCorruptedError as B, MaterializedViewSourceUnknownError as C, DictKeyInUseError as D, MaterializedViewTooLargeError as E, FieldFrozenError as F, AlreadyElevatedError as G, ConflictError as H, InvariantError as I, CrossJoinSourceUnknownError as J, CrossJoinTooLargeError as K, LocaleNotSpecifiedError as L, MissingTranslationError as M, NoydbError as N, OverlayBaseIsVirtualError as O, PartitionExtractionError as P, DanglingReferenceError as Q, ReservedCollectionNameError as R, ScriptViolationError as S, TranslatorNotConfiguredError as T, UnknownDictCodeError as U, DecryptionError as V, DelegationTargetMissingError as W, DirectoryDisabledError as X, ElevationExpiredError as Y, ExportCapabilityError as Z, FilenameSanitizationError as _, DictKeyMissingError as a, GroupCardinalityError as a0, ImportCapabilityError as a1, IndexRequiredError as a2, IndexWriteFailureError as a3, InvalidKeyError as a4, JoinTooLargeError as a5, KeyringCorruptError as a6, KeyringExpiredError as a7, LedgerContentionError as a8, MigrationRequiredError as a9, UniqueConstraintError as aA, UnknownShardError as aB, UnsupportedIndexOptionError as aC, ValidationError as aD, VaultTemplateNotFoundError as aE, NetworkError as aa, NoAccessError as ab, NonAdditiveSchemaChangeError as ac, NotFoundError as ad, NumberingUncertaintyError as ae, PathEscapeError as af, PeriodClosedError as ag, PermissionDeniedError as ah, PrivilegeEscalationError as ai, QuiesceTimeoutError as aj, ReadOnlyAtInstantError as ak, ReadOnlyError as al, ReadOnlyFrameError as am, RecordCekNotFoundError as an, ReservedVaultNameError as ao, SchemaFenceError as ap, SchemaLockedError as aq, SchemaUpdateError as ar, SchemaValidationError as as, SequenceContentionError as at, SequenceOfflineError as au, ShardProvisioningError as av, StoreCapabilityError as aw, TamperedError as ax, TierDemoteDeniedError as ay, TierNotGrantedError as az, StaticDictReadonlyError as b, SessionExpiredError as c, SessionNotFoundError as d, SessionPolicyError as e, RecordLockedError as f, SnapshotNotFoundError as g, DerivationCapExceededError as h, DerivationCycleError as i, DerivationDepthError as j, DerivationOutputShapeError as k, DerivationOutputUnknownError as l, OverlayCollectionUnavailableError as m, OverlayIdMismatchError as n, OverlayNameCollisionError as o, SealedRecordExpiredError as p, SealedRecordMismatchError as q, AttestationError as r, AdoptionStateError as s, BackupLedgerError as t, BundleIntegrityError as u, BundleSealMismatchError as v, BundleVersionConflictError as w, TransferSealError as x, MaterializedViewConfigError as y, MaterializedViewCycleError as z };
|