@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,936 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isProbeableBucketKey,
|
|
3
|
+
stringifyBucketKey
|
|
4
|
+
} from "./chunk-SUZKW6UR.js";
|
|
5
|
+
import {
|
|
6
|
+
KIND_STRING,
|
|
7
|
+
compareKeys,
|
|
8
|
+
toSortKey
|
|
9
|
+
} from "./chunk-LGNDFRYC.js";
|
|
10
|
+
import {
|
|
11
|
+
readPath
|
|
12
|
+
} from "./chunk-HLEK5VAN.js";
|
|
13
|
+
|
|
14
|
+
// src/with-lookup/indexing/index-snapshot.ts
|
|
15
|
+
var FIELD_INDEX_SNAPSHOT_VERSION = 1;
|
|
16
|
+
function sortedIndexKey(field) {
|
|
17
|
+
return `s:${encodeURIComponent(field)}`;
|
|
18
|
+
}
|
|
19
|
+
function compoundIndexKey(fields) {
|
|
20
|
+
return `c:${fields.map(encodeURIComponent).join(",")}`;
|
|
21
|
+
}
|
|
22
|
+
function isWireKey(x) {
|
|
23
|
+
if (!Array.isArray(x) || x.length !== 2) return false;
|
|
24
|
+
const [kind, key] = x;
|
|
25
|
+
if (kind === 0 || kind === 2) return typeof key === "number" && Number.isFinite(key);
|
|
26
|
+
if (kind === 1) return typeof key === "string";
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
function isSeq(x) {
|
|
30
|
+
return typeof x === "number" && Number.isInteger(x) && x >= 0;
|
|
31
|
+
}
|
|
32
|
+
function parseFieldIndexSnapshot(json) {
|
|
33
|
+
let raw;
|
|
34
|
+
try {
|
|
35
|
+
raw = JSON.parse(json);
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
40
|
+
const o = raw;
|
|
41
|
+
if (o["v"] !== FIELD_INDEX_SNAPSHOT_VERSION) return null;
|
|
42
|
+
if (!isSeq(o["nextSeq"]) || !Array.isArray(o["entries"])) return null;
|
|
43
|
+
const nextSeq = o["nextSeq"];
|
|
44
|
+
const entries = o["entries"];
|
|
45
|
+
if (o["t"] === "sorted") {
|
|
46
|
+
if (typeof o["field"] !== "string") return null;
|
|
47
|
+
const out = [];
|
|
48
|
+
for (const e of entries) {
|
|
49
|
+
if (!Array.isArray(e) || e.length !== 4) return null;
|
|
50
|
+
const [kind, key, seq, id] = e;
|
|
51
|
+
if (!isWireKey([kind, key])) return null;
|
|
52
|
+
if (!isSeq(seq) || seq >= nextSeq || typeof id !== "string") return null;
|
|
53
|
+
out.push([kind, key, seq, id]);
|
|
54
|
+
}
|
|
55
|
+
if (!isAscending(out.map((e) => [[e[0], e[1]]]), out.map((e) => e[2]))) return null;
|
|
56
|
+
return { v: FIELD_INDEX_SNAPSHOT_VERSION, t: "sorted", field: o["field"], nextSeq, entries: out };
|
|
57
|
+
}
|
|
58
|
+
if (o["t"] === "compound") {
|
|
59
|
+
const fields = o["fields"];
|
|
60
|
+
if (!Array.isArray(fields) || fields.length === 0 || !fields.every((f) => typeof f === "string")) return null;
|
|
61
|
+
const out = [];
|
|
62
|
+
for (const e of entries) {
|
|
63
|
+
if (!Array.isArray(e) || e.length !== 3) return null;
|
|
64
|
+
const [keys, seq, id] = e;
|
|
65
|
+
if (!Array.isArray(keys) || keys.length !== fields.length || !keys.every(isWireKey)) return null;
|
|
66
|
+
if (!isSeq(seq) || seq >= nextSeq || typeof id !== "string") return null;
|
|
67
|
+
out.push([keys, seq, id]);
|
|
68
|
+
}
|
|
69
|
+
if (!isAscending(out.map((e) => e[0]), out.map((e) => e[1]))) return null;
|
|
70
|
+
return { v: FIELD_INDEX_SNAPSHOT_VERSION, t: "compound", fields, nextSeq, entries: out };
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
function isAscending(keys, seqs) {
|
|
75
|
+
for (let i = 1; i < keys.length; i++) {
|
|
76
|
+
const c = compareWireTuples(keys[i - 1], keys[i]);
|
|
77
|
+
if (c > 0) return false;
|
|
78
|
+
if (c === 0 && seqs[i - 1] >= seqs[i]) return false;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
function compareWireTuples(a, b) {
|
|
83
|
+
for (let i = 0; i < a.length; i++) {
|
|
84
|
+
const x = a[i];
|
|
85
|
+
const y = b[i];
|
|
86
|
+
if (x[0] !== y[0]) return x[0] - y[0];
|
|
87
|
+
if (typeof x[1] === "number" && typeof y[1] === "number") {
|
|
88
|
+
if (x[1] !== y[1]) return x[1] - y[1];
|
|
89
|
+
} else if (x[1] !== y[1]) {
|
|
90
|
+
return x[1] < y[1] ? -1 : 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/with-lookup/indexing/sorted-indexes.ts
|
|
97
|
+
var SortedIndex = class {
|
|
98
|
+
constructor(field) {
|
|
99
|
+
this.field = field;
|
|
100
|
+
}
|
|
101
|
+
field;
|
|
102
|
+
entries = [];
|
|
103
|
+
nextSeq = 0;
|
|
104
|
+
get size() {
|
|
105
|
+
return this.entries.length;
|
|
106
|
+
}
|
|
107
|
+
clear() {
|
|
108
|
+
this.entries.length = 0;
|
|
109
|
+
this.nextSeq = 0;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Insert one record. No-op when the value has no order-defined kind.
|
|
113
|
+
*
|
|
114
|
+
* `seq` REINSTATES a rank a previous entry for this id held — see
|
|
115
|
+
* {@link remove}'s return value and `CollectionIndexes.upsert`. Omit it
|
|
116
|
+
* for a fresh insert, which appends after every existing tie.
|
|
117
|
+
*/
|
|
118
|
+
add(id, value, canonicalKey, seq) {
|
|
119
|
+
const sk = toSortKey(value, canonicalKey);
|
|
120
|
+
if (!sk) return;
|
|
121
|
+
const entry = { ...sk, seq: seq ?? this.nextSeq++, id };
|
|
122
|
+
this.entries.splice(this.insertionPoint(entry), 0, entry);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Remove one record, addressed by the value it was indexed under.
|
|
126
|
+
* Returns the rank it held, so an UPDATE can reinstate it (#1369):
|
|
127
|
+
* `sortRecords()` sorts a snapshot whose order does not change when a
|
|
128
|
+
* record is written in place, so a tie-breaking rank that drifted to the
|
|
129
|
+
* back on every `put` would make an index-served page disagree with the
|
|
130
|
+
* scan it must match. Same contract as `CompoundIndex.remove`.
|
|
131
|
+
*/
|
|
132
|
+
remove(id, value, canonicalKey) {
|
|
133
|
+
const sk = toSortKey(value, canonicalKey);
|
|
134
|
+
if (!sk) return void 0;
|
|
135
|
+
for (let i = this.lowerBound(sk); i < this.entries.length; i++) {
|
|
136
|
+
const e = this.entries[i];
|
|
137
|
+
if (compareKeys(e, sk) !== 0) break;
|
|
138
|
+
if (e.id === id) {
|
|
139
|
+
this.entries.splice(i, 1);
|
|
140
|
+
return e.seq;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return void 0;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Ids in ascending (or descending) key order. Ties keep INSERTION order
|
|
147
|
+
* in both directions — `sortRecords()` negates its comparator over a
|
|
148
|
+
* stable sort, which reverses the key order but not the order of equal
|
|
149
|
+
* keys. A plain `.reverse()` here would disagree on ties.
|
|
150
|
+
*/
|
|
151
|
+
orderedIds(direction) {
|
|
152
|
+
if (direction === "asc") return this.entries.map((e) => e.id);
|
|
153
|
+
const out = [];
|
|
154
|
+
let end = this.entries.length;
|
|
155
|
+
while (end > 0) {
|
|
156
|
+
let start = end - 1;
|
|
157
|
+
while (start > 0 && compareKeys(this.entries[start - 1], this.entries[end - 1]) === 0) start--;
|
|
158
|
+
for (let i = start; i < end; i++) out.push(this.entries[i].id);
|
|
159
|
+
end = start;
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Ids matching a range clause. Returns an empty set when the probe has
|
|
165
|
+
* no comparable kind — which is what the linear scan would produce too.
|
|
166
|
+
*/
|
|
167
|
+
lookup(op, value) {
|
|
168
|
+
if (op === "startsWith") return this.prefix(value);
|
|
169
|
+
if (op === "between") {
|
|
170
|
+
if (!Array.isArray(value) || value.length !== 2) return /* @__PURE__ */ new Set();
|
|
171
|
+
const lo2 = toSortKey(value[0], void 0);
|
|
172
|
+
const hi2 = toSortKey(value[1], void 0);
|
|
173
|
+
if (!lo2 || !hi2 || lo2.kind !== hi2.kind) return /* @__PURE__ */ new Set();
|
|
174
|
+
return this.slice(this.lowerBound(lo2), this.upperBound(hi2));
|
|
175
|
+
}
|
|
176
|
+
const probe = toSortKey(value, void 0);
|
|
177
|
+
if (!probe) return /* @__PURE__ */ new Set();
|
|
178
|
+
const lo = this.lowerBound(probe);
|
|
179
|
+
const hi = this.upperBound(probe);
|
|
180
|
+
const [kindStart, kindEnd] = this.kindBounds(probe.kind);
|
|
181
|
+
switch (op) {
|
|
182
|
+
case "<":
|
|
183
|
+
return this.slice(kindStart, lo);
|
|
184
|
+
case "<=":
|
|
185
|
+
return this.slice(kindStart, hi);
|
|
186
|
+
case ">":
|
|
187
|
+
return this.slice(hi, kindEnd);
|
|
188
|
+
case ">=":
|
|
189
|
+
return this.slice(lo, kindEnd);
|
|
190
|
+
default: {
|
|
191
|
+
const _exhaustive = op;
|
|
192
|
+
void _exhaustive;
|
|
193
|
+
return /* @__PURE__ */ new Set();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
prefix(value) {
|
|
198
|
+
if (typeof value !== "string") return /* @__PURE__ */ new Set();
|
|
199
|
+
const out = /* @__PURE__ */ new Set();
|
|
200
|
+
const from = this.lowerBound({ kind: KIND_STRING, key: value });
|
|
201
|
+
for (let i = from; i < this.entries.length; i++) {
|
|
202
|
+
const e = this.entries[i];
|
|
203
|
+
if (e.kind !== KIND_STRING) break;
|
|
204
|
+
if (!e.key.startsWith(value)) break;
|
|
205
|
+
out.add(e.id);
|
|
206
|
+
}
|
|
207
|
+
return out;
|
|
208
|
+
}
|
|
209
|
+
slice(from, to) {
|
|
210
|
+
const out = /* @__PURE__ */ new Set();
|
|
211
|
+
for (let i = from; i < to; i++) out.add(this.entries[i].id);
|
|
212
|
+
return out;
|
|
213
|
+
}
|
|
214
|
+
/** [start, end) of the run of entries with the given kind — binary, not linear. */
|
|
215
|
+
kindBounds(kind) {
|
|
216
|
+
return [this.kindBoundary((k) => k < kind), this.kindBoundary((k) => k <= kind)];
|
|
217
|
+
}
|
|
218
|
+
kindBoundary(before) {
|
|
219
|
+
let lo = 0;
|
|
220
|
+
let hi = this.entries.length;
|
|
221
|
+
while (lo < hi) {
|
|
222
|
+
const mid = lo + hi >>> 1;
|
|
223
|
+
if (before(this.entries[mid].kind)) lo = mid + 1;
|
|
224
|
+
else hi = mid;
|
|
225
|
+
}
|
|
226
|
+
return lo;
|
|
227
|
+
}
|
|
228
|
+
/** First index whose key is >= `probe`. */
|
|
229
|
+
lowerBound(probe) {
|
|
230
|
+
let lo = 0;
|
|
231
|
+
let hi = this.entries.length;
|
|
232
|
+
while (lo < hi) {
|
|
233
|
+
const mid = lo + hi >>> 1;
|
|
234
|
+
if (compareKeys(this.entries[mid], probe) < 0) lo = mid + 1;
|
|
235
|
+
else hi = mid;
|
|
236
|
+
}
|
|
237
|
+
return lo;
|
|
238
|
+
}
|
|
239
|
+
/** First index whose key is > `probe`. */
|
|
240
|
+
upperBound(probe) {
|
|
241
|
+
let lo = 0;
|
|
242
|
+
let hi = this.entries.length;
|
|
243
|
+
while (lo < hi) {
|
|
244
|
+
const mid = lo + hi >>> 1;
|
|
245
|
+
if (compareKeys(this.entries[mid], probe) <= 0) lo = mid + 1;
|
|
246
|
+
else hi = mid;
|
|
247
|
+
}
|
|
248
|
+
return lo;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The persistable form of this index (#1359). `kind` travels with every
|
|
252
|
+
* key: entries rank by runtime kind first, so an encoding that dropped it
|
|
253
|
+
* would let a `string` probe reach `number` entries on the way back in.
|
|
254
|
+
*/
|
|
255
|
+
toSnapshot() {
|
|
256
|
+
return {
|
|
257
|
+
v: FIELD_INDEX_SNAPSHOT_VERSION,
|
|
258
|
+
t: "sorted",
|
|
259
|
+
field: this.field,
|
|
260
|
+
nextSeq: this.nextSeq,
|
|
261
|
+
entries: this.entries.map((e) => [e.kind, e.key, e.seq, e.id])
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Adopt a validated snapshot, or refuse it. Refusal (`false`) means the
|
|
266
|
+
* caller rebuilds — it NEVER means a partial index: the entries are staged
|
|
267
|
+
* and only swapped in once every one of them is accepted.
|
|
268
|
+
*
|
|
269
|
+
* `isLive` is the caller's liveness predicate over the record cache. An
|
|
270
|
+
* entry naming a record the cache does not hold means the blob and the
|
|
271
|
+
* collection have diverged (a crash between the two writes, say), so the
|
|
272
|
+
* whole blob is discarded. Crash residue must be a rebuild, never a wrong
|
|
273
|
+
* answer.
|
|
274
|
+
*/
|
|
275
|
+
loadSnapshot(snap, isLive) {
|
|
276
|
+
if (snap.t !== "sorted" || snap.field !== this.field) return false;
|
|
277
|
+
const staged = [];
|
|
278
|
+
for (const [kind, key, seq, id] of snap.entries) {
|
|
279
|
+
if (!isLive(id)) return false;
|
|
280
|
+
staged.push({ kind, key, seq, id });
|
|
281
|
+
}
|
|
282
|
+
this.entries.length = 0;
|
|
283
|
+
for (const e of staged) this.entries.push(e);
|
|
284
|
+
this.nextSeq = snap.nextSeq;
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Insertion point that keeps ties in `seq` order. A fresh entry lands at
|
|
289
|
+
* the end of its tie run; a REINSTATED one (see {@link add}) lands back at
|
|
290
|
+
* its own rank inside it.
|
|
291
|
+
*/
|
|
292
|
+
insertionPoint(entry) {
|
|
293
|
+
let i = this.upperBound(entry);
|
|
294
|
+
while (i > 0 && compareKeys(this.entries[i - 1], entry) === 0 && this.entries[i - 1].seq > entry.seq) {
|
|
295
|
+
i--;
|
|
296
|
+
}
|
|
297
|
+
return i;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
function buildSortedIndex(idx, records, canonicalize) {
|
|
301
|
+
idx.clear();
|
|
302
|
+
for (const { id, record } of records) {
|
|
303
|
+
const value = readPath(record, idx.field);
|
|
304
|
+
if (value === null || value === void 0) continue;
|
|
305
|
+
idx.add(id, value, canonicalize?.(idx.field, value));
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// src/with-lookup/indexing/compound-indexes.ts
|
|
310
|
+
var CompoundIndex = class {
|
|
311
|
+
constructor(fields) {
|
|
312
|
+
this.fields = fields;
|
|
313
|
+
}
|
|
314
|
+
fields;
|
|
315
|
+
entries = [];
|
|
316
|
+
nextSeq = 0;
|
|
317
|
+
get size() {
|
|
318
|
+
return this.entries.length;
|
|
319
|
+
}
|
|
320
|
+
clear() {
|
|
321
|
+
this.entries.length = 0;
|
|
322
|
+
this.nextSeq = 0;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Insert one record. No-op unless every component has an ordered key.
|
|
326
|
+
*
|
|
327
|
+
* `seq` REINSTATES a rank a previous entry for this id held — see
|
|
328
|
+
* {@link remove}'s return value and `CollectionIndexes.upsert`. Omit it
|
|
329
|
+
* for a fresh insert, which appends after every existing tie.
|
|
330
|
+
*/
|
|
331
|
+
add(id, keys, seq) {
|
|
332
|
+
if (!keys) return;
|
|
333
|
+
const entry = { keys, seq: seq ?? this.nextSeq++, id };
|
|
334
|
+
this.entries.splice(this.insertionPoint(entry), 0, entry);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Remove one record, addressed by the tuple it was indexed under.
|
|
338
|
+
* Returns the rank it held, so an UPDATE can reinstate it: `sortRecords()`
|
|
339
|
+
* sorts a snapshot whose order does not change when a record is written in
|
|
340
|
+
* place, so a tie-breaking rank that drifted to the back on every `put`
|
|
341
|
+
* would make an index-served page disagree with the scan it must match.
|
|
342
|
+
*/
|
|
343
|
+
remove(id, keys) {
|
|
344
|
+
if (!keys) return void 0;
|
|
345
|
+
const [from, to] = this.run(keys, keys.length);
|
|
346
|
+
for (let i = from; i < to; i++) {
|
|
347
|
+
if (this.entries[i].id === id) {
|
|
348
|
+
const [gone] = this.entries.splice(i, 1);
|
|
349
|
+
return gone.seq;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return void 0;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Ids matching an equality prefix, optionally narrowed by a range on
|
|
356
|
+
* the next component. An empty set is authoritative: the index covers
|
|
357
|
+
* these fields and nothing matches.
|
|
358
|
+
*/
|
|
359
|
+
lookup(prefix, range) {
|
|
360
|
+
const [from, to] = this.run(prefix, prefix.length);
|
|
361
|
+
if (!range) return this.slice(from, to);
|
|
362
|
+
const k = prefix.length;
|
|
363
|
+
if (k >= this.fields.length) return /* @__PURE__ */ new Set();
|
|
364
|
+
if (range.op === "startsWith") {
|
|
365
|
+
if (typeof range.value !== "string") return /* @__PURE__ */ new Set();
|
|
366
|
+
const out = /* @__PURE__ */ new Set();
|
|
367
|
+
const start = this.lowerBound([...prefix, { kind: KIND_STRING, key: range.value }], k + 1, from, to);
|
|
368
|
+
for (let i = start; i < to; i++) {
|
|
369
|
+
const key = this.entries[i].keys[k];
|
|
370
|
+
if (key.kind !== KIND_STRING) break;
|
|
371
|
+
if (!key.key.startsWith(range.value)) break;
|
|
372
|
+
out.add(this.entries[i].id);
|
|
373
|
+
}
|
|
374
|
+
return out;
|
|
375
|
+
}
|
|
376
|
+
if (range.op === "between") {
|
|
377
|
+
if (!Array.isArray(range.value) || range.value.length !== 2) return /* @__PURE__ */ new Set();
|
|
378
|
+
const lo2 = toSortKey(range.value[0], void 0);
|
|
379
|
+
const hi2 = toSortKey(range.value[1], void 0);
|
|
380
|
+
if (!lo2 || !hi2 || lo2.kind !== hi2.kind) return /* @__PURE__ */ new Set();
|
|
381
|
+
return this.slice(
|
|
382
|
+
this.lowerBound([...prefix, lo2], k + 1, from, to),
|
|
383
|
+
this.upperBound([...prefix, hi2], k + 1, from, to)
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
const probe = toSortKey(range.value, void 0);
|
|
387
|
+
if (!probe) return /* @__PURE__ */ new Set();
|
|
388
|
+
const [kindStart, kindEnd] = this.kindRun(from, to, k, probe.kind);
|
|
389
|
+
const lo = this.lowerBound([...prefix, probe], k + 1, from, to);
|
|
390
|
+
const hi = this.upperBound([...prefix, probe], k + 1, from, to);
|
|
391
|
+
switch (range.op) {
|
|
392
|
+
case "<":
|
|
393
|
+
return this.slice(kindStart, lo);
|
|
394
|
+
case "<=":
|
|
395
|
+
return this.slice(kindStart, hi);
|
|
396
|
+
case ">":
|
|
397
|
+
return this.slice(hi, kindEnd);
|
|
398
|
+
case ">=":
|
|
399
|
+
return this.slice(lo, kindEnd);
|
|
400
|
+
default: {
|
|
401
|
+
const _exhaustive = range.op;
|
|
402
|
+
void _exhaustive;
|
|
403
|
+
return /* @__PURE__ */ new Set();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Ids matching an equality prefix, in the order of the remaining
|
|
409
|
+
* components. Ties keep INSERTION order in both directions — a plain
|
|
410
|
+
* `.reverse()` would disagree with `sortRecords()` on equal keys.
|
|
411
|
+
*/
|
|
412
|
+
orderedIds(prefix, direction) {
|
|
413
|
+
const [from, to] = this.run(prefix, prefix.length);
|
|
414
|
+
const out = [];
|
|
415
|
+
if (direction === "asc") {
|
|
416
|
+
for (let i = from; i < to; i++) out.push(this.entries[i].id);
|
|
417
|
+
return out;
|
|
418
|
+
}
|
|
419
|
+
let end = to;
|
|
420
|
+
while (end > from) {
|
|
421
|
+
let start = end - 1;
|
|
422
|
+
while (start > from && this.compare(this.entries[start - 1], this.entries[end - 1].keys, this.fields.length) === 0) {
|
|
423
|
+
start--;
|
|
424
|
+
}
|
|
425
|
+
for (let i = start; i < end; i++) out.push(this.entries[i].id);
|
|
426
|
+
end = start;
|
|
427
|
+
}
|
|
428
|
+
return out;
|
|
429
|
+
}
|
|
430
|
+
slice(from, to) {
|
|
431
|
+
const out = /* @__PURE__ */ new Set();
|
|
432
|
+
for (let i = from; i < to; i++) out.add(this.entries[i].id);
|
|
433
|
+
return out;
|
|
434
|
+
}
|
|
435
|
+
/** [start, end) of the entries whose first `upto` components equal `probe`. */
|
|
436
|
+
run(probe, upto) {
|
|
437
|
+
return [
|
|
438
|
+
this.lowerBound(probe, upto, 0, this.entries.length),
|
|
439
|
+
this.upperBound(probe, upto, 0, this.entries.length)
|
|
440
|
+
];
|
|
441
|
+
}
|
|
442
|
+
/** [start, end) of the entries in [from,to) whose component `k` has this kind. */
|
|
443
|
+
kindRun(from, to, k, kind) {
|
|
444
|
+
return [
|
|
445
|
+
this.kindBoundary(from, to, k, (x) => x < kind),
|
|
446
|
+
this.kindBoundary(from, to, k, (x) => x <= kind)
|
|
447
|
+
];
|
|
448
|
+
}
|
|
449
|
+
kindBoundary(from, to, k, before) {
|
|
450
|
+
let lo = from;
|
|
451
|
+
let hi = to;
|
|
452
|
+
while (lo < hi) {
|
|
453
|
+
const mid = lo + hi >>> 1;
|
|
454
|
+
if (before(this.entries[mid].keys[k].kind)) lo = mid + 1;
|
|
455
|
+
else hi = mid;
|
|
456
|
+
}
|
|
457
|
+
return lo;
|
|
458
|
+
}
|
|
459
|
+
/** First index in [from,to) whose first `upto` components are >= `probe`. */
|
|
460
|
+
lowerBound(probe, upto, from, to) {
|
|
461
|
+
let lo = from;
|
|
462
|
+
let hi = to;
|
|
463
|
+
while (lo < hi) {
|
|
464
|
+
const mid = lo + hi >>> 1;
|
|
465
|
+
if (this.compare(this.entries[mid], probe, upto) < 0) lo = mid + 1;
|
|
466
|
+
else hi = mid;
|
|
467
|
+
}
|
|
468
|
+
return lo;
|
|
469
|
+
}
|
|
470
|
+
/** First index in [from,to) whose first `upto` components are > `probe`. */
|
|
471
|
+
upperBound(probe, upto, from, to) {
|
|
472
|
+
let lo = from;
|
|
473
|
+
let hi = to;
|
|
474
|
+
while (lo < hi) {
|
|
475
|
+
const mid = lo + hi >>> 1;
|
|
476
|
+
if (this.compare(this.entries[mid], probe, upto) <= 0) lo = mid + 1;
|
|
477
|
+
else hi = mid;
|
|
478
|
+
}
|
|
479
|
+
return lo;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* The persistable form of this index (#1359). Each entry's tuple stays an
|
|
483
|
+
* ARRAY of `[kind, key]` pairs: nothing is joined into a string, so a
|
|
484
|
+
* string component may hold any byte and the per-component kind partition
|
|
485
|
+
* survives the round trip intact.
|
|
486
|
+
*/
|
|
487
|
+
toSnapshot() {
|
|
488
|
+
return {
|
|
489
|
+
v: FIELD_INDEX_SNAPSHOT_VERSION,
|
|
490
|
+
t: "compound",
|
|
491
|
+
fields: [...this.fields],
|
|
492
|
+
nextSeq: this.nextSeq,
|
|
493
|
+
entries: this.entries.map(
|
|
494
|
+
(e) => [e.keys.map((k) => [k.kind, k.key]), e.seq, e.id]
|
|
495
|
+
)
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Adopt a validated snapshot, or refuse it. Same contract as
|
|
500
|
+
* `SortedIndex.loadSnapshot`: all-or-nothing, and an entry naming a record
|
|
501
|
+
* the cache does not hold rejects the whole blob so crash residue becomes a
|
|
502
|
+
* rebuild rather than a wrong answer. A snapshot whose field tuple is not
|
|
503
|
+
* exactly this index's is refused — the declaration changed under it.
|
|
504
|
+
*/
|
|
505
|
+
loadSnapshot(snap, isLive) {
|
|
506
|
+
if (snap.t !== "compound") return false;
|
|
507
|
+
if (snap.fields.length !== this.fields.length) return false;
|
|
508
|
+
for (let i = 0; i < snap.fields.length; i++) if (snap.fields[i] !== this.fields[i]) return false;
|
|
509
|
+
const staged = [];
|
|
510
|
+
for (const [keys, seq, id] of snap.entries) {
|
|
511
|
+
if (!isLive(id)) return false;
|
|
512
|
+
staged.push({ keys: keys.map((k) => ({ kind: k[0], key: k[1] })), seq, id });
|
|
513
|
+
}
|
|
514
|
+
this.entries.length = 0;
|
|
515
|
+
for (const e of staged) this.entries.push(e);
|
|
516
|
+
this.nextSeq = snap.nextSeq;
|
|
517
|
+
return true;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Insertion point that keeps ties in `seq` order. A fresh entry lands at
|
|
521
|
+
* the end of its tie run; a REINSTATED one (see {@link add}) lands back at
|
|
522
|
+
* its own rank inside it.
|
|
523
|
+
*/
|
|
524
|
+
insertionPoint(entry) {
|
|
525
|
+
const to = this.upperBound(entry.keys, this.fields.length, 0, this.entries.length);
|
|
526
|
+
let i = to;
|
|
527
|
+
while (i > 0 && this.compare(this.entries[i - 1], entry.keys, this.fields.length) === 0 && this.entries[i - 1].seq > entry.seq) {
|
|
528
|
+
i--;
|
|
529
|
+
}
|
|
530
|
+
return i;
|
|
531
|
+
}
|
|
532
|
+
compare(entry, probe, upto) {
|
|
533
|
+
for (let i = 0; i < upto; i++) {
|
|
534
|
+
const c = compareKeys(entry.keys[i], probe[i]);
|
|
535
|
+
if (c !== 0) return c;
|
|
536
|
+
}
|
|
537
|
+
return 0;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
function tupleKeyOf(fields, record, canonicalize) {
|
|
541
|
+
const keys = [];
|
|
542
|
+
for (const field of fields) {
|
|
543
|
+
const value = readPath(record, field);
|
|
544
|
+
if (value === null || value === void 0) return void 0;
|
|
545
|
+
const key = toSortKey(value, canonicalize?.(field, value));
|
|
546
|
+
if (!key) return void 0;
|
|
547
|
+
keys.push(key);
|
|
548
|
+
}
|
|
549
|
+
return keys;
|
|
550
|
+
}
|
|
551
|
+
function probeKeysOf(values) {
|
|
552
|
+
const keys = [];
|
|
553
|
+
for (const value of values) {
|
|
554
|
+
const key = toSortKey(value, void 0);
|
|
555
|
+
if (!key) return void 0;
|
|
556
|
+
keys.push(key);
|
|
557
|
+
}
|
|
558
|
+
return keys;
|
|
559
|
+
}
|
|
560
|
+
function buildCompoundIndex(idx, records, canonicalize) {
|
|
561
|
+
idx.clear();
|
|
562
|
+
for (const { id, record } of records) {
|
|
563
|
+
idx.add(id, tupleKeyOf(idx.fields, record, canonicalize));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function compoundKey(fields) {
|
|
567
|
+
return fields.join("\0");
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// src/with-lookup/indexing/eager-indexes.ts
|
|
571
|
+
function normalizeIndexDefs(defs) {
|
|
572
|
+
return defs.map((def) => {
|
|
573
|
+
if (typeof def === "string") return { fields: [def] };
|
|
574
|
+
if (Array.isArray(def)) return { fields: def };
|
|
575
|
+
return def;
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
var CollectionIndexes = class {
|
|
579
|
+
indexes = /* @__PURE__ */ new Map();
|
|
580
|
+
/**
|
|
581
|
+
* Sorted (range) indexes, keyed by field — the #1344 half. Parallel to
|
|
582
|
+
* `indexes` above and maintained at the SAME mutation sites, through the
|
|
583
|
+
* SAME `canonicalize` closure, so the two can never disagree about which
|
|
584
|
+
* key space a field lives in.
|
|
585
|
+
*/
|
|
586
|
+
sorted = /* @__PURE__ */ new Map();
|
|
587
|
+
/**
|
|
588
|
+
* Compound (tuple-keyed) sorted indexes, keyed by the joined field
|
|
589
|
+
* tuple — the #1345 half. Third parallel map, maintained at the SAME
|
|
590
|
+
* mutation sites through the SAME `canonicalize` closure as the other
|
|
591
|
+
* two, so no field can end up in disagreeing key spaces.
|
|
592
|
+
*/
|
|
593
|
+
compound = /* @__PURE__ */ new Map();
|
|
594
|
+
/**
|
|
595
|
+
* The indexes declared `persist: true` (#1359), keyed by their SIDECAR key
|
|
596
|
+
* (`s:<field>` / `c:<f1>,<f2>`). A separate map rather than a flag on the
|
|
597
|
+
* index classes: persistence is a property of the DECLARATION, and the
|
|
598
|
+
* index classes stay unaware of storage.
|
|
599
|
+
*/
|
|
600
|
+
persistable = /* @__PURE__ */ new Map();
|
|
601
|
+
/**
|
|
602
|
+
* Per-field bucket-key canonicalizer (#672 review C1), registered ONCE
|
|
603
|
+
* via {@link setCanonicalizer} when the collection wires indexing up
|
|
604
|
+
* (money-aware via `ViaPipeline.canonicalizeIndexKey`). Consulted by
|
|
605
|
+
* EVERY bucket-mutation site — `build`/`upsert`/`remove` — so bucket
|
|
606
|
+
* membership is symmetric by construction: a value can never be added
|
|
607
|
+
* under a canonical key and later removed under the raw one (or vice
|
|
608
|
+
* versa), which is what stranded ids on `put`/`delete` before this fix.
|
|
609
|
+
*/
|
|
610
|
+
canonicalize;
|
|
611
|
+
/**
|
|
612
|
+
* Register the bucket-key canonicalizer. Called once, where the
|
|
613
|
+
* collection constructs its indexing state — safe to call again (the
|
|
614
|
+
* closure is simply replaced) but there is normally only one caller.
|
|
615
|
+
*/
|
|
616
|
+
setCanonicalizer(fn) {
|
|
617
|
+
this.canonicalize = fn;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Declare an index. Subsequent record additions are tracked under it.
|
|
621
|
+
* Calling this twice for the same field is a no-op (idempotent).
|
|
622
|
+
*/
|
|
623
|
+
declare(field) {
|
|
624
|
+
if (this.indexes.has(field)) return;
|
|
625
|
+
this.indexes.set(field, { field, buckets: /* @__PURE__ */ new Map() });
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Declare a sorted (range) index on a field. Independent of
|
|
629
|
+
* {@link declare} — callers that want both `==` speed and range speed
|
|
630
|
+
* declare both (which is what `withIndexing()` does for a
|
|
631
|
+
* `kind: 'sorted'` declaration). Idempotent.
|
|
632
|
+
*/
|
|
633
|
+
declareSorted(field, opts) {
|
|
634
|
+
let idx = this.sorted.get(field);
|
|
635
|
+
if (!idx) {
|
|
636
|
+
idx = new SortedIndex(field);
|
|
637
|
+
this.sorted.set(field, idx);
|
|
638
|
+
}
|
|
639
|
+
if (opts?.persist) this.persistable.set(sortedIndexKey(field), idx);
|
|
640
|
+
}
|
|
641
|
+
/** True if the given field has a declared SORTED index. */
|
|
642
|
+
hasSorted(field) {
|
|
643
|
+
return this.sorted.has(field);
|
|
644
|
+
}
|
|
645
|
+
/** All sorted-index field names, in declaration order. */
|
|
646
|
+
sortedFields() {
|
|
647
|
+
return [...this.sorted.keys()];
|
|
648
|
+
}
|
|
649
|
+
/** Number of entries in a field's sorted index (0 when undeclared). */
|
|
650
|
+
sortedSize(field) {
|
|
651
|
+
return this.sorted.get(field)?.size ?? 0;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Range lookup: ids whose `field` satisfies the operator. Returns
|
|
655
|
+
* `null` when no SORTED index covers the field — the caller falls back
|
|
656
|
+
* to a linear scan. An empty set means "the index covers this field and
|
|
657
|
+
* nothing matches", which is authoritative.
|
|
658
|
+
*/
|
|
659
|
+
lookupRange(field, op, value) {
|
|
660
|
+
return this.sorted.get(field)?.lookup(op, value) ?? null;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Ids of every indexed record in `field` order. `null` when no sorted
|
|
664
|
+
* index covers the field. Records whose value is nullish or has no
|
|
665
|
+
* order-defined type are absent — compare against {@link sortedSize}
|
|
666
|
+
* before treating the result as the full collection.
|
|
667
|
+
*/
|
|
668
|
+
orderedIds(field, direction) {
|
|
669
|
+
return this.sorted.get(field)?.orderedIds(direction) ?? null;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Declare a compound (multi-field) sorted index over an ordered field
|
|
673
|
+
* tuple. A tuple shorter than two fields is a single-field sorted index
|
|
674
|
+
* and is ignored here. Idempotent.
|
|
675
|
+
*/
|
|
676
|
+
declareCompound(fields, opts) {
|
|
677
|
+
if (fields.length < 2) return;
|
|
678
|
+
const key = compoundKey(fields);
|
|
679
|
+
let idx = this.compound.get(key);
|
|
680
|
+
if (!idx) {
|
|
681
|
+
idx = new CompoundIndex([...fields]);
|
|
682
|
+
this.compound.set(key, idx);
|
|
683
|
+
}
|
|
684
|
+
if (opts?.persist) this.persistable.set(compoundIndexKey(fields), idx);
|
|
685
|
+
}
|
|
686
|
+
/** Every declared field tuple, in declaration order. */
|
|
687
|
+
compoundTuples() {
|
|
688
|
+
return [...this.compound.values()].map((idx) => idx.fields);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Number of records the tuple's index holds (0 when undeclared). A
|
|
692
|
+
* record with a nullish or non-orderable component is absent, so a
|
|
693
|
+
* caller that removes clauses from the plan MUST compare this against
|
|
694
|
+
* the snapshot size before trusting the result.
|
|
695
|
+
*/
|
|
696
|
+
compoundSize(fields) {
|
|
697
|
+
return this.compound.get(compoundKey(fields))?.size ?? 0;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Compound lookup: ids whose leading components equal `prefixValues`,
|
|
701
|
+
* optionally narrowed by a range on the component just past them.
|
|
702
|
+
* `null` when no compound index covers the tuple, or when an operand
|
|
703
|
+
* has no order-defined type — the caller falls back to a linear scan.
|
|
704
|
+
*/
|
|
705
|
+
lookupCompound(fields, prefixValues, range) {
|
|
706
|
+
const idx = this.compound.get(compoundKey(fields));
|
|
707
|
+
if (!idx) return null;
|
|
708
|
+
const prefix = probeKeysOf(prefixValues);
|
|
709
|
+
if (!prefix) return null;
|
|
710
|
+
return idx.lookup(prefix, range);
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Ids matching an equality prefix, ordered by the remaining components.
|
|
714
|
+
* `null` when no compound index covers the tuple or an operand has no
|
|
715
|
+
* order-defined type. See {@link compoundSize} for the coverage caveat.
|
|
716
|
+
*/
|
|
717
|
+
compoundOrderedIds(fields, prefixValues, direction) {
|
|
718
|
+
const idx = this.compound.get(compoundKey(fields));
|
|
719
|
+
if (!idx) return null;
|
|
720
|
+
const prefix = probeKeysOf(prefixValues);
|
|
721
|
+
if (!prefix) return null;
|
|
722
|
+
return idx.orderedIds(prefix, direction);
|
|
723
|
+
}
|
|
724
|
+
/** True if the given field has a declared index. */
|
|
725
|
+
has(field) {
|
|
726
|
+
return this.indexes.has(field);
|
|
727
|
+
}
|
|
728
|
+
/** All declared field names, in declaration order. */
|
|
729
|
+
fields() {
|
|
730
|
+
return [...this.indexes.keys()];
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Build all declared indexes from a snapshot of records.
|
|
734
|
+
* Called once per hydration. O(N × indexes.size). Buckets through the
|
|
735
|
+
* registered {@link setCanonicalizer} closure, same as `upsert`/`remove`.
|
|
736
|
+
*/
|
|
737
|
+
build(records, skip = EMPTY_KEYS) {
|
|
738
|
+
for (const idx of this.indexes.values()) {
|
|
739
|
+
idx.buckets.clear();
|
|
740
|
+
for (const { id, record } of records) {
|
|
741
|
+
addToIndex(idx, id, record, this.canonicalize);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
for (const [field, idx] of this.sorted) {
|
|
745
|
+
if (skip.has(sortedIndexKey(field))) continue;
|
|
746
|
+
buildSortedIndex(idx, records, this.canonicalize);
|
|
747
|
+
}
|
|
748
|
+
for (const idx of this.compound.values()) {
|
|
749
|
+
if (skip.has(compoundIndexKey(idx.fields))) continue;
|
|
750
|
+
buildCompoundIndex(idx, records, this.canonicalize);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
/** Sidecar keys of every index declared `persist: true`, in declaration order. */
|
|
754
|
+
persistableKeys() {
|
|
755
|
+
return [...this.persistable.keys()];
|
|
756
|
+
}
|
|
757
|
+
/** The persistable snapshot behind one sidecar key, or `undefined` if it is not declared. */
|
|
758
|
+
snapshotIndex(key) {
|
|
759
|
+
return this.persistable.get(key)?.toSnapshot();
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Adopt a validated snapshot into the index behind `key`. `false` means the
|
|
763
|
+
* caller must rebuild that index from the cache — the index is left
|
|
764
|
+
* untouched, never half-loaded.
|
|
765
|
+
*/
|
|
766
|
+
restoreIndex(key, snap, isLive) {
|
|
767
|
+
return this.persistable.get(key)?.loadSnapshot(snap, isLive) ?? false;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Insert or update a single record across all indexes.
|
|
771
|
+
* Called by `Collection.put()` after the encrypted write succeeds.
|
|
772
|
+
*
|
|
773
|
+
* If `previousRecord` is provided, the record is removed from any old
|
|
774
|
+
* buckets first — this is the update path. Pass `null` for fresh adds.
|
|
775
|
+
*/
|
|
776
|
+
upsert(id, newRecord, previousRecord) {
|
|
777
|
+
if (this.indexes.size === 0 && this.sorted.size === 0 && this.compound.size === 0) return;
|
|
778
|
+
const ranks = /* @__PURE__ */ new Map();
|
|
779
|
+
const sortedRanks = /* @__PURE__ */ new Map();
|
|
780
|
+
if (previousRecord !== null) {
|
|
781
|
+
for (const [key, idx] of this.compound) {
|
|
782
|
+
ranks.set(key, idx.remove(id, tupleKeyOf(idx.fields, previousRecord, this.canonicalize)));
|
|
783
|
+
}
|
|
784
|
+
for (const [key, idx] of this.sorted) {
|
|
785
|
+
const value = readPath(previousRecord, idx.field);
|
|
786
|
+
if (value === null || value === void 0) continue;
|
|
787
|
+
sortedRanks.set(key, idx.remove(id, value, this.canonicalize?.(idx.field, value)));
|
|
788
|
+
}
|
|
789
|
+
this.remove(id, previousRecord);
|
|
790
|
+
}
|
|
791
|
+
for (const idx of this.indexes.values()) {
|
|
792
|
+
addToIndex(idx, id, newRecord, this.canonicalize);
|
|
793
|
+
}
|
|
794
|
+
for (const [key, idx] of this.sorted) {
|
|
795
|
+
const value = readPath(newRecord, idx.field);
|
|
796
|
+
if (value === null || value === void 0) continue;
|
|
797
|
+
idx.add(id, value, this.canonicalize?.(idx.field, value), sortedRanks.get(key));
|
|
798
|
+
}
|
|
799
|
+
for (const [key, idx] of this.compound) {
|
|
800
|
+
idx.add(id, tupleKeyOf(idx.fields, newRecord, this.canonicalize), ranks.get(key));
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Remove a record from all indexes. Called by `Collection.delete()`
|
|
805
|
+
* (and as the first half of `upsert` for the update path).
|
|
806
|
+
*/
|
|
807
|
+
remove(id, record) {
|
|
808
|
+
if (this.indexes.size === 0 && this.sorted.size === 0 && this.compound.size === 0) return;
|
|
809
|
+
for (const idx of this.indexes.values()) {
|
|
810
|
+
removeFromIndex(idx, id, record, this.canonicalize);
|
|
811
|
+
}
|
|
812
|
+
for (const idx of this.sorted.values()) {
|
|
813
|
+
const value = readPath(record, idx.field);
|
|
814
|
+
if (value === null || value === void 0) continue;
|
|
815
|
+
idx.remove(id, value, this.canonicalize?.(idx.field, value));
|
|
816
|
+
}
|
|
817
|
+
for (const idx of this.compound.values()) {
|
|
818
|
+
idx.remove(id, tupleKeyOf(idx.fields, record, this.canonicalize));
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
/** Drop all index data. Called when the collection is invalidated. */
|
|
822
|
+
clear() {
|
|
823
|
+
for (const idx of this.indexes.values()) {
|
|
824
|
+
idx.buckets.clear();
|
|
825
|
+
}
|
|
826
|
+
for (const idx of this.sorted.values()) {
|
|
827
|
+
idx.clear();
|
|
828
|
+
}
|
|
829
|
+
for (const idx of this.compound.values()) {
|
|
830
|
+
idx.clear();
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Equality lookup: return the set of record ids whose `field` matches
|
|
835
|
+
* the given value. Returns `null` if no index covers the field — the
|
|
836
|
+
* caller should fall back to a linear scan.
|
|
837
|
+
*
|
|
838
|
+
* ⛔ ALSO `null` when the OPERAND has no bucket ADDRESS (#1402) — a
|
|
839
|
+
* nullish operand, or an object one, which every object-valued record in
|
|
840
|
+
* the collection shares. Answering those from the buckets returns rows
|
|
841
|
+
* the scan does not, silently, and only on the collections that happen to
|
|
842
|
+
* have an index. See `isProbeableBucketKey` for the two measurements.
|
|
843
|
+
*
|
|
844
|
+
* The returned Set is a reference to the index's internal storage —
|
|
845
|
+
* callers must NOT mutate it.
|
|
846
|
+
*/
|
|
847
|
+
lookupEqual(field, value) {
|
|
848
|
+
const idx = this.indexes.get(field);
|
|
849
|
+
if (!idx) return null;
|
|
850
|
+
if (!isProbeableBucketKey(value)) return null;
|
|
851
|
+
const key = stringifyKey(value);
|
|
852
|
+
return idx.buckets.get(key) ?? EMPTY_SET;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Set lookup: return the union of record ids whose `field` matches any
|
|
856
|
+
* of the given values. Returns `null` if no index covers the field.
|
|
857
|
+
*
|
|
858
|
+
* ⛔ ALSO `null` when ANY member of `values` has no bucket address
|
|
859
|
+
* (#1402) — one unaddressable member poisons the whole union, since the
|
|
860
|
+
* result is a union and there is no partial answer to hand back. Same
|
|
861
|
+
* measurement as {@link lookupEqual}.
|
|
862
|
+
*/
|
|
863
|
+
lookupIn(field, values) {
|
|
864
|
+
const idx = this.indexes.get(field);
|
|
865
|
+
if (!idx) return null;
|
|
866
|
+
if (!values.every(isProbeableBucketKey)) return null;
|
|
867
|
+
const out = /* @__PURE__ */ new Set();
|
|
868
|
+
for (const value of values) {
|
|
869
|
+
const key = stringifyKey(value);
|
|
870
|
+
const bucket = idx.buckets.get(key);
|
|
871
|
+
if (bucket) {
|
|
872
|
+
for (const id of bucket) out.add(id);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return out;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* One record id per NON-EMPTY bucket of `field`'s hash index, in bucket
|
|
879
|
+
* order — the index-backed spine of `Query.distinct()` (#1347). `null` when
|
|
880
|
+
* no hash index covers the field, so the caller scans instead.
|
|
881
|
+
*
|
|
882
|
+
* The bucket set IS the distinct key set, so this costs O(buckets) rather
|
|
883
|
+
* than O(records). It returns REPRESENTATIVE IDS rather than the keys
|
|
884
|
+
* themselves on purpose: a bucket key is a canonical string (money's
|
|
885
|
+
* BigInt-normalized scaled int, say), and `distinct()` owes its caller the
|
|
886
|
+
* field's real value, which only the record carries.
|
|
887
|
+
*
|
|
888
|
+
* Bucket insertion order is first-seen record order — `build()` walks the
|
|
889
|
+
* snapshot in order and `upsert()` appends — which is why an index-backed
|
|
890
|
+
* `distinct()` and a scanned one agree on ORDER too, not merely on the set.
|
|
891
|
+
* Empty buckets are skipped defensively; `removeFromIndex` already deletes
|
|
892
|
+
* them, so this is belt-and-braces against a future partial removal path.
|
|
893
|
+
*/
|
|
894
|
+
bucketRepresentatives(field) {
|
|
895
|
+
const idx = this.indexes.get(field);
|
|
896
|
+
if (!idx) return null;
|
|
897
|
+
const out = [];
|
|
898
|
+
for (const bucket of idx.buckets.values()) {
|
|
899
|
+
for (const id of bucket) {
|
|
900
|
+
out.push(id);
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
return out;
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
908
|
+
var EMPTY_KEYS = /* @__PURE__ */ new Set();
|
|
909
|
+
var stringifyKey = stringifyBucketKey;
|
|
910
|
+
function addToIndex(idx, id, record, canonicalize) {
|
|
911
|
+
const value = readPath(record, idx.field);
|
|
912
|
+
if (value === null || value === void 0) return;
|
|
913
|
+
const key = canonicalize?.(idx.field, value) ?? stringifyKey(value);
|
|
914
|
+
let bucket = idx.buckets.get(key);
|
|
915
|
+
if (!bucket) {
|
|
916
|
+
bucket = /* @__PURE__ */ new Set();
|
|
917
|
+
idx.buckets.set(key, bucket);
|
|
918
|
+
}
|
|
919
|
+
bucket.add(id);
|
|
920
|
+
}
|
|
921
|
+
function removeFromIndex(idx, id, record, canonicalize) {
|
|
922
|
+
const value = readPath(record, idx.field);
|
|
923
|
+
if (value === null || value === void 0) return;
|
|
924
|
+
const key = canonicalize?.(idx.field, value) ?? stringifyKey(value);
|
|
925
|
+
const bucket = idx.buckets.get(key);
|
|
926
|
+
if (!bucket) return;
|
|
927
|
+
bucket.delete(id);
|
|
928
|
+
if (bucket.size === 0) idx.buckets.delete(key);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
export {
|
|
932
|
+
parseFieldIndexSnapshot,
|
|
933
|
+
normalizeIndexDefs,
|
|
934
|
+
CollectionIndexes
|
|
935
|
+
};
|
|
936
|
+
//# sourceMappingURL=chunk-YSK2CU2Q.js.map
|