@noy-db/hub 0.7.0 → 0.8.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -14
- package/LICENSE +202 -21
- package/NOTICE +1 -0
- package/README.md +27 -10
- package/codemods/0.8.0-pre.json +61 -0
- package/dist/api-GVYEKSJE.js +19 -0
- package/dist/as/index.js +11 -11
- package/dist/at/index.js +9 -9
- package/dist/attestation/index.js +20 -20
- package/dist/{backup-IJTB4S4M.js → backup-7TFRVFLH.js} +21 -15
- package/dist/backup-7TFRVFLH.js.map +1 -0
- package/dist/blobs/index.js +13 -13
- package/dist/broker/index.js +12 -12
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.js +39 -36
- package/dist/{chunk-7O3Y4PPD.js → chunk-244VXYPG.js} +140 -16
- package/dist/chunk-244VXYPG.js.map +1 -0
- package/dist/{chunk-BUE2D7PX.js → chunk-32YV3TJT.js} +2 -2
- package/dist/{chunk-3RCJJBNR.js → chunk-3ELRMVJK.js} +12 -12
- package/dist/{chunk-6GMZ7HEE.js → chunk-3F7GLNAE.js} +6 -6
- package/dist/{chunk-2Y4IMKA6.js → chunk-3H5KLDZN.js} +4 -4
- package/dist/{chunk-VTFVLCUH.js → chunk-3JWHAR6E.js} +2 -2
- package/dist/{chunk-YMUFFJCO.js → chunk-3TDUWVWB.js} +5 -2
- package/dist/chunk-3TDUWVWB.js.map +1 -0
- package/dist/{chunk-JBDFMYKQ.js → chunk-4AF3TUMP.js} +2 -2
- package/dist/{chunk-ZORTV6NH.js → chunk-4I522ERM.js} +88 -4
- package/dist/chunk-4I522ERM.js.map +1 -0
- package/dist/{chunk-MUM7IANK.js → chunk-4MXI3ODD.js} +4 -4
- package/dist/chunk-4MXI3ODD.js.map +1 -0
- package/dist/{chunk-BLN54W3L.js → chunk-5FDLC6G7.js} +56 -3
- package/dist/chunk-5FDLC6G7.js.map +1 -0
- package/dist/chunk-5O7D6ZTW.js +53 -0
- package/dist/chunk-5O7D6ZTW.js.map +1 -0
- package/dist/{chunk-J6FXAEUG.js → chunk-6B3VNR4P.js} +12 -12
- package/dist/{chunk-TUFM4UZP.js → chunk-6K7DPM7D.js} +2 -2
- package/dist/{chunk-K6LHRFBL.js → chunk-6LMQ5R26.js} +7 -7
- package/dist/{chunk-SPXXX5E4.js → chunk-6LNL42F5.js} +94 -32
- package/dist/chunk-6LNL42F5.js.map +1 -0
- package/dist/{chunk-XLMEZIAJ.js → chunk-6OWXYZK2.js} +2 -2
- package/dist/{chunk-BOWNCWZT.js → chunk-6QSQQLSE.js} +3 -3
- package/dist/chunk-7JE7BDYJ.js +1558 -0
- package/dist/chunk-7JE7BDYJ.js.map +1 -0
- package/dist/{chunk-KG7TZKZG.js → chunk-7VCXZDA4.js} +5 -5
- package/dist/chunk-7VCXZDA4.js.map +1 -0
- package/dist/{chunk-NQKIUNW5.js → chunk-A6IJU4TK.js} +2 -2
- package/dist/{chunk-BM5TWITZ.js → chunk-ANWPSTZU.js} +38 -9
- package/dist/chunk-ANWPSTZU.js.map +1 -0
- package/dist/{chunk-QIZPZMUI.js → chunk-AOWGXU6D.js} +2 -2
- package/dist/{chunk-CUZLNGD5.js → chunk-B2YY6WDD.js} +1 -1
- package/dist/chunk-B2YY6WDD.js.map +1 -0
- package/dist/{chunk-SFAWCTEM.js → chunk-B57AFBY2.js} +2 -2
- package/dist/{chunk-GPEQUXHL.js → chunk-B6SJIBQK.js} +4 -4
- package/dist/chunk-BJ2IXQ5Q.js +100 -0
- package/dist/chunk-BJ2IXQ5Q.js.map +1 -0
- package/dist/{chunk-Q2PU57HC.js → chunk-BK2HHQGN.js} +2 -2
- package/dist/chunk-BKT776R5.js +1 -0
- package/dist/{chunk-KUX3OB6D.js → chunk-BP6DARYA.js} +33 -5
- package/dist/chunk-BP6DARYA.js.map +1 -0
- package/dist/{chunk-FXBIP2WD.js → chunk-BUDAGWL5.js} +6 -6
- package/dist/chunk-CF5UU4S7.js +757 -0
- package/dist/chunk-CF5UU4S7.js.map +1 -0
- package/dist/{chunk-BOET4NA4.js → chunk-CKNGS5MH.js} +3 -3
- package/dist/chunk-CY2CYVWZ.js +41 -0
- package/dist/chunk-CY2CYVWZ.js.map +1 -0
- package/dist/{chunk-2577DKXB.js → chunk-DC5QVPV7.js} +2 -2
- package/dist/chunk-DC5QVPV7.js.map +1 -0
- package/dist/{chunk-YSRUYAVU.js → chunk-DE4DH2RZ.js} +2 -2
- package/dist/{chunk-6I2RQCET.js → chunk-DF73H4UN.js} +4 -4
- package/dist/{chunk-4GVM6QZA.js → chunk-ENAG3IY7.js} +2 -2
- package/dist/chunk-ENAG3IY7.js.map +1 -0
- package/dist/{chunk-K7NTTA6P.js → chunk-EOVMT6TB.js} +2 -2
- package/dist/chunk-F24ZZTHQ.js +193 -0
- package/dist/chunk-F24ZZTHQ.js.map +1 -0
- package/dist/chunk-F2TDU7MQ.js +456 -0
- package/dist/chunk-F2TDU7MQ.js.map +1 -0
- package/dist/chunk-F6NCB7KT.js +13 -0
- package/dist/chunk-F6NCB7KT.js.map +1 -0
- package/dist/{chunk-SPYWXKJN.js → chunk-F7XGHL5O.js} +3 -3
- package/dist/chunk-F7XGHL5O.js.map +1 -0
- package/dist/{chunk-XTXOCYOJ.js → chunk-FCKWQE2H.js} +5 -5
- package/dist/{chunk-U4FOQDY4.js → chunk-FH2L2E34.js} +4 -4
- package/dist/chunk-FH2L2E34.js.map +1 -0
- package/dist/{chunk-4OZNXTO4.js → chunk-FN5EBVTQ.js} +2 -2
- package/dist/chunk-FQ54DWUQ.js +270 -0
- package/dist/chunk-FQ54DWUQ.js.map +1 -0
- package/dist/{chunk-NKHRDYOR.js → chunk-FQ5VRHIB.js} +4 -4
- package/dist/{chunk-FAHMLERK.js → chunk-FW22ZCXT.js} +2 -2
- package/dist/chunk-FXQBGFOX.js +524 -0
- package/dist/chunk-FXQBGFOX.js.map +1 -0
- package/dist/{chunk-AO42KJO6.js → chunk-GF5BZ7D4.js} +45 -9
- package/dist/chunk-GF5BZ7D4.js.map +1 -0
- package/dist/{chunk-TRGTKX5E.js → chunk-GHLTDZRS.js} +5 -3
- package/dist/{chunk-TRGTKX5E.js.map → chunk-GHLTDZRS.js.map} +1 -1
- package/dist/{chunk-5WDXHNSW.js → chunk-HBPPGWUM.js} +5 -5
- package/dist/chunk-HBPPGWUM.js.map +1 -0
- package/dist/{chunk-KTFRCC5C.js → chunk-HBRLNOHL.js} +82 -8
- package/dist/chunk-HBRLNOHL.js.map +1 -0
- package/dist/chunk-HLEK5VAN.js +275 -0
- package/dist/chunk-HLEK5VAN.js.map +1 -0
- package/dist/{chunk-RMS3NEA3.js → chunk-HT2AHGQI.js} +2 -2
- package/dist/{chunk-CHJBLCOG.js → chunk-HVSCEIYL.js} +7 -7
- package/dist/{chunk-UXWB3FPF.js → chunk-I3JDRCMW.js} +150 -22
- package/dist/chunk-I3JDRCMW.js.map +1 -0
- package/dist/{chunk-GY4WYNNG.js → chunk-ID6Z6E66.js} +2 -2
- package/dist/{chunk-EYBQEIUY.js → chunk-IEX7NK2K.js} +3 -3
- package/dist/{chunk-KUJDV5QH.js → chunk-ISZQJBML.js} +5 -5
- package/dist/{chunk-LWBCUYZW.js → chunk-IT22PWKV.js} +2 -2
- package/dist/{chunk-EQEYOJBM.js → chunk-IUWCVHQ7.js} +3 -3
- package/dist/chunk-IUWCVHQ7.js.map +1 -0
- package/dist/{chunk-7V4TP3AF.js → chunk-J6UOHJY5.js} +4 -4
- package/dist/{chunk-JMGDHKQF.js → chunk-JCN44NCY.js} +2 -2
- package/dist/{chunk-CARABLSQ.js → chunk-K6W7BVZ6.js} +3 -3
- package/dist/{chunk-77K4PG6P.js → chunk-KJFW62P4.js} +29 -11
- package/dist/chunk-KJFW62P4.js.map +1 -0
- package/dist/{chunk-453F654R.js → chunk-L7DOS3TE.js} +2 -2
- package/dist/chunk-LGNDFRYC.js +23 -0
- package/dist/chunk-LGNDFRYC.js.map +1 -0
- package/dist/{chunk-WEQEYLCS.js → chunk-LGRLME4M.js} +7 -7
- package/dist/{chunk-RMF67KCG.js → chunk-LQ4ZHOKP.js} +2 -2
- package/dist/{chunk-ZVO4QVPD.js → chunk-M522UYZ2.js} +5 -5
- package/dist/{chunk-G56KBWFY.js → chunk-M7NI3IWE.js} +45 -12
- package/dist/chunk-M7NI3IWE.js.map +1 -0
- package/dist/chunk-MDWKM2XC.js +293 -0
- package/dist/chunk-MDWKM2XC.js.map +1 -0
- package/dist/chunk-MKXXMNJH.js +204 -0
- package/dist/chunk-MKXXMNJH.js.map +1 -0
- package/dist/{chunk-SKGMN35F.js → chunk-MLPHLJIQ.js} +3 -3
- package/dist/chunk-MLPHLJIQ.js.map +1 -0
- package/dist/{chunk-2N4GY74U.js → chunk-MTL7MXGR.js} +6 -6
- package/dist/{chunk-TFR7DSOV.js → chunk-MVZ2TPVP.js} +2 -2
- package/dist/{chunk-CPWQB3N5.js → chunk-N5DNADLQ.js} +7 -7
- package/dist/{chunk-ELNXJMGB.js → chunk-NNARWO72.js} +6 -6
- package/dist/{chunk-PT43Y56J.js → chunk-NRT6QZQB.js} +102 -16
- package/dist/chunk-NRT6QZQB.js.map +1 -0
- package/dist/{chunk-QIBVIOXO.js → chunk-NWHBJQAL.js} +99 -8
- package/dist/chunk-NWHBJQAL.js.map +1 -0
- package/dist/chunk-NYMLINRP.js +28 -0
- package/dist/chunk-NYMLINRP.js.map +1 -0
- package/dist/{chunk-7MG7SJT7.js → chunk-ODVPTDPK.js} +1 -1
- package/dist/chunk-ODVPTDPK.js.map +1 -0
- package/dist/chunk-ORDURZBU.js +461 -0
- package/dist/chunk-ORDURZBU.js.map +1 -0
- package/dist/{chunk-6YXCPL4T.js → chunk-PDCG6PR5.js} +2 -2
- package/dist/{chunk-REDOOY2Q.js → chunk-PSIV7CJV.js} +2 -2
- package/dist/{chunk-NA2NIJZI.js → chunk-QBBUZ3I3.js} +126 -19
- package/dist/chunk-QBBUZ3I3.js.map +1 -0
- package/dist/{chunk-5VCRVKOZ.js → chunk-QOOUUR4A.js} +6 -4
- package/dist/{chunk-5VCRVKOZ.js.map → chunk-QOOUUR4A.js.map} +1 -1
- package/dist/{chunk-ANATMFIO.js → chunk-QWFHIOD2.js} +5 -5
- package/dist/{chunk-X2DLENDQ.js → chunk-QWGU66MP.js} +3 -3
- package/dist/chunk-RHVMZSUU.js +7 -0
- package/dist/chunk-RHVMZSUU.js.map +1 -0
- package/dist/{chunk-BSFNRLK2.js → chunk-S57HTZ6X.js} +5 -5
- package/dist/{chunk-SZJ3DLZA.js → chunk-SEE332EV.js} +2 -2
- package/dist/{chunk-YYP7WSEB.js → chunk-SI3V7D4G.js} +2 -2
- package/dist/{chunk-UGTBXF5U.js → chunk-SOIQ4MM4.js} +3 -3
- package/dist/chunk-SUZKW6UR.js +25 -0
- package/dist/chunk-SUZKW6UR.js.map +1 -0
- package/dist/{chunk-VXGSWL6L.js → chunk-SYVZW77S.js} +6 -6
- package/dist/{chunk-6GOE5PGN.js → chunk-T2LBQ5DV.js} +883 -227
- package/dist/chunk-T2LBQ5DV.js.map +1 -0
- package/dist/chunk-T52GX4SA.js +215 -0
- package/dist/chunk-T52GX4SA.js.map +1 -0
- package/dist/{chunk-MVMXZYXT.js → chunk-TKUOEU2F.js} +2 -2
- package/dist/chunk-TOPYQ6GA.js +31 -0
- package/dist/chunk-TOPYQ6GA.js.map +1 -0
- package/dist/{chunk-SMH6SRX7.js → chunk-TROR3ALR.js} +2 -2
- package/dist/{chunk-2C3AQB46.js → chunk-UD5EVGZ7.js} +42 -389
- package/dist/chunk-UD5EVGZ7.js.map +1 -0
- package/dist/{chunk-KJIMGIWO.js → chunk-UPD5NWI5.js} +65 -17
- package/dist/chunk-UPD5NWI5.js.map +1 -0
- package/dist/{chunk-SL3JAAKN.js → chunk-UYB234ZR.js} +30 -2
- package/dist/chunk-UYB234ZR.js.map +1 -0
- package/dist/chunk-VHM7HCKB.js +220 -0
- package/dist/chunk-VHM7HCKB.js.map +1 -0
- package/dist/{chunk-DGOZ4UZD.js → chunk-VNNRUGMM.js} +2 -2
- package/dist/{chunk-HDOU6I2Y.js → chunk-VNPEWFPD.js} +4 -4
- package/dist/{chunk-L7CIOOBW.js → chunk-WNJ4AVGE.js} +2 -2
- package/dist/{chunk-FMZY5Q6L.js → chunk-WX5ADGTZ.js} +3 -3
- package/dist/{chunk-VXANTWBJ.js → chunk-WY2XXTET.js} +92 -6
- package/dist/{chunk-VXANTWBJ.js.map → chunk-WY2XXTET.js.map} +1 -1
- package/dist/{chunk-6X6SEMEE.js → chunk-X25NWUZB.js} +33 -8
- package/dist/chunk-X25NWUZB.js.map +1 -0
- package/dist/{chunk-Q7HZX3IF.js → chunk-X4773RBR.js} +2 -2
- package/dist/chunk-XBKH4FOC.js +195 -0
- package/dist/chunk-XBKH4FOC.js.map +1 -0
- package/dist/{chunk-ANSIZYEG.js → chunk-YNIUIERI.js} +3 -3
- package/dist/chunk-YSK2CU2Q.js +936 -0
- package/dist/chunk-YSK2CU2Q.js.map +1 -0
- package/dist/{chunk-UXVWEX5L.js → chunk-Z5HTYMMQ.js} +6 -2
- package/dist/chunk-Z5HTYMMQ.js.map +1 -0
- package/dist/{chunk-RRNRNANG.js → chunk-ZE4CHIED.js} +66 -75
- package/dist/chunk-ZE4CHIED.js.map +1 -0
- package/dist/chunk-ZSX4S5XB.js +1289 -0
- package/dist/chunk-ZSX4S5XB.js.map +1 -0
- package/dist/{chunk-BZ3534YM.js → chunk-ZUVBC32X.js} +2 -2
- package/dist/{chunk-L742JPKZ.js → chunk-ZXABPVM6.js} +6 -6
- package/dist/classified/index.js +5 -5
- package/dist/{classified-marker-LI2SF2E4.js → classified-marker-W3USLL5M.js} +3 -3
- package/dist/collection-facade-QU6IJBN3.js +48 -0
- package/dist/{computed-VPOKQK4N.js → computed-TPFBX7U4.js} +3 -3
- package/dist/consent/index.js +9 -9
- package/dist/cover/index.js +10 -10
- package/dist/coverage/index.js +306 -0
- package/dist/coverage/index.js.map +1 -0
- package/dist/custody/index.js +12 -12
- package/dist/{dead-filter-TSWZQRR5.js → dead-filter-U2UYKSZL.js} +2 -2
- package/dist/debug/index.js +1 -1
- package/dist/{delegation-OVIFFPG4.js → delegation-S3AEPW2T.js} +11 -11
- package/dist/derivations/index.js +25 -22
- package/dist/derive-OX7F6TGG.js +21 -0
- package/dist/directory/index.js +10 -10
- package/dist/{dispatch-WC6X2M6C.js → dispatch-3CQDJV5Q.js} +5 -5
- package/dist/{dispatch-S73TK3IY.js → dispatch-RH4LHKBH.js} +21 -21
- package/dist/{enclave-KJOTOH7X.js → enclave-27SMF6GF.js} +15 -9
- package/dist/executor-B6SRO2QS.js +36 -0
- package/dist/executor-BI5CHWRY.js +8 -0
- package/dist/executor-RBKM5W5K.js +8 -0
- package/dist/export-accessible-VMA3YM5V.js +22 -0
- package/dist/extract-partition-NF7PXGPP.js +37 -0
- package/dist/{fanout-sidecar-WUFXNYP4.js → fanout-sidecar-OT6RYLOL.js} +9 -9
- package/dist/find-LZMP26KF.js +10 -0
- package/dist/forget/index.js +9 -9
- package/dist/guards/index.js +4 -4
- package/dist/history/index.js +13 -13
- package/dist/i18n/index.js +14 -14
- package/dist/index.d.ts +29 -6
- package/dist/index.js +999 -191
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +13 -5
- package/dist/indexing/index.js.map +1 -1
- package/dist/introspection/index.js +11 -11
- package/dist/issue-IHARXWW5.js +18 -0
- package/dist/ivf-flat-UZ6DQDLS.js +314 -0
- package/dist/ivf-flat-UZ6DQDLS.js.map +1 -0
- package/dist/{json-schema-V3M5MUCM.js → json-schema-3SHX72CC.js} +2 -1
- package/dist/json-schema-3SHX72CC.js.map +1 -0
- package/dist/kernel/collection-config.d.ts +4 -20
- package/dist/kernel/collection.d.ts +29 -8
- package/dist/kernel/enclave/crypto.d.ts +16 -0
- package/dist/kernel/enclave/index.d.ts +1 -1
- package/dist/kernel/enclave/record-keys/record-codec.d.ts +25 -0
- package/dist/kernel/errors.d.ts +227 -36
- package/dist/kernel/generation-map.d.ts +48 -0
- package/dist/kernel/memory-store.d.ts +35 -7
- package/dist/kernel/noydb.d.ts +6 -1
- package/dist/kernel/present-cache.d.ts +58 -0
- package/dist/kernel/query/all.d.ts +7 -0
- package/dist/kernel/query/builder.d.ts +601 -270
- package/dist/kernel/query/civil-date.d.ts +64 -0
- package/dist/kernel/query/cursor.d.ts +40 -0
- package/dist/kernel/query/distinct-key.d.ts +98 -0
- package/dist/kernel/query/hydration.d.ts +76 -0
- package/dist/kernel/query/index.d.ts +31 -15
- package/dist/kernel/query/internal/core.d.ts +30 -0
- package/dist/kernel/query/internal/hooks.d.ts +22 -0
- package/dist/kernel/query/internal/maintenance.d.ts +43 -0
- package/dist/kernel/query/live/incremental.d.ts +314 -0
- package/dist/kernel/query/live/index.d.ts +22 -0
- package/dist/kernel/query/live/install.d.ts +2 -0
- package/dist/kernel/query/{live.d.ts → live/live.d.ts} +39 -9
- package/dist/kernel/query/live/methods.d.ts +107 -0
- package/dist/kernel/query/predicate.d.ts +119 -1
- package/dist/kernel/query/reduce/date-trunc.d.ts +75 -0
- package/dist/kernel/query/reduce/index.d.ts +36 -0
- package/dist/kernel/query/reduce/install.d.ts +2 -0
- package/dist/kernel/query/reduce/methods.d.ts +259 -0
- package/dist/kernel/query/reduce/scan-methods.d.ts +121 -0
- package/dist/kernel/query/relate/explain.d.ts +199 -0
- package/dist/kernel/query/relate/index.d.ts +48 -0
- package/dist/kernel/query/relate/install.d.ts +2 -0
- package/dist/kernel/query/relate/join-on.d.ts +126 -0
- package/dist/kernel/query/relate/join-reduce.d.ts +16 -0
- package/dist/kernel/query/relate/join.d.ts +452 -0
- package/dist/kernel/query/relate/methods.d.ts +426 -0
- package/dist/kernel/query/relate/partition.d.ts +87 -0
- package/dist/kernel/query/relate/scan-methods.d.ts +163 -0
- package/dist/kernel/query/relate/traverse.d.ts +109 -0
- package/dist/kernel/query/scan-builder.d.ts +79 -176
- package/dist/kernel/query/sort-key.d.ts +52 -0
- package/dist/kernel/tx-write-gate.d.ts +77 -0
- package/dist/kernel/types.d.ts +71 -3
- package/dist/kernel/validation.d.ts +27 -10
- package/dist/kernel/vault.d.ts +9 -4
- package/dist/kernel/via/compose.d.ts +3 -0
- package/dist/kernel/via/index.d.ts +56 -0
- package/dist/kernel/via/pipeline.d.ts +48 -0
- package/dist/{ledger-F33ZVMTK.js → ledger-KZPCMVZY.js} +11 -11
- package/dist/liberate-GRLCZMW4.js +24 -0
- package/dist/link-set-JCMJ7ULP.js +30 -0
- package/dist/{managed-secret-PQYKSR6T.js → managed-secret-S3MQ6SH6.js} +10 -10
- package/dist/materialized-views/index.js +30 -23
- package/dist/{migrate-cek-5ENH64AA.js → migrate-cek-V7GKJZ7O.js} +2 -2
- package/dist/money/index.js +5 -5
- package/dist/noydb-SWQJ3MZS.js +97 -0
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +12 -12
- package/dist/pod/index.js +75 -68
- package/dist/{pod-handle-Q736KYON.js → pod-handle-WGDFB4C2.js} +9 -9
- package/dist/policy/index.js +10 -10
- package/dist/port/with/blob-strategy.d.ts +9 -0
- package/dist/port/with/collection-options.d.ts +5 -0
- package/dist/port/with/coverage-strategy.d.ts +83 -0
- package/dist/port/with/service-bus.d.ts +46 -0
- package/dist/port/with/strategies.d.ts +2 -0
- package/dist/portability/index.js +8 -8
- package/dist/{post-register-LNE2FE2A.js → post-register-SLSXIPBV.js} +6 -6
- package/dist/query/all/index.js +31 -0
- package/dist/query/index.js +20 -32
- package/dist/query/live/index.js +21 -0
- package/dist/query/live/index.js.map +1 -0
- package/dist/query/reduce/index.js +33 -0
- package/dist/query/reduce/index.js.map +1 -0
- package/dist/query/relate/index.js +56 -0
- package/dist/query/relate/index.js.map +1 -0
- package/dist/reduce/index.js +72 -18
- package/dist/reduce/index.js.map +1 -1
- package/dist/register-F3OYE7MJ.js +31 -0
- package/dist/registry-CILQFXFK.js +8 -0
- package/dist/registry-XNNYQVKV.js +8 -0
- package/dist/registry-YCDZV3VW.js +35 -0
- package/dist/registry-ZGYS33TE.js +24 -0
- package/dist/request-withdrawal-Z5NC6TXT.js +30 -0
- package/dist/{reveal-67RDQRIN.js → reveal-4BCKPEC2.js} +6 -6
- package/dist/revoke-ZL62WC2D.js +23 -0
- package/dist/satellites/index.js +1 -1
- package/dist/schema-update/index.js +2 -2
- package/dist/sealed-record/index.js +12 -12
- package/dist/search/index.js +11 -5
- package/dist/{seed-G42JYN56.js → seed-4JS2RJ4A.js} +12 -12
- package/dist/sequence/index.js +9 -9
- package/dist/session/index.js +9 -9
- package/dist/shadow/index.js +2 -2
- package/dist/signer-MBZZMXTC.js +24 -0
- package/dist/snapshots/index.js +10 -10
- package/dist/{stale-DDL7WQEZ.js → stale-TJ3DYZMQ.js} +10 -10
- package/dist/storage-SVMKRGCW.js +22 -0
- package/dist/{store-coordination-provider-MEQ2MJQG.js → store-coordination-provider-2O2VUHKW.js} +10 -10
- package/dist/sync/index.js +10 -10
- package/dist/team/index.js +17 -15
- package/dist/tiers/index.js +13 -11
- package/dist/to/index.js +2 -2
- package/dist/transactions/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/vault-head/index.js +8 -8
- package/dist/{verify-KOV2G5D6.js → verify-RVT67IMH.js} +5 -5
- package/dist/via/blob/index.d.ts +1 -0
- package/dist/via/geo/binding.d.ts +31 -0
- package/dist/via/geo/descriptor.d.ts +54 -0
- package/dist/via/geo/geohash.d.ts +95 -0
- package/dist/via/geo/index.d.ts +13 -0
- package/dist/via/geo/where.d.ts +50 -0
- package/dist/via/i18n/core.d.ts +1 -1
- package/dist/via/lookup/registry.d.ts +1 -1
- package/dist/via/lookup/snapshot.d.ts +3 -3
- package/dist/walk-HJ42EISE.js +21 -0
- package/dist/walk-HJ42EISE.js.map +1 -0
- package/dist/with-audit/coverage/accounting.d.ts +112 -0
- package/dist/with-audit/coverage/active.d.ts +29 -0
- package/dist/with-audit/coverage/index.d.ts +61 -0
- package/dist/with-audit/coverage/sketch.d.ts +75 -0
- package/dist/with-audit/periods/periods.d.ts +55 -7
- package/dist/with-audit/periods/reserved-collections.d.ts +3 -0
- package/dist/with-audit/periods/vault-facade.d.ts +17 -0
- package/dist/with-audit/tiers/index.d.ts +51 -0
- package/dist/with-audit/tiers/strategy.d.ts +8 -0
- package/dist/with-cargo/floor.d.ts +2 -2
- package/dist/with-commit/tx/invariants.d.ts +1 -1
- package/dist/with-commit/tx/transaction.d.ts +13 -3
- package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +4 -3
- package/dist/with-formula/materialized-views/emit-memo.d.ts +40 -0
- package/dist/with-formula/materialized-views/executor.d.ts +8 -0
- package/dist/with-formula/materialized-views/index.d.ts +1 -1
- package/dist/with-formula/materialized-views/registry.d.ts +15 -0
- package/dist/with-formula/materialized-views/types.d.ts +106 -14
- package/dist/with-formula/materialized-views/window-stage.d.ts +11 -0
- package/dist/with-formula/overlay-views/types.d.ts +1 -1
- package/dist/with-formula/overlay-views/virtual-collection.d.ts +13 -4
- package/dist/with-lookup/embeddings/chunks.d.ts +79 -0
- package/dist/with-lookup/embeddings/descriptor.d.ts +21 -0
- package/dist/with-lookup/embeddings/index.d.ts +3 -0
- package/dist/with-lookup/embeddings/ivf-flat.d.ts +93 -0
- package/dist/with-lookup/embeddings/vector-index.d.ts +73 -0
- package/dist/with-lookup/embeddings/vector-set.d.ts +94 -1
- package/dist/with-lookup/embeddings/with-vector-index.d.ts +67 -0
- package/dist/with-lookup/indexing/collection-facade.d.ts +85 -2
- package/dist/with-lookup/indexing/compound-indexes.d.ts +129 -0
- package/dist/with-lookup/indexing/eager-indexes.d.ts +170 -1
- package/dist/with-lookup/indexing/index-snapshot.d.ts +62 -0
- package/dist/with-lookup/indexing/lazy-builder.d.ts +33 -0
- package/dist/with-lookup/indexing/persisted-field-indexes.d.ts +104 -0
- package/dist/with-lookup/indexing/persisted-indexes.d.ts +12 -0
- package/dist/with-lookup/indexing/sorted-indexes.d.ts +117 -0
- package/dist/with-lookup/indexing/unique-constraints.d.ts +106 -23
- package/dist/with-lookup/reduce/active.d.ts +2 -24
- package/dist/with-lookup/reduce/group-core.d.ts +43 -0
- package/dist/with-lookup/reduce/groupby.d.ts +195 -36
- package/dist/with-lookup/reduce/incremental-group.d.ts +153 -0
- package/dist/with-lookup/reduce/index.d.ts +26 -5
- package/dist/with-lookup/reduce/reducers.d.ts +255 -1
- package/dist/with-lookup/reduce/reduction.d.ts +44 -13
- package/dist/with-lookup/reduce/strategy.d.ts +43 -3
- package/dist/with-lookup/reduce/window.d.ts +262 -0
- package/dist/with-lookup/search/collection-facade.d.ts +44 -8
- package/dist/with-lookup/search/index-store.d.ts +5 -3
- package/dist/with-lookup/search/index.d.ts +4 -2
- package/dist/with-lookup/search/inverted-index.d.ts +38 -2
- package/dist/with-lookup/search/persisted-index-store.d.ts +5 -2
- package/dist/with-lookup/search/phrase.d.ts +28 -0
- package/dist/with-lookup/search/retrieve-types.d.ts +57 -1
- package/dist/with-lookup/search/serialize.d.ts +29 -3
- package/dist/with-lookup/search/strategy.d.ts +2 -6
- package/dist/with-party/directory/cover/index.d.ts +1 -1
- package/dist/with-party/directory/cover/storage.d.ts +1 -1
- package/dist/with-party/directory/cover/types.d.ts +1 -1
- package/dist/with-party/directory/index.d.ts +1 -1
- package/dist/with-party/directory/types.d.ts +1 -1
- package/dist/with-party/directory/user-envelope/api.d.ts +1 -1
- package/dist/with-party/policy/engine.d.ts +1 -1
- package/dist/with-party/policy/index.d.ts +1 -1
- package/dist/with-party/policy/presets.d.ts +1 -1
- package/dist/with-party/team/authenticators.d.ts +91 -1
- package/dist/with-party/team/index.d.ts +3 -2
- package/dist/with-party/team/keyring.d.ts +13 -6
- package/dist/with-party/team/managed-secret.d.ts +1 -1
- package/dist/with-party/team/noydb-facade.d.ts +12 -3
- package/dist/with-party/team/wrapped-deks.d.ts +4 -4
- package/dist/with-pod/format.d.ts +1 -1
- package/dist/with-pod/pod.d.ts +5 -5
- package/dist/with-shape/blobs/blob-compaction.d.ts +16 -0
- package/dist/with-shape/blobs/blob-set.d.ts +21 -2
- package/dist/with-shape/blobs/legacy-sweep.d.ts +35 -0
- package/dist/with-shape/introspection/describe.d.ts +6 -0
- package/dist/with-shape/introspection/field-meta.d.ts +18 -0
- package/dist/with-shape/introspection/types.d.ts +57 -1
- package/dist/with-shape/links/vault-facade.d.ts +1 -1
- package/dist/with-store/partitioned/index.d.ts +337 -0
- package/dist/with-sync/change-broadcast.d.ts +153 -0
- package/dist/withdraw-accessible-5NZUPAVA.js +27 -0
- package/dist/withdraw-accessible-5NZUPAVA.js.map +1 -0
- package/package.json +37 -10
- package/dist/api-TXFOVOXX.js +0 -19
- package/dist/backup-IJTB4S4M.js.map +0 -1
- package/dist/chunk-2577DKXB.js.map +0 -1
- package/dist/chunk-2C3AQB46.js.map +0 -1
- package/dist/chunk-4GVM6QZA.js.map +0 -1
- package/dist/chunk-5WDXHNSW.js.map +0 -1
- package/dist/chunk-6GOE5PGN.js.map +0 -1
- package/dist/chunk-6X6SEMEE.js.map +0 -1
- package/dist/chunk-77K4PG6P.js.map +0 -1
- package/dist/chunk-7MG2LHO5.js +0 -1616
- package/dist/chunk-7MG2LHO5.js.map +0 -1
- package/dist/chunk-7MG7SJT7.js.map +0 -1
- package/dist/chunk-7O3Y4PPD.js.map +0 -1
- package/dist/chunk-AO42KJO6.js.map +0 -1
- package/dist/chunk-ATL3ZVXT.js +0 -151
- package/dist/chunk-ATL3ZVXT.js.map +0 -1
- package/dist/chunk-BLN54W3L.js.map +0 -1
- package/dist/chunk-BM5TWITZ.js.map +0 -1
- package/dist/chunk-CUZLNGD5.js.map +0 -1
- package/dist/chunk-EQEYOJBM.js.map +0 -1
- package/dist/chunk-G56KBWFY.js.map +0 -1
- package/dist/chunk-I3ISCYT7.js +0 -159
- package/dist/chunk-I3ISCYT7.js.map +0 -1
- package/dist/chunk-KG7TZKZG.js.map +0 -1
- package/dist/chunk-KJIMGIWO.js.map +0 -1
- package/dist/chunk-KTFRCC5C.js.map +0 -1
- package/dist/chunk-KUX3OB6D.js.map +0 -1
- package/dist/chunk-MUM7IANK.js.map +0 -1
- package/dist/chunk-NA2NIJZI.js.map +0 -1
- package/dist/chunk-NSITFOCJ.js +0 -99
- package/dist/chunk-NSITFOCJ.js.map +0 -1
- package/dist/chunk-PT43Y56J.js.map +0 -1
- package/dist/chunk-QIBVIOXO.js.map +0 -1
- package/dist/chunk-RRNRNANG.js.map +0 -1
- package/dist/chunk-RTBJ5IOO.js +0 -87
- package/dist/chunk-RTBJ5IOO.js.map +0 -1
- package/dist/chunk-SKGMN35F.js.map +0 -1
- package/dist/chunk-SL3JAAKN.js.map +0 -1
- package/dist/chunk-SPXXX5E4.js.map +0 -1
- package/dist/chunk-SPYWXKJN.js.map +0 -1
- package/dist/chunk-U4FOQDY4.js.map +0 -1
- package/dist/chunk-UXVWEX5L.js.map +0 -1
- package/dist/chunk-UXWB3FPF.js.map +0 -1
- package/dist/chunk-YMUFFJCO.js.map +0 -1
- package/dist/chunk-ZN4FD4PE.js +0 -364
- package/dist/chunk-ZN4FD4PE.js.map +0 -1
- package/dist/chunk-ZORTV6NH.js.map +0 -1
- package/dist/collection-facade-4GRREZ6C.js +0 -45
- package/dist/derive-6O5SWQKN.js +0 -21
- package/dist/executor-5NIMLSKZ.js +0 -8
- package/dist/executor-AQVXV5GZ.js +0 -8
- package/dist/executor-PUAO6AKJ.js +0 -29
- package/dist/export-accessible-72EQNBMR.js +0 -22
- package/dist/extract-partition-PUYNU3UF.js +0 -37
- package/dist/find-2ABFCZX4.js +0 -10
- package/dist/issue-SIDORTSZ.js +0 -18
- package/dist/json-schema-V3M5MUCM.js.map +0 -1
- package/dist/kernel/query/join.d.ts +0 -232
- package/dist/liberate-LCDPNAG2.js +0 -24
- package/dist/link-set-FKNWAYKS.js +0 -30
- package/dist/noydb-DUXZPKSN.js +0 -90
- package/dist/register-I2DZXGAR.js +0 -31
- package/dist/registry-23WF3TGH.js +0 -8
- package/dist/registry-4AYVUNXK.js +0 -8
- package/dist/registry-VSSQPIGF.js +0 -18
- package/dist/registry-YLEWMGAC.js +0 -32
- package/dist/request-withdrawal-KFQHEZ25.js +0 -30
- package/dist/revoke-DQDZAZZM.js +0 -23
- package/dist/signer-WAMDZHEN.js +0 -24
- package/dist/storage-FLR73HHF.js +0 -22
- package/dist/walk-3UQBRMDV.js +0 -21
- package/dist/withdraw-accessible-EL5GXZBS.js +0 -27
- /package/dist/{api-TXFOVOXX.js.map → api-GVYEKSJE.js.map} +0 -0
- /package/dist/{chunk-BUE2D7PX.js.map → chunk-32YV3TJT.js.map} +0 -0
- /package/dist/{chunk-3RCJJBNR.js.map → chunk-3ELRMVJK.js.map} +0 -0
- /package/dist/{chunk-6GMZ7HEE.js.map → chunk-3F7GLNAE.js.map} +0 -0
- /package/dist/{chunk-2Y4IMKA6.js.map → chunk-3H5KLDZN.js.map} +0 -0
- /package/dist/{chunk-VTFVLCUH.js.map → chunk-3JWHAR6E.js.map} +0 -0
- /package/dist/{chunk-JBDFMYKQ.js.map → chunk-4AF3TUMP.js.map} +0 -0
- /package/dist/{chunk-J6FXAEUG.js.map → chunk-6B3VNR4P.js.map} +0 -0
- /package/dist/{chunk-TUFM4UZP.js.map → chunk-6K7DPM7D.js.map} +0 -0
- /package/dist/{chunk-K6LHRFBL.js.map → chunk-6LMQ5R26.js.map} +0 -0
- /package/dist/{chunk-XLMEZIAJ.js.map → chunk-6OWXYZK2.js.map} +0 -0
- /package/dist/{chunk-BOWNCWZT.js.map → chunk-6QSQQLSE.js.map} +0 -0
- /package/dist/{chunk-NQKIUNW5.js.map → chunk-A6IJU4TK.js.map} +0 -0
- /package/dist/{chunk-QIZPZMUI.js.map → chunk-AOWGXU6D.js.map} +0 -0
- /package/dist/{chunk-SFAWCTEM.js.map → chunk-B57AFBY2.js.map} +0 -0
- /package/dist/{chunk-GPEQUXHL.js.map → chunk-B6SJIBQK.js.map} +0 -0
- /package/dist/{chunk-Q2PU57HC.js.map → chunk-BK2HHQGN.js.map} +0 -0
- /package/dist/{collection-facade-4GRREZ6C.js.map → chunk-BKT776R5.js.map} +0 -0
- /package/dist/{chunk-FXBIP2WD.js.map → chunk-BUDAGWL5.js.map} +0 -0
- /package/dist/{chunk-BOET4NA4.js.map → chunk-CKNGS5MH.js.map} +0 -0
- /package/dist/{chunk-YSRUYAVU.js.map → chunk-DE4DH2RZ.js.map} +0 -0
- /package/dist/{chunk-6I2RQCET.js.map → chunk-DF73H4UN.js.map} +0 -0
- /package/dist/{chunk-K7NTTA6P.js.map → chunk-EOVMT6TB.js.map} +0 -0
- /package/dist/{chunk-XTXOCYOJ.js.map → chunk-FCKWQE2H.js.map} +0 -0
- /package/dist/{chunk-4OZNXTO4.js.map → chunk-FN5EBVTQ.js.map} +0 -0
- /package/dist/{chunk-NKHRDYOR.js.map → chunk-FQ5VRHIB.js.map} +0 -0
- /package/dist/{chunk-FAHMLERK.js.map → chunk-FW22ZCXT.js.map} +0 -0
- /package/dist/{chunk-RMS3NEA3.js.map → chunk-HT2AHGQI.js.map} +0 -0
- /package/dist/{chunk-CHJBLCOG.js.map → chunk-HVSCEIYL.js.map} +0 -0
- /package/dist/{chunk-GY4WYNNG.js.map → chunk-ID6Z6E66.js.map} +0 -0
- /package/dist/{chunk-EYBQEIUY.js.map → chunk-IEX7NK2K.js.map} +0 -0
- /package/dist/{chunk-KUJDV5QH.js.map → chunk-ISZQJBML.js.map} +0 -0
- /package/dist/{chunk-LWBCUYZW.js.map → chunk-IT22PWKV.js.map} +0 -0
- /package/dist/{chunk-7V4TP3AF.js.map → chunk-J6UOHJY5.js.map} +0 -0
- /package/dist/{chunk-JMGDHKQF.js.map → chunk-JCN44NCY.js.map} +0 -0
- /package/dist/{chunk-CARABLSQ.js.map → chunk-K6W7BVZ6.js.map} +0 -0
- /package/dist/{chunk-453F654R.js.map → chunk-L7DOS3TE.js.map} +0 -0
- /package/dist/{chunk-WEQEYLCS.js.map → chunk-LGRLME4M.js.map} +0 -0
- /package/dist/{chunk-RMF67KCG.js.map → chunk-LQ4ZHOKP.js.map} +0 -0
- /package/dist/{chunk-ZVO4QVPD.js.map → chunk-M522UYZ2.js.map} +0 -0
- /package/dist/{chunk-2N4GY74U.js.map → chunk-MTL7MXGR.js.map} +0 -0
- /package/dist/{chunk-TFR7DSOV.js.map → chunk-MVZ2TPVP.js.map} +0 -0
- /package/dist/{chunk-CPWQB3N5.js.map → chunk-N5DNADLQ.js.map} +0 -0
- /package/dist/{chunk-ELNXJMGB.js.map → chunk-NNARWO72.js.map} +0 -0
- /package/dist/{chunk-6YXCPL4T.js.map → chunk-PDCG6PR5.js.map} +0 -0
- /package/dist/{chunk-REDOOY2Q.js.map → chunk-PSIV7CJV.js.map} +0 -0
- /package/dist/{chunk-ANATMFIO.js.map → chunk-QWFHIOD2.js.map} +0 -0
- /package/dist/{chunk-X2DLENDQ.js.map → chunk-QWGU66MP.js.map} +0 -0
- /package/dist/{chunk-BSFNRLK2.js.map → chunk-S57HTZ6X.js.map} +0 -0
- /package/dist/{chunk-SZJ3DLZA.js.map → chunk-SEE332EV.js.map} +0 -0
- /package/dist/{chunk-YYP7WSEB.js.map → chunk-SI3V7D4G.js.map} +0 -0
- /package/dist/{chunk-UGTBXF5U.js.map → chunk-SOIQ4MM4.js.map} +0 -0
- /package/dist/{chunk-VXGSWL6L.js.map → chunk-SYVZW77S.js.map} +0 -0
- /package/dist/{chunk-MVMXZYXT.js.map → chunk-TKUOEU2F.js.map} +0 -0
- /package/dist/{chunk-SMH6SRX7.js.map → chunk-TROR3ALR.js.map} +0 -0
- /package/dist/{chunk-DGOZ4UZD.js.map → chunk-VNNRUGMM.js.map} +0 -0
- /package/dist/{chunk-HDOU6I2Y.js.map → chunk-VNPEWFPD.js.map} +0 -0
- /package/dist/{chunk-L7CIOOBW.js.map → chunk-WNJ4AVGE.js.map} +0 -0
- /package/dist/{chunk-FMZY5Q6L.js.map → chunk-WX5ADGTZ.js.map} +0 -0
- /package/dist/{chunk-Q7HZX3IF.js.map → chunk-X4773RBR.js.map} +0 -0
- /package/dist/{chunk-ANSIZYEG.js.map → chunk-YNIUIERI.js.map} +0 -0
- /package/dist/{chunk-BZ3534YM.js.map → chunk-ZUVBC32X.js.map} +0 -0
- /package/dist/{chunk-L742JPKZ.js.map → chunk-ZXABPVM6.js.map} +0 -0
- /package/dist/{classified-marker-LI2SF2E4.js.map → classified-marker-W3USLL5M.js.map} +0 -0
- /package/dist/{computed-VPOKQK4N.js.map → collection-facade-QU6IJBN3.js.map} +0 -0
- /package/dist/{derive-6O5SWQKN.js.map → computed-TPFBX7U4.js.map} +0 -0
- /package/dist/{dead-filter-TSWZQRR5.js.map → dead-filter-U2UYKSZL.js.map} +0 -0
- /package/dist/{delegation-OVIFFPG4.js.map → delegation-S3AEPW2T.js.map} +0 -0
- /package/dist/{enclave-KJOTOH7X.js.map → derive-OX7F6TGG.js.map} +0 -0
- /package/dist/{dispatch-WC6X2M6C.js.map → dispatch-3CQDJV5Q.js.map} +0 -0
- /package/dist/{dispatch-S73TK3IY.js.map → dispatch-RH4LHKBH.js.map} +0 -0
- /package/dist/{executor-5NIMLSKZ.js.map → enclave-27SMF6GF.js.map} +0 -0
- /package/dist/{executor-AQVXV5GZ.js.map → executor-B6SRO2QS.js.map} +0 -0
- /package/dist/{executor-PUAO6AKJ.js.map → executor-BI5CHWRY.js.map} +0 -0
- /package/dist/{export-accessible-72EQNBMR.js.map → executor-RBKM5W5K.js.map} +0 -0
- /package/dist/{extract-partition-PUYNU3UF.js.map → export-accessible-VMA3YM5V.js.map} +0 -0
- /package/dist/{find-2ABFCZX4.js.map → extract-partition-NF7PXGPP.js.map} +0 -0
- /package/dist/{fanout-sidecar-WUFXNYP4.js.map → fanout-sidecar-OT6RYLOL.js.map} +0 -0
- /package/dist/{issue-SIDORTSZ.js.map → find-LZMP26KF.js.map} +0 -0
- /package/dist/{ledger-F33ZVMTK.js.map → issue-IHARXWW5.js.map} +0 -0
- /package/dist/{liberate-LCDPNAG2.js.map → ledger-KZPCMVZY.js.map} +0 -0
- /package/dist/{link-set-FKNWAYKS.js.map → liberate-GRLCZMW4.js.map} +0 -0
- /package/dist/{managed-secret-PQYKSR6T.js.map → link-set-JCMJ7ULP.js.map} +0 -0
- /package/dist/{noydb-DUXZPKSN.js.map → managed-secret-S3MQ6SH6.js.map} +0 -0
- /package/dist/{migrate-cek-5ENH64AA.js.map → migrate-cek-V7GKJZ7O.js.map} +0 -0
- /package/dist/{register-I2DZXGAR.js.map → noydb-SWQJ3MZS.js.map} +0 -0
- /package/dist/{pod-handle-Q736KYON.js.map → pod-handle-WGDFB4C2.js.map} +0 -0
- /package/dist/{post-register-LNE2FE2A.js.map → post-register-SLSXIPBV.js.map} +0 -0
- /package/dist/{registry-23WF3TGH.js.map → query/all/index.js.map} +0 -0
- /package/dist/{registry-4AYVUNXK.js.map → register-F3OYE7MJ.js.map} +0 -0
- /package/dist/{registry-VSSQPIGF.js.map → registry-CILQFXFK.js.map} +0 -0
- /package/dist/{registry-YLEWMGAC.js.map → registry-XNNYQVKV.js.map} +0 -0
- /package/dist/{request-withdrawal-KFQHEZ25.js.map → registry-YCDZV3VW.js.map} +0 -0
- /package/dist/{revoke-DQDZAZZM.js.map → registry-ZGYS33TE.js.map} +0 -0
- /package/dist/{signer-WAMDZHEN.js.map → request-withdrawal-Z5NC6TXT.js.map} +0 -0
- /package/dist/{reveal-67RDQRIN.js.map → reveal-4BCKPEC2.js.map} +0 -0
- /package/dist/{stale-DDL7WQEZ.js.map → revoke-ZL62WC2D.js.map} +0 -0
- /package/dist/{seed-G42JYN56.js.map → seed-4JS2RJ4A.js.map} +0 -0
- /package/dist/{storage-FLR73HHF.js.map → signer-MBZZMXTC.js.map} +0 -0
- /package/dist/{walk-3UQBRMDV.js.map → stale-TJ3DYZMQ.js.map} +0 -0
- /package/dist/{withdraw-accessible-EL5GXZBS.js.map → storage-SVMKRGCW.js.map} +0 -0
- /package/dist/{store-coordination-provider-MEQ2MJQG.js.map → store-coordination-provider-2O2VUHKW.js.map} +0 -0
- /package/dist/{verify-KOV2G5D6.js.map → verify-RVT67IMH.js.map} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
issueAttestationCore
|
|
3
|
+
} from "./chunk-MTL7MXGR.js";
|
|
4
|
+
import "./chunk-QWFHIOD2.js";
|
|
5
|
+
import "./chunk-4AOERLTV.js";
|
|
6
|
+
import "./chunk-KJFW62P4.js";
|
|
7
|
+
import "./chunk-SEE332EV.js";
|
|
8
|
+
import "./chunk-6QSQQLSE.js";
|
|
9
|
+
import "./chunk-DE4DH2RZ.js";
|
|
10
|
+
import "./chunk-LQ4ZHOKP.js";
|
|
11
|
+
import "./chunk-LP7BEXCT.js";
|
|
12
|
+
import "./chunk-UYB234ZR.js";
|
|
13
|
+
import "./chunk-ODVPTDPK.js";
|
|
14
|
+
import "./chunk-244VXYPG.js";
|
|
15
|
+
export {
|
|
16
|
+
issueAttestationCore
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=issue-IHARXWW5.js.map
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
// src/with-lookup/embeddings/ivf-flat.ts
|
|
2
|
+
function defaultNlist(n) {
|
|
3
|
+
return Math.max(4, Math.min(256, Math.round(Math.sqrt(n) / 4)));
|
|
4
|
+
}
|
|
5
|
+
function mulberry32(seed) {
|
|
6
|
+
let a = seed >>> 0;
|
|
7
|
+
return () => {
|
|
8
|
+
a = a + 1831565813 >>> 0;
|
|
9
|
+
let t = a;
|
|
10
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
11
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
12
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function dot(a, b) {
|
|
16
|
+
let s = 0;
|
|
17
|
+
for (let i = 0; i < a.length; i++) s += a[i] * b[i];
|
|
18
|
+
return s;
|
|
19
|
+
}
|
|
20
|
+
function invNorm(v) {
|
|
21
|
+
let n = 0;
|
|
22
|
+
for (let i = 0; i < v.length; i++) n += v[i] * v[i];
|
|
23
|
+
return n === 0 ? 0 : 1 / Math.sqrt(n);
|
|
24
|
+
}
|
|
25
|
+
var IVF_DEFAULTS = {
|
|
26
|
+
nlist: void 0,
|
|
27
|
+
nprobe: 8,
|
|
28
|
+
sampleSize: 4096,
|
|
29
|
+
iterations: 6,
|
|
30
|
+
seed: 2654435769
|
|
31
|
+
};
|
|
32
|
+
var IvfFlatIndex = class {
|
|
33
|
+
params;
|
|
34
|
+
/** Unit-length partition representatives, `nlist` of them. */
|
|
35
|
+
centroids = [];
|
|
36
|
+
/** `lists[c]` = point slots assigned to centroid `c`. */
|
|
37
|
+
lists = [];
|
|
38
|
+
// Points, as parallel arrays. A "point" is one vector: a whole-record vector
|
|
39
|
+
// or one chunk of a chunked record. Parallel arrays rather than an object
|
|
40
|
+
// per point because at the gating scale there are hundreds of thousands of
|
|
41
|
+
// them and per-object overhead would dwarf the payload we deliberately
|
|
42
|
+
// refused to copy.
|
|
43
|
+
pVec = [];
|
|
44
|
+
pInv = [];
|
|
45
|
+
pRecord = [];
|
|
46
|
+
pChunk = [];
|
|
47
|
+
/** Owning list, or -1 for a free slot. */
|
|
48
|
+
pList = [];
|
|
49
|
+
recordIds = [];
|
|
50
|
+
slotOfRecord = /* @__PURE__ */ new Map();
|
|
51
|
+
pointsOfRecord = /* @__PURE__ */ new Map();
|
|
52
|
+
freeSlots = [];
|
|
53
|
+
live = 0;
|
|
54
|
+
builtAt = 0;
|
|
55
|
+
/**
|
|
56
|
+
* Points actually scored by the last {@link search} — the deterministic
|
|
57
|
+
* measure of what the index bought.
|
|
58
|
+
*
|
|
59
|
+
* Wall-clock speedup is not reproducible on a loaded machine (measured: the
|
|
60
|
+
* same cell varied 100x across reps while other work ran), but the fraction
|
|
61
|
+
* of the corpus a query touches is exact arithmetic and identical on every
|
|
62
|
+
* machine. The benchmark reports both and treats this as the primary number;
|
|
63
|
+
* latency follows from it and the brute-force table's µs-per-vector.
|
|
64
|
+
*/
|
|
65
|
+
lastProbedPoints = 0;
|
|
66
|
+
constructor(params = {}) {
|
|
67
|
+
this.params = { ...IVF_DEFAULTS, ...params };
|
|
68
|
+
}
|
|
69
|
+
get size() {
|
|
70
|
+
return this.live;
|
|
71
|
+
}
|
|
72
|
+
get nlist() {
|
|
73
|
+
return this.centroids.length;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Rebuild when the corpus has doubled or halved since the fit. Incremental
|
|
77
|
+
* upserts assign to EXISTING centroids, so a set that grew 10x around new
|
|
78
|
+
* topics is partitioned by a map of the old ones — recall decays silently,
|
|
79
|
+
* which is the failure mode this flag exists to stop.
|
|
80
|
+
*/
|
|
81
|
+
get stale() {
|
|
82
|
+
if (this.centroids.length === 0) return true;
|
|
83
|
+
return this.live > this.builtAt * 2 || this.live * 2 < this.builtAt;
|
|
84
|
+
}
|
|
85
|
+
build(vectors) {
|
|
86
|
+
this.centroids = [];
|
|
87
|
+
this.lists = [];
|
|
88
|
+
this.pVec = [];
|
|
89
|
+
this.pInv = [];
|
|
90
|
+
this.pRecord = [];
|
|
91
|
+
this.pChunk = [];
|
|
92
|
+
this.pList = [];
|
|
93
|
+
this.recordIds = [];
|
|
94
|
+
this.slotOfRecord = /* @__PURE__ */ new Map();
|
|
95
|
+
this.pointsOfRecord = /* @__PURE__ */ new Map();
|
|
96
|
+
this.freeSlots = [];
|
|
97
|
+
this.live = 0;
|
|
98
|
+
for (const v of vectors) this.addPoints(v, -1);
|
|
99
|
+
this.builtAt = this.live;
|
|
100
|
+
const dim = this.firstDim();
|
|
101
|
+
if (dim === 0) return;
|
|
102
|
+
const k = Math.max(1, Math.min(this.params.nlist ?? defaultNlist(this.live), this.live));
|
|
103
|
+
this.centroids = fitCentroids(this.sampleUnitVectors(dim), k, this.params);
|
|
104
|
+
if (this.centroids.length === 0) return;
|
|
105
|
+
this.lists = Array.from({ length: this.centroids.length }, () => []);
|
|
106
|
+
for (let p = 0; p < this.pVec.length; p++) {
|
|
107
|
+
if (this.pVec[p] === void 0) continue;
|
|
108
|
+
this.assign(p);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
upsert(vector) {
|
|
112
|
+
this.remove(vector.id);
|
|
113
|
+
this.addPoints(vector, -1);
|
|
114
|
+
if (this.centroids.length === 0) return;
|
|
115
|
+
for (const p of this.pointsOfRecord.get(vector.id) ?? []) if (this.pList[p] === -1) this.assign(p);
|
|
116
|
+
}
|
|
117
|
+
remove(recordId) {
|
|
118
|
+
const pts = this.pointsOfRecord.get(recordId);
|
|
119
|
+
if (!pts) return;
|
|
120
|
+
for (const p of pts) {
|
|
121
|
+
const l = this.pList[p];
|
|
122
|
+
if (l >= 0) {
|
|
123
|
+
const list = this.lists[l];
|
|
124
|
+
const at = list.indexOf(p);
|
|
125
|
+
if (at >= 0) {
|
|
126
|
+
list[at] = list[list.length - 1];
|
|
127
|
+
list.pop();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
this.pVec[p] = void 0;
|
|
131
|
+
this.pChunk[p] = void 0;
|
|
132
|
+
this.pList[p] = -1;
|
|
133
|
+
this.freeSlots.push(p);
|
|
134
|
+
this.live--;
|
|
135
|
+
}
|
|
136
|
+
this.pointsOfRecord.delete(recordId);
|
|
137
|
+
}
|
|
138
|
+
search(query, k, opts = {}) {
|
|
139
|
+
if (k <= 0 || this.centroids.length === 0) return [];
|
|
140
|
+
const qi = invNorm(query);
|
|
141
|
+
const minScore = opts.minScore ?? -Infinity;
|
|
142
|
+
if (qi === 0) return [];
|
|
143
|
+
const qn = new Float32Array(query.length);
|
|
144
|
+
for (let i = 0; i < query.length; i++) qn[i] = query[i] * qi;
|
|
145
|
+
const nprobe = Math.max(1, Math.min(opts.nprobe ?? this.params.nprobe, this.centroids.length));
|
|
146
|
+
const probes = this.topCentroids(qn, nprobe);
|
|
147
|
+
this.lastProbedPoints = 0;
|
|
148
|
+
const best = /* @__PURE__ */ new Map();
|
|
149
|
+
for (const c of probes) {
|
|
150
|
+
this.lastProbedPoints += this.lists[c].length;
|
|
151
|
+
for (const p of this.lists[c]) {
|
|
152
|
+
const v = this.pVec[p];
|
|
153
|
+
if (v === void 0 || v.length !== qn.length) continue;
|
|
154
|
+
const score = dot(qn, v) * this.pInv[p];
|
|
155
|
+
const r = this.pRecord[p];
|
|
156
|
+
const cur = best.get(r);
|
|
157
|
+
if (cur === void 0 || score > cur.score) best.set(r, { score, chunk: this.pChunk[p] });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const hits = [];
|
|
161
|
+
for (const [r, b] of best) {
|
|
162
|
+
if (b.score < minScore) continue;
|
|
163
|
+
hits.push(b.chunk ? { id: this.recordIds[r], score: b.score, chunk: b.chunk } : { id: this.recordIds[r], score: b.score });
|
|
164
|
+
}
|
|
165
|
+
hits.sort((a, b) => b.score - a.score);
|
|
166
|
+
return hits.slice(0, k);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A deterministic fixed-stride sample of the corpus, unit-normalised — the
|
|
170
|
+
* only place the index materialises normalised copies, and it is bounded by
|
|
171
|
+
* `sampleSize` rather than by `n`. A stride (not a random draw) so the fit
|
|
172
|
+
* is reproducible without spending the PRNG, which is saved for k-means++
|
|
173
|
+
* seeding where it actually buys recall.
|
|
174
|
+
*/
|
|
175
|
+
sampleUnitVectors(dim) {
|
|
176
|
+
const slots = this.pVec.length;
|
|
177
|
+
const want = Math.min(slots, this.params.sampleSize);
|
|
178
|
+
const stride = Math.max(1, Math.floor(slots / Math.max(1, want)));
|
|
179
|
+
const sample = [];
|
|
180
|
+
for (let p = 0; p < slots && sample.length < want; p += stride) {
|
|
181
|
+
const v = this.pVec[p];
|
|
182
|
+
const inv = this.pInv[p];
|
|
183
|
+
if (v === void 0 || inv === 0 || v.length !== dim) continue;
|
|
184
|
+
const u = new Float32Array(dim);
|
|
185
|
+
for (let i = 0; i < dim; i++) u[i] = v[i] * inv;
|
|
186
|
+
sample.push(u);
|
|
187
|
+
}
|
|
188
|
+
return sample;
|
|
189
|
+
}
|
|
190
|
+
firstDim() {
|
|
191
|
+
for (const v of this.pVec) if (v !== void 0 && v.length > 0) return v.length;
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
topCentroids(qn, nprobe) {
|
|
195
|
+
const scores = new Float64Array(this.centroids.length);
|
|
196
|
+
for (let c = 0; c < this.centroids.length; c++) {
|
|
197
|
+
const cv = this.centroids[c];
|
|
198
|
+
scores[c] = cv.length === qn.length ? dot(qn, cv) : -Infinity;
|
|
199
|
+
}
|
|
200
|
+
const order = [];
|
|
201
|
+
for (let c = 0; c < scores.length; c++) order.push(c);
|
|
202
|
+
order.sort((a, b) => scores[b] - scores[a]);
|
|
203
|
+
return order.slice(0, nprobe);
|
|
204
|
+
}
|
|
205
|
+
assign(p) {
|
|
206
|
+
const v = this.pVec[p];
|
|
207
|
+
if (v === void 0 || this.centroids.length === 0) return;
|
|
208
|
+
let bestC = 0;
|
|
209
|
+
let bestS = -Infinity;
|
|
210
|
+
const inv = this.pInv[p];
|
|
211
|
+
for (let c = 0; c < this.centroids.length; c++) {
|
|
212
|
+
const cv = this.centroids[c];
|
|
213
|
+
if (cv.length !== v.length) continue;
|
|
214
|
+
const s = dot(cv, v) * inv;
|
|
215
|
+
if (s > bestS) {
|
|
216
|
+
bestS = s;
|
|
217
|
+
bestC = c;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
this.pList[p] = bestC;
|
|
221
|
+
this.lists[bestC].push(p);
|
|
222
|
+
}
|
|
223
|
+
recordSlot(id) {
|
|
224
|
+
const existing = this.slotOfRecord.get(id);
|
|
225
|
+
if (existing !== void 0) return existing;
|
|
226
|
+
const slot = this.recordIds.length;
|
|
227
|
+
this.recordIds.push(id);
|
|
228
|
+
this.slotOfRecord.set(id, slot);
|
|
229
|
+
return slot;
|
|
230
|
+
}
|
|
231
|
+
/** Materialise one record's points into free slots. `list` -1 = unassigned. */
|
|
232
|
+
addPoints(v, list) {
|
|
233
|
+
const r = this.recordSlot(v.id);
|
|
234
|
+
const pts = [];
|
|
235
|
+
const push = (vec, chunk) => {
|
|
236
|
+
const p = this.freeSlots.pop() ?? this.pVec.length;
|
|
237
|
+
this.pVec[p] = vec;
|
|
238
|
+
this.pInv[p] = invNorm(vec);
|
|
239
|
+
this.pRecord[p] = r;
|
|
240
|
+
this.pChunk[p] = chunk;
|
|
241
|
+
this.pList[p] = list;
|
|
242
|
+
pts.push(p);
|
|
243
|
+
this.live++;
|
|
244
|
+
};
|
|
245
|
+
if (v.chunks && v.chunks.length > 0) {
|
|
246
|
+
for (const c of v.chunks) push(c.vec, { id: c.id, start: c.start, end: c.end });
|
|
247
|
+
} else if (v.vec) {
|
|
248
|
+
push(v.vec, void 0);
|
|
249
|
+
}
|
|
250
|
+
if (pts.length > 0) this.pointsOfRecord.set(v.id, pts);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
function fitCentroids(sample, k, params) {
|
|
254
|
+
if (sample.length === 0) return [];
|
|
255
|
+
const dim = sample[0].length;
|
|
256
|
+
const kk = Math.min(k, sample.length);
|
|
257
|
+
const rand = mulberry32(params.seed);
|
|
258
|
+
const centroids = [sample[Math.floor(rand() * sample.length)].slice()];
|
|
259
|
+
const best = new Float64Array(sample.length).fill(Infinity);
|
|
260
|
+
while (centroids.length < kk) {
|
|
261
|
+
const last = centroids[centroids.length - 1];
|
|
262
|
+
let total = 0;
|
|
263
|
+
for (let i = 0; i < sample.length; i++) {
|
|
264
|
+
const d = 1 - dot(sample[i], last);
|
|
265
|
+
const w = d * d;
|
|
266
|
+
if (w < best[i]) best[i] = w;
|
|
267
|
+
total += best[i];
|
|
268
|
+
}
|
|
269
|
+
if (total === 0) break;
|
|
270
|
+
let target = rand() * total;
|
|
271
|
+
let pick = sample.length - 1;
|
|
272
|
+
for (let i = 0; i < sample.length; i++) {
|
|
273
|
+
target -= best[i];
|
|
274
|
+
if (target <= 0) {
|
|
275
|
+
pick = i;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
centroids.push(sample[pick].slice());
|
|
280
|
+
}
|
|
281
|
+
for (let it = 0; it < params.iterations; it++) {
|
|
282
|
+
const sums = Array.from({ length: centroids.length }, () => new Float64Array(dim));
|
|
283
|
+
const counts = new Int32Array(centroids.length);
|
|
284
|
+
for (const u of sample) {
|
|
285
|
+
let bc = 0, bs = -Infinity;
|
|
286
|
+
for (let c = 0; c < centroids.length; c++) {
|
|
287
|
+
const s = dot(u, centroids[c]);
|
|
288
|
+
if (s > bs) {
|
|
289
|
+
bs = s;
|
|
290
|
+
bc = c;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const acc = sums[bc];
|
|
294
|
+
for (let i = 0; i < dim; i++) acc[i] += u[i];
|
|
295
|
+
counts[bc]++;
|
|
296
|
+
}
|
|
297
|
+
for (let c = 0; c < centroids.length; c++) {
|
|
298
|
+
if (counts[c] === 0) continue;
|
|
299
|
+
const acc = sums[c];
|
|
300
|
+
let n = 0;
|
|
301
|
+
for (let i = 0; i < dim; i++) n += acc[i] * acc[i];
|
|
302
|
+
if (n === 0) continue;
|
|
303
|
+
const inv = 1 / Math.sqrt(n);
|
|
304
|
+
const cv = centroids[c];
|
|
305
|
+
for (let i = 0; i < dim; i++) cv[i] = acc[i] * inv;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return centroids;
|
|
309
|
+
}
|
|
310
|
+
export {
|
|
311
|
+
IvfFlatIndex,
|
|
312
|
+
defaultNlist
|
|
313
|
+
};
|
|
314
|
+
//# sourceMappingURL=ivf-flat-UZ6DQDLS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-lookup/embeddings/ivf-flat.ts"],"sourcesContent":["/**\n * IVF-flat — the approximate vector index (#1360 part 2).\n *\n * ## Why IVF-flat and not HNSW\n *\n * The choice is a build-cost argument, not a taste one, and the numbers are in\n * `test-harnesses/benchmarks/src/vector-ann-index.bench.ts`.\n *\n * Every index here is paid for **once per session**: the vector set is loaded\n * from the encrypted `_vec` sidecars into memory, so an index built over it\n * dies with the process. There is no persisted index to amortise against —\n * `_vec` holds vectors, never a graph — so the only question that matters is\n * *how many queries does the build cost, and how many does it save?*\n *\n * - **IVF-flat** builds in `n · nlist` dot products = exactly `nlist`\n * brute-force queries, and `nlist` is a knob we choose. At the defaults it is\n * tens of query-equivalents, and one query then costs ~`(nlist + nprobe ·\n * n/nlist)/n` of a brute-force scan.\n * - **HNSW** builds in `n · log n · efConstruction` distance computations —\n * hundreds to thousands of query-equivalents at the same corpus — and its\n * deletes need tombstones plus periodic graph repair. It wins on\n * queries-per-second at *very* large n with a *persisted* graph. Neither\n * condition holds here.\n *\n * The deciding property is that a noy-db collection is mutable: `put()` and\n * `forget()` run constantly, and IVF handles both in `O(nlist)` (assign to the\n * nearest centroid / splice out of one list) with no graph to repair.\n *\n * ## The scoring identity — why this is exact arithmetic on an approximate set\n *\n * Cosine is scale-invariant, so with a unit-normalised query `q̂`:\n *\n * cosine(q, v) = dot(q̂, v) · (1/‖v‖)\n *\n * The index therefore stores the **caller's own `Float32Array` by reference**\n * plus one scalar `1/‖v‖` per point, and never a normalised copy. That is the\n * difference between `O(n)` and `O(n·d)` of index memory: at 100k × 768 a\n * normalised copy would be another ~300 MB. Scores this class returns are the\n * same numbers `cosine()` returns, bit for bit up to float association order —\n * so a hit's score is comparable with an exact hit's score, and `minScore`\n * means the same thing on both paths.\n *\n * ## What is approximate, and where recall goes\n *\n * Only the CANDIDATE SET is approximate: a true neighbour whose point sits in\n * an unprobed list is missed. `nprobe` is the dial; recall is measured, not\n * assumed (`__tests__/embeddings-ivf-recall.test.ts` and the benchmark).\n *\n * ⭐ Chunking interacts here: a record is scored by its best chunk *among the\n * probed lists*. A record whose best chunk is unprobed can still be returned\n * via a weaker chunk, with a lower score than exact search would give it. That\n * is a score difference, not only a membership difference, and it is why the\n * recall test compares folded RECORD results rather than raw points.\n *\n * ⚠️ **Ties do not order identically to the exact path**, even at `nprobe =\n * nlist`. Both sort by score with a stable sort, but over different scan\n * orders, so two records holding the SAME score can swap places. Neither path\n * ever promised a tie-break order. A real embedding corpus has no exact ties;\n * a test with a toy encoder is full of them, so compare by score there.\n */\nimport type { EmbeddingChunk } from './chunks.js'\nimport type { StoredVector, VectorHit } from './vector-set.js'\nimport type { VectorIndex, VectorIndexSearchOptions } from './vector-index.js'\n\n/**\n * Default partition count for a corpus of `n` points.\n *\n * Build cost is `nlist` brute-force-query-equivalents and query cost is\n * roughly `(nlist + nprobe·n/nlist)/n` of one, so `nlist` trades build against\n * query *linearly in opposite directions*.\n *\n * MEASURED (768d, 100,000 vectors, `nprobe: 8`; full table in\n * `test-harnesses/benchmarks/src/vector-ann-index.bench.ts`):\n *\n * | nlist | scan | speedup | recall@10 | build |\n * |-------------|-------|---------|-----------|---------------|\n * | 79 = √n/4 | 10.3% | 9.7x | 0.895 | 56 queries |\n * | 316 = √n | 3.0% | 33.8x | 0.813 | 288 queries |\n *\n * √n is the better index and the worse DEFAULT. This index is per-session —\n * it is rebuilt from the decrypted sidecars every time the process starts and\n * is never persisted — so a build has only this session's queries to amortise\n * against, and 288 query-equivalents is a bad opening bid for a consumer who\n * runs a dozen searches. `√n/4` costs ~56 and still cuts the scan by 10x.\n * A long-lived query-heavy session should override it; that is what the knob\n * is for. The CAP (256) matters as much as the formula: it bounds the build at\n * the top end, where an uncapped √n grows without limit.\n */\nexport function defaultNlist(n: number): number {\n return Math.max(4, Math.min(256, Math.round(Math.sqrt(n) / 4)))\n}\n\n/** Deterministic PRNG — the index must be identical across runs for a given corpus. */\nfunction mulberry32(seed: number): () => number {\n let a = seed >>> 0\n return () => {\n a = (a + 0x6d2b79f5) >>> 0\n let t = a\n t = Math.imul(t ^ (t >>> 15), t | 1)\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61)\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296\n }\n}\n\nfunction dot(a: Float32Array, b: Float32Array): number {\n let s = 0\n for (let i = 0; i < a.length; i++) s += a[i]! * b[i]!\n return s\n}\n\n/** `1/‖v‖`, or 0 for a zero vector — which makes its score 0, exactly as `cosine()` does. */\nfunction invNorm(v: Float32Array): number {\n let n = 0\n for (let i = 0; i < v.length; i++) n += v[i]! * v[i]!\n return n === 0 ? 0 : 1 / Math.sqrt(n)\n}\n\ninterface IvfParams {\n readonly nlist: number | undefined\n readonly nprobe: number\n readonly sampleSize: number\n readonly iterations: number\n readonly seed: number\n}\n\nconst IVF_DEFAULTS: IvfParams = {\n nlist: undefined,\n nprobe: 8,\n sampleSize: 4096,\n iterations: 6,\n seed: 0x9e3779b9,\n}\n\nexport class IvfFlatIndex implements VectorIndex {\n private readonly params: IvfParams\n\n /** Unit-length partition representatives, `nlist` of them. */\n private centroids: Float32Array[] = []\n /** `lists[c]` = point slots assigned to centroid `c`. */\n private lists: number[][] = []\n\n // Points, as parallel arrays. A \"point\" is one vector: a whole-record vector\n // or one chunk of a chunked record. Parallel arrays rather than an object\n // per point because at the gating scale there are hundreds of thousands of\n // them and per-object overhead would dwarf the payload we deliberately\n // refused to copy.\n private pVec: (Float32Array | undefined)[] = []\n private pInv: number[] = []\n private pRecord: number[] = []\n private pChunk: (EmbeddingChunk | undefined)[] = []\n /** Owning list, or -1 for a free slot. */\n private pList: number[] = []\n\n private recordIds: string[] = []\n private slotOfRecord = new Map<string, number>()\n private pointsOfRecord = new Map<string, number[]>()\n private freeSlots: number[] = []\n private live = 0\n private builtAt = 0\n /**\n * Points actually scored by the last {@link search} — the deterministic\n * measure of what the index bought.\n *\n * Wall-clock speedup is not reproducible on a loaded machine (measured: the\n * same cell varied 100x across reps while other work ran), but the fraction\n * of the corpus a query touches is exact arithmetic and identical on every\n * machine. The benchmark reports both and treats this as the primary number;\n * latency follows from it and the brute-force table's µs-per-vector.\n */\n lastProbedPoints = 0\n\n constructor(params: Partial<IvfParams> = {}) {\n this.params = { ...IVF_DEFAULTS, ...params }\n }\n\n get size(): number { return this.live }\n get nlist(): number { return this.centroids.length }\n\n /**\n * Rebuild when the corpus has doubled or halved since the fit. Incremental\n * upserts assign to EXISTING centroids, so a set that grew 10x around new\n * topics is partitioned by a map of the old ones — recall decays silently,\n * which is the failure mode this flag exists to stop.\n */\n get stale(): boolean {\n if (this.centroids.length === 0) return true\n return this.live > this.builtAt * 2 || this.live * 2 < this.builtAt\n }\n\n build(vectors: readonly StoredVector[]): void {\n this.centroids = []\n this.lists = []\n this.pVec = []; this.pInv = []; this.pRecord = []; this.pChunk = []; this.pList = []\n this.recordIds = []\n this.slotOfRecord = new Map()\n this.pointsOfRecord = new Map()\n this.freeSlots = []\n this.live = 0\n\n // Materialise the points first (unassigned), then fit, then assign.\n for (const v of vectors) this.addPoints(v, -1)\n this.builtAt = this.live\n\n const dim = this.firstDim()\n if (dim === 0) return\n const k = Math.max(1, Math.min(this.params.nlist ?? defaultNlist(this.live), this.live))\n this.centroids = fitCentroids(this.sampleUnitVectors(dim), k, this.params)\n // No centroids means no usable vector to fit on — every point was\n // zero-norm or off-dimension. Leave the points unassigned; `nlist === 0`\n // is the signal `VectorSet` reads to fall back to the exact scan, which\n // scores those vectors 0 rather than dropping them.\n if (this.centroids.length === 0) return\n this.lists = Array.from({ length: this.centroids.length }, () => [] as number[])\n for (let p = 0; p < this.pVec.length; p++) {\n if (this.pVec[p] === undefined) continue\n this.assign(p)\n }\n }\n\n upsert(vector: StoredVector): void {\n this.remove(vector.id)\n this.addPoints(vector, -1)\n if (this.centroids.length === 0) return\n for (const p of this.pointsOfRecord.get(vector.id) ?? []) if (this.pList[p] === -1) this.assign(p)\n }\n\n remove(recordId: string): void {\n const pts = this.pointsOfRecord.get(recordId)\n if (!pts) return\n for (const p of pts) {\n const l = this.pList[p]!\n if (l >= 0) {\n const list = this.lists[l]!\n const at = list.indexOf(p)\n if (at >= 0) { list[at] = list[list.length - 1]!; list.pop() }\n }\n this.pVec[p] = undefined\n this.pChunk[p] = undefined\n this.pList[p] = -1\n this.freeSlots.push(p)\n this.live--\n }\n this.pointsOfRecord.delete(recordId)\n // The record's SLOT is deliberately kept. `put()` on an existing id is\n // remove-then-add, and freeing the slot there would mint a new one on\n // every write — unbounded growth on the hottest path. A slot is 8 bytes\n // and one string; a re-put reuses it.\n }\n\n search(query: Float32Array, k: number, opts: VectorIndexSearchOptions = {}): VectorHit[] {\n if (k <= 0 || this.centroids.length === 0) return []\n const qi = invNorm(query)\n const minScore = opts.minScore ?? -Infinity\n // A zero-norm query scores 0 against everything (cosine's contract). There\n // is no meaningful ranking to approximate, so answer exactly rather than\n // returning whichever list the arbitrary probe order happened to pick.\n if (qi === 0) return []\n const qn = new Float32Array(query.length)\n for (let i = 0; i < query.length; i++) qn[i] = query[i]! * qi\n\n const nprobe = Math.max(1, Math.min(opts.nprobe ?? this.params.nprobe, this.centroids.length))\n const probes = this.topCentroids(qn, nprobe)\n this.lastProbedPoints = 0\n\n // Fold to one hit per RECORD by best chunk, exactly as the exact path does\n // — `k` counts records, never fragments.\n const best = new Map<number, { score: number; chunk: EmbeddingChunk | undefined }>()\n for (const c of probes) {\n this.lastProbedPoints += this.lists[c]!.length\n for (const p of this.lists[c]!) {\n const v = this.pVec[p]\n if (v === undefined || v.length !== qn.length) continue\n const score = dot(qn, v) * this.pInv[p]!\n const r = this.pRecord[p]!\n const cur = best.get(r)\n if (cur === undefined || score > cur.score) best.set(r, { score, chunk: this.pChunk[p] })\n }\n }\n const hits: VectorHit[] = []\n for (const [r, b] of best) {\n if (b.score < minScore) continue\n hits.push(b.chunk ? { id: this.recordIds[r]!, score: b.score, chunk: b.chunk } : { id: this.recordIds[r]!, score: b.score })\n }\n hits.sort((a, b) => b.score - a.score)\n return hits.slice(0, k)\n }\n\n /**\n * A deterministic fixed-stride sample of the corpus, unit-normalised — the\n * only place the index materialises normalised copies, and it is bounded by\n * `sampleSize` rather than by `n`. A stride (not a random draw) so the fit\n * is reproducible without spending the PRNG, which is saved for k-means++\n * seeding where it actually buys recall.\n */\n private sampleUnitVectors(dim: number): Float32Array[] {\n const slots = this.pVec.length\n const want = Math.min(slots, this.params.sampleSize)\n const stride = Math.max(1, Math.floor(slots / Math.max(1, want)))\n const sample: Float32Array[] = []\n for (let p = 0; p < slots && sample.length < want; p += stride) {\n const v = this.pVec[p]\n const inv = this.pInv[p]!\n if (v === undefined || inv === 0 || v.length !== dim) continue\n const u = new Float32Array(dim)\n for (let i = 0; i < dim; i++) u[i] = v[i]! * inv\n sample.push(u)\n }\n return sample\n }\n\n private firstDim(): number {\n for (const v of this.pVec) if (v !== undefined && v.length > 0) return v.length\n return 0\n }\n\n private topCentroids(qn: Float32Array, nprobe: number): number[] {\n // nlist is capped at 256, so a full scan + partial selection is cheaper\n // than any heap — and it is a rounding error next to the list scan.\n const scores = new Float64Array(this.centroids.length)\n for (let c = 0; c < this.centroids.length; c++) {\n const cv = this.centroids[c]!\n scores[c] = cv.length === qn.length ? dot(qn, cv) : -Infinity\n }\n const order: number[] = []\n for (let c = 0; c < scores.length; c++) order.push(c)\n order.sort((a, b) => scores[b]! - scores[a]!)\n return order.slice(0, nprobe)\n }\n\n private assign(p: number): void {\n const v = this.pVec[p]\n if (v === undefined || this.centroids.length === 0) return\n let bestC = 0\n let bestS = -Infinity\n const inv = this.pInv[p]!\n for (let c = 0; c < this.centroids.length; c++) {\n const cv = this.centroids[c]!\n if (cv.length !== v.length) continue\n const s = dot(cv, v) * inv\n if (s > bestS) { bestS = s; bestC = c }\n }\n this.pList[p] = bestC\n this.lists[bestC]!.push(p)\n }\n\n private recordSlot(id: string): number {\n const existing = this.slotOfRecord.get(id)\n if (existing !== undefined) return existing\n const slot = this.recordIds.length\n this.recordIds.push(id)\n this.slotOfRecord.set(id, slot)\n return slot\n }\n\n /** Materialise one record's points into free slots. `list` -1 = unassigned. */\n private addPoints(v: StoredVector, list: number): void {\n const r = this.recordSlot(v.id)\n const pts: number[] = []\n const push = (vec: Float32Array, chunk: EmbeddingChunk | undefined): void => {\n const p = this.freeSlots.pop() ?? this.pVec.length\n this.pVec[p] = vec\n this.pInv[p] = invNorm(vec)\n this.pRecord[p] = r\n this.pChunk[p] = chunk\n this.pList[p] = list\n pts.push(p)\n this.live++\n }\n if (v.chunks && v.chunks.length > 0) {\n for (const c of v.chunks) push(c.vec, { id: c.id, start: c.start, end: c.end })\n } else if (v.vec) {\n push(v.vec, undefined)\n }\n if (pts.length > 0) this.pointsOfRecord.set(v.id, pts)\n }\n}\n\n/**\n * Spherical k-means over a deterministic SAMPLE, not the corpus.\n *\n * Clustering all `n` points would cost `iterations · n · k · d`; assigning\n * them once costs `n · k · d`. Fitting on a sample makes the iterations free\n * relative to the single unavoidable assignment pass, which is the whole\n * reason IVF's build stays affordable at the #1360 gating scale.\n */\nfunction fitCentroids(sample: readonly Float32Array[], k: number, params: IvfParams): Float32Array[] {\n if (sample.length === 0) return []\n const dim = sample[0]!.length\n const kk = Math.min(k, sample.length)\n\n // k-means++ seeding on unit vectors, weighting by squared cosine distance.\n const rand = mulberry32(params.seed)\n const centroids: Float32Array[] = [sample[Math.floor(rand() * sample.length)]!.slice()]\n const best = new Float64Array(sample.length).fill(Infinity)\n while (centroids.length < kk) {\n const last = centroids[centroids.length - 1]!\n let total = 0\n for (let i = 0; i < sample.length; i++) {\n const d = 1 - dot(sample[i]!, last)\n const w = d * d\n if (w < best[i]!) best[i] = w\n total += best[i]!\n }\n if (total === 0) break\n let target = rand() * total\n let pick = sample.length - 1\n for (let i = 0; i < sample.length; i++) { target -= best[i]!; if (target <= 0) { pick = i; break } }\n centroids.push(sample[pick]!.slice())\n }\n\n // Lloyd, spherical: mean, then re-normalise. An empty cluster KEEPS its\n // previous centroid rather than being re-seeded — a dead list costs one\n // wasted centroid comparison per query, whereas re-seeding mid-fit makes the\n // result depend on the iteration count in a way nothing else here does.\n for (let it = 0; it < params.iterations; it++) {\n const sums = Array.from({ length: centroids.length }, () => new Float64Array(dim))\n const counts = new Int32Array(centroids.length)\n for (const u of sample) {\n let bc = 0, bs = -Infinity\n for (let c = 0; c < centroids.length; c++) {\n const s = dot(u, centroids[c]!)\n if (s > bs) { bs = s; bc = c }\n }\n const acc = sums[bc]!\n for (let i = 0; i < dim; i++) acc[i]! += u[i]!\n counts[bc]!++\n }\n for (let c = 0; c < centroids.length; c++) {\n if (counts[c] === 0) continue\n const acc = sums[c]!\n let n = 0\n for (let i = 0; i < dim; i++) n += acc[i]! * acc[i]!\n if (n === 0) continue\n const inv = 1 / Math.sqrt(n)\n const cv = centroids[c]!\n for (let i = 0; i < dim; i++) cv[i] = acc[i]! * inv\n }\n }\n return centroids\n}\n"],"mappings":";AAwFO,SAAS,aAAa,GAAmB;AAC9C,SAAO,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE;AAGA,SAAS,WAAW,MAA4B;AAC9C,MAAI,IAAI,SAAS;AACjB,SAAO,MAAM;AACX,QAAK,IAAI,eAAgB;AACzB,QAAI,IAAI;AACR,QAAI,KAAK,KAAK,IAAK,MAAM,IAAK,IAAI,CAAC;AACnC,SAAK,IAAI,KAAK,KAAK,IAAK,MAAM,GAAI,IAAI,EAAE;AACxC,aAAS,IAAK,MAAM,QAAS,KAAK;AAAA,EACpC;AACF;AAEA,SAAS,IAAI,GAAiB,GAAyB;AACrD,MAAI,IAAI;AACR,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,IAAK,MAAK,EAAE,CAAC,IAAK,EAAE,CAAC;AACnD,SAAO;AACT;AAGA,SAAS,QAAQ,GAAyB;AACxC,MAAI,IAAI;AACR,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,IAAK,MAAK,EAAE,CAAC,IAAK,EAAE,CAAC;AACnD,SAAO,MAAM,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC;AACtC;AAUA,IAAM,eAA0B;AAAA,EAC9B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,MAAM;AACR;AAEO,IAAM,eAAN,MAA0C;AAAA,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|
|
@@ -22,6 +22,7 @@ function buildJsonSchema(desc, base) {
|
|
|
22
22
|
if (f.unit !== void 0) prop["x-unit"] = f.unit;
|
|
23
23
|
if (f.semanticType !== void 0) prop["x-semanticType"] = f.semanticType;
|
|
24
24
|
if (f.sensitivity !== void 0) prop["x-sensitivity"] = f.sensitivity;
|
|
25
|
+
if (f.bulk !== void 0) prop["x-bulk"] = f.bulk;
|
|
25
26
|
if (f.widget !== void 0) prop["x-widget"] = f.widget;
|
|
26
27
|
if (f.editable === false) prop["x-readonly"] = true;
|
|
27
28
|
if (f.money !== void 0) prop["x-money"] = f.money;
|
|
@@ -39,4 +40,4 @@ function buildJsonSchema(desc, base) {
|
|
|
39
40
|
export {
|
|
40
41
|
buildJsonSchema
|
|
41
42
|
};
|
|
42
|
-
//# sourceMappingURL=json-schema-
|
|
43
|
+
//# sourceMappingURL=json-schema-3SHX72CC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-shape/introspection/json-schema.ts"],"sourcesContent":["/**\n * `buildJsonSchema` — pure overlay that merges describe() metadata onto a\n * base JSON Schema (from derivePersistedSchema) as `x-` extension keys.\n *\n * When no base JSON Schema is available (non-zod / unknown validator),\n * builds a minimal `{ type:'object', properties }` from describe()'s field\n * type tags. No static `import 'zod'` — validator derivation stays lazy.\n *\n * @module\n */\n\nimport type { CollectionDescription } from './describe.js'\n\n/** Map a DescribedField's type tag to a JSON-Schema `type`. */\nfunction jsonType(t: string): string {\n switch (t) {\n case 'number': return 'number'\n case 'boolean': return 'boolean'\n case 'array': return 'array'\n case 'object': return 'object'\n default: return 'string'\n }\n}\n\n/** Overlay describe() metadata onto a base JSON Schema (or build a minimal one). */\nexport function buildJsonSchema(desc: CollectionDescription, base?: Record<string, unknown> | null): object {\n const baseProps = (base?.['properties'] as Record<string, Record<string, unknown>> | undefined) ?? {}\n const properties: Record<string, Record<string, unknown>> = {}\n for (const f of desc.fields) {\n const prop: Record<string, unknown> = { ...(baseProps[f.key] ?? { type: jsonType(f.type) }) }\n prop['x-label'] = f.label\n if (f.unit !== undefined) prop['x-unit'] = f.unit\n if (f.semanticType !== undefined) prop['x-semanticType'] = f.semanticType\n if (f.sensitivity !== undefined) prop['x-sensitivity'] = f.sensitivity\n // Read-shape sensitivity (#1363). Orthogonal to x-sensitivity: a field can\n // be 'public' and still belong to a corpus whose coverage is protected.\n if (f.bulk !== undefined) prop['x-bulk'] = f.bulk\n if (f.widget !== undefined) prop['x-widget'] = f.widget\n if (f.editable === false) prop['x-readonly'] = true\n if (f.money !== undefined) prop['x-money'] = f.money\n if (f.ref !== undefined) prop['x-ref'] = f.ref.target\n if (f.dict?.values) {\n const labels: Record<string, string> = {}\n for (const v of f.dict.values) if (v.label !== undefined) labels[v.value] = v.label\n if (Object.keys(labels).length) prop['x-enumLabels'] = labels\n }\n // `x-classified` carries the whole classified block, incl. `equatable` when\n // set — emitted ungated (boundary note on DescribedField.classified): a\n // deployment wanting it gated can gate this behind its value-bearing door.\n if (f.classified !== undefined) prop['x-classified'] = f.classified\n properties[f.key] = prop\n }\n return base != null && typeof base === 'object'\n ? { ...base, properties }\n : { type: 'object', properties }\n}\n"],"mappings":";AAcA,SAAS,SAAS,GAAmB;AACnC,UAAQ,GAAG;AAAA,IACT,KAAK;AAAU,aAAO;AAAA,IACtB,KAAK;AAAW,aAAO;AAAA,IACvB,KAAK;AAAS,aAAO;AAAA,IACrB,KAAK;AAAU,aAAO;AAAA,IACtB;AAAS,aAAO;AAAA,EAClB;AACF;AAGO,SAAS,gBAAgB,MAA6B,MAA+C;AAC1G,QAAM,YAAa,OAAO,YAAY,KAA6D,CAAC;AACpG,QAAM,aAAsD,CAAC;AAC7D,aAAW,KAAK,KAAK,QAAQ;AAC3B,UAAM,OAAgC,EAAE,GAAI,UAAU,EAAE,GAAG,KAAK,EAAE,MAAM,SAAS,EAAE,IAAI,EAAE,EAAG;AAC5F,SAAK,SAAS,IAAI,EAAE;AACpB,QAAI,EAAE,SAAS,OAAW,MAAK,QAAQ,IAAI,EAAE;AAC7C,QAAI,EAAE,iBAAiB,OAAW,MAAK,gBAAgB,IAAI,EAAE;AAC7D,QAAI,EAAE,gBAAgB,OAAW,MAAK,eAAe,IAAI,EAAE;AAG3D,QAAI,EAAE,SAAS,OAAW,MAAK,QAAQ,IAAI,EAAE;AAC7C,QAAI,EAAE,WAAW,OAAW,MAAK,UAAU,IAAI,EAAE;AACjD,QAAI,EAAE,aAAa,MAAO,MAAK,YAAY,IAAI;AAC/C,QAAI,EAAE,UAAU,OAAW,MAAK,SAAS,IAAI,EAAE;AAC/C,QAAI,EAAE,QAAQ,OAAW,MAAK,OAAO,IAAI,EAAE,IAAI;AAC/C,QAAI,EAAE,MAAM,QAAQ;AAClB,YAAM,SAAiC,CAAC;AACxC,iBAAW,KAAK,EAAE,KAAK,OAAQ,KAAI,EAAE,UAAU,OAAW,QAAO,EAAE,KAAK,IAAI,EAAE;AAC9E,UAAI,OAAO,KAAK,MAAM,EAAE,OAAQ,MAAK,cAAc,IAAI;AAAA,IACzD;AAIA,QAAI,EAAE,eAAe,OAAW,MAAK,cAAc,IAAI,EAAE;AACzD,eAAW,EAAE,GAAG,IAAI;AAAA,EACtB;AACA,SAAO,QAAQ,QAAQ,OAAO,SAAS,WACnC,EAAE,GAAG,MAAM,WAAW,IACtB,EAAE,MAAM,UAAU,WAAW;AACnC;","names":[]}
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collection construction config — the PURE half of the `Collection`
|
|
3
|
-
* constructor.
|
|
4
|
-
*
|
|
5
|
-
* `resolveCollectionConfig` takes the raw `CollectionOpts` the Vault threads in
|
|
6
|
-
* and resolves every `?? default`, every normalized/derived field, and runs the
|
|
7
|
-
* pure construction-time validations (embeddings-on-CRDT, money-field paths,
|
|
8
|
-
* deterministic-risk acknowledgement). It holds **no `this`** and performs no
|
|
9
|
-
* external side effect — the only objects it allocates (`Set`s, `VectorSet`,
|
|
10
|
-
* the CEK `Lru`) are the same instances the collection then owns by reference.
|
|
11
|
-
*
|
|
12
|
-
* The `this`-dependent construction (the search-index store whose persisted
|
|
13
|
-
* callback closes over `this.searchContext()`, the `RecordCodec`, and the
|
|
14
|
-
* SyncEngine conflict-resolver registration) stays in the constructor — those
|
|
15
|
-
* genuinely capture the live instance (and the conflict-resolver closures close
|
|
16
|
-
* over `conflictPolicy: ConflictPolicy<T>`, whose invariant-in-T custom-merge
|
|
17
|
-
* signature can't be exposed via a method without breaking `Collection<T>`
|
|
18
|
-
* assignability to `Collection<unknown>`).
|
|
19
|
-
*/
|
|
20
1
|
import type { StrategyBag } from '../port/with/strategies.js';
|
|
21
2
|
import type { NoydbStore, ConflictPolicy, CollectionConflictResolver, HistoryConfig, TierMode, CrossTierAccessEvent, VdigFieldPolicy } from './types.js';
|
|
22
3
|
import type { EnclaveKey } from './enclave/index.js';
|
|
@@ -43,7 +24,7 @@ import type { FieldRef, Grain } from './via/graph.js';
|
|
|
43
24
|
import type { FieldMeta } from '../with-shape/introspection/field-meta.js';
|
|
44
25
|
import type { CollectionMeta } from '../with-shape/introspection/meta.js';
|
|
45
26
|
import type { RefDescriptor } from './refs.js';
|
|
46
|
-
import type { JoinableSource } from './query/
|
|
27
|
+
import type { JoinableSource } from './query/relate/join.js';
|
|
47
28
|
import { VectorSet, type EmbeddingDescriptor } from '../with-lookup/embeddings/index.js';
|
|
48
29
|
import { Lru } from './cache/index.js';
|
|
49
30
|
import type { ReadOnlyVaultFacade } from '../with-audit/guards/types.js';
|
|
@@ -210,6 +191,8 @@ export interface CollectionOpts<T> {
|
|
|
210
191
|
embeddings?: EmbeddingDescriptor | undefined;
|
|
211
192
|
/** — string fields exposed to client-side `retrieve()`. */
|
|
212
193
|
textIndexes?: readonly string[] | undefined;
|
|
194
|
+
/** — subset of `textIndexes` recording token positions (phrase / proximity, #1354). */
|
|
195
|
+
textIndexPositions?: readonly string[] | undefined;
|
|
213
196
|
/** — pre-build the lexical index on open (eager-only). */
|
|
214
197
|
warmIndexOnOpen?: boolean | undefined;
|
|
215
198
|
/** — persist the lexical index as an opaque encrypted blob at `_ftindex/<name>`. */
|
|
@@ -712,6 +695,7 @@ export declare function resolveCollectionConfig<T>(opts: CollectionOpts<T>): {
|
|
|
712
695
|
} | undefined;
|
|
713
696
|
i18nFields: Record<string, I18nTextDescriptor> | undefined;
|
|
714
697
|
textIndexes: readonly string[] | undefined;
|
|
698
|
+
textIndexPositions: readonly string[] | undefined;
|
|
715
699
|
embeddings: EmbeddingDescriptor | undefined;
|
|
716
700
|
vectorSet: VectorSet | undefined;
|
|
717
701
|
dictKeyFields: Record<string, StaticDictDescriptor<string> | DictKeyDescriptor<string>> | undefined;
|
|
@@ -17,11 +17,11 @@ import type { GhostRecord } from './types.js';
|
|
|
17
17
|
import type { StandardSchemaV1 } from './schema.js';
|
|
18
18
|
import type { DiffEntry } from '../with-commit/history/diff.js';
|
|
19
19
|
import { Query, ScanBuilder } from './query/index.js';
|
|
20
|
-
import type { JoinableSource } from './query/
|
|
20
|
+
import type { JoinableSource } from './query/relate/join.js';
|
|
21
21
|
import { type CollectionIndexes } from '../with-lookup/indexing/eager-indexes.js';
|
|
22
22
|
import { LazyQuery } from '../with-lookup/indexing/lazy-builder.js';
|
|
23
23
|
import type { SearchOptions, SearchResult } from '../with-lookup/search/index.js';
|
|
24
|
-
import type { RetrieveOptions, RetrieveHit } from '../with-lookup/search/retrieve-types.js';
|
|
24
|
+
import type { RetrieveOptions, RetrieveHit, SimilarToOptions } from '../with-lookup/search/retrieve-types.js';
|
|
25
25
|
import type { RefDescriptor } from './refs.js';
|
|
26
26
|
import { type CollectionDescription, type DescribeOptions } from '../with-shape/introspection/describe.js';
|
|
27
27
|
import type { CollectionConfig } from '../with-shape/introspection/types.js';
|
|
@@ -112,6 +112,10 @@ export declare class Collection<T, S extends keyof T = never, Q extends keyof T
|
|
|
112
112
|
private readonly blobFields;
|
|
113
113
|
private readonly blobTierPolicy;
|
|
114
114
|
private readonly cache;
|
|
115
|
+
/** #1418 — mutation stamp for a derived-output memo, or `null` when one must NOT be used because a redundant re-write would still be observable (gate handler, history, sync, search) or there is no eager cache to stamp. The rules and their measured rationale live with the consumer, `with-formula/materialized-views/emit-memo.ts`. `_`-prefixed deliberately: `kernel-api-surface-golden` freezes the PUBLIC surface and this is an executor seam. @internal */
|
|
116
|
+
get _cacheStamp(): number | null;
|
|
117
|
+
/** #1439 — could a `beforePut` gate fire for THIS row? Asks each handler's declared scope, not merely whether any is registered — the bus is vault-wide, the gates are not. @internal */
|
|
118
|
+
_derivedWriteGated(record: Record<string, unknown>): boolean;
|
|
115
119
|
private hydrated;
|
|
116
120
|
/**
|
|
117
121
|
* #606: ids known to carry a delete marker in the store — lets the #589
|
|
@@ -221,8 +225,12 @@ export declare class Collection<T, S extends keyof T = never, Q extends keyof T
|
|
|
221
225
|
private i18nFields;
|
|
222
226
|
/** The configured string fields exposed to `retrieve()`; `undefined` for ordinary collections (zero-cost). */
|
|
223
227
|
private readonly textIndexes;
|
|
228
|
+
/** #1354 — the subset of `textIndexes` carrying positional postings (phrase / proximity). */
|
|
229
|
+
private readonly textIndexPositions;
|
|
224
230
|
/** Session-scoped lexical index store; `undefined` (zero-cost) unless `textIndexes` is non-empty. */
|
|
225
231
|
private readonly searchIndexStore;
|
|
232
|
+
/** Encrypted field-index sidecars (#1359); `null` (zero-cost) unless an index declared `persist: true`. */
|
|
233
|
+
private readonly fieldIndexStore;
|
|
226
234
|
/** Embedding config for write-time vector derivation; `undefined` (zero-cost) for ordinary
|
|
227
235
|
* collections. When set, `put()` encodes the source field(s) and stores an encrypted `_vec` sidecar. */
|
|
228
236
|
private readonly embeddings;
|
|
@@ -427,6 +435,8 @@ export declare class Collection<T, S extends keyof T = never, Q extends keyof T
|
|
|
427
435
|
readonly fields: readonly string[];
|
|
428
436
|
readonly unique?: boolean;
|
|
429
437
|
}>;
|
|
438
|
+
/** #1447 — `field -> via brands covering it`, for `dumpSchema()`. Brand and field only, never a binding's config; see `via/pipeline.ts#fieldCoverage`. Consumed by walk.ts. */
|
|
439
|
+
getViaCoverage(): Record<string, readonly string[]> | undefined;
|
|
430
440
|
/**
|
|
431
441
|
* Aggregate all collection-level configuration options that are actively set
|
|
432
442
|
* into a {@link CollectionConfig} snapshot. Returns `undefined` when no options
|
|
@@ -971,11 +981,7 @@ export declare class Collection<T, S extends keyof T = never, Q extends keyof T
|
|
|
971
981
|
/** Retrieval (lexical | semantic | hybrid) — gated behind `searchStrategy: withSearch()`. */
|
|
972
982
|
retrieve(query: string, opts?: RetrieveOptions<T>): Promise<RetrieveHit<T>[]>;
|
|
973
983
|
/** Raw-vector kNN — gated behind `searchStrategy: withSearch()`. */
|
|
974
|
-
similarTo(vector: Float32Array, opts?:
|
|
975
|
-
k?: number;
|
|
976
|
-
minScore?: number;
|
|
977
|
-
includeRecord?: boolean;
|
|
978
|
-
}): Promise<RetrieveHit<T>[]>;
|
|
984
|
+
similarTo(vector: Float32Array, opts?: SimilarToOptions): Promise<RetrieveHit<T>[]>;
|
|
979
985
|
/** Opt-in bulk `_vec` re-derive (#788) — a plain collection has nothing to rebuild; gated behind `searchStrategy: withSearch()` otherwise. */
|
|
980
986
|
rebuildEmbeddings(): Promise<{
|
|
981
987
|
rebuilt: number;
|
|
@@ -1055,7 +1061,7 @@ export declare class Collection<T, S extends keyof T = never, Q extends keyof T
|
|
|
1055
1061
|
* the filtered records directly (the API). Prefer the chainable
|
|
1056
1062
|
* form for new code.
|
|
1057
1063
|
*
|
|
1058
|
-
* **Lazy-MV gap:** `query()` is synchronous and does NOT
|
|
1064
|
+
* **Cold-collection gate (#1414):** until something has bulk-loaded this collection (`list()`, `get()`), every terminal returns a value that hydrates when AWAITED and throws `CollectionNotHydratedError` on synchronous use — an unloaded collection is not an empty one; see `query/hydration.ts`. **Lazy-MV gap:** `query()` is synchronous and does NOT
|
|
1059
1065
|
* trigger lazy materialized-view resolve-on-read. If this
|
|
1060
1066
|
* collection is a lazy MV's output and the MV is currently stale,
|
|
1061
1067
|
* `query().toArray()` returns the pre-stale snapshot. To force a
|
|
@@ -1275,6 +1281,10 @@ export declare class Collection<T, S extends keyof T = never, Q extends keyof T
|
|
|
1275
1281
|
* Never writes to the store and never fires write hooks, so it cannot loop.
|
|
1276
1282
|
*/
|
|
1277
1283
|
_applyRemoteChange(id: string, action: 'put' | 'delete'): Promise<void>;
|
|
1284
|
+
/** @internal #1362 — same as {@link _applyRemoteChange}, for a frame that carries NO verb.
|
|
1285
|
+
* A peer's claim about the verb is not evidence; the re-read decides it, exactly as
|
|
1286
|
+
* `_compensateRevertedWrite` does. Untrusted ingress is why the frame omits it. */
|
|
1287
|
+
_applyRemoteSignal(id: string): Promise<void>;
|
|
1278
1288
|
/**
|
|
1279
1289
|
* Origin-tagged mutation choke point (#623 task 10) — the single dispatch
|
|
1280
1290
|
* point every put/delete path funnels through, AFTER its own store write,
|
|
@@ -1401,6 +1411,15 @@ export declare class Collection<T, S extends keyof T = never, Q extends keyof T
|
|
|
1401
1411
|
* vault-shared `_blob` DEK (enabling cross-collection deduplication).
|
|
1402
1412
|
*/
|
|
1403
1413
|
blob(id: string): BlobSet;
|
|
1414
|
+
/**
|
|
1415
|
+
* #1452 — would an update of record `id` pass the `beforePut` gate bus right
|
|
1416
|
+
* now? Runs the bus with `incoming = existing`, so closed periods and record
|
|
1417
|
+
* guards refuse an attachment change exactly as they would refuse the
|
|
1418
|
+
* record's own update. A record with no stored body (never written, marker,
|
|
1419
|
+
* elevated tier) is not gated — attaching before the first `put()` was
|
|
1420
|
+
* always allowed. @internal
|
|
1421
|
+
*/
|
|
1422
|
+
_assertRecordMutable(id: string): Promise<void>;
|
|
1404
1423
|
/** Get all records as encrypted envelopes (for dump). */
|
|
1405
1424
|
dumpEnvelopes(): Promise<Record<string, EncryptedEnvelope>>;
|
|
1406
1425
|
/**
|
|
@@ -1469,6 +1488,8 @@ export declare class Collection<T, S extends keyof T = never, Q extends keyof T
|
|
|
1469
1488
|
/** Drop a record's encrypted _vec sidecar on erasure (a vector is text-invertible).
|
|
1470
1489
|
* Called by vault.ts forget() inside a resilient try/catch; residue is reported in ForgetResult. */
|
|
1471
1490
|
_purgeVector(id: string): Promise<void>;
|
|
1491
|
+
/** @internal #1359 — force an immediate sidecar write, cancelling the debounce. No-op when none opted in. */
|
|
1492
|
+
_flushFieldIndexes(): Promise<void>;
|
|
1472
1493
|
/** Drop the persisted lexical-index blob (forget/erasure): an opaque
|
|
1473
1494
|
* all-records index must not survive crypto-shred. Idempotent; no-op without persist. */
|
|
1474
1495
|
_purgeSearchIndex(): Promise<void>;
|
|
@@ -93,6 +93,13 @@ export declare function deriveSecretKey(secret: string, salt: Uint8Array, params
|
|
|
93
93
|
}): Promise<CryptoKey>;
|
|
94
94
|
/** Generate a random AES-256-GCM data encryption key. */
|
|
95
95
|
export declare function generateDEK(): Promise<CryptoKey>;
|
|
96
|
+
/** Serialize a DEK set to `{ collection: base64(rawKey) }`. */
|
|
97
|
+
export declare function exportDekSet(deks: Map<string, CryptoKey>): Promise<Record<string, string>>;
|
|
98
|
+
/**
|
|
99
|
+
* Reverse of {@link exportDekSet}. Keys come back extractable AES-GCM
|
|
100
|
+
* (`encrypt`/`decrypt`), matching what `generateDEK` mints.
|
|
101
|
+
*/
|
|
102
|
+
export declare function importDekSet(exported: Record<string, string>): Promise<Map<string, CryptoKey>>;
|
|
96
103
|
/** Wrap (encrypt) a DEK with a KEK using AES-KW. Returns base64 string. */
|
|
97
104
|
export declare function wrapKey(dek: CryptoKey, kek: CryptoKey): Promise<string>;
|
|
98
105
|
/** Unwrap (decrypt) a DEK from base64 string using a KEK. */
|
|
@@ -331,5 +338,14 @@ export declare function decryptDeterministic(ivBase64: string, dataBase64: strin
|
|
|
331
338
|
export declare function generateIV(): Uint8Array;
|
|
332
339
|
/** Generate a random 32-byte salt for PBKDF2. */
|
|
333
340
|
export declare function generateSalt(): Uint8Array;
|
|
341
|
+
/**
|
|
342
|
+
* Mint a fresh recovery secret — the high-entropy value a recovery profile
|
|
343
|
+
* wraps the DEK set under and then hands out (Shamir splits it into shares;
|
|
344
|
+
* paper prints it). Not a salt: a salt is public, this is not, and a fork
|
|
345
|
+
* may size them differently. The reference enclave returns 32 bytes.
|
|
346
|
+
*
|
|
347
|
+
* Callers must zero the buffer once it has been wrapped and split.
|
|
348
|
+
*/
|
|
349
|
+
export declare function generateRecoverySecret(): Uint8Array;
|
|
334
350
|
export declare function bufferToBase64(buffer: ArrayBuffer | Uint8Array): string;
|
|
335
351
|
export declare function base64ToBuffer(base64: string): Uint8Array<ArrayBuffer>;
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
*/
|
|
58
58
|
export type { EnclaveKey, EncryptResult } from './crypto.js';
|
|
59
59
|
export { encrypt, decrypt, encryptBytes, decryptBytes, encryptBytesWithAAD, decryptBytesWithAAD, encryptDeterministic, decryptDeterministic, sha256Hex, hmacSha256Hex, deriveBlobAddressKey, } from './crypto.js';
|
|
60
|
-
export { deriveKey, deriveSecretKey, generateDEK, generateSalt, generateIV, wrapKey, unwrapKey, bufferToBase64, base64ToBuffer, derivePresenceKey, deriveDeterministicKey, deriveSealedFieldKey, deriveSealedFieldKeyFromCek, wrapCek, unwrapCek, importCek, encodeEchoParts, deriveEchoKey, } from './crypto.js';
|
|
60
|
+
export { deriveKey, deriveSecretKey, generateDEK, exportDekSet, importDekSet, generateSalt, generateRecoverySecret, generateIV, wrapKey, unwrapKey, bufferToBase64, base64ToBuffer, derivePresenceKey, deriveDeterministicKey, deriveSealedFieldKey, deriveSealedFieldKeyFromCek, wrapCek, unwrapCek, importCek, encodeEchoParts, deriveEchoKey, } from './crypto.js';
|
|
61
61
|
export type { SecretKeyUsage } from './crypto.js';
|
|
62
62
|
export type { EchoSecretParts } from './crypto.js';
|
|
63
63
|
export { resolveStableCek, rewrapBodyToDek, rewrapEnvelope, applyRewrappedBody, isRewrappedUnder } from './record-keys/lifecycle.js';
|
|
@@ -97,6 +97,18 @@ export interface RecordCodecContext<T> {
|
|
|
97
97
|
* snapshot.
|
|
98
98
|
*/
|
|
99
99
|
via: ViaPipeline | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Read-coverage observer (#1363), resolved once per Collection from
|
|
102
|
+
* `strategies.coverage.observer(...)`. `undefined` for every un-opted-in
|
|
103
|
+
* deployment AND for every collection the sensor does not account for, so
|
|
104
|
+
* the decrypt path costs one `!== undefined` test.
|
|
105
|
+
*
|
|
106
|
+
* ⛔⛔ TELEMETRY, NOT A CONTROL: an insider holding the device and local keys
|
|
107
|
+
* holds the DEK, so this observes an extraction it cannot prevent. It exists
|
|
108
|
+
* to make one visible early, attributable and loud. It may never grow a
|
|
109
|
+
* return value — a decrypt is not gated on it, and nothing here may refuse.
|
|
110
|
+
*/
|
|
111
|
+
readonly onDecrypt?: ((id: string) => void) | undefined;
|
|
100
112
|
}
|
|
101
113
|
export declare class RecordCodec<T> {
|
|
102
114
|
private readonly ctx;
|
|
@@ -230,6 +242,19 @@ export declare class RecordCodec<T> {
|
|
|
230
242
|
* perfectly good record (#1041).
|
|
231
243
|
*/
|
|
232
244
|
decryptJsonString(ref: RecordRef, envelope: EncryptedEnvelope): Promise<string | null>;
|
|
245
|
+
/**
|
|
246
|
+
* Fire the read-coverage observer for a successful record decrypt (#1363).
|
|
247
|
+
*
|
|
248
|
+
* ⚠️ ONLY for this codec's OWN collection. `ref.collection` can be a storage
|
|
249
|
+
* identity that is not the live collection — a history/version address, the
|
|
250
|
+
* `_vec` vector sidecar, the `_ft` lexical index (#1041) — and their ids are
|
|
251
|
+
* not this corpus's ids, so counting them would corrupt the very estimate
|
|
252
|
+
* the sensor exists to produce. The cost is a deliberate UNDER-count: a
|
|
253
|
+
* principal reading the corpus through its history sidecar is not accounted.
|
|
254
|
+
* A sensor that under-counts is honest; one that inflates cries wolf and
|
|
255
|
+
* gets turned off. Recorded rather than papered over.
|
|
256
|
+
*/
|
|
257
|
+
private observeDecrypt;
|
|
233
258
|
/**
|
|
234
259
|
* Unseal a single `_sealed[field]` slot to its plaintext value: derive the
|
|
235
260
|
* per-field key off the collection DEK, AES-GCM-decrypt the `iv:data` blob,
|