@noy-db/hub 0.3.0-pre.3 → 0.3.0-pre.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/index.d.ts +2 -2
- package/dist/adapter/index.js +1 -1
- package/dist/aggregate/index.d.ts +3 -3
- package/dist/aggregate/index.js +4 -4
- package/dist/api-JOXUNSKP.js +20 -0
- package/dist/as/index.d.ts +4 -4
- package/dist/as/index.js +12 -9
- package/dist/at/index.d.ts +2 -2
- package/dist/attestation/index.d.ts +3 -3
- package/dist/attestation/index.js +21 -18
- package/dist/attestation/index.js.map +1 -1
- package/dist/{backup-NGRJ46SH.js → backup-OPONO6Q5.js} +12 -9
- package/dist/{backup-NGRJ46SH.js.map → backup-OPONO6Q5.js.map} +1 -1
- package/dist/blobs/index.d.ts +4 -4
- package/dist/blobs/index.js +11 -8
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.d.ts +5 -5
- package/dist/bundle/index.js +21 -18
- package/dist/bundle/index.js.map +1 -1
- package/dist/{bundle-B-P3_Jvb.d.ts → bundle-Bs13EZtX.d.ts} +1 -1
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.d.ts +4 -4
- package/dist/cargo/index.js +23 -20
- package/dist/{chunk-VBYVKOMJ.js → chunk-3QRQOBS7.js} +3 -3
- package/dist/{chunk-JFYIHLU3.js → chunk-3Y4QLJ6K.js} +2 -2
- package/dist/{chunk-BZIWKN74.js → chunk-43ISXURO.js} +2 -2
- package/dist/{chunk-PYWW4KLO.js → chunk-44UTIDE2.js} +9 -9
- package/dist/{chunk-7IP75FP2.js → chunk-4K3MQ5S3.js} +2 -2
- package/dist/chunk-5EWYUR5P.js +37 -0
- package/dist/chunk-5EWYUR5P.js.map +1 -0
- package/dist/{chunk-2KSPDSWI.js → chunk-5MRE3C4Q.js} +5 -5
- package/dist/{chunk-PUNJAEY6.js → chunk-6HNKCKFZ.js} +7 -7
- package/dist/{chunk-PJDK2PPQ.js → chunk-6RXPSMKR.js} +3 -3
- package/dist/{chunk-6DP5HBQD.js → chunk-6UOSONVI.js} +9 -9
- package/dist/{chunk-YN66UOXT.js → chunk-7SY3PTED.js} +25 -9
- package/dist/{chunk-YN66UOXT.js.map → chunk-7SY3PTED.js.map} +1 -1
- package/dist/{chunk-UP6EMMDI.js → chunk-A4DWPOP3.js} +10 -10
- package/dist/{chunk-MCJAUQGE.js → chunk-A5DYVMDR.js} +3 -3
- package/dist/{chunk-MIOLJG2R.js → chunk-AF5ZRTZ4.js} +5 -2
- package/dist/chunk-AF5ZRTZ4.js.map +1 -0
- package/dist/{chunk-TICO2I2O.js → chunk-BKGIWGCX.js} +2 -2
- package/dist/{chunk-O5DNEXQC.js → chunk-BMQOH7MM.js} +2 -2
- package/dist/{chunk-3UDPDRUC.js → chunk-EWR7HL3K.js} +4 -4
- package/dist/{chunk-CVXLJIAV.js → chunk-FH52CDEW.js} +5 -5
- package/dist/chunk-G4MGYGSS.js +130 -0
- package/dist/chunk-G4MGYGSS.js.map +1 -0
- package/dist/{chunk-FELHYKIO.js → chunk-G7RDYYTE.js} +2 -2
- package/dist/{chunk-N2FP26NH.js → chunk-GBTUANXF.js} +16 -297
- package/dist/chunk-GBTUANXF.js.map +1 -0
- package/dist/{chunk-DHIN36UC.js → chunk-GQOT6QJR.js} +8 -8
- package/dist/{chunk-DGUR3CC4.js → chunk-GXGK22QU.js} +2 -2
- package/dist/{chunk-YTIAXSUE.js → chunk-GZZL5R73.js} +4 -4
- package/dist/{chunk-E4YJUNPU.js → chunk-H5XRIJX3.js} +7 -7
- package/dist/{chunk-DA34OEZU.js → chunk-H7RYPVMJ.js} +2 -2
- package/dist/{chunk-2ZORB5RW.js → chunk-HBKDR7R3.js} +3 -3
- package/dist/{chunk-ZNI3RTFV.js → chunk-HMXLN43G.js} +2 -2
- package/dist/{chunk-BYW7EU5L.js → chunk-HY6ZGGEC.js} +2 -2
- package/dist/{chunk-ADBMJDBW.js → chunk-IEUIUSBO.js} +449 -1077
- package/dist/chunk-IEUIUSBO.js.map +1 -0
- package/dist/{chunk-OVIVYAQL.js → chunk-LEA7WJEZ.js} +25 -10
- package/dist/chunk-LEA7WJEZ.js.map +1 -0
- package/dist/{chunk-5Z3RNFJC.js → chunk-LIP6JWYK.js} +3 -3
- package/dist/{chunk-OCDUQUAP.js → chunk-LN22XH4B.js} +1 -1
- package/dist/chunk-LN22XH4B.js.map +1 -0
- package/dist/chunk-LP7BEXCT.js +32 -0
- package/dist/chunk-LP7BEXCT.js.map +1 -0
- package/dist/{chunk-IJW6K6UX.js → chunk-LPRPVCNY.js} +5 -5
- package/dist/{chunk-6EVZXETK.js → chunk-M66NAZA4.js} +3 -3
- package/dist/{chunk-HGQG3VIP.js → chunk-N5YVZHCB.js} +2 -2
- package/dist/chunk-NO272T7Q.js +194 -0
- package/dist/chunk-NO272T7Q.js.map +1 -0
- package/dist/{chunk-NIA5VQ7G.js → chunk-NQVZB3S7.js} +29 -11
- package/dist/chunk-NQVZB3S7.js.map +1 -0
- package/dist/{chunk-6OQ7NKMZ.js → chunk-O2DB4C3M.js} +6 -6
- package/dist/{chunk-LHYQE3BP.js → chunk-OFBFAVLI.js} +6 -6
- package/dist/{chunk-IWVWB7BZ.js → chunk-OJU3CPFA.js} +12 -12
- package/dist/{chunk-ZFME46HJ.js → chunk-OPTFANOX.js} +3 -3
- package/dist/chunk-OPTFANOX.js.map +1 -0
- package/dist/{chunk-5EZAJEES.js → chunk-OVO2RZAE.js} +81 -27
- package/dist/chunk-OVO2RZAE.js.map +1 -0
- package/dist/{chunk-6I2YPLAG.js → chunk-P27Z66EB.js} +7 -7
- package/dist/{chunk-7MHVHGQZ.js → chunk-P2LDXRGP.js} +2 -2
- package/dist/chunk-P3NGV5RV.js +41 -0
- package/dist/chunk-P3NGV5RV.js.map +1 -0
- package/dist/{chunk-NPVICKZE.js → chunk-P5WXDYMD.js} +8 -197
- package/dist/chunk-P5WXDYMD.js.map +1 -0
- package/dist/{chunk-CPAROOKP.js → chunk-PGFY7IRW.js} +12 -41
- package/dist/chunk-PGFY7IRW.js.map +1 -0
- package/dist/{chunk-Z44OY24N.js → chunk-PI5CG2OV.js} +9 -5
- package/dist/chunk-PI5CG2OV.js.map +1 -0
- package/dist/{chunk-6RASM2J4.js → chunk-QKVILR7N.js} +2 -2
- package/dist/{chunk-LKBLAUOB.js → chunk-QNTEDPWP.js} +3 -3
- package/dist/{chunk-P6UXDALK.js → chunk-RDHAGBEB.js} +3 -3
- package/dist/{chunk-XRE4JOEO.js → chunk-RTS23VIJ.js} +2 -2
- package/dist/{chunk-5ZPWVNL3.js → chunk-S2WKOCTU.js} +2 -2
- package/dist/chunk-SAJJWVNQ.js +135 -0
- package/dist/chunk-SAJJWVNQ.js.map +1 -0
- package/dist/{chunk-VHEEU4ZO.js → chunk-SW56GSYC.js} +2 -2
- package/dist/{chunk-46YGCU6Z.js → chunk-T2EGAXPM.js} +2 -2
- package/dist/{chunk-LES2Z7B4.js → chunk-T45LAT2Y.js} +2 -2
- package/dist/{chunk-4NMFWOS2.js → chunk-T65UZXR6.js} +3 -3
- package/dist/{chunk-2N4MUSF3.js → chunk-TB5RNNJ4.js} +7 -7
- package/dist/chunk-TCIUO62Z.js +29 -0
- package/dist/chunk-TCIUO62Z.js.map +1 -0
- package/dist/chunk-THNJ3IKU.js +17 -0
- package/dist/chunk-THNJ3IKU.js.map +1 -0
- package/dist/{chunk-U6OM4E67.js → chunk-TL7QR5T6.js} +20 -15
- package/dist/chunk-TL7QR5T6.js.map +1 -0
- package/dist/{chunk-L4IRFTIF.js → chunk-TLJOJBZD.js} +3 -23
- package/dist/chunk-TLJOJBZD.js.map +1 -0
- package/dist/chunk-TQ3REHVF.js +95 -0
- package/dist/chunk-TQ3REHVF.js.map +1 -0
- package/dist/{chunk-6CNLU4TO.js → chunk-TYGW5TOR.js} +7 -7
- package/dist/{chunk-BLZRNHMG.js → chunk-U23JUUPX.js} +8 -1
- package/dist/{chunk-BLZRNHMG.js.map → chunk-U23JUUPX.js.map} +1 -1
- package/dist/{chunk-U5DWHU3S.js → chunk-U24XHXNK.js} +2 -2
- package/dist/chunk-ULIHDPKL.js +94 -0
- package/dist/chunk-ULIHDPKL.js.map +1 -0
- package/dist/chunk-UOEWDCUX.js +69 -0
- package/dist/chunk-UOEWDCUX.js.map +1 -0
- package/dist/{chunk-NTHKOFVL.js → chunk-VFRNWE5P.js} +52 -8
- package/dist/chunk-VFRNWE5P.js.map +1 -0
- package/dist/{chunk-4DZGZ7II.js → chunk-VMJ5URU7.js} +8 -8
- package/dist/chunk-VMJ5URU7.js.map +1 -0
- package/dist/{chunk-YDP2SA5K.js → chunk-VPCMJ5Z4.js} +5 -5
- package/dist/{chunk-ZAWD6O46.js → chunk-VRPBEOWU.js} +2 -2
- package/dist/{chunk-AY4P6PHN.js → chunk-VWGCJUTV.js} +2 -2
- package/dist/{chunk-IIK7W3AN.js → chunk-XJR3COJO.js} +5 -5
- package/dist/{chunk-ZD4D7UM6.js → chunk-XYYW64LB.js} +2 -2
- package/dist/{chunk-4NZCZUGL.js → chunk-YFF2RP3X.js} +2 -2
- package/dist/{chunk-WVIIJPTJ.js → chunk-Z3FZC5GV.js} +7 -7
- package/dist/{chunk-55HDKLI3.js → chunk-Z5PIUYNB.js} +8 -8
- package/dist/{chunk-ZRDYQZYH.js → chunk-Z7KI4WHR.js} +2 -2
- package/dist/{chunk-BV7KNFJY.js → chunk-ZBDK7T6X.js} +9 -9
- package/dist/chunk-ZKF6HH7V.js +120 -0
- package/dist/chunk-ZKF6HH7V.js.map +1 -0
- package/dist/{chunk-P6DN5QU7.js → chunk-ZKYMKF2S.js} +8 -8
- package/dist/{chunk-NMRKAGHE.js → chunk-ZROMNP7Q.js} +2 -2
- package/dist/{chunk-5A6TC3RQ.js → chunk-ZT4GWVTX.js} +29 -14
- package/dist/chunk-ZT4GWVTX.js.map +1 -0
- package/dist/classified/index.d.ts +4 -4
- package/dist/classified/index.js +3 -3
- package/dist/collection-facade-THH4ASGX.js +39 -0
- package/dist/computed-BMMEFRFJ.js +11 -0
- package/dist/config-drift-3UIJVI5G.js +24 -0
- package/dist/config-drift-3UIJVI5G.js.map +1 -0
- package/dist/consent/index.d.ts +3 -3
- package/dist/consent/index.js +10 -7
- package/dist/consent/index.js.map +1 -1
- package/dist/crdt/index.d.ts +3 -3
- package/dist/delegation-BQNIEHZE.js +25 -0
- package/dist/derivations/index.d.ts +4 -4
- package/dist/derivations/index.js +12 -9
- package/dist/describe/index.d.ts +1 -1
- package/dist/{describe-0tiXAjoO.d.ts → describe-C6iHNlqJ.d.ts} +9 -0
- package/dist/{dev-unlock-B_s9DUWa.d.ts → dev-unlock-Cqd5Xv5J.d.ts} +1 -1
- package/dist/{enclave-IS7HZSQ7.js → enclave-YN6223OG.js} +21 -8
- package/dist/executor-CBTNU5VZ.js +9 -0
- package/dist/executor-DJHNSTIR.js +9 -0
- package/dist/executor-FGISLQIN.js +21 -0
- package/dist/export-accessible-P7SLRLK3.js +23 -0
- package/dist/extract-partition-6JGY3KYR.js +36 -0
- package/dist/{fanout-sidecar-DDKRG2MX.js → fanout-sidecar-WS22Q5WH.js} +12 -9
- package/dist/{fanout-sidecar-DDKRG2MX.js.map → fanout-sidecar-WS22Q5WH.js.map} +1 -1
- package/dist/fence-watcher-DHQ775JB.js +69 -0
- package/dist/fence-watcher-DHQ775JB.js.map +1 -0
- package/dist/find-RNBG7LBY.js +11 -0
- package/dist/forget/index.js +10 -7
- package/dist/forget/index.js.map +1 -1
- package/dist/guards/index.d.ts +4 -4
- package/dist/guards/index.js +3 -3
- package/dist/{hash-CWxn7sf6.d.ts → hash-D8Q5MJLA.d.ts} +1 -1
- package/dist/history/index.d.ts +4 -4
- package/dist/history/index.js +12 -9
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.js +14 -11
- package/dist/i18n/index.js.map +1 -1
- package/dist/in/index.d.ts +2 -2
- package/dist/{index-D05bV0_g.d.ts → index-D4GQe1Rx.d.ts} +818 -49
- package/dist/{index-DTMUUwwW.d.ts → index-DRxk8q_7.d.ts} +3 -3
- package/dist/index.d.ts +54 -18
- package/dist/index.js +1022 -123
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +4 -4
- package/dist/issue-W5QG53B5.js +19 -0
- package/dist/json-schema-I22JCYCG.js +44 -0
- package/dist/json-schema-I22JCYCG.js.map +1 -0
- package/dist/kernel/index.d.ts +3 -3
- package/dist/kernel/index.js +13 -10
- package/dist/lazy/index.d.ts +21 -0
- package/dist/lazy/index.js +12 -0
- package/dist/{ledger-YUAJUNFP.js → ledger-KZWBKAG5.js} +12 -9
- package/dist/liberate-AQ7OWBZZ.js +24 -0
- package/dist/link-set-UQEIYQAM.js +31 -0
- package/dist/materialized-views/index.d.ts +4 -4
- package/dist/materialized-views/index.js +16 -13
- package/dist/{mime-magic-Qr_4HjP6.d.ts → mime-magic-DmwT7OzZ.d.ts} +1 -1
- package/dist/noydb-WQZNAECY.js +60 -0
- package/dist/on/index.d.ts +2 -2
- package/dist/on/index.js +10 -7
- package/dist/overlay-views/index.d.ts +4 -4
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.d.ts +3 -3
- package/dist/periods/index.js +13 -10
- package/dist/pod/index.d.ts +3 -3
- package/dist/pod/index.js +12 -9
- package/dist/{policy-LRE6HTO5.js → policy-YIKUH4AD.js} +5 -5
- package/dist/portability/index.d.ts +3 -3
- package/dist/portability/index.js +8 -8
- package/dist/{public-envelope-WVRRUVAJ.js → public-envelope-MRN5YYZZ.js} +4 -4
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +6 -6
- package/dist/register-V5AQTXNI.js +21 -0
- package/dist/registry-IMNMHWTM.js +17 -0
- package/dist/registry-K6VUQXKV.js +19 -0
- package/dist/registry-ZVO3T4M5.js +9 -0
- package/dist/request-withdrawal-EHALV66Y.js +31 -0
- package/dist/request-withdrawal-EHALV66Y.js.map +1 -0
- package/dist/{reveal-WSUHXCSS.js → reveal-TBLTFWQ2.js} +6 -5
- package/dist/{reveal-WSUHXCSS.js.map → reveal-TBLTFWQ2.js.map} +1 -1
- package/dist/revoke-MHAUAESM.js +24 -0
- package/dist/revoke-MHAUAESM.js.map +1 -0
- package/dist/sealed-record/index.d.ts +3 -3
- package/dist/sealed-record/index.js +13 -10
- package/dist/sealed-record/index.js.map +1 -1
- package/dist/session/index.d.ts +4 -4
- package/dist/session/index.js +10 -7
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.d.ts +3 -3
- package/dist/shadow/index.js +2 -2
- package/dist/signer-PQ74YXRY.js +25 -0
- package/dist/signer-PQ74YXRY.js.map +1 -0
- package/dist/snapshots/index.d.ts +3 -3
- package/dist/snapshots/index.js +11 -8
- package/dist/snapshots/index.js.map +1 -1
- package/dist/{stale-LX4BR43V.js → stale-7Q62KVI3.js} +2 -2
- package/dist/stale-7Q62KVI3.js.map +1 -0
- package/dist/storage-3FKGLQMC.js +23 -0
- package/dist/storage-3FKGLQMC.js.map +1 -0
- package/dist/{store-coordination-provider-KTRIC6PR.js → store-coordination-provider-JJCEMTAE.js} +3 -3
- package/dist/sync/index.d.ts +2 -2
- package/dist/sync/index.js +10 -7
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.d.ts +45 -6
- package/dist/team/index.js +25 -15
- package/dist/tiers/index.d.ts +2 -2
- package/dist/tiers/index.js +11 -8
- package/dist/to/index.d.ts +2 -2
- package/dist/to/index.js +1 -1
- package/dist/{transition-guard-C1Pyz8nH.d.ts → transition-guard-C4hvR-Ac.d.ts} +1 -1
- package/dist/tx/index.d.ts +3 -3
- package/dist/tx/index.js +3 -3
- package/dist/ui/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/validators-Ctgkj5qd.d.ts +101 -0
- package/dist/{vault-diff-Fn0WeY2w.d.ts → vault-diff-B1Ir6EGs.d.ts} +1 -1
- package/dist/{verify-SW6J63Q2.js → verify-YB5LQHNA.js} +11 -7
- package/dist/{verify-SW6J63Q2.js.map → verify-YB5LQHNA.js.map} +1 -1
- package/dist/walk-T65TZDN2.js +241 -0
- package/dist/walk-T65TZDN2.js.map +1 -0
- package/dist/with/index.d.ts +3 -3
- package/dist/with/index.js +12 -9
- package/dist/{with-materialized-view-NKxs6iK5.d.ts → with-materialized-view-Bp65kKdQ.d.ts} +1 -1
- package/dist/{with-overlayed-view-B4fPYHwV.d.ts → with-overlayed-view-BRhdQNrK.d.ts} +1 -1
- package/dist/{with-rollup-Bl0sRFEt.d.ts → with-rollup-bQRPc3y1.d.ts} +1 -1
- package/dist/withdraw-accessible-JMX2TCPX.js +28 -0
- package/dist/withdraw-accessible-JMX2TCPX.js.map +1 -0
- package/package.json +7 -3
- package/dist/api-LORZ2EZU.js +0 -17
- package/dist/chunk-4DZGZ7II.js.map +0 -1
- package/dist/chunk-5A6TC3RQ.js.map +0 -1
- package/dist/chunk-5EZAJEES.js.map +0 -1
- package/dist/chunk-ADBMJDBW.js.map +0 -1
- package/dist/chunk-CPAROOKP.js.map +0 -1
- package/dist/chunk-L4IRFTIF.js.map +0 -1
- package/dist/chunk-MIOLJG2R.js.map +0 -1
- package/dist/chunk-N2FP26NH.js.map +0 -1
- package/dist/chunk-NIA5VQ7G.js.map +0 -1
- package/dist/chunk-NPVICKZE.js.map +0 -1
- package/dist/chunk-NTHKOFVL.js.map +0 -1
- package/dist/chunk-OCDUQUAP.js.map +0 -1
- package/dist/chunk-OVIVYAQL.js.map +0 -1
- package/dist/chunk-QLQS5A7X.js +0 -524
- package/dist/chunk-QLQS5A7X.js.map +0 -1
- package/dist/chunk-U6OM4E67.js.map +0 -1
- package/dist/chunk-Z44OY24N.js.map +0 -1
- package/dist/chunk-ZFME46HJ.js.map +0 -1
- package/dist/collection-facade-XPVRHBGU.js +0 -36
- package/dist/delegation-4HUHUE6T.js +0 -22
- package/dist/executor-ANFBCOYA.js +0 -9
- package/dist/executor-IKT47SH2.js +0 -9
- package/dist/executor-OIECZXTV.js +0 -18
- package/dist/export-accessible-NZWCFZHL.js +0 -20
- package/dist/extract-partition-52LX6RQH.js +0 -33
- package/dist/issue-F4SYPJGJ.js +0 -16
- package/dist/liberate-6LDETRIW.js +0 -21
- package/dist/noydb-WQNBVJIG.js +0 -54
- package/dist/registry-6HZ2JSQ7.js +0 -14
- package/dist/registry-GPXZQ7DT.js +0 -9
- package/dist/registry-USYD2ECC.js +0 -16
- package/dist/request-withdrawal-54V4L6CR.js +0 -28
- package/dist/revoke-JV26NTQD.js +0 -21
- package/dist/signer-AE56T5HE.js +0 -22
- package/dist/validators-Dzn7T-3x.d.ts +0 -62
- package/dist/withdraw-accessible-DGA4V2TP.js +0 -25
- /package/dist/{api-LORZ2EZU.js.map → api-JOXUNSKP.js.map} +0 -0
- /package/dist/{chunk-VBYVKOMJ.js.map → chunk-3QRQOBS7.js.map} +0 -0
- /package/dist/{chunk-JFYIHLU3.js.map → chunk-3Y4QLJ6K.js.map} +0 -0
- /package/dist/{chunk-BZIWKN74.js.map → chunk-43ISXURO.js.map} +0 -0
- /package/dist/{chunk-PYWW4KLO.js.map → chunk-44UTIDE2.js.map} +0 -0
- /package/dist/{chunk-7IP75FP2.js.map → chunk-4K3MQ5S3.js.map} +0 -0
- /package/dist/{chunk-2KSPDSWI.js.map → chunk-5MRE3C4Q.js.map} +0 -0
- /package/dist/{chunk-PUNJAEY6.js.map → chunk-6HNKCKFZ.js.map} +0 -0
- /package/dist/{chunk-PJDK2PPQ.js.map → chunk-6RXPSMKR.js.map} +0 -0
- /package/dist/{chunk-6DP5HBQD.js.map → chunk-6UOSONVI.js.map} +0 -0
- /package/dist/{chunk-UP6EMMDI.js.map → chunk-A4DWPOP3.js.map} +0 -0
- /package/dist/{chunk-MCJAUQGE.js.map → chunk-A5DYVMDR.js.map} +0 -0
- /package/dist/{chunk-TICO2I2O.js.map → chunk-BKGIWGCX.js.map} +0 -0
- /package/dist/{chunk-O5DNEXQC.js.map → chunk-BMQOH7MM.js.map} +0 -0
- /package/dist/{chunk-3UDPDRUC.js.map → chunk-EWR7HL3K.js.map} +0 -0
- /package/dist/{chunk-CVXLJIAV.js.map → chunk-FH52CDEW.js.map} +0 -0
- /package/dist/{chunk-FELHYKIO.js.map → chunk-G7RDYYTE.js.map} +0 -0
- /package/dist/{chunk-DHIN36UC.js.map → chunk-GQOT6QJR.js.map} +0 -0
- /package/dist/{chunk-DGUR3CC4.js.map → chunk-GXGK22QU.js.map} +0 -0
- /package/dist/{chunk-YTIAXSUE.js.map → chunk-GZZL5R73.js.map} +0 -0
- /package/dist/{chunk-E4YJUNPU.js.map → chunk-H5XRIJX3.js.map} +0 -0
- /package/dist/{chunk-DA34OEZU.js.map → chunk-H7RYPVMJ.js.map} +0 -0
- /package/dist/{chunk-2ZORB5RW.js.map → chunk-HBKDR7R3.js.map} +0 -0
- /package/dist/{chunk-ZNI3RTFV.js.map → chunk-HMXLN43G.js.map} +0 -0
- /package/dist/{chunk-BYW7EU5L.js.map → chunk-HY6ZGGEC.js.map} +0 -0
- /package/dist/{chunk-5Z3RNFJC.js.map → chunk-LIP6JWYK.js.map} +0 -0
- /package/dist/{chunk-IJW6K6UX.js.map → chunk-LPRPVCNY.js.map} +0 -0
- /package/dist/{chunk-6EVZXETK.js.map → chunk-M66NAZA4.js.map} +0 -0
- /package/dist/{chunk-HGQG3VIP.js.map → chunk-N5YVZHCB.js.map} +0 -0
- /package/dist/{chunk-6OQ7NKMZ.js.map → chunk-O2DB4C3M.js.map} +0 -0
- /package/dist/{chunk-LHYQE3BP.js.map → chunk-OFBFAVLI.js.map} +0 -0
- /package/dist/{chunk-IWVWB7BZ.js.map → chunk-OJU3CPFA.js.map} +0 -0
- /package/dist/{chunk-6I2YPLAG.js.map → chunk-P27Z66EB.js.map} +0 -0
- /package/dist/{chunk-7MHVHGQZ.js.map → chunk-P2LDXRGP.js.map} +0 -0
- /package/dist/{chunk-6RASM2J4.js.map → chunk-QKVILR7N.js.map} +0 -0
- /package/dist/{chunk-LKBLAUOB.js.map → chunk-QNTEDPWP.js.map} +0 -0
- /package/dist/{chunk-P6UXDALK.js.map → chunk-RDHAGBEB.js.map} +0 -0
- /package/dist/{chunk-XRE4JOEO.js.map → chunk-RTS23VIJ.js.map} +0 -0
- /package/dist/{chunk-5ZPWVNL3.js.map → chunk-S2WKOCTU.js.map} +0 -0
- /package/dist/{chunk-VHEEU4ZO.js.map → chunk-SW56GSYC.js.map} +0 -0
- /package/dist/{chunk-46YGCU6Z.js.map → chunk-T2EGAXPM.js.map} +0 -0
- /package/dist/{chunk-LES2Z7B4.js.map → chunk-T45LAT2Y.js.map} +0 -0
- /package/dist/{chunk-4NMFWOS2.js.map → chunk-T65UZXR6.js.map} +0 -0
- /package/dist/{chunk-2N4MUSF3.js.map → chunk-TB5RNNJ4.js.map} +0 -0
- /package/dist/{chunk-6CNLU4TO.js.map → chunk-TYGW5TOR.js.map} +0 -0
- /package/dist/{chunk-U5DWHU3S.js.map → chunk-U24XHXNK.js.map} +0 -0
- /package/dist/{chunk-YDP2SA5K.js.map → chunk-VPCMJ5Z4.js.map} +0 -0
- /package/dist/{chunk-ZAWD6O46.js.map → chunk-VRPBEOWU.js.map} +0 -0
- /package/dist/{chunk-AY4P6PHN.js.map → chunk-VWGCJUTV.js.map} +0 -0
- /package/dist/{chunk-IIK7W3AN.js.map → chunk-XJR3COJO.js.map} +0 -0
- /package/dist/{chunk-ZD4D7UM6.js.map → chunk-XYYW64LB.js.map} +0 -0
- /package/dist/{chunk-4NZCZUGL.js.map → chunk-YFF2RP3X.js.map} +0 -0
- /package/dist/{chunk-WVIIJPTJ.js.map → chunk-Z3FZC5GV.js.map} +0 -0
- /package/dist/{chunk-55HDKLI3.js.map → chunk-Z5PIUYNB.js.map} +0 -0
- /package/dist/{chunk-ZRDYQZYH.js.map → chunk-Z7KI4WHR.js.map} +0 -0
- /package/dist/{chunk-BV7KNFJY.js.map → chunk-ZBDK7T6X.js.map} +0 -0
- /package/dist/{chunk-P6DN5QU7.js.map → chunk-ZKYMKF2S.js.map} +0 -0
- /package/dist/{chunk-NMRKAGHE.js.map → chunk-ZROMNP7Q.js.map} +0 -0
- /package/dist/{collection-facade-XPVRHBGU.js.map → collection-facade-THH4ASGX.js.map} +0 -0
- /package/dist/{delegation-4HUHUE6T.js.map → computed-BMMEFRFJ.js.map} +0 -0
- /package/dist/{enclave-IS7HZSQ7.js.map → delegation-BQNIEHZE.js.map} +0 -0
- /package/dist/{executor-ANFBCOYA.js.map → enclave-YN6223OG.js.map} +0 -0
- /package/dist/{executor-IKT47SH2.js.map → executor-CBTNU5VZ.js.map} +0 -0
- /package/dist/{executor-OIECZXTV.js.map → executor-DJHNSTIR.js.map} +0 -0
- /package/dist/{export-accessible-NZWCFZHL.js.map → executor-FGISLQIN.js.map} +0 -0
- /package/dist/{extract-partition-52LX6RQH.js.map → export-accessible-P7SLRLK3.js.map} +0 -0
- /package/dist/{issue-F4SYPJGJ.js.map → extract-partition-6JGY3KYR.js.map} +0 -0
- /package/dist/{ledger-YUAJUNFP.js.map → find-RNBG7LBY.js.map} +0 -0
- /package/dist/{liberate-6LDETRIW.js.map → issue-W5QG53B5.js.map} +0 -0
- /package/dist/{noydb-WQNBVJIG.js.map → lazy/index.js.map} +0 -0
- /package/dist/{policy-LRE6HTO5.js.map → ledger-KZWBKAG5.js.map} +0 -0
- /package/dist/{public-envelope-WVRRUVAJ.js.map → liberate-AQ7OWBZZ.js.map} +0 -0
- /package/dist/{registry-6HZ2JSQ7.js.map → link-set-UQEIYQAM.js.map} +0 -0
- /package/dist/{registry-GPXZQ7DT.js.map → noydb-WQZNAECY.js.map} +0 -0
- /package/dist/{registry-USYD2ECC.js.map → policy-YIKUH4AD.js.map} +0 -0
- /package/dist/{request-withdrawal-54V4L6CR.js.map → public-envelope-MRN5YYZZ.js.map} +0 -0
- /package/dist/{revoke-JV26NTQD.js.map → register-V5AQTXNI.js.map} +0 -0
- /package/dist/{signer-AE56T5HE.js.map → registry-IMNMHWTM.js.map} +0 -0
- /package/dist/{stale-LX4BR43V.js.map → registry-K6VUQXKV.js.map} +0 -0
- /package/dist/{withdraw-accessible-DGA4V2TP.js.map → registry-ZVO3T4M5.js.map} +0 -0
- /package/dist/{store-coordination-provider-KTRIC6PR.js.map → store-coordination-provider-JJCEMTAE.js.map} +0 -0
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
jsonSchemaToFields
|
|
3
|
+
} from "./chunk-TQ3REHVF.js";
|
|
4
4
|
import {
|
|
5
5
|
NO_SEQUENCE,
|
|
6
6
|
SEQUENCE_COLLECTION,
|
|
7
7
|
compileSequenceFormat,
|
|
8
8
|
resolveSequenceKey
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-P27Z66EB.js";
|
|
10
|
+
import {
|
|
11
|
+
loadVaultPolicy
|
|
12
|
+
} from "./chunk-T45LAT2Y.js";
|
|
13
|
+
import {
|
|
14
|
+
LinkIntegrityError,
|
|
15
|
+
isLinkCollectionName,
|
|
16
|
+
linkCollectionName,
|
|
17
|
+
linkRowKey
|
|
18
|
+
} from "./chunk-P3NGV5RV.js";
|
|
19
|
+
import {
|
|
20
|
+
derivePersistedSchema,
|
|
21
|
+
isZod4Schema
|
|
22
|
+
} from "./chunk-ULIHDPKL.js";
|
|
10
23
|
import {
|
|
11
24
|
loadFence
|
|
12
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-YFF2RP3X.js";
|
|
13
26
|
import {
|
|
14
27
|
InvertedIndex,
|
|
15
28
|
MemoryIndexStore,
|
|
16
29
|
NO_SEARCH,
|
|
17
30
|
VectorSet,
|
|
18
31
|
buildPersistedIndexCallbacks
|
|
19
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-A4DWPOP3.js";
|
|
20
33
|
import {
|
|
21
34
|
ServiceBus,
|
|
22
35
|
WriteHookRegistry,
|
|
@@ -24,63 +37,65 @@ import {
|
|
|
24
37
|
assertCanImport,
|
|
25
38
|
canExport,
|
|
26
39
|
canImport
|
|
27
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-7SY3PTED.js";
|
|
28
41
|
import {
|
|
29
42
|
NO_ATTESTATION
|
|
30
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-Z7KI4WHR.js";
|
|
31
44
|
import {
|
|
32
45
|
NO_CLASSIFIED,
|
|
33
46
|
enforceClassifiedWrite,
|
|
34
47
|
resolveClassifiedFields
|
|
35
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-AF5ZRTZ4.js";
|
|
36
49
|
import {
|
|
37
50
|
NO_TIERS,
|
|
38
51
|
classifySealedShred
|
|
39
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-VMJ5URU7.js";
|
|
40
53
|
import {
|
|
41
54
|
NO_PORTABILITY
|
|
42
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-N5YVZHCB.js";
|
|
43
56
|
import {
|
|
44
57
|
CustodyApi,
|
|
45
58
|
NO_CARGO,
|
|
46
59
|
NO_CUSTODY
|
|
47
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-PI5CG2OV.js";
|
|
48
61
|
import {
|
|
49
62
|
runDrainBarrier
|
|
50
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-3Y4QLJ6K.js";
|
|
64
|
+
import {
|
|
65
|
+
PERIODS_COLLECTION
|
|
66
|
+
} from "./chunk-GZZL5R73.js";
|
|
51
67
|
import {
|
|
52
68
|
TxContext,
|
|
53
69
|
revertExecuted
|
|
54
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-T65UZXR6.js";
|
|
55
71
|
import {
|
|
56
72
|
OverlayedCollection
|
|
57
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-ZROMNP7Q.js";
|
|
58
74
|
import {
|
|
59
75
|
EXPORT_AUDIT_COLLECTION,
|
|
60
76
|
createExportBlobsHandle,
|
|
61
77
|
runCompaction
|
|
62
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-5MRE3C4Q.js";
|
|
63
79
|
import {
|
|
64
80
|
LazyQuery,
|
|
65
81
|
decodeIdxId,
|
|
66
82
|
encodeIdxId
|
|
67
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-QNTEDPWP.js";
|
|
68
84
|
import {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
85
|
+
IMPLICIT_LAZY,
|
|
86
|
+
Lru,
|
|
87
|
+
estimateRecordBytes
|
|
88
|
+
} from "./chunk-NO272T7Q.js";
|
|
72
89
|
import {
|
|
73
90
|
resolveManagedSecret,
|
|
74
91
|
saveSealedPassphrase
|
|
75
|
-
} from "./chunk-
|
|
76
|
-
import {
|
|
77
|
-
PERIODS_COLLECTION
|
|
78
|
-
} from "./chunk-YTIAXSUE.js";
|
|
92
|
+
} from "./chunk-VWGCJUTV.js";
|
|
79
93
|
import {
|
|
80
94
|
isDictCollectionName,
|
|
81
95
|
isStaticDictDescriptor
|
|
82
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-44UTIDE2.js";
|
|
83
97
|
import {
|
|
98
|
+
NO_TEAM,
|
|
84
99
|
enrollAuthenticator,
|
|
85
100
|
findAuthenticator,
|
|
86
101
|
recoverPassphrase,
|
|
@@ -89,7 +104,7 @@ import {
|
|
|
89
104
|
rotatePassphrase,
|
|
90
105
|
updateAuthenticator,
|
|
91
106
|
writeMagicLinkGrant
|
|
92
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-LEA7WJEZ.js";
|
|
93
108
|
import {
|
|
94
109
|
hasRecoveryEnrolled,
|
|
95
110
|
hasStrongRecoveryEnrolled,
|
|
@@ -99,7 +114,7 @@ import {
|
|
|
99
114
|
mintShamirRecoveryEntry,
|
|
100
115
|
savePaperRecoveryEntries,
|
|
101
116
|
saveShamirRecoveryEntries
|
|
102
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-LPRPVCNY.js";
|
|
103
118
|
import {
|
|
104
119
|
INDEXED_STORE_POLICY
|
|
105
120
|
} from "./chunk-VQNJ7UZL.js";
|
|
@@ -109,25 +124,23 @@ import {
|
|
|
109
124
|
changeSecret,
|
|
110
125
|
createOwnerKeyring,
|
|
111
126
|
ensureCollectionDEK,
|
|
112
|
-
grant,
|
|
113
127
|
hasAccess,
|
|
114
128
|
hasWritePermission,
|
|
129
|
+
isSecretBearingReservedCollection,
|
|
115
130
|
listUsers,
|
|
116
131
|
loadKeyring,
|
|
117
|
-
revoke,
|
|
118
|
-
rotateKeys,
|
|
119
132
|
updateKeyringIdentity
|
|
120
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-ZT4GWVTX.js";
|
|
121
134
|
import {
|
|
122
135
|
persistDirectoryConfig,
|
|
123
136
|
readDirectoryConfig
|
|
124
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-TB5RNNJ4.js";
|
|
125
138
|
import {
|
|
126
139
|
generateULID
|
|
127
140
|
} from "./chunk-ZJADGNYF.js";
|
|
128
141
|
import {
|
|
129
|
-
sha256Hex
|
|
130
|
-
} from "./chunk-
|
|
142
|
+
sha256Hex
|
|
143
|
+
} from "./chunk-M66NAZA4.js";
|
|
131
144
|
import {
|
|
132
145
|
NO_FORGET,
|
|
133
146
|
addSubjectRef,
|
|
@@ -136,10 +149,10 @@ import {
|
|
|
136
149
|
readDottedPath,
|
|
137
150
|
rebuildSubjectIndex,
|
|
138
151
|
removeSubjectRef
|
|
139
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-O2DB4C3M.js";
|
|
140
153
|
import {
|
|
141
154
|
NO_SEALED_RECORD
|
|
142
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-G7RDYYTE.js";
|
|
143
156
|
import {
|
|
144
157
|
RecordCodec,
|
|
145
158
|
SEALED_CEK_NS,
|
|
@@ -149,40 +162,35 @@ import {
|
|
|
149
162
|
queryByDet,
|
|
150
163
|
resolveStableCek,
|
|
151
164
|
validateSchemaInput
|
|
152
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-OVO2RZAE.js";
|
|
153
166
|
import {
|
|
154
167
|
buildTombstone,
|
|
155
168
|
isTombstone
|
|
156
|
-
} from "./chunk-
|
|
157
|
-
import {
|
|
158
|
-
encrypt,
|
|
159
|
-
sha256Hex
|
|
160
|
-
} from "./chunk-L4IRFTIF.js";
|
|
169
|
+
} from "./chunk-QKVILR7N.js";
|
|
161
170
|
import {
|
|
162
171
|
NOYDB_FORMAT_VERSION
|
|
163
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-LN22XH4B.js";
|
|
173
|
+
import {
|
|
174
|
+
encrypt
|
|
175
|
+
} from "./chunk-TLJOJBZD.js";
|
|
164
176
|
import {
|
|
165
177
|
NO_AGGREGATE,
|
|
166
178
|
Query,
|
|
167
|
-
ScanBuilder
|
|
168
|
-
|
|
169
|
-
canonicalizeStoredMoney,
|
|
170
|
-
decodeMoneyFields,
|
|
171
|
-
quantizeMoneyFields,
|
|
172
|
-
validateMoneyFieldPaths
|
|
173
|
-
} from "./chunk-N2FP26NH.js";
|
|
179
|
+
ScanBuilder
|
|
180
|
+
} from "./chunk-GBTUANXF.js";
|
|
174
181
|
import {
|
|
175
182
|
canonicalGroupKey
|
|
176
|
-
} from "./chunk-
|
|
183
|
+
} from "./chunk-P5WXDYMD.js";
|
|
177
184
|
import {
|
|
185
|
+
moneyRuntime,
|
|
178
186
|
readPath
|
|
179
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-ZKF6HH7V.js";
|
|
180
188
|
import {
|
|
181
189
|
getAtPath,
|
|
182
190
|
resolvePolicy,
|
|
183
191
|
setAtPathInPlace,
|
|
184
192
|
stripI18nFilled
|
|
185
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-4K3MQ5S3.js";
|
|
186
194
|
import {
|
|
187
195
|
AlreadyElevatedError,
|
|
188
196
|
AttestationError,
|
|
@@ -219,11 +227,11 @@ import {
|
|
|
219
227
|
UnknownDictCodeError,
|
|
220
228
|
UnsupportedIndexOptionError,
|
|
221
229
|
ValidationError
|
|
222
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-U23JUUPX.js";
|
|
223
231
|
|
|
224
232
|
// src/port/by/default-provider.ts
|
|
225
233
|
async function createDefaultCoordinationProvider(store) {
|
|
226
|
-
const { StoreCoordinationProvider } = await import("./store-coordination-provider-
|
|
234
|
+
const { StoreCoordinationProvider } = await import("./store-coordination-provider-JJCEMTAE.js");
|
|
227
235
|
return new StoreCoordinationProvider(store);
|
|
228
236
|
}
|
|
229
237
|
|
|
@@ -237,6 +245,21 @@ function guardClassifiedCompat(collection, byField, ctx) {
|
|
|
237
245
|
"digest-only/recoverable classified fields cannot combine with a crdt mode or a conflictPolicy resolver \u2014 merge paths bypass write enforcement (R2)"
|
|
238
246
|
);
|
|
239
247
|
}
|
|
248
|
+
for (const [f, spec] of Object.entries(byField)) {
|
|
249
|
+
if (spec.equatable === true && spec.storage !== "digest-only") {
|
|
250
|
+
throw new ClassifiedConfigError(
|
|
251
|
+
collection,
|
|
252
|
+
`field "${f}" declares equatable but storage is '${spec.storage}' \u2014 equatable is a digest-only knob; recoverable equality is _det's job (R7)`
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const hasEquatable = Object.values(byField).some((s) => s.equatable === true);
|
|
257
|
+
if (hasEquatable && ctx.acknowledgeEquatableRisk !== true) {
|
|
258
|
+
throw new ClassifiedConfigError(
|
|
259
|
+
collection,
|
|
260
|
+
`classified equatable fields require \`acknowledgeEquatableRisk: true\` \u2014 equal values produce equal store-visible index tags (a partition leak a DEK holder can offline-dictionary at the PBKDF2 floor); the door is the real control for low-entropy fields (R8)`
|
|
261
|
+
);
|
|
262
|
+
}
|
|
240
263
|
if (digestOnly.length === 0) return;
|
|
241
264
|
if (!ctx.storeCiphertext) {
|
|
242
265
|
throw new ClassifiedConfigError(
|
|
@@ -279,34 +302,6 @@ function guardClassifiedCompat(collection, byField, ctx) {
|
|
|
279
302
|
}
|
|
280
303
|
}
|
|
281
304
|
|
|
282
|
-
// src/with-formula/computed/index.ts
|
|
283
|
-
var ComputedFieldError = class extends NoydbError {
|
|
284
|
-
constructor(field, id, cause) {
|
|
285
|
-
super(
|
|
286
|
-
"COMPUTED_FIELD",
|
|
287
|
-
`computed field "${field}" threw for record "${id}": ` + (cause instanceof Error ? cause.message : String(cause))
|
|
288
|
-
);
|
|
289
|
-
this.field = field;
|
|
290
|
-
this.id = id;
|
|
291
|
-
this.cause = cause;
|
|
292
|
-
this.name = "ComputedFieldError";
|
|
293
|
-
}
|
|
294
|
-
field;
|
|
295
|
-
id;
|
|
296
|
-
cause;
|
|
297
|
-
};
|
|
298
|
-
function evalComputedFields(record, computed, id) {
|
|
299
|
-
const out = { ...record };
|
|
300
|
-
for (const [field, fn] of Object.entries(computed)) {
|
|
301
|
-
try {
|
|
302
|
-
out[field] = fn(out);
|
|
303
|
-
} catch (cause) {
|
|
304
|
-
throw new ComputedFieldError(field, id, cause);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return out;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
305
|
// src/with-lookup/indexing/collection-facade.ts
|
|
311
306
|
function readPersistedValue(record, field) {
|
|
312
307
|
if (!field.includes(".")) return record[field];
|
|
@@ -561,89 +556,6 @@ async function purgePersistedIndexes(ctx, id) {
|
|
|
561
556
|
return { purged, residue };
|
|
562
557
|
}
|
|
563
558
|
|
|
564
|
-
// src/with-shape/persisted-schemas/canonicalize.ts
|
|
565
|
-
function canonicalize(value) {
|
|
566
|
-
if (value === null || typeof value !== "object") {
|
|
567
|
-
return JSON.stringify(value);
|
|
568
|
-
}
|
|
569
|
-
if (Array.isArray(value)) {
|
|
570
|
-
return "[" + value.map(canonicalize).join(",") + "]";
|
|
571
|
-
}
|
|
572
|
-
const obj = value;
|
|
573
|
-
const keys = Object.keys(obj).sort();
|
|
574
|
-
const parts = keys.map((k) => JSON.stringify(k) + ":" + canonicalize(obj[k]));
|
|
575
|
-
return "{" + parts.join(",") + "}";
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// src/with-shape/persisted-schemas/derive.ts
|
|
579
|
-
function isZodSchema(value) {
|
|
580
|
-
if (value === null || typeof value !== "object") return false;
|
|
581
|
-
const std = value["~standard"];
|
|
582
|
-
if (std && typeof std === "object" && std.vendor === "zod") return true;
|
|
583
|
-
const def = value._def;
|
|
584
|
-
if (!def || typeof def !== "object") return false;
|
|
585
|
-
return typeof def.typeName === "string" && def.typeName.startsWith("Zod");
|
|
586
|
-
}
|
|
587
|
-
function detectKind(validator) {
|
|
588
|
-
if (isZodSchema(validator)) return "Zod";
|
|
589
|
-
return "Unknown";
|
|
590
|
-
}
|
|
591
|
-
function isZod4Schema(value) {
|
|
592
|
-
if (value === null || typeof value !== "object") return false;
|
|
593
|
-
return "_zod" in value;
|
|
594
|
-
}
|
|
595
|
-
async function loadZodToJsonSchemaConverter() {
|
|
596
|
-
try {
|
|
597
|
-
const mod = await import("zod-to-json-schema");
|
|
598
|
-
if (!mod.zodToJsonSchema) {
|
|
599
|
-
throw new Error("zod-to-json-schema export missing");
|
|
600
|
-
}
|
|
601
|
-
return mod.zodToJsonSchema;
|
|
602
|
-
} catch (err) {
|
|
603
|
-
throw new Error(
|
|
604
|
-
`persistJsonSchema requires the optional peer-dep \`zod-to-json-schema\`. Install it: \`pnpm add zod-to-json-schema\` (or npm/yarn equivalent). Original error: ${err instanceof Error ? err.message : String(err)}`
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
async function loadZodV4Converter() {
|
|
609
|
-
try {
|
|
610
|
-
const mod = await import("./zod-HAJM7LMS.js");
|
|
611
|
-
if (typeof mod.toJSONSchema !== "function") {
|
|
612
|
-
throw new Error("zod.toJSONSchema not available (zod v4 required)");
|
|
613
|
-
}
|
|
614
|
-
return mod.toJSONSchema;
|
|
615
|
-
} catch (err) {
|
|
616
|
-
throw new Error(
|
|
617
|
-
`persistJsonSchema with a Zod v4 schema requires zod@4 with toJSONSchema. Original error: ${err instanceof Error ? err.message : String(err)}`
|
|
618
|
-
);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
async function derivePersistedSchema(validator) {
|
|
622
|
-
const kind = detectKind(validator);
|
|
623
|
-
const derivedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
624
|
-
if (kind === "Zod") {
|
|
625
|
-
let jsonSchema;
|
|
626
|
-
if (isZod4Schema(validator)) {
|
|
627
|
-
const convert = await loadZodV4Converter();
|
|
628
|
-
jsonSchema = convert(validator);
|
|
629
|
-
} else {
|
|
630
|
-
const convert = await loadZodToJsonSchemaConverter();
|
|
631
|
-
jsonSchema = convert(validator);
|
|
632
|
-
}
|
|
633
|
-
const canonical = canonicalize(jsonSchema);
|
|
634
|
-
const hash = await sha256Hex(new TextEncoder().encode(canonical));
|
|
635
|
-
return { _noydb_schema: 1, kind, jsonSchema, hash, derivedAt };
|
|
636
|
-
}
|
|
637
|
-
return {
|
|
638
|
-
_noydb_schema: 1,
|
|
639
|
-
kind,
|
|
640
|
-
jsonSchema: null,
|
|
641
|
-
hash: null,
|
|
642
|
-
reason: `derivation not yet supported for kind=${kind} (v0 supports Zod only)`,
|
|
643
|
-
derivedAt
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
|
|
647
559
|
// src/with-lookup/indexing/strategy.ts
|
|
648
560
|
var NO_INDEXING = {
|
|
649
561
|
createState() {
|
|
@@ -889,97 +801,6 @@ function resolveFieldMeta(key, inputs) {
|
|
|
889
801
|
};
|
|
890
802
|
}
|
|
891
803
|
|
|
892
|
-
// src/with-shape/introspection/fields.ts
|
|
893
|
-
function jsonSchemaType(node) {
|
|
894
|
-
if (Array.isArray(node.type)) {
|
|
895
|
-
const non = node.type.filter((t) => t !== "null");
|
|
896
|
-
return non[0] ?? "opaque";
|
|
897
|
-
}
|
|
898
|
-
if (node.enum && Array.isArray(node.enum)) return "enum";
|
|
899
|
-
if (node.const !== void 0) return "enum";
|
|
900
|
-
if (typeof node.type === "string") return node.type;
|
|
901
|
-
return "opaque";
|
|
902
|
-
}
|
|
903
|
-
function constraintsFor(node) {
|
|
904
|
-
const out = {};
|
|
905
|
-
if (node.enum) out.values = node.enum;
|
|
906
|
-
if (node.const !== void 0) out.values = [node.const];
|
|
907
|
-
if (node.minLength !== void 0) out.minLength = node.minLength;
|
|
908
|
-
if (node.maxLength !== void 0) out.maxLength = node.maxLength;
|
|
909
|
-
if (node.pattern !== void 0) out.pattern = node.pattern;
|
|
910
|
-
if (node.format !== void 0) out.format = node.format;
|
|
911
|
-
if (node.minimum !== void 0) out.minimum = node.minimum;
|
|
912
|
-
if (node.maximum !== void 0) out.maximum = node.maximum;
|
|
913
|
-
if (node.exclusiveMinimum !== void 0) out.gt = node.exclusiveMinimum;
|
|
914
|
-
if (node.exclusiveMaximum !== void 0) out.lt = node.exclusiveMaximum;
|
|
915
|
-
return Object.keys(out).length === 0 ? void 0 : out;
|
|
916
|
-
}
|
|
917
|
-
function extractObjectFields(obj, source, refs) {
|
|
918
|
-
const required = new Set(Array.isArray(obj.required) ? obj.required : []);
|
|
919
|
-
const fields = {};
|
|
920
|
-
if (!obj.properties || typeof obj.properties !== "object") return { fields, required };
|
|
921
|
-
for (const [name, node] of Object.entries(obj.properties)) {
|
|
922
|
-
const descriptor = {
|
|
923
|
-
type: jsonSchemaType(node),
|
|
924
|
-
source,
|
|
925
|
-
...required.has(name) ? {} : { optional: true },
|
|
926
|
-
...refs?.[name] ? { references: `${refs[name].target}.id` } : {}
|
|
927
|
-
};
|
|
928
|
-
const constraints = constraintsFor(node);
|
|
929
|
-
if (constraints) descriptor.constraints = constraints;
|
|
930
|
-
fields[name] = descriptor;
|
|
931
|
-
}
|
|
932
|
-
return { fields, required };
|
|
933
|
-
}
|
|
934
|
-
function mergeUnionMembers(members, source, refs) {
|
|
935
|
-
if (members.length === 0) return {};
|
|
936
|
-
const extracted = members.filter((m) => m.properties && typeof m.properties === "object").map((m) => extractObjectFields(m, source, refs));
|
|
937
|
-
if (extracted.length === 0) return {};
|
|
938
|
-
const allNames = /* @__PURE__ */ new Set();
|
|
939
|
-
for (const { fields } of extracted) {
|
|
940
|
-
for (const name of Object.keys(fields)) allNames.add(name);
|
|
941
|
-
}
|
|
942
|
-
const memberCount = extracted.length;
|
|
943
|
-
const out = {};
|
|
944
|
-
for (const name of allNames) {
|
|
945
|
-
const presentIn = extracted.filter(({ fields }) => name in fields);
|
|
946
|
-
const requiredInAll = presentIn.length === memberCount && presentIn.every(({ required }) => required.has(name));
|
|
947
|
-
const base = presentIn[0].fields[name];
|
|
948
|
-
const allValues = [];
|
|
949
|
-
for (const { fields } of presentIn) {
|
|
950
|
-
const fd = fields[name];
|
|
951
|
-
if (fd?.constraints?.values && Array.isArray(fd.constraints.values)) {
|
|
952
|
-
for (const v of fd.constraints.values) {
|
|
953
|
-
if (!allValues.includes(v)) allValues.push(v);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
const mergedConstraints = allValues.length > 0 ? { ...base.constraints ?? {}, values: allValues } : base.constraints;
|
|
958
|
-
const descriptor = {
|
|
959
|
-
type: base.type,
|
|
960
|
-
source,
|
|
961
|
-
...requiredInAll ? {} : { optional: true },
|
|
962
|
-
...base.references ? { references: base.references } : {}
|
|
963
|
-
};
|
|
964
|
-
if (mergedConstraints) {
|
|
965
|
-
descriptor.constraints = mergedConstraints;
|
|
966
|
-
}
|
|
967
|
-
out[name] = descriptor;
|
|
968
|
-
}
|
|
969
|
-
return out;
|
|
970
|
-
}
|
|
971
|
-
function jsonSchemaToFields(jsonSchema, source, refs) {
|
|
972
|
-
if (!jsonSchema || typeof jsonSchema !== "object") return {};
|
|
973
|
-
const root = jsonSchema;
|
|
974
|
-
const unionMembers = root.anyOf ?? root.oneOf;
|
|
975
|
-
if (Array.isArray(unionMembers) && unionMembers.length > 0) {
|
|
976
|
-
return mergeUnionMembers(unionMembers, source, refs);
|
|
977
|
-
}
|
|
978
|
-
if (!root.properties || typeof root.properties !== "object") return {};
|
|
979
|
-
const { fields } = extractObjectFields(root, source, refs);
|
|
980
|
-
return fields;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
804
|
// src/with-shape/introspection/describe.ts
|
|
984
805
|
var ZOD_META_KEYS = /* @__PURE__ */ new Set([
|
|
985
806
|
"label",
|
|
@@ -1185,7 +1006,8 @@ function buildDescription(input) {
|
|
|
1185
1006
|
classified: {
|
|
1186
1007
|
preset: cls.preset,
|
|
1187
1008
|
storage: cls.storage,
|
|
1188
|
-
list: cls.list.kind === "omit" ? "omit" : cls.list.kind === "mask" ? { mask: cls.list.pattern } : { rider: cls.list.rider }
|
|
1009
|
+
list: cls.list.kind === "omit" ? "omit" : cls.list.kind === "mask" ? { mask: cls.list.pattern } : { rider: cls.list.rider },
|
|
1010
|
+
...cls.equatable === true ? { equatable: true } : {}
|
|
1189
1011
|
}
|
|
1190
1012
|
} : {}
|
|
1191
1013
|
};
|
|
@@ -1202,204 +1024,6 @@ function buildDescription(input) {
|
|
|
1202
1024
|
};
|
|
1203
1025
|
}
|
|
1204
1026
|
|
|
1205
|
-
// src/with-shape/introspection/json-schema.ts
|
|
1206
|
-
function jsonType(t) {
|
|
1207
|
-
switch (t) {
|
|
1208
|
-
case "number":
|
|
1209
|
-
return "number";
|
|
1210
|
-
case "boolean":
|
|
1211
|
-
return "boolean";
|
|
1212
|
-
case "array":
|
|
1213
|
-
return "array";
|
|
1214
|
-
case "object":
|
|
1215
|
-
return "object";
|
|
1216
|
-
default:
|
|
1217
|
-
return "string";
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
function buildJsonSchema(desc, base) {
|
|
1221
|
-
const baseProps = base?.["properties"] ?? {};
|
|
1222
|
-
const properties = {};
|
|
1223
|
-
for (const f of desc.fields) {
|
|
1224
|
-
const prop = { ...baseProps[f.key] ?? { type: jsonType(f.type) } };
|
|
1225
|
-
prop["x-label"] = f.label;
|
|
1226
|
-
if (f.unit !== void 0) prop["x-unit"] = f.unit;
|
|
1227
|
-
if (f.semanticType !== void 0) prop["x-semanticType"] = f.semanticType;
|
|
1228
|
-
if (f.sensitivity !== void 0) prop["x-sensitivity"] = f.sensitivity;
|
|
1229
|
-
if (f.widget !== void 0) prop["x-widget"] = f.widget;
|
|
1230
|
-
if (f.editable === false) prop["x-readonly"] = true;
|
|
1231
|
-
if (f.money !== void 0) prop["x-money"] = f.money;
|
|
1232
|
-
if (f.ref !== void 0) prop["x-ref"] = f.ref.target;
|
|
1233
|
-
if (f.dict?.values) {
|
|
1234
|
-
const labels = {};
|
|
1235
|
-
for (const v of f.dict.values) if (v.label !== void 0) labels[v.value] = v.label;
|
|
1236
|
-
if (Object.keys(labels).length) prop["x-enumLabels"] = labels;
|
|
1237
|
-
}
|
|
1238
|
-
if (f.classified !== void 0) prop["x-classified"] = f.classified;
|
|
1239
|
-
properties[f.key] = prop;
|
|
1240
|
-
}
|
|
1241
|
-
return base != null && typeof base === "object" ? { ...base, properties } : { type: "object", properties };
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
// src/kernel/cache/lru.ts
|
|
1245
|
-
var Lru = class {
|
|
1246
|
-
entries = /* @__PURE__ */ new Map();
|
|
1247
|
-
maxRecords;
|
|
1248
|
-
maxBytes;
|
|
1249
|
-
currentBytes = 0;
|
|
1250
|
-
hits = 0;
|
|
1251
|
-
misses = 0;
|
|
1252
|
-
evictions = 0;
|
|
1253
|
-
constructor(options) {
|
|
1254
|
-
if (options.maxRecords === void 0 && options.maxBytes === void 0) {
|
|
1255
|
-
throw new Error("Lru: must specify maxRecords, maxBytes, or both");
|
|
1256
|
-
}
|
|
1257
|
-
this.maxRecords = options.maxRecords;
|
|
1258
|
-
this.maxBytes = options.maxBytes;
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Look up a key. Hits promote the entry to most-recently-used; misses
|
|
1262
|
-
* return undefined. Both update the running stats counters.
|
|
1263
|
-
*/
|
|
1264
|
-
get(key) {
|
|
1265
|
-
const entry = this.entries.get(key);
|
|
1266
|
-
if (!entry) {
|
|
1267
|
-
this.misses++;
|
|
1268
|
-
return void 0;
|
|
1269
|
-
}
|
|
1270
|
-
this.entries.delete(key);
|
|
1271
|
-
this.entries.set(key, entry);
|
|
1272
|
-
this.hits++;
|
|
1273
|
-
return entry.value;
|
|
1274
|
-
}
|
|
1275
|
-
/**
|
|
1276
|
-
* Insert or update a key. If the key already exists, its size is
|
|
1277
|
-
* accounted for and the entry is promoted to MRU. After insertion,
|
|
1278
|
-
* eviction runs to maintain both budgets.
|
|
1279
|
-
*/
|
|
1280
|
-
set(key, value, size) {
|
|
1281
|
-
const existing = this.entries.get(key);
|
|
1282
|
-
if (existing) {
|
|
1283
|
-
this.currentBytes -= existing.size;
|
|
1284
|
-
this.entries.delete(key);
|
|
1285
|
-
}
|
|
1286
|
-
this.entries.set(key, { value, size });
|
|
1287
|
-
this.currentBytes += size;
|
|
1288
|
-
this.evictUntilUnderBudget();
|
|
1289
|
-
}
|
|
1290
|
-
/**
|
|
1291
|
-
* Remove a key without affecting hit/miss stats. Used by `Collection.delete()`.
|
|
1292
|
-
* Returns true if the key was present.
|
|
1293
|
-
*/
|
|
1294
|
-
remove(key) {
|
|
1295
|
-
const existing = this.entries.get(key);
|
|
1296
|
-
if (!existing) return false;
|
|
1297
|
-
this.currentBytes -= existing.size;
|
|
1298
|
-
this.entries.delete(key);
|
|
1299
|
-
return true;
|
|
1300
|
-
}
|
|
1301
|
-
/** True if the cache currently holds an entry for the given key. */
|
|
1302
|
-
has(key) {
|
|
1303
|
-
return this.entries.has(key);
|
|
1304
|
-
}
|
|
1305
|
-
/**
|
|
1306
|
-
* Drop every entry. Stats counters survive — call `resetStats()` if you
|
|
1307
|
-
* want a clean slate. Used by `Collection.invalidate()` on key rotation.
|
|
1308
|
-
*/
|
|
1309
|
-
clear() {
|
|
1310
|
-
this.entries.clear();
|
|
1311
|
-
this.currentBytes = 0;
|
|
1312
|
-
}
|
|
1313
|
-
/** Reset hit/miss/eviction counters to zero. Does NOT touch entries. */
|
|
1314
|
-
resetStats() {
|
|
1315
|
-
this.hits = 0;
|
|
1316
|
-
this.misses = 0;
|
|
1317
|
-
this.evictions = 0;
|
|
1318
|
-
}
|
|
1319
|
-
/** Snapshot of current cache statistics. Cheap — no copying. */
|
|
1320
|
-
stats() {
|
|
1321
|
-
return {
|
|
1322
|
-
hits: this.hits,
|
|
1323
|
-
misses: this.misses,
|
|
1324
|
-
evictions: this.evictions,
|
|
1325
|
-
size: this.entries.size,
|
|
1326
|
-
bytes: this.currentBytes
|
|
1327
|
-
};
|
|
1328
|
-
}
|
|
1329
|
-
/**
|
|
1330
|
-
* Iterate over all currently-cached values. Order is least-recently-used
|
|
1331
|
-
* first. Used by tests and devtools — production callers should use
|
|
1332
|
-
* `Collection.scan()` instead.
|
|
1333
|
-
*/
|
|
1334
|
-
*values() {
|
|
1335
|
-
for (const entry of this.entries.values()) yield entry.value;
|
|
1336
|
-
}
|
|
1337
|
-
/**
|
|
1338
|
-
* Walk the cache from the LRU end and drop entries until both budgets
|
|
1339
|
-
* are satisfied. Called after every `set()`. Single pass — entries are
|
|
1340
|
-
* never re-promoted during eviction.
|
|
1341
|
-
*/
|
|
1342
|
-
evictUntilUnderBudget() {
|
|
1343
|
-
while (this.overBudget()) {
|
|
1344
|
-
const oldest = this.entries.keys().next();
|
|
1345
|
-
if (oldest.done) return;
|
|
1346
|
-
const key = oldest.value;
|
|
1347
|
-
const entry = this.entries.get(key);
|
|
1348
|
-
if (entry) this.currentBytes -= entry.size;
|
|
1349
|
-
this.entries.delete(key);
|
|
1350
|
-
this.evictions++;
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
overBudget() {
|
|
1354
|
-
if (this.maxRecords !== void 0 && this.entries.size > this.maxRecords) return true;
|
|
1355
|
-
if (this.maxBytes !== void 0 && this.currentBytes > this.maxBytes) return true;
|
|
1356
|
-
return false;
|
|
1357
|
-
}
|
|
1358
|
-
};
|
|
1359
|
-
|
|
1360
|
-
// src/kernel/cache/policy.ts
|
|
1361
|
-
var UNITS = {
|
|
1362
|
-
"": 1,
|
|
1363
|
-
"B": 1,
|
|
1364
|
-
"KB": 1024,
|
|
1365
|
-
"MB": 1024 * 1024,
|
|
1366
|
-
"GB": 1024 * 1024 * 1024
|
|
1367
|
-
// 'TB' deliberately not supported — if you need it, you're not using NOYDB.
|
|
1368
|
-
};
|
|
1369
|
-
function parseBytes(input) {
|
|
1370
|
-
if (typeof input === "number") {
|
|
1371
|
-
if (!Number.isFinite(input) || input <= 0) {
|
|
1372
|
-
throw new Error(`parseBytes: numeric input must be a positive finite number, got ${String(input)}`);
|
|
1373
|
-
}
|
|
1374
|
-
return Math.floor(input);
|
|
1375
|
-
}
|
|
1376
|
-
const trimmed = input.trim();
|
|
1377
|
-
if (trimmed === "") {
|
|
1378
|
-
throw new Error("parseBytes: empty string is not a valid byte budget");
|
|
1379
|
-
}
|
|
1380
|
-
const match = /^([0-9]+(?:\.[0-9]+)?)\s*([A-Za-z]*)$/.exec(trimmed);
|
|
1381
|
-
if (!match) {
|
|
1382
|
-
throw new Error(`parseBytes: invalid byte budget "${input}". Expected format: "1024", "50KB", "50MB", "1GB"`);
|
|
1383
|
-
}
|
|
1384
|
-
const value = parseFloat(match[1]);
|
|
1385
|
-
const unit = (match[2] ?? "").toUpperCase();
|
|
1386
|
-
if (!(unit in UNITS)) {
|
|
1387
|
-
throw new Error(`parseBytes: unknown unit "${match[2]}" in "${input}". Supported: B, KB, MB, GB`);
|
|
1388
|
-
}
|
|
1389
|
-
const bytes = Math.floor(value * UNITS[unit]);
|
|
1390
|
-
if (bytes <= 0) {
|
|
1391
|
-
throw new Error(`parseBytes: byte budget must be > 0, got ${bytes} from "${input}"`);
|
|
1392
|
-
}
|
|
1393
|
-
return bytes;
|
|
1394
|
-
}
|
|
1395
|
-
function estimateRecordBytes(record) {
|
|
1396
|
-
try {
|
|
1397
|
-
return JSON.stringify(record).length;
|
|
1398
|
-
} catch {
|
|
1399
|
-
return 0;
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
1027
|
// src/with-formula/derivations/stale.ts
|
|
1404
1028
|
var _staleByRegistry = /* @__PURE__ */ new WeakMap();
|
|
1405
1029
|
var keyFor = (source, sourceId) => `${source}/${sourceId}`;
|
|
@@ -1436,7 +1060,7 @@ async function resolveStaleOnRead(accessor, outputCollection, id) {
|
|
|
1436
1060
|
}
|
|
1437
1061
|
const sourceWithId = { ...source, id };
|
|
1438
1062
|
if (DerivationExecutor === null) {
|
|
1439
|
-
({ DerivationExecutor } = await import("./executor-
|
|
1063
|
+
({ DerivationExecutor } = await import("./executor-CBTNU5VZ.js"));
|
|
1440
1064
|
}
|
|
1441
1065
|
const ctx = { vault: accessor.getReadOnlyFacade() };
|
|
1442
1066
|
const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
|
|
@@ -1593,7 +1217,7 @@ function resolveCollectionConfig(opts) {
|
|
|
1593
1217
|
`Collection "${opts.name}": embeddings are not supported on CRDT collections (L2). Use a non-CRDT collection for semantic search.`
|
|
1594
1218
|
);
|
|
1595
1219
|
}
|
|
1596
|
-
if (opts.moneyFields) validateMoneyFieldPaths(opts.moneyFields);
|
|
1220
|
+
if (opts.moneyFields) moneyRuntime().validateMoneyFieldPaths(opts.moneyFields);
|
|
1597
1221
|
const resolvedClassified = opts.classifiedFields !== void 0 ? resolveClassifiedFields(opts.name, opts.classifiedFields) : void 0;
|
|
1598
1222
|
let mergedComputed = opts.computed;
|
|
1599
1223
|
if (resolvedClassified !== void 0) {
|
|
@@ -1636,7 +1260,8 @@ function resolveCollectionConfig(opts) {
|
|
|
1636
1260
|
textIndexFields: new Set(opts.textIndexes ?? []),
|
|
1637
1261
|
vectorSourceFields: new Set(embeddingSources),
|
|
1638
1262
|
subjectKeyField: opts.subjectKeyField,
|
|
1639
|
-
bareSensitiveFields: new Set(opts.sensitive ?? [])
|
|
1263
|
+
bareSensitiveFields: new Set(opts.sensitive ?? []),
|
|
1264
|
+
acknowledgeEquatableRisk: opts.acknowledgeEquatableRisk === true
|
|
1640
1265
|
};
|
|
1641
1266
|
if (resolvedClassified !== void 0) {
|
|
1642
1267
|
guardClassifiedCompat(opts.name, resolvedClassified.byField, classifiedGuardCtx);
|
|
@@ -1647,6 +1272,7 @@ function resolveCollectionConfig(opts) {
|
|
|
1647
1272
|
const vdigEntries = resolvedClassified === void 0 ? [] : Object.entries(resolvedClassified.byField).filter(([, s]) => s.storage === "digest-only").map(([f, s]) => [f, {
|
|
1648
1273
|
normalize: s.verifyNormalize ?? "password",
|
|
1649
1274
|
notLastN: s.notLastN ?? 0,
|
|
1275
|
+
equatable: s.equatable === true,
|
|
1650
1276
|
...s.rotateDays !== void 0 ? { rotateDays: s.rotateDays } : {}
|
|
1651
1277
|
}]);
|
|
1652
1278
|
const vdigFields = vdigEntries.length > 0 ? new Map(vdigEntries) : null;
|
|
@@ -1721,6 +1347,13 @@ function resolveCollectionConfig(opts) {
|
|
|
1721
1347
|
};
|
|
1722
1348
|
}
|
|
1723
1349
|
|
|
1350
|
+
// src/with-formula/computed/lazy.ts
|
|
1351
|
+
var fn = null;
|
|
1352
|
+
async function loadEvalComputedFields() {
|
|
1353
|
+
fn ??= (await import("./computed-BMMEFRFJ.js")).evalComputedFields;
|
|
1354
|
+
return fn;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1724
1357
|
// src/kernel/collection.ts
|
|
1725
1358
|
function selfWriteFieldEqual(a, b) {
|
|
1726
1359
|
if (a === b) return true;
|
|
@@ -1967,6 +1600,9 @@ var Collection = class {
|
|
|
1967
1600
|
* `_vdig` forward under (C6). `null` when the collection declares none.
|
|
1968
1601
|
*/
|
|
1969
1602
|
vdigFields;
|
|
1603
|
+
/** C-A/R10 memoization: marker declared-set lookup (undefined=unresolved) + classified-handle persist-once flag. */
|
|
1604
|
+
_markerDigestOnlyCache = void 0;
|
|
1605
|
+
_markerPersisted = false;
|
|
1970
1606
|
/**
|
|
1971
1607
|
* Tree-shake seam for `reveal()` — defaults to `NO_CLASSIFIED`, which
|
|
1972
1608
|
* throws `ClassifiedNotEnabledError`. Set via the `classifiedStrategy`
|
|
@@ -2232,7 +1868,8 @@ var Collection = class {
|
|
|
2232
1868
|
crdtStrategy: this.crdtStrategy,
|
|
2233
1869
|
schema: this.schema,
|
|
2234
1870
|
getDEK: () => this.getDEK(this.name),
|
|
2235
|
-
cekCache: this.cekCache
|
|
1871
|
+
cekCache: this.cekCache,
|
|
1872
|
+
classifiedMarkerDigestOnly: () => this._classifiedMarkerDigestOnly()
|
|
2236
1873
|
});
|
|
2237
1874
|
if (opts.crdt && opts.onRegisterConflictResolver) {
|
|
2238
1875
|
const crdtMode = opts.crdt;
|
|
@@ -2304,15 +1941,7 @@ var Collection = class {
|
|
|
2304
1941
|
}
|
|
2305
1942
|
this.lazy = opts.prefetch === false;
|
|
2306
1943
|
if (this.lazy) {
|
|
2307
|
-
|
|
2308
|
-
throw new Error(
|
|
2309
|
-
`Collection "${this.name}": lazy mode (prefetch: false) requires a cache option with maxRecords and/or maxBytes. An unbounded lazy cache defeats the purpose.`
|
|
2310
|
-
);
|
|
2311
|
-
}
|
|
2312
|
-
const lruOptions = {};
|
|
2313
|
-
if (opts.cache.maxRecords !== void 0) lruOptions.maxRecords = opts.cache.maxRecords;
|
|
2314
|
-
if (opts.cache.maxBytes !== void 0) lruOptions.maxBytes = parseBytes(opts.cache.maxBytes);
|
|
2315
|
-
this.lru = new Lru(lruOptions);
|
|
1944
|
+
this.lru = (opts.lazyStrategy ?? IMPLICIT_LAZY).createCache(this.name, opts.cache);
|
|
2316
1945
|
this.hydrated = true;
|
|
2317
1946
|
} else {
|
|
2318
1947
|
this.lru = null;
|
|
@@ -2443,6 +2072,7 @@ var Collection = class {
|
|
|
2443
2072
|
}
|
|
2444
2073
|
/** JSON Schema for this collection with describe() metadata as x- extensions. */
|
|
2445
2074
|
async toJSONSchema() {
|
|
2075
|
+
const { buildJsonSchema } = await import("./json-schema-I22JCYCG.js");
|
|
2446
2076
|
const desc = await this.describe({});
|
|
2447
2077
|
let base = null;
|
|
2448
2078
|
if (this.schema !== void 0) {
|
|
@@ -2506,6 +2136,140 @@ var Collection = class {
|
|
|
2506
2136
|
} } : {}
|
|
2507
2137
|
};
|
|
2508
2138
|
}
|
|
2139
|
+
/**
|
|
2140
|
+
* Equatable blind-index lookup: the ids whose classified digest-only
|
|
2141
|
+
* `equatable` field carries a `_bidx` tag matching `candidate` AND whose
|
|
2142
|
+
* `_vdig` payload confirms it. Requires the field to be declared
|
|
2143
|
+
* `classified.password({ equatable: true })` (or `secretAnswer`) and the
|
|
2144
|
+
* collection to have opened its `acknowledgeEquatableRisk` door.
|
|
2145
|
+
*
|
|
2146
|
+
* The algorithm order is load-bearing (spec §3):
|
|
2147
|
+
* 1. Caller-bug refusals thrown at ~0 elapsed, BEFORE any PBKDF2 (R9 /
|
|
2148
|
+
* Oracle #6): the three field mis-declarations share ONE constant,
|
|
2149
|
+
* field-name-free message so the refusal text cannot enumerate which
|
|
2150
|
+
* fields are classified / digest-only / equatable.
|
|
2151
|
+
* 2. Derive the ONE blind-index target UNCONDITIONALLY (I-1 / F1): an empty
|
|
2152
|
+
* collection still pays exactly one 600K PBKDF2, so wall-time can never
|
|
2153
|
+
* distinguish "no records" from "no match". No early return may precede
|
|
2154
|
+
* this line.
|
|
2155
|
+
* 3. Scan `list + one get` per id, string-comparing the stored `_bidx` tag —
|
|
2156
|
+
* decrypting NOTHING — and retain each hit's already-fetched envelope.
|
|
2157
|
+
* 4. Emit the single sweep consent op (`onAccess('find', '*')`) now — after
|
|
2158
|
+
* the scan, before confirm (Oracle #5) — fixing its store-write timestamp
|
|
2159
|
+
* independent of hit count.
|
|
2160
|
+
* 5. Confirm-by-verify against the ALREADY-FETCHED envelope (C-B): run the
|
|
2161
|
+
* enclave `verifyDigestField` on an in-memory `getEnvelope` closure so the
|
|
2162
|
+
* confirm reads ZERO additional envelopes. A tag-hit whose `_vdig` fails
|
|
2163
|
+
* to confirm is dropped silently (a splice is indistinguishable from a
|
|
2164
|
+
* stale tag). Store-shape law: the only store calls are `list + N get`.
|
|
2165
|
+
*/
|
|
2166
|
+
async findByDigest(field, candidate) {
|
|
2167
|
+
const spec = this.classified?.byField[field];
|
|
2168
|
+
if (spec === void 0 || spec.storage !== "digest-only" || spec.equatable !== true) {
|
|
2169
|
+
throw new ClassifiedVerifyError(
|
|
2170
|
+
this.name,
|
|
2171
|
+
"*",
|
|
2172
|
+
"not a declared equatable digest-only classified field"
|
|
2173
|
+
);
|
|
2174
|
+
}
|
|
2175
|
+
if (typeof candidate !== "string") {
|
|
2176
|
+
throw new ClassifiedVerifyError(this.name, "*", "candidate must be a string");
|
|
2177
|
+
}
|
|
2178
|
+
const target = await this.classifiedStrategy.computeTarget(this._classifiedVerifyCtx(spec), field, candidate);
|
|
2179
|
+
const ids = await this.adapter.list(this.vault, this.name);
|
|
2180
|
+
const hits = [];
|
|
2181
|
+
const hitMap = /* @__PURE__ */ new Map();
|
|
2182
|
+
for (const id of ids) {
|
|
2183
|
+
const env = await this.adapter.get(this.vault, this.name, id);
|
|
2184
|
+
if (target !== null && env?._bidx?.[field] === target) {
|
|
2185
|
+
hits.push(id);
|
|
2186
|
+
hitMap.set(id, env);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
await this.onAccess?.("find", "*");
|
|
2190
|
+
if (hits.length === 0) return [];
|
|
2191
|
+
const { verifyDigestField } = await import("./verify-YB5LQHNA.js");
|
|
2192
|
+
const policy = {
|
|
2193
|
+
normalize: spec.verifyNormalize ?? "password",
|
|
2194
|
+
notLastN: spec.notLastN ?? 0,
|
|
2195
|
+
equatable: true,
|
|
2196
|
+
...spec.rotateDays !== void 0 ? { rotateDays: spec.rotateDays } : {}
|
|
2197
|
+
};
|
|
2198
|
+
const confirmCtx = {
|
|
2199
|
+
collection: this.name,
|
|
2200
|
+
getEnvelope: async (rid) => hitMap.get(rid) ?? null,
|
|
2201
|
+
// in-memory: zero extra store.get
|
|
2202
|
+
resolveCek: (env) => this.codec.resolveEnvelopeCek(env),
|
|
2203
|
+
getDEK: () => this.getDEK(this.name),
|
|
2204
|
+
now: () => Date.now()
|
|
2205
|
+
};
|
|
2206
|
+
const confirmed = [];
|
|
2207
|
+
for (const id of hits) {
|
|
2208
|
+
const verdict = await verifyDigestField(confirmCtx, id, field, candidate, policy);
|
|
2209
|
+
if (verdict.ok === true) confirmed.push(id);
|
|
2210
|
+
}
|
|
2211
|
+
return confirmed;
|
|
2212
|
+
}
|
|
2213
|
+
/**
|
|
2214
|
+
* Retire a field's equatable blind-index (`_bidx`) coverage across every
|
|
2215
|
+
* live record — the SOLE lazy-write-independent drop-path for a still-live
|
|
2216
|
+
* record's tag (besides clear / `forget()` / DEK-rotation). For each envelope
|
|
2217
|
+
* carrying `_bidx[field]`, rewrite it WITHOUT that slot (dropping the whole
|
|
2218
|
+
* `_bidx` map when it becomes empty), leaving `_vdig[field]` and everything
|
|
2219
|
+
* else INTACT — the field stays `digest-only`, only the index coverage is
|
|
2220
|
+
* retired. NO crypto, NO re-mint, NO re-encrypt: a targeted envelope rewrite.
|
|
2221
|
+
* Returns the count of records scrubbed.
|
|
2222
|
+
*
|
|
2223
|
+
* This is a maintenance write, not a read-egress: it emits NO `'find'` op and
|
|
2224
|
+
* no consent. The field is validated to a declared equatable digest-only
|
|
2225
|
+
* classified field (only such a field ever carries `_bidx`).
|
|
2226
|
+
*
|
|
2227
|
+
* **Ledger consistency**: dropping `_bidx[field]` changes the envelope's
|
|
2228
|
+
* payload hash (`_bidx` is bound into `envelopeBodyForHash`), so a raw
|
|
2229
|
+
* `adapter.put` of the scrubbed envelope WITHOUT a matching ledger entry would
|
|
2230
|
+
* desync the chain and make a future integrity cross-check flag false
|
|
2231
|
+
* tampering. After each rewrite we therefore append an `op:'migration'` entry
|
|
2232
|
+
* recording the NEW payloadHash at the SAME version — this is index retirement,
|
|
2233
|
+
* not a new record version, so `_v` is NOT bumped; the migration op is
|
|
2234
|
+
* reverse-delta-inert (`ledger.reconstruct` skips non-put/delete ops) yet
|
|
2235
|
+
* keeps the hash chain and the record's latest recorded payloadHash correct.
|
|
2236
|
+
*/
|
|
2237
|
+
async scrubEquatableTags(field) {
|
|
2238
|
+
const spec = this.classified?.byField[field];
|
|
2239
|
+
if (spec === void 0 || spec.storage !== "digest-only" || spec.equatable !== true) {
|
|
2240
|
+
throw new ClassifiedVerifyError(
|
|
2241
|
+
this.name,
|
|
2242
|
+
"*",
|
|
2243
|
+
"not a declared equatable digest-only classified field"
|
|
2244
|
+
);
|
|
2245
|
+
}
|
|
2246
|
+
const ids = await this.adapter.list(this.vault, this.name);
|
|
2247
|
+
let count = 0;
|
|
2248
|
+
for (const id of ids) {
|
|
2249
|
+
const env = await this.adapter.get(this.vault, this.name, id);
|
|
2250
|
+
if (env?._bidx?.[field] === void 0) continue;
|
|
2251
|
+
const nextBidx = { ...env._bidx };
|
|
2252
|
+
delete nextBidx[field];
|
|
2253
|
+
const scrubbedRaw = { ...env };
|
|
2254
|
+
delete scrubbedRaw._bidx;
|
|
2255
|
+
if (Object.keys(nextBidx).length > 0) scrubbedRaw._bidx = nextBidx;
|
|
2256
|
+
const scrubbed = scrubbedRaw;
|
|
2257
|
+
await this.adapter.put(this.vault, this.name, id, scrubbed);
|
|
2258
|
+
if (this.ledger) {
|
|
2259
|
+
await this.ledger.append({
|
|
2260
|
+
op: "migration",
|
|
2261
|
+
collection: this.name,
|
|
2262
|
+
id,
|
|
2263
|
+
version: scrubbed._v,
|
|
2264
|
+
actor: this.keyring.userId,
|
|
2265
|
+
payloadHash: await this.historyStrategy.envelopePayloadHash(scrubbed),
|
|
2266
|
+
reason: "classified:scrub-equatable-tags"
|
|
2267
|
+
});
|
|
2268
|
+
}
|
|
2269
|
+
count++;
|
|
2270
|
+
}
|
|
2271
|
+
return count;
|
|
2272
|
+
}
|
|
2509
2273
|
/**
|
|
2510
2274
|
* @internal — attach money descriptors post-construction. MV dependency
|
|
2511
2275
|
* analysis auto-creates a source collection (without options) during
|
|
@@ -2514,7 +2278,7 @@ var Collection = class {
|
|
|
2514
2278
|
*/
|
|
2515
2279
|
_applyMoneyFields(moneyFields) {
|
|
2516
2280
|
if (this.moneyFields !== void 0) return;
|
|
2517
|
-
validateMoneyFieldPaths(moneyFields);
|
|
2281
|
+
moneyRuntime().validateMoneyFieldPaths(moneyFields);
|
|
2518
2282
|
this.moneyFields = moneyFields;
|
|
2519
2283
|
}
|
|
2520
2284
|
/** @internal — attach computed fields post-construction. See {@link _applyMoneyFields}. */
|
|
@@ -2600,7 +2364,7 @@ var Collection = class {
|
|
|
2600
2364
|
}
|
|
2601
2365
|
}
|
|
2602
2366
|
if (this.materializedViewSource !== void 0) {
|
|
2603
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
2367
|
+
const { resolveStaleMVOnRead } = await import("./stale-7Q62KVI3.js");
|
|
2604
2368
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
2605
2369
|
}
|
|
2606
2370
|
let record;
|
|
@@ -2832,6 +2596,17 @@ var Collection = class {
|
|
|
2832
2596
|
const cached = this.cache.get(id);
|
|
2833
2597
|
return cached ? { record: cached.record, version: cached.version } : void 0;
|
|
2834
2598
|
}
|
|
2599
|
+
/** Resolves the prior envelope/record for a gate event; elides the read (#267) when no handler at `point` needs it (`elided: true`, `env`/`record` null). */
|
|
2600
|
+
async resolveGatePrior(point, id) {
|
|
2601
|
+
if (!this.subsystemBus.gateNeedsPrior(point)) return { env: null, record: null, elided: true };
|
|
2602
|
+
const env = await this.adapter.get(this.vault, this.name, id);
|
|
2603
|
+
if (!env) return { env: null, record: null, elided: false };
|
|
2604
|
+
try {
|
|
2605
|
+
return { env, record: await this.codec.decryptRecord(env, { skipValidation: true }), elided: false };
|
|
2606
|
+
} catch {
|
|
2607
|
+
return { env, record: null, elided: false };
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2835
2610
|
/**
|
|
2836
2611
|
* Wraps {@link RecordCodec.toCacheRecord} with an additional strip for
|
|
2837
2612
|
* digest-only classified fields: the codec already omits them from `_data`
|
|
@@ -2852,24 +2627,16 @@ var Collection = class {
|
|
|
2852
2627
|
if (!hasWritePermission(this.keyring, this.name)) {
|
|
2853
2628
|
throw new ReadOnlyError();
|
|
2854
2629
|
}
|
|
2855
|
-
record = canonicalizeIncomingMoney(record, this.moneyFields);
|
|
2630
|
+
if (this.moneyFields) record = moneyRuntime().canonicalizeIncomingMoney(record, this.moneyFields);
|
|
2856
2631
|
if (this.subsystemBus?.hasGateHandlers("beforePut")) {
|
|
2857
|
-
const existingEnv = await this.
|
|
2858
|
-
let existingRecord = null;
|
|
2859
|
-
if (existingEnv) {
|
|
2860
|
-
try {
|
|
2861
|
-
existingRecord = await this.codec.decryptRecord(existingEnv, { skipValidation: true });
|
|
2862
|
-
} catch {
|
|
2863
|
-
existingRecord = null;
|
|
2864
|
-
}
|
|
2865
|
-
}
|
|
2632
|
+
const { env: existingEnv, record: existingRecord } = await this.resolveGatePrior("beforePut", id);
|
|
2866
2633
|
const gateEvent = {
|
|
2867
2634
|
op: existingEnv ? "update" : "create",
|
|
2868
2635
|
vault: this.vault,
|
|
2869
2636
|
collection: this.name,
|
|
2870
2637
|
docId: id,
|
|
2871
2638
|
incoming: record,
|
|
2872
|
-
existing: canonicalizeStoredMoney(existingRecord, this.moneyFields),
|
|
2639
|
+
existing: this.moneyFields ? moneyRuntime().canonicalizeStoredMoney(existingRecord, this.moneyFields) : existingRecord,
|
|
2873
2640
|
existingVersion: existingEnv?._v ?? 0,
|
|
2874
2641
|
existingTs: existingEnv?._ts,
|
|
2875
2642
|
userId: this.keyring.userId,
|
|
@@ -2882,13 +2649,13 @@ var Collection = class {
|
|
|
2882
2649
|
enforceClassifiedWrite(record, this.classified.byField, this.name);
|
|
2883
2650
|
}
|
|
2884
2651
|
if (this.computed !== void 0) {
|
|
2885
|
-
record =
|
|
2652
|
+
record = (await loadEvalComputedFields())(record, this.computed, id);
|
|
2886
2653
|
}
|
|
2887
2654
|
if (this.schema !== void 0) {
|
|
2888
2655
|
record = await validateSchemaInput(this.schema, record, `put(${id})`);
|
|
2889
2656
|
}
|
|
2890
2657
|
if (this.moneyFields) {
|
|
2891
|
-
record = quantizeMoneyFields(record, this.moneyFields);
|
|
2658
|
+
record = moneyRuntime().quantizeMoneyFields(record, this.moneyFields);
|
|
2892
2659
|
}
|
|
2893
2660
|
if (this.i18nFields) {
|
|
2894
2661
|
const obj = record;
|
|
@@ -3094,6 +2861,7 @@ var Collection = class {
|
|
|
3094
2861
|
}
|
|
3095
2862
|
const envelope = await this.codec.encryptRecord(record, version, cek, options?.source, options?.sourceTs, vdigCtx);
|
|
3096
2863
|
await this.adapter.put(this.vault, this.name, id, envelope);
|
|
2864
|
+
await this._ensureClassifiedMarker();
|
|
3097
2865
|
if (this.embeddings) {
|
|
3098
2866
|
await this.searchStrategy.embedOnWrite(this.searchContext(), id, record, version);
|
|
3099
2867
|
}
|
|
@@ -3159,7 +2927,7 @@ var Collection = class {
|
|
|
3159
2927
|
if (mode === "eager") {
|
|
3160
2928
|
if (executor === null) {
|
|
3161
2929
|
;
|
|
3162
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
2930
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-FGISLQIN.js"));
|
|
3163
2931
|
}
|
|
3164
2932
|
await executor.refresh(reg, {
|
|
3165
2933
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -3168,7 +2936,7 @@ var Collection = class {
|
|
|
3168
2936
|
});
|
|
3169
2937
|
} else if (mode === "lazy") {
|
|
3170
2938
|
if (staleHelpers === null) {
|
|
3171
|
-
staleHelpers = await import("./stale-
|
|
2939
|
+
staleHelpers = await import("./stale-7Q62KVI3.js");
|
|
3172
2940
|
}
|
|
3173
2941
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
3174
2942
|
}
|
|
@@ -3220,7 +2988,7 @@ var Collection = class {
|
|
|
3220
2988
|
raw = (await this.resolvePriorValues(id))?.record ?? null;
|
|
3221
2989
|
}
|
|
3222
2990
|
if (raw === null) return null;
|
|
3223
|
-
return canonicalizeStoredMoney(raw, this.moneyFields);
|
|
2991
|
+
return this.moneyFields ? moneyRuntime().canonicalizeStoredMoney(raw, this.moneyFields) : raw;
|
|
3224
2992
|
}
|
|
3225
2993
|
/**
|
|
3226
2994
|
* @internal Ids of records whose top-level `field` equals `value`.
|
|
@@ -3303,7 +3071,7 @@ var Collection = class {
|
|
|
3303
3071
|
}
|
|
3304
3072
|
async dispatchDerivations(id, record, version) {
|
|
3305
3073
|
if (this.derivationSource === void 0) return;
|
|
3306
|
-
const incoming = canonicalizeStoredMoney(record, this.moneyFields);
|
|
3074
|
+
const incoming = this.moneyFields ? moneyRuntime().canonicalizeStoredMoney(record, this.moneyFields) : record;
|
|
3307
3075
|
if (incoming && typeof incoming === "object" && "_derivedFrom" in incoming) return;
|
|
3308
3076
|
const registry = this.derivationSource.registry();
|
|
3309
3077
|
const strategies = registry.strategiesForSource(this.name);
|
|
@@ -3353,7 +3121,7 @@ var Collection = class {
|
|
|
3353
3121
|
continue;
|
|
3354
3122
|
}
|
|
3355
3123
|
if (DerivationExecutor === null) {
|
|
3356
|
-
({ DerivationExecutor } = await import("./executor-
|
|
3124
|
+
({ DerivationExecutor } = await import("./executor-CBTNU5VZ.js"));
|
|
3357
3125
|
}
|
|
3358
3126
|
for (const run of runs) {
|
|
3359
3127
|
const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
|
|
@@ -3372,7 +3140,7 @@ var Collection = class {
|
|
|
3372
3140
|
const outputCollection = this.derivationSource.getCollection(outSpec.collection);
|
|
3373
3141
|
const txCtx = this.derivationSource.getActiveTxContext();
|
|
3374
3142
|
if (out.kind === "array") {
|
|
3375
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
3143
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-WS22Q5WH.js");
|
|
3376
3144
|
const prior = await loadFanoutSidecar(this.adapter, this.vault, spec.source, run.runId, key, this.getDEK, this.storeCiphertext);
|
|
3377
3145
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
3378
3146
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -3580,21 +3348,15 @@ var Collection = class {
|
|
|
3580
3348
|
throw new ReadOnlyError();
|
|
3581
3349
|
}
|
|
3582
3350
|
if (this.subsystemBus?.hasGateHandlers("beforeDelete")) {
|
|
3583
|
-
const existingEnv = await this.
|
|
3584
|
-
if (existingEnv) {
|
|
3585
|
-
let existingRecord = null;
|
|
3586
|
-
try {
|
|
3587
|
-
existingRecord = await this.codec.decryptRecord(existingEnv, { skipValidation: true });
|
|
3588
|
-
} catch {
|
|
3589
|
-
existingRecord = null;
|
|
3590
|
-
}
|
|
3351
|
+
const { env: existingEnv, record: existingRecord, elided } = await this.resolveGatePrior("beforeDelete", id);
|
|
3352
|
+
if (existingEnv || elided) {
|
|
3591
3353
|
await this.subsystemBus.dispatchGate("beforeDelete", {
|
|
3592
3354
|
vault: this.vault,
|
|
3593
3355
|
collection: this.name,
|
|
3594
3356
|
docId: id,
|
|
3595
|
-
existing: canonicalizeStoredMoney(existingRecord, this.moneyFields),
|
|
3596
|
-
existingVersion: existingEnv
|
|
3597
|
-
existingTs: existingEnv
|
|
3357
|
+
existing: this.moneyFields ? moneyRuntime().canonicalizeStoredMoney(existingRecord, this.moneyFields) : existingRecord,
|
|
3358
|
+
existingVersion: existingEnv?._v ?? 0,
|
|
3359
|
+
existingTs: existingEnv?._ts,
|
|
3598
3360
|
internal,
|
|
3599
3361
|
userId: this.keyring.userId,
|
|
3600
3362
|
role: this.keyring.role
|
|
@@ -3731,7 +3493,7 @@ var Collection = class {
|
|
|
3731
3493
|
for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
|
|
3732
3494
|
if (outSpec.shape !== "array") continue;
|
|
3733
3495
|
if (helpers === null) {
|
|
3734
|
-
helpers = await import("./fanout-sidecar-
|
|
3496
|
+
helpers = await import("./fanout-sidecar-WS22Q5WH.js");
|
|
3735
3497
|
}
|
|
3736
3498
|
const sidecar = await helpers.loadFanoutSidecar(this.adapter, this.vault, spec.source, id, outputKey, this.getDEK, this.storeCiphertext);
|
|
3737
3499
|
if (!sidecar) continue;
|
|
@@ -3765,7 +3527,7 @@ var Collection = class {
|
|
|
3765
3527
|
if (mode === "eager") {
|
|
3766
3528
|
if (executor === null) {
|
|
3767
3529
|
;
|
|
3768
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
3530
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-FGISLQIN.js"));
|
|
3769
3531
|
}
|
|
3770
3532
|
await executor.refresh(reg, {
|
|
3771
3533
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -3774,7 +3536,7 @@ var Collection = class {
|
|
|
3774
3536
|
});
|
|
3775
3537
|
} else if (mode === "lazy") {
|
|
3776
3538
|
if (staleHelpers === null) {
|
|
3777
|
-
staleHelpers = await import("./stale-
|
|
3539
|
+
staleHelpers = await import("./stale-7Q62KVI3.js");
|
|
3778
3540
|
}
|
|
3779
3541
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
3780
3542
|
}
|
|
@@ -3797,7 +3559,7 @@ var Collection = class {
|
|
|
3797
3559
|
);
|
|
3798
3560
|
}
|
|
3799
3561
|
if (this.materializedViewSource !== void 0) {
|
|
3800
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
3562
|
+
const { resolveStaleMVOnRead } = await import("./stale-7Q62KVI3.js");
|
|
3801
3563
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
3802
3564
|
}
|
|
3803
3565
|
await this.ensureHydrated();
|
|
@@ -4653,7 +4415,7 @@ var Collection = class {
|
|
|
4653
4415
|
const locale = localeOpts?.locale ?? this.defaultLocale;
|
|
4654
4416
|
let result = record;
|
|
4655
4417
|
if (hasMoney && this.moneyFields) {
|
|
4656
|
-
result = decodeMoneyFields(result, this.moneyFields, typeof locale === "string" ? locale : void 0);
|
|
4418
|
+
result = moneyRuntime().decodeMoneyFields(result, this.moneyFields, typeof locale === "string" ? locale : void 0);
|
|
4657
4419
|
}
|
|
4658
4420
|
const hasStaticDisplay = hasDict && this.dictKeyFields !== void 0 && Object.values(this.dictKeyFields).some(
|
|
4659
4421
|
(d) => isStaticDictDescriptor(d) && d.displayLocale !== void 0
|
|
@@ -4939,6 +4701,20 @@ var Collection = class {
|
|
|
4939
4701
|
id
|
|
4940
4702
|
);
|
|
4941
4703
|
}
|
|
4704
|
+
/** C-A/R10: persist the classified marker once per classified handle (store I/O in config-drift.ts). */
|
|
4705
|
+
async _ensureClassifiedMarker() {
|
|
4706
|
+
if (this._markerPersisted || this.vdigFields === null) return;
|
|
4707
|
+
const { persistClassifiedMarkerForFields } = await import("./config-drift-3UIJVI5G.js");
|
|
4708
|
+
await persistClassifiedMarkerForFields(this.adapter, this.vault, this.name, this.vdigFields, await this.getDEK(this.name));
|
|
4709
|
+
this._markerPersisted = true;
|
|
4710
|
+
}
|
|
4711
|
+
/** C-A/R10 drift signal — the marker's declared digest-only set, memoized to one store read per handle (see config-drift.ts). */
|
|
4712
|
+
async _classifiedMarkerDigestOnly() {
|
|
4713
|
+
if (this._markerDigestOnlyCache !== void 0) return this._markerDigestOnlyCache;
|
|
4714
|
+
const { readClassifiedMarkerDigestOnly } = await import("./config-drift-3UIJVI5G.js");
|
|
4715
|
+
this._markerDigestOnlyCache = await readClassifiedMarkerDigestOnly(this.adapter, this.vault, this.name, await this.getDEK(this.name));
|
|
4716
|
+
return this._markerDigestOnlyCache;
|
|
4717
|
+
}
|
|
4942
4718
|
/**
|
|
4943
4719
|
* find the first record whose deterministic field matches
|
|
4944
4720
|
* the given plaintext. Returns `null` when no match exists.
|
|
@@ -5660,141 +5436,6 @@ var RefRegistry = class {
|
|
|
5660
5436
|
}
|
|
5661
5437
|
};
|
|
5662
5438
|
|
|
5663
|
-
// src/with-shape/links/link-set.ts
|
|
5664
|
-
var LINK_COLLECTION_PREFIX = "_links_";
|
|
5665
|
-
function linkCollectionName(name) {
|
|
5666
|
-
return `${LINK_COLLECTION_PREFIX}${name}`;
|
|
5667
|
-
}
|
|
5668
|
-
function isLinkCollectionName(name) {
|
|
5669
|
-
return name.startsWith(LINK_COLLECTION_PREFIX);
|
|
5670
|
-
}
|
|
5671
|
-
function linkRowKey(aId, bId) {
|
|
5672
|
-
return `${encodeURIComponent(aId)}|${encodeURIComponent(bId)}`;
|
|
5673
|
-
}
|
|
5674
|
-
var LinkSet = class {
|
|
5675
|
-
constructor(adapter, vault, name, spec, encrypted, getDEK, actor, emitter, endpointExists) {
|
|
5676
|
-
this.adapter = adapter;
|
|
5677
|
-
this.vault = vault;
|
|
5678
|
-
this.name = name;
|
|
5679
|
-
this.spec = spec;
|
|
5680
|
-
this.encrypted = encrypted;
|
|
5681
|
-
this.getDEK = getDEK;
|
|
5682
|
-
this.actor = actor;
|
|
5683
|
-
this.emitter = emitter;
|
|
5684
|
-
this.endpointExists = endpointExists;
|
|
5685
|
-
this.collName = linkCollectionName(name);
|
|
5686
|
-
}
|
|
5687
|
-
adapter;
|
|
5688
|
-
vault;
|
|
5689
|
-
name;
|
|
5690
|
-
spec;
|
|
5691
|
-
encrypted;
|
|
5692
|
-
getDEK;
|
|
5693
|
-
actor;
|
|
5694
|
-
emitter;
|
|
5695
|
-
endpointExists;
|
|
5696
|
-
collName;
|
|
5697
|
-
dekPromise = null;
|
|
5698
|
-
dek() {
|
|
5699
|
-
if (!this.dekPromise) this.dekPromise = this.getDEK(this.collName);
|
|
5700
|
-
return this.dekPromise;
|
|
5701
|
-
}
|
|
5702
|
-
async encryptEntry(entry, version) {
|
|
5703
|
-
const json = JSON.stringify(entry);
|
|
5704
|
-
const base = { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: (/* @__PURE__ */ new Date()).toISOString(), _by: this.actor };
|
|
5705
|
-
if (!this.encrypted) return { ...base, _iv: "", _data: json };
|
|
5706
|
-
const { iv, data } = await encrypt(json, await this.dek());
|
|
5707
|
-
return { ...base, _iv: iv, _data: data };
|
|
5708
|
-
}
|
|
5709
|
-
async decryptEntry(env) {
|
|
5710
|
-
const json = this.encrypted ? await openEnvelopeJson(env, await this.dek()) : env._data;
|
|
5711
|
-
return JSON.parse(json);
|
|
5712
|
-
}
|
|
5713
|
-
async connect(aId, bId, meta) {
|
|
5714
|
-
if (!await this.endpointExists(this.spec.a, aId)) {
|
|
5715
|
-
throw new LinkEndpointError(this.name, this.spec.a, aId);
|
|
5716
|
-
}
|
|
5717
|
-
if (!await this.endpointExists(this.spec.b, bId)) {
|
|
5718
|
-
throw new LinkEndpointError(this.name, this.spec.b, bId);
|
|
5719
|
-
}
|
|
5720
|
-
const key = linkRowKey(aId, bId);
|
|
5721
|
-
const entry = meta !== void 0 ? { a: aId, b: bId, meta } : { a: aId, b: bId };
|
|
5722
|
-
const existing = await this.adapter.get(this.vault, this.collName, key);
|
|
5723
|
-
const env = await this.encryptEntry(entry, (existing?._v ?? 0) + 1);
|
|
5724
|
-
await this.adapter.put(this.vault, this.collName, key, env, existing?._v);
|
|
5725
|
-
this.emitter.emit("change", { vault: this.vault, collection: this.collName, id: key, action: "put" });
|
|
5726
|
-
}
|
|
5727
|
-
async disconnect(aId, bId) {
|
|
5728
|
-
const key = linkRowKey(aId, bId);
|
|
5729
|
-
const existing = await this.adapter.get(this.vault, this.collName, key);
|
|
5730
|
-
if (!existing) return;
|
|
5731
|
-
await this.adapter.delete(this.vault, this.collName, key);
|
|
5732
|
-
this.emitter.emit("change", { vault: this.vault, collection: this.collName, id: key, action: "delete" });
|
|
5733
|
-
}
|
|
5734
|
-
async has(aId, bId) {
|
|
5735
|
-
return await this.adapter.get(this.vault, this.collName, linkRowKey(aId, bId)) !== null;
|
|
5736
|
-
}
|
|
5737
|
-
async of(id) {
|
|
5738
|
-
const rows = await this.list();
|
|
5739
|
-
return rows.filter((r) => r.a === id || r.b === id);
|
|
5740
|
-
}
|
|
5741
|
-
async list() {
|
|
5742
|
-
const keys = await this.adapter.list(this.vault, this.collName);
|
|
5743
|
-
const out = [];
|
|
5744
|
-
for (const key of keys) {
|
|
5745
|
-
const env = await this.adapter.get(this.vault, this.collName, key);
|
|
5746
|
-
if (!env) continue;
|
|
5747
|
-
const e = await this.decryptEntry(env);
|
|
5748
|
-
out.push(e.meta !== void 0 ? { a: e.a, b: e.b, meta: e.meta } : { a: e.a, b: e.b });
|
|
5749
|
-
}
|
|
5750
|
-
return out;
|
|
5751
|
-
}
|
|
5752
|
-
// ── Vault-internal cascade helpers ──────────────────────────────────
|
|
5753
|
-
/** @internal — rows where the deleted endpoint id matches the relevant slot. */
|
|
5754
|
-
async _rowsTouchingEndpoint(collection, id) {
|
|
5755
|
-
const rows = await this.list();
|
|
5756
|
-
return rows.filter(
|
|
5757
|
-
(r) => this.spec.a === collection && r.a === id || this.spec.b === collection && r.b === id
|
|
5758
|
-
);
|
|
5759
|
-
}
|
|
5760
|
-
/** @internal — the storage collection name (for tx pre-image capture). */
|
|
5761
|
-
get _collectionName() {
|
|
5762
|
-
return this.collName;
|
|
5763
|
-
}
|
|
5764
|
-
};
|
|
5765
|
-
var LinkEndpointError = class extends NoydbError {
|
|
5766
|
-
link;
|
|
5767
|
-
endpoint;
|
|
5768
|
-
missingId;
|
|
5769
|
-
constructor(link, endpoint, missingId) {
|
|
5770
|
-
super(
|
|
5771
|
-
"LINK_ENDPOINT",
|
|
5772
|
-
`link("${link}").connect: endpoint "${endpoint}" has no record "${missingId}".`
|
|
5773
|
-
);
|
|
5774
|
-
this.name = "LinkEndpointError";
|
|
5775
|
-
this.link = link;
|
|
5776
|
-
this.endpoint = endpoint;
|
|
5777
|
-
this.missingId = missingId;
|
|
5778
|
-
}
|
|
5779
|
-
};
|
|
5780
|
-
var LinkIntegrityError = class extends NoydbError {
|
|
5781
|
-
link;
|
|
5782
|
-
endpoint;
|
|
5783
|
-
id;
|
|
5784
|
-
count;
|
|
5785
|
-
constructor(link, endpoint, id, count) {
|
|
5786
|
-
super(
|
|
5787
|
-
"LINK_INTEGRITY",
|
|
5788
|
-
`Cannot delete "${endpoint}"/"${id}": ${count} link(s) in "${link}" still reference it (onDelete: 'strict').`
|
|
5789
|
-
);
|
|
5790
|
-
this.name = "LinkIntegrityError";
|
|
5791
|
-
this.link = link;
|
|
5792
|
-
this.endpoint = endpoint;
|
|
5793
|
-
this.id = id;
|
|
5794
|
-
this.count = count;
|
|
5795
|
-
}
|
|
5796
|
-
};
|
|
5797
|
-
|
|
5798
5439
|
// src/with-shape/links/vault-facade.ts
|
|
5799
5440
|
var VaultLinks = class {
|
|
5800
5441
|
constructor(deps) {
|
|
@@ -6114,74 +5755,21 @@ var VaultLinks = class {
|
|
|
6114
5755
|
}
|
|
6115
5756
|
};
|
|
6116
5757
|
|
|
6117
|
-
// src/with-shape/
|
|
6118
|
-
function
|
|
6119
|
-
|
|
6120
|
-
const
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
const shapeChanged = canonicalize(aProps[k]) !== canonicalize(bProps[k]);
|
|
6133
|
-
const requiredChanged = aReq.has(k) !== bReq.has(k);
|
|
6134
|
-
if (shapeChanged || requiredChanged) {
|
|
6135
|
-
changed.push({ field: k, requiredChanged, shapeChanged });
|
|
6136
|
-
}
|
|
6137
|
-
}
|
|
6138
|
-
let kind;
|
|
6139
|
-
if (added.length === 0 && removed.length === 0 && changed.length === 0) {
|
|
6140
|
-
kind = "none";
|
|
6141
|
-
} else if (removed.length === 0 && changed.length === 0 && added.every((k) => !bReq.has(k))) {
|
|
6142
|
-
kind = "additive";
|
|
6143
|
-
} else {
|
|
6144
|
-
kind = "non-additive";
|
|
6145
|
-
}
|
|
6146
|
-
return { collection, kind, added, removed, changed };
|
|
6147
|
-
}
|
|
6148
|
-
|
|
6149
|
-
// src/with-shape/schema-update/dispatch.ts
|
|
6150
|
-
async function evaluateStrategies(delta, strategies, ctx) {
|
|
6151
|
-
for (const strategy of strategies) {
|
|
6152
|
-
const decision = await strategy.onSchemaDelta(delta, ctx);
|
|
6153
|
-
if (decision.action !== "allow") return decision;
|
|
6154
|
-
}
|
|
6155
|
-
return { action: "allow" };
|
|
6156
|
-
}
|
|
6157
|
-
|
|
6158
|
-
// src/with-shape/persisted-schemas/register.ts
|
|
6159
|
-
async function persistSchemaIfNeeded(opts) {
|
|
6160
|
-
const fresh = await derivePersistedSchema(opts.validator);
|
|
6161
|
-
const stored = await loadPersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek);
|
|
6162
|
-
if (stored && isEquivalent(stored, fresh)) {
|
|
6163
|
-
return { written: false, skipped: true, envelope: stored, decision: { action: "allow" } };
|
|
6164
|
-
}
|
|
6165
|
-
let decision = { action: "allow" };
|
|
6166
|
-
const strategies = opts.strategies ?? [];
|
|
6167
|
-
if (stored && strategies.length > 0 && stored.kind === fresh.kind && isPlainObject(stored.jsonSchema) && isPlainObject(fresh.jsonSchema)) {
|
|
6168
|
-
const delta = computeSchemaDelta(stored.jsonSchema, fresh.jsonSchema, opts.collectionName);
|
|
6169
|
-
decision = await evaluateStrategies(delta, strategies, { collection: opts.collectionName });
|
|
6170
|
-
}
|
|
6171
|
-
if (decision.action !== "allow") {
|
|
6172
|
-
return { written: false, skipped: false, envelope: stored ?? fresh, decision };
|
|
6173
|
-
}
|
|
6174
|
-
await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, fresh);
|
|
6175
|
-
return { written: true, skipped: false, envelope: fresh, decision };
|
|
6176
|
-
}
|
|
6177
|
-
function isPlainObject(v) {
|
|
6178
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
6179
|
-
}
|
|
6180
|
-
function isEquivalent(a, b) {
|
|
6181
|
-
if (a.kind !== b.kind) return false;
|
|
6182
|
-
if (a.hash && b.hash) return a.hash === b.hash;
|
|
6183
|
-
if (a.hash === null && b.hash === null) return true;
|
|
6184
|
-
return false;
|
|
5758
|
+
// src/with-shape/links/lazy-handle.ts
|
|
5759
|
+
function makeLazyLinkSetHandle(d) {
|
|
5760
|
+
let engine = null;
|
|
5761
|
+
const load = () => engine ??= import("./link-set-UQEIYQAM.js").then(
|
|
5762
|
+
({ LinkSet }) => new LinkSet(d.adapter, d.vault, d.name, d.spec, d.encrypted, d.getDEK, d.actor, d.emitter, d.endpointExists)
|
|
5763
|
+
);
|
|
5764
|
+
return {
|
|
5765
|
+
_collectionName: linkCollectionName(d.name),
|
|
5766
|
+
connect: async (aId, bId, meta) => (await load()).connect(aId, bId, meta),
|
|
5767
|
+
disconnect: async (aId, bId) => (await load()).disconnect(aId, bId),
|
|
5768
|
+
has: async (aId, bId) => (await load()).has(aId, bId),
|
|
5769
|
+
of: async (id) => (await load()).of(id),
|
|
5770
|
+
list: async () => (await load()).list(),
|
|
5771
|
+
_rowsTouchingEndpoint: async (collection, id) => (await load())._rowsTouchingEndpoint(collection, id)
|
|
5772
|
+
};
|
|
6185
5773
|
}
|
|
6186
5774
|
|
|
6187
5775
|
// src/with-shape/schema-update/gate.ts
|
|
@@ -6297,70 +5885,6 @@ var SchemaFenceController = class {
|
|
|
6297
5885
|
}
|
|
6298
5886
|
};
|
|
6299
5887
|
|
|
6300
|
-
// src/with-shape/schema-update/fence-watcher.ts
|
|
6301
|
-
var FenceWatcher = class {
|
|
6302
|
-
#coordination;
|
|
6303
|
-
#vault;
|
|
6304
|
-
#writerId;
|
|
6305
|
-
#sessionId;
|
|
6306
|
-
#onFlush;
|
|
6307
|
-
#now;
|
|
6308
|
-
#emit;
|
|
6309
|
-
#lastState = null;
|
|
6310
|
-
#quiescedAtVersion = null;
|
|
6311
|
-
#timer;
|
|
6312
|
-
constructor(opts) {
|
|
6313
|
-
this.#coordination = opts.coordination;
|
|
6314
|
-
this.#vault = opts.vault;
|
|
6315
|
-
this.#writerId = opts.clientId;
|
|
6316
|
-
this.#sessionId = opts.sessionId ?? opts.clientId;
|
|
6317
|
-
this.#onFlush = opts.onFlush;
|
|
6318
|
-
this.#now = opts.now ?? (() => Date.now());
|
|
6319
|
-
this.#emit = opts.emit ?? (() => {
|
|
6320
|
-
});
|
|
6321
|
-
}
|
|
6322
|
-
/** Publish liveness (and the current ack) without changing quiesce state. */
|
|
6323
|
-
async beat() {
|
|
6324
|
-
await this.#coordination.reportPresence(this.#vault, {
|
|
6325
|
-
writerId: this.#writerId,
|
|
6326
|
-
sessionId: this.#sessionId,
|
|
6327
|
-
lastSeen: this.#now(),
|
|
6328
|
-
quiescedAtVersion: this.#quiescedAtVersion
|
|
6329
|
-
});
|
|
6330
|
-
}
|
|
6331
|
-
/** Poll the fence; quiesce on draining; emit on transitions. */
|
|
6332
|
-
async check() {
|
|
6333
|
-
const fence = await this.#coordination.readFence(this.#vault);
|
|
6334
|
-
if (fence.fenceState !== this.#lastState) {
|
|
6335
|
-
this.#lastState = fence.fenceState;
|
|
6336
|
-
this.#emit({ currentSchemaVersion: fence.currentSchemaVersion, fenceState: fence.fenceState });
|
|
6337
|
-
}
|
|
6338
|
-
if (fence.fenceState === "draining" && this.#quiescedAtVersion !== fence.currentSchemaVersion) {
|
|
6339
|
-
await this.#onFlush();
|
|
6340
|
-
this.#quiescedAtVersion = fence.currentSchemaVersion;
|
|
6341
|
-
await this.beat();
|
|
6342
|
-
}
|
|
6343
|
-
if (fence.fenceState === "normal") {
|
|
6344
|
-
this.#quiescedAtVersion = null;
|
|
6345
|
-
}
|
|
6346
|
-
}
|
|
6347
|
-
start(intervalMs) {
|
|
6348
|
-
if (this.#timer) return;
|
|
6349
|
-
this.#timer = setInterval(() => {
|
|
6350
|
-
void this.beat();
|
|
6351
|
-
void this.check();
|
|
6352
|
-
}, intervalMs);
|
|
6353
|
-
const timer = this.#timer;
|
|
6354
|
-
if (typeof timer.unref === "function") timer.unref();
|
|
6355
|
-
}
|
|
6356
|
-
stop() {
|
|
6357
|
-
if (this.#timer) {
|
|
6358
|
-
clearInterval(this.#timer);
|
|
6359
|
-
this.#timer = void 0;
|
|
6360
|
-
}
|
|
6361
|
-
}
|
|
6362
|
-
};
|
|
6363
|
-
|
|
6364
5888
|
// src/with-audit/attestation/vault-facade.ts
|
|
6365
5889
|
var VaultAttestation = class {
|
|
6366
5890
|
constructor(deps, strategy) {
|
|
@@ -6433,224 +5957,6 @@ var VaultAttestation = class {
|
|
|
6433
5957
|
}
|
|
6434
5958
|
};
|
|
6435
5959
|
|
|
6436
|
-
// src/with-shape/introspection/walk.ts
|
|
6437
|
-
var INTERNAL_PREFIX = "_";
|
|
6438
|
-
var KNOWN_INTERNAL_NAMES = ["_keyring", "_ledger", "_meta", "_schemas", "_deltas"];
|
|
6439
|
-
async function dumpVaultSchema(vault, opts) {
|
|
6440
|
-
const state = vault._introspectState();
|
|
6441
|
-
const sampleSize = opts.sampleSize ?? 50;
|
|
6442
|
-
const withStats = opts.withStats === true;
|
|
6443
|
-
const cacheNames = [...state.collectionCache.keys()];
|
|
6444
|
-
const storageNames = (await safeListAllCollections(state.adapter, state.name)).filter((n) => !n.startsWith(INTERNAL_PREFIX));
|
|
6445
|
-
const allNames = Array.from(/* @__PURE__ */ new Set([...cacheNames, ...storageNames])).sort();
|
|
6446
|
-
const collections = {};
|
|
6447
|
-
for (const name of allNames) {
|
|
6448
|
-
collections[name] = await describeCollection(state, name, sampleSize, withStats);
|
|
6449
|
-
}
|
|
6450
|
-
const materializedViews = describeMVs(state.mvRegistry);
|
|
6451
|
-
const overlayViews = describeOverlays(state.overlayRegistry);
|
|
6452
|
-
const derivations = describeDerivations(state.derivationRegistry);
|
|
6453
|
-
let internal;
|
|
6454
|
-
if (withStats) {
|
|
6455
|
-
internal = {};
|
|
6456
|
-
for (const name of KNOWN_INTERNAL_NAMES) {
|
|
6457
|
-
const stats = await statsForCollection(state.adapter, state.name, name);
|
|
6458
|
-
if (stats.records > 0) {
|
|
6459
|
-
internal[name] = { records: stats.records, bytes: stats.bytes };
|
|
6460
|
-
}
|
|
6461
|
-
}
|
|
6462
|
-
}
|
|
6463
|
-
const snap = {
|
|
6464
|
-
_noydb_snapshot: 1,
|
|
6465
|
-
vault: state.name,
|
|
6466
|
-
emittedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6467
|
-
subsystems: state.subsystems,
|
|
6468
|
-
...state.vaultMeta !== void 0 ? { meta: state.vaultMeta } : {},
|
|
6469
|
-
collections,
|
|
6470
|
-
materializedViews,
|
|
6471
|
-
overlayViews,
|
|
6472
|
-
derivations,
|
|
6473
|
-
...internal !== void 0 ? { internal } : {}
|
|
6474
|
-
};
|
|
6475
|
-
return snap;
|
|
6476
|
-
}
|
|
6477
|
-
async function safeListAllCollections(adapter, vault) {
|
|
6478
|
-
try {
|
|
6479
|
-
const snap = await adapter.loadAll(vault);
|
|
6480
|
-
return Object.keys(snap);
|
|
6481
|
-
} catch {
|
|
6482
|
-
return [];
|
|
6483
|
-
}
|
|
6484
|
-
}
|
|
6485
|
-
async function describeCollection(state, collectionName, sampleSize, withStats) {
|
|
6486
|
-
let fields = {};
|
|
6487
|
-
let validator;
|
|
6488
|
-
const refsRaw = state.refRegistry.getOutbound(collectionName);
|
|
6489
|
-
const refs = {};
|
|
6490
|
-
for (const [name, desc] of Object.entries(refsRaw)) {
|
|
6491
|
-
refs[name] = { target: desc.target, mode: desc.mode };
|
|
6492
|
-
}
|
|
6493
|
-
try {
|
|
6494
|
-
const dek = await state.getDEK(collectionName);
|
|
6495
|
-
const persisted = await loadPersistedSchema(state.adapter, state.name, collectionName, dek);
|
|
6496
|
-
if (persisted) {
|
|
6497
|
-
validator = { kind: persisted.kind, source: "persisted" };
|
|
6498
|
-
if (persisted.jsonSchema) {
|
|
6499
|
-
fields = jsonSchemaToFields(persisted.jsonSchema, "persisted", refsRaw);
|
|
6500
|
-
}
|
|
6501
|
-
}
|
|
6502
|
-
} catch {
|
|
6503
|
-
}
|
|
6504
|
-
const liveColl = state.collectionCache.get(collectionName);
|
|
6505
|
-
if (!validator) {
|
|
6506
|
-
const schema = liveColl?.getSchema();
|
|
6507
|
-
if (schema) {
|
|
6508
|
-
try {
|
|
6509
|
-
const derived = await derivePersistedSchema(schema);
|
|
6510
|
-
validator = { kind: derived.kind, source: "live-validator" };
|
|
6511
|
-
if (derived.jsonSchema) {
|
|
6512
|
-
fields = jsonSchemaToFields(derived.jsonSchema, "live-validator", refsRaw);
|
|
6513
|
-
}
|
|
6514
|
-
} catch {
|
|
6515
|
-
}
|
|
6516
|
-
}
|
|
6517
|
-
}
|
|
6518
|
-
if (Object.keys(fields).length === 0 && sampleSize > 0) {
|
|
6519
|
-
}
|
|
6520
|
-
const collMeta = liveColl?.getMeta();
|
|
6521
|
-
const collConfig = liveColl?.getConfig();
|
|
6522
|
-
const archivePresent = state.hasCollectionArchive?.(collectionName) === true;
|
|
6523
|
-
const schemaUpdateNames = state.getCollectionSchemaUpdateNames?.(collectionName);
|
|
6524
|
-
const hasSchemaUpdate = schemaUpdateNames !== void 0 && schemaUpdateNames.length > 0;
|
|
6525
|
-
let mergedConfig;
|
|
6526
|
-
if (collConfig !== void 0 || archivePresent || hasSchemaUpdate) {
|
|
6527
|
-
mergedConfig = {
|
|
6528
|
-
...collConfig ?? {},
|
|
6529
|
-
...archivePresent ? { archive: true } : {},
|
|
6530
|
-
...hasSchemaUpdate ? { schemaUpdate: schemaUpdateNames } : {}
|
|
6531
|
-
};
|
|
6532
|
-
}
|
|
6533
|
-
const descriptor = {
|
|
6534
|
-
fields,
|
|
6535
|
-
indexes: [],
|
|
6536
|
-
refs,
|
|
6537
|
-
...validator ? { validator } : {},
|
|
6538
|
-
...collMeta !== void 0 ? { meta: collMeta } : {},
|
|
6539
|
-
...mergedConfig !== void 0 ? { config: mergedConfig } : {}
|
|
6540
|
-
};
|
|
6541
|
-
if (withStats) {
|
|
6542
|
-
const stats = await statsForCollection(state.adapter, state.name, collectionName);
|
|
6543
|
-
descriptor.stats = stats;
|
|
6544
|
-
}
|
|
6545
|
-
return descriptor;
|
|
6546
|
-
}
|
|
6547
|
-
async function statsForCollection(adapter, vault, collection) {
|
|
6548
|
-
const ids = await adapter.list(vault, collection);
|
|
6549
|
-
if (ids.length === 0) {
|
|
6550
|
-
return { records: 0, bytes: 0, bytesAvg: 0, bytesMin: 0, bytesMax: 0, oldest: "", newest: "" };
|
|
6551
|
-
}
|
|
6552
|
-
let total = 0;
|
|
6553
|
-
let min = Number.POSITIVE_INFINITY;
|
|
6554
|
-
let max = 0;
|
|
6555
|
-
let oldest = "\uFFFF";
|
|
6556
|
-
let newest = "";
|
|
6557
|
-
for (const id of ids) {
|
|
6558
|
-
const env = await adapter.get(vault, collection, id);
|
|
6559
|
-
if (!env) continue;
|
|
6560
|
-
const size = env._data.length;
|
|
6561
|
-
total += size;
|
|
6562
|
-
if (size < min) min = size;
|
|
6563
|
-
if (size > max) max = size;
|
|
6564
|
-
if (env._ts < oldest) oldest = env._ts;
|
|
6565
|
-
if (env._ts > newest) newest = env._ts;
|
|
6566
|
-
}
|
|
6567
|
-
return {
|
|
6568
|
-
records: ids.length,
|
|
6569
|
-
bytes: total,
|
|
6570
|
-
bytesAvg: Math.round(total / ids.length),
|
|
6571
|
-
bytesMin: min === Number.POSITIVE_INFINITY ? 0 : min,
|
|
6572
|
-
bytesMax: max,
|
|
6573
|
-
oldest: oldest === "\uFFFF" ? "" : oldest,
|
|
6574
|
-
newest
|
|
6575
|
-
};
|
|
6576
|
-
}
|
|
6577
|
-
function describeMVs(registry) {
|
|
6578
|
-
if (!registry || typeof registry !== "object") return {};
|
|
6579
|
-
const items = listFromRegistry(registry);
|
|
6580
|
-
const out = {};
|
|
6581
|
-
for (const item of items) {
|
|
6582
|
-
const reg = item;
|
|
6583
|
-
const spec = reg.spec;
|
|
6584
|
-
if (!spec?.name) continue;
|
|
6585
|
-
const sources = spec.unionSources ? spec.unionSources.map((u) => u.collection) : reg.dependencies ? [...reg.dependencies].sort() : [];
|
|
6586
|
-
const groupBy = spec.groupBy ? Array.isArray(spec.groupBy) ? [...spec.groupBy] : [spec.groupBy] : void 0;
|
|
6587
|
-
const aggregate = spec.aggregate ? Object.fromEntries(
|
|
6588
|
-
Object.entries(spec.aggregate).map(([k, v]) => [k, summariseAggregateOp(v)])
|
|
6589
|
-
) : void 0;
|
|
6590
|
-
out[spec.name] = {
|
|
6591
|
-
sources,
|
|
6592
|
-
...groupBy ? { groupBy } : {},
|
|
6593
|
-
...aggregate ? { aggregate } : {},
|
|
6594
|
-
refresh: spec.refresh ?? "eager"
|
|
6595
|
-
};
|
|
6596
|
-
}
|
|
6597
|
-
return out;
|
|
6598
|
-
}
|
|
6599
|
-
function describeOverlays(registry) {
|
|
6600
|
-
if (!registry || typeof registry !== "object") return {};
|
|
6601
|
-
const specs = listFromRegistry(registry);
|
|
6602
|
-
const out = {};
|
|
6603
|
-
for (const spec of specs) {
|
|
6604
|
-
const s = spec;
|
|
6605
|
-
if (!s.name || !s.base || !s.overlay) continue;
|
|
6606
|
-
out[s.name] = { base: s.base, overlay: s.overlay };
|
|
6607
|
-
}
|
|
6608
|
-
return out;
|
|
6609
|
-
}
|
|
6610
|
-
function describeDerivations(registry) {
|
|
6611
|
-
if (!registry || typeof registry !== "object") return {};
|
|
6612
|
-
const items = listFromRegistry(registry);
|
|
6613
|
-
const out = {};
|
|
6614
|
-
for (const item of items) {
|
|
6615
|
-
const reg = item;
|
|
6616
|
-
const s = reg.spec ?? reg;
|
|
6617
|
-
if (!s.source) continue;
|
|
6618
|
-
const outputCollections = s.outputs ? Object.values(s.outputs).map((o) => o.collection) : [];
|
|
6619
|
-
const key = outputCollections.length > 0 ? [...outputCollections].sort().join("+") : s.source;
|
|
6620
|
-
out[key] = {
|
|
6621
|
-
source: s.source,
|
|
6622
|
-
outputs: outputCollections
|
|
6623
|
-
};
|
|
6624
|
-
}
|
|
6625
|
-
return out;
|
|
6626
|
-
}
|
|
6627
|
-
function listFromRegistry(reg) {
|
|
6628
|
-
for (const method of ["all", "list", "specs", "values"]) {
|
|
6629
|
-
const fn = reg[method];
|
|
6630
|
-
if (typeof fn === "function") {
|
|
6631
|
-
try {
|
|
6632
|
-
const out = fn.call(reg);
|
|
6633
|
-
if (Array.isArray(out)) return out;
|
|
6634
|
-
if (out && typeof out.values === "function") {
|
|
6635
|
-
return [...out.values()];
|
|
6636
|
-
}
|
|
6637
|
-
} catch {
|
|
6638
|
-
continue;
|
|
6639
|
-
}
|
|
6640
|
-
}
|
|
6641
|
-
}
|
|
6642
|
-
return [];
|
|
6643
|
-
}
|
|
6644
|
-
function summariseAggregateOp(value) {
|
|
6645
|
-
if (value && typeof value === "object") {
|
|
6646
|
-
const op = value.op ?? value.kind;
|
|
6647
|
-
const field = value.field;
|
|
6648
|
-
if (op && field) return `${op}(${field})`;
|
|
6649
|
-
if (op) return op;
|
|
6650
|
-
}
|
|
6651
|
-
return String(value);
|
|
6652
|
-
}
|
|
6653
|
-
|
|
6654
5960
|
// src/kernel/vault.ts
|
|
6655
5961
|
function resolveLabelFromMap(labels, locale, fallback) {
|
|
6656
5962
|
if (labels[locale] !== void 0) return labels[locale];
|
|
@@ -6703,6 +6009,7 @@ var Vault = class {
|
|
|
6703
6009
|
/** Per-collection record archival policies. Indexed by collection name. */
|
|
6704
6010
|
archiveRegistry = /* @__PURE__ */ new Map();
|
|
6705
6011
|
indexStrategy;
|
|
6012
|
+
lazyStrategy;
|
|
6706
6013
|
aggregateStrategy;
|
|
6707
6014
|
crdtStrategy;
|
|
6708
6015
|
tiersStrategy;
|
|
@@ -6922,7 +6229,7 @@ var Vault = class {
|
|
|
6922
6229
|
dictionaryCache = /* @__PURE__ */ new Map();
|
|
6923
6230
|
/** Registered link specs, keyed by link name; set by `vault.link()`. */
|
|
6924
6231
|
linkRegistry = /* @__PURE__ */ new Map();
|
|
6925
|
-
/** Cache of
|
|
6232
|
+
/** Cache of link-set handles, one per link name (lazy -- see links()). */
|
|
6926
6233
|
linkSetCache = /* @__PURE__ */ new Map();
|
|
6927
6234
|
/** — subscribers for cross-tier access events. */
|
|
6928
6235
|
crossTierSubs = /* @__PURE__ */ new Set();
|
|
@@ -6956,6 +6263,7 @@ var Vault = class {
|
|
|
6956
6263
|
this.objectStore = opts.objectStore;
|
|
6957
6264
|
this.archiveStrategy = opts.archiveStrategy;
|
|
6958
6265
|
this.indexStrategy = opts.indexStrategy;
|
|
6266
|
+
this.lazyStrategy = opts.lazyStrategy;
|
|
6959
6267
|
this.aggregateStrategy = opts.aggregateStrategy;
|
|
6960
6268
|
this.crdtStrategy = opts.crdtStrategy;
|
|
6961
6269
|
this.tiersStrategy = opts.tiersStrategy;
|
|
@@ -7090,6 +6398,9 @@ var Vault = class {
|
|
|
7090
6398
|
if (isLinkCollectionName(collectionName)) {
|
|
7091
6399
|
throw new ReservedCollectionNameError(collectionName);
|
|
7092
6400
|
}
|
|
6401
|
+
if (isSecretBearingReservedCollection(collectionName)) {
|
|
6402
|
+
throw new ReservedCollectionNameError(collectionName);
|
|
6403
|
+
}
|
|
7093
6404
|
let coll = this.collectionCache.get(collectionName);
|
|
7094
6405
|
if (coll && options?.moneyFields) {
|
|
7095
6406
|
coll._applyMoneyFields(options.moneyFields);
|
|
@@ -7150,6 +6461,7 @@ var Vault = class {
|
|
|
7150
6461
|
const strategies = options.schemaUpdate ?? [];
|
|
7151
6462
|
const work = (async () => {
|
|
7152
6463
|
const dek = await this.getDEK(collectionName);
|
|
6464
|
+
const { persistSchemaIfNeeded } = await import("./register-V5AQTXNI.js");
|
|
7153
6465
|
const result = await persistSchemaIfNeeded({
|
|
7154
6466
|
store: this.adapter,
|
|
7155
6467
|
vault: this.name,
|
|
@@ -7161,7 +6473,7 @@ var Vault = class {
|
|
|
7161
6473
|
const decision = result.decision ?? { action: "allow" };
|
|
7162
6474
|
if (decision.action === "cutover") {
|
|
7163
6475
|
this.schemaFence.registerPendingCutover(collectionName, decision.transform);
|
|
7164
|
-
this._ensureFenceCoordination();
|
|
6476
|
+
await this._ensureFenceCoordination();
|
|
7165
6477
|
}
|
|
7166
6478
|
return decision;
|
|
7167
6479
|
})();
|
|
@@ -7195,6 +6507,7 @@ var Vault = class {
|
|
|
7195
6507
|
...this.objectStore !== void 0 ? { objectStore: this.objectStore } : {},
|
|
7196
6508
|
...options?.blobFields !== void 0 ? { blobFields: options.blobFields } : {},
|
|
7197
6509
|
...this.indexStrategy !== void 0 ? { indexStrategy: this.indexStrategy } : {},
|
|
6510
|
+
...this.lazyStrategy !== void 0 ? { lazyStrategy: this.lazyStrategy } : {},
|
|
7198
6511
|
...this.aggregateStrategy !== void 0 ? { aggregateStrategy: this.aggregateStrategy } : {},
|
|
7199
6512
|
...this.crdtStrategy !== void 0 ? { crdtStrategy: this.crdtStrategy } : {},
|
|
7200
6513
|
...this.tiersStrategy !== void 0 ? { tiersStrategy: this.tiersStrategy } : {},
|
|
@@ -7252,6 +6565,9 @@ var Vault = class {
|
|
|
7252
6565
|
if (options?.acknowledgeDeterministicRisk !== void 0) {
|
|
7253
6566
|
collOpts.acknowledgeDeterministicRisk = options.acknowledgeDeterministicRisk;
|
|
7254
6567
|
}
|
|
6568
|
+
if (options?.acknowledgeEquatableRisk !== void 0) {
|
|
6569
|
+
collOpts.acknowledgeEquatableRisk = options.acknowledgeEquatableRisk;
|
|
6570
|
+
}
|
|
7255
6571
|
if (options?.sensitive !== void 0) {
|
|
7256
6572
|
collOpts.sensitive = options.sensitive;
|
|
7257
6573
|
}
|
|
@@ -7324,7 +6640,7 @@ var Vault = class {
|
|
|
7324
6640
|
const work = (async () => {
|
|
7325
6641
|
try {
|
|
7326
6642
|
const dek = await this.getDEK(collectionName);
|
|
7327
|
-
await persistSchemaIfNeeded({
|
|
6643
|
+
await (await import("./register-V5AQTXNI.js")).persistSchemaIfNeeded({
|
|
7328
6644
|
store: this.adapter,
|
|
7329
6645
|
vault: this.name,
|
|
7330
6646
|
collectionName,
|
|
@@ -7408,10 +6724,12 @@ var Vault = class {
|
|
|
7408
6724
|
async schemaFenceState() {
|
|
7409
6725
|
return loadFence(this.adapter, this.name);
|
|
7410
6726
|
}
|
|
7411
|
-
/** @internal Start
|
|
7412
|
-
_ensureFenceCoordination() {
|
|
6727
|
+
/** @internal Start heartbeat + fence watcher once a cutover is registered. Async since #553: FenceWatcher dynamic-imports on demand. */
|
|
6728
|
+
async _ensureFenceCoordination() {
|
|
7413
6729
|
if (this.#fenceCoordinationStarted) return;
|
|
7414
6730
|
this.#fenceCoordinationStarted = true;
|
|
6731
|
+
const { FenceWatcher } = await import("./fence-watcher-DHQ775JB.js");
|
|
6732
|
+
if (!this.#fenceCoordinationStarted) return;
|
|
7415
6733
|
this.#fenceWatcher = new FenceWatcher({
|
|
7416
6734
|
coordination: this.noydb.coordination,
|
|
7417
6735
|
vault: this.name,
|
|
@@ -7440,7 +6758,7 @@ var Vault = class {
|
|
|
7440
6758
|
}
|
|
7441
6759
|
/** @internal Drive one heartbeat + watch cycle deterministically (tests). */
|
|
7442
6760
|
async _fenceTick() {
|
|
7443
|
-
this._ensureFenceCoordination();
|
|
6761
|
+
await this._ensureFenceCoordination();
|
|
7444
6762
|
await this.#fenceWatcher.beat();
|
|
7445
6763
|
await this.#fenceWatcher.check();
|
|
7446
6764
|
}
|
|
@@ -7652,17 +6970,17 @@ var Vault = class {
|
|
|
7652
6970
|
if (!spec) {
|
|
7653
6971
|
throw new ValidationError(`vault.links("${name}"): not declared. Call vault.link("${name}", { a, b }) first.`);
|
|
7654
6972
|
}
|
|
7655
|
-
handle =
|
|
7656
|
-
this.adapter,
|
|
7657
|
-
this.name,
|
|
6973
|
+
handle = makeLazyLinkSetHandle({
|
|
6974
|
+
adapter: this.adapter,
|
|
6975
|
+
vault: this.name,
|
|
7658
6976
|
name,
|
|
7659
6977
|
spec,
|
|
7660
|
-
this.encrypted,
|
|
7661
|
-
this.getDEK,
|
|
7662
|
-
this.keyring.userId,
|
|
7663
|
-
this.emitter,
|
|
7664
|
-
async (collection, id) => await this.collection(collection).get(id) !== null
|
|
7665
|
-
);
|
|
6978
|
+
encrypted: this.encrypted,
|
|
6979
|
+
getDEK: this.getDEK,
|
|
6980
|
+
actor: this.keyring.userId,
|
|
6981
|
+
emitter: this.emitter,
|
|
6982
|
+
endpointExists: async (collection, id) => await this.collection(collection).get(id) !== null
|
|
6983
|
+
});
|
|
7666
6984
|
this.linkSetCache.set(name, handle);
|
|
7667
6985
|
}
|
|
7668
6986
|
return handle;
|
|
@@ -8171,8 +7489,14 @@ var Vault = class {
|
|
|
8171
7489
|
if (live?._sealed !== void 0) {
|
|
8172
7490
|
try {
|
|
8173
7491
|
const cls = await coll._classifySealedShred(live);
|
|
8174
|
-
|
|
8175
|
-
|
|
7492
|
+
for (const slot of cls.slots) {
|
|
7493
|
+
if (slot.class === "shreddable" || slot.class === "live-shreddable+dekResidue-in-backups") {
|
|
7494
|
+
sealedFieldsShredded += 1;
|
|
7495
|
+
}
|
|
7496
|
+
if (slot.class === "dekResidue" || slot.class === "live-shreddable+dekResidue-in-backups") {
|
|
7497
|
+
sealedResidue.push(`${ref2.collection}:${ref2.id}:${slot.field}`);
|
|
7498
|
+
}
|
|
7499
|
+
}
|
|
8176
7500
|
} catch {
|
|
8177
7501
|
for (const field of Object.keys(live._sealed)) sealedResidue.push(`${ref2.collection}:${ref2.id}:${field}`);
|
|
8178
7502
|
}
|
|
@@ -8231,7 +7555,7 @@ var Vault = class {
|
|
|
8231
7555
|
indexResidue.push(`${collName}:_ftindex`);
|
|
8232
7556
|
}
|
|
8233
7557
|
}
|
|
8234
|
-
const subjectHash = await
|
|
7558
|
+
const subjectHash = await sha256Hex(subjectId);
|
|
8235
7559
|
const ledger = this.getLedgerOrNull();
|
|
8236
7560
|
if (!ledger) {
|
|
8237
7561
|
throw new Error(
|
|
@@ -8399,7 +7723,7 @@ var Vault = class {
|
|
|
8399
7723
|
async _initDerivations(handles) {
|
|
8400
7724
|
if (handles.length === 0) return;
|
|
8401
7725
|
const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
8402
|
-
import("./registry-
|
|
7726
|
+
import("./registry-IMNMHWTM.js"),
|
|
8403
7727
|
import("./read-only-facade-5ADRJVTM.js")
|
|
8404
7728
|
]);
|
|
8405
7729
|
const registry = new DerivationRegistry();
|
|
@@ -8430,7 +7754,7 @@ var Vault = class {
|
|
|
8430
7754
|
*/
|
|
8431
7755
|
async _initMaterializedViews(handles) {
|
|
8432
7756
|
if (handles.length === 0) return;
|
|
8433
|
-
const { MaterializedViewRegistry } = await import("./registry-
|
|
7757
|
+
const { MaterializedViewRegistry } = await import("./registry-K6VUQXKV.js");
|
|
8434
7758
|
const registry = new MaterializedViewRegistry();
|
|
8435
7759
|
this.materializedViewRegistry = registry;
|
|
8436
7760
|
const db = this;
|
|
@@ -8454,7 +7778,7 @@ var Vault = class {
|
|
|
8454
7778
|
*/
|
|
8455
7779
|
async _initOverlayedViews(handles) {
|
|
8456
7780
|
if (handles.length === 0) return;
|
|
8457
|
-
const { OverlayedViewRegistry } = await import("./registry-
|
|
7781
|
+
const { OverlayedViewRegistry } = await import("./registry-ZVO3T4M5.js");
|
|
8458
7782
|
const registry = new OverlayedViewRegistry();
|
|
8459
7783
|
const mvRegistry = this.materializedViewRegistry;
|
|
8460
7784
|
const overlayNames = /* @__PURE__ */ new Set();
|
|
@@ -8501,13 +7825,13 @@ var Vault = class {
|
|
|
8501
7825
|
if (!reg) {
|
|
8502
7826
|
throw new Error(`refreshView: no MV registered with name "${name}"`);
|
|
8503
7827
|
}
|
|
8504
|
-
const { MaterializedViewExecutor } = await import("./executor-
|
|
7828
|
+
const { MaterializedViewExecutor } = await import("./executor-FGISLQIN.js");
|
|
8505
7829
|
const result = await MaterializedViewExecutor.refresh(reg, {
|
|
8506
7830
|
getCollection: (n) => this.collection(n),
|
|
8507
7831
|
getActiveTxContext: () => this.noydb._activeTxContextOrNull,
|
|
8508
7832
|
getQueryContext: () => this
|
|
8509
7833
|
});
|
|
8510
|
-
const { clearMVStale } = await import("./stale-
|
|
7834
|
+
const { clearMVStale } = await import("./stale-7Q62KVI3.js");
|
|
8511
7835
|
clearMVStale(registry, name);
|
|
8512
7836
|
return result;
|
|
8513
7837
|
}
|
|
@@ -8523,7 +7847,7 @@ var Vault = class {
|
|
|
8523
7847
|
if (registry === null) return { derived: 0, failed: 0 };
|
|
8524
7848
|
const strategies = registry.strategiesForSource(sourceCollection);
|
|
8525
7849
|
if (strategies.length === 0) return { derived: 0, failed: 0 };
|
|
8526
|
-
const { DerivationExecutor } = await import("./executor-
|
|
7850
|
+
const { DerivationExecutor } = await import("./executor-CBTNU5VZ.js");
|
|
8527
7851
|
const sourceColl = this.collection(sourceCollection);
|
|
8528
7852
|
const records = await sourceColl.list();
|
|
8529
7853
|
const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-5ADRJVTM.js")).ReadOnlyVaultFacade(this, "derivation") };
|
|
@@ -8548,7 +7872,7 @@ var Vault = class {
|
|
|
8548
7872
|
if (!outSpec) continue;
|
|
8549
7873
|
const outputColl = this.collection(outSpec.collection);
|
|
8550
7874
|
if (out.kind === "array") {
|
|
8551
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
7875
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-WS22Q5WH.js");
|
|
8552
7876
|
const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key, this.getDEK, this.encrypted);
|
|
8553
7877
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
8554
7878
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -8698,11 +8022,11 @@ var Vault = class {
|
|
|
8698
8022
|
*
|
|
8699
8023
|
*.
|
|
8700
8024
|
*/
|
|
8701
|
-
async withConsent(ctx,
|
|
8025
|
+
async withConsent(ctx, fn2) {
|
|
8702
8026
|
const prior = this.consentContext;
|
|
8703
8027
|
this.consentContext = ctx;
|
|
8704
8028
|
try {
|
|
8705
|
-
return await
|
|
8029
|
+
return await fn2();
|
|
8706
8030
|
} finally {
|
|
8707
8031
|
this.consentContext = prior;
|
|
8708
8032
|
}
|
|
@@ -8770,7 +8094,7 @@ var Vault = class {
|
|
|
8770
8094
|
* collection.
|
|
8771
8095
|
*/
|
|
8772
8096
|
async delegate(opts) {
|
|
8773
|
-
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
8097
|
+
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-BQNIEHZE.js");
|
|
8774
8098
|
if (!this.keyring.kek) {
|
|
8775
8099
|
throw new ValidationError(
|
|
8776
8100
|
"issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
|
|
@@ -8792,7 +8116,7 @@ var Vault = class {
|
|
|
8792
8116
|
* if the id does not exist.
|
|
8793
8117
|
*/
|
|
8794
8118
|
async revokeDelegation(id) {
|
|
8795
|
-
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
8119
|
+
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-BQNIEHZE.js");
|
|
8796
8120
|
await revokeDelegation(this.adapter, this.name, id);
|
|
8797
8121
|
void DELEGATIONS_COLLECTION;
|
|
8798
8122
|
}
|
|
@@ -9008,6 +8332,7 @@ var Vault = class {
|
|
|
9008
8332
|
* @see docs/superpowers/specs/2026-05-22-schema-dump-design.md
|
|
9009
8333
|
*/
|
|
9010
8334
|
async dumpSchema(opts = {}) {
|
|
8335
|
+
const { dumpVaultSchema } = await import("./walk-T65TZDN2.js");
|
|
9011
8336
|
return dumpVaultSchema(this, opts);
|
|
9012
8337
|
}
|
|
9013
8338
|
/**
|
|
@@ -9142,7 +8467,7 @@ var Vault = class {
|
|
|
9142
8467
|
* @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/public-envelope.md
|
|
9143
8468
|
*/
|
|
9144
8469
|
async getPublicEnvelope(opts = {}) {
|
|
9145
|
-
const { readPublicEnvelope } = await import("./public-envelope-
|
|
8470
|
+
const { readPublicEnvelope } = await import("./public-envelope-MRN5YYZZ.js");
|
|
9146
8471
|
return readPublicEnvelope(this.adapter, this.name, opts);
|
|
9147
8472
|
}
|
|
9148
8473
|
/**
|
|
@@ -9157,7 +8482,7 @@ var Vault = class {
|
|
|
9157
8482
|
* both modes round-trip cleanly.
|
|
9158
8483
|
*/
|
|
9159
8484
|
async dump() {
|
|
9160
|
-
const { dumpVault } = await import("./backup-
|
|
8485
|
+
const { dumpVault } = await import("./backup-OPONO6Q5.js");
|
|
9161
8486
|
return dumpVault(this.backupContext());
|
|
9162
8487
|
}
|
|
9163
8488
|
/**
|
|
@@ -9209,7 +8534,7 @@ var Vault = class {
|
|
|
9209
8534
|
* — there's no chain to verify against.
|
|
9210
8535
|
*/
|
|
9211
8536
|
async load(backupJson) {
|
|
9212
|
-
const { loadVault } = await import("./backup-
|
|
8537
|
+
const { loadVault } = await import("./backup-OPONO6Q5.js");
|
|
9213
8538
|
return loadVault(this.backupContext(), backupJson);
|
|
9214
8539
|
}
|
|
9215
8540
|
/**
|
|
@@ -9241,7 +8566,7 @@ var Vault = class {
|
|
|
9241
8566
|
* way to detect tampering of an in-place vault.
|
|
9242
8567
|
*/
|
|
9243
8568
|
async verifyBackupIntegrity() {
|
|
9244
|
-
const { verifyBackupIntegrity } = await import("./backup-
|
|
8569
|
+
const { verifyBackupIntegrity } = await import("./backup-OPONO6Q5.js");
|
|
9245
8570
|
return verifyBackupIntegrity(this.backupContext());
|
|
9246
8571
|
}
|
|
9247
8572
|
/**
|
|
@@ -9459,7 +8784,7 @@ var Vault = class {
|
|
|
9459
8784
|
* is the live validator object, not a serialization of it).
|
|
9460
8785
|
*/
|
|
9461
8786
|
async exportJSON(opts = {}) {
|
|
9462
|
-
const { exportVaultJSON } = await import("./backup-
|
|
8787
|
+
const { exportVaultJSON } = await import("./backup-OPONO6Q5.js");
|
|
9463
8788
|
return exportVaultJSON(this.backupContext(), opts);
|
|
9464
8789
|
}
|
|
9465
8790
|
};
|
|
@@ -9536,10 +8861,10 @@ var WriteQueueTracker = class {
|
|
|
9536
8861
|
* (success or failure). The fn's resolved value is returned; a thrown
|
|
9537
8862
|
* error is re-thrown after the queue is decremented.
|
|
9538
8863
|
*/
|
|
9539
|
-
async track(
|
|
8864
|
+
async track(fn2) {
|
|
9540
8865
|
this.begin();
|
|
9541
8866
|
try {
|
|
9542
|
-
const value = await
|
|
8867
|
+
const value = await fn2();
|
|
9543
8868
|
this.settle();
|
|
9544
8869
|
return value;
|
|
9545
8870
|
} catch (error) {
|
|
@@ -9624,13 +8949,13 @@ var TabCoordinator = class {
|
|
|
9624
8949
|
const out = [self, ...[...this.#peers.values()].filter((p) => p.lastSeen >= cutoff)];
|
|
9625
8950
|
return out.sort((a, b) => a.tabId.localeCompare(b.tabId));
|
|
9626
8951
|
}
|
|
9627
|
-
onTabRoleChange(
|
|
9628
|
-
this.#roleHandlers.add(
|
|
9629
|
-
return () => this.#roleHandlers.delete(
|
|
8952
|
+
onTabRoleChange(fn2) {
|
|
8953
|
+
this.#roleHandlers.add(fn2);
|
|
8954
|
+
return () => this.#roleHandlers.delete(fn2);
|
|
9630
8955
|
}
|
|
9631
|
-
onActiveTabsChange(
|
|
9632
|
-
this.#tabsHandlers.add(
|
|
9633
|
-
return () => this.#tabsHandlers.delete(
|
|
8956
|
+
onActiveTabsChange(fn2) {
|
|
8957
|
+
this.#tabsHandlers.add(fn2);
|
|
8958
|
+
return () => this.#tabsHandlers.delete(fn2);
|
|
9634
8959
|
}
|
|
9635
8960
|
dispose() {
|
|
9636
8961
|
if (this.#disposed) return;
|
|
@@ -10327,6 +9652,35 @@ var TeamFacade = class {
|
|
|
10327
9652
|
}
|
|
10328
9653
|
return p;
|
|
10329
9654
|
}
|
|
9655
|
+
// ─── Multi-user grant / revoke / rotate runners (#267 team split) ──
|
|
9656
|
+
//
|
|
9657
|
+
// The kernel's `db.grant` / `db.revoke` / `db.rotate` route through the
|
|
9658
|
+
// TeamStrategy seam, which calls back here with the keyring ENGINE as an
|
|
9659
|
+
// argument (statically linked in `active.ts`, i.e. only in the
|
|
9660
|
+
// `@noy-db/hub/team` subpath bundle). These runners own the policy-gate +
|
|
9661
|
+
// keyring plumbing so the kernel keeps single-line delegators and the
|
|
9662
|
+
// engines stay off the single-user floor.
|
|
9663
|
+
/** Gate + run a `grant` engine. See `Noydb.grant` for the public contract. */
|
|
9664
|
+
async runGrant(engine, vault, options, factors) {
|
|
9665
|
+
this.deps.checkPolicyOperation(vault, "grant");
|
|
9666
|
+
await this.deps.checkGate(vault, "enroll-user", factors);
|
|
9667
|
+
const keyring = await this.deps.getKeyringInternal(vault);
|
|
9668
|
+
await engine(this.deps.options.store, vault, keyring, options);
|
|
9669
|
+
}
|
|
9670
|
+
/** Gate + run a `revoke` engine. See `Noydb.revoke` for the public contract. */
|
|
9671
|
+
async runRevoke(engine, vault, options, factors) {
|
|
9672
|
+
this.deps.checkPolicyOperation(vault, "revoke");
|
|
9673
|
+
await this.deps.checkGate(vault, "revoke-user", factors);
|
|
9674
|
+
const keyring = await this.deps.getKeyringInternal(vault);
|
|
9675
|
+
await engine(this.deps.options.store, vault, keyring, options);
|
|
9676
|
+
}
|
|
9677
|
+
/** Gate + run a `rotateKeys` engine. See `Noydb.rotate` for the public contract. */
|
|
9678
|
+
async runRotate(engine, vault, collections) {
|
|
9679
|
+
this.deps.checkPolicyOperation(vault, "rotate");
|
|
9680
|
+
const keyring = await this.deps.getKeyringInternal(vault);
|
|
9681
|
+
await engine(this.deps.options.store, vault, keyring, collections);
|
|
9682
|
+
this.deps.keyringCache.set(vault, keyring);
|
|
9683
|
+
}
|
|
10330
9684
|
// ─── Tier-2 enroll / remove ─────────────────────────────────────
|
|
10331
9685
|
/**
|
|
10332
9686
|
* Add a tier-2 authenticator slot to the calling user's keyring.
|
|
@@ -11072,6 +10426,15 @@ var Noydb = class {
|
|
|
11072
10426
|
/** Pre-resolved `vault.user` API factory (mirrors `coordinationProvider` above). Public so `Vault` can call it. */
|
|
11073
10427
|
userApiFactory;
|
|
11074
10428
|
vaultCache = /* @__PURE__ */ new Map();
|
|
10429
|
+
/**
|
|
10430
|
+
* In-flight `openVault` promise per name — concurrent opens of the same
|
|
10431
|
+
* vault must converge on ONE Vault instance. Without this, two callers
|
|
10432
|
+
* racing past the `vaultCache` miss each construct a Vault (and later two
|
|
10433
|
+
* Collections with independent DEKs for the same store slice), so a record
|
|
10434
|
+
* written through one fails decryption through the other with a spurious
|
|
10435
|
+
* `TamperedError` (#564).
|
|
10436
|
+
*/
|
|
10437
|
+
vaultOpening = /* @__PURE__ */ new Map();
|
|
11075
10438
|
keyringCache = /* @__PURE__ */ new Map();
|
|
11076
10439
|
syncEngines = /* @__PURE__ */ new Map();
|
|
11077
10440
|
/**
|
|
@@ -11111,6 +10474,11 @@ var Noydb = class {
|
|
|
11111
10474
|
* through it; grant/revoke route through it from this class. @internal
|
|
11112
10475
|
*/
|
|
11113
10476
|
custodyStrategy;
|
|
10477
|
+
/**
|
|
10478
|
+
* Opt-in multi-user team strategy (#267 keyring-grant → team split) —
|
|
10479
|
+
* `NO_TEAM` (throwing) unless `withTeam()` was passed; the keyring
|
|
10480
|
+
* engines are linked only by the active strategy, not by this file. */
|
|
10481
|
+
teamStrategy;
|
|
11114
10482
|
sessionStrategy;
|
|
11115
10483
|
syncStrategy;
|
|
11116
10484
|
snapshots;
|
|
@@ -11161,6 +10529,7 @@ var Noydb = class {
|
|
|
11161
10529
|
this.txStrategy = options.txStrategy ?? NO_TX;
|
|
11162
10530
|
this.forgetStrategy = options.forgetStrategy ?? NO_FORGET;
|
|
11163
10531
|
this.custodyStrategy = options.custodyStrategy ?? NO_CUSTODY;
|
|
10532
|
+
this.teamStrategy = options.teamStrategy ?? NO_TEAM;
|
|
11164
10533
|
this.sessionStrategy = options.sessionStrategy ?? NO_SESSION;
|
|
11165
10534
|
this.syncStrategy = options.syncStrategy ?? NO_SYNC;
|
|
11166
10535
|
this.snapshots = new NoydbSnapshots({
|
|
@@ -11192,6 +10561,7 @@ var Noydb = class {
|
|
|
11192
10561
|
quickUnlock: this.quickUnlock,
|
|
11193
10562
|
policyCache: this.policyCache,
|
|
11194
10563
|
checkGate: (vault, gate, factors) => this.checkGate(vault, gate, factors),
|
|
10564
|
+
checkPolicyOperation: (vault, op) => this.checkPolicyOperation(vault, op),
|
|
11195
10565
|
getKeyringInternal: (vault, opts) => this._getKeyringInternal(vault, opts),
|
|
11196
10566
|
assertRecoveryEnrolled: (vault, policy, opts) => this.assertRecoveryEnrolled(vault, policy, opts),
|
|
11197
10567
|
openVault: (vault, opts) => this.openVault(vault, opts),
|
|
@@ -11286,7 +10656,7 @@ var Noydb = class {
|
|
|
11286
10656
|
if (!facade) return;
|
|
11287
10657
|
const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
|
|
11288
10658
|
await registry.runChecks(e.collection, incoming, ctx);
|
|
11289
|
-
const { GuardExecutor } = await import("./executor-
|
|
10659
|
+
const { GuardExecutor } = await import("./executor-DJHNSTIR.js");
|
|
11290
10660
|
for (const g of guards) {
|
|
11291
10661
|
await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
|
|
11292
10662
|
}
|
|
@@ -11381,12 +10751,26 @@ var Noydb = class {
|
|
|
11381
10751
|
if (this.closed) throw new ValidationError("Instance is closed");
|
|
11382
10752
|
this.touchPolicy(name);
|
|
11383
10753
|
let comp = this.vaultCache.get(name);
|
|
10754
|
+
if (!comp) {
|
|
10755
|
+
const pending = this.vaultOpening.get(name);
|
|
10756
|
+
if (pending) comp = await pending;
|
|
10757
|
+
}
|
|
11384
10758
|
if (comp) {
|
|
11385
10759
|
if (opts?.locale !== void 0) {
|
|
11386
10760
|
comp.setLocale(opts.locale);
|
|
11387
10761
|
}
|
|
11388
10762
|
return comp;
|
|
11389
10763
|
}
|
|
10764
|
+
const opening = this.#openVaultFresh(name, opts);
|
|
10765
|
+
this.vaultOpening.set(name, opening);
|
|
10766
|
+
try {
|
|
10767
|
+
return await opening;
|
|
10768
|
+
} finally {
|
|
10769
|
+
this.vaultOpening.delete(name);
|
|
10770
|
+
}
|
|
10771
|
+
}
|
|
10772
|
+
/** Uncached single-flight body of {@link openVault} — see `vaultOpening`. */
|
|
10773
|
+
async #openVaultFresh(name, opts) {
|
|
11390
10774
|
const keyring = await this._getKeyringInternal(name, { create: opts?.create !== false });
|
|
11391
10775
|
if (!this.activeTier.has(name)) {
|
|
11392
10776
|
this.activeTier.set(name, 1);
|
|
@@ -11427,7 +10811,7 @@ var Noydb = class {
|
|
|
11427
10811
|
this.syncEngines.set(key, engine);
|
|
11428
10812
|
}
|
|
11429
10813
|
}
|
|
11430
|
-
comp = new Vault({
|
|
10814
|
+
const comp = new Vault({
|
|
11431
10815
|
adapter: this.options.store,
|
|
11432
10816
|
name,
|
|
11433
10817
|
noydb: this,
|
|
@@ -11448,6 +10832,7 @@ var Noydb = class {
|
|
|
11448
10832
|
...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
|
|
11449
10833
|
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
11450
10834
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
10835
|
+
...this.options.lazyStrategy !== void 0 ? { lazyStrategy: this.options.lazyStrategy } : {},
|
|
11451
10836
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
11452
10837
|
...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
|
|
11453
10838
|
...this.options.tiersStrategy !== void 0 ? { tiersStrategy: this.options.tiersStrategy } : {},
|
|
@@ -11514,6 +10899,7 @@ var Noydb = class {
|
|
|
11514
10899
|
...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
|
|
11515
10900
|
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
11516
10901
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
10902
|
+
...this.options.lazyStrategy !== void 0 ? { lazyStrategy: this.options.lazyStrategy } : {},
|
|
11517
10903
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
11518
10904
|
...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
|
|
11519
10905
|
...this.options.tiersStrategy !== void 0 ? { tiersStrategy: this.options.tiersStrategy } : {},
|
|
@@ -11554,6 +10940,7 @@ var Noydb = class {
|
|
|
11554
10940
|
...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
|
|
11555
10941
|
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
11556
10942
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
10943
|
+
...this.options.lazyStrategy !== void 0 ? { lazyStrategy: this.options.lazyStrategy } : {},
|
|
11557
10944
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
11558
10945
|
...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
|
|
11559
10946
|
...this.options.tiersStrategy !== void 0 ? { tiersStrategy: this.options.tiersStrategy } : {},
|
|
@@ -11581,12 +10968,10 @@ var Noydb = class {
|
|
|
11581
10968
|
*
|
|
11582
10969
|
* The legacy `requireReAuthFor: ['grant']` session-policy check still
|
|
11583
10970
|
* fires on top — both are independent opt-ins.
|
|
10971
|
+
* Opt-in (#267): throws {@link TeamNotEnabledError} without `withTeam()`.
|
|
11584
10972
|
*/
|
|
11585
10973
|
async grant(vault, options, factors) {
|
|
11586
|
-
this.
|
|
11587
|
-
await this.checkGate(vault, "enroll-user", factors);
|
|
11588
|
-
const keyring = await this._getKeyringInternal(vault);
|
|
11589
|
-
await grant(this.options.store, vault, keyring, options);
|
|
10974
|
+
return this.teamStrategy.grant(this.team, vault, options, factors);
|
|
11590
10975
|
}
|
|
11591
10976
|
/**
|
|
11592
10977
|
* Revoke a user's access to a vault.
|
|
@@ -11596,12 +10981,10 @@ var Noydb = class {
|
|
|
11596
10981
|
*
|
|
11597
10982
|
* The legacy `requireReAuthFor: ['revoke']` session-policy check still
|
|
11598
10983
|
* fires on top — both are independent opt-ins.
|
|
10984
|
+
* Opt-in (#267): throws {@link TeamNotEnabledError} without `withTeam()`.
|
|
11599
10985
|
*/
|
|
11600
10986
|
async revoke(vault, options, factors) {
|
|
11601
|
-
this.
|
|
11602
|
-
await this.checkGate(vault, "revoke-user", factors);
|
|
11603
|
-
const keyring = await this._getKeyringInternal(vault);
|
|
11604
|
-
await revoke(this.options.store, vault, keyring, options);
|
|
10987
|
+
return this.teamStrategy.revoke(this.team, vault, options, factors);
|
|
11605
10988
|
}
|
|
11606
10989
|
/**
|
|
11607
10990
|
* Grant the FR-6 `custodian` role to a user (owner-only custody API).
|
|
@@ -11616,13 +10999,14 @@ var Noydb = class {
|
|
|
11616
10999
|
async grantCustodian(vault, options, factors) {
|
|
11617
11000
|
return this.custodyStrategy.grantCustodian(this, vault, options, factors);
|
|
11618
11001
|
}
|
|
11619
|
-
/** @internal —
|
|
11620
|
-
|
|
11002
|
+
/** @internal — grant-custodian engine, reached only via withCustody(); the
|
|
11003
|
+
* keyring engine arrives as an argument so the floor never carries it (#267). */
|
|
11004
|
+
async _grantCustodianImpl(engine, vault, options, factors) {
|
|
11621
11005
|
this.checkPolicyOperation(vault, "grant");
|
|
11622
11006
|
await this.checkGate(vault, "grant-custodian", factors);
|
|
11623
11007
|
const keyring = await this._getKeyringInternal(vault);
|
|
11624
11008
|
if (keyring.role !== "owner") throw new PermissionDeniedError("only the Deed owner can grant a custodian");
|
|
11625
|
-
await
|
|
11009
|
+
await engine(this.options.store, vault, keyring, { ...options, role: "custodian" });
|
|
11626
11010
|
}
|
|
11627
11011
|
/**
|
|
11628
11012
|
* Revoke a custodian (owner-only custody API).
|
|
@@ -11634,13 +11018,14 @@ var Noydb = class {
|
|
|
11634
11018
|
async revokeCustodian(vault, options, factors) {
|
|
11635
11019
|
return this.custodyStrategy.revokeCustodian(this, vault, options, factors);
|
|
11636
11020
|
}
|
|
11637
|
-
/** @internal —
|
|
11638
|
-
|
|
11021
|
+
/** @internal — revoke-custodian engine, reached only via withCustody().
|
|
11022
|
+
* Mirrors `_grantCustodianImpl` (#267: engine passed in). */
|
|
11023
|
+
async _revokeCustodianImpl(engine, vault, options, factors) {
|
|
11639
11024
|
this.checkPolicyOperation(vault, "revoke");
|
|
11640
11025
|
await this.checkGate(vault, "revoke-user", factors);
|
|
11641
11026
|
const keyring = await this._getKeyringInternal(vault);
|
|
11642
11027
|
if (keyring.role !== "owner") throw new PermissionDeniedError("only the Deed owner can revoke a custodian");
|
|
11643
|
-
await
|
|
11028
|
+
await engine(this.options.store, vault, keyring, options);
|
|
11644
11029
|
}
|
|
11645
11030
|
/**
|
|
11646
11031
|
* Mutate post-grant identity fields on an existing keyring — `role`,
|
|
@@ -11707,12 +11092,10 @@ var Noydb = class {
|
|
|
11707
11092
|
* Exposed on Noydb (rather than only on the lower-level keyring
|
|
11708
11093
|
* module) so CLI and admin tooling can trigger rotation without
|
|
11709
11094
|
* reaching into internals. See `noy-db rotate` for the CLI wrapper.
|
|
11095
|
+
* Opt-in (#267): throws {@link TeamNotEnabledError} without `withTeam()`.
|
|
11710
11096
|
*/
|
|
11711
11097
|
async rotate(vault, collections) {
|
|
11712
|
-
this.
|
|
11713
|
-
const keyring = await this._getKeyringInternal(vault);
|
|
11714
|
-
await rotateKeys(this.options.store, vault, keyring, collections);
|
|
11715
|
-
this.keyringCache.set(vault, keyring);
|
|
11098
|
+
return this.teamStrategy.rotate(this.team, vault, collections);
|
|
11716
11099
|
}
|
|
11717
11100
|
/** List all users with access to a vault. */
|
|
11718
11101
|
async listUsers(vault) {
|
|
@@ -11872,7 +11255,7 @@ var Noydb = class {
|
|
|
11872
11255
|
* })
|
|
11873
11256
|
* ```
|
|
11874
11257
|
*/
|
|
11875
|
-
async queryAcross(vaultIds,
|
|
11258
|
+
async queryAcross(vaultIds, fn2, options = {}) {
|
|
11876
11259
|
if (this.closed) throw new ValidationError("Instance is closed");
|
|
11877
11260
|
this.resetSessionTimer();
|
|
11878
11261
|
const concurrency = Math.max(1, options.concurrency ?? 1);
|
|
@@ -11886,7 +11269,7 @@ var Noydb = class {
|
|
|
11886
11269
|
const task = (async () => {
|
|
11887
11270
|
try {
|
|
11888
11271
|
const comp = await this.openVault(vaultId, { create: options.create !== false });
|
|
11889
|
-
const result = await
|
|
11272
|
+
const result = await fn2(comp);
|
|
11890
11273
|
results[idx] = { vault: vaultId, result };
|
|
11891
11274
|
} catch (err) {
|
|
11892
11275
|
results[idx] = {
|
|
@@ -12146,9 +11529,9 @@ var Noydb = class {
|
|
|
12146
11529
|
return this.writeHooks.onAfterWrite(handler);
|
|
12147
11530
|
}
|
|
12148
11531
|
/** Subscribe to cross-tab write conflicts. Returns an unsubscribe. */
|
|
12149
|
-
onWriteConflict(
|
|
12150
|
-
this.on("write:conflict",
|
|
12151
|
-
return () => this.off("write:conflict",
|
|
11532
|
+
onWriteConflict(fn2) {
|
|
11533
|
+
this.on("write:conflict", fn2);
|
|
11534
|
+
return () => this.off("write:conflict", fn2);
|
|
12152
11535
|
}
|
|
12153
11536
|
/**
|
|
12154
11537
|
* Enable same-device multi-tab coordination: primary/secondary
|
|
@@ -12222,12 +11605,12 @@ var Noydb = class {
|
|
|
12222
11605
|
activeTabs() {
|
|
12223
11606
|
return this.tabCoordinator?.activeTabs() ?? [];
|
|
12224
11607
|
}
|
|
12225
|
-
onTabRoleChange(
|
|
12226
|
-
return this.tabCoordinator?.onTabRoleChange(
|
|
11608
|
+
onTabRoleChange(fn2) {
|
|
11609
|
+
return this.tabCoordinator?.onTabRoleChange(fn2) ?? (() => {
|
|
12227
11610
|
});
|
|
12228
11611
|
}
|
|
12229
|
-
onActiveTabsChange(
|
|
12230
|
-
return this.tabCoordinator?.onActiveTabsChange(
|
|
11612
|
+
onActiveTabsChange(fn2) {
|
|
11613
|
+
return this.tabCoordinator?.onActiveTabsChange(fn2) ?? (() => {
|
|
12231
11614
|
});
|
|
12232
11615
|
}
|
|
12233
11616
|
/** @internal The write-hook registry, threaded into each Collection. */
|
|
@@ -12526,7 +11909,7 @@ var Noydb = class {
|
|
|
12526
11909
|
"setPublicEnvelope: the public-envelope feature is not enabled. Pass `publicEnvelope: true` (or a schema object) to `createNoydb`."
|
|
12527
11910
|
);
|
|
12528
11911
|
}
|
|
12529
|
-
const { loadPublicEnvelope, savePublicEnvelope, resolveSchema, validatePublicEnvelopeInput } = await import("./public-envelope-
|
|
11912
|
+
const { loadPublicEnvelope, savePublicEnvelope, resolveSchema, validatePublicEnvelopeInput } = await import("./public-envelope-MRN5YYZZ.js");
|
|
12530
11913
|
const schema = resolveSchema(this.options.publicEnvelope);
|
|
12531
11914
|
validatePublicEnvelopeInput(input, schema);
|
|
12532
11915
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -12555,7 +11938,7 @@ var Noydb = class {
|
|
|
12555
11938
|
* regardless).
|
|
12556
11939
|
*/
|
|
12557
11940
|
async getPublicEnvelope(vault, opts = {}) {
|
|
12558
|
-
const { readPublicEnvelope } = await import("./public-envelope-
|
|
11941
|
+
const { readPublicEnvelope } = await import("./public-envelope-MRN5YYZZ.js");
|
|
12559
11942
|
return readPublicEnvelope(this.options.store, vault, opts);
|
|
12560
11943
|
}
|
|
12561
11944
|
// ─── Auth introspection ─────────────────────────────────────────
|
|
@@ -12746,9 +12129,9 @@ async function createNoydb(options) {
|
|
|
12746
12129
|
throw new ValidationError("A secret (passphrase) or getKeyring callback is required when encryption is enabled");
|
|
12747
12130
|
}
|
|
12748
12131
|
if (!options.coordinationStrategy) options = { ...options, coordinationStrategy: await createDefaultCoordinationProvider(options.store) };
|
|
12749
|
-
if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-
|
|
12132
|
+
if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-JOXUNSKP.js")).createUserApi };
|
|
12750
12133
|
if (!options.policyFactory) {
|
|
12751
|
-
const policyModule = await import("./policy-
|
|
12134
|
+
const policyModule = await import("./policy-YIKUH4AD.js");
|
|
12752
12135
|
options = { ...options, policyFactory: policyModule.createNoydbPolicy, policyCheckGateFn: policyModule.checkGate };
|
|
12753
12136
|
}
|
|
12754
12137
|
return new Noydb(options);
|
|
@@ -12765,13 +12148,6 @@ function normalizeSyncTargets(sync) {
|
|
|
12765
12148
|
export {
|
|
12766
12149
|
memoryStore,
|
|
12767
12150
|
withArchive,
|
|
12768
|
-
ComputedFieldError,
|
|
12769
|
-
evalComputedFields,
|
|
12770
|
-
isZodSchema,
|
|
12771
|
-
derivePersistedSchema,
|
|
12772
|
-
Lru,
|
|
12773
|
-
parseBytes,
|
|
12774
|
-
estimateRecordBytes,
|
|
12775
12151
|
Collection,
|
|
12776
12152
|
ELEVATION_AUDIT_COLLECTION,
|
|
12777
12153
|
ElevatedHandle,
|
|
@@ -12781,10 +12157,6 @@ export {
|
|
|
12781
12157
|
ref,
|
|
12782
12158
|
refArray,
|
|
12783
12159
|
RefRegistry,
|
|
12784
|
-
isLinkCollectionName,
|
|
12785
|
-
LinkEndpointError,
|
|
12786
|
-
LinkIntegrityError,
|
|
12787
|
-
persistSchemaIfNeeded,
|
|
12788
12160
|
Vault,
|
|
12789
12161
|
QuickUnlockStore,
|
|
12790
12162
|
describeAuthConfig,
|
|
@@ -12794,4 +12166,4 @@ export {
|
|
|
12794
12166
|
Noydb,
|
|
12795
12167
|
createNoydb
|
|
12796
12168
|
};
|
|
12797
|
-
//# sourceMappingURL=chunk-
|
|
12169
|
+
//# sourceMappingURL=chunk-IEUIUSBO.js.map
|