@delali/narsil 0.3.1-next.99 → 0.4.1-next.211
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 +30 -11
- 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 +404 -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,554 @@
|
|
|
1
|
+
// src/core/segment-codec-host.browser.ts
|
|
2
|
+
var ErrorCodes;
|
|
3
|
+
var NarsilError;
|
|
4
|
+
var PROTOTYPE_POLLUTION_KEYS;
|
|
5
|
+
var assembleFrozenSegment;
|
|
6
|
+
var cloneProjected;
|
|
7
|
+
var createPartitionIndex;
|
|
8
|
+
var decodeSurfaceTable;
|
|
9
|
+
var documentWithOwnBuffers;
|
|
10
|
+
var getNestedValue;
|
|
11
|
+
var loadStorageCode;
|
|
12
|
+
var projectIncludedPaths;
|
|
13
|
+
var raiseEarlierReleaseGraphSetting;
|
|
14
|
+
var readProjectedPath;
|
|
15
|
+
var resolvePartialWordAnalysis;
|
|
16
|
+
var resolvePartitionInsertOptions;
|
|
17
|
+
var valueWithOwnBuffers;
|
|
18
|
+
var wrapExternalIdTable;
|
|
19
|
+
var wrapFrozenTokenTable;
|
|
20
|
+
var writePartitionDocument;
|
|
21
|
+
var yieldToEventLoop;
|
|
22
|
+
var Decoder;
|
|
23
|
+
var MAP_TAGS;
|
|
24
|
+
var decode;
|
|
25
|
+
var encodeDocument;
|
|
26
|
+
var headerAt;
|
|
27
|
+
function bindSegmentCodecHost(host, msgpack) {
|
|
28
|
+
({
|
|
29
|
+
ErrorCodes,
|
|
30
|
+
NarsilError,
|
|
31
|
+
PROTOTYPE_POLLUTION_KEYS,
|
|
32
|
+
assembleFrozenSegment,
|
|
33
|
+
cloneProjected,
|
|
34
|
+
createPartitionIndex,
|
|
35
|
+
decodeSurfaceTable,
|
|
36
|
+
documentWithOwnBuffers,
|
|
37
|
+
getNestedValue,
|
|
38
|
+
loadStorageCode,
|
|
39
|
+
projectIncludedPaths,
|
|
40
|
+
raiseEarlierReleaseGraphSetting,
|
|
41
|
+
readProjectedPath,
|
|
42
|
+
resolvePartialWordAnalysis,
|
|
43
|
+
resolvePartitionInsertOptions,
|
|
44
|
+
valueWithOwnBuffers,
|
|
45
|
+
wrapExternalIdTable,
|
|
46
|
+
wrapFrozenTokenTable,
|
|
47
|
+
writePartitionDocument,
|
|
48
|
+
yieldToEventLoop
|
|
49
|
+
} = host);
|
|
50
|
+
({ Decoder, MAP_TAGS, decode, encodeDocument, headerAt } = msgpack);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/engine/recovery-schema.ts
|
|
54
|
+
function unflattenSchema(flat) {
|
|
55
|
+
const root = {};
|
|
56
|
+
for (const [path, fieldType] of Object.entries(flat)) {
|
|
57
|
+
const segments = path.split(".");
|
|
58
|
+
let cursor = root;
|
|
59
|
+
for (let i = 0; i < segments.length - 1; i += 1) {
|
|
60
|
+
const segment = segments[i];
|
|
61
|
+
const existing = cursor[segment];
|
|
62
|
+
if (existing === void 0 || typeof existing !== "object") {
|
|
63
|
+
const child = {};
|
|
64
|
+
cursor[segment] = child;
|
|
65
|
+
cursor = child;
|
|
66
|
+
} else {
|
|
67
|
+
cursor = existing;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const leaf = segments[segments.length - 1];
|
|
71
|
+
cursor[leaf] = fieldType;
|
|
72
|
+
}
|
|
73
|
+
return root;
|
|
74
|
+
}
|
|
75
|
+
function reconstructSchemaFromMetadata(metadata) {
|
|
76
|
+
const config = {
|
|
77
|
+
schema: unflattenSchema(metadata.schema),
|
|
78
|
+
language: metadata.language,
|
|
79
|
+
bm25: {
|
|
80
|
+
k1: metadata.bm25Params.k1,
|
|
81
|
+
b: metadata.bm25Params.b,
|
|
82
|
+
...metadata.bm25Params.fields !== void 0 ? { fields: metadata.bm25Params.fields } : {}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
if (metadata.embedding) {
|
|
86
|
+
config.embedding = metadata.embedding.adapter !== void 0 ? { adapter: metadata.embedding.adapter, fields: metadata.embedding.fields } : { fields: metadata.embedding.fields };
|
|
87
|
+
}
|
|
88
|
+
if (metadata.surfaceForms !== void 0) {
|
|
89
|
+
config.surfaceForms = metadata.surfaceForms;
|
|
90
|
+
}
|
|
91
|
+
if (metadata.tokenizer !== void 0) {
|
|
92
|
+
config.tokenizer = metadata.tokenizer;
|
|
93
|
+
}
|
|
94
|
+
if (metadata.stopWords !== void 0) {
|
|
95
|
+
config.stopWords = metadata.stopWords;
|
|
96
|
+
} else if (metadata.stopWordList !== void 0) {
|
|
97
|
+
config.stopWords = new Set(metadata.stopWordList);
|
|
98
|
+
}
|
|
99
|
+
if (metadata.partitionLimits !== void 0) {
|
|
100
|
+
config.partitions = metadata.partitionLimits;
|
|
101
|
+
}
|
|
102
|
+
if (metadata.defaultScoring !== void 0) {
|
|
103
|
+
config.defaultScoring = metadata.defaultScoring;
|
|
104
|
+
}
|
|
105
|
+
if (metadata.trackPositions !== void 0) {
|
|
106
|
+
config.trackPositions = metadata.trackPositions;
|
|
107
|
+
}
|
|
108
|
+
if (metadata.textStorage !== void 0) {
|
|
109
|
+
config.textStorage = metadata.textStorage;
|
|
110
|
+
}
|
|
111
|
+
if (metadata.strict !== void 0) {
|
|
112
|
+
config.strict = metadata.strict;
|
|
113
|
+
}
|
|
114
|
+
if (metadata.required !== void 0) {
|
|
115
|
+
config.required = metadata.required;
|
|
116
|
+
}
|
|
117
|
+
if (metadata.vectorPromotion !== void 0) {
|
|
118
|
+
config.vectorPromotion = raiseEarlierReleaseGraphSetting(metadata.vectorPromotion);
|
|
119
|
+
}
|
|
120
|
+
if (metadata.patternValueLimit !== void 0) {
|
|
121
|
+
config.patternValueLimit = metadata.patternValueLimit;
|
|
122
|
+
}
|
|
123
|
+
return config;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/partitioning/constants.ts
|
|
127
|
+
var REBALANCE_CHUNK_SIZE = 1e3;
|
|
128
|
+
var DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE = 1e4;
|
|
129
|
+
var TEXT_REBUILD_CHUNK_DOCUMENTS = 1e3;
|
|
130
|
+
var TEXT_REBUILD_SWITCH_BACKLOG_DOCUMENTS = 1e3;
|
|
131
|
+
|
|
132
|
+
// src/partitioning/rewrite-spill-of.ts
|
|
133
|
+
async function rewriteSpillOf(storage, manager, target) {
|
|
134
|
+
if (storage === void 0 || (target?.config ?? manager.config).textStorage !== "disk") return null;
|
|
135
|
+
const { openRewriteSpill } = await loadStorageCode();
|
|
136
|
+
return openRewriteSpill(storage, manager, target);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/partitioning/text-rebuild.ts
|
|
140
|
+
function textRebuildTargetOf(config, language, analysis) {
|
|
141
|
+
return { config, language, analysis, partialWordAnalysis: resolvePartialWordAnalysis(config, language, analysis) };
|
|
142
|
+
}
|
|
143
|
+
function interrupted(pass) {
|
|
144
|
+
return pass.log.partitionsReplaced || !pass.hooks.isCurrent();
|
|
145
|
+
}
|
|
146
|
+
async function buildPartition(pass, source, partitionId) {
|
|
147
|
+
const { manager, language, options } = pass;
|
|
148
|
+
let target = pass.spill?.newPartition(partitionId) ?? createPartitionIndex(partitionId, manager.config.trackPositions ?? true);
|
|
149
|
+
const docIds = [...source.docIds()];
|
|
150
|
+
target.beginBatch();
|
|
151
|
+
for (let start = 0; start < docIds.length; start += TEXT_REBUILD_CHUNK_DOCUMENTS) {
|
|
152
|
+
const end = Math.min(start + TEXT_REBUILD_CHUNK_DOCUMENTS, docIds.length);
|
|
153
|
+
for (let i = start; i < end; i++) {
|
|
154
|
+
const document = manager.getRef(docIds[i]);
|
|
155
|
+
if (document !== void 0)
|
|
156
|
+
target = writePartitionDocument(target, docIds[i], document, manager.schema, language, options).partition;
|
|
157
|
+
}
|
|
158
|
+
if (pass.spill !== null) {
|
|
159
|
+
target.endBatch();
|
|
160
|
+
await pass.spill.spillIfFull(target, partitionId);
|
|
161
|
+
target.beginBatch();
|
|
162
|
+
}
|
|
163
|
+
await yieldToEventLoop();
|
|
164
|
+
if (interrupted(pass)) return null;
|
|
165
|
+
}
|
|
166
|
+
target.endBatch();
|
|
167
|
+
if (pass.partialWordAnalysis !== null) target.preparePartialWords(pass.partialWordAnalysis);
|
|
168
|
+
return target;
|
|
169
|
+
}
|
|
170
|
+
function applyWrittenDocuments(pass, built) {
|
|
171
|
+
const { manager, language, options } = pass;
|
|
172
|
+
for (const docId of pass.log.takeWrittenDocIds()) {
|
|
173
|
+
for (const partition of built) {
|
|
174
|
+
if (!partition.has(docId)) continue;
|
|
175
|
+
partition.remove(docId, manager.schema, language, options);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
const partitionId = manager.partitionIdOf(docId);
|
|
179
|
+
const document = manager.getRef(docId);
|
|
180
|
+
if (partitionId === void 0 || document === void 0) continue;
|
|
181
|
+
built[partitionId] = writePartitionDocument(
|
|
182
|
+
built[partitionId],
|
|
183
|
+
docId,
|
|
184
|
+
document,
|
|
185
|
+
manager.schema,
|
|
186
|
+
language,
|
|
187
|
+
options
|
|
188
|
+
).partition;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async function rebuildOnce(pass) {
|
|
192
|
+
const partitionCount = pass.manager.partitionCount;
|
|
193
|
+
const built = [];
|
|
194
|
+
for (let partitionId = 0; partitionId < partitionCount; partitionId++) {
|
|
195
|
+
const partition = await buildPartition(pass, pass.manager.getPartition(partitionId), partitionId);
|
|
196
|
+
if (partition === null) return false;
|
|
197
|
+
built.push(partition);
|
|
198
|
+
pass.hooks.onPartitionBuilt(built.length);
|
|
199
|
+
}
|
|
200
|
+
while (pass.log.pendingDocuments > TEXT_REBUILD_SWITCH_BACKLOG_DOCUMENTS) {
|
|
201
|
+
applyWrittenDocuments(pass, built);
|
|
202
|
+
await yieldToEventLoop();
|
|
203
|
+
if (interrupted(pass)) return false;
|
|
204
|
+
}
|
|
205
|
+
const keepCurrent = () => {
|
|
206
|
+
if (interrupted(pass)) return false;
|
|
207
|
+
applyWrittenDocuments(pass, built);
|
|
208
|
+
return true;
|
|
209
|
+
};
|
|
210
|
+
if (pass.hooks.holdBeforeSwitch !== void 0 && !await pass.hooks.holdBeforeSwitch(keepCurrent)) return false;
|
|
211
|
+
const swap = () => {
|
|
212
|
+
if (interrupted(pass)) return false;
|
|
213
|
+
applyWrittenDocuments(pass, built);
|
|
214
|
+
pass.manager.adoptRebuiltPartitions(built);
|
|
215
|
+
pass.hooks.onSwitch();
|
|
216
|
+
return true;
|
|
217
|
+
};
|
|
218
|
+
const publish = () => pass.manager.publication.write(swap);
|
|
219
|
+
return pass.hooks.runSwitch === void 0 ? publish() : pass.hooks.runSwitch(publish);
|
|
220
|
+
}
|
|
221
|
+
async function rebuildTextIndexes(manager, hooks, target) {
|
|
222
|
+
const options = resolvePartitionInsertOptions(
|
|
223
|
+
target?.config ?? manager.config,
|
|
224
|
+
target?.analysis ?? manager.analysis,
|
|
225
|
+
{
|
|
226
|
+
validate: false,
|
|
227
|
+
skipClone: true
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
const language = target?.language ?? manager.language;
|
|
231
|
+
const partialWordAnalysis = target === void 0 ? manager.partialWordAnalysis : target.partialWordAnalysis;
|
|
232
|
+
const spill = await rewriteSpillOf(hooks.rewriteStorage?.(), manager, target);
|
|
233
|
+
while (hooks.isCurrent()) {
|
|
234
|
+
const log = manager.openWriteLog();
|
|
235
|
+
let swapped = false;
|
|
236
|
+
try {
|
|
237
|
+
swapped = await rebuildOnce({ manager, log, hooks, language, partialWordAnalysis, options, spill });
|
|
238
|
+
if (swapped) {
|
|
239
|
+
hooks.onRewriteSpill?.(spill);
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
} finally {
|
|
243
|
+
log.close();
|
|
244
|
+
if (!swapped) await spill?.abandon();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// src/serialization/msgpack-without-fields.ts
|
|
251
|
+
var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
252
|
+
var keyDecoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
253
|
+
function endOfValue(view, start) {
|
|
254
|
+
let offset = start;
|
|
255
|
+
let pending = 1;
|
|
256
|
+
while (pending > 0) {
|
|
257
|
+
const header = headerAt(view, offset);
|
|
258
|
+
if (header === null) return null;
|
|
259
|
+
offset += header.headerBytes + header.bodyBytes;
|
|
260
|
+
if (offset > view.byteLength) return null;
|
|
261
|
+
pending += header.children - 1;
|
|
262
|
+
}
|
|
263
|
+
return offset;
|
|
264
|
+
}
|
|
265
|
+
function stringKeyAt(bytes, view, offset) {
|
|
266
|
+
const header = headerAt(view, offset);
|
|
267
|
+
if (header === null || header.children !== 0) return null;
|
|
268
|
+
const tag = view.getUint8(offset);
|
|
269
|
+
const isString = tag >= 160 && tag <= 191 || tag === 217 || tag === 218 || tag === 219;
|
|
270
|
+
const end = offset + header.headerBytes + header.bodyBytes;
|
|
271
|
+
if (!isString || end > bytes.length) return null;
|
|
272
|
+
try {
|
|
273
|
+
return { key: keyDecoder.decode(bytes.subarray(offset + header.headerBytes, end)), end };
|
|
274
|
+
} catch {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function topLevelMapKeys(bytes) {
|
|
279
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
280
|
+
const top = headerAt(view, 0);
|
|
281
|
+
if (top === null || top.bodyBytes !== 0) return null;
|
|
282
|
+
const tag = view.getUint8(0);
|
|
283
|
+
if (!(tag >= 128 && tag <= 143 || MAP_TAGS.has(tag))) return null;
|
|
284
|
+
const keys = /* @__PURE__ */ new Set();
|
|
285
|
+
let offset = top.headerBytes;
|
|
286
|
+
for (let pair = 0; pair < top.children / 2; pair += 1) {
|
|
287
|
+
const key = stringKeyAt(bytes, view, offset);
|
|
288
|
+
if (key === null) return null;
|
|
289
|
+
const valueEnd = endOfValue(view, key.end);
|
|
290
|
+
if (valueEnd === null) return null;
|
|
291
|
+
keys.add(key.key);
|
|
292
|
+
offset = valueEnd;
|
|
293
|
+
}
|
|
294
|
+
return keys;
|
|
295
|
+
}
|
|
296
|
+
function decodeMapWithoutFields(bytes, skippedFields) {
|
|
297
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
298
|
+
const top = headerAt(view, 0);
|
|
299
|
+
if (top === null || top.children === 0 || top.bodyBytes !== 0) return null;
|
|
300
|
+
const tag = view.getUint8(0);
|
|
301
|
+
const isMap = tag >= 128 && tag <= 143 || MAP_TAGS.has(tag);
|
|
302
|
+
if (!isMap) return null;
|
|
303
|
+
const document = {};
|
|
304
|
+
let offset = top.headerBytes;
|
|
305
|
+
for (let pair = 0; pair < top.children / 2; pair += 1) {
|
|
306
|
+
const key = stringKeyAt(bytes, view, offset);
|
|
307
|
+
if (key === null || FORBIDDEN_KEYS.has(key.key)) return null;
|
|
308
|
+
const valueEnd = endOfValue(view, key.end);
|
|
309
|
+
if (valueEnd === null) return null;
|
|
310
|
+
if (!skippedFields.has(key.key)) {
|
|
311
|
+
try {
|
|
312
|
+
document[key.key] = decode(bytes.subarray(key.end, valueEnd));
|
|
313
|
+
} catch {
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
offset = valueEnd;
|
|
318
|
+
}
|
|
319
|
+
return offset === bytes.length ? document : null;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// src/serialization/msgpack-path.ts
|
|
323
|
+
var encoder = new TextEncoder();
|
|
324
|
+
var PROTO_KEY_BYTES = encoder.encode("__proto__");
|
|
325
|
+
var MISSING = { found: false, value: void 0 };
|
|
326
|
+
var pathDecoder = null;
|
|
327
|
+
function encodePathSegments(segments) {
|
|
328
|
+
if (segments.length === 0) return null;
|
|
329
|
+
if (segments.some((segment) => PROTOTYPE_POLLUTION_KEYS.has(segment))) return null;
|
|
330
|
+
return segments.map((segment) => encoder.encode(segment));
|
|
331
|
+
}
|
|
332
|
+
function isStringTag(tag) {
|
|
333
|
+
return tag >= 160 && tag <= 191 || tag === 217 || tag === 218 || tag === 219;
|
|
334
|
+
}
|
|
335
|
+
function isMapTag(tag) {
|
|
336
|
+
return tag >= 128 && tag <= 143 || tag === 222 || tag === 223;
|
|
337
|
+
}
|
|
338
|
+
function isArrayTag(tag) {
|
|
339
|
+
return tag >= 144 && tag <= 159 || tag === 220 || tag === 221;
|
|
340
|
+
}
|
|
341
|
+
function isScalarTag(tag) {
|
|
342
|
+
if (tag <= 127 || tag >= 224 || isStringTag(tag)) return true;
|
|
343
|
+
return tag === 192 || tag === 194 || tag === 195 || tag >= 202 && tag <= 211;
|
|
344
|
+
}
|
|
345
|
+
function sameBytes(bytes, start, end, target) {
|
|
346
|
+
if (end - start !== target.length) return false;
|
|
347
|
+
for (let at = 0; at < target.length; at++) {
|
|
348
|
+
if (bytes[start + at] !== target[at]) return false;
|
|
349
|
+
}
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
function keyRangeAt(view, offset) {
|
|
353
|
+
if (!isStringTag(view.getUint8(offset))) return null;
|
|
354
|
+
const header = headerAt(view, offset);
|
|
355
|
+
if (header === null) return null;
|
|
356
|
+
const start = offset + header.headerBytes;
|
|
357
|
+
return { start, end: start + header.bodyBytes };
|
|
358
|
+
}
|
|
359
|
+
function readEncodedPath(bytes, segments, arrays) {
|
|
360
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
361
|
+
let start = 0;
|
|
362
|
+
let end = bytes.length;
|
|
363
|
+
for (let depth = 0; depth < segments.length; depth++) {
|
|
364
|
+
if (start >= end) return null;
|
|
365
|
+
const tag = view.getUint8(start);
|
|
366
|
+
if (!isMapTag(tag)) {
|
|
367
|
+
if (depth === 0) return null;
|
|
368
|
+
if (isArrayTag(tag)) return arrays === "missing" ? MISSING : null;
|
|
369
|
+
return isScalarTag(tag) ? MISSING : null;
|
|
370
|
+
}
|
|
371
|
+
const header = headerAt(view, start);
|
|
372
|
+
if (header === null) return null;
|
|
373
|
+
let offset = start + header.headerBytes;
|
|
374
|
+
let valueStart = -1;
|
|
375
|
+
let valueEnd = -1;
|
|
376
|
+
for (let pair = 0; pair < header.children / 2; pair++) {
|
|
377
|
+
if (offset >= end) return null;
|
|
378
|
+
const key = keyRangeAt(view, offset);
|
|
379
|
+
if (key === null || key.end > end) return null;
|
|
380
|
+
if (sameBytes(bytes, key.start, key.end, PROTO_KEY_BYTES)) return null;
|
|
381
|
+
const next = endOfValue(view, key.end);
|
|
382
|
+
if (next === null || next > end) return null;
|
|
383
|
+
if (sameBytes(bytes, key.start, key.end, segments[depth])) {
|
|
384
|
+
valueStart = key.end;
|
|
385
|
+
valueEnd = next;
|
|
386
|
+
}
|
|
387
|
+
offset = next;
|
|
388
|
+
}
|
|
389
|
+
if (offset !== end) return null;
|
|
390
|
+
if (valueStart < 0) return MISSING;
|
|
391
|
+
start = valueStart;
|
|
392
|
+
end = valueEnd;
|
|
393
|
+
}
|
|
394
|
+
try {
|
|
395
|
+
pathDecoder ??= new Decoder();
|
|
396
|
+
return { found: true, value: pathDecoder.decode(bytes.subarray(start, end)) };
|
|
397
|
+
} catch {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// src/core/partition/frozen/document-source.ts
|
|
403
|
+
var encodedProjectionPaths = /* @__PURE__ */ new WeakMap();
|
|
404
|
+
function encodedProjectionPathOf(path) {
|
|
405
|
+
let segments = encodedProjectionPaths.get(path);
|
|
406
|
+
if (segments === void 0) {
|
|
407
|
+
segments = encodePathSegments(path);
|
|
408
|
+
encodedProjectionPaths.set(path, segments);
|
|
409
|
+
}
|
|
410
|
+
return segments;
|
|
411
|
+
}
|
|
412
|
+
function sharesPrefix(left, right) {
|
|
413
|
+
const shared = Math.min(left.length, right.length);
|
|
414
|
+
for (let at = 0; at < shared; at++) {
|
|
415
|
+
if (left[at] !== right[at]) return false;
|
|
416
|
+
}
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
function removeFieldAtPath(document, fieldPath) {
|
|
420
|
+
const segments = fieldPath.split(".");
|
|
421
|
+
let current = document;
|
|
422
|
+
for (let i = 0; i < segments.length - 1; i += 1) {
|
|
423
|
+
const next = current[segments[i]];
|
|
424
|
+
if (next === null || typeof next !== "object" || Array.isArray(next)) return;
|
|
425
|
+
current = next;
|
|
426
|
+
}
|
|
427
|
+
delete current[segments[segments.length - 1]];
|
|
428
|
+
}
|
|
429
|
+
function decodeStoredDocument(bytes, discardedFields) {
|
|
430
|
+
let decoded;
|
|
431
|
+
try {
|
|
432
|
+
decoded = decode(bytes);
|
|
433
|
+
} catch (error) {
|
|
434
|
+
throw new NarsilError(
|
|
435
|
+
ErrorCodes.PERSISTENCE_LOAD_FAILED,
|
|
436
|
+
`A stored document is not MessagePack: ${error instanceof Error ? error.message : String(error)}`
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
if (decoded === null || typeof decoded !== "object" || Array.isArray(decoded) || decoded instanceof Uint8Array) {
|
|
440
|
+
throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, "A stored document decodes to something other than a map");
|
|
441
|
+
}
|
|
442
|
+
const document = decoded;
|
|
443
|
+
if (discardedFields !== void 0) {
|
|
444
|
+
for (const fieldPath of discardedFields) removeFieldAtPath(document, fieldPath);
|
|
445
|
+
}
|
|
446
|
+
return document;
|
|
447
|
+
}
|
|
448
|
+
function* storedDocumentsOf(data) {
|
|
449
|
+
const count = data.offsets.length - 1;
|
|
450
|
+
for (let ordinal = 0; ordinal < count; ordinal++) {
|
|
451
|
+
yield decodeStoredDocument(
|
|
452
|
+
data.blob.subarray(data.offsets[ordinal], data.offsets[ordinal + 1]),
|
|
453
|
+
data.discardedFields
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function decodeEveryStoredDocument(data) {
|
|
458
|
+
const count = data.offsets.length - 1;
|
|
459
|
+
for (let ordinal = 0; ordinal < count; ordinal++) {
|
|
460
|
+
decodeStoredDocument(data.blob.subarray(data.offsets[ordinal], data.offsets[ordinal + 1]), data.discardedFields);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function encodeDocumentTableData(documents) {
|
|
464
|
+
const encoded = new Array(documents.length);
|
|
465
|
+
let blobLength = 0;
|
|
466
|
+
for (let ordinal = 0; ordinal < documents.length; ordinal++) {
|
|
467
|
+
const bytes = encodeDocument(documents[ordinal]);
|
|
468
|
+
encoded[ordinal] = bytes;
|
|
469
|
+
blobLength += bytes.length;
|
|
470
|
+
}
|
|
471
|
+
const blob = new Uint8Array(blobLength);
|
|
472
|
+
const offsets = new Uint32Array(documents.length + 1);
|
|
473
|
+
let cursor = 0;
|
|
474
|
+
for (let ordinal = 0; ordinal < documents.length; ordinal++) {
|
|
475
|
+
blob.set(encoded[ordinal], cursor);
|
|
476
|
+
cursor += encoded[ordinal].length;
|
|
477
|
+
offsets[ordinal + 1] = cursor;
|
|
478
|
+
}
|
|
479
|
+
return { blob, offsets };
|
|
480
|
+
}
|
|
481
|
+
function wrapEncodedDocumentTable(data) {
|
|
482
|
+
const { blob, offsets } = data;
|
|
483
|
+
return createEncodedDocumentSource(
|
|
484
|
+
offsets.length - 1,
|
|
485
|
+
blob.byteLength + offsets.byteLength,
|
|
486
|
+
(ordinal) => blob.subarray(offsets[ordinal], offsets[ordinal + 1]),
|
|
487
|
+
data.discardedFields
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
function createEncodedDocumentSource(count, byteLength, bytesAt, discardedFields) {
|
|
491
|
+
const discarded = (discardedFields ?? []).map((fieldPath) => fieldPath.split("."));
|
|
492
|
+
const touchesDiscarded = (path) => discarded.some((discardedPath) => sharesPrefix(discardedPath, path));
|
|
493
|
+
const docAt = (ordinal) => documentWithOwnBuffers(decodeStoredDocument(bytesAt(ordinal), discardedFields));
|
|
494
|
+
function projectedPathAt(ordinal, path) {
|
|
495
|
+
const segments = encodedProjectionPathOf(path);
|
|
496
|
+
if (segments === null) return { found: false, value: void 0 };
|
|
497
|
+
const read = touchesDiscarded(path) ? null : readEncodedPath(bytesAt(ordinal), segments, "missing");
|
|
498
|
+
if (read === null) return readProjectedPath(docAt(ordinal), path);
|
|
499
|
+
return read.found ? { found: true, value: valueWithOwnBuffers(read.value) } : read;
|
|
500
|
+
}
|
|
501
|
+
return {
|
|
502
|
+
count,
|
|
503
|
+
byteLength,
|
|
504
|
+
docAt,
|
|
505
|
+
readAt(ordinal) {
|
|
506
|
+
return decodeStoredDocument(bytesAt(ordinal), discardedFields);
|
|
507
|
+
},
|
|
508
|
+
fieldReader(fieldPath) {
|
|
509
|
+
const path = fieldPath.split(".");
|
|
510
|
+
const segments = encodePathSegments(path);
|
|
511
|
+
if (segments === null) return () => void 0;
|
|
512
|
+
const decodesDocument = touchesDiscarded(path);
|
|
513
|
+
return (ordinal) => {
|
|
514
|
+
const read = decodesDocument ? null : readEncodedPath(bytesAt(ordinal), segments, "decode-document");
|
|
515
|
+
if (read !== null) return valueWithOwnBuffers(read.value);
|
|
516
|
+
return getNestedValue(docAt(ordinal), fieldPath);
|
|
517
|
+
};
|
|
518
|
+
},
|
|
519
|
+
projectedAt(ordinal, projection) {
|
|
520
|
+
if (projection === void 0 || projection.kind === "full") return docAt(ordinal);
|
|
521
|
+
if (projection.kind === "none") return {};
|
|
522
|
+
if (projection.include === null) return cloneProjected(docAt(ordinal), projection);
|
|
523
|
+
return projectIncludedPaths(projection.include, projection.exclude, (path) => projectedPathAt(ordinal, path));
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// src/core/partition/frozen/shared.ts
|
|
529
|
+
function createSharedFrozenSegment(snapshot, survivingSurfaceForms) {
|
|
530
|
+
const tokenTable = wrapFrozenTokenTable(snapshot.tokenTable);
|
|
531
|
+
return assembleFrozenSegment(
|
|
532
|
+
snapshot.segmentId,
|
|
533
|
+
{
|
|
534
|
+
...snapshot,
|
|
535
|
+
tokenTable,
|
|
536
|
+
idTable: wrapExternalIdTable(snapshot.idTable),
|
|
537
|
+
documentTable: snapshot.documentTable,
|
|
538
|
+
readSurfaceForms: () => snapshot.surfaceTable === null ? null : decodeSurfaceTable(snapshot.surfaceTable),
|
|
539
|
+
docFrequencies: () => {
|
|
540
|
+
const frequencies = /* @__PURE__ */ Object.create(null);
|
|
541
|
+
for (let at = 0; at < tokenTable.size; at++) {
|
|
542
|
+
frequencies[tokenTable.tokenAt(at)] = tokenTable.documentFrequencyAt(at);
|
|
543
|
+
}
|
|
544
|
+
return frequencies;
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
wrapEncodedDocumentTable(snapshot.documentTable),
|
|
548
|
+
snapshot,
|
|
549
|
+
snapshot.partialWords,
|
|
550
|
+
survivingSurfaceForms
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, bindSegmentCodecHost, createEncodedDocumentSource, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, encodeDocumentTableData, endOfValue, rebuildTextIndexes, reconstructSchemaFromMetadata, rewriteSpillOf, storedDocumentsOf, textRebuildTargetOf, topLevelMapKeys };
|