@noy-db/hub 0.6.0-pre.1 → 0.6.0-pre.11
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/codemods/0.4.0-pre.json +699 -0
- package/dist/{api-67SBPMMH.js → api-RXUMEKT3.js} +6 -6
- package/dist/attestation/index.js +12 -12
- package/dist/attestation/index.js.map +1 -1
- package/dist/{backup-GAYWQAFN.js → backup-AVAGHAJE.js} +25 -6
- package/dist/backup-AVAGHAJE.js.map +1 -0
- package/dist/blobs/index.js +5 -5
- package/dist/broker/index.js +6 -6
- package/dist/{bundle-handle-5OUAI7CV.js → bundle-handle-GFNHT52M.js} +2 -2
- package/dist/cargo/index.js +18 -18
- package/dist/{chunk-CYQOUTMY.js → chunk-2BMRJ6LQ.js} +2 -2
- package/dist/{chunk-HS7HNYBD.js → chunk-2DHSSLOD.js} +6 -6
- package/dist/{chunk-JH3OHQM4.js → chunk-2Z3NCLNX.js} +6 -6
- package/dist/{chunk-NVU7ZMPN.js → chunk-3IXIU6FP.js} +2 -2
- package/dist/{chunk-XBLKM73C.js → chunk-3JVXVJ7L.js} +8 -8
- package/dist/{chunk-FY343IZR.js → chunk-3URQC7EH.js} +3 -3
- package/dist/{chunk-BPTZ4K5L.js → chunk-4GZ6XOVW.js} +7 -7
- package/dist/{chunk-ROWL352P.js → chunk-4I72F5DF.js} +4 -4
- package/dist/{chunk-EK7DT5BT.js → chunk-4VUPLMZ6.js} +39 -3
- package/dist/chunk-4VUPLMZ6.js.map +1 -0
- package/dist/{chunk-LBGPO5RL.js → chunk-52JPHN5N.js} +4 -4
- package/dist/{chunk-27TCYH6G.js → chunk-5JY5TSVY.js} +3 -3
- package/dist/{chunk-27TCYH6G.js.map → chunk-5JY5TSVY.js.map} +1 -1
- package/dist/chunk-5O5HRRTV.js +201 -0
- package/dist/chunk-5O5HRRTV.js.map +1 -0
- package/dist/{chunk-ZXJXDHNK.js → chunk-5ZKS6ZE2.js} +2 -2
- package/dist/{chunk-ZXJXDHNK.js.map → chunk-5ZKS6ZE2.js.map} +1 -1
- package/dist/{chunk-MVOWXQHN.js → chunk-6BU3L4UE.js} +2 -2
- package/dist/{chunk-3IIPWA75.js → chunk-6BVER473.js} +28 -3
- package/dist/chunk-6BVER473.js.map +1 -0
- package/dist/{chunk-OSFPNKY4.js → chunk-6FJWSWFT.js} +2 -2
- package/dist/chunk-6FJWSWFT.js.map +1 -0
- package/dist/{chunk-CJ73OLMW.js → chunk-6HFM7EIT.js} +1 -1
- package/dist/chunk-6HFM7EIT.js.map +1 -0
- package/dist/{chunk-PGAPBZEK.js → chunk-6NVPFKN3.js} +4 -4
- package/dist/{chunk-24UICKTB.js → chunk-6SAFL5YE.js} +2 -2
- package/dist/chunk-6SAFL5YE.js.map +1 -0
- package/dist/{chunk-NQRJ5AJO.js → chunk-7H73RIE3.js} +2 -2
- package/dist/{chunk-NQCNSVGI.js → chunk-7MNBICB5.js} +3 -3
- package/dist/{chunk-T4GPR2IR.js → chunk-7TSYBD3E.js} +1 -1
- package/dist/chunk-7TSYBD3E.js.map +1 -0
- package/dist/{chunk-TLNNHG3A.js → chunk-ADW22QSB.js} +3 -3
- package/dist/{chunk-TLNNHG3A.js.map → chunk-ADW22QSB.js.map} +1 -1
- package/dist/{chunk-3737A6EA.js → chunk-BGQ63MCT.js} +74 -17
- package/dist/chunk-BGQ63MCT.js.map +1 -0
- package/dist/{chunk-TFZ7LLOQ.js → chunk-BRVW2GS5.js} +5 -5
- package/dist/{chunk-3UK6STWO.js → chunk-CBXHHCZT.js} +3 -3
- package/dist/{chunk-MXZ5TSTR.js → chunk-CCVYQFLU.js} +6 -6
- package/dist/{chunk-V5C5NNBR.js → chunk-CDB2HVQW.js} +3 -3
- package/dist/{chunk-3HYWYLXL.js → chunk-CEJWMBXO.js} +1 -1
- package/dist/chunk-CEJWMBXO.js.map +1 -0
- package/dist/{chunk-2KIV7BEK.js → chunk-FDX7OWWI.js} +1 -1
- package/dist/chunk-FDX7OWWI.js.map +1 -0
- package/dist/{chunk-4MQDV3HZ.js → chunk-FFDNKRCY.js} +2 -2
- package/dist/{chunk-PP5CO2PR.js → chunk-FMQJZH4R.js} +2 -2
- package/dist/{chunk-JSRU5W2M.js → chunk-FZ6NYJ7L.js} +3 -3
- package/dist/{chunk-ZGGVOADG.js → chunk-G6S5VVHP.js} +2 -2
- package/dist/{chunk-OMSAULZM.js → chunk-GU7A7MQA.js} +9 -9
- package/dist/{chunk-E6427JU2.js → chunk-H4YQSDOI.js} +17 -1
- package/dist/chunk-H4YQSDOI.js.map +1 -0
- package/dist/{chunk-JXIDGFKS.js → chunk-HPLWFNG4.js} +3 -1
- package/dist/chunk-HPLWFNG4.js.map +1 -0
- package/dist/{chunk-ZWMO5GL5.js → chunk-JJNOLSG5.js} +3 -3
- package/dist/{chunk-RLWY6Z44.js → chunk-JRKZTEZZ.js} +62 -6
- package/dist/chunk-JRKZTEZZ.js.map +1 -0
- package/dist/chunk-N35NC4JH.js +123 -0
- package/dist/chunk-N35NC4JH.js.map +1 -0
- package/dist/{chunk-SRGJET2F.js → chunk-NJDQ4YSV.js} +2 -2
- package/dist/{chunk-JEM2IGS3.js → chunk-NPP5R7FF.js} +5 -5
- package/dist/{chunk-DPJTDNUF.js → chunk-O2ERS4UJ.js} +5 -5
- package/dist/{chunk-F3GVO44K.js → chunk-PDLLCOGD.js} +3 -3
- package/dist/{chunk-VBY6ZLJT.js → chunk-PL2GHSCM.js} +3 -3
- package/dist/{chunk-DCMQR46R.js → chunk-PNKHAKQ7.js} +3 -3
- package/dist/{chunk-ZK4CO2KZ.js → chunk-Q6TEJXBX.js} +4 -4
- package/dist/{chunk-GS5RT2KK.js → chunk-QULVCV3M.js} +2 -2
- package/dist/chunk-QULVCV3M.js.map +1 -0
- package/dist/{chunk-KZ3KMDN3.js → chunk-RTAMLDWP.js} +6 -2
- package/dist/chunk-RTAMLDWP.js.map +1 -0
- package/dist/{chunk-MZ5ZFO2D.js → chunk-RXYYFSBB.js} +82 -110
- package/dist/chunk-RXYYFSBB.js.map +1 -0
- package/dist/{chunk-4VCWI42L.js → chunk-SUFG5E73.js} +2 -2
- package/dist/{chunk-SKONR2OL.js → chunk-U5O6GIWZ.js} +2 -2
- package/dist/{chunk-3CLZY46Y.js → chunk-UV4O7FAL.js} +296 -110
- package/dist/chunk-UV4O7FAL.js.map +1 -0
- package/dist/{chunk-HFKGIBMD.js → chunk-VZ3XFUQ7.js} +2 -2
- package/dist/{chunk-3EO7RZLJ.js → chunk-W77KZHCW.js} +4 -4
- package/dist/{chunk-P7NGLLUF.js → chunk-WASHZV34.js} +2 -2
- package/dist/{chunk-XB7LUDKM.js → chunk-WFUIE565.js} +3 -3
- package/dist/{chunk-RPXL6KSX.js → chunk-WLZ47GSL.js} +3 -3
- package/dist/{chunk-MJWCLSQL.js → chunk-X56RTUK3.js} +3 -3
- package/dist/{chunk-MC2LFTQM.js → chunk-XWX7GL56.js} +2 -2
- package/dist/{chunk-46V67XP5.js → chunk-YJ6IONGA.js} +2 -2
- package/dist/chunk-YJ6IONGA.js.map +1 -0
- package/dist/{chunk-24ZLWWEO.js → chunk-YPYHVOXP.js} +1 -1
- package/dist/chunk-YPYHVOXP.js.map +1 -0
- package/dist/{chunk-2LGDCNFJ.js → chunk-Z45YRGFO.js} +1 -1
- package/dist/chunk-Z45YRGFO.js.map +1 -0
- package/dist/classified/index.js +3 -3
- package/dist/{classified-marker-MH3ON5OL.js → classified-marker-2KJAXRRO.js} +3 -3
- package/dist/{collection-facade-AHT7FATG.js → collection-facade-QEJIM6BC.js} +8 -8
- package/dist/consent/index.js +4 -4
- package/dist/cover/index.js +2 -2
- package/dist/custody/index.js +6 -6
- package/dist/{dead-filter-U575NGSH.js → dead-filter-DCB62VWW.js} +2 -2
- package/dist/{delegation-PDYL6RWT.js → delegation-MO7YZYJS.js} +4 -4
- package/dist/derivations/index.js +6 -6
- package/dist/{derive-AKT4KU36.js → derive-IUA6JFLB.js} +5 -5
- package/dist/directory/index.js +5 -5
- package/dist/{dispatch-4XIJSFTT.js → dispatch-23SKSHPD.js} +5 -5
- package/dist/{dispatch-N5HGVUGU.js → dispatch-MJ6SHB3Y.js} +9 -9
- package/dist/{enclave-OPK24QDR.js → enclave-JU4YIEPB.js} +4 -4
- package/dist/{executor-3JZ4POTW.js → executor-FKZURXVV.js} +10 -9
- package/dist/{export-accessible-CPTP5STN.js → export-accessible-4S36PQNR.js} +7 -7
- package/dist/{extract-partition-TWXPHVU7.js → extract-partition-IO7FDZ2P.js} +10 -10
- package/dist/{fanout-sidecar-T2ZGLQFE.js → fanout-sidecar-NNAJQXMX.js} +4 -4
- package/dist/forget/index.js +4 -4
- package/dist/guards/index.js +1 -1
- package/dist/history/index.js +6 -6
- package/dist/i18n/index.js +6 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +71 -65
- package/dist/index.js.map +1 -1
- package/dist/introspection/index.js +6 -6
- package/dist/{issue-N74C55X6.js → issue-RIVHSY2S.js} +6 -6
- package/dist/kernel/query/builder.d.ts +15 -2
- package/dist/kernel/query/join.d.ts +27 -0
- package/dist/kernel/secret-mode.d.ts +1 -1
- package/dist/kernel/types.d.ts +41 -6
- package/dist/kernel/vault.d.ts +19 -15
- package/dist/{ledger-DONWFC5M.js → ledger-AETNF4OM.js} +6 -6
- package/dist/liberate-GFN4C7RR.js +24 -0
- package/dist/{link-set-2TTP4VLO.js → link-set-E5HNY67I.js} +5 -5
- package/dist/{managed-secret-EAOYWRYF.js → managed-secret-CWQ6PND5.js} +3 -3
- package/dist/materialized-views/index.js +11 -10
- package/dist/money/index.js +10 -6
- package/dist/{noydb-6W2XGQCS.js → noydb-FYTCH2GD.js} +30 -30
- package/dist/overlay-views/index.js +1 -1
- package/dist/periods/index.js +17 -7
- package/dist/pod/index.js +33 -33
- package/dist/policy/index.js +3 -3
- package/dist/port/to/index.d.ts +2 -2
- package/dist/port/to/locator.d.ts +54 -8
- package/dist/port/with/collection-options.d.ts +1 -1
- package/dist/portability/index.js +6 -6
- package/dist/{post-register-ORQOQJCS.js → post-register-2XSSMGEQ.js} +4 -4
- package/dist/query/index.js +2 -2
- package/dist/{register-LHETZRJM.js → register-4EFJCVYD.js} +11 -11
- package/dist/{registry-JRIN447B.js → registry-4SDHHOJ7.js} +6 -6
- package/dist/{registry-AMAZ6QRZ.js → registry-OYTFGWVK.js} +4 -4
- package/dist/{request-withdrawal-2DN2RGCO.js → request-withdrawal-KGXGDPVQ.js} +9 -9
- package/dist/{reveal-AG4SCHUQ.js → reveal-BW36KCOQ.js} +3 -3
- package/dist/{revoke-ZX4NM2CJ.js → revoke-JFN773KF.js} +6 -6
- package/dist/sealed-record/index.js +6 -6
- package/dist/search/index.js +1 -1
- package/dist/{seed-IRCDGIRK.js → seed-GDV5PT4R.js} +6 -6
- package/dist/sequence/index.js +4 -4
- package/dist/session/index.js +3 -3
- package/dist/{signer-7KHD4OL2.js → signer-TA55QB6R.js} +5 -5
- package/dist/snapshots/index.js +5 -5
- package/dist/{stale-K734VACF.js → stale-4PUTWI2H.js} +5 -5
- package/dist/{storage-4H2GF6RQ.js → storage-V7MTFAQJ.js} +5 -5
- package/dist/{store-coordination-provider-4SKLSFUG.js → store-coordination-provider-GFCUOBR6.js} +3 -3
- package/dist/sync/index.js +5 -5
- package/dist/team/index.js +8 -8
- package/dist/tiers/index.js +4 -4
- package/dist/to/index.js +16 -6
- package/dist/to/index.js.map +1 -1
- package/dist/via/classified/descriptor.d.ts +1 -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-MQHYNDLZ.js → walk-3ZECBFDA.js} +7 -7
- package/dist/with-audit/attestation/index.d.ts +1 -1
- package/dist/with-audit/guards/immutable-guard.d.ts +14 -0
- package/dist/with-audit/guards/with-guard.d.ts +1 -1
- 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 +160 -5
- package/dist/with-audit/periods/strategy.d.ts +13 -4
- package/dist/with-audit/periods/vault-facade.d.ts +89 -10
- package/dist/with-audit/periods/window.d.ts +10 -0
- package/dist/with-cargo/index.d.ts +2 -2
- package/dist/with-commit/history/ledger/entry.d.ts +1 -1
- package/dist/with-commit/numbering/descriptor.d.ts +1 -1
- package/dist/with-formula/derivations/with-derivation.d.ts +1 -1
- package/dist/with-formula/materialized-views/types.d.ts +52 -0
- package/dist/with-formula/materialized-views/with-materialized-view.d.ts +3 -3
- package/dist/with-formula/overlay-views/with-overlayed-view.d.ts +1 -1
- package/dist/with-party/custody/index.d.ts +1 -1
- package/dist/with-party/directory/user-envelope/index.d.ts +1 -1
- package/dist/with-party/directory/user-envelope/storage.d.ts +1 -1
- package/dist/with-party/team/echo-ceremony.d.ts +3 -3
- package/dist/with-party/team/echo-secret.d.ts +2 -2
- package/dist/with-party/team/keyring.d.ts +10 -1
- package/dist/with-pod/bundle.d.ts +15 -0
- package/dist/with-shape/introspection/index.d.ts +2 -1
- package/dist/with-shape/introspection/types.d.ts +1 -1
- package/dist/with-shape/persisted-schemas/derive.d.ts +1 -1
- package/dist/with-shape/persisted-schemas/index.d.ts +1 -1
- package/dist/with-shape/persisted-schemas/types.d.ts +1 -1
- package/dist/{withdraw-accessible-JSDQHXHE.js → withdraw-accessible-7PG4DYQK.js} +8 -8
- package/package.json +6 -4
- package/dist/backup-GAYWQAFN.js.map +0 -1
- package/dist/chunk-24UICKTB.js.map +0 -1
- package/dist/chunk-24ZLWWEO.js.map +0 -1
- package/dist/chunk-2KIV7BEK.js.map +0 -1
- package/dist/chunk-2LGDCNFJ.js.map +0 -1
- package/dist/chunk-3737A6EA.js.map +0 -1
- package/dist/chunk-3CLZY46Y.js.map +0 -1
- package/dist/chunk-3HYWYLXL.js.map +0 -1
- package/dist/chunk-3IIPWA75.js.map +0 -1
- package/dist/chunk-46V67XP5.js.map +0 -1
- package/dist/chunk-CJ73OLMW.js.map +0 -1
- package/dist/chunk-E6427JU2.js.map +0 -1
- package/dist/chunk-EK7DT5BT.js.map +0 -1
- package/dist/chunk-GS5RT2KK.js.map +0 -1
- package/dist/chunk-JXIDGFKS.js.map +0 -1
- package/dist/chunk-KZ3KMDN3.js.map +0 -1
- package/dist/chunk-LTU4FLHG.js +0 -131
- package/dist/chunk-LTU4FLHG.js.map +0 -1
- package/dist/chunk-MZ5ZFO2D.js.map +0 -1
- package/dist/chunk-OSFPNKY4.js.map +0 -1
- package/dist/chunk-RLWY6Z44.js.map +0 -1
- package/dist/chunk-T4GPR2IR.js.map +0 -1
- package/dist/liberate-KICI7AJN.js +0 -24
- /package/dist/{api-67SBPMMH.js.map → api-RXUMEKT3.js.map} +0 -0
- /package/dist/{bundle-handle-5OUAI7CV.js.map → bundle-handle-GFNHT52M.js.map} +0 -0
- /package/dist/{chunk-CYQOUTMY.js.map → chunk-2BMRJ6LQ.js.map} +0 -0
- /package/dist/{chunk-HS7HNYBD.js.map → chunk-2DHSSLOD.js.map} +0 -0
- /package/dist/{chunk-JH3OHQM4.js.map → chunk-2Z3NCLNX.js.map} +0 -0
- /package/dist/{chunk-NVU7ZMPN.js.map → chunk-3IXIU6FP.js.map} +0 -0
- /package/dist/{chunk-XBLKM73C.js.map → chunk-3JVXVJ7L.js.map} +0 -0
- /package/dist/{chunk-FY343IZR.js.map → chunk-3URQC7EH.js.map} +0 -0
- /package/dist/{chunk-BPTZ4K5L.js.map → chunk-4GZ6XOVW.js.map} +0 -0
- /package/dist/{chunk-ROWL352P.js.map → chunk-4I72F5DF.js.map} +0 -0
- /package/dist/{chunk-LBGPO5RL.js.map → chunk-52JPHN5N.js.map} +0 -0
- /package/dist/{chunk-MVOWXQHN.js.map → chunk-6BU3L4UE.js.map} +0 -0
- /package/dist/{chunk-PGAPBZEK.js.map → chunk-6NVPFKN3.js.map} +0 -0
- /package/dist/{chunk-NQRJ5AJO.js.map → chunk-7H73RIE3.js.map} +0 -0
- /package/dist/{chunk-NQCNSVGI.js.map → chunk-7MNBICB5.js.map} +0 -0
- /package/dist/{chunk-TFZ7LLOQ.js.map → chunk-BRVW2GS5.js.map} +0 -0
- /package/dist/{chunk-3UK6STWO.js.map → chunk-CBXHHCZT.js.map} +0 -0
- /package/dist/{chunk-MXZ5TSTR.js.map → chunk-CCVYQFLU.js.map} +0 -0
- /package/dist/{chunk-V5C5NNBR.js.map → chunk-CDB2HVQW.js.map} +0 -0
- /package/dist/{chunk-4MQDV3HZ.js.map → chunk-FFDNKRCY.js.map} +0 -0
- /package/dist/{chunk-PP5CO2PR.js.map → chunk-FMQJZH4R.js.map} +0 -0
- /package/dist/{chunk-JSRU5W2M.js.map → chunk-FZ6NYJ7L.js.map} +0 -0
- /package/dist/{chunk-ZGGVOADG.js.map → chunk-G6S5VVHP.js.map} +0 -0
- /package/dist/{chunk-OMSAULZM.js.map → chunk-GU7A7MQA.js.map} +0 -0
- /package/dist/{chunk-ZWMO5GL5.js.map → chunk-JJNOLSG5.js.map} +0 -0
- /package/dist/{chunk-SRGJET2F.js.map → chunk-NJDQ4YSV.js.map} +0 -0
- /package/dist/{chunk-JEM2IGS3.js.map → chunk-NPP5R7FF.js.map} +0 -0
- /package/dist/{chunk-DPJTDNUF.js.map → chunk-O2ERS4UJ.js.map} +0 -0
- /package/dist/{chunk-F3GVO44K.js.map → chunk-PDLLCOGD.js.map} +0 -0
- /package/dist/{chunk-VBY6ZLJT.js.map → chunk-PL2GHSCM.js.map} +0 -0
- /package/dist/{chunk-DCMQR46R.js.map → chunk-PNKHAKQ7.js.map} +0 -0
- /package/dist/{chunk-ZK4CO2KZ.js.map → chunk-Q6TEJXBX.js.map} +0 -0
- /package/dist/{chunk-4VCWI42L.js.map → chunk-SUFG5E73.js.map} +0 -0
- /package/dist/{chunk-SKONR2OL.js.map → chunk-U5O6GIWZ.js.map} +0 -0
- /package/dist/{chunk-HFKGIBMD.js.map → chunk-VZ3XFUQ7.js.map} +0 -0
- /package/dist/{chunk-3EO7RZLJ.js.map → chunk-W77KZHCW.js.map} +0 -0
- /package/dist/{chunk-P7NGLLUF.js.map → chunk-WASHZV34.js.map} +0 -0
- /package/dist/{chunk-XB7LUDKM.js.map → chunk-WFUIE565.js.map} +0 -0
- /package/dist/{chunk-RPXL6KSX.js.map → chunk-WLZ47GSL.js.map} +0 -0
- /package/dist/{chunk-MJWCLSQL.js.map → chunk-X56RTUK3.js.map} +0 -0
- /package/dist/{chunk-MC2LFTQM.js.map → chunk-XWX7GL56.js.map} +0 -0
- /package/dist/{classified-marker-MH3ON5OL.js.map → classified-marker-2KJAXRRO.js.map} +0 -0
- /package/dist/{collection-facade-AHT7FATG.js.map → collection-facade-QEJIM6BC.js.map} +0 -0
- /package/dist/{dead-filter-U575NGSH.js.map → dead-filter-DCB62VWW.js.map} +0 -0
- /package/dist/{delegation-PDYL6RWT.js.map → delegation-MO7YZYJS.js.map} +0 -0
- /package/dist/{derive-AKT4KU36.js.map → derive-IUA6JFLB.js.map} +0 -0
- /package/dist/{dispatch-4XIJSFTT.js.map → dispatch-23SKSHPD.js.map} +0 -0
- /package/dist/{dispatch-N5HGVUGU.js.map → dispatch-MJ6SHB3Y.js.map} +0 -0
- /package/dist/{enclave-OPK24QDR.js.map → enclave-JU4YIEPB.js.map} +0 -0
- /package/dist/{executor-3JZ4POTW.js.map → executor-FKZURXVV.js.map} +0 -0
- /package/dist/{export-accessible-CPTP5STN.js.map → export-accessible-4S36PQNR.js.map} +0 -0
- /package/dist/{extract-partition-TWXPHVU7.js.map → extract-partition-IO7FDZ2P.js.map} +0 -0
- /package/dist/{fanout-sidecar-T2ZGLQFE.js.map → fanout-sidecar-NNAJQXMX.js.map} +0 -0
- /package/dist/{issue-N74C55X6.js.map → issue-RIVHSY2S.js.map} +0 -0
- /package/dist/{ledger-DONWFC5M.js.map → ledger-AETNF4OM.js.map} +0 -0
- /package/dist/{liberate-KICI7AJN.js.map → liberate-GFN4C7RR.js.map} +0 -0
- /package/dist/{link-set-2TTP4VLO.js.map → link-set-E5HNY67I.js.map} +0 -0
- /package/dist/{managed-secret-EAOYWRYF.js.map → managed-secret-CWQ6PND5.js.map} +0 -0
- /package/dist/{noydb-6W2XGQCS.js.map → noydb-FYTCH2GD.js.map} +0 -0
- /package/dist/{post-register-ORQOQJCS.js.map → post-register-2XSSMGEQ.js.map} +0 -0
- /package/dist/{register-LHETZRJM.js.map → register-4EFJCVYD.js.map} +0 -0
- /package/dist/{registry-AMAZ6QRZ.js.map → registry-4SDHHOJ7.js.map} +0 -0
- /package/dist/{registry-JRIN447B.js.map → registry-OYTFGWVK.js.map} +0 -0
- /package/dist/{request-withdrawal-2DN2RGCO.js.map → request-withdrawal-KGXGDPVQ.js.map} +0 -0
- /package/dist/{reveal-AG4SCHUQ.js.map → reveal-BW36KCOQ.js.map} +0 -0
- /package/dist/{revoke-ZX4NM2CJ.js.map → revoke-JFN773KF.js.map} +0 -0
- /package/dist/{seed-IRCDGIRK.js.map → seed-GDV5PT4R.js.map} +0 -0
- /package/dist/{signer-7KHD4OL2.js.map → signer-TA55QB6R.js.map} +0 -0
- /package/dist/{stale-K734VACF.js.map → stale-4PUTWI2H.js.map} +0 -0
- /package/dist/{storage-4H2GF6RQ.js.map → storage-V7MTFAQJ.js.map} +0 -0
- /package/dist/{store-coordination-provider-4SKLSFUG.js.map → store-coordination-provider-GFCUOBR6.js.map} +0 -0
- /package/dist/{walk-MQHYNDLZ.js.map → walk-3ZECBFDA.js.map} +0 -0
- /package/dist/{withdraw-accessible-JSDQHXHE.js.map → withdraw-accessible-7PG4DYQK.js.map} +0 -0
|
@@ -3,7 +3,31 @@ import type { NoydbStore } from '../../kernel/types.js';
|
|
|
3
3
|
import type { LedgerStore } from '../../with-commit/history/ledger/store.js';
|
|
4
4
|
import type { Collection } from '../../kernel/collection.js';
|
|
5
5
|
import type { PeriodsStrategy } from './strategy.js';
|
|
6
|
-
import { type PeriodRecord, type TargetPurgeCount, type ClosePeriodOptions, type OpenPeriodOptions } from './periods.js';
|
|
6
|
+
import { type PeriodRecord, type TargetPurgeCount, type ClosePeriodOptions, type OpenPeriodOptions, type PeriodPartition, type PeriodReopenEvent } from './periods.js';
|
|
7
|
+
/** Selects one period timeline. Omit — or pass an empty tuple — for the vault-wide one (#1005). */
|
|
8
|
+
export interface PeriodScope {
|
|
9
|
+
readonly partition?: PeriodPartition;
|
|
10
|
+
}
|
|
11
|
+
/** A scoped operation that also records a free-text justification in the audit trail. */
|
|
12
|
+
export interface PeriodScopeWithReason extends PeriodScope {
|
|
13
|
+
readonly reason?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Options for `vault.reopenPeriod()` (#1022). */
|
|
16
|
+
export interface ReopenPeriodOptions extends PeriodScopeWithReason {
|
|
17
|
+
/**
|
|
18
|
+
* ISO instant after which the period re-seals BY ITSELF, with nobody acting.
|
|
19
|
+
* Omit for a window that stays open until an explicit `reclosePeriod()`.
|
|
20
|
+
*
|
|
21
|
+
* Expiry is evaluated against the clock on every write check, so a lapsed
|
|
22
|
+
* window needs no sweep, no timer and no cache invalidation to take effect.
|
|
23
|
+
*/
|
|
24
|
+
readonly until?: string;
|
|
25
|
+
}
|
|
26
|
+
/** The persisted side of a write, as the period write-guard sees it. */
|
|
27
|
+
export interface PeriodGuardPrior {
|
|
28
|
+
readonly ts: string | null;
|
|
29
|
+
readonly record: Record<string, unknown> | null;
|
|
30
|
+
}
|
|
7
31
|
/** Everything the moving period methods touched on the vault's `this.*`. */
|
|
8
32
|
export interface VaultPeriodsDeps {
|
|
9
33
|
/** Resolved periods strategy (NO_PERIODS when not configured). */
|
|
@@ -56,7 +80,7 @@ export declare class VaultPeriods {
|
|
|
56
80
|
* read only. Idempotent: a second call is a no-op that returns the
|
|
57
81
|
* same merged record without re-purging or re-appending a ledger entry.
|
|
58
82
|
*/
|
|
59
|
-
freezePeriod(name: string): Promise<PeriodRecord>;
|
|
83
|
+
freezePeriod(name: string, options?: PeriodScope): Promise<PeriodRecord>;
|
|
60
84
|
/**
|
|
61
85
|
* Archive a closed period (#613): physically relocates its in-window
|
|
62
86
|
* records (those with `_ts < periodExclusiveUpperBound(endDate)`) from the
|
|
@@ -66,7 +90,7 @@ export declare class VaultPeriods {
|
|
|
66
90
|
* through to cold) and idempotent: a second call is a no-op returning the
|
|
67
91
|
* same merged record.
|
|
68
92
|
*/
|
|
69
|
-
archivePeriod(name: string): Promise<PeriodRecord>;
|
|
93
|
+
archivePeriod(name: string, options?: PeriodScope): Promise<PeriodRecord>;
|
|
70
94
|
/**
|
|
71
95
|
* Target-purge a closed period (#615): sweeps delete markers off the vault's
|
|
72
96
|
* PUSH-ONLY sync targets (`backup`/`archive`) via `purgeTargets`, recording a
|
|
@@ -76,22 +100,77 @@ export declare class VaultPeriods {
|
|
|
76
100
|
* Idempotent once run; with no push-only targets it writes no companion and
|
|
77
101
|
* is re-runnable.
|
|
78
102
|
*/
|
|
79
|
-
purgePeriodTargets(name: string): Promise<PeriodRecord>;
|
|
103
|
+
purgePeriodTargets(name: string, options?: PeriodScope): Promise<PeriodRecord>;
|
|
80
104
|
/** Merge target-purge companion fields into a fresh `PeriodRecord` copy — never mutates `periodCache`. */
|
|
81
105
|
private mergeTargetPurge;
|
|
82
106
|
/** Merge archive companion fields into a fresh `PeriodRecord` copy — never mutates `periodCache`. */
|
|
83
107
|
private mergeArchive;
|
|
84
108
|
/** Merge freeze companion fields into a fresh `PeriodRecord` copy — never mutates `periodCache`. */
|
|
85
109
|
private mergeFreeze;
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Return every closed / opened period in `closedAt` order, merged with any
|
|
112
|
+
* freeze + archive companions.
|
|
113
|
+
*
|
|
114
|
+
* With no argument this spans EVERY timeline — the pre-#1005 behaviour, and
|
|
115
|
+
* the right default for an audit sweep. Pass `{ partition }` to scope to one
|
|
116
|
+
* timeline; `{ partition: [] }` (or omitting it) means the vault-wide one.
|
|
117
|
+
*/
|
|
118
|
+
listPeriods(options?: PeriodScope): Promise<readonly PeriodRecord[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Look up a single period by name within one timeline, merged with its
|
|
121
|
+
* freeze + archive + target-purge companions if any. Returns `null` if not
|
|
122
|
+
* found.
|
|
123
|
+
*
|
|
124
|
+
* Names are only unique per partition (#1005), so this resolves against the
|
|
125
|
+
* VAULT-WIDE timeline unless `{ partition }` says otherwise — matching how
|
|
126
|
+
* every pre-partition period is stored.
|
|
127
|
+
*/
|
|
128
|
+
getPeriod(name: string, options?: PeriodScope): Promise<PeriodRecord | null>;
|
|
129
|
+
/**
|
|
130
|
+
* The full append-only reopen/reclose log for one period (#1022) — the record
|
|
131
|
+
* an audit actually asks for, in order. `[]` when never reopened.
|
|
132
|
+
*/
|
|
133
|
+
listPeriodReopens(name: string, options?: PeriodScope): Promise<readonly PeriodReopenEvent[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Return a closed period to a writable state (#1022).
|
|
136
|
+
*
|
|
137
|
+
* Close is a three-state lifecycle in practice — open / closed / reopened —
|
|
138
|
+
* because a month gets closed and then a missing invoice arrives, or a filing
|
|
139
|
+
* is rejected and must be amended. That is routine, and it is supposed to
|
|
140
|
+
* leave a trail.
|
|
141
|
+
*
|
|
142
|
+
* The `_periods/<key>` record is NOT touched: the reopen is appended to a
|
|
143
|
+
* companion log, so the inter-period hash chain that proves the close
|
|
144
|
+
* happened survives the reopen intact. The chain reads *closed at T1,
|
|
145
|
+
* reopened at T2 by U, reclosed at T3*.
|
|
146
|
+
*
|
|
147
|
+
* A reopen withdraws the PERIOD's veto and nothing else. Record-level rules —
|
|
148
|
+
* an `immutableGuard` on a sent receipt, a frozen field — are separate gate
|
|
149
|
+
* handlers registered ahead of the period gate, so a reopened month cannot
|
|
150
|
+
* resurrect a document that is independently locked. Period state can only
|
|
151
|
+
* ever widen what the record-level rule already permits.
|
|
152
|
+
*
|
|
153
|
+
* Reopening an already-open window is allowed and appends another event: that
|
|
154
|
+
* is how a window gets extended, and the log keeps both.
|
|
155
|
+
*/
|
|
156
|
+
reopenPeriod(name: string, options?: ReopenPeriodOptions): Promise<PeriodRecord>;
|
|
157
|
+
/**
|
|
158
|
+
* Seal a reopened period again (#1022), ending the window explicitly rather
|
|
159
|
+
* than waiting for an `until` to lapse. Appends to the same log, so the
|
|
160
|
+
* close → reopen → reclose sequence is recoverable in order.
|
|
161
|
+
*/
|
|
162
|
+
reclosePeriod(name: string, options?: PeriodScopeWithReason): Promise<PeriodRecord>;
|
|
163
|
+
/** Append one entry to a period's reopen log, ledger it, and invalidate the guard's view. */
|
|
164
|
+
private appendReopenEvent;
|
|
165
|
+
/** Merge each period's reopen log onto it. One adapter listing, not one per period. */
|
|
166
|
+
private mergeReopenState;
|
|
167
|
+
/** Resolve one period within the timeline named by `options` (vault-wide when absent). */
|
|
168
|
+
private findPeriod;
|
|
169
|
+
/** Called by the gate bus before put/delete. `collection` selects the subject mapping (#1005). */
|
|
91
170
|
assertTsWritable(existing: {
|
|
92
171
|
ts: string | null;
|
|
93
172
|
record: Record<string, unknown> | null;
|
|
94
|
-
} | null, incoming: Record<string, unknown> | null): Promise<void>;
|
|
173
|
+
} | null, incoming: Record<string, unknown> | null, collection?: string): Promise<void>;
|
|
95
174
|
private loadPeriodsCache;
|
|
96
175
|
/** Generic reserved-collection writer — serves `_periods` and `_period_freezes` alike. */
|
|
97
176
|
private writeReserved;
|
|
@@ -6,6 +6,16 @@ export declare const PERIOD_FREEZES_COLLECTION = "_period_freezes";
|
|
|
6
6
|
export declare const PERIOD_ARCHIVES_COLLECTION = "_period_archives";
|
|
7
7
|
/** Sibling of {@link PERIODS_COLLECTION} holding target-purge companions (#615). */
|
|
8
8
|
export declare const PERIOD_TARGET_PURGES_COLLECTION = "_period_target_purges";
|
|
9
|
+
/**
|
|
10
|
+
* Sibling of {@link PERIODS_COLLECTION} holding reopen/reclose companions (#1022).
|
|
11
|
+
*
|
|
12
|
+
* Unlike the freeze / archive / target-purge companions — each a single,
|
|
13
|
+
* idempotent, once-only record — this one holds an APPEND-ONLY EVENT LIST,
|
|
14
|
+
* because reopening is a repeating cycle: a month can be closed, reopened,
|
|
15
|
+
* reclosed, and reopened again. The audit value is the sequence, not the
|
|
16
|
+
* latest state.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PERIOD_REOPENS_COLLECTION = "_period_reopens";
|
|
9
19
|
/**
|
|
10
20
|
* Exclusive upper bound for a period's delete-marker purge window (#604).
|
|
11
21
|
* Markers carry no business date (empty body), only write-time `_ts`, so freeze
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* distributed query, addressing, and change-observation. It consolidates the
|
|
9
9
|
* runtime floor formerly published as `/kernel` plus the orchestration delta.
|
|
10
10
|
*
|
|
11
|
-
* See docs/
|
|
11
|
+
* See docs/foundations/architecture-lexicon.md.
|
|
12
12
|
*
|
|
13
13
|
* @packageDocumentation
|
|
14
14
|
*/
|
|
@@ -37,7 +37,7 @@ export type { ExtractPartitionResult } from './extract-partition.js';
|
|
|
37
37
|
export { adoptPartition, unsealDeks, createOwnerOnAdoptedPartition } from './adopt-partition.js';
|
|
38
38
|
export type { AdoptPartitionOptions, AdoptPartitionResult, CreateOwnerResult, CreateOwnerOptions, CreateOwnerStandardOptions, CreateOwnerManagedOptions, } from './adopt-partition.js';
|
|
39
39
|
export { TransferSealError, AdoptionStateError, PartitionExtractionError } from '../kernel/errors.js';
|
|
40
|
-
export type { WriteHook } from '../port/with/write-hooks.js';
|
|
40
|
+
export type { WriteHook, WriteEvent } from '../port/with/write-hooks.js';
|
|
41
41
|
export type { WriteQueue } from '../kernel/write-queue.js';
|
|
42
42
|
export type { WriteConflict } from '../kernel/types.js';
|
|
43
43
|
export type { AccessibleVault } from '../kernel/types.js';
|
|
@@ -128,7 +128,7 @@ export interface LedgerEntry {
|
|
|
128
128
|
* the role of the actor, the (collection, id, vBefore, vAfter) tuple
|
|
129
129
|
* for every record touched, and which guard invariants passed.
|
|
130
130
|
*
|
|
131
|
-
* See
|
|
131
|
+
* See design-history/2026-05-18-guards-design.md.
|
|
132
132
|
*/
|
|
133
133
|
readonly amendment?: {
|
|
134
134
|
readonly reason: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @category capability
|
|
3
3
|
* Deferred-numbering config descriptor. See
|
|
4
|
-
*
|
|
4
|
+
* design-history/2026-06-08-sealed-numbering-and-store-clock-design.md.
|
|
5
5
|
*/
|
|
6
6
|
/** A registered deferred-numbering series. */
|
|
7
7
|
export interface DeferredNumberingConfig {
|
|
@@ -5,6 +5,6 @@ import type { DerivationSpec, DerivationStrategy } from './types.js';
|
|
|
5
5
|
* plaintext after DEK unwrap. Outputs are encrypted with the same DEK
|
|
6
6
|
* as the source and written via the standard `Collection.put` path.
|
|
7
7
|
*
|
|
8
|
-
* See
|
|
8
|
+
* See design-history/2026-05-01-dim14-derivation-v1-design.md.
|
|
9
9
|
*/
|
|
10
10
|
export declare function withDerivation<TSource extends Record<string, unknown>, TOutputs extends Record<string, Record<string, unknown> | ReadonlyArray<Record<string, unknown>>>>(spec: DerivationSpec<TSource, TOutputs>): DerivationStrategy;
|
|
@@ -4,6 +4,7 @@ import type { ReduceSpec, Reduction } from '../../with-lookup/reduce/reduction.j
|
|
|
4
4
|
import type { GroupedReduction } from '../../with-lookup/reduce/groupby.js';
|
|
5
5
|
import type { JoinStrategy } from '../../kernel/query/join.js';
|
|
6
6
|
import type { MoneyDescriptor } from '../../via/money/descriptor.js';
|
|
7
|
+
import type { ExactMath } from '../../via/money/exact.js';
|
|
7
8
|
import type { I18nTextDescriptor } from '../../via/i18n/core.js';
|
|
8
9
|
/**
|
|
9
10
|
* Minimal vault-shaped accessor passed to the MV `query()` callback.
|
|
@@ -269,6 +270,57 @@ export interface MaterializedViewSpec<TRow extends Record<string, unknown>> {
|
|
|
269
270
|
* UNION-mode only. Ignored if {@link query} is set.
|
|
270
271
|
*/
|
|
271
272
|
aggregate?: ReduceSpec;
|
|
273
|
+
/**
|
|
274
|
+
* Post-aggregate projection over ONE finished row (#1007).
|
|
275
|
+
*
|
|
276
|
+
* `aggregate` accepts reducers only, so a row can carry every input a
|
|
277
|
+
* derived value needs and still not express it — `max(0, netTotal - paid)`
|
|
278
|
+
* is not a reduction. `derive` closes that gap: it receives the row the
|
|
279
|
+
* grouping/aggregation pipeline just produced and returns a patch merged
|
|
280
|
+
* onto it, immediately before materialisation.
|
|
281
|
+
*
|
|
282
|
+
* ```ts
|
|
283
|
+
* aggregate: { paid: sum('paid'), netTotal: sum('netTotal') },
|
|
284
|
+
* derive: (row) => ({ toPay: Math.max(0, row.netTotal - row.paid) }),
|
|
285
|
+
* ```
|
|
286
|
+
*
|
|
287
|
+
* Deliberately narrow, and the narrowness is what keeps it safe under
|
|
288
|
+
* incremental recompute: **pure, single-row, no cross-row access, no second
|
|
289
|
+
* aggregation pass.** It only ever sees the row the reducer just produced,
|
|
290
|
+
* so a refresh triggered by one source write recomputes it correctly without
|
|
291
|
+
* the engine needing to know anything about the function.
|
|
292
|
+
*
|
|
293
|
+
* Returning `null` / `undefined` leaves the row unchanged. Returned keys
|
|
294
|
+
* that collide with a {@link groupBy} field throw
|
|
295
|
+
* `MaterializedViewConfigError` — a group key is the row's identity and
|
|
296
|
+
* feeds {@link rowKey}, so rewriting it would silently re-home the row.
|
|
297
|
+
*
|
|
298
|
+
* **Money:** money leaves a reducer as an exact decimal string, and
|
|
299
|
+
* `Number(a) - Number(b)` would put it straight back through binary floating
|
|
300
|
+
* point — `10.05 - 0.10` becomes `9.950000000000001`, which the money
|
|
301
|
+
* quantiser then refuses rather than storing drift. So `derive` receives
|
|
302
|
+
* {@link ExactMath} as its second argument; it works in scaled BigInt and
|
|
303
|
+
* cannot introduce a representation error:
|
|
304
|
+
*
|
|
305
|
+
* ```ts
|
|
306
|
+
* moneyFields: { netTotal: THB, paid: THB, toPay: THB },
|
|
307
|
+
* derive: (row, exact) => ({ toPay: exact.max(0, exact.sub(row.netTotal, row.paid)) }),
|
|
308
|
+
* ```
|
|
309
|
+
*
|
|
310
|
+
* Declare the derived field in {@link moneyFields} and the result is
|
|
311
|
+
* quantised through that descriptor before storage, exact at its scale.
|
|
312
|
+
*
|
|
313
|
+
* Note the one place `TRow` under-describes what arrives: a field declared
|
|
314
|
+
* in {@link moneyFields} reaches `derive` DECODED — the decimal string a
|
|
315
|
+
* reader would see, not the scaled integer the reducer left behind — even
|
|
316
|
+
* where `TRow` types it as `number` (which is what the arms' `map` emits).
|
|
317
|
+
* `ExactMath` accepts both, which is why its operations are the right tool
|
|
318
|
+
* here and why no cast is needed.
|
|
319
|
+
*
|
|
320
|
+
* Applies to every MV form (union, projection, and query), always as the
|
|
321
|
+
* last step before rows are materialised.
|
|
322
|
+
*/
|
|
323
|
+
derive?: (row: TRow, exact: ExactMath) => Record<string, unknown> | null | undefined;
|
|
272
324
|
/**
|
|
273
325
|
* Money descriptors for the UNION-mode aggregate, keyed by the
|
|
274
326
|
* OUTPUT/intermediate field name as it appears in the mapped row and
|
|
@@ -21,8 +21,8 @@ import type { MaterializedViewSpec, MaterializedViewStrategy } from './types.js'
|
|
|
21
21
|
* The three modes are mutually exclusive — exactly one of `query` /
|
|
22
22
|
* `unionSources` / `projection` must be set at registration time.
|
|
23
23
|
*
|
|
24
|
-
* See
|
|
25
|
-
*
|
|
26
|
-
* and
|
|
24
|
+
* See design-history/2026-05-20-dim14-mv-v2-design.md (single-source v2),
|
|
25
|
+
* design-history/2026-05-21-dim14-mv-multikey-and-union.md (UNION),
|
|
26
|
+
* and design-history/2026-07-25-join-projection-mv-design.md (projection).
|
|
27
27
|
*/
|
|
28
28
|
export declare function withMaterializedView<TRow extends Record<string, unknown>>(spec: MaterializedViewSpec<TRow>): MaterializedViewStrategy;
|
|
@@ -4,6 +4,6 @@ import type { OverlayedViewSpec, OverlayedViewStrategy } from './types.js';
|
|
|
4
4
|
* a user-writable overlay so consumers can express operator-editable
|
|
5
5
|
* lifecycles as one declarative block.
|
|
6
6
|
*
|
|
7
|
-
* See
|
|
7
|
+
* See design-history/2026-05-20-dim14-mv-v2-design.md.
|
|
8
8
|
*/
|
|
9
9
|
export declare function withOverlayedView(spec: OverlayedViewSpec): OverlayedViewStrategy;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* vault instance (and thus no custody namespace) yet — it stays the exported
|
|
21
21
|
* `team/deed.ts` function.
|
|
22
22
|
*
|
|
23
|
-
* @see
|
|
23
|
+
* @see design-history/2026-06-17-fr6-deed-custodian-liberate-design.md
|
|
24
24
|
* @module
|
|
25
25
|
*/
|
|
26
26
|
import type { GrantOptions, RevokeOptions, FactorProofBundle } from '../../kernel/types.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `UserEnvelopeOversizedError` live in the kernel spine
|
|
6
6
|
* (`kernel/types.ts` / `kernel/constants.ts` / `kernel/errors.ts`).
|
|
7
7
|
*
|
|
8
|
-
* @see
|
|
8
|
+
* @see design-history/2026-05-05-user-envelope-design.md
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* (`vault.user.*`) sits on top of this; permission gates, own-only
|
|
13
13
|
* write enforcement, and presence-channel propagation live there.
|
|
14
14
|
*
|
|
15
|
-
* @see
|
|
15
|
+
* @see design-history/2026-05-05-user-envelope-design.md
|
|
16
16
|
*
|
|
17
17
|
* @module
|
|
18
18
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `beginEchoUnlock` — the interactive ceremony API (spec
|
|
3
|
-
*
|
|
3
|
+
* design-history/2026-08-02-echo-secret-design.md, #940, Task 6).
|
|
4
4
|
*
|
|
5
5
|
* Split out of `echo-secret.ts` (which owns only the block builders +
|
|
6
6
|
* verifiers) because this module orchestrates BOTH `echo-secret.ts`
|
|
@@ -33,7 +33,7 @@ export interface EchoCeremony {
|
|
|
33
33
|
* TYPE it.
|
|
34
34
|
*
|
|
35
35
|
* Conforming-player contract (spec
|
|
36
|
-
*
|
|
36
|
+
* design-history/2026-08-02-echo-secret-design.md, "Ceremony"):
|
|
37
37
|
* when the owner does NOT recognize the revealed echo, the player MUST show
|
|
38
38
|
* a hard phishing warning — do not continue, open the official app, rotate
|
|
39
39
|
* the secret immediately — MUST NOT offer any skip or
|
|
@@ -57,7 +57,7 @@ export interface EchoCeremony {
|
|
|
57
57
|
* cannot be resolved — sealed reveal under a foreign device).
|
|
58
58
|
*
|
|
59
59
|
* Conforming-player contract (spec
|
|
60
|
-
*
|
|
60
|
+
* design-history/2026-08-02-echo-secret-design.md): an owner who does
|
|
61
61
|
* not recognize `ceremony.reveal` is looking at a phish. The player MUST then
|
|
62
62
|
* show a hard warning (stop, open the official app, rotate the secret now),
|
|
63
63
|
* MUST NOT offer a skip / "verification unavailable" fallback or any
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Echo-block builders + verifiers (spec
|
|
3
|
-
*
|
|
3
|
+
* design-history/2026-08-02-echo-secret-design.md, #940).
|
|
4
4
|
*
|
|
5
5
|
* Builds and verifies the on-keyring {@link KeyringEchoBlock} declaration
|
|
6
6
|
* for the 3-part echo ceremony (prompt → echo → key). This module owns:
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* offline brute-force oracles for anyone holding the keyring file (600K
|
|
25
25
|
* PBKDF2 per guess), and the `sealed` reveal blob is unpadded so its length
|
|
26
26
|
* discloses the echo's UTF-8 byte length — see the threat model in
|
|
27
|
-
* `
|
|
27
|
+
* `design-history/2026-08-02-echo-secret-design.md`.
|
|
28
28
|
*
|
|
29
29
|
* @module
|
|
30
30
|
*/
|
|
@@ -368,8 +368,17 @@ export declare function listUsersWithEnvelopes<T = unknown>(store: NoydbStore, v
|
|
|
368
368
|
user: UserInfo;
|
|
369
369
|
envelope: UserEnvelope<T> | null;
|
|
370
370
|
}>>;
|
|
371
|
-
/** Ensure a DEK exists for a collection. Generates one if new. */
|
|
372
371
|
export declare function ensureCollectionDEK(store: NoydbStore, vault: string, keyring: UnlockedKeyring): Promise<(collectionName: string) => Promise<EnclaveKey>>;
|
|
372
|
+
/**
|
|
373
|
+
* The `Permissions` catch-all key (#1010). `Permissions` has always documented
|
|
374
|
+
* `'*'` as "the wildcard collection matching all collections in the vault", but
|
|
375
|
+
* nothing expanded it — a grantee handed the documented catch-all got no keys
|
|
376
|
+
* at all. It is honoured in three places, and they must agree: the DEK wrapping
|
|
377
|
+
* in `grant()`, and both permission checks below.
|
|
378
|
+
*/
|
|
379
|
+
export declare const PERMISSION_WILDCARD = "*";
|
|
380
|
+
/** Does this permission map hand over the whole vault? */
|
|
381
|
+
export declare function permissionsAreWildcard(permissions: Permissions | undefined): boolean;
|
|
373
382
|
/** Check if a user has write permission for a collection. */
|
|
374
383
|
export declare function hasWritePermission(keyring: UnlockedKeyring, collectionName: string): boolean;
|
|
375
384
|
/** Check if a user has any access to a collection. */
|
|
@@ -268,6 +268,21 @@ export interface WritePodOptions {
|
|
|
268
268
|
}
|
|
269
269
|
/** @deprecated Use `WritePodOptions`. */
|
|
270
270
|
export type WriteNoydbBundleOptions = WritePodOptions;
|
|
271
|
+
/**
|
|
272
|
+
* Every key `writePod` reads, in declaration order (#991).
|
|
273
|
+
*
|
|
274
|
+
* A pod is a wire artifact, so an option this list doesn't name is refused
|
|
275
|
+
* rather than ignored: a dropped write option produces a structurally valid
|
|
276
|
+
* bundle that is missing something, and the defect surfaces later — in
|
|
277
|
+
* whoever imports it — with nothing left to trace it back to.
|
|
278
|
+
*
|
|
279
|
+
* `bundle-option-keys.test.ts` parses `WritePodOptions` out of this file and
|
|
280
|
+
* fails if the two ever drift, so adding an option is enough; you do not have
|
|
281
|
+
* to remember to update this list, only to keep the interface shape parseable.
|
|
282
|
+
*
|
|
283
|
+
* @internal
|
|
284
|
+
*/
|
|
285
|
+
export declare const WRITE_POD_OPTION_KEYS: readonly ["compression", "collections", "since", "where", "tierAtMost", "exportSecret", "recipients", "autoCredentials", "sealedCredentials", "autoSecrets", "sealedSecrets", "sign", "engineRange", "unlockMethods", "hasApp", "species", "pointerMode", "redirect"];
|
|
271
286
|
/**
|
|
272
287
|
* Result returned by `readPod`. The caller is expected to
|
|
273
288
|
* pass `dumpJson` into `vault.load(json, secret)` to
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* {@link VaultSchemaSnapshot} describing the vault's shape and (optional)
|
|
4
4
|
* stats. Consumed by `noydb describe` for human-readable audit output.
|
|
5
5
|
*
|
|
6
|
-
* @see
|
|
6
|
+
* @see design-history/2026-05-22-schema-dump-design.md
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
@@ -14,6 +14,7 @@ export { jsonSchemaToFields } from './fields.js';
|
|
|
14
14
|
export type { SchemaIntrospection } from './types.js';
|
|
15
15
|
export type { FieldMeta, SemanticType } from './field-meta.js';
|
|
16
16
|
export type { CollectionDescription, DescribedField, DescribeOptions } from './describe.js';
|
|
17
|
+
export type { StandardSchemaV1Issue } from '../../kernel/schema.js';
|
|
17
18
|
export { applyListProjection } from './projection.js';
|
|
18
19
|
export type { ListProjectionOptions } from './projection.js';
|
|
19
20
|
export type { BehaviorSummary, GuardBehaviorEntry, DerivationBehaviorEntry, DerivationOutputEntry, MaterializedViewBehaviorEntry, OverlayBehaviorEntry, SatelliteBehaviorEntry, } from './behaviors.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* by `vault.dumpSchema()`. Consumed by the upcoming `noydb describe`
|
|
4
4
|
* CLI to emit human-readable YAML/JSON audit output.
|
|
5
5
|
*
|
|
6
|
-
* @see
|
|
6
|
+
* @see design-history/2026-05-22-schema-dump-design.md
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Standard Schema validators (Valibot, ArkType, Effect Schema) write a
|
|
11
11
|
* stub envelope flagging the kind without a JSON Schema body.
|
|
12
12
|
*
|
|
13
|
-
* @see
|
|
13
|
+
* @see design-history/2026-05-22-schema-dump-design.md
|
|
14
14
|
*
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
freezeSnapshotOnly,
|
|
5
5
|
randomId,
|
|
6
6
|
withdrawAccessibleData
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-FZ6NYJ7L.js";
|
|
8
|
+
import "./chunk-FFDNKRCY.js";
|
|
9
|
+
import "./chunk-4VUPLMZ6.js";
|
|
10
|
+
import "./chunk-2BMRJ6LQ.js";
|
|
11
|
+
import "./chunk-3URQC7EH.js";
|
|
12
|
+
import "./chunk-7H73RIE3.js";
|
|
13
13
|
import "./chunk-HXGUIPQB.js";
|
|
14
14
|
import "./chunk-AR2JDFAE.js";
|
|
15
15
|
import "./chunk-747LRSOO.js";
|
|
16
16
|
import "./chunk-LP7BEXCT.js";
|
|
17
17
|
import "./chunk-VCETL77O.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-YPYHVOXP.js";
|
|
19
19
|
import "./chunk-HNGSV2YC.js";
|
|
20
20
|
import "./chunk-PZ5AY32C.js";
|
|
21
21
|
export {
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
randomId,
|
|
26
26
|
withdrawAccessibleData
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=withdraw-accessible-
|
|
28
|
+
//# sourceMappingURL=withdraw-accessible-7PG4DYQK.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noy-db/hub",
|
|
3
|
-
"version": "0.6.0-pre.
|
|
3
|
+
"version": "0.6.0-pre.11",
|
|
4
4
|
"description": "Zero-knowledge, offline-first, encrypted document store — core library with AES-256-GCM, PBKDF2, multi-user keyring, and sync engine",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "vLannaAi <vicio@lanna.ai>",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
21
|
"default": "./dist/index.js"
|
|
22
22
|
},
|
|
23
|
+
"./codemods/0.4.0-pre.json": "./codemods/0.4.0-pre.json",
|
|
23
24
|
"./i18n": {
|
|
24
25
|
"types": "./dist/via/i18n/index.d.ts",
|
|
25
26
|
"default": "./dist/i18n/index.js"
|
|
@@ -202,20 +203,21 @@
|
|
|
202
203
|
"files": [
|
|
203
204
|
"dist",
|
|
204
205
|
"README.md",
|
|
205
|
-
"LICENSE"
|
|
206
|
+
"LICENSE",
|
|
207
|
+
"codemods"
|
|
206
208
|
],
|
|
207
209
|
"engines": {
|
|
208
210
|
"node": ">=22.0.0"
|
|
209
211
|
},
|
|
210
212
|
"dependencies": {
|
|
211
|
-
"@noy-db/attestation": "0.6.0-pre.
|
|
213
|
+
"@noy-db/attestation": "0.6.0-pre.11"
|
|
212
214
|
},
|
|
213
215
|
"devDependencies": {
|
|
214
216
|
"@types/node": "^22.0.0",
|
|
215
217
|
"esbuild": "^0.25.0",
|
|
216
218
|
"zod": "^4.0.0",
|
|
217
219
|
"zod-to-json-schema": "^3.25.2",
|
|
218
|
-
"@noy-db/on-shamir": "0.6.0-pre.
|
|
220
|
+
"@noy-db/on-shamir": "0.6.0-pre.11"
|
|
219
221
|
},
|
|
220
222
|
"peerDependencies": {
|
|
221
223
|
"zod-to-json-schema": "^3.25.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/with-pod/backup.ts"],"sourcesContent":["/**\n * Vault backup / restore / integrity.\n *\n * Holds `dump()` (verifiable encrypted JSON backup, including the blob\n * collections so blob \"covers\" travel in the bundle), `load()` (restore +\n * post-load integrity gate), `verifyBackupIntegrity()` (chain + data-envelope\n * cross-check), and `exportJSON()` (plaintext per-collection export, built on\n * the vault's `exportStream`). Behaviour is byte-identical to the inline\n * `Vault` methods these functions replaced — every dependency the moving code\n * touched on `this.*` arrives via {@link BackupContext}. `Vault` keeps the\n * public methods as thin delegators.\n *\n * Internal — reached through `vault.dump()` / `vault.load()` / etc.\n */\nimport { NOYDB_BACKUP_VERSION } from '../kernel/types.js'\nimport { BackupLedgerError, BackupCorruptedError } from '../kernel/errors.js'\nimport { LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION } from '../with-commit/history/ledger/constants.js'\nimport { SCHEMAS_COLLECTION } from '../with-shape/persisted-schemas/storage.js'\nimport { SEQUENCE_COLLECTION } from '../with-commit/sequence/index.js'\nimport { MANIFEST_COLLECTION } from '../with-shape/manifest/reserved-collections.js'\nimport type {\n NoydbStore,\n EncryptedEnvelope,\n VaultBackup,\n VaultSnapshot,\n ExportStreamOptions,\n ExportChunk,\n} from '../kernel/types.js'\nimport type { LedgerStore } from '../with-commit/history/ledger/store.js'\n\n/** Everything the moving backup methods touched on the vault's `this.*`. */\nexport interface BackupContext {\n /** The ciphertext store. */\n readonly adapter: NoydbStore\n /** Vault namespace name. */\n readonly vault: string\n /** The invoking keyring's user id (read fresh per call). */\n userId(): string\n /** The vault's ledger store, or null when history is off. */\n getLedgerOrNull(): LedgerStore | null\n /** Recompute an envelope's `payloadHash` (bound `historyStrategy.envelopePayloadHash`). */\n envelopePayloadHash(envelope: EncryptedEnvelope): Promise<string>\n /**\n * Refresh the in-memory keyring from the freshly-loaded keyring file and\n * rebuild the DEK resolver. No-op when the vault has no `reloadKeyring`\n * callback (plaintext vaults / test constructions).\n */\n reloadKeyringAndRebuildDEK(): Promise<void>\n /** Clear the vault's collection cache (post-load). */\n clearCollectionCache(): void\n /** Reset the ledger store so the next `ledger()` rebuilds its head cache. */\n resetLedgerStore(): void\n /** The vault's decrypt+ACL export stream (used by `exportJSON`). */\n exportStream(opts: ExportStreamOptions): AsyncIterableIterator<ExportChunk>\n}\n\n/** Result of {@link verifyBackupIntegrity}. */\nexport type VerifyBackupResult =\n | { readonly ok: true; readonly head: string; readonly length: number }\n | {\n readonly ok: false\n readonly kind: 'chain'\n readonly divergedAt: number\n readonly message: string\n }\n | {\n readonly ok: false\n readonly kind: 'data'\n readonly collection: string\n readonly id: string\n readonly message: string\n }\n\n/**\n * Dump vault as a verifiable encrypted JSON backup string.\n *\n * backups embed the current ledger head and the full `_ledger` +\n * `_ledger_deltas` internal collections so the receiver can run\n * `verifyBackupIntegrity()` after `load()` and detect any tampering between\n * dump and restore. Backups produced without a ledger skip the integrity check\n * with a warning — both modes round-trip cleanly.\n */\nexport async function dumpVault(ctx: BackupContext): Promise<string> {\n const snapshot = await ctx.adapter.loadAll(ctx.vault)\n\n // Load keyrings (separate path because loadAll filters them out\n // along with all other underscore-prefixed internal collections).\n const keyringIds = await ctx.adapter.list(ctx.vault, '_keyring')\n const keyrings: Record<string, unknown> = {}\n for (const keyringId of keyringIds) {\n const envelope = await ctx.adapter.get(ctx.vault, '_keyring', keyringId)\n if (envelope) {\n keyrings[keyringId] = JSON.parse(envelope._data)\n }\n }\n\n // Load the ledger entries + deltas so the receiver can replay\n // the chain after restore. Without this, `load()` would have an\n // empty ledger and `verifyBackupIntegrity()` would have nothing\n // to compare against.\n //\n // Also enumerate the blob collections so blob content (\"covers\")\n // travels in the bundle (the blob DEK already travels in `_keyring`).\n // Literals are inlined (not imported from blobs/blob-set.ts) to keep\n // the blob runtime out of this kernel hot path — they mirror\n // BLOB_INDEX/CHUNKS/EVICTION_AUDIT_COLLECTION and SLOTS/VERSIONS_PREFIX.\n // The collect-loop skips empty ids, so this no-ops without blobs.\n const internalSnapshot: VaultSnapshot = {}\n const internalNames = [\n LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION, SCHEMAS_COLLECTION, SEQUENCE_COLLECTION,\n MANIFEST_COLLECTION, // #941: the pod's manifest-set record(s) travel in the bundle too\n '_history', // full-snapshot version history — so history()/getVersion()/diff() survive the bundle\n '_blob_index', '_blob_chunks', '_blob_eviction_audit',\n // #753 spec §7 Q3: `_blob_intent` markers travel too — restoring mid-op\n // state (a blob row without its marker) would reproduce the ambiguity\n // the journal exists to prevent. Note: `_mv_stale` does NOT travel\n // today (a pre-existing, separate gap) — observed here, tracked on\n // #761, not fixed in this pass.\n '_blob_intent',\n // #769: `_blob_slots_<c>` envelopes travel verbatim (raw ciphertext,\n // same DEK, same vault) — including any `SlotRecord.pendingRelease`\n // resume breadcrumb they carry. This is INTENTIONALLY the opposite of\n // `extract-partition`'s `reKeyBlobs`, which STRIPS `pendingRelease`:\n // a full-vault backup restores into the SAME vault it was taken from,\n // so a breadcrumb taken mid-rehome (together with its `_blob_intent`\n // marker, carried above) is resumable on restore — carry-and-resume is\n // correct here. A partition extraction crosses vaults: the breadcrumb's\n // old eTag may not exist in the destination, so it must be stripped\n // there instead. Asymmetry: backup = same-vault-resumable = carry;\n // partition = cross-vault = strip-breadcrumb-carry-marker.\n ...Object.keys(snapshot).flatMap((c) => [`_blob_slots_${c}`, `_blob_versions_${c}`]),\n ]\n for (const internalName of internalNames) {\n const ids = await ctx.adapter.list(ctx.vault, internalName)\n if (ids.length === 0) continue\n const records: Record<string, EncryptedEnvelope> = {}\n for (const id of ids) {\n const envelope = await ctx.adapter.get(ctx.vault, internalName, id)\n if (envelope) records[id] = envelope\n }\n internalSnapshot[internalName] = records\n }\n\n // Embed the ledger head if there's a chain. An empty ledger\n // (fresh vault) leaves `ledgerHead` undefined, which\n // load() treats the same as a legacy backup (no integrity\n // check, console warning). If history is not opted in,\n // `getLedgerOrNull` returns null and we skip embedding entirely\n // — the backup is still valid, just without the integrity head.\n const ledgerForHead = ctx.getLedgerOrNull()\n const head = ledgerForHead ? await ledgerForHead.head() : null\n const backup: VaultBackup = {\n _noydb_backup: NOYDB_BACKUP_VERSION,\n _compartment: ctx.vault,\n _exported_at: new Date().toISOString(),\n _exported_by: ctx.userId(),\n keyrings: keyrings as VaultBackup['keyrings'],\n collections: snapshot,\n ...(Object.keys(internalSnapshot).length > 0\n ? { _internal: internalSnapshot }\n : {}),\n ...(head\n ? {\n ledgerHead: {\n hash: head.hash,\n index: head.entry.index,\n ts: head.entry.ts,\n },\n }\n : {}),\n }\n\n return JSON.stringify(backup)\n}\n\n/**\n * Restore a vault from a verifiable backup. After loading, runs\n * `verifyBackupIntegrity()` to confirm the hash chain, the embedded head, and\n * every data envelope's payload hash. Legacy backups (no `ledgerHead`) load\n * with a console warning and skip the integrity check.\n */\nexport async function loadVault(ctx: BackupContext, backupJson: string): Promise<void> {\n const backup = JSON.parse(backupJson) as VaultBackup\n\n // 1. Restore data collections.\n await ctx.adapter.saveAll(ctx.vault, backup.collections)\n\n // 2. Restore keyrings.\n for (const [userId, keyringFile] of Object.entries(backup.keyrings)) {\n const envelope = {\n _noydb: 1 as const,\n _v: 1,\n _ts: new Date().toISOString(),\n _iv: '',\n _data: JSON.stringify(keyringFile),\n }\n await ctx.adapter.put(ctx.vault, '_keyring', userId, envelope)\n }\n\n // 3. Restore internal collections (`_ledger`, `_ledger_deltas`).\n // Required so verifyBackupIntegrity has the chain to walk.\n if (backup._internal) {\n for (const [internalName, records] of Object.entries(backup._internal)) {\n for (const [id, envelope] of Object.entries(records)) {\n await ctx.adapter.put(ctx.vault, internalName, id, envelope)\n }\n }\n }\n\n // 4. Refresh the in-memory keyring from the freshly-loaded\n // keyring file. Without this, the Vault's getDEK\n // closure still holds the OLD session's DEKs, and every\n // decrypt of a loaded ledger entry / data envelope fails\n // with TamperedError because the DEK doesn't match the\n // ciphertext that was encrypted with the SOURCE user's DEK.\n // Skipped for plaintext vaults and for tests that\n // construct Vault without a reloadKeyring callback.\n await ctx.reloadKeyringAndRebuildDEK()\n\n // 5. Clear collection cache + reset the ledger store so the\n // next ledger() call rebuilds its head cache from the\n // freshly-loaded entries.\n ctx.clearCollectionCache()\n ctx.resetLedgerStore()\n\n // 5. Run the verification gate. Legacy backups (no ledgerHead)\n // skip this with a one-line warning so existing consumers can\n // still read them while migrating.\n if (!backup.ledgerHead) {\n console.warn(\n `[noy-db] Loaded a legacy backup with no ledgerHead — ` +\n `verifiable-backup integrity check skipped. ` +\n `Re-export with a ledger-aware build to get tamper detection.`,\n )\n return\n }\n\n const result = await verifyBackupIntegrity(ctx)\n if (!result.ok) {\n // Surface the most specific error class we can. The result\n // shape carries enough info for callers to inspect.\n if (result.kind === 'data') {\n throw new BackupCorruptedError(\n result.collection,\n result.id,\n result.message,\n )\n }\n throw new BackupLedgerError(result.message, result.divergedAt)\n }\n\n // 6. Cross-check: the freshly-verified head must match the\n // value embedded at dump time. A mismatch means someone\n // truncated or extended the chain after dump.\n if (result.head !== backup.ledgerHead.hash) {\n throw new BackupLedgerError(\n `Backup ledger head mismatch: embedded \"${backup.ledgerHead.hash}\" ` +\n `but reconstructed \"${result.head}\".`,\n )\n }\n}\n\n/**\n * End-to-end backup integrity check: `ledger.verify()` (hash chain) plus a data\n * envelope cross-check (every current record's `_data` hash must match the\n * latest `put` entry's `payloadHash`). Returns a discriminated union so callers\n * can distinguish chain vs data failures.\n */\nexport async function verifyBackupIntegrity(ctx: BackupContext): Promise<VerifyBackupResult> {\n // Step 1: chain verification. Without the history strategy there\n // is no ledger; an unaudited backup verifies trivially as `ok`\n // because there's nothing to diverge from.\n const ledgerForVerify = ctx.getLedgerOrNull()\n if (!ledgerForVerify) {\n return { ok: true, head: '', length: 0 }\n }\n const chainResult = await ledgerForVerify.verify()\n if (!chainResult.ok) {\n return {\n ok: false,\n kind: 'chain',\n divergedAt: chainResult.divergedAt,\n message:\n `Ledger chain diverged at index ${chainResult.divergedAt}: ` +\n `expected prevHash \"${chainResult.expected}\" but found \"${chainResult.actual}\".`,\n }\n }\n\n // Step 2: data envelope cross-check. Walk every entry in the\n // ledger and, for the LATEST `put` per (collection, id), recompute\n // the data envelope's payloadHash and compare. Earlier puts of the\n // same id are skipped because the data collection only holds the\n // current version — historical envelopes live in the deltas\n // collection (which is itself protected by the chain).\n // Reuse the ledger we already resolved in step 1.\n const allEntries = await ledgerForVerify.loadAllEntries()\n\n // Find the latest non-delete entry per (collection, id). Walk\n // the entries in reverse so we hit the latest first; mark each\n // (collection, id) as seen and skip subsequent entries.\n const seen = new Set<string>()\n const latest = new Map<\n string,\n { collection: string; id: string; expectedHash: string }\n >()\n for (let i = allEntries.length - 1; i >= 0; i--) {\n const entry = allEntries[i]\n if (!entry) continue\n // Amendment entries are multi-record audit entries whose\n // `collection` and `id` are empty strings — building a `\"/\"`\n // key here would mark that synthetic slot as seen and falsely\n // trip the data check on a record that never existed. Skip\n // them BEFORE the key/seen bookkeeping so they neither\n // tombstone real entries nor enter the latest map.\n if (entry.op === 'amendment' || entry.op === 'lifecycle') continue\n const key = `${entry.collection}/${entry.id}`\n if (seen.has(key)) continue\n seen.add(key)\n // For deletes the data collection should NOT have the record,\n // so we skip — there's nothing to cross-check. Marking the key\n // as seen above ensures any earlier `put` of the same id is\n // also skipped (the record was subsequently deleted).\n if (entry.op === 'delete') continue\n latest.set(key, {\n collection: entry.collection,\n id: entry.id,\n expectedHash: entry.payloadHash,\n })\n }\n\n for (const { collection, id, expectedHash } of latest.values()) {\n const envelope = await ctx.adapter.get(ctx.vault, collection, id)\n if (!envelope) {\n return {\n ok: false,\n kind: 'data',\n collection,\n id,\n message:\n `Ledger expects data record \"${collection}/${id}\" to exist, ` +\n `but the adapter has no envelope for it.`,\n }\n }\n const actualHash = await ctx.envelopePayloadHash(envelope)\n if (actualHash !== expectedHash) {\n return {\n ok: false,\n kind: 'data',\n collection,\n id,\n message:\n `Data envelope \"${collection}/${id}\" has been tampered with: ` +\n `expected payloadHash \"${expectedHash}\", got \"${actualHash}\".`,\n }\n }\n }\n\n return {\n ok: true,\n head: chainResult.head,\n length: chainResult.length,\n }\n}\n\n/**\n * Plaintext per-collection export, built on the vault's `exportStream`. Forces\n * collection granularity (record-by-record output makes no sense in a single\n * string) and merges dictionary snapshots across collections.\n */\nexport async function exportVaultJSON(ctx: BackupContext, opts: ExportStreamOptions = {}): Promise<string> {\n // Force per-collection granularity regardless of caller setting:\n // record-by-record output doesn't make sense in a single string.\n const collections: Record<\n string,\n {\n schema: null\n refs: Record<string, { target: string; mode: 'strict' | 'warn' | 'cascade' }>\n records: unknown[]\n }\n > = {}\n let ledgerHead: ExportChunk['ledgerHead'] | undefined\n // Merged dictionary snapshot across all collections.\n // Only populated when `resolveLabels` is not set.\n const allDictionaries: Record<\n string, // collection name\n Record<string, Record<string, Record<string, string>>>\n > = {}\n\n for await (const chunk of ctx.exportStream({\n granularity: 'collection',\n withLedgerHead: opts.withLedgerHead === true,\n // Thread the export locale so records are read at the\n // `export` layer (i18nText collapsed + dictKey/staticDict labels resolved).\n ...(opts.resolveLabels !== undefined ? { resolveLabels: opts.resolveLabels } : {}),\n })) {\n collections[chunk.collection] = {\n schema: null, // Standard Schema validators are not JSON-serializable\n refs: chunk.refs,\n records: chunk.records,\n }\n if (chunk.ledgerHead) ledgerHead = chunk.ledgerHead\n // Collect dictionary snapshots unless resolveLabels is set\n if (!opts.resolveLabels && chunk.dictionaries) {\n allDictionaries[chunk.collection] = chunk.dictionaries\n }\n }\n\n const hasDictionaries = Object.keys(allDictionaries).length > 0\n return JSON.stringify({\n _noydb_export: 1,\n _compartment: ctx.vault,\n _exported_at: new Date().toISOString(),\n _exported_by: ctx.userId(),\n collections,\n ...(hasDictionaries ? { _dictionaries: allDictionaries } : {}),\n ...(ledgerHead ? { ledgerHead } : {}),\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFA,eAAsB,UAAU,KAAqC;AACnE,QAAM,WAAW,MAAM,IAAI,QAAQ,QAAQ,IAAI,KAAK;AAIpD,QAAM,aAAa,MAAM,IAAI,QAAQ,KAAK,IAAI,OAAO,UAAU;AAC/D,QAAM,WAAoC,CAAC;AAC3C,aAAW,aAAa,YAAY;AAClC,UAAM,WAAW,MAAM,IAAI,QAAQ,IAAI,IAAI,OAAO,YAAY,SAAS;AACvE,QAAI,UAAU;AACZ,eAAS,SAAS,IAAI,KAAK,MAAM,SAAS,KAAK;AAAA,IACjD;AAAA,EACF;AAaA,QAAM,mBAAkC,CAAC;AACzC,QAAM,gBAA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