@noy-db/hub 0.2.0-pre.23 → 0.2.0-pre.25
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 +421 -1209
- 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 +42 -193
- package/dist/bundle/index.js.map +1 -1
- package/dist/{chunk-SQOK5UM6.js → chunk-2KA3PDUR.js} +2 -2
- package/dist/{chunk-HYJMAV53.js → chunk-2RHBFCWQ.js} +93 -93
- package/dist/chunk-2RHBFCWQ.js.map +1 -0
- package/dist/{chunk-U2XSUCDF.js → chunk-3BANVNDH.js} +2 -2
- package/dist/{chunk-P65YMN5V.js → chunk-56ENKU46.js} +397 -165
- package/dist/chunk-56ENKU46.js.map +1 -0
- package/dist/{chunk-37VGJM3T.js → chunk-7JSP3E67.js} +2 -2
- package/dist/{chunk-F5ILTHMU.js → chunk-ANLOD6IS.js} +5 -5
- package/dist/{chunk-JYNH4FIM.js → chunk-C7UIT5XY.js} +4 -4
- package/dist/{chunk-OTWT6BAJ.js → chunk-DDOYOMAD.js} +2 -2
- package/dist/chunk-DDOYOMAD.js.map +1 -0
- package/dist/{chunk-TGIJTNM3.js → chunk-E5TJAQS7.js} +2 -2
- package/dist/{chunk-IY24WS2P.js → chunk-EJJTUDNI.js} +4 -4
- package/dist/{chunk-IY24WS2P.js.map → chunk-EJJTUDNI.js.map} +1 -1
- package/dist/{chunk-GJTKMME7.js → chunk-EW3H5Y7N.js} +2 -2
- package/dist/{chunk-JDCPRJVS.js → chunk-EYZJULEN.js} +4 -4
- package/dist/{chunk-I3IYTUUI.js → chunk-FCIZXX56.js} +3 -3
- package/dist/{chunk-C2RJVZZL.js → chunk-FJ3C3ELF.js} +2 -2
- package/dist/{chunk-ZONKSLF2.js → chunk-FO5WEDKF.js} +2 -2
- package/dist/{chunk-SQKAECUL.js → chunk-FUDVHE2U.js} +2 -2
- package/dist/{chunk-IVZWHIEK.js → chunk-GHXOVGTX.js} +5 -5
- package/dist/{chunk-UU6M64HI.js → chunk-GPZHHTJU.js} +4 -4
- package/dist/{chunk-3HNKR65T.js → chunk-H4XFA2LM.js} +3 -3
- package/dist/{chunk-JOK73NDT.js → chunk-HUXDQIVU.js} +3 -3
- package/dist/{chunk-F5GWNSE2.js → chunk-J73KU4AE.js} +3 -3
- package/dist/{chunk-F5GWNSE2.js.map → chunk-J73KU4AE.js.map} +1 -1
- package/dist/{chunk-O5XKZCUD.js → chunk-JJKXJAH2.js} +5 -5
- package/dist/{chunk-TNH5SLCD.js → chunk-KD253AI5.js} +2 -2
- package/dist/{chunk-WWVJXBOT.js → chunk-KJ37E3R5.js} +5 -5
- package/dist/{chunk-S45MDEEF.js → chunk-KNJ7MK4B.js} +2 -2
- package/dist/{chunk-TA6HPKWQ.js → chunk-LR7CODVN.js} +1 -1
- package/dist/chunk-LR7CODVN.js.map +1 -0
- package/dist/{chunk-J6RGRZOY.js → chunk-LX4CPLU6.js} +2 -2
- package/dist/{chunk-WE2BUQD2.js → chunk-N4EXCKWP.js} +3 -3
- package/dist/{chunk-EYK72OTL.js → chunk-OCRDV3NU.js} +5 -5
- package/dist/chunk-OCRDV3NU.js.map +1 -0
- package/dist/{chunk-JBBWALNI.js → chunk-OMBPGXCL.js} +2 -2
- package/dist/{chunk-NV4IHBZS.js → chunk-PS6PSEZL.js} +5 -5
- package/dist/{chunk-6QE4DUYC.js → chunk-Q7P4WHTL.js} +2 -2
- package/dist/{chunk-TAMRU7A2.js → chunk-QYQRAOEF.js} +4 -4
- package/dist/{chunk-6QAZ5O6X.js → chunk-RHVYFAVQ.js} +2 -2
- package/dist/chunk-RZOGD7IF.js +232 -0
- package/dist/chunk-RZOGD7IF.js.map +1 -0
- package/dist/{chunk-YPIOFSN3.js → chunk-SKYBEGHB.js} +2 -2
- package/dist/{chunk-7MRT7EPB.js → chunk-TESFHBOW.js} +3 -3
- package/dist/{chunk-CQYEDODS.js → chunk-TSUICI5N.js} +3 -3
- package/dist/{chunk-FRRJIUSI.js → chunk-UNBX2HMA.js} +17 -9
- package/dist/chunk-UNBX2HMA.js.map +1 -0
- package/dist/{chunk-TYMDCIQM.js → chunk-VGAN5RLD.js} +4 -4
- package/dist/{chunk-5YTXYPES.js → chunk-VJNV2GRF.js} +5 -5
- package/dist/{chunk-NSXNXLYM.js → chunk-VUUQYWF5.js} +2 -2
- package/dist/{chunk-IW4L4X65.js → chunk-WVYL6HM7.js} +2 -2
- package/dist/{chunk-BZW5IL43.js → chunk-Y5CTT6K5.js} +4 -4
- package/dist/{chunk-C6W5KVDV.js → chunk-YP2AYE5W.js} +35 -35
- package/dist/chunk-YP2AYE5W.js.map +1 -0
- package/dist/{chunk-KOAJ3TZM.js → chunk-YRQPI67X.js} +2 -2
- package/dist/{chunk-MBXKRHSS.js → chunk-YYTM4U4J.js} +2 -2
- package/dist/{chunk-2XA2ZML4.js → chunk-ZCBJIDT4.js} +3 -3
- package/dist/{chunk-AI4USDRI.js → chunk-ZW2YSN6G.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-456N7UVX.js → crypto-YBKBNPVM.js} +3 -3
- package/dist/{ulid-Dwt3JEcy.d.ts → decrypt-partition-C71vhnND.d.cts} +19 -64
- package/dist/{ulid-Bg-IBJyA.d.cts → decrypt-partition-CyyJUWLR.d.ts} +19 -64
- package/dist/{delegation-DP4COTXB.js → delegation-4JSMM6BB.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-Bw7iBD1D.d.cts → dev-unlock-BdrE0kbS.d.cts} +1 -1
- package/dist/{dev-unlock-DzDzLTdZ.d.ts → dev-unlock-ByBkl99-.d.ts} +1 -1
- package/dist/{errors-Dkc_fi-S.d.cts → errors-Dwk2k1xY.d.cts} +14 -5
- package/dist/{errors-Dkc_fi-S.d.ts → errors-Dwk2k1xY.d.ts} +14 -5
- package/dist/executor-3SVNESQ3.js +8 -0
- package/dist/executor-BIW4FT5R.js +12 -0
- package/dist/executor-VEZUBJNQ.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-BUkDp_8Q.d.cts} +1 -1
- package/dist/{hash-DepR-xVc.d.ts → hash-CZxVv8RH.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-CBUhOmrM.d.cts +70 -0
- package/dist/index-DFhKV-6A.d.ts +70 -0
- package/dist/{index-tZqVB9g5.d.cts → index-DoxKSsMj.d.cts} +2 -2
- package/dist/{index-Bm9hIY7t.d.ts → index-LaexBi3v.d.ts} +2 -2
- package/dist/index.cjs +25660 -25495
- 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 +70 -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-LEBPVF3Y.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-FLRTSOYH.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-Cxf9B_Dm.d.cts → mime-magic-BAhLjkHw.d.cts} +1 -1
- package/dist/{mime-magic-Dejetix_.d.ts → mime-magic-C1UbcBxP.d.ts} +1 -1
- package/dist/noydb-6FA46A4M.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-DBKJEBBF.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-CMEVTOCN.js +8 -0
- package/dist/{registry-NWHOLD5M.js → registry-OUZ3VBZA.js} +3 -3
- package/dist/registry-XUBRO5JJ.js +8 -0
- package/dist/{revoke-5IEK22KT.js → revoke-P5D3UTRX.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-NEQPCHMW.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-KKCHF2VB.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-D1zjEV3n.d.cts} +1 -1
- package/dist/{strategy-54eIwox5.d.ts → strategy-YQ1qJWyq.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-Ctxapq1b.d.ts → transition-guard-BSLdikC_.d.ts} +1 -1
- package/dist/{transition-guard-BcLyTGYq.d.cts → transition-guard-DPs6al8h.d.cts} +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-Bhs2i_Ll.d.cts → types-BCYvhKzr.d.cts} +282 -578
- package/dist/{types-DONgts0n.d.ts → types-CCq0WHh9.d.ts} +282 -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-BYb3p9wT.d.cts → with-materialized-view-CTHe6uh9.d.cts} +1 -1
- package/dist/{with-materialized-view-CyVLOr09.d.ts → with-materialized-view-DiD41wQp.d.ts} +1 -1
- package/dist/{with-overlayed-view-BhLRxqwI.d.ts → with-overlayed-view-DlbsJMhF.d.ts} +1 -1
- package/dist/{with-overlayed-view-LGrQ984e.d.cts → with-overlayed-view-Dlz5hcM8.d.cts} +1 -1
- package/dist/{with-rollup-Bj8c7ttB.d.cts → with-rollup-BBWdrCvu.d.cts} +1 -1
- package/dist/{with-rollup-CO8ibRcK.d.ts → with-rollup-mT4_CWaU.d.ts} +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-SQOK5UM6.js.map → chunk-2KA3PDUR.js.map} +0 -0
- /package/dist/{chunk-U2XSUCDF.js.map → chunk-3BANVNDH.js.map} +0 -0
- /package/dist/{chunk-37VGJM3T.js.map → chunk-7JSP3E67.js.map} +0 -0
- /package/dist/{chunk-F5ILTHMU.js.map → chunk-ANLOD6IS.js.map} +0 -0
- /package/dist/{chunk-JYNH4FIM.js.map → chunk-C7UIT5XY.js.map} +0 -0
- /package/dist/{chunk-TGIJTNM3.js.map → chunk-E5TJAQS7.js.map} +0 -0
- /package/dist/{chunk-GJTKMME7.js.map → chunk-EW3H5Y7N.js.map} +0 -0
- /package/dist/{chunk-JDCPRJVS.js.map → chunk-EYZJULEN.js.map} +0 -0
- /package/dist/{chunk-I3IYTUUI.js.map → chunk-FCIZXX56.js.map} +0 -0
- /package/dist/{chunk-C2RJVZZL.js.map → chunk-FJ3C3ELF.js.map} +0 -0
- /package/dist/{chunk-ZONKSLF2.js.map → chunk-FO5WEDKF.js.map} +0 -0
- /package/dist/{chunk-SQKAECUL.js.map → chunk-FUDVHE2U.js.map} +0 -0
- /package/dist/{chunk-IVZWHIEK.js.map → chunk-GHXOVGTX.js.map} +0 -0
- /package/dist/{chunk-UU6M64HI.js.map → chunk-GPZHHTJU.js.map} +0 -0
- /package/dist/{chunk-3HNKR65T.js.map → chunk-H4XFA2LM.js.map} +0 -0
- /package/dist/{chunk-JOK73NDT.js.map → chunk-HUXDQIVU.js.map} +0 -0
- /package/dist/{chunk-O5XKZCUD.js.map → chunk-JJKXJAH2.js.map} +0 -0
- /package/dist/{chunk-TNH5SLCD.js.map → chunk-KD253AI5.js.map} +0 -0
- /package/dist/{chunk-WWVJXBOT.js.map → chunk-KJ37E3R5.js.map} +0 -0
- /package/dist/{chunk-S45MDEEF.js.map → chunk-KNJ7MK4B.js.map} +0 -0
- /package/dist/{chunk-J6RGRZOY.js.map → chunk-LX4CPLU6.js.map} +0 -0
- /package/dist/{chunk-WE2BUQD2.js.map → chunk-N4EXCKWP.js.map} +0 -0
- /package/dist/{chunk-JBBWALNI.js.map → chunk-OMBPGXCL.js.map} +0 -0
- /package/dist/{chunk-NV4IHBZS.js.map → chunk-PS6PSEZL.js.map} +0 -0
- /package/dist/{chunk-6QE4DUYC.js.map → chunk-Q7P4WHTL.js.map} +0 -0
- /package/dist/{chunk-TAMRU7A2.js.map → chunk-QYQRAOEF.js.map} +0 -0
- /package/dist/{chunk-6QAZ5O6X.js.map → chunk-RHVYFAVQ.js.map} +0 -0
- /package/dist/{chunk-YPIOFSN3.js.map → chunk-SKYBEGHB.js.map} +0 -0
- /package/dist/{chunk-7MRT7EPB.js.map → chunk-TESFHBOW.js.map} +0 -0
- /package/dist/{chunk-CQYEDODS.js.map → chunk-TSUICI5N.js.map} +0 -0
- /package/dist/{chunk-TYMDCIQM.js.map → chunk-VGAN5RLD.js.map} +0 -0
- /package/dist/{chunk-5YTXYPES.js.map → chunk-VJNV2GRF.js.map} +0 -0
- /package/dist/{chunk-NSXNXLYM.js.map → chunk-VUUQYWF5.js.map} +0 -0
- /package/dist/{chunk-IW4L4X65.js.map → chunk-WVYL6HM7.js.map} +0 -0
- /package/dist/{chunk-BZW5IL43.js.map → chunk-Y5CTT6K5.js.map} +0 -0
- /package/dist/{chunk-KOAJ3TZM.js.map → chunk-YRQPI67X.js.map} +0 -0
- /package/dist/{chunk-MBXKRHSS.js.map → chunk-YYTM4U4J.js.map} +0 -0
- /package/dist/{chunk-2XA2ZML4.js.map → chunk-ZCBJIDT4.js.map} +0 -0
- /package/dist/{chunk-AI4USDRI.js.map → chunk-ZW2YSN6G.js.map} +0 -0
- /package/dist/{crypto-456N7UVX.js.map → crypto-YBKBNPVM.js.map} +0 -0
- /package/dist/{delegation-DP4COTXB.js.map → delegation-4JSMM6BB.js.map} +0 -0
- /package/dist/{executor-4IEW4KG5.js.map → executor-3SVNESQ3.js.map} +0 -0
- /package/dist/{executor-KYJCJCIN.js.map → executor-BIW4FT5R.js.map} +0 -0
- /package/dist/{executor-W7VIBOBZ.js.map → executor-VEZUBJNQ.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-LEBPVF3Y.js.map} +0 -0
- /package/dist/{ledger-I7JUYP4L.js.map → kernel/index.js.map} +0 -0
- /package/dist/{noydb-VGR2HLDB.js.map → ledger-FLRTSOYH.js.map} +0 -0
- /package/dist/{public-envelope-5XRTUNKF.js.map → noydb-6FA46A4M.js.map} +0 -0
- /package/dist/{registry-ATRHOG5B.js.map → public-envelope-DBKJEBBF.js.map} +0 -0
- /package/dist/{registry-LEHB26TY.js.map → registry-CMEVTOCN.js.map} +0 -0
- /package/dist/{registry-NWHOLD5M.js.map → registry-OUZ3VBZA.js.map} +0 -0
- /package/dist/{revoke-5IEK22KT.js.map → registry-XUBRO5JJ.js.map} +0 -0
- /package/dist/{signer-I6YARZQA.js.map → revoke-P5D3UTRX.js.map} +0 -0
- /package/dist/{stale-CPESGAPL.js.map → signer-NEQPCHMW.js.map} +0 -0
- /package/dist/{state-vault-JR3CFGNP.js.map → stale-KKCHF2VB.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-EJJTUDNI.js";
|
|
11
8
|
import {
|
|
12
9
|
OverlayedCollection
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YYTM4U4J.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-PS6PSEZL.js";
|
|
24
21
|
import {
|
|
25
22
|
EXPORT_AUDIT_COLLECTION,
|
|
26
23
|
createExportBlobsHandle,
|
|
27
24
|
runCompaction
|
|
28
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZCBJIDT4.js";
|
|
29
26
|
import {
|
|
30
27
|
LazyQuery,
|
|
31
28
|
decodeIdxId,
|
|
32
29
|
encodeIdxId
|
|
33
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-H4XFA2LM.js";
|
|
34
31
|
import {
|
|
35
32
|
canonicalGroupKey
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-C7UIT5XY.js";
|
|
37
34
|
import {
|
|
38
35
|
readPath
|
|
39
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-3BANVNDH.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-YP2AYE5W.js";
|
|
47
44
|
import {
|
|
48
45
|
writeNoydbBundle
|
|
49
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-N4EXCKWP.js";
|
|
50
47
|
import {
|
|
51
48
|
loadPublicEnvelope,
|
|
52
49
|
readPublicEnvelope,
|
|
53
50
|
savePublicEnvelope,
|
|
54
51
|
validatePublicEnvelopeInput
|
|
55
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-HUXDQIVU.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-Y5CTT6K5.js";
|
|
65
62
|
import {
|
|
66
63
|
PERIODS_COLLECTION
|
|
67
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-FCIZXX56.js";
|
|
68
65
|
import {
|
|
69
66
|
isDictCollectionName,
|
|
70
67
|
isStaticDictDescriptor
|
|
71
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-JJKXJAH2.js";
|
|
72
69
|
import {
|
|
73
70
|
getAtPath,
|
|
74
71
|
resolvePolicy,
|
|
75
72
|
setAtPathInPlace
|
|
76
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-KD253AI5.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-2RHBFCWQ.js";
|
|
99
96
|
import {
|
|
100
97
|
assertTierAccess,
|
|
101
98
|
dekKey
|
|
102
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-J73KU4AE.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-UNBX2HMA.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-EYZJULEN.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-TSUICI5N.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-7JSP3E67.js";
|
|
162
160
|
import {
|
|
163
161
|
AlreadyElevatedError,
|
|
164
162
|
AttestationError,
|
|
@@ -184,7 +182,6 @@ import {
|
|
|
184
182
|
QuiesceTimeoutError,
|
|
185
183
|
ReadOnlyError,
|
|
186
184
|
ReservedCollectionNameError,
|
|
187
|
-
ReservedVaultNameError,
|
|
188
185
|
SchemaFenceError,
|
|
189
186
|
SchemaValidationError,
|
|
190
187
|
SequenceContentionError,
|
|
@@ -197,9 +194,8 @@ import {
|
|
|
197
194
|
UniqueConstraintError,
|
|
198
195
|
UnknownDictCodeError,
|
|
199
196
|
UnsupportedIndexOptionError,
|
|
200
|
-
ValidationError
|
|
201
|
-
|
|
202
|
-
} from "./chunk-OTWT6BAJ.js";
|
|
197
|
+
ValidationError
|
|
198
|
+
} from "./chunk-DDOYOMAD.js";
|
|
203
199
|
|
|
204
200
|
// src/policy/storage.ts
|
|
205
201
|
var META_COLLECTION = "_meta";
|
|
@@ -913,7 +909,7 @@ async function resolveStaleOnRead(accessor, outputCollection, id) {
|
|
|
913
909
|
}
|
|
914
910
|
const sourceWithId = { ...source, id };
|
|
915
911
|
if (DerivationExecutor === null) {
|
|
916
|
-
({ DerivationExecutor } = await import("./executor-
|
|
912
|
+
({ DerivationExecutor } = await import("./executor-VEZUBJNQ.js"));
|
|
917
913
|
}
|
|
918
914
|
const ctx = { vault: accessor.getReadOnlyFacade() };
|
|
919
915
|
const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
|
|
@@ -1159,6 +1155,13 @@ var Collection = class {
|
|
|
1159
1155
|
* flag) still decrypts CEK records.
|
|
1160
1156
|
*/
|
|
1161
1157
|
perRecordCek;
|
|
1158
|
+
/**
|
|
1159
|
+
* Per-record provenance opt-in (`provenance: true`). When set, `put()` calls
|
|
1160
|
+
* that supply a `source` option stamp `_source`/`_sourceTs` onto the
|
|
1161
|
+
* unencrypted envelope metadata. Off by default — zero cost for collections
|
|
1162
|
+
* that don't need lineage tracking (FR-5, #445).
|
|
1163
|
+
*/
|
|
1164
|
+
provenance;
|
|
1162
1165
|
/**
|
|
1163
1166
|
* Session-scoped `(id) → CEK` cache for this collection. Lets updates
|
|
1164
1167
|
* reuse a record's stable CEK and lets repeated reads skip the AES-KW
|
|
@@ -1318,6 +1321,7 @@ var Collection = class {
|
|
|
1318
1321
|
}
|
|
1319
1322
|
this.perRecordCek = opts.perRecordKeys === true;
|
|
1320
1323
|
this.cekCache = this.perRecordCek ? new Lru({ maxRecords: 4096 }) : null;
|
|
1324
|
+
this.provenance = opts.provenance === true;
|
|
1321
1325
|
if (opts.crdt && opts.onRegisterConflictResolver) {
|
|
1322
1326
|
const crdtMode = opts.crdt;
|
|
1323
1327
|
const crdtResolver = async (id, local, remote) => {
|
|
@@ -1462,7 +1466,7 @@ var Collection = class {
|
|
|
1462
1466
|
}
|
|
1463
1467
|
}
|
|
1464
1468
|
if (this.materializedViewSource !== void 0) {
|
|
1465
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
1469
|
+
const { resolveStaleMVOnRead } = await import("./stale-KKCHF2VB.js");
|
|
1466
1470
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
1467
1471
|
}
|
|
1468
1472
|
let record;
|
|
@@ -1505,6 +1509,33 @@ var Collection = class {
|
|
|
1505
1509
|
if (json === null) return null;
|
|
1506
1510
|
return JSON.parse(json);
|
|
1507
1511
|
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Read a record's unencrypted envelope metadata (version, timestamps,
|
|
1514
|
+
* provenance) without decrypting the body.
|
|
1515
|
+
*
|
|
1516
|
+
* Returns `null` when no envelope exists for `id` (record absent or never
|
|
1517
|
+
* written). Only `_source`/`_sourceTs` fields are populated when the
|
|
1518
|
+
* collection was opened with `provenance: true` AND the record was written
|
|
1519
|
+
* with a `source` option — but this method works on any collection because
|
|
1520
|
+
* it reads the raw envelope directly.
|
|
1521
|
+
*
|
|
1522
|
+
* @returns `{ version, timestamp, by?, source?, sourceTs? }` or `null`.
|
|
1523
|
+
*
|
|
1524
|
+
* @example
|
|
1525
|
+
* const meta = await clients.getMetadata('c1')
|
|
1526
|
+
* if (meta) console.log(meta.source, meta.timestamp)
|
|
1527
|
+
*/
|
|
1528
|
+
async getMetadata(id) {
|
|
1529
|
+
const env = await this.adapter.get(this.vault, this.name, id);
|
|
1530
|
+
if (!env) return null;
|
|
1531
|
+
return {
|
|
1532
|
+
version: env._v,
|
|
1533
|
+
timestamp: env._ts,
|
|
1534
|
+
...env._by !== void 0 ? { by: env._by } : {},
|
|
1535
|
+
...env._source !== void 0 ? { source: env._source } : {},
|
|
1536
|
+
...env._sourceTs !== void 0 ? { sourceTs: env._sourceTs } : {}
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1508
1539
|
/**
|
|
1509
1540
|
* Return a presence handle for this collection.
|
|
1510
1541
|
*
|
|
@@ -1542,6 +1573,14 @@ var Collection = class {
|
|
|
1542
1573
|
* `reason` is stamped onto the resulting ledger entry
|
|
1543
1574
|
* so audit consumers can filter via
|
|
1544
1575
|
* `entries.filter(e => e.reason?.startsWith('import:'))`.
|
|
1576
|
+
* `source` is an opaque source id (e.g. `'crm-sync'`, `'firm-A'`)
|
|
1577
|
+
* stamped onto the envelope as `_source`/`_sourceTs` when
|
|
1578
|
+
* the collection has `provenance: true`. Ignored otherwise
|
|
1579
|
+
* (zero cost). (FR-5, #445)
|
|
1580
|
+
* `sourceTs` is an optional ISO-8601 origin timestamp override;
|
|
1581
|
+
* when supplied together with `source` on a provenance collection,
|
|
1582
|
+
* replaces the machine-stamped `now()` so re-merges preserve the
|
|
1583
|
+
* ORIGIN refresh time across vaults. (FR-4)
|
|
1545
1584
|
*/
|
|
1546
1585
|
async put(id, record, options) {
|
|
1547
1586
|
await this.schemaUpdateGate?.assertWritable();
|
|
@@ -1573,6 +1612,20 @@ var Collection = class {
|
|
|
1573
1612
|
if (busAfterPut) await this.subsystemBus.dispatch("afterPut", event);
|
|
1574
1613
|
}
|
|
1575
1614
|
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Validate a record against this collection's schema WITHOUT writing it.
|
|
1617
|
+
* Returns the (possibly coerced) record on success; throws
|
|
1618
|
+
* {@link SchemaValidationError} (direction: `'input'`) on violation.
|
|
1619
|
+
* A no-op pass-through when no schema is declared.
|
|
1620
|
+
*
|
|
1621
|
+
* Used by FR-8 migrate-then-merge to pre-validate all staged records
|
|
1622
|
+
* before `mergeDecryptedRecords` writes anything — so a failed upgrade
|
|
1623
|
+
* never half-writes the receiver.
|
|
1624
|
+
*/
|
|
1625
|
+
async validateInput(record) {
|
|
1626
|
+
if (this.schema === void 0) return record;
|
|
1627
|
+
return validateSchemaInput(this.schema, record, `validateInput(${this.name})`);
|
|
1628
|
+
}
|
|
1576
1629
|
/** @internal — true when hooks should fire for this write (handlers exist, not re-entrant). */
|
|
1577
1630
|
#hooksActive() {
|
|
1578
1631
|
return this.writeHooks !== void 0 && this.writeHooks.hasHandlers && !this.writeHooks.suppressed;
|
|
@@ -1730,7 +1783,7 @@ var Collection = class {
|
|
|
1730
1783
|
}
|
|
1731
1784
|
const version2 = existingVersion + 1;
|
|
1732
1785
|
const cek2 = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
1733
|
-
const envelope2 = await this.encryptJsonString(JSON.stringify(crdtState), version2, cek2);
|
|
1786
|
+
const envelope2 = await this.encryptJsonString(JSON.stringify(crdtState), version2, cek2, options?.source, options?.sourceTs);
|
|
1734
1787
|
await this.adapter.put(this.vault, this.name, id, envelope2);
|
|
1735
1788
|
const resolvedRecord = this.crdtStrategy.resolveCrdtSnapshot(crdtState);
|
|
1736
1789
|
const existingResolvedRecord = existingEnvelope ? await this.decryptRecord(existingEnvelope, { skipValidation: true }) : null;
|
|
@@ -1809,7 +1862,7 @@ var Collection = class {
|
|
|
1809
1862
|
});
|
|
1810
1863
|
}
|
|
1811
1864
|
}
|
|
1812
|
-
const envelope = await this.encryptRecord(record, version, cek);
|
|
1865
|
+
const envelope = await this.encryptRecord(record, version, cek, options?.source, options?.sourceTs);
|
|
1813
1866
|
await this.adapter.put(this.vault, this.name, id, envelope);
|
|
1814
1867
|
if (this.ledger) {
|
|
1815
1868
|
const appendInput = {
|
|
@@ -1872,7 +1925,7 @@ var Collection = class {
|
|
|
1872
1925
|
if (mode === "eager") {
|
|
1873
1926
|
if (executor === null) {
|
|
1874
1927
|
;
|
|
1875
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
1928
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-BIW4FT5R.js"));
|
|
1876
1929
|
}
|
|
1877
1930
|
await executor.refresh(reg, {
|
|
1878
1931
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -1881,7 +1934,7 @@ var Collection = class {
|
|
|
1881
1934
|
});
|
|
1882
1935
|
} else if (mode === "lazy") {
|
|
1883
1936
|
if (staleHelpers === null) {
|
|
1884
|
-
staleHelpers = await import("./stale-
|
|
1937
|
+
staleHelpers = await import("./stale-KKCHF2VB.js");
|
|
1885
1938
|
}
|
|
1886
1939
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
1887
1940
|
}
|
|
@@ -2055,7 +2108,7 @@ var Collection = class {
|
|
|
2055
2108
|
continue;
|
|
2056
2109
|
}
|
|
2057
2110
|
if (DerivationExecutor === null) {
|
|
2058
|
-
({ DerivationExecutor } = await import("./executor-
|
|
2111
|
+
({ DerivationExecutor } = await import("./executor-VEZUBJNQ.js"));
|
|
2059
2112
|
}
|
|
2060
2113
|
for (const run of runs) {
|
|
2061
2114
|
const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
|
|
@@ -2074,7 +2127,7 @@ var Collection = class {
|
|
|
2074
2127
|
const outputCollection = this.derivationSource.getCollection(outSpec.collection);
|
|
2075
2128
|
const txCtx = this.derivationSource.getActiveTxContext();
|
|
2076
2129
|
if (out.kind === "array") {
|
|
2077
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
2130
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-ZQT4Y7PF.js");
|
|
2078
2131
|
const prior = await loadFanoutSidecar(
|
|
2079
2132
|
this.adapter,
|
|
2080
2133
|
this.vault,
|
|
@@ -2102,7 +2155,7 @@ var Collection = class {
|
|
|
2102
2155
|
priorEnvelope
|
|
2103
2156
|
});
|
|
2104
2157
|
}
|
|
2105
|
-
await outputCollection.put(entry.key, entry.value);
|
|
2158
|
+
await outputCollection.put(entry.key, entry.value, { source: "derived" });
|
|
2106
2159
|
}
|
|
2107
2160
|
await saveFanoutSidecar(this.adapter, this.vault, {
|
|
2108
2161
|
source: spec.source,
|
|
@@ -2135,7 +2188,7 @@ var Collection = class {
|
|
|
2135
2188
|
priorEnvelope: prior
|
|
2136
2189
|
});
|
|
2137
2190
|
}
|
|
2138
|
-
await outputCollection.put(run.runId, patched);
|
|
2191
|
+
await outputCollection.put(run.runId, patched, { source: "derived" });
|
|
2139
2192
|
continue;
|
|
2140
2193
|
}
|
|
2141
2194
|
if (txCtx !== null) {
|
|
@@ -2150,7 +2203,7 @@ var Collection = class {
|
|
|
2150
2203
|
priorEnvelope: prior
|
|
2151
2204
|
});
|
|
2152
2205
|
}
|
|
2153
|
-
await outputCollection.put(run.runId, out.value);
|
|
2206
|
+
await outputCollection.put(run.runId, out.value, { source: "derived" });
|
|
2154
2207
|
}
|
|
2155
2208
|
}
|
|
2156
2209
|
}
|
|
@@ -2437,7 +2490,7 @@ var Collection = class {
|
|
|
2437
2490
|
for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
|
|
2438
2491
|
if (outSpec.shape !== "array") continue;
|
|
2439
2492
|
if (helpers === null) {
|
|
2440
|
-
helpers = await import("./fanout-sidecar-
|
|
2493
|
+
helpers = await import("./fanout-sidecar-ZQT4Y7PF.js");
|
|
2441
2494
|
}
|
|
2442
2495
|
const sidecar = await helpers.loadFanoutSidecar(
|
|
2443
2496
|
this.adapter,
|
|
@@ -2477,7 +2530,7 @@ var Collection = class {
|
|
|
2477
2530
|
if (mode === "eager") {
|
|
2478
2531
|
if (executor === null) {
|
|
2479
2532
|
;
|
|
2480
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
2533
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-BIW4FT5R.js"));
|
|
2481
2534
|
}
|
|
2482
2535
|
await executor.refresh(reg, {
|
|
2483
2536
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -2486,7 +2539,7 @@ var Collection = class {
|
|
|
2486
2539
|
});
|
|
2487
2540
|
} else if (mode === "lazy") {
|
|
2488
2541
|
if (staleHelpers === null) {
|
|
2489
|
-
staleHelpers = await import("./stale-
|
|
2542
|
+
staleHelpers = await import("./stale-KKCHF2VB.js");
|
|
2490
2543
|
}
|
|
2491
2544
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
2492
2545
|
}
|
|
@@ -2509,7 +2562,7 @@ var Collection = class {
|
|
|
2509
2562
|
);
|
|
2510
2563
|
}
|
|
2511
2564
|
if (this.materializedViewSource !== void 0) {
|
|
2512
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
2565
|
+
const { resolveStaleMVOnRead } = await import("./stale-KKCHF2VB.js");
|
|
2513
2566
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
2514
2567
|
}
|
|
2515
2568
|
await this.ensureHydrated();
|
|
@@ -3813,7 +3866,7 @@ var Collection = class {
|
|
|
3813
3866
|
* (see {@link encryptRecord}). Rejects `_`-prefixed record fields, which
|
|
3814
3867
|
* would collide with the reserved metadata namespace.
|
|
3815
3868
|
*/
|
|
3816
|
-
buildDebugEnvelope(record, version) {
|
|
3869
|
+
buildDebugEnvelope(record, version, source, sourceTs) {
|
|
3817
3870
|
const rec = record;
|
|
3818
3871
|
for (const key of Object.keys(rec)) {
|
|
3819
3872
|
if (key.startsWith("_")) throw new DebugReservedFieldError(this.name, key);
|
|
@@ -3826,11 +3879,13 @@ var Collection = class {
|
|
|
3826
3879
|
_data: "",
|
|
3827
3880
|
_by: this.keyring.userId,
|
|
3828
3881
|
_debug: NOYDB_FORMAT_VERSION,
|
|
3882
|
+
...this.provenance && source !== void 0 ? { _source: source, _sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {},
|
|
3829
3883
|
...rec
|
|
3830
3884
|
};
|
|
3831
3885
|
}
|
|
3832
|
-
async encryptJsonString(json, version, cek) {
|
|
3886
|
+
async encryptJsonString(json, version, cek, source, sourceTs) {
|
|
3833
3887
|
const by = this.keyring.userId;
|
|
3888
|
+
const provenanceFields = this.provenance && source !== void 0 ? { _source: source, _sourceTs: sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {};
|
|
3834
3889
|
if (!this.encrypted) {
|
|
3835
3890
|
return {
|
|
3836
3891
|
_noydb: NOYDB_FORMAT_VERSION,
|
|
@@ -3838,7 +3893,8 @@ var Collection = class {
|
|
|
3838
3893
|
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3839
3894
|
_iv: "",
|
|
3840
3895
|
_data: json,
|
|
3841
|
-
_by: by
|
|
3896
|
+
_by: by,
|
|
3897
|
+
...provenanceFields
|
|
3842
3898
|
};
|
|
3843
3899
|
}
|
|
3844
3900
|
const dek = await this.getDEK(this.name);
|
|
@@ -3852,7 +3908,8 @@ var Collection = class {
|
|
|
3852
3908
|
_iv: iv2,
|
|
3853
3909
|
_data: data2,
|
|
3854
3910
|
_by: by,
|
|
3855
|
-
_cek: wrapped
|
|
3911
|
+
_cek: wrapped,
|
|
3912
|
+
...provenanceFields
|
|
3856
3913
|
};
|
|
3857
3914
|
}
|
|
3858
3915
|
const { iv, data } = await encrypt(json, dek);
|
|
@@ -3862,14 +3919,15 @@ var Collection = class {
|
|
|
3862
3919
|
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3863
3920
|
_iv: iv,
|
|
3864
3921
|
_data: data,
|
|
3865
|
-
_by: by
|
|
3922
|
+
_by: by,
|
|
3923
|
+
...provenanceFields
|
|
3866
3924
|
};
|
|
3867
3925
|
}
|
|
3868
|
-
async encryptRecord(record, version, cek) {
|
|
3926
|
+
async encryptRecord(record, version, cek, source, sourceTs) {
|
|
3869
3927
|
if (!this.encrypted && this.keyring.debugPlaintext === true && !this.name.startsWith("_")) {
|
|
3870
|
-
return this.buildDebugEnvelope(record, version);
|
|
3928
|
+
return this.buildDebugEnvelope(record, version, source, sourceTs);
|
|
3871
3929
|
}
|
|
3872
|
-
const base = await this.encryptJsonString(JSON.stringify(record), version, cek);
|
|
3930
|
+
const base = await this.encryptJsonString(JSON.stringify(record), version, cek, source, sourceTs);
|
|
3873
3931
|
if (!this.deterministicFields || !this.encrypted) return base;
|
|
3874
3932
|
const dek = await this.getDEK(this.name);
|
|
3875
3933
|
const rec = record;
|
|
@@ -4003,7 +4061,8 @@ var Collection = class {
|
|
|
4003
4061
|
_iv: iv,
|
|
4004
4062
|
_data: data,
|
|
4005
4063
|
_by: this.keyring.userId,
|
|
4006
|
-
...tier > 0 && { _tier: tier }
|
|
4064
|
+
...tier > 0 && { _tier: tier },
|
|
4065
|
+
...this.provenance && opts?.source !== void 0 ? { _source: opts.source, _sourceTs: opts.sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {}
|
|
4007
4066
|
};
|
|
4008
4067
|
await this.adapter.put(this.vault, this.name, id, envelope);
|
|
4009
4068
|
if (tier > 0) {
|
|
@@ -4341,43 +4400,49 @@ function randomId() {
|
|
|
4341
4400
|
const b = globalThis.crypto.getRandomValues(new Uint8Array(12));
|
|
4342
4401
|
return Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
|
|
4343
4402
|
}
|
|
4344
|
-
async function
|
|
4403
|
+
async function freezeSnapshotOnly(vault, collections, opts) {
|
|
4345
4404
|
const { name: vaultName, adapter } = vault._introspectState();
|
|
4346
4405
|
const closure = [];
|
|
4347
4406
|
for (const c of collections) {
|
|
4348
4407
|
for (const id of await adapter.list(vaultName, c)) closure.push({ collection: c, id });
|
|
4349
4408
|
}
|
|
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
|
-
}
|
|
4409
|
+
const withdrawalId = opts.withdrawalId ?? `wd-${randomId()}`;
|
|
4410
|
+
const snap = {};
|
|
4379
4411
|
for (const { collection, id } of closure) {
|
|
4380
|
-
await
|
|
4412
|
+
const env = await adapter.get(vaultName, collection, id);
|
|
4413
|
+
if (env) (snap[collection] ??= {})[id] = env;
|
|
4414
|
+
}
|
|
4415
|
+
const frozenAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4416
|
+
const body = JSON.stringify({ withdrawalId, frozenAt, by: opts.actorUserId, collections: snap });
|
|
4417
|
+
const sha = await sha256Hex(ENC.encode(body));
|
|
4418
|
+
await adapter.put(
|
|
4419
|
+
vaultName,
|
|
4420
|
+
FROZEN_SNAPSHOTS_COLLECTION,
|
|
4421
|
+
withdrawalId,
|
|
4422
|
+
{ _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: frozenAt, _iv: "", _data: body, _by: opts.actorUserId },
|
|
4423
|
+
0
|
|
4424
|
+
);
|
|
4425
|
+
await vault._getLedgerOrNull()?.append({
|
|
4426
|
+
op: "lifecycle",
|
|
4427
|
+
collection: "",
|
|
4428
|
+
id: "",
|
|
4429
|
+
version: 0,
|
|
4430
|
+
actor: opts.actorUserId,
|
|
4431
|
+
payloadHash: "",
|
|
4432
|
+
reason: `withdrawal-frozen-snapshot:${withdrawalId}:${sha}`
|
|
4433
|
+
});
|
|
4434
|
+
return { withdrawalId, sha256: sha, recordCount: closure.length, frozenAt };
|
|
4435
|
+
}
|
|
4436
|
+
async function freezeAndDeleteClosure(vault, collections, opts) {
|
|
4437
|
+
const snapshot = opts.disposition === "freeze" ? await freezeSnapshotOnly(vault, collections, {
|
|
4438
|
+
actorUserId: opts.actorUserId,
|
|
4439
|
+
...opts.withdrawalId ? { withdrawalId: opts.withdrawalId } : {}
|
|
4440
|
+
}) : void 0;
|
|
4441
|
+
const { name: vaultName, adapter } = vault._introspectState();
|
|
4442
|
+
for (const c of collections) {
|
|
4443
|
+
for (const id of await adapter.list(vaultName, c)) {
|
|
4444
|
+
await vault.collection(c).delete(id);
|
|
4445
|
+
}
|
|
4381
4446
|
}
|
|
4382
4447
|
return snapshot;
|
|
4383
4448
|
}
|
|
@@ -4389,6 +4454,11 @@ async function withdrawAccessibleData(vault, opts) {
|
|
|
4389
4454
|
"unilateralWithdrawal is the scoped self-service path; an owner/admin should use extractPartition"
|
|
4390
4455
|
);
|
|
4391
4456
|
}
|
|
4457
|
+
if (keyring.role === "custodian") {
|
|
4458
|
+
throw new ReadOnlyError(
|
|
4459
|
+
"a custodian cannot destructively withdraw/sever; use vault.custody.liberate for an audited ownership claim"
|
|
4460
|
+
);
|
|
4461
|
+
}
|
|
4392
4462
|
if (keyring.role === "client" || keyring.role === "viewer") {
|
|
4393
4463
|
throw new ReadOnlyError(
|
|
4394
4464
|
"read-only role cannot self-serve a destructive withdrawal \u2014 use requestWithdrawal (two-party)"
|
|
@@ -5578,6 +5648,148 @@ function isPlainObject(x) {
|
|
|
5578
5648
|
return proto === Object.prototype || proto === null;
|
|
5579
5649
|
}
|
|
5580
5650
|
|
|
5651
|
+
// src/custody/index.ts
|
|
5652
|
+
var CustodyApi = class {
|
|
5653
|
+
constructor(_grantCustodian, _revokeCustodian, _liberate) {
|
|
5654
|
+
this._grantCustodian = _grantCustodian;
|
|
5655
|
+
this._revokeCustodian = _revokeCustodian;
|
|
5656
|
+
this._liberate = _liberate;
|
|
5657
|
+
}
|
|
5658
|
+
_grantCustodian;
|
|
5659
|
+
_revokeCustodian;
|
|
5660
|
+
_liberate;
|
|
5661
|
+
/**
|
|
5662
|
+
* Owner-only: grant the FR-6 `custodian` role. The custodian operates every
|
|
5663
|
+
* collection (rw + access) but is provably unable to grant / revoke / rotate /
|
|
5664
|
+
* extract-and-sever. Defended in depth (gate + owner-only role check) inside
|
|
5665
|
+
* the injected `Noydb.grantCustodian`.
|
|
5666
|
+
*/
|
|
5667
|
+
async grantCustodian(options, factors) {
|
|
5668
|
+
return this._grantCustodian(options, factors);
|
|
5669
|
+
}
|
|
5670
|
+
/** Owner-only: revoke a custodian. */
|
|
5671
|
+
async revokeCustodian(options, factors) {
|
|
5672
|
+
return this._revokeCustodian(options, factors);
|
|
5673
|
+
}
|
|
5674
|
+
/**
|
|
5675
|
+
* Custodian-only: the audited claim of ownership over a sealed-owner (Deed)
|
|
5676
|
+
* vault. Mints a DISTINCT new owner re-wrapping the incumbent DEKs under a
|
|
5677
|
+
* fresh KEK (the latent owner is never impersonated), ledger-audited. See
|
|
5678
|
+
* {@link liberateVault}.
|
|
5679
|
+
*/
|
|
5680
|
+
async liberate(opts) {
|
|
5681
|
+
return this._liberate(opts);
|
|
5682
|
+
}
|
|
5683
|
+
};
|
|
5684
|
+
|
|
5685
|
+
// src/team/deed.ts
|
|
5686
|
+
var DEED_RECORD_ID = "deed";
|
|
5687
|
+
async function createDeedOwner(store, vault, ownerUserId, sealing) {
|
|
5688
|
+
const passphrase = await resolveManagedSecret(store, vault, sealing);
|
|
5689
|
+
const keyring = await createOwnerKeyring(store, vault, ownerUserId, passphrase);
|
|
5690
|
+
await saveDeedMarker(store, vault, {
|
|
5691
|
+
ownerUserId,
|
|
5692
|
+
sealedUnder: sealing.id,
|
|
5693
|
+
latent: true,
|
|
5694
|
+
issuedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5695
|
+
});
|
|
5696
|
+
return keyring;
|
|
5697
|
+
}
|
|
5698
|
+
async function loadDeedMarker(store, vault) {
|
|
5699
|
+
const envelope = await store.get(vault, "_meta", DEED_RECORD_ID);
|
|
5700
|
+
if (!envelope) return null;
|
|
5701
|
+
let payload;
|
|
5702
|
+
try {
|
|
5703
|
+
payload = JSON.parse(envelope._data);
|
|
5704
|
+
} catch {
|
|
5705
|
+
return null;
|
|
5706
|
+
}
|
|
5707
|
+
if (typeof payload !== "object" || payload === null) return null;
|
|
5708
|
+
const r = payload;
|
|
5709
|
+
if (r._noydb_deed !== 1) return null;
|
|
5710
|
+
if (typeof r.ownerUserId !== "string" || typeof r.sealedUnder !== "string" || r.latent !== true || typeof r.issuedAt !== "string") {
|
|
5711
|
+
return null;
|
|
5712
|
+
}
|
|
5713
|
+
const marker = {
|
|
5714
|
+
ownerUserId: r.ownerUserId,
|
|
5715
|
+
sealedUnder: r.sealedUnder,
|
|
5716
|
+
latent: true,
|
|
5717
|
+
issuedAt: r.issuedAt,
|
|
5718
|
+
...typeof r.liberatedAt === "string" ? { liberatedAt: r.liberatedAt } : {}
|
|
5719
|
+
};
|
|
5720
|
+
return marker;
|
|
5721
|
+
}
|
|
5722
|
+
async function isDeedVault(store, vault) {
|
|
5723
|
+
return await loadDeedMarker(store, vault) !== null;
|
|
5724
|
+
}
|
|
5725
|
+
async function saveDeedMarker(store, vault, marker) {
|
|
5726
|
+
const persisted = { _noydb_deed: 1, ...marker };
|
|
5727
|
+
const prior = await store.get(vault, "_meta", DEED_RECORD_ID);
|
|
5728
|
+
const env = {
|
|
5729
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
5730
|
+
_v: (prior?._v ?? 0) + 1,
|
|
5731
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5732
|
+
// AES-GCM bypassed — the marker is plaintext audit metadata.
|
|
5733
|
+
_iv: "",
|
|
5734
|
+
_data: JSON.stringify(persisted)
|
|
5735
|
+
};
|
|
5736
|
+
await store.put(vault, "_meta", DEED_RECORD_ID, env);
|
|
5737
|
+
}
|
|
5738
|
+
|
|
5739
|
+
// src/custody/liberate.ts
|
|
5740
|
+
async function liberateVault(vault, opts) {
|
|
5741
|
+
await vault.noydb.checkGate(vault.name, "liberate-vault", opts.factors);
|
|
5742
|
+
const { name: vaultName, adapter, keyring } = vault._introspectState();
|
|
5743
|
+
if (keyring.role !== "custodian") {
|
|
5744
|
+
throw new PermissionDeniedError(
|
|
5745
|
+
"liberation is claimed only by the custodian (the de-facto authority holding the DEKs)"
|
|
5746
|
+
);
|
|
5747
|
+
}
|
|
5748
|
+
const existing = await adapter.get(vaultName, "_keyring", opts.newOwnerId);
|
|
5749
|
+
if (existing) {
|
|
5750
|
+
throw new PermissionDeniedError(
|
|
5751
|
+
`liberateVault: newOwnerId "${opts.newOwnerId}" already exists as a principal; choose a fresh id (liberation mints a distinct owner, it never overwrites an existing keyring)`
|
|
5752
|
+
);
|
|
5753
|
+
}
|
|
5754
|
+
const collections = await listOperationalCollections(vault);
|
|
5755
|
+
const snapshot = await freezeSnapshotOnly(vault, collections, { actorUserId: keyring.userId });
|
|
5756
|
+
const newOwner = await createOwnerKeyring(adapter, vaultName, opts.newOwnerId, opts.newOwnerPassphrase);
|
|
5757
|
+
if (!newOwner.kek) {
|
|
5758
|
+
throw new PermissionDeniedError(
|
|
5759
|
+
`new owner keyring for "${opts.newOwnerId}" has no KEK to re-wrap the incumbent DEKs under`
|
|
5760
|
+
);
|
|
5761
|
+
}
|
|
5762
|
+
const env = await adapter.get(vaultName, "_keyring", opts.newOwnerId);
|
|
5763
|
+
if (!env) {
|
|
5764
|
+
throw new PermissionDeniedError(`new owner keyring for "${opts.newOwnerId}" did not persist`);
|
|
5765
|
+
}
|
|
5766
|
+
const keyringFile = JSON.parse(env._data);
|
|
5767
|
+
const mergedDeks = { ...keyringFile.deks };
|
|
5768
|
+
for (const [collection, dek] of keyring.deks) {
|
|
5769
|
+
mergedDeks[collection] = await wrapKey(dek, newOwner.kek);
|
|
5770
|
+
}
|
|
5771
|
+
const mergedFile = { ...keyringFile, deks: mergedDeks };
|
|
5772
|
+
await adapter.put(vaultName, "_keyring", opts.newOwnerId, { ...env, _data: JSON.stringify(mergedFile) });
|
|
5773
|
+
await vault._getLedgerOrNull()?.append({
|
|
5774
|
+
op: "lifecycle",
|
|
5775
|
+
collection: "",
|
|
5776
|
+
id: "",
|
|
5777
|
+
version: 0,
|
|
5778
|
+
actor: opts.newOwnerId,
|
|
5779
|
+
payloadHash: "",
|
|
5780
|
+
reason: `liberation-claimed:${opts.newOwnerId}:${opts.legalBasis}`
|
|
5781
|
+
});
|
|
5782
|
+
const marker = await loadDeedMarker(adapter, vaultName);
|
|
5783
|
+
if (marker) {
|
|
5784
|
+
await saveDeedMarker(adapter, vaultName, { ...marker, liberatedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
5785
|
+
}
|
|
5786
|
+
return { snapshot };
|
|
5787
|
+
}
|
|
5788
|
+
async function listOperationalCollections(vault) {
|
|
5789
|
+
const { keyring } = vault._introspectState();
|
|
5790
|
+
return [...keyring.deks.keys()].filter((c) => !c.startsWith("_"));
|
|
5791
|
+
}
|
|
5792
|
+
|
|
5581
5793
|
// src/persisted-schemas/canonicalize.ts
|
|
5582
5794
|
function canonicalize(value) {
|
|
5583
5795
|
if (value === null || typeof value !== "object") {
|
|
@@ -6360,6 +6572,18 @@ var Vault = class {
|
|
|
6360
6572
|
* @see docs/superpowers/specs/2026-05-05-user-envelope-design.md
|
|
6361
6573
|
*/
|
|
6362
6574
|
user;
|
|
6575
|
+
/**
|
|
6576
|
+
* FR-6 custody API — the sovereign-custody surface, mirroring `vault.user.*`.
|
|
6577
|
+
*
|
|
6578
|
+
* - `grantCustodian(opts)` / `revokeCustodian(opts)` — owner-only: mint /
|
|
6579
|
+
* remove a `custodian` who operates the vault fully but can never grant /
|
|
6580
|
+
* rotate / sever / extract.
|
|
6581
|
+
* - `liberate(opts)` — custodian-only: the audited claim of ownership over a
|
|
6582
|
+
* sealed-owner (Deed) vault (mints a DISTINCT new owner; ledger-audited).
|
|
6583
|
+
*
|
|
6584
|
+
* @see docs/superpowers/specs/2026-06-17-fr6-deed-custodian-liberate-design.md
|
|
6585
|
+
*/
|
|
6586
|
+
custody;
|
|
6363
6587
|
/**
|
|
6364
6588
|
* Optional callback that re-derives an UnlockedKeyring from the
|
|
6365
6589
|
* adapter using the active user's passphrase. Called by `load()`
|
|
@@ -6570,6 +6794,11 @@ var Vault = class {
|
|
|
6570
6794
|
(requestId, opts2) => approveWithdrawal(this, requestId, opts2),
|
|
6571
6795
|
(requestId, opts2) => rejectWithdrawal(this, requestId, opts2)
|
|
6572
6796
|
);
|
|
6797
|
+
this.custody = new CustodyApi(
|
|
6798
|
+
(options, factors) => this.noydb.grantCustodian(this.name, options, factors),
|
|
6799
|
+
(options, factors) => this.noydb.revokeCustodian(this.name, options, factors),
|
|
6800
|
+
(opts2) => liberateVault(this, opts2)
|
|
6801
|
+
);
|
|
6573
6802
|
}
|
|
6574
6803
|
/**
|
|
6575
6804
|
* Construct (or reconstruct) the lazy DEK resolver. Captures the
|
|
@@ -6797,6 +7026,7 @@ var Vault = class {
|
|
|
6797
7026
|
}
|
|
6798
7027
|
collOpts.perRecordKeys = true;
|
|
6799
7028
|
}
|
|
7029
|
+
if (options?.provenance !== void 0) collOpts.provenance = options.provenance;
|
|
6800
7030
|
if (options?.tiers !== void 0) collOpts.tiers = options.tiers;
|
|
6801
7031
|
if (options?.tierMode !== void 0) collOpts.tierMode = options.tierMode;
|
|
6802
7032
|
collOpts.onCrossTierAccess = (event) => this.emitCrossTier(event);
|
|
@@ -7481,12 +7711,12 @@ var Vault = class {
|
|
|
7481
7711
|
if (!fieldSchema) {
|
|
7482
7712
|
throw new AttestationError(`issueAttestation: collection '${collectionName}' has no attestation field-schema. Declare it via vault.collection('${collectionName}', { attestation: { fields: [...] } }).`);
|
|
7483
7713
|
}
|
|
7484
|
-
const { issueAttestationCore } = await import("./issue-
|
|
7714
|
+
const { issueAttestationCore } = await import("./issue-LEBPVF3Y.js");
|
|
7485
7715
|
const out = await issueAttestationCore(this.makeIssueContext(), { collection: collectionName, id, fieldSchema });
|
|
7486
7716
|
return { docId: out.docId, qr: out.qr, keyId: out.keyId, publicKeyB64: out.publicKeyB64 };
|
|
7487
7717
|
}
|
|
7488
7718
|
async getDocumentSigningPublicKey() {
|
|
7489
|
-
const { loadSigner, loadOrCreateSigner } = await import("./signer-
|
|
7719
|
+
const { loadSigner, loadOrCreateSigner } = await import("./signer-NEQPCHMW.js");
|
|
7490
7720
|
const existing = await loadSigner(this.adapter, this.name, this.getDEK);
|
|
7491
7721
|
if (existing) return { keyId: existing.keyId, publicKeyB64: existing.publicKeyB64 };
|
|
7492
7722
|
if (this.keyring.role !== "owner") {
|
|
@@ -7512,19 +7742,19 @@ var Vault = class {
|
|
|
7512
7742
|
};
|
|
7513
7743
|
}
|
|
7514
7744
|
async revokeAttestation(docId) {
|
|
7515
|
-
const { revokeDocCore } = await import("./revoke-
|
|
7745
|
+
const { revokeDocCore } = await import("./revoke-P5D3UTRX.js");
|
|
7516
7746
|
await revokeDocCore(this.makeRevokeContext(), docId);
|
|
7517
7747
|
}
|
|
7518
7748
|
async unrevokeAttestation(docId) {
|
|
7519
|
-
const { unrevokeDocCore } = await import("./revoke-
|
|
7749
|
+
const { unrevokeDocCore } = await import("./revoke-P5D3UTRX.js");
|
|
7520
7750
|
await unrevokeDocCore(this.makeRevokeContext(), docId);
|
|
7521
7751
|
}
|
|
7522
7752
|
async getRevokedDocIds() {
|
|
7523
|
-
const { getRevokedDocIdsCore } = await import("./revoke-
|
|
7753
|
+
const { getRevokedDocIdsCore } = await import("./revoke-P5D3UTRX.js");
|
|
7524
7754
|
return getRevokedDocIdsCore(this.makeRevokeContext());
|
|
7525
7755
|
}
|
|
7526
7756
|
async publishRevocationList() {
|
|
7527
|
-
const { publishRevocationListCore } = await import("./revoke-
|
|
7757
|
+
const { publishRevocationListCore } = await import("./revoke-P5D3UTRX.js");
|
|
7528
7758
|
return publishRevocationListCore(this.makeRevokeContext());
|
|
7529
7759
|
}
|
|
7530
7760
|
makeRevokeContext() {
|
|
@@ -8183,7 +8413,7 @@ var Vault = class {
|
|
|
8183
8413
|
async _initDerivations(handles) {
|
|
8184
8414
|
if (handles.length === 0) return;
|
|
8185
8415
|
const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
8186
|
-
import("./registry-
|
|
8416
|
+
import("./registry-CMEVTOCN.js"),
|
|
8187
8417
|
import("./read-only-facade-EX6WZZBP.js")
|
|
8188
8418
|
]);
|
|
8189
8419
|
const registry = new DerivationRegistry();
|
|
@@ -8214,7 +8444,7 @@ var Vault = class {
|
|
|
8214
8444
|
*/
|
|
8215
8445
|
async _initMaterializedViews(handles) {
|
|
8216
8446
|
if (handles.length === 0) return;
|
|
8217
|
-
const { MaterializedViewRegistry } = await import("./registry-
|
|
8447
|
+
const { MaterializedViewRegistry } = await import("./registry-OUZ3VBZA.js");
|
|
8218
8448
|
const registry = new MaterializedViewRegistry();
|
|
8219
8449
|
this.materializedViewRegistry = registry;
|
|
8220
8450
|
const db = this;
|
|
@@ -8238,7 +8468,7 @@ var Vault = class {
|
|
|
8238
8468
|
*/
|
|
8239
8469
|
async _initOverlayedViews(handles) {
|
|
8240
8470
|
if (handles.length === 0) return;
|
|
8241
|
-
const { OverlayedViewRegistry } = await import("./registry-
|
|
8471
|
+
const { OverlayedViewRegistry } = await import("./registry-XUBRO5JJ.js");
|
|
8242
8472
|
const registry = new OverlayedViewRegistry();
|
|
8243
8473
|
const mvRegistry = this.materializedViewRegistry;
|
|
8244
8474
|
const overlayNames = /* @__PURE__ */ new Set();
|
|
@@ -8285,13 +8515,13 @@ var Vault = class {
|
|
|
8285
8515
|
if (!reg) {
|
|
8286
8516
|
throw new Error(`refreshView: no MV registered with name "${name}"`);
|
|
8287
8517
|
}
|
|
8288
|
-
const { MaterializedViewExecutor } = await import("./executor-
|
|
8518
|
+
const { MaterializedViewExecutor } = await import("./executor-BIW4FT5R.js");
|
|
8289
8519
|
const result = await MaterializedViewExecutor.refresh(reg, {
|
|
8290
8520
|
getCollection: (n) => this.collection(n),
|
|
8291
8521
|
getActiveTxContext: () => this.noydb._activeTxContextOrNull,
|
|
8292
8522
|
getQueryContext: () => this
|
|
8293
8523
|
});
|
|
8294
|
-
const { clearMVStale } = await import("./stale-
|
|
8524
|
+
const { clearMVStale } = await import("./stale-KKCHF2VB.js");
|
|
8295
8525
|
clearMVStale(registry, name);
|
|
8296
8526
|
return result;
|
|
8297
8527
|
}
|
|
@@ -8307,7 +8537,7 @@ var Vault = class {
|
|
|
8307
8537
|
if (registry === null) return { derived: 0, failed: 0 };
|
|
8308
8538
|
const strategies = registry.strategiesForSource(sourceCollection);
|
|
8309
8539
|
if (strategies.length === 0) return { derived: 0, failed: 0 };
|
|
8310
|
-
const { DerivationExecutor } = await import("./executor-
|
|
8540
|
+
const { DerivationExecutor } = await import("./executor-VEZUBJNQ.js");
|
|
8311
8541
|
const sourceColl = this.collection(sourceCollection);
|
|
8312
8542
|
const records = await sourceColl.list();
|
|
8313
8543
|
const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-EX6WZZBP.js")).ReadOnlyVaultFacade(this, "derivation") };
|
|
@@ -8332,7 +8562,7 @@ var Vault = class {
|
|
|
8332
8562
|
if (!outSpec) continue;
|
|
8333
8563
|
const outputColl = this.collection(outSpec.collection);
|
|
8334
8564
|
if (out.kind === "array") {
|
|
8335
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
8565
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-ZQT4Y7PF.js");
|
|
8336
8566
|
const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key);
|
|
8337
8567
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
8338
8568
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -8554,7 +8784,7 @@ var Vault = class {
|
|
|
8554
8784
|
* collection.
|
|
8555
8785
|
*/
|
|
8556
8786
|
async delegate(opts) {
|
|
8557
|
-
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
8787
|
+
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-4JSMM6BB.js");
|
|
8558
8788
|
if (!this.keyring.kek) {
|
|
8559
8789
|
throw new ValidationError(
|
|
8560
8790
|
"issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
|
|
@@ -8576,7 +8806,7 @@ var Vault = class {
|
|
|
8576
8806
|
* if the id does not exist.
|
|
8577
8807
|
*/
|
|
8578
8808
|
async revokeDelegation(id) {
|
|
8579
|
-
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
8809
|
+
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-4JSMM6BB.js");
|
|
8580
8810
|
await revokeDelegation(this.adapter, this.name, id);
|
|
8581
8811
|
void DELEGATIONS_COLLECTION;
|
|
8582
8812
|
}
|
|
@@ -8619,7 +8849,7 @@ var Vault = class {
|
|
|
8619
8849
|
if (this.activeElevation) {
|
|
8620
8850
|
throw new AlreadyElevatedError(this.activeElevation.tier);
|
|
8621
8851
|
}
|
|
8622
|
-
if (this.keyring.role !== "owner" && this.keyring.role !== "admin") {
|
|
8852
|
+
if (this.keyring.role !== "owner" && this.keyring.role !== "admin" && this.keyring.role !== "custodian") {
|
|
8623
8853
|
const suffix = `#${tier}`;
|
|
8624
8854
|
let found = false;
|
|
8625
8855
|
for (const k of this.keyring.deks.keys()) {
|
|
@@ -9046,7 +9276,7 @@ var Vault = class {
|
|
|
9046
9276
|
* @see docs/subsystems/public-envelope.md
|
|
9047
9277
|
*/
|
|
9048
9278
|
async getPublicEnvelope(opts = {}) {
|
|
9049
|
-
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-
|
|
9279
|
+
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-DBKJEBBF.js");
|
|
9050
9280
|
return readPublicEnvelope2(this.adapter, this.name, opts);
|
|
9051
9281
|
}
|
|
9052
9282
|
/**
|
|
@@ -10563,6 +10793,12 @@ var ROLE_RANK = {
|
|
|
10563
10793
|
client: 1,
|
|
10564
10794
|
viewer: 2,
|
|
10565
10795
|
operator: 3,
|
|
10796
|
+
// FR-6: custodian is operationally admin-rank (rw + access on every
|
|
10797
|
+
// collection) — it ranks alongside admin for "how much can this
|
|
10798
|
+
// principal see/operate." It is NOT above admin, and explicitly below
|
|
10799
|
+
// owner: a custodian can never grant/revoke/rotate/sever (those are
|
|
10800
|
+
// owner meta-capabilities), so it must not outrank or equal the owner.
|
|
10801
|
+
custodian: 4,
|
|
10566
10802
|
admin: 4,
|
|
10567
10803
|
owner: 5
|
|
10568
10804
|
};
|
|
@@ -10624,7 +10860,6 @@ var Noydb = class {
|
|
|
10624
10860
|
writeRelay;
|
|
10625
10861
|
/** Per-vault policy enforcers. */
|
|
10626
10862
|
policyEnforcers = /* @__PURE__ */ new Map();
|
|
10627
|
-
vaultTemplates = /* @__PURE__ */ new Map();
|
|
10628
10863
|
txStrategy;
|
|
10629
10864
|
forgetStrategy;
|
|
10630
10865
|
sessionStrategy;
|
|
@@ -10755,7 +10990,7 @@ var Noydb = class {
|
|
|
10755
10990
|
if (!facade) return;
|
|
10756
10991
|
const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
|
|
10757
10992
|
await registry.runChecks(e.collection, incoming, ctx);
|
|
10758
|
-
const { GuardExecutor } = await import("./executor-
|
|
10993
|
+
const { GuardExecutor } = await import("./executor-3SVNESQ3.js");
|
|
10759
10994
|
for (const g of guards) {
|
|
10760
10995
|
await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
|
|
10761
10996
|
}
|
|
@@ -11074,6 +11309,37 @@ var Noydb = class {
|
|
|
11074
11309
|
const keyring = await this.getKeyringInternal(vault);
|
|
11075
11310
|
await revoke(this.options.store, vault, keyring, options);
|
|
11076
11311
|
}
|
|
11312
|
+
/**
|
|
11313
|
+
* Grant the FR-6 `custodian` role to a user (owner-only custody API).
|
|
11314
|
+
*
|
|
11315
|
+
* A custodian operates every collection (rw + access) but is provably
|
|
11316
|
+
* unable to grant / revoke / rotate / extract-and-sever. Only the Deed
|
|
11317
|
+
* owner may mint one. Defended in depth: the `grant-custodian` gate
|
|
11318
|
+
* (fail-closed) AND an explicit `keyring.role !== 'owner'` check — the
|
|
11319
|
+
* gate enforces host policy, the role check enforces the cryptographic
|
|
11320
|
+
* owner-only invariant even if a host mis-configures the gate.
|
|
11321
|
+
*/
|
|
11322
|
+
async grantCustodian(vault, options, factors) {
|
|
11323
|
+
this.checkPolicyOperation(vault, "grant");
|
|
11324
|
+
await this.checkGate(vault, "grant-custodian", factors);
|
|
11325
|
+
const keyring = await this.getKeyringInternal(vault);
|
|
11326
|
+
if (keyring.role !== "owner") throw new PermissionDeniedError("only the Deed owner can grant a custodian");
|
|
11327
|
+
await grant(this.options.store, vault, keyring, { ...options, role: "custodian" });
|
|
11328
|
+
}
|
|
11329
|
+
/**
|
|
11330
|
+
* Revoke a custodian (owner-only custody API).
|
|
11331
|
+
*
|
|
11332
|
+
* Mirrors {@link revoke} but pins the caller to the Deed owner: defended
|
|
11333
|
+
* in depth by the `revoke-user` gate AND an explicit `keyring.role !==
|
|
11334
|
+
* 'owner'` check, so an admin cannot unwind a custodianship.
|
|
11335
|
+
*/
|
|
11336
|
+
async revokeCustodian(vault, options, factors) {
|
|
11337
|
+
this.checkPolicyOperation(vault, "revoke");
|
|
11338
|
+
await this.checkGate(vault, "revoke-user", factors);
|
|
11339
|
+
const keyring = await this.getKeyringInternal(vault);
|
|
11340
|
+
if (keyring.role !== "owner") throw new PermissionDeniedError("only the Deed owner can revoke a custodian");
|
|
11341
|
+
await revoke(this.options.store, vault, keyring, options);
|
|
11342
|
+
}
|
|
11077
11343
|
/**
|
|
11078
11344
|
* Mutate post-grant identity fields on an existing keyring — `role`,
|
|
11079
11345
|
* `displayName`, and/or `permissions`. Pure plaintext-header rewrite:
|
|
@@ -11343,52 +11609,12 @@ var Noydb = class {
|
|
|
11343
11609
|
return results;
|
|
11344
11610
|
}
|
|
11345
11611
|
/**
|
|
11346
|
-
*
|
|
11347
|
-
*
|
|
11612
|
+
* @internal True once `close()` has been called. Read by outward
|
|
11613
|
+
* orchestration frameworks whose entry points can't see the private
|
|
11614
|
+
* `closed` field.
|
|
11348
11615
|
*/
|
|
11349
|
-
|
|
11350
|
-
this.
|
|
11351
|
-
}
|
|
11352
|
-
/**
|
|
11353
|
-
* Open a VaultGroup — transparent routing over per-partition shard
|
|
11354
|
-
* vaults, with shard discovery backed by the supplied `vault-registry`
|
|
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;
|
|
11382
|
-
}
|
|
11383
|
-
/**
|
|
11384
|
-
* Open the reserved StateManagement control-plane vault (registry +
|
|
11385
|
-
* schema-manifest + deployment-events). Lazy-loaded so the federation
|
|
11386
|
-
* chunk stays out of the core graph until used.
|
|
11387
|
-
*/
|
|
11388
|
-
async openStateManagementVault() {
|
|
11389
|
-
if (this.closed) throw new ValidationError("Instance is closed");
|
|
11390
|
-
const { StateManagementVault } = await import("./state-vault-JR3CFGNP.js");
|
|
11391
|
-
return StateManagementVault.open(this);
|
|
11616
|
+
get isClosed() {
|
|
11617
|
+
return this.closed;
|
|
11392
11618
|
}
|
|
11393
11619
|
/**
|
|
11394
11620
|
* @internal — true when an encrypted shard vault is provisioned
|
|
@@ -12909,22 +13135,6 @@ export {
|
|
|
12909
13135
|
listWithdrawalRequests,
|
|
12910
13136
|
approveWithdrawal,
|
|
12911
13137
|
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
13138
|
META_COLLECTION,
|
|
12929
13139
|
POLICY_RECORD_ID,
|
|
12930
13140
|
loadVaultPolicy,
|
|
@@ -12935,14 +13145,36 @@ export {
|
|
|
12935
13145
|
describeAllUsersAuth,
|
|
12936
13146
|
ComputedFieldError,
|
|
12937
13147
|
evalComputedFields,
|
|
13148
|
+
validateSchemaInput,
|
|
13149
|
+
validateSchemaOutput,
|
|
12938
13150
|
tokenize,
|
|
12939
13151
|
Lru,
|
|
12940
13152
|
parseBytes,
|
|
12941
13153
|
estimateRecordBytes,
|
|
12942
13154
|
Collection,
|
|
13155
|
+
isRefArray,
|
|
13156
|
+
RefIntegrityError,
|
|
13157
|
+
RefScopeError,
|
|
13158
|
+
ref,
|
|
13159
|
+
refArray,
|
|
13160
|
+
RefRegistry,
|
|
13161
|
+
isLinkCollectionName,
|
|
13162
|
+
LinkEndpointError,
|
|
13163
|
+
LinkIntegrityError,
|
|
13164
|
+
UserApi,
|
|
13165
|
+
CustodyApi,
|
|
13166
|
+
DEED_RECORD_ID,
|
|
13167
|
+
createDeedOwner,
|
|
13168
|
+
loadDeedMarker,
|
|
13169
|
+
isDeedVault,
|
|
13170
|
+
liberateVault,
|
|
13171
|
+
isZodSchema,
|
|
13172
|
+
derivePersistedSchema,
|
|
13173
|
+
persistSchemaIfNeeded,
|
|
12943
13174
|
Vault,
|
|
12944
13175
|
ELEVATION_AUDIT_COLLECTION,
|
|
12945
13176
|
ElevatedHandle,
|
|
13177
|
+
QuickUnlockStore,
|
|
12946
13178
|
PERSONAL_POLICY,
|
|
12947
13179
|
STRICT_POLICY,
|
|
12948
13180
|
mergePolicy,
|
|
@@ -12952,4 +13184,4 @@ export {
|
|
|
12952
13184
|
Noydb,
|
|
12953
13185
|
createNoydb
|
|
12954
13186
|
};
|
|
12955
|
-
//# sourceMappingURL=chunk-
|
|
13187
|
+
//# sourceMappingURL=chunk-56ENKU46.js.map
|