@noy-db/hub 0.2.0-pre.3 → 0.2.0-pre.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -0
- package/dist/adapter/index.d.ts +9 -0
- package/dist/adapter/index.js +14 -0
- package/dist/aggregate/index.d.ts +3 -2
- package/dist/aggregate/index.js +10 -8
- package/dist/aggregate/index.js.map +1 -1
- package/dist/attestation/index.d.ts +7 -5
- package/dist/attestation/index.js +7 -6
- package/dist/attestation/index.js.map +1 -1
- package/dist/blobs/index.d.ts +9 -7
- package/dist/blobs/index.js +12 -6
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.d.ts +29 -18
- package/dist/bundle/index.js +53 -192
- package/dist/bundle/index.js.map +1 -1
- package/dist/{chunk-75QDHSE4.js → chunk-2QDWRK3B.js} +5 -5
- package/dist/{chunk-74JEQFMT.js → chunk-2UT7HJJR.js} +5 -5
- package/dist/chunk-2UT7HJJR.js.map +1 -0
- package/dist/{chunk-FCDO7UAO.js → chunk-2ZYIN3BL.js} +2 -2
- package/dist/{chunk-BFI3RS42.js → chunk-33EQCZXE.js} +2 -2
- package/dist/chunk-33EQCZXE.js.map +1 -0
- package/dist/{chunk-WRLHNG6H.js → chunk-4K4QKYK4.js} +4 -4
- package/dist/chunk-4K4QKYK4.js.map +1 -0
- package/dist/{chunk-HGZ7DC5H.js → chunk-4L6N56B4.js} +2 -2
- package/dist/chunk-4L6N56B4.js.map +1 -0
- package/dist/{chunk-YMYK7US4.js → chunk-4YD7VZH4.js} +2 -2
- package/dist/chunk-4YD7VZH4.js.map +1 -0
- package/dist/{chunk-ZUMGGHRB.js → chunk-5PTX7PKD.js} +4 -4
- package/dist/{chunk-QAU5HM6Q.js → chunk-6EKRQ7QF.js} +3 -3
- package/dist/{chunk-ZC2AAE6J.js → chunk-7GPQPLGO.js} +19 -4
- package/dist/chunk-7GPQPLGO.js.map +1 -0
- package/dist/{chunk-EPK6A3WJ.js → chunk-A3JMGXPG.js} +2 -2
- package/dist/chunk-A3JMGXPG.js.map +1 -0
- package/dist/{chunk-FXQYZNOW.js → chunk-A7DNZVAV.js} +1 -1
- package/dist/chunk-A7DNZVAV.js.map +1 -0
- package/dist/{chunk-UMLVJTYV.js → chunk-ADB7GPM3.js} +7 -4
- package/dist/chunk-ADB7GPM3.js.map +1 -0
- package/dist/{chunk-YL2DR3HY.js → chunk-ASIGWYRA.js} +2 -2
- package/dist/chunk-ASIGWYRA.js.map +1 -0
- package/dist/{chunk-2EYC3WDT.js → chunk-AWU4JF7C.js} +93 -93
- package/dist/chunk-AWU4JF7C.js.map +1 -0
- package/dist/chunk-BEZ2EV43.js +129 -0
- package/dist/chunk-BEZ2EV43.js.map +1 -0
- package/dist/{chunk-IS5HWQO7.js → chunk-CIZDUAHI.js} +30 -4
- package/dist/chunk-CIZDUAHI.js.map +1 -0
- package/dist/{chunk-4OQWR46B.js → chunk-CUPTCF4R.js} +5 -5
- package/dist/chunk-CUPTCF4R.js.map +1 -0
- package/dist/{chunk-5ZGZ6HIZ.js → chunk-DEE4CRYN.js} +30 -7
- package/dist/chunk-DEE4CRYN.js.map +1 -0
- package/dist/{chunk-UOF74WQY.js → chunk-E2MDPPOC.js} +37 -2
- package/dist/chunk-E2MDPPOC.js.map +1 -0
- package/dist/{chunk-SAVQ6E2O.js → chunk-FFKQ65YX.js} +10 -3
- package/dist/chunk-FFKQ65YX.js.map +1 -0
- package/dist/{chunk-2XLVPKXG.js → chunk-G7ALNCQH.js} +10 -2
- package/dist/chunk-G7ALNCQH.js.map +1 -0
- package/dist/chunk-GGXN73NM.js +252 -0
- package/dist/chunk-GGXN73NM.js.map +1 -0
- package/dist/{chunk-UVPGJXVO.js → chunk-JOJPBZSZ.js} +5 -5
- package/dist/{chunk-YDLAFP36.js → chunk-JZ5DS4DP.js} +346 -3
- package/dist/chunk-JZ5DS4DP.js.map +1 -0
- package/dist/{chunk-KMI2NBBF.js → chunk-K4JID2ZE.js} +44 -8
- package/dist/chunk-K4JID2ZE.js.map +1 -0
- package/dist/{aggregate/index.cjs → chunk-K6NVSHAH.js} +241 -210
- package/dist/chunk-K6NVSHAH.js.map +1 -0
- package/dist/chunk-KJ3K5VZM.js +524 -0
- package/dist/chunk-KJ3K5VZM.js.map +1 -0
- package/dist/chunk-L5HHBOMS.js +232 -0
- package/dist/chunk-L5HHBOMS.js.map +1 -0
- package/dist/{chunk-YK72A4IT.js → chunk-LBILABKZ.js} +4 -4
- package/dist/chunk-LXKBG52H.js +151 -0
- package/dist/chunk-LXKBG52H.js.map +1 -0
- package/dist/{chunk-NGSPBLLE.js → chunk-MPIZQGFA.js} +50 -20
- package/dist/chunk-MPIZQGFA.js.map +1 -0
- package/dist/{chunk-4X2S7PBF.js → chunk-MRJPSXPE.js} +84 -70
- package/dist/chunk-MRJPSXPE.js.map +1 -0
- package/dist/{chunk-6S3LLAQ5.js → chunk-MSMDDDDJ.js} +3 -3
- package/dist/{chunk-6S3LLAQ5.js.map → chunk-MSMDDDDJ.js.map} +1 -1
- package/dist/{chunk-GAUBWHAF.js → chunk-OCYFFBZS.js} +4 -4
- package/dist/{chunk-NCO2JGKK.js → chunk-PDVP3C2I.js} +1 -1
- package/dist/chunk-PDVP3C2I.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/{chunk-P6256WTJ.js → chunk-QBLPY44S.js} +3 -3
- package/dist/chunk-QBLPY44S.js.map +1 -0
- package/dist/{query/index.cjs → chunk-QGBBQKDS.js} +706 -831
- package/dist/chunk-QGBBQKDS.js.map +1 -0
- package/dist/{chunk-FS7A4XNF.js → chunk-QWJCNXH2.js} +3 -3
- package/dist/chunk-QXWJQ7UU.js +380 -0
- package/dist/chunk-QXWJQ7UU.js.map +1 -0
- package/dist/{chunk-GDTCGIPX.js → chunk-RCB6GWTC.js} +27 -5
- package/dist/chunk-RCB6GWTC.js.map +1 -0
- package/dist/{chunk-K5PVGKE4.js → chunk-SAAJYSVV.js} +2 -2
- package/dist/{chunk-G7PAZ3TD.js → chunk-SHJ3BRTZ.js} +46 -10
- package/dist/chunk-SHJ3BRTZ.js.map +1 -0
- package/dist/chunk-SQXTKZL7.js +125 -0
- package/dist/chunk-SQXTKZL7.js.map +1 -0
- package/dist/chunk-STNPB3UM.js +9 -0
- package/dist/chunk-STNPB3UM.js.map +1 -0
- package/dist/{chunk-NSLTPGEN.js → chunk-TMUMMAWV.js} +12 -2
- package/dist/{chunk-NSLTPGEN.js.map → chunk-TMUMMAWV.js.map} +1 -1
- package/dist/{chunk-LS3JLEIB.js → chunk-TZGWI5AX.js} +4 -4
- package/dist/{chunk-GD3BGKAR.js → chunk-UBF5JEOJ.js} +44 -5
- package/dist/chunk-UBF5JEOJ.js.map +1 -0
- package/dist/{chunk-T6HQMVML.js → chunk-W5NVNJDX.js} +5250 -801
- package/dist/chunk-W5NVNJDX.js.map +1 -0
- package/dist/chunk-XAYDHD2O.js +123 -0
- package/dist/chunk-XAYDHD2O.js.map +1 -0
- package/dist/{chunk-LOL725S4.js → chunk-XYW2CSCI.js} +31 -3
- package/dist/chunk-XYW2CSCI.js.map +1 -0
- package/dist/{chunk-TLFUDXVV.js → chunk-ZCMOS4H2.js} +31 -10
- package/dist/chunk-ZCMOS4H2.js.map +1 -0
- package/dist/{chunk-FBMXWVGP.js → chunk-ZK66B5EY.js} +450 -30
- package/dist/chunk-ZK66B5EY.js.map +1 -0
- package/dist/{chunk-GVXBHCZ2.js → chunk-ZPJSQPQH.js} +66 -7
- package/dist/chunk-ZPJSQPQH.js.map +1 -0
- package/dist/consent/index.d.ts +8 -6
- package/dist/consent/index.js +4 -3
- package/dist/consent/index.js.map +1 -1
- package/dist/crdt/index.js +1 -0
- package/dist/crdt/index.js.map +1 -1
- package/dist/{crypto-H2Y3DDFW.js → crypto-OSIV2IIW.js} +8 -3
- package/dist/{ulid-CiM2OAeM.d.ts → decrypt-partition-CXS5KopB.d.ts} +37 -82
- package/dist/{delegation-QSC7G5QC.js → delegation-BQTRJATI.js} +6 -5
- package/dist/derivations/index.d.ts +11 -9
- package/dist/derivations/index.js +9 -6
- package/dist/{dev-unlock-Cf2B7Kih.d.ts → dev-unlock-CnHTTVea.d.ts} +1 -1
- package/dist/discriminant-BN9REW3o.d.ts +60 -0
- package/dist/errors-BAWO5Z5a.d.ts +1500 -0
- package/dist/executor-KYSKFJ2R.js +9 -0
- package/dist/executor-M7W3NEKR.js +9 -0
- package/dist/executor-VDTDGWO6.js +13 -0
- package/dist/{fanout-sidecar-NRBWSLRK.js → fanout-sidecar-AZALISHB.js} +3 -2
- package/dist/fanout-sidecar-AZALISHB.js.map +1 -0
- package/dist/forget/index.d.ts +1 -0
- package/dist/forget/index.js +15 -0
- package/dist/guards/index.d.ts +16 -8
- package/dist/guards/index.js +12 -5
- package/dist/{hash-gVn_uKhp.d.ts → hash-oc5paYl0.d.ts} +1 -1
- package/dist/history/index.d.ts +9 -7
- package/dist/history/index.js +10 -7
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.d.ts +8 -6
- package/dist/i18n/index.js +116 -15
- package/dist/i18n/index.js.map +1 -1
- package/dist/index-BMmajblo.d.ts +362 -0
- package/dist/index-BmhGztUi.d.ts +93 -0
- package/dist/{types-D9eB0Rvh.d.ts → index-DHn9lEP0.d.ts} +4305 -1523
- package/dist/{index-BF1B2HB9.d.ts → index-Ddm8D3Oo.d.ts} +186 -1151
- package/dist/index.d.ts +342 -70
- package/dist/index.js +420 -112
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +5 -4
- package/dist/indexing/index.js.map +1 -1
- package/dist/issue-DPHRF2TI.js +13 -0
- package/dist/kernel/index.d.ts +11 -0
- package/dist/kernel/index.js +50 -0
- package/dist/{lazy-builder-Rpd-V3jP.d.ts → lazy-builder-ChSqcF5t.d.ts} +2 -2
- package/dist/{ledger-WOEJUYTP.js → ledger-CI7GSMLB.js} +7 -6
- package/dist/materialized-views/index.d.ts +23 -20
- package/dist/materialized-views/index.js +9 -7
- package/dist/mime-magic-JeLKHRng.d.ts +103 -0
- package/dist/noydb-NAU2DTFP.js +40 -0
- package/dist/overlay-views/index.d.ts +32 -12
- package/dist/overlay-views/index.js +7 -6
- package/dist/periods/index.d.ts +8 -6
- package/dist/periods/index.js +7 -6
- package/dist/{predicate-Dnu81tsS.d.cts → predicate-BmhBSPCH.d.ts} +87 -5
- package/dist/{public-envelope-OHQ5UZFM.js → public-envelope-MFMBFJLZ.js} +5 -4
- package/dist/query/index.d.ts +4 -3
- package/dist/query/index.js +14 -6
- package/dist/read-only-facade-3OQRZ3VS.js +8 -0
- package/dist/registry-IX5WKK4F.js +8 -0
- package/dist/registry-LMHO5265.js +11 -0
- package/dist/registry-TXCKWH26.js +9 -0
- package/dist/registry-VFEDQSYV.js +9 -0
- package/dist/revoke-5PUOZPJJ.js +18 -0
- package/dist/revoke-5PUOZPJJ.js.map +1 -0
- package/dist/sealed-record/index.d.ts +123 -0
- package/dist/sealed-record/index.js +43 -0
- package/dist/sealed-record/index.js.map +1 -0
- package/dist/session/index.d.ts +9 -7
- package/dist/session/index.js +4 -3
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.d.ts +8 -6
- package/dist/shadow/index.js +3 -2
- package/dist/shadow/index.js.map +1 -1
- package/dist/{signer-M4K5HBLD.js → signer-UB5TQOZ6.js} +6 -5
- package/dist/signer-UB5TQOZ6.js.map +1 -0
- package/dist/snapshots/index.d.ts +30 -0
- package/dist/snapshots/index.js +153 -0
- package/dist/snapshots/index.js.map +1 -0
- package/dist/{stale-PAGCS4K5.js → stale-J3TUF5C5.js} +3 -2
- package/dist/stale-J3TUF5C5.js.map +1 -0
- package/dist/store/index.d.ts +15 -6
- package/dist/store/index.js +3 -2
- package/dist/{strategy-DSTrsZ8t.d.ts → strategy-8QGs5KQE.d.ts} +475 -7
- package/dist/sync/index.d.ts +7 -5
- package/dist/sync/index.js +5 -4
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.d.ts +8 -6
- package/dist/team/index.js +9 -8
- package/dist/transition-guard-Dy3NioQr.d.ts +165 -0
- package/dist/tx/index.d.ts +26 -8
- package/dist/tx/index.js +10 -5
- package/dist/tx/index.js.map +1 -1
- package/dist/ulid-DRH25k3y.d.ts +66 -0
- package/dist/{ulid-COREQ2RQ.js → ulid-KEPZMD2N.js} +2 -1
- package/dist/ulid-KEPZMD2N.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +6 -1
- package/dist/util/index.js.map +1 -1
- package/dist/{with-materialized-view-qtoJ3xKJ.d.ts → with-materialized-view-DIVeez0W.d.ts} +2 -2
- package/dist/{with-overlayed-view-DFaRfgMr.d.ts → with-overlayed-view-DVZrc5Hb.d.ts} +2 -2
- package/dist/with-rollup-CbU-O4wP.d.ts +47 -0
- package/dist/zod-HAJM7LMS.js +14763 -0
- package/dist/zod-HAJM7LMS.js.map +1 -0
- package/package.json +73 -191
- package/dist/aggregate/index.cjs.map +0 -1
- package/dist/aggregate/index.d.cts +0 -38
- package/dist/attestation/index.cjs +0 -305
- package/dist/attestation/index.cjs.map +0 -1
- package/dist/attestation/index.d.cts +0 -52
- package/dist/blobs/index.cjs +0 -1480
- package/dist/blobs/index.cjs.map +0 -1
- package/dist/blobs/index.d.cts +0 -46
- package/dist/bundle/index.cjs +0 -18561
- package/dist/bundle/index.cjs.map +0 -1
- package/dist/bundle/index.d.cts +0 -176
- package/dist/chunk-2EYC3WDT.js.map +0 -1
- package/dist/chunk-2XLVPKXG.js.map +0 -1
- package/dist/chunk-4OQWR46B.js.map +0 -1
- package/dist/chunk-4UBOTYP5.js +0 -1367
- package/dist/chunk-4UBOTYP5.js.map +0 -1
- package/dist/chunk-4X2S7PBF.js.map +0 -1
- package/dist/chunk-5YHWBPOT.js +0 -19
- package/dist/chunk-5YHWBPOT.js.map +0 -1
- package/dist/chunk-5ZGZ6HIZ.js.map +0 -1
- package/dist/chunk-74JEQFMT.js.map +0 -1
- package/dist/chunk-A6SWRXUQ.js +0 -118
- package/dist/chunk-A6SWRXUQ.js.map +0 -1
- package/dist/chunk-BFI3RS42.js.map +0 -1
- package/dist/chunk-EMEX37ZN.js +0 -51
- package/dist/chunk-EMEX37ZN.js.map +0 -1
- package/dist/chunk-EPK6A3WJ.js.map +0 -1
- package/dist/chunk-FBMXWVGP.js.map +0 -1
- package/dist/chunk-FXQYZNOW.js.map +0 -1
- package/dist/chunk-G7PAZ3TD.js.map +0 -1
- package/dist/chunk-GD3BGKAR.js.map +0 -1
- package/dist/chunk-GDTCGIPX.js.map +0 -1
- package/dist/chunk-GVXBHCZ2.js.map +0 -1
- package/dist/chunk-HGZ7DC5H.js.map +0 -1
- package/dist/chunk-IS5HWQO7.js.map +0 -1
- package/dist/chunk-KMI2NBBF.js.map +0 -1
- package/dist/chunk-KYKMKLJ6.js +0 -340
- package/dist/chunk-KYKMKLJ6.js.map +0 -1
- package/dist/chunk-LOL725S4.js.map +0 -1
- package/dist/chunk-MRIBLZL3.js +0 -86
- package/dist/chunk-MRIBLZL3.js.map +0 -1
- package/dist/chunk-NCO2JGKK.js.map +0 -1
- package/dist/chunk-NGSPBLLE.js.map +0 -1
- package/dist/chunk-P6256WTJ.js.map +0 -1
- package/dist/chunk-SAVQ6E2O.js.map +0 -1
- package/dist/chunk-T6HQMVML.js.map +0 -1
- package/dist/chunk-TLFUDXVV.js.map +0 -1
- package/dist/chunk-UMLVJTYV.js.map +0 -1
- package/dist/chunk-UOF74WQY.js.map +0 -1
- package/dist/chunk-WRLHNG6H.js.map +0 -1
- package/dist/chunk-YDLAFP36.js.map +0 -1
- package/dist/chunk-YL2DR3HY.js.map +0 -1
- package/dist/chunk-YMYK7US4.js.map +0 -1
- package/dist/chunk-ZC2AAE6J.js.map +0 -1
- package/dist/consent/index.cjs +0 -204
- package/dist/consent/index.cjs.map +0 -1
- package/dist/consent/index.d.cts +0 -25
- package/dist/crdt/index.cjs +0 -152
- package/dist/crdt/index.cjs.map +0 -1
- package/dist/crdt/index.d.cts +0 -30
- package/dist/derivations/index.cjs +0 -351
- package/dist/derivations/index.cjs.map +0 -1
- package/dist/derivations/index.d.cts +0 -72
- package/dist/dev-unlock-De3mjQWv.d.cts +0 -263
- package/dist/executor-BZKFZVRC.js +0 -8
- package/dist/executor-GFZFDQXV.js +0 -8
- package/dist/executor-KT2IOZVP.js +0 -11
- package/dist/fanout-sidecar-NRBWSLRK.js.map +0 -1
- package/dist/guards/index.cjs +0 -322
- package/dist/guards/index.cjs.map +0 -1
- package/dist/guards/index.d.cts +0 -31
- package/dist/hash-vBCB0-Ps.d.cts +0 -63
- package/dist/history/index.cjs +0 -1222
- package/dist/history/index.cjs.map +0 -1
- package/dist/history/index.d.cts +0 -63
- package/dist/i18n/index.cjs +0 -840
- package/dist/i18n/index.cjs.map +0 -1
- package/dist/i18n/index.d.cts +0 -39
- package/dist/index-DVkvrgpm.d.cts +0 -2290
- package/dist/index.cjs +0 -23590
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -778
- package/dist/indexing/index.cjs +0 -738
- package/dist/indexing/index.cjs.map +0 -1
- package/dist/indexing/index.d.cts +0 -36
- package/dist/issue-BAJ7ZB4S.js +0 -12
- package/dist/lazy-builder-C-rPfWG0.d.cts +0 -304
- package/dist/materialized-views/index.cjs +0 -837
- package/dist/materialized-views/index.cjs.map +0 -1
- package/dist/materialized-views/index.d.cts +0 -184
- package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
- package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
- package/dist/noydb-XNQSKXGO.js +0 -34
- package/dist/overlay-views/index.cjs +0 -359
- package/dist/overlay-views/index.cjs.map +0 -1
- package/dist/overlay-views/index.d.cts +0 -82
- package/dist/periods/index.cjs +0 -1041
- package/dist/periods/index.cjs.map +0 -1
- package/dist/periods/index.d.cts +0 -22
- package/dist/predicate-Dnu81tsS.d.ts +0 -185
- package/dist/query/index.cjs.map +0 -1
- package/dist/query/index.d.cts +0 -3
- package/dist/read-only-facade-ITU6L7BL.js +0 -7
- package/dist/registry-2IEARCGT.js +0 -7
- package/dist/registry-CDHASH73.js +0 -10
- package/dist/registry-EMGLZGR6.js +0 -8
- package/dist/registry-NQALYR77.js +0 -8
- package/dist/revoke-7JOVLZFD.js +0 -17
- package/dist/session/index.cjs +0 -495
- package/dist/session/index.cjs.map +0 -1
- package/dist/session/index.d.cts +0 -46
- package/dist/shadow/index.cjs +0 -133
- package/dist/shadow/index.cjs.map +0 -1
- package/dist/shadow/index.d.cts +0 -17
- package/dist/store/index.cjs +0 -1083
- package/dist/store/index.cjs.map +0 -1
- package/dist/store/index.d.cts +0 -492
- package/dist/strategy-BSxFXGzb.d.cts +0 -110
- package/dist/strategy-DSTrsZ8t.d.cts +0 -601
- package/dist/sync/index.cjs +0 -1062
- package/dist/sync/index.cjs.map +0 -1
- package/dist/sync/index.d.cts +0 -43
- package/dist/team/index.cjs +0 -2798
- package/dist/team/index.cjs.map +0 -1
- package/dist/team/index.d.cts +0 -118
- package/dist/tx/index.cjs +0 -544
- package/dist/tx/index.cjs.map +0 -1
- package/dist/tx/index.d.cts +0 -21
- package/dist/types-CSLcfytP.d.cts +0 -12493
- package/dist/ulid-CG2YvAbg.d.cts +0 -603
- package/dist/util/index.cjs +0 -230
- package/dist/util/index.cjs.map +0 -1
- package/dist/util/index.d.cts +0 -77
- package/dist/with-derivation-Bzpj6UTv.d.ts +0 -13
- package/dist/with-derivation-DWajFh4K.d.cts +0 -13
- package/dist/with-guard-DF_Ul3DT.d.cts +0 -18
- package/dist/with-guard-DR7U-l4v.d.ts +0 -18
- package/dist/with-materialized-view-_piodoIz.d.cts +0 -27
- package/dist/with-overlayed-view-DwzCKxn2.d.cts +0 -13
- /package/dist/{crypto-H2Y3DDFW.js.map → adapter/index.js.map} +0 -0
- /package/dist/{chunk-75QDHSE4.js.map → chunk-2QDWRK3B.js.map} +0 -0
- /package/dist/{chunk-FCDO7UAO.js.map → chunk-2ZYIN3BL.js.map} +0 -0
- /package/dist/{chunk-ZUMGGHRB.js.map → chunk-5PTX7PKD.js.map} +0 -0
- /package/dist/{chunk-QAU5HM6Q.js.map → chunk-6EKRQ7QF.js.map} +0 -0
- /package/dist/{chunk-UVPGJXVO.js.map → chunk-JOJPBZSZ.js.map} +0 -0
- /package/dist/{chunk-YK72A4IT.js.map → chunk-LBILABKZ.js.map} +0 -0
- /package/dist/{chunk-GAUBWHAF.js.map → chunk-OCYFFBZS.js.map} +0 -0
- /package/dist/{delegation-QSC7G5QC.js.map → chunk-PZ5AY32C.js.map} +0 -0
- /package/dist/{chunk-FS7A4XNF.js.map → chunk-QWJCNXH2.js.map} +0 -0
- /package/dist/{chunk-K5PVGKE4.js.map → chunk-SAAJYSVV.js.map} +0 -0
- /package/dist/{chunk-LS3JLEIB.js.map → chunk-TZGWI5AX.js.map} +0 -0
- /package/dist/{executor-BZKFZVRC.js.map → crypto-OSIV2IIW.js.map} +0 -0
- /package/dist/{executor-GFZFDQXV.js.map → delegation-BQTRJATI.js.map} +0 -0
- /package/dist/{executor-KT2IOZVP.js.map → executor-KYSKFJ2R.js.map} +0 -0
- /package/dist/{issue-BAJ7ZB4S.js.map → executor-M7W3NEKR.js.map} +0 -0
- /package/dist/{ledger-WOEJUYTP.js.map → executor-VDTDGWO6.js.map} +0 -0
- /package/dist/{noydb-XNQSKXGO.js.map → forget/index.js.map} +0 -0
- /package/dist/{public-envelope-OHQ5UZFM.js.map → issue-DPHRF2TI.js.map} +0 -0
- /package/dist/{read-only-facade-ITU6L7BL.js.map → kernel/index.js.map} +0 -0
- /package/dist/{registry-2IEARCGT.js.map → ledger-CI7GSMLB.js.map} +0 -0
- /package/dist/{registry-CDHASH73.js.map → noydb-NAU2DTFP.js.map} +0 -0
- /package/dist/{registry-EMGLZGR6.js.map → public-envelope-MFMBFJLZ.js.map} +0 -0
- /package/dist/{registry-NQALYR77.js.map → read-only-facade-3OQRZ3VS.js.map} +0 -0
- /package/dist/{revoke-7JOVLZFD.js.map → registry-IX5WKK4F.js.map} +0 -0
- /package/dist/{signer-M4K5HBLD.js.map → registry-LMHO5265.js.map} +0 -0
- /package/dist/{stale-PAGCS4K5.js.map → registry-TXCKWH26.js.map} +0 -0
- /package/dist/{ulid-COREQ2RQ.js.map → registry-VFEDQSYV.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bc as PublicEnvelope, bd as SealingKeyProvider, be as BundleRecipient, bf as RecipientSealer, bg as RecipientHint, bh as Vault } from './index-DHn9lEP0.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `.noydb` container format — byte layout, header schema, validators.
|
|
@@ -124,7 +124,7 @@ interface NoydbBundleHeader {
|
|
|
124
124
|
*/
|
|
125
125
|
readonly publicEnvelope?: PublicEnvelope;
|
|
126
126
|
/**
|
|
127
|
-
* Auto-unlock material indicator
|
|
127
|
+
* Auto-unlock material indicator. When present, the bundle
|
|
128
128
|
* body wraps the dump JSON in a structure carrying per-user
|
|
129
129
|
* passphrases — either plaintext (`'unsealed'`, public-by-design)
|
|
130
130
|
* or sealed under a `SealingKeyProvider` (`'sealed'`, requires
|
|
@@ -136,17 +136,17 @@ interface NoydbBundleHeader {
|
|
|
136
136
|
* (sealed).
|
|
137
137
|
*
|
|
138
138
|
* Absent → the body is a raw `vault.dump()` JSON string (the
|
|
139
|
-
*
|
|
139
|
+
* the legacy shape; back-compatible).
|
|
140
140
|
*/
|
|
141
141
|
readonly autoUnlock?: 'unsealed' | 'sealed';
|
|
142
142
|
/**
|
|
143
|
-
* Bundle's role in the source → destination lifecycle
|
|
143
|
+
* Bundle's role in the source → destination lifecycle.
|
|
144
144
|
* - omitted / 'snapshot' (default): backup/copy of an existing vault.
|
|
145
145
|
* - 'extracted-partition': re-keyed projection awaiting adoption.
|
|
146
146
|
*/
|
|
147
147
|
readonly bundleKind?: 'snapshot' | 'extracted-partition';
|
|
148
148
|
/**
|
|
149
|
-
* Transfer-seal INDICATOR
|
|
149
|
+
* Transfer-seal INDICATOR — metadata only, no payload (the
|
|
150
150
|
* sealed DEKs live in the body). Present iff
|
|
151
151
|
* bundleKind === 'extracted-partition'.
|
|
152
152
|
*/
|
|
@@ -248,7 +248,7 @@ interface AutoCredential {
|
|
|
248
248
|
* - `compression: 'gzip'` — force gzip
|
|
249
249
|
* - `compression: 'none'` — no compression (round-trip testing only)
|
|
250
250
|
*
|
|
251
|
-
* **Slice filtering
|
|
251
|
+
* **Slice filtering:**
|
|
252
252
|
* - `collections` — allowlist of collection names to include. Internal
|
|
253
253
|
* collections (keyrings, ledger) and excluded user collections are
|
|
254
254
|
* dropped from the bundle. Records inside included collections are
|
|
@@ -311,7 +311,7 @@ interface WriteNoydbBundleOptions {
|
|
|
311
311
|
*/
|
|
312
312
|
readonly recipients?: readonly BundleRecipient[];
|
|
313
313
|
/**
|
|
314
|
-
* Auto-unlock — unsealed per-user credentials
|
|
314
|
+
* Auto-unlock — unsealed per-user credentials.
|
|
315
315
|
*
|
|
316
316
|
* Generalises `autoPassphrases` to support any bundleable credential
|
|
317
317
|
* kind (`passphrase` | `password` | `pin`).
|
|
@@ -333,7 +333,7 @@ interface WriteNoydbBundleOptions {
|
|
|
333
333
|
};
|
|
334
334
|
/**
|
|
335
335
|
* Auto-unlock — per-user credentials sealed under a
|
|
336
|
-
* {@link SealingKeyProvider}
|
|
336
|
+
* {@link SealingKeyProvider}.
|
|
337
337
|
*
|
|
338
338
|
* Generalises `sealedPassphrases` to support any bundleable
|
|
339
339
|
* credential kind (`passphrase` | `password` | `pin`).
|
|
@@ -369,9 +369,9 @@ interface WriteNoydbBundleOptions {
|
|
|
369
369
|
}>;
|
|
370
370
|
};
|
|
371
371
|
/**
|
|
372
|
-
* @deprecated Use `autoCredentials` instead
|
|
372
|
+
* @deprecated Use `autoCredentials` instead.
|
|
373
373
|
*
|
|
374
|
-
* Auto-unlock — unsealed per-user passphrases
|
|
374
|
+
* Auto-unlock — unsealed per-user passphrases.
|
|
375
375
|
*
|
|
376
376
|
* Public-by-design: anyone holding the bundle bytes can read these
|
|
377
377
|
* plaintext credentials. Use for demo data, sample vaults,
|
|
@@ -389,10 +389,10 @@ interface WriteNoydbBundleOptions {
|
|
|
389
389
|
readonly perUser: Record<string, string>;
|
|
390
390
|
};
|
|
391
391
|
/**
|
|
392
|
-
* @deprecated Use `sealedCredentials` instead
|
|
392
|
+
* @deprecated Use `sealedCredentials` instead.
|
|
393
393
|
*
|
|
394
394
|
* Auto-unlock — per-user passphrases sealed under a
|
|
395
|
-
* {@link SealingKeyProvider} (
|
|
395
|
+
* {@link SealingKeyProvider} (self-target only).
|
|
396
396
|
*
|
|
397
397
|
* The hub seals each user's plaintext passphrase under `provider`
|
|
398
398
|
* and embeds the resulting sealed envelopes in the bundle. The
|
|
@@ -424,7 +424,7 @@ interface NoydbBundleReadResult {
|
|
|
424
424
|
readonly header: NoydbBundleHeader;
|
|
425
425
|
readonly dumpJson: string;
|
|
426
426
|
/**
|
|
427
|
-
* Auto-unlock material
|
|
427
|
+
* Auto-unlock material. Present only when
|
|
428
428
|
* the header's `autoUnlock` flag is set AND the body's wrapped
|
|
429
429
|
* structure survived parsing. Values are typed credentials — either
|
|
430
430
|
* delivered plain (`kind: 'unsealed'`) or unsealed at read time
|
|
@@ -444,9 +444,9 @@ interface NoydbBundleReadResult {
|
|
|
444
444
|
};
|
|
445
445
|
}
|
|
446
446
|
/**
|
|
447
|
-
* Options accepted by {@link readNoydbBundle} for the
|
|
448
|
-
* auto-unlock paths. Without these the reader behaves exactly as
|
|
449
|
-
*
|
|
447
|
+
* Options accepted by {@link readNoydbBundle} for the
|
|
448
|
+
* auto-unlock paths. Without these the reader behaves exactly as before
|
|
449
|
+
* (header parsed; body returned as `dumpJson`).
|
|
450
450
|
*/
|
|
451
451
|
interface ReadNoydbBundleOptions {
|
|
452
452
|
/**
|
|
@@ -469,10 +469,10 @@ interface ReadNoydbBundleOptions {
|
|
|
469
469
|
readonly attemptUnsealAcrossProviders?: boolean;
|
|
470
470
|
}
|
|
471
471
|
/**
|
|
472
|
-
* Transfer-seal payload
|
|
472
|
+
* Transfer-seal payload. The destination DEKs, exported to raw
|
|
473
473
|
* bytes and AES-256-GCM-sealed *as a set* under the one-time transfer
|
|
474
|
-
* key. `adoptPartition`
|
|
475
|
-
*
|
|
474
|
+
* key. `adoptPartition` unseals this; `createOwnerOnAdoptedPartition`
|
|
475
|
+
* re-wraps the raw DEKs under the recipient's KEK.
|
|
476
476
|
*/
|
|
477
477
|
interface TransferSealPayload {
|
|
478
478
|
readonly v: 1;
|
|
@@ -535,69 +535,24 @@ declare function readNoydbBundlePublicEnvelope(bytes: Uint8Array, opts?: {
|
|
|
535
535
|
*/
|
|
536
536
|
declare function readNoydbBundle(bytes: Uint8Array, opts?: ReadNoydbBundleOptions): Promise<NoydbBundleReadResult>;
|
|
537
537
|
|
|
538
|
+
/** One decrypted record from an extracted-partition compartment. */
|
|
539
|
+
interface DecryptedRecord {
|
|
540
|
+
readonly id: string;
|
|
541
|
+
readonly record: Record<string, unknown>;
|
|
542
|
+
/** Source envelope write timestamp (ISO) — for last-write-wins merges. */
|
|
543
|
+
readonly ts: string;
|
|
544
|
+
/** Source envelope version. */
|
|
545
|
+
readonly version: number;
|
|
546
|
+
/** Provenance source id (FR-5). Present only when the source collection had provenance:true and a source was supplied on put. */
|
|
547
|
+
readonly source?: string;
|
|
548
|
+
/** ISO-8601 timestamp the provenance source was recorded (FR-5). */
|
|
549
|
+
readonly sourceTs?: string;
|
|
550
|
+
}
|
|
538
551
|
/**
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
|
|
542
|
-
* handles for `.noydb` containers.
|
|
543
|
-
*
|
|
544
|
-
* **What's a ULID?** A 128-bit identifier encoded as 26 Crockford
|
|
545
|
-
* base32 characters. Layout:
|
|
546
|
-
*
|
|
547
|
-
* ```
|
|
548
|
-
* 01HYABCDEFGHJKMNPQRSTVWXYZ
|
|
549
|
-
* |--------||---------------|
|
|
550
|
-
* 48-bit 80-bit
|
|
551
|
-
* timestamp randomness
|
|
552
|
-
* ```
|
|
553
|
-
*
|
|
554
|
-
* The first 10 chars encode a millisecond Unix timestamp (so ULIDs
|
|
555
|
-
* sort lexicographically by creation time), and the remaining 16
|
|
556
|
-
* chars are random. Crockford base32 omits I/L/O/U to avoid
|
|
557
|
-
* ambiguity in handwriting and URLs.
|
|
558
|
-
*
|
|
559
|
-
* **Why hand-roll instead of pulling in `ulid`?** The package adds
|
|
560
|
-
* a dep, the implementation is ~30 lines, and the bundle module
|
|
561
|
-
* is the only consumer. Adding `ulid` would also drag in its own
|
|
562
|
-
* crypto polyfill that we don't need on Node 18+ or modern
|
|
563
|
-
* browsers.
|
|
564
|
-
*
|
|
565
|
-
* **Privacy consideration:** the timestamp prefix is observable in
|
|
566
|
-
* the bundle header. This is a deliberate trade-off:
|
|
567
|
-
* - Pro: lexicographic sortability lets bundle adapters list
|
|
568
|
-
* newest-first without an extra index.
|
|
569
|
-
* - Con: a casual observer can read the bundle's creation time
|
|
570
|
-
* from the handle. They cannot read it from any OTHER field
|
|
571
|
-
* (the header explicitly forbids `_exported_at`), and a
|
|
572
|
-
* creation timestamp is the same kind of metadata that
|
|
573
|
-
* filesystem mtime would already expose for a downloaded
|
|
574
|
-
* bundle. The leak is therefore equivalent to what's already
|
|
575
|
-
* visible from the file's mtime — not a new exposure.
|
|
576
|
-
*
|
|
577
|
-
* If a future use case needs timestamp-free handles, a v2 of the
|
|
578
|
-
* format could specify "use the random portion only" without a
|
|
579
|
-
* format break — `validateBundleHeader` only checks the regex
|
|
580
|
-
* shape, not the encoded timestamp.
|
|
581
|
-
*/
|
|
582
|
-
/**
|
|
583
|
-
* Generate a fresh ULID. Uses `crypto.getRandomValues` for the
|
|
584
|
-
* randomness portion — same Web Crypto API the rest of the
|
|
585
|
-
* codebase uses for IVs and salt.
|
|
586
|
-
*
|
|
587
|
-
* Returns a 26-character string. Calling twice in the same
|
|
588
|
-
* millisecond produces two distinct ULIDs (the random portion
|
|
589
|
-
* differs); ULIDs from the same millisecond are NOT guaranteed
|
|
590
|
-
* to be monotonically ordered relative to each other, only
|
|
591
|
-
* relative to ULIDs from a different millisecond. The bundle
|
|
592
|
-
* format never relies on intra-millisecond ordering.
|
|
593
|
-
*/
|
|
594
|
-
declare function generateULID(): string;
|
|
595
|
-
/**
|
|
596
|
-
* Validate that a string is a syntactically well-formed ULID. Used
|
|
597
|
-
* by the bundle header validator. Does NOT verify that the
|
|
598
|
-
* timestamp portion decodes to a sensible date — the format only
|
|
599
|
-
* cares about the encoding shape.
|
|
552
|
+
* Decrypt every record of an extracted-partition bundle to plaintext,
|
|
553
|
+
* grouped by collection. Throws if the bundle isn't an
|
|
554
|
+
* extracted-partition or the transfer key is wrong.
|
|
600
555
|
*/
|
|
601
|
-
declare function
|
|
556
|
+
declare function decryptExtractedPartition(bundleBytes: Uint8Array, transferKey: Uint8Array): Promise<Record<string, DecryptedRecord[]>>;
|
|
602
557
|
|
|
603
|
-
export { type AutoCredential as A, COMPRESSION_BROTLI as C, FLAG_COMPRESSED as F, NOYDB_BUNDLE_FORMAT_VERSION as N, type ReadNoydbBundleOptions as R, type TransferSealPayload as T, type WriteNoydbBundleOptions as W, COMPRESSION_GZIP as a, COMPRESSION_NONE as b, type CompressionAlgo as c, FLAG_HAS_INTEGRITY_HASH as d, NOYDB_BUNDLE_MAGIC as e, NOYDB_BUNDLE_PREFIX_BYTES as f, type NoydbBundleHeader as g, type NoydbBundleReadResult as h,
|
|
558
|
+
export { type AutoCredential as A, COMPRESSION_BROTLI as C, type DecryptedRecord as D, FLAG_COMPRESSED as F, NOYDB_BUNDLE_FORMAT_VERSION as N, type ReadNoydbBundleOptions as R, type TransferSealPayload as T, type WriteNoydbBundleOptions as W, COMPRESSION_GZIP as a, COMPRESSION_NONE as b, type CompressionAlgo as c, FLAG_HAS_INTEGRITY_HASH as d, NOYDB_BUNDLE_MAGIC as e, NOYDB_BUNDLE_PREFIX_BYTES as f, type NoydbBundleHeader as g, type NoydbBundleReadResult as h, decryptExtractedPartition as i, encodeBundleHeader as j, readNoydbBundleHeader as k, resetBrotliSupportCache as l, type AutoCredentialKind as m, hasNoydbBundleMagic as n, readNoydbBundlePublicEnvelope as o, readNoydbBundle as r, validateBundleHeader as v, writeNoydbBundle as w };
|
|
@@ -3,15 +3,16 @@ import {
|
|
|
3
3
|
issueDelegation,
|
|
4
4
|
loadActiveDelegations,
|
|
5
5
|
revokeDelegation
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-LBILABKZ.js";
|
|
7
|
+
import "./chunk-MSMDDDDJ.js";
|
|
8
8
|
import "./chunk-FZU343FL.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-E2MDPPOC.js";
|
|
10
|
+
import "./chunk-JZ5DS4DP.js";
|
|
11
|
+
import "./chunk-PZ5AY32C.js";
|
|
11
12
|
export {
|
|
12
13
|
DELEGATIONS_COLLECTION,
|
|
13
14
|
issueDelegation,
|
|
14
15
|
loadActiveDelegations,
|
|
15
16
|
revokeDelegation
|
|
16
17
|
};
|
|
17
|
-
//# sourceMappingURL=delegation-
|
|
18
|
+
//# sourceMappingURL=delegation-BQTRJATI.js.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export { w as withDerivation } from '../with-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
import '../lazy-builder-
|
|
6
|
-
import '../predicate-
|
|
7
|
-
import '../strategy-
|
|
1
|
+
export { w as withDerivation, a as withRollup } from '../with-rollup-CbU-O4wP.js';
|
|
2
|
+
import { aC as DerivationStrategy, aD as DerivationContext } from '../index-DHn9lEP0.js';
|
|
3
|
+
export { aE as ArrayOutputSpec, aF as DerivationRegistry, aG as DerivationStrategyHandle, aH as DerivedFromMeta, aI as OutputSpec, aJ as RecordOutputSpec } from '../index-DHn9lEP0.js';
|
|
4
|
+
export { i as DerivationCapExceededError, j as DerivationCycleError, k as DerivationDepthError, l as DerivationOutputShapeError, m as DerivationOutputUnknownError } from '../errors-BAWO5Z5a.js';
|
|
5
|
+
import '../lazy-builder-ChSqcF5t.js';
|
|
6
|
+
import '../predicate-BmhBSPCH.js';
|
|
7
|
+
import '../strategy-8QGs5KQE.js';
|
|
8
8
|
import '../strategy-BSxFXGzb.js';
|
|
9
|
+
import '../index-BMmajblo.js';
|
|
10
|
+
import '../index-Ddm8D3Oo.js';
|
|
9
11
|
import '@noy-db/attestation';
|
|
10
12
|
|
|
11
13
|
interface RunResult {
|
|
@@ -18,7 +20,7 @@ interface RunResult {
|
|
|
18
20
|
*
|
|
19
21
|
* - `record` — the existing v1 shape: one value (or a "skipped"
|
|
20
22
|
* marker if the output was optional and `derive` returned null).
|
|
21
|
-
* - `array` —
|
|
23
|
+
* - `array` — a list of `(key, value)` entries.
|
|
22
24
|
* The caller diffs these against the previously-emitted key set
|
|
23
25
|
* (loaded from the fanout sidecar) to compute deletes + upserts.
|
|
24
26
|
*/
|
|
@@ -28,7 +30,7 @@ interface RecordOutputResult {
|
|
|
28
30
|
value: Record<string, unknown>;
|
|
29
31
|
ok: true;
|
|
30
32
|
/**
|
|
31
|
-
* `true` when an optional output
|
|
33
|
+
* `true` when an optional output returned `null` /
|
|
32
34
|
* `undefined`. The caller deletes any previously-emitted output at
|
|
33
35
|
* the same id (mirrors "tombstone for derived data"); a never-emitted
|
|
34
36
|
* output is a silent no-op. `ok: true` because skipping is a
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
withDerivation
|
|
3
|
-
|
|
2
|
+
withDerivation,
|
|
3
|
+
withRollup
|
|
4
|
+
} from "../chunk-BEZ2EV43.js";
|
|
4
5
|
import {
|
|
5
6
|
DerivationRegistry
|
|
6
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-UBF5JEOJ.js";
|
|
7
8
|
import {
|
|
8
9
|
DerivationExecutor
|
|
9
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-4L6N56B4.js";
|
|
10
11
|
import {
|
|
11
12
|
DerivationCapExceededError,
|
|
12
13
|
DerivationCycleError,
|
|
13
14
|
DerivationDepthError,
|
|
14
15
|
DerivationOutputShapeError,
|
|
15
16
|
DerivationOutputUnknownError
|
|
16
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-JZ5DS4DP.js";
|
|
18
|
+
import "../chunk-PZ5AY32C.js";
|
|
17
19
|
export {
|
|
18
20
|
DerivationCapExceededError,
|
|
19
21
|
DerivationCycleError,
|
|
@@ -22,6 +24,7 @@ export {
|
|
|
22
24
|
DerivationOutputShapeError,
|
|
23
25
|
DerivationOutputUnknownError,
|
|
24
26
|
DerivationRegistry,
|
|
25
|
-
withDerivation
|
|
27
|
+
withDerivation,
|
|
28
|
+
withRollup
|
|
26
29
|
};
|
|
27
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-guard helper for narrowing discriminated-union records.
|
|
3
|
+
*
|
|
4
|
+
* `Collection<T>` correctly threads `T` through `get` / `query` / `scan`, but
|
|
5
|
+
* accessing member-specific fields after reading from a `Collection<Union>`
|
|
6
|
+
* still requires a narrowing step in application code. In regular `.ts` files
|
|
7
|
+
* a simple `if (r.kind === 'IV')` block narrows correctly; in vue-tsc /
|
|
8
|
+
* template contexts the inline comparison is sometimes not enough, and the
|
|
9
|
+
* helper below makes the guard portable and avoids `as unknown as …` casts.
|
|
10
|
+
*
|
|
11
|
+
* **Usage with Collection<T>**
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { isDiscriminant } from '@noy-db/hub'
|
|
15
|
+
*
|
|
16
|
+
* type IV = { kind: 'IV'; invoiceNo: string; amount: number }
|
|
17
|
+
* type RE = { kind: 'RE'; receiptNo: string; paidAt: string }
|
|
18
|
+
* type Receipt = IV | RE | ...
|
|
19
|
+
*
|
|
20
|
+
* const receipts = await vault.collection<Receipt>('receipts').query().toArray()
|
|
21
|
+
*
|
|
22
|
+
* // Filter approach — result is IV[], invoiceNo accessible without cast:
|
|
23
|
+
* const ivs = receipts.filter(r => isDiscriminant(r, 'kind', 'IV'))
|
|
24
|
+
* console.log(ivs[0].invoiceNo)
|
|
25
|
+
*
|
|
26
|
+
* // Branch approach:
|
|
27
|
+
* for (const r of receipts) {
|
|
28
|
+
* if (isDiscriminant(r, 'kind', 'IV')) {
|
|
29
|
+
* console.log(r.invoiceNo) // r: IV here
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @module
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Type-guard for narrowing a discriminated-union record by its discriminant.
|
|
38
|
+
*
|
|
39
|
+
* Returns `true` when `record[key] === value`, and narrows `record` to
|
|
40
|
+
* `Extract<T, Record<K, V>>` — the exact union member(s) that carry that
|
|
41
|
+
* discriminant value.
|
|
42
|
+
*
|
|
43
|
+
* The discriminant key is a parameter (not hardcoded to `'kind'`), so this
|
|
44
|
+
* works with any field name: `'kind'`, `'type'`, `'tag'`, etc.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const ivs = receipts.filter(r => isDiscriminant(r, 'kind', 'IV'))
|
|
48
|
+
* // ivs: IV[] — invoiceNo accessible, no cast needed
|
|
49
|
+
*
|
|
50
|
+
* @typeParam T - The union type of the record (e.g. `Receipt`). Both type-alias
|
|
51
|
+
* unions and interface-extended unions work; use a `type` alias (`type Receipt = IV | RE`) for best
|
|
52
|
+
* results.
|
|
53
|
+
* @typeParam K - The discriminant key (must be a key of `T`).
|
|
54
|
+
* @typeParam V - The discriminant value to match. The `const` modifier ensures
|
|
55
|
+
* TypeScript infers the string literal (e.g. `'IV'`), not the full union
|
|
56
|
+
* `T[K]`, so the predicate resolves to the exact member type.
|
|
57
|
+
*/
|
|
58
|
+
declare function isDiscriminant<T, K extends keyof T, const V extends T[K]>(record: T, key: K, value: V): record is Extract<T, Record<K, V>>;
|
|
59
|
+
|
|
60
|
+
export { isDiscriminant as i };
|