@delali/narsil 0.3.1-next.98 → 0.4.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/NOTICE +45 -0
- package/README.md +27 -8
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +101 -13
- package/dist/adapters/gcs.d.ts +49 -0
- package/dist/adapters/gcs.mjs +213 -0
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +2 -7
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/adapters/memory.mjs +5 -0
- package/dist/adapters/s3.d.ts +53 -0
- package/dist/adapters/s3.mjs +263 -0
- package/dist/{adapters-BQFQ4PRz.d.ts → adapters-pljAqmrC.d.ts} +33 -0
- package/dist/browser/chunk-4E5APHTM.mjs +1459 -0
- package/dist/browser/chunk-NDYADQ4Y.mjs +23426 -0
- package/dist/browser/chunk-QAOVAYAG.mjs +564 -0
- package/dist/browser/chunk-WC2DEXWU.mjs +29 -0
- package/dist/browser/chunk-YINZFPLT.mjs +1239 -0
- package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
- package/dist/browser/{chunk-Z7QH2XHB.mjs → core-leaf-HWAXCEWX.mjs} +3987 -2103
- package/dist/browser/custom-token-results-R5BIX7SL.mjs +59 -0
- package/dist/browser/digest-leaf-64IPRPZD.mjs +151 -0
- package/dist/browser/durability-config-75NSFCQN.mjs +97 -0
- package/dist/browser/embed-GG6PS3EA.mjs +264 -0
- package/dist/browser/geo-index-GNHY4PUB.mjs +1484 -0
- package/dist/browser/gzip-JF3S6PPT.mjs +31 -0
- package/dist/browser/module-ZZTNG5JZ.mjs +5762 -0
- package/dist/browser/msgpack-leaf-44XNWSSY.mjs +302 -0
- package/dist/browser/optional-reads-XMVPG6HG.mjs +3230 -0
- package/dist/browser/optional-writes-76DWMRQH.mjs +3603 -0
- package/dist/browser/phrase-module-6UGFVW5J.mjs +617 -0
- package/dist/browser/resolve-vector-text-XRR2OVHE.mjs +85 -0
- package/dist/browser/restore-queue-SG5O735W.mjs +196 -0
- package/dist/browser/{runtime-NYE5TB6O.mjs → runtime-OMKE7DF4.mjs} +83 -25
- package/dist/browser/segment-codec-leaf-A427QJUX.mjs +554 -0
- package/dist/browser/segment-merge-leaf-7BZ54JPI.mjs +1636 -0
- package/dist/browser/storage-leaf-5UTR5K7J.mjs +19829 -0
- package/dist/browser/store-leaf-3L33V35P.mjs +2070 -0
- package/dist/browser/suggestions-leaf-UBNDVKBD.mjs +1430 -0
- package/dist/browser/worker-copies-JXSGYR5X.mjs +2951 -0
- package/dist/{capabilities-BTTIs96E.d.ts → capabilities-DMte5K9_.d.ts} +162 -18
- package/dist/chunk-2AFZE7Y3.mjs +72 -0
- package/dist/chunk-2CKDCC65.mjs +47 -0
- package/dist/chunk-3ECIRFS5.mjs +61 -0
- package/dist/chunk-44W3CBNG.mjs +7 -0
- package/dist/chunk-4H4RG2FR.mjs +13 -0
- package/dist/chunk-4PY4JYMY.mjs +11 -0
- package/dist/chunk-4ZPVAHWF.mjs +1289 -0
- package/dist/chunk-5EI5CXO6.mjs +197 -0
- package/dist/chunk-5F5MXWS5.mjs +283 -0
- package/dist/{chunk-OHP7QR33.mjs → chunk-5FLRXF73.mjs} +25 -4
- package/dist/chunk-6FOENO4E.mjs +273 -0
- package/dist/chunk-6GHX35ZM.mjs +108 -0
- package/dist/chunk-6MSZ543Y.mjs +32 -0
- package/dist/chunk-6N6HHBCQ.mjs +4596 -0
- package/dist/{chunk-LXPIXDUJ.mjs → chunk-7P5YWDRQ.mjs} +403 -169
- package/dist/{chunk-TGP5M5R7.mjs → chunk-7T4LAYT4.mjs} +1 -1
- package/dist/{chunk-GGSH6KBQ.mjs → chunk-ASZLNVWW.mjs} +23 -3
- package/dist/chunk-AVBPB3MI.mjs +602 -0
- package/dist/{chunk-UCDF35PU.mjs → chunk-AVGUEEQ3.mjs} +494 -245
- package/dist/chunk-BUMREPLU.mjs +15 -0
- package/dist/chunk-BY6NALRK.mjs +31921 -0
- package/dist/chunk-C4ZMXXTL.mjs +92 -0
- package/dist/{chunk-2WYMG3OZ.mjs → chunk-C74KPRR7.mjs} +274 -19
- package/dist/{chunk-RSRVGAIQ.mjs → chunk-D456ZFPQ.mjs} +3 -2
- package/dist/chunk-DXZ6JDWG.mjs +797 -0
- package/dist/chunk-FJXJZUWF.mjs +209 -0
- package/dist/chunk-FS3HPPSC.mjs +212 -0
- package/dist/chunk-FT4KLZXW.mjs +1164 -0
- package/dist/chunk-GR5GMFJJ.mjs +104 -0
- package/dist/chunk-GXCDWLQI.mjs +193 -0
- package/dist/chunk-GXED6R3Q.mjs +271 -0
- package/dist/chunk-HLPRHOSO.mjs +17 -0
- package/dist/chunk-IL5DRCNU.mjs +3041 -0
- package/dist/{chunk-P36MUFEJ.mjs → chunk-JDDXV6UF.mjs} +2 -1
- package/dist/chunk-K5HSUPYS.mjs +11 -0
- package/dist/chunk-KYIRXTCA.mjs +100 -0
- package/dist/chunk-LFXS6OF7.mjs +289 -0
- package/dist/chunk-LNGE7SLY.mjs +151 -0
- package/dist/chunk-M2Z5WVWW.mjs +194 -0
- package/dist/{chunk-45AVKHMJ.mjs → chunk-M3B7SGJB.mjs} +63 -50
- package/dist/chunk-M3OW2XSP.mjs +40 -0
- package/dist/chunk-MFPSQZ6P.mjs +127 -0
- package/dist/chunk-MRCJBWJZ.mjs +1292 -0
- package/dist/chunk-MSIN4NM3.mjs +25 -0
- package/dist/chunk-MW3CJVGP.mjs +219 -0
- package/dist/chunk-MYM6CAVK.mjs +76 -0
- package/dist/chunk-NJJN4FMM.mjs +84 -0
- package/dist/chunk-NM7I3BM7.mjs +59 -0
- package/dist/chunk-OIJ64LGT.mjs +19 -0
- package/dist/{chunk-K7D4ZTSW.mjs → chunk-P4F4UWLC.mjs} +1 -1
- package/dist/chunk-Q2AP2FSN.mjs +15 -0
- package/dist/chunk-R2PJKSNL.mjs +54 -0
- package/dist/{chunk-HXJBSHXF.mjs → chunk-R724DJSG.mjs} +5056 -2619
- package/dist/chunk-S2POFTLN.mjs +10 -0
- package/dist/chunk-S5QMWECL.mjs +7 -0
- package/dist/chunk-SLAC5PAB.mjs +5008 -0
- package/dist/chunk-T4HMSZCX.mjs +5 -0
- package/dist/chunk-TACP6VK6.mjs +111 -0
- package/dist/chunk-TGPKS2UM.mjs +125 -0
- package/dist/chunk-TKKXPKEO.mjs +979 -0
- package/dist/chunk-V6EUBAIT.mjs +19 -0
- package/dist/chunk-XL56L4IR.mjs +228 -0
- package/dist/chunk-XQIAMDAG.mjs +3076 -0
- package/dist/chunk-YTUZ4R22.mjs +1063 -0
- package/dist/{chunk-KV3AZFT3.mjs → chunk-ZKOQR7EA.mjs} +45 -1
- package/dist/chunk-ZPJFGGGI.mjs +638 -0
- package/dist/chunk-ZXX5GZEX.mjs +17 -0
- package/dist/{client-i9eLJrw5.d.ts → client-BKqtl0_V.d.ts} +442 -22
- package/dist/client.d.ts +11 -10
- package/dist/client.mjs +8 -898
- package/dist/config-Bnl7L-0H.d.ts +608 -0
- package/dist/{config-P__Diiy4.d.ts → config-CJ-jfI0a.d.ts} +119 -9
- package/dist/core-leaf-6JVHEVFB.mjs +8 -0
- package/dist/custom-token-results-NXHBVY7U.mjs +59 -0
- package/dist/digest-leaf-KXBGKYHZ.mjs +1 -0
- package/dist/direct-executor-V3WOYU2Y.mjs +17 -0
- package/dist/distribution/coordinator/etcd.d.ts +63 -7
- package/dist/distribution/coordinator/etcd.mjs +725 -81
- package/dist/distribution/coordinator/in-memory.d.ts +3 -3
- package/dist/distribution/coordinator/in-memory.mjs +65 -10
- package/dist/distribution/transport/grpc.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +39 -10
- package/dist/distribution/transport/in-memory.d.ts +2 -2
- package/dist/distribution/transport/in-memory.mjs +9 -6
- package/dist/distribution/transport/tcp.d.ts +2 -2
- package/dist/distribution/transport/tcp.mjs +20 -15
- package/dist/distribution.d.ts +267 -56
- package/dist/distribution.mjs +23156 -11362
- package/dist/durability-config-VWS2K24E.mjs +96 -0
- package/dist/embed-4PHHKGBK.mjs +263 -0
- package/dist/embeddings/openai.d.ts +1 -1
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{memory-CUEDwr-F.d.ts → engine-qjAxJSKk.d.ts} +2254 -1123
- package/dist/geo-index-2ZMMWWSK.mjs +1484 -0
- package/dist/gzip-2UCZW2MM.mjs +31 -0
- package/dist/{index-lcdGLyJH.d.ts → index-B_vmxpgW.d.ts} +260 -102
- package/dist/index.browser.mjs +4 -4
- package/dist/index.d.ts +2133 -57
- package/dist/index.mjs +16 -32
- package/dist/index.react-native.mjs +12 -0
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/filesystem.mjs +1 -2
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/languages/albanian.mjs +1 -1
- package/dist/languages/amharic.mjs +1 -1
- package/dist/languages/arabic.mjs +1 -1
- package/dist/languages/armenian.mjs +1 -1
- package/dist/languages/azerbaijani.mjs +1 -1
- package/dist/languages/bambara.mjs +1 -1
- package/dist/languages/basque.mjs +1 -1
- package/dist/languages/belarusian.mjs +1 -1
- package/dist/languages/bengali.mjs +1 -1
- package/dist/languages/bosnian.mjs +1 -1
- package/dist/languages/breton.mjs +1 -1
- package/dist/languages/bulgarian.mjs +1 -1
- package/dist/languages/burmese.mjs +1 -1
- package/dist/languages/catalan.mjs +1 -1
- package/dist/languages/chinese.mjs +1 -1
- package/dist/languages/croatian.mjs +1 -1
- package/dist/languages/czech.mjs +1 -1
- package/dist/languages/dagbani.mjs +1 -1
- package/dist/languages/danish.mjs +1 -1
- package/dist/languages/dutch.mjs +1 -1
- package/dist/languages/english.mjs +1 -1
- package/dist/languages/esperanto.mjs +1 -1
- package/dist/languages/estonian.mjs +1 -1
- package/dist/languages/ewe.mjs +1 -1
- package/dist/languages/faroese.mjs +1 -1
- package/dist/languages/fijian.mjs +1 -1
- package/dist/languages/finnish.mjs +1 -1
- package/dist/languages/french.mjs +1 -1
- package/dist/languages/ga.mjs +1 -1
- package/dist/languages/galician.mjs +1 -1
- package/dist/languages/georgian.mjs +1 -1
- package/dist/languages/german.mjs +1 -1
- package/dist/languages/greek.mjs +1 -1
- package/dist/languages/guarani.mjs +1 -1
- package/dist/languages/gujarati.mjs +1 -1
- package/dist/languages/haitian-creole.mjs +1 -1
- package/dist/languages/hausa.mjs +1 -1
- package/dist/languages/hawaiian.mjs +1 -1
- package/dist/languages/hebrew.mjs +1 -1
- package/dist/languages/hindi.mjs +1 -1
- package/dist/languages/hungarian.mjs +1 -1
- package/dist/languages/icelandic.mjs +1 -1
- package/dist/languages/igbo.mjs +1 -1
- package/dist/languages/indonesian.mjs +1 -1
- package/dist/languages/irish.mjs +1 -1
- package/dist/languages/italian.mjs +1 -1
- package/dist/languages/japanese.mjs +1 -1
- package/dist/languages/kannada.mjs +1 -1
- package/dist/languages/kazakh.mjs +1 -1
- package/dist/languages/khmer.mjs +1 -1
- package/dist/languages/kinyarwanda.mjs +1 -1
- package/dist/languages/kirundi.mjs +1 -1
- package/dist/languages/korean.mjs +1 -1
- package/dist/languages/kurmanji.mjs +1 -1
- package/dist/languages/kyrgyz.mjs +1 -1
- package/dist/languages/lao.mjs +1 -1
- package/dist/languages/latin.mjs +1 -1
- package/dist/languages/latvian.mjs +1 -1
- package/dist/languages/lingala.mjs +1 -1
- package/dist/languages/lithuanian.mjs +1 -1
- package/dist/languages/luxembourgish.mjs +1 -1
- package/dist/languages/macedonian.mjs +1 -1
- package/dist/languages/malagasy.mjs +1 -1
- package/dist/languages/malay.mjs +1 -1
- package/dist/languages/malayalam.mjs +1 -1
- package/dist/languages/maltese.mjs +1 -1
- package/dist/languages/maori.mjs +1 -1
- package/dist/languages/marathi.mjs +1 -1
- package/dist/languages/nepali.mjs +1 -1
- package/dist/languages/norwegian.mjs +1 -1
- package/dist/languages/oromo.mjs +1 -1
- package/dist/languages/persian.mjs +1 -1
- package/dist/languages/polish.mjs +1 -1
- package/dist/languages/portuguese.mjs +1 -1
- package/dist/languages/punjabi.mjs +1 -1
- package/dist/languages/romanian.mjs +1 -1
- package/dist/languages/russian.mjs +1 -1
- package/dist/languages/samoan.mjs +1 -1
- package/dist/languages/sanskrit.mjs +1 -1
- package/dist/languages/scottish-gaelic.mjs +1 -1
- package/dist/languages/serbian.mjs +1 -1
- package/dist/languages/shona.mjs +1 -1
- package/dist/languages/sinhala.mjs +1 -1
- package/dist/languages/slovak.mjs +1 -1
- package/dist/languages/slovenian.mjs +1 -1
- package/dist/languages/sorani.mjs +1 -1
- package/dist/languages/spanish.mjs +1 -1
- package/dist/languages/swahili.mjs +1 -1
- package/dist/languages/swedish.mjs +1 -1
- package/dist/languages/tagalog.mjs +1 -1
- package/dist/languages/tamil.mjs +1 -1
- package/dist/languages/tatar.mjs +1 -1
- package/dist/languages/telugu.mjs +1 -1
- package/dist/languages/thai.mjs +1 -1
- package/dist/languages/tibetan.mjs +1 -1
- package/dist/languages/tigrinya.mjs +1 -1
- package/dist/languages/tongan.mjs +1 -1
- package/dist/languages/turkish.mjs +1 -1
- package/dist/languages/twi.mjs +1 -1
- package/dist/languages/ukrainian.mjs +1 -1
- package/dist/languages/urdu.mjs +1 -1
- package/dist/languages/vietnamese.mjs +1 -1
- package/dist/languages/welsh.mjs +1 -1
- package/dist/languages/wolof.mjs +1 -1
- package/dist/languages/xhosa.mjs +1 -1
- package/dist/languages/yoruba.mjs +1 -1
- package/dist/languages/zulu.mjs +1 -1
- package/dist/long-query-thread-UCRK7MSI.mjs +154 -0
- package/dist/module-5ZSLUQII.mjs +3729 -0
- package/dist/msgpack-leaf-H5ZYW7S7.mjs +9 -0
- package/dist/optional-reads-5HFMF2QZ.mjs +3373 -0
- package/dist/optional-writes-4UOQKETU.mjs +247 -0
- package/dist/paged-partition-archive-BBRLZCIF.mjs +253 -0
- package/dist/partial-words.browser.mjs +1650 -0
- package/dist/partial-words.mjs +17 -11
- package/dist/{chunk-ASY5PHYI.mjs → pattern.browser.mjs} +253 -311
- package/dist/pattern.mjs +6 -7
- package/dist/persistence/durability/checkpoint-worker.d.ts +93 -25
- package/dist/persistence/durability/checkpoint-worker.mjs +51 -41
- package/dist/phrase-module-EFESWOCR.mjs +635 -0
- package/dist/query-actions-HMJUVWGT.mjs +119 -0
- package/dist/query-suggestions/merge-worker.d.ts +55 -0
- package/dist/query-suggestions/merge-worker.mjs +53 -0
- package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
- package/dist/query-suggestions.browser.mjs +47 -0
- package/dist/query-suggestions.d.ts +20 -0
- package/dist/query-suggestions.mjs +19 -0
- package/dist/react-native/chunks/chunk-3OEFSHVV.mjs +970 -0
- package/dist/{browser/chunk-RELZRJNR.mjs → react-native/chunks/chunk-43R4GCM7.mjs} +49 -50
- package/dist/react-native/chunks/chunk-AKRYHAVG.mjs +6729 -0
- package/dist/react-native/chunks/chunk-CW2ZFXSE.mjs +14 -0
- package/dist/react-native/chunks/chunk-G3WCDTOF.mjs +29640 -0
- package/dist/react-native/chunks/chunk-GXXHHA2T.mjs +212 -0
- package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
- package/dist/react-native/chunks/chunk-HQEVQEDJ.mjs +52 -0
- package/dist/react-native/chunks/chunk-HRDMIQ63.mjs +131 -0
- package/dist/react-native/chunks/chunk-HTBY4GON.mjs +565 -0
- package/dist/react-native/chunks/chunk-LX62Y4B5.mjs +61 -0
- package/dist/react-native/chunks/chunk-MRH36RN3.mjs +902 -0
- package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
- package/dist/react-native/chunks/chunk-UE4ANHSX.mjs +127 -0
- package/dist/react-native/chunks/chunk-UNZPWLVL.mjs +1063 -0
- package/dist/react-native/chunks/chunk-UO44MA5M.mjs +232 -0
- package/dist/react-native/chunks/chunk-UYKIV2KT.mjs +42 -0
- package/dist/react-native/chunks/chunk-VUJCSQG5.mjs +11 -0
- package/dist/react-native/chunks/chunk-WVHF4ZAK.mjs +802 -0
- package/dist/react-native/chunks/chunk-ZUJCUPVS.mjs +54 -0
- package/dist/react-native/chunks/core-leaf-S2KNBWDY.mjs +7 -0
- package/dist/react-native/chunks/custom-token-results-3OZEMRE7.mjs +59 -0
- package/dist/react-native/chunks/digest-leaf-X6OIFDIU.mjs +1 -0
- package/dist/react-native/chunks/durability-config-FCSD4MXY.mjs +96 -0
- package/dist/react-native/chunks/embed-HA2I7RCF.mjs +263 -0
- package/dist/react-native/chunks/geo-index-QEYKEVPH.mjs +1484 -0
- package/dist/react-native/chunks/gzip.react-native-CVM4NQG2.mjs +12 -0
- package/dist/react-native/chunks/module-FMBX75GP.mjs +5209 -0
- package/dist/react-native/chunks/msgpack-leaf-JMNGSTRW.mjs +7 -0
- package/dist/react-native/chunks/optional-reads-AFPO2FEB.mjs +3364 -0
- package/dist/react-native/chunks/optional-writes-XOH25XZI.mjs +296 -0
- package/dist/react-native/chunks/phrase-module-IGYBK7XH.mjs +636 -0
- package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
- package/dist/react-native/chunks/resolve-vector-text-GE2CRJKI.mjs +84 -0
- package/dist/react-native/chunks/restore-queue-LLNMYB4Z.mjs +187 -0
- package/dist/react-native/chunks/runtime-UOHD2XUJ.mjs +615 -0
- package/dist/react-native/chunks/segment-codec-leaf-VR6O5GLC.mjs +13 -0
- package/dist/react-native/chunks/segment-merge-leaf-LLMWU4EW.mjs +14 -0
- package/dist/react-native/chunks/storage-leaf-JD7PIDO4.mjs +19633 -0
- package/dist/react-native/chunks/store-leaf-4UVCMYGN.mjs +15 -0
- package/dist/react-native/chunks/suggestions-leaf-J5VT5RHY.mjs +1321 -0
- package/dist/react-native/chunks/worker-copies-ZYHY7FKJ.mjs +2831 -0
- package/dist/react-native/partial-words.mjs +1658 -0
- package/dist/react-native/pattern.mjs +2570 -0
- package/dist/react-native/query-suggestions.mjs +55 -0
- package/dist/react-native/sync.mjs +2759 -0
- package/dist/react-native/synonyms.mjs +676 -0
- package/dist/react.d.ts +12 -8
- package/dist/react.mjs +45 -1
- package/dist/{rerank-NWTKK636.mjs → rerank-RI2PMNOD.mjs} +22 -12
- package/dist/rerankers/http.d.ts +1 -1
- package/dist/rerankers/http.mjs +2 -2
- package/dist/resolve-vector-text-OD4J3WHF.mjs +3 -0
- package/dist/restore-queue-PCKWDAKQ.mjs +192 -0
- package/dist/runtime-USQYKN3I.mjs +615 -0
- package/dist/{schema-4W_7tk1f.d.ts → schema-CzG9OUw5.d.ts} +70 -30
- package/dist/segment-codec-leaf-QJM7I6QG.mjs +18 -0
- package/dist/segment-merge-leaf-4BJGIJHY.mjs +18 -0
- package/dist/server.d.ts +348 -22
- package/dist/server.mjs +2211 -327
- package/dist/storage-leaf-GRRRI7UV.mjs +5962 -0
- package/dist/store-leaf-6VMMSVBE.mjs +20 -0
- package/dist/stored-values-BWIMpiT_.d.ts +25 -0
- package/dist/suggestions-leaf-4KPTMPTL.mjs +54 -0
- package/dist/sync/filesystem.d.ts +30 -0
- package/dist/sync/filesystem.mjs +288 -0
- package/dist/sync/indexeddb.browser.mjs +287 -0
- package/dist/sync/indexeddb.d.ts +30 -0
- package/dist/sync/indexeddb.mjs +242 -0
- package/dist/sync.browser.mjs +1271 -0
- package/dist/sync.d.ts +23 -0
- package/dist/sync.mjs +2712 -0
- package/dist/synonyms.browser.mjs +658 -0
- package/dist/synonyms.mjs +17 -7
- package/dist/tasks-65b6t6lk.d.ts +782 -0
- package/dist/thread-UJ3W5LVI.mjs +31 -0
- package/dist/{types-B3b68nfF.d.ts → types-Ck97nB3D.d.ts} +1 -1
- package/dist/types-CpCg-Gq-.d.ts +227 -0
- package/dist/{types-Cb9kiY5P.d.ts → types-DvncmvuQ.d.ts} +12 -1
- package/dist/vector/search-worker.d.ts +10 -2
- package/dist/vector/search-worker.mjs +11 -11
- package/dist/worker-copies-YSXZXIGC.mjs +2232 -0
- package/dist/workers/entry.mjs +75 -15
- package/openapi.json +6840 -0
- package/package.json +406 -19
- package/dist/browser/chunk-CN4I4FZU.mjs +0 -602
- package/dist/browser/chunk-HOZW3PKP.mjs +0 -9
- package/dist/browser/chunk-JPTQZWJQ.mjs +0 -10
- package/dist/browser/chunk-LD55ZGU3.mjs +0 -347
- package/dist/browser/chunk-NAFT3K6X.mjs +0 -24546
- package/dist/browser/chunk-NNG3EEB6.mjs +0 -2728
- package/dist/browser/chunk-QWES44AW.mjs +0 -473
- package/dist/browser/durability-wiring-PY3L7DES.mjs +0 -3679
- package/dist/browser/module-PDXYHT75.mjs +0 -2822
- package/dist/browser/release-76MXRPGV.mjs +0 -33
- package/dist/browser/restore-queue-DVIYJ7RU.mjs +0 -35
- package/dist/browser/snapshot-J57MZK6L.mjs +0 -1207
- package/dist/browser/write-L7FAQA47.mjs +0 -208
- package/dist/chunk-37CD3OKS.mjs +0 -87
- package/dist/chunk-5XNIRLFC.mjs +0 -96
- package/dist/chunk-7X5JST5L.mjs +0 -114
- package/dist/chunk-AV4IJKD2.mjs +0 -35
- package/dist/chunk-AY3AQ3UH.mjs +0 -73
- package/dist/chunk-BKB3XTMI.mjs +0 -707
- package/dist/chunk-C7SLA6CM.mjs +0 -19
- package/dist/chunk-COVCQ73F.mjs +0 -587
- package/dist/chunk-DJHHF2L5.mjs +0 -17
- package/dist/chunk-E74YLAIG.mjs +0 -24
- package/dist/chunk-FMWRCP2C.mjs +0 -57
- package/dist/chunk-GES7U2PM.mjs +0 -68
- package/dist/chunk-HJSN7UYG.mjs +0 -10
- package/dist/chunk-JFRNNBOM.mjs +0 -35
- package/dist/chunk-K25LZA54.mjs +0 -8484
- package/dist/chunk-KEHK2O6P.mjs +0 -13
- package/dist/chunk-KOKM4PQN.mjs +0 -52
- package/dist/chunk-KZ3NX2P7.mjs +0 -21
- package/dist/chunk-L3L5YFXC.mjs +0 -614
- package/dist/chunk-L5ORED7V.mjs +0 -25
- package/dist/chunk-LH4NZNJJ.mjs +0 -1731
- package/dist/chunk-LU2CE5AE.mjs +0 -507
- package/dist/chunk-LXWDQLTW.mjs +0 -30
- package/dist/chunk-MHOSCQCQ.mjs +0 -948
- package/dist/chunk-NKRBEGJZ.mjs +0 -1705
- package/dist/chunk-NTRMFARG.mjs +0 -462
- package/dist/chunk-NW4XDSP2.mjs +0 -212
- package/dist/chunk-OOEXLUGR.mjs +0 -117
- package/dist/chunk-ORBLD3EL.mjs +0 -6
- package/dist/chunk-OWNZYMRE.mjs +0 -3591
- package/dist/chunk-PPY2GSIB.mjs +0 -44
- package/dist/chunk-QY7GC2MW.mjs +0 -33
- package/dist/chunk-R6A773WK.mjs +0 -226
- package/dist/chunk-R6PR4WYZ.mjs +0 -68
- package/dist/chunk-R7EEKAJE.mjs +0 -593
- package/dist/chunk-RONEOEON.mjs +0 -426
- package/dist/chunk-VWULPWRJ.mjs +0 -7469
- package/dist/chunk-WCJKUGHB.mjs +0 -262
- package/dist/chunk-WQBCBKY3.mjs +0 -8
- package/dist/chunk-X5CV2E2B.mjs +0 -1
- package/dist/chunk-YA7XLE2R.mjs +0 -1256
- package/dist/chunk-YTJCGKM4.mjs +0 -56
- package/dist/chunk-ZG477IPV.mjs +0 -526
- package/dist/chunk-ZYNAMIYX.mjs +0 -113
- package/dist/config-BGB_fDtq.d.ts +0 -237
- package/dist/direct-executor-CXZ66ACP.mjs +0 -22
- package/dist/durability-wiring-QTHOGFMZ.mjs +0 -3229
- package/dist/engine-BGCEm9E_.d.ts +0 -577
- package/dist/module-3NONKBZX.mjs +0 -1860
- package/dist/release-BH3DKW3T.mjs +0 -33
- package/dist/restore-queue-JPRBUYII.mjs +0 -35
- package/dist/runtime-ZKYZFJJC.mjs +0 -177
- package/dist/snapshot-HOGXNO5W.mjs +0 -793
- package/dist/tasks-HG3rlxx6.d.ts +0 -302
- package/dist/thread-B657LQXK.mjs +0 -692
- package/dist/write-XLIGTXBU.mjs +0 -238
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
export { applyStoredIndexBm25, updateIndexBm25 } from './chunk-NM7I3BM7.mjs';
|
|
2
|
+
import { readHeapStatistics, loadSchemaCodeFor, loadStorageCode, lookupOfStoredSynonyms, reconstructSchemaFromMetadata, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, prepareStoredSynonyms, getVectorFieldPaths, arrayPositionsAreStale, validatePartitionConfig, validateEmbeddingConfig } from './chunk-BY6NALRK.mjs';
|
|
3
|
+
export { bindOptionalWritesHost, holdVectorsForRollback, insertDocument, insertDocumentBatch, prepareDocumentWrite, removeDocument, removeDocumentBatch, rollbackInsertedDocument, rollbackRemovedDocument, rollbackUpdatedDocument, updateDocument, updateDocumentBatch } from './chunk-BY6NALRK.mjs';
|
|
4
|
+
import './chunk-2CKDCC65.mjs';
|
|
5
|
+
import './chunk-2AFZE7Y3.mjs';
|
|
6
|
+
import './chunk-GXCDWLQI.mjs';
|
|
7
|
+
import { isSyncEpoch, newSyncEpoch } from './chunk-BUMREPLU.mjs';
|
|
8
|
+
import './chunk-7T4LAYT4.mjs';
|
|
9
|
+
import './chunk-IL5DRCNU.mjs';
|
|
10
|
+
import { validateSchema, validateVectorStorage, validateTextStorage } from './chunk-7P5YWDRQ.mjs';
|
|
11
|
+
import './chunk-U2BKYEC7.mjs';
|
|
12
|
+
import './chunk-FJXJZUWF.mjs';
|
|
13
|
+
import './chunk-5EI5CXO6.mjs';
|
|
14
|
+
import './chunk-3ECIRFS5.mjs';
|
|
15
|
+
import './chunk-ASZLNVWW.mjs';
|
|
16
|
+
import './chunk-ZXX5GZEX.mjs';
|
|
17
|
+
import './chunk-4PY4JYMY.mjs';
|
|
18
|
+
import { NarsilError, ErrorCodes } from './chunk-ZKOQR7EA.mjs';
|
|
19
|
+
import './chunk-TGPKS2UM.mjs';
|
|
20
|
+
|
|
21
|
+
// src/runtime/process-memory.ts
|
|
22
|
+
function readProcessMemory() {
|
|
23
|
+
const proc = globalThis.process;
|
|
24
|
+
if (!proc || typeof proc.memoryUsage !== "function") {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const usage = proc.memoryUsage();
|
|
29
|
+
const heap = readHeapStatistics();
|
|
30
|
+
if (!Number.isFinite(usage.heapUsed) || !Number.isFinite(usage.heapTotal) || !Number.isFinite(usage.external) || !Number.isFinite(usage.rss)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
heapUsed: usage.heapUsed,
|
|
35
|
+
heapTotal: usage.heapTotal,
|
|
36
|
+
heapLimit: heap === null ? null : heap.configuredLimitBytes ?? heap.limitBytes,
|
|
37
|
+
external: usage.external,
|
|
38
|
+
rss: usage.rss
|
|
39
|
+
};
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/engine/sync-state.ts
|
|
46
|
+
function epochStatesOfMetadata(metadata) {
|
|
47
|
+
const syncOn = metadata.sync?.enabled === true;
|
|
48
|
+
const changesOn = metadata.changes?.enabled === true;
|
|
49
|
+
if (!syncOn && !changesOn) return { sync: null, changes: null };
|
|
50
|
+
const stored = isSyncEpoch(metadata.syncEpoch) ? metadata.syncEpoch : null;
|
|
51
|
+
const epoch = stored ?? newSyncEpoch();
|
|
52
|
+
const sync = metadata.sync;
|
|
53
|
+
const changes = metadata.changes;
|
|
54
|
+
return {
|
|
55
|
+
sync: syncOn && sync !== void 0 ? {
|
|
56
|
+
...sync.historyMaxAgeMs !== void 0 ? { historyMaxAgeMs: sync.historyMaxAgeMs } : {},
|
|
57
|
+
...sync.historyMaxBytes !== void 0 ? { historyMaxBytes: sync.historyMaxBytes } : {},
|
|
58
|
+
active: stored !== null && metadata.syncActive === true,
|
|
59
|
+
epoch
|
|
60
|
+
} : null,
|
|
61
|
+
changes: changesOn && changes !== void 0 ? {
|
|
62
|
+
previousDocument: changes.previousDocument === true,
|
|
63
|
+
...changes.historyMaxAgeMs !== void 0 ? { historyMaxAgeMs: changes.historyMaxAgeMs } : {},
|
|
64
|
+
...changes.historyMaxBytes !== void 0 ? { historyMaxBytes: changes.historyMaxBytes } : {},
|
|
65
|
+
epoch
|
|
66
|
+
} : null
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/engine/index-from-metadata.ts
|
|
71
|
+
function isRecoveryConfigError(err) {
|
|
72
|
+
return err instanceof NarsilError && (err.code === ErrorCodes.CONFIG_INVALID || err.code === ErrorCodes.SCHEMA_INVALID_TYPE || err.code === ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION);
|
|
73
|
+
}
|
|
74
|
+
function resolveEmbeddingAdapter(deps, metadata, schema) {
|
|
75
|
+
const name = metadata.embedding?.adapter ?? null;
|
|
76
|
+
if (!metadata.embedding) return { adapter: null, name };
|
|
77
|
+
const candidate = name !== null ? deps.embeddingAdapters.get(name) ?? null : deps.config?.embedding ?? null;
|
|
78
|
+
if (!candidate) return { adapter: null, name };
|
|
79
|
+
try {
|
|
80
|
+
validateEmbeddingConfig({ fields: metadata.embedding.fields, adapter: candidate }, schema, void 0);
|
|
81
|
+
} catch (err) {
|
|
82
|
+
if (err instanceof NarsilError) {
|
|
83
|
+
throw new NarsilError(err.code, `Recovery of index "${metadata.indexName}" failed: ${err.message}`, {
|
|
84
|
+
indexName: metadata.indexName,
|
|
85
|
+
adapter: name ?? void 0
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
return { adapter: candidate, name };
|
|
91
|
+
}
|
|
92
|
+
function recoveryFailure(metadata, err) {
|
|
93
|
+
if (!isRecoveryConfigError(err)) return err;
|
|
94
|
+
return new NarsilError(err.code, `Recovery of index "${metadata.indexName}" failed: ${err.message}`, {
|
|
95
|
+
...err.details,
|
|
96
|
+
indexName: metadata.indexName,
|
|
97
|
+
tokenizer: metadata.tokenizer,
|
|
98
|
+
stopWords: metadata.stopWords
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
async function savedPartitionCountOf(metadata) {
|
|
102
|
+
const count = metadata.partitionCount;
|
|
103
|
+
if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 1) {
|
|
104
|
+
const held = typeof count === "number" ? String(count) : `a ${typeof count} as its count of`;
|
|
105
|
+
throw new NarsilError(
|
|
106
|
+
ErrorCodes.PERSISTENCE_LOAD_FAILED,
|
|
107
|
+
`Recovery of index "${metadata.indexName}" failed: its metadata holds ${held} partitions, and an index holds a whole number above zero`,
|
|
108
|
+
{ indexName: metadata.indexName, partitionCount: typeof count === "number" ? count : typeof count }
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
const { requireSavedPartitionCount } = await loadStorageCode();
|
|
112
|
+
requireSavedPartitionCount(count, "metadata", metadata.indexName);
|
|
113
|
+
return count;
|
|
114
|
+
}
|
|
115
|
+
async function createIndexFromMetadata(deps, metadata, loadData) {
|
|
116
|
+
const loadingSchemaCode = loadSchemaCodeFor(
|
|
117
|
+
loadData ? metadata.schema : null,
|
|
118
|
+
metadata.tokenizer,
|
|
119
|
+
metadata.pendingAnalysis?.tokenizer
|
|
120
|
+
);
|
|
121
|
+
if (loadingSchemaCode !== null) await loadingSchemaCode;
|
|
122
|
+
const existing = deps.indexRegistry.get(metadata.indexName);
|
|
123
|
+
if (existing !== void 0) {
|
|
124
|
+
if ((metadata.analysisGeneration ?? 0) > existing.analysisGeneration) {
|
|
125
|
+
const { adoptSavedAnalysis } = await loadStorageCode();
|
|
126
|
+
adoptSavedAnalysis(deps.executor.getManager(metadata.indexName), existing, metadata);
|
|
127
|
+
}
|
|
128
|
+
if (loadData && deps.executor.getManager(metadata.indexName) === void 0) {
|
|
129
|
+
const partitionCount2 = await savedPartitionCountOf(metadata);
|
|
130
|
+
deps.executor.createIndex(
|
|
131
|
+
metadata.indexName,
|
|
132
|
+
existing.config,
|
|
133
|
+
existing.language,
|
|
134
|
+
false,
|
|
135
|
+
lookupOfStoredSynonyms(existing.synonyms, existing.config, existing.language),
|
|
136
|
+
partitionCount2
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const indexConfig = reconstructSchemaFromMetadata(metadata);
|
|
142
|
+
const language = getLanguage(indexConfig.language ?? "english");
|
|
143
|
+
try {
|
|
144
|
+
indexConfig.schema = validateSchema(indexConfig.schema);
|
|
145
|
+
validatePatternValueLimit(indexConfig.patternValueLimit);
|
|
146
|
+
requireSurfaceFormsForPartialFields(indexConfig.schema, indexConfig.surfaceForms);
|
|
147
|
+
} catch (err) {
|
|
148
|
+
throw recoveryFailure(metadata, err);
|
|
149
|
+
}
|
|
150
|
+
const partitionCount = await savedPartitionCountOf(metadata);
|
|
151
|
+
const embedding = resolveEmbeddingAdapter(deps, metadata, indexConfig.schema);
|
|
152
|
+
const prepared = prepareStoredSynonyms(
|
|
153
|
+
metadata.synonyms,
|
|
154
|
+
indexConfig,
|
|
155
|
+
language,
|
|
156
|
+
"The synonym set in the index metadata is invalid: "
|
|
157
|
+
);
|
|
158
|
+
const synonyms = prepared?.encoded ?? null;
|
|
159
|
+
try {
|
|
160
|
+
validateVectorStorage(indexConfig.vectorPromotion, deps.filesystemDurability);
|
|
161
|
+
validateTextStorage(indexConfig.textStorage, deps.filesystemDurability);
|
|
162
|
+
if (loadData) {
|
|
163
|
+
deps.executor.createIndex(
|
|
164
|
+
metadata.indexName,
|
|
165
|
+
indexConfig,
|
|
166
|
+
language,
|
|
167
|
+
false,
|
|
168
|
+
prepared?.lookup ?? null,
|
|
169
|
+
partitionCount
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
} catch (err) {
|
|
173
|
+
throw recoveryFailure(metadata, err);
|
|
174
|
+
}
|
|
175
|
+
deps.indexRegistry.set(metadata.indexName, {
|
|
176
|
+
storedSizes: deps.indexRegistry.get(metadata.indexName)?.storedSizes,
|
|
177
|
+
config: indexConfig,
|
|
178
|
+
language,
|
|
179
|
+
embeddingAdapter: embedding.adapter,
|
|
180
|
+
embeddingAdapterName: embedding.name,
|
|
181
|
+
vectorFieldPaths: getVectorFieldPaths(indexConfig.schema),
|
|
182
|
+
indexUuid: metadata.indexUuid ?? null,
|
|
183
|
+
heldPartitions: metadata.heldPartitions ?? null,
|
|
184
|
+
documentCount: metadata.documentCount ?? 0,
|
|
185
|
+
savedBytes: metadata.savedBytes,
|
|
186
|
+
partitionCount,
|
|
187
|
+
analysisRevision: metadata.analysisRevision ?? null,
|
|
188
|
+
arrayPositionGap: metadata.arrayPositionGap ?? null,
|
|
189
|
+
synonyms,
|
|
190
|
+
analysisGeneration: metadata.analysisGeneration ?? 0,
|
|
191
|
+
pendingAnalysis: metadata.pendingAnalysis ?? null,
|
|
192
|
+
durableAnalysis: null,
|
|
193
|
+
...epochStatesOfMetadata(metadata),
|
|
194
|
+
querySuggestions: metadata.querySuggestions ?? null
|
|
195
|
+
});
|
|
196
|
+
if (loadData) await deps.indexState().registerOpen(metadata.indexName);
|
|
197
|
+
else deps.indexState().registerClosed(metadata.indexName);
|
|
198
|
+
if (metadata.analysisRevision !== language.revision || arrayPositionsAreStale(indexConfig, metadata.arrayPositionGap ?? null)) {
|
|
199
|
+
deps.analysisRebuild().markStale({
|
|
200
|
+
indexName: metadata.indexName,
|
|
201
|
+
language: language.name,
|
|
202
|
+
storedRevision: metadata.analysisRevision ?? null,
|
|
203
|
+
currentRevision: language.revision
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/engine/partition-config.ts
|
|
209
|
+
async function updateEnginePartitionConfig(core, indexName, partitionConfig) {
|
|
210
|
+
const entry = core.requireIndex(indexName);
|
|
211
|
+
const manager = core.requireManager(indexName);
|
|
212
|
+
if (core.rebalancingIndexes.has(indexName)) {
|
|
213
|
+
throw new NarsilError(
|
|
214
|
+
ErrorCodes.PARTITION_REBALANCING_BACKPRESSURE,
|
|
215
|
+
`Index "${indexName}" is currently being rebalanced`
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
validatePartitionConfig(partitionConfig);
|
|
219
|
+
if (partitionConfig.maxPartitions !== void 0 && partitionConfig.maxPartitions < manager.partitionCount) {
|
|
220
|
+
throw new NarsilError(
|
|
221
|
+
ErrorCodes.PARTITION_CAPACITY_EXCEEDED,
|
|
222
|
+
`maxPartitions (${partitionConfig.maxPartitions}) is less than the current partition count (${manager.partitionCount})`,
|
|
223
|
+
{ maxPartitions: partitionConfig.maxPartitions, partitionCount: manager.partitionCount }
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
const currentDocCount = manager.countDocuments();
|
|
227
|
+
const newMaxDocs = partitionConfig.maxDocsPerPartition ?? entry.config.partitions?.maxDocsPerPartition;
|
|
228
|
+
if (newMaxDocs !== void 0) {
|
|
229
|
+
const newTotalCapacity = newMaxDocs * manager.partitionCount;
|
|
230
|
+
if (newTotalCapacity < currentDocCount) {
|
|
231
|
+
throw new NarsilError(
|
|
232
|
+
ErrorCodes.PARTITION_CAPACITY_EXCEEDED,
|
|
233
|
+
`New capacity (${newTotalCapacity}) is less than current document count (${currentDocCount})`,
|
|
234
|
+
{ newTotalCapacity, currentDocCount }
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (!entry.config.partitions) entry.config.partitions = {};
|
|
239
|
+
if (partitionConfig.maxDocsPerPartition !== void 0)
|
|
240
|
+
entry.config.partitions.maxDocsPerPartition = partitionConfig.maxDocsPerPartition;
|
|
241
|
+
if (partitionConfig.maxPartitions !== void 0) entry.config.partitions.maxPartitions = partitionConfig.maxPartitions;
|
|
242
|
+
if (partitionConfig.watermark !== void 0) entry.config.partitions.watermark = partitionConfig.watermark;
|
|
243
|
+
if (core.durability) await core.durability.manager.persistMetadata(indexName);
|
|
244
|
+
core.watermarkNotifier.check(indexName);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export { createIndexFromMetadata, readProcessMemory, updateEnginePartitionConfig };
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { resolvePartitionId } from './chunk-KYIRXTCA.mjs';
|
|
2
|
+
import { readVectorFile, VECTOR_FILE_ENVELOPE_VERSION } from './chunk-FT4KLZXW.mjs';
|
|
3
|
+
import './chunk-C74KPRR7.mjs';
|
|
4
|
+
import './chunk-M2Z5WVWW.mjs';
|
|
5
|
+
import { encodeSegmentManifest, loadFailed, directoryCheckpointStore, decodeSections, SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES } from './chunk-DXZ6JDWG.mjs';
|
|
6
|
+
import { PARTITION_COPY_VECTOR_RUN_BYTES } from './chunk-JDDXV6UF.mjs';
|
|
7
|
+
import { segmentsPrefix, vectorFileKey } from './chunk-C4ZMXXTL.mjs';
|
|
8
|
+
import './chunk-S5QMWECL.mjs';
|
|
9
|
+
import './chunk-LNGE7SLY.mjs';
|
|
10
|
+
import './chunk-R2PJKSNL.mjs';
|
|
11
|
+
import './chunk-MFPSQZ6P.mjs';
|
|
12
|
+
import './chunk-FS3HPPSC.mjs';
|
|
13
|
+
import { vectorsPerFile, isDead, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-R724DJSG.mjs';
|
|
14
|
+
import './chunk-V6EUBAIT.mjs';
|
|
15
|
+
import { HEADER_SIZE, crc32Init, crc32Final, engineVersionParts, writeHeader, RESERVED_SIZE, crc32Update } from './chunk-TKKXPKEO.mjs';
|
|
16
|
+
import { generateId, isCompositePartition } from './chunk-BY6NALRK.mjs';
|
|
17
|
+
import './chunk-2CKDCC65.mjs';
|
|
18
|
+
import './chunk-2AFZE7Y3.mjs';
|
|
19
|
+
import { decode } from './chunk-GXCDWLQI.mjs';
|
|
20
|
+
import './chunk-BUMREPLU.mjs';
|
|
21
|
+
import './chunk-7T4LAYT4.mjs';
|
|
22
|
+
import './chunk-IL5DRCNU.mjs';
|
|
23
|
+
import { parseVectorDimension } from './chunk-7P5YWDRQ.mjs';
|
|
24
|
+
import './chunk-U2BKYEC7.mjs';
|
|
25
|
+
import './chunk-FJXJZUWF.mjs';
|
|
26
|
+
import './chunk-5EI5CXO6.mjs';
|
|
27
|
+
import './chunk-3ECIRFS5.mjs';
|
|
28
|
+
import './chunk-ASZLNVWW.mjs';
|
|
29
|
+
import './chunk-ZXX5GZEX.mjs';
|
|
30
|
+
import './chunk-4PY4JYMY.mjs';
|
|
31
|
+
import './chunk-ZKOQR7EA.mjs';
|
|
32
|
+
import './chunk-TGPKS2UM.mjs';
|
|
33
|
+
import { encode } from '@msgpack/msgpack';
|
|
34
|
+
|
|
35
|
+
var FLOAT32_BYTES = 4;
|
|
36
|
+
var BIN8 = 196;
|
|
37
|
+
var BIN16 = 197;
|
|
38
|
+
var BIN32 = 198;
|
|
39
|
+
var UINT8_MAX = 255;
|
|
40
|
+
var UINT16_MAX = 65535;
|
|
41
|
+
var FIXMAP_OF_SIX = 134;
|
|
42
|
+
var VECTOR_FILE_PAGE_SIZES = /* @__PURE__ */ new Set([SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES]);
|
|
43
|
+
function binHeader(length) {
|
|
44
|
+
if (length <= UINT8_MAX) return Uint8Array.of(BIN8, length);
|
|
45
|
+
if (length <= UINT16_MAX) return Uint8Array.of(BIN16, length >> 8, length & 255);
|
|
46
|
+
const header = new Uint8Array(5);
|
|
47
|
+
header[0] = BIN32;
|
|
48
|
+
new DataView(header.buffer).setUint32(1, length, false);
|
|
49
|
+
return header;
|
|
50
|
+
}
|
|
51
|
+
async function docIdsOf(checkpoint, directory, ref, fieldPath) {
|
|
52
|
+
const { headOffset, headLength } = ref;
|
|
53
|
+
if (headOffset === void 0 || headLength === void 0) {
|
|
54
|
+
const { payload } = await readVectorFile(directoryCheckpointStore(directory), ref, fieldPath);
|
|
55
|
+
return payload.docIds;
|
|
56
|
+
}
|
|
57
|
+
const head = await checkpoint.readRange(ref, HEADER_SIZE + headOffset, headLength);
|
|
58
|
+
const raw = decode(head);
|
|
59
|
+
const sections = decodeSections(raw.sections, ref.bytes - HEADER_SIZE, `head of "${ref.key}"`, VECTOR_FILE_PAGE_SIZES);
|
|
60
|
+
const section = sections.find((candidate) => candidate.name === "docIds");
|
|
61
|
+
if (section === void 0) loadFailed(`The head of "${ref.key}" lists no section "docIds"`);
|
|
62
|
+
const docIds = decode(await checkpoint.readRange(ref, HEADER_SIZE + section.offset, section.length));
|
|
63
|
+
if (!Array.isArray(docIds) || docIds.length !== ref.count) {
|
|
64
|
+
loadFailed(`The vector file "${ref.key}" lists the wrong number of IDs`);
|
|
65
|
+
}
|
|
66
|
+
return docIds;
|
|
67
|
+
}
|
|
68
|
+
async function writePartitionVectorFile(checkpoint, directory, target, slots) {
|
|
69
|
+
const { dimension, fieldPath, temporaryKey } = target;
|
|
70
|
+
const width = dimension * FLOAT32_BYTES;
|
|
71
|
+
const handle = await directory.appendHandle(temporaryKey);
|
|
72
|
+
let state = crc32Init();
|
|
73
|
+
let payloadLength = 0;
|
|
74
|
+
async function appendPayload(bytes) {
|
|
75
|
+
state = crc32Update(state, bytes);
|
|
76
|
+
payloadLength += bytes.byteLength;
|
|
77
|
+
await handle.append(bytes);
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
await handle.append(new Uint8Array(HEADER_SIZE));
|
|
81
|
+
await appendPayload(Uint8Array.of(FIXMAP_OF_SIX));
|
|
82
|
+
for (const [key, value] of [
|
|
83
|
+
["v", VECTOR_FILE_PAYLOAD_VERSION],
|
|
84
|
+
["fieldName", fieldPath],
|
|
85
|
+
["dimension", dimension],
|
|
86
|
+
["docIds", slots.map((slot) => slot.docId)],
|
|
87
|
+
["codes", null]
|
|
88
|
+
]) {
|
|
89
|
+
await appendPayload(encode(key));
|
|
90
|
+
await appendPayload(encode(value));
|
|
91
|
+
}
|
|
92
|
+
await appendPayload(encode("vectors"));
|
|
93
|
+
await appendPayload(binHeader(slots.length * width));
|
|
94
|
+
let at = 0;
|
|
95
|
+
while (at < slots.length) {
|
|
96
|
+
const first = slots[at];
|
|
97
|
+
let end = at + 1;
|
|
98
|
+
const limit = Math.max(1, Math.floor(PARTITION_COPY_VECTOR_RUN_BYTES / width));
|
|
99
|
+
while (end < slots.length && end - at < limit && slots[end].ref === first.ref && slots[end].position === first.position + (end - at)) {
|
|
100
|
+
end += 1;
|
|
101
|
+
}
|
|
102
|
+
const offset = first.ref.bytes - (first.ref.count - first.position) * width;
|
|
103
|
+
await appendPayload(await checkpoint.readRange(first.ref, offset, (end - at) * width));
|
|
104
|
+
at = end;
|
|
105
|
+
}
|
|
106
|
+
await handle.sync();
|
|
107
|
+
} finally {
|
|
108
|
+
await handle.close();
|
|
109
|
+
}
|
|
110
|
+
const checksum = crc32Final(state);
|
|
111
|
+
const [major, minor, patch] = engineVersionParts();
|
|
112
|
+
const header = writeHeader({
|
|
113
|
+
magic: "NRSL",
|
|
114
|
+
envelopeFormatVersion: VECTOR_FILE_ENVELOPE_VERSION,
|
|
115
|
+
engineVersionMajor: major,
|
|
116
|
+
engineVersionMinor: minor,
|
|
117
|
+
engineVersionPatch: patch,
|
|
118
|
+
payloadLength,
|
|
119
|
+
flags: {
|
|
120
|
+
compressionEnabled: false,
|
|
121
|
+
compressionAlgorithm: "none",
|
|
122
|
+
checksumPresent: true,
|
|
123
|
+
encryptionEnabled: false
|
|
124
|
+
},
|
|
125
|
+
checksum,
|
|
126
|
+
reserved: new Uint8Array(RESERVED_SIZE)
|
|
127
|
+
});
|
|
128
|
+
const patched = await directory.markerHandle(temporaryKey);
|
|
129
|
+
try {
|
|
130
|
+
await patched.writeSlot(0, header);
|
|
131
|
+
} finally {
|
|
132
|
+
await patched.close();
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
temporaryKey,
|
|
136
|
+
ref: {
|
|
137
|
+
id: target.id,
|
|
138
|
+
key: target.key,
|
|
139
|
+
count: slots.length,
|
|
140
|
+
dead: null,
|
|
141
|
+
bytes: HEADER_SIZE + payloadLength,
|
|
142
|
+
checksum
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
async function partitionField(checkpoint, directory, scope, field, written) {
|
|
147
|
+
const fieldType = scope.manifest.schema[field.fieldPath];
|
|
148
|
+
const dimension = fieldType === void 0 ? null : parseVectorDimension(fieldType);
|
|
149
|
+
if (dimension === null) loadFailed(`The manifest gives vector field "${field.fieldPath}" no dimension`);
|
|
150
|
+
const capacity = vectorsPerFile(dimension, null);
|
|
151
|
+
const files = [];
|
|
152
|
+
let pending = [];
|
|
153
|
+
async function flush() {
|
|
154
|
+
if (pending.length === 0) return;
|
|
155
|
+
const id = files.length;
|
|
156
|
+
const key = vectorFileKey(scope.indexName, field.fieldPath, id);
|
|
157
|
+
const temporaryKey = `${scope.temporaryPrefix}${written.size}`;
|
|
158
|
+
const file = await writePartitionVectorFile(
|
|
159
|
+
checkpoint,
|
|
160
|
+
directory,
|
|
161
|
+
{ key, id, temporaryKey, fieldPath: field.fieldPath, dimension },
|
|
162
|
+
pending
|
|
163
|
+
);
|
|
164
|
+
files.push(file.ref);
|
|
165
|
+
written.set(key, temporaryKey);
|
|
166
|
+
pending = [];
|
|
167
|
+
}
|
|
168
|
+
for (const ref of field.files) {
|
|
169
|
+
const docIds = await docIdsOf(checkpoint, directory, ref, field.fieldPath);
|
|
170
|
+
for (let position = 0; position < docIds.length; position++) {
|
|
171
|
+
if (isDead(ref.dead, position) || !scope.holds(docIds[position])) continue;
|
|
172
|
+
pending.push({ docId: docIds[position], ref, position });
|
|
173
|
+
if (pending.length === capacity) await flush();
|
|
174
|
+
}
|
|
175
|
+
await flush();
|
|
176
|
+
}
|
|
177
|
+
return { fieldPath: field.fieldPath, nextFileId: files.length, files, graphGeneration: 0, graphParts: [] };
|
|
178
|
+
}
|
|
179
|
+
async function openPagedPartitionArchive(checkpoint, directory, indexName, partitionId, manager) {
|
|
180
|
+
const { manifest } = checkpoint;
|
|
181
|
+
const temporaryPrefix = `${segmentsPrefix(indexName)}partition-copy-${partitionId}-${generateId()}-`;
|
|
182
|
+
const written = /* @__PURE__ */ new Map();
|
|
183
|
+
const { partitionCount } = manager;
|
|
184
|
+
const routesHere = (docId) => resolvePartitionId(docId, partitionCount) === partitionId;
|
|
185
|
+
async function removeWritten() {
|
|
186
|
+
for (const temporaryKey of written.values()) await directory.remove(temporaryKey);
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const vectors = [];
|
|
190
|
+
for (const field of manifest.vectors) {
|
|
191
|
+
vectors.push(
|
|
192
|
+
await partitionField(
|
|
193
|
+
checkpoint,
|
|
194
|
+
directory,
|
|
195
|
+
{ indexName, manifest, temporaryPrefix, holds: routesHere },
|
|
196
|
+
field,
|
|
197
|
+
written
|
|
198
|
+
)
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
const narrowed = {
|
|
202
|
+
...manifest,
|
|
203
|
+
partitions: manifest.partitions.filter((entry) => entry.partitionId === partitionId),
|
|
204
|
+
checkpoint: manifest.checkpoint.filter((entry) => entry.partitionId === partitionId),
|
|
205
|
+
vectors
|
|
206
|
+
};
|
|
207
|
+
const encoded = await encodeSegmentManifest(narrowed);
|
|
208
|
+
let manifestLength = 0;
|
|
209
|
+
for (const chunk of encoded.chunks) manifestLength += chunk.byteLength;
|
|
210
|
+
const manifestBytes = new Uint8Array(manifestLength);
|
|
211
|
+
let cursor = 0;
|
|
212
|
+
for (const chunk of encoded.chunks) {
|
|
213
|
+
manifestBytes.set(chunk, cursor);
|
|
214
|
+
cursor += chunk.byteLength;
|
|
215
|
+
}
|
|
216
|
+
const { readRange } = directory;
|
|
217
|
+
return {
|
|
218
|
+
manifestBytes,
|
|
219
|
+
manifest: narrowed,
|
|
220
|
+
lastSeqNo: narrowed.checkpoint[0]?.lastSeqNo ?? 0,
|
|
221
|
+
directory,
|
|
222
|
+
readFile: (ref) => checkpoint.readFile(ref),
|
|
223
|
+
readRange: (ref, offset, length) => {
|
|
224
|
+
const temporaryKey = written.get(ref.key);
|
|
225
|
+
if (temporaryKey === void 0 || readRange === void 0) return checkpoint.readRange(ref, offset, length);
|
|
226
|
+
return readRange.call(directory, temporaryKey, offset, length);
|
|
227
|
+
},
|
|
228
|
+
release: () => {
|
|
229
|
+
void removeWritten().catch(() => void 0).finally(() => checkpoint.release());
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
} catch (error) {
|
|
233
|
+
await removeWritten().catch(() => void 0);
|
|
234
|
+
throw error;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
async function removeReceivedFilesNothingReads(directory, manager, partitionId, currentPrefix) {
|
|
238
|
+
const partition = manager.getPartition(partitionId);
|
|
239
|
+
const read = /* @__PURE__ */ new Set();
|
|
240
|
+
if (isCompositePartition(partition)) {
|
|
241
|
+
for (const segment of partition.frozenSegments()) {
|
|
242
|
+
if (segment.paged !== null) read.add(segment.paged.key);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const everyReceipt = `${manager.indexName}/received/p${partitionId}/`;
|
|
246
|
+
for (const key of await directory.list(everyReceipt)) {
|
|
247
|
+
if (read.has(key)) continue;
|
|
248
|
+
if (key.startsWith(currentPrefix) && [...read].some((held) => held.startsWith(currentPrefix))) continue;
|
|
249
|
+
await directory.remove(key);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export { openPagedPartitionArchive, removeReceivedFilesNothingReads };
|