@noy-db/hub 0.2.0-pre.3 → 0.2.0-pre.5
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.map +1 -1
- package/dist/aggregate/index.js +4 -4
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +4 -4
- package/dist/attestation/index.d.ts +4 -4
- package/dist/attestation/index.js +6 -6
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +5 -5
- package/dist/blobs/index.d.ts +5 -5
- package/dist/blobs/index.js +5 -5
- package/dist/bundle/index.cjs +443 -338
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +17 -17
- package/dist/bundle/index.d.ts +17 -17
- package/dist/bundle/index.js +10 -10
- package/dist/bundle/index.js.map +1 -1
- package/dist/{chunk-YL2DR3HY.js → chunk-25WFLKOH.js} +2 -2
- package/dist/chunk-25WFLKOH.js.map +1 -0
- package/dist/{chunk-EMEX37ZN.js → chunk-2GMRNNI3.js} +3 -3
- package/dist/chunk-2GMRNNI3.js.map +1 -0
- package/dist/{chunk-NGSPBLLE.js → chunk-34XGYMQT.js} +3 -3
- package/dist/chunk-34XGYMQT.js.map +1 -0
- package/dist/{chunk-FXQYZNOW.js → chunk-5OVIFUQE.js} +1 -1
- package/dist/chunk-5OVIFUQE.js.map +1 -0
- package/dist/{chunk-P6256WTJ.js → chunk-5QPF2MJ5.js} +3 -3
- package/dist/chunk-5QPF2MJ5.js.map +1 -0
- package/dist/{chunk-5ZGZ6HIZ.js → chunk-5VMTAX4Y.js} +2 -2
- package/dist/{chunk-74JEQFMT.js → chunk-6A4AMQ2H.js} +5 -5
- package/dist/chunk-6A4AMQ2H.js.map +1 -0
- package/dist/{chunk-YDLAFP36.js → chunk-6HJ2ZALB.js} +1 -1
- package/dist/chunk-6HJ2ZALB.js.map +1 -0
- package/dist/{chunk-GDTCGIPX.js → chunk-7TX7HN42.js} +2 -2
- package/dist/chunk-7TX7HN42.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-75QDHSE4.js → chunk-A4JNVBPF.js} +5 -5
- package/dist/{chunk-IS5HWQO7.js → chunk-ARZAHCCF.js} +3 -3
- package/dist/{chunk-T6HQMVML.js → chunk-BT7544RM.js} +399 -301
- package/dist/chunk-BT7544RM.js.map +1 -0
- package/dist/{chunk-4OQWR46B.js → chunk-CCC25PA7.js} +5 -5
- package/dist/{chunk-NSLTPGEN.js → chunk-CGJFCT3X.js} +2 -2
- package/dist/{chunk-YK72A4IT.js → chunk-CKH247ZR.js} +4 -4
- package/dist/{chunk-HGZ7DC5H.js → chunk-DFCINPB5.js} +2 -2
- package/dist/chunk-DFCINPB5.js.map +1 -0
- package/dist/{chunk-4X2S7PBF.js → chunk-E225X5CQ.js} +3 -3
- package/dist/chunk-E225X5CQ.js.map +1 -0
- package/dist/{chunk-5YHWBPOT.js → chunk-ED3E3OLO.js} +2 -2
- package/dist/{chunk-UOF74WQY.js → chunk-EKTOYEZ3.js} +2 -2
- package/dist/{chunk-SAVQ6E2O.js → chunk-G26QAQNI.js} +2 -2
- package/dist/{chunk-YMYK7US4.js → chunk-HIELMTUK.js} +2 -2
- package/dist/{chunk-MRIBLZL3.js → chunk-ICH4AIGL.js} +1 -1
- package/dist/chunk-ICH4AIGL.js.map +1 -0
- package/dist/{chunk-LOL725S4.js → chunk-JSYTGEX4.js} +3 -3
- package/dist/{chunk-FBMXWVGP.js → chunk-KGFV72WK.js} +5 -5
- package/dist/{chunk-GVXBHCZ2.js → chunk-LJO6Q3X6.js} +5 -5
- package/dist/chunk-LJO6Q3X6.js.map +1 -0
- package/dist/{chunk-ZC2AAE6J.js → chunk-LWFQYT4N.js} +2 -2
- package/dist/chunk-LWFQYT4N.js.map +1 -0
- package/dist/{chunk-K5PVGKE4.js → chunk-MDIC4FAU.js} +2 -2
- package/dist/{chunk-A6SWRXUQ.js → chunk-NONMIU6C.js} +2 -2
- package/dist/{chunk-ZUMGGHRB.js → chunk-OPD3PZOG.js} +4 -4
- package/dist/{chunk-LS3JLEIB.js → chunk-PS5G6A3Y.js} +4 -4
- package/dist/{chunk-KYKMKLJ6.js → chunk-PX3MJ6RB.js} +3 -3
- package/dist/{chunk-FCDO7UAO.js → chunk-R4LTCI6O.js} +2 -2
- package/dist/{chunk-BFI3RS42.js → chunk-R7JTYCRX.js} +2 -2
- package/dist/chunk-R7JTYCRX.js.map +1 -0
- package/dist/{chunk-WRLHNG6H.js → chunk-RIHZBSWJ.js} +4 -4
- package/dist/chunk-RIHZBSWJ.js.map +1 -0
- package/dist/{chunk-UVPGJXVO.js → chunk-SGSHQ4PH.js} +5 -5
- package/dist/{chunk-TLFUDXVV.js → chunk-T6MTNGBM.js} +5 -5
- package/dist/chunk-T6MTNGBM.js.map +1 -0
- package/dist/{chunk-6S3LLAQ5.js → chunk-TNBIWSQ7.js} +2 -2
- package/dist/{chunk-GD3BGKAR.js → chunk-UGVDIOY7.js} +2 -2
- package/dist/{chunk-FS7A4XNF.js → chunk-WEA4TDTJ.js} +3 -3
- package/dist/{chunk-4UBOTYP5.js → chunk-XDW37COG.js} +5 -5
- package/dist/chunk-XDW37COG.js.map +1 -0
- package/dist/{chunk-QAU5HM6Q.js → chunk-XVJFFGTG.js} +3 -3
- package/dist/{chunk-2EYC3WDT.js → chunk-Y3P5DEMZ.js} +6 -6
- package/dist/chunk-Y3P5DEMZ.js.map +1 -0
- package/dist/{chunk-G7PAZ3TD.js → chunk-YEHUEUNP.js} +4 -4
- package/dist/chunk-YEHUEUNP.js.map +1 -0
- package/dist/{chunk-2XLVPKXG.js → chunk-YJ46RFCD.js} +2 -2
- package/dist/{chunk-KMI2NBBF.js → chunk-YZ6JETII.js} +6 -6
- package/dist/{chunk-NCO2JGKK.js → chunk-Z6FNBOTC.js} +1 -1
- package/dist/chunk-Z6FNBOTC.js.map +1 -0
- package/dist/{chunk-GAUBWHAF.js → chunk-ZQMYB56Z.js} +4 -4
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-H2Y3DDFW.js → crypto-5UDZZL26.js} +3 -3
- package/dist/{delegation-QSC7G5QC.js → delegation-42LO4WFO.js} +5 -5
- package/dist/derivations/index.cjs +1 -1
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +8 -8
- package/dist/derivations/index.d.ts +8 -8
- package/dist/derivations/index.js +4 -4
- package/dist/{dev-unlock-Cf2B7Kih.d.ts → dev-unlock--ahUTrhc.d.ts} +1 -1
- package/dist/{dev-unlock-De3mjQWv.d.cts → dev-unlock-BIwt2V3p.d.cts} +1 -1
- package/dist/executor-AWCHQ2KN.js +8 -0
- package/dist/executor-RWICJI7J.js +11 -0
- package/dist/executor-SOLEQVUB.js +8 -0
- package/dist/{fanout-sidecar-NRBWSLRK.js → fanout-sidecar-EVICRM46.js} +2 -2
- package/dist/fanout-sidecar-EVICRM46.js.map +1 -0
- package/dist/guards/index.cjs +1 -1
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +6 -6
- package/dist/guards/index.d.ts +6 -6
- package/dist/guards/index.js +4 -4
- package/dist/{hash-vBCB0-Ps.d.cts → hash-BQVrGV-t.d.cts} +1 -1
- package/dist/{hash-gVn_uKhp.d.ts → hash-CJEFQxSD.d.ts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +6 -6
- package/dist/history/index.d.ts +6 -6
- package/dist/history/index.js +6 -6
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +5 -5
- package/dist/i18n/index.d.ts +5 -5
- package/dist/i18n/index.js +7 -7
- package/dist/{index-DVkvrgpm.d.cts → index-5I0MZ0jQ.d.cts} +12 -12
- package/dist/{index-BF1B2HB9.d.ts → index-fIPPh5dg.d.ts} +12 -12
- package/dist/index.cjs +362 -264
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -22
- package/dist/index.d.ts +20 -22
- package/dist/index.js +45 -45
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs +1 -1
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.d.cts +3 -3
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +4 -4
- package/dist/issue-IODMTPME.js +12 -0
- package/dist/{lazy-builder-Rpd-V3jP.d.ts → lazy-builder-D1MyR1qH.d.ts} +2 -2
- package/dist/{lazy-builder-C-rPfWG0.d.cts → lazy-builder-DXlSCNCJ.d.cts} +2 -2
- package/dist/{ledger-WOEJUYTP.js → ledger-UX4QIHWI.js} +6 -6
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +18 -18
- package/dist/materialized-views/index.d.ts +18 -18
- package/dist/materialized-views/index.js +7 -7
- package/dist/noydb-6TADQIYH.js +34 -0
- package/dist/overlay-views/index.cjs +1 -1
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +8 -8
- package/dist/overlay-views/index.d.ts +8 -8
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +5 -5
- package/dist/periods/index.d.ts +5 -5
- package/dist/periods/index.js +6 -6
- package/dist/{predicate-Dnu81tsS.d.cts → predicate-B0IKeBXx.d.cts} +1 -1
- package/dist/{predicate-Dnu81tsS.d.ts → predicate-B0IKeBXx.d.ts} +1 -1
- package/dist/{public-envelope-OHQ5UZFM.js → public-envelope-YKHKP74C.js} +4 -4
- package/dist/query/index.cjs +2 -2
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +6 -6
- package/dist/registry-446I2NMN.js +8 -0
- package/dist/{registry-CDHASH73.js → registry-4NEW7LQY.js} +3 -3
- package/dist/registry-524KJZG4.js +8 -0
- package/dist/registry-DKEXOJVO.js +7 -0
- package/dist/{revoke-7JOVLZFD.js → revoke-R5NIQ74J.js} +6 -6
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +6 -6
- package/dist/session/index.d.ts +6 -6
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +5 -5
- package/dist/shadow/index.d.ts +5 -5
- package/dist/shadow/index.js +2 -2
- package/dist/{signer-M4K5HBLD.js → signer-WGDJNWSU.js} +5 -5
- package/dist/{stale-PAGCS4K5.js → stale-74WGLVZ2.js} +2 -2
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +5 -5
- package/dist/store/index.d.ts +5 -5
- package/dist/store/index.js +2 -2
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +4 -4
- package/dist/sync/index.d.ts +4 -4
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs +1 -1
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +5 -5
- package/dist/team/index.d.ts +5 -5
- package/dist/team/index.js +8 -8
- package/dist/tx/index.cjs +2 -2
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +5 -5
- package/dist/tx/index.d.ts +5 -5
- package/dist/tx/index.js +3 -3
- package/dist/tx/index.js.map +1 -1
- package/dist/{types-D9eB0Rvh.d.ts → types-BV4AZKmx.d.ts} +340 -302
- package/dist/{types-CSLcfytP.d.cts → types-BeKi0hCx.d.cts} +340 -302
- package/dist/{ulid-CiM2OAeM.d.ts → ulid-CQc0eBxE.d.ts} +19 -19
- package/dist/{ulid-CG2YvAbg.d.cts → ulid-Cvljl7ZZ.d.cts} +19 -19
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{with-derivation-Bzpj6UTv.d.ts → with-derivation-BWcwmevt.d.ts} +1 -1
- package/dist/{with-derivation-DWajFh4K.d.cts → with-derivation-BkOBDhsu.d.cts} +1 -1
- package/dist/{with-guard-DF_Ul3DT.d.cts → with-guard-BD4Hyu8s.d.cts} +1 -1
- package/dist/{with-guard-DR7U-l4v.d.ts → with-guard-Du54s3Ti.d.ts} +1 -1
- package/dist/{with-materialized-view-qtoJ3xKJ.d.ts → with-materialized-view-B5W4wFAC.d.ts} +2 -2
- package/dist/{with-materialized-view-_piodoIz.d.cts → with-materialized-view-BCPPZdjC.d.cts} +2 -2
- package/dist/{with-overlayed-view-DFaRfgMr.d.ts → with-overlayed-view-B8RrlLsG.d.cts} +2 -2
- package/dist/{with-overlayed-view-DwzCKxn2.d.cts → with-overlayed-view-Cw-h9p9N.d.ts} +2 -2
- package/package.json +3 -3
- package/dist/chunk-2EYC3WDT.js.map +0 -1
- package/dist/chunk-4UBOTYP5.js.map +0 -1
- package/dist/chunk-4X2S7PBF.js.map +0 -1
- package/dist/chunk-74JEQFMT.js.map +0 -1
- package/dist/chunk-BFI3RS42.js.map +0 -1
- package/dist/chunk-EMEX37ZN.js.map +0 -1
- package/dist/chunk-EPK6A3WJ.js.map +0 -1
- package/dist/chunk-FXQYZNOW.js.map +0 -1
- package/dist/chunk-G7PAZ3TD.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-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-T6HQMVML.js.map +0 -1
- package/dist/chunk-TLFUDXVV.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-ZC2AAE6J.js.map +0 -1
- 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/issue-BAJ7ZB4S.js +0 -12
- package/dist/noydb-XNQSKXGO.js +0 -34
- package/dist/registry-2IEARCGT.js +0 -7
- package/dist/registry-EMGLZGR6.js +0 -8
- package/dist/registry-NQALYR77.js +0 -8
- /package/dist/{chunk-5ZGZ6HIZ.js.map → chunk-5VMTAX4Y.js.map} +0 -0
- /package/dist/{chunk-75QDHSE4.js.map → chunk-A4JNVBPF.js.map} +0 -0
- /package/dist/{chunk-IS5HWQO7.js.map → chunk-ARZAHCCF.js.map} +0 -0
- /package/dist/{chunk-4OQWR46B.js.map → chunk-CCC25PA7.js.map} +0 -0
- /package/dist/{chunk-NSLTPGEN.js.map → chunk-CGJFCT3X.js.map} +0 -0
- /package/dist/{chunk-YK72A4IT.js.map → chunk-CKH247ZR.js.map} +0 -0
- /package/dist/{chunk-5YHWBPOT.js.map → chunk-ED3E3OLO.js.map} +0 -0
- /package/dist/{chunk-UOF74WQY.js.map → chunk-EKTOYEZ3.js.map} +0 -0
- /package/dist/{chunk-SAVQ6E2O.js.map → chunk-G26QAQNI.js.map} +0 -0
- /package/dist/{chunk-YMYK7US4.js.map → chunk-HIELMTUK.js.map} +0 -0
- /package/dist/{chunk-LOL725S4.js.map → chunk-JSYTGEX4.js.map} +0 -0
- /package/dist/{chunk-FBMXWVGP.js.map → chunk-KGFV72WK.js.map} +0 -0
- /package/dist/{chunk-K5PVGKE4.js.map → chunk-MDIC4FAU.js.map} +0 -0
- /package/dist/{chunk-A6SWRXUQ.js.map → chunk-NONMIU6C.js.map} +0 -0
- /package/dist/{chunk-ZUMGGHRB.js.map → chunk-OPD3PZOG.js.map} +0 -0
- /package/dist/{chunk-LS3JLEIB.js.map → chunk-PS5G6A3Y.js.map} +0 -0
- /package/dist/{chunk-KYKMKLJ6.js.map → chunk-PX3MJ6RB.js.map} +0 -0
- /package/dist/{chunk-FCDO7UAO.js.map → chunk-R4LTCI6O.js.map} +0 -0
- /package/dist/{chunk-UVPGJXVO.js.map → chunk-SGSHQ4PH.js.map} +0 -0
- /package/dist/{chunk-6S3LLAQ5.js.map → chunk-TNBIWSQ7.js.map} +0 -0
- /package/dist/{chunk-GD3BGKAR.js.map → chunk-UGVDIOY7.js.map} +0 -0
- /package/dist/{chunk-FS7A4XNF.js.map → chunk-WEA4TDTJ.js.map} +0 -0
- /package/dist/{chunk-QAU5HM6Q.js.map → chunk-XVJFFGTG.js.map} +0 -0
- /package/dist/{chunk-2XLVPKXG.js.map → chunk-YJ46RFCD.js.map} +0 -0
- /package/dist/{chunk-KMI2NBBF.js.map → chunk-YZ6JETII.js.map} +0 -0
- /package/dist/{chunk-GAUBWHAF.js.map → chunk-ZQMYB56Z.js.map} +0 -0
- /package/dist/{crypto-H2Y3DDFW.js.map → crypto-5UDZZL26.js.map} +0 -0
- /package/dist/{delegation-QSC7G5QC.js.map → delegation-42LO4WFO.js.map} +0 -0
- /package/dist/{executor-BZKFZVRC.js.map → executor-AWCHQ2KN.js.map} +0 -0
- /package/dist/{executor-GFZFDQXV.js.map → executor-RWICJI7J.js.map} +0 -0
- /package/dist/{executor-KT2IOZVP.js.map → executor-SOLEQVUB.js.map} +0 -0
- /package/dist/{issue-BAJ7ZB4S.js.map → issue-IODMTPME.js.map} +0 -0
- /package/dist/{ledger-WOEJUYTP.js.map → ledger-UX4QIHWI.js.map} +0 -0
- /package/dist/{noydb-XNQSKXGO.js.map → noydb-6TADQIYH.js.map} +0 -0
- /package/dist/{public-envelope-OHQ5UZFM.js.map → public-envelope-YKHKP74C.js.map} +0 -0
- /package/dist/{registry-2IEARCGT.js.map → registry-446I2NMN.js.map} +0 -0
- /package/dist/{registry-CDHASH73.js.map → registry-4NEW7LQY.js.map} +0 -0
- /package/dist/{registry-EMGLZGR6.js.map → registry-524KJZG4.js.map} +0 -0
- /package/dist/{registry-NQALYR77.js.map → registry-DKEXOJVO.js.map} +0 -0
- /package/dist/{revoke-7JOVLZFD.js.map → revoke-R5NIQ74J.js.map} +0 -0
- /package/dist/{signer-M4K5HBLD.js.map → signer-WGDJNWSU.js.map} +0 -0
- /package/dist/{stale-PAGCS4K5.js.map → stale-74WGLVZ2.js.map} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { I as IndexStrategy, d as LazyQuery } from './lazy-builder-
|
|
1
|
+
import { I as IndexStrategy, d as LazyQuery } from './lazy-builder-D1MyR1qH.js';
|
|
2
2
|
import { b as AggregateSpec, A as AggregateStrategy } from './strategy-DSTrsZ8t.js';
|
|
3
3
|
import { C as CrdtStrategy, a as CrdtMode, b as CrdtState } from './strategy-BSxFXGzb.js';
|
|
4
|
-
import { N as NoydbError, Q as Query, ar as RefRegistry, ao as RefDescriptor, a2 as JoinableSource, at as RefViolation, au as ScanBuilder } from './index-
|
|
5
|
-
import { F as FieldClause, I as IndexDef, C as CollectionIndexes } from './predicate-
|
|
4
|
+
import { N as NoydbError, Q as Query, ar as RefRegistry, ao as RefDescriptor, a2 as JoinableSource, at as RefViolation, au as ScanBuilder } from './index-fIPPh5dg.js';
|
|
5
|
+
import { F as FieldClause, I as IndexDef, C as CollectionIndexes } from './predicate-B0IKeBXx.js';
|
|
6
6
|
import { AttestationFieldSchema, RevocationList } from '@noy-db/attestation';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -797,7 +797,7 @@ interface LedgerEntry {
|
|
|
797
797
|
* below for the structured payload.
|
|
798
798
|
*
|
|
799
799
|
* `'lifecycle'` records a non-data audit event (e.g. partition
|
|
800
|
-
* handover
|
|
800
|
+
* handover) — `collection`/`id` are empty and the event detail
|
|
801
801
|
* lives in `reason` (e.g. `'partition-handed-over:<sealId>'`). Like
|
|
802
802
|
* `amendment`, it carries no data envelope, so `verifyBackupIntegrity`
|
|
803
803
|
* skips it in the data cross-check (it still participates in the
|
|
@@ -828,8 +828,8 @@ interface LedgerEntry {
|
|
|
828
828
|
*/
|
|
829
829
|
readonly payloadHash: string;
|
|
830
830
|
/**
|
|
831
|
-
* Optional human-readable tag describing why this mutation happened
|
|
832
|
-
*
|
|
831
|
+
* Optional human-readable tag describing why this mutation happened.
|
|
832
|
+
* Threaded through `collection.put(_, _, { reason })`. Common
|
|
833
833
|
* values include `'import:csv'`, `'import:json'`, `'import:xlsx'` from
|
|
834
834
|
* `as-*` ImportPlan.apply(), but consumers can use any string for
|
|
835
835
|
* domain-specific audit filtering. Auto-strip via `canonicalJson` —
|
|
@@ -1106,8 +1106,8 @@ interface AppendInput {
|
|
|
1106
1106
|
*/
|
|
1107
1107
|
amendment?: LedgerEntry['amendment'];
|
|
1108
1108
|
/**
|
|
1109
|
-
* Optional human-readable tag describing why this mutation happened
|
|
1110
|
-
*
|
|
1109
|
+
* Optional human-readable tag describing why this mutation happened.
|
|
1110
|
+
* Threaded from `collection.put(_, _, { reason })`.
|
|
1111
1111
|
* Carried verbatim onto the resulting ledger entry's `reason` field;
|
|
1112
1112
|
* omitted from canonical JSON when undefined.
|
|
1113
1113
|
*/
|
|
@@ -1848,7 +1848,6 @@ interface PassphrasePolicy {
|
|
|
1848
1848
|
* double-space). For non-space-delimited word semantics, use
|
|
1849
1849
|
* {@link customValidator} instead.
|
|
1850
1850
|
*
|
|
1851
|
-
* Added in pre.8 (#31).
|
|
1852
1851
|
*/
|
|
1853
1852
|
readonly pattern?: RegExp;
|
|
1854
1853
|
/**
|
|
@@ -1866,7 +1865,6 @@ interface PassphrasePolicy {
|
|
|
1866
1865
|
* {@link assertStrongPassphrase} dispatches on — `ok: true` accepts;
|
|
1867
1866
|
* `ok: false` throws `WeakPassphraseError` with the supplied reason.
|
|
1868
1867
|
*
|
|
1869
|
-
* Added in pre.8 (#31).
|
|
1870
1868
|
*/
|
|
1871
1869
|
readonly customValidator?: (phrase: string) => PassphraseValidationResult;
|
|
1872
1870
|
}
|
|
@@ -1983,7 +1981,7 @@ interface UnlockedKeyring {
|
|
|
1983
1981
|
* - Unencrypted mode (no KEK exists)
|
|
1984
1982
|
* - Tier-3 PIN quick-resume (`@noy-db/on-pin`)
|
|
1985
1983
|
* - Wrap-DEKs tier-2 unlock (`@noy-db/on-password`'s
|
|
1986
|
-
* `verifyPasswordSlot`
|
|
1984
|
+
* `verifyPasswordSlot`)
|
|
1987
1985
|
* - Session-state restore (`session/session.ts`)
|
|
1988
1986
|
* - Dev-unlock fixture (`session/dev-unlock.ts`)
|
|
1989
1987
|
*
|
|
@@ -1992,9 +1990,8 @@ interface UnlockedKeyring {
|
|
|
1992
1990
|
* null-check and throw a clear error if absent — re-authenticate
|
|
1993
1991
|
* at tier 1 first to recover the KEK.
|
|
1994
1992
|
*
|
|
1995
|
-
* Tightened from `CryptoKey` to `CryptoKey | null
|
|
1996
|
-
*
|
|
1997
|
-
* matches reality.
|
|
1993
|
+
* Tightened from `CryptoKey` to `CryptoKey | null`; the runtime
|
|
1994
|
+
* contract has always allowed null, the type now matches reality.
|
|
1998
1995
|
*/
|
|
1999
1996
|
readonly kek: CryptoKey | null;
|
|
2000
1997
|
readonly salt: Uint8Array;
|
|
@@ -2015,7 +2012,7 @@ interface UnlockedKeyring {
|
|
|
2015
2012
|
/**
|
|
2016
2013
|
* Tier-2 authenticator slots — readonly snapshot loaded from the
|
|
2017
2014
|
* keyring file. Mutations go through `enrollAuthenticator` /
|
|
2018
|
-
* `removeAuthenticator
|
|
2015
|
+
* `removeAuthenticator`, which write back via
|
|
2019
2016
|
* `persistKeyring`. Always defined; loads with an empty array for
|
|
2020
2017
|
* keyrings written before the multi-slot extension landed.
|
|
2021
2018
|
*/
|
|
@@ -2068,7 +2065,6 @@ declare function revoke(adapter: NoydbStore, vault: string, callerKeyring: Unloc
|
|
|
2068
2065
|
* @throws `PermissionDeniedError` when the role hierarchy rejects.
|
|
2069
2066
|
* @throws `ValidationError` when the diff is empty (nothing to update).
|
|
2070
2067
|
*
|
|
2071
|
-
* @see #54
|
|
2072
2068
|
*/
|
|
2073
2069
|
declare function updateKeyringIdentity(adapter: NoydbStore, vault: string, callerKeyring: UnlockedKeyring, options: UpdateUserOptions): Promise<void>;
|
|
2074
2070
|
/**
|
|
@@ -2163,7 +2159,7 @@ interface ListUsersOptions {
|
|
|
2163
2159
|
* `userEnvelopeDek` is the vault's `_users` collection DEK
|
|
2164
2160
|
* (`vault.getDEK('_users')`); used to decrypt every envelope.
|
|
2165
2161
|
*
|
|
2166
|
-
* `callerRole`
|
|
2162
|
+
* `callerRole` drives the directory-visibility checks:
|
|
2167
2163
|
*
|
|
2168
2164
|
* - When the vault's `_meta/directory` document has `enabled: false`,
|
|
2169
2165
|
* only `owner` and `admin` callers may enumerate; anyone else gets
|
|
@@ -2173,7 +2169,7 @@ interface ListUsersOptions {
|
|
|
2173
2169
|
* `{ includeHidden: true }` to see them; lower roles passing that
|
|
2174
2170
|
* option get `PermissionDeniedError`.
|
|
2175
2171
|
*
|
|
2176
|
-
* Honest caveat
|
|
2172
|
+
* Honest caveat: these filters are a UX hint, not a security
|
|
2177
2173
|
* boundary. The keyring file is still listed at `_keyring/*` and the
|
|
2178
2174
|
* envelope ciphertext at `_users/*`. A caller with direct store access
|
|
2179
2175
|
* — or a caller that calls this function with `callerRole: 'owner'`
|
|
@@ -2550,7 +2546,7 @@ interface I18nStrategy {
|
|
|
2550
2546
|
}
|
|
2551
2547
|
|
|
2552
2548
|
/**
|
|
2553
|
-
* Observable write-queue
|
|
2549
|
+
* Observable write-queue.
|
|
2554
2550
|
*
|
|
2555
2551
|
* Tracks outstanding in-flight *logical* writes (a full Collection.put /
|
|
2556
2552
|
* delete, including ledger + cache + derivation + MV dispatch — not just
|
|
@@ -2597,7 +2593,7 @@ declare class WriteQueueTracker implements WriteQueue {
|
|
|
2597
2593
|
}
|
|
2598
2594
|
|
|
2599
2595
|
/**
|
|
2600
|
-
* Hub-level write lifecycle hooks
|
|
2596
|
+
* Hub-level write lifecycle hooks. `onBeforeWrite` may abort (throw);
|
|
2601
2597
|
* `onAfterWrite` is awaited and its errors are warned, not thrown. A
|
|
2602
2598
|
* re-entrancy flag suppresses nested firing so a handler that writes can't
|
|
2603
2599
|
* loop. Held on the Noydb instance, threaded into every Collection.
|
|
@@ -2616,15 +2612,15 @@ interface WriteEvent {
|
|
|
2616
2612
|
readonly txId: string;
|
|
2617
2613
|
}
|
|
2618
2614
|
type WriteHook = (event: WriteEvent) => void | Promise<void>;
|
|
2619
|
-
type Unsubscribe$
|
|
2615
|
+
type Unsubscribe$3 = () => void;
|
|
2620
2616
|
declare class WriteHookRegistry {
|
|
2621
2617
|
#private;
|
|
2622
2618
|
/** True while handlers are running — used by the write path to skip nested firing. */
|
|
2623
2619
|
get suppressed(): boolean;
|
|
2624
2620
|
/** True when any hook is registered (cheap gate for the write path). */
|
|
2625
2621
|
get hasHandlers(): boolean;
|
|
2626
|
-
onBeforeWrite(handler: WriteHook): Unsubscribe$
|
|
2627
|
-
onAfterWrite(handler: WriteHook): Unsubscribe$
|
|
2622
|
+
onBeforeWrite(handler: WriteHook): Unsubscribe$3;
|
|
2623
|
+
onAfterWrite(handler: WriteHook): Unsubscribe$3;
|
|
2628
2624
|
/** Run before-hooks (awaited, in order). A throw propagates and aborts the write. */
|
|
2629
2625
|
runBefore(event: WriteEvent): Promise<void>;
|
|
2630
2626
|
/** Run after-hooks (awaited, in order). Per-handler errors are warned, not thrown. */
|
|
@@ -2632,7 +2628,113 @@ declare class WriteHookRegistry {
|
|
|
2632
2628
|
}
|
|
2633
2629
|
|
|
2634
2630
|
/**
|
|
2635
|
-
*
|
|
2631
|
+
* Generic per-instance **observe** bus. Observe-class
|
|
2632
|
+
* subsystems (devtools inspector, audit, sync-dirty notification) register
|
|
2633
|
+
* handlers against named lifecycle points instead of the kernel naming each
|
|
2634
|
+
* subsystem. Mirrors the registry pattern of {@link WriteHookRegistry} but is
|
|
2635
|
+
* internal and keyed by lifecycle point.
|
|
2636
|
+
*
|
|
2637
|
+
* OBSERVE SEMANTICS: handlers react to a write that already happened. A
|
|
2638
|
+
* handler throw is warned, not propagated — it can never abort a write. Write-
|
|
2639
|
+
* *gating* subsystems (guards, periods) need a throw-propagating gate bus.
|
|
2640
|
+
* Add observe points by extending {@link LifecycleEventMap}. Write-*gating*
|
|
2641
|
+
* subsystems use the sibling gate API on this same class
|
|
2642
|
+
* (`registerGate`/`dispatchGate`, throw-propagating); see {@link GateEventMap}.
|
|
2643
|
+
*
|
|
2644
|
+
* @module
|
|
2645
|
+
*/
|
|
2646
|
+
|
|
2647
|
+
/** Typed map of OBSERVE lifecycle point → event payload. Extend by adding keys. */
|
|
2648
|
+
interface LifecycleEventMap {
|
|
2649
|
+
afterPut: WriteEvent;
|
|
2650
|
+
afterDelete: WriteEvent;
|
|
2651
|
+
}
|
|
2652
|
+
type LifecyclePoint = keyof LifecycleEventMap;
|
|
2653
|
+
type BusHandler<P extends LifecyclePoint> = (event: LifecycleEventMap[P]) => void | Promise<void>;
|
|
2654
|
+
type Unsubscribe$2 = () => void;
|
|
2655
|
+
/** Payload for a `beforePut` gate — carries the data guards and periods need to validate or reject a write. */
|
|
2656
|
+
interface GatePutEvent {
|
|
2657
|
+
readonly op: 'create' | 'update';
|
|
2658
|
+
readonly vault: string;
|
|
2659
|
+
readonly collection: string;
|
|
2660
|
+
readonly docId: string;
|
|
2661
|
+
/** The record about to be written (pre schema-validation). */
|
|
2662
|
+
readonly incoming: unknown;
|
|
2663
|
+
/** Decrypted prior record, or null on create / when prior is unreadable. */
|
|
2664
|
+
readonly existing: unknown;
|
|
2665
|
+
/** Prior envelope version, or 0 when none. */
|
|
2666
|
+
readonly existingVersion: number;
|
|
2667
|
+
/** Prior envelope timestamp (`_ts` ISO string), or undefined when none — periods compares against this. */
|
|
2668
|
+
readonly existingTs: string | undefined;
|
|
2669
|
+
readonly userId: string;
|
|
2670
|
+
readonly role: Role;
|
|
2671
|
+
}
|
|
2672
|
+
/** Payload for a `beforeDelete` gate. Like {@link GatePutEvent} without `incoming`. */
|
|
2673
|
+
interface GateDeleteEvent {
|
|
2674
|
+
readonly vault: string;
|
|
2675
|
+
readonly collection: string;
|
|
2676
|
+
readonly docId: string;
|
|
2677
|
+
/** True for system-internal (housekeeping) deletes — handlers branch on this. */
|
|
2678
|
+
readonly internal: boolean;
|
|
2679
|
+
readonly existing: unknown;
|
|
2680
|
+
readonly existingVersion: number;
|
|
2681
|
+
readonly existingTs: string | undefined;
|
|
2682
|
+
readonly userId: string;
|
|
2683
|
+
readonly role: Role;
|
|
2684
|
+
}
|
|
2685
|
+
/** Typed map of GATE lifecycle point → event payload. Extend by adding keys. */
|
|
2686
|
+
interface GateEventMap {
|
|
2687
|
+
beforePut: GatePutEvent;
|
|
2688
|
+
beforeDelete: GateDeleteEvent;
|
|
2689
|
+
}
|
|
2690
|
+
type GatePoint = keyof GateEventMap;
|
|
2691
|
+
type GateHandler<P extends GatePoint> = (event: GateEventMap[P]) => void | Promise<void>;
|
|
2692
|
+
declare class SubsystemBus {
|
|
2693
|
+
#private;
|
|
2694
|
+
/** Register a handler for an observe point. Returns an unsubscribe fn. */
|
|
2695
|
+
register<P extends LifecyclePoint>(point: P, handler: BusHandler<P>): Unsubscribe$2;
|
|
2696
|
+
/** Cheap gate for the write path — true when any handler is registered for the point. */
|
|
2697
|
+
hasHandlers(point: LifecyclePoint): boolean;
|
|
2698
|
+
/**
|
|
2699
|
+
* True while one or more dispatches are in flight. Backed by a depth counter
|
|
2700
|
+
* so that two concurrent async dispatches (`Promise.all([put('a'), put('b')])`
|
|
2701
|
+
* each captured `busAfterPut=true` at their respective put() tops while depth
|
|
2702
|
+
* was 0) both proceed independently — the counter stays > 0 until BOTH finish,
|
|
2703
|
+
* so any nested write attempted by a handler still sees `dispatching === true`
|
|
2704
|
+
* and is suppressed by the write-path gate in `collection.ts`
|
|
2705
|
+
* (`busAfterPut = hasHandlers('afterPut') && !dispatching`). Re-entrancy
|
|
2706
|
+
* suppression lives exclusively on that write-path gate; concurrent independent
|
|
2707
|
+
* dispatches must not drop each other's events.
|
|
2708
|
+
*/
|
|
2709
|
+
get dispatching(): boolean;
|
|
2710
|
+
/**
|
|
2711
|
+
* Dispatch in registration order, awaited. Per-handler errors are warned, not
|
|
2712
|
+
* thrown — an observe handler must never abort a completed write. A
|
|
2713
|
+
* re-entrancy guard suppresses nested firing so a handler that itself writes
|
|
2714
|
+
* cannot loop (same rationale as WriteHookRegistry.#suppressed).
|
|
2715
|
+
*/
|
|
2716
|
+
dispatch<P extends LifecyclePoint>(point: P, event: LifecycleEventMap[P]): Promise<void>;
|
|
2717
|
+
/** Register a write-gating handler. A throw from the handler ABORTS the write. Returns an unsubscribe fn. */
|
|
2718
|
+
registerGate<P extends GatePoint>(point: P, handler: GateHandler<P>): Unsubscribe$2;
|
|
2719
|
+
/** Cheap gate for the write path — true when any gate handler is registered for the point. */
|
|
2720
|
+
hasGateHandlers(point: GatePoint): boolean;
|
|
2721
|
+
/**
|
|
2722
|
+
* Run gate handlers in registration order, awaited. Unlike `dispatch`
|
|
2723
|
+
* (observe), a handler throw is NOT swallowed — it PROPAGATES, aborting the
|
|
2724
|
+
* write before it reaches the store. The first throw stops the remaining
|
|
2725
|
+
* handlers (fail-fast). This is the seam guards/periods migrate onto.
|
|
2726
|
+
*
|
|
2727
|
+
* Note: gate handlers are validators that read, not write. A gate handler
|
|
2728
|
+
* that writes back into the same collection would re-enter the write path
|
|
2729
|
+
* and re-dispatch this point; loop-suppression for that case is deferred to
|
|
2730
|
+
* the migration slice (contract: gate handlers must not perform writes that
|
|
2731
|
+
* re-trigger their own point).
|
|
2732
|
+
*/
|
|
2733
|
+
dispatchGate<P extends GatePoint>(point: P, event: GateEventMap[P]): Promise<void>;
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
/**
|
|
2737
|
+
* Schema-update strategy framework types (M12 §3a).
|
|
2636
2738
|
*
|
|
2637
2739
|
* The hub core detects a schema change (SchemaDelta) and dispatches it
|
|
2638
2740
|
* through a collection's ordered strategy list. Strategies decide what
|
|
@@ -2661,13 +2763,13 @@ interface SchemaDelta {
|
|
|
2661
2763
|
interface UpdateContext {
|
|
2662
2764
|
readonly collection: string;
|
|
2663
2765
|
}
|
|
2664
|
-
/** Bulk transform run by the coordinatedCutover strategy
|
|
2766
|
+
/** Bulk transform run by the coordinatedCutover strategy. */
|
|
2665
2767
|
type TransformFn = (doc: Record<string, unknown>) => Record<string, unknown>;
|
|
2666
2768
|
/**
|
|
2667
2769
|
* A strategy's verdict on a detected schema change.
|
|
2668
2770
|
* - `allow` — no objection; the dispatcher falls through to the next strategy.
|
|
2669
2771
|
* - `reject` — terminal: refuse the change; `error` is thrown at the write path.
|
|
2670
|
-
* - `cutover` — terminal: run a coordinated drain-barrier (handled by
|
|
2772
|
+
* - `cutover` — terminal: run a coordinated drain-barrier (handled by coordinatedCutover).
|
|
2671
2773
|
* New terminal actions may be added without breaking existing strategies.
|
|
2672
2774
|
*/
|
|
2673
2775
|
type UpdateDecision = {
|
|
@@ -2686,7 +2788,7 @@ interface SchemaUpdateStrategy {
|
|
|
2686
2788
|
}
|
|
2687
2789
|
|
|
2688
2790
|
/**
|
|
2689
|
-
* Per-collection write gate
|
|
2791
|
+
* Per-collection write gate. Holds the (async) update decision
|
|
2690
2792
|
* computed at registration; `Collection.put`/`delete` await it before
|
|
2691
2793
|
* writing and throw the strategy's rejection error.
|
|
2692
2794
|
*
|
|
@@ -2703,7 +2805,7 @@ declare class SchemaUpdateGate {
|
|
|
2703
2805
|
}
|
|
2704
2806
|
|
|
2705
2807
|
/**
|
|
2706
|
-
* Schema-fence document
|
|
2808
|
+
* Schema-fence document. Vault-level generation counter + drain
|
|
2707
2809
|
* state, stored at `_meta/schema-fence` using the plaintext-envelope
|
|
2708
2810
|
* pattern of `_meta/policy` (no PII — a counter + a state enum).
|
|
2709
2811
|
*/
|
|
@@ -2715,7 +2817,7 @@ interface FenceDoc {
|
|
|
2715
2817
|
}
|
|
2716
2818
|
|
|
2717
2819
|
/**
|
|
2718
|
-
* Vault-level schema-fence controller
|
|
2820
|
+
* Vault-level schema-fence controller.
|
|
2719
2821
|
*
|
|
2720
2822
|
* Owns the open-time generation snapshot, the pending-cutover registry,
|
|
2721
2823
|
* and the cutover orchestration. 3a: single-client (the caller is the
|
|
@@ -3313,7 +3415,7 @@ declare class SyncEngine {
|
|
|
3313
3415
|
}
|
|
3314
3416
|
|
|
3315
3417
|
/**
|
|
3316
|
-
* **Wrap-DEKs primitive
|
|
3418
|
+
* **Wrap-DEKs primitive** — a single canonical shape for the
|
|
3317
3419
|
* pattern of "serialize a DEK set, encrypt it under a credential-derived
|
|
3318
3420
|
* AES-GCM key." Used by:
|
|
3319
3421
|
*
|
|
@@ -3331,7 +3433,7 @@ declare class SyncEngine {
|
|
|
3331
3433
|
* `PIN_PBKDF2_ITERATIONS` and the threat-model rationale in its
|
|
3332
3434
|
* module docstring.
|
|
3333
3435
|
*
|
|
3334
|
-
*
|
|
3436
|
+
* Previously, the same crypto lived in two places: `mintPaperRecoveryEntry`
|
|
3335
3437
|
* (in `team/recovery.ts`) and `enrollPasswordAuthenticator` (in
|
|
3336
3438
|
* `@noy-db/on-password`). Both functions did identical work — PBKDF2
|
|
3337
3439
|
* the credential, AES-GCM-encrypt the JSON-serialized DEK set — but
|
|
@@ -3358,7 +3460,7 @@ declare class SyncEngine {
|
|
|
3358
3460
|
* Composition: `PaperRecoveryEntry extends WrappedDeksBlob` plus
|
|
3359
3461
|
* `{ codeId, enrolledAt }`. `KeyringAuthenticatorWrappingDEKs`
|
|
3360
3462
|
* carries the same three fields with `salt` stored in `meta` for
|
|
3361
|
-
* slot-format back-compat (
|
|
3463
|
+
* slot-format back-compat (defers moving it to top-level).
|
|
3362
3464
|
*/
|
|
3363
3465
|
interface WrappedDeksBlob {
|
|
3364
3466
|
/** Base64 PBKDF2 salt for the credential-derived wrapping key. */
|
|
@@ -3415,9 +3517,9 @@ interface ShamirRecoveryProvider {
|
|
|
3415
3517
|
}
|
|
3416
3518
|
|
|
3417
3519
|
/**
|
|
3418
|
-
* Recovery profile persistence + dispatch
|
|
3520
|
+
* Recovery profile persistence + dispatch.
|
|
3419
3521
|
*
|
|
3420
|
-
*
|
|
3522
|
+
* Wires the **paper** profile end-to-end through
|
|
3421
3523
|
* `@noy-db/on-recovery`. The other three profiles (Shamir,
|
|
3422
3524
|
* multi-channel, admin-mediated) ship the API surface and throw
|
|
3423
3525
|
* {@link RecoveryProfileNotImplementedError} during use; per-profile
|
|
@@ -3454,7 +3556,7 @@ interface ShamirRecoveryProvider {
|
|
|
3454
3556
|
* PBKDF2-derived key), and it sidesteps the non-extractable-KEK
|
|
3455
3557
|
* constraint cleanly.
|
|
3456
3558
|
*
|
|
3457
|
-
* Type-level composition
|
|
3559
|
+
* Type-level composition: `PaperRecoveryEntry extends
|
|
3458
3560
|
* WrappedDeksBlob` — the three crypto fields (`salt`, `iv`,
|
|
3459
3561
|
* `wrappedDeks`) come from the shared primitive; `codeId` and
|
|
3460
3562
|
* `enrolledAt` are paper-recovery's own metadata. Wire format
|
|
@@ -3568,7 +3670,7 @@ declare function unwrapDeksFromShamirEntry(provider: ShamirRecoveryProvider, ent
|
|
|
3568
3670
|
* {@link savePaperRecoveryEntries}). The recovery flow unwraps the
|
|
3569
3671
|
* DEK set, then mints a fresh KEK from the user's new passphrase.
|
|
3570
3672
|
*
|
|
3571
|
-
* Thin wrapper over {@link mintWrappedDeksBlob}
|
|
3673
|
+
* Thin wrapper over {@link mintWrappedDeksBlob} — the crypto
|
|
3572
3674
|
* lives in the shared primitive; this function just adds paper-
|
|
3573
3675
|
* recovery's own metadata (`codeId`, `enrolledAt`).
|
|
3574
3676
|
*
|
|
@@ -3583,14 +3685,14 @@ declare function mintPaperRecoveryEntry(deks: Map<string, CryptoKey>, code: stri
|
|
|
3583
3685
|
* Decrypt a recovery entry to recover the raw DEK set. Used by the
|
|
3584
3686
|
* `recoverPassphrase` flow after the user's code has been parsed.
|
|
3585
3687
|
*
|
|
3586
|
-
* Thin wrapper over {@link unwrapDeksFromBlob}
|
|
3688
|
+
* Thin wrapper over {@link unwrapDeksFromBlob}.
|
|
3587
3689
|
*
|
|
3588
3690
|
* @throws when the code does not match the entry (AES-GCM auth tag fail).
|
|
3589
3691
|
*/
|
|
3590
3692
|
declare function unwrapDeksFromPaperEntry(entry: PaperRecoveryEntry, code: string): Promise<Map<string, CryptoKey>>;
|
|
3591
3693
|
|
|
3592
3694
|
/**
|
|
3593
|
-
* Tier-2 authenticator slot management
|
|
3695
|
+
* Tier-2 authenticator slot management.
|
|
3594
3696
|
*
|
|
3595
3697
|
* Each slot independently wraps the SAME KEK under a method-specific
|
|
3596
3698
|
* derived key (LUKS pattern). Enrolling adds a slot; removing drops
|
|
@@ -3640,15 +3742,14 @@ type EnrollAuthenticatorOptions = EnrollAuthenticatorWrappingKEKOptions | Enroll
|
|
|
3640
3742
|
*/
|
|
3641
3743
|
declare function enrollAuthenticator(store: NoydbStore, vault: string, keyring: UnlockedKeyring, options: EnrollAuthenticatorOptions): Promise<UnlockedKeyring>;
|
|
3642
3744
|
/**
|
|
3643
|
-
* Caller payload for {@link updateAuthenticator}
|
|
3745
|
+
* Caller payload for {@link updateAuthenticator}. Mutates only
|
|
3644
3746
|
* `meta` — the slot's id, method, and wrap material are immutable
|
|
3645
3747
|
* through this primitive, preserving the anti-slot-swap guard.
|
|
3646
3748
|
*
|
|
3647
3749
|
* `meta` is **merged** at the top level: keys absent from the patch
|
|
3648
3750
|
* are preserved, keys present overwrite. To clear a meta key, pass
|
|
3649
|
-
* `null` for that key explicitly. (Same semantics as
|
|
3650
|
-
* `UserApi.updateMe`,
|
|
3651
|
-
* into nested meta values.)
|
|
3751
|
+
* `null` for that key explicitly. (Same top-level merge semantics as
|
|
3752
|
+
* `UserApi.updateMe`, non-recursive — meta is a flat label bag.)
|
|
3652
3753
|
*/
|
|
3653
3754
|
interface UpdateAuthenticatorOptions {
|
|
3654
3755
|
readonly meta?: Record<string, unknown>;
|
|
@@ -3670,7 +3771,6 @@ interface UpdateAuthenticatorOptions {
|
|
|
3670
3771
|
* @throws `NoAccessError` when no slot with the given id exists.
|
|
3671
3772
|
* @throws `ValidationError` when no patch field is provided.
|
|
3672
3773
|
*
|
|
3673
|
-
* @see #55
|
|
3674
3774
|
*/
|
|
3675
3775
|
declare function updateAuthenticator(store: NoydbStore, vault: string, keyring: UnlockedKeyring, slotId: string, options: UpdateAuthenticatorOptions): Promise<UnlockedKeyring>;
|
|
3676
3776
|
/**
|
|
@@ -3687,7 +3787,7 @@ declare function findAuthenticator(keyring: UnlockedKeyring, slotId: string): Ke
|
|
|
3687
3787
|
|
|
3688
3788
|
/**
|
|
3689
3789
|
* Tier-1 change flows — `rotatePassphrase` (user remembers old) and
|
|
3690
|
-
* `recoverPassphrase` (user supplies a recovery proof).
|
|
3790
|
+
* `recoverPassphrase` (user supplies a recovery proof).
|
|
3691
3791
|
*
|
|
3692
3792
|
* The two flows share the post-verification half — fresh salt, fresh
|
|
3693
3793
|
* KEK, rewrap every DEK — and differ only in how they re-derive the
|
|
@@ -3753,10 +3853,9 @@ interface RotatePassphraseInput {
|
|
|
3753
3853
|
* Map of slot id → re-enrolment ceremony. Slots whose id appears
|
|
3754
3854
|
* here are PRESERVED across rotation (the ceremony re-derives the
|
|
3755
3855
|
* method-specific wrapping under the new keyring); slots whose id
|
|
3756
|
-
* is absent are DROPPED (the pre
|
|
3856
|
+
* is absent are DROPPED (the pre-slot-ceremony behavior).
|
|
3757
3857
|
*
|
|
3758
|
-
* Without this map, `rotatePassphrase`
|
|
3759
|
-
* behavior of wiping every tier-2 slot. Consumers building a
|
|
3858
|
+
* Without this map, `rotatePassphrase` wipes every tier-2 slot. Consumers building a
|
|
3760
3859
|
* "rotate without losing my biometric" flow supply ceremonies for
|
|
3761
3860
|
* each slot they want to keep.
|
|
3762
3861
|
*
|
|
@@ -3764,7 +3863,7 @@ interface RotatePassphraseInput {
|
|
|
3764
3863
|
* state. Callers wrap individual ceremonies in try/catch + return
|
|
3765
3864
|
* a sentinel if they want graceful degradation per slot.
|
|
3766
3865
|
*
|
|
3767
|
-
* Added
|
|
3866
|
+
* Added when slot-ceremony rewrapping landed.
|
|
3768
3867
|
*/
|
|
3769
3868
|
readonly slotCeremonies?: {
|
|
3770
3869
|
readonly [slotId: string]: SlotRewrapCeremony;
|
|
@@ -3775,10 +3874,10 @@ interface RotatePassphraseInput {
|
|
|
3775
3874
|
* under a freshly-derived KEK from `newPassphrase`, and persist.
|
|
3776
3875
|
*
|
|
3777
3876
|
* Tier-2 authenticator slots are dropped UNLESS the caller supplies
|
|
3778
|
-
* a `slotCeremonies` map
|
|
3877
|
+
* a `slotCeremonies` map — each ceremony re-derives its
|
|
3779
3878
|
* method-specific wrapping under the new keyring, and hub persists
|
|
3780
3879
|
* the rewrapped slots atomically with the rotation. Slots whose id
|
|
3781
|
-
* isn't in the map are still dropped
|
|
3880
|
+
* isn't in the map are still dropped.
|
|
3782
3881
|
*
|
|
3783
3882
|
* @throws `InvalidKeyError` if `oldPassphrase` does not unwrap the keyring.
|
|
3784
3883
|
* @throws `WeakPassphraseError` if `newPassphrase` fails the strength rule.
|
|
@@ -3789,7 +3888,7 @@ declare function rotatePassphrase(store: NoydbStore, vault: string, userId: stri
|
|
|
3789
3888
|
/**
|
|
3790
3889
|
* Caller payload for {@link recoverPassphrase}.
|
|
3791
3890
|
*
|
|
3792
|
-
*
|
|
3891
|
+
* `paper` and `shamir` are wired end-to-end.
|
|
3793
3892
|
* The remaining two profiles (`multi-channel`, `admin-mediated`)
|
|
3794
3893
|
* stay outside the union and throw
|
|
3795
3894
|
* {@link RecoveryProfileNotImplementedError} at the runtime guard
|
|
@@ -3819,7 +3918,7 @@ interface RecoverPassphraseInput {
|
|
|
3819
3918
|
* After a successful paper-recovery, replace ALL remaining recovery
|
|
3820
3919
|
* entries with freshly-minted ones. Defaults to `true` (defensive).
|
|
3821
3920
|
*
|
|
3822
|
-
* Rationale
|
|
3921
|
+
* Rationale: the user just demonstrated they had access
|
|
3823
3922
|
* to AT LEAST one code. The remaining codes from the same printed
|
|
3824
3923
|
* sheet may also be compromised — photographed, leaked via a
|
|
3825
3924
|
* screen-share slip, or in the hands of whoever stole the sheet.
|
|
@@ -3869,7 +3968,7 @@ interface RecoverPassphraseResult {
|
|
|
3869
3968
|
readonly newCodes: readonly string[];
|
|
3870
3969
|
}
|
|
3871
3970
|
/**
|
|
3872
|
-
* Input for {@link Noydb.rotateRecovery}
|
|
3971
|
+
* Input for {@link Noydb.rotateRecovery} — deliberate
|
|
3873
3972
|
* recovery-credential regeneration when the user knows their
|
|
3874
3973
|
* passphrase but wants a fresh sheet (paper) or fresh shares
|
|
3875
3974
|
* (shamir). Symmetric to {@link RotatePassphraseInput}.
|
|
@@ -3920,7 +4019,7 @@ interface EnrollRecoveryResult {
|
|
|
3920
4019
|
}
|
|
3921
4020
|
/**
|
|
3922
4021
|
* Input shape for {@link Noydb.enrollRecovery} and
|
|
3923
|
-
* {@link Noydb.openVaultAndEnrollRecovery}
|
|
4022
|
+
* {@link Noydb.openVaultAndEnrollRecovery}. Discriminated
|
|
3924
4023
|
* union over recovery profiles.
|
|
3925
4024
|
*
|
|
3926
4025
|
* - `paper`: caller pre-mints entries (typically via
|
|
@@ -3946,9 +4045,8 @@ type RecoveryEnrollmentInput = {
|
|
|
3946
4045
|
readonly entryId?: string;
|
|
3947
4046
|
};
|
|
3948
4047
|
/**
|
|
3949
|
-
* Reset the user's passphrase using a recovery proof.
|
|
3950
|
-
*
|
|
3951
|
-
* persisted in `_meta/recovery-paper`. The other three profiles throw
|
|
4048
|
+
* Reset the user's passphrase using a recovery proof.
|
|
4049
|
+
* Supports `'paper'` and `'shamir'` profiles. The other profiles throw
|
|
3952
4050
|
* {@link RecoveryProfileNotImplementedError}.
|
|
3953
4051
|
*
|
|
3954
4052
|
* On success, the used recovery entry is burned (deleted from the
|
|
@@ -3957,7 +4055,7 @@ type RecoveryEnrollmentInput = {
|
|
|
3957
4055
|
declare function recoverPassphrase(provider: ShamirRecoveryProvider | undefined, store: NoydbStore, vault: string, userId: string, input: RecoverPassphraseInput): Promise<UnlockedKeyring>;
|
|
3958
4056
|
|
|
3959
4057
|
/**
|
|
3960
|
-
* Atomic peer-recovery primitive
|
|
4058
|
+
* Atomic peer-recovery primitive.
|
|
3961
4059
|
*
|
|
3962
4060
|
* `recoverUser` is a SEPARATE operation from `revoke + grant`. It
|
|
3963
4061
|
* exists because peer-recovery has different semantics than account
|
|
@@ -3986,7 +4084,7 @@ declare function recoverPassphrase(provider: ShamirRecoveryProvider | undefined,
|
|
|
3986
4084
|
*
|
|
3987
4085
|
* Caller must be at least as privileged as the target. The hub
|
|
3988
4086
|
* `db.recoverUser` method gates this with the `peer-recover-user`
|
|
3989
|
-
* policy gate (
|
|
4087
|
+
* policy gate (the `peer-recover-user` factor-proof requirement); the function below
|
|
3990
4088
|
* enforces only the role + anti-privilege-escalation invariants.
|
|
3991
4089
|
*
|
|
3992
4090
|
* @module
|
|
@@ -4142,7 +4240,7 @@ declare function validatePublicEnvelopeInput(input: SetPublicEnvelopeInput, sche
|
|
|
4142
4240
|
declare function isPublicEnvelope(x: unknown): x is PublicEnvelope;
|
|
4143
4241
|
|
|
4144
4242
|
/**
|
|
4145
|
-
* Multi-tab coordination
|
|
4243
|
+
* Multi-tab coordination: primary/secondary election (Web Locks)
|
|
4146
4244
|
* + presence heartbeat (BroadcastChannel). Browser-only; opt-in; no-op
|
|
4147
4245
|
* when the APIs are absent. The lock/channel interfaces are hub-local
|
|
4148
4246
|
* (structurally compatible with @noy-db/by-peer + @noy-db/by-tabs, but
|
|
@@ -4186,20 +4284,20 @@ interface TabCoordinationOptions {
|
|
|
4186
4284
|
*/
|
|
4187
4285
|
readonly closeChannelOnDispose?: boolean;
|
|
4188
4286
|
/**
|
|
4189
|
-
* Also propagate committed writes to other tabs
|
|
4287
|
+
* Also propagate committed writes to other tabs. Default true:
|
|
4190
4288
|
* when tab coordination is enabled and a channel is available, a write in
|
|
4191
4289
|
* one tab refreshes that document in every other tab. Set false to opt out.
|
|
4192
4290
|
*/
|
|
4193
4291
|
readonly propagateWrites?: boolean;
|
|
4194
4292
|
/**
|
|
4195
|
-
* Channel for write propagation
|
|
4293
|
+
* Channel for write propagation — distinct from the presence
|
|
4196
4294
|
* channel. Default: an inline BroadcastChannel on `noydb:tab-writes`.
|
|
4197
4295
|
*/
|
|
4198
4296
|
readonly writeChannel?: TabChannel;
|
|
4199
4297
|
}
|
|
4200
4298
|
|
|
4201
4299
|
/**
|
|
4202
|
-
* Per-vault tier-3 (PIN / quick-resume) state
|
|
4300
|
+
* Per-vault tier-3 (PIN / quick-resume) state.
|
|
4203
4301
|
*
|
|
4204
4302
|
* The hub holds a `PinResumeState`-shaped record in memory, keyed by
|
|
4205
4303
|
* vault. `enrollUnlock` populates it; `unlockViaPin` consumes it via
|
|
@@ -4315,7 +4413,7 @@ interface StagedOp {
|
|
|
4315
4413
|
expectedVersion?: number;
|
|
4316
4414
|
/**
|
|
4317
4415
|
* Optional human-readable tag forwarded to the resulting ledger
|
|
4318
|
-
* entry's `reason` field
|
|
4416
|
+
* entry's `reason` field. Set by callers via
|
|
4319
4417
|
* `tx.vault(v).collection(c).put(id, record, { reason })`.
|
|
4320
4418
|
*/
|
|
4321
4419
|
reason?: string;
|
|
@@ -4347,7 +4445,7 @@ interface AmendmentTxOptions {
|
|
|
4347
4445
|
* facade; its `put`/`delete`/`get` calls stage ops against the tx.
|
|
4348
4446
|
*/
|
|
4349
4447
|
declare class TxContext {
|
|
4350
|
-
/** Stable id for this transaction; shared by all writes it performs
|
|
4448
|
+
/** Stable id for this transaction; shared by all writes it performs. */
|
|
4351
4449
|
readonly txId: string;
|
|
4352
4450
|
/** @internal */
|
|
4353
4451
|
readonly _ops: StagedOp[];
|
|
@@ -4357,7 +4455,7 @@ declare class TxContext {
|
|
|
4357
4455
|
* restore prior state via `revertExecuted`. Side-effect writes (e.g.
|
|
4358
4456
|
* recursive derivation outputs fired inside `Collection.put`) are
|
|
4359
4457
|
* appended here in execution order so they roll back alongside the
|
|
4360
|
-
* main staged ops
|
|
4458
|
+
* main staged ops.
|
|
4361
4459
|
*/
|
|
4362
4460
|
readonly _executed: ExecutedOp[];
|
|
4363
4461
|
/** @internal */
|
|
@@ -4429,12 +4527,12 @@ declare class TxCollection<T> {
|
|
|
4429
4527
|
* in `noydb.ts`. `Collection.putManyAtomic` runs its own Phase 2 loop
|
|
4430
4528
|
* but shares the `_activeTxContext` mechanism (and the `revertExecuted`
|
|
4431
4529
|
* helper) so nested side-effect derivation writes get registered for
|
|
4432
|
-
* revert alongside the bulk-put source ops
|
|
4530
|
+
* revert alongside the bulk-put source ops.
|
|
4433
4531
|
*/
|
|
4434
4532
|
declare function runTransaction<T>(db: Noydb, fn: (tx: TxContext) => Promise<T> | T, options?: AmendmentTxOptions): Promise<T>;
|
|
4435
4533
|
|
|
4436
4534
|
/**
|
|
4437
|
-
* Dry-run transactions
|
|
4535
|
+
* Dry-run transactions. Runs the tx body to STAGE ops, then builds
|
|
4438
4536
|
* the directly-affected diff (before = current committed via collection.get,
|
|
4439
4537
|
* after = staged record) and collects guard violations — without executing
|
|
4440
4538
|
* phase 2. No adapter writes, no write-hooks, no commit. MV/derivation
|
|
@@ -4462,7 +4560,7 @@ interface DryRunResult {
|
|
|
4462
4560
|
}
|
|
4463
4561
|
|
|
4464
4562
|
/**
|
|
4465
|
-
* Policy gate DSL types
|
|
4563
|
+
* Policy gate DSL types.
|
|
4466
4564
|
*
|
|
4467
4565
|
* Sensitive operations (rotate the passphrase, enroll an authenticator,
|
|
4468
4566
|
* export plaintext, grant a user, …) are gated by a typed policy
|
|
@@ -4496,12 +4594,10 @@ interface DryRunResult {
|
|
|
4496
4594
|
* devices — policies can require ANY of them or insist on a count of 2
|
|
4497
4595
|
* to force a mix.
|
|
4498
4596
|
*
|
|
4499
|
-
*
|
|
4500
|
-
*
|
|
4501
|
-
*
|
|
4502
|
-
*
|
|
4503
|
-
* pin "any second factor I have wired" without losing the freshness
|
|
4504
|
-
* guarantee.
|
|
4597
|
+
* `webauthn-platform`, `password`, `pin` — for consumers with no
|
|
4598
|
+
* off-device infrastructure (no TOTP, no email-OTP, paper recovery not
|
|
4599
|
+
* enrolled) who want to require "any second factor I have wired"
|
|
4600
|
+
* without losing the freshness guarantee.
|
|
4505
4601
|
*/
|
|
4506
4602
|
type FactorKind = 'totp' | 'email-otp' | 'recovery' | 'shamir' | 'webauthn-roaming' | 'webauthn-platform' | 'password' | 'pin';
|
|
4507
4603
|
/**
|
|
@@ -4545,7 +4641,7 @@ interface GatePolicy {
|
|
|
4545
4641
|
type BuiltInGateName = 'rotate-passphrase' | 'recover-passphrase' | 'enroll-authenticator' | 'remove-authenticator'
|
|
4546
4642
|
/**
|
|
4547
4643
|
* Authorize a deliberate paper-recovery-code regeneration —
|
|
4548
|
-
* `db.rotateRecovery
|
|
4644
|
+
* `db.rotateRecovery`. Symmetric to `rotate-passphrase` for
|
|
4549
4645
|
* the case where the user remembers their passphrase but wants a
|
|
4550
4646
|
* fresh sheet (lost the printout, suspect compromise of the off-site
|
|
4551
4647
|
* copy). PERSONAL allows tier-1; STRICT requires an off-device
|
|
@@ -4555,19 +4651,19 @@ type BuiltInGateName = 'rotate-passphrase' | 'recover-passphrase' | 'enroll-auth
|
|
|
4555
4651
|
| 'rotate-recovery'
|
|
4556
4652
|
/**
|
|
4557
4653
|
* Authorize a meta-only mutation on an existing authenticator slot —
|
|
4558
|
-
* `db.updateAuthenticator
|
|
4654
|
+
* `db.updateAuthenticator`. The slot's wrap material, id, and
|
|
4559
4655
|
* method are immutable through this gate; only the `meta` blob
|
|
4560
4656
|
* (nicknames, method-specific labels) can change. Anti-slot-swap
|
|
4561
4657
|
* guard is preserved structurally regardless of this gate's
|
|
4562
4658
|
* settings.
|
|
4563
4659
|
*/
|
|
4564
4660
|
| 'update-authenticator' | 'rotate-unlock' | 'enroll-user' | 'revoke-user' | 'export-bundle' | 'export-plaintext' | 'view-user-auth'
|
|
4565
|
-
/** Authorize a write to one's own user envelope
|
|
4661
|
+
/** Authorize a write to one's own user envelope. */
|
|
4566
4662
|
| 'edit-own-profile'
|
|
4567
|
-
/** Authorize reading other principals' user envelopes
|
|
4663
|
+
/** Authorize reading other principals' user envelopes. */
|
|
4568
4664
|
| 'view-team-profiles'
|
|
4569
4665
|
/**
|
|
4570
|
-
* Authorize an atomic peer-recovery — `db.recoverUser
|
|
4666
|
+
* Authorize an atomic peer-recovery — `db.recoverUser`.
|
|
4571
4667
|
* Distinct from `revoke-user` because peer-recovery is intentional
|
|
4572
4668
|
* re-issuance of someone's keyring under a temp passphrase, NOT
|
|
4573
4669
|
* removal. Allows owner→owner natively (matches the threat model:
|
|
@@ -4577,7 +4673,7 @@ type BuiltInGateName = 'rotate-passphrase' | 'recover-passphrase' | 'enroll-auth
|
|
|
4577
4673
|
*/
|
|
4578
4674
|
| 'peer-recover-user'
|
|
4579
4675
|
/**
|
|
4580
|
-
* Authorize a post-grant identity mutation — `db.updateUser
|
|
4676
|
+
* Authorize a post-grant identity mutation — `db.updateUser`.
|
|
4581
4677
|
* Covers `role`, `displayName`, `permissions` changes on an existing
|
|
4582
4678
|
* keyring. Pure plaintext-header rewrite — no DEKs touched, no KEK
|
|
4583
4679
|
* required. The role-elevation guard inside the implementation
|
|
@@ -4590,7 +4686,7 @@ type GateName = BuiltInGateName | `app:${string}`;
|
|
|
4590
4686
|
/**
|
|
4591
4687
|
* Top-level policy object. Persisted at `_meta/policy` once at vault
|
|
4592
4688
|
* creation. The `passphrase` block configures the strength rules
|
|
4593
|
-
* applied at every passphrase ingress
|
|
4689
|
+
* applied at every passphrase ingress; `gates` configures
|
|
4594
4690
|
* the action-level requirements.
|
|
4595
4691
|
*/
|
|
4596
4692
|
interface VaultPolicy {
|
|
@@ -4614,7 +4710,7 @@ interface FactorProof {
|
|
|
4614
4710
|
* `db.recoverUser`, `db.enrollUnlock`, `db.describeUserAuth`,
|
|
4615
4711
|
* `db.describeAllUsersAuth`.
|
|
4616
4712
|
*
|
|
4617
|
-
*
|
|
4713
|
+
* Previously this type was inlined at every call site as
|
|
4618
4714
|
* `{ factors?: ReadonlyArray<FactorProof>; sharedDevice?: boolean }`
|
|
4619
4715
|
* and parameter names alternated between `factors` and `presented`.
|
|
4620
4716
|
* Now exported so consumers can name their helpers and so the param
|
|
@@ -4634,13 +4730,14 @@ declare class Noydb {
|
|
|
4634
4730
|
private readonly emitter;
|
|
4635
4731
|
private readonly writeQueueTracker;
|
|
4636
4732
|
private readonly writeHooks;
|
|
4733
|
+
private readonly subsystemBus;
|
|
4637
4734
|
private readonly clientId;
|
|
4638
4735
|
private readonly vaultCache;
|
|
4639
4736
|
private readonly keyringCache;
|
|
4640
4737
|
private readonly syncEngines;
|
|
4641
4738
|
/**
|
|
4642
4739
|
* Per-vault active session tier — defaults to `1` after a passphrase
|
|
4643
|
-
* unlock; tier-2 / tier-3 unlocks
|
|
4740
|
+
* unlock; tier-2 / tier-3 unlocks downgrade it. Used by
|
|
4644
4741
|
* {@link checkGate} to evaluate `gate.minTier`.
|
|
4645
4742
|
*/
|
|
4646
4743
|
private readonly activeTier;
|
|
@@ -4650,14 +4747,14 @@ declare class Noydb {
|
|
|
4650
4747
|
*/
|
|
4651
4748
|
private readonly policyCache;
|
|
4652
4749
|
/**
|
|
4653
|
-
* One-shot bypass for the managed-mode strong-recovery check
|
|
4750
|
+
* One-shot bypass for the managed-mode strong-recovery check.
|
|
4654
4751
|
* Set true by {@link openVaultAndEnrollRecovery} for the duration of
|
|
4655
4752
|
* the bootstrap window so the keyring can be created before the
|
|
4656
4753
|
* strong recovery is enrolled. Always cleared (try/finally).
|
|
4657
4754
|
* @internal
|
|
4658
4755
|
*/
|
|
4659
4756
|
private _skipNextManagedRecoveryCheck;
|
|
4660
|
-
/** Per-vault tier-3 (PIN / quick-resume) state
|
|
4757
|
+
/** Per-vault tier-3 (PIN / quick-resume) state. */
|
|
4661
4758
|
private readonly quickUnlock;
|
|
4662
4759
|
/**
|
|
4663
4760
|
* Resolved public-envelope schema. Lazily computed once from
|
|
@@ -4667,9 +4764,9 @@ declare class Noydb {
|
|
|
4667
4764
|
private readonly publicEnvelopeSchema;
|
|
4668
4765
|
private closed;
|
|
4669
4766
|
private sessionTimer;
|
|
4670
|
-
/** Same-device multi-tab coordinator
|
|
4767
|
+
/** Same-device multi-tab coordinator; created on `enableTabCoordination()`. */
|
|
4671
4768
|
private tabCoordinator;
|
|
4672
|
-
/** Cross-tab write relay
|
|
4769
|
+
/** Cross-tab write relay; created on `enableTabCoordination()`. */
|
|
4673
4770
|
private writeRelay;
|
|
4674
4771
|
/** Per-vault policy enforcers. */
|
|
4675
4772
|
private readonly policyEnforcers;
|
|
@@ -4682,8 +4779,8 @@ declare class Noydb {
|
|
|
4682
4779
|
* the same function's `finally` block. Side-effect writes triggered
|
|
4683
4780
|
* during a staged op's `Collection.put` (today: eager derivation
|
|
4684
4781
|
* outputs) register their pre-write envelope on `_executed` here so
|
|
4685
|
-
* a mid-batch failure rolls them back alongside the main staged ops
|
|
4686
|
-
*
|
|
4782
|
+
* a mid-batch failure rolls them back alongside the main staged ops.
|
|
4783
|
+
* `null` outside of Phase 2.
|
|
4687
4784
|
* @internal
|
|
4688
4785
|
*/
|
|
4689
4786
|
private _activeTxContext;
|
|
@@ -4786,8 +4883,6 @@ declare class Noydb {
|
|
|
4786
4883
|
* @throws `NoAccessError` when no keyring exists for the target.
|
|
4787
4884
|
* @throws `PermissionDeniedError` when the role hierarchy rejects.
|
|
4788
4885
|
* @throws `ValidationError` when no field is provided.
|
|
4789
|
-
*
|
|
4790
|
-
* @see #54
|
|
4791
4886
|
*/
|
|
4792
4887
|
updateUser(vault: string, options: UpdateUserOptions, factors?: FactorProofBundle): Promise<void>;
|
|
4793
4888
|
/**
|
|
@@ -4975,7 +5070,7 @@ declare class Noydb {
|
|
|
4975
5070
|
*/
|
|
4976
5071
|
transaction<T>(options: AmendmentTxOptions, fn: (tx: TxContext) => Promise<T> | T): Promise<T>;
|
|
4977
5072
|
/**
|
|
4978
|
-
* Dry-run a transaction
|
|
5073
|
+
* Dry-run a transaction: run the body to stage ops, then return
|
|
4979
5074
|
* the directly-affected diff + collected guard violations WITHOUT
|
|
4980
5075
|
* committing (no adapter writes, no write hooks). MV/derivation cascade
|
|
4981
5076
|
* is not simulated. Requires `withTransactions()`.
|
|
@@ -5003,7 +5098,7 @@ declare class Noydb {
|
|
|
5003
5098
|
* Phase 2. `Collection.dispatchDerivations` consults this so a
|
|
5004
5099
|
* recursive derived-output write inside `Collection.put` can register
|
|
5005
5100
|
* its envelope onto `ctx._executed` and roll back with the main
|
|
5006
|
-
* staged ops on mid-batch failure
|
|
5101
|
+
* staged ops on mid-batch failure.
|
|
5007
5102
|
*
|
|
5008
5103
|
* @internal
|
|
5009
5104
|
*/
|
|
@@ -5028,7 +5123,7 @@ declare class Noydb {
|
|
|
5028
5123
|
* `Collection.putManyAtomic` (via `derivationSource.createTxContext`)
|
|
5029
5124
|
* to publish an active context for the duration of its bulk-atomic
|
|
5030
5125
|
* Phase 2 loop, so recursive derivation-output writes register on
|
|
5031
|
-
* `ctx._executed` and roll back together with the source ops
|
|
5126
|
+
* `ctx._executed` and roll back together with the source ops.
|
|
5032
5127
|
*
|
|
5033
5128
|
* @internal
|
|
5034
5129
|
*/
|
|
@@ -5064,19 +5159,19 @@ declare class Noydb {
|
|
|
5064
5159
|
*/
|
|
5065
5160
|
get _writeQueueTracker(): WriteQueueTracker;
|
|
5066
5161
|
/**
|
|
5067
|
-
* Register a hook that runs before each write
|
|
5162
|
+
* Register a hook that runs before each write. Awaited; a throw
|
|
5068
5163
|
* aborts the write. Returns an unsubscribe function.
|
|
5069
5164
|
*/
|
|
5070
|
-
onBeforeWrite(handler: WriteHook): Unsubscribe$
|
|
5165
|
+
onBeforeWrite(handler: WriteHook): Unsubscribe$3;
|
|
5071
5166
|
/**
|
|
5072
|
-
* Register a hook that runs after each committed write
|
|
5167
|
+
* Register a hook that runs after each committed write. Awaited;
|
|
5073
5168
|
* a handler error is warned, never rolled back. Returns an unsubscribe fn.
|
|
5074
5169
|
*/
|
|
5075
|
-
onAfterWrite(handler: WriteHook): Unsubscribe$
|
|
5076
|
-
/** Subscribe to cross-tab write conflicts
|
|
5077
|
-
onWriteConflict(fn: (c: WriteConflict) => void): Unsubscribe$
|
|
5170
|
+
onAfterWrite(handler: WriteHook): Unsubscribe$3;
|
|
5171
|
+
/** Subscribe to cross-tab write conflicts. Returns an unsubscribe. */
|
|
5172
|
+
onWriteConflict(fn: (c: WriteConflict) => void): Unsubscribe$3;
|
|
5078
5173
|
/**
|
|
5079
|
-
* Enable same-device multi-tab coordination
|
|
5174
|
+
* Enable same-device multi-tab coordination: primary/secondary
|
|
5080
5175
|
* election + presence. Browser-only — a graceful no-op (role 'unknown')
|
|
5081
5176
|
* when Web Locks / BroadcastChannel are unavailable and nothing is
|
|
5082
5177
|
* injected. Idempotent; returns a disposer.
|
|
@@ -5087,11 +5182,13 @@ declare class Noydb {
|
|
|
5087
5182
|
private disableTabCoordination;
|
|
5088
5183
|
get tabRole(): TabRole;
|
|
5089
5184
|
activeTabs(): TabPresence[];
|
|
5090
|
-
onTabRoleChange(fn: (r: TabRole) => void): Unsubscribe$
|
|
5091
|
-
onActiveTabsChange(fn: (t: TabPresence[]) => void): Unsubscribe$
|
|
5185
|
+
onTabRoleChange(fn: (r: TabRole) => void): Unsubscribe$3;
|
|
5186
|
+
onActiveTabsChange(fn: (t: TabPresence[]) => void): Unsubscribe$3;
|
|
5092
5187
|
/** @internal The write-hook registry, threaded into each Collection. */
|
|
5093
5188
|
get _writeHooks(): WriteHookRegistry;
|
|
5094
|
-
/** @internal
|
|
5189
|
+
/** @internal The observe bus, threaded into every Collection. */
|
|
5190
|
+
get _subsystemBus(): SubsystemBus;
|
|
5191
|
+
/** @internal Stable per-instance id for schema-cutover coordination. */
|
|
5095
5192
|
get _clientId(): string;
|
|
5096
5193
|
/**
|
|
5097
5194
|
* Soft-lock a single vault: clear its in-memory keyring, DEKs, vault
|
|
@@ -5109,10 +5206,6 @@ declare class Noydb {
|
|
|
5109
5206
|
* survives lock; nothing about it changes when DEKs are scrubbed).
|
|
5110
5207
|
*
|
|
5111
5208
|
* No-op when `vault` is not currently in cache (idempotent).
|
|
5112
|
-
*
|
|
5113
|
-
* Unblocks vLannaAi/niwat#33.
|
|
5114
|
-
*
|
|
5115
|
-
* @see #17
|
|
5116
5209
|
*/
|
|
5117
5210
|
lockVault(vault: string): void;
|
|
5118
5211
|
close(): void;
|
|
@@ -5146,7 +5239,7 @@ declare class Noydb {
|
|
|
5146
5239
|
*/
|
|
5147
5240
|
updatePolicy(vault: string, override: Partial<VaultPolicy>): Promise<VaultPolicy>;
|
|
5148
5241
|
/**
|
|
5149
|
-
* Read the current vault-level user-directory toggle
|
|
5242
|
+
* Read the current vault-level user-directory toggle. Returns
|
|
5150
5243
|
* the default-on shape (`{ enabled: true }`) when no `_meta/directory`
|
|
5151
5244
|
* document has been persisted yet.
|
|
5152
5245
|
*
|
|
@@ -5154,7 +5247,7 @@ declare class Noydb {
|
|
|
5154
5247
|
*/
|
|
5155
5248
|
getDirectoryEnabled(vault: string): Promise<boolean>;
|
|
5156
5249
|
/**
|
|
5157
|
-
* Toggle the vault's user-directory listing on or off
|
|
5250
|
+
* Toggle the vault's user-directory listing on or off.
|
|
5158
5251
|
* Owner-only. When disabled, `listUsersWithEnvelopes()` throws
|
|
5159
5252
|
* {@link import('./errors.js').DirectoryDisabledError} for callers
|
|
5160
5253
|
* whose role is neither `owner` nor `admin`.
|
|
@@ -5186,7 +5279,7 @@ declare class Noydb {
|
|
|
5186
5279
|
*
|
|
5187
5280
|
* Two enforcement modes:
|
|
5188
5281
|
*
|
|
5189
|
-
* 1. **Managed-mode mandatory strong-recovery
|
|
5282
|
+
* 1. **Managed-mode mandatory strong-recovery.** When
|
|
5190
5283
|
* `passphraseMode === 'managed'`, the vault MUST have at least
|
|
5191
5284
|
* one **strong** recovery profile (Shamir today). Paper alone is
|
|
5192
5285
|
* rejected because under managed mode the user has no memorized
|
|
@@ -5206,7 +5299,7 @@ declare class Noydb {
|
|
|
5206
5299
|
*/
|
|
5207
5300
|
private assertRecoveryEnrolled;
|
|
5208
5301
|
/**
|
|
5209
|
-
* Internal accessor used by tier-2/tier-3 unlock paths
|
|
5302
|
+
* Internal accessor used by tier-2/tier-3 unlock paths
|
|
5210
5303
|
* to mark the active session tier.
|
|
5211
5304
|
* @internal
|
|
5212
5305
|
*/
|
|
@@ -5230,7 +5323,7 @@ declare class Noydb {
|
|
|
5230
5323
|
* `remove-authenticator`.
|
|
5231
5324
|
*/
|
|
5232
5325
|
removeAuthenticator(vault: string, slotId: string, factors?: FactorProofBundle): Promise<void>;
|
|
5233
|
-
/** Read the slot list for a vault. Internal — `describeAuthConfig`
|
|
5326
|
+
/** Read the slot list for a vault. Internal — `describeAuthConfig` consumes this. */
|
|
5234
5327
|
listAuthenticators(vault: string): Promise<ReadonlyArray<KeyringAuthenticator>>;
|
|
5235
5328
|
/**
|
|
5236
5329
|
* Mutate the `meta` blob on an existing authenticator slot — slot
|
|
@@ -5239,7 +5332,7 @@ declare class Noydb {
|
|
|
5239
5332
|
* are immutable through this method. Anti-slot-swap is structural,
|
|
5240
5333
|
* not gate-driven.
|
|
5241
5334
|
*
|
|
5242
|
-
* `meta` patch semantics (
|
|
5335
|
+
* `meta` patch semantics (top-level merge):
|
|
5243
5336
|
* - Top-level merge — absent keys preserved
|
|
5244
5337
|
* - `null` value — delete that meta key
|
|
5245
5338
|
* - Other values — replace verbatim
|
|
@@ -5257,12 +5350,10 @@ declare class Noydb {
|
|
|
5257
5350
|
*
|
|
5258
5351
|
* @throws `NoAccessError` when no slot with the given id exists.
|
|
5259
5352
|
* @throws `ValidationError` when no patch field is provided.
|
|
5260
|
-
*
|
|
5261
|
-
* @see #55
|
|
5262
5353
|
*/
|
|
5263
5354
|
updateAuthenticator(vault: string, slotId: string, options: UpdateAuthenticatorOptions, factors?: FactorProofBundle): Promise<void>;
|
|
5264
5355
|
/**
|
|
5265
|
-
* Native WebAuthn enrollment using the **real** internal keyring
|
|
5356
|
+
* Native WebAuthn enrollment using the **real** internal keyring.
|
|
5266
5357
|
*
|
|
5267
5358
|
* Why this exists: when a consumer is using `createNoydb({ secret })`,
|
|
5268
5359
|
* they cannot reach the live `UnlockedKeyring` to feed it to
|
|
@@ -5305,8 +5396,6 @@ declare class Noydb {
|
|
|
5305
5396
|
* a server-side allowlist).
|
|
5306
5397
|
*
|
|
5307
5398
|
* Gated by `enroll-authenticator` like `enrollAuthenticator()` itself.
|
|
5308
|
-
*
|
|
5309
|
-
* @see #16
|
|
5310
5399
|
*/
|
|
5311
5400
|
enrollWebAuthn(vault: string, ceremony: (keyring: UnlockedKeyring) => Promise<EnrollAuthenticatorOptions>, factors?: FactorProofBundle): Promise<{
|
|
5312
5401
|
credentialId: string;
|
|
@@ -5317,8 +5406,6 @@ declare class Noydb {
|
|
|
5317
5406
|
* deciding when a new device prompt should appear. Identity is
|
|
5318
5407
|
* `id` + `enrolled_at`; the `meta.credentialId` (base64) is used by
|
|
5319
5408
|
* `allowCredentials` at unlock time.
|
|
5320
|
-
*
|
|
5321
|
-
* @see #16
|
|
5322
5409
|
*/
|
|
5323
5410
|
listWebAuthnSlots(vault: string): Promise<ReadonlyArray<{
|
|
5324
5411
|
id: string;
|
|
@@ -5382,8 +5469,7 @@ declare class Noydb {
|
|
|
5382
5469
|
*
|
|
5383
5470
|
* Tier-2 authenticator slots are dropped — each slot wraps the old
|
|
5384
5471
|
* KEK and would need its derivation key to be re-presented. Re-enrol
|
|
5385
|
-
* via `db.enrollAuthenticator` after rotation.
|
|
5386
|
-
* v0.1.0-pre.5 limitation.
|
|
5472
|
+
* via `db.enrollAuthenticator` after rotation.
|
|
5387
5473
|
*
|
|
5388
5474
|
* @throws `WeakPassphraseError` on a weak new phrase.
|
|
5389
5475
|
* @throws `PolicyDeniedError` when the gate denies (missing factor, …).
|
|
@@ -5392,14 +5478,14 @@ declare class Noydb {
|
|
|
5392
5478
|
rotatePassphrase(vault: string, input: RotatePassphraseInput, factors?: FactorProofBundle): Promise<void>;
|
|
5393
5479
|
/**
|
|
5394
5480
|
* Reset the passphrase using a recovery proof (user forgot the old).
|
|
5395
|
-
*
|
|
5396
|
-
* other
|
|
5481
|
+
* Currently supports the `'paper'` profile end-to-end; the
|
|
5482
|
+
* other profiles throw {@link RecoveryProfileNotImplementedError}.
|
|
5397
5483
|
*
|
|
5398
5484
|
* Burns the used recovery entry on success.
|
|
5399
5485
|
*/
|
|
5400
5486
|
recoverPassphrase(vault: string, input: RecoverPassphraseInput, factors?: FactorProofBundle): Promise<RecoverPassphraseResult>;
|
|
5401
5487
|
/**
|
|
5402
|
-
* Deliberate paper-recovery-code regeneration
|
|
5488
|
+
* Deliberate paper-recovery-code regeneration. User knows their
|
|
5403
5489
|
* passphrase but wants a fresh sheet — they lost the printout or
|
|
5404
5490
|
* suspect compromise of the off-site copy.
|
|
5405
5491
|
*
|
|
@@ -5409,7 +5495,7 @@ declare class Noydb {
|
|
|
5409
5495
|
*
|
|
5410
5496
|
* Gated by the `rotate-recovery` policy gate:
|
|
5411
5497
|
* - PERSONAL_POLICY: `{ minTier: 1 }` — knowing the passphrase
|
|
5412
|
-
* suffices, matching the
|
|
5498
|
+
* suffices, matching the lower-level flow's bar.
|
|
5413
5499
|
* - STRICT_POLICY: `{ minTier: 1, factors: [{ anyOf: ['totp',
|
|
5414
5500
|
* 'email-otp', 'webauthn-roaming'] }] }` — rotation is an
|
|
5415
5501
|
* off-site-trust event; require an off-device factor so a
|
|
@@ -5445,7 +5531,7 @@ declare class Noydb {
|
|
|
5445
5531
|
private rotateRecoveryPaper;
|
|
5446
5532
|
private rotateRecoveryShamir;
|
|
5447
5533
|
/**
|
|
5448
|
-
* **Atomic create-and-enroll for managed-mode vaults
|
|
5534
|
+
* **Atomic create-and-enroll for managed-mode vaults.**
|
|
5449
5535
|
*
|
|
5450
5536
|
* Bootstraps a managed-mode vault and enrolls strong recovery in
|
|
5451
5537
|
* a single ceremony. Under `passphraseMode: 'managed'`, every
|
|
@@ -5490,7 +5576,7 @@ declare class Noydb {
|
|
|
5490
5576
|
readonly recoveryEnrollments: ReadonlyArray<EnrollRecoveryResult>;
|
|
5491
5577
|
}>;
|
|
5492
5578
|
/**
|
|
5493
|
-
* **Recovery flow under managed-passphrase mode
|
|
5579
|
+
* **Recovery flow under managed-passphrase mode.**
|
|
5494
5580
|
*
|
|
5495
5581
|
* Replaces the sealed passphrase of a managed-mode vault with a
|
|
5496
5582
|
* fresh 256-bit random, sealed under the configured
|
|
@@ -5507,7 +5593,7 @@ declare class Noydb {
|
|
|
5507
5593
|
* 5. Drop the keyring cache so the next operation re-derives.
|
|
5508
5594
|
*
|
|
5509
5595
|
* The vault's strong-recovery enrollment is preserved across
|
|
5510
|
-
* recovery (Shamir entries are not burned on use
|
|
5596
|
+
* recovery (Shamir entries are not burned on use).
|
|
5511
5597
|
*
|
|
5512
5598
|
* @throws ValidationError if the Noydb instance is not in managed mode.
|
|
5513
5599
|
*/
|
|
@@ -5517,7 +5603,7 @@ declare class Noydb {
|
|
|
5517
5603
|
}): Promise<void>;
|
|
5518
5604
|
/**
|
|
5519
5605
|
* Atomic peer-recovery — re-wraps an EXISTING user's keyring under
|
|
5520
|
-
* a fresh temp passphrase in a single store write. Closes
|
|
5606
|
+
* a fresh temp passphrase in a single store write. Closes the
|
|
5521
5607
|
* partial-failure window (the previous compose-from-primitives
|
|
5522
5608
|
* pattern was `db.revoke + db.grant`, two writes — if the issuer
|
|
5523
5609
|
* cancelled between them the target was locked out entirely).
|
|
@@ -5527,7 +5613,7 @@ declare class Noydb {
|
|
|
5527
5613
|
* - Same `userId`, role, permissions, capabilities preserved.
|
|
5528
5614
|
* - DEKs unchanged → every other principal in the vault keeps
|
|
5529
5615
|
* access. No key rotation.
|
|
5530
|
-
* - Allows owner→owner natively
|
|
5616
|
+
* - Allows owner→owner natively. The existing
|
|
5531
5617
|
* `db.revoke` retains its block — peer-recovery is a separate,
|
|
5532
5618
|
* intentionally-named operation.
|
|
5533
5619
|
* - Tier-2 slots dropped (they wrap the old KEK).
|
|
@@ -5556,11 +5642,10 @@ declare class Noydb {
|
|
|
5556
5642
|
* @throws `PrivilegeEscalationError` when the caller lacks a DEK
|
|
5557
5643
|
* the target previously had access to.
|
|
5558
5644
|
*
|
|
5559
|
-
* @see #33 #34 — the issues this method closes.
|
|
5560
5645
|
*/
|
|
5561
5646
|
recoverUser(vault: string, options: RecoverUserOptions, factors?: FactorProofBundle): Promise<void>;
|
|
5562
5647
|
/**
|
|
5563
|
-
* Persist a recovery enrollment.
|
|
5648
|
+
* Persist a recovery enrollment. Accepts the `'paper'`
|
|
5564
5649
|
* profile.
|
|
5565
5650
|
*
|
|
5566
5651
|
* The hub wraps the user's DEK set (not the KEK) under a code-derived
|
|
@@ -5580,7 +5665,7 @@ declare class Noydb {
|
|
|
5580
5665
|
* showCodesToUser(codes)
|
|
5581
5666
|
* ```
|
|
5582
5667
|
*
|
|
5583
|
-
*
|
|
5668
|
+
* `@noy-db/on-recovery`'s `generateRecoveryCodeSet`
|
|
5584
5669
|
* delegates to `mintPaperRecoveryEntry` internally — its output is
|
|
5585
5670
|
* fed directly to this API. Pick whichever fits your code-gen layer:
|
|
5586
5671
|
*
|
|
@@ -5591,7 +5676,7 @@ declare class Noydb {
|
|
|
5591
5676
|
* ```
|
|
5592
5677
|
*/
|
|
5593
5678
|
enrollRecovery(vault: string, enrollment: RecoveryEnrollmentInput): Promise<EnrollRecoveryResult>;
|
|
5594
|
-
/** Read the persisted recovery entries (paper + Shamir). Used by `describeAuthConfig
|
|
5679
|
+
/** Read the persisted recovery entries (paper + Shamir). Used by `describeAuthConfig`. */
|
|
5595
5680
|
listRecoveryEntries(vault: string): Promise<{
|
|
5596
5681
|
paper: ReadonlyArray<PaperRecoveryEntry>;
|
|
5597
5682
|
shamir: ReadonlyArray<ShamirRecoveryEntry>;
|
|
@@ -5619,11 +5704,11 @@ declare class Noydb {
|
|
|
5619
5704
|
/** Drop the tier-3 state for a vault — explicit logout. */
|
|
5620
5705
|
clearQuickUnlock(vault: string): void;
|
|
5621
5706
|
/**
|
|
5622
|
-
* Public accessor for the unlocked keyring of a vault
|
|
5707
|
+
* Public accessor for the unlocked keyring of a vault.
|
|
5623
5708
|
*
|
|
5624
5709
|
* Returns a **defensive shallow copy** so consumers can read the DEK
|
|
5625
5710
|
* map and authenticator list without the risk of mutating the hub's
|
|
5626
|
-
* internal cache
|
|
5711
|
+
* internal cache. Internal hub code paths use a live reference
|
|
5627
5712
|
* via `getKeyringInternal`; ceremonies and external consumers always
|
|
5628
5713
|
* get a snapshot.
|
|
5629
5714
|
*
|
|
@@ -5864,8 +5949,8 @@ interface GuardStrategy<T extends Record<string, unknown>> {
|
|
|
5864
5949
|
* })
|
|
5865
5950
|
* ```
|
|
5866
5951
|
*
|
|
5867
|
-
* Also skipped on system-internal deletes (derivation tombstones
|
|
5868
|
-
*
|
|
5952
|
+
* Also skipped on system-internal deletes (derivation tombstones,
|
|
5953
|
+
* MV refresh from Dim 14 v2) — those use `_internalDelete`
|
|
5869
5954
|
* which bypasses every user-facing delete hook. Housekeeping ops are
|
|
5870
5955
|
* NOT user-initiated and should not trip user invariants.
|
|
5871
5956
|
*
|
|
@@ -5924,14 +6009,14 @@ interface RecordOutputSpec {
|
|
|
5924
6009
|
* `undefined`) for this output key. The executor interprets that as
|
|
5925
6010
|
* "no output for this invocation": a previously-emitted output at
|
|
5926
6011
|
* the same id is deleted (mirroring the empty-group / empty-aggregate
|
|
5927
|
-
* semantics
|
|
6012
|
+
* semantics for empty groups); a never-emitted output is a silent
|
|
5928
6013
|
* no-op. When `false` (default), returning `null` throws
|
|
5929
6014
|
* `DerivationOutputShapeError` — same as v1.
|
|
5930
6015
|
*/
|
|
5931
6016
|
optional?: boolean;
|
|
5932
6017
|
}
|
|
5933
6018
|
/**
|
|
5934
|
-
* Array-shape output
|
|
6019
|
+
* Array-shape output — one source row produces a variable-length
|
|
5935
6020
|
* list of output rows, each with its own id (from the `key` extractor).
|
|
5936
6021
|
*
|
|
5937
6022
|
* On every source-row change, the dispatcher diffs the previously
|
|
@@ -6154,7 +6239,7 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
6154
6239
|
*/
|
|
6155
6240
|
query?: (db: MVQueryContext) => Query<TRow>;
|
|
6156
6241
|
/**
|
|
6157
|
-
* UNION-form sources
|
|
6242
|
+
* UNION-form sources: an explicit list of sibling collections
|
|
6158
6243
|
* that contribute rows to a single MV. Each arm's `map` projects a
|
|
6159
6244
|
* source row into the MV's unified row shape; the mapped streams are
|
|
6160
6245
|
* concatenated, then {@link groupBy} + {@link aggregate} run on the
|
|
@@ -6170,7 +6255,7 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
6170
6255
|
*/
|
|
6171
6256
|
unionSources?: ReadonlyArray<UnionSource<TRow>>;
|
|
6172
6257
|
/**
|
|
6173
|
-
* Group-key field(s) for UNION mode
|
|
6258
|
+
* Group-key field(s) for UNION mode. Applied to the
|
|
6174
6259
|
* concatenated mapped-row stream from {@link unionSources} before
|
|
6175
6260
|
* {@link aggregate} runs. Accepts a single field name or a tuple of
|
|
6176
6261
|
* field names for multi-key grouping (same shape as
|
|
@@ -6182,7 +6267,7 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
6182
6267
|
*/
|
|
6183
6268
|
groupBy?: string | ReadonlyArray<string>;
|
|
6184
6269
|
/**
|
|
6185
|
-
* Aggregation spec for UNION mode
|
|
6270
|
+
* Aggregation spec for UNION mode. Applied per-group after
|
|
6186
6271
|
* {@link groupBy} buckets the concatenated mapped-row stream from
|
|
6187
6272
|
* {@link unionSources}. Same shape as the `AggregateSpec` passed to
|
|
6188
6273
|
* `Query.aggregate()`.
|
|
@@ -6193,11 +6278,11 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
6193
6278
|
/**
|
|
6194
6279
|
* Pure function from a materialized row → stable id used in the
|
|
6195
6280
|
* output collection. Required — explicit always beats default-with-pitfalls
|
|
6196
|
-
* (
|
|
6281
|
+
* (explicit always beats default-with-pitfalls; see the slash-collision rationale).
|
|
6197
6282
|
*/
|
|
6198
6283
|
rowKey: (row: TRow) => string;
|
|
6199
6284
|
/**
|
|
6200
|
-
* Explicit source collections
|
|
6285
|
+
* Explicit source collections. Required when `query()` returns
|
|
6201
6286
|
* an `Aggregation` or `GroupedAggregation` rather than a `Query<T>`
|
|
6202
6287
|
* — the dependency analyzer can't introspect through `groupBy().aggregate()`
|
|
6203
6288
|
* back to the source. Optional for plain `Query<T>` results — the
|
|
@@ -6207,7 +6292,7 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
6207
6292
|
*/
|
|
6208
6293
|
sources?: ReadonlyArray<string>;
|
|
6209
6294
|
/**
|
|
6210
|
-
* Declared deterministic predicates
|
|
6295
|
+
* Declared deterministic predicates. Each entry pairs a
|
|
6211
6296
|
* consumer-stable `hash` with a function. The `query()` callback's
|
|
6212
6297
|
* Query<T> can invoke them via `.wherePredicate(name, ctx?)`. The
|
|
6213
6298
|
* predicate's `hash` + a canonical-JSON hash of `ctx` both fold
|
|
@@ -6244,8 +6329,8 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
6244
6329
|
*
|
|
6245
6330
|
* - `'delete'` (default) — tombstone the prior MV row via
|
|
6246
6331
|
* `Collection._internalDelete` (system housekeeping bypasses user
|
|
6247
|
-
* `onDelete` guards on the output collection —
|
|
6248
|
-
* composition fix).
|
|
6332
|
+
* `onDelete` guards on the output collection — the housekeeping
|
|
6333
|
+
* bypass composition fix).
|
|
6249
6334
|
* - `'keep'` — leave the prior MV row in place. Useful when zero
|
|
6250
6335
|
* is a meaningful state.
|
|
6251
6336
|
*/
|
|
@@ -6253,7 +6338,7 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
6253
6338
|
/**
|
|
6254
6339
|
* `true` re-throws on any row-write failure → composes with
|
|
6255
6340
|
* `withTransactions` to roll back the source-write atomically via
|
|
6256
|
-
* `revertExecuted
|
|
6341
|
+
* `revertExecuted`. Default `false` (failed rows are
|
|
6257
6342
|
* isolated; other rows commit).
|
|
6258
6343
|
*/
|
|
6259
6344
|
strict?: boolean;
|
|
@@ -6287,7 +6372,7 @@ interface RegisteredMV {
|
|
|
6287
6372
|
* Top-level FieldClauses on the partition field, captured at
|
|
6288
6373
|
* registration time. Used by the cycle detector to resolve
|
|
6289
6374
|
* same-collection-as-source edges via the partition-discriminator
|
|
6290
|
-
* check
|
|
6375
|
+
* check. Empty when `spec.output?.partition` is undefined.
|
|
6291
6376
|
*/
|
|
6292
6377
|
readonly partitionClauses: readonly FieldClause[];
|
|
6293
6378
|
}
|
|
@@ -6339,7 +6424,7 @@ declare class MaterializedViewRegistry {
|
|
|
6339
6424
|
}
|
|
6340
6425
|
|
|
6341
6426
|
/**
|
|
6342
|
-
* Read-shadow overlay primitive (
|
|
6427
|
+
* Read-shadow overlay primitive (MV v2 spec § Composition with
|
|
6343
6428
|
* operator-editable lifecycle). Binds an MV's read-only base output
|
|
6344
6429
|
* to a separate user-writable overlay collection; reads merge via a
|
|
6345
6430
|
* single shadow predicate, writes route to the overlay.
|
|
@@ -6442,7 +6527,7 @@ declare class GuardRegistry {
|
|
|
6442
6527
|
register<T extends Record<string, unknown>>(spec: GuardStrategy<T>): void;
|
|
6443
6528
|
/** All guards registered against `collection` in registration order. */
|
|
6444
6529
|
guardsFor(collection: string): ReadonlyArray<AnyGuard>;
|
|
6445
|
-
/** Per-collection guard counts, for introspection
|
|
6530
|
+
/** Per-collection guard counts, for introspection. */
|
|
6446
6531
|
summary(): {
|
|
6447
6532
|
collection: string;
|
|
6448
6533
|
count: number;
|
|
@@ -6883,7 +6968,7 @@ declare function magicLinkGrantRecordId(token: string, index: number): string;
|
|
|
6883
6968
|
declare function isMagicLinkGrantExpired(payload: MagicLinkGrantPayload, now?: Date): boolean;
|
|
6884
6969
|
|
|
6885
6970
|
/**
|
|
6886
|
-
* Type surface for the user-list visibility subsystem
|
|
6971
|
+
* Type surface for the user-list visibility subsystem.
|
|
6887
6972
|
*
|
|
6888
6973
|
* Two complementary flags:
|
|
6889
6974
|
* - {@link DirectoryConfig} — vault-level "is the directory listing
|
|
@@ -6934,7 +7019,7 @@ interface UserVisibility {
|
|
|
6934
7019
|
* own keyringId. **Own-only write rule** is structural — no method
|
|
6935
7020
|
* exists to write someone else's envelope.
|
|
6936
7021
|
* - Read-anyone: `get` / `list` — read other principals' envelopes
|
|
6937
|
-
* (subject to `view-team-profiles` policy gate
|
|
7022
|
+
* (subject to `view-team-profiles` policy gate).
|
|
6938
7023
|
* - Reactive: `subscribe` / `live` — in-process event emission on local
|
|
6939
7024
|
* writes. Cross-instance updates land via the team/sync engine and
|
|
6940
7025
|
* surface to subscribers when the sync diff replays through this API.
|
|
@@ -6954,7 +7039,7 @@ type DeepPartial<T> = T extends object ? {
|
|
|
6954
7039
|
} : T;
|
|
6955
7040
|
/**
|
|
6956
7041
|
* Recursive partial with `null` allowed at every level — used by
|
|
6957
|
-
* `updateMe`
|
|
7042
|
+
* `updateMe` to express deletion intent in addition to merge.
|
|
6958
7043
|
*
|
|
6959
7044
|
* Semantics inside `updateMe`:
|
|
6960
7045
|
* - `undefined` (or absent key) — skip; source value preserved
|
|
@@ -6963,8 +7048,8 @@ type DeepPartial<T> = T extends object ? {
|
|
|
6963
7048
|
* replace for primitives / arrays)
|
|
6964
7049
|
*
|
|
6965
7050
|
* Matches lodash `_.merge` behavior on `null` and Firestore's
|
|
6966
|
-
* `FieldValue.delete()` semantics. Loosened from `DeepPartial<T
|
|
6967
|
-
*
|
|
7051
|
+
* `FieldValue.delete()` semantics. Loosened from `DeepPartial<T>`.
|
|
7052
|
+
* Consumers wanting the original "merge-only" surface can keep
|
|
6968
7053
|
* importing `DeepPartial` and avoid passing `null`.
|
|
6969
7054
|
*/
|
|
6970
7055
|
type DeepPartialOrNull<T> = T extends object ? {
|
|
@@ -7036,7 +7121,7 @@ declare class UserApi {
|
|
|
7036
7121
|
* the envelope on first call. Optimistic-concurrency safe — a stale
|
|
7037
7122
|
* `_v` (parallel writer on another device) throws `ConflictError`.
|
|
7038
7123
|
*
|
|
7039
|
-
* Patch semantics
|
|
7124
|
+
* Patch semantics:
|
|
7040
7125
|
* - `undefined` (or omitted key) — skip; existing value preserved
|
|
7041
7126
|
* - `null` — delete the field from the merged result
|
|
7042
7127
|
* - any other value — overwrite (deep-merge for plain objects,
|
|
@@ -7190,7 +7275,7 @@ interface PersistedSchemaEnvelope {
|
|
|
7190
7275
|
* @module
|
|
7191
7276
|
*/
|
|
7192
7277
|
|
|
7193
|
-
/** Flat snapshot of a vault's registered schema
|
|
7278
|
+
/** Flat snapshot of a vault's registered schema. */
|
|
7194
7279
|
interface SchemaIntrospection {
|
|
7195
7280
|
readonly collections: ReadonlyArray<{
|
|
7196
7281
|
name: string;
|
|
@@ -7367,23 +7452,23 @@ declare class Vault {
|
|
|
7367
7452
|
* `null` for vaults that never register any guard strategy. The
|
|
7368
7453
|
* runtime class is dynamic-imported on demand so consumers that
|
|
7369
7454
|
* never use guards don't pull `GuardRegistry`/`GuardExecutor` into
|
|
7370
|
-
* their bundle
|
|
7455
|
+
* their bundle.
|
|
7371
7456
|
*/
|
|
7372
7457
|
private guardRegistry;
|
|
7373
7458
|
/**
|
|
7374
7459
|
* Per-vault derivation registry. Same lazy-load contract as
|
|
7375
7460
|
* `guardRegistry` — `null` until `_initDerivations()` runs with at
|
|
7376
|
-
* least one strategy handle.
|
|
7461
|
+
* least one strategy handle.
|
|
7377
7462
|
*/
|
|
7378
7463
|
private derivationRegistry;
|
|
7379
7464
|
/**
|
|
7380
|
-
* Per-vault materialized-view registry
|
|
7465
|
+
* Per-vault materialized-view registry. Same lazy-load
|
|
7381
7466
|
* contract as `derivationRegistry` — `null` until
|
|
7382
7467
|
* `_initMaterializedViews()` runs with at least one MV handle.
|
|
7383
7468
|
*/
|
|
7384
7469
|
private materializedViewRegistry;
|
|
7385
7470
|
/**
|
|
7386
|
-
* Per-vault overlay registry
|
|
7471
|
+
* Per-vault overlay registry. Same lazy-load contract as
|
|
7387
7472
|
* `materializedViewRegistry` — `null` until `_initOverlayedViews()`
|
|
7388
7473
|
* runs with at least one handle.
|
|
7389
7474
|
*/
|
|
@@ -7404,7 +7489,7 @@ declare class Vault {
|
|
|
7404
7489
|
* target this vault session's keyringId. There is no method to write
|
|
7405
7490
|
* another principal's envelope (own-only write rule, structural).
|
|
7406
7491
|
* - Read-anyone: `get(keyringId)`, `list()` — read other principals'
|
|
7407
|
-
* envelopes, subject to the `view-team-profiles` policy gate
|
|
7492
|
+
* envelopes, subject to the `view-team-profiles` policy gate.
|
|
7408
7493
|
* - Reactive: `subscribe(id, cb)`, `live(id)` — fire on local writes.
|
|
7409
7494
|
*
|
|
7410
7495
|
* @see docs/superpowers/specs/2026-05-05-user-envelope-design.md
|
|
@@ -7424,7 +7509,7 @@ declare class Vault {
|
|
|
7424
7509
|
*/
|
|
7425
7510
|
private readonly reloadKeyring;
|
|
7426
7511
|
private readonly collectionCache;
|
|
7427
|
-
/**
|
|
7512
|
+
/** Vault-level schema cutover fence/controller. */
|
|
7428
7513
|
readonly schemaFence: SchemaFenceController;
|
|
7429
7514
|
/**
|
|
7430
7515
|
* per-collection `blobFields` retention/TTL config.
|
|
@@ -7498,8 +7583,7 @@ declare class Vault {
|
|
|
7498
7583
|
* Cache of closed/opened accounting periods.
|
|
7499
7584
|
* Populated on first `closePeriod` / `openPeriod` / `listPeriods` /
|
|
7500
7585
|
* per-collection write call. Kept in memory as an ordered list (by
|
|
7501
|
-
* `closedAt`) so
|
|
7502
|
-
* each collection's put/delete path.
|
|
7586
|
+
* `closedAt`) so period checks run fast when the gate bus fires.
|
|
7503
7587
|
*
|
|
7504
7588
|
* Sentinel `null` means "not yet loaded" — the first consumer
|
|
7505
7589
|
* triggers a one-time `loadPeriods()` pass. Every subsequent
|
|
@@ -7659,7 +7743,7 @@ declare class Vault {
|
|
|
7659
7743
|
*/
|
|
7660
7744
|
persistJsonSchema?: boolean;
|
|
7661
7745
|
/**
|
|
7662
|
-
* Ordered schema-update strategies
|
|
7746
|
+
* Ordered schema-update strategies. On a detected schema
|
|
7663
7747
|
* change, evaluated in order; the first non-`allow` decision wins.
|
|
7664
7748
|
* A `reject` is enforced at the write path (`put`/`delete` throw).
|
|
7665
7749
|
* Requires `persistJsonSchema: true` (detection needs the baseline).
|
|
@@ -7675,7 +7759,7 @@ declare class Vault {
|
|
|
7675
7759
|
*/
|
|
7676
7760
|
_drainPendingSchemaWrites(): Promise<void>;
|
|
7677
7761
|
/**
|
|
7678
|
-
* Run a coordinated schema cutover
|
|
7762
|
+
* Run a coordinated schema cutover. Drains pending writes, waits
|
|
7679
7763
|
* for the active client set to quiesce (the ack-barrier), applies every
|
|
7680
7764
|
* pending collection transform in bulk, bumps the vault schema generation,
|
|
7681
7765
|
* and clears the fence. Returns the count of collections migrated.
|
|
@@ -7687,15 +7771,15 @@ declare class Vault {
|
|
|
7687
7771
|
migrated: number;
|
|
7688
7772
|
}>;
|
|
7689
7773
|
/**
|
|
7690
|
-
*
|
|
7774
|
+
* Refresh a loaded collection's view of one document from a peer
|
|
7691
7775
|
* tab's broadcast. No-op when the collection isn't loaded in this tab
|
|
7692
|
-
* (it will read fresh on next open). Mirrors
|
|
7776
|
+
* (it will read fresh on next open). Mirrors `#runCutoverTransform`'s guard.
|
|
7693
7777
|
*/
|
|
7694
7778
|
_applyRemoteWrite(collectionName: string, docId: string, action: 'put' | 'delete'): Promise<void>;
|
|
7695
7779
|
/**
|
|
7696
|
-
*
|
|
7780
|
+
* For a detected conflict: capture this tab's clobbered record,
|
|
7697
7781
|
* read the common ancestor from history, converge the cache to the store's
|
|
7698
|
-
* authoritative value (the
|
|
7782
|
+
* authoritative value (the re-read), and return all three for the
|
|
7699
7783
|
* WriteConflict payload. Returns null when the collection isn't loaded.
|
|
7700
7784
|
*/
|
|
7701
7785
|
_captureAndConverge(collectionName: string, docId: string, action: 'put' | 'delete', baseV: number): Promise<{
|
|
@@ -7703,11 +7787,11 @@ declare class Vault {
|
|
|
7703
7787
|
remote: unknown;
|
|
7704
7788
|
base: unknown;
|
|
7705
7789
|
} | null>;
|
|
7706
|
-
/** Recover a stuck cutover fence
|
|
7790
|
+
/** Recover a stuck cutover fence — reset to normal without bumping. */
|
|
7707
7791
|
abortSchemaCutover(): Promise<void>;
|
|
7708
|
-
/** Current schema-cutover fence state for this vault
|
|
7792
|
+
/** Current schema-cutover fence state for this vault. Thin live read. */
|
|
7709
7793
|
schemaFenceState(): Promise<FenceDoc>;
|
|
7710
|
-
/** @internal Start the per-client heartbeat + fence watcher once a cutover is registered
|
|
7794
|
+
/** @internal Start the per-client heartbeat + fence watcher once a cutover is registered. */
|
|
7711
7795
|
_ensureFenceCoordination(): void;
|
|
7712
7796
|
/** @internal Stop the heartbeat/watcher (vault lock/close). */
|
|
7713
7797
|
_stopFenceCoordination(): void;
|
|
@@ -8023,7 +8107,7 @@ declare class Vault {
|
|
|
8023
8107
|
* Dynamic-imports `GuardRegistry` + `ReadOnlyVaultFacade` and seeds
|
|
8024
8108
|
* the registry with the supplied strategy handles. No-op when the
|
|
8025
8109
|
* handles array is empty — keeps the guard subsystem out of the
|
|
8026
|
-
* floor bundle for consumers that don't use guards
|
|
8110
|
+
* floor bundle for consumers that don't use guards.
|
|
8027
8111
|
*
|
|
8028
8112
|
* The read-only facade is eagerly instantiated here so the sync
|
|
8029
8113
|
* accessor `_getReadOnlyFacade()` (called from the tx amendment
|
|
@@ -8031,10 +8115,9 @@ declare class Vault {
|
|
|
8031
8115
|
*/
|
|
8032
8116
|
_initGuards(handles: ReadonlyArray<GuardStrategyHandleAny>): Promise<void>;
|
|
8033
8117
|
/**
|
|
8034
|
-
* @internal —
|
|
8035
|
-
* vaults that never registered any guard
|
|
8036
|
-
* gate on null
|
|
8037
|
-
* `Collection` already do this transitively).
|
|
8118
|
+
* @internal — The gate handler in Noydb.#registerGuardGate calls into
|
|
8119
|
+
* this. Returns `null` for vaults that never registered any guard
|
|
8120
|
+
* strategy. Callers MUST gate on null.
|
|
8038
8121
|
*/
|
|
8039
8122
|
_getGuardRegistry(): GuardRegistry | null;
|
|
8040
8123
|
/**
|
|
@@ -8043,7 +8126,7 @@ declare class Vault {
|
|
|
8043
8126
|
* derivation strategies (async because `strategyHash` computation
|
|
8044
8127
|
* goes through `crypto.subtle.digest`). No-op when the handles
|
|
8045
8128
|
* array is empty — keeps the derivation subsystem out of the floor
|
|
8046
|
-
* bundle for consumers that don't use derivations
|
|
8129
|
+
* bundle for consumers that don't use derivations. Throws
|
|
8047
8130
|
* `DerivationCycleError` if a cycle is detected after registration.
|
|
8048
8131
|
*/
|
|
8049
8132
|
_initDerivations(handles: ReadonlyArray<DerivationStrategyHandle>): Promise<void>;
|
|
@@ -8058,7 +8141,7 @@ declare class Vault {
|
|
|
8058
8141
|
* MV spec (which invokes its `query()` once for dependency
|
|
8059
8142
|
* analysis), then runs the unified cycle detection across the MV +
|
|
8060
8143
|
* derivation graphs. No-op when the handles array is empty — keeps
|
|
8061
|
-
* the MV subsystem out of the floor bundle (mirrors
|
|
8144
|
+
* the MV subsystem out of the floor bundle (mirrors the derivation lazy-import pattern).
|
|
8062
8145
|
* Throws `MaterializedViewCycleError` if a cycle is detected.
|
|
8063
8146
|
*/
|
|
8064
8147
|
_initMaterializedViews(handles: ReadonlyArray<MaterializedViewStrategyHandle>): Promise<void>;
|
|
@@ -8080,13 +8163,13 @@ declare class Vault {
|
|
|
8080
8163
|
*/
|
|
8081
8164
|
_getOverlayedViewRegistry(): OverlayedViewRegistry | null;
|
|
8082
8165
|
/**
|
|
8083
|
-
* Manual re-materialize for a single registered MV
|
|
8166
|
+
* Manual re-materialize for a single registered MV. Useful
|
|
8084
8167
|
* for `refresh: 'manual'` MVs (whose consumer drives refreshes
|
|
8085
8168
|
* externally), for stale-bit recovery on vault re-open, and as the
|
|
8086
8169
|
* explicit bulk-recompute escape hatch after a strategy change.
|
|
8087
8170
|
*
|
|
8088
|
-
* Returns `{ written, deleted, failed }`. `deleted` is always 0
|
|
8089
|
-
*
|
|
8171
|
+
* Returns `{ written, deleted, failed }`. `deleted` is always 0
|
|
8172
|
+
* when tombstoning is not enabled.
|
|
8090
8173
|
*
|
|
8091
8174
|
* Throws if `name` is not a registered MV.
|
|
8092
8175
|
*/
|
|
@@ -8109,20 +8192,17 @@ declare class Vault {
|
|
|
8109
8192
|
/**
|
|
8110
8193
|
* @internal — exposed for `runTransaction({ amendment: true })` so
|
|
8111
8194
|
* the amendment invariant runner can pass the SAME read-only vault
|
|
8112
|
-
* facade that the
|
|
8113
|
-
*
|
|
8114
|
-
* `
|
|
8115
|
-
*
|
|
8116
|
-
*
|
|
8195
|
+
* facade that the gate handler in Noydb.#registerGuardGate uses.
|
|
8196
|
+
* Eagerly instantiated by `_initGuards()` so this accessor stays
|
|
8197
|
+
* synchronous; returns `null` for vaults that never registered any
|
|
8198
|
+
* guard (amendments require at least one guard, so the caller should
|
|
8199
|
+
* never see null).
|
|
8117
8200
|
*/
|
|
8118
8201
|
_getReadOnlyFacade(): ReadOnlyVaultFacade | null;
|
|
8119
8202
|
/**
|
|
8120
|
-
* Internal lazy-allocator for the read-only facade. Used
|
|
8121
|
-
*
|
|
8122
|
-
*
|
|
8123
|
-
* invocation (theoretically impossible — `Noydb.openVault` awaits
|
|
8124
|
-
* `_initGuards` before returning — but we keep the defensive lazy
|
|
8125
|
-
* path so the closure's contract stays "always returns a facade").
|
|
8203
|
+
* Internal lazy-allocator for the read-only facade. Used as a
|
|
8204
|
+
* defensive fallback; in practice `_initGuards()` eagerly
|
|
8205
|
+
* instantiates this, so the lazy path is a no-op.
|
|
8126
8206
|
*/
|
|
8127
8207
|
private _ensureReadOnlyFacade;
|
|
8128
8208
|
/**
|
|
@@ -8329,7 +8409,7 @@ declare class Vault {
|
|
|
8329
8409
|
listPeriods(): Promise<readonly PeriodRecord[]>;
|
|
8330
8410
|
/** Look up a single period by name. Returns `null` if not found. */
|
|
8331
8411
|
getPeriod(name: string): Promise<PeriodRecord | null>;
|
|
8332
|
-
/** @internal —
|
|
8412
|
+
/** @internal — called by the gate bus before put/delete. */
|
|
8333
8413
|
_assertTsWritable(existing: {
|
|
8334
8414
|
ts: string | null;
|
|
8335
8415
|
record: Record<string, unknown> | null;
|
|
@@ -8360,7 +8440,7 @@ declare class Vault {
|
|
|
8360
8440
|
*/
|
|
8361
8441
|
dumpSchema(opts?: DumpSchemaOptions): Promise<VaultSchemaSnapshot>;
|
|
8362
8442
|
/**
|
|
8363
|
-
* Lightweight read of the vault's registered schema
|
|
8443
|
+
* Lightweight read of the vault's registered schema: collections
|
|
8364
8444
|
* (+ doc counts), guards, materialized views, schema-update strategies,
|
|
8365
8445
|
* and the unlocked user's grants. Cheap — one `adapter.list` per
|
|
8366
8446
|
* collection, no decryption. For a full snapshot + stats use dumpSchema().
|
|
@@ -8854,6 +8934,7 @@ declare class Collection<T> {
|
|
|
8854
8934
|
private readonly schemaUpdateGate;
|
|
8855
8935
|
private readonly schemaFence;
|
|
8856
8936
|
private readonly writeHooks;
|
|
8937
|
+
private readonly subsystemBus;
|
|
8857
8938
|
private readonly activeTxId;
|
|
8858
8939
|
private readonly getDEK;
|
|
8859
8940
|
private readonly onDirty;
|
|
@@ -9035,42 +9116,14 @@ declare class Collection<T> {
|
|
|
9035
9116
|
private readonly syncAdapter;
|
|
9036
9117
|
/** — consent-audit hook, no-op when no scope is active. */
|
|
9037
9118
|
private readonly onAccess;
|
|
9038
|
-
/**
|
|
9039
|
-
* accounting-period write guard. Called BEFORE any
|
|
9040
|
-
* adapter write with:
|
|
9041
|
-
* - `existing` — the prior envelope's `_ts` and decrypted record
|
|
9042
|
-
* (or `null` if no prior envelope exists)
|
|
9043
|
-
* - `incoming` — the record being written (or `null` for delete)
|
|
9044
|
-
*
|
|
9045
|
-
* Throws `PeriodClosedError` if either side falls inside a closed
|
|
9046
|
-
* period. Installed by Vault; no-op when no period has been closed.
|
|
9047
|
-
* Async so the Vault can lazy-load the period list from the
|
|
9048
|
-
* adapter on first use.
|
|
9049
|
-
*/
|
|
9050
|
-
private readonly periodGuard;
|
|
9051
|
-
/**
|
|
9052
|
-
* Optional back-reference to the owning vault's guard registry + a
|
|
9053
|
-
* read-only vault facade. When present, `Collection.put` and
|
|
9054
|
-
* `Collection.delete` consult the registry for guards declared
|
|
9055
|
-
* against this collection and run their `check` + `frozenFields`
|
|
9056
|
-
* before the adapter write. Absent in unit tests that construct
|
|
9057
|
-
* a Collection directly; production code always sets it via
|
|
9058
|
-
* `Vault.collection()`.
|
|
9059
|
-
*
|
|
9060
|
-
* Typed structurally rather than as `Vault` to avoid a circular
|
|
9061
|
-
* import (mirrors the `refEnforcer` / `joinResolver` pattern).
|
|
9062
|
-
*/
|
|
9063
|
-
private readonly guardSource;
|
|
9064
9119
|
/**
|
|
9065
9120
|
* Vault-internal hook for derivation dispatch. When set,
|
|
9066
9121
|
* `Collection.put` consults the registry after the source-write
|
|
9067
9122
|
* commits and writes derived outputs through `getCollection(name).put`.
|
|
9068
|
-
* Same structural-interface pattern as `guardSource` to avoid a
|
|
9069
|
-
* circular Vault import.
|
|
9070
9123
|
*/
|
|
9071
9124
|
private readonly derivationSource;
|
|
9072
9125
|
/**
|
|
9073
|
-
* Vault-internal hook for materialized-view dispatch
|
|
9126
|
+
* Vault-internal hook for materialized-view dispatch.
|
|
9074
9127
|
* Parallel to `derivationSource` — when set, `Collection.put` fires
|
|
9075
9128
|
* `MaterializedViewRegistry.onSourceWrite` after the source-write
|
|
9076
9129
|
* commits + after `dispatchDerivations` has run.
|
|
@@ -9123,19 +9176,21 @@ declare class Collection<T> {
|
|
|
9123
9176
|
encrypted: boolean;
|
|
9124
9177
|
emitter: NoydbEventEmitter;
|
|
9125
9178
|
/**
|
|
9126
|
-
* Vault-level in-flight write tracker
|
|
9179
|
+
* Vault-level in-flight write tracker. When present,
|
|
9127
9180
|
* `put`/`delete` run inside `writeQueue.track()` so `hub.writeQueue`
|
|
9128
9181
|
* reflects outstanding writes. Optional so direct Collection
|
|
9129
9182
|
* construction in tests still works untracked.
|
|
9130
9183
|
*/
|
|
9131
9184
|
writeQueue?: WriteQueueTracker | undefined;
|
|
9132
|
-
/**
|
|
9185
|
+
/** Per-collection schema-update gate; `put`/`delete` await it. */
|
|
9133
9186
|
schemaUpdateGate?: SchemaUpdateGate | undefined;
|
|
9134
|
-
/**
|
|
9187
|
+
/** Vault-level fence controller; `put`/`delete` consult it. */
|
|
9135
9188
|
schemaFence?: SchemaFenceController | undefined;
|
|
9136
|
-
/**
|
|
9189
|
+
/** Hub-level write-hook registry; fired around put/delete. */
|
|
9137
9190
|
writeHooks?: WriteHookRegistry | undefined;
|
|
9138
|
-
/**
|
|
9191
|
+
/** The observe bus, threaded from Noydb. */
|
|
9192
|
+
subsystemBus?: SubsystemBus | undefined;
|
|
9193
|
+
/** Active transaction id supplier (null outside a transaction). */
|
|
9139
9194
|
activeTxId?: (() => string | null) | undefined;
|
|
9140
9195
|
getDEK: (collectionName: string) => Promise<CryptoKey>;
|
|
9141
9196
|
historyConfig?: HistoryConfig | undefined;
|
|
@@ -9340,33 +9395,19 @@ declare class Collection<T> {
|
|
|
9340
9395
|
* to the ledger.
|
|
9341
9396
|
*/
|
|
9342
9397
|
onCrossTierAccess?: ((event: CrossTierAccessEvent) => void) | undefined;
|
|
9343
|
-
periodGuard?: (existing: {
|
|
9344
|
-
ts: string | null;
|
|
9345
|
-
record: Record<string, unknown> | null;
|
|
9346
|
-
} | null, incoming: Record<string, unknown> | null) => Promise<void>;
|
|
9347
9398
|
/**
|
|
9348
|
-
* Optional back-reference to the owning vault's guard registry +
|
|
9349
|
-
* read-only facade. When present, put/delete consult registered
|
|
9350
|
-
* guards for this collection. Same structural-interface pattern
|
|
9351
|
-
* as `refEnforcer` to avoid a circular Vault import.
|
|
9352
|
-
*/
|
|
9353
|
-
guardSource?: {
|
|
9354
|
-
registry(): GuardRegistry;
|
|
9355
|
-
readOnlyVault(): ReadOnlyVaultFacade$1;
|
|
9356
|
-
} | undefined;
|
|
9357
9399
|
/**
|
|
9358
9400
|
* Optional back-reference to the owning vault's derivation
|
|
9359
9401
|
* registry + collection accessor. When present, successful
|
|
9360
9402
|
* `put()` dispatches registered derivation strategies for the
|
|
9361
|
-
* source collection.
|
|
9362
|
-
* `guardSource` to avoid a circular Vault import.
|
|
9403
|
+
* source collection.
|
|
9363
9404
|
*/
|
|
9364
9405
|
derivationSource?: {
|
|
9365
9406
|
registry(): DerivationRegistry;
|
|
9366
9407
|
getCollection(name: string): Collection<Record<string, unknown>>;
|
|
9367
9408
|
/**
|
|
9368
9409
|
* Read-only vault facade handed to `derive(source, ctx)` so a
|
|
9369
|
-
* derivation can fetch sibling records
|
|
9410
|
+
* derivation can fetch sibling records. Same shape and
|
|
9370
9411
|
* instance the guards subsystem uses for `check(incoming, ctx)`.
|
|
9371
9412
|
*/
|
|
9372
9413
|
getReadOnlyFacade(): ReadOnlyVaultFacade$1;
|
|
@@ -9375,13 +9416,13 @@ declare class Collection<T> {
|
|
|
9375
9416
|
* transaction context, or `null` when no transaction is running.
|
|
9376
9417
|
* `dispatchDerivations` consults this so a recursive derived-output
|
|
9377
9418
|
* write can register its pre-write envelope onto `ctx._executed`
|
|
9378
|
-
* and roll back alongside the source op on mid-batch failure
|
|
9419
|
+
* and roll back alongside the source op on mid-batch failure.
|
|
9379
9420
|
*/
|
|
9380
9421
|
getActiveTxContext(): TxContext | null;
|
|
9381
9422
|
/**
|
|
9382
9423
|
* Construct a transient TxContext bound to the owning Noydb. Used
|
|
9383
9424
|
* by `Collection.putManyAtomic` to publish an active context for
|
|
9384
|
-
* its Phase 2 loop
|
|
9425
|
+
* its Phase 2 loop.
|
|
9385
9426
|
*/
|
|
9386
9427
|
createTxContext(): TxContext;
|
|
9387
9428
|
/** Publish a TxContext for the duration of a bulk-atomic loop. */
|
|
@@ -9390,7 +9431,7 @@ declare class Collection<T> {
|
|
|
9390
9431
|
clearActiveTxContext(ctx: TxContext): void;
|
|
9391
9432
|
} | undefined;
|
|
9392
9433
|
/**
|
|
9393
|
-
* Vault-internal hook for materialized-view dispatch
|
|
9434
|
+
* Vault-internal hook for materialized-view dispatch.
|
|
9394
9435
|
* Parallel to `derivationSource`. When set, `Collection.put` fires
|
|
9395
9436
|
* registered MV `onSourceWrite` after the standard derivation
|
|
9396
9437
|
* dispatch.
|
|
@@ -9453,14 +9494,14 @@ declare class Collection<T> {
|
|
|
9453
9494
|
}): PresenceHandle<P>;
|
|
9454
9495
|
/**
|
|
9455
9496
|
* Create or update a record. Runs inside the hub's write-queue tracker
|
|
9456
|
-
*
|
|
9497
|
+
* so `hub.writeQueue.pending` reflects this write.
|
|
9457
9498
|
*
|
|
9458
9499
|
* @param id Record identifier.
|
|
9459
9500
|
* @param record The record body (validated by the collection's schema
|
|
9460
9501
|
* if one was attached at `vault.collection(...)` time).
|
|
9461
9502
|
* @param options Optional metadata for audit + import workflows.
|
|
9462
9503
|
* `reason` is stamped onto the resulting ledger entry
|
|
9463
|
-
*
|
|
9504
|
+
* so audit consumers can filter via
|
|
9464
9505
|
* `entries.filter(e => e.reason?.startsWith('import:'))`.
|
|
9465
9506
|
*/
|
|
9466
9507
|
put(id: string, record: T, options?: {
|
|
@@ -9472,7 +9513,7 @@ declare class Collection<T> {
|
|
|
9472
9513
|
* Fire registered MV strategies whose dependency set includes this
|
|
9473
9514
|
* collection. Eager-mode MVs re-materialize inline via
|
|
9474
9515
|
* `MaterializedViewExecutor.refresh`; lazy / manual modes are
|
|
9475
|
-
* no-ops in the foundation
|
|
9516
|
+
* no-ops in the foundation; wired in the lazy-mode implementation.
|
|
9476
9517
|
*
|
|
9477
9518
|
* Skips entirely when the record being written is itself an
|
|
9478
9519
|
* MV-emitted row (carries `_materializedFrom`) — defensive guard
|
|
@@ -9495,11 +9536,11 @@ declare class Collection<T> {
|
|
|
9495
9536
|
private dispatchDerivations;
|
|
9496
9537
|
/**
|
|
9497
9538
|
* Delete a record by ID. Runs inside the hub's write-queue tracker
|
|
9498
|
-
*
|
|
9539
|
+
* so `hub.writeQueue.pending` reflects this write.
|
|
9499
9540
|
*/
|
|
9500
9541
|
delete(id: string): Promise<void>;
|
|
9501
9542
|
/**
|
|
9502
|
-
* @internal
|
|
9543
|
+
* @internal — bulk-rewrite every record through a cutover transform.
|
|
9503
9544
|
* Raw adapter path (bypasses the write gate + guards — the transform is
|
|
9504
9545
|
* trusted and runs only during the `migrating` phase). Bumps each
|
|
9505
9546
|
* record's `_v` and appends a ledger `op:'migration'` entry.
|
|
@@ -9509,8 +9550,7 @@ declare class Collection<T> {
|
|
|
9509
9550
|
private deleteInternal;
|
|
9510
9551
|
/**
|
|
9511
9552
|
* @internal — system-internal delete that bypasses user-facing
|
|
9512
|
-
* delete hooks (`onDelete`,
|
|
9513
|
-
* enforcer). Used by derivation tombstones (#144) and MV refresh
|
|
9553
|
+
* delete hooks (`onDelete`, FK ref enforcer). Used by derivation tombstones and MV refresh
|
|
9514
9554
|
* (Dim 14 v2) — system housekeeping shouldn't trip user invariants
|
|
9515
9555
|
* registered against the output collection. The ledger entry and
|
|
9516
9556
|
* history snapshot still fire so backup integrity and time-travel
|
|
@@ -9522,7 +9562,7 @@ declare class Collection<T> {
|
|
|
9522
9562
|
*
|
|
9523
9563
|
* When a `txCtx` is supplied, the prior envelope is captured and
|
|
9524
9564
|
* pushed onto `txCtx._executed` BEFORE the delete fires — mirrors
|
|
9525
|
-
* the
|
|
9565
|
+
* the rollback hardening for puts. Callers outside a
|
|
9526
9566
|
* multi-record transaction pass `null` and skip the tracking.
|
|
9527
9567
|
*
|
|
9528
9568
|
* Amendment composition: if `_internalDelete` runs while a vault's
|
|
@@ -9549,7 +9589,7 @@ declare class Collection<T> {
|
|
|
9549
9589
|
private _doDelete;
|
|
9550
9590
|
/**
|
|
9551
9591
|
* Cascade deletes of array-shape derived rows when a source row is
|
|
9552
|
-
* deleted
|
|
9592
|
+
* deleted. Reads each registered strategy's fanout sidecar
|
|
9553
9593
|
* for this source id, deletes every listed derived row, then
|
|
9554
9594
|
* deletes the sidecar itself.
|
|
9555
9595
|
*
|
|
@@ -9560,8 +9600,8 @@ declare class Collection<T> {
|
|
|
9560
9600
|
*/
|
|
9561
9601
|
private dispatchArrayDerivationsOnDelete;
|
|
9562
9602
|
/**
|
|
9563
|
-
* Mirror of {@link dispatchMaterializedViews} for the delete path
|
|
9564
|
-
*
|
|
9603
|
+
* Mirror of {@link dispatchMaterializedViews} for the delete path.
|
|
9604
|
+
* No record content is available (it's gone), so the
|
|
9565
9605
|
* `_materializedFrom` skip used by the put-side dispatch doesn't
|
|
9566
9606
|
* apply here — instead, the recursion guard is the `internal` gate
|
|
9567
9607
|
* at the `_doDelete` call site above.
|
|
@@ -9643,7 +9683,7 @@ declare class Collection<T> {
|
|
|
9643
9683
|
* the filtered records directly (the API). Prefer the chainable
|
|
9644
9684
|
* form for new code.
|
|
9645
9685
|
*
|
|
9646
|
-
* **Lazy-MV gap
|
|
9686
|
+
* **Lazy-MV gap:** `query()` is synchronous and does NOT
|
|
9647
9687
|
* trigger lazy materialized-view resolve-on-read. If this
|
|
9648
9688
|
* collection is a lazy MV's output and the MV is currently stale,
|
|
9649
9689
|
* `query().toArray()` returns the pre-stale snapshot. To force a
|
|
@@ -9804,7 +9844,7 @@ declare class Collection<T> {
|
|
|
9804
9844
|
* .aggregate({ total: sum('amount'), n: count() })
|
|
9805
9845
|
* ```
|
|
9806
9846
|
*
|
|
9807
|
-
* **Lazy-MV gap
|
|
9847
|
+
* **Lazy-MV gap:** `scan()` is synchronous-build and does
|
|
9808
9848
|
* NOT trigger lazy materialized-view resolve-on-read. For lazy
|
|
9809
9849
|
* MVs, call `list()` (which DOES resolve) or `vault.refreshView(name)`
|
|
9810
9850
|
* before scanning. Same shape as the `query()` limitation.
|
|
@@ -9844,13 +9884,13 @@ declare class Collection<T> {
|
|
|
9844
9884
|
*/
|
|
9845
9885
|
_invalidateCacheEntry(id: string): Promise<void>;
|
|
9846
9886
|
/**
|
|
9847
|
-
*
|
|
9887
|
+
* Apply a peer tab's committed write to THIS tab's in-memory view:
|
|
9848
9888
|
* re-read the (already-persisted) envelope from the shared store + refresh
|
|
9849
9889
|
* cache/indexes, then emit a `change` event so reactive consumers re-render.
|
|
9850
9890
|
* Never writes to the store and never fires write hooks, so it cannot loop.
|
|
9851
9891
|
*/
|
|
9852
9892
|
_applyRemoteChange(id: string, action: 'put' | 'delete'): Promise<void>;
|
|
9853
|
-
/** @internal
|
|
9893
|
+
/** @internal — the current in-memory record without a store read (for conflict capture). */
|
|
9854
9894
|
_peekCached(id: string): T | null;
|
|
9855
9895
|
private ensureHydrated;
|
|
9856
9896
|
/** Hydrate from a pre-loaded snapshot (used by Vault). */
|
|
@@ -10408,7 +10448,7 @@ interface SessionStrategy {
|
|
|
10408
10448
|
}
|
|
10409
10449
|
|
|
10410
10450
|
/**
|
|
10411
|
-
* Managed-passphrase mode —
|
|
10451
|
+
* Managed-passphrase mode — rubber-hose-resistant vaults.
|
|
10412
10452
|
*
|
|
10413
10453
|
* A vault mode where the passphrase is machine-generated and never
|
|
10414
10454
|
* exposed to the user, sealed under a developer-provided
|
|
@@ -10447,9 +10487,9 @@ interface SessionStrategy {
|
|
|
10447
10487
|
* Returns the plaintext passphrase string that the rest of the
|
|
10448
10488
|
* `createNoydb` keyring path consumes.
|
|
10449
10489
|
*
|
|
10450
|
-
*
|
|
10490
|
+
* Deferred to follow-ups:
|
|
10451
10491
|
* - Block `rotate-passphrase` policy gate under managed mode.
|
|
10452
|
-
* - Mandatory strong-recovery enforcement
|
|
10492
|
+
* - Mandatory strong-recovery enforcement.
|
|
10453
10493
|
* - Recovery flow under managed mode (generates fresh sealed phrase).
|
|
10454
10494
|
*
|
|
10455
10495
|
* @see docs/subsystems/session-tiers.md → Managed-passphrase mode
|
|
@@ -10609,12 +10649,12 @@ interface SealedPassphrase {
|
|
|
10609
10649
|
*
|
|
10610
10650
|
* v1 shape (this release): `{ v: 1, _noydb_sealed: 1, pid, payload }`.
|
|
10611
10651
|
*
|
|
10612
|
-
* Legacy shape (
|
|
10652
|
+
* Legacy shape (earlier releases): `{ _noydb_sealed: 1, providerId, sealed }`
|
|
10613
10653
|
* — accepted on read for backwards compatibility; never produced on
|
|
10614
10654
|
* write going forward.
|
|
10615
10655
|
*/
|
|
10616
10656
|
interface SealedEnvelope {
|
|
10617
|
-
/** Envelope schema version. v1 is the shape
|
|
10657
|
+
/** Envelope schema version. v1 is the current shape. */
|
|
10618
10658
|
readonly v: 1;
|
|
10619
10659
|
/** Magic marker for forensics + legacy-shape detection. */
|
|
10620
10660
|
readonly _noydb_sealed: 1;
|
|
@@ -10628,9 +10668,9 @@ interface SealedEnvelope {
|
|
|
10628
10668
|
* in-memory {@link SealedPassphrase} representation. Accepts both:
|
|
10629
10669
|
*
|
|
10630
10670
|
* 1. v1 wire format `{ v: 1, _noydb_sealed: 1, pid, payload }` —
|
|
10631
|
-
* the shape
|
|
10671
|
+
* the current shape.
|
|
10632
10672
|
* 2. Legacy wire format `{ _noydb_sealed: 1, providerId, sealed }` —
|
|
10633
|
-
*
|
|
10673
|
+
* read-only; never written
|
|
10634
10674
|
* going forward.
|
|
10635
10675
|
*
|
|
10636
10676
|
* Returns `undefined` for any input that doesn't match either shape,
|
|
@@ -11015,9 +11055,9 @@ interface ImportCapability {
|
|
|
11015
11055
|
*/
|
|
11016
11056
|
type VaultPolicyOnDisk = Record<string, unknown>;
|
|
11017
11057
|
/**
|
|
11018
|
-
* Recovery profile enrolled at vault creation
|
|
11058
|
+
* Recovery profile enrolled at vault creation.
|
|
11019
11059
|
*
|
|
11020
|
-
* - `paper` — `on-recovery` codes (the
|
|
11060
|
+
* - `paper` — `on-recovery` codes (the standard end-to-end profile).
|
|
11021
11061
|
* - `shamir` / `multi-channel` / `admin-mediated` — API surface ships;
|
|
11022
11062
|
* per-profile dispatch lands in follow-up issues. Calling
|
|
11023
11063
|
* `db.recoverPassphrase` against these throws
|
|
@@ -11080,7 +11120,7 @@ interface KeyringAuthenticatorBase {
|
|
|
11080
11120
|
* extractable KEK from its own credential — WebAuthn (PRF-derived
|
|
11081
11121
|
* wrapping key) and split-key OIDC.
|
|
11082
11122
|
*
|
|
11083
|
-
* `wrapKind` is optional/absent on slots
|
|
11123
|
+
* `wrapKind` is optional/absent on older slots — those
|
|
11084
11124
|
* legacy slots are treated as wrap-KEK by default at unlock time.
|
|
11085
11125
|
*/
|
|
11086
11126
|
interface KeyringAuthenticatorWrappingKEK extends KeyringAuthenticatorBase {
|
|
@@ -11143,11 +11183,11 @@ interface KeyringFile {
|
|
|
11143
11183
|
readonly granted_by: string;
|
|
11144
11184
|
/**
|
|
11145
11185
|
* Passphrase canary — base64 AES-KW-wrapped form of a known constant
|
|
11146
|
-
* 256-bit value, wrapped under the keyring's KEK
|
|
11186
|
+
* 256-bit value, wrapped under the keyring's KEK.
|
|
11147
11187
|
*
|
|
11148
|
-
* Optional:
|
|
11149
|
-
* the multi-DEK corruption heuristic
|
|
11150
|
-
*
|
|
11188
|
+
* Optional: older keyrings load with no canary and fall back to
|
|
11189
|
+
* the multi-DEK corruption heuristic. Newer keyrings
|
|
11190
|
+
* carry one and let `loadKeyring` distinguish wrong-passphrase
|
|
11151
11191
|
* from corruption even when ALL DEKs (including a single-DEK keyring's
|
|
11152
11192
|
* sole DEK) are corrupted.
|
|
11153
11193
|
*
|
|
@@ -11370,7 +11410,7 @@ interface Conflict {
|
|
|
11370
11410
|
readonly resolve?: (winner: EncryptedEnvelope | null) => void;
|
|
11371
11411
|
}
|
|
11372
11412
|
/**
|
|
11373
|
-
*
|
|
11413
|
+
* A same-device cross-tab write conflict: another tab overwrote a
|
|
11374
11414
|
* document this tab had written, having diverged from an older base. Records
|
|
11375
11415
|
* are decrypted (cross-tab handlers reconcile in plaintext). `base` is the
|
|
11376
11416
|
* common ancestor from history, or null when history is unavailable.
|
|
@@ -11473,8 +11513,8 @@ interface NoydbEventMap {
|
|
|
11473
11513
|
'change': ChangeEvent;
|
|
11474
11514
|
'error': Error;
|
|
11475
11515
|
/**
|
|
11476
|
-
* Same-instance signal that this vault's schema-fence state changed
|
|
11477
|
-
*
|
|
11516
|
+
* Same-instance signal that this vault's schema-fence state changed.
|
|
11517
|
+
* For UI integration. Cross-client coordination goes
|
|
11478
11518
|
* through the store, not this event.
|
|
11479
11519
|
*/
|
|
11480
11520
|
'schema:fence-changed': {
|
|
@@ -11580,7 +11620,7 @@ interface GrantOptions {
|
|
|
11580
11620
|
readonly initialProfile?: unknown;
|
|
11581
11621
|
}
|
|
11582
11622
|
/**
|
|
11583
|
-
* Caller payload for `db.updateUser
|
|
11623
|
+
* Caller payload for `db.updateUser`. Mutate one or more
|
|
11584
11624
|
* identity fields on an existing keyring without rotating any keys.
|
|
11585
11625
|
*
|
|
11586
11626
|
* `role`, `displayName`, and `permissions` live in the plaintext header
|
|
@@ -11594,7 +11634,7 @@ interface GrantOptions {
|
|
|
11594
11634
|
* `null` on `displayName` clears the field (stored as the empty string;
|
|
11595
11635
|
* UI consumers typically render the empty case by falling back to the
|
|
11596
11636
|
* user id). `undefined` / absent leaves the field untouched. Mirrors
|
|
11597
|
-
* the `null`-as-clear convention `UserApi.updateMe` uses
|
|
11637
|
+
* the `null`-as-clear convention `UserApi.updateMe` uses.
|
|
11598
11638
|
*
|
|
11599
11639
|
* `permissions`, however, is a **full replacement** at the map level —
|
|
11600
11640
|
* passing `{ invoices: 'rw' }` REPLACES the entire permissions map,
|
|
@@ -11608,8 +11648,6 @@ interface GrantOptions {
|
|
|
11608
11648
|
* do anything. Non-admin callers (operator/viewer/client) cannot call
|
|
11609
11649
|
* `db.updateUser` at all — for self-displayName changes, use
|
|
11610
11650
|
* `vault.user.updateMe` (the user-envelope API).
|
|
11611
|
-
*
|
|
11612
|
-
* @see #54
|
|
11613
11651
|
*/
|
|
11614
11652
|
interface UpdateUserOptions {
|
|
11615
11653
|
readonly userId: string;
|
|
@@ -12201,7 +12239,7 @@ interface NoydbOptions {
|
|
|
12201
12239
|
*/
|
|
12202
12240
|
readonly derivationStrategies?: ReadonlyArray<DerivationStrategyHandle>;
|
|
12203
12241
|
/**
|
|
12204
|
-
* Optional materialized-view strategies
|
|
12242
|
+
* Optional materialized-view strategies.
|
|
12205
12243
|
* Each handle returned by `withMaterializedView()` from
|
|
12206
12244
|
* `@noy-db/hub/materialized-views`. The vault runs unified cycle
|
|
12207
12245
|
* detection across the MV + derivation graphs at `openVault`; a
|
|
@@ -12209,7 +12247,7 @@ interface NoydbOptions {
|
|
|
12209
12247
|
*/
|
|
12210
12248
|
readonly materializedViewStrategies?: ReadonlyArray<MaterializedViewStrategyHandle>;
|
|
12211
12249
|
/**
|
|
12212
|
-
* Optional overlay strategies
|
|
12250
|
+
* Optional overlay strategies. Each handle returned by
|
|
12213
12251
|
* `withOverlayedView()` from `@noy-db/hub/overlay-views`. The vault
|
|
12214
12252
|
* validates name uniqueness + base concreteness + overlay
|
|
12215
12253
|
* availability at `openVault`; a clash throws one of the
|
|
@@ -12262,7 +12300,7 @@ interface NoydbOptions {
|
|
|
12262
12300
|
*/
|
|
12263
12301
|
readonly getKeyring?: (vault: string) => Promise<UnlockedKeyring>;
|
|
12264
12302
|
/**
|
|
12265
|
-
* Passphrase mode
|
|
12303
|
+
* Passphrase mode. Default `'standard'`.
|
|
12266
12304
|
*
|
|
12267
12305
|
* - `'standard'` — the legacy flow. `secret` supplies the
|
|
12268
12306
|
* plaintext passphrase, the user knows it, and the policy gate
|
|
@@ -12323,14 +12361,14 @@ interface NoydbOptions {
|
|
|
12323
12361
|
readonly sessionPolicy?: SessionPolicy;
|
|
12324
12362
|
/**
|
|
12325
12363
|
* Validate passphrase strength against the phrase format
|
|
12326
|
-
*
|
|
12364
|
+
* on first-time keyring creation. When
|
|
12327
12365
|
* `true`, weak phrases throw {@link WeakPassphraseError} from
|
|
12328
12366
|
* `createNoydb()` / `db.rotatePassphrase()`. Default: `false` for
|
|
12329
|
-
* back-compat
|
|
12367
|
+
* back-compat; planned to flip to `true` in a future major release.
|
|
12330
12368
|
*/
|
|
12331
12369
|
readonly validatePassphrase?: boolean;
|
|
12332
12370
|
/**
|
|
12333
|
-
* Vault-level policy gate document
|
|
12371
|
+
* Vault-level policy gate document. When present, the hub
|
|
12334
12372
|
* persists the merged policy at `_meta/policy` on first-time vault
|
|
12335
12373
|
* creation and gates sensitive operations (`db.rotatePassphrase`,
|
|
12336
12374
|
* `db.export*`, …) against it. Omitted ⇒ the engine uses
|
|
@@ -12346,14 +12384,14 @@ interface NoydbOptions {
|
|
|
12346
12384
|
*/
|
|
12347
12385
|
readonly policy?: VaultPolicy;
|
|
12348
12386
|
/**
|
|
12349
|
-
* Mandatory recovery profile enrollment
|
|
12387
|
+
* Mandatory recovery profile enrollment. Vaults with
|
|
12350
12388
|
* `recover-passphrase` enabled MUST register at least one profile
|
|
12351
12389
|
* before being production-ready, otherwise `createNoydb()` throws
|
|
12352
12390
|
* {@link RecoveryNotEnrolledError}. Set
|
|
12353
12391
|
* `policy.gates['recover-passphrase'].enabled = false` to
|
|
12354
12392
|
* deliberately opt out of recovery (passphrase loss = data loss).
|
|
12355
12393
|
*
|
|
12356
|
-
*
|
|
12394
|
+
* The `'paper'` profile is supported end-to-end. Other
|
|
12357
12395
|
* profiles ship the API shape and throw
|
|
12358
12396
|
* {@link RecoveryProfileNotImplementedError} during use.
|
|
12359
12397
|
*/
|
|
@@ -12361,9 +12399,9 @@ interface NoydbOptions {
|
|
|
12361
12399
|
/**
|
|
12362
12400
|
* When `true`, `createNoydb` rejects vaults with no recovery
|
|
12363
12401
|
* entries persisted (per the spec's mandatory-enrollment
|
|
12364
|
-
* requirement). Default `false` for
|
|
12365
|
-
* flip to `true`
|
|
12366
|
-
* turn this on now.
|
|
12402
|
+
* requirement). Default `false` for back-compat; planned to
|
|
12403
|
+
* flip to `true` in a future major release. Apps in regulated
|
|
12404
|
+
* environments should turn this on now.
|
|
12367
12405
|
*/
|
|
12368
12406
|
readonly requireRecovery?: boolean;
|
|
12369
12407
|
/**
|