@noy-db/hub 0.6.0-pre.2 → 0.6.0-pre.21
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/CHANGELOG.md +5234 -0
- package/codemods/0.4.0-pre.json +699 -0
- package/codemods/0.6.0-pre.json +211 -0
- package/dist/api-EYNT6KGS.js +20 -0
- package/dist/attestation/index.js +19 -19
- package/dist/{backup-YYBE5RPC.js → backup-FSC36VWC.js} +36 -18
- package/dist/backup-FSC36VWC.js.map +1 -0
- package/dist/blobs/index.js +13 -13
- package/dist/broker/index.js +12 -12
- package/dist/cargo/index.js +33 -33
- package/dist/{chunk-35EBKWQU.js → chunk-2LFOMUEA.js} +4 -4
- package/dist/{chunk-OF3L2SD6.js → chunk-32B7VCKU.js} +2 -2
- package/dist/{chunk-MSWYQLMQ.js → chunk-3B6S6RSI.js} +2 -2
- package/dist/{chunk-PJNTR2NV.js → chunk-3ENNPCIW.js} +7 -10
- package/dist/chunk-3ENNPCIW.js.map +1 -0
- package/dist/{chunk-7F4DBNSP.js → chunk-3O72ZD2E.js} +3 -3
- package/dist/{chunk-FNSMZQS4.js → chunk-3PMFMUFX.js} +2 -2
- package/dist/{chunk-WQDTCJ6W.js → chunk-45YHJ3GV.js} +11 -3
- package/dist/{chunk-WQDTCJ6W.js.map → chunk-45YHJ3GV.js.map} +1 -1
- package/dist/{chunk-NIVEDYJZ.js → chunk-4A34KWOU.js} +31 -49
- package/dist/chunk-4A34KWOU.js.map +1 -0
- package/dist/{chunk-ZJADGNYF.js → chunk-4AOERLTV.js} +1 -1
- package/dist/chunk-4AOERLTV.js.map +1 -0
- package/dist/{chunk-EDXAQ6JI.js → chunk-4N5Q23KV.js} +87 -34
- package/dist/chunk-4N5Q23KV.js.map +1 -0
- package/dist/{chunk-VV4NSB7P.js → chunk-4OQZNXQG.js} +15 -24
- package/dist/chunk-4OQZNXQG.js.map +1 -0
- package/dist/{chunk-FAXZQ5UF.js → chunk-4RAS6HN6.js} +2 -2
- package/dist/{chunk-C2OOEM57.js → chunk-4YL2LMXK.js} +92 -35
- package/dist/chunk-4YL2LMXK.js.map +1 -0
- package/dist/{chunk-EP7VPR7Y.js → chunk-5Q7AJ7DN.js} +11 -8
- package/dist/chunk-5Q7AJ7DN.js.map +1 -0
- package/dist/{chunk-VMCCGUQB.js → chunk-6JPGVL7X.js} +2 -2
- package/dist/{chunk-PRDRGL73.js → chunk-6KTVJ5ZZ.js} +17 -14
- package/dist/chunk-6KTVJ5ZZ.js.map +1 -0
- package/dist/{chunk-4MC5JRRX.js → chunk-6WO62AJW.js} +14 -15
- package/dist/chunk-6WO62AJW.js.map +1 -0
- package/dist/{chunk-WLYIROCJ.js → chunk-6YD5SYQS.js} +2 -2
- package/dist/{chunk-YAWK6AWF.js → chunk-7KAE7CQ2.js} +2 -2
- package/dist/{chunk-MWKDOHEF.js → chunk-7LNE2N2V.js} +17 -10
- package/dist/chunk-7LNE2N2V.js.map +1 -0
- package/dist/{chunk-5PR33AC4.js → chunk-7PJ3BKHS.js} +20 -17
- package/dist/chunk-7PJ3BKHS.js.map +1 -0
- package/dist/{chunk-JXIDGFKS.js → chunk-A4TOGAUW.js} +4 -2
- package/dist/chunk-A4TOGAUW.js.map +1 -0
- package/dist/{chunk-VCETL77O.js → chunk-AU3AUJIZ.js} +27 -7
- package/dist/chunk-AU3AUJIZ.js.map +1 -0
- package/dist/{chunk-NKH7GSIH.js → chunk-AUPSEJ7O.js} +4 -4
- package/dist/{chunk-CCZJJ4I2.js → chunk-B6IYATME.js} +4 -4
- package/dist/{chunk-WYZ5MYUA.js → chunk-BAHOV5I5.js} +44 -42
- package/dist/chunk-BAHOV5I5.js.map +1 -0
- package/dist/{chunk-G5APARUV.js → chunk-BEZDLIDG.js} +13 -15
- package/dist/chunk-BEZDLIDG.js.map +1 -0
- package/dist/{chunk-ERB6NDDW.js → chunk-CAGI4LLJ.js} +427 -72
- package/dist/chunk-CAGI4LLJ.js.map +1 -0
- package/dist/{chunk-4UVDI4XE.js → chunk-CLAHBPOI.js} +4 -4
- package/dist/{chunk-HNGSV2YC.js → chunk-CWM4GQD2.js} +39 -10
- package/dist/chunk-CWM4GQD2.js.map +1 -0
- package/dist/{chunk-HVQGCKY4.js → chunk-D3R7Q4QK.js} +2 -2
- package/dist/{chunk-I4F6PKUK.js → chunk-DIZ6HM7Q.js} +16 -17
- package/dist/chunk-DIZ6HM7Q.js.map +1 -0
- package/dist/{chunk-ZNACADFG.js → chunk-DVRZYAGT.js} +4 -4
- package/dist/chunk-DVRZYAGT.js.map +1 -0
- package/dist/{chunk-P7OG2ETF.js → chunk-DXKLLKME.js} +3 -3
- package/dist/{chunk-TDJPS3T2.js → chunk-E5SC6ENM.js} +24 -19
- package/dist/chunk-E5SC6ENM.js.map +1 -0
- package/dist/{chunk-26JMGSSC.js → chunk-EES37S2V.js} +4 -4
- package/dist/chunk-EES37S2V.js.map +1 -0
- package/dist/{chunk-JIUVJ4M7.js → chunk-EKEIEJL6.js} +2 -2
- package/dist/{chunk-GASWQ3XG.js → chunk-ESKIAXO2.js} +15 -16
- package/dist/chunk-ESKIAXO2.js.map +1 -0
- package/dist/{chunk-TOAIYQJR.js → chunk-FFSQFH6D.js} +7 -10
- package/dist/chunk-FFSQFH6D.js.map +1 -0
- package/dist/{chunk-DG27IUVI.js → chunk-FS7NTGCJ.js} +2 -2
- package/dist/{chunk-V5KYPBUR.js → chunk-FW7NGYLT.js} +11 -14
- package/dist/chunk-FW7NGYLT.js.map +1 -0
- package/dist/{chunk-52QYGZHH.js → chunk-GBBDFE6C.js} +2 -2
- package/dist/chunk-GBBDFE6C.js.map +1 -0
- package/dist/{chunk-HXGUIPQB.js → chunk-GQXFOAYZ.js} +3 -3
- package/dist/{chunk-BTVYJWSN.js → chunk-GTHVPVAR.js} +10 -10
- package/dist/{chunk-DMQCLZ4Z.js → chunk-GWO2IDAB.js} +2 -2
- package/dist/{chunk-6HFM7EIT.js → chunk-H3G4I3PN.js} +2 -2
- package/dist/chunk-HK67PX4J.js +27 -0
- package/dist/chunk-HK67PX4J.js.map +1 -0
- package/dist/{chunk-E7OBCBXS.js → chunk-HQSPF5IY.js} +22 -18
- package/dist/chunk-HQSPF5IY.js.map +1 -0
- package/dist/{chunk-VJFMXYKP.js → chunk-HR5R5JOM.js} +2 -2
- package/dist/{chunk-FDX7OWWI.js → chunk-HYYVT2KZ.js} +2 -2
- package/dist/{chunk-JRCYZEHU.js → chunk-I6QKB7MT.js} +2 -2
- package/dist/{chunk-MZ5ZFO2D.js → chunk-ICDHUUMQ.js} +84 -112
- package/dist/chunk-ICDHUUMQ.js.map +1 -0
- package/dist/{chunk-W5W6KHN2.js → chunk-IGNJOJEP.js} +1 -1
- package/dist/chunk-IGNJOJEP.js.map +1 -0
- package/dist/{chunk-KUDZVJKQ.js → chunk-IJ46VCWD.js} +2 -2
- package/dist/{chunk-4HDYQL3J.js → chunk-INMHEMXX.js} +2 -2
- package/dist/{chunk-66W5OOCX.js → chunk-JLYQQNY4.js} +52 -65
- package/dist/chunk-JLYQQNY4.js.map +1 -0
- package/dist/{chunk-UHXCLPGC.js → chunk-JNMTN5D5.js} +2 -2
- package/dist/chunk-JNMTN5D5.js.map +1 -0
- package/dist/{chunk-I4ZAO7F7.js → chunk-JWMBG5S3.js} +7 -11
- package/dist/chunk-JWMBG5S3.js.map +1 -0
- package/dist/chunk-KRVS7YWY.js +123 -0
- package/dist/chunk-KRVS7YWY.js.map +1 -0
- package/dist/{chunk-AR2JDFAE.js → chunk-KV6JM2IA.js} +2 -2
- package/dist/{chunk-PVU7LW5L.js → chunk-KX57HODD.js} +6 -6
- package/dist/{chunk-PY7CI6L5.js → chunk-LGFTOU27.js} +553 -275
- package/dist/chunk-LGFTOU27.js.map +1 -0
- package/dist/chunk-LN7P6MZB.js +190 -0
- package/dist/chunk-LN7P6MZB.js.map +1 -0
- package/dist/{chunk-UIBGXRDD.js → chunk-LX46B56Q.js} +25 -31
- package/dist/chunk-LX46B56Q.js.map +1 -0
- package/dist/{chunk-CEJWMBXO.js → chunk-LXECF2ZR.js} +2 -2
- package/dist/{chunk-7VHY5E3X.js → chunk-MSLPDFK2.js} +7 -7
- package/dist/{chunk-I6SDX7WX.js → chunk-MZTUTEHP.js} +16 -22
- package/dist/chunk-MZTUTEHP.js.map +1 -0
- package/dist/{chunk-VRA4Q7DA.js → chunk-NCCEDL2K.js} +55 -48
- package/dist/chunk-NCCEDL2K.js.map +1 -0
- package/dist/{chunk-HNHCQ556.js → chunk-NR2SUJ3H.js} +2 -2
- package/dist/{chunk-AHLJSVRL.js → chunk-NW4TY6VC.js} +5 -7
- package/dist/chunk-NW4TY6VC.js.map +1 -0
- package/dist/{chunk-RKKORO4M.js → chunk-O742QBZZ.js} +10 -10
- package/dist/chunk-O742QBZZ.js.map +1 -0
- package/dist/{chunk-VN45YLWM.js → chunk-OHOKBMTM.js} +343 -132
- package/dist/chunk-OHOKBMTM.js.map +1 -0
- package/dist/{chunk-W3TVWF6N.js → chunk-OIBEJN5H.js} +2 -2
- package/dist/{chunk-QD724WDJ.js → chunk-OMYCSTXL.js} +4 -4
- package/dist/{chunk-Z45YRGFO.js → chunk-ONVD6GBY.js} +2 -2
- package/dist/{chunk-TAGFGKHP.js → chunk-OTHHO3KI.js} +7 -10
- package/dist/chunk-OTHHO3KI.js.map +1 -0
- package/dist/{chunk-3737A6EA.js → chunk-P2MR5UNE.js} +75 -18
- package/dist/chunk-P2MR5UNE.js.map +1 -0
- package/dist/chunk-PENPHA45.js +66 -0
- package/dist/chunk-PENPHA45.js.map +1 -0
- package/dist/{chunk-3FSX6LDG.js → chunk-PPCOKVFA.js} +8 -3
- package/dist/{chunk-3FSX6LDG.js.map → chunk-PPCOKVFA.js.map} +1 -1
- package/dist/{chunk-VOQW5LAM.js → chunk-QSIEL6TL.js} +102 -71
- package/dist/chunk-QSIEL6TL.js.map +1 -0
- package/dist/chunk-RFO4UXKQ.js +201 -0
- package/dist/chunk-RFO4UXKQ.js.map +1 -0
- package/dist/{chunk-KCQX65FU.js → chunk-RKCRPPNB.js} +3 -3
- package/dist/{chunk-7TSYBD3E.js → chunk-RSXQNFGO.js} +2 -2
- package/dist/{chunk-SZ2K3MHL.js → chunk-S56VYR4Q.js} +8 -11
- package/dist/{chunk-SZ2K3MHL.js.map → chunk-S56VYR4Q.js.map} +1 -1
- package/dist/{chunk-7NXHMW6Y.js → chunk-SYS46BL7.js} +2 -2
- package/dist/{chunk-55LKVALY.js → chunk-T7IR4N2S.js} +1 -3
- package/dist/chunk-T7IR4N2S.js.map +1 -0
- package/dist/{chunk-A67356IR.js → chunk-T7JGWTES.js} +33 -8
- package/dist/chunk-T7JGWTES.js.map +1 -0
- package/dist/{chunk-WHJKIZS7.js → chunk-TDSN2O2V.js} +27 -149
- package/dist/chunk-TDSN2O2V.js.map +1 -0
- package/dist/{chunk-747LRSOO.js → chunk-TMBSPLUG.js} +2 -2
- package/dist/{chunk-LWSJG3LI.js → chunk-TQPASLY4.js} +7 -3
- package/dist/chunk-TQPASLY4.js.map +1 -0
- package/dist/{chunk-WKPJXWKR.js → chunk-TX5MKAHA.js} +3 -3
- package/dist/{chunk-HFQ6LGIO.js → chunk-U27Y4DJZ.js} +12 -10
- package/dist/{chunk-HFQ6LGIO.js.map → chunk-U27Y4DJZ.js.map} +1 -1
- package/dist/{chunk-E6427JU2.js → chunk-VVSOPRUE.js} +18 -2
- package/dist/chunk-VVSOPRUE.js.map +1 -0
- package/dist/{chunk-7G6VDWXB.js → chunk-WVE6YKMX.js} +3 -3
- package/dist/chunk-WVE6YKMX.js.map +1 -0
- package/dist/{chunk-GLKDWWNO.js → chunk-YALD3SST.js} +16 -14
- package/dist/chunk-YALD3SST.js.map +1 -0
- package/dist/{chunk-NJDQ4YSV.js → chunk-YKXZHUOW.js} +4 -4
- package/dist/{chunk-VW6ZZGCG.js → chunk-ZLHHE5XZ.js} +3 -3
- package/dist/{chunk-FUHKW252.js → chunk-ZZXLB6AS.js} +2 -2
- package/dist/classified/index.js +5 -5
- package/dist/{classified-marker-FTOX7Q5L.js → classified-marker-NA6HUV33.js} +3 -3
- package/dist/collection-facade-VBM35WAH.js +45 -0
- package/dist/{computed-6G5M3UPH.js → computed-GSTLWSY5.js} +3 -3
- package/dist/consent/index.js +10 -10
- package/dist/cover/index.js +10 -3
- package/dist/custody/index.js +11 -11
- package/dist/{dead-filter-ENRIOQIE.js → dead-filter-UALP5DJX.js} +2 -2
- package/dist/debug/index.js +1 -1
- package/dist/{delegation-SSEPLXXO.js → delegation-JLNXM7KH.js} +24 -23
- package/dist/delegation-JLNXM7KH.js.map +1 -0
- package/dist/derivations/index.js +12 -12
- package/dist/derive-YUO3TQYN.js +22 -0
- package/dist/directory/index.js +10 -10
- package/dist/{dispatch-RE74SH6L.js → dispatch-4ZHLSFZQ.js} +5 -5
- package/dist/{dispatch-BDVGYC6X.js → dispatch-77CB75KB.js} +18 -18
- package/dist/{enclave-52VUXNRL.js → enclave-O4NOROCJ.js} +27 -9
- package/dist/executor-CZDXBXKE.js +29 -0
- package/dist/executor-DVJAWN3B.js +9 -0
- package/dist/executor-VRLG4TQJ.js +9 -0
- package/dist/export-accessible-UXSMG7AB.js +23 -0
- package/dist/extract-partition-TVY7AMKH.js +38 -0
- package/dist/{fanout-sidecar-DTBIDOWF.js → fanout-sidecar-NLQ7QAYW.js} +18 -27
- package/dist/fanout-sidecar-NLQ7QAYW.js.map +1 -0
- package/dist/find-WSARMJBW.js +11 -0
- package/dist/forget/index.js +9 -9
- package/dist/guards/index.js +7 -7
- package/dist/history/index.js +23 -20
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.js +14 -14
- package/dist/index.d.ts +33 -15
- package/dist/index.js +187 -191
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +2 -2
- package/dist/introspection/index.js +11 -11
- package/dist/issue-3JNJNPT3.js +19 -0
- package/dist/kernel/constants.d.ts +18 -0
- package/dist/kernel/enclave/crypto.d.ts +24 -4
- package/dist/kernel/enclave/index.d.ts +9 -2
- package/dist/kernel/enclave/record-aad.d.ts +131 -0
- package/dist/kernel/enclave/record-envelope.d.ts +76 -0
- package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
- package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
- package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
- package/dist/kernel/enclave/record-keys/rekey-blob.d.ts +88 -0
- package/dist/kernel/enclave/record-keys/rekey.d.ts +68 -0
- package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -2
- package/dist/kernel/errors.d.ts +71 -12
- package/dist/kernel/merge-authority.d.ts +25 -0
- package/dist/kernel/noydb.d.ts +27 -4
- package/dist/kernel/query/builder.d.ts +15 -2
- package/dist/kernel/query/join.d.ts +27 -0
- package/dist/kernel/sync-policy.d.ts +0 -2
- package/dist/kernel/tier-visibility.d.ts +15 -0
- package/dist/kernel/types.d.ts +145 -12
- package/dist/kernel/vault.d.ts +22 -18
- package/dist/kernel/via/index.d.ts +11 -2
- package/dist/{ledger-4WJL66BW.js → ledger-MVPNG5OS.js} +11 -11
- package/dist/liberate-4LOJOLDT.js +24 -0
- package/dist/{link-set-N4ZPV6E6.js → link-set-3POMQR3I.js} +11 -11
- package/dist/{managed-secret-OTHS64IF.js → managed-secret-IARIJJ7Q.js} +11 -3
- package/dist/materialized-views/index.js +22 -21
- package/dist/migrate-cek-XM2ETTZW.js +19 -0
- package/dist/migrate-cek-XM2ETTZW.js.map +1 -0
- package/dist/money/index.js +12 -8
- package/dist/noydb-IRILUDED.js +84 -0
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +22 -12
- package/dist/pod/index.js +75 -86
- package/dist/pod-handle-MELERCKU.js +41 -0
- package/dist/pod-handle-MELERCKU.js.map +1 -0
- package/dist/policy/index.js +11 -4
- package/dist/port/to/index.d.ts +4 -4
- package/dist/port/to/locator.d.ts +54 -8
- package/dist/port/with/i18n-strategy.d.ts +4 -1
- package/dist/port/with/lookup-strategy.d.ts +4 -1
- package/dist/port/with/merge-authority.d.ts +52 -0
- package/dist/port/with/service-bus.d.ts +0 -4
- package/dist/port/with/strategies.d.ts +2 -0
- package/dist/port/with/team-strategy.d.ts +5 -1
- package/dist/portability/index.js +8 -8
- package/dist/{post-register-ZAG2CAIY.js → post-register-Z5T7FY45.js} +6 -6
- package/dist/query/index.js +3 -3
- package/dist/reduce/index.js +4 -4
- package/dist/register-UZ37QPDB.js +32 -0
- package/dist/registry-ETJNA7PO.js +9 -0
- package/dist/registry-F7U6KSLX.js +9 -0
- package/dist/registry-L4ELKX6C.js +18 -0
- package/dist/registry-SDT5LIGO.js +19 -0
- package/dist/request-withdrawal-PVFEYX57.js +31 -0
- package/dist/{reveal-CMOJY4VO.js → reveal-DQ2E3QAZ.js} +6 -6
- package/dist/revoke-YXY6SHUH.js +24 -0
- package/dist/satellites/index.js +1 -1
- package/dist/schema-update/index.js +2 -2
- package/dist/sealed-record/index.js +20 -13
- package/dist/sealed-record/index.js.map +1 -1
- package/dist/search/index.js +4 -4
- package/dist/{seed-UK4QRIUN.js → seed-DZ4ORU5N.js} +19 -22
- package/dist/seed-DZ4ORU5N.js.map +1 -0
- package/dist/sequence/index.js +9 -9
- package/dist/session/index.js +10 -10
- package/dist/shadow/index.js +2 -2
- package/dist/share-link/index.js +1 -1
- package/dist/signer-Q7XQBMPA.js +25 -0
- package/dist/snapshots/index.js +10 -10
- package/dist/snapshots/index.js.map +1 -1
- package/dist/{stale-ZWXSOWJI.js → stale-NI7SAXAZ.js} +10 -10
- package/dist/storage-3VNGSHXS.js +23 -0
- package/dist/{store-coordination-provider-PB6QZ57W.js → store-coordination-provider-TYKNR3OU.js} +18 -12
- package/dist/store-coordination-provider-TYKNR3OU.js.map +1 -0
- package/dist/sync/index.js +11 -11
- package/dist/team/index.js +15 -14
- package/dist/tiers/index.js +11 -10
- package/dist/to/index.js +17 -9
- package/dist/to/index.js.map +1 -1
- package/dist/transactions/index.js +4 -4
- package/dist/{ulid-PTAIMDG4.js → ulid-VQW6ERQN.js} +2 -2
- package/dist/util/index.js +1 -1
- package/dist/vault-head/index.js +115 -0
- package/dist/vault-head/index.js.map +1 -0
- package/dist/{verify-RO5RTZOJ.js → verify-6J2YLKSO.js} +5 -5
- package/dist/via/lookup/handle.d.ts +4 -1
- package/dist/via/money/exact.d.ts +44 -0
- package/dist/via/money/index.d.ts +2 -0
- package/dist/via/money/normalize.d.ts +20 -0
- package/dist/walk-WRA7RAPY.js +21 -0
- package/dist/with-audit/guards/immutable-guard.d.ts +14 -0
- package/dist/with-audit/periods/active.d.ts +28 -1
- package/dist/with-audit/periods/index.d.ts +4 -2
- package/dist/with-audit/periods/periods.d.ts +161 -6
- package/dist/with-audit/periods/strategy.d.ts +14 -5
- package/dist/with-audit/periods/vault-facade.d.ts +89 -10
- package/dist/with-audit/periods/window.d.ts +10 -0
- package/dist/with-audit/sealed-record/index.d.ts +13 -0
- package/dist/with-audit/tiers/index.d.ts +17 -2
- package/dist/with-cargo/adopt-partition.d.ts +1 -1
- package/dist/with-cargo/extract-partition.d.ts +1 -1
- package/dist/with-cargo/index.d.ts +2 -2
- package/dist/with-commit/history/history.d.ts +26 -0
- package/dist/with-commit/history/index.d.ts +2 -1
- package/dist/with-commit/history/ledger/store.d.ts +7 -1
- package/dist/with-commit/history/strategy.d.ts +11 -1
- package/dist/with-commit/numbering/index.d.ts +0 -5
- package/dist/with-commit/vault-head/active.d.ts +2 -0
- package/dist/with-commit/vault-head/head.d.ts +28 -0
- package/dist/with-commit/vault-head/index.d.ts +10 -0
- package/dist/with-commit/vault-head/strategy.d.ts +127 -0
- package/dist/with-commit/vault-head/verify.d.ts +90 -0
- package/dist/with-formula/materialized-views/types.d.ts +52 -0
- package/dist/with-party/directory/cover/storage.d.ts +0 -8
- package/dist/with-party/directory/storage.d.ts +0 -11
- package/dist/with-party/directory/visibility.d.ts +0 -21
- package/dist/with-party/policy/storage.d.ts +0 -10
- package/dist/with-party/team/index.d.ts +1 -1
- package/dist/with-party/team/keyring.d.ts +149 -3
- package/dist/with-party/team/noydb-facade.d.ts +5 -1
- package/dist/with-party/team/roster-tag.d.ts +101 -0
- package/dist/with-party/team/tiers.d.ts +2 -1
- package/dist/with-pod/format.d.ts +10 -12
- package/dist/with-pod/index.d.ts +10 -10
- package/dist/with-pod/open.d.ts +2 -2
- package/dist/with-pod/pod-handle.d.ts +19 -0
- package/dist/with-pod/pod-store.d.ts +0 -8
- package/dist/with-pod/{bundle.d.ts → pod.d.ts} +26 -19
- package/dist/with-pod/ulid.d.ts +1 -1
- package/dist/with-shape/blobs/blob-set.d.ts +2 -2
- package/dist/with-shape/introspection/index.d.ts +1 -0
- package/dist/with-sync/engine.d.ts +54 -5
- package/dist/with-sync/strategy.d.ts +3 -0
- package/dist/withdraw-accessible-4JTDFRFZ.js +28 -0
- package/package.json +13 -5
- package/dist/api-WVY3H3YH.js +0 -20
- package/dist/backup-YYBE5RPC.js.map +0 -1
- package/dist/bundle-handle-JEUWU2SJ.js +0 -36
- package/dist/bundle-handle-JEUWU2SJ.js.map +0 -1
- package/dist/chunk-26JMGSSC.js.map +0 -1
- package/dist/chunk-3737A6EA.js.map +0 -1
- package/dist/chunk-4MC5JRRX.js.map +0 -1
- package/dist/chunk-52QYGZHH.js.map +0 -1
- package/dist/chunk-55LKVALY.js.map +0 -1
- package/dist/chunk-5PR33AC4.js.map +0 -1
- package/dist/chunk-66W5OOCX.js.map +0 -1
- package/dist/chunk-7G6VDWXB.js.map +0 -1
- package/dist/chunk-A67356IR.js.map +0 -1
- package/dist/chunk-AFHQATY4.js +0 -47
- package/dist/chunk-AFHQATY4.js.map +0 -1
- package/dist/chunk-AHLJSVRL.js.map +0 -1
- package/dist/chunk-C2OOEM57.js.map +0 -1
- package/dist/chunk-DIMKRG2E.js +0 -131
- package/dist/chunk-DIMKRG2E.js.map +0 -1
- package/dist/chunk-E6427JU2.js.map +0 -1
- package/dist/chunk-E7OBCBXS.js.map +0 -1
- package/dist/chunk-EDXAQ6JI.js.map +0 -1
- package/dist/chunk-EP7VPR7Y.js.map +0 -1
- package/dist/chunk-ERB6NDDW.js.map +0 -1
- package/dist/chunk-G5APARUV.js.map +0 -1
- package/dist/chunk-GASWQ3XG.js.map +0 -1
- package/dist/chunk-GLKDWWNO.js.map +0 -1
- package/dist/chunk-HNGSV2YC.js.map +0 -1
- package/dist/chunk-I4F6PKUK.js.map +0 -1
- package/dist/chunk-I4ZAO7F7.js.map +0 -1
- package/dist/chunk-I6SDX7WX.js.map +0 -1
- package/dist/chunk-JXIDGFKS.js.map +0 -1
- package/dist/chunk-LWSJG3LI.js.map +0 -1
- package/dist/chunk-MWKDOHEF.js.map +0 -1
- package/dist/chunk-MZ5ZFO2D.js.map +0 -1
- package/dist/chunk-NIVEDYJZ.js.map +0 -1
- package/dist/chunk-NWCGDAV6.js +0 -45
- package/dist/chunk-NWCGDAV6.js.map +0 -1
- package/dist/chunk-PJNTR2NV.js.map +0 -1
- package/dist/chunk-PRDRGL73.js.map +0 -1
- package/dist/chunk-PY7CI6L5.js.map +0 -1
- package/dist/chunk-RKKORO4M.js.map +0 -1
- package/dist/chunk-TAGFGKHP.js.map +0 -1
- package/dist/chunk-TDJPS3T2.js.map +0 -1
- package/dist/chunk-TOAIYQJR.js.map +0 -1
- package/dist/chunk-UHXCLPGC.js.map +0 -1
- package/dist/chunk-UIBGXRDD.js.map +0 -1
- package/dist/chunk-V5KYPBUR.js.map +0 -1
- package/dist/chunk-VCETL77O.js.map +0 -1
- package/dist/chunk-VN45YLWM.js.map +0 -1
- package/dist/chunk-VOQW5LAM.js.map +0 -1
- package/dist/chunk-VRA4Q7DA.js.map +0 -1
- package/dist/chunk-VV4NSB7P.js.map +0 -1
- package/dist/chunk-W5W6KHN2.js.map +0 -1
- package/dist/chunk-WHJKIZS7.js.map +0 -1
- package/dist/chunk-WYZ5MYUA.js.map +0 -1
- package/dist/chunk-ZJADGNYF.js.map +0 -1
- package/dist/chunk-ZNACADFG.js.map +0 -1
- package/dist/collection-facade-QN5ULWYC.js +0 -45
- package/dist/delegation-SSEPLXXO.js.map +0 -1
- package/dist/derive-6V3PIZF7.js +0 -22
- package/dist/executor-CYJQLKKI.js +0 -9
- package/dist/executor-FHHLXO4Y.js +0 -28
- package/dist/executor-S4QIKEHW.js +0 -9
- package/dist/export-accessible-PE5AYKZR.js +0 -23
- package/dist/extract-partition-X2L26O6A.js +0 -38
- package/dist/fanout-sidecar-DTBIDOWF.js.map +0 -1
- package/dist/find-RBBYKXI7.js +0 -11
- package/dist/issue-RNU55YOF.js +0 -19
- package/dist/liberate-PX4CAT5V.js +0 -24
- package/dist/noydb-YPSEGK32.js +0 -83
- package/dist/register-TMD6YRCX.js +0 -32
- package/dist/registry-CZVINVQH.js +0 -9
- package/dist/registry-FVLDWQKT.js +0 -18
- package/dist/registry-IKUR2MXD.js +0 -9
- package/dist/registry-JET4HBLY.js +0 -19
- package/dist/request-withdrawal-RH55LNZL.js +0 -31
- package/dist/revoke-R5TBYVA6.js +0 -24
- package/dist/seed-UK4QRIUN.js.map +0 -1
- package/dist/signer-AGALOXOO.js +0 -25
- package/dist/storage-N7LB275C.js +0 -23
- package/dist/store-coordination-provider-PB6QZ57W.js.map +0 -1
- package/dist/walk-OCUHCYJ6.js +0 -21
- package/dist/with-pod/bundle-handle.d.ts +0 -9
- package/dist/withdraw-accessible-QQNWM5BO.js +0 -28
- /package/dist/{api-WVY3H3YH.js.map → api-EYNT6KGS.js.map} +0 -0
- /package/dist/{chunk-35EBKWQU.js.map → chunk-2LFOMUEA.js.map} +0 -0
- /package/dist/{chunk-OF3L2SD6.js.map → chunk-32B7VCKU.js.map} +0 -0
- /package/dist/{chunk-MSWYQLMQ.js.map → chunk-3B6S6RSI.js.map} +0 -0
- /package/dist/{chunk-7F4DBNSP.js.map → chunk-3O72ZD2E.js.map} +0 -0
- /package/dist/{chunk-FNSMZQS4.js.map → chunk-3PMFMUFX.js.map} +0 -0
- /package/dist/{chunk-FAXZQ5UF.js.map → chunk-4RAS6HN6.js.map} +0 -0
- /package/dist/{chunk-VMCCGUQB.js.map → chunk-6JPGVL7X.js.map} +0 -0
- /package/dist/{chunk-WLYIROCJ.js.map → chunk-6YD5SYQS.js.map} +0 -0
- /package/dist/{chunk-YAWK6AWF.js.map → chunk-7KAE7CQ2.js.map} +0 -0
- /package/dist/{chunk-NKH7GSIH.js.map → chunk-AUPSEJ7O.js.map} +0 -0
- /package/dist/{chunk-CCZJJ4I2.js.map → chunk-B6IYATME.js.map} +0 -0
- /package/dist/{chunk-4UVDI4XE.js.map → chunk-CLAHBPOI.js.map} +0 -0
- /package/dist/{chunk-HVQGCKY4.js.map → chunk-D3R7Q4QK.js.map} +0 -0
- /package/dist/{chunk-P7OG2ETF.js.map → chunk-DXKLLKME.js.map} +0 -0
- /package/dist/{chunk-JIUVJ4M7.js.map → chunk-EKEIEJL6.js.map} +0 -0
- /package/dist/{chunk-DG27IUVI.js.map → chunk-FS7NTGCJ.js.map} +0 -0
- /package/dist/{chunk-HXGUIPQB.js.map → chunk-GQXFOAYZ.js.map} +0 -0
- /package/dist/{chunk-BTVYJWSN.js.map → chunk-GTHVPVAR.js.map} +0 -0
- /package/dist/{chunk-DMQCLZ4Z.js.map → chunk-GWO2IDAB.js.map} +0 -0
- /package/dist/{chunk-6HFM7EIT.js.map → chunk-H3G4I3PN.js.map} +0 -0
- /package/dist/{chunk-VJFMXYKP.js.map → chunk-HR5R5JOM.js.map} +0 -0
- /package/dist/{chunk-FDX7OWWI.js.map → chunk-HYYVT2KZ.js.map} +0 -0
- /package/dist/{chunk-JRCYZEHU.js.map → chunk-I6QKB7MT.js.map} +0 -0
- /package/dist/{chunk-KUDZVJKQ.js.map → chunk-IJ46VCWD.js.map} +0 -0
- /package/dist/{chunk-4HDYQL3J.js.map → chunk-INMHEMXX.js.map} +0 -0
- /package/dist/{chunk-AR2JDFAE.js.map → chunk-KV6JM2IA.js.map} +0 -0
- /package/dist/{chunk-PVU7LW5L.js.map → chunk-KX57HODD.js.map} +0 -0
- /package/dist/{chunk-CEJWMBXO.js.map → chunk-LXECF2ZR.js.map} +0 -0
- /package/dist/{chunk-7VHY5E3X.js.map → chunk-MSLPDFK2.js.map} +0 -0
- /package/dist/{chunk-HNHCQ556.js.map → chunk-NR2SUJ3H.js.map} +0 -0
- /package/dist/{chunk-W3TVWF6N.js.map → chunk-OIBEJN5H.js.map} +0 -0
- /package/dist/{chunk-QD724WDJ.js.map → chunk-OMYCSTXL.js.map} +0 -0
- /package/dist/{chunk-Z45YRGFO.js.map → chunk-ONVD6GBY.js.map} +0 -0
- /package/dist/{chunk-KCQX65FU.js.map → chunk-RKCRPPNB.js.map} +0 -0
- /package/dist/{chunk-7TSYBD3E.js.map → chunk-RSXQNFGO.js.map} +0 -0
- /package/dist/{chunk-7NXHMW6Y.js.map → chunk-SYS46BL7.js.map} +0 -0
- /package/dist/{chunk-747LRSOO.js.map → chunk-TMBSPLUG.js.map} +0 -0
- /package/dist/{chunk-WKPJXWKR.js.map → chunk-TX5MKAHA.js.map} +0 -0
- /package/dist/{chunk-NJDQ4YSV.js.map → chunk-YKXZHUOW.js.map} +0 -0
- /package/dist/{chunk-VW6ZZGCG.js.map → chunk-ZLHHE5XZ.js.map} +0 -0
- /package/dist/{chunk-FUHKW252.js.map → chunk-ZZXLB6AS.js.map} +0 -0
- /package/dist/{classified-marker-FTOX7Q5L.js.map → classified-marker-NA6HUV33.js.map} +0 -0
- /package/dist/{collection-facade-QN5ULWYC.js.map → collection-facade-VBM35WAH.js.map} +0 -0
- /package/dist/{computed-6G5M3UPH.js.map → computed-GSTLWSY5.js.map} +0 -0
- /package/dist/{dead-filter-ENRIOQIE.js.map → dead-filter-UALP5DJX.js.map} +0 -0
- /package/dist/{derive-6V3PIZF7.js.map → derive-YUO3TQYN.js.map} +0 -0
- /package/dist/{dispatch-RE74SH6L.js.map → dispatch-4ZHLSFZQ.js.map} +0 -0
- /package/dist/{dispatch-BDVGYC6X.js.map → dispatch-77CB75KB.js.map} +0 -0
- /package/dist/{enclave-52VUXNRL.js.map → enclave-O4NOROCJ.js.map} +0 -0
- /package/dist/{executor-CYJQLKKI.js.map → executor-CZDXBXKE.js.map} +0 -0
- /package/dist/{executor-FHHLXO4Y.js.map → executor-DVJAWN3B.js.map} +0 -0
- /package/dist/{executor-S4QIKEHW.js.map → executor-VRLG4TQJ.js.map} +0 -0
- /package/dist/{export-accessible-PE5AYKZR.js.map → export-accessible-UXSMG7AB.js.map} +0 -0
- /package/dist/{extract-partition-X2L26O6A.js.map → extract-partition-TVY7AMKH.js.map} +0 -0
- /package/dist/{find-RBBYKXI7.js.map → find-WSARMJBW.js.map} +0 -0
- /package/dist/{issue-RNU55YOF.js.map → issue-3JNJNPT3.js.map} +0 -0
- /package/dist/{ledger-4WJL66BW.js.map → ledger-MVPNG5OS.js.map} +0 -0
- /package/dist/{liberate-PX4CAT5V.js.map → liberate-4LOJOLDT.js.map} +0 -0
- /package/dist/{link-set-N4ZPV6E6.js.map → link-set-3POMQR3I.js.map} +0 -0
- /package/dist/{managed-secret-OTHS64IF.js.map → managed-secret-IARIJJ7Q.js.map} +0 -0
- /package/dist/{noydb-YPSEGK32.js.map → noydb-IRILUDED.js.map} +0 -0
- /package/dist/{post-register-ZAG2CAIY.js.map → post-register-Z5T7FY45.js.map} +0 -0
- /package/dist/{register-TMD6YRCX.js.map → register-UZ37QPDB.js.map} +0 -0
- /package/dist/{registry-CZVINVQH.js.map → registry-ETJNA7PO.js.map} +0 -0
- /package/dist/{registry-FVLDWQKT.js.map → registry-F7U6KSLX.js.map} +0 -0
- /package/dist/{registry-IKUR2MXD.js.map → registry-L4ELKX6C.js.map} +0 -0
- /package/dist/{registry-JET4HBLY.js.map → registry-SDT5LIGO.js.map} +0 -0
- /package/dist/{request-withdrawal-RH55LNZL.js.map → request-withdrawal-PVFEYX57.js.map} +0 -0
- /package/dist/{reveal-CMOJY4VO.js.map → reveal-DQ2E3QAZ.js.map} +0 -0
- /package/dist/{revoke-R5TBYVA6.js.map → revoke-YXY6SHUH.js.map} +0 -0
- /package/dist/{signer-AGALOXOO.js.map → signer-Q7XQBMPA.js.map} +0 -0
- /package/dist/{stale-ZWXSOWJI.js.map → stale-NI7SAXAZ.js.map} +0 -0
- /package/dist/{storage-N7LB275C.js.map → storage-3VNGSHXS.js.map} +0 -0
- /package/dist/{ulid-PTAIMDG4.js.map → ulid-VQW6ERQN.js.map} +0 -0
- /package/dist/{verify-RO5RTZOJ.js.map → verify-6J2YLKSO.js.map} +0 -0
- /package/dist/{walk-OCUHCYJ6.js.map → walk-WRA7RAPY.js.map} +0 -0
- /package/dist/{withdraw-accessible-QQNWM5BO.js.map → withdraw-accessible-4JTDFRFZ.js.map} +0 -0
|
@@ -1,75 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LinkIntegrityError,
|
|
3
|
+
declareLink,
|
|
4
|
+
isLinkCollectionName,
|
|
5
|
+
linkCollectionName,
|
|
6
|
+
linkRowKey
|
|
7
|
+
} from "./chunk-NR2SUJ3H.js";
|
|
1
8
|
import {
|
|
2
9
|
hashFields,
|
|
3
10
|
validateSatelliteDeclaration
|
|
4
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-D3R7Q4QK.js";
|
|
5
12
|
import {
|
|
6
13
|
resolveStaleOnRead
|
|
7
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-INMHEMXX.js";
|
|
8
15
|
import {
|
|
9
16
|
isManifestReservedCollection
|
|
10
17
|
} from "./chunk-EPFF7LOX.js";
|
|
11
18
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "./chunk-HNHCQ556.js";
|
|
19
|
+
VectorSet,
|
|
20
|
+
buildPersistedIndexCallbacks,
|
|
21
|
+
encodeVecId,
|
|
22
|
+
syncTierSearch
|
|
23
|
+
} from "./chunk-O742QBZZ.js";
|
|
18
24
|
import {
|
|
19
25
|
isBaseLive,
|
|
20
26
|
liveBaseIdSet
|
|
21
27
|
} from "./chunk-GYGLAVCX.js";
|
|
22
28
|
import {
|
|
23
29
|
loadFence
|
|
24
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-FFSQFH6D.js";
|
|
25
31
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
fallbackDerivationName,
|
|
33
|
+
jsonSchemaToFields
|
|
34
|
+
} from "./chunk-KHKKD62N.js";
|
|
35
|
+
import {
|
|
36
|
+
derivePersistedSchema,
|
|
37
|
+
isZod4Schema
|
|
38
|
+
} from "./chunk-ONVD6GBY.js";
|
|
31
39
|
import {
|
|
32
40
|
SchemaUpdateGate
|
|
33
41
|
} from "./chunk-6LJY7X5A.js";
|
|
42
|
+
import {
|
|
43
|
+
NO_ATTESTATION
|
|
44
|
+
} from "./chunk-HR5R5JOM.js";
|
|
34
45
|
import {
|
|
35
46
|
NO_CLASSIFIED,
|
|
36
47
|
guardClassifiedCompat,
|
|
37
48
|
resolveClassifiedFields
|
|
38
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-OMYCSTXL.js";
|
|
39
50
|
import {
|
|
40
51
|
NO_TIERS,
|
|
41
52
|
classifySealedShred,
|
|
42
53
|
syncDerivedOutputs
|
|
43
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-4YL2LMXK.js";
|
|
44
55
|
import {
|
|
45
56
|
NO_PORTABILITY
|
|
46
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-ZZXLB6AS.js";
|
|
47
58
|
import {
|
|
48
59
|
NO_CARGO,
|
|
49
60
|
runDrainBarrier
|
|
50
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-FS7NTGCJ.js";
|
|
51
62
|
import {
|
|
52
63
|
saveSealedSecret
|
|
53
|
-
} from "./chunk-
|
|
54
|
-
import {
|
|
55
|
-
fallbackDerivationName,
|
|
56
|
-
jsonSchemaToFields
|
|
57
|
-
} from "./chunk-KHKKD62N.js";
|
|
58
|
-
import {
|
|
59
|
-
derivePersistedSchema,
|
|
60
|
-
isZod4Schema
|
|
61
|
-
} from "./chunk-Z45YRGFO.js";
|
|
64
|
+
} from "./chunk-OTHHO3KI.js";
|
|
62
65
|
import {
|
|
63
66
|
loadPersistedSchema
|
|
64
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-6WO62AJW.js";
|
|
68
|
+
import {
|
|
69
|
+
NO_SEQUENCE,
|
|
70
|
+
SEQUENCE_COLLECTION,
|
|
71
|
+
compileSequenceFormat,
|
|
72
|
+
resolveSequenceKey
|
|
73
|
+
} from "./chunk-YALD3SST.js";
|
|
65
74
|
import {
|
|
66
75
|
CustodyApi,
|
|
67
76
|
NO_CUSTODY
|
|
68
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-AUPSEJ7O.js";
|
|
69
78
|
import {
|
|
70
79
|
DEFAULT_POSTURE,
|
|
71
80
|
ViaGraph
|
|
72
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-RSXQNFGO.js";
|
|
73
82
|
import {
|
|
74
83
|
buildLookupAltIndex,
|
|
75
84
|
buildLookupSnapshotRows,
|
|
@@ -93,31 +102,33 @@ import {
|
|
|
93
102
|
selfWriteFieldEqual,
|
|
94
103
|
touchFor,
|
|
95
104
|
updateReferencingRecords
|
|
96
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-DVRZYAGT.js";
|
|
97
106
|
import {
|
|
98
107
|
OverlayedCollection
|
|
99
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-32B7VCKU.js";
|
|
100
109
|
import {
|
|
101
110
|
INDEXED_STORE_POLICY,
|
|
102
111
|
NO_SYNC
|
|
103
|
-
} from "./chunk-
|
|
104
|
-
import {
|
|
105
|
-
NO_ATTESTATION
|
|
106
|
-
} from "./chunk-VJFMXYKP.js";
|
|
112
|
+
} from "./chunk-T7IR4N2S.js";
|
|
107
113
|
import {
|
|
108
114
|
NO_CONSENT
|
|
109
115
|
} from "./chunk-PEOZ34EM.js";
|
|
110
116
|
import {
|
|
111
117
|
NO_PERIODS,
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
isEffectivelyReopened,
|
|
119
|
+
purgeMarkersOn,
|
|
120
|
+
resolvePeriodKey,
|
|
121
|
+
resolveReopenState,
|
|
122
|
+
samePartition
|
|
123
|
+
} from "./chunk-RFO4UXKQ.js";
|
|
114
124
|
import {
|
|
115
125
|
PERIODS_COLLECTION,
|
|
116
126
|
PERIOD_ARCHIVES_COLLECTION,
|
|
117
127
|
PERIOD_FREEZES_COLLECTION,
|
|
128
|
+
PERIOD_REOPENS_COLLECTION,
|
|
118
129
|
PERIOD_TARGET_PURGES_COLLECTION,
|
|
119
130
|
periodExclusiveUpperBound
|
|
120
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-A4TOGAUW.js";
|
|
121
132
|
import {
|
|
122
133
|
NO_SHADOW
|
|
123
134
|
} from "./chunk-SMY5X46Z.js";
|
|
@@ -127,7 +138,7 @@ import {
|
|
|
127
138
|
import {
|
|
128
139
|
TxContext,
|
|
129
140
|
bestEffortRevert
|
|
130
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-2LFOMUEA.js";
|
|
131
142
|
import {
|
|
132
143
|
lazy
|
|
133
144
|
} from "./chunk-5D2ALSM5.js";
|
|
@@ -135,29 +146,26 @@ import {
|
|
|
135
146
|
InvertedIndex,
|
|
136
147
|
MemoryIndexStore,
|
|
137
148
|
NO_SEARCH
|
|
138
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-GTHVPVAR.js";
|
|
139
150
|
import {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
compileSequenceFormat,
|
|
143
|
-
resolveSequenceKey
|
|
144
|
-
} from "./chunk-GLKDWWNO.js";
|
|
151
|
+
NO_SEALED_RECORD
|
|
152
|
+
} from "./chunk-4RAS6HN6.js";
|
|
145
153
|
import {
|
|
146
154
|
Query,
|
|
147
155
|
ScanBuilder
|
|
148
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-P2MR5UNE.js";
|
|
149
157
|
import {
|
|
150
158
|
EXPORT_AUDIT_COLLECTION,
|
|
151
159
|
NO_BLOBS,
|
|
152
160
|
createExportBlobsHandle,
|
|
153
161
|
runCompaction
|
|
154
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-4OQZNXQG.js";
|
|
155
163
|
import {
|
|
156
164
|
LazyQuery,
|
|
157
165
|
NO_INDEXING,
|
|
158
166
|
decodeIdxId,
|
|
159
167
|
encodeIdxId
|
|
160
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-EKEIEJL6.js";
|
|
161
169
|
import {
|
|
162
170
|
normalizeIndexDefs
|
|
163
171
|
} from "./chunk-GQ3BX5EA.js";
|
|
@@ -180,7 +188,7 @@ import {
|
|
|
180
188
|
} from "./chunk-PVEWA2DU.js";
|
|
181
189
|
import {
|
|
182
190
|
dictCollectionName
|
|
183
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-6KTVJ5ZZ.js";
|
|
184
192
|
import {
|
|
185
193
|
NO_I18N,
|
|
186
194
|
getAtPath,
|
|
@@ -188,11 +196,11 @@ import {
|
|
|
188
196
|
isDictKeyDescriptor,
|
|
189
197
|
isI18nTextDescriptor,
|
|
190
198
|
isStaticDictDescriptor
|
|
191
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-WVE6YKMX.js";
|
|
192
200
|
import {
|
|
193
201
|
isViaInstalled,
|
|
194
202
|
viaBinder
|
|
195
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-JNMTN5D5.js";
|
|
196
204
|
import {
|
|
197
205
|
NO_TEAM,
|
|
198
206
|
describeAllUsersAuth,
|
|
@@ -215,7 +223,7 @@ import {
|
|
|
215
223
|
saveShamirRecoveryEntries,
|
|
216
224
|
updateAuthenticator,
|
|
217
225
|
writeMagicLinkGrant
|
|
218
|
-
} from "./chunk-
|
|
226
|
+
} from "./chunk-NCCEDL2K.js";
|
|
219
227
|
import {
|
|
220
228
|
assertKeyringOpenAllowed,
|
|
221
229
|
buildRecipientKeyringFile,
|
|
@@ -230,32 +238,36 @@ import {
|
|
|
230
238
|
listUsers,
|
|
231
239
|
loadKeyring,
|
|
232
240
|
updateKeyringIdentity
|
|
233
|
-
} from "./chunk-
|
|
241
|
+
} from "./chunk-CAGI4LLJ.js";
|
|
234
242
|
import {
|
|
235
243
|
persistDirectoryConfig,
|
|
236
244
|
readDirectoryConfig
|
|
237
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-LX46B56Q.js";
|
|
238
246
|
import {
|
|
239
247
|
NO_BROKER,
|
|
240
248
|
buildCredentialBrokerHandle
|
|
241
|
-
} from "./chunk-
|
|
249
|
+
} from "./chunk-OIBEJN5H.js";
|
|
242
250
|
import {
|
|
243
251
|
NO_SESSION
|
|
244
252
|
} from "./chunk-VKQCVU2Z.js";
|
|
245
253
|
import {
|
|
246
254
|
generateULID
|
|
247
|
-
} from "./chunk-
|
|
255
|
+
} from "./chunk-4AOERLTV.js";
|
|
248
256
|
import {
|
|
249
257
|
NO_HISTORY
|
|
250
|
-
} from "./chunk-
|
|
258
|
+
} from "./chunk-LN7P6MZB.js";
|
|
259
|
+
import {
|
|
260
|
+
sha256Hex
|
|
261
|
+
} from "./chunk-ZLHHE5XZ.js";
|
|
251
262
|
import {
|
|
252
263
|
assertCutoverTierSafe,
|
|
253
264
|
assertTierWritable,
|
|
265
|
+
dekKey,
|
|
254
266
|
liveRecordIsElevated
|
|
255
|
-
} from "./chunk-
|
|
267
|
+
} from "./chunk-PPCOKVFA.js";
|
|
256
268
|
import {
|
|
257
|
-
|
|
258
|
-
} from "./chunk-
|
|
269
|
+
NO_VAULT_HEAD
|
|
270
|
+
} from "./chunk-HK67PX4J.js";
|
|
259
271
|
import {
|
|
260
272
|
NO_FORGET,
|
|
261
273
|
addSubjectRef,
|
|
@@ -264,34 +276,36 @@ import {
|
|
|
264
276
|
readDottedPath,
|
|
265
277
|
rebuildSubjectIndex,
|
|
266
278
|
removeSubjectRef
|
|
267
|
-
} from "./chunk-
|
|
268
|
-
import {
|
|
269
|
-
NO_SEALED_RECORD
|
|
270
|
-
} from "./chunk-FAXZQ5UF.js";
|
|
279
|
+
} from "./chunk-U27Y4DJZ.js";
|
|
271
280
|
import {
|
|
272
281
|
RecordCodec,
|
|
273
282
|
SEALED_CEK_NS,
|
|
283
|
+
applyRewrappedBody,
|
|
284
|
+
buildRecordAad,
|
|
274
285
|
findByDet,
|
|
275
286
|
hasPerRecordKey,
|
|
287
|
+
hasSealedBody,
|
|
276
288
|
makeReservedEnvelopes,
|
|
277
289
|
openEnvelopeJson,
|
|
278
290
|
queryByDet,
|
|
279
291
|
resolveStableCek,
|
|
280
|
-
|
|
281
|
-
|
|
292
|
+
rewrapBodyToDek,
|
|
293
|
+
validateSchemaInput,
|
|
294
|
+
verifyRecordIdentity
|
|
295
|
+
} from "./chunk-OHOKBMTM.js";
|
|
282
296
|
import {
|
|
283
297
|
buildDeleteMarker,
|
|
298
|
+
buildRecordEnvelope,
|
|
284
299
|
buildTombstone,
|
|
285
300
|
isDeleteMarker,
|
|
286
301
|
isTombstone
|
|
287
|
-
} from "./chunk-
|
|
302
|
+
} from "./chunk-PENPHA45.js";
|
|
288
303
|
import {
|
|
289
304
|
encrypt
|
|
290
|
-
} from "./chunk-
|
|
305
|
+
} from "./chunk-AU3AUJIZ.js";
|
|
291
306
|
import {
|
|
292
|
-
NOYDB_FORMAT_VERSION,
|
|
293
307
|
SealedHandle
|
|
294
|
-
} from "./chunk-
|
|
308
|
+
} from "./chunk-IGNJOJEP.js";
|
|
295
309
|
import {
|
|
296
310
|
AlreadyElevatedError,
|
|
297
311
|
AttestationError,
|
|
@@ -334,7 +348,36 @@ import {
|
|
|
334
348
|
UnsupportedTierCompositionError,
|
|
335
349
|
ValidationError,
|
|
336
350
|
isConflictError
|
|
337
|
-
} from "./chunk-
|
|
351
|
+
} from "./chunk-CWM4GQD2.js";
|
|
352
|
+
|
|
353
|
+
// src/kernel/merge-authority.ts
|
|
354
|
+
function buildMergeAuthority(keyring) {
|
|
355
|
+
return {
|
|
356
|
+
verify: async (collection, id, envelope) => {
|
|
357
|
+
const dek = keyring.deks.get(dekKey(collection, envelope._tier ?? 0));
|
|
358
|
+
if (dek === void 0) return true;
|
|
359
|
+
return verifyRecordIdentity({ collection, id }, envelope, dek);
|
|
360
|
+
},
|
|
361
|
+
advance: async (collection, id, envelope, toVersion) => {
|
|
362
|
+
if (!hasSealedBody(envelope)) return { ...envelope, _v: toVersion };
|
|
363
|
+
const dek = keyring.deks.get(dekKey(collection, envelope._tier ?? 0));
|
|
364
|
+
if (dek === void 0) {
|
|
365
|
+
throw new ValidationError(
|
|
366
|
+
`sync: cannot advance "${collection}/${id}" past the remote \u2014 no key for it, so its body cannot be re-sealed at the new version. The local copy is unchanged.`
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
const from = {
|
|
370
|
+
collection,
|
|
371
|
+
id,
|
|
372
|
+
version: envelope._v,
|
|
373
|
+
...envelope._tier !== void 0 ? { tier: envelope._tier } : {},
|
|
374
|
+
...envelope._by !== void 0 ? { by: envelope._by } : {}
|
|
375
|
+
};
|
|
376
|
+
const body = await rewrapBodyToDek(from, { ...from, version: toVersion }, envelope, dek, dek);
|
|
377
|
+
return { ...applyRewrappedBody(envelope, body), _v: toVersion };
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
}
|
|
338
381
|
|
|
339
382
|
// src/with-commit/tx/strategy.ts
|
|
340
383
|
var NOT_ENABLED = new Error(
|
|
@@ -371,6 +414,7 @@ var STRATEGY_DEFAULTS = {
|
|
|
371
414
|
custody: NO_CUSTODY,
|
|
372
415
|
forget: NO_FORGET,
|
|
373
416
|
history: NO_HISTORY,
|
|
417
|
+
vaultHead: NO_VAULT_HEAD,
|
|
374
418
|
i18n: NO_I18N,
|
|
375
419
|
indexing: NO_INDEXING,
|
|
376
420
|
lazy: IMPLICIT_LAZY,
|
|
@@ -464,7 +508,7 @@ function validateSecretModeOptions(options) {
|
|
|
464
508
|
}
|
|
465
509
|
async function resolveEffectiveSecret(options, store, vault) {
|
|
466
510
|
if (options.secretMode === "managed") {
|
|
467
|
-
const { resolveManagedSecret } = await import("./managed-secret-
|
|
511
|
+
const { resolveManagedSecret } = await import("./managed-secret-IARIJJ7Q.js");
|
|
468
512
|
return resolveManagedSecret(store, vault, options.sealingKey);
|
|
469
513
|
}
|
|
470
514
|
return options.secret;
|
|
@@ -482,7 +526,7 @@ function ownerKeyringOptions(options, secret) {
|
|
|
482
526
|
|
|
483
527
|
// src/port/by/default-provider.ts
|
|
484
528
|
async function createDefaultCoordinationProvider(store) {
|
|
485
|
-
const { StoreCoordinationProvider } = await import("./store-coordination-provider-
|
|
529
|
+
const { StoreCoordinationProvider } = await import("./store-coordination-provider-TYKNR3OU.js");
|
|
486
530
|
return new StoreCoordinationProvider(store);
|
|
487
531
|
}
|
|
488
532
|
|
|
@@ -937,13 +981,13 @@ async function applyCutoverTransform(ctx) {
|
|
|
937
981
|
for (const id of ids) {
|
|
938
982
|
const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
939
983
|
if (!env || isTombstone(env, ctx.storeCiphertext) || isDeleteMarker(env)) continue;
|
|
940
|
-
const decoded = await ctx.codec.decryptRecord(env, { skipValidation: true
|
|
984
|
+
const decoded = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env, { skipValidation: true });
|
|
941
985
|
if (decoded === null) continue;
|
|
942
986
|
const record = decoded;
|
|
943
987
|
const next = ctx.transform(record);
|
|
944
988
|
const nextVersion = (env._v ?? 0) + 1;
|
|
945
989
|
const cek = ctx.perRecordCek ? await ctx.resolveRecordCek(id) : void 0;
|
|
946
|
-
const migEnvelope = await ctx.codec.encryptRecord(next, nextVersion, cek, void 0, void 0, ctx.vdigFields !== null ? { id, prev: env } : void 0
|
|
990
|
+
const migEnvelope = await ctx.codec.encryptRecord({ collection: ctx.name, id }, next, nextVersion, cek, void 0, void 0, ctx.vdigFields !== null ? { id, prev: env } : void 0);
|
|
947
991
|
await ctx.adapter.put(ctx.vault, ctx.name, id, migEnvelope);
|
|
948
992
|
await ctx.onRecordMutated(id, "put", "cutover");
|
|
949
993
|
if (ctx.ledger) {
|
|
@@ -1049,7 +1093,7 @@ async function rebuildIndexes(ctx) {
|
|
|
1049
1093
|
const envelope = await ctx.adapter.get(ctx.vault, ctx.name, recordId);
|
|
1050
1094
|
if (!envelope) continue;
|
|
1051
1095
|
if ((envelope._tier ?? 0) > 0) continue;
|
|
1052
|
-
const record = await ctx.codec.decryptRecord(
|
|
1096
|
+
const record = await ctx.codec.decryptRecord({ collection: ctx.name, id: recordId }, envelope, { skipValidation: true });
|
|
1053
1097
|
if (record === null) continue;
|
|
1054
1098
|
await maintainPersistedIndexesOnPut(ctx, recordId, record, null, envelope._v);
|
|
1055
1099
|
}
|
|
@@ -1083,7 +1127,7 @@ async function reconcileIndex(ctx, field, opts = {}) {
|
|
|
1083
1127
|
const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
1084
1128
|
if (!env) continue;
|
|
1085
1129
|
try {
|
|
1086
|
-
const sidecarJson = await ctx.codec.decryptJsonString(env);
|
|
1130
|
+
const sidecarJson = await ctx.codec.decryptJsonString({ collection: ctx.name, id }, env);
|
|
1087
1131
|
if (sidecarJson === null) {
|
|
1088
1132
|
sidecar.set(decoded.recordId, void 0);
|
|
1089
1133
|
} else {
|
|
@@ -1103,7 +1147,7 @@ async function reconcileIndex(ctx, field, opts = {}) {
|
|
|
1103
1147
|
const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
1104
1148
|
if (!env) continue;
|
|
1105
1149
|
if ((env._tier ?? 0) > 0) continue;
|
|
1106
|
-
const record = await ctx.codec.decryptRecord(env, { skipValidation: true
|
|
1150
|
+
const record = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env, { skipValidation: true });
|
|
1107
1151
|
if (record === null) continue;
|
|
1108
1152
|
const live = readPersistedValue(record, field);
|
|
1109
1153
|
const stored = sidecar.get(id);
|
|
@@ -1164,7 +1208,7 @@ async function maintainPersistedIndexesOnPut(ctx, id, newRecord, previousRecord,
|
|
|
1164
1208
|
recordId: id,
|
|
1165
1209
|
writtenAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1166
1210
|
});
|
|
1167
|
-
const envelope = await ctx.codec.encryptJsonString(body, version);
|
|
1211
|
+
const envelope = await ctx.codec.encryptJsonString({ collection: ctx.name, id: idxId }, body, version);
|
|
1168
1212
|
await ctx.adapter.put(ctx.vault, ctx.name, idxId, envelope);
|
|
1169
1213
|
}
|
|
1170
1214
|
} catch (cause) {
|
|
@@ -1233,7 +1277,7 @@ async function resolveTierSyncPrior(ctx, id, priorEnvelope) {
|
|
|
1233
1277
|
const cached = ctx.cache.get(id)?.record;
|
|
1234
1278
|
if (cached !== void 0) return cached;
|
|
1235
1279
|
if (!ctx.lazy || !priorEnvelope || (priorEnvelope._tier ?? 0) > 0) return null;
|
|
1236
|
-
return await ctx.codec.decryptRecord(priorEnvelope, { skipValidation: true
|
|
1280
|
+
return await ctx.codec.decryptRecord({ collection: ctx.name, id }, priorEnvelope, { skipValidation: true });
|
|
1237
1281
|
}
|
|
1238
1282
|
|
|
1239
1283
|
// src/with-lookup/search/serialize.ts
|
|
@@ -2416,7 +2460,7 @@ function resolveCollectionConfig(opts) {
|
|
|
2416
2460
|
}
|
|
2417
2461
|
|
|
2418
2462
|
// src/with-formula/computed/lazy.ts
|
|
2419
|
-
var loadComputed = lazy(() => import("./computed-
|
|
2463
|
+
var loadComputed = lazy(() => import("./computed-GSTLWSY5.js"));
|
|
2420
2464
|
async function loadEvalComputedFields() {
|
|
2421
2465
|
return (await loadComputed()).evalComputedFields;
|
|
2422
2466
|
}
|
|
@@ -2872,14 +2916,14 @@ var Collection = class {
|
|
|
2872
2916
|
if (crdtMode === "yjs") {
|
|
2873
2917
|
return local._v >= remote._v ? local : remote;
|
|
2874
2918
|
}
|
|
2875
|
-
const localJson = await this.codec.decryptJsonString(
|
|
2876
|
-
const remoteJson = await this.codec.decryptJsonString(
|
|
2919
|
+
const localJson = await this.codec.decryptJsonString({ collection: this.name, id }, local);
|
|
2920
|
+
const remoteJson = await this.codec.decryptJsonString({ collection: this.name, id }, remote);
|
|
2877
2921
|
if (localJson === null) return local;
|
|
2878
2922
|
if (remoteJson === null) return remote;
|
|
2879
2923
|
const merged = this.strategies.crdt.mergeCrdtStates(JSON.parse(localJson), JSON.parse(remoteJson));
|
|
2880
2924
|
const mergedVersion = Math.max(local._v, remote._v) + 1;
|
|
2881
2925
|
const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
2882
|
-
return this.codec.encryptJsonString(JSON.stringify(merged), mergedVersion, cek);
|
|
2926
|
+
return this.codec.encryptJsonString({ collection: this.name, id }, JSON.stringify(merged), mergedVersion, cek);
|
|
2883
2927
|
};
|
|
2884
2928
|
opts.onRegisterConflictResolver(this.name, crdtResolver);
|
|
2885
2929
|
}
|
|
@@ -2920,14 +2964,14 @@ var Collection = class {
|
|
|
2920
2964
|
} else {
|
|
2921
2965
|
const mergeFn = policy;
|
|
2922
2966
|
resolver = async (id, local, remote) => {
|
|
2923
|
-
const localRecord = await this.codec.decryptRecord(local, { skipValidation: true
|
|
2924
|
-
const remoteRecord = await this.codec.decryptRecord(remote, { skipValidation: true
|
|
2967
|
+
const localRecord = await this.codec.decryptRecord({ collection: this.name, id }, local, { skipValidation: true });
|
|
2968
|
+
const remoteRecord = await this.codec.decryptRecord({ collection: this.name, id }, remote, { skipValidation: true });
|
|
2925
2969
|
if (localRecord === null) return local;
|
|
2926
2970
|
if (remoteRecord === null) return remote;
|
|
2927
2971
|
const merged = mergeFn(localRecord, remoteRecord);
|
|
2928
2972
|
const mergedVersion = Math.max(local._v, remote._v) + 1;
|
|
2929
2973
|
const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
2930
|
-
return this.codec.encryptRecord(
|
|
2974
|
+
return this.codec.encryptRecord({ collection: this.name, id }, merged, mergedVersion, cek);
|
|
2931
2975
|
};
|
|
2932
2976
|
}
|
|
2933
2977
|
opts.onRegisterConflictResolver(collectionName, resolver);
|
|
@@ -3198,7 +3242,7 @@ var Collection = class {
|
|
|
3198
3242
|
}
|
|
3199
3243
|
await this.onAccess?.("find", "*");
|
|
3200
3244
|
if (hits.length === 0) return [];
|
|
3201
|
-
const { verifyDigestField } = await import("./verify-
|
|
3245
|
+
const { verifyDigestField } = await import("./verify-6J2YLKSO.js");
|
|
3202
3246
|
const policy = {
|
|
3203
3247
|
normalize: spec.verifyNormalize ?? "password",
|
|
3204
3248
|
notLastN: spec.notLastN ?? 0,
|
|
@@ -3404,7 +3448,7 @@ var Collection = class {
|
|
|
3404
3448
|
}
|
|
3405
3449
|
}
|
|
3406
3450
|
if (this.materializedViewSource !== void 0) {
|
|
3407
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
3451
|
+
const { resolveStaleMVOnRead } = await import("./stale-NI7SAXAZ.js");
|
|
3408
3452
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
|
|
3409
3453
|
}
|
|
3410
3454
|
let record;
|
|
@@ -3416,7 +3460,7 @@ var Collection = class {
|
|
|
3416
3460
|
const envelope = await this.adapter.get(this.vault, this.name, id);
|
|
3417
3461
|
if (!envelope) return null;
|
|
3418
3462
|
if (isTombstone(envelope, this.storeCiphertext) || isDeleteMarker(envelope) || (envelope._tier ?? 0) > 0) return null;
|
|
3419
|
-
record = await this.codec.decryptRecord(envelope, {
|
|
3463
|
+
record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
|
|
3420
3464
|
if (record === null) return null;
|
|
3421
3465
|
this.lru.set(id, { record, version: envelope._v }, estimateRecordBytes(record));
|
|
3422
3466
|
}
|
|
@@ -3443,7 +3487,7 @@ var Collection = class {
|
|
|
3443
3487
|
}
|
|
3444
3488
|
const envelope = await this.adapter.get(this.vault, this.name, id);
|
|
3445
3489
|
if (!envelope || (envelope._tier ?? 0) > 0) return null;
|
|
3446
|
-
const json = await this.codec.decryptJsonString(envelope);
|
|
3490
|
+
const json = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
|
|
3447
3491
|
if (json === null) return null;
|
|
3448
3492
|
return JSON.parse(json);
|
|
3449
3493
|
}
|
|
@@ -3560,7 +3604,7 @@ var Collection = class {
|
|
|
3560
3604
|
if (cached) return cached.record;
|
|
3561
3605
|
const env = await this.adapter.get(this.vault, this.name, id);
|
|
3562
3606
|
if (!env || (env._tier ?? 0) > 0) return void 0;
|
|
3563
|
-
const rec = await this.codec.decryptRecord(
|
|
3607
|
+
const rec = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
|
|
3564
3608
|
return rec === null ? void 0 : rec;
|
|
3565
3609
|
}
|
|
3566
3610
|
await this.ensureHydrated();
|
|
@@ -3608,7 +3652,7 @@ var Collection = class {
|
|
|
3608
3652
|
if (cached2) return { record: cached2.record, version: cached2.version };
|
|
3609
3653
|
const env = await this.adapter.get(this.vault, this.name, id);
|
|
3610
3654
|
if (!env || (env._tier ?? 0) > 0) return { record: null, version: 0 };
|
|
3611
|
-
return { record: await this.codec.decryptRecord(env, { skipValidation: true
|
|
3655
|
+
return { record: await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true }) ?? null, version: env._v };
|
|
3612
3656
|
}
|
|
3613
3657
|
await this.ensureHydrated();
|
|
3614
3658
|
const cached = this.cache.get(id);
|
|
@@ -3630,7 +3674,7 @@ var Collection = class {
|
|
|
3630
3674
|
if (this.sensitiveFields.size > 0 || this.via?.hasAtRestHooks === true) {
|
|
3631
3675
|
const env = await this.adapter.get(this.vault, this.name, id);
|
|
3632
3676
|
if (!env || isTombstone(env, this.storeCiphertext) || (env._tier ?? 0) > 0) return void 0;
|
|
3633
|
-
const rec = await this.codec.decryptRecord(env, { skipValidation: true
|
|
3677
|
+
const rec = await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true });
|
|
3634
3678
|
return rec === null ? void 0 : { record: rec, version: env._v };
|
|
3635
3679
|
}
|
|
3636
3680
|
const cached = this.cache.get(id);
|
|
@@ -3642,7 +3686,7 @@ var Collection = class {
|
|
|
3642
3686
|
const env = await this.adapter.get(this.vault, this.name, id);
|
|
3643
3687
|
if (!env) return { env: null, record: null, elided: false };
|
|
3644
3688
|
if ((env._tier ?? 0) > 0) return { env, record: null, elided: false };
|
|
3645
|
-
return { env, record: await this.codec.decryptRecord(env, { skipValidation: true
|
|
3689
|
+
return { env, record: await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true }), elided: false };
|
|
3646
3690
|
}
|
|
3647
3691
|
/**
|
|
3648
3692
|
* Wraps {@link RecordCodec.toCacheRecord} with an additional strip for
|
|
@@ -3666,9 +3710,9 @@ var Collection = class {
|
|
|
3666
3710
|
* payload that is not a CRDT state. The `lww-map` and `rga` branches each
|
|
3667
3711
|
* carried a copy, byte-identical apart from the cast (#842).
|
|
3668
3712
|
*/
|
|
3669
|
-
async #decodePriorCrdtState(envelope) {
|
|
3713
|
+
async #decodePriorCrdtState(id, envelope) {
|
|
3670
3714
|
if (!envelope) return void 0;
|
|
3671
|
-
const prevJson = await this.codec.decryptJsonString(envelope);
|
|
3715
|
+
const prevJson = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
|
|
3672
3716
|
if (prevJson === null) return void 0;
|
|
3673
3717
|
const prevParsed = JSON.parse(prevJson);
|
|
3674
3718
|
if (prevParsed === null || typeof prevParsed !== "object" || !("_crdt" in prevParsed)) {
|
|
@@ -3705,7 +3749,8 @@ var Collection = class {
|
|
|
3705
3749
|
this.vault,
|
|
3706
3750
|
this.name,
|
|
3707
3751
|
id,
|
|
3708
|
-
await this.codec.encryptRecord(prior.record, prior.version, cek, void 0, void 0, vdigCtx
|
|
3752
|
+
await this.codec.encryptRecord(this.strategies.history.historyIdentity(this.name, id, prior.version), prior.record, prior.version, cek, void 0, void 0, vdigCtx)
|
|
3753
|
+
// sealed against its _history STORAGE identity (#1041)
|
|
3709
3754
|
);
|
|
3710
3755
|
this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: prior.version });
|
|
3711
3756
|
if (this.historyConfig.maxVersions) {
|
|
@@ -3815,20 +3860,20 @@ var Collection = class {
|
|
|
3815
3860
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3816
3861
|
let crdtState;
|
|
3817
3862
|
if (this.crdtMode === "lww-map") {
|
|
3818
|
-
const existingState = await this.#decodePriorCrdtState(existingEnvelope);
|
|
3863
|
+
const existingState = await this.#decodePriorCrdtState(id, existingEnvelope);
|
|
3819
3864
|
crdtState = this.strategies.crdt.buildLwwMapState(record, existingState, now);
|
|
3820
3865
|
} else if (this.crdtMode === "rga") {
|
|
3821
|
-
const existingState = await this.#decodePriorCrdtState(existingEnvelope);
|
|
3866
|
+
const existingState = await this.#decodePriorCrdtState(id, existingEnvelope);
|
|
3822
3867
|
crdtState = this.strategies.crdt.buildRgaState(Array.isArray(record) ? record : [record], existingState, generateULID);
|
|
3823
3868
|
} else {
|
|
3824
3869
|
crdtState = { _crdt: "yjs", update: record };
|
|
3825
3870
|
}
|
|
3826
3871
|
const version = existingVersion + 1;
|
|
3827
3872
|
const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
3828
|
-
const envelope = await this.codec.encryptJsonString(JSON.stringify(crdtState), version, cek, options?.source, options?.sourceTs);
|
|
3873
|
+
const envelope = await this.codec.encryptJsonString({ collection: this.name, id }, JSON.stringify(crdtState), version, cek, options?.source, options?.sourceTs);
|
|
3829
3874
|
await this.adapter.put(this.vault, this.name, id, envelope);
|
|
3830
3875
|
const resolvedRecord = this.strategies.crdt.resolveCrdtSnapshot(crdtState);
|
|
3831
|
-
const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord(existingEnvelope, { skipValidation: true }) : null;
|
|
3876
|
+
const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord({ collection: this.name, id }, existingEnvelope, { skipValidation: true }) : null;
|
|
3832
3877
|
const existingResolved = existingResolvedRecord !== null ? { record: existingResolvedRecord, version: existingVersion } : void 0;
|
|
3833
3878
|
if (existingResolved) {
|
|
3834
3879
|
await this.#savePriorHistory(id, existingResolved, cek, this.vdigFields !== null ? { id, prev: existingEnvelope } : void 0);
|
|
@@ -3868,7 +3913,7 @@ var Collection = class {
|
|
|
3868
3913
|
if (!existing) {
|
|
3869
3914
|
priorRaw = await this.adapter.get(this.vault, this.name, id);
|
|
3870
3915
|
if (priorRaw) {
|
|
3871
|
-
const previousRecord = await this.codec.decryptRecord(
|
|
3916
|
+
const previousRecord = await this.codec.decryptRecord({ collection: this.name, id }, priorRaw, {});
|
|
3872
3917
|
if (previousRecord !== null) {
|
|
3873
3918
|
existing = { record: previousRecord, version: priorRaw._v };
|
|
3874
3919
|
}
|
|
@@ -3888,7 +3933,7 @@ var Collection = class {
|
|
|
3888
3933
|
this.uniqueConstraints?.check(id, record);
|
|
3889
3934
|
const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
3890
3935
|
const vdigCtx = this.vdigFields !== null ? { id, prev: await this.adapter.get(this.vault, this.name, id) } : void 0;
|
|
3891
|
-
const envelope = await this.codec.encryptRecord(record, version, cek, options?.source, options?.sourceTs, vdigCtx
|
|
3936
|
+
const envelope = await this.codec.encryptRecord({ collection: this.name, id }, record, version, cek, options?.source, options?.sourceTs, vdigCtx);
|
|
3892
3937
|
return { id, envelope, version, indexed: record, event: record, prior: existing, cek, vdigCtx, reason: options?.reason };
|
|
3893
3938
|
}
|
|
3894
3939
|
/**
|
|
@@ -3934,7 +3979,7 @@ var Collection = class {
|
|
|
3934
3979
|
*/
|
|
3935
3980
|
async dispatchMaterializedViews(id, record, wave) {
|
|
3936
3981
|
if (this.materializedViewSource === void 0) return;
|
|
3937
|
-
const { dispatchMaterializedViews } = await import("./dispatch-
|
|
3982
|
+
const { dispatchMaterializedViews } = await import("./dispatch-4ZHLSFZQ.js");
|
|
3938
3983
|
return dispatchMaterializedViews(this.#mvDispatchCtx(this.materializedViewSource), id, record, wave);
|
|
3939
3984
|
}
|
|
3940
3985
|
/**
|
|
@@ -3962,7 +4007,7 @@ var Collection = class {
|
|
|
3962
4007
|
const cached = this.lru.get(id);
|
|
3963
4008
|
const env = await this.adapter.get(this.vault, this.name, id);
|
|
3964
4009
|
if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
|
|
3965
|
-
raw = await this.codec.decryptRecord(
|
|
4010
|
+
raw = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
|
|
3966
4011
|
if (raw === null) return null;
|
|
3967
4012
|
if (!cached) {
|
|
3968
4013
|
this.lru.set(id, { record: await this.codec.toCacheRecord(raw, env, id), version: env._v }, estimateRecordBytes(raw));
|
|
@@ -3973,7 +4018,7 @@ var Collection = class {
|
|
|
3973
4018
|
else {
|
|
3974
4019
|
const env = await this.adapter.get(this.vault, this.name, id);
|
|
3975
4020
|
if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
|
|
3976
|
-
raw = await this.codec.decryptRecord(
|
|
4021
|
+
raw = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
|
|
3977
4022
|
if (raw === null) return null;
|
|
3978
4023
|
this.lru.set(id, { record: raw, version: env._v }, estimateRecordBytes(raw));
|
|
3979
4024
|
}
|
|
@@ -3990,7 +4035,7 @@ var Collection = class {
|
|
|
3990
4035
|
async _getStoredRecordForDispatch(id) {
|
|
3991
4036
|
const env = await this.adapter.get(this.vault, this.name, id);
|
|
3992
4037
|
if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
|
|
3993
|
-
const record = await this.codec.decryptRecord(
|
|
4038
|
+
const record = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
|
|
3994
4039
|
return record === null ? null : { record, version: env._v };
|
|
3995
4040
|
}
|
|
3996
4041
|
/**
|
|
@@ -4107,7 +4152,7 @@ var Collection = class {
|
|
|
4107
4152
|
* dispatch wave's per-target dedup; `undefined` on the local-write path (byte-identical). */
|
|
4108
4153
|
async dispatchDerivations(id, record, version, wave) {
|
|
4109
4154
|
if (this.derivationSource === void 0) return;
|
|
4110
|
-
const { dispatchDerivations } = await import("./dispatch-
|
|
4155
|
+
const { dispatchDerivations } = await import("./dispatch-77CB75KB.js");
|
|
4111
4156
|
return dispatchDerivations({
|
|
4112
4157
|
...this.#derivationDeleteCtx(this.derivationSource),
|
|
4113
4158
|
via: this.via,
|
|
@@ -4290,7 +4335,7 @@ var Collection = class {
|
|
|
4290
4335
|
if (!existing && this.historyConfig.enabled !== false) {
|
|
4291
4336
|
const previousEnvelope2 = await this.adapter.get(this.vault, this.name, id);
|
|
4292
4337
|
if (previousEnvelope2) {
|
|
4293
|
-
const previousRecord = await this.codec.decryptRecord(
|
|
4338
|
+
const previousRecord = await this.codec.decryptRecord({ collection: this.name, id }, previousEnvelope2, {});
|
|
4294
4339
|
if (previousRecord !== null) {
|
|
4295
4340
|
existing = { record: previousRecord, version: previousEnvelope2._v };
|
|
4296
4341
|
}
|
|
@@ -4305,7 +4350,7 @@ var Collection = class {
|
|
|
4305
4350
|
if (this.onDirty) {
|
|
4306
4351
|
const live = previousEnvelope;
|
|
4307
4352
|
if (!live || isTombstone(live, this.storeCiphertext) || isDeleteMarker(live)) return null;
|
|
4308
|
-
marker = buildDeleteMarker(live._v + 1, this.keyring.userId);
|
|
4353
|
+
marker = buildDeleteMarker({ collection: this.name, id }, live._v + 1, this.keyring.userId);
|
|
4309
4354
|
}
|
|
4310
4355
|
const snapshots = existing !== void 0 && this.historyConfig.enabled !== false;
|
|
4311
4356
|
const cek = snapshots && this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
@@ -4327,7 +4372,7 @@ var Collection = class {
|
|
|
4327
4372
|
async _commitDelete(prepared, persist = true) {
|
|
4328
4373
|
const { id, internal, existing, previousPayloadHash, marker, cek, vdigCtx } = prepared;
|
|
4329
4374
|
if (existing && this.historyConfig.enabled !== false) {
|
|
4330
|
-
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
|
|
4375
|
+
await this.strategies.history.saveHistory(this.adapter, this.vault, this.name, id, await this.codec.encryptRecord(this.strategies.history.historyIdentity(this.name, id, existing.version), existing.record, existing.version, cek, void 0, void 0, vdigCtx));
|
|
4331
4376
|
}
|
|
4332
4377
|
if (marker) {
|
|
4333
4378
|
if (persist) await this.adapter.put(this.vault, this.name, id, marker);
|
|
@@ -4394,7 +4439,7 @@ var Collection = class {
|
|
|
4394
4439
|
*/
|
|
4395
4440
|
async _decodeEnvelope(envelope, id) {
|
|
4396
4441
|
try {
|
|
4397
|
-
const rec = await this.codec.decryptRecord(envelope, { skipValidation: true
|
|
4442
|
+
const rec = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { skipValidation: true });
|
|
4398
4443
|
return rec === null ? null : rec;
|
|
4399
4444
|
} catch {
|
|
4400
4445
|
return null;
|
|
@@ -4403,7 +4448,7 @@ var Collection = class {
|
|
|
4403
4448
|
async _writeTombstone(id, actor) {
|
|
4404
4449
|
const live = await this.adapter.get(this.vault, this.name, id);
|
|
4405
4450
|
if (!live || isTombstone(live, this.storeCiphertext) || isDeleteMarker(live)) return null;
|
|
4406
|
-
await this.adapter.put(this.vault, this.name, id, buildTombstone(live._v, actor));
|
|
4451
|
+
await this.adapter.put(this.vault, this.name, id, buildTombstone({ collection: this.name, id }, live._v, actor));
|
|
4407
4452
|
this.cache.delete(id);
|
|
4408
4453
|
this.lru?.remove(id);
|
|
4409
4454
|
this.cekCache?.remove(id);
|
|
@@ -4422,7 +4467,7 @@ var Collection = class {
|
|
|
4422
4467
|
*/
|
|
4423
4468
|
async dispatchArrayDerivationsOnDelete(id, eraseRecordShapeToo = false) {
|
|
4424
4469
|
if (this.derivationSource === void 0) return 0;
|
|
4425
|
-
const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-
|
|
4470
|
+
const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-77CB75KB.js");
|
|
4426
4471
|
return dispatchArrayDerivationsOnDelete(this.#derivationDeleteCtx(this.derivationSource), id, eraseRecordShapeToo);
|
|
4427
4472
|
}
|
|
4428
4473
|
/**
|
|
@@ -4436,7 +4481,7 @@ var Collection = class {
|
|
|
4436
4481
|
*/
|
|
4437
4482
|
async dispatchMaterializedViewsOnDelete(id) {
|
|
4438
4483
|
if (this.materializedViewSource === void 0) return { deleted: 0, residueUndecodable: [], residueDeclined: [] };
|
|
4439
|
-
const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-
|
|
4484
|
+
const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-4ZHLSFZQ.js");
|
|
4440
4485
|
return dispatchMaterializedViewsOnDelete(this.#mvDispatchCtx(this.materializedViewSource), id);
|
|
4441
4486
|
}
|
|
4442
4487
|
/**
|
|
@@ -4456,7 +4501,7 @@ var Collection = class {
|
|
|
4456
4501
|
);
|
|
4457
4502
|
}
|
|
4458
4503
|
if (this.materializedViewSource !== void 0) {
|
|
4459
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
4504
|
+
const { resolveStaleMVOnRead } = await import("./stale-NI7SAXAZ.js");
|
|
4460
4505
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
|
|
4461
4506
|
}
|
|
4462
4507
|
await this.ensureHydrated();
|
|
@@ -4790,7 +4835,7 @@ var Collection = class {
|
|
|
4790
4835
|
const entries = [];
|
|
4791
4836
|
for (const env of envelopes) {
|
|
4792
4837
|
if ((env._tier ?? 0) > 0) continue;
|
|
4793
|
-
const record = await this.codec.decryptRecord(env, { skipValidation: true
|
|
4838
|
+
const record = await this.codec.decryptRecord(this.strategies.history.historyIdentity(this.name, id, env._v), env, { skipValidation: true });
|
|
4794
4839
|
if (record === null) continue;
|
|
4795
4840
|
entries.push({
|
|
4796
4841
|
version: env._v,
|
|
@@ -4819,7 +4864,7 @@ var Collection = class {
|
|
|
4819
4864
|
version
|
|
4820
4865
|
);
|
|
4821
4866
|
if (!envelope || (envelope._tier ?? 0) > 0 || await liveRecordIsElevated(this.adapter, this.vault, this.name, id)) return null;
|
|
4822
|
-
return this.codec.decryptRecord(envelope, { skipValidation: true
|
|
4867
|
+
return this.codec.decryptRecord(this.strategies.history.historyIdentity(this.name, id, envelope._v), envelope, { skipValidation: true });
|
|
4823
4868
|
}
|
|
4824
4869
|
/** Revert a record to a past version. Creates a new version with the old content. */
|
|
4825
4870
|
async revert(id, version) {
|
|
@@ -4925,7 +4970,7 @@ var Collection = class {
|
|
|
4925
4970
|
const id = ids[i];
|
|
4926
4971
|
const envelope = await this.adapter.get(this.vault, this.name, id);
|
|
4927
4972
|
if (envelope && (envelope._tier ?? 0) === 0) {
|
|
4928
|
-
const record = await this.codec.decryptRecord(envelope, {
|
|
4973
|
+
const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
|
|
4929
4974
|
if (record === null) continue;
|
|
4930
4975
|
items.push(record);
|
|
4931
4976
|
if (!this.lazy && !this.cache.has(id)) {
|
|
@@ -5007,7 +5052,7 @@ var Collection = class {
|
|
|
5007
5052
|
const out = [];
|
|
5008
5053
|
for (const { id, envelope } of items) {
|
|
5009
5054
|
if ((envelope._tier ?? 0) > 0) continue;
|
|
5010
|
-
const record = await this.codec.decryptRecord(envelope, {
|
|
5055
|
+
const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
|
|
5011
5056
|
if (record === null) continue;
|
|
5012
5057
|
out.push({ id, record, version: envelope._v });
|
|
5013
5058
|
}
|
|
@@ -5068,7 +5113,7 @@ var Collection = class {
|
|
|
5068
5113
|
}
|
|
5069
5114
|
return;
|
|
5070
5115
|
}
|
|
5071
|
-
const record = await this.codec.decryptRecord(envelope, {
|
|
5116
|
+
const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
|
|
5072
5117
|
if (record === null) {
|
|
5073
5118
|
this.cache.delete(id);
|
|
5074
5119
|
if (previous) {
|
|
@@ -5164,7 +5209,7 @@ var Collection = class {
|
|
|
5164
5209
|
for (const id of ids) {
|
|
5165
5210
|
const envelope = await this.adapter.get(this.vault, this.name, id);
|
|
5166
5211
|
if (envelope && !isTombstone(envelope, this.storeCiphertext) && !isDeleteMarker(envelope) && (envelope._tier ?? 0) === 0) {
|
|
5167
|
-
const record = await this.codec.decryptRecord(envelope, {
|
|
5212
|
+
const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
|
|
5168
5213
|
if (record === null) continue;
|
|
5169
5214
|
this.cache.set(id, { record, version: envelope._v });
|
|
5170
5215
|
} else if (envelope && isDeleteMarker(envelope)) {
|
|
@@ -5183,7 +5228,7 @@ var Collection = class {
|
|
|
5183
5228
|
continue;
|
|
5184
5229
|
}
|
|
5185
5230
|
if (isTombstone(envelope, this.storeCiphertext) || (envelope._tier ?? 0) > 0) continue;
|
|
5186
|
-
const record = await this.codec.decryptRecord(envelope, {
|
|
5231
|
+
const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
|
|
5187
5232
|
if (record === null) continue;
|
|
5188
5233
|
this.cache.set(id, { record, version: envelope._v });
|
|
5189
5234
|
}
|
|
@@ -5317,7 +5362,7 @@ var Collection = class {
|
|
|
5317
5362
|
for (const [id, entry] of this.cache) {
|
|
5318
5363
|
const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
|
|
5319
5364
|
const prevForVdig = this.vdigFields !== null ? await this.adapter.get(this.vault, this.name, id) : null;
|
|
5320
|
-
result[id] = await this.codec.encryptRecord(entry.record, entry.version, cek, void 0, void 0, this.vdigFields !== null ? { id, prev: prevForVdig } : void 0
|
|
5365
|
+
result[id] = await this.codec.encryptRecord({ collection: this.name, id }, entry.record, entry.version, cek, void 0, void 0, this.vdigFields !== null ? { id, prev: prevForVdig } : void 0);
|
|
5321
5366
|
}
|
|
5322
5367
|
return result;
|
|
5323
5368
|
}
|
|
@@ -5432,7 +5477,7 @@ var Collection = class {
|
|
|
5432
5477
|
const envelope = await this.adapter.get(this.vault, this.name, id);
|
|
5433
5478
|
if (!envelope) continue;
|
|
5434
5479
|
try {
|
|
5435
|
-
const json = await this.codec.decryptJsonString(envelope);
|
|
5480
|
+
const json = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
|
|
5436
5481
|
if (json === null) continue;
|
|
5437
5482
|
const body = JSON.parse(json);
|
|
5438
5483
|
if (typeof body.recordId !== "string") continue;
|
|
@@ -5566,14 +5611,14 @@ var Collection = class {
|
|
|
5566
5611
|
/** C-A/R10: persist the classified marker once per classified handle (store I/O in config-drift.ts). */
|
|
5567
5612
|
async _ensureClassifiedMarker() {
|
|
5568
5613
|
if (this._markerPersisted || this.vdigFields === null) return;
|
|
5569
|
-
const { persistClassifiedMarkerForFields } = await import("./classified-marker-
|
|
5614
|
+
const { persistClassifiedMarkerForFields } = await import("./classified-marker-NA6HUV33.js");
|
|
5570
5615
|
await persistClassifiedMarkerForFields(this.adapter, this.vault, this.name, this.vdigFields, await this.getDEK(this.name));
|
|
5571
5616
|
this._markerPersisted = true;
|
|
5572
5617
|
}
|
|
5573
5618
|
/** C-A/R10 drift signal — the marker's declared digest-only set, memoized to one store read per handle (see config-drift.ts). */
|
|
5574
5619
|
async _classifiedMarkerDigestOnly() {
|
|
5575
5620
|
if (this._markerDigestOnlyCache !== void 0) return this._markerDigestOnlyCache;
|
|
5576
|
-
const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-
|
|
5621
|
+
const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-NA6HUV33.js");
|
|
5577
5622
|
this._markerDigestOnlyCache = await readClassifiedMarkerDigestOnly(this.adapter, this.vault, this.name, await this.getDEK(this.name));
|
|
5578
5623
|
return this._markerDigestOnlyCache;
|
|
5579
5624
|
}
|
|
@@ -5725,8 +5770,9 @@ var Collection = class {
|
|
|
5725
5770
|
syncIndexes: (id, rec, version, priorEnvelope) => syncTierIndexes(this.indexingContext(), id, rec, version, priorEnvelope),
|
|
5726
5771
|
syncSearch: (id, rec, version) => syncTierSearch(this.searchContext(), id, rec, version),
|
|
5727
5772
|
syncHistory: async (id, fromDek, toDek) => this.strategies.history.rewrapHistory(this.adapter, this.vault, this.name, id, fromDek, toDek, await this.getDEK(this.name)),
|
|
5728
|
-
saveHistorySnapshot: async (id,
|
|
5773
|
+
saveHistorySnapshot: async (id, version, seal) => {
|
|
5729
5774
|
if (this.historyConfig.enabled === false) return;
|
|
5775
|
+
const envelope = await seal(this.strategies.history.historyIdentity(this.name, id, version));
|
|
5730
5776
|
await this.strategies.history.saveHistory(this.adapter, this.vault, this.name, id, envelope);
|
|
5731
5777
|
this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: envelope._v });
|
|
5732
5778
|
if (this.historyConfig.maxVersions) await this.strategies.history.pruneHistory(this.adapter, this.vault, this.name, id, { keepVersions: this.historyConfig.maxVersions });
|
|
@@ -6010,17 +6056,18 @@ var DeferredNumberingStore = class {
|
|
|
6010
6056
|
async readJson(collection, id) {
|
|
6011
6057
|
const env = await this.adapter.get(this.vault, collection, id);
|
|
6012
6058
|
if (!env) return { env: null, value: null };
|
|
6013
|
-
const json = this.encrypted ? await openEnvelopeJson(env, await this.dek(collection)) : env._data;
|
|
6059
|
+
const json = this.encrypted ? await openEnvelopeJson({ collection, id }, env, await this.dek(collection)) : env._data;
|
|
6014
6060
|
return { env, value: JSON.parse(json) };
|
|
6015
6061
|
}
|
|
6016
6062
|
async writeJson(collection, id, value, expectedVersion) {
|
|
6017
6063
|
const json = JSON.stringify(value);
|
|
6018
6064
|
let env;
|
|
6019
6065
|
if (!this.encrypted) {
|
|
6020
|
-
env = {
|
|
6066
|
+
env = buildRecordEnvelope({ collection, id, version: expectedVersion + 1 }, { iv: "", data: json });
|
|
6021
6067
|
} else {
|
|
6022
|
-
const {
|
|
6023
|
-
|
|
6068
|
+
const identity = { collection, id, version: expectedVersion + 1 };
|
|
6069
|
+
const { iv, data } = await encrypt(json, await this.dek(collection), buildRecordAad(identity));
|
|
6070
|
+
env = buildRecordEnvelope(identity, { iv, data });
|
|
6024
6071
|
}
|
|
6025
6072
|
await this.adapter.put(this.vault, collection, id, env, expectedVersion);
|
|
6026
6073
|
}
|
|
@@ -6120,6 +6167,18 @@ var DeferredNumberingStore = class {
|
|
|
6120
6167
|
};
|
|
6121
6168
|
|
|
6122
6169
|
// src/with-audit/periods/vault-facade.ts
|
|
6170
|
+
function hasPartition(partition) {
|
|
6171
|
+
return partition !== void 0 && partition.length > 0;
|
|
6172
|
+
}
|
|
6173
|
+
function scopeSuffix(options) {
|
|
6174
|
+
return hasPartition(options?.partition) ? ` in partition [${options.partition.join(", ")}]` : "";
|
|
6175
|
+
}
|
|
6176
|
+
function assertVaultWide(op, period, why) {
|
|
6177
|
+
if (!hasPartition(period.partition)) return;
|
|
6178
|
+
throw new ValidationError(
|
|
6179
|
+
`${op}: period "${period.name}" is partitioned ([${period.partition.join(", ")}]), and ${op} ${why} \u2014 it cannot be scoped to one timeline, because the store sees only ciphertext and cannot tell which partition a stored record belongs to. Close partitioned periods for their sealing semantics; run ${op} against an unpartitioned period covering the same window.`
|
|
6180
|
+
);
|
|
6181
|
+
}
|
|
6123
6182
|
var VaultPeriods = class {
|
|
6124
6183
|
constructor(deps) {
|
|
6125
6184
|
this.deps = deps;
|
|
@@ -6134,11 +6193,11 @@ var VaultPeriods = class {
|
|
|
6134
6193
|
periodCache = null;
|
|
6135
6194
|
async closePeriod(options) {
|
|
6136
6195
|
const existing = await this.loadPeriodsCache();
|
|
6137
|
-
this.deps.strategy.validatePeriodName(options.name, existing);
|
|
6196
|
+
this.deps.strategy.validatePeriodName(options.name, existing, options.partition);
|
|
6138
6197
|
if (typeof options.endDate !== "string" || options.endDate.length === 0) {
|
|
6139
6198
|
throw new ValidationError("closePeriod: endDate must be a non-empty ISO string.");
|
|
6140
6199
|
}
|
|
6141
|
-
const anchor = await this.deps.strategy.chainAnchor(existing);
|
|
6200
|
+
const anchor = await this.deps.strategy.chainAnchor(existing, options.partition);
|
|
6142
6201
|
const record = {
|
|
6143
6202
|
name: options.name,
|
|
6144
6203
|
kind: "closed",
|
|
@@ -6147,21 +6206,26 @@ var VaultPeriods = class {
|
|
|
6147
6206
|
closedBy: this.deps.userId(),
|
|
6148
6207
|
priorPeriodHash: anchor.priorPeriodHash,
|
|
6149
6208
|
...anchor.priorPeriodName !== void 0 && { priorPeriodName: anchor.priorPeriodName },
|
|
6150
|
-
...options.dateField !== void 0 && { dateField: options.dateField }
|
|
6209
|
+
...options.dateField !== void 0 && { dateField: options.dateField },
|
|
6210
|
+
...hasPartition(options.partition) && { partition: options.partition }
|
|
6151
6211
|
};
|
|
6152
|
-
const
|
|
6153
|
-
await this.
|
|
6212
|
+
const storageKey = resolvePeriodKey(record.name, record.partition);
|
|
6213
|
+
const envelope = await this.writeReserved(PERIODS_COLLECTION, storageKey, record);
|
|
6214
|
+
await this.deps.strategy.appendPeriodLedgerEntry(this.deps.getLedgerOrNull(), this.deps.userId(), envelope, storageKey);
|
|
6154
6215
|
existing.push(record);
|
|
6155
6216
|
this.periodCache = existing;
|
|
6156
6217
|
return record;
|
|
6157
6218
|
}
|
|
6158
6219
|
async openPeriod(options) {
|
|
6159
6220
|
const existing = await this.loadPeriodsCache();
|
|
6160
|
-
this.deps.strategy.validatePeriodName(options.name, existing);
|
|
6161
|
-
const prior = existing.find(
|
|
6221
|
+
this.deps.strategy.validatePeriodName(options.name, existing, options.partition);
|
|
6222
|
+
const prior = existing.find(
|
|
6223
|
+
(p) => p.name === options.fromPeriod && samePartition(p.partition, options.partition)
|
|
6224
|
+
);
|
|
6162
6225
|
if (!prior) {
|
|
6226
|
+
const where = hasPartition(options.partition) ? ` in partition [${options.partition.join(", ")}]` : "";
|
|
6163
6227
|
throw new ValidationError(
|
|
6164
|
-
`openPeriod: fromPeriod "${options.fromPeriod}" does not exist in this vault.`
|
|
6228
|
+
`openPeriod: fromPeriod "${options.fromPeriod}" does not exist in this vault${where}.`
|
|
6165
6229
|
);
|
|
6166
6230
|
}
|
|
6167
6231
|
if (prior.kind !== "closed") {
|
|
@@ -6191,7 +6255,7 @@ var VaultPeriods = class {
|
|
|
6191
6255
|
}
|
|
6192
6256
|
openingCollections.push(collName);
|
|
6193
6257
|
}
|
|
6194
|
-
const anchor = await this.deps.strategy.chainAnchor(existing);
|
|
6258
|
+
const anchor = await this.deps.strategy.chainAnchor(existing, options.partition);
|
|
6195
6259
|
const record = {
|
|
6196
6260
|
name: options.name,
|
|
6197
6261
|
kind: "opened",
|
|
@@ -6202,10 +6266,12 @@ var VaultPeriods = class {
|
|
|
6202
6266
|
closedBy: this.deps.userId(),
|
|
6203
6267
|
priorPeriodHash: anchor.priorPeriodHash,
|
|
6204
6268
|
priorPeriodName: anchor.priorPeriodName ?? prior.name,
|
|
6205
|
-
...openingCollections.length > 0 && { openingCollections }
|
|
6269
|
+
...openingCollections.length > 0 && { openingCollections },
|
|
6270
|
+
...hasPartition(options.partition) && { partition: options.partition }
|
|
6206
6271
|
};
|
|
6207
|
-
const
|
|
6208
|
-
await this.
|
|
6272
|
+
const storageKey = resolvePeriodKey(record.name, record.partition);
|
|
6273
|
+
const envelope = await this.writeReserved(PERIODS_COLLECTION, storageKey, record);
|
|
6274
|
+
await this.deps.strategy.appendPeriodLedgerEntry(this.deps.getLedgerOrNull(), this.deps.userId(), envelope, storageKey);
|
|
6209
6275
|
existing.push(record);
|
|
6210
6276
|
this.periodCache = existing;
|
|
6211
6277
|
return record;
|
|
@@ -6219,10 +6285,11 @@ var VaultPeriods = class {
|
|
|
6219
6285
|
* read only. Idempotent: a second call is a no-op that returns the
|
|
6220
6286
|
* same merged record without re-purging or re-appending a ledger entry.
|
|
6221
6287
|
*/
|
|
6222
|
-
async freezePeriod(name) {
|
|
6288
|
+
async freezePeriod(name, options) {
|
|
6223
6289
|
const existing = await this.loadPeriodsCache();
|
|
6224
|
-
const period =
|
|
6225
|
-
if (!period) throw new ValidationError(`freezePeriod: no period named "${name}".`);
|
|
6290
|
+
const period = this.findPeriod(existing, name, options);
|
|
6291
|
+
if (!period) throw new ValidationError(`freezePeriod: no period named "${name}"${scopeSuffix(options)}.`);
|
|
6292
|
+
assertVaultWide("freezePeriod", period, "purges delete markers by write-time across the whole store");
|
|
6226
6293
|
if (period.kind !== "closed") {
|
|
6227
6294
|
throw new ValidationError(
|
|
6228
6295
|
`freezePeriod: period "${name}" is "${period.kind}"; only a closed period can be frozen.`
|
|
@@ -6262,10 +6329,11 @@ var VaultPeriods = class {
|
|
|
6262
6329
|
* through to cold) and idempotent: a second call is a no-op returning the
|
|
6263
6330
|
* same merged record.
|
|
6264
6331
|
*/
|
|
6265
|
-
async archivePeriod(name) {
|
|
6332
|
+
async archivePeriod(name, options) {
|
|
6266
6333
|
const existing = await this.loadPeriodsCache();
|
|
6267
|
-
const period =
|
|
6268
|
-
if (!period) throw new ValidationError(`archivePeriod: no period named "${name}".`);
|
|
6334
|
+
const period = this.findPeriod(existing, name, options);
|
|
6335
|
+
if (!period) throw new ValidationError(`archivePeriod: no period named "${name}"${scopeSuffix(options)}.`);
|
|
6336
|
+
assertVaultWide("archivePeriod", period, "relocates records by write-time across the whole store");
|
|
6269
6337
|
if (period.kind !== "closed") {
|
|
6270
6338
|
throw new ValidationError(
|
|
6271
6339
|
`archivePeriod: period "${name}" is "${period.kind}"; only a closed period can be archived.`
|
|
@@ -6300,10 +6368,11 @@ var VaultPeriods = class {
|
|
|
6300
6368
|
* Idempotent once run; with no push-only targets it writes no companion and
|
|
6301
6369
|
* is re-runnable.
|
|
6302
6370
|
*/
|
|
6303
|
-
async purgePeriodTargets(name) {
|
|
6371
|
+
async purgePeriodTargets(name, options) {
|
|
6304
6372
|
const existing = await this.loadPeriodsCache();
|
|
6305
|
-
const period =
|
|
6306
|
-
if (!period) throw new ValidationError(`purgePeriodTargets: no period named "${name}".`);
|
|
6373
|
+
const period = this.findPeriod(existing, name, options);
|
|
6374
|
+
if (!period) throw new ValidationError(`purgePeriodTargets: no period named "${name}"${scopeSuffix(options)}.`);
|
|
6375
|
+
assertVaultWide("purgePeriodTargets", period, "sweeps delete markers by write-time off whole sync targets");
|
|
6307
6376
|
if (period.kind !== "closed") {
|
|
6308
6377
|
throw new ValidationError(
|
|
6309
6378
|
`purgePeriodTargets: period "${name}" is "${period.kind}"; only a closed period can be target-purged.`
|
|
@@ -6363,8 +6432,15 @@ var VaultPeriods = class {
|
|
|
6363
6432
|
purgedMarkerCount: freeze.purgedMarkerCount
|
|
6364
6433
|
};
|
|
6365
6434
|
}
|
|
6366
|
-
/**
|
|
6367
|
-
|
|
6435
|
+
/**
|
|
6436
|
+
* Return every closed / opened period in `closedAt` order, merged with any
|
|
6437
|
+
* freeze + archive companions.
|
|
6438
|
+
*
|
|
6439
|
+
* With no argument this spans EVERY timeline — the pre-#1005 behaviour, and
|
|
6440
|
+
* the right default for an audit sweep. Pass `{ partition }` to scope to one
|
|
6441
|
+
* timeline; `{ partition: [] }` (or omitting it) means the vault-wide one.
|
|
6442
|
+
*/
|
|
6443
|
+
async listPeriods(options) {
|
|
6368
6444
|
this.periodCache = null;
|
|
6369
6445
|
const all = await this.loadPeriodsCache();
|
|
6370
6446
|
const freezeIds = await this.deps.adapter.list(this.deps.vault, PERIOD_FREEZES_COLLECTION);
|
|
@@ -6385,7 +6461,9 @@ var VaultPeriods = class {
|
|
|
6385
6461
|
const tp = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION, id);
|
|
6386
6462
|
if (tp) targetPurges.set(tp.period, tp);
|
|
6387
6463
|
}
|
|
6388
|
-
|
|
6464
|
+
const scoped = options === void 0 ? all : all.filter((p) => samePartition(p.partition, options.partition));
|
|
6465
|
+
const withReopen = await this.mergeReopenState(scoped);
|
|
6466
|
+
return withReopen.map((p) => {
|
|
6389
6467
|
const f = freezes.get(p.name);
|
|
6390
6468
|
let merged = f ? this.mergeFreeze(p, f) : p;
|
|
6391
6469
|
const a = archives.get(p.name);
|
|
@@ -6395,38 +6473,168 @@ var VaultPeriods = class {
|
|
|
6395
6473
|
return merged;
|
|
6396
6474
|
});
|
|
6397
6475
|
}
|
|
6398
|
-
/**
|
|
6399
|
-
|
|
6476
|
+
/**
|
|
6477
|
+
* Look up a single period by name within one timeline, merged with its
|
|
6478
|
+
* freeze + archive + target-purge companions if any. Returns `null` if not
|
|
6479
|
+
* found.
|
|
6480
|
+
*
|
|
6481
|
+
* Names are only unique per partition (#1005), so this resolves against the
|
|
6482
|
+
* VAULT-WIDE timeline unless `{ partition }` says otherwise — matching how
|
|
6483
|
+
* every pre-partition period is stored.
|
|
6484
|
+
*/
|
|
6485
|
+
async getPeriod(name, options) {
|
|
6400
6486
|
const all = await this.loadPeriodsCache();
|
|
6401
|
-
const period =
|
|
6487
|
+
const period = this.findPeriod(all, name, options);
|
|
6402
6488
|
if (!period) return null;
|
|
6403
|
-
const
|
|
6404
|
-
const
|
|
6489
|
+
const key = resolvePeriodKey(name, options?.partition);
|
|
6490
|
+
const freeze = await this.readReserved(PERIOD_FREEZES_COLLECTION, key);
|
|
6491
|
+
const archive = await this.readReserved(PERIOD_ARCHIVES_COLLECTION, key);
|
|
6405
6492
|
let merged = freeze ? this.mergeFreeze(period, freeze) : period;
|
|
6406
6493
|
if (archive) merged = this.mergeArchive(merged, archive);
|
|
6407
|
-
const targetPurge = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION,
|
|
6494
|
+
const targetPurge = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION, key);
|
|
6408
6495
|
if (targetPurge) merged = this.mergeTargetPurge(merged, targetPurge);
|
|
6496
|
+
const reopenLog = await this.readReserved(PERIOD_REOPENS_COLLECTION, key);
|
|
6497
|
+
if (reopenLog) merged = { ...merged, ...resolveReopenState(reopenLog.events) };
|
|
6409
6498
|
return merged;
|
|
6410
6499
|
}
|
|
6411
|
-
/**
|
|
6412
|
-
|
|
6500
|
+
/**
|
|
6501
|
+
* The full append-only reopen/reclose log for one period (#1022) — the record
|
|
6502
|
+
* an audit actually asks for, in order. `[]` when never reopened.
|
|
6503
|
+
*/
|
|
6504
|
+
async listPeriodReopens(name, options) {
|
|
6505
|
+
const key = resolvePeriodKey(name, options?.partition);
|
|
6506
|
+
const log = await this.readReserved(PERIOD_REOPENS_COLLECTION, key);
|
|
6507
|
+
return log?.events ?? [];
|
|
6508
|
+
}
|
|
6509
|
+
/**
|
|
6510
|
+
* Return a closed period to a writable state (#1022).
|
|
6511
|
+
*
|
|
6512
|
+
* Close is a three-state lifecycle in practice — open / closed / reopened —
|
|
6513
|
+
* because a month gets closed and then a missing invoice arrives, or a filing
|
|
6514
|
+
* is rejected and must be amended. That is routine, and it is supposed to
|
|
6515
|
+
* leave a trail.
|
|
6516
|
+
*
|
|
6517
|
+
* The `_periods/<key>` record is NOT touched: the reopen is appended to a
|
|
6518
|
+
* companion log, so the inter-period hash chain that proves the close
|
|
6519
|
+
* happened survives the reopen intact. The chain reads *closed at T1,
|
|
6520
|
+
* reopened at T2 by U, reclosed at T3*.
|
|
6521
|
+
*
|
|
6522
|
+
* A reopen withdraws the PERIOD's veto and nothing else. Record-level rules —
|
|
6523
|
+
* an `immutableGuard` on a sent receipt, a frozen field — are separate gate
|
|
6524
|
+
* handlers registered ahead of the period gate, so a reopened month cannot
|
|
6525
|
+
* resurrect a document that is independently locked. Period state can only
|
|
6526
|
+
* ever widen what the record-level rule already permits.
|
|
6527
|
+
*
|
|
6528
|
+
* Reopening an already-open window is allowed and appends another event: that
|
|
6529
|
+
* is how a window gets extended, and the log keeps both.
|
|
6530
|
+
*/
|
|
6531
|
+
async reopenPeriod(name, options) {
|
|
6532
|
+
const existing = await this.loadPeriodsCache();
|
|
6533
|
+
const period = this.findPeriod(existing, name, options);
|
|
6534
|
+
if (!period) throw new ValidationError(`reopenPeriod: no period named "${name}"${scopeSuffix(options)}.`);
|
|
6535
|
+
if (period.kind !== "closed") {
|
|
6536
|
+
throw new ValidationError(
|
|
6537
|
+
`reopenPeriod: period "${name}" is "${period.kind}"; only a closed period can be reopened.`
|
|
6538
|
+
);
|
|
6539
|
+
}
|
|
6540
|
+
if (options?.until !== void 0 && Number.isNaN(Date.parse(options.until))) {
|
|
6541
|
+
throw new ValidationError(`reopenPeriod: unparseable \`until\` "${options.until}".`);
|
|
6542
|
+
}
|
|
6543
|
+
return this.appendReopenEvent(period, options, {
|
|
6544
|
+
op: "reopen",
|
|
6545
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6546
|
+
by: this.deps.userId(),
|
|
6547
|
+
...options?.until !== void 0 && { until: options.until },
|
|
6548
|
+
...options?.reason !== void 0 && { reason: options.reason }
|
|
6549
|
+
});
|
|
6550
|
+
}
|
|
6551
|
+
/**
|
|
6552
|
+
* Seal a reopened period again (#1022), ending the window explicitly rather
|
|
6553
|
+
* than waiting for an `until` to lapse. Appends to the same log, so the
|
|
6554
|
+
* close → reopen → reclose sequence is recoverable in order.
|
|
6555
|
+
*/
|
|
6556
|
+
async reclosePeriod(name, options) {
|
|
6557
|
+
const existing = await this.loadPeriodsCache();
|
|
6558
|
+
const period = this.findPeriod(existing, name, options);
|
|
6559
|
+
if (!period) throw new ValidationError(`reclosePeriod: no period named "${name}"${scopeSuffix(options)}.`);
|
|
6560
|
+
const merged = await this.mergeReopenState([period]);
|
|
6561
|
+
if (!isEffectivelyReopened(merged[0], (/* @__PURE__ */ new Date()).toISOString())) {
|
|
6562
|
+
throw new ValidationError(
|
|
6563
|
+
`reclosePeriod: period "${name}"${scopeSuffix(options)} is not currently reopened \u2014 nothing to reclose. A period whose \`until\` has already lapsed re-sealed on its own.`
|
|
6564
|
+
);
|
|
6565
|
+
}
|
|
6566
|
+
return this.appendReopenEvent(period, options, {
|
|
6567
|
+
op: "reclose",
|
|
6568
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6569
|
+
by: this.deps.userId(),
|
|
6570
|
+
...options?.reason !== void 0 && { reason: options.reason }
|
|
6571
|
+
});
|
|
6572
|
+
}
|
|
6573
|
+
/** Append one entry to a period's reopen log, ledger it, and invalidate the guard's view. */
|
|
6574
|
+
async appendReopenEvent(period, scope, event) {
|
|
6575
|
+
const key = resolvePeriodKey(period.name, period.partition);
|
|
6576
|
+
const prior = await this.readReserved(PERIOD_REOPENS_COLLECTION, key);
|
|
6577
|
+
const record = {
|
|
6578
|
+
period: period.name,
|
|
6579
|
+
...hasPartition(period.partition) && { partition: period.partition },
|
|
6580
|
+
events: [...prior?.events ?? [], event]
|
|
6581
|
+
};
|
|
6582
|
+
const envelope = await this.writeReserved(PERIOD_REOPENS_COLLECTION, key, record);
|
|
6583
|
+
await this.deps.strategy.appendPeriodLedgerEntry(
|
|
6584
|
+
this.deps.getLedgerOrNull(),
|
|
6585
|
+
this.deps.userId(),
|
|
6586
|
+
envelope,
|
|
6587
|
+
key,
|
|
6588
|
+
PERIOD_REOPENS_COLLECTION
|
|
6589
|
+
);
|
|
6590
|
+
this.periodCache = null;
|
|
6591
|
+
void scope;
|
|
6592
|
+
return { ...period, ...resolveReopenState(record.events) };
|
|
6593
|
+
}
|
|
6594
|
+
/** Merge each period's reopen log onto it. One adapter listing, not one per period. */
|
|
6595
|
+
async mergeReopenState(periods) {
|
|
6596
|
+
if (periods.length === 0) return [];
|
|
6597
|
+
const ids = await this.deps.adapter.list(this.deps.vault, PERIOD_REOPENS_COLLECTION);
|
|
6598
|
+
if (ids.length === 0) return [...periods];
|
|
6599
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
6600
|
+
for (const id of ids) {
|
|
6601
|
+
const r = await this.readReserved(PERIOD_REOPENS_COLLECTION, id);
|
|
6602
|
+
if (r) byKey.set(id, r);
|
|
6603
|
+
}
|
|
6604
|
+
return periods.map((p) => {
|
|
6605
|
+
const log = byKey.get(resolvePeriodKey(p.name, p.partition));
|
|
6606
|
+
return log ? { ...p, ...resolveReopenState(log.events) } : p;
|
|
6607
|
+
});
|
|
6608
|
+
}
|
|
6609
|
+
/** Resolve one period within the timeline named by `options` (vault-wide when absent). */
|
|
6610
|
+
findPeriod(all, name, options) {
|
|
6611
|
+
return all.find((p) => p.name === name && samePartition(p.partition, options?.partition));
|
|
6612
|
+
}
|
|
6613
|
+
/** Called by the gate bus before put/delete. `collection` selects the subject mapping (#1005). */
|
|
6614
|
+
async assertTsWritable(existing, incoming, collection) {
|
|
6413
6615
|
if (existing === null && incoming === null) return;
|
|
6414
6616
|
if (this.periodCache === null) {
|
|
6415
|
-
|
|
6617
|
+
const loaded = await this.deps.strategy.loadPeriods(
|
|
6416
6618
|
this.deps.adapter,
|
|
6417
6619
|
this.deps.vault,
|
|
6418
|
-
(env) => this.decryptPeriodRecord(env)
|
|
6620
|
+
(id, env) => this.decryptPeriodRecord(id, env)
|
|
6419
6621
|
);
|
|
6622
|
+
this.periodCache = await this.mergeReopenState(loaded);
|
|
6420
6623
|
}
|
|
6421
6624
|
if (this.periodCache.length === 0) return;
|
|
6422
|
-
this.deps.strategy.assertTsWritable(
|
|
6625
|
+
this.deps.strategy.assertTsWritable(
|
|
6626
|
+
existing,
|
|
6627
|
+
incoming,
|
|
6628
|
+
this.periodCache,
|
|
6629
|
+
collection !== void 0 ? { collection, ...this.deps.strategy.partitionOf !== void 0 && { resolve: this.deps.strategy.partitionOf } } : void 0
|
|
6630
|
+
);
|
|
6423
6631
|
}
|
|
6424
6632
|
async loadPeriodsCache() {
|
|
6425
6633
|
if (this.periodCache !== null) return this.periodCache;
|
|
6426
6634
|
const loaded = await this.deps.strategy.loadPeriods(
|
|
6427
6635
|
this.deps.adapter,
|
|
6428
6636
|
this.deps.vault,
|
|
6429
|
-
(env) => this.decryptPeriodRecord(env)
|
|
6637
|
+
(id, env) => this.decryptPeriodRecord(id, env)
|
|
6430
6638
|
);
|
|
6431
6639
|
this.periodCache = loaded;
|
|
6432
6640
|
return loaded;
|
|
@@ -6434,27 +6642,15 @@ var VaultPeriods = class {
|
|
|
6434
6642
|
/** Generic reserved-collection writer — serves `_periods` and `_period_freezes` alike. */
|
|
6435
6643
|
async writeReserved(collection, key, value) {
|
|
6436
6644
|
const json = JSON.stringify(value);
|
|
6645
|
+
const actor = this.deps.userId();
|
|
6646
|
+
const identity = { collection, id: key, by: actor, version: 1 };
|
|
6437
6647
|
let envelope;
|
|
6438
6648
|
if (this.deps.encrypted) {
|
|
6439
6649
|
const dek = await this.deps.getDEK(collection);
|
|
6440
|
-
const { iv, data } = await encrypt(json, dek);
|
|
6441
|
-
envelope = {
|
|
6442
|
-
_noydb: NOYDB_FORMAT_VERSION,
|
|
6443
|
-
_v: 1,
|
|
6444
|
-
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6445
|
-
_iv: iv,
|
|
6446
|
-
_data: data,
|
|
6447
|
-
_by: this.deps.userId()
|
|
6448
|
-
};
|
|
6650
|
+
const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
|
|
6651
|
+
envelope = buildRecordEnvelope(identity, { iv, data });
|
|
6449
6652
|
} else {
|
|
6450
|
-
envelope = {
|
|
6451
|
-
_noydb: NOYDB_FORMAT_VERSION,
|
|
6452
|
-
_v: 1,
|
|
6453
|
-
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6454
|
-
_iv: "",
|
|
6455
|
-
_data: json,
|
|
6456
|
-
_by: this.deps.userId()
|
|
6457
|
-
};
|
|
6653
|
+
envelope = buildRecordEnvelope(identity, { iv: "", data: json });
|
|
6458
6654
|
}
|
|
6459
6655
|
await this.deps.adapter.put(this.deps.vault, collection, key, envelope);
|
|
6460
6656
|
if (collection === PERIODS_COLLECTION && this.deps.onDirty) {
|
|
@@ -6466,14 +6662,14 @@ var VaultPeriods = class {
|
|
|
6466
6662
|
async readReserved(collection, key) {
|
|
6467
6663
|
const env = await this.deps.adapter.get(this.deps.vault, collection, key);
|
|
6468
6664
|
if (!env) return null;
|
|
6469
|
-
const json = this.deps.encrypted ? await openEnvelopeJson(env, await this.deps.getDEK(collection)) : env._data;
|
|
6665
|
+
const json = this.deps.encrypted ? await openEnvelopeJson({ collection, id: key }, env, await this.deps.getDEK(collection)) : env._data;
|
|
6470
6666
|
return JSON.parse(json);
|
|
6471
6667
|
}
|
|
6472
|
-
async decryptPeriodRecord(envelope) {
|
|
6668
|
+
async decryptPeriodRecord(periodId, envelope) {
|
|
6473
6669
|
let json;
|
|
6474
6670
|
if (this.deps.encrypted) {
|
|
6475
6671
|
const dek = await this.deps.getDEK(PERIODS_COLLECTION);
|
|
6476
|
-
json = await openEnvelopeJson(envelope, dek);
|
|
6672
|
+
json = await openEnvelopeJson({ collection: PERIODS_COLLECTION, id: periodId }, envelope, dek);
|
|
6477
6673
|
} else {
|
|
6478
6674
|
json = envelope._data;
|
|
6479
6675
|
}
|
|
@@ -7048,7 +7244,7 @@ var VaultLinks = class {
|
|
|
7048
7244
|
// src/with-shape/links/lazy-handle.ts
|
|
7049
7245
|
function makeLazyLinkSetHandle(d) {
|
|
7050
7246
|
let engine = null;
|
|
7051
|
-
const load = () => engine ??= import("./link-set-
|
|
7247
|
+
const load = () => engine ??= import("./link-set-3POMQR3I.js").then(
|
|
7052
7248
|
({ LinkSet }) => new LinkSet(d.adapter, d.vault, d.name, d.spec, d.encrypted, d.getDEK, d.actor, d.emitter, d.endpointExists)
|
|
7053
7249
|
);
|
|
7054
7250
|
return {
|
|
@@ -7695,7 +7891,7 @@ function declareSatellite(ctx, collectionName, options, existingRegistry) {
|
|
|
7695
7891
|
ctx.forEachSyncEngine((e) => e.remirrorPairResolvers([spec.base, spec.satellite]));
|
|
7696
7892
|
const registry = reg;
|
|
7697
7893
|
const baseSchema = ctx.getBaseSchema(spec.base);
|
|
7698
|
-
void import("./post-register-
|
|
7894
|
+
void import("./post-register-Z5T7FY45.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
|
|
7699
7895
|
});
|
|
7700
7896
|
return reg;
|
|
7701
7897
|
}
|
|
@@ -8015,17 +8211,6 @@ function expandRefsWithSatellites(refs, registry) {
|
|
|
8015
8211
|
return anySat ? out : refs;
|
|
8016
8212
|
}
|
|
8017
8213
|
|
|
8018
|
-
// src/with-shape/satellites/migrate-cek.ts
|
|
8019
|
-
async function migrateSatelliteCek(name, coll) {
|
|
8020
|
-
if (coll.getConfig()?.perRecordKeys !== true) {
|
|
8021
|
-
throw new SatelliteConfigError(
|
|
8022
|
-
`migrateSatellitePerRecordKeys: collection "${name}" was already opened this session without perRecordKeys (construction-only); migrate before its first open, or restart the session.`
|
|
8023
|
-
);
|
|
8024
|
-
}
|
|
8025
|
-
const migrated = await coll._applyCutoverTransform((doc) => doc);
|
|
8026
|
-
return { migrated };
|
|
8027
|
-
}
|
|
8028
|
-
|
|
8029
8214
|
// src/with-shape/schema-update/fence-controller.ts
|
|
8030
8215
|
function schemaBumpAuditHook(getLedger, actor) {
|
|
8031
8216
|
return async (generation) => {
|
|
@@ -8678,7 +8863,7 @@ var Vault = class {
|
|
|
8678
8863
|
const strategies = options.schemaUpdate ?? [];
|
|
8679
8864
|
const work = (async () => {
|
|
8680
8865
|
const dek = await this.getDEK(collectionName);
|
|
8681
|
-
const { persistSchemaIfNeeded } = await import("./register-
|
|
8866
|
+
const { persistSchemaIfNeeded } = await import("./register-UZ37QPDB.js");
|
|
8682
8867
|
const result = await persistSchemaIfNeeded({
|
|
8683
8868
|
store: this.adapter,
|
|
8684
8869
|
vault: this.name,
|
|
@@ -8828,7 +9013,7 @@ var Vault = class {
|
|
|
8828
9013
|
const work = (async () => {
|
|
8829
9014
|
try {
|
|
8830
9015
|
const dek = await this.getDEK(collectionName);
|
|
8831
|
-
await (await import("./register-
|
|
9016
|
+
await (await import("./register-UZ37QPDB.js")).persistSchemaIfNeeded({
|
|
8832
9017
|
store: this.adapter,
|
|
8833
9018
|
vault: this.name,
|
|
8834
9019
|
collectionName,
|
|
@@ -8871,9 +9056,10 @@ var Vault = class {
|
|
|
8871
9056
|
* unblocks R-S7 when a base gains forget coverage after its satellite was
|
|
8872
9057
|
* already declared without `perRecordKeys`. Call BEFORE re-declaring with
|
|
8873
9058
|
* `{ satelliteOf, perRecordKeys: true }` AND before this collection serves
|
|
8874
|
-
* writes (unfenced walk — see
|
|
9059
|
+
* writes (unfenced walk — see `with-shape/satellites/migrate-cek.ts`); resumable.
|
|
8875
9060
|
*/
|
|
8876
9061
|
async migrateSatellitePerRecordKeys(satelliteName) {
|
|
9062
|
+
const { migrateSatelliteCek } = await import("./migrate-cek-XM2ETTZW.js");
|
|
8877
9063
|
return migrateSatelliteCek(satelliteName, this.collection(satelliteName, { perRecordKeys: true }));
|
|
8878
9064
|
}
|
|
8879
9065
|
/**
|
|
@@ -9504,16 +9690,23 @@ var Vault = class {
|
|
|
9504
9690
|
*/
|
|
9505
9691
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
9506
9692
|
async _loadPodSigner() {
|
|
9507
|
-
const { loadSigner } = await import("./signer-
|
|
9693
|
+
const { loadSigner } = await import("./signer-Q7XQBMPA.js");
|
|
9508
9694
|
return loadSigner(this.adapter, this.name, this.getDEK);
|
|
9509
9695
|
}
|
|
9510
9696
|
async writeExportAudit(entry) {
|
|
9511
9697
|
const json = JSON.stringify(entry);
|
|
9698
|
+
const exportAuditIdentity = { collection: EXPORT_AUDIT_COLLECTION, id: entry.id, by: entry.actor, version: 1 };
|
|
9512
9699
|
const envelope = this.encrypted ? await (async () => {
|
|
9513
9700
|
const dek = await this.getDEK(EXPORT_AUDIT_COLLECTION);
|
|
9514
|
-
const { iv, data } = await encrypt(json, dek);
|
|
9515
|
-
return
|
|
9516
|
-
|
|
9701
|
+
const { iv, data } = await encrypt(json, dek, buildRecordAad(exportAuditIdentity));
|
|
9702
|
+
return buildRecordEnvelope(
|
|
9703
|
+
exportAuditIdentity,
|
|
9704
|
+
{ ts: entry.startedAt, iv, data }
|
|
9705
|
+
);
|
|
9706
|
+
})() : buildRecordEnvelope(
|
|
9707
|
+
exportAuditIdentity,
|
|
9708
|
+
{ ts: entry.startedAt, iv: "", data: json }
|
|
9709
|
+
);
|
|
9517
9710
|
await this.adapter.put(this.name, EXPORT_AUDIT_COLLECTION, entry.id, envelope);
|
|
9518
9711
|
}
|
|
9519
9712
|
canExport(tier, format) {
|
|
@@ -9527,12 +9720,12 @@ var Vault = class {
|
|
|
9527
9720
|
*
|
|
9528
9721
|
* @internal
|
|
9529
9722
|
*/
|
|
9530
|
-
async _decryptEnvelopeForBundleFilter(env, collectionName) {
|
|
9723
|
+
async _decryptEnvelopeForBundleFilter(env, collectionName, recordId) {
|
|
9531
9724
|
if (!this.encrypted) {
|
|
9532
9725
|
return JSON.parse(env._data);
|
|
9533
9726
|
}
|
|
9534
9727
|
const dek = await this.getDEK(collectionName);
|
|
9535
|
-
const json = await openEnvelopeJson(env, dek);
|
|
9728
|
+
const json = await openEnvelopeJson({ collection: collectionName, id: recordId }, env, dek);
|
|
9536
9729
|
return JSON.parse(json);
|
|
9537
9730
|
}
|
|
9538
9731
|
canImport(tier, format) {
|
|
@@ -9987,7 +10180,7 @@ var Vault = class {
|
|
|
9987
10180
|
async _initGuards(handles) {
|
|
9988
10181
|
if (handles.length === 0) return;
|
|
9989
10182
|
const [{ GuardRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
9990
|
-
import("./registry-
|
|
10183
|
+
import("./registry-F7U6KSLX.js"),
|
|
9991
10184
|
import("./read-only-facade-CHCKSEPD.js")
|
|
9992
10185
|
]);
|
|
9993
10186
|
const registry = new GuardRegistry();
|
|
@@ -10015,7 +10208,7 @@ var Vault = class {
|
|
|
10015
10208
|
async _initDerivations(handles) {
|
|
10016
10209
|
if (handles.length === 0) return;
|
|
10017
10210
|
const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
10018
|
-
import("./registry-
|
|
10211
|
+
import("./registry-L4ELKX6C.js"),
|
|
10019
10212
|
import("./read-only-facade-CHCKSEPD.js")
|
|
10020
10213
|
]);
|
|
10021
10214
|
const registry = new DerivationRegistry();
|
|
@@ -10047,7 +10240,7 @@ var Vault = class {
|
|
|
10047
10240
|
*/
|
|
10048
10241
|
async _initMaterializedViews(handles) {
|
|
10049
10242
|
if (handles.length === 0) return;
|
|
10050
|
-
const { MaterializedViewRegistry } = await import("./registry-
|
|
10243
|
+
const { MaterializedViewRegistry } = await import("./registry-SDT5LIGO.js");
|
|
10051
10244
|
const registry = new MaterializedViewRegistry();
|
|
10052
10245
|
this.materializedViewRegistry = registry;
|
|
10053
10246
|
const db = this;
|
|
@@ -10072,7 +10265,7 @@ var Vault = class {
|
|
|
10072
10265
|
*/
|
|
10073
10266
|
async _initOverlayedViews(handles) {
|
|
10074
10267
|
if (handles.length === 0) return;
|
|
10075
|
-
const { OverlayedViewRegistry } = await import("./registry-
|
|
10268
|
+
const { OverlayedViewRegistry } = await import("./registry-ETJNA7PO.js");
|
|
10076
10269
|
const registry = new OverlayedViewRegistry();
|
|
10077
10270
|
const mvRegistry = this.materializedViewRegistry;
|
|
10078
10271
|
const overlayNames = /* @__PURE__ */ new Set();
|
|
@@ -10134,14 +10327,14 @@ var Vault = class {
|
|
|
10134
10327
|
if (!reg) {
|
|
10135
10328
|
throw new Error(`refreshView: no MV registered with name "${name}"`);
|
|
10136
10329
|
}
|
|
10137
|
-
const { MaterializedViewExecutor } = await import("./executor-
|
|
10330
|
+
const { MaterializedViewExecutor } = await import("./executor-CZDXBXKE.js");
|
|
10138
10331
|
const result = await MaterializedViewExecutor.refresh(reg, {
|
|
10139
10332
|
getCollection: (n) => this.collection(n),
|
|
10140
10333
|
getActiveTxContext: () => this.noydb._activeTxContextOrNull,
|
|
10141
10334
|
getQueryContext: () => this,
|
|
10142
10335
|
dispatchCtx: this._dispatchCtx({ collection: name, id: "refreshView" })
|
|
10143
10336
|
});
|
|
10144
|
-
const { clearMVStaleFully } = await import("./stale-
|
|
10337
|
+
const { clearMVStaleFully } = await import("./stale-NI7SAXAZ.js");
|
|
10145
10338
|
await clearMVStaleFully(this.adapter, this.name, registry, name);
|
|
10146
10339
|
return result;
|
|
10147
10340
|
}
|
|
@@ -10154,7 +10347,7 @@ var Vault = class {
|
|
|
10154
10347
|
if (registry === null) return { derived: 0, failed: 0, skippedFrozen: 0 };
|
|
10155
10348
|
const strategies = registry.strategiesForSource(sourceCollection);
|
|
10156
10349
|
if (strategies.length === 0) return { derived: 0, failed: 0, skippedFrozen: 0 };
|
|
10157
|
-
const { DerivationExecutor } = await import("./executor-
|
|
10350
|
+
const { DerivationExecutor } = await import("./executor-VRLG4TQJ.js");
|
|
10158
10351
|
const sourceColl = this.collection(sourceCollection);
|
|
10159
10352
|
const records = await sourceColl.list();
|
|
10160
10353
|
const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-CHCKSEPD.js")).ReadOnlyVaultFacade(this, "derivation") };
|
|
@@ -10181,7 +10374,7 @@ var Vault = class {
|
|
|
10181
10374
|
if (!outSpec) continue;
|
|
10182
10375
|
const outputColl = this.collection(outSpec.collection);
|
|
10183
10376
|
if (out.kind === "array") {
|
|
10184
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
10377
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-NLQ7QAYW.js");
|
|
10185
10378
|
const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key, this.getDEK, this.encrypted);
|
|
10186
10379
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
10187
10380
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -10408,7 +10601,7 @@ var Vault = class {
|
|
|
10408
10601
|
* collection.
|
|
10409
10602
|
*/
|
|
10410
10603
|
async delegate(opts) {
|
|
10411
|
-
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
10604
|
+
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-JLNXM7KH.js");
|
|
10412
10605
|
if (!this.keyring.kek) {
|
|
10413
10606
|
throw new ValidationError(
|
|
10414
10607
|
"issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (secret) first."
|
|
@@ -10430,7 +10623,7 @@ var Vault = class {
|
|
|
10430
10623
|
* if the id does not exist.
|
|
10431
10624
|
*/
|
|
10432
10625
|
async revokeDelegation(id) {
|
|
10433
|
-
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
10626
|
+
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-JLNXM7KH.js");
|
|
10434
10627
|
await revokeDelegation(this.adapter, this.name, id);
|
|
10435
10628
|
void DELEGATIONS_COLLECTION;
|
|
10436
10629
|
}
|
|
@@ -10526,25 +10719,18 @@ var Vault = class {
|
|
|
10526
10719
|
async writeElevationAudit(entry) {
|
|
10527
10720
|
const id = `elev-${Date.now().toString(36)}-${Math.random().toString(16).slice(2, 10)}`;
|
|
10528
10721
|
const json = JSON.stringify({ id, ...entry });
|
|
10722
|
+
const elevationAuditIdentity = { collection: ELEVATION_AUDIT_COLLECTION, id, by: entry.actor, version: 1 };
|
|
10529
10723
|
const envelope = this.encrypted ? await (async () => {
|
|
10530
10724
|
const dek = await this.getDEK(ELEVATION_AUDIT_COLLECTION);
|
|
10531
|
-
const { iv, data } = await encrypt(json, dek);
|
|
10532
|
-
return
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
})() : {
|
|
10541
|
-
_noydb: NOYDB_FORMAT_VERSION,
|
|
10542
|
-
_v: 1,
|
|
10543
|
-
_ts: entry.startedAt,
|
|
10544
|
-
_iv: "",
|
|
10545
|
-
_data: json,
|
|
10546
|
-
_by: entry.actor
|
|
10547
|
-
};
|
|
10725
|
+
const { iv, data } = await encrypt(json, dek, buildRecordAad(elevationAuditIdentity));
|
|
10726
|
+
return buildRecordEnvelope(
|
|
10727
|
+
elevationAuditIdentity,
|
|
10728
|
+
{ ts: entry.startedAt, iv, data }
|
|
10729
|
+
);
|
|
10730
|
+
})() : buildRecordEnvelope(
|
|
10731
|
+
elevationAuditIdentity,
|
|
10732
|
+
{ ts: entry.startedAt, iv: "", data: json }
|
|
10733
|
+
);
|
|
10548
10734
|
await this.adapter.put(this.name, ELEVATION_AUDIT_COLLECTION, id, envelope);
|
|
10549
10735
|
}
|
|
10550
10736
|
/**
|
|
@@ -10609,13 +10795,13 @@ var Vault = class {
|
|
|
10609
10795
|
async openPeriod(options) {
|
|
10610
10796
|
return this.periods.openPeriod(options);
|
|
10611
10797
|
}
|
|
10612
|
-
/**
|
|
10613
|
-
async listPeriods() {
|
|
10614
|
-
return this.periods.listPeriods();
|
|
10798
|
+
/** Every closed / opened period in `closedAt` order; ALL timelines unless `{ partition }` scopes it (#1005). */
|
|
10799
|
+
async listPeriods(options) {
|
|
10800
|
+
return this.periods.listPeriods(options);
|
|
10615
10801
|
}
|
|
10616
|
-
/**
|
|
10617
|
-
async getPeriod(name) {
|
|
10618
|
-
return this.periods.getPeriod(name);
|
|
10802
|
+
/** One period by name within a timeline (vault-wide unless `{ partition }`). `null` if not found. */
|
|
10803
|
+
async getPeriod(name, options) {
|
|
10804
|
+
return this.periods.getPeriod(name, options);
|
|
10619
10805
|
}
|
|
10620
10806
|
/**
|
|
10621
10807
|
* Freeze a closed period (#604): purges in-window delete markers and
|
|
@@ -10625,8 +10811,8 @@ var Vault = class {
|
|
|
10625
10811
|
* and purging re-opens the #589 resurrection window for a peer offline
|
|
10626
10812
|
* since before the cutoff (see periods.ts's "Freeze" section).
|
|
10627
10813
|
*/
|
|
10628
|
-
async freezePeriod(name) {
|
|
10629
|
-
return this.periods.freezePeriod(name);
|
|
10814
|
+
async freezePeriod(name, options) {
|
|
10815
|
+
return this.periods.freezePeriod(name, options);
|
|
10630
10816
|
}
|
|
10631
10817
|
/**
|
|
10632
10818
|
* Archive a closed period (#613): relocates its in-window records from the
|
|
@@ -10635,8 +10821,8 @@ var Vault = class {
|
|
|
10635
10821
|
* the chained `_periods` record. Non-destructive (reads fall through to
|
|
10636
10822
|
* cold) and idempotent. Requires a routeStore with a cold route.
|
|
10637
10823
|
*/
|
|
10638
|
-
async archivePeriod(name) {
|
|
10639
|
-
return this.periods.archivePeriod(name);
|
|
10824
|
+
async archivePeriod(name, options) {
|
|
10825
|
+
return this.periods.archivePeriod(name, options);
|
|
10640
10826
|
}
|
|
10641
10827
|
/**
|
|
10642
10828
|
* Target-purge a closed+frozen period (#615): sweeps delete markers off the
|
|
@@ -10646,12 +10832,24 @@ var Vault = class {
|
|
|
10646
10832
|
* frozen first. Idempotent; a vault with no push-only targets writes no
|
|
10647
10833
|
* companion and is re-runnable.
|
|
10648
10834
|
*/
|
|
10649
|
-
async purgePeriodTargets(name) {
|
|
10650
|
-
return this.periods.purgePeriodTargets(name);
|
|
10835
|
+
async purgePeriodTargets(name, options) {
|
|
10836
|
+
return this.periods.purgePeriodTargets(name, options);
|
|
10837
|
+
}
|
|
10838
|
+
/** Return a closed period to writable (#1022); logged append-only, close chain untouched. */
|
|
10839
|
+
async reopenPeriod(name, options) {
|
|
10840
|
+
return this.periods.reopenPeriod(name, options);
|
|
10841
|
+
}
|
|
10842
|
+
/** Seal a reopened period again (#1022) rather than waiting for its `until` to lapse. */
|
|
10843
|
+
async reclosePeriod(name, options) {
|
|
10844
|
+
return this.periods.reclosePeriod(name, options);
|
|
10845
|
+
}
|
|
10846
|
+
/** The append-only reopen/reclose log for one period (#1022), in order. */
|
|
10847
|
+
async listPeriodReopens(name, options) {
|
|
10848
|
+
return this.periods.listPeriodReopens(name, options);
|
|
10651
10849
|
}
|
|
10652
10850
|
/** @internal — called by the gate bus before put/delete. */
|
|
10653
|
-
async _assertTsWritable(existing, incoming) {
|
|
10654
|
-
return this.periods.assertTsWritable(existing, incoming);
|
|
10851
|
+
async _assertTsWritable(existing, incoming, collection) {
|
|
10852
|
+
return this.periods.assertTsWritable(existing, incoming, collection);
|
|
10655
10853
|
}
|
|
10656
10854
|
/** List all collection names in this vault. */
|
|
10657
10855
|
async collections() {
|
|
@@ -10678,7 +10876,7 @@ var Vault = class {
|
|
|
10678
10876
|
* @see design-history/2026-05-22-schema-dump-design.md
|
|
10679
10877
|
*/
|
|
10680
10878
|
async dumpSchema(opts = {}) {
|
|
10681
|
-
const { dumpVaultSchema } = await import("./walk-
|
|
10879
|
+
const { dumpVaultSchema } = await import("./walk-WRA7RAPY.js");
|
|
10682
10880
|
return dumpVaultSchema(this, opts);
|
|
10683
10881
|
}
|
|
10684
10882
|
/**
|
|
@@ -10773,15 +10971,15 @@ var Vault = class {
|
|
|
10773
10971
|
* distinct handles, which is the right behavior — they're
|
|
10774
10972
|
* separate vault instances now.
|
|
10775
10973
|
*/
|
|
10776
|
-
async
|
|
10777
|
-
const {
|
|
10778
|
-
return
|
|
10974
|
+
async getPodHandle() {
|
|
10975
|
+
const { buildPodHandle } = await import("./pod-handle-MELERCKU.js");
|
|
10976
|
+
return buildPodHandle(this.adapter, this.name);
|
|
10779
10977
|
}
|
|
10780
10978
|
/**
|
|
10781
10979
|
* Read the owner-curated cover for this vault (or `undefined` if
|
|
10782
10980
|
* none is persisted). The cover lives in `_meta/public-envelope`
|
|
10783
10981
|
* (the frozen wire name) as plaintext — readable without any KEK
|
|
10784
|
-
* — so `
|
|
10982
|
+
* — so `getPodHandle`-style callers can label a vault before
|
|
10785
10983
|
* unlock.
|
|
10786
10984
|
*
|
|
10787
10985
|
* Mirrors `Noydb.getCover(vault, opts)` but scoped to a
|
|
@@ -10806,7 +11004,7 @@ var Vault = class {
|
|
|
10806
11004
|
* both modes round-trip cleanly.
|
|
10807
11005
|
*/
|
|
10808
11006
|
async dump() {
|
|
10809
|
-
const { dumpVault } = await import("./backup-
|
|
11007
|
+
const { dumpVault } = await import("./backup-FSC36VWC.js");
|
|
10810
11008
|
return dumpVault(this.backupContext());
|
|
10811
11009
|
}
|
|
10812
11010
|
/**
|
|
@@ -10858,7 +11056,7 @@ var Vault = class {
|
|
|
10858
11056
|
* — there's no chain to verify against.
|
|
10859
11057
|
*/
|
|
10860
11058
|
async load(backupJson) {
|
|
10861
|
-
const { loadVault } = await import("./backup-
|
|
11059
|
+
const { loadVault } = await import("./backup-FSC36VWC.js");
|
|
10862
11060
|
return loadVault(this.backupContext(), backupJson);
|
|
10863
11061
|
}
|
|
10864
11062
|
/**
|
|
@@ -10890,7 +11088,7 @@ var Vault = class {
|
|
|
10890
11088
|
* way to detect tampering of an in-place vault.
|
|
10891
11089
|
*/
|
|
10892
11090
|
async verifyBackupIntegrity() {
|
|
10893
|
-
const { verifyBackupIntegrity } = await import("./backup-
|
|
11091
|
+
const { verifyBackupIntegrity } = await import("./backup-FSC36VWC.js");
|
|
10894
11092
|
return verifyBackupIntegrity(this.backupContext());
|
|
10895
11093
|
}
|
|
10896
11094
|
/**
|
|
@@ -11108,7 +11306,7 @@ var Vault = class {
|
|
|
11108
11306
|
* is the live validator object, not a serialization of it).
|
|
11109
11307
|
*/
|
|
11110
11308
|
async exportJSON(opts = {}) {
|
|
11111
|
-
const { exportVaultJSON } = await import("./backup-
|
|
11309
|
+
const { exportVaultJSON } = await import("./backup-FSC36VWC.js");
|
|
11112
11310
|
return exportVaultJSON(this.backupContext(), opts);
|
|
11113
11311
|
}
|
|
11114
11312
|
};
|
|
@@ -12019,6 +12217,20 @@ var TeamFacade = class {
|
|
|
12019
12217
|
this.deps.keyringCache.set(vault, keyring);
|
|
12020
12218
|
return result;
|
|
12021
12219
|
}
|
|
12220
|
+
/** Gate + run the `verifyRoster` engine (#1121). See `Noydb.verifyRoster`. */
|
|
12221
|
+
async runVerifyRoster(engine, vault) {
|
|
12222
|
+
const keyring = await this.deps.getKeyringInternal(vault);
|
|
12223
|
+
return engine(this.deps.options.store, vault, keyring);
|
|
12224
|
+
}
|
|
12225
|
+
/** Gate + run the `quarantineKeyring` engine (#1121). See `Noydb.quarantineKeyring`. */
|
|
12226
|
+
async runQuarantine(engine, vault, userId, factors) {
|
|
12227
|
+
this.deps.checkPolicyOperation(vault, "revoke");
|
|
12228
|
+
await this.deps.checkGate(vault, "revoke-user", factors);
|
|
12229
|
+
const keyring = await this.deps.getKeyringInternal(vault);
|
|
12230
|
+
const result = await engine(this.deps.options.store, vault, keyring, userId);
|
|
12231
|
+
this.deps.keyringCache.set(vault, keyring);
|
|
12232
|
+
return result;
|
|
12233
|
+
}
|
|
12022
12234
|
// ─── Tier-2 enroll / remove ─────────────────────────────────────
|
|
12023
12235
|
/**
|
|
12024
12236
|
* Add a tier-2 authenticator slot to the calling user's keyring.
|
|
@@ -12924,6 +13136,7 @@ var Noydb = class {
|
|
|
12924
13136
|
this.#registerGuardGate();
|
|
12925
13137
|
this.#registerPeriodGate();
|
|
12926
13138
|
this.#registerForgetHooks();
|
|
13139
|
+
this.#registerVaultHeadObserver();
|
|
12927
13140
|
this.resetSessionTimer();
|
|
12928
13141
|
}
|
|
12929
13142
|
/** @internal — resolved forget strategy (NO_FORGET when not configured). */
|
|
@@ -12940,6 +13153,22 @@ var Noydb = class {
|
|
|
12940
13153
|
// - the subsystemBus `afterDelete` observer fires on delete (onAfterWrite
|
|
12941
13154
|
// does NOT) — drop the ref so a deleted record never lingers in the
|
|
12942
13155
|
// index (RISK #2). Without it, forget() would try to shred a ghost.
|
|
13156
|
+
/** #1044 — see `with-commit/vault-head/strategy.ts` for why this is an observer. */
|
|
13157
|
+
#registerVaultHeadObserver() {
|
|
13158
|
+
if (!this.strategies.vaultHead.enabled) return;
|
|
13159
|
+
for (const point of ["afterPut", "afterDelete"]) {
|
|
13160
|
+
this.subsystemBus.register(point, async (event) => {
|
|
13161
|
+
const vault = this.vaultCache.get(event.vault);
|
|
13162
|
+
if (!vault) return;
|
|
13163
|
+
const { adapter, getDEK } = vault._introspectState();
|
|
13164
|
+
await this.strategies.vaultHead.note(adapter, event.vault, getDEK, {
|
|
13165
|
+
collection: event.collection,
|
|
13166
|
+
id: event.docId,
|
|
13167
|
+
version: event.version
|
|
13168
|
+
});
|
|
13169
|
+
});
|
|
13170
|
+
}
|
|
13171
|
+
}
|
|
12943
13172
|
#registerForgetHooks() {
|
|
12944
13173
|
const subjects = this.strategies.forget.subjects;
|
|
12945
13174
|
if (Object.keys(subjects).length === 0) return;
|
|
@@ -13005,7 +13234,7 @@ var Noydb = class {
|
|
|
13005
13234
|
if (!facade) return;
|
|
13006
13235
|
const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
|
|
13007
13236
|
await registry.runChecks(e.collection, incoming, ctx);
|
|
13008
|
-
const { GuardExecutor } = await import("./executor-
|
|
13237
|
+
const { GuardExecutor } = await import("./executor-DVJAWN3B.js");
|
|
13009
13238
|
for (const g of guards) {
|
|
13010
13239
|
await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
|
|
13011
13240
|
}
|
|
@@ -13051,7 +13280,7 @@ var Noydb = class {
|
|
|
13051
13280
|
const v = this.vaultCache.get(e.vault);
|
|
13052
13281
|
if (!v) return;
|
|
13053
13282
|
const existing = e.op === "create" ? null : { ts: e.existingTs ?? null, record: e.existing ?? null };
|
|
13054
|
-
await v._assertTsWritable(existing, e.incoming);
|
|
13283
|
+
await v._assertTsWritable(existing, e.incoming, e.collection);
|
|
13055
13284
|
});
|
|
13056
13285
|
this.subsystemBus.registerGate("beforeDelete", async (e) => {
|
|
13057
13286
|
if (e.internal) return;
|
|
@@ -13059,7 +13288,8 @@ var Noydb = class {
|
|
|
13059
13288
|
if (!v) return;
|
|
13060
13289
|
await v._assertTsWritable(
|
|
13061
13290
|
{ ts: e.existingTs ?? null, record: e.existing ?? null },
|
|
13062
|
-
null
|
|
13291
|
+
null,
|
|
13292
|
+
e.collection
|
|
13063
13293
|
);
|
|
13064
13294
|
});
|
|
13065
13295
|
}
|
|
@@ -13125,6 +13355,7 @@ var Noydb = class {
|
|
|
13125
13355
|
if (this.options.encrypt !== false && !this.policyCache.has(name)) {
|
|
13126
13356
|
await this.bootstrapPolicy(name);
|
|
13127
13357
|
}
|
|
13358
|
+
const mergeAuthority = buildMergeAuthority(keyring);
|
|
13128
13359
|
let syncEngine;
|
|
13129
13360
|
const targets = normalizeSyncTargets(this.options.sync);
|
|
13130
13361
|
if (targets.length > 0) {
|
|
@@ -13139,11 +13370,12 @@ var Noydb = class {
|
|
|
13139
13370
|
emitter: this.emitter,
|
|
13140
13371
|
syncPolicy: effectivePolicy,
|
|
13141
13372
|
role: primary.role,
|
|
13373
|
+
mergeAuthority,
|
|
13142
13374
|
...primary.label !== void 0 ? { label: primary.label } : {}
|
|
13143
13375
|
});
|
|
13144
13376
|
this.syncEngines.set(name, syncEngine);
|
|
13145
13377
|
if (declaredPolicy) syncEngine.startScheduler();
|
|
13146
|
-
for (const target of targets) {
|
|
13378
|
+
for (const [index, target] of targets.entries()) {
|
|
13147
13379
|
if (target === primary) continue;
|
|
13148
13380
|
const targetPolicy = target.policy ?? this.options.syncPolicy ?? INDEXED_STORE_POLICY;
|
|
13149
13381
|
const engine = this.strategies.sync.buildSyncEngine({
|
|
@@ -13154,10 +13386,10 @@ var Noydb = class {
|
|
|
13154
13386
|
emitter: this.emitter,
|
|
13155
13387
|
syncPolicy: targetPolicy,
|
|
13156
13388
|
role: target.role,
|
|
13389
|
+
mergeAuthority,
|
|
13157
13390
|
...target.label !== void 0 ? { label: target.label } : {}
|
|
13158
13391
|
});
|
|
13159
|
-
|
|
13160
|
-
this.syncEngines.set(key, engine);
|
|
13392
|
+
this.syncEngines.set(`${name}::${index}`, engine);
|
|
13161
13393
|
if (target.policy ?? this.options.syncPolicy) engine.startScheduler();
|
|
13162
13394
|
}
|
|
13163
13395
|
}
|
|
@@ -13378,8 +13610,8 @@ var Noydb = class {
|
|
|
13378
13610
|
* collection) pair that was dropped. Re-run `grant()` for those pairs, or
|
|
13379
13611
|
* they stay locked out.
|
|
13380
13612
|
*
|
|
13381
|
-
* Unlike `revoke(
|
|
13382
|
-
*
|
|
13613
|
+
* Unlike `revoke()`, this call does not REMOVE any user from the vault —
|
|
13614
|
+
* they keep membership and their other collections.
|
|
13383
13615
|
* This is the "just rotate" path; "revoke and rotate" lives in `revoke()`.
|
|
13384
13616
|
*
|
|
13385
13617
|
* Exposed on Noydb (rather than only on the lower-level keyring
|
|
@@ -13390,6 +13622,27 @@ var Noydb = class {
|
|
|
13390
13622
|
async rotate(vault, collections) {
|
|
13391
13623
|
return this.strategies.team.rotate(this.team, vault, collections);
|
|
13392
13624
|
}
|
|
13625
|
+
/**
|
|
13626
|
+
* Verify every `_keyring` file in the vault. Read-only (#1121).
|
|
13627
|
+
*
|
|
13628
|
+
* Names each failing file and why, so the bad one need not be found by trial.
|
|
13629
|
+
* Reports `checked` too: "nothing unverified" is equally true of a sweep that
|
|
13630
|
+
* examined nothing.
|
|
13631
|
+
*/
|
|
13632
|
+
async verifyRoster(vault) {
|
|
13633
|
+
return this.strategies.team.verifyRoster(this.team, vault);
|
|
13634
|
+
}
|
|
13635
|
+
/**
|
|
13636
|
+
* Remove a `_keyring` file that cannot be authenticated, and re-key behind it
|
|
13637
|
+
* (#1121). Owner-only; refuses a file that verifies (use {@link revoke}).
|
|
13638
|
+
*
|
|
13639
|
+
* `revoke` consults the target's own `role`, so it cannot act on a file it
|
|
13640
|
+
* will not trust. This ignores every claim the file makes — which is exactly
|
|
13641
|
+
* why it is restricted to files that already fail authentication.
|
|
13642
|
+
*/
|
|
13643
|
+
async quarantineKeyring(vault, userId, factors) {
|
|
13644
|
+
return this.strategies.team.quarantineKeyring(this.team, vault, userId, factors);
|
|
13645
|
+
}
|
|
13393
13646
|
/** List all users with access to a vault. */
|
|
13394
13647
|
async listUsers(vault) {
|
|
13395
13648
|
return listUsers(this.options.store, vault);
|
|
@@ -13783,6 +14036,21 @@ var Noydb = class {
|
|
|
13783
14036
|
}
|
|
13784
14037
|
return engine.status();
|
|
13785
14038
|
}
|
|
14039
|
+
/**
|
|
14040
|
+
* Per-target sync state for `vault` (#1034) — `syncStatus()` reads only the
|
|
14041
|
+
* primary engine, so it cannot express "the LAN store is behind, the cloud
|
|
14042
|
+
* is current". Registration order, primary first. See {@link SyncTargetStatus}.
|
|
14043
|
+
*/
|
|
14044
|
+
syncTargetStatus(vault) {
|
|
14045
|
+
const targets = [];
|
|
14046
|
+
for (const [key, engine] of this.syncEngines) {
|
|
14047
|
+
if (key !== vault && !key.startsWith(`${vault}::`)) continue;
|
|
14048
|
+
const { dirty, lastPush, lastPull } = engine.status();
|
|
14049
|
+
const { label, role } = engine;
|
|
14050
|
+
targets.push({ label, role, dirty, lastPush, lastPull, caughtUp: dirty === 0 });
|
|
14051
|
+
}
|
|
14052
|
+
return targets;
|
|
14053
|
+
}
|
|
13786
14054
|
/**
|
|
13787
14055
|
* Enumerate the sync targets wired for `vault` (#948) — the primary engine
|
|
13788
14056
|
* (keyed by vault name) plus any additional targets (keyed `vault::label`
|
|
@@ -13805,7 +14073,14 @@ var Noydb = class {
|
|
|
13805
14073
|
getSyncEngine(vault) {
|
|
13806
14074
|
const engine = this.syncEngines.get(vault);
|
|
13807
14075
|
if (!engine) {
|
|
13808
|
-
|
|
14076
|
+
if (this.syncEngines.size === 0) {
|
|
14077
|
+
throw new ValidationError(
|
|
14078
|
+
"No sync adapter configured. Pass a `sync` adapter to createNoydb() \u2014 a NoydbStore, a SyncTarget (`{ store, role }`), or an array of them \u2014 and `syncStrategy: withSync()` to enable the engine."
|
|
14079
|
+
);
|
|
14080
|
+
}
|
|
14081
|
+
throw new ValidationError(
|
|
14082
|
+
`No sync engine for vault "${String(vault)}". Sync is configured, but for [${[...this.syncEngines.keys()].map((k) => `"${k}"`).join(", ")}] \u2014 an engine is built per vault when it is opened, so open this vault first. Note the vault name is a REQUIRED argument: \`db.pull(vaultName)\`, not \`db.pull()\`.`
|
|
14083
|
+
);
|
|
13809
14084
|
}
|
|
13810
14085
|
return engine;
|
|
13811
14086
|
}
|
|
@@ -13990,8 +14265,11 @@ var Noydb = class {
|
|
|
13990
14265
|
* No-op when `vault` is not currently in cache (idempotent).
|
|
13991
14266
|
*/
|
|
13992
14267
|
lockVault(vault) {
|
|
13993
|
-
this.syncEngines
|
|
13994
|
-
|
|
14268
|
+
for (const [key, engine] of [...this.syncEngines]) {
|
|
14269
|
+
if (key !== vault && !key.startsWith(`${vault}::`)) continue;
|
|
14270
|
+
engine.stopAutoSync();
|
|
14271
|
+
this.syncEngines.delete(key);
|
|
14272
|
+
}
|
|
13995
14273
|
this.policyEnforcers.get(vault)?.destroy();
|
|
13996
14274
|
this.policyEnforcers.delete(vault);
|
|
13997
14275
|
this.vaultCache.get(vault)?._stopFenceCoordination();
|
|
@@ -14328,7 +14606,7 @@ async function createNoydb(options) {
|
|
|
14328
14606
|
if (!options.store) options = { ...options, store: memoryStore() };
|
|
14329
14607
|
validateSecretModeOptions(options);
|
|
14330
14608
|
if (!options.coordinationStrategy) options = { ...options, coordinationStrategy: await createDefaultCoordinationProvider(options.store) };
|
|
14331
|
-
if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-
|
|
14609
|
+
if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-EYNT6KGS.js")).createUserApi };
|
|
14332
14610
|
if (!options.policyFactory) {
|
|
14333
14611
|
const policyModule = await import("./policy/index.js");
|
|
14334
14612
|
options = { ...options, policyFactory: policyModule.createNoydbPolicy, policyCheckGateFn: policyModule.checkGate };
|
|
@@ -14363,4 +14641,4 @@ export {
|
|
|
14363
14641
|
Noydb,
|
|
14364
14642
|
createNoydb
|
|
14365
14643
|
};
|
|
14366
|
-
//# sourceMappingURL=chunk-
|
|
14644
|
+
//# sourceMappingURL=chunk-LGFTOU27.js.map
|