@noy-db/hub 0.3.0-pre.11 → 0.3.0-pre.13
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/aggregate/index.js +4 -4
- package/dist/api-ZGS6LCOF.js +20 -0
- package/dist/as/index.js +11 -11
- package/dist/attestation/index.js +18 -18
- package/dist/{backup-XA5STIYQ.js → backup-BJ57IKAO.js} +28 -11
- package/dist/backup-BJ57IKAO.js.map +1 -0
- package/dist/blobs/index.js +12 -10
- package/dist/blobs/index.js.map +1 -1
- package/dist/broker/index.js +12 -12
- package/dist/bundle/index.js +25 -22
- package/dist/bundle/index.js.map +1 -1
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.js +22 -22
- package/dist/{chunk-WGV4CUZT.js → chunk-2NVOWNI3.js} +4 -4
- package/dist/{chunk-WGV4CUZT.js.map → chunk-2NVOWNI3.js.map} +1 -1
- package/dist/{chunk-OFJ5GPNA.js → chunk-3B5VVCNY.js} +2 -2
- package/dist/{chunk-KPGX66PM.js → chunk-3LQ2YKO4.js} +2 -2
- package/dist/{chunk-D26JB3LZ.js → chunk-3QCRBHCY.js} +2 -2
- package/dist/{chunk-H6CZSDWK.js → chunk-454JXE57.js} +3 -3
- package/dist/{chunk-H6CZSDWK.js.map → chunk-454JXE57.js.map} +1 -1
- package/dist/{chunk-DGH65E7Q.js → chunk-4CTHCN4J.js} +24 -10
- package/dist/chunk-4CTHCN4J.js.map +1 -0
- package/dist/{chunk-4N5QFSNQ.js → chunk-4JBYV75E.js} +5 -5
- package/dist/{chunk-UTLEAJXC.js → chunk-4NXKCLLQ.js} +2 -2
- package/dist/{chunk-ARSAMO24.js → chunk-4VNQOLML.js} +2 -2
- package/dist/{chunk-X6CMGUAG.js → chunk-5M5DVGV7.js} +2 -2
- package/dist/{chunk-DJ3VKYFA.js → chunk-5O3XF4DV.js} +4 -4
- package/dist/chunk-5O3XF4DV.js.map +1 -0
- package/dist/{chunk-XHV25KBM.js → chunk-5YOLBEQ6.js} +2 -2
- package/dist/{chunk-CB25ONKC.js → chunk-6CRIV7DE.js} +2 -2
- package/dist/{chunk-BE7N3AXA.js → chunk-6JTIAGHD.js} +3 -3
- package/dist/{chunk-JOQ53DMI.js → chunk-6QTNZJBS.js} +3 -3
- package/dist/{chunk-BZO4WCJI.js → chunk-6T2SCQRU.js} +4 -4
- package/dist/{chunk-FQQF23MC.js → chunk-7DSTRQIJ.js} +2 -2
- package/dist/{chunk-IP2QBAGS.js → chunk-AUSTCW2X.js} +10 -10
- package/dist/{chunk-A2Y6YFVN.js → chunk-B3HJYUOF.js} +2 -2
- package/dist/{chunk-SRVQHVNX.js → chunk-BDVFPG6Y.js} +5 -5
- package/dist/{chunk-FH542DDY.js → chunk-BIOUI4HL.js} +50 -1
- package/dist/chunk-BIOUI4HL.js.map +1 -0
- package/dist/{chunk-YXOUQ2H7.js → chunk-CAF6WOK7.js} +2 -2
- package/dist/{chunk-H6HM6CVR.js → chunk-CDUQTA3Z.js} +114 -12
- package/dist/chunk-CDUQTA3Z.js.map +1 -0
- package/dist/{chunk-HUS3J5WM.js → chunk-CIE2BASH.js} +2 -2
- package/dist/{chunk-DIRRS7WP.js → chunk-CRI4OUV4.js} +2 -2
- package/dist/{chunk-FXK4X4BL.js → chunk-DLG74CNB.js} +4 -4
- package/dist/{chunk-WTUNZACT.js → chunk-E5ZQT5KX.js} +2 -2
- package/dist/{chunk-DMFNPHCX.js → chunk-EQO2UVP4.js} +6 -6
- package/dist/{chunk-MCEKIAO4.js → chunk-ERJ7FU55.js} +3 -3
- package/dist/{chunk-6QILBDZU.js → chunk-EVVGJDRQ.js} +3 -3
- package/dist/{chunk-7VSGW5KJ.js → chunk-EVX47VBM.js} +2 -2
- package/dist/{chunk-D3EFFFOL.js → chunk-EXK7QRWF.js} +5 -5
- package/dist/{chunk-5JB73NMC.js → chunk-EYZ6IQ6X.js} +5 -5
- package/dist/{chunk-BCYQA5BK.js → chunk-F64IRYG3.js} +2 -2
- package/dist/{chunk-K62IUKOD.js → chunk-FHS2HQSH.js} +5 -5
- package/dist/{chunk-2JMMY7HZ.js → chunk-FM3G3NOY.js} +27 -9
- package/dist/chunk-FM3G3NOY.js.map +1 -0
- package/dist/{chunk-67TNU77I.js → chunk-FUG4SFN3.js} +2 -2
- package/dist/{chunk-ZP5PL65C.js → chunk-GKEWXIV5.js} +2 -2
- package/dist/{chunk-RKRGDAS7.js → chunk-GTGPO5KW.js} +5 -5
- package/dist/{chunk-MSPNM2OM.js → chunk-HB3RFQSC.js} +3 -3
- package/dist/{chunk-W5D62AQD.js → chunk-HDMEGAQE.js} +20 -7
- package/dist/chunk-HDMEGAQE.js.map +1 -0
- package/dist/chunk-HDQIIUPH.js +135 -0
- package/dist/chunk-HDQIIUPH.js.map +1 -0
- package/dist/{chunk-7QIXUSDQ.js → chunk-HTJQYHZP.js} +15 -12
- package/dist/chunk-HTJQYHZP.js.map +1 -0
- package/dist/{chunk-OOLO4LQG.js → chunk-I6GALP6E.js} +6 -6
- package/dist/{chunk-57V5S7PW.js → chunk-IL6POWCW.js} +6 -6
- package/dist/{chunk-7NS43EXZ.js → chunk-IU6SNYX6.js} +5 -5
- package/dist/{chunk-5ZOSG3RJ.js → chunk-J2ZX2XUV.js} +5 -5
- package/dist/{chunk-L2SNBIV7.js → chunk-JIF24JPM.js} +57 -15
- package/dist/chunk-JIF24JPM.js.map +1 -0
- package/dist/{chunk-SYMS4546.js → chunk-JKJOGPZN.js} +2 -2
- package/dist/{chunk-CKZW6P5V.js → chunk-JNAI2HN2.js} +1 -1
- package/dist/chunk-JNAI2HN2.js.map +1 -0
- package/dist/{chunk-AWB5JZW6.js → chunk-JZUV47FZ.js} +2 -2
- package/dist/{chunk-ODJWBC5I.js → chunk-K5IMOGHB.js} +2 -2
- package/dist/{chunk-3G4KMVUN.js → chunk-KSKBRKGJ.js} +3 -3
- package/dist/{chunk-HFJIGWJC.js → chunk-LASZKVMO.js} +3 -3
- package/dist/{chunk-IGJHJYM6.js → chunk-LXEXBTKL.js} +4 -4
- package/dist/{chunk-3CNQ7FQ3.js → chunk-M4CV6BRT.js} +119 -25
- package/dist/chunk-M4CV6BRT.js.map +1 -0
- package/dist/{chunk-H44ZE4IE.js → chunk-MEFJPTZ4.js} +33 -17
- package/dist/chunk-MEFJPTZ4.js.map +1 -0
- package/dist/{chunk-PR5LC5YX.js → chunk-MV43JSJF.js} +4 -4
- package/dist/{chunk-ELNBMFOS.js → chunk-NJ4EOKMB.js} +4 -4
- package/dist/{chunk-PXWVF7MC.js → chunk-NR5LT5RY.js} +7 -7
- package/dist/{chunk-QYPKGVT4.js → chunk-NWSGI5C7.js} +3 -3
- package/dist/{chunk-P5RY4ZWD.js → chunk-OSDB5WW3.js} +92 -15
- package/dist/chunk-OSDB5WW3.js.map +1 -0
- package/dist/chunk-PN2XMATY.js +37 -0
- package/dist/chunk-PN2XMATY.js.map +1 -0
- package/dist/{chunk-25NDNMQ7.js → chunk-Q5VNKNE5.js} +3 -3
- package/dist/{chunk-CIKY6I4W.js → chunk-QLWMEXCT.js} +2 -2
- package/dist/{chunk-VA4ZWLFY.js → chunk-QRB7NAOJ.js} +2 -2
- package/dist/{chunk-3MSQLQNZ.js → chunk-R4ROFEYC.js} +2 -2
- package/dist/{chunk-BEIRE5K4.js → chunk-RCVJZMFE.js} +4 -4
- package/dist/{chunk-VR24ILCR.js → chunk-RIX4V2TB.js} +3 -3
- package/dist/{chunk-Q3XSMOZM.js → chunk-RYCTDFUX.js} +2 -2
- package/dist/{chunk-7E67FJ33.js → chunk-RZ5SVOYR.js} +2 -2
- package/dist/{chunk-IDIV5NVH.js → chunk-SLFHQTTW.js} +5 -5
- package/dist/chunk-SNZ6URZZ.js +2782 -0
- package/dist/chunk-SNZ6URZZ.js.map +1 -0
- package/dist/{chunk-C3YH34IL.js → chunk-T2FFWNPK.js} +3 -3
- package/dist/{chunk-O2DYPAZY.js → chunk-UNFPPVNI.js} +2 -2
- package/dist/{chunk-MELR46EF.js → chunk-VFUPHI2Z.js} +63 -10
- package/dist/chunk-VFUPHI2Z.js.map +1 -0
- package/dist/{chunk-GA2QHD6P.js → chunk-VLFCJYTL.js} +9 -9
- package/dist/{chunk-YSXEFGND.js → chunk-VN3DBQAU.js} +2 -2
- package/dist/{chunk-C7NTK5I3.js → chunk-VZRODIM3.js} +4 -4
- package/dist/{chunk-QLLKLFE2.js → chunk-W22IKJE2.js} +2 -2
- package/dist/{chunk-5XIPOCQC.js → chunk-X3YYQWOQ.js} +3 -3
- package/dist/{chunk-A2QF4JUE.js → chunk-X7QBD67R.js} +625 -293
- package/dist/chunk-X7QBD67R.js.map +1 -0
- package/dist/{chunk-QQJXBZCO.js → chunk-XDYREZWE.js} +82 -10
- package/dist/chunk-XDYREZWE.js.map +1 -0
- package/dist/{chunk-OEAATWH5.js → chunk-XWZVFISC.js} +40 -6
- package/dist/{chunk-OEAATWH5.js.map → chunk-XWZVFISC.js.map} +1 -1
- package/dist/{chunk-XFXUTFWQ.js → chunk-YFXZEAYK.js} +6 -6
- package/dist/{chunk-7ITPJFGC.js → chunk-ZAJAVEXY.js} +2 -2
- package/dist/{chunk-4R4Q64W5.js → chunk-ZICD77GM.js} +2 -2
- package/dist/{chunk-45ZZLTFH.js → chunk-ZJ2AK4V7.js} +2 -2
- package/dist/{chunk-UFILRICG.js → chunk-ZUODRVHY.js} +2 -2
- package/dist/classified/index.js +5 -5
- package/dist/{classified-marker-LQWWQNIJ.js → classified-marker-CZKA6ITE.js} +8 -4
- package/dist/classified-marker-CZKA6ITE.js.map +1 -0
- package/dist/collection-facade-TLWIPI76.js +44 -0
- package/dist/{computed-W6MVAMWZ.js → computed-ZIQTYTDI.js} +3 -3
- package/dist/consent/index.js +9 -9
- package/dist/{dead-filter-4KXZEB3X.js → dead-filter-ESOBZZP5.js} +2 -2
- package/dist/delegation-W7ZV2322.js +25 -0
- package/dist/derivations/index.js +12 -12
- package/dist/derive-H2BJTLUI.js +21 -0
- package/dist/{enclave-VXAQD4XJ.js → enclave-AP3I5W7O.js} +15 -9
- package/dist/executor-KGWTNEQD.js +9 -0
- package/dist/executor-OVEXR6RT.js +9 -0
- package/dist/executor-UNEH5ZYH.js +25 -0
- package/dist/export-accessible-PCMXSUZS.js +23 -0
- package/dist/extract-partition-SWHFSYJO.js +38 -0
- package/dist/{fanout-sidecar-CKYFH33E.js → fanout-sidecar-A765THMX.js} +9 -9
- package/dist/find-N6345CNT.js +11 -0
- package/dist/forget/index.js +9 -9
- package/dist/guards/index.js +3 -3
- package/dist/history/index.js +14 -11
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.js +14 -14
- package/dist/index.d.ts +5 -1
- package/dist/index.js +108 -89
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +5 -5
- package/dist/indexing/index.js.map +1 -1
- package/dist/issue-5OKB6I2R.js +19 -0
- package/dist/kernel/best-effort-revert.d.ts +52 -0
- package/dist/kernel/collection-config.d.ts +28 -0
- package/dist/kernel/collection.d.ts +49 -32
- package/dist/kernel/enclave/classify/verify.d.ts +3 -0
- package/dist/kernel/enclave/index.d.ts +2 -1
- package/dist/kernel/enclave/record-keys/deterministic.d.ts +1 -0
- package/dist/kernel/enclave/record-keys/lifecycle.d.ts +50 -0
- package/dist/kernel/enclave/record-keys/record-codec.d.ts +27 -0
- package/dist/kernel/errors.d.ts +75 -1
- package/dist/kernel/lazy-count.d.ts +13 -0
- package/dist/kernel/noydb.d.ts +8 -0
- package/dist/kernel/tier-visibility.d.ts +54 -0
- package/dist/kernel/types.d.ts +92 -0
- package/dist/kernel/vault.d.ts +23 -6
- package/dist/kernel/via/dispatch.d.ts +10 -0
- package/dist/kernel/via/graph.d.ts +2 -1
- package/dist/{ledger-FU6GH5EH.js → ledger-GFBKVPV4.js} +11 -11
- package/dist/legacy/bundle.d.ts +1 -1
- package/dist/liberate-3VDOT4KO.js +24 -0
- package/dist/{link-set-MNADSH5M.js → link-set-Z7Q2ASFX.js} +11 -11
- package/dist/materialized-views/index.js +18 -18
- package/dist/noydb-ZCJOYBDI.js +68 -0
- package/dist/on/index.js +9 -9
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +12 -12
- package/dist/pod/index.js +11 -11
- package/dist/{policy-JTFOPPUU.js → policy-Z3RUAIY2.js} +5 -5
- package/dist/port/with/blob-strategy.d.ts +17 -0
- package/dist/port/with/lookup-strategy.d.ts +2 -1
- package/dist/portability/index.js +8 -8
- package/dist/{post-register-HAWO3O7O.js → post-register-JTH76BLY.js} +12 -7
- package/dist/post-register-JTH76BLY.js.map +1 -0
- package/dist/{public-envelope-NJVB7LPA.js → public-envelope-B4KNWVUA.js} +4 -4
- package/dist/query/index.js +5 -5
- package/dist/register-VAHONCID.js +23 -0
- package/dist/registry-7MLVD3VO.js +19 -0
- package/dist/registry-EPKPD5SM.js +18 -0
- package/dist/registry-P5T7PS2U.js +9 -0
- package/dist/request-withdrawal-TI3A5WPS.js +31 -0
- package/dist/{reveal-BOY7XYFH.js → reveal-DIBHLUZX.js} +7 -7
- package/dist/reveal-DIBHLUZX.js.map +1 -0
- package/dist/revoke-FDRD6GRW.js +24 -0
- package/dist/satellites/index.js +1 -1
- package/dist/sealed-record/index.js +12 -12
- package/dist/{seed-4RRXT42N.js → seed-Q6M2IZFL.js} +11 -11
- package/dist/session/index.js +9 -9
- package/dist/shadow/index.js +2 -2
- package/dist/signer-MUWEIUI6.js +25 -0
- package/dist/snapshots/index.js +10 -10
- package/dist/stale-OSQ7J3AA.js +29 -0
- package/dist/storage-MVFCGEQE.js +23 -0
- package/dist/{store-coordination-provider-HPYVFJCV.js → store-coordination-provider-64OEZFGS.js} +3 -3
- package/dist/sync/index.js +9 -9
- package/dist/team/index.js +15 -15
- package/dist/tiers/index.js +14 -10
- package/dist/to/index.js +1 -1
- package/dist/tx/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/{verify-66RHOW7N.js → verify-ZASTRNPR.js} +9 -8
- package/dist/verify-ZASTRNPR.js.map +1 -0
- package/dist/via/lookup/registry.d.ts +9 -0
- package/dist/via/money/where.d.ts +27 -6
- package/dist/{walk-2RWEOCAS.js → walk-SVNDIZ62.js} +11 -11
- package/dist/with/index.js +11 -11
- package/dist/with-audit/forget/strategy.d.ts +22 -0
- package/dist/with-audit/tiers/index.d.ts +275 -3
- package/dist/with-audit/tiers/strategy.d.ts +5 -4
- package/dist/with-cargo/describe-extraction.d.ts +9 -1
- package/dist/with-cargo/extract-partition.d.ts +9 -1
- package/dist/with-cargo/walk-closure.d.ts +32 -3
- package/dist/with-commit/history/history.d.ts +46 -0
- package/dist/with-commit/history/ledger/store.d.ts +21 -0
- package/dist/with-commit/history/strategy.d.ts +10 -0
- package/dist/with-commit/history/time-machine.d.ts +23 -0
- package/dist/with-commit/tx/elevated-handle.d.ts +2 -1
- package/dist/with-commit/tx/transaction.d.ts +5 -0
- package/dist/with-formula/materialized-views/executor.d.ts +9 -0
- package/dist/with-formula/materialized-views/stale.d.ts +52 -1
- package/dist/with-lookup/embeddings/index.d.ts +1 -0
- package/dist/with-lookup/embeddings/vec-id.d.ts +47 -0
- package/dist/with-lookup/indexing/collection-facade.d.ts +38 -1
- package/dist/with-lookup/indexing/lazy-builder.d.ts +35 -2
- package/dist/with-lookup/indexing/persisted-indexes.d.ts +44 -1
- package/dist/with-lookup/search/collection-facade.d.ts +40 -0
- package/dist/with-lookup/search/persisted-index-store.d.ts +82 -2
- package/dist/with-lookup/search/strategy.d.ts +4 -0
- package/dist/with-party/team/sync.d.ts +9 -0
- package/dist/with-shape/blobs/blob-intent.d.ts +153 -0
- package/dist/with-shape/blobs/blob-set.d.ts +949 -5
- package/dist/with-shape/satellites/fanout.d.ts +5 -4
- package/dist/with-shape/satellites/migrate-cek.d.ts +26 -0
- package/dist/with-shape/satellites/types.d.ts +11 -0
- package/dist/withdraw-accessible-WZIEVWSR.js +28 -0
- package/package.json +3 -3
- package/dist/api-YGMINAET.js +0 -20
- package/dist/backup-XA5STIYQ.js.map +0 -1
- package/dist/chunk-2JMMY7HZ.js.map +0 -1
- package/dist/chunk-3CNQ7FQ3.js.map +0 -1
- package/dist/chunk-7QIXUSDQ.js.map +0 -1
- package/dist/chunk-A2QF4JUE.js.map +0 -1
- package/dist/chunk-AOVDSIL3.js +0 -1221
- package/dist/chunk-AOVDSIL3.js.map +0 -1
- package/dist/chunk-CKZW6P5V.js.map +0 -1
- package/dist/chunk-DGH65E7Q.js.map +0 -1
- package/dist/chunk-DJ3VKYFA.js.map +0 -1
- package/dist/chunk-FH542DDY.js.map +0 -1
- package/dist/chunk-H44ZE4IE.js.map +0 -1
- package/dist/chunk-H6HM6CVR.js.map +0 -1
- package/dist/chunk-L2SNBIV7.js.map +0 -1
- package/dist/chunk-MELR46EF.js.map +0 -1
- package/dist/chunk-P5RY4ZWD.js.map +0 -1
- package/dist/chunk-QQJXBZCO.js.map +0 -1
- package/dist/chunk-TPH5EO6L.js +0 -54
- package/dist/chunk-TPH5EO6L.js.map +0 -1
- package/dist/chunk-W5D62AQD.js.map +0 -1
- package/dist/classified-marker-LQWWQNIJ.js.map +0 -1
- package/dist/collection-facade-YE2O4J4O.js +0 -39
- package/dist/delegation-OPUU3R2E.js +0 -25
- package/dist/derive-BGUHU663.js +0 -21
- package/dist/executor-GTVSUUBX.js +0 -25
- package/dist/executor-GZWMTOXB.js +0 -9
- package/dist/executor-XXGS4S3K.js +0 -9
- package/dist/export-accessible-BMULIOYB.js +0 -23
- package/dist/extract-partition-JUQTWDXR.js +0 -36
- package/dist/find-XRGCNGNN.js +0 -11
- package/dist/issue-UB6AA5M6.js +0 -19
- package/dist/liberate-YUN7W5QG.js +0 -24
- package/dist/noydb-6JLBZU4U.js +0 -67
- package/dist/post-register-HAWO3O7O.js.map +0 -1
- package/dist/register-VCKOBWKT.js +0 -23
- package/dist/registry-72UKJ2L4.js +0 -9
- package/dist/registry-BZFLJNEH.js +0 -18
- package/dist/registry-YJEYSYI5.js +0 -19
- package/dist/request-withdrawal-6MJRMFHF.js +0 -31
- package/dist/reveal-BOY7XYFH.js.map +0 -1
- package/dist/revoke-4KUNSVJC.js +0 -24
- package/dist/signer-DDDXP5JD.js +0 -25
- package/dist/stale-NXPT56JA.js +0 -14
- package/dist/storage-IR6EEAV2.js +0 -23
- package/dist/verify-66RHOW7N.js.map +0 -1
- package/dist/withdraw-accessible-CLMZEHQT.js +0 -28
- /package/dist/{api-YGMINAET.js.map → api-ZGS6LCOF.js.map} +0 -0
- /package/dist/{chunk-OFJ5GPNA.js.map → chunk-3B5VVCNY.js.map} +0 -0
- /package/dist/{chunk-KPGX66PM.js.map → chunk-3LQ2YKO4.js.map} +0 -0
- /package/dist/{chunk-D26JB3LZ.js.map → chunk-3QCRBHCY.js.map} +0 -0
- /package/dist/{chunk-4N5QFSNQ.js.map → chunk-4JBYV75E.js.map} +0 -0
- /package/dist/{chunk-UTLEAJXC.js.map → chunk-4NXKCLLQ.js.map} +0 -0
- /package/dist/{chunk-ARSAMO24.js.map → chunk-4VNQOLML.js.map} +0 -0
- /package/dist/{chunk-X6CMGUAG.js.map → chunk-5M5DVGV7.js.map} +0 -0
- /package/dist/{chunk-XHV25KBM.js.map → chunk-5YOLBEQ6.js.map} +0 -0
- /package/dist/{chunk-CB25ONKC.js.map → chunk-6CRIV7DE.js.map} +0 -0
- /package/dist/{chunk-BE7N3AXA.js.map → chunk-6JTIAGHD.js.map} +0 -0
- /package/dist/{chunk-JOQ53DMI.js.map → chunk-6QTNZJBS.js.map} +0 -0
- /package/dist/{chunk-BZO4WCJI.js.map → chunk-6T2SCQRU.js.map} +0 -0
- /package/dist/{chunk-FQQF23MC.js.map → chunk-7DSTRQIJ.js.map} +0 -0
- /package/dist/{chunk-IP2QBAGS.js.map → chunk-AUSTCW2X.js.map} +0 -0
- /package/dist/{chunk-A2Y6YFVN.js.map → chunk-B3HJYUOF.js.map} +0 -0
- /package/dist/{chunk-SRVQHVNX.js.map → chunk-BDVFPG6Y.js.map} +0 -0
- /package/dist/{chunk-YXOUQ2H7.js.map → chunk-CAF6WOK7.js.map} +0 -0
- /package/dist/{chunk-HUS3J5WM.js.map → chunk-CIE2BASH.js.map} +0 -0
- /package/dist/{chunk-DIRRS7WP.js.map → chunk-CRI4OUV4.js.map} +0 -0
- /package/dist/{chunk-FXK4X4BL.js.map → chunk-DLG74CNB.js.map} +0 -0
- /package/dist/{chunk-WTUNZACT.js.map → chunk-E5ZQT5KX.js.map} +0 -0
- /package/dist/{chunk-DMFNPHCX.js.map → chunk-EQO2UVP4.js.map} +0 -0
- /package/dist/{chunk-MCEKIAO4.js.map → chunk-ERJ7FU55.js.map} +0 -0
- /package/dist/{chunk-6QILBDZU.js.map → chunk-EVVGJDRQ.js.map} +0 -0
- /package/dist/{chunk-7VSGW5KJ.js.map → chunk-EVX47VBM.js.map} +0 -0
- /package/dist/{chunk-D3EFFFOL.js.map → chunk-EXK7QRWF.js.map} +0 -0
- /package/dist/{chunk-5JB73NMC.js.map → chunk-EYZ6IQ6X.js.map} +0 -0
- /package/dist/{chunk-BCYQA5BK.js.map → chunk-F64IRYG3.js.map} +0 -0
- /package/dist/{chunk-K62IUKOD.js.map → chunk-FHS2HQSH.js.map} +0 -0
- /package/dist/{chunk-67TNU77I.js.map → chunk-FUG4SFN3.js.map} +0 -0
- /package/dist/{chunk-ZP5PL65C.js.map → chunk-GKEWXIV5.js.map} +0 -0
- /package/dist/{chunk-RKRGDAS7.js.map → chunk-GTGPO5KW.js.map} +0 -0
- /package/dist/{chunk-MSPNM2OM.js.map → chunk-HB3RFQSC.js.map} +0 -0
- /package/dist/{chunk-OOLO4LQG.js.map → chunk-I6GALP6E.js.map} +0 -0
- /package/dist/{chunk-57V5S7PW.js.map → chunk-IL6POWCW.js.map} +0 -0
- /package/dist/{chunk-7NS43EXZ.js.map → chunk-IU6SNYX6.js.map} +0 -0
- /package/dist/{chunk-5ZOSG3RJ.js.map → chunk-J2ZX2XUV.js.map} +0 -0
- /package/dist/{chunk-SYMS4546.js.map → chunk-JKJOGPZN.js.map} +0 -0
- /package/dist/{chunk-AWB5JZW6.js.map → chunk-JZUV47FZ.js.map} +0 -0
- /package/dist/{chunk-ODJWBC5I.js.map → chunk-K5IMOGHB.js.map} +0 -0
- /package/dist/{chunk-3G4KMVUN.js.map → chunk-KSKBRKGJ.js.map} +0 -0
- /package/dist/{chunk-HFJIGWJC.js.map → chunk-LASZKVMO.js.map} +0 -0
- /package/dist/{chunk-IGJHJYM6.js.map → chunk-LXEXBTKL.js.map} +0 -0
- /package/dist/{chunk-PR5LC5YX.js.map → chunk-MV43JSJF.js.map} +0 -0
- /package/dist/{chunk-ELNBMFOS.js.map → chunk-NJ4EOKMB.js.map} +0 -0
- /package/dist/{chunk-PXWVF7MC.js.map → chunk-NR5LT5RY.js.map} +0 -0
- /package/dist/{chunk-QYPKGVT4.js.map → chunk-NWSGI5C7.js.map} +0 -0
- /package/dist/{chunk-25NDNMQ7.js.map → chunk-Q5VNKNE5.js.map} +0 -0
- /package/dist/{chunk-CIKY6I4W.js.map → chunk-QLWMEXCT.js.map} +0 -0
- /package/dist/{chunk-VA4ZWLFY.js.map → chunk-QRB7NAOJ.js.map} +0 -0
- /package/dist/{chunk-3MSQLQNZ.js.map → chunk-R4ROFEYC.js.map} +0 -0
- /package/dist/{chunk-BEIRE5K4.js.map → chunk-RCVJZMFE.js.map} +0 -0
- /package/dist/{chunk-VR24ILCR.js.map → chunk-RIX4V2TB.js.map} +0 -0
- /package/dist/{chunk-Q3XSMOZM.js.map → chunk-RYCTDFUX.js.map} +0 -0
- /package/dist/{chunk-7E67FJ33.js.map → chunk-RZ5SVOYR.js.map} +0 -0
- /package/dist/{chunk-IDIV5NVH.js.map → chunk-SLFHQTTW.js.map} +0 -0
- /package/dist/{chunk-C3YH34IL.js.map → chunk-T2FFWNPK.js.map} +0 -0
- /package/dist/{chunk-O2DYPAZY.js.map → chunk-UNFPPVNI.js.map} +0 -0
- /package/dist/{chunk-GA2QHD6P.js.map → chunk-VLFCJYTL.js.map} +0 -0
- /package/dist/{chunk-YSXEFGND.js.map → chunk-VN3DBQAU.js.map} +0 -0
- /package/dist/{chunk-C7NTK5I3.js.map → chunk-VZRODIM3.js.map} +0 -0
- /package/dist/{chunk-QLLKLFE2.js.map → chunk-W22IKJE2.js.map} +0 -0
- /package/dist/{chunk-5XIPOCQC.js.map → chunk-X3YYQWOQ.js.map} +0 -0
- /package/dist/{chunk-XFXUTFWQ.js.map → chunk-YFXZEAYK.js.map} +0 -0
- /package/dist/{chunk-7ITPJFGC.js.map → chunk-ZAJAVEXY.js.map} +0 -0
- /package/dist/{chunk-4R4Q64W5.js.map → chunk-ZICD77GM.js.map} +0 -0
- /package/dist/{chunk-45ZZLTFH.js.map → chunk-ZJ2AK4V7.js.map} +0 -0
- /package/dist/{chunk-UFILRICG.js.map → chunk-ZUODRVHY.js.map} +0 -0
- /package/dist/{collection-facade-YE2O4J4O.js.map → collection-facade-TLWIPI76.js.map} +0 -0
- /package/dist/{computed-W6MVAMWZ.js.map → computed-ZIQTYTDI.js.map} +0 -0
- /package/dist/{dead-filter-4KXZEB3X.js.map → dead-filter-ESOBZZP5.js.map} +0 -0
- /package/dist/{delegation-OPUU3R2E.js.map → delegation-W7ZV2322.js.map} +0 -0
- /package/dist/{derive-BGUHU663.js.map → derive-H2BJTLUI.js.map} +0 -0
- /package/dist/{enclave-VXAQD4XJ.js.map → enclave-AP3I5W7O.js.map} +0 -0
- /package/dist/{executor-GTVSUUBX.js.map → executor-KGWTNEQD.js.map} +0 -0
- /package/dist/{executor-GZWMTOXB.js.map → executor-OVEXR6RT.js.map} +0 -0
- /package/dist/{executor-XXGS4S3K.js.map → executor-UNEH5ZYH.js.map} +0 -0
- /package/dist/{export-accessible-BMULIOYB.js.map → export-accessible-PCMXSUZS.js.map} +0 -0
- /package/dist/{extract-partition-JUQTWDXR.js.map → extract-partition-SWHFSYJO.js.map} +0 -0
- /package/dist/{fanout-sidecar-CKYFH33E.js.map → fanout-sidecar-A765THMX.js.map} +0 -0
- /package/dist/{find-XRGCNGNN.js.map → find-N6345CNT.js.map} +0 -0
- /package/dist/{issue-UB6AA5M6.js.map → issue-5OKB6I2R.js.map} +0 -0
- /package/dist/{ledger-FU6GH5EH.js.map → ledger-GFBKVPV4.js.map} +0 -0
- /package/dist/{liberate-YUN7W5QG.js.map → liberate-3VDOT4KO.js.map} +0 -0
- /package/dist/{link-set-MNADSH5M.js.map → link-set-Z7Q2ASFX.js.map} +0 -0
- /package/dist/{noydb-6JLBZU4U.js.map → noydb-ZCJOYBDI.js.map} +0 -0
- /package/dist/{policy-JTFOPPUU.js.map → policy-Z3RUAIY2.js.map} +0 -0
- /package/dist/{public-envelope-NJVB7LPA.js.map → public-envelope-B4KNWVUA.js.map} +0 -0
- /package/dist/{register-VCKOBWKT.js.map → register-VAHONCID.js.map} +0 -0
- /package/dist/{registry-72UKJ2L4.js.map → registry-7MLVD3VO.js.map} +0 -0
- /package/dist/{registry-BZFLJNEH.js.map → registry-EPKPD5SM.js.map} +0 -0
- /package/dist/{registry-YJEYSYI5.js.map → registry-P5T7PS2U.js.map} +0 -0
- /package/dist/{request-withdrawal-6MJRMFHF.js.map → request-withdrawal-TI3A5WPS.js.map} +0 -0
- /package/dist/{revoke-4KUNSVJC.js.map → revoke-FDRD6GRW.js.map} +0 -0
- /package/dist/{seed-4RRXT42N.js.map → seed-Q6M2IZFL.js.map} +0 -0
- /package/dist/{signer-DDDXP5JD.js.map → signer-MUWEIUI6.js.map} +0 -0
- /package/dist/{stale-NXPT56JA.js.map → stale-OSQ7J3AA.js.map} +0 -0
- /package/dist/{storage-IR6EEAV2.js.map → storage-MVFCGEQE.js.map} +0 -0
- /package/dist/{store-coordination-provider-HPYVFJCV.js.map → store-coordination-provider-64OEZFGS.js.map} +0 -0
- /package/dist/{walk-2RWEOCAS.js.map → walk-SVNDIZ62.js.map} +0 -0
- /package/dist/{withdraw-accessible-CLMZEHQT.js.map → withdraw-accessible-WZIEVWSR.js.map} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RecordCodec
|
|
3
|
+
} from "./chunk-XDYREZWE.js";
|
|
4
|
+
|
|
5
|
+
// src/with-formula/materialized-views/stale.ts
|
|
6
|
+
var _staleByRegistry = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function markMVStale(registry, mvName) {
|
|
8
|
+
let set = _staleByRegistry.get(registry);
|
|
9
|
+
if (!set) {
|
|
10
|
+
set = /* @__PURE__ */ new Set();
|
|
11
|
+
_staleByRegistry.set(registry, set);
|
|
12
|
+
}
|
|
13
|
+
set.add(mvName);
|
|
14
|
+
}
|
|
15
|
+
function isMVStale(registry, mvName) {
|
|
16
|
+
return _staleByRegistry.get(registry)?.has(mvName) ?? false;
|
|
17
|
+
}
|
|
18
|
+
var MV_STALE_COLLECTION = "_mv_stale";
|
|
19
|
+
var _hydratedByRegistry = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
function storeOf(accessor, collectionName) {
|
|
21
|
+
const c = accessor.getCollection(collectionName);
|
|
22
|
+
return { adapter: c.adapter, vault: c.vault };
|
|
23
|
+
}
|
|
24
|
+
async function writeMVStaleMarker(adapter, vault, mvName) {
|
|
25
|
+
const env = RecordCodec.buildPlaintextEnvelope({ version: 1, data: "{}" });
|
|
26
|
+
await adapter.put(vault, MV_STALE_COLLECTION, mvName, env);
|
|
27
|
+
}
|
|
28
|
+
async function deleteMVStaleMarker(adapter, vault, mvName) {
|
|
29
|
+
await adapter.delete(vault, MV_STALE_COLLECTION, mvName);
|
|
30
|
+
}
|
|
31
|
+
async function hydratePersistedStaleMarkers(accessor, registry) {
|
|
32
|
+
const mvs = registry.all();
|
|
33
|
+
if (mvs.length === 0) return;
|
|
34
|
+
const { adapter, vault } = storeOf(accessor, mvs[0].outputCollection);
|
|
35
|
+
for (const name of await adapter.list(vault, MV_STALE_COLLECTION)) markMVStale(registry, name);
|
|
36
|
+
}
|
|
37
|
+
async function invalidateMVAtRest(accessor, reg, mode) {
|
|
38
|
+
const outputColl = accessor.getCollection(reg.outputCollection);
|
|
39
|
+
const txCtx = accessor.getActiveTxContext();
|
|
40
|
+
const { adapter, vault } = storeOf(accessor, reg.outputCollection);
|
|
41
|
+
let deleted = 0;
|
|
42
|
+
const residueUndecodable = [];
|
|
43
|
+
const residueDeclined = [];
|
|
44
|
+
for (const id of await adapter.list(vault, reg.outputCollection)) {
|
|
45
|
+
const envelope = await adapter.get(vault, reg.outputCollection, id);
|
|
46
|
+
if (envelope === null) continue;
|
|
47
|
+
const decoded = await outputColl._decodeEnvelope(envelope, id);
|
|
48
|
+
if (decoded === null) {
|
|
49
|
+
residueUndecodable.push(id);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const stampedBy = decoded._materializedFrom;
|
|
53
|
+
if (stampedBy?.mvName !== reg.spec.name) continue;
|
|
54
|
+
if (await outputColl._internalDelete(id, txCtx)) {
|
|
55
|
+
deleted++;
|
|
56
|
+
} else {
|
|
57
|
+
residueDeclined.push(id);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (mode === "lazy") {
|
|
61
|
+
const registry = accessor.registry();
|
|
62
|
+
markMVStale(registry, reg.spec.name);
|
|
63
|
+
await writeMVStaleMarker(adapter, vault, reg.spec.name);
|
|
64
|
+
}
|
|
65
|
+
return { deleted, residueUndecodable, residueDeclined };
|
|
66
|
+
}
|
|
67
|
+
async function resolveStaleMVOnRead(accessor, outputCollection, dispatchCtx) {
|
|
68
|
+
const registry = accessor.registry();
|
|
69
|
+
let hydrate = _hydratedByRegistry.get(registry);
|
|
70
|
+
if (!hydrate) {
|
|
71
|
+
hydrate = hydratePersistedStaleMarkers(accessor, registry).catch((err) => {
|
|
72
|
+
_hydratedByRegistry.delete(registry);
|
|
73
|
+
throw err;
|
|
74
|
+
});
|
|
75
|
+
_hydratedByRegistry.set(registry, hydrate);
|
|
76
|
+
}
|
|
77
|
+
await hydrate;
|
|
78
|
+
const pending = _staleByRegistry.get(registry);
|
|
79
|
+
if (!pending || pending.size === 0) return;
|
|
80
|
+
const { adapter, vault } = storeOf(accessor, outputCollection);
|
|
81
|
+
for (const name of pending) {
|
|
82
|
+
if (registry.byName(name)) continue;
|
|
83
|
+
pending.delete(name);
|
|
84
|
+
await deleteMVStaleMarker(adapter, vault, name);
|
|
85
|
+
}
|
|
86
|
+
if (pending.size === 0) return;
|
|
87
|
+
const candidates = [];
|
|
88
|
+
for (const mv of registry.all()) {
|
|
89
|
+
if (mv.outputCollection !== outputCollection) continue;
|
|
90
|
+
if (!pending.has(mv.spec.name)) continue;
|
|
91
|
+
candidates.push(mv.spec.name);
|
|
92
|
+
}
|
|
93
|
+
if (candidates.length === 0) return;
|
|
94
|
+
let executor = null;
|
|
95
|
+
for (const name of candidates) {
|
|
96
|
+
const reg = registry.byName(name);
|
|
97
|
+
if (!reg) {
|
|
98
|
+
pending.delete(name);
|
|
99
|
+
await deleteMVStaleMarker(adapter, vault, name);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (executor === null) {
|
|
103
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-UNEH5ZYH.js"));
|
|
104
|
+
}
|
|
105
|
+
for (const dep of reg.dependencies) {
|
|
106
|
+
await accessor.getCollection(dep).ensureHydrated();
|
|
107
|
+
}
|
|
108
|
+
await executor.refresh(reg, {
|
|
109
|
+
getCollection: (n) => accessor.getCollection(n),
|
|
110
|
+
getActiveTxContext: () => accessor.getActiveTxContext(),
|
|
111
|
+
getQueryContext: () => accessor.getQueryContext(),
|
|
112
|
+
...dispatchCtx !== void 0 ? { dispatchCtx } : {}
|
|
113
|
+
});
|
|
114
|
+
pending.delete(name);
|
|
115
|
+
await deleteMVStaleMarker(adapter, vault, name);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function clearMVStale(registry, mvName) {
|
|
119
|
+
_staleByRegistry.get(registry)?.delete(mvName);
|
|
120
|
+
}
|
|
121
|
+
async function clearMVStaleFully(adapter, vault, registry, mvName) {
|
|
122
|
+
clearMVStale(registry, mvName);
|
|
123
|
+
await deleteMVStaleMarker(adapter, vault, mvName);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
markMVStale,
|
|
128
|
+
isMVStale,
|
|
129
|
+
MV_STALE_COLLECTION,
|
|
130
|
+
invalidateMVAtRest,
|
|
131
|
+
resolveStaleMVOnRead,
|
|
132
|
+
clearMVStale,
|
|
133
|
+
clearMVStaleFully
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=chunk-HDQIIUPH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-formula/materialized-views/stale.ts"],"sourcesContent":["import type { Collection } from '../../kernel/collection.js'\nimport type { TxContext } from '../../with-commit/tx/transaction.js'\nimport type { PutDerivedOutputCtx } from '../../kernel/via/dispatch.js'\nimport type { MaterializedViewRegistry, RegisteredMV } from './registry.js'\n// Type-only — runtime class loaded via dynamic import in\n// `resolveStaleMVOnRead` only when a stale flag actually fires.\n// Keeps the executor chunk out of the floor bundle (mirrors v1 floor-bundle isolation).\nimport type { MaterializedViewExecutor as MVExecutorType } from './executor.js'\nimport type { MVQueryContext } from './types.js'\nimport type { NoydbStore } from '../../kernel/types.js'\nimport { RecordCodec } from '../../kernel/enclave/index.js'\n\n/**\n * Accessor shape passed in from the owning Vault. Provides the\n * registry (used as a stable WeakMap key + to look up MVs by output\n * collection) and the runtime context the lazy refresh needs.\n * Mirrors v1's `DerivationStaleAccessor`.\n */\nexport interface MVStaleAccessor {\n registry(): MaterializedViewRegistry\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getCollection(name: string): Collection<any>\n getActiveTxContext(): TxContext | null\n getQueryContext(): MVQueryContext\n}\n\n/**\n * In-memory stale map keyed by `MaterializedViewRegistry` instance\n * (stable per vault). Each registry maps to a set of MV names that\n * have at least one pending source-change requiring a re-materialize.\n *\n * Persistence across vault close is NOT implemented in this iteration\n * (concern flagged in the v2 spec, mirrors v1 derivation behavior).\n * On vault re-open, the unset stale flag is interpreted as \"fresh\" —\n * `vault.refreshView(name)` is the explicit recompute escape hatch.\n *\n * @internal\n */\nconst _staleByRegistry = new WeakMap<MaterializedViewRegistry, Set<string>>()\n\n/**\n * Mark an MV as stale. Called from `Collection.dispatchMaterializedViews`\n * when a source-write fires for a `refresh: 'lazy'` MV.\n *\n * @internal\n */\nexport function markMVStale(registry: MaterializedViewRegistry, mvName: string): void {\n let set = _staleByRegistry.get(registry)\n if (!set) {\n set = new Set()\n _staleByRegistry.set(registry, set)\n }\n set.add(mvName)\n}\n\n/**\n * Test-only: check whether a given MV name is currently flagged stale\n * against a registry. Exported so the regression suite can pin the\n * stale-bit lifecycle without touching the internal `WeakMap`.\n *\n * @internal\n */\nexport function isMVStale(registry: MaterializedViewRegistry, mvName: string): boolean {\n return _staleByRegistry.get(registry)?.has(mvName) ?? false\n}\n\n/**\n * Reserved collection holding CONTENT-FREE lazy-stale markers (record id =\n * MV name, plaintext `_iv: ''` envelope, no payload) — mirrors the\n * `_meta`/schema-fence marker envelope shape. Written only from the\n * delete/forget/elevate dispatcher (#736); ordinary source writes stay\n * in-memory-only (the cheap path). Read via the adapter directly, never\n * through `vault.collection()` — same reserved-collection convention as\n * `_subject_index`/`_meta`.\n */\nexport const MV_STALE_COLLECTION = '_mv_stale'\n\n/**\n * Once-per-registry hydrate guard for `resolveStaleMVOnRead`'s persisted-marker fold-in.\n * Stores the in-flight/settled PROMISE (not a boolean) — a concurrent cold first read that\n * arrives while the hydrate is still awaiting `adapter.list` must await the SAME promise\n * rather than observing \"already hydrating\" and reading an empty pending set (#736\n * whole-branch review).\n */\nconst _hydratedByRegistry = new WeakMap<MaterializedViewRegistry, Promise<void>>()\n\n/** The adapter + vault name backing any collection in this vault (all collections share both). */\nfunction storeOf(accessor: MVStaleAccessor, collectionName: string): { adapter: NoydbStore; vault: string } {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const c = accessor.getCollection(collectionName) as any\n return { adapter: c.adapter as NoydbStore, vault: c.vault as string }\n}\n\nasync function writeMVStaleMarker(adapter: NoydbStore, vault: string, mvName: string): Promise<void> {\n // Content-free — the marker's only payload is its key (the MV name).\n const env = RecordCodec.buildPlaintextEnvelope({ version: 1, data: '{}' })\n await adapter.put(vault, MV_STALE_COLLECTION, mvName, env)\n}\n\nasync function deleteMVStaleMarker(adapter: NoydbStore, vault: string, mvName: string): Promise<void> {\n await adapter.delete(vault, MV_STALE_COLLECTION, mvName)\n}\n\n/**\n * On first `resolveStaleMVOnRead` call for a (cold-reopened) registry, fold every\n * persisted `_mv_stale` marker into the in-memory pending set — otherwise a cold\n * session's empty `WeakMap` entry reads as \"fresh\" and serves the emptied output\n * collection forever.\n */\nasync function hydratePersistedStaleMarkers(accessor: MVStaleAccessor, registry: MaterializedViewRegistry): Promise<void> {\n const mvs = registry.all()\n if (mvs.length === 0) return\n const { adapter, vault } = storeOf(accessor, mvs[0]!.outputCollection)\n // No try/catch: a genuine store failure here must surface, not be read as\n // \"nothing pending\" — silently treating it as fresh is the exact leak class\n // this module closes (mirrors `subject-index.ts`'s bare `adapter.list` reads).\n for (const name of await adapter.list(vault, MV_STALE_COLLECTION)) markMVStale(registry, name)\n}\n\n/**\n * Invalidate an MV from the delete/forget/elevate dispatcher (#736) — the ordinary\n * source-write path (`dispatchMaterializedViews`) never calls this. Deletes EVERY\n * persisted row in `reg.outputCollection` via `_internalDelete` (the at-rest law: a\n * stale mark alone leaves the elevated/forgotten source's plaintext sitting in the\n * output row) using the adapter directly so the read-path's `resolveStaleMVOnRead`\n * isn't triggered mid-invalidation. `mode: 'lazy'` also persists the stale mark so a\n * cold session recomputes on next read; `'manual'` gets the purge only — the MV\n * serves empty until an explicit `vault.refreshView()` (erasure wins). Deletion is\n * stamp-scoped (`_materializedFrom.mvName === reg.spec.name` — see the loop below),\n * so another registered MV sharing this output collection keeps its own rows intact:\n * no cross-MV re-marking is needed here, only `reg` itself is marked stale.\n *\n * Returns the count of rows actually `_internalDelete`d (#761 item 1) — folded by the\n * caller into `dispatchMaterializedViewsOnDelete`'s `deleted` so `ForgetResult.derivedRecordsErased`\n * counts lazy/manual purges too, not just the eager executor's tombstone leg — plus\n * `residueUndecodable`, the bare ids whose ownership stamp could NOT be decoded (#776): a\n * candidate row that fails to decode under the collection's default DEK (e.g. elevated above\n * tier 0 on a tiered output collection) has UNKNOWN ownership — it might be this MV's own\n * output, or (same-collection shape) a plain user record — so it is never erased, but it must\n * be SURFACED rather than silently skipped (the #724 posture), since it may still hold the\n * forgotten/pre-elevation contribution, decryptable by tier-holders — and `residueDeclined`\n * (#785), the bare ids that DID decode and stamp-match but whose `_internalDelete` declined\n * (ownership CONFIRMED, erasure declined).\n *\n * @internal\n */\nexport async function invalidateMVAtRest(\n accessor: MVStaleAccessor,\n reg: RegisteredMV,\n mode: 'lazy' | 'manual',\n): Promise<{ deleted: number; residueUndecodable: string[]; residueDeclined: string[] }> {\n const outputColl = accessor.getCollection(reg.outputCollection)\n const txCtx = accessor.getActiveTxContext()\n const { adapter, vault } = storeOf(accessor, reg.outputCollection)\n let deleted = 0\n const residueUndecodable: string[] = []\n const residueDeclined: string[] = []\n for (const id of await adapter.list(vault, reg.outputCollection)) {\n // A same-collection partition MV (`output: { collection: <source>, partition }`,\n // the DERIV-PP30-001 shape) writes INTO its own source collection — `adapter.list`\n // over `reg.outputCollection` then also returns untouched user source records.\n // Decode each candidate row (the invalidation path is rare; this cost is fine\n // here) and only erase rows THIS MV stamped via `_materializedFrom.mvName` —\n // an unstamped row, or one stamped by a different MV, is never this MV's to\n // delete (#736 whole-branch review, Critical).\n const envelope = await adapter.get(vault, reg.outputCollection, id)\n if (envelope === null) continue\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const decoded = await (outputColl as any)._decodeEnvelope(envelope, id)\n if (decoded === null) { residueUndecodable.push(id); continue } // #776 — ownership unknown, surfaced not skipped\n const stampedBy = (decoded as Record<string, unknown>)._materializedFrom as { mvName?: string } | undefined\n if (stampedBy?.mvName !== reg.spec.name) continue\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (await (outputColl as any)._internalDelete(id, txCtx)) {\n deleted++\n } else {\n // #782 part b — decoded AND stamp-owned, but erasure declined (#718 tier-elevation\n // gate). Ownership IS confirmed — a real silent survival, not a legit stamp-mismatch\n // skip. Surface it too, in its own channel (#785 — distinct from the decode-null case).\n residueDeclined.push(id)\n }\n }\n\n // `mode: 'manual'` gets the purge only (erasure wins, no auto-recompute promise);\n // `'lazy'` also marks + persists ITS OWN stale bit for cold-session recompute. No\n // sibling MV on the same output collection is touched here — the stamp-scoped\n // deletion above never erased sibling rows in the first place (#736 re-review).\n if (mode === 'lazy') {\n const registry = accessor.registry()\n markMVStale(registry, reg.spec.name)\n await writeMVStaleMarker(adapter, vault, reg.spec.name)\n }\n return { deleted, residueUndecodable, residueDeclined }\n}\n\n/**\n * Called from `Collection.get` (and any reader that materializes the\n * MV's output collection). If any MV producing `outputCollection` is\n * flagged stale, runs the executor against the live source state\n * before returning. No-op when there is no pending work — keeps the\n * read fast path negligible.\n *\n * `dispatchCtx` (#641): threaded from the calling `Collection`'s\n * `#dispatchCtx({ collection: outputCollection, id: 'resolve-on-read' })` — a read has no\n * real \"reacting write\" record, so `'resolve-on-read'` is the sentinel id, mirroring\n * `Vault.refreshView()`'s `'refreshView'` sentinel for the same reason. Passed straight\n * through to the executor so a stale row whose output lands in a closed period follows the\n * frozen-output rule (skip + `derivation:skipped-frozen`, #637) instead of throwing\n * `PeriodClosedError` out of a read.\n *\n * Dynamic-imports the executor only when a stale flag actually fires\n * (the floor-bundle isolation pattern v1 derivations established in\n * floor-bundle isolation pattern).\n */\nexport async function resolveStaleMVOnRead(\n accessor: MVStaleAccessor,\n outputCollection: string,\n dispatchCtx?: PutDerivedOutputCtx,\n): Promise<void> {\n const registry = accessor.registry()\n // Cold session: the in-memory WeakMap has no entry for this (freshly\n // constructed) registry yet — fold any persisted `_mv_stale` markers in\n // before reading the pending set, once per registry (#736). Memoize the\n // PROMISE, not a boolean: a concurrent first read arriving while the\n // hydrate is still awaiting `adapter.list` must await the SAME promise —\n // otherwise it observes \"already hydrating\", skips straight to an empty\n // pending set, and serves the purged/stale view as fresh (#736\n // whole-branch review, hydrate-once race). On rejection, evict the entry\n // BEFORE rethrowing — a cached rejected promise would otherwise poison the\n // MV read surface for the rest of the session (every later read re-awaits\n // the same rejection instead of retrying the store call) (#736 re-review).\n let hydrate = _hydratedByRegistry.get(registry)\n if (!hydrate) {\n hydrate = hydratePersistedStaleMarkers(accessor, registry).catch((err: unknown) => {\n _hydratedByRegistry.delete(registry)\n throw err\n })\n _hydratedByRegistry.set(registry, hydrate)\n }\n await hydrate\n const pending = _staleByRegistry.get(registry)\n if (!pending || pending.size === 0) return\n\n const { adapter, vault } = storeOf(accessor, outputCollection)\n\n // Clean up persisted markers for MV names no longer registered (renamed or\n // removed since the marker was written). Without this sweep an orphaned name\n // can never become a `candidate` below — `candidates` is built from\n // `registry.all()`, which no longer lists it — so both the in-memory pending\n // entry and the persisted `_mv_stale` row would linger forever, re-hydrating\n // on every cold session (#736 whole-branch review).\n for (const name of pending) {\n if (registry.byName(name)) continue\n pending.delete(name)\n await deleteMVStaleMarker(adapter, vault, name)\n }\n if (pending.size === 0) return\n\n // Find every MV that writes to this output collection AND is\n // currently flagged stale. Multiple MVs CAN share an output\n // collection in theory; in practice the registration validation +\n // cycle detection make this unusual.\n const candidates: string[] = []\n for (const mv of registry.all()) {\n if (mv.outputCollection !== outputCollection) continue\n if (!pending.has(mv.spec.name)) continue\n candidates.push(mv.spec.name)\n }\n if (candidates.length === 0) return\n\n let executor: typeof MVExecutorType | null = null\n for (const name of candidates) {\n const reg = registry.byName(name)\n if (!reg) {\n // Unreachable in practice — `candidates` is drawn from `registry.all()`,\n // and the orphan sweep above already cleared any name absent from it.\n // Kept as a defensive fallback; also clears the persisted marker so it\n // can't linger if this ever does fire.\n pending.delete(name)\n await deleteMVStaleMarker(adapter, vault, name)\n continue\n }\n if (executor === null) {\n ({ MaterializedViewExecutor: executor } = (await import('./executor.js')) as {\n MaterializedViewExecutor: typeof MVExecutorType\n })\n }\n // A cold-hydrated stale flag (unlike an in-session one) can fire with\n // NONE of the MV's dependency collections touched yet this session —\n // the sync `Query.toArray()` `spec.query()` runs reads straight off\n // `Collection`'s in-memory cache, populated only by a prior async\n // touch (`ensureHydrated()`, called from `get`/`list`/`put`, never\n // from `query()` itself). Warm every dependency first so the recompute\n // sees the live persisted state instead of an empty cache (#736).\n for (const dep of reg.dependencies) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await (accessor.getCollection(dep) as any).ensureHydrated()\n }\n await executor.refresh(reg, {\n getCollection: (n) => accessor.getCollection(n),\n getActiveTxContext: () => accessor.getActiveTxContext(),\n getQueryContext: () => accessor.getQueryContext(),\n ...(dispatchCtx !== undefined ? { dispatchCtx } : {}),\n })\n pending.delete(name)\n // Runs even when no marker was ever persisted for this name (an in-session-only\n // stale bit — e.g. the cheap ordinary-write path never writes one, see the\n // \"cheap-path guarantee\" test). `adapter.delete` on an absent key is a harmless\n // void — keeping this unconditional avoids branching on marker origin here.\n await deleteMVStaleMarker(adapter, vault, name)\n }\n}\n\n/**\n * Drop every stale flag for a registry. Used after a manual\n * `vault.refreshView(name)` runs the executor explicitly — the\n * post-refresh state matches the registered strategies, so\n * lingering stale bits would force a redundant refresh on the next\n * read.\n *\n * @internal\n */\nexport function clearMVStale(registry: MaterializedViewRegistry, mvName: string): void {\n _staleByRegistry.get(registry)?.delete(mvName)\n}\n\n/**\n * `clearMVStale` plus the persisted marker (#736) — `Vault.refreshView()`'s\n * completion path. A lingering persisted marker after a manual refresh would\n * make the NEXT cold session recompute redundantly.\n *\n * @internal\n */\nexport async function clearMVStaleFully(\n adapter: NoydbStore,\n vault: string,\n registry: MaterializedViewRegistry,\n mvName: string,\n): Promise<void> {\n clearMVStale(registry, mvName)\n await deleteMVStaleMarker(adapter, vault, mvName)\n}\n"],"mappings":";;;;;AAsCA,IAAM,mBAAmB,oBAAI,QAA+C;AAQrE,SAAS,YAAY,UAAoC,QAAsB;AACpF,MAAI,M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ializedViewCycleError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BIOUI4HL.js";
|
|
5
5
|
|
|
6
6
|
// src/kernel/via/graph.ts
|
|
7
7
|
var DEFAULT_POSTURE = { encryptedAtRest: "envelope", queryable: "full", exportable: true, forgettable: false };
|
|
@@ -45,7 +45,8 @@ var ViaGraph = class {
|
|
|
45
45
|
_posture = /* @__PURE__ */ new Map();
|
|
46
46
|
/** Every derived target's registration, keyed by the target's node id. */
|
|
47
47
|
_in = /* @__PURE__ */ new Map();
|
|
48
|
-
/** source node id -> derived
|
|
48
|
+
/** source node id -> derived edges that depend on it (dispatch/erasure), each carrying
|
|
49
|
+
* its own registration's `kind` (#678 — see {@link OutEdge}). */
|
|
49
50
|
_out = /* @__PURE__ */ new Map();
|
|
50
51
|
/** Memoized effective posture per derived target node id. */
|
|
51
52
|
_effectiveCache = /* @__PURE__ */ new Map();
|
|
@@ -88,9 +89,10 @@ var ViaGraph = class {
|
|
|
88
89
|
});
|
|
89
90
|
for (const source of sources) {
|
|
90
91
|
const sourceId = nodeId(source);
|
|
92
|
+
const outEdge = { target, kind };
|
|
91
93
|
const dependents = this._out.get(sourceId);
|
|
92
|
-
if (dependents) dependents.push(
|
|
93
|
-
else this._out.set(sourceId, [
|
|
94
|
+
if (dependents) dependents.push(outEdge);
|
|
95
|
+
else this._out.set(sourceId, [outEdge]);
|
|
94
96
|
}
|
|
95
97
|
this._effectiveCache.clear();
|
|
96
98
|
this._wildcardCache.clear();
|
|
@@ -151,12 +153,12 @@ var ViaGraph = class {
|
|
|
151
153
|
assertAcyclic() {
|
|
152
154
|
const visited = /* @__PURE__ */ new Set();
|
|
153
155
|
const stack = [];
|
|
154
|
-
const notRefEdge = (
|
|
156
|
+
const notRefEdge = (entry) => entry.kind !== "ref";
|
|
155
157
|
const neighboursOf = (id) => {
|
|
156
|
-
const own = (this._out.get(id) ?? []).filter(notRefEdge);
|
|
158
|
+
const own = (this._out.get(id) ?? []).filter(notRefEdge).map((entry) => entry.target);
|
|
157
159
|
const sep = id.indexOf(SEP);
|
|
158
160
|
if (id.slice(sep + 1) === "*") return own;
|
|
159
|
-
const wildcard = (this._out.get(`${id.slice(0, sep)}${SEP}*`) ?? []).filter(notRefEdge);
|
|
161
|
+
const wildcard = (this._out.get(`${id.slice(0, sep)}${SEP}*`) ?? []).filter(notRefEdge).map((entry) => entry.target);
|
|
160
162
|
if (wildcard.length === 0) return own;
|
|
161
163
|
return [...own, ...wildcard];
|
|
162
164
|
};
|
|
@@ -324,10 +326,11 @@ var ViaGraph = class {
|
|
|
324
326
|
const targets = this._out.get(nodeId({ collection: backing, field: "*" }));
|
|
325
327
|
if (!targets) return [];
|
|
326
328
|
const out = [];
|
|
327
|
-
for (const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
for (const entry of targets) {
|
|
330
|
+
if (entry.kind !== "ref") continue;
|
|
331
|
+
const edge = this._in.get(nodeId(entry.target));
|
|
332
|
+
if (edge?.onDelete !== void 0) {
|
|
333
|
+
out.push({ referencing: entry.target, onDelete: edge.onDelete, keyField: edge.keyField ?? "id" });
|
|
331
334
|
}
|
|
332
335
|
}
|
|
333
336
|
return out;
|
|
@@ -338,4 +341,4 @@ export {
|
|
|
338
341
|
DEFAULT_POSTURE,
|
|
339
342
|
ViaGraph
|
|
340
343
|
};
|
|
341
|
-
//# sourceMappingURL=chunk-
|
|
344
|
+
//# sourceMappingURL=chunk-HTJQYHZP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kernel/via/graph.ts"],"sourcesContent":["// kernel/via/graph.ts — the per-vault ViaGraph dependency model (Via port phase C, #638).\n//\n// Metadata-only dependency graph over (collection, field) nodes: source-field\n// postures, derived-field edges, and the taint (effective-posture) algebra.\n// NEVER stores record values or key material — see\n// docs/superpowers/specs/2026-07-11-via-phase-c-design.md §1/§2.\n\nimport { DerivationCycleError, MaterializedViewCycleError } from '../errors.js'\nimport type { ViaPosture } from './index.js'\n\n/** A (collection, field) node. Artifact-grain targets (rollup field, MV row-class,\n * overlay output) are modelled as a field node whose `field` is the artifact key. */\nexport interface FieldRef { readonly collection: string; readonly field: string }\n\nexport type EdgeKind = 'computed' | 'derivation' | 'rollup' | 'mv' | 'overlay' | 'ref'\n/** `'virtual'` (#638 Task 7) marks a `computed(fn, { mode: 'virtual' })` field's edge —\n * never stored (rides the `present` phase), so it can never be sealed at rest\n * ({@link ViaGraph.taintSealedFields} excludes it) and is always non-queryable\n * regardless of source posture ({@link ViaGraph.effectivePosture} clamps it). */\nexport type Grain = 'record' | 'aggregate' | 'virtual'\n\n/** Delete/forget-time referential policy for a `'ref'` edge (#650 Task 5, spec §4) — duplicated\n * (not imported) from `via/lookup/descriptor.ts`'s `OnDelete`: the kernel spine may not\n * statically import `via/**` (Check 14, `via-layering`). Keep the two in sync by hand. */\nexport type OnDelete = 'restrict' | 'cascade' | 'nullify'\n\n/** Plain (non-via) field baseline — max-permissive; taint only ever tightens. */\nexport const DEFAULT_POSTURE: ViaPosture =\n { encryptedAtRest: 'envelope', queryable: 'full', exportable: true, forgettable: false }\n\nconst QUERYABLE_RANK: Record<ViaPosture['queryable'], number> = {\n none: 0,\n 'det-exact': 1,\n ordered: 2,\n full: 3,\n}\n\n/** The per-axis \"most restrictive\" fold — pure, exported for direct unit testing. */\nexport function foldPosture(a: ViaPosture, b: ViaPosture): ViaPosture {\n return {\n encryptedAtRest: a.encryptedAtRest === 'sealed' || b.encryptedAtRest === 'sealed' ? 'sealed' : 'envelope',\n queryable: QUERYABLE_RANK[a.queryable] <= QUERYABLE_RANK[b.queryable] ? a.queryable : b.queryable,\n exportable: a.exportable && b.exportable,\n forgettable: a.forgettable || b.forgettable,\n }\n}\n\n/** Security-axes-only fold for a wildcard collection node (#642): sealed-wins encryptedAtRest,\n * AND exportable, OR forgettable — queryable is NOT folded (stays base.queryable; the sealed\n * clamp to 'none' is buildTaintOverlay's job, so inheriting `sealed` never over-restricts a\n * blob-adjacent output to unqueryable). Pure; exported for unit testing. Distinct from\n * {@link foldPosture} (which folds all four axes) — do NOT reuse foldPosture here. */\nexport function foldWildcardSecurity(base: ViaPosture, contributor: ViaPosture): ViaPosture {\n return {\n encryptedAtRest: base.encryptedAtRest === 'sealed' || contributor.encryptedAtRest === 'sealed' ? 'sealed' : 'envelope',\n queryable: base.queryable,\n exportable: base.exportable && contributor.exportable,\n forgettable: base.forgettable || contributor.forgettable,\n }\n}\n\n// the folded formula kinds a '*' source contributes its collection-fold to (ref keeps identity):\ntype FoldedKind = 'derivation' | 'rollup' | 'mv' | 'overlay'\nconst FOLDED_KINDS: ReadonlySet<EdgeKind> = new Set<FoldedKind>(['derivation', 'rollup', 'mv', 'overlay'])\n\n/** Whether `p` is exactly the plain, non-taint baseline (Task 3 — `taintProvenance`). */\nfunction isDefaultPosture(p: ViaPosture): boolean {\n return p.encryptedAtRest === DEFAULT_POSTURE.encryptedAtRest && p.queryable === DEFAULT_POSTURE.queryable &&\n p.exportable === DEFAULT_POSTURE.exportable && p.forgettable === DEFAULT_POSTURE.forgettable\n}\n\n/** One `_out` entry — a `source -> target` derived edge, carrying its OWN registration's\n * `kind` (#678). `kind` must be edge-local, not re-derived from `_in`: `_in` is single-slot\n * per target and can be overwritten by a LATER `registerDerived` call on the SAME target\n * (a dual-role target, e.g. #631's exempt {computed, lookup} field composition) — asking\n * `_in` for \"this target's current kind\" answers the wrong question for a specific edge. */\ninterface OutEdge { readonly target: FieldRef; readonly kind: EdgeKind }\n\n/** One registered `registerDerived` call — a target's whole in-edge set. */\ninterface DerivedEdge {\n readonly target: FieldRef\n readonly sources: readonly FieldRef[]\n readonly kind: EdgeKind\n readonly grain: Grain\n /** `'ref'` edges only — the referencing field's delete/forget policy (#650 Task 5). */\n readonly onDelete?: OnDelete\n /** `'ref'` edges only — the backing dimension's canonical-key FIELD NAME on its own row (matrix\n * tier's `lookup(dim, {key})`; always `'id'` for reserved/static tiers). Defaults to `'id'`\n * when absent — a referencing field always stores this field's VALUE, never the backing row's\n * PUT-id when the two differ (#650 Task 5, mirrors Task 3's membership review fix). */\n readonly keyField?: string\n}\n\nconst SEP = '\\0'\nconst EMPTY_SET: ReadonlySet<string> = new Set()\n\nfunction nodeId(ref: FieldRef): string {\n return `${ref.collection}${SEP}${ref.field}`\n}\n\n/** Inverse of `nodeId`, for building a human-readable cycle path. */\nfunction displayNodeId(id: string): string {\n const sep = id.indexOf(SEP)\n return `${id.slice(0, sep)}.${id.slice(sep + 1)}`\n}\n\n/** Metadata-only dependency graph, ONE per vault. Never stores values or key material. */\nexport class ViaGraph {\n /** Declared source-field postures (registerField), keyed by node id. */\n private readonly _posture = new Map<string, ViaPosture>()\n /** Every derived target's registration, keyed by the target's node id. */\n private readonly _in = new Map<string, DerivedEdge>()\n /** source node id -> derived edges that depend on it (dispatch/erasure), each carrying\n * its own registration's `kind` (#678 — see {@link OutEdge}). */\n private readonly _out = new Map<string, OutEdge[]>()\n /** Memoized effective posture per derived target node id. */\n private readonly _effectiveCache = new Map<string, ViaPosture>()\n /** Memoized whole-collection security-axes fold for `'*'` wildcard LEAF nodes (#642),\n * keyed by collection name — see {@link _wildcardContribution}. Cleared alongside\n * `_effectiveCache` on every `registerField`/`registerDerived` (a later-registered\n * field must re-fold on the next read — registration ordering is free). */\n private readonly _wildcardCache = new Map<string, ViaPosture>()\n /** Collections with at least one classified field (#638 Task 2 fix wave 2,\n * Finding I1 — the reconcile path's combined-state leak guard memory). */\n private readonly _classifiedCollections = new Set<string>()\n /** Computed field names declared with no `deps` entry, per collection\n * (Finding I1 — such a field registers no edge when no classified field is\n * present yet, so a LATER, separate reconcile call attaching classifiedFields\n * still needs to see it regardless of declaration order). */\n private readonly _depslessComputed = new Map<string, Set<string>>()\n\n /** Declare a source field's posture (money/i18n/classified/plain). Plain fields\n * default to `DEFAULT_POSTURE`; a later declaration for the same node wins-first (idempotent). */\n registerField(collection: string, field: string, posture: ViaPosture): void {\n const id = nodeId({ collection, field })\n if (this._posture.has(id)) return\n this._posture.set(id, posture)\n this._effectiveCache.clear()\n this._wildcardCache.clear()\n }\n\n /** A derived target depends on `sources` (may be cross-collection). `kind`/`grain`\n * drive dispatch + erasure semantics; sources drive taint. Re-registering the same\n * target replaces `_in` but does not prune stale `_out` edges — callers must\n * register each target at most once per graph lifetime. `onDelete`/`keyField` (#650 Task 5)\n * are meaningful only for `kind === 'ref'` edges — {@link referencingEdgesOf} reads them back. */\n registerDerived(target: FieldRef, sources: readonly FieldRef[], kind: EdgeKind, grain: Grain, onDelete?: OnDelete, keyField?: string): void {\n const id = nodeId(target)\n this._in.set(id, {\n target, sources, kind, grain,\n ...(onDelete !== undefined ? { onDelete } : {}),\n ...(keyField !== undefined ? { keyField } : {}),\n })\n for (const source of sources) {\n const sourceId = nodeId(source)\n const outEdge: OutEdge = { target, kind }\n const dependents = this._out.get(sourceId)\n if (dependents) dependents.push(outEdge)\n else this._out.set(sourceId, [outEdge])\n }\n this._effectiveCache.clear()\n this._wildcardCache.clear()\n }\n\n /** Whether `target` already has a registered in-edge — lets a caller skip\n * re-registering the same target (#638 Task 2 fix wave 2, Finding I2i:\n * `registerDerived`'s at-most-once contract must hold across repeated\n * identical `vault.collection()` calls, not just within a single one). */\n hasDerived(target: FieldRef): boolean {\n return this._in.has(nodeId(target))\n }\n\n /** Mark/query a collection as having declared at least one classified field. */\n markClassified(collection: string): void {\n this._classifiedCollections.add(collection)\n }\n\n isClassified(collection: string): boolean {\n return this._classifiedCollections.has(collection)\n }\n\n /** Mark/query a collection's depsless (no declared `deps`) computed\n * field names — see `_depslessComputed`'s doc comment above. */\n markDepslessComputed(collection: string, field: string): void {\n let set = this._depslessComputed.get(collection)\n if (!set) { set = new Set(); this._depslessComputed.set(collection, set) }\n set.add(field)\n }\n\n depslessComputedFields(collection: string): ReadonlySet<string> {\n return this._depslessComputed.get(collection) ?? EMPTY_SET\n }\n\n /** Every field name the graph already has memory of for `collection` — from an\n * EARLIER, separate `vault.collection()` call (registered postures, derived\n * targets, depsless-computed names) — regardless of which via feature declared\n * it. #645 — `via/graph-wiring.ts`'s reconcile-path `knownFields` universe\n * (`collectKnownFieldNames`) is scoped to THIS call's own options only, so a\n * computed field attached in a LATER call whose `deps` correctly names a field\n * declared in an EARLIER call was spuriously refused as \"unknown\"; this method\n * lets that call site union in the graph's cross-call memory. Excludes the `'*'`\n * wildcard target (an overlay/derivation whole-record fold node, never a real\n * record field — see {@link registerDerived}'s doc comment). */\n knownFieldNames(collection: string): ReadonlySet<string> {\n const out = new Set<string>()\n const prefix = `${collection}${SEP}`\n for (const id of this._posture.keys()) {\n if (id.startsWith(prefix)) out.add(id.slice(prefix.length))\n }\n for (const edge of this._in.values()) {\n if (edge.target.collection === collection && edge.target.field !== '*') out.add(edge.target.field)\n }\n const depsless = this._depslessComputed.get(collection)\n if (depsless) for (const field of depsless) out.add(field)\n return out\n }\n\n /** Reject cycles at declare time (vault open). Throws `DerivationCycleError` for a\n * derivation/rollup/computed cycle, `MaterializedViewCycleError` for an MV cycle —\n * same classes + message shape the registries throw today (behavior lock). */\n assertAcyclic(): void {\n const visited = new Set<string>()\n const stack: string[] = []\n\n /** #639 — containment expansion: writing a real field `f` on collection `C` is\n * a write to `C`, so it must ALSO reach every whole-record (`'*'`) dependent of\n * `C` — the missing reachability step that made mutual/rotating rollup cycles\n * invisible (a rollup target is always a real field node and never itself a\n * graph SOURCE, so the old `_out.get(id)`-only walk dead-ended on it).\n *\n * TRAVERSAL-LOCAL ONLY (law, #642): this is a virtual adjacency computed\n * during the DFS walk, reading `_out` only. It must NEVER be materialized via\n * `registerDerived` (no new `(C,f)→(C,'*')` edge) and must NEVER touch `_in` —\n * putting `(C,'*')` into `_in` would flip `_contribution('C\\0*')` from the\n * `_wildcardContribution` fold (`#642`) onto the `_computeEffective` path,\n * bleeding cycle-reachability taint into `foldWildcardSecurity`'s posture\n * fold. Posture folding (`_contribution`/`_computeEffective`/\n * `_wildcardContribution`) never reads `_out`, so an expansion that reads\n * `_out` only is provably unable to perturb it. */\n // #671 item 5 — exclude `kind:'ref'` consuming edges: mutual FK lookups (two\n // collections each referencing the other) are legal and must not be treated as a\n // derivation cycle. Ref edges exist for cascade/rename machinery\n // (`referencingEdgesOf`/delete-time restrict/cascade/nullify), never derivation\n // ordering, so they carry no ordering constraint here. #678 — `kind` is read off\n // THIS `_out` entry (edge-local), NOT re-derefed from `_in`: a dual-role target\n // (e.g. #631's exempt {computed, lookup} composition) can have its `_in` entry's\n // `kind` overwritten by a LATER `registerDerived` call for the SAME target, so\n // asking `_in` \"what kind is `t` registered as NOW\" wrongly excluded a real\n // computed edge from the DFS as if it were a ref edge, hiding a genuine\n // derivation cycle. Asking \"what kind is THIS specific edge\" is correct\n // regardless of what else was later registered for the target.\n const notRefEdge = (entry: OutEdge): boolean => entry.kind !== 'ref'\n const neighboursOf = (id: string): readonly FieldRef[] => {\n const own = (this._out.get(id) ?? []).filter(notRefEdge).map((entry) => entry.target)\n const sep = id.indexOf(SEP)\n if (id.slice(sep + 1) === '*') return own\n const wildcard = (this._out.get(`${id.slice(0, sep)}${SEP}*`) ?? []).filter(notRefEdge).map((entry) => entry.target)\n if (wildcard.length === 0) return own\n return [...own, ...wildcard]\n }\n\n const visit = (id: string): void => {\n const idx = stack.indexOf(id)\n if (idx !== -1) {\n const cycle = stack.slice(idx).concat(id)\n const isMv = cycle.some(cycleId => this._in.get(cycleId)?.kind === 'mv')\n const path = cycle.map(displayNodeId)\n if (isMv) throw new MaterializedViewCycleError(path)\n throw new DerivationCycleError(path)\n }\n if (visited.has(id)) return\n stack.push(id)\n for (const dependent of neighboursOf(id)) visit(nodeId(dependent))\n stack.pop()\n visited.add(id)\n }\n\n for (const id of this._out.keys()) visit(id)\n }\n\n /** A leaf (non-derived) node's own posture contribution: its declared posture,\n * or `DEFAULT_POSTURE` if never declared via `registerField`. */\n private _declaredPosture(id: string): ViaPosture {\n return this._posture.get(id) ?? DEFAULT_POSTURE\n }\n\n /** A node's posture contribution when folded into a dependent: recurse if it is itself\n * derived; else its declared/default posture — UNLESS it is a `'*'` LEAF node consumed\n * by a folded formula kind (#642, `derivation|rollup|mv|overlay`), in which case it\n * contributes its collection's whole-record security fold ({@link _wildcardContribution}).\n * `kind` is the CONSUMING edge's kind, threaded from {@link _computeEffective}. `'ref'`\n * edges (and the provenance-only untyped call, `kind` left `undefined`) keep `'*'` =\n * identity — the phase-D lookup reliance (`via/lookup/registry.ts:392-397`) that a\n * referencing field must not seal just because its dimension collection has a classified\n * column. */\n private _contribution(id: string, kind?: EdgeKind): ViaPosture {\n const edge = this._in.get(id)\n if (edge) return this._computeEffective(id, edge)\n if (kind !== undefined && FOLDED_KINDS.has(kind) && id.endsWith(`${SEP}*`)) {\n return this._wildcardContribution(id.slice(0, -2))\n }\n return this._declaredPosture(id)\n }\n\n /** Lazy fold (#642) of a collection's REGISTERED field postures on the security axes only\n * ({@link foldWildcardSecurity} — sealed-wins encryptedAtRest, AND exportable, OR\n * forgettable; queryable stays at DEFAULT_POSTURE's 'full', never folded), seeded at\n * DEFAULT_POSTURE. This is the collection-level posture a `'*'` LEAF node contributes to a\n * folded-kind formula edge (derivation/rollup/mv/overlay) — see {@link _contribution}. A\n * plain (unregistered) field contributes nothing (the identity), so the fold is strictly\n * more conservative than deps-based taint and never hits the KNOWN-LIMIT wall (it names no\n * fields — seam map §1d). Memoized per collection in `_wildcardCache`. */\n private _wildcardContribution(collection: string): ViaPosture {\n const cached = this._wildcardCache.get(collection)\n if (cached) return cached\n let result = DEFAULT_POSTURE\n const prefix = `${collection}${SEP}`\n for (const [id, posture] of this._posture) {\n if (!id.startsWith(prefix) || id === `${prefix}*`) continue\n result = foldWildcardSecurity(result, posture)\n }\n this._wildcardCache.set(collection, result)\n return result\n }\n\n private _computeEffective(id: string, edge: DerivedEdge): ViaPosture {\n const cached = this._effectiveCache.get(id)\n if (cached) return cached\n let result = DEFAULT_POSTURE\n for (const source of edge.sources) {\n result = foldPosture(result, this._contribution(nodeId(source), edge.kind))\n }\n // #638 Task 7 — a virtual field is computed fresh on every read and never\n // stored, so it is structurally unqueryable regardless of what its\n // sources' fold would otherwise permit (e.g. a money-sourced virtual\n // field must NOT inherit money's 'ordered' queryability — there is no\n // stored/indexed form to query against). Every OTHER axis (exportable/\n // forgettable/encryptedAtRest) still folds normally — the taint rule is\n // identical to a materialized field; only queryability is a fixed,\n // grain-level property, not a source-derived one.\n if (edge.grain === 'virtual' && result.queryable !== 'none') {\n result = { ...result, queryable: 'none' }\n }\n this._effectiveCache.set(id, result)\n return result\n }\n\n /** Strictest source posture on every axis, per §2. `undefined` when `target` has no\n * in-edges (not a derived field). Transitive: folds through chained derivations. */\n effectivePosture(target: FieldRef): ViaPosture | undefined {\n const id = nodeId(target)\n const edge = this._in.get(id)\n if (!edge) return undefined\n return this._computeEffective(id, edge)\n }\n\n /** Per-collection { field → effectivePosture } overlay the pipeline consumes (Task 3). */\n taintedPostures(collection: string): ReadonlyMap<string, ViaPosture> {\n const out = new Map<string, ViaPosture>()\n for (const edge of this._in.values()) {\n if (edge.target.collection !== collection) continue\n out.set(edge.target.field, this._computeEffective(nodeId(edge.target), edge))\n }\n return out\n }\n\n /** Materialized (`grain !== 'virtual'`) derived fields on `collection` whose effective\n * encryptedAtRest resolves to 'sealed' — the taint-seal set (Task 3). #638 Task 7\n * makes the `grain !== 'virtual'` filter meaningful: a `computed(fn, { mode: 'virtual' })`\n * field is never stored (rides the `present` phase, seam map Part 4's money-Formatted/\n * i18n-Label precedent), so it is EXCLUDED here even when its effective `encryptedAtRest`\n * folds to `'sealed'` — there is no envelope slot to seal. It still surfaces in\n * {@link taintedPostures} (query refusal via `postureFor`'s `queryable` clamp above, and\n * export refusal via `exportable`) — only the AT-REST SEALING ACTION is skipped. */\n taintSealedFields(collection: string): ReadonlySet<string> {\n const out = new Set<string>()\n for (const edge of this._in.values()) {\n if (edge.target.collection !== collection || edge.grain === 'virtual') continue\n const posture = this._computeEffective(nodeId(edge.target), edge)\n if (posture.encryptedAtRest === 'sealed') out.add(edge.target.field)\n }\n return out\n }\n\n /** Fields on `collection` whose registered edge is `grain === 'virtual'` (#638 Task 7) —\n * `via/graph-wiring.ts#applyTaintOverlay` intersects this with `exportable === false`\n * postures to know which virtual fields need PRESENT-TIME (not just export-time)\n * redaction, since a virtual field's value is only ever materialized inside `present()`. */\n virtualFields(collection: string): ReadonlySet<string> {\n const out = new Set<string>()\n for (const edge of this._in.values()) {\n if (edge.target.collection === collection && edge.grain === 'virtual') out.add(edge.target.field)\n }\n return out\n }\n\n /** Per-collection { field → immediate source field names that forced its\n * effective posture away from `DEFAULT_POSTURE` } — `describe()`'s\n * provenance (Task 3). Only the DIRECT declared sources are named (not the\n * ultimate origin several hops up a transitive chain); a source absent\n * from the result contributed nothing restrictive. */\n taintProvenance(collection: string): ReadonlyMap<string, readonly string[]> {\n const out = new Map<string, readonly string[]>()\n for (const edge of this._in.values()) {\n if (edge.target.collection !== collection) continue\n const forcedBy = edge.sources\n .filter((source) => !isDefaultPosture(this._contribution(nodeId(source))))\n .map((source) => source.field)\n if (forcedBy.length > 0) out.set(edge.target.field, forcedBy)\n }\n return out\n }\n\n private _targetsDependingOn(collection: string): ReadonlyArray<{ readonly target: FieldRef; readonly kind: EdgeKind; readonly grain: Grain }> {\n const out: Array<{ target: FieldRef; kind: EdgeKind; grain: Grain }> = []\n for (const edge of this._in.values()) {\n if (edge.sources.some(source => source.collection === collection)) {\n out.push({ target: edge.target, kind: edge.kind, grain: edge.grain })\n }\n }\n return out\n }\n\n /** Dispatch (Task 4): every derived target triggered by a write to `collection`. Excludes\n * `'ref'` edges (#650 Task 5 review, folded Minor) — a `'ref'` edge is consulted only by the\n * delete/forget-time restrict/cascade/nullify path ({@link referencingEdgesOf}), never by the\n * sync/cutover/restore dispatch wave (`runGraphDispatchWave`); counting it here defeated that\n * wave's zero-cost early-continue, costing every write to a referenced backing collection an\n * unconditional decrypt + two no-op dispatch passes. {@link derivedArtifactsOf} (erasure\n * fanout) still includes `'ref'` edges — the forget path genuinely needs them. */\n dependentsOf(collection: string): ReadonlyArray<{ readonly target: FieldRef; readonly kind: EdgeKind; readonly grain: Grain }> {\n return this._targetsDependingOn(collection).filter((edge) => edge.kind !== 'ref')\n }\n\n /** Erasure (Task 6): derived artifacts of a forgotten record whose source is `collection`. */\n derivedArtifactsOf(collection: string): ReadonlyArray<{ readonly target: FieldRef; readonly kind: EdgeKind; readonly grain: Grain }> {\n return this._targetsDependingOn(collection)\n }\n\n /** Referencing edges pointing AT a backing dimension (delete/forget-time restrict/cascade/\n * nullify, #650 Task 5) — an O(1) reverse lookup via the existing `_out` map (keyed at the\n * dimension's wildcard `field:'*'` node, the same convention every whole-collection source\n * already uses), NEVER a scan across collections or records. `backing` is the collection name\n * a lookup field's edge was registered against (a reserved dimension's `_dict_<name>`/\n * `_lookup_<name>` collection name, or a matrix dimension's own collection name). */\n referencingEdgesOf(backing: string): ReadonlyArray<{ readonly referencing: FieldRef; readonly onDelete: OnDelete; readonly keyField: string }> {\n const targets = this._out.get(nodeId({ collection: backing, field: '*' }))\n if (!targets) return []\n const out: Array<{ referencing: FieldRef; onDelete: OnDelete; keyField: string }> = []\n for (const entry of targets) {\n // #678 — `kind` is read directly off THIS `_out` entry (edge-local) instead of\n // re-derefing `_in`. This also fixes the symmetric ref-vanishes hazard: under a\n // registration order where a LATER `registerDerived` call for the same target\n // overwrites `_in`'s kind away from `'ref'`, the old `_in`-derefing check would\n // silently drop a genuine referencing edge from cascade/nullify delete machinery\n // even though this specific edge was truly registered as `'ref'`.\n if (entry.kind !== 'ref') continue\n const edge = this._in.get(nodeId(entry.target))\n if (edge?.onDelete !== undefined) {\n out.push({ referencing: entry.target, onDelete: edge.onDelete, keyField: edge.keyField ?? 'id' })\n }\n }\n return out\n }\n}\n"],"mappings":";;;;;;AA2BO,IAAM,kBACX,EAAE,iBAAiB,YAAY,WAAW,QAAQ,YAAY,MAAM,aAAa,MAAM;AAEzF,IAAM,iBAA0D;AAAA,EAC9D,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS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js";
|
|
8
8
|
import {
|
|
9
9
|
openEnvelopeJson
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XDYREZWE.js";
|
|
11
11
|
import {
|
|
12
12
|
encrypt
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CIE2BASH.js";
|
|
14
14
|
import {
|
|
15
15
|
NOYDB_FORMAT_VERSION
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JNAI2HN2.js";
|
|
17
17
|
import {
|
|
18
18
|
PermissionDeniedError
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BIOUI4HL.js";
|
|
20
20
|
|
|
21
21
|
// src/with-party/team/active.ts
|
|
22
22
|
function withTeam() {
|
|
@@ -96,4 +96,4 @@ export {
|
|
|
96
96
|
listCredentials,
|
|
97
97
|
credentialStatus
|
|
98
98
|
};
|
|
99
|
-
//# sourceMappingURL=chunk-
|
|
99
|
+
//# sourceMappingURL=chunk-I6GALP6E.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
linkCollectionName,
|
|
3
3
|
linkRowKey
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JZUV47FZ.js";
|
|
5
5
|
import {
|
|
6
6
|
openEnvelopeJson
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XDYREZWE.js";
|
|
8
8
|
import {
|
|
9
9
|
encrypt
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CIE2BASH.js";
|
|
11
11
|
import {
|
|
12
12
|
NOYDB_FORMAT_VERSION
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JNAI2HN2.js";
|
|
14
14
|
import {
|
|
15
15
|
NoydbError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BIOUI4HL.js";
|
|
17
17
|
|
|
18
18
|
// src/with-shape/links/link-set.ts
|
|
19
19
|
var LinkSet = class {
|
|
@@ -127,4 +127,4 @@ export {
|
|
|
127
127
|
LinkSet,
|
|
128
128
|
LinkEndpointError
|
|
129
129
|
};
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
130
|
+
//# sourceMappingURL=chunk-IL6POWCW.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildAccessibleBundle,
|
|
3
3
|
resolveAccessibleCollections
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F64IRYG3.js";
|
|
5
5
|
import {
|
|
6
6
|
sha256Hex
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CIE2BASH.js";
|
|
8
8
|
import {
|
|
9
9
|
NOYDB_FORMAT_VERSION
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JNAI2HN2.js";
|
|
11
11
|
import {
|
|
12
12
|
ReadOnlyError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BIOUI4HL.js";
|
|
14
14
|
|
|
15
15
|
// src/with-audit/portability/withdraw-accessible.ts
|
|
16
16
|
var FROZEN_SNAPSHOTS_COLLECTION = "_frozen_snapshots";
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
freezeAndDeleteClosure,
|
|
115
115
|
withdrawAccessibleData
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
117
|
+
//# sourceMappingURL=chunk-IU6SNYX6.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
readDirectoryConfig,
|
|
6
6
|
readUserVisibility,
|
|
7
7
|
saveUserEnvelope
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4JBYV75E.js";
|
|
9
9
|
import {
|
|
10
10
|
base64ToBuffer,
|
|
11
11
|
bufferToBase64,
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
generateSalt,
|
|
17
17
|
unwrapKey,
|
|
18
18
|
wrapKey
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CIE2BASH.js";
|
|
20
20
|
import {
|
|
21
21
|
NOYDB_FORMAT_VERSION,
|
|
22
22
|
NOYDB_KEYRING_VERSION
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-JNAI2HN2.js";
|
|
24
24
|
import {
|
|
25
25
|
DirectoryDisabledError,
|
|
26
26
|
InvalidKeyError,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
PrivilegeEscalationError,
|
|
33
33
|
USER_ENVELOPE_COLLECTION,
|
|
34
34
|
ValidationError
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-BIOUI4HL.js";
|
|
36
36
|
|
|
37
37
|
// src/kernel/validation.ts
|
|
38
38
|
var WeakPassphraseError = class extends NoydbError {
|
|
@@ -775,4 +775,4 @@ export {
|
|
|
775
775
|
hasImportCapability,
|
|
776
776
|
evaluateImportCapability
|
|
777
777
|
};
|
|
778
|
-
//# sourceMappingURL=chunk-
|
|
778
|
+
//# sourceMappingURL=chunk-J2ZX2XUV.js.map
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SCHEMAS_COLLECTION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VZRODIM3.js";
|
|
4
4
|
import {
|
|
5
5
|
BLOB_CHUNKS_COLLECTION,
|
|
6
6
|
BLOB_COLLECTION,
|
|
7
7
|
BLOB_INDEX_COLLECTION,
|
|
8
|
+
BLOB_INTENT_COLLECTION,
|
|
8
9
|
BLOB_SLOTS_PREFIX,
|
|
9
10
|
BLOB_VERSIONS_PREFIX
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SNZ6URZZ.js";
|
|
11
12
|
import {
|
|
12
13
|
assembleBundleContainer,
|
|
13
14
|
buildExtractedPartitionWrapper
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FHS2HQSH.js";
|
|
15
16
|
import {
|
|
16
17
|
generateULID
|
|
17
18
|
} from "./chunk-ZJADGNYF.js";
|
|
@@ -22,10 +23,11 @@ import {
|
|
|
22
23
|
canonicalJson,
|
|
23
24
|
envelopePayloadHash,
|
|
24
25
|
hashEntry
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-Q5VNKNE5.js";
|
|
26
27
|
import {
|
|
27
|
-
openEnvelopeJson
|
|
28
|
-
|
|
28
|
+
openEnvelopeJson,
|
|
29
|
+
writeEnvelopeBody
|
|
30
|
+
} from "./chunk-XDYREZWE.js";
|
|
29
31
|
import {
|
|
30
32
|
bufferToBase64,
|
|
31
33
|
decrypt,
|
|
@@ -35,14 +37,14 @@ import {
|
|
|
35
37
|
generateDEK,
|
|
36
38
|
unwrapCek,
|
|
37
39
|
wrapCek
|
|
38
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-CIE2BASH.js";
|
|
39
41
|
import {
|
|
40
42
|
NOYDB_BACKUP_VERSION,
|
|
41
43
|
NOYDB_FORMAT_VERSION
|
|
42
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-JNAI2HN2.js";
|
|
43
45
|
import {
|
|
44
46
|
PartitionExtractionError
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-BIOUI4HL.js";
|
|
46
48
|
|
|
47
49
|
// src/with-cargo/walk-closure.ts
|
|
48
50
|
async function walkClosure(vault, opts) {
|
|
@@ -75,7 +77,7 @@ async function walkClosure(vault, opts) {
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
const { refRegistry } = vault._introspectState();
|
|
80
|
+
const { refRegistry, adapter, name: vaultName } = vault._introspectState();
|
|
79
81
|
const maxDepth = opts.maxDepth ?? 16;
|
|
80
82
|
let cyclesDetected = false;
|
|
81
83
|
let inboundDepth = 0;
|
|
@@ -110,6 +112,7 @@ async function walkClosure(vault, opts) {
|
|
|
110
112
|
}
|
|
111
113
|
let outboundFrontier = [];
|
|
112
114
|
for (const [c, ids] of closure) for (const id of ids) outboundFrontier.push([c, id]);
|
|
115
|
+
const danglingRefs = [];
|
|
113
116
|
while (outboundFrontier.length > 0) {
|
|
114
117
|
const next = [];
|
|
115
118
|
for (const [collectionName, id] of outboundFrontier) {
|
|
@@ -122,6 +125,21 @@ async function walkClosure(vault, opts) {
|
|
|
122
125
|
const rawId = record[field];
|
|
123
126
|
if (typeof rawId !== "string" && typeof rawId !== "number") continue;
|
|
124
127
|
const parentId = String(rawId);
|
|
128
|
+
const parentColl = vault.collection(descriptor.target);
|
|
129
|
+
const parentRecord = await parentColl.get(parentId);
|
|
130
|
+
if (!parentRecord) {
|
|
131
|
+
const rawParentEnv = await adapter.get(vaultName, descriptor.target, parentId);
|
|
132
|
+
const reason = rawParentEnv && (rawParentEnv._tier ?? 0) > 0 ? "elevated" : "missing";
|
|
133
|
+
danglingRefs.push({
|
|
134
|
+
collection: collectionName,
|
|
135
|
+
id,
|
|
136
|
+
field,
|
|
137
|
+
target: descriptor.target,
|
|
138
|
+
targetId: parentId,
|
|
139
|
+
reason
|
|
140
|
+
});
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
125
143
|
if (add(descriptor.target, parentId)) {
|
|
126
144
|
next.push([descriptor.target, parentId]);
|
|
127
145
|
}
|
|
@@ -135,7 +153,7 @@ async function walkClosure(vault, opts) {
|
|
|
135
153
|
outboundFrontier = next;
|
|
136
154
|
}
|
|
137
155
|
const depth = Math.max(inboundDepth, outboundDepth);
|
|
138
|
-
return { closure, graph: { depth, cyclesDetected } };
|
|
156
|
+
return { closure, graph: { depth, cyclesDetected }, danglingRefs };
|
|
139
157
|
}
|
|
140
158
|
|
|
141
159
|
// src/with-cargo/extract-partition.ts
|
|
@@ -161,6 +179,11 @@ async function reKeyClosure(vault, closure, fieldProjection) {
|
|
|
161
179
|
for (const id of ids) {
|
|
162
180
|
const env = await adapter.get(vaultName, collectionName, id);
|
|
163
181
|
if (!env) continue;
|
|
182
|
+
if ((env._tier ?? 0) > 0) {
|
|
183
|
+
throw new PartitionExtractionError(
|
|
184
|
+
`#748: reKeyClosure fetched an elevated envelope (collection="${collectionName}" id="${id}" _tier=${env._tier}) \u2014 this is unreachable by construction (walkClosure only ever adds ids reachable through tier-gated Collection reads). Refusing to carry it into a partition.`
|
|
185
|
+
);
|
|
186
|
+
}
|
|
164
187
|
if (env._cek !== void 0) {
|
|
165
188
|
const cek = await unwrapCek(env._cek, srcDek);
|
|
166
189
|
const plaintext2 = await decrypt(env._iv, env._data, cek);
|
|
@@ -279,13 +302,27 @@ async function reKeyBlobs(vault, closure, destDeks, fieldProjection) {
|
|
|
279
302
|
const proj = projList ? new Set(projList) : void 0;
|
|
280
303
|
const slotsCollection = `${BLOB_SLOTS_PREFIX}${collectionName}`;
|
|
281
304
|
for (const id of ids) {
|
|
305
|
+
const intentId = `${collectionName}::${id}`;
|
|
306
|
+
const intentEnv = await adapter.get(vaultName, BLOB_INTENT_COLLECTION, intentId);
|
|
307
|
+
if (intentEnv) {
|
|
308
|
+
const intentPlain = await openEnvelopeJson(intentEnv, srcDek);
|
|
309
|
+
const intentBody = await writeEnvelopeBody(intentPlain, destDek);
|
|
310
|
+
place(BLOB_INTENT_COLLECTION, intentId, { ...intentEnv, ...intentBody });
|
|
311
|
+
}
|
|
282
312
|
const env = await adapter.get(vaultName, slotsCollection, id);
|
|
283
313
|
if (!env) continue;
|
|
314
|
+
if ((env._tier ?? 0) > 0) {
|
|
315
|
+
throw new PartitionExtractionError(
|
|
316
|
+
`#748: reKeyBlobs fetched an elevated slot-map envelope (collection="${slotsCollection}" id="${id}" _tier=${env._tier}) \u2014 this is unreachable by construction. Refusing to carry it into a partition.`
|
|
317
|
+
);
|
|
318
|
+
}
|
|
284
319
|
const slots = JSON.parse(await openEnvelopeJson(env, srcDek));
|
|
285
320
|
const kept = {};
|
|
286
321
|
for (const [slotName, slot] of Object.entries(slots)) {
|
|
287
322
|
if (proj && !proj.has(slotName)) continue;
|
|
288
|
-
|
|
323
|
+
const { pendingRelease, ...strippedSlot } = slot;
|
|
324
|
+
void pendingRelease;
|
|
325
|
+
kept[slotName] = strippedSlot;
|
|
289
326
|
addRef(slot.eTag);
|
|
290
327
|
}
|
|
291
328
|
if (Object.keys(kept).length === 0) continue;
|
|
@@ -300,6 +337,11 @@ async function reKeyBlobs(vault, closure, destDeks, fieldProjection) {
|
|
|
300
337
|
if (proj && slotName !== void 0 && !proj.has(slotName)) continue;
|
|
301
338
|
const env = await adapter.get(vaultName, versionsCollection, key);
|
|
302
339
|
if (!env) continue;
|
|
340
|
+
if ((env._tier ?? 0) > 0) {
|
|
341
|
+
throw new PartitionExtractionError(
|
|
342
|
+
`#748: reKeyBlobs fetched an elevated version-record envelope (collection="${versionsCollection}" key="${key}" _tier=${env._tier}) \u2014 this is unreachable by construction. Refusing to carry it into a partition.`
|
|
343
|
+
);
|
|
344
|
+
}
|
|
303
345
|
const record = JSON.parse(await openEnvelopeJson(env, srcDek));
|
|
304
346
|
addRef(record.eTag);
|
|
305
347
|
const { iv, data } = await encrypt(JSON.stringify(record), destDek);
|
|
@@ -382,7 +424,7 @@ async function extractPartitionCore(vault, opts) {
|
|
|
382
424
|
);
|
|
383
425
|
}
|
|
384
426
|
if (opts.carrySchemas) await vault._drainPendingSchemaWrites();
|
|
385
|
-
const { closure } = await walkClosure(vault, opts);
|
|
427
|
+
const { closure, danglingRefs } = await walkClosure(vault, opts);
|
|
386
428
|
const { collections, deks } = await reKeyClosure(vault, closure, opts.fieldProjection);
|
|
387
429
|
let ledgerHead;
|
|
388
430
|
let ledgerEntries;
|
|
@@ -437,7 +479,7 @@ async function extractPartitionCore(vault, opts) {
|
|
|
437
479
|
// indicator only
|
|
438
480
|
}
|
|
439
481
|
});
|
|
440
|
-
return { bundleBytes, transferKey, sealId: seal.sealId };
|
|
482
|
+
return { bundleBytes, transferKey, sealId: seal.sealId, danglingRefs };
|
|
441
483
|
}
|
|
442
484
|
|
|
443
485
|
export {
|
|
@@ -450,4 +492,4 @@ export {
|
|
|
450
492
|
extractPartition,
|
|
451
493
|
extractPartitionCore
|
|
452
494
|
};
|
|
453
|
-
//# sourceMappingURL=chunk-
|
|
495
|
+
//# sourceMappingURL=chunk-JIF24JPM.js.map
|