@noy-db/hub 0.4.0-pre.4 → 0.4.0-pre.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/aggregate/index.js +4 -4
- package/dist/api-22ES33N3.js +20 -0
- package/dist/as/index.js +11 -11
- package/dist/attestation/index.js +20 -20
- package/dist/{backup-JL2GOTYQ.js → backup-YCHAC575.js} +11 -11
- package/dist/blobs/index.js +12 -12
- package/dist/broker/index.js +12 -12
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.js +29 -29
- package/dist/{chunk-2RMDVWGB.js → chunk-2CRZOVDI.js} +2 -2
- package/dist/{chunk-T7S4V52L.js → chunk-2PDBYF2O.js} +4 -4
- package/dist/{chunk-WJDYZP3U.js → chunk-3LJYHE7S.js} +36 -36
- package/dist/chunk-3LJYHE7S.js.map +1 -0
- package/dist/{chunk-CCT4WZI6.js → chunk-3OWYOECI.js} +5 -5
- package/dist/chunk-3OWYOECI.js.map +1 -0
- package/dist/{chunk-L4OA7G5T.js → chunk-522MBPE5.js} +2 -2
- package/dist/{chunk-ZJGZDOQO.js → chunk-5ATANZSW.js} +6 -6
- package/dist/{chunk-M25ZIEB2.js → chunk-5HSSTOOG.js} +2 -2
- package/dist/{chunk-LLVW4V7R.js → chunk-5WLDZZ6S.js} +3 -3
- package/dist/{chunk-7B4GPCX7.js → chunk-6RPWILRH.js} +5 -5
- package/dist/{chunk-IGM563N5.js → chunk-6SYOHUHM.js} +6 -6
- package/dist/chunk-6SYOHUHM.js.map +1 -0
- package/dist/{chunk-HGVFJL63.js → chunk-7BIJS6II.js} +15 -5
- package/dist/{chunk-HGVFJL63.js.map → chunk-7BIJS6II.js.map} +1 -1
- package/dist/{chunk-KR5EGWI4.js → chunk-7ICV4ASA.js} +5 -5
- package/dist/{chunk-J3VW4J4E.js → chunk-7LP7FFJ2.js} +2 -2
- package/dist/chunk-7LP7FFJ2.js.map +1 -0
- package/dist/{chunk-5P5AAXYA.js → chunk-7U6AB7DZ.js} +7 -7
- package/dist/chunk-7U6AB7DZ.js.map +1 -0
- package/dist/{chunk-KMONEHDJ.js → chunk-AFAPBZAA.js} +2 -2
- package/dist/{chunk-GBEXTC6Z.js → chunk-BAAUFCJK.js} +3 -3
- package/dist/chunk-BAAUFCJK.js.map +1 -0
- package/dist/{chunk-CGPO3ZYB.js → chunk-BY5YBSXA.js} +2 -2
- package/dist/{chunk-3O62PVDW.js → chunk-CJVEAVYH.js} +5 -5
- package/dist/chunk-CJVEAVYH.js.map +1 -0
- package/dist/{chunk-3XVOLB75.js → chunk-CKUYQO2P.js} +3 -3
- package/dist/{chunk-2JZ763FV.js → chunk-D4LAJ737.js} +2 -2
- package/dist/{chunk-OOTTXUNV.js → chunk-DYZ5CCVM.js} +2 -2
- package/dist/{chunk-W7TCXZWU.js → chunk-EEZCB74X.js} +393 -716
- package/dist/chunk-EEZCB74X.js.map +1 -0
- package/dist/{chunk-N4FZ6ITM.js → chunk-EGU4PWQW.js} +2 -2
- package/dist/{chunk-JKWNG3TM.js → chunk-FHHYCBBP.js} +2 -2
- package/dist/{chunk-QUIG6BZT.js → chunk-FIP7KI2P.js} +26 -26
- package/dist/chunk-FIP7KI2P.js.map +1 -0
- package/dist/{chunk-5KI3REO3.js → chunk-FTCGEUOY.js} +7 -7
- package/dist/{chunk-5BB3N4KU.js → chunk-G4MFQXYX.js} +2 -2
- package/dist/{chunk-PEY6ZTCF.js → chunk-GEEJPID6.js} +9 -9
- package/dist/{chunk-PEY6ZTCF.js.map → chunk-GEEJPID6.js.map} +1 -1
- package/dist/{chunk-KVHWEPT2.js → chunk-GHEMAVTN.js} +2 -2
- package/dist/{chunk-OVFCAS7U.js → chunk-GP54LU5N.js} +9 -9
- package/dist/{chunk-XW7NWO4A.js → chunk-GTNRMJYH.js} +2 -2
- package/dist/{chunk-JW3XCZA2.js → chunk-HAPY7WFP.js} +11 -11
- package/dist/{chunk-4X6DJZHY.js → chunk-HQKRZIX6.js} +4 -4
- package/dist/{chunk-OWE4BNTM.js → chunk-I2XEBEEF.js} +4 -4
- package/dist/{chunk-WEC3JGBA.js → chunk-IGLU4ME7.js} +3 -3
- package/dist/{chunk-BZK6JEX4.js → chunk-ILM6X6CP.js} +5 -5
- package/dist/{chunk-2KL6NDD4.js → chunk-J5TEU77Q.js} +4 -4
- package/dist/{chunk-UEO5CHOP.js → chunk-JAMDDLIM.js} +13 -13
- package/dist/chunk-JAMDDLIM.js.map +1 -0
- package/dist/{chunk-V7RGFJ3Z.js → chunk-JIHH26WQ.js} +6 -6
- package/dist/{chunk-XGVDLQJE.js → chunk-JN3SGXJE.js} +3 -3
- package/dist/{chunk-XULHFSHO.js → chunk-K4BWPNJO.js} +5 -5
- package/dist/chunk-K4BWPNJO.js.map +1 -0
- package/dist/{chunk-BZEPJJOK.js → chunk-K7BADAOS.js} +4 -4
- package/dist/{chunk-BLB7P7LS.js → chunk-KJTIAECI.js} +17 -17
- package/dist/chunk-KJTIAECI.js.map +1 -0
- package/dist/{chunk-U73LHVPF.js → chunk-L2CAWCQL.js} +4 -4
- package/dist/{chunk-MSO2C3KG.js → chunk-LC7DSMHR.js} +2 -2
- package/dist/{chunk-JA5B3SLH.js → chunk-M6QA2KK2.js} +2 -2
- package/dist/{chunk-IUIVDVXM.js → chunk-MUPZ6IZX.js} +2 -2
- package/dist/{chunk-QAFWRGVD.js → chunk-OGVE4IJW.js} +7 -7
- package/dist/{chunk-BCOKZC4B.js → chunk-OHV6T5JB.js} +19 -19
- package/dist/chunk-OHV6T5JB.js.map +1 -0
- package/dist/{chunk-25ZDB25Z.js → chunk-OMSKGLYA.js} +3 -3
- package/dist/chunk-OMSKGLYA.js.map +1 -0
- package/dist/{chunk-2U7Y7BNJ.js → chunk-ONB627HU.js} +2 -2
- package/dist/{chunk-GYB2QK5H.js → chunk-OWLZONGX.js} +2 -2
- package/dist/{chunk-YHPUDB7Q.js → chunk-OWOT7CFC.js} +2 -2
- package/dist/{chunk-VEX6G3YL.js → chunk-P4NUJVWL.js} +2 -2
- package/dist/{chunk-NM4LVUXH.js → chunk-PTT2NB46.js} +2 -2
- package/dist/{chunk-2ITLQZV5.js → chunk-PWWWMRT7.js} +2 -2
- package/dist/{chunk-GS3Q2KOZ.js → chunk-QBOQI6PG.js} +2 -2
- package/dist/{chunk-JIMEB4C6.js → chunk-QMMOMBH6.js} +4 -4
- package/dist/{chunk-QDNVHA2F.js → chunk-QMZ5A6FQ.js} +2 -2
- package/dist/{chunk-FLHOTGOO.js → chunk-QVGEVZ5F.js} +3 -3
- package/dist/{chunk-AFBJHD55.js → chunk-QZJEYZ4I.js} +5 -5
- package/dist/{chunk-V3YB7RGR.js → chunk-R2N37AA6.js} +3 -3
- package/dist/{chunk-JLHKBAFY.js → chunk-RWW3I3PO.js} +3 -3
- package/dist/{chunk-IGAIOGCN.js → chunk-S4YERMGJ.js} +4 -4
- package/dist/{chunk-OGFPMCSP.js → chunk-SBOHNJUD.js} +2 -2
- package/dist/{chunk-QXPOEAKR.js → chunk-SC4JLMZI.js} +2 -2
- package/dist/{chunk-EDC6MLXV.js → chunk-SEU6QHH4.js} +2 -2
- package/dist/{chunk-F4COUZLL.js → chunk-TMR64XPL.js} +2 -2
- package/dist/{chunk-DEQ2JTBR.js → chunk-TNATF3HB.js} +3 -3
- package/dist/{chunk-GZ2GKOF6.js → chunk-TNJVDG2B.js} +3 -3
- package/dist/{chunk-5OZCCLNC.js → chunk-TSNRZSRC.js} +2 -2
- package/dist/{chunk-QCUH2G77.js → chunk-UTEATWHO.js} +6 -6
- package/dist/{chunk-JA5O7UEZ.js → chunk-UVBHM7AK.js} +6 -6
- package/dist/chunk-UVBHM7AK.js.map +1 -0
- package/dist/{chunk-HKR25MGX.js → chunk-V5JUAW4M.js} +10 -10
- package/dist/chunk-V5JUAW4M.js.map +1 -0
- package/dist/{chunk-YGBIBOCR.js → chunk-VEGQYPCP.js} +7 -7
- package/dist/{chunk-25G7U6RD.js → chunk-WQN5SM7P.js} +2 -2
- package/dist/{chunk-NOT7XA7Q.js → chunk-X3MWEFPT.js} +5 -5
- package/dist/chunk-XUFAFHQM.js +78 -0
- package/dist/chunk-XUFAFHQM.js.map +1 -0
- package/dist/{chunk-MEKAMERX.js → chunk-YCAJDK4O.js} +29 -29
- package/dist/chunk-YCAJDK4O.js.map +1 -0
- package/dist/{chunk-BVZGNMVM.js → chunk-YFFEF6HR.js} +3 -3
- package/dist/{chunk-H4SMS4O2.js → chunk-YJ3TREAC.js} +2 -2
- package/dist/{chunk-5SZ24DL5.js → chunk-YQQPNXNO.js} +6 -6
- package/dist/{chunk-5BHNQNBI.js → chunk-YTW6ZIPD.js} +1 -1
- package/dist/chunk-YTW6ZIPD.js.map +1 -0
- package/dist/{chunk-EW4HFWGJ.js → chunk-YWZEDG7F.js} +6 -6
- package/dist/{chunk-2VUISNGP.js → chunk-YXIVUWDU.js} +5 -5
- package/dist/{chunk-YG2EG6CB.js → chunk-YXZNGHID.js} +4 -4
- package/dist/{chunk-QYJIOWKN.js → chunk-YZN6NRTR.js} +9 -9
- package/dist/{chunk-IZX3WZBF.js → chunk-YZNKFYDC.js} +4 -4
- package/dist/{chunk-E2R5NRZD.js → chunk-Z4D3YGAB.js} +2 -2
- package/dist/{chunk-STR7WBOB.js → chunk-ZUDAK436.js} +2 -2
- package/dist/{chunk-ITI3SJRB.js → chunk-ZX5FNWH7.js} +2 -2
- package/dist/classified/index.js +5 -5
- package/dist/{classified-marker-7S5IEP6Q.js → classified-marker-52P3D72W.js} +3 -3
- package/dist/collection-facade-XKCFHSLR.js +44 -0
- package/dist/{computed-WZNKRLCY.js → computed-33DRJDOC.js} +3 -3
- package/dist/consent/index.js +9 -9
- package/dist/{cover-B5MY43CK.js → cover-5BSNJREH.js} +4 -4
- package/dist/{dead-filter-KRRD57MR.js → dead-filter-JXVCKS6W.js} +2 -2
- package/dist/delegation-WWZPEDK2.js +25 -0
- package/dist/derivations/index.js +12 -12
- package/dist/derive-CWWFEQ4N.js +21 -0
- package/dist/dispatch-PKQQFDBT.js +193 -0
- package/dist/dispatch-PKQQFDBT.js.map +1 -0
- package/dist/dispatch-SMXUO7W5.js +72 -0
- package/dist/dispatch-SMXUO7W5.js.map +1 -0
- package/dist/{enclave-YFKA3GJT.js → enclave-I5H3GINP.js} +11 -11
- package/dist/executor-FCJEH3FU.js +9 -0
- package/dist/executor-OHET7TF7.js +9 -0
- package/dist/executor-SHYLIBOM.js +26 -0
- package/dist/export-accessible-FBL6TDSK.js +23 -0
- package/dist/extract-partition-ZYIRYMTI.js +38 -0
- package/dist/{fanout-sidecar-HJV3A7PM.js → fanout-sidecar-WWXVHHUH.js} +9 -9
- package/dist/find-LEBUXVL7.js +11 -0
- package/dist/forget/index.js +9 -9
- package/dist/guards/index.js +3 -3
- package/dist/history/index.js +12 -12
- package/dist/i18n/index.js +14 -14
- package/dist/index.d.ts +13 -9
- package/dist/index.js +119 -118
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +2 -2
- package/dist/issue-F76PAGIR.js +19 -0
- package/dist/kernel/collection.d.ts +0 -1
- package/dist/kernel/enclave/crypto.d.ts +8 -8
- package/dist/kernel/enclave/index.d.ts +2 -2
- package/dist/kernel/errors.d.ts +20 -20
- package/dist/kernel/noydb.d.ts +32 -91
- package/dist/kernel/types.d.ts +82 -41
- package/dist/kernel/validation.d.ts +33 -33
- package/dist/kernel/vault.d.ts +12 -149
- package/dist/kernel/via/dispatch.d.ts +7 -0
- package/dist/{ledger-SW6QQOAV.js → ledger-M2BKCNVS.js} +11 -11
- package/dist/liberate-ZP7UB57K.js +24 -0
- package/dist/{link-set-GNGGCFI4.js → link-set-ZU4E5J5S.js} +11 -11
- package/dist/materialized-views/index.js +19 -19
- package/dist/noydb-BNDGEK5X.js +71 -0
- package/dist/on/index.js +9 -9
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +13 -13
- package/dist/pod/index.js +11 -11
- package/dist/{policy-EAXSJNOT.js → policy-IY2YEA3A.js} +5 -5
- package/dist/port/at/index.d.ts +4 -4
- package/dist/port/with/collection-options.d.ts +171 -0
- package/dist/port/with/team-strategy.d.ts +1 -1
- package/dist/portability/index.js +8 -8
- package/dist/{post-register-A7HCFBP5.js → post-register-XIAHB6KF.js} +6 -6
- package/dist/query/index.js +6 -6
- package/dist/register-HB4TQZSV.js +23 -0
- package/dist/registry-6BMBFEXT.js +19 -0
- package/dist/registry-7CZWF3EQ.js +9 -0
- package/dist/registry-JOFO7RAH.js +18 -0
- package/dist/request-withdrawal-UN3TRHWI.js +31 -0
- package/dist/{reveal-PB3YG544.js → reveal-VWXRV2XU.js} +6 -6
- package/dist/revoke-OLO2OVR7.js +24 -0
- package/dist/satellites/index.js +1 -1
- package/dist/sealed-record/index.js +12 -12
- package/dist/{seed-EKF4DIBB.js → seed-CDBFOTIK.js} +12 -12
- package/dist/seed-CDBFOTIK.js.map +1 -0
- package/dist/session/index.js +9 -9
- package/dist/shadow/index.js +2 -2
- package/dist/signer-MGGKPYAN.js +25 -0
- package/dist/snapshots/index.js +10 -10
- package/dist/{stale-4UNPHWOU.js → stale-NBROTA66.js} +10 -10
- package/dist/storage-3R37QZLA.js +23 -0
- package/dist/{store-coordination-provider-3AELCZ4Y.js → store-coordination-provider-P3IU5JHD.js} +3 -3
- package/dist/sync/index.js +10 -10
- package/dist/team/index.js +20 -20
- package/dist/tiers/index.js +10 -10
- package/dist/to/index.js +1 -1
- package/dist/tx/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/{verify-MXN66IIH.js → verify-5X37OXRY.js} +5 -5
- package/dist/{walk-H4YE52S2.js → walk-E3OVLBFR.js} +11 -11
- package/dist/with/index.js +11 -11
- package/dist/with-audit/portability/export-accessible.d.ts +4 -4
- package/dist/with-audit/portability/request-withdrawal.d.ts +3 -3
- package/dist/with-audit/portability/withdraw-accessible.d.ts +2 -2
- package/dist/with-audit/sealed-record/strategy.d.ts +1 -1
- package/dist/with-cargo/adopt-partition.d.ts +7 -7
- package/dist/with-cargo/index.d.ts +1 -1
- package/dist/with-commit/history/time-machine.d.ts +2 -2
- package/dist/with-formula/derivations/dispatch.d.ts +98 -0
- package/dist/with-formula/materialized-views/dispatch.d.ts +75 -0
- package/dist/with-party/custody/liberate.d.ts +3 -3
- package/dist/with-party/session/dev-unlock.d.ts +2 -2
- package/dist/with-party/session/session.d.ts +2 -2
- package/dist/with-party/team/deed.d.ts +8 -8
- package/dist/with-party/team/index.d.ts +2 -2
- package/dist/with-party/team/keyring.d.ts +19 -19
- package/dist/with-party/team/{managed-passphrase.d.ts → managed-secret.d.ts} +27 -27
- package/dist/with-party/team/noydb-facade.d.ts +41 -41
- package/dist/with-party/team/peer-recover.d.ts +13 -13
- package/dist/with-party/team/recovery.d.ts +5 -5
- package/dist/with-party/team/rotate-recover.d.ts +30 -30
- package/dist/with-pod/bundle.d.ts +30 -30
- package/dist/with-pod/format.d.ts +2 -2
- package/dist/withdraw-accessible-Q2EMATCU.js +28 -0
- package/package.json +3 -3
- package/dist/api-UPAT2O3M.js +0 -20
- package/dist/chunk-25ZDB25Z.js.map +0 -1
- package/dist/chunk-3O62PVDW.js.map +0 -1
- package/dist/chunk-5BHNQNBI.js.map +0 -1
- package/dist/chunk-5P5AAXYA.js.map +0 -1
- package/dist/chunk-BCOKZC4B.js.map +0 -1
- package/dist/chunk-BLB7P7LS.js.map +0 -1
- package/dist/chunk-CCT4WZI6.js.map +0 -1
- package/dist/chunk-GBEXTC6Z.js.map +0 -1
- package/dist/chunk-HKR25MGX.js.map +0 -1
- package/dist/chunk-IGM563N5.js.map +0 -1
- package/dist/chunk-J3VW4J4E.js.map +0 -1
- package/dist/chunk-JA5O7UEZ.js.map +0 -1
- package/dist/chunk-MEKAMERX.js.map +0 -1
- package/dist/chunk-QUIG6BZT.js.map +0 -1
- package/dist/chunk-UEO5CHOP.js.map +0 -1
- package/dist/chunk-W7TCXZWU.js.map +0 -1
- package/dist/chunk-WJDYZP3U.js.map +0 -1
- package/dist/chunk-XULHFSHO.js.map +0 -1
- package/dist/collection-facade-CMZGQ6IS.js +0 -44
- package/dist/delegation-UT76AQIG.js +0 -25
- package/dist/derive-SGRCCKVP.js +0 -21
- package/dist/executor-TEZYRDN3.js +0 -9
- package/dist/executor-WQQRU6DO.js +0 -9
- package/dist/executor-YORMIBWV.js +0 -26
- package/dist/export-accessible-HXMKW5LJ.js +0 -23
- package/dist/extract-partition-QGQ2R42J.js +0 -38
- package/dist/find-VV6PBIHK.js +0 -11
- package/dist/issue-7JJ4Z7E2.js +0 -19
- package/dist/liberate-FK7JI2QX.js +0 -24
- package/dist/noydb-N5IW6OFZ.js +0 -70
- package/dist/register-YBMRLZLO.js +0 -23
- package/dist/registry-3LXKNXWI.js +0 -9
- package/dist/registry-4V4YQCXJ.js +0 -19
- package/dist/registry-ZULMLCJK.js +0 -18
- package/dist/request-withdrawal-SEVUEUDG.js +0 -31
- package/dist/revoke-5QULL5GT.js +0 -24
- package/dist/seed-EKF4DIBB.js.map +0 -1
- package/dist/signer-ZMH35FT4.js +0 -25
- package/dist/storage-QOZKQMID.js +0 -23
- package/dist/withdraw-accessible-HPOVNG2G.js +0 -28
- /package/dist/{api-UPAT2O3M.js.map → api-22ES33N3.js.map} +0 -0
- /package/dist/{backup-JL2GOTYQ.js.map → backup-YCHAC575.js.map} +0 -0
- /package/dist/{chunk-2RMDVWGB.js.map → chunk-2CRZOVDI.js.map} +0 -0
- /package/dist/{chunk-T7S4V52L.js.map → chunk-2PDBYF2O.js.map} +0 -0
- /package/dist/{chunk-L4OA7G5T.js.map → chunk-522MBPE5.js.map} +0 -0
- /package/dist/{chunk-ZJGZDOQO.js.map → chunk-5ATANZSW.js.map} +0 -0
- /package/dist/{chunk-M25ZIEB2.js.map → chunk-5HSSTOOG.js.map} +0 -0
- /package/dist/{chunk-LLVW4V7R.js.map → chunk-5WLDZZ6S.js.map} +0 -0
- /package/dist/{chunk-7B4GPCX7.js.map → chunk-6RPWILRH.js.map} +0 -0
- /package/dist/{chunk-KR5EGWI4.js.map → chunk-7ICV4ASA.js.map} +0 -0
- /package/dist/{chunk-KMONEHDJ.js.map → chunk-AFAPBZAA.js.map} +0 -0
- /package/dist/{chunk-CGPO3ZYB.js.map → chunk-BY5YBSXA.js.map} +0 -0
- /package/dist/{chunk-3XVOLB75.js.map → chunk-CKUYQO2P.js.map} +0 -0
- /package/dist/{chunk-2JZ763FV.js.map → chunk-D4LAJ737.js.map} +0 -0
- /package/dist/{chunk-OOTTXUNV.js.map → chunk-DYZ5CCVM.js.map} +0 -0
- /package/dist/{chunk-N4FZ6ITM.js.map → chunk-EGU4PWQW.js.map} +0 -0
- /package/dist/{chunk-JKWNG3TM.js.map → chunk-FHHYCBBP.js.map} +0 -0
- /package/dist/{chunk-5KI3REO3.js.map → chunk-FTCGEUOY.js.map} +0 -0
- /package/dist/{chunk-5BB3N4KU.js.map → chunk-G4MFQXYX.js.map} +0 -0
- /package/dist/{chunk-KVHWEPT2.js.map → chunk-GHEMAVTN.js.map} +0 -0
- /package/dist/{chunk-OVFCAS7U.js.map → chunk-GP54LU5N.js.map} +0 -0
- /package/dist/{chunk-XW7NWO4A.js.map → chunk-GTNRMJYH.js.map} +0 -0
- /package/dist/{chunk-JW3XCZA2.js.map → chunk-HAPY7WFP.js.map} +0 -0
- /package/dist/{chunk-4X6DJZHY.js.map → chunk-HQKRZIX6.js.map} +0 -0
- /package/dist/{chunk-OWE4BNTM.js.map → chunk-I2XEBEEF.js.map} +0 -0
- /package/dist/{chunk-WEC3JGBA.js.map → chunk-IGLU4ME7.js.map} +0 -0
- /package/dist/{chunk-BZK6JEX4.js.map → chunk-ILM6X6CP.js.map} +0 -0
- /package/dist/{chunk-2KL6NDD4.js.map → chunk-J5TEU77Q.js.map} +0 -0
- /package/dist/{chunk-V7RGFJ3Z.js.map → chunk-JIHH26WQ.js.map} +0 -0
- /package/dist/{chunk-XGVDLQJE.js.map → chunk-JN3SGXJE.js.map} +0 -0
- /package/dist/{chunk-BZEPJJOK.js.map → chunk-K7BADAOS.js.map} +0 -0
- /package/dist/{chunk-U73LHVPF.js.map → chunk-L2CAWCQL.js.map} +0 -0
- /package/dist/{chunk-MSO2C3KG.js.map → chunk-LC7DSMHR.js.map} +0 -0
- /package/dist/{chunk-JA5B3SLH.js.map → chunk-M6QA2KK2.js.map} +0 -0
- /package/dist/{chunk-IUIVDVXM.js.map → chunk-MUPZ6IZX.js.map} +0 -0
- /package/dist/{chunk-QAFWRGVD.js.map → chunk-OGVE4IJW.js.map} +0 -0
- /package/dist/{chunk-2U7Y7BNJ.js.map → chunk-ONB627HU.js.map} +0 -0
- /package/dist/{chunk-GYB2QK5H.js.map → chunk-OWLZONGX.js.map} +0 -0
- /package/dist/{chunk-YHPUDB7Q.js.map → chunk-OWOT7CFC.js.map} +0 -0
- /package/dist/{chunk-VEX6G3YL.js.map → chunk-P4NUJVWL.js.map} +0 -0
- /package/dist/{chunk-NM4LVUXH.js.map → chunk-PTT2NB46.js.map} +0 -0
- /package/dist/{chunk-2ITLQZV5.js.map → chunk-PWWWMRT7.js.map} +0 -0
- /package/dist/{chunk-GS3Q2KOZ.js.map → chunk-QBOQI6PG.js.map} +0 -0
- /package/dist/{chunk-JIMEB4C6.js.map → chunk-QMMOMBH6.js.map} +0 -0
- /package/dist/{chunk-QDNVHA2F.js.map → chunk-QMZ5A6FQ.js.map} +0 -0
- /package/dist/{chunk-FLHOTGOO.js.map → chunk-QVGEVZ5F.js.map} +0 -0
- /package/dist/{chunk-AFBJHD55.js.map → chunk-QZJEYZ4I.js.map} +0 -0
- /package/dist/{chunk-V3YB7RGR.js.map → chunk-R2N37AA6.js.map} +0 -0
- /package/dist/{chunk-JLHKBAFY.js.map → chunk-RWW3I3PO.js.map} +0 -0
- /package/dist/{chunk-IGAIOGCN.js.map → chunk-S4YERMGJ.js.map} +0 -0
- /package/dist/{chunk-OGFPMCSP.js.map → chunk-SBOHNJUD.js.map} +0 -0
- /package/dist/{chunk-QXPOEAKR.js.map → chunk-SC4JLMZI.js.map} +0 -0
- /package/dist/{chunk-EDC6MLXV.js.map → chunk-SEU6QHH4.js.map} +0 -0
- /package/dist/{chunk-F4COUZLL.js.map → chunk-TMR64XPL.js.map} +0 -0
- /package/dist/{chunk-DEQ2JTBR.js.map → chunk-TNATF3HB.js.map} +0 -0
- /package/dist/{chunk-GZ2GKOF6.js.map → chunk-TNJVDG2B.js.map} +0 -0
- /package/dist/{chunk-5OZCCLNC.js.map → chunk-TSNRZSRC.js.map} +0 -0
- /package/dist/{chunk-QCUH2G77.js.map → chunk-UTEATWHO.js.map} +0 -0
- /package/dist/{chunk-YGBIBOCR.js.map → chunk-VEGQYPCP.js.map} +0 -0
- /package/dist/{chunk-25G7U6RD.js.map → chunk-WQN5SM7P.js.map} +0 -0
- /package/dist/{chunk-NOT7XA7Q.js.map → chunk-X3MWEFPT.js.map} +0 -0
- /package/dist/{chunk-BVZGNMVM.js.map → chunk-YFFEF6HR.js.map} +0 -0
- /package/dist/{chunk-H4SMS4O2.js.map → chunk-YJ3TREAC.js.map} +0 -0
- /package/dist/{chunk-5SZ24DL5.js.map → chunk-YQQPNXNO.js.map} +0 -0
- /package/dist/{chunk-EW4HFWGJ.js.map → chunk-YWZEDG7F.js.map} +0 -0
- /package/dist/{chunk-2VUISNGP.js.map → chunk-YXIVUWDU.js.map} +0 -0
- /package/dist/{chunk-YG2EG6CB.js.map → chunk-YXZNGHID.js.map} +0 -0
- /package/dist/{chunk-QYJIOWKN.js.map → chunk-YZN6NRTR.js.map} +0 -0
- /package/dist/{chunk-IZX3WZBF.js.map → chunk-YZNKFYDC.js.map} +0 -0
- /package/dist/{chunk-E2R5NRZD.js.map → chunk-Z4D3YGAB.js.map} +0 -0
- /package/dist/{chunk-STR7WBOB.js.map → chunk-ZUDAK436.js.map} +0 -0
- /package/dist/{chunk-ITI3SJRB.js.map → chunk-ZX5FNWH7.js.map} +0 -0
- /package/dist/{classified-marker-7S5IEP6Q.js.map → classified-marker-52P3D72W.js.map} +0 -0
- /package/dist/{collection-facade-CMZGQ6IS.js.map → collection-facade-XKCFHSLR.js.map} +0 -0
- /package/dist/{computed-WZNKRLCY.js.map → computed-33DRJDOC.js.map} +0 -0
- /package/dist/{cover-B5MY43CK.js.map → cover-5BSNJREH.js.map} +0 -0
- /package/dist/{dead-filter-KRRD57MR.js.map → dead-filter-JXVCKS6W.js.map} +0 -0
- /package/dist/{delegation-UT76AQIG.js.map → delegation-WWZPEDK2.js.map} +0 -0
- /package/dist/{derive-SGRCCKVP.js.map → derive-CWWFEQ4N.js.map} +0 -0
- /package/dist/{enclave-YFKA3GJT.js.map → enclave-I5H3GINP.js.map} +0 -0
- /package/dist/{executor-TEZYRDN3.js.map → executor-FCJEH3FU.js.map} +0 -0
- /package/dist/{executor-WQQRU6DO.js.map → executor-OHET7TF7.js.map} +0 -0
- /package/dist/{executor-YORMIBWV.js.map → executor-SHYLIBOM.js.map} +0 -0
- /package/dist/{export-accessible-HXMKW5LJ.js.map → export-accessible-FBL6TDSK.js.map} +0 -0
- /package/dist/{extract-partition-QGQ2R42J.js.map → extract-partition-ZYIRYMTI.js.map} +0 -0
- /package/dist/{fanout-sidecar-HJV3A7PM.js.map → fanout-sidecar-WWXVHHUH.js.map} +0 -0
- /package/dist/{find-VV6PBIHK.js.map → find-LEBUXVL7.js.map} +0 -0
- /package/dist/{issue-7JJ4Z7E2.js.map → issue-F76PAGIR.js.map} +0 -0
- /package/dist/{ledger-SW6QQOAV.js.map → ledger-M2BKCNVS.js.map} +0 -0
- /package/dist/{liberate-FK7JI2QX.js.map → liberate-ZP7UB57K.js.map} +0 -0
- /package/dist/{link-set-GNGGCFI4.js.map → link-set-ZU4E5J5S.js.map} +0 -0
- /package/dist/{noydb-N5IW6OFZ.js.map → noydb-BNDGEK5X.js.map} +0 -0
- /package/dist/{policy-EAXSJNOT.js.map → policy-IY2YEA3A.js.map} +0 -0
- /package/dist/{post-register-A7HCFBP5.js.map → post-register-XIAHB6KF.js.map} +0 -0
- /package/dist/{register-YBMRLZLO.js.map → register-HB4TQZSV.js.map} +0 -0
- /package/dist/{registry-3LXKNXWI.js.map → registry-6BMBFEXT.js.map} +0 -0
- /package/dist/{registry-4V4YQCXJ.js.map → registry-7CZWF3EQ.js.map} +0 -0
- /package/dist/{registry-ZULMLCJK.js.map → registry-JOFO7RAH.js.map} +0 -0
- /package/dist/{request-withdrawal-SEVUEUDG.js.map → request-withdrawal-UN3TRHWI.js.map} +0 -0
- /package/dist/{reveal-PB3YG544.js.map → reveal-VWXRV2XU.js.map} +0 -0
- /package/dist/{revoke-5QULL5GT.js.map → revoke-OLO2OVR7.js.map} +0 -0
- /package/dist/{signer-ZMH35FT4.js.map → signer-MGGKPYAN.js.map} +0 -0
- /package/dist/{stale-4UNPHWOU.js.map → stale-NBROTA66.js.map} +0 -0
- /package/dist/{storage-QOZKQMID.js.map → storage-3R37QZLA.js.map} +0 -0
- /package/dist/{store-coordination-provider-3AELCZ4Y.js.map → store-coordination-provider-P3IU5JHD.js.map} +0 -0
- /package/dist/{verify-MXN66IIH.js.map → verify-5X37OXRY.js.map} +0 -0
- /package/dist/{walk-H4YE52S2.js.map → walk-E3OVLBFR.js.map} +0 -0
- /package/dist/{withdraw-accessible-HPOVNG2G.js.map → withdraw-accessible-Q2EMATCU.js.map} +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadVaultPolicy
|
|
3
|
+
} from "./chunk-QMZ5A6FQ.js";
|
|
1
4
|
import {
|
|
2
5
|
jsonSchemaToFields
|
|
3
6
|
} from "./chunk-VYYM3MEN.js";
|
|
@@ -6,23 +9,23 @@ import {
|
|
|
6
9
|
SEQUENCE_COLLECTION,
|
|
7
10
|
compileSequenceFormat,
|
|
8
11
|
resolveSequenceKey
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
loadVaultPolicy
|
|
12
|
-
} from "./chunk-QDNVHA2F.js";
|
|
12
|
+
} from "./chunk-X3MWEFPT.js";
|
|
13
13
|
import {
|
|
14
14
|
LinkIntegrityError,
|
|
15
15
|
isLinkCollectionName,
|
|
16
16
|
linkCollectionName,
|
|
17
17
|
linkRowKey
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MUPZ6IZX.js";
|
|
19
19
|
import {
|
|
20
20
|
hashFields,
|
|
21
21
|
validateSatelliteDeclaration
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-522MBPE5.js";
|
|
23
|
+
import {
|
|
24
|
+
resolveStaleOnRead
|
|
25
|
+
} from "./chunk-XUFAFHQM.js";
|
|
23
26
|
import {
|
|
24
27
|
loadFence
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-M6QA2KK2.js";
|
|
26
29
|
import {
|
|
27
30
|
InvertedIndex,
|
|
28
31
|
MemoryIndexStore,
|
|
@@ -31,11 +34,11 @@ import {
|
|
|
31
34
|
buildPersistedIndexCallbacks,
|
|
32
35
|
encodeVecId,
|
|
33
36
|
syncTierSearch
|
|
34
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-HAPY7WFP.js";
|
|
35
38
|
import {
|
|
36
39
|
derivePersistedSchema,
|
|
37
40
|
isZod4Schema
|
|
38
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-SEU6QHH4.js";
|
|
39
42
|
import {
|
|
40
43
|
isBaseLive,
|
|
41
44
|
liveBaseIdSet
|
|
@@ -44,11 +47,11 @@ import {
|
|
|
44
47
|
CustodyApi,
|
|
45
48
|
NO_CARGO,
|
|
46
49
|
NO_CUSTODY
|
|
47
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-L2CAWCQL.js";
|
|
48
51
|
import {
|
|
49
52
|
resolveManagedSecret,
|
|
50
|
-
|
|
51
|
-
} from "./chunk-
|
|
53
|
+
saveSealedSecret
|
|
54
|
+
} from "./chunk-OHV6T5JB.js";
|
|
52
55
|
import {
|
|
53
56
|
ServiceBus,
|
|
54
57
|
WriteHookRegistry,
|
|
@@ -56,35 +59,35 @@ import {
|
|
|
56
59
|
assertCanImport,
|
|
57
60
|
canExport,
|
|
58
61
|
canImport
|
|
59
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-IGLU4ME7.js";
|
|
60
63
|
import {
|
|
61
64
|
runDrainBarrier
|
|
62
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-AFAPBZAA.js";
|
|
63
66
|
import {
|
|
64
67
|
NO_ATTESTATION
|
|
65
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-GTNRMJYH.js";
|
|
66
69
|
import {
|
|
67
70
|
NO_CLASSIFIED,
|
|
68
71
|
guardClassifiedCompat,
|
|
69
72
|
resolveClassifiedFields
|
|
70
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-YZNKFYDC.js";
|
|
71
74
|
import {
|
|
72
75
|
NO_TIERS,
|
|
73
76
|
classifySealedShred,
|
|
74
77
|
syncDerivedOutputs
|
|
75
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-FTCGEUOY.js";
|
|
76
79
|
import {
|
|
77
80
|
NO_PORTABILITY
|
|
78
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-OWLZONGX.js";
|
|
79
82
|
import {
|
|
80
83
|
TxContext,
|
|
81
84
|
bestEffortRevert,
|
|
82
85
|
revertExecuted
|
|
83
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-QVGEVZ5F.js";
|
|
84
87
|
import {
|
|
85
88
|
DEFAULT_POSTURE,
|
|
86
89
|
ViaGraph
|
|
87
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-Z4D3YGAB.js";
|
|
88
91
|
import {
|
|
89
92
|
buildLookupAltIndex,
|
|
90
93
|
buildLookupSnapshotRows,
|
|
@@ -105,27 +108,28 @@ import {
|
|
|
105
108
|
resolveLabelFromMap,
|
|
106
109
|
resolveRollupDeleteIntents,
|
|
107
110
|
runGraphDispatchWave,
|
|
111
|
+
selfWriteFieldEqual,
|
|
108
112
|
touchFor,
|
|
109
113
|
updateReferencingRecords
|
|
110
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-7BIJS6II.js";
|
|
111
115
|
import {
|
|
112
116
|
OverlayedCollection
|
|
113
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-PWWWMRT7.js";
|
|
114
118
|
import {
|
|
115
119
|
NO_AGGREGATE,
|
|
116
120
|
Query,
|
|
117
121
|
ScanBuilder
|
|
118
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-HQKRZIX6.js";
|
|
119
123
|
import {
|
|
120
124
|
EXPORT_AUDIT_COLLECTION,
|
|
121
125
|
createExportBlobsHandle,
|
|
122
126
|
runCompaction
|
|
123
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-J5TEU77Q.js";
|
|
124
128
|
import {
|
|
125
129
|
LazyQuery,
|
|
126
130
|
decodeIdxId,
|
|
127
131
|
encodeIdxId
|
|
128
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-BY5YBSXA.js";
|
|
129
133
|
import {
|
|
130
134
|
IMPLICIT_LAZY,
|
|
131
135
|
Lru,
|
|
@@ -133,13 +137,13 @@ import {
|
|
|
133
137
|
} from "./chunk-NO272T7Q.js";
|
|
134
138
|
import {
|
|
135
139
|
canonicalGroupKey
|
|
136
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-QMMOMBH6.js";
|
|
137
141
|
import {
|
|
138
142
|
readPath
|
|
139
143
|
} from "./chunk-IGJCYUT5.js";
|
|
140
144
|
import {
|
|
141
145
|
dictCollectionName
|
|
142
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-K7BADAOS.js";
|
|
143
147
|
import {
|
|
144
148
|
NO_I18N,
|
|
145
149
|
getAtPath,
|
|
@@ -147,23 +151,23 @@ import {
|
|
|
147
151
|
isDictKeyDescriptor,
|
|
148
152
|
isI18nTextDescriptor,
|
|
149
153
|
isStaticDictDescriptor
|
|
150
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-JN3SGXJE.js";
|
|
151
155
|
import {
|
|
152
156
|
installViaBinder,
|
|
153
157
|
isViaInstalled,
|
|
154
158
|
viaBinder
|
|
155
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-ZUDAK436.js";
|
|
156
160
|
import {
|
|
157
161
|
NO_TEAM,
|
|
158
162
|
enrollAuthenticator,
|
|
159
163
|
findAuthenticator,
|
|
160
|
-
|
|
164
|
+
recoverSecret,
|
|
161
165
|
recoverUser,
|
|
162
166
|
removeAuthenticator,
|
|
163
|
-
|
|
167
|
+
rotateSecret,
|
|
164
168
|
updateAuthenticator,
|
|
165
169
|
writeMagicLinkGrant
|
|
166
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-FIP7KI2P.js";
|
|
167
171
|
import {
|
|
168
172
|
assertKeyringOpenAllowed,
|
|
169
173
|
buildRecipientKeyringFile,
|
|
@@ -176,11 +180,11 @@ import {
|
|
|
176
180
|
listUsers,
|
|
177
181
|
loadKeyring,
|
|
178
182
|
updateKeyringIdentity
|
|
179
|
-
} from "./chunk-
|
|
183
|
+
} from "./chunk-3LJYHE7S.js";
|
|
180
184
|
import {
|
|
181
185
|
persistDirectoryConfig,
|
|
182
186
|
readDirectoryConfig
|
|
183
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-6RPWILRH.js";
|
|
184
188
|
import {
|
|
185
189
|
hasRecoveryEnrolled,
|
|
186
190
|
hasStrongRecoveryEnrolled,
|
|
@@ -190,7 +194,7 @@ import {
|
|
|
190
194
|
mintShamirRecoveryEntry,
|
|
191
195
|
savePaperRecoveryEntries,
|
|
192
196
|
saveShamirRecoveryEntries
|
|
193
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-CJVEAVYH.js";
|
|
194
198
|
import {
|
|
195
199
|
INDEXED_STORE_POLICY
|
|
196
200
|
} from "./chunk-VQNJ7UZL.js";
|
|
@@ -200,11 +204,11 @@ import {
|
|
|
200
204
|
PERIOD_FREEZES_COLLECTION,
|
|
201
205
|
PERIOD_TARGET_PURGES_COLLECTION,
|
|
202
206
|
periodExclusiveUpperBound
|
|
203
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-TMR64XPL.js";
|
|
204
208
|
import {
|
|
205
209
|
NO_BROKER,
|
|
206
210
|
buildCredentialBrokerHandle
|
|
207
|
-
} from "./chunk-
|
|
211
|
+
} from "./chunk-P4NUJVWL.js";
|
|
208
212
|
import {
|
|
209
213
|
generateULID
|
|
210
214
|
} from "./chunk-ZJADGNYF.js";
|
|
@@ -212,10 +216,10 @@ import {
|
|
|
212
216
|
assertCutoverTierSafe,
|
|
213
217
|
assertTierWritable,
|
|
214
218
|
liveRecordIsElevated
|
|
215
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-PTT2NB46.js";
|
|
216
220
|
import {
|
|
217
221
|
sha256Hex
|
|
218
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-RWW3I3PO.js";
|
|
219
223
|
import {
|
|
220
224
|
NO_FORGET,
|
|
221
225
|
addSubjectRef,
|
|
@@ -224,10 +228,10 @@ import {
|
|
|
224
228
|
readDottedPath,
|
|
225
229
|
rebuildSubjectIndex,
|
|
226
230
|
removeSubjectRef
|
|
227
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-I2XEBEEF.js";
|
|
228
232
|
import {
|
|
229
233
|
NO_SEALED_RECORD
|
|
230
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-7LP7FFJ2.js";
|
|
231
235
|
import {
|
|
232
236
|
RecordCodec,
|
|
233
237
|
SEALED_CEK_NS,
|
|
@@ -238,20 +242,20 @@ import {
|
|
|
238
242
|
queryByDet,
|
|
239
243
|
resolveStableCek,
|
|
240
244
|
validateSchemaInput
|
|
241
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-GEEJPID6.js";
|
|
242
246
|
import {
|
|
243
247
|
buildDeleteMarker,
|
|
244
248
|
buildTombstone,
|
|
245
249
|
isDeleteMarker,
|
|
246
250
|
isTombstone
|
|
247
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-SC4JLMZI.js";
|
|
248
252
|
import {
|
|
249
253
|
encrypt
|
|
250
|
-
} from "./chunk-
|
|
254
|
+
} from "./chunk-7U6AB7DZ.js";
|
|
251
255
|
import {
|
|
252
256
|
NOYDB_FORMAT_VERSION,
|
|
253
257
|
SealedHandle
|
|
254
|
-
} from "./chunk-
|
|
258
|
+
} from "./chunk-YTW6ZIPD.js";
|
|
255
259
|
import {
|
|
256
260
|
AlreadyElevatedError,
|
|
257
261
|
AttestationError,
|
|
@@ -260,7 +264,6 @@ import {
|
|
|
260
264
|
ClassifiedVerifyError,
|
|
261
265
|
ConflictError,
|
|
262
266
|
DebugPlaintextError,
|
|
263
|
-
DerivationCapExceededError,
|
|
264
267
|
DictKeyInUseError,
|
|
265
268
|
ElevationExpiredError,
|
|
266
269
|
FieldNotQueryableError,
|
|
@@ -291,7 +294,7 @@ import {
|
|
|
291
294
|
UnsupportedIndexOptionError,
|
|
292
295
|
UnsupportedTierCompositionError,
|
|
293
296
|
ValidationError
|
|
294
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-6SYOHUHM.js";
|
|
295
298
|
|
|
296
299
|
// src/via/blob/binding.ts
|
|
297
300
|
async function eraseBlobs(ctx, cfg) {
|
|
@@ -573,7 +576,7 @@ function resolveStrategies(options) {
|
|
|
573
576
|
|
|
574
577
|
// src/port/by/default-provider.ts
|
|
575
578
|
async function createDefaultCoordinationProvider(store) {
|
|
576
|
-
const { StoreCoordinationProvider } = await import("./store-coordination-provider-
|
|
579
|
+
const { StoreCoordinationProvider } = await import("./store-coordination-provider-P3IU5JHD.js");
|
|
577
580
|
return new StoreCoordinationProvider(store);
|
|
578
581
|
}
|
|
579
582
|
|
|
@@ -1844,79 +1847,6 @@ function buildDescription(input) {
|
|
|
1844
1847
|
};
|
|
1845
1848
|
}
|
|
1846
1849
|
|
|
1847
|
-
// src/with-formula/derivations/stale.ts
|
|
1848
|
-
var _staleByRegistry = /* @__PURE__ */ new WeakMap();
|
|
1849
|
-
var keyFor = (source, sourceId) => `${source}/${sourceId}`;
|
|
1850
|
-
async function markStale(registry, strategy, sourceId) {
|
|
1851
|
-
let map = _staleByRegistry.get(registry);
|
|
1852
|
-
if (!map) {
|
|
1853
|
-
map = /* @__PURE__ */ new Map();
|
|
1854
|
-
_staleByRegistry.set(registry, map);
|
|
1855
|
-
}
|
|
1856
|
-
const k = keyFor(strategy.source, sourceId);
|
|
1857
|
-
let set = map.get(k);
|
|
1858
|
-
if (!set) {
|
|
1859
|
-
set = /* @__PURE__ */ new Set();
|
|
1860
|
-
map.set(k, set);
|
|
1861
|
-
}
|
|
1862
|
-
set.add(strategy);
|
|
1863
|
-
}
|
|
1864
|
-
async function resolveStaleOnRead(accessor, outputCollection, id) {
|
|
1865
|
-
const registry = accessor.registry();
|
|
1866
|
-
const producers = registry.strategiesProducingOutput(outputCollection);
|
|
1867
|
-
if (producers.length === 0) return;
|
|
1868
|
-
const map = _staleByRegistry.get(registry);
|
|
1869
|
-
if (!map) return;
|
|
1870
|
-
let DerivationExecutor = null;
|
|
1871
|
-
for (const { spec, strategyHash } of producers) {
|
|
1872
|
-
const k = keyFor(spec.source, id);
|
|
1873
|
-
const pending = map.get(k);
|
|
1874
|
-
if (!pending || !pending.has(spec)) continue;
|
|
1875
|
-
const sourceColl = accessor.getCollection(spec.source);
|
|
1876
|
-
const source = await sourceColl.get(id);
|
|
1877
|
-
if (!source) {
|
|
1878
|
-
pending.delete(spec);
|
|
1879
|
-
continue;
|
|
1880
|
-
}
|
|
1881
|
-
const sourceWithId = { ...source, id };
|
|
1882
|
-
if (DerivationExecutor === null) {
|
|
1883
|
-
({ DerivationExecutor } = await import("./executor-TEZYRDN3.js"));
|
|
1884
|
-
}
|
|
1885
|
-
const ctx = { vault: accessor.getReadOnlyFacade() };
|
|
1886
|
-
const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
|
|
1887
|
-
for (const key of Object.keys(spec.outputs)) {
|
|
1888
|
-
const out = result.outputs[key];
|
|
1889
|
-
if (!out) continue;
|
|
1890
|
-
if (out.kind === "failed") {
|
|
1891
|
-
const err = out.error;
|
|
1892
|
-
if (spec.strict) {
|
|
1893
|
-
throw err;
|
|
1894
|
-
}
|
|
1895
|
-
console.warn(
|
|
1896
|
-
`[derivation] lazy output "${key}" for source "${spec.source}" id="${id}" failed:`,
|
|
1897
|
-
err
|
|
1898
|
-
);
|
|
1899
|
-
continue;
|
|
1900
|
-
}
|
|
1901
|
-
if (out.kind === "array") {
|
|
1902
|
-
console.warn(
|
|
1903
|
-
`[derivation] unexpected array-shape output "${key}" in lazy resolve path; array-shape derivations require lifecycle: "eager".`
|
|
1904
|
-
);
|
|
1905
|
-
continue;
|
|
1906
|
-
}
|
|
1907
|
-
const outSpec = spec.outputs[key];
|
|
1908
|
-
if (!outSpec) continue;
|
|
1909
|
-
const outputColl = accessor.getCollection(outSpec.collection);
|
|
1910
|
-
if (out.skipped === true) {
|
|
1911
|
-
await outputColl._internalDelete(id, accessor.getActiveTxContext());
|
|
1912
|
-
continue;
|
|
1913
|
-
}
|
|
1914
|
-
await outputColl.put(id, out.value);
|
|
1915
|
-
}
|
|
1916
|
-
pending.delete(spec);
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
1850
|
// src/kernel/via/compose.ts
|
|
1921
1851
|
function via(...descriptors) {
|
|
1922
1852
|
if (descriptors.length === 0) {
|
|
@@ -2383,20 +2313,11 @@ function resolveCollectionConfig(opts) {
|
|
|
2383
2313
|
// src/with-formula/computed/lazy.ts
|
|
2384
2314
|
var fn = null;
|
|
2385
2315
|
async function loadEvalComputedFields() {
|
|
2386
|
-
fn ??= (await import("./computed-
|
|
2316
|
+
fn ??= (await import("./computed-33DRJDOC.js")).evalComputedFields;
|
|
2387
2317
|
return fn;
|
|
2388
2318
|
}
|
|
2389
2319
|
|
|
2390
2320
|
// src/kernel/collection.ts
|
|
2391
|
-
function selfWriteFieldEqual(a, b) {
|
|
2392
|
-
if (a === b) return true;
|
|
2393
|
-
if (a === null || b === null || typeof a !== "object" || typeof b !== "object") return false;
|
|
2394
|
-
try {
|
|
2395
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
2396
|
-
} catch {
|
|
2397
|
-
return false;
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
2321
|
var fallbackWarned = /* @__PURE__ */ new Set();
|
|
2401
2322
|
function warnOnceFallback(adapterName) {
|
|
2402
2323
|
if (fallbackWarned.has(adapterName)) return;
|
|
@@ -3169,7 +3090,7 @@ var Collection = class {
|
|
|
3169
3090
|
}
|
|
3170
3091
|
await this.onAccess?.("find", "*");
|
|
3171
3092
|
if (hits.length === 0) return [];
|
|
3172
|
-
const { verifyDigestField } = await import("./verify-
|
|
3093
|
+
const { verifyDigestField } = await import("./verify-5X37OXRY.js");
|
|
3173
3094
|
const policy = {
|
|
3174
3095
|
normalize: spec.verifyNormalize ?? "password",
|
|
3175
3096
|
notLastN: spec.notLastN ?? 0,
|
|
@@ -3375,7 +3296,7 @@ var Collection = class {
|
|
|
3375
3296
|
}
|
|
3376
3297
|
}
|
|
3377
3298
|
if (this.materializedViewSource !== void 0) {
|
|
3378
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
3299
|
+
const { resolveStaleMVOnRead } = await import("./stale-NBROTA66.js");
|
|
3379
3300
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
|
|
3380
3301
|
}
|
|
3381
3302
|
let record;
|
|
@@ -3631,6 +3552,103 @@ var Collection = class {
|
|
|
3631
3552
|
return clone;
|
|
3632
3553
|
}
|
|
3633
3554
|
/** @internal Untracked put body — call {@link put}, not this. */
|
|
3555
|
+
/**
|
|
3556
|
+
* Decode a prior envelope's CRDT state, or `undefined` when there is no
|
|
3557
|
+
* usable prior: no envelope, a shredded body decrypting to `null`, or a
|
|
3558
|
+
* payload that is not a CRDT state. The `lww-map` and `rga` branches each
|
|
3559
|
+
* carried a copy, byte-identical apart from the cast (#842).
|
|
3560
|
+
*/
|
|
3561
|
+
async #decodePriorCrdtState(envelope) {
|
|
3562
|
+
if (!envelope) return void 0;
|
|
3563
|
+
const prevJson = await this.codec.decryptJsonString(envelope);
|
|
3564
|
+
if (prevJson === null) return void 0;
|
|
3565
|
+
const prevParsed = JSON.parse(prevJson);
|
|
3566
|
+
if (prevParsed === null || typeof prevParsed !== "object" || !("_crdt" in prevParsed)) {
|
|
3567
|
+
return void 0;
|
|
3568
|
+
}
|
|
3569
|
+
return prevParsed;
|
|
3570
|
+
}
|
|
3571
|
+
/**
|
|
3572
|
+
* Record a write on the active transaction so a mid-batch failure rolls it
|
|
3573
|
+
* back. Four sites in the derivation/MV dispatch hand-built this literal (#842).
|
|
3574
|
+
*/
|
|
3575
|
+
#trackPut(txCtx, collectionName, id, priorEnvelope) {
|
|
3576
|
+
txCtx._executed.push({
|
|
3577
|
+
op: { type: "put", vaultName: this.vault, collectionName, id },
|
|
3578
|
+
priorEnvelope
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3581
|
+
/**
|
|
3582
|
+
* Snapshot the PRIOR version into history, emit, and prune.
|
|
3583
|
+
*
|
|
3584
|
+
* Deliberately does NOT carry `source` from the current write — a history
|
|
3585
|
+
* entry describes the version being replaced, not the one replacing it.
|
|
3586
|
+
*
|
|
3587
|
+
* Kept OUT of {@link #commitWriteTail} because the two paths call it at
|
|
3588
|
+
* different points: the normal path snapshots BEFORE `adapter.put` (so a
|
|
3589
|
+
* history failure leaves no write behind), while the CRDT path must merge
|
|
3590
|
+
* and persist first to resolve the prior record at all. Folding it into the
|
|
3591
|
+
* tail would silently reorder one of them (#842).
|
|
3592
|
+
*/
|
|
3593
|
+
async #savePriorHistory(id, prior, cek, vdigCtx) {
|
|
3594
|
+
if (this.historyConfig.enabled === false) return;
|
|
3595
|
+
await this.strategies.history.saveHistory(
|
|
3596
|
+
this.adapter,
|
|
3597
|
+
this.vault,
|
|
3598
|
+
this.name,
|
|
3599
|
+
id,
|
|
3600
|
+
await this.codec.encryptRecord(prior.record, prior.version, cek, void 0, void 0, vdigCtx, id)
|
|
3601
|
+
);
|
|
3602
|
+
this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: prior.version });
|
|
3603
|
+
if (this.historyConfig.maxVersions) {
|
|
3604
|
+
await this.strategies.history.pruneHistory(this.adapter, this.vault, this.name, id, { keepVersions: this.historyConfig.maxVersions });
|
|
3605
|
+
}
|
|
3606
|
+
}
|
|
3607
|
+
/**
|
|
3608
|
+
* Everything both write paths do once the envelope is on the adapter:
|
|
3609
|
+
* classified marker, embedding sidecar, ledger append, cache/index
|
|
3610
|
+
* maintenance, and the mutation event that drives derivation dispatch.
|
|
3611
|
+
*
|
|
3612
|
+
* The CRDT branch used to re-implement all of it, and in doing so skipped
|
|
3613
|
+
* `_ensureClassifiedMarker`, the unique-constraint upsert and
|
|
3614
|
+
* `_toCacheableRecord` (#835). All three were unreachable — each blocked by
|
|
3615
|
+
* a config-time refusal on CRDT collections — but only by accident of what
|
|
3616
|
+
* that copy happened to omit. One tail makes the divergence unrepresentable
|
|
3617
|
+
* rather than merely unreachable; on a CRDT collection the extra steps are
|
|
3618
|
+
* provably no-ops (classified/unique + crdt are refused at construction, and
|
|
3619
|
+
* a CRDT body never produces a `_sealed` slot, so `_toCacheableRecord` is
|
|
3620
|
+
* the identity).
|
|
3621
|
+
*/
|
|
3622
|
+
async #commitWriteTail(args) {
|
|
3623
|
+
const { id, envelope, version, indexed, event, prior, reason } = args;
|
|
3624
|
+
await this._ensureClassifiedMarker();
|
|
3625
|
+
if (this.embeddings) {
|
|
3626
|
+
await this.strategies.search.embedOnWrite(this.searchContext(), id, indexed, version);
|
|
3627
|
+
}
|
|
3628
|
+
if (this.ledger) {
|
|
3629
|
+
const appendInput = {
|
|
3630
|
+
op: "put",
|
|
3631
|
+
collection: this.name,
|
|
3632
|
+
id,
|
|
3633
|
+
version,
|
|
3634
|
+
actor: this.keyring.userId,
|
|
3635
|
+
payloadHash: await this.strategies.history.envelopePayloadHash(envelope)
|
|
3636
|
+
};
|
|
3637
|
+
if (prior) appendInput.delta = this.strategies.history.computePatch(indexed, prior.record);
|
|
3638
|
+
if (reason !== void 0) appendInput.reason = reason;
|
|
3639
|
+
await this.ledger.append(appendInput);
|
|
3640
|
+
}
|
|
3641
|
+
const cacheable = await this._toCacheableRecord(indexed, envelope, id);
|
|
3642
|
+
if (this.lazy && this.lru) {
|
|
3643
|
+
this.lru.set(id, { record: cacheable, version }, estimateRecordBytes(indexed));
|
|
3644
|
+
await this.maintainPersistedIndexesOnPut(id, indexed, prior ? prior.record : null, version);
|
|
3645
|
+
} else {
|
|
3646
|
+
this.cache.set(id, { record: cacheable, version });
|
|
3647
|
+
this.indexes?.upsert(id, indexed, prior ? prior.record : null);
|
|
3648
|
+
this.uniqueConstraints?.upsert(id, indexed, prior?.record);
|
|
3649
|
+
}
|
|
3650
|
+
await this._onRecordMutated(id, "put", "local-write", { record: event, version });
|
|
3651
|
+
}
|
|
3634
3652
|
async _putInternal(id, record, options) {
|
|
3635
3653
|
if (!hasWritePermission(this.keyring, this.name)) {
|
|
3636
3654
|
throw new ReadOnlyError();
|
|
@@ -3679,28 +3697,10 @@ var Collection = class {
|
|
|
3679
3697
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3680
3698
|
let crdtState;
|
|
3681
3699
|
if (this.crdtMode === "lww-map") {
|
|
3682
|
-
|
|
3683
|
-
if (existingEnvelope) {
|
|
3684
|
-
const prevJson = await this.codec.decryptJsonString(existingEnvelope);
|
|
3685
|
-
if (prevJson !== null) {
|
|
3686
|
-
const prevParsed = JSON.parse(prevJson);
|
|
3687
|
-
if (prevParsed !== null && typeof prevParsed === "object" && "_crdt" in prevParsed) {
|
|
3688
|
-
existingState = prevParsed;
|
|
3689
|
-
}
|
|
3690
|
-
}
|
|
3691
|
-
}
|
|
3700
|
+
const existingState = await this.#decodePriorCrdtState(existingEnvelope);
|
|
3692
3701
|
crdtState = this.strategies.crdt.buildLwwMapState(record, existingState, now);
|
|
3693
3702
|
} else if (this.crdtMode === "rga") {
|
|
3694
|
-
|
|
3695
|
-
if (existingEnvelope) {
|
|
3696
|
-
const prevJson = await this.codec.decryptJsonString(existingEnvelope);
|
|
3697
|
-
if (prevJson !== null) {
|
|
3698
|
-
const prevParsed = JSON.parse(prevJson);
|
|
3699
|
-
if (prevParsed !== null && typeof prevParsed === "object" && "_crdt" in prevParsed) {
|
|
3700
|
-
existingState = prevParsed;
|
|
3701
|
-
}
|
|
3702
|
-
}
|
|
3703
|
-
}
|
|
3703
|
+
const existingState = await this.#decodePriorCrdtState(existingEnvelope);
|
|
3704
3704
|
crdtState = this.strategies.crdt.buildRgaState(Array.isArray(record) ? record : [record], existingState, generateULID);
|
|
3705
3705
|
} else {
|
|
3706
3706
|
crdtState = { _crdt: "yjs", update: record };
|
|
@@ -3712,39 +3712,18 @@ var Collection = class {
|
|
|
3712
3712
|
const resolvedRecord = this.strategies.crdt.resolveCrdtSnapshot(crdtState);
|
|
3713
3713
|
const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord(existingEnvelope, { skipValidation: true }) : null;
|
|
3714
3714
|
const existingResolved = existingResolvedRecord !== null ? { record: existingResolvedRecord, version: existingVersion } : void 0;
|
|
3715
|
-
if (existingResolved
|
|
3716
|
-
await this
|
|
3717
|
-
this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: existingResolved.version });
|
|
3718
|
-
if (this.historyConfig.maxVersions) {
|
|
3719
|
-
await this.strategies.history.pruneHistory(this.adapter, this.vault, this.name, id, { keepVersions: this.historyConfig.maxVersions });
|
|
3720
|
-
}
|
|
3721
|
-
}
|
|
3722
|
-
if (this.ledger) {
|
|
3723
|
-
const appendInput = {
|
|
3724
|
-
op: "put",
|
|
3725
|
-
collection: this.name,
|
|
3726
|
-
id,
|
|
3727
|
-
version: version2,
|
|
3728
|
-
actor: this.keyring.userId,
|
|
3729
|
-
payloadHash: await this.strategies.history.envelopePayloadHash(envelope2)
|
|
3730
|
-
};
|
|
3731
|
-
if (existingResolved) appendInput.delta = this.strategies.history.computePatch(resolvedRecord, existingResolved.record);
|
|
3732
|
-
if (options?.reason !== void 0) appendInput.reason = options.reason;
|
|
3733
|
-
await this.ledger.append(appendInput);
|
|
3715
|
+
if (existingResolved) {
|
|
3716
|
+
await this.#savePriorHistory(id, existingResolved, cek2, this.vdigFields !== null ? { id, prev: existingEnvelope } : void 0);
|
|
3734
3717
|
}
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
}
|
|
3744
|
-
this.cache.set(id, { record: resolvedRecord, version: version2 });
|
|
3745
|
-
this.indexes?.upsert(id, resolvedRecord, existingResolved ? existingResolved.record : null);
|
|
3746
|
-
}
|
|
3747
|
-
await this._onRecordMutated(id, "put", "local-write", { record, version: version2 });
|
|
3718
|
+
await this.#commitWriteTail({
|
|
3719
|
+
id,
|
|
3720
|
+
envelope: envelope2,
|
|
3721
|
+
version: version2,
|
|
3722
|
+
indexed: resolvedRecord,
|
|
3723
|
+
event: record,
|
|
3724
|
+
prior: existingResolved,
|
|
3725
|
+
reason: options?.reason
|
|
3726
|
+
});
|
|
3748
3727
|
return;
|
|
3749
3728
|
}
|
|
3750
3729
|
let existing;
|
|
@@ -3774,47 +3753,19 @@ var Collection = class {
|
|
|
3774
3753
|
this.uniqueConstraints?.check(id, record);
|
|
3775
3754
|
const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
3776
3755
|
const vdigCtx = this.vdigFields !== null ? { id, prev: await this.adapter.get(this.vault, this.name, id) } : void 0;
|
|
3777
|
-
if (existing
|
|
3778
|
-
await this.strategies.history.saveHistory(this.adapter, this.vault, this.name, id, await this.codec.encryptRecord(existing.record, existing.version, cek, void 0, void 0, vdigCtx, id));
|
|
3779
|
-
this.emitter.emit("history:save", {
|
|
3780
|
-
vault: this.vault,
|
|
3781
|
-
collection: this.name,
|
|
3782
|
-
id,
|
|
3783
|
-
version: existing.version
|
|
3784
|
-
});
|
|
3785
|
-
if (this.historyConfig.maxVersions) await this.strategies.history.pruneHistory(this.adapter, this.vault, this.name, id, { keepVersions: this.historyConfig.maxVersions });
|
|
3786
|
-
}
|
|
3756
|
+
if (existing) await this.#savePriorHistory(id, existing, cek, vdigCtx);
|
|
3787
3757
|
const envelope = await this.codec.encryptRecord(record, version, cek, options?.source, options?.sourceTs, vdigCtx, id);
|
|
3788
3758
|
await this.adapter.put(this.vault, this.name, id, envelope);
|
|
3789
3759
|
this.markerIds.delete(id);
|
|
3790
|
-
await this
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
version,
|
|
3800
|
-
actor: this.keyring.userId,
|
|
3801
|
-
payloadHash: await this.strategies.history.envelopePayloadHash(envelope)
|
|
3802
|
-
};
|
|
3803
|
-
if (existing) {
|
|
3804
|
-
appendInput.delta = this.strategies.history.computePatch(record, existing.record);
|
|
3805
|
-
}
|
|
3806
|
-
if (options?.reason !== void 0) appendInput.reason = options.reason;
|
|
3807
|
-
await this.ledger.append(appendInput);
|
|
3808
|
-
}
|
|
3809
|
-
if (this.lazy && this.lru) {
|
|
3810
|
-
this.lru.set(id, { record: await this._toCacheableRecord(record, envelope, id), version }, estimateRecordBytes(record));
|
|
3811
|
-
await this.maintainPersistedIndexesOnPut(id, record, existing ? existing.record : null, version);
|
|
3812
|
-
} else {
|
|
3813
|
-
this.cache.set(id, { record: await this._toCacheableRecord(record, envelope, id), version });
|
|
3814
|
-
this.indexes?.upsert(id, record, existing ? existing.record : null);
|
|
3815
|
-
this.uniqueConstraints?.upsert(id, record, existing?.record);
|
|
3816
|
-
}
|
|
3817
|
-
await this._onRecordMutated(id, "put", "local-write", { record, version });
|
|
3760
|
+
await this.#commitWriteTail({
|
|
3761
|
+
id,
|
|
3762
|
+
envelope,
|
|
3763
|
+
version,
|
|
3764
|
+
indexed: record,
|
|
3765
|
+
event: record,
|
|
3766
|
+
prior: existing,
|
|
3767
|
+
reason: options?.reason
|
|
3768
|
+
});
|
|
3818
3769
|
}
|
|
3819
3770
|
/**
|
|
3820
3771
|
* Fire registered MV strategies whose dependency set includes this
|
|
@@ -3831,34 +3782,8 @@ var Collection = class {
|
|
|
3831
3782
|
*/
|
|
3832
3783
|
async dispatchMaterializedViews(id, record, wave) {
|
|
3833
3784
|
if (this.materializedViewSource === void 0) return;
|
|
3834
|
-
const
|
|
3835
|
-
|
|
3836
|
-
const registry = this.materializedViewSource.registry();
|
|
3837
|
-
const mvs = registry.mvsForSource(this.name);
|
|
3838
|
-
if (mvs.length === 0) return;
|
|
3839
|
-
let executor = null;
|
|
3840
|
-
let staleHelpers = null;
|
|
3841
|
-
for (const reg of mvs) {
|
|
3842
|
-
const mode = reg.spec.refresh;
|
|
3843
|
-
if (mode === "eager") {
|
|
3844
|
-
if (wave?.seen(`mv\0${reg.spec.name}`)) continue;
|
|
3845
|
-
if (executor === null) {
|
|
3846
|
-
;
|
|
3847
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-YORMIBWV.js"));
|
|
3848
|
-
}
|
|
3849
|
-
await executor.refresh(reg, {
|
|
3850
|
-
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
3851
|
-
getActiveTxContext: () => this.materializedViewSource.getActiveTxContext(),
|
|
3852
|
-
getQueryContext: () => this.materializedViewSource.getQueryContext(),
|
|
3853
|
-
dispatchCtx: this.#dispatchCtx({ collection: this.name, id })
|
|
3854
|
-
});
|
|
3855
|
-
} else if (mode === "lazy") {
|
|
3856
|
-
if (staleHelpers === null) {
|
|
3857
|
-
staleHelpers = await import("./stale-4UNPHWOU.js");
|
|
3858
|
-
}
|
|
3859
|
-
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
3860
|
-
}
|
|
3861
|
-
}
|
|
3785
|
+
const { dispatchMaterializedViews } = await import("./dispatch-SMXUO7W5.js");
|
|
3786
|
+
return dispatchMaterializedViews(this.#mvDispatchCtx(this.materializedViewSource), id, record, wave);
|
|
3862
3787
|
}
|
|
3863
3788
|
/**
|
|
3864
3789
|
* Fire registered derivation strategies for this source collection.
|
|
@@ -3946,6 +3871,32 @@ var Collection = class {
|
|
|
3946
3871
|
return out;
|
|
3947
3872
|
}
|
|
3948
3873
|
/** @internal — ctx for `putDerivedOutput`'s frozen-period skip+audit (#638 Task 5). */
|
|
3874
|
+
/** What `with-formula/materialized-views/dispatch.ts` needs from this collection (#842). */
|
|
3875
|
+
#mvDispatchCtx(materializedViewSource) {
|
|
3876
|
+
return {
|
|
3877
|
+
materializedViewSource,
|
|
3878
|
+
collectionName: this.name,
|
|
3879
|
+
dispatchCtx: (source) => this.#dispatchCtx(source)
|
|
3880
|
+
};
|
|
3881
|
+
}
|
|
3882
|
+
/**
|
|
3883
|
+
* What `with-formula/derivations/dispatch.ts` needs from this collection (#842).
|
|
3884
|
+
*
|
|
3885
|
+
* The return type is inferred, not annotated: importing `DerivationDeleteCtx`
|
|
3886
|
+
* would be a STATIC spine→service import, which `port-layering` rejects even
|
|
3887
|
+
* when it is type-only — the guard scans import statements, not their
|
|
3888
|
+
* erasure. The dynamic `import()` at the call site still types the argument.
|
|
3889
|
+
*/
|
|
3890
|
+
#derivationDeleteCtx(derivationSource) {
|
|
3891
|
+
return {
|
|
3892
|
+
derivationSource,
|
|
3893
|
+
collectionName: this.name,
|
|
3894
|
+
adapter: this.adapter,
|
|
3895
|
+
vault: this.vault,
|
|
3896
|
+
getDEK: this.getDEK,
|
|
3897
|
+
storeCiphertext: this.storeCiphertext
|
|
3898
|
+
};
|
|
3899
|
+
}
|
|
3949
3900
|
#dispatchCtx(source) {
|
|
3950
3901
|
return { emit: (e, p) => this.emitter.emit(e, p), source, audit: ledgerAuditHook(this.ledger, this.keyring.userId) };
|
|
3951
3902
|
}
|
|
@@ -3971,11 +3922,7 @@ var Collection = class {
|
|
|
3971
3922
|
const patched = { ...base, [field]: newValue };
|
|
3972
3923
|
const txCtx = this.derivationSource.getActiveTxContext();
|
|
3973
3924
|
if (txCtx !== null) {
|
|
3974
|
-
|
|
3975
|
-
txCtx._executed.push({
|
|
3976
|
-
op: { type: "put", vaultName: this.vault, collectionName: into, id: parentId },
|
|
3977
|
-
priorEnvelope: prior
|
|
3978
|
-
});
|
|
3925
|
+
this.#trackPut(txCtx, into, parentId, await this.adapter.get(this.vault, into, parentId));
|
|
3979
3926
|
}
|
|
3980
3927
|
return putDerivedOutput(intoColl, parentId, patched, this.#dispatchCtx(source));
|
|
3981
3928
|
}
|
|
@@ -4008,150 +3955,14 @@ var Collection = class {
|
|
|
4008
3955
|
* dispatch wave's per-target dedup; `undefined` on the local-write path (byte-identical). */
|
|
4009
3956
|
async dispatchDerivations(id, record, version, wave) {
|
|
4010
3957
|
if (this.derivationSource === void 0) return;
|
|
4011
|
-
const
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
if (spec.rollup) {
|
|
4020
|
-
if (mode !== "eager") continue;
|
|
4021
|
-
let parentId;
|
|
4022
|
-
if (this.name === spec.rollup.from) {
|
|
4023
|
-
const kv = incoming[spec.rollup.key];
|
|
4024
|
-
parentId = typeof kv === "string" || typeof kv === "number" ? String(kv) : null;
|
|
4025
|
-
} else {
|
|
4026
|
-
parentId = id;
|
|
4027
|
-
}
|
|
4028
|
-
if (parentId !== null) await this.recomputeRollup(spec, parentId, { collection: this.name, id }, wave);
|
|
4029
|
-
continue;
|
|
4030
|
-
}
|
|
4031
|
-
const isSource = spec.source === this.name;
|
|
4032
|
-
const isSibling = !isSource && (spec.sources?.includes(this.name) ?? false);
|
|
4033
|
-
const trigger = !isSource && !isSibling ? spec.triggerBy?.find((t) => t.collection === this.name) : void 0;
|
|
4034
|
-
const runs = [];
|
|
4035
|
-
if (isSource) {
|
|
4036
|
-
runs.push({ input: { ...incoming, id }, base: incoming, runId: id, version });
|
|
4037
|
-
} else if (isSibling) {
|
|
4038
|
-
const p = await this.derivationSource.getCollection(spec.source).get(id);
|
|
4039
|
-
if (p !== null && p !== void 0) {
|
|
4040
|
-
const raw = await this.derivationSource.getCollection(spec.source)._getStoredRecord(id);
|
|
4041
|
-
runs.push({ input: { ...p, id }, base: raw ?? p, runId: id, version: 0 });
|
|
4042
|
-
}
|
|
4043
|
-
} else if (trigger) {
|
|
4044
|
-
const srcColl = this.derivationSource.getCollection(spec.source);
|
|
4045
|
-
const ids = await srcColl._findMatchingIds(trigger.on, id);
|
|
4046
|
-
if (trigger.maxFanout !== void 0 && ids.length > trigger.maxFanout) {
|
|
4047
|
-
throw new DerivationCapExceededError(`triggerBy ${this.name}\u2192${spec.source}`, ids.length, trigger.maxFanout);
|
|
4048
|
-
}
|
|
4049
|
-
for (const sid of ids) {
|
|
4050
|
-
const raw = await srcColl._getStoredRecord(sid);
|
|
4051
|
-
if (raw === null) continue;
|
|
4052
|
-
runs.push({ input: { ...raw, id: sid }, base: raw, runId: sid, version: 0 });
|
|
4053
|
-
}
|
|
4054
|
-
}
|
|
4055
|
-
if (runs.length === 0) continue;
|
|
4056
|
-
if (mode !== "eager") {
|
|
4057
|
-
for (const run of runs) await markStale(registry, spec, run.runId);
|
|
4058
|
-
continue;
|
|
4059
|
-
}
|
|
4060
|
-
if (DerivationExecutor === null) {
|
|
4061
|
-
({ DerivationExecutor } = await import("./executor-TEZYRDN3.js"));
|
|
4062
|
-
}
|
|
4063
|
-
for (const run of runs) {
|
|
4064
|
-
const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
|
|
4065
|
-
const outCtx = this.#dispatchCtx({ collection: spec.source, id: run.runId });
|
|
4066
|
-
const result = await DerivationExecutor.run(spec, run.input, run.version, strategyHash, ctx);
|
|
4067
|
-
for (const key of Object.keys(spec.outputs)) {
|
|
4068
|
-
const out = result.outputs[key];
|
|
4069
|
-
if (!out) continue;
|
|
4070
|
-
if (out.kind === "failed") {
|
|
4071
|
-
const err = out.error;
|
|
4072
|
-
if (spec.strict) throw err;
|
|
4073
|
-
console.warn(`[derivation] output "${key}" for source "${spec.source}" id="${run.runId}" failed:`, err);
|
|
4074
|
-
continue;
|
|
4075
|
-
}
|
|
4076
|
-
const outSpec = spec.outputs[key];
|
|
4077
|
-
if (!outSpec) continue;
|
|
4078
|
-
const outputCollection = this.derivationSource.getCollection(outSpec.collection);
|
|
4079
|
-
const txCtx = this.derivationSource.getActiveTxContext();
|
|
4080
|
-
if (out.kind === "array") {
|
|
4081
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-HJV3A7PM.js");
|
|
4082
|
-
const prior = await loadFanoutSidecar(this.adapter, this.vault, spec.source, run.runId, key, this.getDEK, this.storeCiphertext);
|
|
4083
|
-
const prevKeys = new Set(prior?.keys ?? []);
|
|
4084
|
-
const newKeysList = out.entries.map((e) => e.key);
|
|
4085
|
-
const newKeysSet = new Set(newKeysList);
|
|
4086
|
-
for (const k of prevKeys) {
|
|
4087
|
-
if (newKeysSet.has(k)) continue;
|
|
4088
|
-
await outputCollection._internalDelete(k, txCtx);
|
|
4089
|
-
}
|
|
4090
|
-
for (const entry of out.entries) {
|
|
4091
|
-
if (txCtx !== null) {
|
|
4092
|
-
const priorEnvelope = await this.adapter.get(this.vault, outSpec.collection, entry.key);
|
|
4093
|
-
txCtx._executed.push({
|
|
4094
|
-
op: {
|
|
4095
|
-
type: "put",
|
|
4096
|
-
vaultName: this.vault,
|
|
4097
|
-
collectionName: outSpec.collection,
|
|
4098
|
-
id: entry.key
|
|
4099
|
-
},
|
|
4100
|
-
priorEnvelope
|
|
4101
|
-
});
|
|
4102
|
-
}
|
|
4103
|
-
await putDerivedOutput(outputCollection, entry.key, entry.value, outCtx, { source: "derived" });
|
|
4104
|
-
}
|
|
4105
|
-
await saveFanoutSidecar(this.adapter, this.vault, {
|
|
4106
|
-
source: spec.source,
|
|
4107
|
-
sourceId: run.runId,
|
|
4108
|
-
outputKey: key,
|
|
4109
|
-
outputCollection: outSpec.collection,
|
|
4110
|
-
keys: newKeysList
|
|
4111
|
-
}, this.getDEK, this.storeCiphertext);
|
|
4112
|
-
continue;
|
|
4113
|
-
}
|
|
4114
|
-
if (out.skipped === true) {
|
|
4115
|
-
await outputCollection._internalDelete(run.runId, txCtx);
|
|
4116
|
-
continue;
|
|
4117
|
-
}
|
|
4118
|
-
if (outSpec.shape === "record" && outSpec.denorm !== void 0 && outSpec.collection === spec.source) {
|
|
4119
|
-
const value = out.value;
|
|
4120
|
-
const patched = { ...run.base };
|
|
4121
|
-
let changed = false;
|
|
4122
|
-
for (const f of outSpec.denorm) {
|
|
4123
|
-
if (!selfWriteFieldEqual(run.base[f], value[f])) {
|
|
4124
|
-
patched[f] = value[f];
|
|
4125
|
-
changed = true;
|
|
4126
|
-
}
|
|
4127
|
-
}
|
|
4128
|
-
if (!changed) continue;
|
|
4129
|
-
if (txCtx !== null) {
|
|
4130
|
-
const prior = await this.adapter.get(this.vault, outSpec.collection, run.runId);
|
|
4131
|
-
txCtx._executed.push({
|
|
4132
|
-
op: { type: "put", vaultName: this.vault, collectionName: outSpec.collection, id: run.runId },
|
|
4133
|
-
priorEnvelope: prior
|
|
4134
|
-
});
|
|
4135
|
-
}
|
|
4136
|
-
await putDerivedOutput(outputCollection, run.runId, patched, outCtx, { source: "derived" });
|
|
4137
|
-
continue;
|
|
4138
|
-
}
|
|
4139
|
-
if (txCtx !== null) {
|
|
4140
|
-
const prior = await this.adapter.get(this.vault, outSpec.collection, run.runId);
|
|
4141
|
-
txCtx._executed.push({
|
|
4142
|
-
op: {
|
|
4143
|
-
type: "put",
|
|
4144
|
-
vaultName: this.vault,
|
|
4145
|
-
collectionName: outSpec.collection,
|
|
4146
|
-
id: run.runId
|
|
4147
|
-
},
|
|
4148
|
-
priorEnvelope: prior
|
|
4149
|
-
});
|
|
4150
|
-
}
|
|
4151
|
-
await putDerivedOutput(outputCollection, run.runId, out.value, outCtx, { source: "derived" });
|
|
4152
|
-
}
|
|
4153
|
-
}
|
|
4154
|
-
}
|
|
3958
|
+
const { dispatchDerivations } = await import("./dispatch-PKQQFDBT.js");
|
|
3959
|
+
return dispatchDerivations({
|
|
3960
|
+
...this.#derivationDeleteCtx(this.derivationSource),
|
|
3961
|
+
via: this.via,
|
|
3962
|
+
recomputeRollup: (spec, parentId, source, w) => this.recomputeRollup(spec, parentId, source, w),
|
|
3963
|
+
dispatchCtx: (source) => this.#dispatchCtx(source),
|
|
3964
|
+
trackPut: (txCtx, collectionName, rid, prior) => this.#trackPut(txCtx, collectionName, rid, prior)
|
|
3965
|
+
}, id, record, version, wave);
|
|
4155
3966
|
}
|
|
4156
3967
|
/**
|
|
4157
3968
|
* Delete a record by ID. Runs inside the hub's write-queue tracker
|
|
@@ -4421,33 +4232,8 @@ var Collection = class {
|
|
|
4421
4232
|
*/
|
|
4422
4233
|
async dispatchArrayDerivationsOnDelete(id, eraseRecordShapeToo = false) {
|
|
4423
4234
|
if (this.derivationSource === void 0) return 0;
|
|
4424
|
-
const
|
|
4425
|
-
|
|
4426
|
-
if (strategies.length === 0) return 0;
|
|
4427
|
-
let helpers = null;
|
|
4428
|
-
const txCtx = this.derivationSource.getActiveTxContext();
|
|
4429
|
-
let erased = 0;
|
|
4430
|
-
for (const { spec } of strategies) {
|
|
4431
|
-
for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
|
|
4432
|
-
if (outSpec.shape === "record") {
|
|
4433
|
-
if (eraseRecordShapeToo && spec.source === this.name && outSpec.collection !== this.name) {
|
|
4434
|
-
if (await this.derivationSource.getCollection(outSpec.collection)._internalDelete(id, txCtx)) erased += 1;
|
|
4435
|
-
}
|
|
4436
|
-
continue;
|
|
4437
|
-
}
|
|
4438
|
-
if (helpers === null) {
|
|
4439
|
-
helpers = await import("./fanout-sidecar-HJV3A7PM.js");
|
|
4440
|
-
}
|
|
4441
|
-
const sidecar = await helpers.loadFanoutSidecar(this.adapter, this.vault, spec.source, id, outputKey, this.getDEK, this.storeCiphertext);
|
|
4442
|
-
if (!sidecar) continue;
|
|
4443
|
-
const outputCollection = this.derivationSource.getCollection(outSpec.collection);
|
|
4444
|
-
for (const derivedId of sidecar.keys) {
|
|
4445
|
-
if (await outputCollection._internalDelete(derivedId, txCtx)) erased += 1;
|
|
4446
|
-
}
|
|
4447
|
-
await helpers.deleteFanoutSidecar(this.adapter, this.vault, spec.source, id, outputKey);
|
|
4448
|
-
}
|
|
4449
|
-
}
|
|
4450
|
-
return erased;
|
|
4235
|
+
const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-PKQQFDBT.js");
|
|
4236
|
+
return dispatchArrayDerivationsOnDelete(this.#derivationDeleteCtx(this.derivationSource), id, eraseRecordShapeToo);
|
|
4451
4237
|
}
|
|
4452
4238
|
/**
|
|
4453
4239
|
* Mirror of {@link dispatchMaterializedViews} for the delete/forget path — no `_materializedFrom`
|
|
@@ -4460,41 +4246,8 @@ var Collection = class {
|
|
|
4460
4246
|
*/
|
|
4461
4247
|
async dispatchMaterializedViewsOnDelete(id) {
|
|
4462
4248
|
if (this.materializedViewSource === void 0) return { deleted: 0, residueUndecodable: [], residueDeclined: [] };
|
|
4463
|
-
const
|
|
4464
|
-
|
|
4465
|
-
if (mvs.length === 0) return { deleted: 0, residueUndecodable: [], residueDeclined: [] };
|
|
4466
|
-
let executor = null;
|
|
4467
|
-
let staleHelpers = null;
|
|
4468
|
-
let deleted = 0;
|
|
4469
|
-
const residueUndecodable = [];
|
|
4470
|
-
const residueDeclined = [];
|
|
4471
|
-
for (const reg of mvs) {
|
|
4472
|
-
const mode = reg.spec.refresh;
|
|
4473
|
-
if (mode === "eager") {
|
|
4474
|
-
if (executor === null) {
|
|
4475
|
-
;
|
|
4476
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-YORMIBWV.js"));
|
|
4477
|
-
}
|
|
4478
|
-
const rr = await executor.refresh(reg, {
|
|
4479
|
-
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
4480
|
-
getActiveTxContext: () => this.materializedViewSource.getActiveTxContext(),
|
|
4481
|
-
getQueryContext: () => this.materializedViewSource.getQueryContext(),
|
|
4482
|
-
dispatchCtx: this.#dispatchCtx({ collection: this.name, id })
|
|
4483
|
-
});
|
|
4484
|
-
deleted += rr.deleted;
|
|
4485
|
-
residueUndecodable.push(...rr.residueUndecodable);
|
|
4486
|
-
residueDeclined.push(...rr.residueDeclined);
|
|
4487
|
-
} else {
|
|
4488
|
-
if (staleHelpers === null) {
|
|
4489
|
-
staleHelpers = await import("./stale-4UNPHWOU.js");
|
|
4490
|
-
}
|
|
4491
|
-
const inv = await staleHelpers.invalidateMVAtRest(this.materializedViewSource, reg, mode);
|
|
4492
|
-
deleted += inv.deleted;
|
|
4493
|
-
residueUndecodable.push(...inv.residueUndecodable.map((rid) => `${reg.outputCollection}:${rid}`));
|
|
4494
|
-
residueDeclined.push(...inv.residueDeclined.map((rid) => `${reg.outputCollection}:${rid}`));
|
|
4495
|
-
}
|
|
4496
|
-
}
|
|
4497
|
-
return { deleted, residueUndecodable, residueDeclined };
|
|
4249
|
+
const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-SMXUO7W5.js");
|
|
4250
|
+
return dispatchMaterializedViewsOnDelete(this.#mvDispatchCtx(this.materializedViewSource), id);
|
|
4498
4251
|
}
|
|
4499
4252
|
/**
|
|
4500
4253
|
* List all records in the collection.
|
|
@@ -4513,7 +4266,7 @@ var Collection = class {
|
|
|
4513
4266
|
);
|
|
4514
4267
|
}
|
|
4515
4268
|
if (this.materializedViewSource !== void 0) {
|
|
4516
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
4269
|
+
const { resolveStaleMVOnRead } = await import("./stale-NBROTA66.js");
|
|
4517
4270
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
|
|
4518
4271
|
}
|
|
4519
4272
|
await this.ensureHydrated();
|
|
@@ -5666,14 +5419,14 @@ var Collection = class {
|
|
|
5666
5419
|
/** C-A/R10: persist the classified marker once per classified handle (store I/O in config-drift.ts). */
|
|
5667
5420
|
async _ensureClassifiedMarker() {
|
|
5668
5421
|
if (this._markerPersisted || this.vdigFields === null) return;
|
|
5669
|
-
const { persistClassifiedMarkerForFields } = await import("./classified-marker-
|
|
5422
|
+
const { persistClassifiedMarkerForFields } = await import("./classified-marker-52P3D72W.js");
|
|
5670
5423
|
await persistClassifiedMarkerForFields(this.adapter, this.vault, this.name, this.vdigFields, await this.getDEK(this.name));
|
|
5671
5424
|
this._markerPersisted = true;
|
|
5672
5425
|
}
|
|
5673
5426
|
/** C-A/R10 drift signal — the marker's declared digest-only set, memoized to one store read per handle (see config-drift.ts). */
|
|
5674
5427
|
async _classifiedMarkerDigestOnly() {
|
|
5675
5428
|
if (this._markerDigestOnlyCache !== void 0) return this._markerDigestOnlyCache;
|
|
5676
|
-
const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-
|
|
5429
|
+
const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-52P3D72W.js");
|
|
5677
5430
|
this._markerDigestOnlyCache = await readClassifiedMarkerDigestOnly(this.adapter, this.vault, this.name, await this.getDEK(this.name));
|
|
5678
5431
|
return this._markerDigestOnlyCache;
|
|
5679
5432
|
}
|
|
@@ -7058,7 +6811,7 @@ var VaultLinks = class {
|
|
|
7058
6811
|
// src/with-shape/links/lazy-handle.ts
|
|
7059
6812
|
function makeLazyLinkSetHandle(d) {
|
|
7060
6813
|
let engine = null;
|
|
7061
|
-
const load = () => engine ??= import("./link-set-
|
|
6814
|
+
const load = () => engine ??= import("./link-set-ZU4E5J5S.js").then(
|
|
7062
6815
|
({ LinkSet }) => new LinkSet(d.adapter, d.vault, d.name, d.spec, d.encrypted, d.getDEK, d.actor, d.emitter, d.endpointExists)
|
|
7063
6816
|
);
|
|
7064
6817
|
return {
|
|
@@ -7596,7 +7349,7 @@ function declareSatellite(ctx, collectionName, options, existingRegistry) {
|
|
|
7596
7349
|
ctx.forEachSyncEngine((e) => e.remirrorPairResolvers([spec.base, spec.satellite]));
|
|
7597
7350
|
const registry = reg;
|
|
7598
7351
|
const baseSchema = ctx.getBaseSchema(spec.base);
|
|
7599
|
-
void import("./post-register-
|
|
7352
|
+
void import("./post-register-XIAHB6KF.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
|
|
7600
7353
|
});
|
|
7601
7354
|
return reg;
|
|
7602
7355
|
}
|
|
@@ -8113,6 +7866,43 @@ var VaultAttestation = class {
|
|
|
8113
7866
|
};
|
|
8114
7867
|
|
|
8115
7868
|
// src/kernel/vault.ts
|
|
7869
|
+
var COLLECTION_PASSTHROUGH_KEYS = [
|
|
7870
|
+
"indexes",
|
|
7871
|
+
"reconcileOnOpen",
|
|
7872
|
+
"prefetch",
|
|
7873
|
+
"cache",
|
|
7874
|
+
"schema",
|
|
7875
|
+
"conflictPolicy",
|
|
7876
|
+
"crdt",
|
|
7877
|
+
"deterministicFields",
|
|
7878
|
+
"acknowledgeDeterministicRisk",
|
|
7879
|
+
"acknowledgeEquatableRisk",
|
|
7880
|
+
"sensitive",
|
|
7881
|
+
"perRecordKeys",
|
|
7882
|
+
"provenance",
|
|
7883
|
+
"ramCiphertext",
|
|
7884
|
+
"tiers",
|
|
7885
|
+
"tierMode",
|
|
7886
|
+
"blobTierPolicy",
|
|
7887
|
+
"i18nFields",
|
|
7888
|
+
"embeddings",
|
|
7889
|
+
"textIndexes",
|
|
7890
|
+
"warmIndexOnOpen",
|
|
7891
|
+
"textIndexPersist",
|
|
7892
|
+
"moneyFields",
|
|
7893
|
+
"viaFields",
|
|
7894
|
+
"computed",
|
|
7895
|
+
"classifiedFields",
|
|
7896
|
+
"fieldMeta",
|
|
7897
|
+
"meta"
|
|
7898
|
+
];
|
|
7899
|
+
function copyDefined(dst, src, keys) {
|
|
7900
|
+
if (src === void 0) return;
|
|
7901
|
+
for (const key of keys) {
|
|
7902
|
+
const value = src[key];
|
|
7903
|
+
if (value !== void 0) dst[key] = value;
|
|
7904
|
+
}
|
|
7905
|
+
}
|
|
8116
7906
|
var Vault = class {
|
|
8117
7907
|
adapter;
|
|
8118
7908
|
/** The vault's name as passed to `openVault()`. Stable for the instance lifetime. */
|
|
@@ -8194,7 +7984,7 @@ var Vault = class {
|
|
|
8194
7984
|
* @see docs/superpowers/specs/2026-06-17-fr6-deed-custodian-liberate-design.md
|
|
8195
7985
|
*/
|
|
8196
7986
|
custody;
|
|
8197
|
-
/** Re-derives an UnlockedKeyring from the adapter using the active user's
|
|
7987
|
+
/** Re-derives an UnlockedKeyring from the adapter using the active user's secret; called by
|
|
8198
7988
|
* `load()` after the on-disk keyring file has been replaced. Provided by Noydb at openVault()
|
|
8199
7989
|
* time; `undefined` in tests that construct Vault directly (load() then skips the refresh). */
|
|
8200
7990
|
reloadKeyring;
|
|
@@ -8559,7 +8349,7 @@ var Vault = class {
|
|
|
8559
8349
|
const strategies = options.schemaUpdate ?? [];
|
|
8560
8350
|
const work = (async () => {
|
|
8561
8351
|
const dek = await this.getDEK(collectionName);
|
|
8562
|
-
const { persistSchemaIfNeeded } = await import("./register-
|
|
8352
|
+
const { persistSchemaIfNeeded } = await import("./register-HB4TQZSV.js");
|
|
8563
8353
|
const result = await persistSchemaIfNeeded({
|
|
8564
8354
|
store: this.adapter,
|
|
8565
8355
|
vault: this.name,
|
|
@@ -8640,26 +8430,7 @@ var Vault = class {
|
|
|
8640
8430
|
}
|
|
8641
8431
|
} : {}
|
|
8642
8432
|
};
|
|
8643
|
-
|
|
8644
|
-
if (options?.reconcileOnOpen !== void 0) collOpts.reconcileOnOpen = options.reconcileOnOpen;
|
|
8645
|
-
if (options?.prefetch !== void 0) collOpts.prefetch = options.prefetch;
|
|
8646
|
-
if (options?.cache !== void 0) collOpts.cache = options.cache;
|
|
8647
|
-
if (options?.schema !== void 0) collOpts.schema = options.schema;
|
|
8648
|
-
if (options?.conflictPolicy !== void 0) collOpts.conflictPolicy = options.conflictPolicy;
|
|
8649
|
-
if (options?.crdt !== void 0) collOpts.crdt = options.crdt;
|
|
8650
|
-
if (options?.deterministicFields !== void 0) {
|
|
8651
|
-
collOpts.deterministicFields = options.deterministicFields;
|
|
8652
|
-
}
|
|
8653
|
-
if (options?.acknowledgeDeterministicRisk !== void 0) {
|
|
8654
|
-
collOpts.acknowledgeDeterministicRisk = options.acknowledgeDeterministicRisk;
|
|
8655
|
-
}
|
|
8656
|
-
if (options?.acknowledgeEquatableRisk !== void 0) {
|
|
8657
|
-
collOpts.acknowledgeEquatableRisk = options.acknowledgeEquatableRisk;
|
|
8658
|
-
}
|
|
8659
|
-
if (options?.sensitive !== void 0) {
|
|
8660
|
-
collOpts.sensitive = options.sensitive;
|
|
8661
|
-
}
|
|
8662
|
-
if (options?.perRecordKeys !== void 0) collOpts.perRecordKeys = options.perRecordKeys;
|
|
8433
|
+
copyDefined(collOpts, options, COLLECTION_PASSTHROUGH_KEYS);
|
|
8663
8434
|
const subjectKey = this.strategies.forget.subjects[collectionName];
|
|
8664
8435
|
if (subjectKey !== void 0) {
|
|
8665
8436
|
if (options?.perRecordKeys === false) {
|
|
@@ -8674,22 +8445,8 @@ var Vault = class {
|
|
|
8674
8445
|
if (value !== void 0 && value !== null) await this._addSubjectRef(coerceSubjectId(value), { collection: collectionName, id });
|
|
8675
8446
|
};
|
|
8676
8447
|
}
|
|
8677
|
-
if (options?.provenance !== void 0) collOpts.provenance = options.provenance;
|
|
8678
|
-
if (options?.ramCiphertext !== void 0) collOpts.ramCiphertext = options.ramCiphertext;
|
|
8679
|
-
if (options?.tiers !== void 0) collOpts.tiers = options.tiers;
|
|
8680
|
-
if (options?.tierMode !== void 0) collOpts.tierMode = options.tierMode;
|
|
8681
|
-
if (options?.blobTierPolicy !== void 0) collOpts.blobTierPolicy = options.blobTierPolicy;
|
|
8682
8448
|
collOpts.onCrossTierAccess = (event) => this.emitCrossTier(event);
|
|
8683
8449
|
if (this.syncAdapter !== void 0) collOpts.syncAdapter = this.syncAdapter;
|
|
8684
|
-
if (options?.i18nFields !== void 0) collOpts.i18nFields = options.i18nFields;
|
|
8685
|
-
if (options?.embeddings !== void 0) collOpts.embeddings = options.embeddings;
|
|
8686
|
-
if (options?.textIndexes !== void 0) collOpts.textIndexes = options.textIndexes;
|
|
8687
|
-
if (options?.warmIndexOnOpen !== void 0) collOpts.warmIndexOnOpen = options.warmIndexOnOpen;
|
|
8688
|
-
if (options?.textIndexPersist !== void 0) collOpts.textIndexPersist = options.textIndexPersist;
|
|
8689
|
-
if (options?.moneyFields !== void 0) collOpts.moneyFields = options.moneyFields;
|
|
8690
|
-
if (options?.viaFields !== void 0) collOpts.viaFields = options.viaFields;
|
|
8691
|
-
if (options?.computed !== void 0) collOpts.computed = options.computed;
|
|
8692
|
-
if (options?.classifiedFields !== void 0) collOpts.classifiedFields = options.classifiedFields;
|
|
8693
8450
|
if (effectiveViaFields.dictKeyFields !== void 0 || effectiveViaFields.lookupFields !== void 0) {
|
|
8694
8451
|
collOpts.dictLabelResolver = async (dictName, key, locale, fallback) => {
|
|
8695
8452
|
const stat = this.staticByName.get(dictName);
|
|
@@ -8723,10 +8480,6 @@ var Vault = class {
|
|
|
8723
8480
|
if (effectiveViaFields.i18nFields !== void 0 && this.translateText) {
|
|
8724
8481
|
collOpts.autoTranslateHook = this.translateText;
|
|
8725
8482
|
}
|
|
8726
|
-
if (options?.fieldMeta !== void 0) {
|
|
8727
|
-
collOpts.fieldMeta = options.fieldMeta;
|
|
8728
|
-
}
|
|
8729
|
-
if (options?.meta !== void 0) collOpts.meta = options.meta;
|
|
8730
8483
|
if (options?.refs !== void 0) {
|
|
8731
8484
|
collOpts.declaredRefs = this.refRegistry.getOutbound(collectionName);
|
|
8732
8485
|
}
|
|
@@ -8745,7 +8498,7 @@ var Vault = class {
|
|
|
8745
8498
|
const work = (async () => {
|
|
8746
8499
|
try {
|
|
8747
8500
|
const dek = await this.getDEK(collectionName);
|
|
8748
|
-
await (await import("./register-
|
|
8501
|
+
await (await import("./register-HB4TQZSV.js")).persistSchemaIfNeeded({
|
|
8749
8502
|
store: this.adapter,
|
|
8750
8503
|
vault: this.name,
|
|
8751
8504
|
collectionName,
|
|
@@ -9243,7 +8996,7 @@ var Vault = class {
|
|
|
9243
8996
|
* is re-keyed for distinct recipients.
|
|
9244
8997
|
*
|
|
9245
8998
|
* Each recipient becomes its own `KeyringFile` sealed with that
|
|
9246
|
-
* recipient's
|
|
8999
|
+
* recipient's secret. The DEKs wrapped into each slot are
|
|
9247
9000
|
* exactly those the recipient's role + permissions justify, and
|
|
9248
9001
|
* never wider than the source keyring's own DEK set
|
|
9249
9002
|
* (privilege-escalation check).
|
|
@@ -9932,7 +9685,7 @@ var Vault = class {
|
|
|
9932
9685
|
async _initDerivations(handles) {
|
|
9933
9686
|
if (handles.length === 0) return;
|
|
9934
9687
|
const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
9935
|
-
import("./registry-
|
|
9688
|
+
import("./registry-JOFO7RAH.js"),
|
|
9936
9689
|
import("./read-only-facade-CHCKSEPD.js")
|
|
9937
9690
|
]);
|
|
9938
9691
|
const registry = new DerivationRegistry();
|
|
@@ -9964,7 +9717,7 @@ var Vault = class {
|
|
|
9964
9717
|
*/
|
|
9965
9718
|
async _initMaterializedViews(handles) {
|
|
9966
9719
|
if (handles.length === 0) return;
|
|
9967
|
-
const { MaterializedViewRegistry } = await import("./registry-
|
|
9720
|
+
const { MaterializedViewRegistry } = await import("./registry-6BMBFEXT.js");
|
|
9968
9721
|
const registry = new MaterializedViewRegistry();
|
|
9969
9722
|
this.materializedViewRegistry = registry;
|
|
9970
9723
|
const db = this;
|
|
@@ -9989,7 +9742,7 @@ var Vault = class {
|
|
|
9989
9742
|
*/
|
|
9990
9743
|
async _initOverlayedViews(handles) {
|
|
9991
9744
|
if (handles.length === 0) return;
|
|
9992
|
-
const { OverlayedViewRegistry } = await import("./registry-
|
|
9745
|
+
const { OverlayedViewRegistry } = await import("./registry-7CZWF3EQ.js");
|
|
9993
9746
|
const registry = new OverlayedViewRegistry();
|
|
9994
9747
|
const mvRegistry = this.materializedViewRegistry;
|
|
9995
9748
|
const overlayNames = /* @__PURE__ */ new Set();
|
|
@@ -10036,14 +9789,14 @@ var Vault = class {
|
|
|
10036
9789
|
if (!reg) {
|
|
10037
9790
|
throw new Error(`refreshView: no MV registered with name "${name}"`);
|
|
10038
9791
|
}
|
|
10039
|
-
const { MaterializedViewExecutor } = await import("./executor-
|
|
9792
|
+
const { MaterializedViewExecutor } = await import("./executor-SHYLIBOM.js");
|
|
10040
9793
|
const result = await MaterializedViewExecutor.refresh(reg, {
|
|
10041
9794
|
getCollection: (n) => this.collection(n),
|
|
10042
9795
|
getActiveTxContext: () => this.noydb._activeTxContextOrNull,
|
|
10043
9796
|
getQueryContext: () => this,
|
|
10044
9797
|
dispatchCtx: this._dispatchCtx({ collection: name, id: "refreshView" })
|
|
10045
9798
|
});
|
|
10046
|
-
const { clearMVStaleFully } = await import("./stale-
|
|
9799
|
+
const { clearMVStaleFully } = await import("./stale-NBROTA66.js");
|
|
10047
9800
|
await clearMVStaleFully(this.adapter, this.name, registry, name);
|
|
10048
9801
|
return result;
|
|
10049
9802
|
}
|
|
@@ -10056,7 +9809,7 @@ var Vault = class {
|
|
|
10056
9809
|
if (registry === null) return { derived: 0, failed: 0, skippedFrozen: 0 };
|
|
10057
9810
|
const strategies = registry.strategiesForSource(sourceCollection);
|
|
10058
9811
|
if (strategies.length === 0) return { derived: 0, failed: 0, skippedFrozen: 0 };
|
|
10059
|
-
const { DerivationExecutor } = await import("./executor-
|
|
9812
|
+
const { DerivationExecutor } = await import("./executor-FCJEH3FU.js");
|
|
10060
9813
|
const sourceColl = this.collection(sourceCollection);
|
|
10061
9814
|
const records = await sourceColl.list();
|
|
10062
9815
|
const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-CHCKSEPD.js")).ReadOnlyVaultFacade(this, "derivation") };
|
|
@@ -10083,7 +9836,7 @@ var Vault = class {
|
|
|
10083
9836
|
if (!outSpec) continue;
|
|
10084
9837
|
const outputColl = this.collection(outSpec.collection);
|
|
10085
9838
|
if (out.kind === "array") {
|
|
10086
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
9839
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-WWXVHHUH.js");
|
|
10087
9840
|
const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key, this.getDEK, this.encrypted);
|
|
10088
9841
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
10089
9842
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -10310,10 +10063,10 @@ var Vault = class {
|
|
|
10310
10063
|
* collection.
|
|
10311
10064
|
*/
|
|
10312
10065
|
async delegate(opts) {
|
|
10313
|
-
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
10066
|
+
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-WWZPEDK2.js");
|
|
10314
10067
|
if (!this.keyring.kek) {
|
|
10315
10068
|
throw new ValidationError(
|
|
10316
|
-
"issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (
|
|
10069
|
+
"issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (secret) first."
|
|
10317
10070
|
);
|
|
10318
10071
|
}
|
|
10319
10072
|
const targetKek = this.keyring.kek;
|
|
@@ -10332,7 +10085,7 @@ var Vault = class {
|
|
|
10332
10085
|
* if the id does not exist.
|
|
10333
10086
|
*/
|
|
10334
10087
|
async revokeDelegation(id) {
|
|
10335
|
-
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
10088
|
+
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-WWZPEDK2.js");
|
|
10336
10089
|
await revokeDelegation(this.adapter, this.name, id);
|
|
10337
10090
|
void DELEGATIONS_COLLECTION;
|
|
10338
10091
|
}
|
|
@@ -10580,7 +10333,7 @@ var Vault = class {
|
|
|
10580
10333
|
* @see docs/superpowers/specs/2026-05-22-schema-dump-design.md
|
|
10581
10334
|
*/
|
|
10582
10335
|
async dumpSchema(opts = {}) {
|
|
10583
|
-
const { dumpVaultSchema } = await import("./walk-
|
|
10336
|
+
const { dumpVaultSchema } = await import("./walk-E3OVLBFR.js");
|
|
10584
10337
|
return dumpVaultSchema(this, opts);
|
|
10585
10338
|
}
|
|
10586
10339
|
/**
|
|
@@ -10715,7 +10468,7 @@ var Vault = class {
|
|
|
10715
10468
|
* @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/public-envelope.md
|
|
10716
10469
|
*/
|
|
10717
10470
|
async getCover(opts = {}) {
|
|
10718
|
-
const { readCover } = await import("./cover-
|
|
10471
|
+
const { readCover } = await import("./cover-5BSNJREH.js");
|
|
10719
10472
|
return readCover(this.adapter, this.name, opts);
|
|
10720
10473
|
}
|
|
10721
10474
|
/**
|
|
@@ -10730,7 +10483,7 @@ var Vault = class {
|
|
|
10730
10483
|
* both modes round-trip cleanly.
|
|
10731
10484
|
*/
|
|
10732
10485
|
async dump() {
|
|
10733
|
-
const { dumpVault } = await import("./backup-
|
|
10486
|
+
const { dumpVault } = await import("./backup-YCHAC575.js");
|
|
10734
10487
|
return dumpVault(this.backupContext());
|
|
10735
10488
|
}
|
|
10736
10489
|
/**
|
|
@@ -10782,7 +10535,7 @@ var Vault = class {
|
|
|
10782
10535
|
* — there's no chain to verify against.
|
|
10783
10536
|
*/
|
|
10784
10537
|
async load(backupJson) {
|
|
10785
|
-
const { loadVault } = await import("./backup-
|
|
10538
|
+
const { loadVault } = await import("./backup-YCHAC575.js");
|
|
10786
10539
|
return loadVault(this.backupContext(), backupJson);
|
|
10787
10540
|
}
|
|
10788
10541
|
/**
|
|
@@ -10814,7 +10567,7 @@ var Vault = class {
|
|
|
10814
10567
|
* way to detect tampering of an in-place vault.
|
|
10815
10568
|
*/
|
|
10816
10569
|
async verifyBackupIntegrity() {
|
|
10817
|
-
const { verifyBackupIntegrity } = await import("./backup-
|
|
10570
|
+
const { verifyBackupIntegrity } = await import("./backup-YCHAC575.js");
|
|
10818
10571
|
return verifyBackupIntegrity(this.backupContext());
|
|
10819
10572
|
}
|
|
10820
10573
|
/**
|
|
@@ -11032,7 +10785,7 @@ var Vault = class {
|
|
|
11032
10785
|
* is the live validator object, not a serialization of it).
|
|
11033
10786
|
*/
|
|
11034
10787
|
async exportJSON(opts = {}) {
|
|
11035
|
-
const { exportVaultJSON } = await import("./backup-
|
|
10788
|
+
const { exportVaultJSON } = await import("./backup-YCHAC575.js");
|
|
11036
10789
|
return exportVaultJSON(this.backupContext(), opts);
|
|
11037
10790
|
}
|
|
11038
10791
|
};
|
|
@@ -11720,8 +11473,8 @@ async function describeAuthConfig(store, vault) {
|
|
|
11720
11473
|
const lines = [];
|
|
11721
11474
|
lines.push(`Vault "${vault}" \u2014 three-tier authentication`);
|
|
11722
11475
|
lines.push("");
|
|
11723
|
-
lines.push("Tier 1 \u2014
|
|
11724
|
-
lines.push(` Phrase format: ${policy.
|
|
11476
|
+
lines.push("Tier 1 \u2014 Secret (master)");
|
|
11477
|
+
lines.push(` Phrase format: ${policy.secret?.minWords ?? 6}+ words, lowercase letters, \u2265${policy.secret?.minWordLength ?? 3} chars/word`);
|
|
11725
11478
|
lines.push(" Strength validator: enforced (override available for tests only)");
|
|
11726
11479
|
lines.push("");
|
|
11727
11480
|
lines.push("Tier 2 \u2014 Authenticate (routine login)");
|
|
@@ -11732,7 +11485,7 @@ async function describeAuthConfig(store, vault) {
|
|
|
11732
11485
|
lines.push(" Method: PIN (per-app configurable)");
|
|
11733
11486
|
lines.push("");
|
|
11734
11487
|
lines.push(`Recovery profiles enrolled: ${recoveryProfiles.length === 0 ? "none" : recoveryProfiles.join(", ")}`);
|
|
11735
|
-
lines.push("Managed-
|
|
11488
|
+
lines.push("Managed-secret mode: off (post-1.0)");
|
|
11736
11489
|
lines.push("");
|
|
11737
11490
|
lines.push("Sensitive-action gates:");
|
|
11738
11491
|
for (const [gate, gp] of Object.entries(policy.gates)) {
|
|
@@ -11745,7 +11498,7 @@ async function diagramAuthConfig(store, vault) {
|
|
|
11745
11498
|
const lines = [];
|
|
11746
11499
|
lines.push("flowchart TB");
|
|
11747
11500
|
lines.push(` vault["Vault: ${escapeMermaid(vault)}"]`);
|
|
11748
|
-
lines.push(' tier1["Tier 1<br/>
|
|
11501
|
+
lines.push(' tier1["Tier 1<br/>Secret"]');
|
|
11749
11502
|
lines.push(' tier2["Tier 2<br/>Multi-slot Authenticate"]');
|
|
11750
11503
|
lines.push(' tier3["Tier 3<br/>PIN / Quick-resume"]');
|
|
11751
11504
|
lines.push(" vault --> tier1");
|
|
@@ -11819,7 +11572,7 @@ function describeGatePolicy(gp) {
|
|
|
11819
11572
|
}
|
|
11820
11573
|
function defaultPolicySnapshot() {
|
|
11821
11574
|
return {
|
|
11822
|
-
|
|
11575
|
+
secret: { minWords: 6, minWordLength: 3, rejectRepeatedAdjacent: true },
|
|
11823
11576
|
gates: {}
|
|
11824
11577
|
};
|
|
11825
11578
|
}
|
|
@@ -11969,7 +11722,7 @@ var TeamFacade = class {
|
|
|
11969
11722
|
* ```ts
|
|
11970
11723
|
* import { enrollWebAuthn } from '@noy-db/on-webauthn'
|
|
11971
11724
|
*
|
|
11972
|
-
* await db.enrollWebAuthn('demo', async (keyring) => {
|
|
11725
|
+
* await db.team.enrollWebAuthn('demo', async (keyring) => {
|
|
11973
11726
|
* const e = await enrollWebAuthn(keyring, 'demo', { rp: {...} })
|
|
11974
11727
|
* return {
|
|
11975
11728
|
* id: `webauthn-${e.credentialId.slice(0, 8)}`,
|
|
@@ -11998,7 +11751,7 @@ var TeamFacade = class {
|
|
|
11998
11751
|
const slotOptions = await ceremony(keyring);
|
|
11999
11752
|
if (slotOptions.method !== "webauthn") {
|
|
12000
11753
|
throw new ValidationError(
|
|
12001
|
-
`enrollWebAuthn: ceremony returned method "${slotOptions.method}"; expected "webauthn". Use db.enrollAuthenticator() for non-webauthn methods.`
|
|
11754
|
+
`enrollWebAuthn: ceremony returned method "${slotOptions.method}"; expected "webauthn". Use db.team.enrollAuthenticator() for non-webauthn methods.`
|
|
12002
11755
|
);
|
|
12003
11756
|
}
|
|
12004
11757
|
const credentialId = slotOptions.meta.credentialId;
|
|
@@ -12076,44 +11829,44 @@ var TeamFacade = class {
|
|
|
12076
11829
|
}
|
|
12077
11830
|
// ─── Tier-1 change flows ────────────────────────────────────────
|
|
12078
11831
|
/**
|
|
12079
|
-
* Rotate the user's
|
|
12080
|
-
* new phrase against the configured `
|
|
12081
|
-
* `rotate-
|
|
11832
|
+
* Rotate the user's secret (user remembers old). Validates the
|
|
11833
|
+
* new phrase against the configured `secret` policy, runs the
|
|
11834
|
+
* `rotate-secret` gate, then re-derives + re-wraps every DEK.
|
|
12082
11835
|
*
|
|
12083
11836
|
* Tier-2 authenticator slots are dropped — each slot wraps the old
|
|
12084
11837
|
* KEK and would need its derivation key to be re-presented. Re-enrol
|
|
12085
11838
|
* via `db.enrollAuthenticator` after rotation.
|
|
12086
11839
|
*
|
|
12087
|
-
* @throws `
|
|
11840
|
+
* @throws `WeakSecretError` on a weak new phrase.
|
|
12088
11841
|
* @throws `PolicyDeniedError` when the gate denies (missing factor, …).
|
|
12089
|
-
* @throws `InvalidKeyError` when `
|
|
11842
|
+
* @throws `InvalidKeyError` when `oldSecret` is wrong.
|
|
12090
11843
|
*/
|
|
12091
|
-
async
|
|
12092
|
-
if (this.deps.options.
|
|
11844
|
+
async rotateSecret(vault, input, factors) {
|
|
11845
|
+
if (this.deps.options.secretMode === "managed") {
|
|
12093
11846
|
throw new PolicyDeniedError(
|
|
12094
|
-
"rotate-
|
|
11847
|
+
"rotate-secret",
|
|
12095
11848
|
"disabled",
|
|
12096
11849
|
{ minTier: 1, enabled: false },
|
|
12097
|
-
"Managed-
|
|
11850
|
+
"Managed-secret mode (#14): the secret is hub-generated and sealed under the SealingKeyProvider \u2014 there is no plaintext to rotate. Use the recovery flow (follow-up issue) to mint a fresh sealed secret."
|
|
12098
11851
|
);
|
|
12099
11852
|
}
|
|
12100
|
-
await this.deps.checkGate(vault, "rotate-
|
|
11853
|
+
await this.deps.checkGate(vault, "rotate-secret", factors);
|
|
12101
11854
|
const userId = this.deps.options.user;
|
|
12102
|
-
const next = await
|
|
11855
|
+
const next = await rotateSecret(this.deps.options.store, vault, userId, input);
|
|
12103
11856
|
this.deps.keyringCache.set(vault, next);
|
|
12104
11857
|
}
|
|
12105
11858
|
/**
|
|
12106
|
-
* Reset the
|
|
11859
|
+
* Reset the secret using a recovery proof (user forgot the old).
|
|
12107
11860
|
* Currently supports the `'paper'` profile end-to-end; the
|
|
12108
11861
|
* other profiles throw {@link RecoveryProfileNotImplementedError}.
|
|
12109
11862
|
*
|
|
12110
11863
|
* Burns the used recovery entry on success.
|
|
12111
11864
|
*/
|
|
12112
|
-
async
|
|
12113
|
-
await this.deps.checkGate(vault, "recover-
|
|
11865
|
+
async recoverSecret(vault, input, factors) {
|
|
11866
|
+
await this.deps.checkGate(vault, "recover-secret", factors);
|
|
12114
11867
|
const userId = this.deps.options.user;
|
|
12115
11868
|
const entriesBeforeRecovery = await loadPaperRecoveryEntries(this.deps.options.store, vault);
|
|
12116
|
-
const next = await
|
|
11869
|
+
const next = await recoverSecret(this.deps.options.shamirRecovery, this.deps.options.store, vault, userId, input);
|
|
12117
11870
|
this.deps.keyringCache.set(vault, next);
|
|
12118
11871
|
const rotateRemaining = input.rotateRemainingCodes ?? true;
|
|
12119
11872
|
const remainingAfterBurn = Math.max(0, entriesBeforeRecovery.length - 1);
|
|
@@ -12135,15 +11888,15 @@ var TeamFacade = class {
|
|
|
12135
11888
|
}
|
|
12136
11889
|
/**
|
|
12137
11890
|
* Deliberate paper-recovery-code regeneration. User knows their
|
|
12138
|
-
*
|
|
11891
|
+
* secret but wants a fresh sheet — they lost the printout or
|
|
12139
11892
|
* suspect compromise of the off-site copy.
|
|
12140
11893
|
*
|
|
12141
|
-
* Symmetric to {@link
|
|
11894
|
+
* Symmetric to {@link rotateSecret} for the recovery profile:
|
|
12142
11895
|
* gated, audit-trackable, ergonomic. Replaces (not appends) the
|
|
12143
11896
|
* paper sheet under `_meta/recovery-paper` in a single envelope `put`.
|
|
12144
11897
|
*
|
|
12145
11898
|
* Gated by the `rotate-recovery` policy gate:
|
|
12146
|
-
* - PERSONAL_POLICY: `{ minTier: 1 }` — knowing the
|
|
11899
|
+
* - PERSONAL_POLICY: `{ minTier: 1 }` — knowing the secret
|
|
12147
11900
|
* suffices, matching the lower-level flow's bar.
|
|
12148
11901
|
* - STRICT_POLICY: `{ minTier: 1, factors: [{ anyOf: ['totp',
|
|
12149
11902
|
* 'email-otp', 'webauthn-roaming'] }] }` — rotation is an
|
|
@@ -12163,13 +11916,13 @@ var TeamFacade = class {
|
|
|
12163
11916
|
*
|
|
12164
11917
|
* @example Default count + show-once UI
|
|
12165
11918
|
* ```ts
|
|
12166
|
-
* const { newCodes } = await db.rotateRecovery('acme', { profile: 'paper' })
|
|
11919
|
+
* const { newCodes } = await db.team.rotateRecovery('acme', { profile: 'paper' })
|
|
12167
11920
|
* showCodesToUser(newCodes)
|
|
12168
11921
|
* ```
|
|
12169
11922
|
*
|
|
12170
11923
|
* @example STRICT-policy site with TOTP factor proof
|
|
12171
11924
|
* ```ts
|
|
12172
|
-
* await db.rotateRecovery(
|
|
11925
|
+
* await db.team.rotateRecovery(
|
|
12173
11926
|
* 'acme',
|
|
12174
11927
|
* { profile: 'paper', count: 10 },
|
|
12175
11928
|
* { factors: [{ kind: 'totp', proof: '123456' }] },
|
|
@@ -12193,7 +11946,7 @@ var TeamFacade = class {
|
|
|
12193
11946
|
const existing = await loadPaperRecoveryEntries(this.deps.options.store, vault);
|
|
12194
11947
|
if (existing.length === 0) {
|
|
12195
11948
|
throw new Error(
|
|
12196
|
-
`db.rotateRecovery: no recovery codes are enrolled for vault "${vault}". Call db.enrollRecovery({ profile: 'paper', entries }) first; rotateRecovery replaces an existing sheet rather than minting one from scratch.`
|
|
11949
|
+
`db.rotateRecovery: no recovery codes are enrolled for vault "${vault}". Call db.team.enrollRecovery({ profile: 'paper', entries }) first; rotateRecovery replaces an existing sheet rather than minting one from scratch.`
|
|
12197
11950
|
);
|
|
12198
11951
|
}
|
|
12199
11952
|
const keyring = await this.getKeyring(vault);
|
|
@@ -12215,7 +11968,7 @@ var TeamFacade = class {
|
|
|
12215
11968
|
const existing = await loadShamirRecoveryEntries(this.deps.options.store, vault);
|
|
12216
11969
|
if (existing.length === 0) {
|
|
12217
11970
|
throw new Error(
|
|
12218
|
-
`db.rotateRecovery: no Shamir recovery entry is enrolled for vault "${vault}". Call db.enrollRecovery({ profile: 'shamir', k, n }) first; rotateRecovery replaces an existing entry rather than minting one from scratch.`
|
|
11971
|
+
`db.rotateRecovery: no Shamir recovery entry is enrolled for vault "${vault}". Call db.team.enrollRecovery({ profile: 'shamir', k, n }) first; rotateRecovery replaces an existing entry rather than minting one from scratch.`
|
|
12219
11972
|
);
|
|
12220
11973
|
}
|
|
12221
11974
|
let targetEntryId;
|
|
@@ -12252,7 +12005,7 @@ var TeamFacade = class {
|
|
|
12252
12005
|
* **Atomic create-and-enroll for managed-mode vaults.**
|
|
12253
12006
|
*
|
|
12254
12007
|
* Bootstraps a managed-mode vault and enrolls strong recovery in
|
|
12255
|
-
* a single ceremony. Under `
|
|
12008
|
+
* a single ceremony. Under `secretMode: 'managed'`, every
|
|
12256
12009
|
* `openVault` call requires a strong recovery profile (Shamir
|
|
12257
12010
|
* today) to be enrolled — otherwise it throws
|
|
12258
12011
|
* {@link ManagedRecoveryNotEnrolledError}. This method bypasses
|
|
@@ -12271,11 +12024,11 @@ var TeamFacade = class {
|
|
|
12271
12024
|
* ```ts
|
|
12272
12025
|
* const db = await createNoydb({
|
|
12273
12026
|
* store, user: 'alice',
|
|
12274
|
-
*
|
|
12027
|
+
* secretMode: 'managed',
|
|
12275
12028
|
* sealingKey: macosKeychainSealingProvider({ ... }),
|
|
12276
12029
|
* })
|
|
12277
12030
|
*
|
|
12278
|
-
* const { vault, recoveryEnrollments } = await db.openVaultAndEnrollRecovery('acme', {
|
|
12031
|
+
* const { vault, recoveryEnrollments } = await db.team.openVaultAndEnrollRecovery('acme', {
|
|
12279
12032
|
* recovery: [{ profile: 'shamir', k: 2, n: 3 }],
|
|
12280
12033
|
* })
|
|
12281
12034
|
* for (const r of recoveryEnrollments) {
|
|
@@ -12292,11 +12045,11 @@ var TeamFacade = class {
|
|
|
12292
12045
|
"openVaultAndEnrollRecovery: at least one recovery enrollment is required."
|
|
12293
12046
|
);
|
|
12294
12047
|
}
|
|
12295
|
-
if (this.deps.options.
|
|
12048
|
+
if (this.deps.options.secretMode === "managed") {
|
|
12296
12049
|
const hasStrong = opts.recovery.some((r) => r.profile === "shamir");
|
|
12297
12050
|
if (!hasStrong) {
|
|
12298
12051
|
throw new ValidationError(
|
|
12299
|
-
'openVaultAndEnrollRecovery: managed-mode vaults require at least one strong recovery profile in the `recovery` array. Paper alone is not strong under managed mode (no user
|
|
12052
|
+
'openVaultAndEnrollRecovery: managed-mode vaults require at least one strong recovery profile in the `recovery` array. Paper alone is not strong under managed mode (no user secret to fall back on). Include { profile: "shamir", k, n } in `recovery`.'
|
|
12300
12053
|
);
|
|
12301
12054
|
}
|
|
12302
12055
|
}
|
|
@@ -12311,7 +12064,7 @@ var TeamFacade = class {
|
|
|
12311
12064
|
for (const enrollment of opts.recovery) {
|
|
12312
12065
|
recoveryEnrollments.push(await this.enrollRecovery(vault, enrollment));
|
|
12313
12066
|
}
|
|
12314
|
-
if (this.deps.options.
|
|
12067
|
+
if (this.deps.options.secretMode === "managed") {
|
|
12315
12068
|
const policy = this.deps.policyCache.get(vault);
|
|
12316
12069
|
if (policy) {
|
|
12317
12070
|
await this.deps.assertRecoveryEnrolled(vault, policy);
|
|
@@ -12320,20 +12073,20 @@ var TeamFacade = class {
|
|
|
12320
12073
|
return { vault: vaultHandle, recoveryEnrollments };
|
|
12321
12074
|
}
|
|
12322
12075
|
/**
|
|
12323
|
-
* **Recovery flow under managed-
|
|
12076
|
+
* **Recovery flow under managed-secret mode.**
|
|
12324
12077
|
*
|
|
12325
|
-
* Replaces the sealed
|
|
12078
|
+
* Replaces the sealed secret of a managed-mode vault with a
|
|
12326
12079
|
* fresh 256-bit random, sealed under the configured
|
|
12327
|
-
* `SealingKeyProvider`. The user never sees the new
|
|
12080
|
+
* `SealingKeyProvider`. The user never sees the new secret.
|
|
12328
12081
|
*
|
|
12329
12082
|
* Internally:
|
|
12330
12083
|
* 1. Verify the recovery proof (Shamir today) and unwrap the
|
|
12331
12084
|
* DEK set.
|
|
12332
|
-
* 2. Mint a fresh 256-bit random as the new effective
|
|
12085
|
+
* 2. Mint a fresh 256-bit random as the new effective secret.
|
|
12333
12086
|
* 3. Rewrap the DEK set under a fresh KEK derived from the new
|
|
12334
|
-
*
|
|
12087
|
+
* secret (via the existing `recoverSecret` path).
|
|
12335
12088
|
* 4. Seal the random bytes under the provider and overwrite
|
|
12336
|
-
* `_meta/sealed-
|
|
12089
|
+
* `_meta/sealed-secret`.
|
|
12337
12090
|
* 5. Drop the keyring cache so the next operation re-derives.
|
|
12338
12091
|
*
|
|
12339
12092
|
* The vault's strong-recovery enrollment is preserved across
|
|
@@ -12341,40 +12094,40 @@ var TeamFacade = class {
|
|
|
12341
12094
|
*
|
|
12342
12095
|
* @throws ValidationError if the Noydb instance is not in managed mode.
|
|
12343
12096
|
*/
|
|
12344
|
-
async
|
|
12345
|
-
if (this.deps.options.
|
|
12097
|
+
async recoverManagedSecret(vault, options) {
|
|
12098
|
+
if (this.deps.options.secretMode !== "managed") {
|
|
12346
12099
|
throw new ValidationError(
|
|
12347
|
-
"
|
|
12100
|
+
"recoverManagedSecret: this method only applies to vaults opened in managed-secret mode. For standard mode, use db.recoverSecret."
|
|
12348
12101
|
);
|
|
12349
12102
|
}
|
|
12350
12103
|
const provider = this.deps.options.sealingKey;
|
|
12351
12104
|
if (!provider) {
|
|
12352
12105
|
throw new ValidationError(
|
|
12353
|
-
'
|
|
12106
|
+
'recoverManagedSecret: createNoydb({ secretMode: "managed" }) requires `sealingKey` to be supplied; without it the new sealed secret cannot be persisted.'
|
|
12354
12107
|
);
|
|
12355
12108
|
}
|
|
12356
12109
|
const randomBytes = new Uint8Array(32);
|
|
12357
12110
|
globalThis.crypto.getRandomValues(randomBytes);
|
|
12358
12111
|
let binary = "";
|
|
12359
12112
|
for (let i = 0; i < randomBytes.length; i++) binary += String.fromCharCode(randomBytes[i]);
|
|
12360
|
-
const
|
|
12113
|
+
const newSecret = btoa(binary);
|
|
12361
12114
|
try {
|
|
12362
12115
|
const sealed = await provider.seal(randomBytes);
|
|
12363
|
-
await
|
|
12116
|
+
await recoverSecret(
|
|
12364
12117
|
this.deps.options.shamirRecovery,
|
|
12365
12118
|
this.deps.options.store,
|
|
12366
12119
|
vault,
|
|
12367
12120
|
this.deps.options.user,
|
|
12368
12121
|
{
|
|
12369
|
-
|
|
12122
|
+
newSecret,
|
|
12370
12123
|
recoveryProof: options.recoveryProof,
|
|
12371
|
-
// The new
|
|
12124
|
+
// The new secret IS 256 bits of random; policy gates on
|
|
12372
12125
|
// length/entropy don't apply.
|
|
12373
|
-
|
|
12374
|
-
...options.
|
|
12126
|
+
allowWeakSecret: true,
|
|
12127
|
+
...options.secretPolicy !== void 0 ? { secretPolicy: options.secretPolicy } : {}
|
|
12375
12128
|
}
|
|
12376
12129
|
);
|
|
12377
|
-
await
|
|
12130
|
+
await saveSealedSecret(this.deps.options.store, vault, {
|
|
12378
12131
|
providerId: provider.id,
|
|
12379
12132
|
sealed
|
|
12380
12133
|
});
|
|
@@ -12385,7 +12138,7 @@ var TeamFacade = class {
|
|
|
12385
12138
|
}
|
|
12386
12139
|
/**
|
|
12387
12140
|
* Atomic peer-recovery — re-wraps an EXISTING user's keyring under
|
|
12388
|
-
* a fresh temp
|
|
12141
|
+
* a fresh temp secret in a single store write. Closes the
|
|
12389
12142
|
* partial-failure window (the previous compose-from-primitives
|
|
12390
12143
|
* pattern was `db.revoke + db.grant`, two writes — if the issuer
|
|
12391
12144
|
* cancelled between them the target was locked out entirely).
|
|
@@ -12404,17 +12157,17 @@ var TeamFacade = class {
|
|
|
12404
12157
|
* recovery / TOTP / email-OTP factor proof at the moment of
|
|
12405
12158
|
* recovery, so the issuer affirmatively re-asserts identity.
|
|
12406
12159
|
*
|
|
12407
|
-
* The recipient should call `db.
|
|
12160
|
+
* The recipient should call `db.rotateSecret` on first session
|
|
12408
12161
|
* to choose their own phrase — the temp acts as a single-use
|
|
12409
12162
|
* bridge.
|
|
12410
12163
|
*
|
|
12411
12164
|
* ```ts
|
|
12412
|
-
* await db.recoverUser('acme', {
|
|
12165
|
+
* await db.team.recoverUser('acme', {
|
|
12413
12166
|
* userId: 'bob',
|
|
12414
|
-
*
|
|
12167
|
+
* secret: 'temporary-correct-horse-battery-staple-printer',
|
|
12415
12168
|
* }, { factors: [{ kind: 'recovery' }] })
|
|
12416
12169
|
* // Bob opens createNoydb({ user: 'bob', secret: tempPhrase })
|
|
12417
|
-
* // and immediately calls db.
|
|
12170
|
+
* // and immediately calls db.rotateSecret to set his own.
|
|
12418
12171
|
* ```
|
|
12419
12172
|
*
|
|
12420
12173
|
* @throws `NoAccessError` when no keyring exists for the target.
|
|
@@ -12440,17 +12193,17 @@ var TeamFacade = class {
|
|
|
12440
12193
|
* The hub wraps the user's DEK set (not the KEK) under a code-derived
|
|
12441
12194
|
* AES-GCM key — see `team/recovery.ts` for the rationale. The mint
|
|
12442
12195
|
* helper {@link mintPaperRecoveryEntry} is the canonical primitive;
|
|
12443
|
-
* pair it with `db.getKeyring(vault)` to obtain the live DEK set:
|
|
12196
|
+
* pair it with `db.team.getKeyring(vault)` to obtain the live DEK set:
|
|
12444
12197
|
*
|
|
12445
12198
|
* ```ts
|
|
12446
12199
|
* import { mintPaperRecoveryEntry } from '@noy-db/hub'
|
|
12447
12200
|
*
|
|
12448
|
-
* const keyring = await db.getKeyring('acme')
|
|
12201
|
+
* const keyring = await db.team.getKeyring('acme')
|
|
12449
12202
|
* const codes: string[] = ['CORRECT-HORSE-1', 'BATTERY-STAPLE-2', ...]
|
|
12450
12203
|
* const entries = await Promise.all(
|
|
12451
12204
|
* codes.map((code, i) => mintPaperRecoveryEntry(keyring.deks, code, `code-${i}`)),
|
|
12452
12205
|
* )
|
|
12453
|
-
* await db.enrollRecovery('acme', { profile: 'paper', entries })
|
|
12206
|
+
* await db.team.enrollRecovery('acme', { profile: 'paper', entries })
|
|
12454
12207
|
* showCodesToUser(codes)
|
|
12455
12208
|
* ```
|
|
12456
12209
|
*
|
|
@@ -12461,7 +12214,7 @@ var TeamFacade = class {
|
|
|
12461
12214
|
* ```ts
|
|
12462
12215
|
* import { generateRecoveryCodeSet } from '@noy-db/on-recovery'
|
|
12463
12216
|
* const { codes, entries } = await generateRecoveryCodeSet({ deks: keyring.deks, count: 8 })
|
|
12464
|
-
* await db.enrollRecovery('acme', { profile: 'paper', entries })
|
|
12217
|
+
* await db.team.enrollRecovery('acme', { profile: 'paper', entries })
|
|
12465
12218
|
* ```
|
|
12466
12219
|
*/
|
|
12467
12220
|
async enrollRecovery(vault, enrollment) {
|
|
@@ -12561,7 +12314,7 @@ var TeamFacade = class {
|
|
|
12561
12314
|
* and no `secret` / `getKeyring` is configured.
|
|
12562
12315
|
*
|
|
12563
12316
|
* ```ts
|
|
12564
|
-
* const keyring = await db.getKeyring('acme')
|
|
12317
|
+
* const keyring = await db.team.getKeyring('acme')
|
|
12565
12318
|
* // keyring.deks: Map<collection, CryptoKey>
|
|
12566
12319
|
* // keyring.kek: CryptoKey | null (null for tier-3 / wrap-DEKs sessions)
|
|
12567
12320
|
* // keyring.role / .permissions / .authenticators
|
|
@@ -12638,7 +12391,7 @@ var Noydb = class {
|
|
|
12638
12391
|
keyringCache = /* @__PURE__ */ new Map();
|
|
12639
12392
|
syncEngines = /* @__PURE__ */ new Map();
|
|
12640
12393
|
/**
|
|
12641
|
-
* Per-vault active session tier — defaults to `1` after a
|
|
12394
|
+
* Per-vault active session tier — defaults to `1` after a secret
|
|
12642
12395
|
* unlock; tier-2 / tier-3 unlocks downgrade it. Used by
|
|
12643
12396
|
* {@link checkGate} to evaluate `gate.minTier`.
|
|
12644
12397
|
*/
|
|
@@ -12686,7 +12439,23 @@ var Noydb = class {
|
|
|
12686
12439
|
policyManager;
|
|
12687
12440
|
/** Pre-resolved policy-gate engine function (mirrors `coordinationProvider`/`userApiFactory` above). */
|
|
12688
12441
|
policyCheckGate;
|
|
12689
|
-
|
|
12442
|
+
/**
|
|
12443
|
+
* Credential and multi-user operations — enrolment, secret rotation,
|
|
12444
|
+
* recovery, quick-unlock (#846).
|
|
12445
|
+
*
|
|
12446
|
+
* Public because 23 methods on this class did nothing but restate a
|
|
12447
|
+
* TeamFacade signature and forward to it, so every signature had to be
|
|
12448
|
+
* hand-kept in sync with its counterpart. `db.team.rotateSecret(…)`
|
|
12449
|
+
* reads the same and has one source of truth.
|
|
12450
|
+
*
|
|
12451
|
+
* A getter, not a field, so it appears in the prototype-based kernel API
|
|
12452
|
+
* manifest — an instance field is invisible to it (the same reason
|
|
12453
|
+
* `custodyStrategy` became one in #838).
|
|
12454
|
+
*/
|
|
12455
|
+
get team() {
|
|
12456
|
+
return this.#team;
|
|
12457
|
+
}
|
|
12458
|
+
#team;
|
|
12690
12459
|
/**
|
|
12691
12460
|
* Currently-running multi-record transaction, set by
|
|
12692
12461
|
* `runTransaction` at the start of Phase 2 (commit) and cleared in
|
|
@@ -12748,7 +12517,7 @@ var Noydb = class {
|
|
|
12748
12517
|
this.vaultCache.delete(vault);
|
|
12749
12518
|
}
|
|
12750
12519
|
});
|
|
12751
|
-
this
|
|
12520
|
+
this.#team = new TeamFacade({
|
|
12752
12521
|
options: this.options,
|
|
12753
12522
|
keyringCache: this.keyringCache,
|
|
12754
12523
|
activeTier: this.activeTier,
|
|
@@ -12850,7 +12619,7 @@ var Noydb = class {
|
|
|
12850
12619
|
if (!facade) return;
|
|
12851
12620
|
const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
|
|
12852
12621
|
await registry.runChecks(e.collection, incoming, ctx);
|
|
12853
|
-
const { GuardExecutor } = await import("./executor-
|
|
12622
|
+
const { GuardExecutor } = await import("./executor-OHET7TF7.js");
|
|
12854
12623
|
for (const g of guards) {
|
|
12855
12624
|
await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
|
|
12856
12625
|
}
|
|
@@ -13235,9 +13004,9 @@ var Noydb = class {
|
|
|
13235
13004
|
*
|
|
13236
13005
|
* The walk is a two-step pipeline: first ask the adapter for the
|
|
13237
13006
|
* universe of compartments it stores, then for each one attempt to
|
|
13238
|
-
* load the calling user's keyring with the in-memory
|
|
13007
|
+
* load the calling user's keyring with the in-memory secret.
|
|
13239
13008
|
* Compartments where the user has no keyring file (`NoAccessError`)
|
|
13240
|
-
* or where the
|
|
13009
|
+
* or where the secret doesn't unwrap (`InvalidKeyError`) are
|
|
13241
13010
|
* silently dropped from the result — the existence of those
|
|
13242
13011
|
* compartments is **not** confirmed in the return value.
|
|
13243
13012
|
*
|
|
@@ -13258,15 +13027,15 @@ var Noydb = class {
|
|
|
13258
13027
|
* **Known edge case.** A vault whose keyring file
|
|
13259
13028
|
* happens to have an empty wrapped-DEKs map (because the owner
|
|
13260
13029
|
* granted access before any collection was created) will pass the
|
|
13261
|
-
* `loadKeyring` probe with *any*
|
|
13030
|
+
* `loadKeyring` probe with *any* secret — there are no DEKs to
|
|
13262
13031
|
* unwrap, so the integrity-checked unwrap that normally rejects
|
|
13263
|
-
* wrong
|
|
13032
|
+
* wrong secrets never runs. The result is that an unrelated
|
|
13264
13033
|
* principal who happens to know the user-id and the vault
|
|
13265
13034
|
* name can show up in `listAccessibleVaults()` as having
|
|
13266
13035
|
* access to that empty vault. They cannot read any actual
|
|
13267
13036
|
* data (their DEK set is empty), so this is a metadata leak
|
|
13268
13037
|
* (vault name + user-id), not a content leak. Hardening this
|
|
13269
|
-
* via a
|
|
13038
|
+
* via a secret canary in the keyring file is a deferred
|
|
13270
13039
|
* follow-up.
|
|
13271
13040
|
*
|
|
13272
13041
|
* **Cost.** O(compartments × keyring-load) — one `loadKeyring`
|
|
@@ -13307,7 +13076,7 @@ var Noydb = class {
|
|
|
13307
13076
|
}
|
|
13308
13077
|
if (!this.options.secret) {
|
|
13309
13078
|
throw new ValidationError(
|
|
13310
|
-
"Noydb.listAccessibleVaults(): a secret (
|
|
13079
|
+
"Noydb.listAccessibleVaults(): a secret (secret) is required when encryption is enabled."
|
|
13311
13080
|
);
|
|
13312
13081
|
}
|
|
13313
13082
|
const minRank = ROLE_RANK[options.minRole ?? "client"];
|
|
@@ -13446,21 +13215,21 @@ var Noydb = class {
|
|
|
13446
13215
|
return store.resolveBackend ? store.resolveBackend(vaultId) : this.options.store;
|
|
13447
13216
|
}
|
|
13448
13217
|
/**
|
|
13449
|
-
* Change the current user's
|
|
13218
|
+
* Change the current user's secret for a vault.
|
|
13450
13219
|
*
|
|
13451
|
-
* Validates the new
|
|
13452
|
-
* `{
|
|
13453
|
-
* fixtures and migrations. Pass a `
|
|
13220
|
+
* Validates the new secret against the strength rules. Pass
|
|
13221
|
+
* `{ allowWeakSecret: true }` to skip — typically only useful for
|
|
13222
|
+
* fixtures and migrations. Pass a `SecretPolicy` to override the
|
|
13454
13223
|
* default rules (e.g. consumer-tunable `pattern` / `customValidator`).
|
|
13455
13224
|
*/
|
|
13456
|
-
async changeSecret(vault,
|
|
13225
|
+
async changeSecret(vault, newSecret, options) {
|
|
13457
13226
|
this.checkPolicyOperation(vault, "changeSecret");
|
|
13458
13227
|
const keyring = await this._getKeyringInternal(vault);
|
|
13459
13228
|
const updated = await changeSecret(
|
|
13460
13229
|
this.options.store,
|
|
13461
13230
|
vault,
|
|
13462
13231
|
keyring,
|
|
13463
|
-
|
|
13232
|
+
newSecret,
|
|
13464
13233
|
options
|
|
13465
13234
|
);
|
|
13466
13235
|
this.keyringCache.set(vault, updated);
|
|
@@ -13941,7 +13710,7 @@ var Noydb = class {
|
|
|
13941
13710
|
* denial; resolves with `void` on success.
|
|
13942
13711
|
*
|
|
13943
13712
|
* @param vault The vault whose policy applies.
|
|
13944
|
-
* @param gate Gate name — built-in (e.g. `'rotate-
|
|
13713
|
+
* @param gate Gate name — built-in (e.g. `'rotate-secret'`)
|
|
13945
13714
|
* or app-defined (`app:*`).
|
|
13946
13715
|
* @param presented Caller-supplied factor proofs.
|
|
13947
13716
|
*/
|
|
@@ -13966,12 +13735,12 @@ var Noydb = class {
|
|
|
13966
13735
|
* Two enforcement modes:
|
|
13967
13736
|
*
|
|
13968
13737
|
* 1. **Managed-mode mandatory strong-recovery.** When
|
|
13969
|
-
* `
|
|
13738
|
+
* `secretMode === 'managed'`, the vault MUST have at least
|
|
13970
13739
|
* one **strong** recovery profile (Shamir today). Paper alone is
|
|
13971
13740
|
* rejected because under managed mode the user has no memorized
|
|
13972
|
-
*
|
|
13741
|
+
* secret, so losing the paper sheet = losing every record.
|
|
13973
13742
|
* This check is unconditional — independent of `requireRecovery`
|
|
13974
|
-
* and the `recover-
|
|
13743
|
+
* and the `recover-secret` gate.
|
|
13975
13744
|
*
|
|
13976
13745
|
* 2. **Opt-in strict mandatory-recovery.** When
|
|
13977
13746
|
* `requireRecovery: true` is set on createNoydb (and the gate is
|
|
@@ -13985,14 +13754,14 @@ var Noydb = class {
|
|
|
13985
13754
|
*/
|
|
13986
13755
|
async assertRecoveryEnrolled(vault, policy, opts) {
|
|
13987
13756
|
const skipManaged = (opts?.skipManagedCheck ?? false) || this._skipNextManagedRecoveryCheck;
|
|
13988
|
-
if (this.options.
|
|
13757
|
+
if (this.options.secretMode === "managed" && !skipManaged) {
|
|
13989
13758
|
const enrolled2 = await hasStrongRecoveryEnrolled(this.options.store, vault);
|
|
13990
13759
|
if (!enrolled2) {
|
|
13991
13760
|
throw new ManagedRecoveryNotEnrolledError(vault);
|
|
13992
13761
|
}
|
|
13993
13762
|
}
|
|
13994
13763
|
if (this.options.requireRecovery !== true) return;
|
|
13995
|
-
const gate = policy.gates["recover-
|
|
13764
|
+
const gate = policy.gates["recover-secret"];
|
|
13996
13765
|
if (gate?.enabled === false) return;
|
|
13997
13766
|
const enrolled = await hasRecoveryEnrolled(this.options.store, vault);
|
|
13998
13767
|
if (enrolled) return;
|
|
@@ -14007,34 +13776,6 @@ var Noydb = class {
|
|
|
14007
13776
|
this.activeTier.set(vault, tier);
|
|
14008
13777
|
}
|
|
14009
13778
|
// ─── Tier-2 enroll / remove ─────────────────────────────────────
|
|
14010
|
-
/** Add a tier-2 authenticator slot — see {@link TeamFacade.enrollAuthenticator}. */
|
|
14011
|
-
async enrollAuthenticator(vault, options, factors) {
|
|
14012
|
-
return this.team.enrollAuthenticator(vault, options, factors);
|
|
14013
|
-
}
|
|
14014
|
-
/** Remove a tier-2 authenticator slot — see {@link TeamFacade.removeAuthenticator}. */
|
|
14015
|
-
async removeAuthenticator(vault, slotId, factors) {
|
|
14016
|
-
return this.team.removeAuthenticator(vault, slotId, factors);
|
|
14017
|
-
}
|
|
14018
|
-
/** Read the slot list for a vault — see {@link TeamFacade.listAuthenticators}. */
|
|
14019
|
-
async listAuthenticators(vault) {
|
|
14020
|
-
return this.team.listAuthenticators(vault);
|
|
14021
|
-
}
|
|
14022
|
-
/** Mutate an authenticator slot's `meta` — see {@link TeamFacade.updateAuthenticator}. */
|
|
14023
|
-
async updateAuthenticator(vault, slotId, options, factors) {
|
|
14024
|
-
return this.team.updateAuthenticator(vault, slotId, options, factors);
|
|
14025
|
-
}
|
|
14026
|
-
/** Native WebAuthn enrollment — see {@link TeamFacade.enrollWebAuthn}. */
|
|
14027
|
-
async enrollWebAuthn(vault, ceremony, factors) {
|
|
14028
|
-
return this.team.enrollWebAuthn(vault, ceremony, factors);
|
|
14029
|
-
}
|
|
14030
|
-
/** List webauthn-method slots — see {@link TeamFacade.listWebAuthnSlots}. */
|
|
14031
|
-
async listWebAuthnSlots(vault) {
|
|
14032
|
-
return this.team.listWebAuthnSlots(vault);
|
|
14033
|
-
}
|
|
14034
|
-
/** Unlock via a tier-2 authenticator slot — see {@link TeamFacade.unlockViaAuthenticator}. */
|
|
14035
|
-
async unlockViaAuthenticator(vault, slotId, verify) {
|
|
14036
|
-
return this.team.unlockViaAuthenticator(vault, slotId, verify);
|
|
14037
|
-
}
|
|
14038
13779
|
// ─── Cover (https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/public-envelope.md) ──────
|
|
14039
13780
|
/**
|
|
14040
13781
|
* Set the owner-curated cover for a vault. Throws
|
|
@@ -14058,7 +13799,7 @@ var Noydb = class {
|
|
|
14058
13799
|
"setCover: the cover feature is not enabled. Pass `cover: true` (or a schema object) to `createNoydb`."
|
|
14059
13800
|
);
|
|
14060
13801
|
}
|
|
14061
|
-
const { loadCover, saveCover, resolveSchema, validateCoverInput, mergeCustom, validateCoverSize } = await import("./cover-
|
|
13802
|
+
const { loadCover, saveCover, resolveSchema, validateCoverInput, mergeCustom, validateCoverSize } = await import("./cover-5BSNJREH.js");
|
|
14062
13803
|
const schema = resolveSchema(coverOption);
|
|
14063
13804
|
validateCoverInput(input, schema);
|
|
14064
13805
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -14090,76 +13831,12 @@ var Noydb = class {
|
|
|
14090
13831
|
* regardless).
|
|
14091
13832
|
*/
|
|
14092
13833
|
async getCover(vault, opts = {}) {
|
|
14093
|
-
const { readCover } = await import("./cover-
|
|
13834
|
+
const { readCover } = await import("./cover-5BSNJREH.js");
|
|
14094
13835
|
return readCover(this.options.store, vault, opts);
|
|
14095
13836
|
}
|
|
14096
13837
|
// ─── Auth introspection ─────────────────────────────────────────
|
|
14097
|
-
/** English summary of the configured auth model — see {@link TeamFacade.describeAuthConfig}. */
|
|
14098
|
-
async describeAuthConfig(vault) {
|
|
14099
|
-
return this.team.describeAuthConfig(vault);
|
|
14100
|
-
}
|
|
14101
|
-
/** Mermaid `flowchart TB` source for the auth graph — see {@link TeamFacade.diagramAuthConfig}. */
|
|
14102
|
-
async diagramAuthConfig(vault) {
|
|
14103
|
-
return this.team.diagramAuthConfig(vault);
|
|
14104
|
-
}
|
|
14105
|
-
/** Per-user enrollment summary — see {@link TeamFacade.describeUserAuth}. */
|
|
14106
|
-
async describeUserAuth(vault, userId, factors) {
|
|
14107
|
-
return this.team.describeUserAuth(vault, userId, factors);
|
|
14108
|
-
}
|
|
14109
|
-
/** Bulk per-user enrollment summary — see {@link TeamFacade.describeAllUsersAuth}. */
|
|
14110
|
-
async describeAllUsersAuth(vault, factors) {
|
|
14111
|
-
return this.team.describeAllUsersAuth(vault, factors);
|
|
14112
|
-
}
|
|
14113
13838
|
// ─── Tier-1 change flows ────────────────────────────────────────
|
|
14114
|
-
/** Rotate the user's passphrase (user remembers old) — see {@link TeamFacade.rotatePassphrase}. */
|
|
14115
|
-
async rotatePassphrase(vault, input, factors) {
|
|
14116
|
-
return this.team.rotatePassphrase(vault, input, factors);
|
|
14117
|
-
}
|
|
14118
|
-
/** Reset the passphrase using a recovery proof — see {@link TeamFacade.recoverPassphrase}. */
|
|
14119
|
-
async recoverPassphrase(vault, input, factors) {
|
|
14120
|
-
return this.team.recoverPassphrase(vault, input, factors);
|
|
14121
|
-
}
|
|
14122
|
-
/** Deliberate paper/Shamir recovery-code regeneration — see {@link TeamFacade.rotateRecovery}. */
|
|
14123
|
-
async rotateRecovery(vault, options, factors) {
|
|
14124
|
-
return this.team.rotateRecovery(vault, options, factors);
|
|
14125
|
-
}
|
|
14126
|
-
/** Atomic create-and-enroll for managed-mode vaults — see {@link TeamFacade.openVaultAndEnrollRecovery}. */
|
|
14127
|
-
async openVaultAndEnrollRecovery(vault, opts) {
|
|
14128
|
-
return this.team.openVaultAndEnrollRecovery(vault, opts);
|
|
14129
|
-
}
|
|
14130
|
-
/** Recovery flow under managed-passphrase mode — see {@link TeamFacade.recoverManagedPassphrase}. */
|
|
14131
|
-
async recoverManagedPassphrase(vault, options) {
|
|
14132
|
-
return this.team.recoverManagedPassphrase(vault, options);
|
|
14133
|
-
}
|
|
14134
|
-
/** Atomic peer-recovery of an existing user's keyring — see {@link TeamFacade.recoverUser}. */
|
|
14135
|
-
async recoverUser(vault, options, factors) {
|
|
14136
|
-
return this.team.recoverUser(vault, options, factors);
|
|
14137
|
-
}
|
|
14138
|
-
/** Persist a recovery enrollment (paper or Shamir) — see {@link TeamFacade.enrollRecovery}. */
|
|
14139
|
-
async enrollRecovery(vault, enrollment) {
|
|
14140
|
-
return this.team.enrollRecovery(vault, enrollment);
|
|
14141
|
-
}
|
|
14142
|
-
/** Read the persisted recovery entries (paper + Shamir) — see {@link TeamFacade.listRecoveryEntries}. */
|
|
14143
|
-
async listRecoveryEntries(vault) {
|
|
14144
|
-
return this.team.listRecoveryEntries(vault);
|
|
14145
|
-
}
|
|
14146
13839
|
// ─── Tier-3 enroll / unlock ─────────────────────────────────────
|
|
14147
|
-
/** Register a tier-3 quick-unlock state — see {@link TeamFacade.enrollUnlock}. */
|
|
14148
|
-
async enrollUnlock(vault, state, factors) {
|
|
14149
|
-
return this.team.enrollUnlock(vault, state, factors);
|
|
14150
|
-
}
|
|
14151
|
-
/** Resume a session via the registered tier-3 state — see {@link TeamFacade.unlockViaPin}. */
|
|
14152
|
-
async unlockViaPin(vault, resume) {
|
|
14153
|
-
return this.team.unlockViaPin(vault, resume);
|
|
14154
|
-
}
|
|
14155
|
-
/** Drop the tier-3 state for a vault — see {@link TeamFacade.clearQuickUnlock}. */
|
|
14156
|
-
clearQuickUnlock(vault) {
|
|
14157
|
-
this.team.clearQuickUnlock(vault);
|
|
14158
|
-
}
|
|
14159
|
-
/** Public defensive-copy accessor for the unlocked keyring — see {@link TeamFacade.getKeyring}. */
|
|
14160
|
-
async getKeyring(vault) {
|
|
14161
|
-
return this.team.getKeyring(vault);
|
|
14162
|
-
}
|
|
14163
13840
|
/**
|
|
14164
13841
|
* Live-reference variant used by the hub's own code paths. Internal
|
|
14165
13842
|
* mutations on `deks` (e.g. {@link ensureCollectionDEK} adding a
|
|
@@ -14180,7 +13857,7 @@ var Noydb = class {
|
|
|
14180
13857
|
}
|
|
14181
13858
|
await assertKeyringOpenAllowed(this.options.store, vault, this.options.user, opts.create);
|
|
14182
13859
|
let effectiveSecret;
|
|
14183
|
-
if (this.options.
|
|
13860
|
+
if (this.options.secretMode === "managed") {
|
|
14184
13861
|
effectiveSecret = await resolveManagedSecret(
|
|
14185
13862
|
this.options.store,
|
|
14186
13863
|
vault,
|
|
@@ -14190,7 +13867,7 @@ var Noydb = class {
|
|
|
14190
13867
|
effectiveSecret = this.options.secret;
|
|
14191
13868
|
}
|
|
14192
13869
|
if (!effectiveSecret) {
|
|
14193
|
-
throw new ValidationError("A secret (
|
|
13870
|
+
throw new ValidationError("A secret (secret) or getKeyring callback is required when encryption is enabled");
|
|
14194
13871
|
}
|
|
14195
13872
|
let keyring;
|
|
14196
13873
|
try {
|
|
@@ -14204,10 +13881,10 @@ var Noydb = class {
|
|
|
14204
13881
|
effectiveSecret,
|
|
14205
13882
|
{
|
|
14206
13883
|
// Managed mode generates 256-bit base64 strings that don't satisfy
|
|
14207
|
-
// the human-
|
|
13884
|
+
// the human-secret strength rules (no spaces, no "words").
|
|
14208
13885
|
// Skip validation in managed mode — the entropy floor is already
|
|
14209
13886
|
// 256 bits by construction.
|
|
14210
|
-
validate: this.options.
|
|
13887
|
+
validate: this.options.secretMode === "managed" ? false : this.options.validateSecret === true
|
|
14211
13888
|
}
|
|
14212
13889
|
);
|
|
14213
13890
|
} else if (err instanceof InvalidKeyError && this.options.onInvalidKey === "reset") {
|
|
@@ -14218,7 +13895,7 @@ var Noydb = class {
|
|
|
14218
13895
|
this.options.user,
|
|
14219
13896
|
effectiveSecret,
|
|
14220
13897
|
{
|
|
14221
|
-
validate: this.options.
|
|
13898
|
+
validate: this.options.secretMode === "managed" ? false : this.options.validateSecret === true
|
|
14222
13899
|
}
|
|
14223
13900
|
);
|
|
14224
13901
|
} else {
|
|
@@ -14256,34 +13933,34 @@ var Noydb = class {
|
|
|
14256
13933
|
async function createNoydb(options) {
|
|
14257
13934
|
if (!options.store) options = { ...options, store: memoryStore() };
|
|
14258
13935
|
const encrypted = options.encrypt !== false;
|
|
14259
|
-
const managed = options.
|
|
13936
|
+
const managed = options.secretMode === "managed";
|
|
14260
13937
|
if (options.secret && options.getKeyring) {
|
|
14261
13938
|
throw new ValidationError("Provide either `secret` or `getKeyring`, not both");
|
|
14262
13939
|
}
|
|
14263
13940
|
if (managed) {
|
|
14264
13941
|
if (options.secret) {
|
|
14265
13942
|
throw new ValidationError(
|
|
14266
|
-
'`
|
|
13943
|
+
'`secretMode: "managed"` is mutually exclusive with `secret` \u2014 managed mode generates the secret itself. Drop `secret`.'
|
|
14267
13944
|
);
|
|
14268
13945
|
}
|
|
14269
13946
|
if (options.getKeyring) {
|
|
14270
13947
|
throw new ValidationError(
|
|
14271
|
-
'`
|
|
13948
|
+
'`secretMode: "managed"` is mutually exclusive with `getKeyring` \u2014 a custom unlock callback would bypass the sealing flow. Drop `getKeyring`.'
|
|
14272
13949
|
);
|
|
14273
13950
|
}
|
|
14274
13951
|
if (!options.sealingKey) {
|
|
14275
13952
|
throw new ValidationError(
|
|
14276
|
-
'`
|
|
13953
|
+
'`secretMode: "managed"` requires `sealingKey: SealingKeyProvider` (see @noy-db/seal-macos-keychain / @noy-db/seal-aws-kms / etc.).'
|
|
14277
13954
|
);
|
|
14278
13955
|
}
|
|
14279
13956
|
}
|
|
14280
13957
|
if (encrypted && !managed && !options.secret && !options.getKeyring) {
|
|
14281
|
-
throw new ValidationError("A secret (
|
|
13958
|
+
throw new ValidationError("A secret (secret) or getKeyring callback is required when encryption is enabled");
|
|
14282
13959
|
}
|
|
14283
13960
|
if (!options.coordinationStrategy) options = { ...options, coordinationStrategy: await createDefaultCoordinationProvider(options.store) };
|
|
14284
|
-
if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-
|
|
13961
|
+
if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-22ES33N3.js")).createUserApi };
|
|
14285
13962
|
if (!options.policyFactory) {
|
|
14286
|
-
const policyModule = await import("./policy-
|
|
13963
|
+
const policyModule = await import("./policy-IY2YEA3A.js");
|
|
14287
13964
|
options = { ...options, policyFactory: policyModule.createNoydbPolicy, policyCheckGateFn: policyModule.checkGate };
|
|
14288
13965
|
}
|
|
14289
13966
|
return new Noydb(options);
|
|
@@ -14320,4 +13997,4 @@ export {
|
|
|
14320
13997
|
Noydb,
|
|
14321
13998
|
createNoydb
|
|
14322
13999
|
};
|
|
14323
|
-
//# sourceMappingURL=chunk-
|
|
14000
|
+
//# sourceMappingURL=chunk-EEZCB74X.js.map
|