@noy-db/hub 0.6.0-pre.16 → 0.6.0-pre.18
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/{api-NAY63UIE.js → api-FRFEJ6WR.js} +6 -6
- package/dist/attestation/index.js +12 -12
- package/dist/{backup-M2VND2VS.js → backup-OLBRFYY7.js} +10 -10
- package/dist/{backup-M2VND2VS.js.map → backup-OLBRFYY7.js.map} +1 -1
- package/dist/blobs/index.js +8 -8
- package/dist/broker/index.js +6 -6
- package/dist/cargo/index.js +26 -26
- package/dist/{chunk-4CSG6KBX.js → chunk-2ION5ZRH.js} +17 -14
- package/dist/chunk-2ION5ZRH.js.map +1 -0
- package/dist/{chunk-466KGOQB.js → chunk-2NE7ILO7.js} +2 -2
- package/dist/{chunk-CZV57HHC.js → chunk-3KXIGMZ4.js} +2 -2
- package/dist/{chunk-5CH4DWQA.js → chunk-3ODOWQMV.js} +13 -14
- package/dist/chunk-3ODOWQMV.js.map +1 -0
- package/dist/{chunk-3OEWD45V.js → chunk-3RZ7QLJ4.js} +5 -5
- package/dist/{chunk-SFY6NT7D.js → chunk-3Y4OFWQJ.js} +1 -1
- package/dist/chunk-3Y4OFWQJ.js.map +1 -0
- package/dist/{chunk-FZ2SSI5R.js → chunk-6AL6O4CS.js} +2 -2
- package/dist/{chunk-4XEUSZWN.js → chunk-6D3CN2JR.js} +2 -2
- package/dist/{chunk-6UAVKAG6.js → chunk-6QCXMCLZ.js} +3 -3
- package/dist/{chunk-B4G3JPH5.js → chunk-7EH322GJ.js} +14 -7
- package/dist/chunk-7EH322GJ.js.map +1 -0
- package/dist/{chunk-AMKCY454.js → chunk-7WD2G6K4.js} +7 -2
- package/dist/{chunk-AMKCY454.js.map → chunk-7WD2G6K4.js.map} +1 -1
- package/dist/{chunk-VUUUIKRG.js → chunk-A5QQKWCK.js} +14 -23
- package/dist/chunk-A5QQKWCK.js.map +1 -0
- package/dist/{chunk-RRMXMJUP.js → chunk-AA2WWTS3.js} +9 -7
- package/dist/chunk-AA2WWTS3.js.map +1 -0
- package/dist/{chunk-WMUN7ZUD.js → chunk-AA7LM2A3.js} +2 -2
- package/dist/{chunk-PJGMBELR.js → chunk-AIZNLHKN.js} +4 -4
- package/dist/chunk-AIZNLHKN.js.map +1 -0
- package/dist/{chunk-MKSTUVMJ.js → chunk-AMMYIT7F.js} +35 -31
- package/dist/chunk-AMMYIT7F.js.map +1 -0
- package/dist/{chunk-TWPTRJEU.js → chunk-BBU3OD3D.js} +2 -2
- package/dist/{chunk-OJEDR25M.js → chunk-BVIGGV6D.js} +33 -45
- package/dist/chunk-BVIGGV6D.js.map +1 -0
- package/dist/{chunk-IQGIPRSE.js → chunk-CFTPERGL.js} +14 -11
- package/dist/chunk-CFTPERGL.js.map +1 -0
- package/dist/{chunk-T6CCRXD3.js → chunk-CGQUSSW7.js} +26 -142
- package/dist/chunk-CGQUSSW7.js.map +1 -0
- package/dist/{chunk-4JDTLWUZ.js → chunk-DFFSCYIW.js} +9 -9
- package/dist/{chunk-JZVXGOJE.js → chunk-DKYEVHZH.js} +7 -10
- package/dist/chunk-DKYEVHZH.js.map +1 -0
- package/dist/{chunk-YVOW35HH.js → chunk-DL4GDOWL.js} +4 -6
- package/dist/chunk-DL4GDOWL.js.map +1 -0
- package/dist/{chunk-LGGLPURL.js → chunk-DWO55ZWE.js} +13 -22
- package/dist/chunk-DWO55ZWE.js.map +1 -0
- package/dist/{chunk-MKV2KYRV.js → chunk-ER3BQCCE.js} +2 -2
- package/dist/{chunk-JU3JKOY5.js → chunk-EWAGI3EM.js} +2 -2
- package/dist/{chunk-WMZQCXZ5.js → chunk-EZ3UHHND.js} +13 -15
- package/dist/chunk-EZ3UHHND.js.map +1 -0
- package/dist/{chunk-5TF5DUQ5.js → chunk-FDIZHZ3C.js} +29 -47
- package/dist/chunk-FDIZHZ3C.js.map +1 -0
- package/dist/{chunk-56W3T5O2.js → chunk-FOABWV7L.js} +45 -18
- package/dist/chunk-FOABWV7L.js.map +1 -0
- package/dist/{chunk-H5U4T6JK.js → chunk-FRGF56PD.js} +11 -14
- package/dist/chunk-FRGF56PD.js.map +1 -0
- package/dist/{chunk-53PWELSC.js → chunk-FY33DKPH.js} +2 -2
- package/dist/{chunk-KKRFL5E2.js → chunk-GSRW5MTU.js} +220 -169
- package/dist/chunk-GSRW5MTU.js.map +1 -0
- package/dist/{chunk-4VRZDYRE.js → chunk-HJRTFXAA.js} +7 -10
- package/dist/chunk-HJRTFXAA.js.map +1 -0
- package/dist/chunk-HK67PX4J.js +27 -0
- package/dist/chunk-HK67PX4J.js.map +1 -0
- package/dist/{chunk-A3WHDOWI.js → chunk-IN5EZWYQ.js} +13 -14
- package/dist/chunk-IN5EZWYQ.js.map +1 -0
- package/dist/{chunk-PZLIA5R3.js → chunk-ITXPKEDP.js} +23 -29
- package/dist/chunk-ITXPKEDP.js.map +1 -0
- package/dist/{chunk-343FH4S5.js → chunk-JYFJNSTW.js} +9 -9
- package/dist/chunk-JYFJNSTW.js.map +1 -0
- package/dist/{chunk-35RIRCGW.js → chunk-KLVGF2D4.js} +11 -9
- package/dist/{chunk-35RIRCGW.js.map → chunk-KLVGF2D4.js.map} +1 -1
- package/dist/{chunk-7LLKPODL.js → chunk-LPAGIMXJ.js} +2 -2
- package/dist/{chunk-3JQVA527.js → chunk-LU6NPJWN.js} +3 -3
- package/dist/{chunk-UVFO25FJ.js → chunk-NAAPSNCS.js} +90 -33
- package/dist/chunk-NAAPSNCS.js.map +1 -0
- package/dist/{chunk-OPGKH5RD.js → chunk-NFPSC2HL.js} +3 -3
- package/dist/{chunk-55B3KHZW.js → chunk-NRNTXBHT.js} +7 -10
- package/dist/chunk-NRNTXBHT.js.map +1 -0
- package/dist/{chunk-I5OLA3H6.js → chunk-O4QDBAB6.js} +7 -10
- package/dist/{chunk-I5OLA3H6.js.map → chunk-O4QDBAB6.js.map} +1 -1
- package/dist/{chunk-4DJQU3PH.js → chunk-OCCNYGKG.js} +7 -7
- package/dist/{chunk-76FBDG6M.js → chunk-OZD3D2DZ.js} +10 -13
- package/dist/chunk-OZD3D2DZ.js.map +1 -0
- package/dist/{chunk-YX6J3Z3Z.js → chunk-PBPYQZDW.js} +2 -2
- package/dist/{chunk-TTAND7MR.js → chunk-PBRIHUQ5.js} +5 -5
- package/dist/{chunk-TTAND7MR.js.map → chunk-PBRIHUQ5.js.map} +1 -1
- package/dist/{chunk-NBLLQOMR.js → chunk-Q67P7S2I.js} +14 -15
- package/dist/chunk-Q67P7S2I.js.map +1 -0
- package/dist/{chunk-NY6RQBUN.js → chunk-RAYGDC4A.js} +50 -63
- package/dist/chunk-RAYGDC4A.js.map +1 -0
- package/dist/{chunk-RVTOCAHQ.js → chunk-SQSZRCYT.js} +1 -1
- package/dist/chunk-SQSZRCYT.js.map +1 -0
- package/dist/{chunk-JN64WH3U.js → chunk-T7IR4N2S.js} +1 -1
- package/dist/{chunk-JN64WH3U.js.map → chunk-T7IR4N2S.js.map} +1 -1
- package/dist/{chunk-THUITYH7.js → chunk-TNOQNU3R.js} +5 -4
- package/dist/{chunk-THUITYH7.js.map → chunk-TNOQNU3R.js.map} +1 -1
- package/dist/{chunk-TY6N3PAC.js → chunk-TXDOMADN.js} +9 -6
- package/dist/chunk-TXDOMADN.js.map +1 -0
- package/dist/{chunk-6EF3N2MH.js → chunk-U6D5XTI5.js} +13 -13
- package/dist/{chunk-6EF3N2MH.js.map → chunk-U6D5XTI5.js.map} +1 -1
- package/dist/{chunk-HNX47VTC.js → chunk-UE72AQDZ.js} +6 -6
- package/dist/chunk-UIYZ5SOU.js +190 -0
- package/dist/chunk-UIYZ5SOU.js.map +1 -0
- package/dist/{chunk-IGE6XWKK.js → chunk-VXVKEWYC.js} +3 -3
- package/dist/{chunk-LTVETWDH.js → chunk-X3AXSYBL.js} +217 -123
- package/dist/chunk-X3AXSYBL.js.map +1 -0
- package/dist/{chunk-AD2PJGSS.js → chunk-ZDATYUYG.js} +2 -2
- package/dist/{chunk-LJDW6LQJ.js → chunk-ZSOTZ2RZ.js} +41 -24
- package/dist/chunk-ZSOTZ2RZ.js.map +1 -0
- package/dist/{chunk-6E2JZRBD.js → chunk-ZVAFJQZB.js} +25 -19
- package/dist/chunk-ZVAFJQZB.js.map +1 -0
- package/dist/classified/index.js +4 -4
- package/dist/{classified-marker-L7LXKS6Q.js → classified-marker-GWQTNDSL.js} +3 -3
- package/dist/{collection-facade-KN3UFKZ4.js → collection-facade-56RTPO4G.js} +12 -12
- package/dist/consent/index.js +4 -4
- package/dist/cover/index.js +9 -2
- package/dist/custody/index.js +6 -6
- package/dist/{dead-filter-6HG5FP3I.js → dead-filter-XP7MPHCJ.js} +2 -2
- package/dist/{delegation-7EGBYBRN.js → delegation-Q3HEAVLA.js} +18 -19
- package/dist/delegation-Q3HEAVLA.js.map +1 -0
- package/dist/derivations/index.js +3 -3
- package/dist/{derive-XKAYJ2OA.js → derive-SVDY36ER.js} +4 -4
- package/dist/directory/index.js +5 -5
- package/dist/{dispatch-56T7VPGE.js → dispatch-MG5KNMWG.js} +5 -5
- package/dist/{dispatch-BM5GNCE2.js → dispatch-RVJQ4BOL.js} +11 -11
- package/dist/{enclave-KDLGVX5Z.js → enclave-AOZTWFZK.js} +16 -4
- package/dist/{executor-LFHRV6JH.js → executor-FRUVM36Q.js} +12 -12
- package/dist/{export-accessible-HFBJ4JJY.js → export-accessible-HDDHZYPM.js} +7 -7
- package/dist/{extract-partition-7ZRFN6QP.js → extract-partition-TRADP234.js} +12 -12
- package/dist/{fanout-sidecar-MT2OBMZB.js → fanout-sidecar-NZA6J7QB.js} +13 -22
- package/dist/fanout-sidecar-NZA6J7QB.js.map +1 -0
- package/dist/forget/index.js +4 -4
- package/dist/history/index.js +18 -15
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.js +9 -9
- package/dist/index.d.ts +16 -0
- package/dist/index.js +129 -127
- package/dist/index.js.map +1 -1
- package/dist/introspection/index.js +5 -5
- package/dist/{issue-LCOOEH45.js → issue-GZQDW5TQ.js} +6 -6
- package/dist/kernel/enclave/index.d.ts +7 -5
- package/dist/kernel/enclave/record-aad.d.ts +79 -7
- package/dist/kernel/enclave/record-envelope.d.ts +54 -7
- package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
- package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
- package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
- package/dist/kernel/enclave/record-keys/rekey.d.ts +68 -0
- package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -3
- package/dist/kernel/merge-authority.d.ts +25 -0
- package/dist/kernel/tier-visibility.d.ts +15 -0
- package/dist/kernel/types.d.ts +23 -0
- package/dist/kernel/vault.d.ts +1 -1
- package/dist/kernel/via/index.d.ts +11 -2
- package/dist/{ledger-6IHXJHDD.js → ledger-KQAJPEMZ.js} +6 -6
- package/dist/liberate-Z2EXJY2S.js +24 -0
- package/dist/{link-set-XRVHGYWC.js → link-set-XKN5V7VM.js} +5 -5
- package/dist/{managed-secret-IDAOXSSX.js → managed-secret-7WIIVMJ5.js} +11 -3
- package/dist/materialized-views/index.js +14 -14
- package/dist/money/index.js +3 -3
- package/dist/{noydb-M5WII7RP.js → noydb-NPW3C2EX.js} +39 -38
- package/dist/periods/index.js +6 -6
- package/dist/pod/index.js +42 -41
- package/dist/{pod-handle-BYUSBXCT.js → pod-handle-SKDKRPOR.js} +6 -6
- package/dist/{pod-handle-BYUSBXCT.js.map → pod-handle-SKDKRPOR.js.map} +1 -1
- package/dist/policy/index.js +10 -3
- package/dist/port/with/merge-authority.d.ts +52 -0
- package/dist/port/with/strategies.d.ts +2 -0
- package/dist/portability/index.js +6 -6
- package/dist/{post-register-O3YW6CGS.js → post-register-CVS7CCJE.js} +4 -4
- package/dist/reduce/index.js +3 -3
- package/dist/{register-XHOOX37G.js → register-GJ6PW4KP.js} +10 -10
- package/dist/{registry-OFMM4WAC.js → registry-6LUJ5IJW.js} +4 -4
- package/dist/{registry-CYAFB35H.js → registry-KI77RVK7.js} +4 -4
- package/dist/{request-withdrawal-GCE2SLNW.js → request-withdrawal-LICOUGXG.js} +9 -9
- package/dist/{reveal-UHBP5IH3.js → reveal-PWM47FQN.js} +3 -3
- package/dist/{revoke-6KY4VGZY.js → revoke-AWZKZLZB.js} +6 -6
- package/dist/sealed-record/index.js +14 -7
- package/dist/sealed-record/index.js.map +1 -1
- package/dist/search/index.js +3 -3
- package/dist/{seed-DGLQTCIO.js → seed-LNTLU2A3.js} +14 -17
- package/dist/seed-LNTLU2A3.js.map +1 -0
- package/dist/sequence/index.js +4 -4
- package/dist/session/index.js +3 -3
- package/dist/{signer-SLOMB6HS.js → signer-JE6NEURY.js} +5 -5
- package/dist/snapshots/index.js +5 -5
- package/dist/{stale-26ZJLNLG.js → stale-ZWTKUVZX.js} +5 -5
- package/dist/{storage-N3IMFNGS.js → storage-WCZOCA46.js} +5 -5
- package/dist/{store-coordination-provider-RGHCIRWV.js → store-coordination-provider-7H62VO2C.js} +18 -12
- package/dist/store-coordination-provider-7H62VO2C.js.map +1 -0
- package/dist/sync/index.js +5 -5
- package/dist/team/index.js +10 -9
- package/dist/tiers/index.js +6 -5
- package/dist/vault-head/index.js +111 -0
- package/dist/vault-head/index.js.map +1 -0
- package/dist/{walk-B4YFJJ7S.js → walk-HSS3NLQ3.js} +6 -6
- package/dist/with-audit/periods/periods.d.ts +1 -1
- package/dist/with-audit/periods/strategy.d.ts +1 -1
- package/dist/with-audit/sealed-record/index.d.ts +13 -0
- package/dist/with-audit/tiers/index.d.ts +17 -2
- package/dist/with-commit/history/history.d.ts +26 -0
- package/dist/with-commit/history/index.d.ts +2 -1
- package/dist/with-commit/history/ledger/store.d.ts +7 -1
- package/dist/with-commit/history/strategy.d.ts +11 -1
- package/dist/with-commit/vault-head/active.d.ts +2 -0
- package/dist/with-commit/vault-head/head.d.ts +28 -0
- package/dist/with-commit/vault-head/index.d.ts +10 -0
- package/dist/with-commit/vault-head/strategy.d.ts +127 -0
- package/dist/with-commit/vault-head/verify.d.ts +50 -0
- package/dist/with-party/directory/cover/storage.d.ts +0 -8
- package/dist/with-party/directory/storage.d.ts +0 -11
- package/dist/with-party/directory/visibility.d.ts +0 -21
- package/dist/with-party/policy/storage.d.ts +0 -10
- package/dist/with-party/team/keyring.d.ts +5 -0
- package/dist/with-party/team/tiers.d.ts +2 -1
- package/dist/with-sync/engine.d.ts +33 -5
- package/dist/with-sync/strategy.d.ts +3 -0
- package/dist/{withdraw-accessible-OYG7YZUR.js → withdraw-accessible-GHBA4DAA.js} +8 -8
- package/package.json +7 -3
- package/dist/chunk-343FH4S5.js.map +0 -1
- package/dist/chunk-4CSG6KBX.js.map +0 -1
- package/dist/chunk-4VRZDYRE.js.map +0 -1
- package/dist/chunk-55B3KHZW.js.map +0 -1
- package/dist/chunk-56W3T5O2.js.map +0 -1
- package/dist/chunk-5CH4DWQA.js.map +0 -1
- package/dist/chunk-5TF5DUQ5.js.map +0 -1
- package/dist/chunk-6E2JZRBD.js.map +0 -1
- package/dist/chunk-76FBDG6M.js.map +0 -1
- package/dist/chunk-A3WHDOWI.js.map +0 -1
- package/dist/chunk-AFHQATY4.js +0 -47
- package/dist/chunk-AFHQATY4.js.map +0 -1
- package/dist/chunk-B4G3JPH5.js.map +0 -1
- package/dist/chunk-H5U4T6JK.js.map +0 -1
- package/dist/chunk-IQGIPRSE.js.map +0 -1
- package/dist/chunk-JZVXGOJE.js.map +0 -1
- package/dist/chunk-KKRFL5E2.js.map +0 -1
- package/dist/chunk-LGGLPURL.js.map +0 -1
- package/dist/chunk-LJDW6LQJ.js.map +0 -1
- package/dist/chunk-LTVETWDH.js.map +0 -1
- package/dist/chunk-MKSTUVMJ.js.map +0 -1
- package/dist/chunk-NBLLQOMR.js.map +0 -1
- package/dist/chunk-NY6RQBUN.js.map +0 -1
- package/dist/chunk-OJEDR25M.js.map +0 -1
- package/dist/chunk-PJGMBELR.js.map +0 -1
- package/dist/chunk-PZLIA5R3.js.map +0 -1
- package/dist/chunk-RRMXMJUP.js.map +0 -1
- package/dist/chunk-RVTOCAHQ.js.map +0 -1
- package/dist/chunk-SFY6NT7D.js.map +0 -1
- package/dist/chunk-T6CCRXD3.js.map +0 -1
- package/dist/chunk-TY6N3PAC.js.map +0 -1
- package/dist/chunk-UVFO25FJ.js.map +0 -1
- package/dist/chunk-VUUUIKRG.js.map +0 -1
- package/dist/chunk-WMZQCXZ5.js.map +0 -1
- package/dist/chunk-YVOW35HH.js.map +0 -1
- package/dist/delegation-7EGBYBRN.js.map +0 -1
- package/dist/fanout-sidecar-MT2OBMZB.js.map +0 -1
- package/dist/liberate-UEYC4QLJ.js +0 -24
- package/dist/seed-DGLQTCIO.js.map +0 -1
- package/dist/store-coordination-provider-RGHCIRWV.js.map +0 -1
- /package/dist/{api-NAY63UIE.js.map → api-FRFEJ6WR.js.map} +0 -0
- /package/dist/{chunk-466KGOQB.js.map → chunk-2NE7ILO7.js.map} +0 -0
- /package/dist/{chunk-CZV57HHC.js.map → chunk-3KXIGMZ4.js.map} +0 -0
- /package/dist/{chunk-3OEWD45V.js.map → chunk-3RZ7QLJ4.js.map} +0 -0
- /package/dist/{chunk-FZ2SSI5R.js.map → chunk-6AL6O4CS.js.map} +0 -0
- /package/dist/{chunk-4XEUSZWN.js.map → chunk-6D3CN2JR.js.map} +0 -0
- /package/dist/{chunk-6UAVKAG6.js.map → chunk-6QCXMCLZ.js.map} +0 -0
- /package/dist/{chunk-WMUN7ZUD.js.map → chunk-AA7LM2A3.js.map} +0 -0
- /package/dist/{chunk-TWPTRJEU.js.map → chunk-BBU3OD3D.js.map} +0 -0
- /package/dist/{chunk-4JDTLWUZ.js.map → chunk-DFFSCYIW.js.map} +0 -0
- /package/dist/{chunk-MKV2KYRV.js.map → chunk-ER3BQCCE.js.map} +0 -0
- /package/dist/{chunk-JU3JKOY5.js.map → chunk-EWAGI3EM.js.map} +0 -0
- /package/dist/{chunk-53PWELSC.js.map → chunk-FY33DKPH.js.map} +0 -0
- /package/dist/{chunk-7LLKPODL.js.map → chunk-LPAGIMXJ.js.map} +0 -0
- /package/dist/{chunk-3JQVA527.js.map → chunk-LU6NPJWN.js.map} +0 -0
- /package/dist/{chunk-OPGKH5RD.js.map → chunk-NFPSC2HL.js.map} +0 -0
- /package/dist/{chunk-4DJQU3PH.js.map → chunk-OCCNYGKG.js.map} +0 -0
- /package/dist/{chunk-YX6J3Z3Z.js.map → chunk-PBPYQZDW.js.map} +0 -0
- /package/dist/{chunk-HNX47VTC.js.map → chunk-UE72AQDZ.js.map} +0 -0
- /package/dist/{chunk-IGE6XWKK.js.map → chunk-VXVKEWYC.js.map} +0 -0
- /package/dist/{chunk-AD2PJGSS.js.map → chunk-ZDATYUYG.js.map} +0 -0
- /package/dist/{classified-marker-L7LXKS6Q.js.map → classified-marker-GWQTNDSL.js.map} +0 -0
- /package/dist/{collection-facade-KN3UFKZ4.js.map → collection-facade-56RTPO4G.js.map} +0 -0
- /package/dist/{dead-filter-6HG5FP3I.js.map → dead-filter-XP7MPHCJ.js.map} +0 -0
- /package/dist/{derive-XKAYJ2OA.js.map → derive-SVDY36ER.js.map} +0 -0
- /package/dist/{dispatch-56T7VPGE.js.map → dispatch-MG5KNMWG.js.map} +0 -0
- /package/dist/{dispatch-BM5GNCE2.js.map → dispatch-RVJQ4BOL.js.map} +0 -0
- /package/dist/{enclave-KDLGVX5Z.js.map → enclave-AOZTWFZK.js.map} +0 -0
- /package/dist/{executor-LFHRV6JH.js.map → executor-FRUVM36Q.js.map} +0 -0
- /package/dist/{export-accessible-HFBJ4JJY.js.map → export-accessible-HDDHZYPM.js.map} +0 -0
- /package/dist/{extract-partition-7ZRFN6QP.js.map → extract-partition-TRADP234.js.map} +0 -0
- /package/dist/{issue-LCOOEH45.js.map → issue-GZQDW5TQ.js.map} +0 -0
- /package/dist/{ledger-6IHXJHDD.js.map → ledger-KQAJPEMZ.js.map} +0 -0
- /package/dist/{liberate-UEYC4QLJ.js.map → liberate-Z2EXJY2S.js.map} +0 -0
- /package/dist/{link-set-XRVHGYWC.js.map → link-set-XKN5V7VM.js.map} +0 -0
- /package/dist/{managed-secret-IDAOXSSX.js.map → managed-secret-7WIIVMJ5.js.map} +0 -0
- /package/dist/{noydb-M5WII7RP.js.map → noydb-NPW3C2EX.js.map} +0 -0
- /package/dist/{post-register-O3YW6CGS.js.map → post-register-CVS7CCJE.js.map} +0 -0
- /package/dist/{register-XHOOX37G.js.map → register-GJ6PW4KP.js.map} +0 -0
- /package/dist/{registry-CYAFB35H.js.map → registry-6LUJ5IJW.js.map} +0 -0
- /package/dist/{registry-OFMM4WAC.js.map → registry-KI77RVK7.js.map} +0 -0
- /package/dist/{request-withdrawal-GCE2SLNW.js.map → request-withdrawal-LICOUGXG.js.map} +0 -0
- /package/dist/{reveal-UHBP5IH3.js.map → reveal-PWM47FQN.js.map} +0 -0
- /package/dist/{revoke-6KY4VGZY.js.map → revoke-AWZKZLZB.js.map} +0 -0
- /package/dist/{signer-SLOMB6HS.js.map → signer-JE6NEURY.js.map} +0 -0
- /package/dist/{stale-26ZJLNLG.js.map → stale-ZWTKUVZX.js.map} +0 -0
- /package/dist/{storage-N3IMFNGS.js.map → storage-WCZOCA46.js.map} +0 -0
- /package/dist/{walk-B4YFJJ7S.js.map → walk-HSS3NLQ3.js.map} +0 -0
- /package/dist/{withdraw-accessible-OYG7YZUR.js.map → withdraw-accessible-GHBA4DAA.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/kernel/tier-visibility.ts"],"sourcesContent":["/**\n * Tier visibility helper (#712/#707): a tier-0 code path treats an elevated\n * (_tier > 0) record as invisible. History reads gate on the LIVE record's\n * tier — history snapshots keep their tier-0-wrapped CEKs and carry no _tier\n * of their own, so an elevated record's prior versions would otherwise stay\n * tier-0-decryptable (the read-gate closes the API surface; #712's at-rest\n * arc rewraps the snapshot keys). Envelope inspection only — no decryption.\n *\n * #715/#716: the write ring. Invisibility on the read side is exactly what\n * makes a tier-0 write path treat an elevated record as absent — a put()\n * believes it's a create (demotion) and a delete() writes a marker with no\n * _tier (erasing the elevation signal). `assertTierWritable` closes that by\n * refusing the write outright. Both helpers share a single envelope peek\n * (`peekLiveTier`) — no duplicated `adapter.get` per write.\n */\nimport type { NoydbStore } from './types.js'\nimport { TierWriteRefusedError } from './errors.js'\n\nasync function peekLiveTier(\n adapter: NoydbStore, vault: string, name: string, id: string,\n): Promise<number> {\n const env = await adapter.get(vault, name, id)\n return env?._tier ?? 0\n}\n\nexport async function liveRecordIsElevated(\n adapter: NoydbStore, vault: string, name: string, id: string,\n): Promise<boolean> {\n return (await peekLiveTier(adapter, vault, name, id)) > 0\n}\n\n/**\n * The tier a record's LIVE envelope currently carries (0 if untiered or\n * never moved). #724 Task 4: `BlobSet.loadSlots`/`saveSlots` use this to\n * resolve the per-record slot map's collection DEK at the record's current\n * tier by default, so the slot map's physical location follows the record\n * after `rehomeForTier` re-keys it.\n */\nexport async function liveRecordTier(\n adapter: NoydbStore, vault: string, name: string, id: string,\n): Promise<number> {\n return peekLiveTier(adapter, vault, name, id)\n}\n\n/**\n * Refuses a tier-0 `put()`/`delete()` targeting an elevated record.\n * No-op when `tiersEnabled` is false (the cost gate — collections that\n * never declare tiers pay nothing). Throws `TierWriteRefusedError` with\n * the record's ACTUAL live tier when elevated — holders included, since\n * `put()`/`delete()` are the tier-0 APIs and `putAtTier`/`elevate`/`demote`\n * are the sanctioned tier-aware paths.\n */\nexport async function assertTierWritable(\n adapter: NoydbStore, vault: string, name: string, id: string, tiersEnabled: boolean,\n): Promise<void> {\n if (!tiersEnabled) return\n const tier = await peekLiveTier(adapter, vault, name, id)\n if (tier > 0) throw new TierWriteRefusedError(name, tier)\n}\n\n/**\n * #708: ALL-OR-NOTHING pre-check for a coordinated-cutover bulk-rewrite —\n * scans every id's live tier BEFORE any record is transformed and refuses\n * on the first elevated one found. `_applyCutoverTransform` re-encrypts at\n * tier 0 with no gate of its own; without this, it would silently demote\n * an elevated record. Same cost gate as `assertTierWritable` (no-op, no\n * adapter call, when `tiersEnabled` is false).\n *\n * This pre-check guards against an ordinary `put()`/`delete()` racing the\n * cutover, because those go through the schema fence (`SchemaFenceController`\n * blocks concurrent writes during a coordinated cutover). It does NOT guard\n * against `elevate()`/`demote()`/`putAtTier()` — those tier-move paths bypass\n * the fence, so a tier move landing between this scan and the rewrite it\n * gates is not excluded. Cutover callers are expected to hold the vault\n * quiescent for tier moves on this collection for the duration of the call,\n * the same tier-quiescence assumption the documented CAS-less caller\n * (`with-shape/satellites/migrate-cek.ts`'s \"No-quiesce precondition\") makes\n * explicit for concurrent writes generally.\n */\nexport async function assertCutoverTierSafe(\n adapter: NoydbStore, vault: string, name: string, tiersEnabled: boolean,\n): Promise<void> {\n if (!tiersEnabled) return\n for (const id of await adapter.list(vault, name)) {\n const tier = await peekLiveTier(adapter, vault, name, id)\n if (tier > 0) {\n throw new TierWriteRefusedError(name, tier, `Coordinated cutover on collection \"${name}\" refused — record \"${id}\" is elevated to tier ${tier}. Demote it before a coordinated cutover.`)\n }\n }\n}\n"],"mappings":";;;;;AAkBA,eAAe,aACb,SAAqB,OAAe,MAAc,IACjC;AACjB,QAAM,MAAM,MAAM,QAAQ,IAAI,OAAO,MAAM,EAAE;AAC7C,SAAO,KAAK,SAAS;AACvB;AAEA,eAAsB,qBACpB,SAAqB,OAAe,MAAc,IAChC;AAClB,SAAQ,MAAM,aAAa,SAAS,OAAO,MAAM,EAAE,IAAK;AAC1D;AASA,eAAsB,eACpB,SAAqB,OAAe,MAAc,IACjC;AACjB,SAAO,aAAa,SAAS,OAAO,MAAM,EAAE;AAC9C;AAUA,eAAsB,mBACpB,SAAqB,OAAe,MAAc,IAAY,cAC/C;AACf,MAAI,CAAC,aAAc;AACnB,QAAM,OAAO,MAAM,aAAa,SAAS,OAAO,MAAM,EAAE;AACxD,MAAI,OAAO,EAAG,OAAM,IAAI,sBAAsB,MAAM,IAAI;AAC1D;AAqBA,eAAsB,sBACpB,SAAqB,OAAe,MAAc,cACnC;AACf,MAAI,CAAC,aAAc;AACnB,aAAW,MAAM,MAAM,QAAQ,KAAK,OAAO,IAAI,GAAG;AAChD,UAAM,OAAO,MAAM,aAAa,SAAS,OAAO,MAAM,EAAE;AACxD,QAAI,OAAO,GAAG;AACZ,YAAM,IAAI,sBAAsB,MAAM,MAAM,sCAAsC,IAAI,4BAAuB,EAAE,yBAAyB,IAAI,2CAA2C;AAAA,IACzL;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/kernel/tier-visibility.ts"],"sourcesContent":["/**\n * Tier visibility helper (#712/#707): a tier-0 code path treats an elevated\n * (_tier > 0) record as invisible. History reads gate on the LIVE record's\n * tier — history snapshots keep their tier-0-wrapped CEKs and carry no _tier\n * of their own, so an elevated record's prior versions would otherwise stay\n * tier-0-decryptable (the read-gate closes the API surface; #712's at-rest\n * arc rewraps the snapshot keys). Envelope inspection only — no decryption.\n *\n * #715/#716: the write ring. Invisibility on the read side is exactly what\n * makes a tier-0 write path treat an elevated record as absent — a put()\n * believes it's a create (demotion) and a delete() writes a marker with no\n * _tier (erasing the elevation signal). `assertTierWritable` closes that by\n * refusing the write outright. Both helpers share a single envelope peek\n * (`peekLiveTier`) — no duplicated `adapter.get` per write.\n */\nimport type { NoydbStore } from './types.js'\nimport { TierWriteRefusedError } from './errors.js'\n\nasync function peekLiveTier(\n adapter: NoydbStore, vault: string, name: string, id: string,\n): Promise<number> {\n const env = await adapter.get(vault, name, id)\n return env?._tier ?? 0\n}\n\nexport async function liveRecordIsElevated(\n adapter: NoydbStore, vault: string, name: string, id: string,\n): Promise<boolean> {\n return (await peekLiveTier(adapter, vault, name, id)) > 0\n}\n\n/**\n * The tier a record's LIVE envelope currently carries (0 if untiered or\n * never moved). #724 Task 4: `BlobSet.loadSlots`/`saveSlots` use this to\n * resolve the per-record slot map's collection DEK at the record's current\n * tier by default, so the slot map's physical location follows the record\n * after `rehomeForTier` re-keys it.\n */\nexport async function liveRecordTier(\n adapter: NoydbStore, vault: string, name: string, id: string,\n): Promise<number> {\n return peekLiveTier(adapter, vault, name, id)\n}\n\n/**\n * Refuses a tier-0 `put()`/`delete()` targeting an elevated record.\n * No-op when `tiersEnabled` is false (the cost gate — collections that\n * never declare tiers pay nothing). Throws `TierWriteRefusedError` with\n * the record's ACTUAL live tier when elevated — holders included, since\n * `put()`/`delete()` are the tier-0 APIs and `putAtTier`/`elevate`/`demote`\n * are the sanctioned tier-aware paths.\n */\nexport async function assertTierWritable(\n adapter: NoydbStore, vault: string, name: string, id: string, tiersEnabled: boolean,\n): Promise<void> {\n if (!tiersEnabled) return\n const tier = await peekLiveTier(adapter, vault, name, id)\n if (tier > 0) throw new TierWriteRefusedError(name, tier)\n}\n\n/**\n * #708: ALL-OR-NOTHING pre-check for a coordinated-cutover bulk-rewrite —\n * scans every id's live tier BEFORE any record is transformed and refuses\n * on the first elevated one found. `_applyCutoverTransform` re-encrypts at\n * tier 0 with no gate of its own; without this, it would silently demote\n * an elevated record. Same cost gate as `assertTierWritable` (no-op, no\n * adapter call, when `tiersEnabled` is false).\n *\n * This pre-check guards against an ordinary `put()`/`delete()` racing the\n * cutover, because those go through the schema fence (`SchemaFenceController`\n * blocks concurrent writes during a coordinated cutover). It does NOT guard\n * against `elevate()`/`demote()`/`putAtTier()` — those tier-move paths bypass\n * the fence, so a tier move landing between this scan and the rewrite it\n * gates is not excluded. Cutover callers are expected to hold the vault\n * quiescent for tier moves on this collection for the duration of the call,\n * the same tier-quiescence assumption the documented CAS-less caller\n * (`with-shape/satellites/migrate-cek.ts`'s \"No-quiesce precondition\") makes\n * explicit for concurrent writes generally.\n */\nexport async function assertCutoverTierSafe(\n adapter: NoydbStore, vault: string, name: string, tiersEnabled: boolean,\n): Promise<void> {\n if (!tiersEnabled) return\n for (const id of await adapter.list(vault, name)) {\n const tier = await peekLiveTier(adapter, vault, name, id)\n if (tier > 0) {\n throw new TierWriteRefusedError(name, tier, `Coordinated cutover on collection \"${name}\" refused — record \"${id}\" is elevated to tier ${tier}. Demote it before a coordinated cutover.`)\n }\n }\n}\n\n/**\n * The key a collection's DEK is stored under in `UnlockedKeyring.deks` for a\n * given tier: `collection` at tier 0, `collection#N` above it.\n *\n * Lives in the kernel because the `deks` map is a kernel type and the kernel\n * reads it — `noydb.ts` needs this to resolve the right DEK when verifying a\n * pulled envelope (#1042). `with-party/team/tiers.ts` re-exports it, so every\n * existing importer is unchanged; the definition simply moved to the layer that\n * owns the map rather than one that happens to use it.\n *\n * This move was forced by `port-layering`, and rightly: the alternative was the\n * kernel spine statically importing a `with-*` service, or duplicating the\n * naming convention in two places where it could drift.\n */\nexport function dekKey(collection: string, tier: number): string {\n if (tier <= 0) return collection\n return `${collection}#${tier}`\n}\n"],"mappings":";;;;;AAkBA,eAAe,aACb,SAAqB,OAAe,MAAc,IACjC;AACjB,QAAM,MAAM,MAAM,QAAQ,IAAI,OAAO,MAAM,EAAE;AAC7C,SAAO,KAAK,SAAS;AACvB;AAEA,eAAsB,qBACpB,SAAqB,OAAe,MAAc,IAChC;AAClB,SAAQ,MAAM,aAAa,SAAS,OAAO,MAAM,EAAE,IAAK;AAC1D;AASA,eAAsB,eACpB,SAAqB,OAAe,MAAc,IACjC;AACjB,SAAO,aAAa,SAAS,OAAO,MAAM,EAAE;AAC9C;AAUA,eAAsB,mBACpB,SAAqB,OAAe,MAAc,IAAY,cAC/C;AACf,MAAI,CAAC,aAAc;AACnB,QAAM,OAAO,MAAM,aAAa,SAAS,OAAO,MAAM,EAAE;AACxD,MAAI,OAAO,EAAG,OAAM,IAAI,sBAAsB,MAAM,IAAI;AAC1D;AAqBA,eAAsB,sBACpB,SAAqB,OAAe,MAAc,cACnC;AACf,MAAI,CAAC,aAAc;AACnB,aAAW,MAAM,MAAM,QAAQ,KAAK,OAAO,IAAI,GAAG;AAChD,UAAM,OAAO,MAAM,aAAa,SAAS,OAAO,MAAM,EAAE;AACxD,QAAI,OAAO,GAAG;AACZ,YAAM,IAAI,sBAAsB,MAAM,MAAM,sCAAsC,IAAI,4BAAuB,EAAE,yBAAyB,IAAI,2CAA2C;AAAA,IACzL;AAAA,EACF;AACF;AAgBO,SAAS,OAAO,YAAoB,MAAsB;AAC/D,MAAI,QAAQ,EAAG,QAAO;AACtB,SAAO,GAAG,UAAU,IAAI,IAAI;AAC9B;","names":[]}
|
|
@@ -2,14 +2,15 @@ import {
|
|
|
2
2
|
generateULID
|
|
3
3
|
} from "./chunk-4AOERLTV.js";
|
|
4
4
|
import {
|
|
5
|
+
buildRecordAad,
|
|
5
6
|
openEnvelopeJson
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-X3AXSYBL.js";
|
|
8
|
+
import {
|
|
9
|
+
buildRecordEnvelope
|
|
10
|
+
} from "./chunk-ZVAFJQZB.js";
|
|
7
11
|
import {
|
|
8
12
|
encrypt
|
|
9
13
|
} from "./chunk-QTDAPDDV.js";
|
|
10
|
-
import {
|
|
11
|
-
NOYDB_FORMAT_VERSION
|
|
12
|
-
} from "./chunk-SFY6NT7D.js";
|
|
13
14
|
|
|
14
15
|
// src/with-audit/consent/consent.ts
|
|
15
16
|
var CONSENT_AUDIT_COLLECTION = "_consent_audit";
|
|
@@ -29,7 +30,7 @@ async function loadConsentEntries(adapter, vault, encrypted, getDEK, filter = {}
|
|
|
29
30
|
for (const id of ids.sort()) {
|
|
30
31
|
const envelope = await adapter.get(vault, CONSENT_AUDIT_COLLECTION, id);
|
|
31
32
|
if (!envelope) continue;
|
|
32
|
-
const entry = await decryptEntry(envelope, encrypted, getDEK);
|
|
33
|
+
const entry = await decryptEntry(id, envelope, encrypted, getDEK);
|
|
33
34
|
if (!matchesFilter(entry, filter)) continue;
|
|
34
35
|
entries.push(entry);
|
|
35
36
|
}
|
|
@@ -37,28 +38,18 @@ async function loadConsentEntries(adapter, vault, encrypted, getDEK, filter = {}
|
|
|
37
38
|
}
|
|
38
39
|
async function buildEnvelope(entry, encrypted, getDEK) {
|
|
39
40
|
const json = JSON.stringify(entry);
|
|
41
|
+
const identity = { collection: CONSENT_AUDIT_COLLECTION, id: entry.id, version: 1 };
|
|
42
|
+
const body = { ts: entry.timestamp };
|
|
40
43
|
if (!encrypted) {
|
|
41
|
-
return {
|
|
42
|
-
_noydb: NOYDB_FORMAT_VERSION,
|
|
43
|
-
_v: 1,
|
|
44
|
-
_ts: entry.timestamp,
|
|
45
|
-
_iv: "",
|
|
46
|
-
_data: json
|
|
47
|
-
};
|
|
44
|
+
return buildRecordEnvelope(identity, { ...body, iv: "", data: json });
|
|
48
45
|
}
|
|
49
46
|
const dek = await getDEK(CONSENT_AUDIT_COLLECTION);
|
|
50
|
-
const { iv, data } = await encrypt(json, dek);
|
|
51
|
-
return {
|
|
52
|
-
_noydb: NOYDB_FORMAT_VERSION,
|
|
53
|
-
_v: 1,
|
|
54
|
-
_ts: entry.timestamp,
|
|
55
|
-
_iv: iv,
|
|
56
|
-
_data: data
|
|
57
|
-
};
|
|
47
|
+
const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
|
|
48
|
+
return buildRecordEnvelope(identity, { ...body, iv, data });
|
|
58
49
|
}
|
|
59
|
-
async function decryptEntry(envelope, encrypted, getDEK) {
|
|
50
|
+
async function decryptEntry(id, envelope, encrypted, getDEK) {
|
|
60
51
|
if (!encrypted) return JSON.parse(envelope._data);
|
|
61
|
-
const json = await openEnvelopeJson(envelope, await getDEK(CONSENT_AUDIT_COLLECTION));
|
|
52
|
+
const json = await openEnvelopeJson({ collection: CONSENT_AUDIT_COLLECTION, id }, envelope, await getDEK(CONSENT_AUDIT_COLLECTION));
|
|
62
53
|
return JSON.parse(json);
|
|
63
54
|
}
|
|
64
55
|
function matchesFilter(entry, f) {
|
|
@@ -75,4 +66,4 @@ export {
|
|
|
75
66
|
writeConsentEntry,
|
|
76
67
|
loadConsentEntries
|
|
77
68
|
};
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
69
|
+
//# sourceMappingURL=chunk-A5QQKWCK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-audit/consent/consent.ts"],"sourcesContent":["/**\n * Consent boundaries — per-access audit log.\n *\n * ```ts\n * const audit = await vault.withConsent(\n * { purpose: 'quarterly-review', consentHash: '7f3a...' },\n * async () => {\n * const invoices = await vault.collection<Invoice>('invoices').list()\n * return invoices\n * },\n * )\n *\n * const log = await vault.consentAudit({ since: '2026-01-01T00:00:00Z' })\n * // → entries: { actor, purpose, consentHash, ts, op, collection, id }\n * ```\n *\n * ## Contract\n *\n * Every `get` / `put` / `delete` that happens inside a `withConsent`\n * callback writes one entry to the reserved `_consent_audit`\n * collection. Entries are encrypted with the vault's consent-audit\n * DEK (separate from per-user-collection DEKs so access-log queries\n * don't require unwrapping individual collection keys). Outside a\n * `withConsent` scope, no entries are written — consent is\n * opt-in by design (GDPR Art. 7: *demonstrable*, *specific*\n * consent).\n *\n * ## Why store the hash, not the consent text?\n *\n * The `consentHash` is the sha256 of whatever consent receipt the\n * actor presented (a signed GDPR banner click, a HIPAA authorisation\n * PDF, an API-level `X-Consent-Hash` header). Storing only the hash:\n *\n * 1. Keeps the audit log small and indexable.\n * 2. Preserves zero-knowledge at the adapter — adapters see\n * ciphertext envelopes of `{ actor, purpose, consentHash, ts,\n * op, collection, id }`, never the consent record itself.\n * 3. Lets the regulator verify a presented consent doc matches\n * the logged hash at audit time without the system ever\n * possessing the doc.\n *\n * ## Concurrency\n *\n * The consent context lives on the {@link Vault} instance. Two\n * concurrent `withConsent` calls on the same Vault would stomp each\n * other — documented limitation; adopters needing per-flight scope\n * should use separate Vault instances or an AsyncLocalStorage shim.\n *\n * @module\n */\nimport type { EncryptedEnvelope, NoydbStore } from '../../kernel/types.js'\nimport { buildRecordAad, buildRecordEnvelope, encrypt, openEnvelopeJson, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport { generateULID } from '../../with-pod/ulid.js'\n\n/** Reserved collection for consent-audit entries. */\nexport const CONSENT_AUDIT_COLLECTION = '_consent_audit'\n\n/**\n * The consent scope active for a block of work. Set via\n * `vault.withConsent()`; observed by the collection's access hooks.\n */\nexport interface ConsentContext {\n /**\n * What this access is for. Used by the audit query (`consentAudit\n * ({ purpose })`) and carried in the stored entry. Free-form; the\n * regulator or compliance tooling decides the vocabulary.\n */\n readonly purpose: string\n /**\n * Hex-encoded sha256 of whatever consent artefact the actor\n * presented. Stored as-is in each entry.\n */\n readonly consentHash: string\n}\n\n/**\n * Access operation recorded in an audit entry.\n *\n * Union-widening checklist (I-2) — these three sites widen together or a\n * downstream exhaustive switch breaks at its next in-range minor:\n * 1. `ConsentOp` here (public, re-exported at `index.ts`).\n * 2. `onAccess` op union on `kernel/collection-config.ts`.\n * 3. classified ctx `onAccess` op union on `port/with/classified-strategy.ts`\n * (the `ClassifiedVerifyCtx` one — the `ClassifiedRevealCtx` one stays `'reveal'`-only).\n */\nexport type ConsentOp = 'get' | 'put' | 'delete' | 'reveal' | 'verify' | 'find'\n\n/** One consent-audit record, as decrypted for the caller. */\nexport interface ConsentAuditEntry {\n /** ULID — stable insertion-order key. */\n readonly id: string\n readonly timestamp: string\n readonly actor: string\n readonly purpose: string\n readonly consentHash: string\n readonly op: ConsentOp\n readonly collection: string\n readonly recordId: string\n}\n\n/** Filter passed to `vault.consentAudit()`. */\nexport interface ConsentAuditFilter {\n /** Only entries at or after this ISO timestamp. */\n readonly since?: string\n /** Only entries at or before this ISO timestamp. */\n readonly until?: string\n /** Match entries targeting this collection. */\n readonly collection?: string\n /** Match entries written by this actor. */\n readonly actor?: string\n /** Match entries with this purpose. */\n readonly purpose?: string\n}\n\n/**\n * Write one audit entry. Called by Vault's onAccess hook when a\n * consent context is active.\n */\nexport async function writeConsentEntry(\n adapter: NoydbStore,\n vault: string,\n encrypted: boolean,\n entry: Omit<ConsentAuditEntry, 'id' | 'timestamp'>,\n getDEK: (collection: string) => Promise<EnclaveKey>,\n): Promise<void> {\n const id = generateULID()\n const full: ConsentAuditEntry = {\n id,\n timestamp: new Date().toISOString(),\n ...entry,\n }\n const envelope = await buildEnvelope(full, encrypted, getDEK)\n await adapter.put(vault, CONSENT_AUDIT_COLLECTION, id, envelope)\n}\n\n/** Load + decrypt + filter all entries. */\nexport async function loadConsentEntries(\n adapter: NoydbStore,\n vault: string,\n encrypted: boolean,\n getDEK: (collection: string) => Promise<EnclaveKey>,\n filter: ConsentAuditFilter = {},\n): Promise<ConsentAuditEntry[]> {\n const ids = await adapter.list(vault, CONSENT_AUDIT_COLLECTION)\n const entries: ConsentAuditEntry[] = []\n\n for (const id of ids.sort()) {\n const envelope = await adapter.get(vault, CONSENT_AUDIT_COLLECTION, id)\n if (!envelope) continue\n const entry = await decryptEntry(id, envelope, encrypted, getDEK)\n if (!matchesFilter(entry, filter)) continue\n entries.push(entry)\n }\n return entries\n}\n\n// ── internals ──────────────────────────────────────────────────────\n\nasync function buildEnvelope(\n entry: ConsentAuditEntry,\n encrypted: boolean,\n getDEK: (collection: string) => Promise<EnclaveKey>,\n): Promise<EncryptedEnvelope> {\n const json = JSON.stringify(entry)\n // `entry.id` IS the record id the caller writes under, so identity needs no\n // threading here (#1051).\n const identity = { collection: CONSENT_AUDIT_COLLECTION, id: entry.id, version: 1 }\n const body = { ts: entry.timestamp }\n if (!encrypted) {\n return buildRecordEnvelope(identity, { ...body, iv: '', data: json })\n }\n const dek = await getDEK(CONSENT_AUDIT_COLLECTION)\n const { iv, data } = await encrypt(json, dek, buildRecordAad(identity))\n return buildRecordEnvelope(identity, { ...body, iv, data })\n}\n\nasync function decryptEntry(\n id: string,\n envelope: EncryptedEnvelope,\n encrypted: boolean,\n getDEK: (collection: string) => Promise<EnclaveKey>,\n): Promise<ConsentAuditEntry> {\n if (!encrypted) return JSON.parse(envelope._data) as ConsentAuditEntry\n const json = await openEnvelopeJson({ collection: CONSENT_AUDIT_COLLECTION, id }, envelope, await getDEK(CONSENT_AUDIT_COLLECTION))\n return JSON.parse(json) as ConsentAuditEntry\n}\n\nfunction matchesFilter(entry: ConsentAuditEntry, f: ConsentAuditFilter): boolean {\n if (f.since && entry.timestamp < f.since) return false\n if (f.until && entry.timestamp > f.until) return false\n if (f.collection && entry.collection !== f.collection) return false\n if (f.actor && entry.actor !== f.actor) return false\n if (f.purpose && entry.purpose !== f.purpose) return false\n return true\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuDO,IAAM,2BAA2B;AA+DxC,eAAsB,kBACpB,SACA,OACA,WACA,OACA,QACe;AACf,QAAM,KAAK,aAAa;AACxB,QAAM,OAA0B;AAAA,IAC9B;AAAA,IACA,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,IAClC,GAAG;AAAA,EACL;AACA,QAAM,WAAW,MAAM,cAAc,MAAM,WAAW,MAAM;AAC5D,QAAM,QAAQ,IAAI,OAAO,0BAA0B,IAAI,QAAQ;AACjE;AAGA,eAAsB,mBACpB,SACA,OACA,WACA,QACA,SAA6B,CAAC,GACA;AAC9B,QAAM,MAAM,MAAM,QAAQ,KAAK,OAAO,wBAAwB;AAC9D,QAAM,UAA+B,CAAC;AAEtC,aAAW,MAAM,IAAI,KAAK,GAAG;AAC3B,UAAM,WAAW,MAAM,QAAQ,IAAI,OAAO,0BAA0B,EAAE;AACtE,QAAI,CAAC,SAAU;AACf,UAAM,QAAQ,MAAM,aAAa,IAAI,UAAU,WAAW,MAAM;AAChE,QAAI,CAAC,cAAc,OAAO,MAAM,EAAG;AACnC,YAAQ,KAAK,KAAK;AAAA,EACpB;AACA,SAAO;AACT;AAIA,eAAe,cACb,OACA,WACA,QAC4B;AAC5B,QAAM,OAAO,KAAK,UAAU,KAAK;AAGjC,QAAM,WAAW,EAAE,YAAY,0BAA0B,IAAI,MAAM,IAAI,SAAS,EAAE;AAClF,QAAM,OAAO,EAAE,IAAI,MAAM,UAAU;AACnC,MAAI,CAAC,WAAW;AACd,WAAO,oBAAoB,UAAU,EAAE,GAAG,MAAM,IAAI,IAAI,MAAM,KAAK,CAAC;AAAA,EACtE;AACA,QAAM,MAAM,MAAM,OAAO,wBAAwB;AACjD,QAAM,EAAE,IAAI,KAAK,IAAI,MAAM,QAAQ,MAAM,KAAK,eAAe,QAAQ,CAAC;AACtE,SAAO,oBAAoB,UAAU,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC;AAC5D;AAEA,eAAe,aACb,IACA,UACA,WACA,QAC4B;AAC5B,MAAI,CAAC,UAAW,QAAO,KAAK,MAAM,SAAS,KAAK;AAChD,QAAM,OAAO,MAAM,iBAAiB,EAAE,YAAY,0BAA0B,GAAG,GAAG,UAAU,MAAM,OAAO,wBAAwB,CAAC;AAClI,SAAO,KAAK,MAAM,IAAI;AACxB;AAEA,SAAS,cAAc,OAA0B,GAAgC;AAC/E,MAAI,EAAE,SAAS,MAAM,YAAY,EAAE,MAAO,QAAO;AACjD,MAAI,EAAE,SAAS,MAAM,YAAY,EAAE,MAAO,QAAO;AACjD,MAAI,EAAE,cAAc,MAAM,eAAe,EAAE,WAAY,QAAO;AAC9D,MAAI,EAAE,SAAS,MAAM,UAAU,EAAE,MAAO,QAAO;AAC/C,MAAI,EAAE,WAAW,MAAM,YAAY,EAAE,QAAS,QAAO;AACrD,SAAO;AACT;","names":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
buildRecordAad,
|
|
2
3
|
openEnvelopeJson
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-X3AXSYBL.js";
|
|
4
5
|
import {
|
|
5
6
|
buildRecordEnvelope
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZVAFJQZB.js";
|
|
7
8
|
import {
|
|
8
9
|
encrypt
|
|
9
10
|
} from "./chunk-QTDAPDDV.js";
|
|
@@ -127,17 +128,18 @@ var SequenceStore = class {
|
|
|
127
128
|
async read(name) {
|
|
128
129
|
const env = await this.adapter.get(this.vault, SEQUENCE_COLLECTION, name);
|
|
129
130
|
if (!env) return { env: null, value: 0 };
|
|
130
|
-
const json = this.encrypted ? await openEnvelopeJson(env, await this.dek()) : env._data;
|
|
131
|
+
const json = this.encrypted ? await openEnvelopeJson({ collection: SEQUENCE_COLLECTION, id: name }, env, await this.dek()) : env._data;
|
|
131
132
|
const state = JSON.parse(json);
|
|
132
133
|
return { env, value: state.value };
|
|
133
134
|
}
|
|
134
135
|
async encryptState(name, state, version) {
|
|
135
136
|
const json = JSON.stringify(state);
|
|
136
137
|
if (!this.encrypted) {
|
|
137
|
-
return buildRecordEnvelope({ collection: SEQUENCE_COLLECTION, id: name }, {
|
|
138
|
+
return buildRecordEnvelope({ collection: SEQUENCE_COLLECTION, id: name, version }, { iv: "", data: json });
|
|
138
139
|
}
|
|
139
|
-
const
|
|
140
|
-
|
|
140
|
+
const identity = { collection: SEQUENCE_COLLECTION, id: name, version };
|
|
141
|
+
const { iv, data } = await encrypt(json, await this.dek(), buildRecordAad(identity));
|
|
142
|
+
return buildRecordEnvelope(identity, { iv, data });
|
|
141
143
|
}
|
|
142
144
|
async peek(name) {
|
|
143
145
|
return (await this.read(name)).value;
|
|
@@ -199,4 +201,4 @@ export {
|
|
|
199
201
|
resolveSequenceKey,
|
|
200
202
|
SequenceStore
|
|
201
203
|
};
|
|
202
|
-
//# sourceMappingURL=chunk-
|
|
204
|
+
//# sourceMappingURL=chunk-AA2WWTS3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-commit/sequence/active.ts","../src/with-commit/sequence/strategy.ts","../src/with-commit/sequence/index.ts"],"sourcesContent":["/**\n * Enable the atomic-sequence capability.\n * Pass to `createNoydb({ sequenceStrategy: withSequence() })` to make\n * `vault.sequence('name').next()` / `.peek()` / `.seedTo()` live. The\n * {@link SequenceStore} CAS engine is statically imported here, so it is pulled\n * into the bundle only when `withSequence()` is referenced (the floor never\n * imports it).\n */\nimport type { SequenceStrategy } from './strategy.js'\nimport { SequenceStore } from './index.js'\n\nexport function withSequence(): SequenceStrategy {\n return {\n createStore(opts) {\n return new SequenceStore(opts)\n },\n }\n}\n","/**\n * Sequence capability strategy — the single on-demand factory the vault routes\n * `vault.sequence()` through to build its atomic-CAS {@link SequenceStore}. The\n * active engine ({@link withSequence}) constructs the real store (kept out of\n * the floor bundle — the store class is reached only via the opt-in\n * `active.ts` chunk); {@link NO_SEQUENCE} throws. The vault always assembles the\n * per-call {@link SequenceStoreOptions} and delegates here, so an un-opted-in\n * caller hits `NO_SEQUENCE`'s throw at `vault.sequence()`.\n *\n * Note: `vault.sequence()` is synchronous, so the factory is a plain (sync)\n * constructor — the engine is tree-shaken by reachability (only `withSequence()`\n * pulls `active.ts`, which statically imports the store), not by a dynamic\n * import. Deferred-numbering series (`withDeferredNumbering`) are a distinct\n * capability and are NOT routed through this strategy.\n * @internal\n */\nimport type { SequenceStore, SequenceStoreOptions } from './index.js'\nimport { SequenceNotEnabledError } from '../../kernel/errors.js'\n\nexport interface SequenceStrategy {\n createStore(opts: SequenceStoreOptions): SequenceStore\n}\n\n/**\n * No-op stub — the floor default. The capability factory throws\n * {@link SequenceNotEnabledError}; opt in with `sequenceStrategy: withSequence()`\n * in createNoydb. @internal\n */\nexport const NO_SEQUENCE: SequenceStrategy = {\n createStore(): SequenceStore {\n throw new SequenceNotEnabledError()\n },\n}\n","/**\n * Atomic sequence primitive — online-coordinated gap-free numbering.\n *\n * `vault.sequence('invoice-2026').next()` returns 1, 2, 3, … with no\n * gaps and no duplicates, even under concurrent callers. Each named\n * sequence is an independent counter record at `_sequences/<name>`,\n * incremented with an optimistic compare-and-swap retry loop — the same\n * proven pattern as the ledger head (`history/ledger/store.ts`).\n *\n * **Explicitly online-only.** Gap-free numbering requires single-authority\n * serialization, which an offline / non-CAS store cannot provide. `next()`\n * throws {@link SequenceOfflineError} unless the backing store advertises\n * `capabilities.casAtomic`. This is a deliberate, honest wall — an offline\n * writer cannot safely allocate a global sequence number.\n *\n * Note on \"gap-free\": the *sequence* is gap-free (each `next()` yields a\n * unique, +1 value). If a caller discards a value without using it, that\n * is a gap in *usage*, not in the sequence — assign each `next()` result\n * to its record in the same operation.\n */\n\nimport { buildRecordAad, buildRecordEnvelope } from '../../kernel/enclave/index.js'\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { encrypt, openEnvelopeJson, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport type { ConflictError} from '../../kernel/errors.js';\nimport { isConflictError, SequenceContentionError, SequenceOfflineError, ValidationError } from '../../kernel/errors.js'\n\n// Capability opt-in seam (S4): `vault.sequence()` builds its CAS store through\n// the sequenceStrategy, so it throws SequenceNotEnabledError unless opted in.\nexport { withSequence } from './active.js'\nexport { NO_SEQUENCE, type SequenceStrategy } from './strategy.js'\nexport { SequenceNotEnabledError } from '../../kernel/errors.js'\n\nexport const SEQUENCE_COLLECTION = '_sequences'\n// A sequence is a single hot CAS row — higher contention than a ledger\n// append. A larger budget + jittered backoff absorbs moderate concurrency;\n// a genuine burst beyond this surfaces SequenceContentionError so the\n// caller can retry / queue (the honest online-only contract).\nconst MAX_NEXT_ATTEMPTS = 16\n\ninterface SequenceState {\n value: number\n}\n\n/** Options for `SequenceHandle.next`. Deferred-numbering series use `for`; the CAS counter ignores all of these. */\nexport interface NextOptions {\n /** Deferred mode: the record id to number. Ignored by the CAS counter. */\n readonly for?: string\n /** Deferred mode: reject after this many ms if still unsealed (reserved; not yet enforced in this slice). */\n readonly timeoutMs?: number\n}\n\n/**\n * Partitioning for a CAS sequence. A partitioned sequence is an\n * independent counter scoped to one tuple of values — e.g.\n * `sequence('invoice', { partition: [2026, 'EU'] })` numbers EU-2026 invoices\n * separately from `[2026, 'US']` and from the bare `invoice` series.\n *\n * Partition components are URI-encoded (so `/`, null bytes and other\n * separators in a value can never collide with the structural separators) and\n * `'/'`-joined, then appended to the series with a null-byte (`\\x00`)\n * separator. The null byte is illegal in a plain series name, which guarantees\n * a partitioned key is always disjoint from any unpartitioned series.\n */\nexport interface SequenceOptions {\n /** Partition tuple. Each component is URI-encoded and `'/'`-joined. */\n readonly partition?: readonly (string | number)[]\n /**\n * Render template for the serial string. When set, `vault.sequence`\n * returns a {@link FormattedSequenceHandle} whose `next()` resolves to\n * `{ serial, formatted }`. Tokens:\n * - `{seq}` — the allocated integer\n * - `{seq:0N}` — zero-padded to width N (e.g. `{seq:04}` → `0001`)\n * - `{partition.i}` — the i-th `partition` component (original value)\n *\n * Any other token, or a `{partition.i}` index beyond the supplied\n * `partition`, throws `ValidationError` at `vault.sequence()` construction.\n * Per-partition reset is inherent: a new partition tuple starts at 1.\n */\n readonly format?: string\n}\n\n/**\n * A formatted sequence handle. Identical to {@link SequenceHandle}\n * except `next()` also returns the rendered `formatted` string. `peek()` /\n * `seedTo()` operate on the underlying integer counter, unchanged.\n */\nexport interface FormattedSequenceHandle {\n /** Allocate the next value and return it with its rendered serial string. */\n next(opts?: NextOptions): Promise<{ serial: number; formatted: string }>\n /** Read the current integer value without allocating. Returns 0 if never used. */\n peek(): Promise<number>\n /** Set-if-greater on the underlying integer counter. See {@link SequenceHandle.seedTo}. */\n seedTo(n: number): Promise<void>\n}\n\n// Matches a single `{...}` token with no nested braces.\nconst SEQ_FORMAT_TOKEN = /\\{([^{}]*)\\}/g\nconst SEQ_PAD_TOKEN = /^seq:0(\\d+)$/\nconst SEQ_PARTITION_TOKEN = /^partition\\.(\\d+)$/\n\n/**\n * Validate a sequence `format` against the supplied partition and return a\n * pure `(serial) => string` renderer. Eager validation: every token is\n * checked now, so a bad pattern throws `ValidationError` at construction —\n * never at `next()` time.\n */\nexport function compileSequenceFormat(\n format: string,\n series: string,\n partition: readonly (string | number)[] | undefined,\n): (serial: number) => string {\n const parts = partition ?? []\n for (const m of format.matchAll(SEQ_FORMAT_TOKEN)) {\n const token = m[1] ?? ''\n if (token === 'seq') continue\n if (SEQ_PAD_TOKEN.test(token)) continue\n const partMatch = SEQ_PARTITION_TOKEN.exec(token)\n if (partMatch) {\n const idx = Number(partMatch[1])\n if (idx >= parts.length) {\n throw new ValidationError(\n `sequence(\"${series}\"): format token \"{${token}}\" references partition index ${idx}, ` +\n `but only ${parts.length} partition component(s) were supplied.`,\n )\n }\n continue\n }\n throw new ValidationError(\n `sequence(\"${series}\"): format contains unknown token \"{${token}}\". ` +\n `Accepted tokens: {seq}, {seq:0N}, {partition.i}.`,\n )\n }\n return (serial: number): string =>\n format.replace(SEQ_FORMAT_TOKEN, (full, token: string) => {\n if (token === 'seq') return String(serial)\n const padMatch = SEQ_PAD_TOKEN.exec(token)\n if (padMatch) return String(serial).padStart(Number(padMatch[1]), '0')\n const partMatch = SEQ_PARTITION_TOKEN.exec(token)\n if (partMatch) return String(parts[Number(partMatch[1])])\n return full // unreachable — validated above\n })\n}\n\n/**\n * Resolve the CAS storage key for a (series, partition) pair.\n *\n * With no partition the key is `series` verbatim. With a partition the key is\n * `${series}\\x00${parts}` where `parts` is each component passed through\n * `encodeURIComponent(String(part))` and `'/'`-joined. The null-byte separator\n * is illegal in a plain series name, so partitioned keys never collide with\n * unpartitioned ones; URI-encoding keeps any component containing `/` distinct\n * from a multi-component partition.\n *\n * @throws {ValidationError} if any partition component is empty after `String()`\n * or is a non-finite number (`NaN`, `±Infinity`).\n */\nexport function resolveSequenceKey(series: string, opts?: SequenceOptions): string {\n const partition = opts?.partition\n if (!partition || partition.length === 0) return series\n const parts = partition.map((p) => {\n if (typeof p === 'number' && !Number.isFinite(p)) {\n throw new ValidationError(`sequence partition component must be a finite number, got ${p}`)\n }\n const s = String(p)\n if (s === '') {\n throw new ValidationError('sequence partition component must not be empty')\n }\n return encodeURIComponent(s)\n })\n return `${series}\\x00${parts.join('/')}`\n}\n\nexport interface SequenceHandle {\n /** Atomically allocate and return the next value (1, 2, 3, …). Deferred series resolve at the next pass. */\n next(opts?: NextOptions): Promise<number>\n /** Read the current value without allocating. Returns 0 if never used. */\n peek(): Promise<number>\n /**\n * Set-if-greater: advance the counter to at least `n`. A no-op if the\n * current value is already `>= n` (so it never rewinds), and `seedTo(0)` is\n * a no-op. Idempotent and CAS-safe under concurrent `next()` / `seedTo()`.\n *\n * Use after a bundle / CSV import to fast-forward the counter past the\n * highest imported serial, so subsequent `next()` calls cannot re-use a\n * number that is already on a record.\n *\n * Online-only: throws {@link SequenceOfflineError} on a non-CAS store.\n */\n seedTo(n: number): Promise<void>\n}\n\nasync function sleepBackoff(attempt: number): Promise<void> {\n // Exponential backoff with full jitter to break the thundering herd\n // when many writers contend on the same counter row.\n const ceil = Math.min(2 ** attempt, 32)\n const ms = Math.floor(Math.random() * ceil)\n await new Promise((r) => setTimeout(r, ms))\n}\n\n/** Per-call context the vault assembles to build a {@link SequenceStore}. */\nexport interface SequenceStoreOptions {\n adapter: NoydbStore\n vault: string\n encrypted: boolean\n getDEK: (collectionName: string) => Promise<EnclaveKey>\n actor: string\n}\n\nexport class SequenceStore {\n private readonly adapter: NoydbStore\n private readonly vault: string\n private readonly encrypted: boolean\n private readonly getDEK: (collectionName: string) => Promise<EnclaveKey>\n private readonly actor: string\n /**\n * Memoized DEK promise. The `_sequences` collection DEK is created on\n * first access; without sharing one promise, a burst of concurrent\n * `next()` calls would each trigger DEK creation and diverge (one\n * writer's ciphertext unreadable by another). One shared promise → one\n * DEK.\n */\n private dekPromise: Promise<EnclaveKey> | null = null\n\n constructor(opts: SequenceStoreOptions) {\n this.adapter = opts.adapter\n this.vault = opts.vault\n this.encrypted = opts.encrypted\n this.getDEK = opts.getDEK\n this.actor = opts.actor\n }\n\n /** A handle bound to one sequence name. */\n handle(name: string): SequenceHandle {\n return {\n next: () => this.next(name),\n peek: () => this.peek(name),\n seedTo: (n) => this.seedTo(name, n),\n }\n }\n\n private assertOnline(): void {\n if (this.adapter.capabilities?.casAtomic !== true) {\n throw new SequenceOfflineError()\n }\n }\n\n private dek(): Promise<EnclaveKey> {\n if (!this.dekPromise) this.dekPromise = this.getDEK(SEQUENCE_COLLECTION)\n return this.dekPromise\n }\n\n private async read(name: string): Promise<{ env: EncryptedEnvelope | null; value: number }> {\n const env = await this.adapter.get(this.vault, SEQUENCE_COLLECTION, name)\n if (!env) return { env: null, value: 0 }\n const json = this.encrypted ? await openEnvelopeJson({ collection: SEQUENCE_COLLECTION, id: name }, env, await this.dek()) : env._data\n const state = JSON.parse(json) as SequenceState\n return { env, value: state.value }\n }\n\n private async encryptState(name: string, state: SequenceState, version: number): Promise<EncryptedEnvelope> {\n const json = JSON.stringify(state)\n if (!this.encrypted) {\n return buildRecordEnvelope({ collection: SEQUENCE_COLLECTION, id: name, version }, { iv: '', data: json})\n }\n const identity = { collection: SEQUENCE_COLLECTION, id: name, version }\n const { iv, data } = await encrypt(json, await this.dek(), buildRecordAad(identity))\n return buildRecordEnvelope(identity, { iv, data})\n }\n\n async peek(name: string): Promise<number> {\n return (await this.read(name)).value\n }\n\n async next(name: string): Promise<number> {\n this.assertOnline()\n let lastConflict: ConflictError | undefined\n for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {\n const { env, value } = await this.read(name)\n const nextValue = value + 1\n const expectedVersion = env?._v ?? 0 // 0 ≡ \"must not yet exist\" (create)\n const envelope = await this.encryptState(name, { value: nextValue }, expectedVersion + 1)\n try {\n await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion)\n return nextValue\n } catch (err) {\n if (isConflictError(err)) {\n lastConflict = err\n if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt)\n continue\n }\n throw err\n }\n }\n void lastConflict\n throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS)\n }\n\n async seedTo(name: string, n: number): Promise<void> {\n this.assertOnline()\n if (n <= 0) return // set-if-greater: 0 (and any non-positive seed) is a no-op\n let lastConflict: ConflictError | undefined\n for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {\n const { env, value } = await this.read(name)\n if (value >= n) return // already at or past the floor — no write, idempotent\n const expectedVersion = env?._v ?? 0 // 0 ≡ \"must not yet exist\" (create)\n const envelope = await this.encryptState(name, { value: n }, expectedVersion + 1)\n try {\n await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion)\n return\n } catch (err) {\n if (isConflictError(err)) {\n lastConflict = err\n if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt)\n continue\n }\n throw err\n }\n }\n void lastConflict\n throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWO,SAAS,eAAiC;AAC/C,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,aAAO,IAAI,cAAc,IAAI;AAAA,IAC/B;AAAA,EACF;AACF;;;ACWO,IAAM,cAAgC;AAAA,EAC3C,cAA6B;AAC3B,UAAM,IAAI,wBAAwB;AAAA,EACpC;AACF;;;ACCO,IAAM,sBAAsB;AAKnC,IAAM,oBAAoB;AA2D1B,IAAM,mBAAmB;AACzB,IAAM,gBAAgB;AACtB,IAAM,sBAAsB;AAQrB,SAAS,sBACd,QACA,QACA,WAC4B;AAC5B,QAAM,QAAQ,aAAa,CAAC;AAC5B,aAAW,KAAK,OAAO,SAAS,gBAAgB,GAAG;AACjD,UAAM,QAAQ,EAAE,CAAC,KAAK;AACtB,QAAI,UAAU,MAAO;AACrB,QAAI,cAAc,KAAK,KAAK,EAAG;AAC/B,UAAM,YAAY,oBAAoB,KAAK,KAAK;AAChD,QAAI,WAAW;AACb,YAAM,MAAM,OAAO,UAAU,CAAC,CAAC;AAC/B,UAAI,OAAO,MAAM,QAAQ;AACvB,cAAM,IAAI;AAAA,UACR,aAAa,MAAM,sBAAsB,KAAK,iCAAiC,GAAG,cACpE,MAAM,MAAM;AAAA,QAC5B;AAAA,MACF;AACA;AAAA,IACF;AACA,UAAM,IAAI;AAAA,MACR,aAAa,MAAM,uCAAuC,KAAK;AAAA,IAEjE;AAAA,EACF;AACA,SAAO,CAAC,WACN,OAAO,QAAQ,kBAAkB,CAAC,MAAM,UAAkB;AACxD,QAAI,UAAU,MAAO,QAAO,OAAO,MAAM;AACzC,UAAM,WAAW,cAAc,KAAK,KAAK;AACzC,QAAI,SAAU,QAAO,OAAO,MAAM,EAAE,SAAS,OAAO,SAAS,CAAC,CAAC,GAAG,GAAG;AACrE,UAA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,UAAM,IAAI,wBAAwB,MAAM,iBAAiB;AAAA,EAC3D;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadVaultPolicy,
|
|
3
3
|
saveVaultPolicy
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DKYEVHZH.js";
|
|
5
5
|
import {
|
|
6
6
|
PolicyDeniedError,
|
|
7
7
|
ValidationError
|
|
@@ -364,4 +364,4 @@ export {
|
|
|
364
364
|
describeGate,
|
|
365
365
|
createNoydbPolicy
|
|
366
366
|
};
|
|
367
|
-
//# sourceMappingURL=chunk-
|
|
367
|
+
//# sourceMappingURL=chunk-AA7LM2A3.js.map
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-5D2ALSM5.js";
|
|
4
4
|
import {
|
|
5
5
|
RecordCodec
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-X3AXSYBL.js";
|
|
7
7
|
|
|
8
8
|
// src/with-formula/materialized-views/stale.ts
|
|
9
|
-
var loadMVExecutor = lazy(() => import("./executor-
|
|
9
|
+
var loadMVExecutor = lazy(() => import("./executor-FRUVM36Q.js"));
|
|
10
10
|
var _staleByRegistry = /* @__PURE__ */ new WeakMap();
|
|
11
11
|
function markMVStale(registry, mvName) {
|
|
12
12
|
let set = _staleByRegistry.get(registry);
|
|
@@ -26,7 +26,7 @@ function storeOf(accessor, collectionName) {
|
|
|
26
26
|
return { adapter: c.adapter, vault: c.vault };
|
|
27
27
|
}
|
|
28
28
|
async function writeMVStaleMarker(adapter, vault, mvName) {
|
|
29
|
-
const env = RecordCodec.buildPlaintextEnvelope({ version: 1, data: "{}" });
|
|
29
|
+
const env = RecordCodec.buildPlaintextEnvelope({ collection: MV_STALE_COLLECTION, id: mvName, version: 1 }, { data: "{}" });
|
|
30
30
|
await adapter.put(vault, MV_STALE_COLLECTION, mvName, env);
|
|
31
31
|
}
|
|
32
32
|
async function deleteMVStaleMarker(adapter, vault, mvName) {
|
|
@@ -134,4 +134,4 @@ export {
|
|
|
134
134
|
clearMVStale,
|
|
135
135
|
clearMVStaleFully
|
|
136
136
|
};
|
|
137
|
-
//# sourceMappingURL=chunk-
|
|
137
|
+
//# sourceMappingURL=chunk-AIZNLHKN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-formula/materialized-views/stale.ts"],"sourcesContent":["import type { Collection } from '../../kernel/collection.js'\nimport type { MaterializedViewExecutor as MVExecutorType } from './executor.js'\nimport type { TxContext } from '../../with-commit/tx/transaction.js'\nimport type { PutDerivedOutputCtx } from '../../kernel/via/dispatch.js'\nimport type { MaterializedViewRegistry, RegisteredMV } from './registry.js'\n// Type-only — runtime class loaded via dynamic import in\n// `resolveStaleMVOnRead` only when a stale flag actually fires.\n// Keeps the executor chunk out of the floor bundle (mirrors v1 floor-bundle isolation).\nimport type { MVQueryContext } from './types.js'\nimport type { NoydbStore } from '../../kernel/types.js'\nimport { RecordCodec } from '../../kernel/enclave/index.js'\n\nimport { lazy } from '../../kernel/lazy.js'\n\n/** #846c — one memoized binding instead of a cast at the call site. */\nconst loadMVExecutor = lazy(() => import('./executor.js'))\n\n/**\n * Accessor shape passed in from the owning Vault. Provides the\n * registry (used as a stable WeakMap key + to look up MVs by output\n * collection) and the runtime context the lazy refresh needs.\n * Mirrors v1's `DerivationStaleAccessor`.\n */\nexport interface MVStaleAccessor {\n registry(): MaterializedViewRegistry\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getCollection(name: string): Collection<any>\n getActiveTxContext(): TxContext | null\n getQueryContext(): MVQueryContext\n}\n\n/**\n * In-memory stale map keyed by `MaterializedViewRegistry` instance\n * (stable per vault). Each registry maps to a set of MV names that\n * have at least one pending source-change requiring a re-materialize.\n *\n * Persistence across vault close is NOT implemented in this iteration\n * (concern flagged in the v2 spec, mirrors v1 derivation behavior).\n * On vault re-open, the unset stale flag is interpreted as \"fresh\" —\n * `vault.refreshView(name)` is the explicit recompute escape hatch.\n *\n * @internal\n */\nconst _staleByRegistry = new WeakMap<MaterializedViewRegistry, Set<string>>()\n\n/**\n * Mark an MV as stale. Called from `Collection.dispatchMaterializedViews`\n * when a source-write fires for a `refresh: 'lazy'` MV.\n *\n * @internal\n */\nexport function markMVStale(registry: MaterializedViewRegistry, mvName: string): void {\n let set = _staleByRegistry.get(registry)\n if (!set) {\n set = new Set()\n _staleByRegistry.set(registry, set)\n }\n set.add(mvName)\n}\n\n/**\n * Test-only: check whether a given MV name is currently flagged stale\n * against a registry. Exported so the regression suite can pin the\n * stale-bit lifecycle without touching the internal `WeakMap`.\n *\n * @internal\n */\nexport function isMVStale(registry: MaterializedViewRegistry, mvName: string): boolean {\n return _staleByRegistry.get(registry)?.has(mvName) ?? false\n}\n\n/**\n * Reserved collection holding CONTENT-FREE lazy-stale markers (record id =\n * MV name, plaintext `_iv: ''` envelope, no payload) — mirrors the\n * `_meta`/schema-fence marker envelope shape. Written only from the\n * delete/forget/elevate dispatcher (#736); ordinary source writes stay\n * in-memory-only (the cheap path). Read via the adapter directly, never\n * through `vault.collection()` — same reserved-collection convention as\n * `_subject_index`/`_meta`.\n */\nexport const MV_STALE_COLLECTION = '_mv_stale'\n\n/**\n * Once-per-registry hydrate guard for `resolveStaleMVOnRead`'s persisted-marker fold-in.\n * Stores the in-flight/settled PROMISE (not a boolean) — a concurrent cold first read that\n * arrives while the hydrate is still awaiting `adapter.list` must await the SAME promise\n * rather than observing \"already hydrating\" and reading an empty pending set (#736\n * whole-branch review).\n */\nconst _hydratedByRegistry = new WeakMap<MaterializedViewRegistry, Promise<void>>()\n\n/** The adapter + vault name backing any collection in this vault (all collections share both). */\nfunction storeOf(accessor: MVStaleAccessor, collectionName: string): { adapter: NoydbStore; vault: string } {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const c = accessor.getCollection(collectionName) as any\n return { adapter: c.adapter as NoydbStore, vault: c.vault as string }\n}\n\nasync function writeMVStaleMarker(adapter: NoydbStore, vault: string, mvName: string): Promise<void> {\n // Content-free — the marker's only payload is its key (the MV name).\n const env = RecordCodec.buildPlaintextEnvelope({ collection: MV_STALE_COLLECTION, id: mvName, version: 1 }, { data: '{}' })\n await adapter.put(vault, MV_STALE_COLLECTION, mvName, env)\n}\n\nasync function deleteMVStaleMarker(adapter: NoydbStore, vault: string, mvName: string): Promise<void> {\n await adapter.delete(vault, MV_STALE_COLLECTION, mvName)\n}\n\n/**\n * On first `resolveStaleMVOnRead` call for a (cold-reopened) registry, fold every\n * persisted `_mv_stale` marker into the in-memory pending set — otherwise a cold\n * session's empty `WeakMap` entry reads as \"fresh\" and serves the emptied output\n * collection forever.\n */\nasync function hydratePersistedStaleMarkers(accessor: MVStaleAccessor, registry: MaterializedViewRegistry): Promise<void> {\n const mvs = registry.all()\n if (mvs.length === 0) return\n const { adapter, vault } = storeOf(accessor, mvs[0]!.outputCollection)\n // No try/catch: a genuine store failure here must surface, not be read as\n // \"nothing pending\" — silently treating it as fresh is the exact leak class\n // this module closes (mirrors `subject-index.ts`'s bare `adapter.list` reads).\n for (const name of await adapter.list(vault, MV_STALE_COLLECTION)) markMVStale(registry, name)\n}\n\n/**\n * Invalidate an MV from the delete/forget/elevate dispatcher (#736) — the ordinary\n * source-write path (`dispatchMaterializedViews`) never calls this. Deletes EVERY\n * persisted row in `reg.outputCollection` via `_internalDelete` (the at-rest law: a\n * stale mark alone leaves the elevated/forgotten source's plaintext sitting in the\n * output row) using the adapter directly so the read-path's `resolveStaleMVOnRead`\n * isn't triggered mid-invalidation. `mode: 'lazy'` also persists the stale mark so a\n * cold session recomputes on next read; `'manual'` gets the purge only — the MV\n * serves empty until an explicit `vault.refreshView()` (erasure wins). Deletion is\n * stamp-scoped (`_materializedFrom.mvName === reg.spec.name` — see the loop below),\n * so another registered MV sharing this output collection keeps its own rows intact:\n * no cross-MV re-marking is needed here, only `reg` itself is marked stale.\n *\n * Returns the count of rows actually `_internalDelete`d (#761 item 1) — folded by the\n * caller into `dispatchMaterializedViewsOnDelete`'s `deleted` so `ForgetResult.derivedRecordsErased`\n * counts lazy/manual purges too, not just the eager executor's tombstone leg — plus\n * `residueUndecodable`, the bare ids whose ownership stamp could NOT be decoded (#776): a\n * candidate row that fails to decode under the collection's default DEK (e.g. elevated above\n * tier 0 on a tiered output collection) has UNKNOWN ownership — it might be this MV's own\n * output, or (same-collection shape) a plain user record — so it is never erased, but it must\n * be SURFACED rather than silently skipped (the #724 posture), since it may still hold the\n * forgotten/pre-elevation contribution, decryptable by tier-holders — and `residueDeclined`\n * (#785), the bare ids that DID decode and stamp-match but whose `_internalDelete` declined\n * (ownership CONFIRMED, erasure declined).\n *\n * @internal\n */\nexport async function invalidateMVAtRest(\n accessor: MVStaleAccessor,\n reg: RegisteredMV,\n mode: 'lazy' | 'manual',\n): Promise<{ deleted: number; residueUndecodable: string[]; residueDeclined: string[] }> {\n const outputColl = accessor.getCollection(reg.outputCollection)\n const txCtx = accessor.getActiveTxContext()\n const { adapter, vault } = storeOf(accessor, reg.outputCollection)\n let deleted = 0\n const residueUndecodable: string[] = []\n const residueDeclined: string[] = []\n for (const id of await adapter.list(vault, reg.outputCollection)) {\n // A same-collection partition MV (`output: { collection: <source>, partition }`,\n // the DERIV-PP30-001 shape) writes INTO its own source collection — `adapter.list`\n // over `reg.outputCollection` then also returns untouched user source records.\n // Decode each candidate row (the invalidation path is rare; this cost is fine\n // here) and only erase rows THIS MV stamped via `_materializedFrom.mvName` —\n // an unstamped row, or one stamped by a different MV, is never this MV's to\n // delete (#736 whole-branch review, Critical).\n const envelope = await adapter.get(vault, reg.outputCollection, id)\n if (envelope === null) continue\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const decoded = await (outputColl as any)._decodeEnvelope(envelope, id)\n if (decoded === null) { residueUndecodable.push(id); continue } // #776 — ownership unknown, surfaced not skipped\n const stampedBy = (decoded as Record<string, unknown>)._materializedFrom as { mvName?: string } | undefined\n if (stampedBy?.mvName !== reg.spec.name) continue\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (await (outputColl as any)._internalDelete(id, txCtx)) {\n deleted++\n } else {\n // #782 part b — decoded AND stamp-owned, but erasure declined (#718 tier-elevation\n // gate). Ownership IS confirmed — a real silent survival, not a legit stamp-mismatch\n // skip. Surface it too, in its own channel (#785 — distinct from the decode-null case).\n residueDeclined.push(id)\n }\n }\n\n // `mode: 'manual'` gets the purge only (erasure wins, no auto-recompute promise);\n // `'lazy'` also marks + persists ITS OWN stale bit for cold-session recompute. No\n // sibling MV on the same output collection is touched here — the stamp-scoped\n // deletion above never erased sibling rows in the first place (#736 re-review).\n if (mode === 'lazy') {\n const registry = accessor.registry()\n markMVStale(registry, reg.spec.name)\n await writeMVStaleMarker(adapter, vault, reg.spec.name)\n }\n return { deleted, residueUndecodable, residueDeclined }\n}\n\n/**\n * Called from `Collection.get` (and any reader that materializes the\n * MV's output collection). If any MV producing `outputCollection` is\n * flagged stale, runs the executor against the live source state\n * before returning. No-op when there is no pending work — keeps the\n * read fast path negligible.\n *\n * `dispatchCtx` (#641): threaded from the calling `Collection`'s\n * `#dispatchCtx({ collection: outputCollection, id: 'resolve-on-read' })` — a read has no\n * real \"reacting write\" record, so `'resolve-on-read'` is the sentinel id, mirroring\n * `Vault.refreshView()`'s `'refreshView'` sentinel for the same reason. Passed straight\n * through to the executor so a stale row whose output lands in a closed period follows the\n * frozen-output rule (skip + `derivation:skipped-frozen`, #637) instead of throwing\n * `PeriodClosedError` out of a read.\n *\n * Dynamic-imports the executor only when a stale flag actually fires\n * (the floor-bundle isolation pattern v1 derivations established in\n * floor-bundle isolation pattern).\n */\nexport async function resolveStaleMVOnRead(\n accessor: MVStaleAccessor,\n outputCollection: string,\n dispatchCtx?: PutDerivedOutputCtx,\n): Promise<void> {\n const registry = accessor.registry()\n // Cold session: the in-memory WeakMap has no entry for this (freshly\n // constructed) registry yet — fold any persisted `_mv_stale` markers in\n // before reading the pending set, once per registry (#736). Memoize the\n // PROMISE, not a boolean: a concurrent first read arriving while the\n // hydrate is still awaiting `adapter.list` must await the SAME promise —\n // otherwise it observes \"already hydrating\", skips straight to an empty\n // pending set, and serves the purged/stale view as fresh (#736\n // whole-branch review, hydrate-once race). On rejection, evict the entry\n // BEFORE rethrowing — a cached rejected promise would otherwise poison the\n // MV read surface for the rest of the session (every later read re-awaits\n // the same rejection instead of retrying the store call) (#736 re-review).\n let hydrate = _hydratedByRegistry.get(registry)\n if (!hydrate) {\n hydrate = hydratePersistedStaleMarkers(accessor, registry).catch((err: unknown) => {\n _hydratedByRegistry.delete(registry)\n throw err\n })\n _hydratedByRegistry.set(registry, hydrate)\n }\n await hydrate\n const pending = _staleByRegistry.get(registry)\n if (!pending || pending.size === 0) return\n\n const { adapter, vault } = storeOf(accessor, outputCollection)\n\n // Clean up persisted markers for MV names no longer registered (renamed or\n // removed since the marker was written). Without this sweep an orphaned name\n // can never become a `candidate` below — `candidates` is built from\n // `registry.all()`, which no longer lists it — so both the in-memory pending\n // entry and the persisted `_mv_stale` row would linger forever, re-hydrating\n // on every cold session (#736 whole-branch review).\n for (const name of pending) {\n if (registry.byName(name)) continue\n pending.delete(name)\n await deleteMVStaleMarker(adapter, vault, name)\n }\n if (pending.size === 0) return\n\n // Find every MV that writes to this output collection AND is\n // currently flagged stale. Multiple MVs CAN share an output\n // collection in theory; in practice the registration validation +\n // cycle detection make this unusual.\n const candidates: string[] = []\n for (const mv of registry.all()) {\n if (mv.outputCollection !== outputCollection) continue\n if (!pending.has(mv.spec.name)) continue\n candidates.push(mv.spec.name)\n }\n if (candidates.length === 0) return\n\n let executor: typeof MVExecutorType | null = null\n for (const name of candidates) {\n const reg = registry.byName(name)\n if (!reg) {\n // Unreachable in practice — `candidates` is drawn from `registry.all()`,\n // and the orphan sweep above already cleared any name absent from it.\n // Kept as a defensive fallback; also clears the persisted marker so it\n // can't linger if this ever does fire.\n pending.delete(name)\n await deleteMVStaleMarker(adapter, vault, name)\n continue\n }\n executor ??= (await loadMVExecutor()).MaterializedViewExecutor\n // A cold-hydrated stale flag (unlike an in-session one) can fire with\n // NONE of the MV's dependency collections touched yet this session —\n // the sync `Query.toArray()` `spec.query()` runs reads straight off\n // `Collection`'s in-memory cache, populated only by a prior async\n // touch (`ensureHydrated()`, called from `get`/`list`/`put`, never\n // from `query()` itself). Warm every dependency first so the recompute\n // sees the live persisted state instead of an empty cache (#736).\n for (const dep of reg.dependencies) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await (accessor.getCollection(dep) as any).ensureHydrated()\n }\n await executor.refresh(reg, {\n getCollection: (n) => accessor.getCollection(n),\n getActiveTxContext: () => accessor.getActiveTxContext(),\n getQueryContext: () => accessor.getQueryContext(),\n ...(dispatchCtx !== undefined ? { dispatchCtx } : {}),\n })\n pending.delete(name)\n // Runs even when no marker was ever persisted for this name (an in-session-only\n // stale bit — e.g. the cheap ordinary-write path never writes one, see the\n // \"cheap-path guarantee\" test). `adapter.delete` on an absent key is a harmless\n // void — keeping this unconditional avoids branching on marker origin here.\n await deleteMVStaleMarker(adapter, vault, name)\n }\n}\n\n/**\n * Drop every stale flag for a registry. Used after a manual\n * `vault.refreshView(name)` runs the executor explicitly — the\n * post-refresh state matches the registered strategies, so\n * lingering stale bits would force a redundant refresh on the next\n * read.\n *\n * @internal\n */\nexport function clearMVStale(registry: MaterializedViewRegistry, mvName: string): void {\n _staleByRegistry.get(registry)?.delete(mvName)\n}\n\n/**\n * `clearMVStale` plus the persisted marker (#736) — `Vault.refreshView()`'s\n * completion path. A lingering persisted marker after a manual refresh would\n * make the NEXT cold session recompute redundantly.\n *\n * @internal\n */\nexport async function clearMVStaleFully(\n adapter: NoydbStore,\n vault: string,\n registry: MaterializedViewRegistry,\n mvName: string,\n): Promise<void> {\n clearMVStale(registry, mvName)\n await deleteMVStaleMarker(adapter, vault, mvName)\n}\n"],"mappings":";;;;;;;;AAeA,IAAM,iBAAiB,KAAK,MAAM,OAAO,wBAAe,CAAC;AA4BzD,IAAM,mBAAmB,oBAAI,QAA+C;AAQrE,S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LLECTION
|
|
3
|
+
} from "./chunk-IN5EZWYQ.js";
|
|
4
|
+
import {
|
|
5
|
+
assemblePodContainer,
|
|
6
|
+
buildExtractedPartitionWrapper
|
|
7
|
+
} from "./chunk-TNOQNU3R.js";
|
|
1
8
|
import {
|
|
2
9
|
BLOB_CHUNKS_COLLECTION,
|
|
3
10
|
BLOB_COLLECTION,
|
|
@@ -5,14 +12,7 @@ import {
|
|
|
5
12
|
BLOB_INTENT_COLLECTION,
|
|
6
13
|
BLOB_SLOTS_PREFIX,
|
|
7
14
|
BLOB_VERSIONS_PREFIX
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
SCHEMAS_COLLECTION
|
|
11
|
-
} from "./chunk-A3WHDOWI.js";
|
|
12
|
-
import {
|
|
13
|
-
assemblePodContainer,
|
|
14
|
-
buildExtractedPartitionWrapper
|
|
15
|
-
} from "./chunk-THUITYH7.js";
|
|
15
|
+
} from "./chunk-RAYGDC4A.js";
|
|
16
16
|
import {
|
|
17
17
|
generateULID
|
|
18
18
|
} from "./chunk-4AOERLTV.js";
|
|
@@ -23,14 +23,16 @@ import {
|
|
|
23
23
|
canonicalJson,
|
|
24
24
|
envelopePayloadHash,
|
|
25
25
|
hashEntry
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-FY33DKPH.js";
|
|
27
27
|
import {
|
|
28
|
+
buildRecordAad,
|
|
28
29
|
openEnvelopeJson,
|
|
30
|
+
recordAadFor,
|
|
29
31
|
writeEnvelopeBody
|
|
30
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-X3AXSYBL.js";
|
|
31
33
|
import {
|
|
32
34
|
buildRecordEnvelope
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ZVAFJQZB.js";
|
|
34
36
|
import {
|
|
35
37
|
bufferToBase64,
|
|
36
38
|
decrypt,
|
|
@@ -43,7 +45,7 @@ import {
|
|
|
43
45
|
} from "./chunk-QTDAPDDV.js";
|
|
44
46
|
import {
|
|
45
47
|
NOYDB_BACKUP_VERSION
|
|
46
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-3Y4OFWQJ.js";
|
|
47
49
|
import {
|
|
48
50
|
PartitionExtractionError
|
|
49
51
|
} from "./chunk-I64WQSN3.js";
|
|
@@ -187,15 +189,16 @@ async function reKeyClosure(vault, closure, fieldProjection) {
|
|
|
187
189
|
);
|
|
188
190
|
}
|
|
189
191
|
if (env._cek !== void 0) {
|
|
192
|
+
const aad = recordAadFor({ collection: collectionName, id }, env);
|
|
190
193
|
const cek = await unwrapCek(env._cek, srcDek);
|
|
191
|
-
const plaintext2 = await decrypt(env._iv, env._data, cek);
|
|
192
|
-
const { iv: iv2, data: data2 } = await encrypt(project(plaintext2), cek);
|
|
194
|
+
const plaintext2 = await decrypt(env._iv, env._data, cek, aad);
|
|
195
|
+
const { iv: iv2, data: data2 } = await encrypt(project(plaintext2), cek, aad);
|
|
193
196
|
const wrapped = await wrapCek(cek, destDek);
|
|
194
197
|
out[id] = { ...env, _iv: iv2, _data: data2, _cek: wrapped };
|
|
195
198
|
continue;
|
|
196
199
|
}
|
|
197
|
-
const plaintext = await openEnvelopeJson(env, srcDek);
|
|
198
|
-
const { iv, data } = await encrypt(project(plaintext), destDek);
|
|
200
|
+
const plaintext = await openEnvelopeJson({ collection: collectionName, id }, env, srcDek);
|
|
201
|
+
const { iv, data } = await encrypt(project(plaintext), destDek, recordAadFor({ collection: collectionName, id }, env));
|
|
199
202
|
out[id] = { ...env, _iv: iv, _data: data };
|
|
200
203
|
}
|
|
201
204
|
collections[collectionName] = out;
|
|
@@ -212,8 +215,8 @@ async function reKeySchemas(vault, closure, destDeks, fieldProjection) {
|
|
|
212
215
|
const destDek = destDeks.get(collectionName);
|
|
213
216
|
if (!destDek) continue;
|
|
214
217
|
const srcDek = await getDEK(collectionName);
|
|
215
|
-
const plaintext = await openEnvelopeJson(env, srcDek);
|
|
216
|
-
const { iv, data } = await encrypt(plaintext, destDek);
|
|
218
|
+
const plaintext = await openEnvelopeJson({ collection: SCHEMAS_COLLECTION, id: collectionName }, env, srcDek);
|
|
219
|
+
const { iv, data } = await encrypt(plaintext, destDek, recordAadFor({ collection: SCHEMAS_COLLECTION, id: collectionName }, env));
|
|
217
220
|
out[collectionName] = { ...env, _iv: iv, _data: data };
|
|
218
221
|
}
|
|
219
222
|
return out;
|
|
@@ -227,7 +230,7 @@ async function reKeyLedger(vault, closure, reKeyedCollections, ledgerDek) {
|
|
|
227
230
|
for (const id of ids) {
|
|
228
231
|
const env = await adapter.get(vaultName, LEDGER_COLLECTION, id);
|
|
229
232
|
if (!env) continue;
|
|
230
|
-
srcEntries.push(JSON.parse(await openEnvelopeJson(env, srcLedgerDek)));
|
|
233
|
+
srcEntries.push(JSON.parse(await openEnvelopeJson({ collection: LEDGER_COLLECTION, id }, env, srcLedgerDek)));
|
|
231
234
|
}
|
|
232
235
|
const kept = srcEntries.filter(
|
|
233
236
|
(e) => (e.op === "put" || e.op === "delete") && (closure.get(e.collection)?.has(e.id) ?? false)
|
|
@@ -260,10 +263,11 @@ async function reKeyLedger(vault, closure, reKeyedCollections, ledgerDek) {
|
|
|
260
263
|
payloadHash,
|
|
261
264
|
...src.reason !== void 0 ? { reason: src.reason } : {}
|
|
262
265
|
};
|
|
263
|
-
const
|
|
266
|
+
const ledgerIdentity = { collection: LEDGER_COLLECTION, id: paddedIndex(i), version: i + 1 };
|
|
267
|
+
const { iv, data } = await encrypt(canonicalJson(entry), ledgerDek, buildRecordAad(ledgerIdentity));
|
|
264
268
|
entries[paddedIndex(i)] = buildRecordEnvelope(
|
|
265
|
-
|
|
266
|
-
{
|
|
269
|
+
ledgerIdentity,
|
|
270
|
+
{ ts: entry.ts, iv, data }
|
|
267
271
|
);
|
|
268
272
|
prevHash = await hashEntry(entry);
|
|
269
273
|
last = entry;
|
|
@@ -303,8 +307,8 @@ async function reKeyBlobs(vault, closure, destDeks, fieldProjection) {
|
|
|
303
307
|
const intentId = `${collectionName}::${id}`;
|
|
304
308
|
const intentEnv = await adapter.get(vaultName, BLOB_INTENT_COLLECTION, intentId);
|
|
305
309
|
if (intentEnv) {
|
|
306
|
-
const intentPlain = await openEnvelopeJson(intentEnv, srcDek);
|
|
307
|
-
const intentBody = await writeEnvelopeBody(intentPlain, destDek);
|
|
310
|
+
const intentPlain = await openEnvelopeJson({ collection: BLOB_INTENT_COLLECTION, id: intentId }, intentEnv, srcDek);
|
|
311
|
+
const intentBody = await writeEnvelopeBody({ collection: BLOB_INTENT_COLLECTION, id: intentId, version: intentEnv._v }, intentPlain, destDek);
|
|
308
312
|
place(BLOB_INTENT_COLLECTION, intentId, { ...intentEnv, ...intentBody });
|
|
309
313
|
}
|
|
310
314
|
const env = await adapter.get(vaultName, slotsCollection, id);
|
|
@@ -314,7 +318,7 @@ async function reKeyBlobs(vault, closure, destDeks, fieldProjection) {
|
|
|
314
318
|
`#748: reKeyBlobs fetched an elevated slot-map envelope (collection="${slotsCollection}" id="${id}" _tier=${env._tier}) \u2014 this is unreachable by construction. Refusing to carry it into a partition.`
|
|
315
319
|
);
|
|
316
320
|
}
|
|
317
|
-
const slots = JSON.parse(await openEnvelopeJson(env, srcDek));
|
|
321
|
+
const slots = JSON.parse(await openEnvelopeJson({ collection: slotsCollection, id }, env, srcDek));
|
|
318
322
|
const kept = {};
|
|
319
323
|
for (const [slotName, slot] of Object.entries(slots)) {
|
|
320
324
|
if (proj && !proj.has(slotName)) continue;
|
|
@@ -324,7 +328,7 @@ async function reKeyBlobs(vault, closure, destDeks, fieldProjection) {
|
|
|
324
328
|
addRef(slot.eTag);
|
|
325
329
|
}
|
|
326
330
|
if (Object.keys(kept).length === 0) continue;
|
|
327
|
-
const { iv, data } = await encrypt(JSON.stringify(kept), destDek);
|
|
331
|
+
const { iv, data } = await encrypt(JSON.stringify(kept), destDek, recordAadFor({ collection: slotsCollection, id }, env));
|
|
328
332
|
place(slotsCollection, id, { ...env, _iv: iv, _data: data });
|
|
329
333
|
}
|
|
330
334
|
const versionsCollection = `${BLOB_VERSIONS_PREFIX}${collectionName}`;
|
|
@@ -340,9 +344,9 @@ async function reKeyBlobs(vault, closure, destDeks, fieldProjection) {
|
|
|
340
344
|
`#748: reKeyBlobs fetched an elevated version-record envelope (collection="${versionsCollection}" key="${key}" _tier=${env._tier}) \u2014 this is unreachable by construction. Refusing to carry it into a partition.`
|
|
341
345
|
);
|
|
342
346
|
}
|
|
343
|
-
const record = JSON.parse(await openEnvelopeJson(env, srcDek));
|
|
347
|
+
const record = JSON.parse(await openEnvelopeJson({ collection: versionsCollection, id: key }, env, srcDek));
|
|
344
348
|
addRef(record.eTag);
|
|
345
|
-
const { iv, data } = await encrypt(JSON.stringify(record), destDek);
|
|
349
|
+
const { iv, data } = await encrypt(JSON.stringify(record), destDek, recordAadFor({ collection: versionsCollection, id: key }, env));
|
|
346
350
|
place(versionsCollection, key, { ...env, _iv: iv, _data: data });
|
|
347
351
|
}
|
|
348
352
|
}
|
|
@@ -352,7 +356,7 @@ async function reKeyBlobs(vault, closure, destDeks, fieldProjection) {
|
|
|
352
356
|
for (const [eTag, refCount] of carriedRefs) {
|
|
353
357
|
const idxEnv = await adapter.get(vaultName, BLOB_INDEX_COLLECTION, eTag);
|
|
354
358
|
if (!idxEnv) continue;
|
|
355
|
-
const blob = JSON.parse(await openEnvelopeJson(idxEnv, srcBlobDek));
|
|
359
|
+
const blob = JSON.parse(await openEnvelopeJson({ collection: BLOB_INDEX_COLLECTION, id: eTag }, idxEnv, srcBlobDek));
|
|
356
360
|
let contentCek;
|
|
357
361
|
let chunksPassthrough;
|
|
358
362
|
if (blob._cek !== void 0) {
|
|
@@ -382,7 +386,7 @@ async function reKeyBlobs(vault, closure, destDeks, fieldProjection) {
|
|
|
382
386
|
const { _cekPending, ...rest } = blob;
|
|
383
387
|
void _cekPending;
|
|
384
388
|
const carried = { ...rest, refCount, _cek: await wrapCek(contentCek, transferBlobDek) };
|
|
385
|
-
const { iv, data } = await encrypt(JSON.stringify(carried), transferBlobDek);
|
|
389
|
+
const { iv, data } = await encrypt(JSON.stringify(carried), transferBlobDek, recordAadFor({ collection: BLOB_INDEX_COLLECTION, id: eTag }, idxEnv));
|
|
386
390
|
place(BLOB_INDEX_COLLECTION, eTag, { ...idxEnv, _iv: iv, _data: data });
|
|
387
391
|
}
|
|
388
392
|
return { internal, blobDek: transferBlobDek };
|
|
@@ -490,4 +494,4 @@ export {
|
|
|
490
494
|
extractPartition,
|
|
491
495
|
extractPartitionCore
|
|
492
496
|
};
|
|
493
|
-
//# sourceMappingURL=chunk-
|
|
497
|
+
//# sourceMappingURL=chunk-AMMYIT7F.js.map
|