@noy-db/hub 0.3.0 → 0.4.0-pre.1
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-IQFZJSQO.js +20 -0
- package/dist/as/index.js +11 -11
- package/dist/attestation/index.js +18 -18
- package/dist/{backup-BJ57IKAO.js → backup-LU2DTZTI.js} +11 -11
- package/dist/blobs/index.js +12 -12
- package/dist/broker/index.js +12 -12
- package/dist/bundle/index.js +26 -74
- package/dist/bundle/index.js.map +1 -1
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.js +41 -22
- package/dist/chunk-2IALOXZS.js +24 -0
- package/dist/chunk-2IALOXZS.js.map +1 -0
- package/dist/{chunk-EVVGJDRQ.js → chunk-2MUZ3LY6.js} +3 -3
- package/dist/{chunk-NWSGI5C7.js → chunk-2P7EGNKF.js} +3 -3
- package/dist/{chunk-ZAJAVEXY.js → chunk-2PCAVW2I.js} +2 -2
- package/dist/{chunk-HTJQYHZP.js → chunk-3ELCWU56.js} +2 -2
- package/dist/{chunk-X7QBD67R.js → chunk-3PF6CRDT.js} +136 -114
- package/dist/chunk-3PF6CRDT.js.map +1 -0
- package/dist/{chunk-J2ZX2XUV.js → chunk-3SV2EPMN.js} +5 -5
- package/dist/{chunk-FUG4SFN3.js → chunk-3U3FBR7O.js} +2 -2
- package/dist/{chunk-VFUPHI2Z.js → chunk-4BRCIYFG.js} +6 -6
- package/dist/{chunk-SNZ6URZZ.js → chunk-5OI6BR4H.js} +7 -7
- package/dist/{chunk-B3HJYUOF.js → chunk-5WZXVULX.js} +2 -2
- package/dist/{chunk-LASZKVMO.js → chunk-6B4DYGWO.js} +3 -3
- package/dist/{chunk-ZJ2AK4V7.js → chunk-6HPG2YNX.js} +2 -2
- package/dist/{chunk-5M5DVGV7.js → chunk-6HY2X62D.js} +2 -2
- package/dist/{chunk-QRB7NAOJ.js → chunk-6NQMXTYC.js} +2 -2
- package/dist/{chunk-RIX4V2TB.js → chunk-6XE5TMPR.js} +3 -3
- package/dist/{chunk-BDVFPG6Y.js → chunk-7CI6CP7Z.js} +5 -5
- package/dist/{chunk-VLFCJYTL.js → chunk-7O3AYBC7.js} +63 -10
- package/dist/chunk-7O3AYBC7.js.map +1 -0
- package/dist/{chunk-454JXE57.js → chunk-A5BDDEXK.js} +10 -170
- package/dist/chunk-A5BDDEXK.js.map +1 -0
- package/dist/{chunk-FHS2HQSH.js → chunk-A7JJLVGH.js} +11 -8
- package/dist/chunk-A7JJLVGH.js.map +1 -0
- package/dist/{chunk-FM3G3NOY.js → chunk-BGK233EA.js} +83 -6
- package/dist/chunk-BGK233EA.js.map +1 -0
- package/dist/{chunk-OSDB5WW3.js → chunk-BMQWTQZ4.js} +11 -11
- package/dist/{chunk-W22IKJE2.js → chunk-BOKIKJJB.js} +2 -2
- package/dist/{chunk-CRI4OUV4.js → chunk-CBSY2N76.js} +2 -2
- package/dist/{chunk-2NVOWNI3.js → chunk-CCOP5XDW.js} +4 -4
- package/dist/{chunk-CDUQTA3Z.js → chunk-DDATL6PU.js} +7 -7
- package/dist/{chunk-RCVJZMFE.js → chunk-DDHM2TLX.js} +4 -4
- package/dist/{chunk-PN2XMATY.js → chunk-DRWBEDYO.js} +2 -2
- package/dist/{chunk-XDYREZWE.js → chunk-DVUZMT2W.js} +12 -8
- package/dist/{chunk-XDYREZWE.js.map → chunk-DVUZMT2W.js.map} +1 -1
- package/dist/{chunk-T2FFWNPK.js → chunk-EGCRBCNA.js} +3 -3
- package/dist/{chunk-VZRODIM3.js → chunk-F6T6L2UK.js} +4 -4
- package/dist/chunk-FH52K7EG.js +50 -0
- package/dist/chunk-FH52K7EG.js.map +1 -0
- package/dist/{chunk-EXK7QRWF.js → chunk-G6EQYAL6.js} +5 -5
- package/dist/{chunk-F64IRYG3.js → chunk-GQNGCEP5.js} +2 -2
- package/dist/{chunk-6JTIAGHD.js → chunk-GULTLPFB.js} +3 -3
- package/dist/chunk-GULTLPFB.js.map +1 -0
- package/dist/{chunk-ZUODRVHY.js → chunk-GVZQ4NAM.js} +2 -2
- package/dist/{chunk-3B5VVCNY.js → chunk-GWKAVKHI.js} +2 -2
- package/dist/{chunk-SLFHQTTW.js → chunk-GYYCX5K6.js} +5 -5
- package/dist/{chunk-CIE2BASH.js → chunk-HOONYZY2.js} +2 -2
- package/dist/{chunk-EYZ6IQ6X.js → chunk-HPUWOVR7.js} +5 -5
- package/dist/{chunk-IL6POWCW.js → chunk-IM3QVF53.js} +6 -6
- package/dist/{chunk-NJ4EOKMB.js → chunk-IRQY7IR5.js} +4 -4
- package/dist/{chunk-3QCRBHCY.js → chunk-ISMV2QVG.js} +2 -2
- package/dist/{chunk-HB3RFQSC.js → chunk-IY23KFNZ.js} +3 -3
- package/dist/chunk-J6Q7UVQE.js +248 -0
- package/dist/chunk-J6Q7UVQE.js.map +1 -0
- package/dist/{chunk-6CRIV7DE.js → chunk-JBBSYJHP.js} +2 -2
- package/dist/{chunk-MEFJPTZ4.js → chunk-JRBNCUNT.js} +3 -3
- package/dist/{chunk-4VNQOLML.js → chunk-JVBO4SZL.js} +2 -2
- package/dist/{chunk-I6GALP6E.js → chunk-JZWWLLVY.js} +6 -6
- package/dist/{chunk-RYCTDFUX.js → chunk-KUIB4B5Q.js} +2 -2
- package/dist/{chunk-HDQIIUPH.js → chunk-KUPKLSX5.js} +3 -3
- package/dist/{chunk-5O3XF4DV.js → chunk-KWVJAOIN.js} +4 -4
- package/dist/{chunk-3LQ2YKO4.js → chunk-LB6OH6K2.js} +2 -2
- package/dist/{chunk-AUSTCW2X.js → chunk-LOF2W3JU.js} +8 -8
- package/dist/{chunk-JNAI2HN2.js → chunk-LSASLXGC.js} +1 -1
- package/dist/chunk-LSASLXGC.js.map +1 -0
- package/dist/{chunk-K5IMOGHB.js → chunk-M75ZZHSR.js} +2 -2
- package/dist/{chunk-GTGPO5KW.js → chunk-MQ6WOPSY.js} +5 -5
- package/dist/{chunk-4CTHCN4J.js → chunk-MTQPRQHB.js} +4 -4
- package/dist/{chunk-UNFPPVNI.js → chunk-N55W7KUL.js} +2 -2
- package/dist/{chunk-JKJOGPZN.js → chunk-N6WF5PKC.js} +2 -2
- package/dist/{chunk-6T2SCQRU.js → chunk-O7WJ47EF.js} +4 -4
- package/dist/{chunk-JIF24JPM.js → chunk-OF75ACKS.js} +9 -9
- package/dist/{chunk-GKEWXIV5.js → chunk-ONTBCHCP.js} +2 -2
- package/dist/{chunk-4JBYV75E.js → chunk-PK6QCH2C.js} +5 -5
- package/dist/{chunk-6QTNZJBS.js → chunk-PT37L5DV.js} +3 -3
- package/dist/{chunk-EVX47VBM.js → chunk-QDPZWTN2.js} +2 -2
- package/dist/chunk-RA5VTXXG.js +173 -0
- package/dist/chunk-RA5VTXXG.js.map +1 -0
- package/dist/{chunk-QLWMEXCT.js → chunk-RDXW3OBQ.js} +2 -2
- package/dist/{chunk-Q5VNKNE5.js → chunk-RM2XV574.js} +3 -3
- package/dist/{chunk-ERJ7FU55.js → chunk-RND5ZPNP.js} +3 -3
- package/dist/{chunk-JZUV47FZ.js → chunk-RTEK4C4I.js} +2 -2
- package/dist/{chunk-KSKBRKGJ.js → chunk-S3BFKGET.js} +84 -6
- package/dist/chunk-S3BFKGET.js.map +1 -0
- package/dist/{chunk-5YOLBEQ6.js → chunk-S6Q37VGE.js} +2 -2
- package/dist/{chunk-HDMEGAQE.js → chunk-SMGEYW6G.js} +127 -8
- package/dist/chunk-SMGEYW6G.js.map +1 -0
- package/dist/{chunk-E5ZQT5KX.js → chunk-SMIRGMS7.js} +2 -2
- package/dist/chunk-T36RFODW.js +180 -0
- package/dist/chunk-T36RFODW.js.map +1 -0
- package/dist/{chunk-EQO2UVP4.js → chunk-T6GU5PPZ.js} +6 -6
- package/dist/{chunk-LXEXBTKL.js → chunk-TAGR72IR.js} +4 -4
- package/dist/{chunk-YFXZEAYK.js → chunk-TOPYT5U5.js} +6 -6
- package/dist/{chunk-MV43JSJF.js → chunk-UBNCR3YK.js} +4 -4
- package/dist/{chunk-ZICD77GM.js → chunk-UC2ETWF3.js} +2 -2
- package/dist/{chunk-XWZVFISC.js → chunk-UFEVO57O.js} +6 -6
- package/dist/{chunk-NR5LT5RY.js → chunk-UNCOC7QH.js} +7 -7
- package/dist/{chunk-R4ROFEYC.js → chunk-VAIS3SOM.js} +2 -2
- package/dist/{chunk-VN3DBQAU.js → chunk-VCBHAE4R.js} +2 -2
- package/dist/{chunk-M4CV6BRT.js → chunk-VEALDPHW.js} +2 -2
- package/dist/{chunk-BIOUI4HL.js → chunk-W2OG6JOL.js} +1 -1
- package/dist/{chunk-BIOUI4HL.js.map → chunk-W2OG6JOL.js.map} +1 -1
- package/dist/{chunk-7DSTRQIJ.js → chunk-WEYZTLXN.js} +2 -2
- package/dist/{chunk-CAF6WOK7.js → chunk-WNGGJWF7.js} +2 -2
- package/dist/{chunk-IU6SNYX6.js → chunk-YJV2UZ7H.js} +5 -5
- package/dist/{chunk-RZ5SVOYR.js → chunk-YTGDPCPW.js} +2 -2
- package/dist/{chunk-DLG74CNB.js → chunk-ZEQWCBCM.js} +7 -19
- package/dist/chunk-ZEQWCBCM.js.map +1 -0
- package/dist/classified/index.js +5 -5
- package/dist/{classified-marker-CZKA6ITE.js → classified-marker-WQVIJAW2.js} +3 -3
- package/dist/collection-facade-MJXSC3Q6.js +44 -0
- package/dist/{computed-ZIQTYTDI.js → computed-DSMPXG2Y.js} +3 -3
- package/dist/consent/index.js +9 -9
- package/dist/{public-envelope-B4KNWVUA.js → cover-B5SJDHR3.js} +25 -5
- package/dist/{dead-filter-ESOBZZP5.js → dead-filter-2A7IAJ3D.js} +2 -2
- package/dist/delegation-A5A75KQO.js +25 -0
- package/dist/derivations/index.js +12 -12
- package/dist/derive-HJSMH7RA.js +21 -0
- package/dist/{enclave-AP3I5W7O.js → enclave-7MW6ZGXW.js} +11 -9
- package/dist/executor-AXE4XMLT.js +26 -0
- package/dist/executor-KGNLJD6M.js +9 -0
- package/dist/executor-XGIS6CR7.js +9 -0
- package/dist/export-accessible-VVBJM3MM.js +23 -0
- package/dist/extract-partition-LGGBTQET.js +38 -0
- package/dist/{fanout-sidecar-A765THMX.js → fanout-sidecar-WDYQ77VB.js} +9 -9
- package/dist/find-YS6XWB46.js +11 -0
- package/dist/forget/index.js +9 -9
- package/dist/guards/index.js +6 -6
- package/dist/history/index.js +12 -12
- package/dist/i18n/index.js +14 -14
- package/dist/index.d.ts +6 -3
- package/dist/index.js +140 -117
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +2 -2
- package/dist/issue-LSR5PS6H.js +19 -0
- package/dist/kernel/enclave/index.d.ts +1 -1
- package/dist/kernel/enclave/record-keys/envelope-body.d.ts +8 -0
- package/dist/kernel/errors.d.ts +10 -5
- package/dist/kernel/noydb.d.ts +21 -11
- package/dist/kernel/types.d.ts +53 -6
- package/dist/kernel/vault.d.ts +10 -6
- package/dist/{ledger-GFBKVPV4.js → ledger-33BC4TR7.js} +11 -11
- package/dist/liberate-GBSAYLPJ.js +24 -0
- package/dist/{link-set-Z7Q2ASFX.js → link-set-QK22TDEX.js} +11 -11
- package/dist/materialized-views/index.js +19 -18
- package/dist/noydb-MTUBMWFE.js +70 -0
- package/dist/on/index.js +9 -9
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +19 -17
- package/dist/pod/index.js +13 -11
- package/dist/{policy-Z3RUAIY2.js → policy-NAHB2TUT.js} +5 -5
- package/dist/portability/index.js +8 -8
- package/dist/{post-register-JTH76BLY.js → post-register-JVTMJ6OW.js} +6 -6
- package/dist/query/index.js +10 -8
- package/dist/register-X462DNDM.js +23 -0
- package/dist/registry-3XMCT7MQ.js +18 -0
- package/dist/registry-KHD2I3M2.js +19 -0
- package/dist/registry-NPOWJHC4.js +9 -0
- package/dist/request-withdrawal-U7K3JTMY.js +31 -0
- package/dist/{reveal-DIBHLUZX.js → reveal-LGBOM2BO.js} +6 -6
- package/dist/revoke-OCWDSWRQ.js +24 -0
- package/dist/satellites/index.js +1 -1
- package/dist/sealed-record/index.js +12 -12
- package/dist/{seed-Q6M2IZFL.js → seed-PWK45HDF.js} +11 -11
- package/dist/session/index.js +9 -9
- package/dist/shadow/index.js +2 -2
- package/dist/share-link/index.d.ts +19 -0
- package/dist/share-link/index.js +201 -0
- package/dist/share-link/index.js.map +1 -0
- package/dist/share-link/share-link.d.ts +123 -0
- package/dist/signer-3YFBLZRN.js +25 -0
- package/dist/snapshots/index.js +10 -10
- package/dist/{stale-OSQ7J3AA.js → stale-FJED42DM.js} +10 -10
- package/dist/storage-W3GURVFU.js +23 -0
- package/dist/{store-coordination-provider-64OEZFGS.js → store-coordination-provider-APODTV4W.js} +3 -3
- package/dist/sync/index.js +10 -9
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.js +16 -15
- package/dist/tiers/index.js +10 -10
- package/dist/to/index.js +1 -1
- package/dist/tx/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/{verify-ZASTRNPR.js → verify-26Y5GNMK.js} +5 -5
- package/dist/via/i18n/policy.d.ts +1 -1
- package/dist/{walk-SVNDIZ62.js → walk-XS3PKM6I.js} +11 -11
- package/dist/with/index.js +11 -11
- package/dist/with-audit/periods/periods.d.ts +1 -16
- package/dist/with-audit/periods/window.d.ts +16 -0
- package/dist/with-cargo/index.d.ts +6 -0
- package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +15 -0
- package/dist/with-formula/materialized-views/index.d.ts +1 -1
- package/dist/with-formula/materialized-views/registry.d.ts +29 -0
- package/dist/with-formula/materialized-views/types.d.ts +81 -0
- package/dist/with-formula/materialized-views/with-materialized-view.d.ts +9 -5
- package/dist/with-party/directory/cover/custom.d.ts +34 -0
- package/dist/with-party/directory/cover/index.d.ts +19 -0
- package/dist/with-party/directory/cover/schema.d.ts +39 -0
- package/dist/with-party/directory/cover/storage.d.ts +71 -0
- package/dist/with-party/directory/cover/types.d.ts +149 -0
- package/dist/with-party/team/noydb-facade.d.ts +1 -1
- package/dist/with-party/team/sync-period-scope.d.ts +78 -0
- package/dist/with-party/team/sync.d.ts +13 -0
- package/dist/with-pod/bundle.d.ts +9 -7
- package/dist/with-pod/format.d.ts +8 -4
- package/dist/with-pod/index.d.ts +2 -1
- package/dist/withdraw-accessible-Y3B2535F.js +28 -0
- package/package.json +7 -3
- package/dist/api-ZGS6LCOF.js +0 -20
- package/dist/chunk-454JXE57.js.map +0 -1
- package/dist/chunk-4NXKCLLQ.js +0 -97
- package/dist/chunk-4NXKCLLQ.js.map +0 -1
- package/dist/chunk-6JTIAGHD.js.map +0 -1
- package/dist/chunk-DLG74CNB.js.map +0 -1
- package/dist/chunk-FHS2HQSH.js.map +0 -1
- package/dist/chunk-FM3G3NOY.js.map +0 -1
- package/dist/chunk-HDMEGAQE.js.map +0 -1
- package/dist/chunk-JNAI2HN2.js.map +0 -1
- package/dist/chunk-KSKBRKGJ.js.map +0 -1
- package/dist/chunk-VLFCJYTL.js.map +0 -1
- package/dist/chunk-WXSYDNBT.js +0 -39
- package/dist/chunk-WXSYDNBT.js.map +0 -1
- package/dist/chunk-X3YYQWOQ.js +0 -155
- package/dist/chunk-X3YYQWOQ.js.map +0 -1
- package/dist/chunk-X7QBD67R.js.map +0 -1
- package/dist/collection-facade-TLWIPI76.js +0 -44
- package/dist/delegation-W7ZV2322.js +0 -25
- package/dist/derive-H2BJTLUI.js +0 -21
- package/dist/executor-KGWTNEQD.js +0 -9
- package/dist/executor-OVEXR6RT.js +0 -9
- package/dist/executor-UNEH5ZYH.js +0 -25
- package/dist/export-accessible-PCMXSUZS.js +0 -23
- package/dist/extract-partition-SWHFSYJO.js +0 -38
- package/dist/find-N6345CNT.js +0 -11
- package/dist/issue-5OKB6I2R.js +0 -19
- package/dist/liberate-3VDOT4KO.js +0 -24
- package/dist/noydb-ZCJOYBDI.js +0 -68
- package/dist/register-VAHONCID.js +0 -23
- package/dist/registry-7MLVD3VO.js +0 -19
- package/dist/registry-EPKPD5SM.js +0 -18
- package/dist/registry-P5T7PS2U.js +0 -9
- package/dist/request-withdrawal-TI3A5WPS.js +0 -31
- package/dist/revoke-FDRD6GRW.js +0 -24
- package/dist/signer-MUWEIUI6.js +0 -25
- package/dist/storage-MVFCGEQE.js +0 -23
- package/dist/with-party/directory/public-envelope/index.d.ts +0 -12
- package/dist/with-party/directory/public-envelope/schema.d.ts +0 -24
- package/dist/with-party/directory/public-envelope/storage.d.ts +0 -59
- package/dist/with-party/directory/public-envelope/types.d.ts +0 -80
- package/dist/withdraw-accessible-WZIEVWSR.js +0 -28
- /package/dist/{api-ZGS6LCOF.js.map → api-IQFZJSQO.js.map} +0 -0
- /package/dist/{backup-BJ57IKAO.js.map → backup-LU2DTZTI.js.map} +0 -0
- /package/dist/{chunk-EVVGJDRQ.js.map → chunk-2MUZ3LY6.js.map} +0 -0
- /package/dist/{chunk-NWSGI5C7.js.map → chunk-2P7EGNKF.js.map} +0 -0
- /package/dist/{chunk-ZAJAVEXY.js.map → chunk-2PCAVW2I.js.map} +0 -0
- /package/dist/{chunk-HTJQYHZP.js.map → chunk-3ELCWU56.js.map} +0 -0
- /package/dist/{chunk-J2ZX2XUV.js.map → chunk-3SV2EPMN.js.map} +0 -0
- /package/dist/{chunk-FUG4SFN3.js.map → chunk-3U3FBR7O.js.map} +0 -0
- /package/dist/{chunk-VFUPHI2Z.js.map → chunk-4BRCIYFG.js.map} +0 -0
- /package/dist/{chunk-SNZ6URZZ.js.map → chunk-5OI6BR4H.js.map} +0 -0
- /package/dist/{chunk-B3HJYUOF.js.map → chunk-5WZXVULX.js.map} +0 -0
- /package/dist/{chunk-LASZKVMO.js.map → chunk-6B4DYGWO.js.map} +0 -0
- /package/dist/{chunk-ZJ2AK4V7.js.map → chunk-6HPG2YNX.js.map} +0 -0
- /package/dist/{chunk-5M5DVGV7.js.map → chunk-6HY2X62D.js.map} +0 -0
- /package/dist/{chunk-QRB7NAOJ.js.map → chunk-6NQMXTYC.js.map} +0 -0
- /package/dist/{chunk-RIX4V2TB.js.map → chunk-6XE5TMPR.js.map} +0 -0
- /package/dist/{chunk-BDVFPG6Y.js.map → chunk-7CI6CP7Z.js.map} +0 -0
- /package/dist/{chunk-OSDB5WW3.js.map → chunk-BMQWTQZ4.js.map} +0 -0
- /package/dist/{chunk-W22IKJE2.js.map → chunk-BOKIKJJB.js.map} +0 -0
- /package/dist/{chunk-CRI4OUV4.js.map → chunk-CBSY2N76.js.map} +0 -0
- /package/dist/{chunk-2NVOWNI3.js.map → chunk-CCOP5XDW.js.map} +0 -0
- /package/dist/{chunk-CDUQTA3Z.js.map → chunk-DDATL6PU.js.map} +0 -0
- /package/dist/{chunk-RCVJZMFE.js.map → chunk-DDHM2TLX.js.map} +0 -0
- /package/dist/{chunk-PN2XMATY.js.map → chunk-DRWBEDYO.js.map} +0 -0
- /package/dist/{chunk-T2FFWNPK.js.map → chunk-EGCRBCNA.js.map} +0 -0
- /package/dist/{chunk-VZRODIM3.js.map → chunk-F6T6L2UK.js.map} +0 -0
- /package/dist/{chunk-EXK7QRWF.js.map → chunk-G6EQYAL6.js.map} +0 -0
- /package/dist/{chunk-F64IRYG3.js.map → chunk-GQNGCEP5.js.map} +0 -0
- /package/dist/{chunk-ZUODRVHY.js.map → chunk-GVZQ4NAM.js.map} +0 -0
- /package/dist/{chunk-3B5VVCNY.js.map → chunk-GWKAVKHI.js.map} +0 -0
- /package/dist/{chunk-SLFHQTTW.js.map → chunk-GYYCX5K6.js.map} +0 -0
- /package/dist/{chunk-CIE2BASH.js.map → chunk-HOONYZY2.js.map} +0 -0
- /package/dist/{chunk-EYZ6IQ6X.js.map → chunk-HPUWOVR7.js.map} +0 -0
- /package/dist/{chunk-IL6POWCW.js.map → chunk-IM3QVF53.js.map} +0 -0
- /package/dist/{chunk-NJ4EOKMB.js.map → chunk-IRQY7IR5.js.map} +0 -0
- /package/dist/{chunk-3QCRBHCY.js.map → chunk-ISMV2QVG.js.map} +0 -0
- /package/dist/{chunk-HB3RFQSC.js.map → chunk-IY23KFNZ.js.map} +0 -0
- /package/dist/{chunk-6CRIV7DE.js.map → chunk-JBBSYJHP.js.map} +0 -0
- /package/dist/{chunk-MEFJPTZ4.js.map → chunk-JRBNCUNT.js.map} +0 -0
- /package/dist/{chunk-4VNQOLML.js.map → chunk-JVBO4SZL.js.map} +0 -0
- /package/dist/{chunk-I6GALP6E.js.map → chunk-JZWWLLVY.js.map} +0 -0
- /package/dist/{chunk-RYCTDFUX.js.map → chunk-KUIB4B5Q.js.map} +0 -0
- /package/dist/{chunk-HDQIIUPH.js.map → chunk-KUPKLSX5.js.map} +0 -0
- /package/dist/{chunk-5O3XF4DV.js.map → chunk-KWVJAOIN.js.map} +0 -0
- /package/dist/{chunk-3LQ2YKO4.js.map → chunk-LB6OH6K2.js.map} +0 -0
- /package/dist/{chunk-AUSTCW2X.js.map → chunk-LOF2W3JU.js.map} +0 -0
- /package/dist/{chunk-K5IMOGHB.js.map → chunk-M75ZZHSR.js.map} +0 -0
- /package/dist/{chunk-GTGPO5KW.js.map → chunk-MQ6WOPSY.js.map} +0 -0
- /package/dist/{chunk-4CTHCN4J.js.map → chunk-MTQPRQHB.js.map} +0 -0
- /package/dist/{chunk-UNFPPVNI.js.map → chunk-N55W7KUL.js.map} +0 -0
- /package/dist/{chunk-JKJOGPZN.js.map → chunk-N6WF5PKC.js.map} +0 -0
- /package/dist/{chunk-6T2SCQRU.js.map → chunk-O7WJ47EF.js.map} +0 -0
- /package/dist/{chunk-JIF24JPM.js.map → chunk-OF75ACKS.js.map} +0 -0
- /package/dist/{chunk-GKEWXIV5.js.map → chunk-ONTBCHCP.js.map} +0 -0
- /package/dist/{chunk-4JBYV75E.js.map → chunk-PK6QCH2C.js.map} +0 -0
- /package/dist/{chunk-6QTNZJBS.js.map → chunk-PT37L5DV.js.map} +0 -0
- /package/dist/{chunk-EVX47VBM.js.map → chunk-QDPZWTN2.js.map} +0 -0
- /package/dist/{chunk-QLWMEXCT.js.map → chunk-RDXW3OBQ.js.map} +0 -0
- /package/dist/{chunk-Q5VNKNE5.js.map → chunk-RM2XV574.js.map} +0 -0
- /package/dist/{chunk-ERJ7FU55.js.map → chunk-RND5ZPNP.js.map} +0 -0
- /package/dist/{chunk-JZUV47FZ.js.map → chunk-RTEK4C4I.js.map} +0 -0
- /package/dist/{chunk-5YOLBEQ6.js.map → chunk-S6Q37VGE.js.map} +0 -0
- /package/dist/{chunk-E5ZQT5KX.js.map → chunk-SMIRGMS7.js.map} +0 -0
- /package/dist/{chunk-EQO2UVP4.js.map → chunk-T6GU5PPZ.js.map} +0 -0
- /package/dist/{chunk-LXEXBTKL.js.map → chunk-TAGR72IR.js.map} +0 -0
- /package/dist/{chunk-YFXZEAYK.js.map → chunk-TOPYT5U5.js.map} +0 -0
- /package/dist/{chunk-MV43JSJF.js.map → chunk-UBNCR3YK.js.map} +0 -0
- /package/dist/{chunk-ZICD77GM.js.map → chunk-UC2ETWF3.js.map} +0 -0
- /package/dist/{chunk-XWZVFISC.js.map → chunk-UFEVO57O.js.map} +0 -0
- /package/dist/{chunk-NR5LT5RY.js.map → chunk-UNCOC7QH.js.map} +0 -0
- /package/dist/{chunk-R4ROFEYC.js.map → chunk-VAIS3SOM.js.map} +0 -0
- /package/dist/{chunk-VN3DBQAU.js.map → chunk-VCBHAE4R.js.map} +0 -0
- /package/dist/{chunk-M4CV6BRT.js.map → chunk-VEALDPHW.js.map} +0 -0
- /package/dist/{chunk-7DSTRQIJ.js.map → chunk-WEYZTLXN.js.map} +0 -0
- /package/dist/{chunk-CAF6WOK7.js.map → chunk-WNGGJWF7.js.map} +0 -0
- /package/dist/{chunk-IU6SNYX6.js.map → chunk-YJV2UZ7H.js.map} +0 -0
- /package/dist/{chunk-RZ5SVOYR.js.map → chunk-YTGDPCPW.js.map} +0 -0
- /package/dist/{classified-marker-CZKA6ITE.js.map → classified-marker-WQVIJAW2.js.map} +0 -0
- /package/dist/{collection-facade-TLWIPI76.js.map → collection-facade-MJXSC3Q6.js.map} +0 -0
- /package/dist/{computed-ZIQTYTDI.js.map → computed-DSMPXG2Y.js.map} +0 -0
- /package/dist/{delegation-W7ZV2322.js.map → cover-B5SJDHR3.js.map} +0 -0
- /package/dist/{dead-filter-ESOBZZP5.js.map → dead-filter-2A7IAJ3D.js.map} +0 -0
- /package/dist/{derive-H2BJTLUI.js.map → delegation-A5A75KQO.js.map} +0 -0
- /package/dist/{enclave-AP3I5W7O.js.map → derive-HJSMH7RA.js.map} +0 -0
- /package/dist/{executor-KGWTNEQD.js.map → enclave-7MW6ZGXW.js.map} +0 -0
- /package/dist/{executor-OVEXR6RT.js.map → executor-AXE4XMLT.js.map} +0 -0
- /package/dist/{executor-UNEH5ZYH.js.map → executor-KGNLJD6M.js.map} +0 -0
- /package/dist/{export-accessible-PCMXSUZS.js.map → executor-XGIS6CR7.js.map} +0 -0
- /package/dist/{extract-partition-SWHFSYJO.js.map → export-accessible-VVBJM3MM.js.map} +0 -0
- /package/dist/{find-N6345CNT.js.map → extract-partition-LGGBTQET.js.map} +0 -0
- /package/dist/{fanout-sidecar-A765THMX.js.map → fanout-sidecar-WDYQ77VB.js.map} +0 -0
- /package/dist/{issue-5OKB6I2R.js.map → find-YS6XWB46.js.map} +0 -0
- /package/dist/{ledger-GFBKVPV4.js.map → issue-LSR5PS6H.js.map} +0 -0
- /package/dist/{liberate-3VDOT4KO.js.map → ledger-33BC4TR7.js.map} +0 -0
- /package/dist/{link-set-Z7Q2ASFX.js.map → liberate-GBSAYLPJ.js.map} +0 -0
- /package/dist/{noydb-ZCJOYBDI.js.map → link-set-QK22TDEX.js.map} +0 -0
- /package/dist/{policy-Z3RUAIY2.js.map → noydb-MTUBMWFE.js.map} +0 -0
- /package/dist/{public-envelope-B4KNWVUA.js.map → policy-NAHB2TUT.js.map} +0 -0
- /package/dist/{post-register-JTH76BLY.js.map → post-register-JVTMJ6OW.js.map} +0 -0
- /package/dist/{register-VAHONCID.js.map → register-X462DNDM.js.map} +0 -0
- /package/dist/{registry-7MLVD3VO.js.map → registry-3XMCT7MQ.js.map} +0 -0
- /package/dist/{registry-EPKPD5SM.js.map → registry-KHD2I3M2.js.map} +0 -0
- /package/dist/{registry-P5T7PS2U.js.map → registry-NPOWJHC4.js.map} +0 -0
- /package/dist/{request-withdrawal-TI3A5WPS.js.map → request-withdrawal-U7K3JTMY.js.map} +0 -0
- /package/dist/{reveal-DIBHLUZX.js.map → reveal-LGBOM2BO.js.map} +0 -0
- /package/dist/{revoke-FDRD6GRW.js.map → revoke-OCWDSWRQ.js.map} +0 -0
- /package/dist/{seed-Q6M2IZFL.js.map → seed-PWK45HDF.js.map} +0 -0
- /package/dist/{signer-MUWEIUI6.js.map → signer-3YFBLZRN.js.map} +0 -0
- /package/dist/{stale-OSQ7J3AA.js.map → stale-FJED42DM.js.map} +0 -0
- /package/dist/{storage-MVFCGEQE.js.map → storage-W3GURVFU.js.map} +0 -0
- /package/dist/{store-coordination-provider-64OEZFGS.js.map → store-coordination-provider-APODTV4W.js.map} +0 -0
- /package/dist/{verify-ZASTRNPR.js.map → verify-26Y5GNMK.js.map} +0 -0
- /package/dist/{walk-SVNDIZ62.js.map → walk-XS3PKM6I.js.map} +0 -0
- /package/dist/{withdraw-accessible-WZIEVWSR.js.map → withdraw-accessible-Y3B2535F.js.map} +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openEnvelopeJson
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DVUZMT2W.js";
|
|
4
4
|
import {
|
|
5
5
|
encrypt
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HOONYZY2.js";
|
|
7
7
|
import {
|
|
8
8
|
NOYDB_FORMAT_VERSION
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LSASLXGC.js";
|
|
10
10
|
import {
|
|
11
11
|
ConflictError,
|
|
12
12
|
USER_ENVELOPE_COLLECTION,
|
|
13
13
|
USER_ENVELOPE_MAX_BYTES,
|
|
14
14
|
UserEnvelopeOversizedError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-W2OG6JOL.js";
|
|
16
16
|
|
|
17
17
|
// src/with-party/directory/storage.ts
|
|
18
18
|
var META_COLLECTION = "_meta";
|
|
@@ -147,4 +147,4 @@ export {
|
|
|
147
147
|
deleteUserEnvelope,
|
|
148
148
|
listUserEnvelopeIds
|
|
149
149
|
};
|
|
150
|
-
//# sourceMappingURL=chunk-
|
|
150
|
+
//# sourceMappingURL=chunk-PK6QCH2C.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hasExportCapability,
|
|
3
3
|
hasImportCapability
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3SV2EPMN.js";
|
|
5
5
|
import {
|
|
6
6
|
ExportCapabilityError,
|
|
7
7
|
ImportCapabilityError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-W2OG6JOL.js";
|
|
9
9
|
|
|
10
10
|
// src/port/with/capabilities.ts
|
|
11
11
|
function assertCanExport(keyring, tier, format) {
|
|
@@ -252,4 +252,4 @@ export {
|
|
|
252
252
|
ServiceBus,
|
|
253
253
|
SubsystemBus
|
|
254
254
|
};
|
|
255
|
-
//# sourceMappingURL=chunk-
|
|
255
|
+
//# sourceMappingURL=chunk-PT37L5DV.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
linkI18nVia
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GULTLPFB.js";
|
|
4
4
|
|
|
5
5
|
// src/via/i18n/dictionary.ts
|
|
6
6
|
function dictKey(name, keysOrMap, opts) {
|
|
@@ -71,4 +71,4 @@ export {
|
|
|
71
71
|
dictKey,
|
|
72
72
|
staticDict
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
74
|
+
//# sourceMappingURL=chunk-QDPZWTN2.js.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readPath
|
|
3
|
+
} from "./chunk-IGJCYUT5.js";
|
|
4
|
+
import {
|
|
5
|
+
DanglingReferenceError,
|
|
6
|
+
JoinTooLargeError
|
|
7
|
+
} from "./chunk-W2OG6JOL.js";
|
|
8
|
+
|
|
9
|
+
// src/kernel/query/join.ts
|
|
10
|
+
var DEFAULT_JOIN_MAX_ROWS = 5e4;
|
|
11
|
+
var JOIN_WARN_FRACTION = 0.8;
|
|
12
|
+
function coerceRefKey(value) {
|
|
13
|
+
if (value === null || value === void 0) return null;
|
|
14
|
+
if (typeof value === "string") return value;
|
|
15
|
+
if (typeof value === "number" || typeof value === "bigint") return String(value);
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
var warnedDanglingKeys = /* @__PURE__ */ new Set();
|
|
19
|
+
function warnOnceDangling(field, target, refId) {
|
|
20
|
+
const key = `${field}\u2192${target}:${refId}`;
|
|
21
|
+
if (warnedDanglingKeys.has(key)) return;
|
|
22
|
+
warnedDanglingKeys.add(key);
|
|
23
|
+
console.warn(
|
|
24
|
+
`[noy-db] .join() encountered dangling ref in 'warn' mode: field "${field}" \u2192 "${target}:${refId}" not found. Attaching null.`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
var warnedCeilingKeys = /* @__PURE__ */ new Set();
|
|
28
|
+
function warnCeilingApproaching(target, side, rows, maxRows) {
|
|
29
|
+
const key = `${target}:${side}`;
|
|
30
|
+
if (warnedCeilingKeys.has(key)) return;
|
|
31
|
+
warnedCeilingKeys.add(key);
|
|
32
|
+
const pct = Math.round(rows / maxRows * 100);
|
|
33
|
+
console.warn(
|
|
34
|
+
`[noy-db] .join() ${side} side is at ${pct}% of the ${maxRows}-row ceiling for target "${target}" (${rows} rows). Streaming joins over scan() are not yet supported for collections that need to exceed this.`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function applyJoins(rows, joins, context, locale) {
|
|
38
|
+
if (joins.length === 0) return [...rows];
|
|
39
|
+
let result = [...rows];
|
|
40
|
+
for (const leg of joins) {
|
|
41
|
+
result = applyOneJoin(result, leg, context, locale);
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
function applyOneJoin(leftRows, leg, context, locale) {
|
|
46
|
+
if (leg.isDictJoin) {
|
|
47
|
+
const dictSource = context.resolveDictSource?.(leg.field);
|
|
48
|
+
if (!dictSource) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`.join() field "${leg.field}" on "${context.leftCollection}" is declared as a dictKey join but the dict source could not be resolved. Ensure the dictionary has at least one entry.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const out = [];
|
|
54
|
+
const snapshot = dictSource.snapshot();
|
|
55
|
+
const dictMap = /* @__PURE__ */ new Map();
|
|
56
|
+
for (const entry of snapshot) {
|
|
57
|
+
const k = readPath(entry, "key");
|
|
58
|
+
if (typeof k === "string") dictMap.set(k, entry);
|
|
59
|
+
}
|
|
60
|
+
for (const left of leftRows) {
|
|
61
|
+
const rawId = readPath(left, leg.field);
|
|
62
|
+
const key = coerceRefKey(rawId);
|
|
63
|
+
const dictEntry = key === null ? void 0 : dictMap.get(key);
|
|
64
|
+
out.push({ ...left, [leg.as]: dictEntry ?? null });
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
const source = context.resolveSource(leg.target);
|
|
69
|
+
if (!source) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`.join() cannot resolve target collection "${leg.target}" (referenced from field "${leg.field}" on "${context.leftCollection}"). Make sure the target collection has been opened via vault.collection() at least once before running the query.`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const maxRows = leg.maxRows ?? DEFAULT_JOIN_MAX_ROWS;
|
|
75
|
+
if (leftRows.length > maxRows) {
|
|
76
|
+
throw new JoinTooLargeError({
|
|
77
|
+
leftRows: leftRows.length,
|
|
78
|
+
rightRows: -1,
|
|
79
|
+
maxRows,
|
|
80
|
+
side: "left",
|
|
81
|
+
message: `.join() left side has ${leftRows.length} rows, exceeding the ${maxRows}-row ceiling for target "${leg.target}". Filter the left side further with where()/limit() before joining, or raise the ceiling via { maxRows }. Streaming joins over scan() are not yet supported.`
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (leftRows.length > maxRows * JOIN_WARN_FRACTION) {
|
|
85
|
+
warnCeilingApproaching(leg.target, "left", leftRows.length, maxRows);
|
|
86
|
+
}
|
|
87
|
+
const rightSnapshot = source.snapshot();
|
|
88
|
+
if (rightSnapshot.length > maxRows) {
|
|
89
|
+
throw new JoinTooLargeError({
|
|
90
|
+
leftRows: leftRows.length,
|
|
91
|
+
rightRows: rightSnapshot.length,
|
|
92
|
+
maxRows,
|
|
93
|
+
side: "right",
|
|
94
|
+
message: `.join() right side "${leg.target}" has ${rightSnapshot.length} rows, exceeding the ${maxRows}-row ceiling. Raise the ceiling via { maxRows } if the data genuinely fits in memory, or track for streaming joins.`
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (rightSnapshot.length > maxRows * JOIN_WARN_FRACTION) {
|
|
98
|
+
warnCeilingApproaching(leg.target, "right", rightSnapshot.length, maxRows);
|
|
99
|
+
}
|
|
100
|
+
const effLocale = locale ?? context.defaultLocale;
|
|
101
|
+
const presentResolve = effLocale !== void 0 && source.presentForJoin !== void 0 ? (right) => right !== null && typeof right === "object" ? source.presentForJoin(right, effLocale) : right : void 0;
|
|
102
|
+
const strategy = leg.strategy ?? (source.lookupById ? "nested" : "hash");
|
|
103
|
+
if (strategy === "nested" && source.lookupById) {
|
|
104
|
+
const lookup = (id) => source.lookupById?.(id);
|
|
105
|
+
return nestedLoopJoin(leftRows, leg, lookup, presentResolve);
|
|
106
|
+
}
|
|
107
|
+
return hashJoin(leftRows, leg, rightSnapshot, presentResolve);
|
|
108
|
+
}
|
|
109
|
+
function nestedLoopJoin(leftRows, leg, lookupById, presentResolve) {
|
|
110
|
+
const out = [];
|
|
111
|
+
for (const left of leftRows) {
|
|
112
|
+
const rawId = readPath(left, leg.field);
|
|
113
|
+
const key = coerceRefKey(rawId);
|
|
114
|
+
let right = key === null ? void 0 : lookupById(key);
|
|
115
|
+
if (presentResolve && right !== void 0) right = presentResolve(right);
|
|
116
|
+
out.push(attachJoin(left, leg, right, rawId));
|
|
117
|
+
}
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
function hashJoin(leftRows, leg, rightSnapshot, presentResolve) {
|
|
121
|
+
const rightMap = /* @__PURE__ */ new Map();
|
|
122
|
+
for (const record of rightSnapshot) {
|
|
123
|
+
const rawId = readPath(record, "id");
|
|
124
|
+
const key = coerceRefKey(rawId);
|
|
125
|
+
if (key !== null) {
|
|
126
|
+
rightMap.set(key, record);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const out = [];
|
|
130
|
+
for (const left of leftRows) {
|
|
131
|
+
const rawId = readPath(left, leg.field);
|
|
132
|
+
const key = coerceRefKey(rawId);
|
|
133
|
+
let right = key === null ? void 0 : rightMap.get(key);
|
|
134
|
+
if (presentResolve && right !== void 0) right = presentResolve(right);
|
|
135
|
+
out.push(attachJoin(left, leg, right, rawId));
|
|
136
|
+
}
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
function attachJoin(left, leg, right, rawId) {
|
|
140
|
+
if (left === null || typeof left !== "object") {
|
|
141
|
+
return left;
|
|
142
|
+
}
|
|
143
|
+
const merged = { ...left };
|
|
144
|
+
const refKey = coerceRefKey(rawId);
|
|
145
|
+
if (right === void 0) {
|
|
146
|
+
if (refKey !== null && leg.mode === "strict") {
|
|
147
|
+
throw new DanglingReferenceError({
|
|
148
|
+
field: leg.field,
|
|
149
|
+
target: leg.target,
|
|
150
|
+
refId: refKey,
|
|
151
|
+
message: `.join() strict dangling: record references "${leg.target}:${refKey}" via field "${leg.field}", but no such record exists. Use ref() mode 'warn' or 'cascade' if dangling refs are acceptable, or run vault.checkIntegrity() to find and fix the orphans.`
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (refKey !== null && leg.mode === "warn") {
|
|
155
|
+
warnOnceDangling(leg.field, leg.target, refKey);
|
|
156
|
+
}
|
|
157
|
+
merged[leg.as] = null;
|
|
158
|
+
} else {
|
|
159
|
+
merged[leg.as] = right;
|
|
160
|
+
}
|
|
161
|
+
return merged;
|
|
162
|
+
}
|
|
163
|
+
function resetJoinWarnings() {
|
|
164
|
+
warnedDanglingKeys.clear();
|
|
165
|
+
warnedCeilingKeys.clear();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
DEFAULT_JOIN_MAX_ROWS,
|
|
170
|
+
applyJoins,
|
|
171
|
+
resetJoinWarnings
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=chunk-RA5VTXXG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kernel/query/join.ts"],"sourcesContent":["/**\n * Query DSL `.join()` — eager, single-FK, intra-vault joins.\n *\n * resolves a ref()-declared foreign key into an attached\n * right-side record under an alias, using one of two planner paths\n * selected automatically:\n *\n * - **nested-loop** — right-side source exposes `lookupById`, so\n * each left row costs O(1). This is the common path for joins\n * against a Collection, which backs `lookupById` with a Map\n * lookup.\n * - **hash** — right-side has only `snapshot()`. Build a\n * `Map<id, record>` once, probe per left row. Same asymptotic\n * cost for our collections, but the path exists as a fallback\n * for custom QuerySource implementations and as an explicit\n * test-only override via `{ strategy: 'hash' }`.\n *\n * Scope:\n *\n * - Equi-joins on declared `ref()` fields only. Joins on\n * undeclared fields throw at plan time with an actionable error\n * naming the field and collection.\n * - Same-vault only. Cross-vault correlation goes\n * through `queryAcross`; this is an architectural\n * invariant, not a limitation we plan to lift.\n * - Hard row ceiling via `JoinTooLargeError` — default 50k per\n * side, override via `{ maxRows }`. Warns at 80% of the ceiling\n * on the existing warn channel.\n * - Three ref-mode behaviors on dangling refs:\n * strict → `DanglingReferenceError`,\n * warn → attach `null` with a one-shot warning,\n * cascade → attach `null` silently (cascade is a delete-time\n * mode; any dangling refs still present at read time are\n * mid-flight cascades or orphans from earlier, not a DSL error).\n *\n * Partition-awareness seam:\n *\n * Every `JoinLeg` carries a `partitionScope` field that is always\n * `'all'` in. The executor never reads this field.\n * partition-aware joins will start populating it from `where()`\n * predicates on the partition key without changing the planner's\n * external shape — this is the whole reason it exists now.\n *\n * Joins stay OUT of the ledger: reads don't touch `_ledger/`,\n * including joined reads.\n */\n\nimport type { RefDescriptor, RefMode } from '../refs.js'\nimport { readPath } from './predicate.js'\nimport { JoinTooLargeError, DanglingReferenceError } from '../errors.js'\n\n/** Planner strategy for a single join leg. Auto-selected unless overridden. */\nexport type JoinStrategy = 'hash' | 'nested'\n\n/** Default per-side row ceiling before `.join()` throws `JoinTooLargeError`. */\nexport const DEFAULT_JOIN_MAX_ROWS = 50_000\n\n/**\n * Fraction of the row ceiling at which a one-shot warning is emitted.\n * At 80% we warn; at 100% we throw. The warn gives consumers a\n * heads-up before the hard error so they can raise the ceiling or\n * filter further without first hitting a broken query.\n */\nconst JOIN_WARN_FRACTION = 0.8\n\n/**\n * Internal representation of a single join leg in the query plan.\n *\n * This is the primary place where constraint #1 is honored:\n * every leg carries a `partitionScope` field that is always `'all'`\n * in and is never read by the executor. partition-aware\n * joins will start populating it from `where()` predicates on the\n * partition key without changing the planner's external shape.\n */\nexport interface JoinLeg {\n /** Field on the left-side record holding the foreign key value. */\n readonly field: string\n /** Alias key under which the joined right-side record attaches. */\n readonly as: string\n /** Target collection name, resolved from the `ref()` declaration. */\n readonly target: string\n /** Ref mode controlling behavior on dangling refs at read time. */\n readonly mode: RefMode\n /** Manual planner strategy override. `undefined` → auto-select. */\n readonly strategy: JoinStrategy | undefined\n /** Per-side row ceiling override. `undefined` → DEFAULT_JOIN_MAX_ROWS. */\n readonly maxRows: number | undefined\n /**\n * Partition scope for future partition-aware joins. Always `'all'`\n * today — the executor never reads this field. Future versions will\n * populate it from `where()` predicates without breaking the\n * planner's external shape. Do not remove even though it looks\n * unused today — that's the whole point of having it.\n */\n readonly partitionScope: 'all' | readonly string[]\n /**\n * When `true`, this is a dictionary join. The executor\n * resolves the left-field value against the dict snapshot and\n * attaches `{ ...labels, key }` rather than a right-side record.\n * `target` holds the dictionary name (not a collection name).\n */\n readonly isDictJoin?: true\n}\n\n/**\n * Minimal shape of a joinable right-side record source.\n *\n * Collections implement this structurally via their `QuerySource`;\n * sources without `lookupById` force the hash-join fallback. Kept as\n * a thin interface so tests can wire up plain-object sources without\n * pulling in the full Collection class.\n *\n * The optional `subscribe` is used by `Query.live()` to merge\n * right-side change streams into the live re-run trigger. Sources\n * that omit `subscribe` still work for live joins — they just\n * don't drive re-fires when their right side mutates. Collection\n * implements `subscribe` by hooking into the existing per-\n * vault event emitter.\n */\nexport interface JoinableSource {\n snapshot(): readonly unknown[]\n lookupById?(id: string): unknown\n /**\n * Default locale a label-resolving query falls back to when the query\n * itself is locale-less. Set by a `staticDict()`-backed source from its\n * `displayLocale` so `{ by: 'label' }` resolves under a locale-less read.\n * Plain `_dict_*`-backed sources omit it.\n */\n readonly displayLocale?: string\n /**\n * Sync present-for-join dressing (#626 retirement, #650 Task 6) — when\n * present and the query carries a locale, each joined right-side record\n * is passed through this hook (built by the right-side `Collection` from\n * its own i18n-text + lookup-label bindings) BEFORE it is attached under\n * the leg's alias — so a joined `i18nText` field resolves to a string\n * (not a raw `{ locale }` map) and a joined lookup field gains its\n * `<field>Label`. Locale-less queries leave joined fields raw\n * (consistent with a locale-less read). Replaces the old `i18nFields`\n * data field — the join executor no longer resolves i18n locale itself,\n * it just calls this hook.\n */\n readonly presentForJoin?: (record: unknown, locale: string) => unknown\n /**\n * Subscribe to mutations on this source. The callback fires\n * AFTER the underlying record set has been updated. Returns an\n * unsubscribe function. Optional — sources without this method\n * cannot trigger live-join re-fires from their side.\n */\n subscribe?(cb: () => void): () => void\n}\n\n/**\n * Join resolution context attached to a `Query` when it's constructed\n * from a `Collection`. Holds everything the `.join()` method needs to\n * translate a field name into a target collection + ref mode, and\n * everything the executor needs to read the right side.\n *\n * Kept as a structural interface so `Vault` can implement it\n * without `Query` needing to import `Vault` (circular-import\n * avoid). The Collection wires this up in its `query()` method using\n * the `joinResolver` back-reference the Vault passes in.\n */\nexport interface JoinContext {\n /** Name of the left-side (owning) collection. */\n readonly leftCollection: string\n /**\n * The owning collection's default locale. Used to resolve joined\n * i18n fields at the `join` layer when a terminal call doesn't pass an\n * explicit locale — so `openVault({ locale })` flows to joins like it does\n * to `get`/`list`. A per-call `toArray({ locale })` overrides it.\n */\n readonly defaultLocale?: string\n /** Look up a `RefDescriptor` by field name on the left collection. */\n resolveRef(field: string): RefDescriptor | null\n /** Resolve a right-side source by target collection name. */\n resolveSource(collectionName: string): JoinableSource | null\n /**\n * Resolve a dictKey join source. Returns a `JoinableSource`\n * whose snapshot exposes `{ key, ...labels }` records, keyed by the\n * stable dictionary key. `null` when the field is not a dictKey.\n *\n * The source is built from the compartment's in-memory dictionary\n * snapshot — same data as `DictionaryHandle.list()`, O(1) per lookup.\n */\n resolveDictSource?(field: string): JoinableSource | null\n}\n\n/**\n * Coerce an unknown FK value into a lookup key string.\n *\n * Legitimate ref values are strings or numbers — the same narrowing\n * the write-time `enforceRefsOnPut` path applies. Anything else\n * (objects, arrays, booleans, null, undefined) is treated as \"no\n * ref\" and returns `null`, so the join attaches `null` instead of\n * running `String({})` and producing `'[object Object]'` as a\n * bucket key. This matches the lint rule guidance and keeps\n * bizarre FK values from producing silently-wrong lookups.\n */\nfunction coerceRefKey(value: unknown): string | null {\n if (value === null || value === undefined) return null\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'bigint') return String(value)\n return null\n}\n\n/**\n * Warn-channel deduplication for dangling-ref `'warn'` mode. Keyed\n * by `field → target:refId` so the same dangling ref only produces\n * one warning even across many rows or repeated queries.\n */\nconst warnedDanglingKeys = new Set<string>()\nfunction warnOnceDangling(field: string, target: string, refId: string): void {\n const key = `${field}→${target}:${refId}`\n if (warnedDanglingKeys.has(key)) return\n warnedDanglingKeys.add(key)\n console.warn(\n `[noy-db] .join() encountered dangling ref in 'warn' mode: ` +\n `field \"${field}\" → \"${target}:${refId}\" not found. Attaching null.`,\n )\n}\n\n/**\n * Track row-ceiling warnings to fire only once per (target, side).\n * Prevents per-query spam when a consumer is running the same query\n * repeatedly (e.g. in a reactive loop).\n */\nconst warnedCeilingKeys = new Set<string>()\nfunction warnCeilingApproaching(\n target: string,\n side: 'left' | 'right',\n rows: number,\n maxRows: number,\n): void {\n const key = `${target}:${side}`\n if (warnedCeilingKeys.has(key)) return\n warnedCeilingKeys.add(key)\n const pct = Math.round((rows / maxRows) * 100)\n console.warn(\n `[noy-db] .join() ${side} side is at ${pct}% of the ${maxRows}-row ` +\n `ceiling for target \"${target}\" (${rows} rows). Streaming joins over ` +\n `scan() are not yet supported for collections that need to exceed this.`,\n )\n}\n\n/**\n * Apply every join leg in the plan against a base set of left-side\n * rows. Called by the query executor after `where` / `orderBy` /\n * `offset` / `limit` have narrowed the left set.\n *\n * Each leg attaches a `leg.as` field to every row. Returns a new\n * array of plain objects — the original left rows are not mutated\n * (structural sharing is fine for the inner fields, but the\n * top-level object is a fresh clone so consumers can further mutate\n * safely).\n *\n * **Ordering:** joins run AFTER orderBy / limit / offset in v1.\n * This keeps the planner simple and means queries like \"top 10\n * invoices with client\" sort and paginate the left side first, then\n * join. Sorting *by* a joined field is out of scope for — users\n * can post-sort the result array in userland or wait for \n * (multi-FK chaining) which can be layered on top.\n *\n * **Multi-FK chaining:** each leg's `maxRows` is enforced\n * against the current left-row count independently. Because\n * joins are equi-joins on the target's primary key (one-to-one or\n * one-to-null), the left row count is constant across legs — no\n * cartesian blowup. The per-leg left-side check is still necessary\n * so that a later leg with a tighter ceiling correctly fires on a\n * query like `.join('a', { maxRows: 100_000 }).join('b', { maxRows: 50 })`,\n * which should throw on the second leg if the left set exceeds 50.\n */\nexport function applyJoins(\n rows: readonly unknown[],\n joins: readonly JoinLeg[],\n context: JoinContext,\n locale?: string,\n): unknown[] {\n if (joins.length === 0) return [...rows]\n\n let result: unknown[] = [...rows]\n for (const leg of joins) {\n result = applyOneJoin(result, leg, context, locale)\n }\n return result\n}\n\nfunction applyOneJoin(\n leftRows: readonly unknown[],\n leg: JoinLeg,\n context: JoinContext,\n locale?: string,\n): unknown[] {\n // Dict join path — resolve left-field value against the\n // dictionary snapshot and attach { key, ...labels } under leg.as.\n if (leg.isDictJoin) {\n const dictSource = context.resolveDictSource?.(leg.field)\n if (!dictSource) {\n throw new Error(\n `.join() field \"${leg.field}\" on \"${context.leftCollection}\" is declared as a ` +\n `dictKey join but the dict source could not be resolved. ` +\n `Ensure the dictionary has at least one entry.`,\n )\n }\n const out: unknown[] = []\n const snapshot = dictSource.snapshot()\n const dictMap = new Map<string, unknown>()\n for (const entry of snapshot) {\n const k = readPath(entry, 'key')\n if (typeof k === 'string') dictMap.set(k, entry)\n }\n for (const left of leftRows) {\n const rawId = readPath(left, leg.field)\n const key = coerceRefKey(rawId)\n const dictEntry = key === null ? undefined : dictMap.get(key)\n out.push({ ...(left as Record<string, unknown>), [leg.as]: dictEntry ?? null })\n }\n return out\n }\n\n const source = context.resolveSource(leg.target)\n if (!source) {\n throw new Error(\n `.join() cannot resolve target collection \"${leg.target}\" ` +\n `(referenced from field \"${leg.field}\" on \"${context.leftCollection}\"). ` +\n `Make sure the target collection has been opened via vault.collection() ` +\n `at least once before running the query.`,\n )\n }\n\n const maxRows = leg.maxRows ?? DEFAULT_JOIN_MAX_ROWS\n\n // Per-leg left-side ceiling check. In a\n // multi-FK chain, each leg's `maxRows` is enforced independently\n // against the current left-row count, so\n // `.join('a', { maxRows: 100_000 }).join('b', { maxRows: 50 })`\n // correctly throws on the second leg if the left set exceeds 50.\n if (leftRows.length > maxRows) {\n throw new JoinTooLargeError({\n leftRows: leftRows.length,\n rightRows: -1,\n maxRows,\n side: 'left',\n message:\n `.join() left side has ${leftRows.length} rows, exceeding the ${maxRows}-row ` +\n `ceiling for target \"${leg.target}\". Filter the left side further with ` +\n `where()/limit() before joining, or raise the ceiling via { maxRows }. ` +\n `Streaming joins over scan() are not yet supported.`,\n })\n }\n if (leftRows.length > maxRows * JOIN_WARN_FRACTION) {\n warnCeilingApproaching(leg.target, 'left', leftRows.length, maxRows)\n }\n\n const rightSnapshot = source.snapshot()\n if (rightSnapshot.length > maxRows) {\n throw new JoinTooLargeError({\n leftRows: leftRows.length,\n rightRows: rightSnapshot.length,\n maxRows,\n side: 'right',\n message:\n `.join() right side \"${leg.target}\" has ${rightSnapshot.length} rows, ` +\n `exceeding the ${maxRows}-row ceiling. Raise the ceiling via { maxRows } ` +\n `if the data genuinely fits in memory, or track for streaming joins.`,\n })\n }\n if (rightSnapshot.length > maxRows * JOIN_WARN_FRACTION) {\n warnCeilingApproaching(leg.target, 'right', rightSnapshot.length, maxRows)\n }\n\n // `join`-layer dressing (#650 Task 6, #626 retirement). When the query\n // carries a locale (per-call or the owning collection's default) and the\n // right side declares a `presentForJoin` hook, resolve each matched right\n // record through it before it's attached. Locale-less → leave raw.\n const effLocale = locale ?? context.defaultLocale\n const presentResolve: ((right: unknown) => unknown) | undefined =\n effLocale !== undefined && source.presentForJoin !== undefined\n ? (right) =>\n right !== null && typeof right === 'object'\n ? source.presentForJoin!(right, effLocale)\n : right\n : undefined\n\n // Strategy selection: explicit override wins; otherwise prefer\n // nested-loop when the source exposes lookupById (O(1) per row),\n // falling back to hash join when it doesn't.\n const strategy: JoinStrategy =\n leg.strategy ?? (source.lookupById ? 'nested' : 'hash')\n\n if (strategy === 'nested' && source.lookupById) {\n // Bind through an arrow so the `this` context of lookupById\n // doesn't drift — same pattern as the existing candidateRecords\n // helper in builder.ts.\n const lookup = (id: string): unknown => source.lookupById?.(id)\n return nestedLoopJoin(leftRows, leg, lookup, presentResolve)\n }\n return hashJoin(leftRows, leg, rightSnapshot, presentResolve)\n}\n\nfunction nestedLoopJoin(\n leftRows: readonly unknown[],\n leg: JoinLeg,\n lookupById: (id: string) => unknown,\n presentResolve?: (right: unknown) => unknown,\n): unknown[] {\n const out: unknown[] = []\n for (const left of leftRows) {\n const rawId = readPath(left, leg.field)\n const key = coerceRefKey(rawId)\n let right = key === null ? undefined : lookupById(key)\n if (presentResolve && right !== undefined) right = presentResolve(right)\n out.push(attachJoin(left, leg, right, rawId))\n }\n return out\n}\n\nfunction hashJoin(\n leftRows: readonly unknown[],\n leg: JoinLeg,\n rightSnapshot: readonly unknown[],\n presentResolve?: (right: unknown) => unknown,\n): unknown[] {\n // Build the right-side hash once per query execution. We key on\n // the `id` field because ref() always points to a target's primary\n // key — non-equi and non-id joins are out of scope for.\n const rightMap = new Map<string, unknown>()\n for (const record of rightSnapshot) {\n const rawId = readPath(record, 'id')\n const key = coerceRefKey(rawId)\n if (key !== null) {\n rightMap.set(key, record)\n }\n }\n const out: unknown[] = []\n for (const left of leftRows) {\n const rawId = readPath(left, leg.field)\n const key = coerceRefKey(rawId)\n let right = key === null ? undefined : rightMap.get(key)\n if (presentResolve && right !== undefined) right = presentResolve(right)\n out.push(attachJoin(left, leg, right, rawId))\n }\n return out\n}\n\n/**\n * Attach the resolved right-side record (or null) to the left row\n * under the alias, applying ref-mode semantics for the dangling\n * case.\n *\n * A left-side record whose FK field is null/undefined is NOT a\n * dangling ref — it's \"no reference at all\", which is always\n * allowed regardless of mode. This matches the write-time\n * `enforceRefsOnPut` behavior: \"Nullish ref values are allowed —\n * treat them as 'no reference'.\"\n *\n * Only non-null FKs pointing at non-existent targets trigger the\n * mode behavior.\n */\nfunction attachJoin(\n left: unknown,\n leg: JoinLeg,\n right: unknown,\n rawId: unknown,\n): unknown {\n if (left === null || typeof left !== 'object') {\n // Pathological input — return as-is. Shouldn't happen in\n // practice because QuerySource yields objects, but defensive\n // because plan execution is untyped at this layer.\n return left\n }\n const merged: Record<string, unknown> = { ...(left as Record<string, unknown>) }\n\n // \"No ref at all\" — null/undefined FK value, or a non-string/non-\n // number FK that coerceRefKey treated as no-ref. Never throws\n // regardless of mode; matches the write-time policy that nullish\n // refs are allowed.\n const refKey = coerceRefKey(rawId)\n if (right === undefined) {\n if (refKey !== null && leg.mode === 'strict') {\n throw new DanglingReferenceError({\n field: leg.field,\n target: leg.target,\n refId: refKey,\n message:\n `.join() strict dangling: record references \"${leg.target}:${refKey}\" ` +\n `via field \"${leg.field}\", but no such record exists. Use ref() mode 'warn' ` +\n `or 'cascade' if dangling refs are acceptable, or run ` +\n `vault.checkIntegrity() to find and fix the orphans.`,\n })\n }\n if (refKey !== null && leg.mode === 'warn') {\n warnOnceDangling(leg.field, leg.target, refKey)\n }\n // For 'cascade' and null refs we attach null silently. Cascade\n // is a delete-time mode; any dangling refs visible at read time\n // are either mid-flight or pre-existing orphans, not a DSL error.\n merged[leg.as] = null\n } else {\n merged[leg.as] = right\n }\n return merged\n}\n\n/**\n * Test-only: reset the join warning deduplication state between\n * tests. Production code never calls this — the dedup state is\n * intentionally process-scoped so a noisy query doesn't spam the\n * console once per component render.\n */\nexport function resetJoinWarnings(): void {\n warnedDanglingKeys.clear()\n warnedCeilingKeys.clear()\n}\n"],"mappings":";;;;;;;;;AAuDO,IAAM,wBAAwB;AAQrC,IAAM,qBAAqB;AAuI3B,SAAS,aAAa,OAA+B;AACnD,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,SAAU,QAAO,OAAO,KAAK;AAC/E,SAAO;AACT;AAOA,IAAM,qBAAqB,oBAAI,IAAY;AAC3C,SAAS,iBAAiB,OAAe,QAAgB,OAAqB;AAC5E,QAAM,MAAM,GAAG,KAAK,SAAI,MAAM,IAAI,KAAK;AACvC,MAAI,mBAAmB,IAAI,GAAG,EAAG;AACjC,qBAAmB,IAAI,GAAG;AAC1B,UAAQ;AAAA,IACN,oEACY,KAAK,aAAQ,MAAM,IAAI,KAAK;AAAA,EAC1C;AACF;AAOA,IAAM,oBAAoB,oBAAI,IAAY;AAC1C,SAAS,uBACP,QACA,MACA,MACA,SACM;AACN,QAAM,MAAM,GAAG,MAAM,IA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Q,IAAI;AAAA,QACZ,OAAO;AAAA,QACP,SACE,+CAA+C,IAAI,MAAM,IAAI,MAAM,gBACrD,IAAI,KAAK;AAAA,MAG3B,CAAC;AAAA,IACH;AACA,QAAI,WAAW,QAAQ,IAAI,SAAS,QAAQ;AAC1C,uBAAiB,IAAI,OAAO,IAAI,QAAQ,MAAM;AAAA,IAChD;AAIA,WAAO,IAAI,EAAE,IAAI;AAAA,EACnB,OAAO;AACL,WAAO,IAAI,EAAE,IAAI;AAAA,EACnB;AACA,SAAO;AACT;AAQO,SAAS,oBAA0B;AACxC,qBAAmB,MAAM;AACzB,oBAAkB,MAAM;AAC1B;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SealedRecordNotEnabledError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W2OG6JOL.js";
|
|
4
4
|
|
|
5
5
|
// src/with-audit/sealed-record/strategy.ts
|
|
6
6
|
var NO_SEALED_RECORD = {
|
|
@@ -18,4 +18,4 @@ var NO_SEALED_RECORD = {
|
|
|
18
18
|
export {
|
|
19
19
|
NO_SEALED_RECORD
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-RDXW3OBQ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
envelopeBodyForHash
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DVUZMT2W.js";
|
|
4
4
|
import {
|
|
5
5
|
sha256Hex
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HOONYZY2.js";
|
|
7
7
|
|
|
8
8
|
// src/with-commit/history/ledger/entry.ts
|
|
9
9
|
function canonicalJson(value) {
|
|
@@ -67,4 +67,4 @@ export {
|
|
|
67
67
|
parseIndex,
|
|
68
68
|
envelopePayloadHash
|
|
69
69
|
};
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-RM2XV574.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadVaultPolicy,
|
|
3
3
|
saveVaultPolicy
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CBSY2N76.js";
|
|
5
5
|
import {
|
|
6
6
|
PolicyDeniedError,
|
|
7
7
|
ValidationError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-W2OG6JOL.js";
|
|
9
9
|
|
|
10
10
|
// src/with-party/policy/presets.ts
|
|
11
11
|
var PERSONAL_POLICY = Object.freeze({
|
|
@@ -364,4 +364,4 @@ export {
|
|
|
364
364
|
describeGate,
|
|
365
365
|
createNoydbPolicy
|
|
366
366
|
};
|
|
367
|
-
//# sourceMappingURL=chunk-
|
|
367
|
+
//# sourceMappingURL=chunk-RND5ZPNP.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NoydbError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W2OG6JOL.js";
|
|
4
4
|
|
|
5
5
|
// src/with-shape/links/names.ts
|
|
6
6
|
var LINK_COLLECTION_PREFIX = "_links_";
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
linkRowKey,
|
|
39
39
|
LinkIntegrityError
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-RTEK4C4I.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sha256Hex
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HOONYZY2.js";
|
|
4
4
|
import {
|
|
5
5
|
MaterializedViewSourceUnknownError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-W2OG6JOL.js";
|
|
7
7
|
|
|
8
8
|
// src/with-formula/materialized-views/dependency-analyzer.ts
|
|
9
9
|
function analyzeDependencies(query) {
|
|
@@ -56,14 +56,27 @@ function summarizeQueryPlan(query) {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
function summarizeUnionPlan(spec) {
|
|
59
|
-
|
|
59
|
+
return `union(${summarizeUnionArms(spec)})${summarizeGroupingTail(spec)}`;
|
|
60
|
+
}
|
|
61
|
+
function summarizeProjectionPlan(spec) {
|
|
62
|
+
const projection = spec.projection;
|
|
63
|
+
const legs = projection.joins.map(
|
|
64
|
+
(leg) => "collect" in leg ? `collect:${leg.collect}.${leg.on}\u2192${leg.as}` : `field:${leg.field}\u2192${leg.as}`
|
|
65
|
+
).sort();
|
|
66
|
+
const body = JSON.stringify({ source: projection.source, legs });
|
|
67
|
+
return `projection(${body})${summarizeGroupingTail(spec)}`;
|
|
68
|
+
}
|
|
69
|
+
function summarizeUnionArms(spec) {
|
|
70
|
+
return (spec.unionSources ?? []).map((s) => {
|
|
60
71
|
const joins = s.join?.length ? `[${s.join.map((j) => `${j.field}\u2192${j.as}`).join(";")}]` : "";
|
|
61
72
|
return `${s.collection}${joins}`;
|
|
62
73
|
}).join(",");
|
|
74
|
+
}
|
|
75
|
+
function summarizeGroupingTail(spec) {
|
|
63
76
|
const groupBy = Array.isArray(spec.groupBy) ? [...spec.groupBy].sort().join(",") : typeof spec.groupBy === "string" ? spec.groupBy : "";
|
|
64
77
|
const aggKeys = spec.aggregate ? Object.keys(spec.aggregate).sort().join(",") : "";
|
|
65
78
|
const moneyKeys = spec.moneyFields ? Object.keys(spec.moneyFields).sort().join(",") : "";
|
|
66
|
-
return
|
|
79
|
+
return `|groupBy(${groupBy})|aggregate(${aggKeys})|money(${moneyKeys})`;
|
|
67
80
|
}
|
|
68
81
|
|
|
69
82
|
// src/with-formula/materialized-views/query-hash.ts
|
|
@@ -96,6 +109,20 @@ var MaterializedViewRegistry = class {
|
|
|
96
109
|
_byName = /* @__PURE__ */ new Map();
|
|
97
110
|
/** Keyed by dependency source-collection → MVs that depend on it. */
|
|
98
111
|
_bySource = /* @__PURE__ */ new Map();
|
|
112
|
+
/**
|
|
113
|
+
* Projection MVs (#810) whose forward-leg ref() targets could not be
|
|
114
|
+
* resolved at registration time. A forward leg names only the FK
|
|
115
|
+
* FIELD; its dependency is the field's ref() TARGET, declared on the
|
|
116
|
+
* source collection — but registration runs at vault open, BEFORE
|
|
117
|
+
* user code declares collections (and their refs). Constructing the
|
|
118
|
+
* source collection here to look them up would be worse: a later
|
|
119
|
+
* `vault.collection(source, { refs })` call only registers refs on a
|
|
120
|
+
* cache miss, so an early construction would silently drop them.
|
|
121
|
+
* Instead each entry carries a non-constructive ref-registry probe;
|
|
122
|
+
* `mvsForSource` retries on every dispatch until every forward
|
|
123
|
+
* target has resolved (see `_resolvePendingForwardDeps`).
|
|
124
|
+
*/
|
|
125
|
+
_pendingForwardDeps = [];
|
|
99
126
|
/**
|
|
100
127
|
* Register an MV. Invokes `spec.query()` once at registration time to
|
|
101
128
|
* read the plan + join context; the resulting `Query<T>` is discarded
|
|
@@ -113,10 +140,20 @@ var MaterializedViewRegistry = class {
|
|
|
113
140
|
let queryPlanSummary;
|
|
114
141
|
let qAny = null;
|
|
115
142
|
let isQuery = false;
|
|
143
|
+
const pendingForwardFields = [];
|
|
116
144
|
if (spec.unionSources) {
|
|
117
145
|
dependencies = new Set(spec.unionSources.map((s) => s.collection));
|
|
118
146
|
if (spec.sources) for (const s of spec.sources) dependencies.add(s);
|
|
119
147
|
queryPlanSummary = summarizeUnionPlan(spec);
|
|
148
|
+
} else if (spec.projection) {
|
|
149
|
+
const projection = spec.projection;
|
|
150
|
+
dependencies = /* @__PURE__ */ new Set([projection.source]);
|
|
151
|
+
for (const leg of projection.joins) {
|
|
152
|
+
if ("collect" in leg) dependencies.add(leg.collect);
|
|
153
|
+
else pendingForwardFields.push(leg.field);
|
|
154
|
+
}
|
|
155
|
+
if (spec.sources) for (const s of spec.sources) dependencies.add(s);
|
|
156
|
+
queryPlanSummary = summarizeProjectionPlan(spec);
|
|
120
157
|
} else {
|
|
121
158
|
const q = spec.query(dbForQuery);
|
|
122
159
|
qAny = q;
|
|
@@ -156,7 +193,7 @@ var MaterializedViewRegistry = class {
|
|
|
156
193
|
if (isFieldClauseOnField(clause, partitionField)) partitionClauses.push(clause);
|
|
157
194
|
}
|
|
158
195
|
}
|
|
159
|
-
const grain = spec.unionSources || isQuery ? "record" : "aggregate";
|
|
196
|
+
const grain = spec.unionSources || spec.projection || isQuery ? "record" : "aggregate";
|
|
160
197
|
const reg = { spec, outputCollection, dependencies, queryHash, partitionClauses, grain };
|
|
161
198
|
this._byName.set(spec.name, reg);
|
|
162
199
|
for (const dep of dependencies) {
|
|
@@ -164,11 +201,52 @@ var MaterializedViewRegistry = class {
|
|
|
164
201
|
if (arr) arr.push(reg);
|
|
165
202
|
else this._bySource.set(dep, [reg]);
|
|
166
203
|
}
|
|
204
|
+
if (pendingForwardFields.length > 0) {
|
|
205
|
+
const refRegistry = db.refRegistry;
|
|
206
|
+
const source = spec.projection.source;
|
|
207
|
+
this._pendingForwardDeps.push({
|
|
208
|
+
reg,
|
|
209
|
+
fields: new Set(pendingForwardFields),
|
|
210
|
+
resolveTarget: (field) => refRegistry?.getOutbound(source)[field]?.target ?? null
|
|
211
|
+
});
|
|
212
|
+
this._resolvePendingForwardDeps();
|
|
213
|
+
}
|
|
167
214
|
}
|
|
168
215
|
/** All MVs that depend on `source`, in registration order. */
|
|
169
216
|
mvsForSource(source) {
|
|
217
|
+
if (this._pendingForwardDeps.length > 0) this._resolvePendingForwardDeps();
|
|
170
218
|
return this._bySource.get(source) ?? [];
|
|
171
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Retry ref() resolution for every pending projection forward leg
|
|
222
|
+
* (#810). A field resolves once its source collection's refs have
|
|
223
|
+
* been declared; the target then folds into the owning MV's
|
|
224
|
+
* dependency set and `_bySource`, so subsequent writes to it
|
|
225
|
+
* dispatch a refresh. Idempotent and cheap — the pending list
|
|
226
|
+
* empties as fields resolve, and `mvsForSource` skips the call
|
|
227
|
+
* entirely once it's empty.
|
|
228
|
+
*
|
|
229
|
+
* Late-resolved targets do NOT retro-feed `edges()` — the cycle
|
|
230
|
+
* pass runs once at vault open, before refs exist. A cycle routed
|
|
231
|
+
* exclusively through a forward leg is therefore not detected at
|
|
232
|
+
* open (collect + source edges, the literal names, are).
|
|
233
|
+
*/
|
|
234
|
+
_resolvePendingForwardDeps() {
|
|
235
|
+
for (let i = this._pendingForwardDeps.length - 1; i >= 0; i--) {
|
|
236
|
+
const entry = this._pendingForwardDeps[i];
|
|
237
|
+
for (const field of [...entry.fields]) {
|
|
238
|
+
const target = entry.resolveTarget(field);
|
|
239
|
+
if (target === null) continue;
|
|
240
|
+
entry.fields.delete(field);
|
|
241
|
+
if (entry.reg.dependencies.has(target)) continue;
|
|
242
|
+
entry.reg.dependencies.add(target);
|
|
243
|
+
const arr = this._bySource.get(target);
|
|
244
|
+
if (arr) arr.push(entry.reg);
|
|
245
|
+
else this._bySource.set(target, [entry.reg]);
|
|
246
|
+
}
|
|
247
|
+
if (entry.fields.size === 0) this._pendingForwardDeps.splice(i, 1);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
172
250
|
/** Single MV by name, or `undefined`. */
|
|
173
251
|
byName(name) {
|
|
174
252
|
return this._byName.get(name);
|
|
@@ -288,4 +366,4 @@ export {
|
|
|
288
366
|
MaterializedViewRegistry,
|
|
289
367
|
wrapDbWithPredicates
|
|
290
368
|
};
|
|
291
|
-
//# sourceMappingURL=chunk-
|
|
369
|
+
//# sourceMappingURL=chunk-S3BFKGET.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-formula/materialized-views/dependency-analyzer.ts","../src/with-formula/materialized-views/query-hash.ts","../src/with-formula/materialized-views/registry.ts"],"sourcesContent":["import type { Query, QueryPlan } from '../../kernel/query/builder.js'\nimport type { JoinContext } from '../../kernel/query/join.js'\nimport type { MaterializedViewStrategy } from './types.js'\n\n/**\n * Walks a `Query<T>` plan and returns the set of source collection\n * names that any source-write should trigger a refresh on.\n *\n * Handles:\n * - root collection (the one the query was built from)\n * - FK join targets (`.join(field, { as })`)\n *\n * Also handles:\n * - cross-join targets (`.crossJoin(target, { as })`) — v3\n *\n * Deferred:\n * - `.wherePredicate(name)` — v2 predicate primitive\n * - Overlay-name expansion to {base, overlay}\n *\n * The set is materialized at MV registration time. The MV registry\n * uses it to (a) dispatch `onSourceWrite` only to MVs that actually\n * care, and (b) contribute edges to the shared cycle-detection graph.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function analyzeDependencies(query: Query<any>): Set<string> {\n const deps = new Set<string>()\n const plan = query._plan()\n const ctx = query._joinContext()\n\n // The root collection is always a dependency.\n if (ctx?.leftCollection) {\n deps.add(ctx.leftCollection)\n }\n\n // FK join targets contribute additional sources.\n for (const leg of plan.joins) {\n deps.add(leg.target)\n }\n\n // Cross-join targets are also dependency sources — writes to either side\n // must trigger MV refresh. Symmetric with FK-join target handling above.\n for (const clause of plan.clauses) {\n if (clause.type === 'crossJoin') {\n deps.add(clause.target)\n }\n }\n\n // Sub-plans inside OR clauses can carry nested joins. Walk them.\n // (Today only top-level `.join()` populates `plan.joins`, but the\n // OR-group machinery permits sub-plans, so we recurse defensively.)\n walkClausesForJoins(plan, deps, ctx)\n\n return deps\n}\n\nfunction walkClausesForJoins(\n plan: QueryPlan,\n deps: Set<string>,\n ctx: JoinContext | undefined,\n): void {\n void ctx\n // Today `plan.joins` carries all join legs at top level. Sub-plans\n // inside OR groups don't currently support nested joins, so the loop\n // below is a no-op safety net for future builder extensions.\n for (const clause of plan.clauses) {\n if (clause.type === 'group') {\n // Group clauses don't (yet) carry their own joins; this is a\n // forward-compat anchor for when OR-groups support nested\n // sources.\n }\n }\n}\n\n/**\n * Convenience: produce a stable string summary of the query plan\n * suitable for `queryHash` derivation. Captures everything the\n * dependency analyzer reads + the where/orderBy/limit/offset\n * structure that affects materialized rows.\n *\n * `joinContext` is intentionally NOT included — the join-resolution\n * function references would defeat hash determinism. The set of join\n * TARGETS (collection names) IS included via the plan.joins legs.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function summarizeQueryPlan(query: Query<any>): string {\n const plan = query._plan()\n const ctx = query._joinContext()\n return JSON.stringify({\n root: ctx?.leftCollection ?? null,\n clauses: plan.clauses.map(c => {\n if (c.type === 'crossJoin') {\n return {\n type: 'crossJoin',\n target: c.target,\n as: c.as,\n // Inline on: callback: use sentinel — drift detection disabled for this MV\n onPredicateName: c.onPredicateName ?? (c.on ? '[inline]' : null),\n maxRows: c.maxRows ?? null,\n }\n }\n return c\n }),\n orderBy: plan.orderBy,\n limit: plan.limit ?? null,\n offset: plan.offset,\n joins: plan.joins.map(j => ({ field: j.field, as: j.as, target: j.target, mode: j.mode })),\n })\n}\n\n/**\n * Canonical string description of a UNION MV's plan, used as input to\n * `computeQueryHash`.\n *\n * Asymmetry note:\n * - Arm collection names are NOT sorted. Declaration order is\n * semantically meaningful for the dedup-only UNION path —\n * `materializeUnionResult` iterates `spec.unionSources` in\n * declaration order and keeps the first-seen row per composite key\n * (tie-break precedence). If we sorted arms here, a consumer who\n * reordered `unionSources` to change precedence would compute the\n * same `queryHash`, refresh would be a no-op, and stale MV rows\n * would persist. Hashing in declaration order makes any reorder\n * trigger a refresh.\n * - `groupBy` fields ARE sorted. Multi-key groupBy buckets are\n * commutative (`canonicalGroupKey` produces the same composite key\n * regardless of field order in the input spec).\n * - `aggregate` keys ARE sorted. Reducer-spec keys are independent\n * of each other — order of declaration doesn't change output.\n *\n * Per-arm `map` functions are NOT fingerprinted; consumers must bump\n * the MV's `name` (or rely on application-level cache busting) when\n * `map` semantics change non-equivalently.\n */\nexport function summarizeUnionPlan<T extends Record<string, unknown>>(\n spec: MaterializedViewStrategy<T>,\n): string {\n return `union(${summarizeUnionArms(spec)})${summarizeGroupingTail(spec)}`\n}\n\n/**\n * Canonical string description of a projection MV's plan (#810), used\n * as input to `computeQueryHash`.\n *\n * Leg descriptors ARE sorted (contrast with UNION arm order): every\n * leg attaches under a distinct `as` alias, forward legs are\n * one-to-one attachments and collect legs are independent\n * hash-grouped passes, so declaration order never changes the\n * materialized rows — a pure reorder must NOT force a refresh.\n *\n * The projection `map` is NOT fingerprinted (identical limitation as\n * the UNION arm `map`); consumers must bump the MV's `name` when\n * `map` semantics change non-equivalently.\n */\nexport function summarizeProjectionPlan<T extends Record<string, unknown>>(\n spec: MaterializedViewStrategy<T>,\n): string {\n const projection = spec.projection!\n const legs = projection.joins\n .map(leg =>\n 'collect' in leg\n ? `collect:${leg.collect}.${leg.on}→${leg.as}`\n : `field:${leg.field}→${leg.as}`,\n )\n .sort()\n const body = JSON.stringify({ source: projection.source, legs })\n return `projection(${body})${summarizeGroupingTail(spec)}`\n}\n\n/** Arm descriptors for `summarizeUnionPlan` — declaration order preserved (see its doc). */\nfunction summarizeUnionArms<T extends Record<string, unknown>>(\n spec: MaterializedViewStrategy<T>,\n): string {\n return (spec.unionSources ?? [])\n .map(s => {\n // Fold each arm's join legs into the summary so adding or\n // reordering joins (which changes the materialized rows) bumps\n // queryHash. Leg order is declaration-significant (legs chain), so\n // it is NOT sorted — same rationale as arm declaration order.\n const joins = s.join?.length\n ? `[${s.join.map(j => `${j.field}→${j.as}`).join(';')}]`\n : ''\n return `${s.collection}${joins}`\n })\n .join(',')\n}\n\n/**\n * Shared `|groupBy(…)|aggregate(…)|money(…)` tail for the UNION and\n * projection summaries — both feed the same post-map grouping pipeline,\n * so the same spec fields fold into both hashes with the same rules.\n */\nfunction summarizeGroupingTail<T extends Record<string, unknown>>(\n spec: MaterializedViewStrategy<T>,\n): string {\n const groupBy: string = Array.isArray(spec.groupBy)\n ? [...spec.groupBy].sort().join(',')\n : typeof spec.groupBy === 'string'\n ? spec.groupBy\n : ''\n const aggKeys = spec.aggregate ? Object.keys(spec.aggregate).sort().join(',') : ''\n // `moneyFields` changes reducer semantics (float → exact BigInt), so\n // declaring / removing / re-keying it must bump queryHash. Keys are\n // sorted — they're independent of each other (one descriptor per\n // output field), same rationale as aggregate keys.\n const moneyKeys = spec.moneyFields ? Object.keys(spec.moneyFields).sort().join(',') : ''\n return `|groupBy(${groupBy})|aggregate(${aggKeys})|money(${moneyKeys})`\n}\n","/**\n * Deterministic hash of a materialized view strategy's \"shape\": MV\n * name + canonical query-plan summary + sorted dependency-set.\n *\n * Used to detect strategy drift: a row whose `_materializedFrom.queryHash`\n * doesn't match the current strategy is considered stale.\n *\n * Web Crypto SHA-256 — no extra deps. Mirrors the v1\n * `computeStrategyHash` pattern.\n */\nimport { sha256Hex } from '../../kernel/enclave/index.js'\n\nexport async function computeQueryHash(\n mvName: string,\n /**\n * Source-collection set the query depends on. Sorted before\n * canonicalization so set iteration order doesn't affect the hash.\n */\n dependencies: ReadonlySet<string>,\n /**\n * Stringified query-plan summary. The caller produces this from the\n * `Query<T>` builder — concretely: a JSON serialization of clauses +\n * orderBy + limit + offset + joins. Function bodies inside\n * `wherePredicate` are NOT included here (those carry their own\n * `predicateHash` to be folded in by a later sub-issue).\n */\n queryPlanSummary: string,\n): Promise<string> {\n const canonical = JSON.stringify({\n mvName,\n dependencies: [...dependencies].sort(),\n queryPlanSummary,\n })\n const bytes = new TextEncoder().encode(canonical)\n return sha256Hex(bytes)\n}\n\n/**\n * Canonicalize a query plan for hashing. Walks the plan structure\n * with sorted keys so insertion order doesn't perturb the result.\n * Lives here rather than in `query/builder.ts` to keep that module\n * stable across MV-specific evolutions.\n *\n * @internal exported for testing\n */\nexport function canonicalizeQueryPlan(plan: unknown): string {\n return JSON.stringify(plan, (_key, value) => {\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n const sorted: Record<string, unknown> = {}\n for (const k of Object.keys(value as Record<string, unknown>).sort()) {\n sorted[k] = (value as Record<string, unknown>)[k]\n }\n return sorted\n }\n return value\n })\n}\n","import { MaterializedViewSourceUnknownError } from '../../kernel/errors.js'\nimport type { ViaGraph, FieldRef, EdgeKind, Grain } from '../../kernel/via/graph.js'\nimport type { Clause, FieldClause } from '../../kernel/query/predicate.js'\nimport type { DeclaredPredicate } from '../../kernel/query/builder.js'\nimport { analyzeDependencies, summarizeQueryPlan, summarizeUnionPlan, summarizeProjectionPlan } from './dependency-analyzer.js'\nimport { computeQueryHash } from './query-hash.js'\nimport type { MaterializedViewStrategy, MVQueryContext } from './types.js'\n\n/**\n * Whole-record artifact-grain field marker (#638 Task 2) — MUST match\n * `derivations/registry.ts`'s and `vault.ts`'s overlay-edge marker so\n * cross-registry edges (a derivation feeding an MV, or vice versa) resolve\n * to the SAME graph node. See that file's `WHOLE_RECORD` doc comment.\n */\nconst WHOLE_RECORD = '*'\n\n/**\n * One registered MV strategy alongside its derived metadata. Stored\n * type-erased on `TRow` so the registry can hold heterogeneous MVs.\n */\nexport interface RegisteredMV {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly spec: MaterializedViewStrategy<any>\n /** Output collection name (`spec.output?.collection ?? spec.name`). */\n readonly outputCollection: string\n /** Set of source collections; populated at registration via the analyzer. */\n readonly dependencies: ReadonlySet<string>\n /** Canonical `queryHash` — `_materializedFrom.queryHash` for every emitted row. */\n readonly queryHash: string\n /**\n * Top-level FieldClauses on the partition field, captured at\n * registration time. Used by the cycle detector to resolve\n * same-collection-as-source edges via the partition-discriminator\n * check. Empty when `spec.output?.partition` is undefined.\n */\n readonly partitionClauses: readonly FieldClause[]\n /**\n * #638 Task 2 — `'record'` for a row-per-source-row Query<T> or\n * `unionSources` MV, `'aggregate'` for a `.groupBy().aggregate()` MV\n * (the shape that requires explicit `sources`, since the dependency\n * analyzer can't walk an aggregate plan). Feeds `edges()`'s grain.\n */\n readonly grain: Grain\n}\n\n/**\n * Vault-internal registry of MV strategies. Owned by `Vault`; not\n * exported. Parallel to v1's `DerivationRegistry`; the two graphs share\n * a single cycle-detection pass at vault open (see `validate`).\n *\n * @internal\n */\nexport class MaterializedViewRegistry {\n /** Keyed by `spec.name`. */\n private readonly _byName = new Map<string, RegisteredMV>()\n /** Keyed by dependency source-collection → MVs that depend on it. */\n private readonly _bySource = new Map<string, RegisteredMV[]>()\n /**\n * Projection MVs (#810) whose forward-leg ref() targets could not be\n * resolved at registration time. A forward leg names only the FK\n * FIELD; its dependency is the field's ref() TARGET, declared on the\n * source collection — but registration runs at vault open, BEFORE\n * user code declares collections (and their refs). Constructing the\n * source collection here to look them up would be worse: a later\n * `vault.collection(source, { refs })` call only registers refs on a\n * cache miss, so an early construction would silently drop them.\n * Instead each entry carries a non-constructive ref-registry probe;\n * `mvsForSource` retries on every dispatch until every forward\n * target has resolved (see `_resolvePendingForwardDeps`).\n */\n private readonly _pendingForwardDeps: Array<{\n reg: RegisteredMV\n fields: Set<string>\n resolveTarget: (field: string) => string | null\n }> = []\n\n /**\n * Register an MV. Invokes `spec.query()` once at registration time to\n * read the plan + join context; the resulting `Query<T>` is discarded\n * after dependency extraction. `vault.collection(...)` must therefore\n * be functional by the time this runs — typically wired from\n * `Vault._initMaterializedViews` after collection bootstrap.\n *\n * Throws `MaterializedViewSourceUnknownError` if the analyzer\n * surfaces a dependency the vault doesn't know about (when a\n * `knownCollections` checker is supplied).\n */\n async register(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n spec: MaterializedViewStrategy<any>,\n db: MVQueryContext,\n options?: { knownCollections?: (name: string) => boolean },\n ): Promise<void> {\n // Build a predicate-aware db wrapper. If `spec.predicates` is\n // declared, the wrapper intercepts `.collection().query()` and\n // attaches the predicates map to the resulting Query<T>. With no\n // predicates declared, the wrapper is the original db unchanged.\n const dbForQuery = spec.predicates ? wrapDbWithPredicates(db, spec.predicates) : db\n\n // Invoke the query callback once to inspect its plan / dependencies.\n // For Query<T> shapes the analyzer extracts deps + plan summary\n // automatically. Aggregation / GroupedAggregation shapes don't\n // expose the underlying Query, so the spec must declare `sources`\n // explicitly. `partitionClauses` are only populated for Query<T>\n // since same-collection-partition is a non-aggregate concern.\n // UNION-form strategies: dependencies and plan summary come\n // straight off the strategy — no `query` callback to introspect.\n // The dependency-analyzer + summarizer are bypassed entirely; the\n // executor handles materialization via `materializeUnionResult`.\n let dependencies: Set<string>\n let queryPlanSummary: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let qAny: any = null\n let isQuery = false\n // Projection-form (#810): forward legs whose ref() target wasn't\n // resolvable at registration time — folded in lazily, see\n // `_pendingForwardDeps`.\n const pendingForwardFields: string[] = []\n if (spec.unionSources) {\n dependencies = new Set(spec.unionSources.map(s => s.collection))\n // Per-arm joins resolve right-side collections that aren't among\n // the arm `collection`s. The consumer lists those in `sources`;\n // fold them into the dependency set so a write to a join-target\n // collection triggers MV refresh (and contributes a cycle edge).\n if (spec.sources) for (const s of spec.sources) dependencies.add(s)\n queryPlanSummary = summarizeUnionPlan(spec)\n } else if (spec.projection) {\n // Projection-form (#810): dependencies are all AUTO — the primary\n // source, every collect leg's collection (both literal names), and\n // every forward leg's ref() target. Forward targets usually can't\n // resolve yet (refs are declared after vault open) — those go\n // through the pending-resolution path below. Explicit `sources`\n // remains additive, same as the other two forms.\n const projection = spec.projection\n dependencies = new Set([projection.source])\n for (const leg of projection.joins) {\n if ('collect' in leg) dependencies.add(leg.collect)\n else pendingForwardFields.push(leg.field)\n }\n if (spec.sources) for (const s of spec.sources) dependencies.add(s)\n queryPlanSummary = summarizeProjectionPlan(spec)\n } else {\n const q = spec.query!(dbForQuery)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n qAny = q as any\n isQuery = typeof qAny._plan === 'function'\n if (isQuery) {\n // `q` is the `Query` arm of the union here (runtime-confirmed via\n // `qAny._plan` above); reuse the already-`any` `qAny` the block uses\n // for `_plan()` rather than re-narrowing.\n dependencies = analyzeDependencies(qAny)\n queryPlanSummary = summarizeQueryPlan(qAny)\n // Fold `.wherePredicate(name, ctx)` references into the plan\n // summary so predicate function or ctx changes (signalled by\n // bumping `hash` or supplying a different ctx) propagate into\n // `queryHash` and force refresh on next visit.\n const predicateRefs = extractPredicateRefs(qAny._plan())\n if (predicateRefs.length > 0) {\n queryPlanSummary = JSON.stringify({ plan: queryPlanSummary, predicates: predicateRefs })\n }\n // If `sources` is ALSO declared, take the union (consumer's\n // explicit list extends the auto-analyzed set).\n if (spec.sources) for (const s of spec.sources) dependencies.add(s)\n } else {\n // Aggregate shape: require explicit `sources`.\n if (!spec.sources || spec.sources.length === 0) {\n throw new Error(\n `withMaterializedView \"${spec.name}\": query() returned an aggregate ` +\n `(Aggregation or GroupedAggregation) but no \\`sources\\` field is declared. ` +\n `The dependency analyzer cannot walk through groupBy().aggregate() ` +\n `back to the source — declare sources: [...] explicitly.`,\n )\n }\n dependencies = new Set(spec.sources)\n // Aggregate plans don't carry a chainable query plan for summary\n // purposes; the dep-set + spec.name serve as the queryHash inputs.\n queryPlanSummary = JSON.stringify({ aggregate: true, sources: [...spec.sources].sort() })\n }\n }\n\n // Sanity-check declared dependencies against the vault's known\n // collections. Optional — when the checker isn't supplied (test\n // wiring, in-process composition) the registration succeeds and\n // any typo surfaces at first onSourceWrite as a no-op.\n if (options?.knownCollections) {\n for (const dep of dependencies) {\n if (!options.knownCollections(dep)) {\n throw new MaterializedViewSourceUnknownError(spec.name, dep)\n }\n }\n }\n\n const outputCollection = spec.output?.collection ?? spec.name\n const queryHash = await computeQueryHash(spec.name, dependencies, queryPlanSummary)\n // For same-collection-as-source MVs, capture the where-clauses on\n // the partition field so cycle detection can prove disjointness.\n // Only applicable to Query<T> shapes — aggregate MVs don't carry\n // a chainable plan to inspect (and same-collection aggregation\n // doesn't make sense for same-collection aggregation).\n const partitionClauses: FieldClause[] = []\n const partitionField = spec.output?.partition?.field\n if (partitionField !== undefined && isQuery) {\n const plan = qAny._plan()\n for (const clause of plan.clauses) {\n if (isFieldClauseOnField(clause, partitionField)) partitionClauses.push(clause)\n }\n }\n // #638 Task 2 — 'aggregate' only for the explicit-sources aggregate shape\n // (groupBy().aggregate() with no chainable plan); a row-per-source-row\n // Query<T>, unionSources, or projection MV is 'record'.\n const grain: Grain = spec.unionSources || spec.projection || isQuery ? 'record' : 'aggregate'\n const reg: RegisteredMV = { spec, outputCollection, dependencies, queryHash, partitionClauses, grain }\n\n this._byName.set(spec.name, reg)\n for (const dep of dependencies) {\n const arr = this._bySource.get(dep)\n if (arr) arr.push(reg)\n else this._bySource.set(dep, [reg])\n }\n if (pendingForwardFields.length > 0) {\n // Non-constructive ref-registry probe: the Vault (the real\n // MVQueryContext) carries its RefRegistry as a private field,\n // reachable structurally at runtime. Test stubs without one simply\n // never resolve — forward deps then come only from explicit `sources`.\n const refRegistry = (db as unknown as {\n refRegistry?: { getOutbound(collection: string): Record<string, { target: string }> }\n }).refRegistry\n const source = spec.projection!.source\n this._pendingForwardDeps.push({\n reg,\n fields: new Set(pendingForwardFields),\n resolveTarget: (field) => refRegistry?.getOutbound(source)[field]?.target ?? null,\n })\n // Immediate attempt — covers refs already declared by the time\n // this MV registers (re-registration flows, test wiring).\n this._resolvePendingForwardDeps()\n }\n }\n\n /** All MVs that depend on `source`, in registration order. */\n mvsForSource(source: string): ReadonlyArray<RegisteredMV> {\n if (this._pendingForwardDeps.length > 0) this._resolvePendingForwardDeps()\n return this._bySource.get(source) ?? []\n }\n\n /**\n * Retry ref() resolution for every pending projection forward leg\n * (#810). A field resolves once its source collection's refs have\n * been declared; the target then folds into the owning MV's\n * dependency set and `_bySource`, so subsequent writes to it\n * dispatch a refresh. Idempotent and cheap — the pending list\n * empties as fields resolve, and `mvsForSource` skips the call\n * entirely once it's empty.\n *\n * Late-resolved targets do NOT retro-feed `edges()` — the cycle\n * pass runs once at vault open, before refs exist. A cycle routed\n * exclusively through a forward leg is therefore not detected at\n * open (collect + source edges, the literal names, are).\n */\n private _resolvePendingForwardDeps(): void {\n for (let i = this._pendingForwardDeps.length - 1; i >= 0; i--) {\n const entry = this._pendingForwardDeps[i]!\n for (const field of [...entry.fields]) {\n const target = entry.resolveTarget(field)\n if (target === null) continue\n entry.fields.delete(field)\n if (entry.reg.dependencies.has(target)) continue\n // `dependencies` is declared ReadonlySet for consumers; the\n // registry owns the underlying Set and is the one writer.\n ;(entry.reg.dependencies as Set<string>).add(target)\n const arr = this._bySource.get(target)\n if (arr) arr.push(entry.reg)\n else this._bySource.set(target, [entry.reg])\n }\n if (entry.fields.size === 0) this._pendingForwardDeps.splice(i, 1)\n }\n }\n\n /** Single MV by name, or `undefined`. */\n byName(name: string): RegisteredMV | undefined {\n return this._byName.get(name)\n }\n\n /** Iterate over every registered MV. */\n all(): ReadonlyArray<RegisteredMV> {\n return [...this._byName.values()]\n }\n\n /**\n * Graph edges for #638 Task 2: one `'mv'` edge per registered MV — target\n * = the output collection (a `WHOLE_RECORD` artifact node), sources =\n * every dependency (also `WHOLE_RECORD` nodes). Same-collection edges\n * (`dep === outputCollection`) are skipped IFF the MV declares an\n * `output.partition` discriminator AND the query has a where-clause that\n * provably excludes the partition value (`partitionDisjoint`) — the SAME\n * condition the old local DFS used. Grain comes from the registration-time\n * `RegisteredMV.grain`.\n */\n edges(): ReadonlyArray<{ readonly target: FieldRef; readonly sources: readonly FieldRef[]; readonly kind: EdgeKind; readonly grain: Grain }> {\n const out: Array<{ target: FieldRef; sources: FieldRef[]; kind: EdgeKind; grain: Grain }> = []\n for (const reg of this._byName.values()) {\n const sources: FieldRef[] = []\n for (const dep of reg.dependencies) {\n if (dep === reg.outputCollection && partitionDisjoint(reg)) continue\n sources.push({ collection: dep, field: WHOLE_RECORD })\n }\n if (sources.length === 0) continue\n out.push({ target: { collection: reg.outputCollection, field: WHOLE_RECORD }, sources, kind: 'mv', grain: reg.grain })\n }\n return out\n }\n\n /**\n * Cycle detection, delegated to `ViaGraph.assertAcyclic()` (#638 Task 2 —\n * retires the local DFS). `graph` is the caller's shared per-vault graph,\n * ALREADY carrying this registry's `edges()` AND `DerivationRegistry`'s\n * (registered by the caller — see `Vault._initMaterializedViews`, which\n * runs after `_initDerivations`, so a pure-derivation cycle already threw\n * `DerivationCycleError` there; any cycle surfacing here necessarily\n * touches an MV edge). Throws `MaterializedViewCycleError` — SAME class as\n * before.\n */\n validate(graph: ViaGraph): void {\n graph.assertAcyclic()\n }\n}\n\n/**\n * Type guard: is the clause a top-level `FieldClause` on the given\n * field? Used by the partition-disjoint check.\n *\n * @internal\n */\nfunction isFieldClauseOnField(clause: Clause, field: string): clause is FieldClause {\n return clause.type === 'field' && clause.field === field\n}\n\n/**\n * Wrap an `MVQueryContext` so its `.collection().query()` returns a\n * Query<T> with the MV's declared predicates attached. Bare Queries\n * (outside of any MV) don't gain `.wherePredicate()` — only Queries\n * obtained through this wrapped db do.\n *\n * @internal\n */\nexport function wrapDbWithPredicates(\n db: MVQueryContext,\n predicates: NonNullable<MaterializedViewStrategy<Record<string, unknown>>['predicates']>,\n): MVQueryContext {\n // Build the predicate map once — the fn signature in the MV spec\n // is row-typed but the QueryBuilder casts to unknown, so we widen\n // here for the Map.\n const map = new Map<string, DeclaredPredicate>()\n for (const [name, decl] of Object.entries(predicates)) {\n map.set(name, {\n hash: decl.hash,\n fn: decl.fn as (record: unknown, ctx?: unknown) => boolean,\n })\n }\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n collection<T extends Record<string, unknown>>(name: string): any {\n const c = db.collection<T>(name)\n // Return an object that delegates everything to `c` but\n // overrides `.query()` to attach predicates via the new\n // `Query._withPredicates()` accessor.\n return new Proxy(c, {\n get(target, prop, receiver) {\n if (prop === 'query') {\n return (...args: unknown[]) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const q = (target.query as any)(...args)\n // For non-aggregate Query<T>, attach predicates. For\n // legacy predicate-arg overload that returns T[] (sync\n // filter), pass through unchanged.\n \n if (q && typeof q._withPredicates === 'function') {\n return q._withPredicates(map)\n }\n return q\n }\n }\n return Reflect.get(target, prop, receiver)\n },\n })\n },\n }\n}\n\n/**\n * Walk a QueryPlan's clauses and collect predicate-reference markers\n * for `queryHash` derivation. Returns a sorted array (deterministic\n * order) of `{ name, predicateHash, ctxHash }` tuples — these are the\n * hashable identity of each `.wherePredicate()` call site.\n *\n * @internal\n */\nfunction extractPredicateRefs(\n plan: { clauses: readonly Clause[] },\n): Array<{ name: string; predicateHash: string; ctxHash: string }> {\n const refs: Array<{ name: string; predicateHash: string; ctxHash: string }> = []\n const walk = (clauses: readonly Clause[]): void => {\n for (const c of clauses) {\n if (c.type === 'wherePredicate') {\n refs.push({ name: c.name, predicateHash: c.predicateHash, ctxHash: c.ctxHash })\n } else if (c.type === 'group') {\n walk(c.clauses)\n }\n }\n }\n walk(plan.clauses)\n // Stable-sort by (name, predicateHash, ctxHash) — same predicate\n // appearing twice with different ctx hashes both flow through.\n refs.sort((a, b) => {\n if (a.name !== b.name) return a.name < b.name ? -1 : 1\n if (a.predicateHash !== b.predicateHash) return a.predicateHash < b.predicateHash ? -1 : 1\n return a.ctxHash < b.ctxHash ? -1 : a.ctxHash > b.ctxHash ? 1 : 0\n })\n return refs\n}\n\n/**\n * Provability check for the same-collection partition-discriminator.\n * Returns `true` when\n * the captured partition clauses on the MV's query provably exclude\n * the partition's value — meaning the input filter and the output\n * partition are disjoint and the same-collection edge isn't really a\n * cycle.\n *\n * Supported provability shapes (narrow on purpose — DERIV-PP30-001\n * is the load-bearing case):\n *\n * - `.where(field, '==', X)` where X !== partition.value → disjoint\n * - `.where(field, '!=', partition.value)` → disjoint\n * - `.where(field, 'in', [...])` where partition.value NOT in list → disjoint\n *\n * Anything else (no clause on the partition field, an 'in' list that\n * contains partition.value, unsupported operators) → not disjoint,\n * the cycle detector surfaces `MaterializedViewCycleError`.\n *\n * @internal\n */\nfunction partitionDisjoint(reg: RegisteredMV): boolean {\n const partition = reg.spec.output?.partition\n if (partition === undefined) return false\n const value = partition.value\n // The OR-semantics of multiple where-clauses on the same field\n // would muddy this check. v2 only treats AND-chained clauses;\n // any clause that proves disjoint is sufficient.\n for (const c of reg.partitionClauses) {\n if (c.op === '==' && c.value !== value) return true\n if (c.op === '!=' && c.value === value) return true\n if (c.op === 'in' && Array.isArray(c.value)) {\n const list = c.value as readonly unknown[]\n if (!list.includes(value)) return true\n }\n }\n return false\n}\n"],"mappings":";;;;;;;;AAwBO,S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MAAM;AAClB,QAAI,EAAE,SAAS,EAAE,KAAM,QAAO,EAAE,OAAO,EAAE,OAAO,KAAK;AACrD,QAAI,EAAE,kBAAkB,EAAE,cAAe,QAAO,EAAE,gBAAgB,EAAE,gBAAgB,KAAK;AACzF,WAAO,EAAE,UAAU,EAAE,UAAU,KAAK,EAAE,UAAU,EAAE,UAAU,IAAI;AAAA,EAClE,CAAC;AACD,SAAO;AACT;AAuBA,SAAS,kBAAkB,KAA4B;AACrD,QAAM,YAAY,IAAI,KAAK,QAAQ;AACnC,MAAI,cAAc,OAAW,QAAO;AACpC,QAAM,QAAQ,UAAU;AAIxB,aAAW,KAAK,IAAI,kBAAkB;AACpC,QAAI,EAAE,OAAO,QAAQ,EAAE,UAAU,MAAO,QAAO;AAC/C,QAAI,EAAE,OAAO,QAAQ,EAAE,UAAU,MAAO,QAAO;AAC/C,QAAI,EAAE,OAAO,QAAQ,MAAM,QAAQ,EAAE,KAAK,GAAG;AAC3C,YAAM,OAAO,EAAE;AACf,UAAI,CAAC,KAAK,SAAS,KAAK,EAAG,QAAO;AAAA,IACpC;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AttestationNotEnabledError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W2OG6JOL.js";
|
|
4
4
|
|
|
5
5
|
// src/with-audit/attestation/strategy.ts
|
|
6
6
|
var NO_ATTESTATION = {
|
|
@@ -27,4 +27,4 @@ var NO_ATTESTATION = {
|
|
|
27
27
|
export {
|
|
28
28
|
NO_ATTESTATION
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-S6Q37VGE.js.map
|