@noy-db/hub 0.2.0-pre.23 → 0.2.0-pre.24
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.d.cts +3 -3
- package/dist/aggregate/index.d.ts +3 -3
- package/dist/aggregate/index.js +5 -5
- 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 +6 -6
- package/dist/blobs/index.d.ts +6 -6
- package/dist/blobs/index.js +6 -6
- package/dist/bundle/index.cjs +617 -1202
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +15 -6
- package/dist/bundle/index.d.ts +15 -6
- package/dist/bundle/index.js +58 -193
- package/dist/bundle/index.js.map +1 -1
- package/dist/{chunk-CQYEDODS.js → chunk-35U5YNRR.js} +3 -3
- package/dist/{chunk-NV4IHBZS.js → chunk-3XJU3OHE.js} +5 -5
- package/dist/{chunk-OTWT6BAJ.js → chunk-4BB4T3O7.js} +12 -2
- package/dist/chunk-4BB4T3O7.js.map +1 -0
- package/dist/{chunk-IVZWHIEK.js → chunk-4HEGG5NJ.js} +5 -5
- package/dist/{chunk-WE2BUQD2.js → chunk-4TCMCCC3.js} +5 -3
- package/dist/{chunk-5YTXYPES.js → chunk-5A2FVGHT.js} +5 -5
- package/dist/{chunk-NSXNXLYM.js → chunk-5GZC2ZM3.js} +2 -2
- package/dist/{chunk-JYNH4FIM.js → chunk-77WF53XY.js} +4 -4
- package/dist/{chunk-O5XKZCUD.js → chunk-7X4EF35A.js} +5 -5
- package/dist/{chunk-SQKAECUL.js → chunk-7ZCTUI26.js} +2 -2
- package/dist/{chunk-J6RGRZOY.js → chunk-AO3QSMCU.js} +2 -2
- package/dist/{chunk-JDCPRJVS.js → chunk-AONK5GCC.js} +4 -4
- package/dist/{chunk-FRRJIUSI.js → chunk-B5CSNGSE.js} +17 -9
- package/dist/chunk-B5CSNGSE.js.map +1 -0
- package/dist/{chunk-IY24WS2P.js → chunk-BCMHJYVT.js} +4 -4
- package/dist/{chunk-IY24WS2P.js.map → chunk-BCMHJYVT.js.map} +1 -1
- package/dist/{chunk-TYMDCIQM.js → chunk-C472BRJ4.js} +4 -4
- package/dist/{chunk-MBXKRHSS.js → chunk-CCNRFAL3.js} +2 -2
- package/dist/{chunk-BZW5IL43.js → chunk-DCA2BDHA.js} +4 -4
- package/dist/{chunk-JBBWALNI.js → chunk-DCICHSRS.js} +2 -2
- package/dist/{chunk-2XA2ZML4.js → chunk-FG6IQ3ZL.js} +3 -3
- package/dist/{chunk-C2RJVZZL.js → chunk-G4GW5VOS.js} +2 -2
- package/dist/{chunk-U2XSUCDF.js → chunk-GEWIFM4J.js} +2 -2
- package/dist/{chunk-TNH5SLCD.js → chunk-HD4QCT2O.js} +2 -2
- package/dist/{chunk-I3IYTUUI.js → chunk-HHJ5DZCZ.js} +3 -3
- package/dist/{chunk-6QAZ5O6X.js → chunk-IEIADIPM.js} +2 -2
- package/dist/{chunk-YPIOFSN3.js → chunk-IHAISFXP.js} +2 -2
- package/dist/{chunk-GJTKMME7.js → chunk-JKM2AVVH.js} +2 -2
- package/dist/{chunk-EYK72OTL.js → chunk-JRMOSIH4.js} +5 -5
- package/dist/chunk-JRMOSIH4.js.map +1 -0
- package/dist/{chunk-S45MDEEF.js → chunk-LMWVNF6X.js} +2 -2
- package/dist/{chunk-TA6HPKWQ.js → chunk-LR7CODVN.js} +1 -1
- package/dist/chunk-LR7CODVN.js.map +1 -0
- package/dist/{chunk-TAMRU7A2.js → chunk-OKV7S356.js} +4 -4
- package/dist/{chunk-HYJMAV53.js → chunk-OWAMTSAI.js} +93 -93
- package/dist/chunk-OWAMTSAI.js.map +1 -0
- package/dist/{chunk-IW4L4X65.js → chunk-P5A4E53B.js} +2 -2
- package/dist/{chunk-JOK73NDT.js → chunk-P7OL22JP.js} +3 -3
- package/dist/{chunk-P65YMN5V.js → chunk-QOXZM3L2.js} +407 -162
- package/dist/chunk-QOXZM3L2.js.map +1 -0
- package/dist/chunk-R43KS34V.js +399 -0
- package/dist/chunk-R43KS34V.js.map +1 -0
- package/dist/{chunk-TGIJTNM3.js → chunk-R5ZECURV.js} +2 -2
- package/dist/{chunk-KOAJ3TZM.js → chunk-RFEXGW3L.js} +2 -2
- package/dist/{chunk-F5ILTHMU.js → chunk-RNQPDV75.js} +5 -5
- package/dist/{chunk-WWVJXBOT.js → chunk-SGM7CK7R.js} +5 -5
- package/dist/{chunk-7MRT7EPB.js → chunk-SOQE5DUV.js} +3 -3
- package/dist/{chunk-F5GWNSE2.js → chunk-TOMSCJRV.js} +3 -3
- package/dist/{chunk-F5GWNSE2.js.map → chunk-TOMSCJRV.js.map} +1 -1
- package/dist/{chunk-ZONKSLF2.js → chunk-TQMQZOMX.js} +2 -2
- package/dist/{chunk-3HNKR65T.js → chunk-U6LTLN7O.js} +3 -3
- package/dist/{chunk-UU6M64HI.js → chunk-UAK2AMO2.js} +4 -4
- package/dist/{chunk-37VGJM3T.js → chunk-WQ3KAGOV.js} +2 -2
- package/dist/{chunk-C6W5KVDV.js → chunk-XC32SZPW.js} +35 -35
- package/dist/chunk-XC32SZPW.js.map +1 -0
- package/dist/{chunk-AI4USDRI.js → chunk-XQO4TAJS.js} +4 -4
- package/dist/{chunk-SQOK5UM6.js → chunk-ZBENTRFS.js} +2 -2
- package/dist/{chunk-6QE4DUYC.js → chunk-ZDITTESU.js} +2 -2
- 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-456N7UVX.js → crypto-2LU6XUFF.js} +3 -3
- package/dist/{delegation-DP4COTXB.js → delegation-6ABSJGXV.js} +5 -5
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +6 -6
- package/dist/derivations/index.d.ts +6 -6
- package/dist/derivations/index.js +4 -4
- package/dist/{dev-unlock-DzDzLTdZ.d.ts → dev-unlock-BlhRHr6p.d.ts} +1 -1
- package/dist/{dev-unlock-Bw7iBD1D.d.cts → dev-unlock-DURe4IvF.d.cts} +1 -1
- package/dist/{errors-Dkc_fi-S.d.cts → errors-B2tUcRPg.d.cts} +19 -5
- package/dist/{errors-Dkc_fi-S.d.ts → errors-B2tUcRPg.d.ts} +19 -5
- package/dist/executor-JKMSEB34.js +8 -0
- package/dist/executor-UYXSQB4D.js +12 -0
- package/dist/executor-VJSCTBWY.js +8 -0
- package/dist/{fanout-sidecar-YXNAEZ33.js → fanout-sidecar-ZQT4Y7PF.js} +2 -2
- package/dist/forget/index.js +4 -4
- 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 +6 -6
- package/dist/{hash-C52X_-m5.d.cts → hash-CqRZfDZH.d.cts} +1 -1
- package/dist/{hash-DepR-xVc.d.ts → hash-cF4iWaBV.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 +5 -5
- 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 +6 -6
- package/dist/index-B8MoIS7B.d.ts +70 -0
- package/dist/{index-Bm9hIY7t.d.ts → index-BLff_E35.d.ts} +2 -2
- package/dist/{index-tZqVB9g5.d.cts → index-BthnP2MA.d.cts} +2 -2
- package/dist/index-da0M3NnR.d.cts +70 -0
- package/dist/index.cjs +25907 -25557
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +135 -80
- package/dist/index.d.ts +135 -80
- package/dist/index.js +78 -51
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.js +4 -4
- package/dist/issue-KLRMW5DH.js +12 -0
- package/dist/kernel/index.cjs +657 -0
- package/dist/kernel/index.cjs.map +1 -0
- package/dist/kernel/index.d.cts +11 -0
- package/dist/kernel/index.d.ts +11 -0
- package/dist/kernel/index.js +40 -0
- package/dist/{ledger-I7JUYP4L.js → ledger-VOS2X3WJ.js} +5 -5
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +6 -6
- package/dist/materialized-views/index.d.ts +6 -6
- package/dist/materialized-views/index.js +8 -8
- package/dist/{mime-magic-Dejetix_.d.ts → mime-magic-BswIvWkR.d.ts} +1 -1
- package/dist/{mime-magic-Cxf9B_Dm.d.cts → mime-magic-CCrP-iXJ.d.cts} +1 -1
- package/dist/{ulid-Bg-IBJyA.d.cts → multi-bundle-6s5nKAZX.d.ts} +114 -58
- package/dist/{ulid-Dwt3JEcy.d.ts → multi-bundle-WhYiJEgV.d.cts} +114 -58
- package/dist/noydb-2PI2ZBX6.js +38 -0
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +6 -6
- package/dist/overlay-views/index.d.ts +6 -6
- 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 +5 -5
- package/dist/{public-envelope-5XRTUNKF.js → public-envelope-IJJMWSTJ.js} +4 -4
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +7 -7
- package/dist/registry-GAIFVWXF.js +8 -0
- package/dist/registry-J77ZUQ7G.js +8 -0
- package/dist/{registry-NWHOLD5M.js → registry-JGEVJ6YC.js} +3 -3
- package/dist/{revoke-5IEK22KT.js → revoke-WUY4AYRJ.js} +6 -6
- package/dist/sealed-record/index.cjs.map +1 -1
- package/dist/sealed-record/index.d.cts +1 -1
- package/dist/sealed-record/index.d.ts +1 -1
- package/dist/sealed-record/index.js +2 -2
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +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-I6YARZQA.js → signer-UJF3CFDC.js} +5 -5
- package/dist/snapshots/index.cjs.map +1 -1
- package/dist/snapshots/index.d.cts +5 -5
- package/dist/snapshots/index.d.ts +5 -5
- package/dist/snapshots/index.js +4 -4
- package/dist/{stale-CPESGAPL.js → stale-PW6VBGSP.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/{strategy-WtB-jXYv.d.cts → strategy-BWmgRPA2.d.cts} +1 -1
- package/dist/{strategy-54eIwox5.d.ts → strategy-D47TC5X6.d.ts} +1 -1
- 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 +10 -3
- 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/{transition-guard-BcLyTGYq.d.cts → transition-guard-C3NxfVKk.d.cts} +1 -1
- package/dist/{transition-guard-Ctxapq1b.d.ts → transition-guard-CQH5263l.d.ts} +1 -1
- package/dist/tx/index.cjs +1 -1
- 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/{types-DONgts0n.d.ts → types-BGRX6sPT.d.ts} +288 -578
- package/dist/{types-Bhs2i_Ll.d.cts → types-COQ6qJZh.d.cts} +288 -578
- package/dist/ulid-DRH25k3y.d.cts +66 -0
- package/dist/ulid-DRH25k3y.d.ts +66 -0
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{with-materialized-view-CyVLOr09.d.ts → with-materialized-view-Cj-6fuav.d.ts} +1 -1
- package/dist/{with-materialized-view-BYb3p9wT.d.cts → with-materialized-view-D4U-KrBH.d.cts} +1 -1
- package/dist/{with-overlayed-view-LGrQ984e.d.cts → with-overlayed-view-BKjdUPRx.d.cts} +1 -1
- package/dist/{with-overlayed-view-BhLRxqwI.d.ts → with-overlayed-view-COp_7EEy.d.ts} +1 -1
- package/dist/{with-rollup-CO8ibRcK.d.ts → with-rollup-B1_ZjG02.d.ts} +1 -1
- package/dist/{with-rollup-Bj8c7ttB.d.cts → with-rollup-C-Bok_o2.d.cts} +1 -1
- package/package.json +13 -3
- package/dist/chunk-C6W5KVDV.js.map +0 -1
- package/dist/chunk-EYK72OTL.js.map +0 -1
- package/dist/chunk-FRRJIUSI.js.map +0 -1
- package/dist/chunk-HYJMAV53.js.map +0 -1
- package/dist/chunk-JTI57WRT.js +0 -164
- package/dist/chunk-JTI57WRT.js.map +0 -1
- package/dist/chunk-OTWT6BAJ.js.map +0 -1
- package/dist/chunk-P65YMN5V.js.map +0 -1
- package/dist/chunk-TA6HPKWQ.js.map +0 -1
- package/dist/chunk-ZC7J6ZYV.js +0 -7
- package/dist/chunk-ZC7J6ZYV.js.map +0 -1
- package/dist/executor-4IEW4KG5.js +0 -8
- package/dist/executor-KYJCJCIN.js +0 -12
- package/dist/executor-W7VIBOBZ.js +0 -8
- package/dist/issue-JXC6T2QR.js +0 -12
- package/dist/noydb-VGR2HLDB.js +0 -39
- package/dist/registry-ATRHOG5B.js +0 -8
- package/dist/registry-LEHB26TY.js +0 -8
- package/dist/state-vault-JR3CFGNP.js +0 -14
- package/dist/vault-group-BB246VIM.js +0 -804
- package/dist/vault-group-BB246VIM.js.map +0 -1
- /package/dist/{chunk-CQYEDODS.js.map → chunk-35U5YNRR.js.map} +0 -0
- /package/dist/{chunk-NV4IHBZS.js.map → chunk-3XJU3OHE.js.map} +0 -0
- /package/dist/{chunk-IVZWHIEK.js.map → chunk-4HEGG5NJ.js.map} +0 -0
- /package/dist/{chunk-WE2BUQD2.js.map → chunk-4TCMCCC3.js.map} +0 -0
- /package/dist/{chunk-5YTXYPES.js.map → chunk-5A2FVGHT.js.map} +0 -0
- /package/dist/{chunk-NSXNXLYM.js.map → chunk-5GZC2ZM3.js.map} +0 -0
- /package/dist/{chunk-JYNH4FIM.js.map → chunk-77WF53XY.js.map} +0 -0
- /package/dist/{chunk-O5XKZCUD.js.map → chunk-7X4EF35A.js.map} +0 -0
- /package/dist/{chunk-SQKAECUL.js.map → chunk-7ZCTUI26.js.map} +0 -0
- /package/dist/{chunk-J6RGRZOY.js.map → chunk-AO3QSMCU.js.map} +0 -0
- /package/dist/{chunk-JDCPRJVS.js.map → chunk-AONK5GCC.js.map} +0 -0
- /package/dist/{chunk-TYMDCIQM.js.map → chunk-C472BRJ4.js.map} +0 -0
- /package/dist/{chunk-MBXKRHSS.js.map → chunk-CCNRFAL3.js.map} +0 -0
- /package/dist/{chunk-BZW5IL43.js.map → chunk-DCA2BDHA.js.map} +0 -0
- /package/dist/{chunk-JBBWALNI.js.map → chunk-DCICHSRS.js.map} +0 -0
- /package/dist/{chunk-2XA2ZML4.js.map → chunk-FG6IQ3ZL.js.map} +0 -0
- /package/dist/{chunk-C2RJVZZL.js.map → chunk-G4GW5VOS.js.map} +0 -0
- /package/dist/{chunk-U2XSUCDF.js.map → chunk-GEWIFM4J.js.map} +0 -0
- /package/dist/{chunk-TNH5SLCD.js.map → chunk-HD4QCT2O.js.map} +0 -0
- /package/dist/{chunk-I3IYTUUI.js.map → chunk-HHJ5DZCZ.js.map} +0 -0
- /package/dist/{chunk-6QAZ5O6X.js.map → chunk-IEIADIPM.js.map} +0 -0
- /package/dist/{chunk-YPIOFSN3.js.map → chunk-IHAISFXP.js.map} +0 -0
- /package/dist/{chunk-GJTKMME7.js.map → chunk-JKM2AVVH.js.map} +0 -0
- /package/dist/{chunk-S45MDEEF.js.map → chunk-LMWVNF6X.js.map} +0 -0
- /package/dist/{chunk-TAMRU7A2.js.map → chunk-OKV7S356.js.map} +0 -0
- /package/dist/{chunk-IW4L4X65.js.map → chunk-P5A4E53B.js.map} +0 -0
- /package/dist/{chunk-JOK73NDT.js.map → chunk-P7OL22JP.js.map} +0 -0
- /package/dist/{chunk-TGIJTNM3.js.map → chunk-R5ZECURV.js.map} +0 -0
- /package/dist/{chunk-KOAJ3TZM.js.map → chunk-RFEXGW3L.js.map} +0 -0
- /package/dist/{chunk-F5ILTHMU.js.map → chunk-RNQPDV75.js.map} +0 -0
- /package/dist/{chunk-WWVJXBOT.js.map → chunk-SGM7CK7R.js.map} +0 -0
- /package/dist/{chunk-7MRT7EPB.js.map → chunk-SOQE5DUV.js.map} +0 -0
- /package/dist/{chunk-ZONKSLF2.js.map → chunk-TQMQZOMX.js.map} +0 -0
- /package/dist/{chunk-3HNKR65T.js.map → chunk-U6LTLN7O.js.map} +0 -0
- /package/dist/{chunk-UU6M64HI.js.map → chunk-UAK2AMO2.js.map} +0 -0
- /package/dist/{chunk-37VGJM3T.js.map → chunk-WQ3KAGOV.js.map} +0 -0
- /package/dist/{chunk-AI4USDRI.js.map → chunk-XQO4TAJS.js.map} +0 -0
- /package/dist/{chunk-SQOK5UM6.js.map → chunk-ZBENTRFS.js.map} +0 -0
- /package/dist/{chunk-6QE4DUYC.js.map → chunk-ZDITTESU.js.map} +0 -0
- /package/dist/{crypto-456N7UVX.js.map → crypto-2LU6XUFF.js.map} +0 -0
- /package/dist/{delegation-DP4COTXB.js.map → delegation-6ABSJGXV.js.map} +0 -0
- /package/dist/{executor-4IEW4KG5.js.map → executor-JKMSEB34.js.map} +0 -0
- /package/dist/{executor-KYJCJCIN.js.map → executor-UYXSQB4D.js.map} +0 -0
- /package/dist/{executor-W7VIBOBZ.js.map → executor-VJSCTBWY.js.map} +0 -0
- /package/dist/{fanout-sidecar-YXNAEZ33.js.map → fanout-sidecar-ZQT4Y7PF.js.map} +0 -0
- /package/dist/{issue-JXC6T2QR.js.map → issue-KLRMW5DH.js.map} +0 -0
- /package/dist/{ledger-I7JUYP4L.js.map → kernel/index.js.map} +0 -0
- /package/dist/{noydb-VGR2HLDB.js.map → ledger-VOS2X3WJ.js.map} +0 -0
- /package/dist/{public-envelope-5XRTUNKF.js.map → noydb-2PI2ZBX6.js.map} +0 -0
- /package/dist/{registry-ATRHOG5B.js.map → public-envelope-IJJMWSTJ.js.map} +0 -0
- /package/dist/{registry-LEHB26TY.js.map → registry-GAIFVWXF.js.map} +0 -0
- /package/dist/{registry-NWHOLD5M.js.map → registry-J77ZUQ7G.js.map} +0 -0
- /package/dist/{revoke-5IEK22KT.js.map → registry-JGEVJ6YC.js.map} +0 -0
- /package/dist/{signer-I6YARZQA.js.map → revoke-WUY4AYRJ.js.map} +0 -0
- /package/dist/{stale-CPESGAPL.js.map → signer-UJF3CFDC.js.map} +0 -0
- /package/dist/{state-vault-JR3CFGNP.js.map → stale-PW6VBGSP.js.map} +0 -0
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
STATE_VAULT_NAME
|
|
3
|
-
} from "./chunk-ZC7J6ZYV.js";
|
|
4
1
|
import {
|
|
5
2
|
resolveSchema
|
|
6
3
|
} from "./chunk-EMIGCR7X.js";
|
|
7
4
|
import {
|
|
8
5
|
TxContext,
|
|
9
6
|
revertExecuted
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BCMHJYVT.js";
|
|
11
8
|
import {
|
|
12
9
|
OverlayedCollection
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CCNRFAL3.js";
|
|
14
11
|
import {
|
|
15
12
|
NO_AGGREGATE,
|
|
16
13
|
Query,
|
|
@@ -20,39 +17,39 @@ import {
|
|
|
20
17
|
decodeMoneyFields,
|
|
21
18
|
quantizeMoneyFields,
|
|
22
19
|
validateMoneyFieldPaths
|
|
23
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3XJU3OHE.js";
|
|
24
21
|
import {
|
|
25
22
|
EXPORT_AUDIT_COLLECTION,
|
|
26
23
|
createExportBlobsHandle,
|
|
27
24
|
runCompaction
|
|
28
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-FG6IQ3ZL.js";
|
|
29
26
|
import {
|
|
30
27
|
LazyQuery,
|
|
31
28
|
decodeIdxId,
|
|
32
29
|
encodeIdxId
|
|
33
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-U6LTLN7O.js";
|
|
34
31
|
import {
|
|
35
32
|
canonicalGroupKey
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-77WF53XY.js";
|
|
37
34
|
import {
|
|
38
35
|
readPath
|
|
39
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-GEWIFM4J.js";
|
|
40
37
|
import {
|
|
41
38
|
SCHEMAS_COLLECTION,
|
|
42
39
|
loadPersistedSchema,
|
|
43
40
|
resolveManagedSecret,
|
|
44
41
|
savePersistedSchema,
|
|
45
42
|
saveSealedPassphrase
|
|
46
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-XC32SZPW.js";
|
|
47
44
|
import {
|
|
48
45
|
writeNoydbBundle
|
|
49
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-4TCMCCC3.js";
|
|
50
47
|
import {
|
|
51
48
|
loadPublicEnvelope,
|
|
52
49
|
readPublicEnvelope,
|
|
53
50
|
savePublicEnvelope,
|
|
54
51
|
validatePublicEnvelopeInput
|
|
55
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-P7OL22JP.js";
|
|
56
53
|
import {
|
|
57
54
|
buildTombstone,
|
|
58
55
|
isTombstone,
|
|
@@ -61,19 +58,19 @@ import {
|
|
|
61
58
|
rewrapBodyToDek,
|
|
62
59
|
rotateRecordCek,
|
|
63
60
|
sealRecordToHost
|
|
64
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-DCA2BDHA.js";
|
|
65
62
|
import {
|
|
66
63
|
PERIODS_COLLECTION
|
|
67
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-HHJ5DZCZ.js";
|
|
68
65
|
import {
|
|
69
66
|
isDictCollectionName,
|
|
70
67
|
isStaticDictDescriptor
|
|
71
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-7X4EF35A.js";
|
|
72
69
|
import {
|
|
73
70
|
getAtPath,
|
|
74
71
|
resolvePolicy,
|
|
75
72
|
setAtPathInPlace
|
|
76
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-HD4QCT2O.js";
|
|
77
74
|
import {
|
|
78
75
|
ManagedRecoveryNotEnrolledError,
|
|
79
76
|
PolicyDeniedError,
|
|
@@ -95,11 +92,11 @@ import {
|
|
|
95
92
|
saveShamirRecoveryEntries,
|
|
96
93
|
updateAuthenticator,
|
|
97
94
|
writeMagicLinkGrant
|
|
98
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-OWAMTSAI.js";
|
|
99
96
|
import {
|
|
100
97
|
assertTierAccess,
|
|
101
98
|
dekKey
|
|
102
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-TOMSCJRV.js";
|
|
103
100
|
import {
|
|
104
101
|
USER_ENVELOPE_COLLECTION,
|
|
105
102
|
assertKeyringOpenAllowed,
|
|
@@ -124,7 +121,7 @@ import {
|
|
|
124
121
|
rotateKeys,
|
|
125
122
|
saveUserEnvelope,
|
|
126
123
|
updateKeyringIdentity
|
|
127
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-B5CSNGSE.js";
|
|
128
125
|
import {
|
|
129
126
|
INDEXED_STORE_POLICY
|
|
130
127
|
} from "./chunk-2QR2PQTT.js";
|
|
@@ -134,7 +131,7 @@ import {
|
|
|
134
131
|
import {
|
|
135
132
|
LEDGER_COLLECTION,
|
|
136
133
|
LEDGER_DELTAS_COLLECTION
|
|
137
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-AONK5GCC.js";
|
|
138
135
|
import {
|
|
139
136
|
sha256Hex as sha256Hex2
|
|
140
137
|
} from "./chunk-PDVP3C2I.js";
|
|
@@ -146,19 +143,20 @@ import {
|
|
|
146
143
|
readDottedPath,
|
|
147
144
|
rebuildSubjectIndex,
|
|
148
145
|
removeSubjectRef
|
|
149
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-35U5YNRR.js";
|
|
150
147
|
import {
|
|
151
148
|
NOYDB_BACKUP_VERSION,
|
|
152
149
|
NOYDB_FORMAT_VERSION
|
|
153
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-LR7CODVN.js";
|
|
154
151
|
import {
|
|
155
152
|
decrypt,
|
|
156
153
|
encrypt,
|
|
157
154
|
encryptDeterministic,
|
|
158
155
|
sha256Hex,
|
|
159
156
|
unwrapCek,
|
|
160
|
-
wrapCek
|
|
161
|
-
|
|
157
|
+
wrapCek,
|
|
158
|
+
wrapKey
|
|
159
|
+
} from "./chunk-WQ3KAGOV.js";
|
|
162
160
|
import {
|
|
163
161
|
AlreadyElevatedError,
|
|
164
162
|
AttestationError,
|
|
@@ -170,6 +168,7 @@ import {
|
|
|
170
168
|
DerivationCapExceededError,
|
|
171
169
|
ElevationExpiredError,
|
|
172
170
|
ExportCapabilityError,
|
|
171
|
+
FederationMovedError,
|
|
173
172
|
ForgetStrategyNotConfiguredError,
|
|
174
173
|
ImportCapabilityError,
|
|
175
174
|
IndexWriteFailureError,
|
|
@@ -184,7 +183,6 @@ import {
|
|
|
184
183
|
QuiesceTimeoutError,
|
|
185
184
|
ReadOnlyError,
|
|
186
185
|
ReservedCollectionNameError,
|
|
187
|
-
ReservedVaultNameError,
|
|
188
186
|
SchemaFenceError,
|
|
189
187
|
SchemaValidationError,
|
|
190
188
|
SequenceContentionError,
|
|
@@ -197,9 +195,8 @@ import {
|
|
|
197
195
|
UniqueConstraintError,
|
|
198
196
|
UnknownDictCodeError,
|
|
199
197
|
UnsupportedIndexOptionError,
|
|
200
|
-
ValidationError
|
|
201
|
-
|
|
202
|
-
} from "./chunk-OTWT6BAJ.js";
|
|
198
|
+
ValidationError
|
|
199
|
+
} from "./chunk-4BB4T3O7.js";
|
|
203
200
|
|
|
204
201
|
// src/policy/storage.ts
|
|
205
202
|
var META_COLLECTION = "_meta";
|
|
@@ -913,7 +910,7 @@ async function resolveStaleOnRead(accessor, outputCollection, id) {
|
|
|
913
910
|
}
|
|
914
911
|
const sourceWithId = { ...source, id };
|
|
915
912
|
if (DerivationExecutor === null) {
|
|
916
|
-
({ DerivationExecutor } = await import("./executor-
|
|
913
|
+
({ DerivationExecutor } = await import("./executor-VJSCTBWY.js"));
|
|
917
914
|
}
|
|
918
915
|
const ctx = { vault: accessor.getReadOnlyFacade() };
|
|
919
916
|
const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
|
|
@@ -1159,6 +1156,13 @@ var Collection = class {
|
|
|
1159
1156
|
* flag) still decrypts CEK records.
|
|
1160
1157
|
*/
|
|
1161
1158
|
perRecordCek;
|
|
1159
|
+
/**
|
|
1160
|
+
* Per-record provenance opt-in (`provenance: true`). When set, `put()` calls
|
|
1161
|
+
* that supply a `source` option stamp `_source`/`_sourceTs` onto the
|
|
1162
|
+
* unencrypted envelope metadata. Off by default — zero cost for collections
|
|
1163
|
+
* that don't need lineage tracking (FR-5, #445).
|
|
1164
|
+
*/
|
|
1165
|
+
provenance;
|
|
1162
1166
|
/**
|
|
1163
1167
|
* Session-scoped `(id) → CEK` cache for this collection. Lets updates
|
|
1164
1168
|
* reuse a record's stable CEK and lets repeated reads skip the AES-KW
|
|
@@ -1318,6 +1322,7 @@ var Collection = class {
|
|
|
1318
1322
|
}
|
|
1319
1323
|
this.perRecordCek = opts.perRecordKeys === true;
|
|
1320
1324
|
this.cekCache = this.perRecordCek ? new Lru({ maxRecords: 4096 }) : null;
|
|
1325
|
+
this.provenance = opts.provenance === true;
|
|
1321
1326
|
if (opts.crdt && opts.onRegisterConflictResolver) {
|
|
1322
1327
|
const crdtMode = opts.crdt;
|
|
1323
1328
|
const crdtResolver = async (id, local, remote) => {
|
|
@@ -1462,7 +1467,7 @@ var Collection = class {
|
|
|
1462
1467
|
}
|
|
1463
1468
|
}
|
|
1464
1469
|
if (this.materializedViewSource !== void 0) {
|
|
1465
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
1470
|
+
const { resolveStaleMVOnRead } = await import("./stale-PW6VBGSP.js");
|
|
1466
1471
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
1467
1472
|
}
|
|
1468
1473
|
let record;
|
|
@@ -1505,6 +1510,33 @@ var Collection = class {
|
|
|
1505
1510
|
if (json === null) return null;
|
|
1506
1511
|
return JSON.parse(json);
|
|
1507
1512
|
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Read a record's unencrypted envelope metadata (version, timestamps,
|
|
1515
|
+
* provenance) without decrypting the body.
|
|
1516
|
+
*
|
|
1517
|
+
* Returns `null` when no envelope exists for `id` (record absent or never
|
|
1518
|
+
* written). Only `_source`/`_sourceTs` fields are populated when the
|
|
1519
|
+
* collection was opened with `provenance: true` AND the record was written
|
|
1520
|
+
* with a `source` option — but this method works on any collection because
|
|
1521
|
+
* it reads the raw envelope directly.
|
|
1522
|
+
*
|
|
1523
|
+
* @returns `{ version, timestamp, by?, source?, sourceTs? }` or `null`.
|
|
1524
|
+
*
|
|
1525
|
+
* @example
|
|
1526
|
+
* const meta = await clients.getMetadata('c1')
|
|
1527
|
+
* if (meta) console.log(meta.source, meta.timestamp)
|
|
1528
|
+
*/
|
|
1529
|
+
async getMetadata(id) {
|
|
1530
|
+
const env = await this.adapter.get(this.vault, this.name, id);
|
|
1531
|
+
if (!env) return null;
|
|
1532
|
+
return {
|
|
1533
|
+
version: env._v,
|
|
1534
|
+
timestamp: env._ts,
|
|
1535
|
+
...env._by !== void 0 ? { by: env._by } : {},
|
|
1536
|
+
...env._source !== void 0 ? { source: env._source } : {},
|
|
1537
|
+
...env._sourceTs !== void 0 ? { sourceTs: env._sourceTs } : {}
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1508
1540
|
/**
|
|
1509
1541
|
* Return a presence handle for this collection.
|
|
1510
1542
|
*
|
|
@@ -1542,6 +1574,14 @@ var Collection = class {
|
|
|
1542
1574
|
* `reason` is stamped onto the resulting ledger entry
|
|
1543
1575
|
* so audit consumers can filter via
|
|
1544
1576
|
* `entries.filter(e => e.reason?.startsWith('import:'))`.
|
|
1577
|
+
* `source` is an opaque source id (e.g. `'crm-sync'`, `'firm-A'`)
|
|
1578
|
+
* stamped onto the envelope as `_source`/`_sourceTs` when
|
|
1579
|
+
* the collection has `provenance: true`. Ignored otherwise
|
|
1580
|
+
* (zero cost). (FR-5, #445)
|
|
1581
|
+
* `sourceTs` is an optional ISO-8601 origin timestamp override;
|
|
1582
|
+
* when supplied together with `source` on a provenance collection,
|
|
1583
|
+
* replaces the machine-stamped `now()` so re-merges preserve the
|
|
1584
|
+
* ORIGIN refresh time across vaults. (FR-4)
|
|
1545
1585
|
*/
|
|
1546
1586
|
async put(id, record, options) {
|
|
1547
1587
|
await this.schemaUpdateGate?.assertWritable();
|
|
@@ -1573,6 +1613,20 @@ var Collection = class {
|
|
|
1573
1613
|
if (busAfterPut) await this.subsystemBus.dispatch("afterPut", event);
|
|
1574
1614
|
}
|
|
1575
1615
|
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Validate a record against this collection's schema WITHOUT writing it.
|
|
1618
|
+
* Returns the (possibly coerced) record on success; throws
|
|
1619
|
+
* {@link SchemaValidationError} (direction: `'input'`) on violation.
|
|
1620
|
+
* A no-op pass-through when no schema is declared.
|
|
1621
|
+
*
|
|
1622
|
+
* Used by FR-8 migrate-then-merge to pre-validate all staged records
|
|
1623
|
+
* before `mergeDecryptedRecords` writes anything — so a failed upgrade
|
|
1624
|
+
* never half-writes the receiver.
|
|
1625
|
+
*/
|
|
1626
|
+
async validateInput(record) {
|
|
1627
|
+
if (this.schema === void 0) return record;
|
|
1628
|
+
return validateSchemaInput(this.schema, record, `validateInput(${this.name})`);
|
|
1629
|
+
}
|
|
1576
1630
|
/** @internal — true when hooks should fire for this write (handlers exist, not re-entrant). */
|
|
1577
1631
|
#hooksActive() {
|
|
1578
1632
|
return this.writeHooks !== void 0 && this.writeHooks.hasHandlers && !this.writeHooks.suppressed;
|
|
@@ -1730,7 +1784,7 @@ var Collection = class {
|
|
|
1730
1784
|
}
|
|
1731
1785
|
const version2 = existingVersion + 1;
|
|
1732
1786
|
const cek2 = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
1733
|
-
const envelope2 = await this.encryptJsonString(JSON.stringify(crdtState), version2, cek2);
|
|
1787
|
+
const envelope2 = await this.encryptJsonString(JSON.stringify(crdtState), version2, cek2, options?.source, options?.sourceTs);
|
|
1734
1788
|
await this.adapter.put(this.vault, this.name, id, envelope2);
|
|
1735
1789
|
const resolvedRecord = this.crdtStrategy.resolveCrdtSnapshot(crdtState);
|
|
1736
1790
|
const existingResolvedRecord = existingEnvelope ? await this.decryptRecord(existingEnvelope, { skipValidation: true }) : null;
|
|
@@ -1809,7 +1863,7 @@ var Collection = class {
|
|
|
1809
1863
|
});
|
|
1810
1864
|
}
|
|
1811
1865
|
}
|
|
1812
|
-
const envelope = await this.encryptRecord(record, version, cek);
|
|
1866
|
+
const envelope = await this.encryptRecord(record, version, cek, options?.source, options?.sourceTs);
|
|
1813
1867
|
await this.adapter.put(this.vault, this.name, id, envelope);
|
|
1814
1868
|
if (this.ledger) {
|
|
1815
1869
|
const appendInput = {
|
|
@@ -1872,7 +1926,7 @@ var Collection = class {
|
|
|
1872
1926
|
if (mode === "eager") {
|
|
1873
1927
|
if (executor === null) {
|
|
1874
1928
|
;
|
|
1875
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
1929
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-UYXSQB4D.js"));
|
|
1876
1930
|
}
|
|
1877
1931
|
await executor.refresh(reg, {
|
|
1878
1932
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -1881,7 +1935,7 @@ var Collection = class {
|
|
|
1881
1935
|
});
|
|
1882
1936
|
} else if (mode === "lazy") {
|
|
1883
1937
|
if (staleHelpers === null) {
|
|
1884
|
-
staleHelpers = await import("./stale-
|
|
1938
|
+
staleHelpers = await import("./stale-PW6VBGSP.js");
|
|
1885
1939
|
}
|
|
1886
1940
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
1887
1941
|
}
|
|
@@ -2055,7 +2109,7 @@ var Collection = class {
|
|
|
2055
2109
|
continue;
|
|
2056
2110
|
}
|
|
2057
2111
|
if (DerivationExecutor === null) {
|
|
2058
|
-
({ DerivationExecutor } = await import("./executor-
|
|
2112
|
+
({ DerivationExecutor } = await import("./executor-VJSCTBWY.js"));
|
|
2059
2113
|
}
|
|
2060
2114
|
for (const run of runs) {
|
|
2061
2115
|
const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
|
|
@@ -2074,7 +2128,7 @@ var Collection = class {
|
|
|
2074
2128
|
const outputCollection = this.derivationSource.getCollection(outSpec.collection);
|
|
2075
2129
|
const txCtx = this.derivationSource.getActiveTxContext();
|
|
2076
2130
|
if (out.kind === "array") {
|
|
2077
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
2131
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-ZQT4Y7PF.js");
|
|
2078
2132
|
const prior = await loadFanoutSidecar(
|
|
2079
2133
|
this.adapter,
|
|
2080
2134
|
this.vault,
|
|
@@ -2102,7 +2156,7 @@ var Collection = class {
|
|
|
2102
2156
|
priorEnvelope
|
|
2103
2157
|
});
|
|
2104
2158
|
}
|
|
2105
|
-
await outputCollection.put(entry.key, entry.value);
|
|
2159
|
+
await outputCollection.put(entry.key, entry.value, { source: "derived" });
|
|
2106
2160
|
}
|
|
2107
2161
|
await saveFanoutSidecar(this.adapter, this.vault, {
|
|
2108
2162
|
source: spec.source,
|
|
@@ -2135,7 +2189,7 @@ var Collection = class {
|
|
|
2135
2189
|
priorEnvelope: prior
|
|
2136
2190
|
});
|
|
2137
2191
|
}
|
|
2138
|
-
await outputCollection.put(run.runId, patched);
|
|
2192
|
+
await outputCollection.put(run.runId, patched, { source: "derived" });
|
|
2139
2193
|
continue;
|
|
2140
2194
|
}
|
|
2141
2195
|
if (txCtx !== null) {
|
|
@@ -2150,7 +2204,7 @@ var Collection = class {
|
|
|
2150
2204
|
priorEnvelope: prior
|
|
2151
2205
|
});
|
|
2152
2206
|
}
|
|
2153
|
-
await outputCollection.put(run.runId, out.value);
|
|
2207
|
+
await outputCollection.put(run.runId, out.value, { source: "derived" });
|
|
2154
2208
|
}
|
|
2155
2209
|
}
|
|
2156
2210
|
}
|
|
@@ -2437,7 +2491,7 @@ var Collection = class {
|
|
|
2437
2491
|
for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
|
|
2438
2492
|
if (outSpec.shape !== "array") continue;
|
|
2439
2493
|
if (helpers === null) {
|
|
2440
|
-
helpers = await import("./fanout-sidecar-
|
|
2494
|
+
helpers = await import("./fanout-sidecar-ZQT4Y7PF.js");
|
|
2441
2495
|
}
|
|
2442
2496
|
const sidecar = await helpers.loadFanoutSidecar(
|
|
2443
2497
|
this.adapter,
|
|
@@ -2477,7 +2531,7 @@ var Collection = class {
|
|
|
2477
2531
|
if (mode === "eager") {
|
|
2478
2532
|
if (executor === null) {
|
|
2479
2533
|
;
|
|
2480
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
2534
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-UYXSQB4D.js"));
|
|
2481
2535
|
}
|
|
2482
2536
|
await executor.refresh(reg, {
|
|
2483
2537
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -2486,7 +2540,7 @@ var Collection = class {
|
|
|
2486
2540
|
});
|
|
2487
2541
|
} else if (mode === "lazy") {
|
|
2488
2542
|
if (staleHelpers === null) {
|
|
2489
|
-
staleHelpers = await import("./stale-
|
|
2543
|
+
staleHelpers = await import("./stale-PW6VBGSP.js");
|
|
2490
2544
|
}
|
|
2491
2545
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
2492
2546
|
}
|
|
@@ -2509,7 +2563,7 @@ var Collection = class {
|
|
|
2509
2563
|
);
|
|
2510
2564
|
}
|
|
2511
2565
|
if (this.materializedViewSource !== void 0) {
|
|
2512
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
2566
|
+
const { resolveStaleMVOnRead } = await import("./stale-PW6VBGSP.js");
|
|
2513
2567
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
2514
2568
|
}
|
|
2515
2569
|
await this.ensureHydrated();
|
|
@@ -3813,7 +3867,7 @@ var Collection = class {
|
|
|
3813
3867
|
* (see {@link encryptRecord}). Rejects `_`-prefixed record fields, which
|
|
3814
3868
|
* would collide with the reserved metadata namespace.
|
|
3815
3869
|
*/
|
|
3816
|
-
buildDebugEnvelope(record, version) {
|
|
3870
|
+
buildDebugEnvelope(record, version, source, sourceTs) {
|
|
3817
3871
|
const rec = record;
|
|
3818
3872
|
for (const key of Object.keys(rec)) {
|
|
3819
3873
|
if (key.startsWith("_")) throw new DebugReservedFieldError(this.name, key);
|
|
@@ -3826,11 +3880,13 @@ var Collection = class {
|
|
|
3826
3880
|
_data: "",
|
|
3827
3881
|
_by: this.keyring.userId,
|
|
3828
3882
|
_debug: NOYDB_FORMAT_VERSION,
|
|
3883
|
+
...this.provenance && source !== void 0 ? { _source: source, _sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {},
|
|
3829
3884
|
...rec
|
|
3830
3885
|
};
|
|
3831
3886
|
}
|
|
3832
|
-
async encryptJsonString(json, version, cek) {
|
|
3887
|
+
async encryptJsonString(json, version, cek, source, sourceTs) {
|
|
3833
3888
|
const by = this.keyring.userId;
|
|
3889
|
+
const provenanceFields = this.provenance && source !== void 0 ? { _source: source, _sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {};
|
|
3834
3890
|
if (!this.encrypted) {
|
|
3835
3891
|
return {
|
|
3836
3892
|
_noydb: NOYDB_FORMAT_VERSION,
|
|
@@ -3838,7 +3894,8 @@ var Collection = class {
|
|
|
3838
3894
|
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3839
3895
|
_iv: "",
|
|
3840
3896
|
_data: json,
|
|
3841
|
-
_by: by
|
|
3897
|
+
_by: by,
|
|
3898
|
+
...provenanceFields
|
|
3842
3899
|
};
|
|
3843
3900
|
}
|
|
3844
3901
|
const dek = await this.getDEK(this.name);
|
|
@@ -3852,7 +3909,8 @@ var Collection = class {
|
|
|
3852
3909
|
_iv: iv2,
|
|
3853
3910
|
_data: data2,
|
|
3854
3911
|
_by: by,
|
|
3855
|
-
_cek: wrapped
|
|
3912
|
+
_cek: wrapped,
|
|
3913
|
+
...provenanceFields
|
|
3856
3914
|
};
|
|
3857
3915
|
}
|
|
3858
3916
|
const { iv, data } = await encrypt(json, dek);
|
|
@@ -3862,14 +3920,15 @@ var Collection = class {
|
|
|
3862
3920
|
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3863
3921
|
_iv: iv,
|
|
3864
3922
|
_data: data,
|
|
3865
|
-
_by: by
|
|
3923
|
+
_by: by,
|
|
3924
|
+
...provenanceFields
|
|
3866
3925
|
};
|
|
3867
3926
|
}
|
|
3868
|
-
async encryptRecord(record, version, cek) {
|
|
3927
|
+
async encryptRecord(record, version, cek, source, sourceTs) {
|
|
3869
3928
|
if (!this.encrypted && this.keyring.debugPlaintext === true && !this.name.startsWith("_")) {
|
|
3870
|
-
return this.buildDebugEnvelope(record, version);
|
|
3929
|
+
return this.buildDebugEnvelope(record, version, source, sourceTs);
|
|
3871
3930
|
}
|
|
3872
|
-
const base = await this.encryptJsonString(JSON.stringify(record), version, cek);
|
|
3931
|
+
const base = await this.encryptJsonString(JSON.stringify(record), version, cek, source, sourceTs);
|
|
3873
3932
|
if (!this.deterministicFields || !this.encrypted) return base;
|
|
3874
3933
|
const dek = await this.getDEK(this.name);
|
|
3875
3934
|
const rec = record;
|
|
@@ -4003,7 +4062,8 @@ var Collection = class {
|
|
|
4003
4062
|
_iv: iv,
|
|
4004
4063
|
_data: data,
|
|
4005
4064
|
_by: this.keyring.userId,
|
|
4006
|
-
...tier > 0 && { _tier: tier }
|
|
4065
|
+
...tier > 0 && { _tier: tier },
|
|
4066
|
+
...this.provenance && opts?.source !== void 0 ? { _source: opts.source, _sourceTs: opts.sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {}
|
|
4007
4067
|
};
|
|
4008
4068
|
await this.adapter.put(this.vault, this.name, id, envelope);
|
|
4009
4069
|
if (tier > 0) {
|
|
@@ -4341,43 +4401,49 @@ function randomId() {
|
|
|
4341
4401
|
const b = globalThis.crypto.getRandomValues(new Uint8Array(12));
|
|
4342
4402
|
return Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
|
|
4343
4403
|
}
|
|
4344
|
-
async function
|
|
4404
|
+
async function freezeSnapshotOnly(vault, collections, opts) {
|
|
4345
4405
|
const { name: vaultName, adapter } = vault._introspectState();
|
|
4346
4406
|
const closure = [];
|
|
4347
4407
|
for (const c of collections) {
|
|
4348
4408
|
for (const id of await adapter.list(vaultName, c)) closure.push({ collection: c, id });
|
|
4349
4409
|
}
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
const withdrawalId = opts.withdrawalId ?? `wd-${randomId()}`;
|
|
4353
|
-
const snap = {};
|
|
4354
|
-
for (const { collection, id } of closure) {
|
|
4355
|
-
const env = await adapter.get(vaultName, collection, id);
|
|
4356
|
-
if (env) (snap[collection] ??= {})[id] = env;
|
|
4357
|
-
}
|
|
4358
|
-
const frozenAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4359
|
-
const body = JSON.stringify({ withdrawalId, frozenAt, by: opts.actorUserId, collections: snap });
|
|
4360
|
-
const sha = await sha256Hex(ENC.encode(body));
|
|
4361
|
-
await adapter.put(
|
|
4362
|
-
vaultName,
|
|
4363
|
-
FROZEN_SNAPSHOTS_COLLECTION,
|
|
4364
|
-
withdrawalId,
|
|
4365
|
-
{ _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: frozenAt, _iv: "", _data: body, _by: opts.actorUserId },
|
|
4366
|
-
0
|
|
4367
|
-
);
|
|
4368
|
-
await vault._getLedgerOrNull()?.append({
|
|
4369
|
-
op: "lifecycle",
|
|
4370
|
-
collection: "",
|
|
4371
|
-
id: "",
|
|
4372
|
-
version: 0,
|
|
4373
|
-
actor: opts.actorUserId,
|
|
4374
|
-
payloadHash: "",
|
|
4375
|
-
reason: `withdrawal-frozen-snapshot:${withdrawalId}:${sha}`
|
|
4376
|
-
});
|
|
4377
|
-
snapshot = { withdrawalId, sha256: sha, recordCount: closure.length, frozenAt };
|
|
4378
|
-
}
|
|
4410
|
+
const withdrawalId = opts.withdrawalId ?? `wd-${randomId()}`;
|
|
4411
|
+
const snap = {};
|
|
4379
4412
|
for (const { collection, id } of closure) {
|
|
4380
|
-
await
|
|
4413
|
+
const env = await adapter.get(vaultName, collection, id);
|
|
4414
|
+
if (env) (snap[collection] ??= {})[id] = env;
|
|
4415
|
+
}
|
|
4416
|
+
const frozenAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4417
|
+
const body = JSON.stringify({ withdrawalId, frozenAt, by: opts.actorUserId, collections: snap });
|
|
4418
|
+
const sha = await sha256Hex(ENC.encode(body));
|
|
4419
|
+
await adapter.put(
|
|
4420
|
+
vaultName,
|
|
4421
|
+
FROZEN_SNAPSHOTS_COLLECTION,
|
|
4422
|
+
withdrawalId,
|
|
4423
|
+
{ _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: frozenAt, _iv: "", _data: body, _by: opts.actorUserId },
|
|
4424
|
+
0
|
|
4425
|
+
);
|
|
4426
|
+
await vault._getLedgerOrNull()?.append({
|
|
4427
|
+
op: "lifecycle",
|
|
4428
|
+
collection: "",
|
|
4429
|
+
id: "",
|
|
4430
|
+
version: 0,
|
|
4431
|
+
actor: opts.actorUserId,
|
|
4432
|
+
payloadHash: "",
|
|
4433
|
+
reason: `withdrawal-frozen-snapshot:${withdrawalId}:${sha}`
|
|
4434
|
+
});
|
|
4435
|
+
return { withdrawalId, sha256: sha, recordCount: closure.length, frozenAt };
|
|
4436
|
+
}
|
|
4437
|
+
async function freezeAndDeleteClosure(vault, collections, opts) {
|
|
4438
|
+
const snapshot = opts.disposition === "freeze" ? await freezeSnapshotOnly(vault, collections, {
|
|
4439
|
+
actorUserId: opts.actorUserId,
|
|
4440
|
+
...opts.withdrawalId ? { withdrawalId: opts.withdrawalId } : {}
|
|
4441
|
+
}) : void 0;
|
|
4442
|
+
const { name: vaultName, adapter } = vault._introspectState();
|
|
4443
|
+
for (const c of collections) {
|
|
4444
|
+
for (const id of await adapter.list(vaultName, c)) {
|
|
4445
|
+
await vault.collection(c).delete(id);
|
|
4446
|
+
}
|
|
4381
4447
|
}
|
|
4382
4448
|
return snapshot;
|
|
4383
4449
|
}
|
|
@@ -4389,6 +4455,11 @@ async function withdrawAccessibleData(vault, opts) {
|
|
|
4389
4455
|
"unilateralWithdrawal is the scoped self-service path; an owner/admin should use extractPartition"
|
|
4390
4456
|
);
|
|
4391
4457
|
}
|
|
4458
|
+
if (keyring.role === "custodian") {
|
|
4459
|
+
throw new ReadOnlyError(
|
|
4460
|
+
"a custodian cannot destructively withdraw/sever; use vault.custody.liberate for an audited ownership claim"
|
|
4461
|
+
);
|
|
4462
|
+
}
|
|
4392
4463
|
if (keyring.role === "client" || keyring.role === "viewer") {
|
|
4393
4464
|
throw new ReadOnlyError(
|
|
4394
4465
|
"read-only role cannot self-serve a destructive withdrawal \u2014 use requestWithdrawal (two-party)"
|
|
@@ -5578,6 +5649,148 @@ function isPlainObject(x) {
|
|
|
5578
5649
|
return proto === Object.prototype || proto === null;
|
|
5579
5650
|
}
|
|
5580
5651
|
|
|
5652
|
+
// src/custody/index.ts
|
|
5653
|
+
var CustodyApi = class {
|
|
5654
|
+
constructor(_grantCustodian, _revokeCustodian, _liberate) {
|
|
5655
|
+
this._grantCustodian = _grantCustodian;
|
|
5656
|
+
this._revokeCustodian = _revokeCustodian;
|
|
5657
|
+
this._liberate = _liberate;
|
|
5658
|
+
}
|
|
5659
|
+
_grantCustodian;
|
|
5660
|
+
_revokeCustodian;
|
|
5661
|
+
_liberate;
|
|
5662
|
+
/**
|
|
5663
|
+
* Owner-only: grant the FR-6 `custodian` role. The custodian operates every
|
|
5664
|
+
* collection (rw + access) but is provably unable to grant / revoke / rotate /
|
|
5665
|
+
* extract-and-sever. Defended in depth (gate + owner-only role check) inside
|
|
5666
|
+
* the injected `Noydb.grantCustodian`.
|
|
5667
|
+
*/
|
|
5668
|
+
async grantCustodian(options, factors) {
|
|
5669
|
+
return this._grantCustodian(options, factors);
|
|
5670
|
+
}
|
|
5671
|
+
/** Owner-only: revoke a custodian. */
|
|
5672
|
+
async revokeCustodian(options, factors) {
|
|
5673
|
+
return this._revokeCustodian(options, factors);
|
|
5674
|
+
}
|
|
5675
|
+
/**
|
|
5676
|
+
* Custodian-only: the audited claim of ownership over a sealed-owner (Deed)
|
|
5677
|
+
* vault. Mints a DISTINCT new owner re-wrapping the incumbent DEKs under a
|
|
5678
|
+
* fresh KEK (the latent owner is never impersonated), ledger-audited. See
|
|
5679
|
+
* {@link liberateVault}.
|
|
5680
|
+
*/
|
|
5681
|
+
async liberate(opts) {
|
|
5682
|
+
return this._liberate(opts);
|
|
5683
|
+
}
|
|
5684
|
+
};
|
|
5685
|
+
|
|
5686
|
+
// src/team/deed.ts
|
|
5687
|
+
var DEED_RECORD_ID = "deed";
|
|
5688
|
+
async function createDeedOwner(store, vault, ownerUserId, sealing) {
|
|
5689
|
+
const passphrase = await resolveManagedSecret(store, vault, sealing);
|
|
5690
|
+
const keyring = await createOwnerKeyring(store, vault, ownerUserId, passphrase);
|
|
5691
|
+
await saveDeedMarker(store, vault, {
|
|
5692
|
+
ownerUserId,
|
|
5693
|
+
sealedUnder: sealing.id,
|
|
5694
|
+
latent: true,
|
|
5695
|
+
issuedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5696
|
+
});
|
|
5697
|
+
return keyring;
|
|
5698
|
+
}
|
|
5699
|
+
async function loadDeedMarker(store, vault) {
|
|
5700
|
+
const envelope = await store.get(vault, "_meta", DEED_RECORD_ID);
|
|
5701
|
+
if (!envelope) return null;
|
|
5702
|
+
let payload;
|
|
5703
|
+
try {
|
|
5704
|
+
payload = JSON.parse(envelope._data);
|
|
5705
|
+
} catch {
|
|
5706
|
+
return null;
|
|
5707
|
+
}
|
|
5708
|
+
if (typeof payload !== "object" || payload === null) return null;
|
|
5709
|
+
const r = payload;
|
|
5710
|
+
if (r._noydb_deed !== 1) return null;
|
|
5711
|
+
if (typeof r.ownerUserId !== "string" || typeof r.sealedUnder !== "string" || r.latent !== true || typeof r.issuedAt !== "string") {
|
|
5712
|
+
return null;
|
|
5713
|
+
}
|
|
5714
|
+
const marker = {
|
|
5715
|
+
ownerUserId: r.ownerUserId,
|
|
5716
|
+
sealedUnder: r.sealedUnder,
|
|
5717
|
+
latent: true,
|
|
5718
|
+
issuedAt: r.issuedAt,
|
|
5719
|
+
...typeof r.liberatedAt === "string" ? { liberatedAt: r.liberatedAt } : {}
|
|
5720
|
+
};
|
|
5721
|
+
return marker;
|
|
5722
|
+
}
|
|
5723
|
+
async function isDeedVault(store, vault) {
|
|
5724
|
+
return await loadDeedMarker(store, vault) !== null;
|
|
5725
|
+
}
|
|
5726
|
+
async function saveDeedMarker(store, vault, marker) {
|
|
5727
|
+
const persisted = { _noydb_deed: 1, ...marker };
|
|
5728
|
+
const prior = await store.get(vault, "_meta", DEED_RECORD_ID);
|
|
5729
|
+
const env = {
|
|
5730
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
5731
|
+
_v: (prior?._v ?? 0) + 1,
|
|
5732
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5733
|
+
// AES-GCM bypassed — the marker is plaintext audit metadata.
|
|
5734
|
+
_iv: "",
|
|
5735
|
+
_data: JSON.stringify(persisted)
|
|
5736
|
+
};
|
|
5737
|
+
await store.put(vault, "_meta", DEED_RECORD_ID, env);
|
|
5738
|
+
}
|
|
5739
|
+
|
|
5740
|
+
// src/custody/liberate.ts
|
|
5741
|
+
async function liberateVault(vault, opts) {
|
|
5742
|
+
await vault.noydb.checkGate(vault.name, "liberate-vault", opts.factors);
|
|
5743
|
+
const { name: vaultName, adapter, keyring } = vault._introspectState();
|
|
5744
|
+
if (keyring.role !== "custodian") {
|
|
5745
|
+
throw new PermissionDeniedError(
|
|
5746
|
+
"liberation is claimed only by the custodian (the de-facto authority holding the DEKs)"
|
|
5747
|
+
);
|
|
5748
|
+
}
|
|
5749
|
+
const existing = await adapter.get(vaultName, "_keyring", opts.newOwnerId);
|
|
5750
|
+
if (existing) {
|
|
5751
|
+
throw new PermissionDeniedError(
|
|
5752
|
+
`liberateVault: newOwnerId "${opts.newOwnerId}" already exists as a principal; choose a fresh id (liberation mints a distinct owner, it never overwrites an existing keyring)`
|
|
5753
|
+
);
|
|
5754
|
+
}
|
|
5755
|
+
const collections = await listOperationalCollections(vault);
|
|
5756
|
+
const snapshot = await freezeSnapshotOnly(vault, collections, { actorUserId: keyring.userId });
|
|
5757
|
+
const newOwner = await createOwnerKeyring(adapter, vaultName, opts.newOwnerId, opts.newOwnerPassphrase);
|
|
5758
|
+
if (!newOwner.kek) {
|
|
5759
|
+
throw new PermissionDeniedError(
|
|
5760
|
+
`new owner keyring for "${opts.newOwnerId}" has no KEK to re-wrap the incumbent DEKs under`
|
|
5761
|
+
);
|
|
5762
|
+
}
|
|
5763
|
+
const env = await adapter.get(vaultName, "_keyring", opts.newOwnerId);
|
|
5764
|
+
if (!env) {
|
|
5765
|
+
throw new PermissionDeniedError(`new owner keyring for "${opts.newOwnerId}" did not persist`);
|
|
5766
|
+
}
|
|
5767
|
+
const keyringFile = JSON.parse(env._data);
|
|
5768
|
+
const mergedDeks = { ...keyringFile.deks };
|
|
5769
|
+
for (const [collection, dek] of keyring.deks) {
|
|
5770
|
+
mergedDeks[collection] = await wrapKey(dek, newOwner.kek);
|
|
5771
|
+
}
|
|
5772
|
+
const mergedFile = { ...keyringFile, deks: mergedDeks };
|
|
5773
|
+
await adapter.put(vaultName, "_keyring", opts.newOwnerId, { ...env, _data: JSON.stringify(mergedFile) });
|
|
5774
|
+
await vault._getLedgerOrNull()?.append({
|
|
5775
|
+
op: "lifecycle",
|
|
5776
|
+
collection: "",
|
|
5777
|
+
id: "",
|
|
5778
|
+
version: 0,
|
|
5779
|
+
actor: opts.newOwnerId,
|
|
5780
|
+
payloadHash: "",
|
|
5781
|
+
reason: `liberation-claimed:${opts.newOwnerId}:${opts.legalBasis}`
|
|
5782
|
+
});
|
|
5783
|
+
const marker = await loadDeedMarker(adapter, vaultName);
|
|
5784
|
+
if (marker) {
|
|
5785
|
+
await saveDeedMarker(adapter, vaultName, { ...marker, liberatedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
5786
|
+
}
|
|
5787
|
+
return { snapshot };
|
|
5788
|
+
}
|
|
5789
|
+
async function listOperationalCollections(vault) {
|
|
5790
|
+
const { keyring } = vault._introspectState();
|
|
5791
|
+
return [...keyring.deks.keys()].filter((c) => !c.startsWith("_"));
|
|
5792
|
+
}
|
|
5793
|
+
|
|
5581
5794
|
// src/persisted-schemas/canonicalize.ts
|
|
5582
5795
|
function canonicalize(value) {
|
|
5583
5796
|
if (value === null || typeof value !== "object") {
|
|
@@ -6360,6 +6573,18 @@ var Vault = class {
|
|
|
6360
6573
|
* @see docs/superpowers/specs/2026-05-05-user-envelope-design.md
|
|
6361
6574
|
*/
|
|
6362
6575
|
user;
|
|
6576
|
+
/**
|
|
6577
|
+
* FR-6 custody API — the sovereign-custody surface, mirroring `vault.user.*`.
|
|
6578
|
+
*
|
|
6579
|
+
* - `grantCustodian(opts)` / `revokeCustodian(opts)` — owner-only: mint /
|
|
6580
|
+
* remove a `custodian` who operates the vault fully but can never grant /
|
|
6581
|
+
* rotate / sever / extract.
|
|
6582
|
+
* - `liberate(opts)` — custodian-only: the audited claim of ownership over a
|
|
6583
|
+
* sealed-owner (Deed) vault (mints a DISTINCT new owner; ledger-audited).
|
|
6584
|
+
*
|
|
6585
|
+
* @see docs/superpowers/specs/2026-06-17-fr6-deed-custodian-liberate-design.md
|
|
6586
|
+
*/
|
|
6587
|
+
custody;
|
|
6363
6588
|
/**
|
|
6364
6589
|
* Optional callback that re-derives an UnlockedKeyring from the
|
|
6365
6590
|
* adapter using the active user's passphrase. Called by `load()`
|
|
@@ -6570,6 +6795,11 @@ var Vault = class {
|
|
|
6570
6795
|
(requestId, opts2) => approveWithdrawal(this, requestId, opts2),
|
|
6571
6796
|
(requestId, opts2) => rejectWithdrawal(this, requestId, opts2)
|
|
6572
6797
|
);
|
|
6798
|
+
this.custody = new CustodyApi(
|
|
6799
|
+
(options, factors) => this.noydb.grantCustodian(this.name, options, factors),
|
|
6800
|
+
(options, factors) => this.noydb.revokeCustodian(this.name, options, factors),
|
|
6801
|
+
(opts2) => liberateVault(this, opts2)
|
|
6802
|
+
);
|
|
6573
6803
|
}
|
|
6574
6804
|
/**
|
|
6575
6805
|
* Construct (or reconstruct) the lazy DEK resolver. Captures the
|
|
@@ -6797,6 +7027,7 @@ var Vault = class {
|
|
|
6797
7027
|
}
|
|
6798
7028
|
collOpts.perRecordKeys = true;
|
|
6799
7029
|
}
|
|
7030
|
+
if (options?.provenance !== void 0) collOpts.provenance = options.provenance;
|
|
6800
7031
|
if (options?.tiers !== void 0) collOpts.tiers = options.tiers;
|
|
6801
7032
|
if (options?.tierMode !== void 0) collOpts.tierMode = options.tierMode;
|
|
6802
7033
|
collOpts.onCrossTierAccess = (event) => this.emitCrossTier(event);
|
|
@@ -7481,12 +7712,12 @@ var Vault = class {
|
|
|
7481
7712
|
if (!fieldSchema) {
|
|
7482
7713
|
throw new AttestationError(`issueAttestation: collection '${collectionName}' has no attestation field-schema. Declare it via vault.collection('${collectionName}', { attestation: { fields: [...] } }).`);
|
|
7483
7714
|
}
|
|
7484
|
-
const { issueAttestationCore } = await import("./issue-
|
|
7715
|
+
const { issueAttestationCore } = await import("./issue-KLRMW5DH.js");
|
|
7485
7716
|
const out = await issueAttestationCore(this.makeIssueContext(), { collection: collectionName, id, fieldSchema });
|
|
7486
7717
|
return { docId: out.docId, qr: out.qr, keyId: out.keyId, publicKeyB64: out.publicKeyB64 };
|
|
7487
7718
|
}
|
|
7488
7719
|
async getDocumentSigningPublicKey() {
|
|
7489
|
-
const { loadSigner, loadOrCreateSigner } = await import("./signer-
|
|
7720
|
+
const { loadSigner, loadOrCreateSigner } = await import("./signer-UJF3CFDC.js");
|
|
7490
7721
|
const existing = await loadSigner(this.adapter, this.name, this.getDEK);
|
|
7491
7722
|
if (existing) return { keyId: existing.keyId, publicKeyB64: existing.publicKeyB64 };
|
|
7492
7723
|
if (this.keyring.role !== "owner") {
|
|
@@ -7512,19 +7743,19 @@ var Vault = class {
|
|
|
7512
7743
|
};
|
|
7513
7744
|
}
|
|
7514
7745
|
async revokeAttestation(docId) {
|
|
7515
|
-
const { revokeDocCore } = await import("./revoke-
|
|
7746
|
+
const { revokeDocCore } = await import("./revoke-WUY4AYRJ.js");
|
|
7516
7747
|
await revokeDocCore(this.makeRevokeContext(), docId);
|
|
7517
7748
|
}
|
|
7518
7749
|
async unrevokeAttestation(docId) {
|
|
7519
|
-
const { unrevokeDocCore } = await import("./revoke-
|
|
7750
|
+
const { unrevokeDocCore } = await import("./revoke-WUY4AYRJ.js");
|
|
7520
7751
|
await unrevokeDocCore(this.makeRevokeContext(), docId);
|
|
7521
7752
|
}
|
|
7522
7753
|
async getRevokedDocIds() {
|
|
7523
|
-
const { getRevokedDocIdsCore } = await import("./revoke-
|
|
7754
|
+
const { getRevokedDocIdsCore } = await import("./revoke-WUY4AYRJ.js");
|
|
7524
7755
|
return getRevokedDocIdsCore(this.makeRevokeContext());
|
|
7525
7756
|
}
|
|
7526
7757
|
async publishRevocationList() {
|
|
7527
|
-
const { publishRevocationListCore } = await import("./revoke-
|
|
7758
|
+
const { publishRevocationListCore } = await import("./revoke-WUY4AYRJ.js");
|
|
7528
7759
|
return publishRevocationListCore(this.makeRevokeContext());
|
|
7529
7760
|
}
|
|
7530
7761
|
makeRevokeContext() {
|
|
@@ -8183,7 +8414,7 @@ var Vault = class {
|
|
|
8183
8414
|
async _initDerivations(handles) {
|
|
8184
8415
|
if (handles.length === 0) return;
|
|
8185
8416
|
const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
8186
|
-
import("./registry-
|
|
8417
|
+
import("./registry-GAIFVWXF.js"),
|
|
8187
8418
|
import("./read-only-facade-EX6WZZBP.js")
|
|
8188
8419
|
]);
|
|
8189
8420
|
const registry = new DerivationRegistry();
|
|
@@ -8214,7 +8445,7 @@ var Vault = class {
|
|
|
8214
8445
|
*/
|
|
8215
8446
|
async _initMaterializedViews(handles) {
|
|
8216
8447
|
if (handles.length === 0) return;
|
|
8217
|
-
const { MaterializedViewRegistry } = await import("./registry-
|
|
8448
|
+
const { MaterializedViewRegistry } = await import("./registry-JGEVJ6YC.js");
|
|
8218
8449
|
const registry = new MaterializedViewRegistry();
|
|
8219
8450
|
this.materializedViewRegistry = registry;
|
|
8220
8451
|
const db = this;
|
|
@@ -8238,7 +8469,7 @@ var Vault = class {
|
|
|
8238
8469
|
*/
|
|
8239
8470
|
async _initOverlayedViews(handles) {
|
|
8240
8471
|
if (handles.length === 0) return;
|
|
8241
|
-
const { OverlayedViewRegistry } = await import("./registry-
|
|
8472
|
+
const { OverlayedViewRegistry } = await import("./registry-J77ZUQ7G.js");
|
|
8242
8473
|
const registry = new OverlayedViewRegistry();
|
|
8243
8474
|
const mvRegistry = this.materializedViewRegistry;
|
|
8244
8475
|
const overlayNames = /* @__PURE__ */ new Set();
|
|
@@ -8285,13 +8516,13 @@ var Vault = class {
|
|
|
8285
8516
|
if (!reg) {
|
|
8286
8517
|
throw new Error(`refreshView: no MV registered with name "${name}"`);
|
|
8287
8518
|
}
|
|
8288
|
-
const { MaterializedViewExecutor } = await import("./executor-
|
|
8519
|
+
const { MaterializedViewExecutor } = await import("./executor-UYXSQB4D.js");
|
|
8289
8520
|
const result = await MaterializedViewExecutor.refresh(reg, {
|
|
8290
8521
|
getCollection: (n) => this.collection(n),
|
|
8291
8522
|
getActiveTxContext: () => this.noydb._activeTxContextOrNull,
|
|
8292
8523
|
getQueryContext: () => this
|
|
8293
8524
|
});
|
|
8294
|
-
const { clearMVStale } = await import("./stale-
|
|
8525
|
+
const { clearMVStale } = await import("./stale-PW6VBGSP.js");
|
|
8295
8526
|
clearMVStale(registry, name);
|
|
8296
8527
|
return result;
|
|
8297
8528
|
}
|
|
@@ -8307,7 +8538,7 @@ var Vault = class {
|
|
|
8307
8538
|
if (registry === null) return { derived: 0, failed: 0 };
|
|
8308
8539
|
const strategies = registry.strategiesForSource(sourceCollection);
|
|
8309
8540
|
if (strategies.length === 0) return { derived: 0, failed: 0 };
|
|
8310
|
-
const { DerivationExecutor } = await import("./executor-
|
|
8541
|
+
const { DerivationExecutor } = await import("./executor-VJSCTBWY.js");
|
|
8311
8542
|
const sourceColl = this.collection(sourceCollection);
|
|
8312
8543
|
const records = await sourceColl.list();
|
|
8313
8544
|
const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-EX6WZZBP.js")).ReadOnlyVaultFacade(this, "derivation") };
|
|
@@ -8332,7 +8563,7 @@ var Vault = class {
|
|
|
8332
8563
|
if (!outSpec) continue;
|
|
8333
8564
|
const outputColl = this.collection(outSpec.collection);
|
|
8334
8565
|
if (out.kind === "array") {
|
|
8335
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
8566
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-ZQT4Y7PF.js");
|
|
8336
8567
|
const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key);
|
|
8337
8568
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
8338
8569
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -8554,7 +8785,7 @@ var Vault = class {
|
|
|
8554
8785
|
* collection.
|
|
8555
8786
|
*/
|
|
8556
8787
|
async delegate(opts) {
|
|
8557
|
-
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
8788
|
+
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-6ABSJGXV.js");
|
|
8558
8789
|
if (!this.keyring.kek) {
|
|
8559
8790
|
throw new ValidationError(
|
|
8560
8791
|
"issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
|
|
@@ -8576,7 +8807,7 @@ var Vault = class {
|
|
|
8576
8807
|
* if the id does not exist.
|
|
8577
8808
|
*/
|
|
8578
8809
|
async revokeDelegation(id) {
|
|
8579
|
-
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
8810
|
+
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-6ABSJGXV.js");
|
|
8580
8811
|
await revokeDelegation(this.adapter, this.name, id);
|
|
8581
8812
|
void DELEGATIONS_COLLECTION;
|
|
8582
8813
|
}
|
|
@@ -8619,7 +8850,7 @@ var Vault = class {
|
|
|
8619
8850
|
if (this.activeElevation) {
|
|
8620
8851
|
throw new AlreadyElevatedError(this.activeElevation.tier);
|
|
8621
8852
|
}
|
|
8622
|
-
if (this.keyring.role !== "owner" && this.keyring.role !== "admin") {
|
|
8853
|
+
if (this.keyring.role !== "owner" && this.keyring.role !== "admin" && this.keyring.role !== "custodian") {
|
|
8623
8854
|
const suffix = `#${tier}`;
|
|
8624
8855
|
let found = false;
|
|
8625
8856
|
for (const k of this.keyring.deks.keys()) {
|
|
@@ -9046,7 +9277,7 @@ var Vault = class {
|
|
|
9046
9277
|
* @see docs/subsystems/public-envelope.md
|
|
9047
9278
|
*/
|
|
9048
9279
|
async getPublicEnvelope(opts = {}) {
|
|
9049
|
-
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-
|
|
9280
|
+
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-IJJMWSTJ.js");
|
|
9050
9281
|
return readPublicEnvelope2(this.adapter, this.name, opts);
|
|
9051
9282
|
}
|
|
9052
9283
|
/**
|
|
@@ -10563,6 +10794,12 @@ var ROLE_RANK = {
|
|
|
10563
10794
|
client: 1,
|
|
10564
10795
|
viewer: 2,
|
|
10565
10796
|
operator: 3,
|
|
10797
|
+
// FR-6: custodian is operationally admin-rank (rw + access on every
|
|
10798
|
+
// collection) — it ranks alongside admin for "how much can this
|
|
10799
|
+
// principal see/operate." It is NOT above admin, and explicitly below
|
|
10800
|
+
// owner: a custodian can never grant/revoke/rotate/sever (those are
|
|
10801
|
+
// owner meta-capabilities), so it must not outrank or equal the owner.
|
|
10802
|
+
custodian: 4,
|
|
10566
10803
|
admin: 4,
|
|
10567
10804
|
owner: 5
|
|
10568
10805
|
};
|
|
@@ -10624,7 +10861,6 @@ var Noydb = class {
|
|
|
10624
10861
|
writeRelay;
|
|
10625
10862
|
/** Per-vault policy enforcers. */
|
|
10626
10863
|
policyEnforcers = /* @__PURE__ */ new Map();
|
|
10627
|
-
vaultTemplates = /* @__PURE__ */ new Map();
|
|
10628
10864
|
txStrategy;
|
|
10629
10865
|
forgetStrategy;
|
|
10630
10866
|
sessionStrategy;
|
|
@@ -10755,7 +10991,7 @@ var Noydb = class {
|
|
|
10755
10991
|
if (!facade) return;
|
|
10756
10992
|
const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
|
|
10757
10993
|
await registry.runChecks(e.collection, incoming, ctx);
|
|
10758
|
-
const { GuardExecutor } = await import("./executor-
|
|
10994
|
+
const { GuardExecutor } = await import("./executor-JKMSEB34.js");
|
|
10759
10995
|
for (const g of guards) {
|
|
10760
10996
|
await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
|
|
10761
10997
|
}
|
|
@@ -11074,6 +11310,37 @@ var Noydb = class {
|
|
|
11074
11310
|
const keyring = await this.getKeyringInternal(vault);
|
|
11075
11311
|
await revoke(this.options.store, vault, keyring, options);
|
|
11076
11312
|
}
|
|
11313
|
+
/**
|
|
11314
|
+
* Grant the FR-6 `custodian` role to a user (owner-only custody API).
|
|
11315
|
+
*
|
|
11316
|
+
* A custodian operates every collection (rw + access) but is provably
|
|
11317
|
+
* unable to grant / revoke / rotate / extract-and-sever. Only the Deed
|
|
11318
|
+
* owner may mint one. Defended in depth: the `grant-custodian` gate
|
|
11319
|
+
* (fail-closed) AND an explicit `keyring.role !== 'owner'` check — the
|
|
11320
|
+
* gate enforces host policy, the role check enforces the cryptographic
|
|
11321
|
+
* owner-only invariant even if a host mis-configures the gate.
|
|
11322
|
+
*/
|
|
11323
|
+
async grantCustodian(vault, options, factors) {
|
|
11324
|
+
this.checkPolicyOperation(vault, "grant");
|
|
11325
|
+
await this.checkGate(vault, "grant-custodian", factors);
|
|
11326
|
+
const keyring = await this.getKeyringInternal(vault);
|
|
11327
|
+
if (keyring.role !== "owner") throw new PermissionDeniedError("only the Deed owner can grant a custodian");
|
|
11328
|
+
await grant(this.options.store, vault, keyring, { ...options, role: "custodian" });
|
|
11329
|
+
}
|
|
11330
|
+
/**
|
|
11331
|
+
* Revoke a custodian (owner-only custody API).
|
|
11332
|
+
*
|
|
11333
|
+
* Mirrors {@link revoke} but pins the caller to the Deed owner: defended
|
|
11334
|
+
* in depth by the `revoke-user` gate AND an explicit `keyring.role !==
|
|
11335
|
+
* 'owner'` check, so an admin cannot unwind a custodianship.
|
|
11336
|
+
*/
|
|
11337
|
+
async revokeCustodian(vault, options, factors) {
|
|
11338
|
+
this.checkPolicyOperation(vault, "revoke");
|
|
11339
|
+
await this.checkGate(vault, "revoke-user", factors);
|
|
11340
|
+
const keyring = await this.getKeyringInternal(vault);
|
|
11341
|
+
if (keyring.role !== "owner") throw new PermissionDeniedError("only the Deed owner can revoke a custodian");
|
|
11342
|
+
await revoke(this.options.store, vault, keyring, options);
|
|
11343
|
+
}
|
|
11077
11344
|
/**
|
|
11078
11345
|
* Mutate post-grant identity fields on an existing keyring — `role`,
|
|
11079
11346
|
* `displayName`, and/or `permissions`. Pure plaintext-header rewrite:
|
|
@@ -11343,52 +11610,24 @@ var Noydb = class {
|
|
|
11343
11610
|
return results;
|
|
11344
11611
|
}
|
|
11345
11612
|
/**
|
|
11346
|
-
*
|
|
11347
|
-
*
|
|
11613
|
+
* @internal True once `close()` has been called. Read by
|
|
11614
|
+
* `@klum-db/lobby`'s Lobby entry points (which can't see the private
|
|
11615
|
+
* `closed` field).
|
|
11348
11616
|
*/
|
|
11349
|
-
|
|
11350
|
-
this.
|
|
11617
|
+
get isClosed() {
|
|
11618
|
+
return this.closed;
|
|
11351
11619
|
}
|
|
11352
|
-
/**
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
* collection.
|
|
11356
|
-
*/
|
|
11357
|
-
async openVaultGroup(name, opts) {
|
|
11358
|
-
if (this.closed) throw new ValidationError("Instance is closed");
|
|
11359
|
-
if (name === STATE_VAULT_NAME) throw new ReservedVaultNameError(name);
|
|
11360
|
-
const template = this.vaultTemplates.get(opts.sharding.vaultTemplate);
|
|
11361
|
-
if (!template) throw new VaultTemplateNotFoundError(opts.sharding.vaultTemplate);
|
|
11362
|
-
const { VaultGroup } = await import("./vault-group-BB246VIM.js");
|
|
11363
|
-
const { StateManagementVault } = await import("./state-vault-JR3CFGNP.js");
|
|
11364
|
-
const stateVault = opts.registry ? void 0 : await StateManagementVault.open(this);
|
|
11365
|
-
const registry = opts.registry ?? stateVault.registry;
|
|
11366
|
-
const group = new VaultGroup(this, name, registry, opts.sharding, template, opts.migrateOnOpen ?? false);
|
|
11367
|
-
if (stateVault) {
|
|
11368
|
-
group._attachStateVault(stateVault);
|
|
11369
|
-
await stateVault.recordManifest(opts.sharding.vaultTemplate, template);
|
|
11370
|
-
try {
|
|
11371
|
-
await stateVault.appendEvent({
|
|
11372
|
-
type: "manifest-recorded",
|
|
11373
|
-
group: name,
|
|
11374
|
-
templateName: opts.sharding.vaultTemplate,
|
|
11375
|
-
version: template.version
|
|
11376
|
-
});
|
|
11377
|
-
await stateVault.appendEvent({ type: "group-opened", group: name });
|
|
11378
|
-
} catch {
|
|
11379
|
-
}
|
|
11380
|
-
}
|
|
11381
|
-
return group;
|
|
11620
|
+
/** @deprecated Federation moved to @klum-db/lobby. Use `createLobby(db).withVaultTemplate(...)`. */
|
|
11621
|
+
withVaultTemplate() {
|
|
11622
|
+
throw new FederationMovedError("withVaultTemplate");
|
|
11382
11623
|
}
|
|
11383
|
-
/**
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11624
|
+
/** @deprecated Federation moved to @klum-db/lobby. Use `createLobby(db).openVaultGroup(...)`. */
|
|
11625
|
+
async openVaultGroup() {
|
|
11626
|
+
throw new FederationMovedError("openVaultGroup");
|
|
11627
|
+
}
|
|
11628
|
+
/** @deprecated Federation moved to @klum-db/lobby. Use `createLobby(db).openStateManagementVault()`. */
|
|
11388
11629
|
async openStateManagementVault() {
|
|
11389
|
-
|
|
11390
|
-
const { StateManagementVault } = await import("./state-vault-JR3CFGNP.js");
|
|
11391
|
-
return StateManagementVault.open(this);
|
|
11630
|
+
throw new FederationMovedError("openStateManagementVault");
|
|
11392
11631
|
}
|
|
11393
11632
|
/**
|
|
11394
11633
|
* @internal — true when an encrypted shard vault is provisioned
|
|
@@ -12909,22 +13148,6 @@ export {
|
|
|
12909
13148
|
listWithdrawalRequests,
|
|
12910
13149
|
approveWithdrawal,
|
|
12911
13150
|
rejectWithdrawal,
|
|
12912
|
-
validateSchemaInput,
|
|
12913
|
-
validateSchemaOutput,
|
|
12914
|
-
isZodSchema,
|
|
12915
|
-
derivePersistedSchema,
|
|
12916
|
-
persistSchemaIfNeeded,
|
|
12917
|
-
isRefArray,
|
|
12918
|
-
RefIntegrityError,
|
|
12919
|
-
RefScopeError,
|
|
12920
|
-
ref,
|
|
12921
|
-
refArray,
|
|
12922
|
-
RefRegistry,
|
|
12923
|
-
isLinkCollectionName,
|
|
12924
|
-
LinkEndpointError,
|
|
12925
|
-
LinkIntegrityError,
|
|
12926
|
-
QuickUnlockStore,
|
|
12927
|
-
UserApi,
|
|
12928
13151
|
META_COLLECTION,
|
|
12929
13152
|
POLICY_RECORD_ID,
|
|
12930
13153
|
loadVaultPolicy,
|
|
@@ -12935,14 +13158,36 @@ export {
|
|
|
12935
13158
|
describeAllUsersAuth,
|
|
12936
13159
|
ComputedFieldError,
|
|
12937
13160
|
evalComputedFields,
|
|
13161
|
+
validateSchemaInput,
|
|
13162
|
+
validateSchemaOutput,
|
|
12938
13163
|
tokenize,
|
|
12939
13164
|
Lru,
|
|
12940
13165
|
parseBytes,
|
|
12941
13166
|
estimateRecordBytes,
|
|
12942
13167
|
Collection,
|
|
13168
|
+
isRefArray,
|
|
13169
|
+
RefIntegrityError,
|
|
13170
|
+
RefScopeError,
|
|
13171
|
+
ref,
|
|
13172
|
+
refArray,
|
|
13173
|
+
RefRegistry,
|
|
13174
|
+
isLinkCollectionName,
|
|
13175
|
+
LinkEndpointError,
|
|
13176
|
+
LinkIntegrityError,
|
|
13177
|
+
UserApi,
|
|
13178
|
+
CustodyApi,
|
|
13179
|
+
DEED_RECORD_ID,
|
|
13180
|
+
createDeedOwner,
|
|
13181
|
+
loadDeedMarker,
|
|
13182
|
+
isDeedVault,
|
|
13183
|
+
liberateVault,
|
|
13184
|
+
isZodSchema,
|
|
13185
|
+
derivePersistedSchema,
|
|
13186
|
+
persistSchemaIfNeeded,
|
|
12943
13187
|
Vault,
|
|
12944
13188
|
ELEVATION_AUDIT_COLLECTION,
|
|
12945
13189
|
ElevatedHandle,
|
|
13190
|
+
QuickUnlockStore,
|
|
12946
13191
|
PERSONAL_POLICY,
|
|
12947
13192
|
STRICT_POLICY,
|
|
12948
13193
|
mergePolicy,
|
|
@@ -12952,4 +13197,4 @@ export {
|
|
|
12952
13197
|
Noydb,
|
|
12953
13198
|
createNoydb
|
|
12954
13199
|
};
|
|
12955
|
-
//# sourceMappingURL=chunk-
|
|
13200
|
+
//# sourceMappingURL=chunk-QOXZM3L2.js.map
|