@delali/narsil 0.3.1-next.157 → 0.3.1-next.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/filesystem.mjs +3 -3
- package/dist/adapters/gcs.mjs +3 -3
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +3 -3
- package/dist/browser/{chunk-N23GL72Q.mjs → chunk-4RNSFVWI.mjs} +20777 -19056
- package/dist/browser/chunk-MMHIIL5B.mjs +564 -0
- package/dist/browser/chunk-MZHQ65VI.mjs +1228 -0
- package/dist/browser/chunk-WC2DEXWU.mjs +29 -0
- package/dist/browser/{chunk-VLJQW4J6.mjs → core-leaf-TJAGWPZZ.mjs} +4674 -3102
- package/dist/{react-native/chunks/durability-config-QXVZEO7T.mjs → browser/durability-config-SGB5ZP5K.mjs} +8 -3
- package/dist/browser/embed-RF2MPGAO.mjs +222 -0
- package/dist/{react-native/chunks/geo-index-PX3BIHAH.mjs → browser/geo-index-GNHY4PUB.mjs} +190 -93
- package/dist/{react-native/chunks/module-TTEVPRCW.mjs → browser/module-362VSIGR.mjs} +1570 -275
- package/dist/browser/msgpack-leaf-44XNWSSY.mjs +302 -0
- package/dist/browser/optional-reads-XMVPG6HG.mjs +3230 -0
- package/dist/browser/optional-writes-WMZX4OEC.mjs +3196 -0
- package/dist/browser/phrase-module-22TKMXWI.mjs +616 -0
- package/dist/browser/resolve-vector-text-KI65IHMD.mjs +60 -0
- package/dist/browser/{restore-hooks-IE3GGYHG.mjs → restore-queue-S4BWOGMU.mjs} +98 -24
- package/dist/{react-native/chunks/runtime-R5E3TB3J.mjs → browser/runtime-NU6VOVH2.mjs} +61 -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-X6CNRHJS.mjs +18221 -0
- package/dist/browser/store-leaf-AEMTAVHX.mjs +2069 -0
- package/dist/browser/{chunk-GFAZPSWK.mjs → suggestions-leaf-3Y6MR6OF.mjs} +441 -119
- package/dist/browser/worker-copies-WQCPP3TS.mjs +2750 -0
- package/dist/{capabilities-D3AoBJoF.d.ts → capabilities-BKDrry0z.d.ts} +2 -2
- package/dist/chunk-2JRERUNZ.mjs +217 -0
- package/dist/chunk-2RIS76RJ.mjs +212 -0
- package/dist/chunk-3B775F3C.mjs +252 -0
- package/dist/{chunk-24FNVRKB.mjs → chunk-3D6RZGJH.mjs} +3 -3
- package/dist/{chunk-INJYO3BU.mjs → chunk-4CAMH7FO.mjs} +1 -1
- package/dist/{chunk-U476IXKQ.mjs → chunk-4PY4JYMY.mjs} +2 -1
- package/dist/chunk-6EZW2GQL.mjs +978 -0
- package/dist/chunk-75UNINFA.mjs +271 -0
- package/dist/chunk-77AUVDQ5.mjs +7 -0
- package/dist/{chunk-JTYPJF3T.mjs → chunk-7MWYORQC.mjs} +2 -2
- package/dist/{chunk-TGP5M5R7.mjs → chunk-7T4LAYT4.mjs} +1 -1
- package/dist/{chunk-XIHUI4KB.mjs → chunk-AB27FWZM.mjs} +8 -3
- package/dist/{chunk-FUD5XSZ5.mjs → chunk-BXM7XM4G.mjs} +7 -3
- package/dist/{chunk-HJJI72X7.mjs → chunk-C7YQHCSO.mjs} +1 -1
- package/dist/{chunk-RVGRFOGN.mjs → chunk-D456ZFPQ.mjs} +2 -1
- package/dist/{chunk-KKQC526K.mjs → chunk-E2F6LZR3.mjs} +19 -21
- package/dist/{chunk-SMOOSIAW.mjs → chunk-FE3MRIBN.mjs} +104 -13
- package/dist/{chunk-KYYABCSW.mjs → chunk-FETZYCH7.mjs} +15 -1
- package/dist/{chunk-XXJZMTZT.mjs → chunk-FVZ5DB6Y.mjs} +3 -2
- package/dist/{chunk-EYD7K3H6.mjs → chunk-GF4K7IUK.mjs} +317 -120
- package/dist/chunk-GXCDWLQI.mjs +193 -0
- package/dist/{chunk-IIRIG7H5.mjs → chunk-H64YDF5M.mjs} +3 -3
- package/dist/{browser/chunk-VY5KW3HN.mjs → chunk-HOOR4CP5.mjs} +63 -7
- package/dist/chunk-IB4BYLE3.mjs +127 -0
- package/dist/{chunk-3C7MTCCI.mjs → chunk-IE3Q62QD.mjs} +2 -2
- package/dist/chunk-IH3G6SJO.mjs +40 -0
- package/dist/chunk-JV74RKCY.mjs +3041 -0
- package/dist/{chunk-ZPZ3YGXV.mjs → chunk-K67I3RF4.mjs} +261 -101
- package/dist/chunk-KLVMK3R5.mjs +47 -0
- package/dist/{chunk-5VV4R6P7.mjs → chunk-LAWIJRMJ.mjs} +4154 -2577
- package/dist/chunk-LF4GB4PO.mjs +281 -0
- package/dist/chunk-NC4QLCZC.mjs +59 -0
- package/dist/chunk-OOO54OVC.mjs +627 -0
- package/dist/chunk-OUWZKNO3.mjs +207 -0
- package/dist/{chunk-FJKKCV4D.mjs → chunk-P5YLI5ED.mjs} +343 -182
- package/dist/{chunk-4ZTHGTVX.mjs → chunk-PTTMGRG5.mjs} +9 -10
- package/dist/{react-native/chunks/chunk-DZ7H7D2C.mjs → chunk-Q3ZZH5Z7.mjs} +6 -0
- package/dist/{browser/chunk-EKMGCRSR.mjs → chunk-QBVTYY4J.mjs} +2 -9
- package/dist/{chunk-W5EB5XKI.mjs → chunk-R4CE4IVU.mjs} +341 -183
- package/dist/chunk-S2POFTLN.mjs +10 -0
- package/dist/{chunk-KJ3RTZDJ.mjs → chunk-S3BSDBF7.mjs} +10 -3
- package/dist/{chunk-4LMSZAK6.mjs → chunk-SHGN3QIF.mjs} +69 -13
- package/dist/chunk-SXIRM4MX.mjs +3549 -0
- package/dist/{chunk-TBC3XUL2.mjs → chunk-TGPKS2UM.mjs} +47 -1
- package/dist/chunk-TINW4BSH.mjs +31301 -0
- package/dist/{cold-module-VOJXMNZB.mjs → chunk-TSLV5P2J.mjs} +397 -80
- package/dist/{chunk-HHBUCIUY.mjs → chunk-TW543F33.mjs} +3 -3
- package/dist/chunk-U6B7DUQW.mjs +788 -0
- package/dist/{chunk-OQLD2BSW.mjs → chunk-V3SGPXWQ.mjs} +8 -9
- package/dist/chunk-W34VJXY7.mjs +4723 -0
- package/dist/chunk-YETKPX5M.mjs +5 -0
- package/dist/chunk-ZQ6QY42L.mjs +59 -0
- package/dist/{client-kqSMevVi.d.ts → client-CTp8RRiK.d.ts} +4 -4
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +66 -18
- package/dist/{config-B4v_Htpu.d.ts → config-PCNzWjHL.d.ts} +6 -3
- package/dist/{config-CTP01fns.d.ts → config-_WT5grSL.d.ts} +3 -3
- package/dist/core-leaf-KXFGP74A.mjs +7 -0
- package/dist/digest-leaf-KXBGKYHZ.mjs +1 -0
- package/dist/direct-executor-MKTZBR26.mjs +16 -0
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +7 -4
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/coordinator/in-memory.mjs +1 -2
- package/dist/distribution/transport/grpc.mjs +7 -2
- package/dist/distribution/transport/tcp.mjs +7 -1
- package/dist/distribution.d.ts +7 -7
- package/dist/distribution.mjs +1199 -1092
- package/dist/{browser/durability-config-TIYKW6XX.mjs → durability-config-XV4XR7Y4.mjs} +7 -3
- package/dist/embed-4H7RTBVL.mjs +221 -0
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-CkPn2PWE.d.ts → engine-DBRVR_d-.d.ts} +1252 -1239
- package/dist/{browser/geo-index-OTV7VPIR.mjs → geo-index-2ZMMWWSK.mjs} +190 -93
- package/dist/{index-C4AmUnl1.d.ts → index-Ck9w5WHz.d.ts} +1 -1
- package/dist/index.browser.mjs +4 -16
- package/dist/index.d.ts +1495 -78
- package/dist/index.mjs +14 -50
- package/dist/index.react-native.mjs +11 -28
- package/dist/invalidation/filesystem.mjs +1 -2
- 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-QDFQSJD6.mjs → long-query-thread-JMGNGF6V.mjs} +74 -58
- package/dist/{module-N55W4Q5C.mjs → module-ZJ6ARG6V.mjs} +444 -111
- package/dist/msgpack-leaf-5WFRP6JM.mjs +9 -0
- package/dist/optional-reads-BR3BOVZW.mjs +3373 -0
- package/dist/optional-writes-DDFHYUOH.mjs +218 -0
- package/dist/{paged-partition-archive-RLRGOXDX.mjs → paged-partition-archive-G576XGVE.mjs} +29 -69
- package/dist/partial-words.browser.mjs +1649 -0
- package/dist/partial-words.mjs +15 -14
- package/dist/{chunk-CITFCZKF.mjs → pattern.browser.mjs} +153 -186
- package/dist/pattern.mjs +6 -8
- package/dist/persistence/durability/checkpoint-worker.d.ts +32 -24
- package/dist/persistence/durability/checkpoint-worker.mjs +27 -59
- package/dist/phrase-module-XK3T44VU.mjs +634 -0
- package/dist/query-actions-OMXJEC2J.mjs +118 -0
- package/dist/query-suggestions/merge-worker.mjs +18 -54
- package/dist/query-suggestions.browser.mjs +26 -227
- package/dist/query-suggestions.d.ts +2 -2
- package/dist/query-suggestions.mjs +16 -67
- package/dist/react-native/chunks/chunk-4EXKQ2IB.mjs +565 -0
- package/dist/react-native/chunks/chunk-52QD7CBJ.mjs +52 -0
- package/dist/react-native/chunks/chunk-72OKYHZL.mjs +969 -0
- package/dist/react-native/chunks/chunk-AQOWRH2C.mjs +802 -0
- package/dist/react-native/chunks/{chunk-4COWCEY7.mjs → chunk-FTQ7JNMU.mjs} +341 -180
- package/dist/react-native/chunks/chunk-G3CUQ333.mjs +42 -0
- package/dist/react-native/chunks/{chunk-EJ33LCHV.mjs → chunk-HRDMIQ63.mjs} +53 -1
- package/dist/react-native/chunks/{chunk-4AV5PPH6.mjs → chunk-IY6U6HRA.mjs} +63 -7
- package/dist/react-native/chunks/chunk-J2NQW353.mjs +212 -0
- package/dist/react-native/chunks/chunk-L4R5ITVG.mjs +29047 -0
- package/dist/react-native/chunks/{chunk-OXM66LO6.mjs → chunk-OK3WUA6N.mjs} +2 -10
- package/dist/react-native/chunks/{chunk-MVXELMJX.mjs → chunk-PVMEHBQO.mjs} +1 -1
- package/dist/{browser/chunk-SRMZXJSL.mjs → react-native/chunks/chunk-TQ26BKBH.mjs} +6 -0
- package/dist/{browser/chunk-GPPOG6PT.mjs → react-native/chunks/chunk-VUJCSQG5.mjs} +3 -1
- package/dist/react-native/chunks/{chunk-ENLMYKSX.mjs → chunk-XEGKQKLY.mjs} +5385 -3114
- package/dist/react-native/chunks/chunk-YOTP2FPE.mjs +232 -0
- package/dist/react-native/chunks/chunk-ZIU6TWXG.mjs +127 -0
- package/dist/react-native/chunks/core-leaf-5B4JXCVA.mjs +6 -0
- package/dist/react-native/chunks/digest-leaf-X6OIFDIU.mjs +1 -0
- package/dist/{durability-config-GE4U7MCZ.mjs → react-native/chunks/durability-config-3IOXIPYZ.mjs} +7 -3
- package/dist/react-native/chunks/embed-3WQ2CCR5.mjs +221 -0
- package/dist/{geo-index-MRH5JMIR.mjs → react-native/chunks/geo-index-QEYKEVPH.mjs} +190 -93
- package/dist/react-native/chunks/{chunk-CKNRFDTZ.mjs → gzip.react-native-DLO4WW27.mjs} +2 -1
- package/dist/{browser/module-TCT66FWA.mjs → react-native/chunks/module-VUA27HZZ.mjs} +1018 -540
- package/dist/react-native/chunks/msgpack-leaf-TR66ZVAX.mjs +7 -0
- package/dist/react-native/chunks/optional-reads-WDTLLHUT.mjs +3364 -0
- package/dist/react-native/chunks/optional-writes-FZV3QW34.mjs +267 -0
- package/dist/react-native/chunks/phrase-module-KCQWVXYZ.mjs +635 -0
- package/dist/react-native/chunks/resolve-vector-text-LXRYXF7M.mjs +59 -0
- package/dist/react-native/chunks/restore-queue-EI2V2I4S.mjs +179 -0
- package/dist/{browser/runtime-OTAGEFQW.mjs → react-native/chunks/runtime-BUCSAK4U.mjs} +61 -25
- package/dist/react-native/chunks/segment-codec-leaf-6ULP7H3I.mjs +12 -0
- package/dist/react-native/chunks/segment-merge-leaf-F4GQZNK6.mjs +13 -0
- package/dist/react-native/chunks/storage-leaf-OAXBU2L6.mjs +18042 -0
- package/dist/react-native/chunks/store-leaf-GY2ZZFXB.mjs +14 -0
- package/dist/react-native/chunks/{chunk-WW2X2AEI.mjs → suggestions-leaf-SQEZ4IBS.mjs} +332 -118
- package/dist/react-native/chunks/worker-copies-EEHSCFJW.mjs +2627 -0
- package/dist/react-native/partial-words.mjs +954 -35
- package/dist/react-native/pattern.mjs +238 -111
- package/dist/react-native/query-suggestions.mjs +33 -239
- package/dist/react-native/sync.mjs +95 -52
- package/dist/react-native/synonyms.mjs +256 -112
- package/dist/react.d.ts +9 -9
- package/dist/react.mjs +6 -0
- package/dist/{rerank-MQ37IYRV.mjs → rerank-Y6MWBMTT.mjs} +17 -8
- package/dist/rerankers/http.mjs +2 -2
- package/dist/resolve-vector-text-4PDRTPNQ.mjs +2 -0
- package/dist/restore-queue-KPYSRJ4A.mjs +184 -0
- package/dist/runtime-4GKUIAKV.mjs +595 -0
- package/dist/{schema-Jwt928nJ.d.ts → schema-C_7yRJLt.d.ts} +1 -1
- package/dist/segment-codec-leaf-6IFBSBPN.mjs +17 -0
- package/dist/segment-merge-leaf-VE3FUSVE.mjs +17 -0
- package/dist/server.d.ts +33 -13
- package/dist/server.mjs +81 -100
- package/dist/{browser/durability-wiring-GVZEE46O.mjs → storage-leaf-HMIIOUYN.mjs} +2334 -931
- package/dist/store-leaf-M7T7SUZJ.mjs +19 -0
- package/dist/stored-values-BWIMpiT_.d.ts +25 -0
- package/dist/suggestions-leaf-Q3Q5D6XV.mjs +53 -0
- package/dist/sync/filesystem.d.ts +3 -3
- package/dist/sync/filesystem.mjs +27 -11
- package/dist/sync/indexeddb.browser.mjs +287 -0
- package/dist/sync/indexeddb.d.ts +3 -3
- package/dist/sync/indexeddb.mjs +7 -2
- package/dist/sync.browser.mjs +88 -72
- package/dist/sync.d.ts +4 -4
- package/dist/sync.mjs +89 -59
- package/dist/{chunk-I5B7RXU7.mjs → synonyms.browser.mjs} +248 -135
- package/dist/synonyms.mjs +15 -11
- package/dist/{tasks-CoNjxbop.d.ts → tasks-B4tT4vmP.d.ts} +4 -4
- package/dist/thread-SNILJXX3.mjs +30 -0
- package/dist/{types-DPMjfOr_.d.ts → types-CTg0KaMy.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +7 -1
- package/dist/vector/search-worker.mjs +9 -13
- package/dist/worker-copies-ZLZS2CUM.mjs +2152 -0
- package/dist/workers/entry.mjs +60 -30
- package/openapi.json +66 -50
- package/package.json +233 -8
- package/dist/analysis-change-CKEMM2MC.mjs +0 -55
- package/dist/analysis-change-entry-SEDMJ6MW.mjs +0 -1
- package/dist/archive-history-E4R73RWD.mjs +0 -29
- package/dist/browser/analysis-change-ZKGJFENM.mjs +0 -942
- package/dist/browser/analysis-change-entry-5BFUVMHJ.mjs +0 -1
- package/dist/browser/archive-history-4IP5XQZY.mjs +0 -29
- package/dist/browser/chunk-25MTVDYD.mjs +0 -432
- package/dist/browser/chunk-3I27KXQD.mjs +0 -34
- package/dist/browser/chunk-3NLMB5CC.mjs +0 -217
- package/dist/browser/chunk-4RD3AFSB.mjs +0 -32
- package/dist/browser/chunk-5W3MMTLG.mjs +0 -19
- package/dist/browser/chunk-5YWB3E2W.mjs +0 -92
- package/dist/browser/chunk-7IGKGWSQ.mjs +0 -79
- package/dist/browser/chunk-AI5UI46D.mjs +0 -12
- package/dist/browser/chunk-ATEBYXP6.mjs +0 -10
- package/dist/browser/chunk-BLT4RHCJ.mjs +0 -241
- package/dist/browser/chunk-C26SPCGQ.mjs +0 -2636
- package/dist/browser/chunk-C4FJ3WDY.mjs +0 -177
- package/dist/browser/chunk-CXNTHHA7.mjs +0 -63
- package/dist/browser/chunk-DSXIBE6N.mjs +0 -78
- package/dist/browser/chunk-DUH6QUVU.mjs +0 -2374
- package/dist/browser/chunk-ELV4OZOI.mjs +0 -29
- package/dist/browser/chunk-EXQZGUQH.mjs +0 -193
- package/dist/browser/chunk-G64Q6OJF.mjs +0 -96
- package/dist/browser/chunk-HOZW3PKP.mjs +0 -9
- package/dist/browser/chunk-HUCSHDTB.mjs +0 -100
- package/dist/browser/chunk-JPTQZWJQ.mjs +0 -10
- package/dist/browser/chunk-K3IPRX6D.mjs +0 -2559
- package/dist/browser/chunk-ML7THVLJ.mjs +0 -38
- package/dist/browser/chunk-MY2XKH22.mjs +0 -40
- package/dist/browser/chunk-NLWTBAGB.mjs +0 -111
- package/dist/browser/chunk-NXQG7DRA.mjs +0 -318
- package/dist/browser/chunk-OEDCEZXJ.mjs +0 -92
- package/dist/browser/chunk-OIZS5KIX.mjs +0 -6
- package/dist/browser/chunk-RA6LSBCM.mjs +0 -43
- package/dist/browser/chunk-TK63WFXK.mjs +0 -90
- package/dist/browser/chunk-TY7L6OXO.mjs +0 -69
- package/dist/browser/chunk-U3JOQGWX.mjs +0 -19
- package/dist/browser/chunk-U4YDIBUT.mjs +0 -653
- package/dist/browser/chunk-UATIJ4KU.mjs +0 -21
- package/dist/browser/chunk-UKOWD2K5.mjs +0 -315
- package/dist/browser/chunk-UTMHUHUV.mjs +0 -150
- package/dist/browser/chunk-V43N6TZO.mjs +0 -857
- package/dist/browser/chunk-VI7BQR4U.mjs +0 -21
- package/dist/browser/chunk-WN464PTL.mjs +0 -375
- package/dist/browser/chunk-WXLBZJMT.mjs +0 -25
- package/dist/browser/chunk-X7TXYUKO.mjs +0 -86
- package/dist/browser/chunk-XAWNZ4G2.mjs +0 -151
- package/dist/browser/chunk-Y6IBAUNO.mjs +0 -561
- package/dist/browser/chunk-ZI2V4VD7.mjs +0 -21
- package/dist/browser/cold-module-YNUUDNOM.mjs +0 -761
- package/dist/browser/engine-hooks-HBVS6YM4.mjs +0 -18
- package/dist/browser/gzip-5S7ROJFJ.mjs +0 -1
- package/dist/browser/import-5ESVMFDJ.mjs +0 -20
- package/dist/browser/methods-KTQCSIN4.mjs +0 -30
- package/dist/browser/module-NDSQLPMQ.mjs +0 -25
- package/dist/browser/operations-OJ3BXS55.mjs +0 -5
- package/dist/browser/phrase-module-HAT3TLZN.mjs +0 -328
- package/dist/browser/pool-3JLET5RO.mjs +0 -297
- package/dist/browser/release-HYXPVJVS.mjs +0 -32
- package/dist/browser/restore-queue-LQBBTODR.mjs +0 -55
- package/dist/browser/retention-TY3L3BFN.mjs +0 -211
- package/dist/browser/snapshot-5FHPPCNZ.mjs +0 -965
- package/dist/browser/start-2UZTOBG5.mjs +0 -26
- package/dist/browser/sync-state-P5XG6LTQ.mjs +0 -15
- package/dist/browser/write-ULXAN5B4.mjs +0 -196
- package/dist/chunk-2NE7VCYE.mjs +0 -212
- package/dist/chunk-2ROUFMQX.mjs +0 -543
- package/dist/chunk-37CD3OKS.mjs +0 -87
- package/dist/chunk-3MXV3VHR.mjs +0 -46
- package/dist/chunk-3OH67G7R.mjs +0 -214
- package/dist/chunk-4B7JIGQD.mjs +0 -106
- package/dist/chunk-5YNRKI2C.mjs +0 -81
- package/dist/chunk-6HTGOXIK.mjs +0 -875
- package/dist/chunk-6OEGXLBX.mjs +0 -57
- package/dist/chunk-6RC4K46J.mjs +0 -86
- package/dist/chunk-7GFE3PEY.mjs +0 -40
- package/dist/chunk-7GXJUJ24.mjs +0 -49
- package/dist/chunk-7V5IUP2T.mjs +0 -63
- package/dist/chunk-A4L7YTKX.mjs +0 -458
- package/dist/chunk-BEZH7VEH.mjs +0 -23
- package/dist/chunk-BNL5OPRV.mjs +0 -634
- package/dist/chunk-BTPGQC6Z.mjs +0 -27
- package/dist/chunk-C7XQYG6U.mjs +0 -50
- package/dist/chunk-CQZXZ75V.mjs +0 -562
- package/dist/chunk-CWS55TEX.mjs +0 -242
- package/dist/chunk-CZQ33DLW.mjs +0 -78
- package/dist/chunk-EEBCDP36.mjs +0 -32
- package/dist/chunk-FB6463IN.mjs +0 -1499
- package/dist/chunk-FCJ553HS.mjs +0 -655
- package/dist/chunk-FEZVDOWX.mjs +0 -6996
- package/dist/chunk-FOCV4CBZ.mjs +0 -87
- package/dist/chunk-FQBFZAWG.mjs +0 -27
- package/dist/chunk-G6HRSGOU.mjs +0 -74
- package/dist/chunk-GES7U2PM.mjs +0 -68
- package/dist/chunk-GH4WQ22V.mjs +0 -34
- package/dist/chunk-GPWMUPCA.mjs +0 -1126
- package/dist/chunk-GQPTDQCL.mjs +0 -54
- package/dist/chunk-HJSN7UYG.mjs +0 -10
- package/dist/chunk-I54T6CQP.mjs +0 -117
- package/dist/chunk-IPN7S4KX.mjs +0 -130
- package/dist/chunk-J4IJTTEX.mjs +0 -226
- package/dist/chunk-JSV6OQ4C.mjs +0 -74
- package/dist/chunk-K4ZIGL2O.mjs +0 -290
- package/dist/chunk-KAKQ74LS.mjs +0 -53
- package/dist/chunk-KCQYFO4K.mjs +0 -62
- package/dist/chunk-KHKIRS5D.mjs +0 -113
- package/dist/chunk-KOKM4PQN.mjs +0 -52
- package/dist/chunk-KP7TYHWT.mjs +0 -92
- package/dist/chunk-KZ3NX2P7.mjs +0 -21
- package/dist/chunk-L5ORED7V.mjs +0 -25
- package/dist/chunk-LDNCLRZU.mjs +0 -218
- package/dist/chunk-LHKOSI2J.mjs +0 -58
- package/dist/chunk-LQG5G2LY.mjs +0 -39
- package/dist/chunk-MATMVH65.mjs +0 -9
- package/dist/chunk-MP7ABPTD.mjs +0 -189
- package/dist/chunk-MW6BR4QP.mjs +0 -316
- package/dist/chunk-MWD5VPN7.mjs +0 -21
- package/dist/chunk-ODYKO5TO.mjs +0 -101
- package/dist/chunk-OG7UGJ6F.mjs +0 -63
- package/dist/chunk-ORN5BLL7.mjs +0 -11
- package/dist/chunk-OYABFKTW.mjs +0 -1974
- package/dist/chunk-P5LANSH6.mjs +0 -121
- package/dist/chunk-PELHVTO7.mjs +0 -24
- package/dist/chunk-PIH5SJ4N.mjs +0 -7481
- package/dist/chunk-PSZI4O24.mjs +0 -253
- package/dist/chunk-PV2CG7EJ.mjs +0 -886
- package/dist/chunk-PWGYQXML.mjs +0 -470
- package/dist/chunk-Q2UL2TPC.mjs +0 -21
- package/dist/chunk-QHPYS427.mjs +0 -66
- package/dist/chunk-QJVOLKU6.mjs +0 -111
- package/dist/chunk-QLDABJZM.mjs +0 -20
- package/dist/chunk-QYRNLLLI.mjs +0 -99
- package/dist/chunk-RCX4WNLC.mjs +0 -151
- package/dist/chunk-RFBLQLLZ.mjs +0 -16
- package/dist/chunk-RIHIVFIQ.mjs +0 -240
- package/dist/chunk-RLOES5SX.mjs +0 -31
- package/dist/chunk-RWURUDSP.mjs +0 -2639
- package/dist/chunk-RZWWB2XR.mjs +0 -96
- package/dist/chunk-S5LN746F.mjs +0 -10
- package/dist/chunk-SOI6LTHM.mjs +0 -216
- package/dist/chunk-SQJWAIF4.mjs +0 -12
- package/dist/chunk-TDIK6NTV.mjs +0 -10
- package/dist/chunk-TQXHPFWT.mjs +0 -177
- package/dist/chunk-U55XJEIG.mjs +0 -18
- package/dist/chunk-UD5HIS4U.mjs +0 -382
- package/dist/chunk-UHICS3JI.mjs +0 -83
- package/dist/chunk-UJDJB3NE.mjs +0 -913
- package/dist/chunk-VD7J552I.mjs +0 -28
- package/dist/chunk-VSLSGASN.mjs +0 -30
- package/dist/chunk-VZ2ONHEE.mjs +0 -3715
- package/dist/chunk-W7OSSKH5.mjs +0 -1427
- package/dist/chunk-WZ7YV54N.mjs +0 -152
- package/dist/chunk-X5CV2E2B.mjs +0 -1
- package/dist/chunk-Y4WPNHMC.mjs +0 -50
- package/dist/chunk-YEKL4JBK.mjs +0 -96
- package/dist/chunk-ZXNQEW43.mjs +0 -18
- package/dist/chunk-ZYAY26KG.mjs +0 -29
- package/dist/direct-executor-V5DRIECI.mjs +0 -34
- package/dist/durability-wiring-3TD62MBI.mjs +0 -4072
- package/dist/engine-hooks-HA3SBOBR.mjs +0 -54
- package/dist/gzip-F4HMIEEQ.mjs +0 -1
- package/dist/import-GPKLTSKA.mjs +0 -56
- package/dist/methods-7IOINERF.mjs +0 -30
- package/dist/module-JYHFTVPS.mjs +0 -63
- package/dist/operations-G5EP6JPX.mjs +0 -5
- package/dist/phrase-module-XW5MKWP5.mjs +0 -330
- package/dist/pool-Y4A46T36.mjs +0 -298
- package/dist/react-native/chunks/analysis-change-QUVDNABS.mjs +0 -934
- package/dist/react-native/chunks/analysis-change-entry-OC4XASBF.mjs +0 -1
- package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +0 -29
- package/dist/react-native/chunks/chunk-2PRHILX3.mjs +0 -529
- package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +0 -1
- package/dist/react-native/chunks/chunk-3WI35N75.mjs +0 -226
- package/dist/react-native/chunks/chunk-4DII3ZSM.mjs +0 -73
- package/dist/react-native/chunks/chunk-4J74WHQM.mjs +0 -177
- package/dist/react-native/chunks/chunk-4NWR3NGS.mjs +0 -151
- package/dist/react-native/chunks/chunk-5CQX3XXV.mjs +0 -17
- package/dist/react-native/chunks/chunk-5MSX5FRT.mjs +0 -858
- package/dist/react-native/chunks/chunk-6OFDUYVX.mjs +0 -92
- package/dist/react-native/chunks/chunk-6VBXNFLE.mjs +0 -9
- package/dist/react-native/chunks/chunk-6ZELFCK5.mjs +0 -315
- package/dist/react-native/chunks/chunk-AAAETEJK.mjs +0 -27
- package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +0 -32
- package/dist/react-native/chunks/chunk-BITYFZSZ.mjs +0 -242
- package/dist/react-native/chunks/chunk-C5G6TJ7A.mjs +0 -140
- package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +0 -43
- package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +0 -10
- package/dist/react-native/chunks/chunk-DMIFXZ3Q.mjs +0 -432
- package/dist/react-native/chunks/chunk-DVDX4SDR.mjs +0 -375
- package/dist/react-native/chunks/chunk-DXRSEWA2.mjs +0 -12
- package/dist/react-native/chunks/chunk-F753DA54.mjs +0 -23
- package/dist/react-native/chunks/chunk-FHPW7P2O.mjs +0 -40
- package/dist/react-native/chunks/chunk-FTZHMRD2.mjs +0 -18
- package/dist/react-native/chunks/chunk-HJBJBH26.mjs +0 -34
- package/dist/react-native/chunks/chunk-IAENKE2D.mjs +0 -21
- package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +0 -10
- package/dist/react-native/chunks/chunk-IYNT75CE.mjs +0 -111
- package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +0 -38
- package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +0 -15
- package/dist/react-native/chunks/chunk-KSBYEMCB.mjs +0 -100
- package/dist/react-native/chunks/chunk-KU646XXT.mjs +0 -164
- package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +0 -68
- package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +0 -93
- package/dist/react-native/chunks/chunk-LZSLNSUN.mjs +0 -193
- package/dist/react-native/chunks/chunk-MJDQU5MW.mjs +0 -1225
- package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +0 -8
- package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +0 -78
- package/dist/react-native/chunks/chunk-OCSLSH27.mjs +0 -22723
- package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +0 -29
- package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +0 -79
- package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +0 -9
- package/dist/react-native/chunks/chunk-RDWG33MM.mjs +0 -79
- package/dist/react-native/chunks/chunk-SK2PWYDH.mjs +0 -654
- package/dist/react-native/chunks/chunk-SUPXRTMD.mjs +0 -96
- package/dist/react-native/chunks/chunk-TORU2OHQ.mjs +0 -218
- package/dist/react-native/chunks/chunk-U4KSKA4Z.mjs +0 -23
- package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +0 -68
- package/dist/react-native/chunks/chunk-WBYQRHDY.mjs +0 -86
- package/dist/react-native/chunks/chunk-WVWJNUMN.mjs +0 -2562
- package/dist/react-native/chunks/chunk-YH7QY657.mjs +0 -288
- package/dist/react-native/chunks/chunk-YZW4CHM6.mjs +0 -562
- package/dist/react-native/chunks/chunk-ZNZ6CPAZ.mjs +0 -562
- package/dist/react-native/chunks/chunk-ZVQMBF2H.mjs +0 -63
- package/dist/react-native/chunks/chunk-ZWAIN4GG.mjs +0 -2636
- package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +0 -92
- package/dist/react-native/chunks/cold-module-N6KFNNZA.mjs +0 -773
- package/dist/react-native/chunks/durability-wiring-RN64S2TL.mjs +0 -4984
- package/dist/react-native/chunks/engine-hooks-CWA5CKCA.mjs +0 -30
- package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +0 -3
- package/dist/react-native/chunks/import-5UAWBRJP.mjs +0 -32
- package/dist/react-native/chunks/methods-6W5U4C3H.mjs +0 -30
- package/dist/react-native/chunks/module-6RP4ZCBW.mjs +0 -37
- package/dist/react-native/chunks/operations-GNRMD6EX.mjs +0 -5
- package/dist/react-native/chunks/phrase-module-QK22HSQ2.mjs +0 -329
- package/dist/react-native/chunks/pool-JR3NJCAF.mjs +0 -297
- package/dist/react-native/chunks/release-2SIHZWDO.mjs +0 -32
- package/dist/react-native/chunks/restore-hooks-ENFMDTWC.mjs +0 -127
- package/dist/react-native/chunks/restore-queue-4R6AASE5.mjs +0 -55
- package/dist/react-native/chunks/retention-5GTFT3GR.mjs +0 -223
- package/dist/react-native/chunks/snapshot-5LGPQXFS.mjs +0 -976
- package/dist/react-native/chunks/start-ZQJVZ5DN.mjs +0 -38
- package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +0 -15
- package/dist/react-native/chunks/write-6BRYIIZ7.mjs +0 -208
- package/dist/release-SMR4WJD4.mjs +0 -32
- package/dist/restore-hooks-HXLIEB4A.mjs +0 -153
- package/dist/restore-queue-LZH7LMLR.mjs +0 -55
- package/dist/retention-3K7ARGAG.mjs +0 -66
- package/dist/runtime-COIUORCN.mjs +0 -177
- package/dist/snapshot-O7ICP7NJ.mjs +0 -783
- package/dist/start-S4PFP6RS.mjs +0 -66
- package/dist/sync-state-ZWHLAFLE.mjs +0 -15
- package/dist/thread-YLJ3ZPQ3.mjs +0 -50
- package/dist/write-2OBJGLFS.mjs +0 -233
- /package/dist/browser/{chunk-M3MQE2X7.mjs → digest-leaf-64IPRPZD.mjs} +0 -0
- /package/dist/browser/{chunk-JNOAKDUM.mjs → gzip-JF3S6PPT.mjs} +0 -0
- /package/dist/{chunk-ZXNNR73R.mjs → gzip-2UCZW2MM.mjs} +0 -0
|
@@ -1,241 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import './chunks/chunk-
|
|
4
|
-
import './chunks/chunk-
|
|
5
|
-
import './chunks/chunk-
|
|
6
|
-
import './chunks/chunk-
|
|
7
|
-
import './chunks/chunk-
|
|
8
|
-
import
|
|
9
|
-
import './chunks/chunk-
|
|
10
|
-
import './chunks/chunk-
|
|
11
|
-
import {
|
|
12
|
-
import './chunks/chunk-NNE4VDMM.mjs';
|
|
13
|
-
import './chunks/chunk-IO2SMUQD.mjs';
|
|
14
|
-
import './chunks/chunk-YZW4CHM6.mjs';
|
|
15
|
-
import './chunks/chunk-LU3Y3P63.mjs';
|
|
16
|
-
import './chunks/chunk-AM7RSBPF.mjs';
|
|
17
|
-
import './chunks/chunk-MVXELMJX.mjs';
|
|
18
|
-
import './chunks/chunk-RDWG33MM.mjs';
|
|
19
|
-
import './chunks/chunk-KU646XXT.mjs';
|
|
20
|
-
import './chunks/chunk-UNUFZ2QY.mjs';
|
|
21
|
-
import './chunks/chunk-3NQOVO3K.mjs';
|
|
22
|
-
import './chunks/chunk-JDOEEMEF.mjs';
|
|
23
|
-
import './chunks/chunk-2PRHILX3.mjs';
|
|
24
|
-
import { MAX_MANUAL_SUGGESTION_COUNT, MAX_SOURCE_INDEX_NAME_LENGTH, DEFAULT_PREVIEW_LIMIT, MAX_PREVIEW_LIMIT } from './chunks/chunk-PJHAB5ZY.mjs';
|
|
25
|
-
import './chunks/chunk-YH7QY657.mjs';
|
|
26
|
-
import './chunks/chunk-CHPTFFJM.mjs';
|
|
27
|
-
import './chunks/chunk-4COWCEY7.mjs';
|
|
28
|
-
import './chunks/chunk-5CQX3XXV.mjs';
|
|
29
|
-
import './chunks/chunk-6VBXNFLE.mjs';
|
|
30
|
-
import './chunks/chunk-C5G6TJ7A.mjs';
|
|
31
|
-
import './chunks/chunk-MJDQU5MW.mjs';
|
|
32
|
-
import './chunks/chunk-3WI35N75.mjs';
|
|
33
|
-
import './chunks/chunk-EJ33LCHV.mjs';
|
|
34
|
-
import './chunks/chunk-FHPW7P2O.mjs';
|
|
35
|
-
import './chunks/chunk-DXRSEWA2.mjs';
|
|
36
|
-
import './chunks/chunk-LVIKKAA6.mjs';
|
|
37
|
-
import './chunks/chunk-AAAETEJK.mjs';
|
|
38
|
-
import './chunks/chunk-FTZHMRD2.mjs';
|
|
39
|
-
import { NarsilError, ErrorCodes } from './chunks/chunk-DZ7H7D2C.mjs';
|
|
40
|
-
|
|
41
|
-
// src/query-suggestions/preview.ts
|
|
42
|
-
function previewOrder(left, right) {
|
|
43
|
-
if (left.count !== right.count) return right.count - left.count;
|
|
44
|
-
if (left.group !== right.group) return left.group < right.group ? -1 : 1;
|
|
45
|
-
return left.query < right.query ? -1 : left.query > right.query ? 1 : 0;
|
|
46
|
-
}
|
|
47
|
-
async function previewBuild(ctx, indexName, max) {
|
|
48
|
-
const setting = enabledSetting(ctx.host, indexName);
|
|
49
|
-
const merged = await mergeHistory(ctx, indexName, setting, Date.now());
|
|
50
|
-
const { groups } = groupsToWrite(ctx, indexName, setting, merged.result);
|
|
51
|
-
const banned = new Set(ctx.host.view(indexName)?.state?.bannedQueries ?? []);
|
|
52
|
-
const candidates = [];
|
|
53
|
-
for (const group of groups) {
|
|
54
|
-
for (const { phrase, count } of merged.result.groups[group] ?? []) {
|
|
55
|
-
if (!banned.has(phrase)) candidates.push({ group, query: phrase, count });
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
candidates.sort(previewOrder);
|
|
59
|
-
const checked = /* @__PURE__ */ new Map();
|
|
60
|
-
const entries = [];
|
|
61
|
-
let next = 0;
|
|
62
|
-
while (next < candidates.length && entries.length < max) {
|
|
63
|
-
const candidate = candidates[next];
|
|
64
|
-
next += 1;
|
|
65
|
-
if (candidate === void 0) break;
|
|
66
|
-
let passes = checked.get(candidate.query);
|
|
67
|
-
if (passes === void 0) {
|
|
68
|
-
passes = await meetsMinResults(ctx, indexName, setting, candidate.query);
|
|
69
|
-
checked.set(candidate.query, passes);
|
|
70
|
-
}
|
|
71
|
-
if (passes) entries.push(candidate);
|
|
72
|
-
}
|
|
73
|
-
return { entries, truncated: next < candidates.length };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/query-suggestions/operations.ts
|
|
77
|
-
function requireView(runtime, indexName) {
|
|
78
|
-
const view = runtime.host.view(indexName);
|
|
79
|
-
if (view === null) {
|
|
80
|
-
throw new NarsilError(ErrorCodes.INDEX_NOT_FOUND, `Index "${indexName}" does not exist`, { indexName });
|
|
81
|
-
}
|
|
82
|
-
return view;
|
|
83
|
-
}
|
|
84
|
-
function requireSourceView(runtime, indexName) {
|
|
85
|
-
const view = requireView(runtime, indexName);
|
|
86
|
-
if (view.state?.querySuggestionsSource !== void 0) {
|
|
87
|
-
invalidSetting(`Index "${indexName}" is a suggestions index, so it takes no query suggestions of its own`, {
|
|
88
|
-
indexName
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (indexName.length > MAX_SOURCE_INDEX_NAME_LENGTH) {
|
|
92
|
-
invalidSetting(
|
|
93
|
-
`Index "${indexName}" has a name longer than ${MAX_SOURCE_INDEX_NAME_LENGTH} characters, which leaves no room for the names of its suggestions indexes`,
|
|
94
|
-
{ indexName }
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
return view;
|
|
98
|
-
}
|
|
99
|
-
function requireAcceptable(runtime, indexName, setting) {
|
|
100
|
-
const view = requireSourceView(runtime, indexName);
|
|
101
|
-
requireFieldsInSchema(setting, view.schema);
|
|
102
|
-
if (!setting.enabled) return;
|
|
103
|
-
if (runtime.scrambler === null) {
|
|
104
|
-
invalidSetting("This engine has no query suggestions key, so it cannot turn the feature on", { indexName });
|
|
105
|
-
}
|
|
106
|
-
if (view.hasSync) {
|
|
107
|
-
invalidSetting(
|
|
108
|
-
`Index "${indexName}" has device sync on, and a device receives the whole index of one user while a suggestion comes from the searches of several people`,
|
|
109
|
-
{ indexName }
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async function updateSetting(runtime, indexName, raw) {
|
|
114
|
-
const setting = validateSetting(raw);
|
|
115
|
-
requireAcceptable(runtime, indexName, setting);
|
|
116
|
-
await runtime.host.updateState(indexName, (current) => {
|
|
117
|
-
requireAcceptable(runtime, indexName, setting);
|
|
118
|
-
return withState(current, { querySuggestions: setting });
|
|
119
|
-
});
|
|
120
|
-
if (!setting.enabled) await runtime.discardHistory(indexName);
|
|
121
|
-
runtime.settingChanged(indexName);
|
|
122
|
-
}
|
|
123
|
-
async function status(runtime, indexName) {
|
|
124
|
-
const view = requireView(runtime, indexName);
|
|
125
|
-
return {
|
|
126
|
-
indexName,
|
|
127
|
-
setting: view.state?.querySuggestions ?? null,
|
|
128
|
-
lastBuild: await runtime.builds.lastBuild(indexName),
|
|
129
|
-
nextBuildAt: runtime.timers.nextBuildAt(indexName),
|
|
130
|
-
suggestionIndexes: [...markedSuggestionIndexes(runtime.host, indexName).values()].sort()
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function previewLimitOf(limit) {
|
|
134
|
-
if (limit === void 0) return DEFAULT_PREVIEW_LIMIT;
|
|
135
|
-
if (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1 || limit > MAX_PREVIEW_LIMIT) {
|
|
136
|
-
invalidSetting(`The preview limit must be a whole number from 1 to ${MAX_PREVIEW_LIMIT}`);
|
|
137
|
-
}
|
|
138
|
-
return limit;
|
|
139
|
-
}
|
|
140
|
-
async function preview(runtime, indexName, limit) {
|
|
141
|
-
const max = previewLimitOf(limit);
|
|
142
|
-
runtime.enabledSetting(indexName);
|
|
143
|
-
const scrambler = runtime.scrambler;
|
|
144
|
-
if (scrambler === null) invalidSetting("This engine has no query suggestions key, so it holds no counts");
|
|
145
|
-
const context = {
|
|
146
|
-
host: runtime.host,
|
|
147
|
-
scrambler,
|
|
148
|
-
saveDay: (name) => runtime.saveDay(name),
|
|
149
|
-
withWriteLock: (name, work) => runtime.withWriteLock(name, work),
|
|
150
|
-
isStopping: () => runtime.isStopping
|
|
151
|
-
};
|
|
152
|
-
return previewBuild(context, indexName, max);
|
|
153
|
-
}
|
|
154
|
-
async function banPhrases(runtime, indexName, next) {
|
|
155
|
-
requireSourceView(runtime, indexName);
|
|
156
|
-
let added = [];
|
|
157
|
-
let stored = [];
|
|
158
|
-
await runtime.host.updateState(indexName, (current) => {
|
|
159
|
-
requireSourceView(runtime, indexName);
|
|
160
|
-
const previous = current?.bannedQueries ?? [];
|
|
161
|
-
stored = next(previous);
|
|
162
|
-
const before = new Set(previous);
|
|
163
|
-
added = stored.filter((phrase) => !before.has(phrase));
|
|
164
|
-
return withState(current, { bannedQueries: stored });
|
|
165
|
-
});
|
|
166
|
-
return { stored, added };
|
|
167
|
-
}
|
|
168
|
-
async function removeFromSuggestions(runtime, indexName, phrases) {
|
|
169
|
-
let holders = 0;
|
|
170
|
-
if (phrases.length === 0) return holders;
|
|
171
|
-
for (const name of markedSuggestionIndexes(runtime.host, indexName).values()) {
|
|
172
|
-
if (await removeSuggestions(runtime.host, name, phrases) > 0) holders += 1;
|
|
173
|
-
}
|
|
174
|
-
return holders;
|
|
175
|
-
}
|
|
176
|
-
function updateBans(runtime, indexName, raw) {
|
|
177
|
-
const phrases = banListFromInput(raw);
|
|
178
|
-
return runtime.withWriteLock(indexName, async () => {
|
|
179
|
-
const { stored, added } = await banPhrases(runtime, indexName, () => phrases);
|
|
180
|
-
await removeFromSuggestions(runtime, indexName, added);
|
|
181
|
-
return stored;
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
function removeQuery(runtime, indexName, raw) {
|
|
185
|
-
const phrase = normaliseBan(raw);
|
|
186
|
-
return runtime.withWriteLock(indexName, async () => {
|
|
187
|
-
await banPhrases(runtime, indexName, (current) => current.includes(phrase) ? [...current] : [...current, phrase]);
|
|
188
|
-
return removeFromSuggestions(runtime, indexName, [phrase]);
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
function manualCountOf(count) {
|
|
192
|
-
if (count === void 0) return 0;
|
|
193
|
-
if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0 || count > MAX_MANUAL_SUGGESTION_COUNT) {
|
|
194
|
-
invalidSetting(`A suggestion's count must be a whole number from 0 to ${MAX_MANUAL_SUGGESTION_COUNT}`);
|
|
195
|
-
}
|
|
196
|
-
return count;
|
|
197
|
-
}
|
|
198
|
-
function addSuggestion(runtime, indexName, raw) {
|
|
199
|
-
const { group, query, count } = raw ?? {};
|
|
200
|
-
if (!isGroup(group)) invalidSetting(`A suggestion needs a group of ${GROUP_FORMAT}`);
|
|
201
|
-
if (typeof query !== "string") invalidSetting("A suggestion needs its query as a string");
|
|
202
|
-
const documentCount = manualCountOf(count);
|
|
203
|
-
return runtime.withWriteLock(indexName, async () => {
|
|
204
|
-
const view = requireSourceView(runtime, indexName);
|
|
205
|
-
const setting = resolveSetting(view.state?.querySuggestions ?? { enabled: false, fields: [] });
|
|
206
|
-
const phrase = acceptedPhrase(query, setting);
|
|
207
|
-
if (phrase === null) invalidSetting("The suggestion is not a phrase that the setting of the index accepts");
|
|
208
|
-
if ((view.state?.bannedQueries ?? []).includes(phrase)) {
|
|
209
|
-
invalidSetting("The ban list of the index holds this phrase", { indexName });
|
|
210
|
-
}
|
|
211
|
-
const marked = markedSuggestionIndexes(runtime.host, indexName);
|
|
212
|
-
if (!marked.has(group) && marked.size >= setting.maxGroups) {
|
|
213
|
-
invalidSetting(`Index "${indexName}" already has ${setting.maxGroups} groups`, { indexName });
|
|
214
|
-
}
|
|
215
|
-
const name = await ensureSuggestionsIndex(runtime.host, indexName, group);
|
|
216
|
-
const document = suggestionDocument(phrase, documentCount, ORIGIN_MANUAL);
|
|
217
|
-
if (await runtime.host.engine.has(name, phrase)) await runtime.host.engine.update(name, phrase, document);
|
|
218
|
-
else await runtime.host.engine.insert(name, document);
|
|
219
|
-
return name;
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
function querySuggestionsOf(runtime) {
|
|
223
|
-
return {
|
|
224
|
-
recordQuery: async (indexName, query) => (await runtime()).record(indexName, query),
|
|
225
|
-
updateSetting: async (indexName, setting) => updateSetting(await runtime(), indexName, setting),
|
|
226
|
-
status: async (indexName) => status(await runtime(), indexName),
|
|
227
|
-
build: async (indexName) => (await runtime()).builds.start(indexName, "caller"),
|
|
228
|
-
preview: async (indexName, limit) => preview(await runtime(), indexName, limit),
|
|
229
|
-
bans: async (indexName) => [...requireView(await runtime(), indexName).state?.bannedQueries ?? []],
|
|
230
|
-
updateBans: async (indexName, phrases) => updateBans(await runtime(), indexName, phrases),
|
|
231
|
-
removeQuery: async (indexName, query) => removeQuery(await runtime(), indexName, query),
|
|
232
|
-
addSuggestion: async (indexName, suggestion) => addSuggestion(await runtime(), indexName, suggestion),
|
|
233
|
-
suggestionsIndexName: (indexName, group) => {
|
|
234
|
-
if (!isGroup(group)) invalidSetting(`A group holds ${GROUP_FORMAT}`);
|
|
235
|
-
return suggestionsIndexName(indexName, group);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
}
|
|
1
|
+
import { engineCoreOf, loadSuggestionsCode, GROUP_PATTERN_SOURCE, GROUP_FORMAT, SUGGESTIONS_INDEX_INFIX } from './chunks/chunk-L4R5ITVG.mjs';
|
|
2
|
+
import './chunks/chunk-52QD7CBJ.mjs';
|
|
3
|
+
import './chunks/chunk-XEGKQKLY.mjs';
|
|
4
|
+
import './chunks/chunk-4EXKQ2IB.mjs';
|
|
5
|
+
import './chunks/chunk-G3CUQ333.mjs';
|
|
6
|
+
import './chunks/chunk-PVMEHBQO.mjs';
|
|
7
|
+
import './chunks/chunk-YOTP2FPE.mjs';
|
|
8
|
+
import './chunks/chunk-FTQ7JNMU.mjs';
|
|
9
|
+
import './chunks/chunk-HRDMIQ63.mjs';
|
|
10
|
+
import './chunks/chunk-VUJCSQG5.mjs';
|
|
11
|
+
import { NarsilError, ErrorCodes } from './chunks/chunk-TQ26BKBH.mjs';
|
|
239
12
|
|
|
240
13
|
// src/query-suggestions/providers.ts
|
|
241
14
|
var providers = /* @__PURE__ */ new WeakMap();
|
|
@@ -254,7 +27,28 @@ function querySuggestions(engine) {
|
|
|
254
27
|
"Popular query suggestions need an engine that createNarsil made in this process"
|
|
255
28
|
);
|
|
256
29
|
}
|
|
257
|
-
return
|
|
30
|
+
return lazyQuerySuggestionsOf(core, engine);
|
|
31
|
+
}
|
|
32
|
+
function checkedSuggestionsIndexName(indexName, group) {
|
|
33
|
+
if (typeof group !== "string" || !new RegExp(GROUP_PATTERN_SOURCE).test(group)) {
|
|
34
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `A group holds ${GROUP_FORMAT}`, {});
|
|
35
|
+
}
|
|
36
|
+
return `${indexName}${SUGGESTIONS_INDEX_INFIX}${group}`;
|
|
37
|
+
}
|
|
38
|
+
function lazyQuerySuggestionsOf(core, engine) {
|
|
39
|
+
const local = async () => (await loadSuggestionsCode()).localQuerySuggestionsOf(core, engine);
|
|
40
|
+
return {
|
|
41
|
+
recordQuery: async (indexName, query) => (await local()).recordQuery(indexName, query),
|
|
42
|
+
updateSetting: async (indexName, setting) => (await local()).updateSetting(indexName, setting),
|
|
43
|
+
status: async (indexName) => (await local()).status(indexName),
|
|
44
|
+
build: async (indexName) => (await local()).build(indexName),
|
|
45
|
+
preview: async (indexName, limit) => (await local()).preview(indexName, limit),
|
|
46
|
+
bans: async (indexName) => (await local()).bans(indexName),
|
|
47
|
+
updateBans: async (indexName, phrases) => (await local()).updateBans(indexName, phrases),
|
|
48
|
+
removeQuery: async (indexName, query) => (await local()).removeQuery(indexName, query),
|
|
49
|
+
addSuggestion: async (indexName, suggestion) => (await local()).addSuggestion(indexName, suggestion),
|
|
50
|
+
suggestionsIndexName: checkedSuggestionsIndexName
|
|
51
|
+
};
|
|
258
52
|
}
|
|
259
53
|
|
|
260
54
|
export { querySuggestions };
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import './chunks/chunk-
|
|
4
|
-
import './chunks/chunk-
|
|
5
|
-
import
|
|
6
|
-
import './chunks/chunk-
|
|
7
|
-
import
|
|
8
|
-
import './chunks/chunk-
|
|
9
|
-
import
|
|
10
|
-
import './chunks/chunk-
|
|
11
|
-
import {
|
|
12
|
-
import './chunks/chunk-5CQX3XXV.mjs';
|
|
13
|
-
import './chunks/chunk-6VBXNFLE.mjs';
|
|
14
|
-
import './chunks/chunk-C5G6TJ7A.mjs';
|
|
15
|
-
import { hasLanguage, hasTokenizer, hasStopWords, getLanguage } from './chunks/chunk-MJDQU5MW.mjs';
|
|
16
|
-
import './chunks/chunk-3WI35N75.mjs';
|
|
17
|
-
import './chunks/chunk-EJ33LCHV.mjs';
|
|
18
|
-
import './chunks/chunk-DXRSEWA2.mjs';
|
|
19
|
-
import { NarsilError, ErrorCodes, ClientErrorCodes, ServerErrorCodes, describeError } from './chunks/chunk-DZ7H7D2C.mjs';
|
|
20
|
-
import { encode, decode } from '@msgpack/msgpack';
|
|
1
|
+
import { isSyncEpoch, hasLanguage, hasTokenizer, hasStopWords, readHeapStatistics, loadStorageCode, getLanguage } from './chunks/chunk-L4R5ITVG.mjs';
|
|
2
|
+
import './chunks/chunk-52QD7CBJ.mjs';
|
|
3
|
+
import './chunks/chunk-XEGKQKLY.mjs';
|
|
4
|
+
import './chunks/chunk-4EXKQ2IB.mjs';
|
|
5
|
+
import './chunks/chunk-G3CUQ333.mjs';
|
|
6
|
+
import './chunks/chunk-PVMEHBQO.mjs';
|
|
7
|
+
import './chunks/chunk-YOTP2FPE.mjs';
|
|
8
|
+
import { loadMessagePack, loadedMessagePack, requireLoadedMessagePack, getNestedValue, extractVectorFieldsFromSchema } from './chunks/chunk-FTQ7JNMU.mjs';
|
|
9
|
+
import './chunks/chunk-HRDMIQ63.mjs';
|
|
10
|
+
import './chunks/chunk-VUJCSQG5.mjs';
|
|
11
|
+
import { NarsilError, ErrorCodes, ClientErrorCodes, ServerErrorCodes, describeError } from './chunks/chunk-TQ26BKBH.mjs';
|
|
21
12
|
|
|
22
13
|
// src/json-encoding.ts
|
|
23
14
|
function toPlainNumbers(key, value) {
|
|
@@ -241,9 +232,9 @@ function toBatchResult(payload, path) {
|
|
|
241
232
|
return {
|
|
242
233
|
succeeded: readArray(payload, "succeeded", path),
|
|
243
234
|
failed: failed.map((entry) => {
|
|
244
|
-
const
|
|
245
|
-
const docId = typeof
|
|
246
|
-
const error = readBody(
|
|
235
|
+
const record2 = readBody(entry, path);
|
|
236
|
+
const docId = typeof record2.docId === "string" ? record2.docId : "";
|
|
237
|
+
const error = readBody(record2.error, path);
|
|
247
238
|
const code = typeof error.code === "string" ? error.code : ServerErrorCodes.INTERNAL_ERROR;
|
|
248
239
|
const message = typeof error.message === "string" ? error.message : "The server refused the document";
|
|
249
240
|
const details = typeof error.details === "object" && error.details !== null ? error.details : void 0;
|
|
@@ -839,6 +830,47 @@ function createQuerySuggestionOperations(transport) {
|
|
|
839
830
|
};
|
|
840
831
|
}
|
|
841
832
|
|
|
833
|
+
// src/score-encoding.ts
|
|
834
|
+
function decodeScore(score) {
|
|
835
|
+
if (typeof score === "number") return Number.isFinite(score) ? score : void 0;
|
|
836
|
+
if (score === "NaN") return Number.NaN;
|
|
837
|
+
if (score === "Infinity") return Number.POSITIVE_INFINITY;
|
|
838
|
+
if (score === "-Infinity") return Number.NEGATIVE_INFINITY;
|
|
839
|
+
return void 0;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
// src/client/query-response.ts
|
|
843
|
+
function record(value) {
|
|
844
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
845
|
+
}
|
|
846
|
+
function invalid(path) {
|
|
847
|
+
throw new NarsilError(ClientErrorCodes.CLIENT_INVALID_RESPONSE, "The search response holds an invalid hit score", {
|
|
848
|
+
route: path
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
function decodeHits(hits, path) {
|
|
852
|
+
if (!Array.isArray(hits)) invalid(path);
|
|
853
|
+
for (const hit of hits) {
|
|
854
|
+
if (!record(hit)) invalid(path);
|
|
855
|
+
if (!Object.hasOwn(hit, "score")) continue;
|
|
856
|
+
const score = decodeScore(hit.score);
|
|
857
|
+
if (score === void 0) invalid(path);
|
|
858
|
+
hit.score = score;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
function decodeQueryResult(payload, path) {
|
|
862
|
+
if (!record(payload)) invalid(path);
|
|
863
|
+
decodeHits(payload.hits, path);
|
|
864
|
+
if (payload.groups !== void 0) {
|
|
865
|
+
if (!Array.isArray(payload.groups)) invalid(path);
|
|
866
|
+
for (const group of payload.groups) {
|
|
867
|
+
if (!record(group)) invalid(path);
|
|
868
|
+
decodeHits(group.hits, path);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return payload;
|
|
872
|
+
}
|
|
873
|
+
|
|
842
874
|
// src/client/search.ts
|
|
843
875
|
function createSearchOperations(transport) {
|
|
844
876
|
async function post(path, params, options) {
|
|
@@ -853,8 +885,9 @@ function createSearchOperations(transport) {
|
|
|
853
885
|
return readBody(payload, path);
|
|
854
886
|
}
|
|
855
887
|
return {
|
|
856
|
-
query(indexName, params, options) {
|
|
857
|
-
|
|
888
|
+
async query(indexName, params, options) {
|
|
889
|
+
const path = `${indexPath(indexName)}/search`;
|
|
890
|
+
return decodeQueryResult(await post(path, params, options), path);
|
|
858
891
|
},
|
|
859
892
|
preflight(indexName, params, options) {
|
|
860
893
|
return post(`${indexPath(indexName)}/search/preflight`, params, options);
|
|
@@ -947,13 +980,13 @@ function createSyncSettingOperations(transport) {
|
|
|
947
980
|
}
|
|
948
981
|
|
|
949
982
|
// src/client/tasks.ts
|
|
950
|
-
function isTerminal(
|
|
951
|
-
return
|
|
983
|
+
function isTerminal(record2) {
|
|
984
|
+
return record2.status === "succeeded" || record2.status === "failed" || record2.status === "cancelled";
|
|
952
985
|
}
|
|
953
|
-
function progressKey(
|
|
954
|
-
const progress =
|
|
955
|
-
if (progress === void 0) return
|
|
956
|
-
return `${
|
|
986
|
+
function progressKey(record2) {
|
|
987
|
+
const progress = record2.progress;
|
|
988
|
+
if (progress === void 0) return record2.status;
|
|
989
|
+
return `${record2.status}:${progress.bytesProcessed}:${progress.indexed}:${progress.failed}`;
|
|
957
990
|
}
|
|
958
991
|
function sleep(milliseconds, signal) {
|
|
959
992
|
return new Promise((resolve) => {
|
|
@@ -1006,25 +1039,25 @@ function createTaskOperations(transport) {
|
|
|
1006
1039
|
{ taskId }
|
|
1007
1040
|
);
|
|
1008
1041
|
}
|
|
1009
|
-
const
|
|
1010
|
-
if (
|
|
1042
|
+
const record2 = await operations.getTask(taskId, options);
|
|
1043
|
+
if (record2 === null) {
|
|
1011
1044
|
throw new NarsilError(
|
|
1012
1045
|
ServerErrorCodes.TASK_NOT_FOUND,
|
|
1013
1046
|
`The server no longer holds task "${taskId}", so its outcome is unknown`,
|
|
1014
1047
|
{ taskId }
|
|
1015
1048
|
);
|
|
1016
1049
|
}
|
|
1017
|
-
const key = progressKey(
|
|
1050
|
+
const key = progressKey(record2);
|
|
1018
1051
|
if (key !== reported) {
|
|
1019
1052
|
reported = key;
|
|
1020
|
-
options?.onProgress?.(
|
|
1053
|
+
options?.onProgress?.(record2);
|
|
1021
1054
|
}
|
|
1022
|
-
if (isTerminal(
|
|
1055
|
+
if (isTerminal(record2)) return record2;
|
|
1023
1056
|
if (waitTimeoutMs > 0 && Date.now() - startedAt >= waitTimeoutMs) {
|
|
1024
1057
|
throw new NarsilError(
|
|
1025
1058
|
ClientErrorCodes.CLIENT_TASK_TIMEOUT,
|
|
1026
|
-
`Task "${taskId}" was still ${
|
|
1027
|
-
{ taskId, waitTimeoutMs, status:
|
|
1059
|
+
`Task "${taskId}" was still ${record2.status} after ${waitTimeoutMs} ms, and it keeps running`,
|
|
1060
|
+
{ taskId, waitTimeoutMs, status: record2.status }
|
|
1028
1061
|
);
|
|
1029
1062
|
}
|
|
1030
1063
|
await sleep(interval, options?.signal);
|
|
@@ -1088,6 +1121,8 @@ function backoffDelayMs(attempt, minimumMs, maximumMs) {
|
|
|
1088
1121
|
const ceiling = Math.min(maximumMs, minimumMs * 2 ** Math.min(attempt, BACKOFF_DOUBLINGS_LIMIT));
|
|
1089
1122
|
return Math.round(ceiling / 2 + Math.random() * ceiling / 2);
|
|
1090
1123
|
}
|
|
1124
|
+
|
|
1125
|
+
// src/sync/device/messages.ts
|
|
1091
1126
|
var RESYNC_REASONS = /* @__PURE__ */ new Set(["epoch", "history", "ahead"]);
|
|
1092
1127
|
function isRecord3(value) {
|
|
1093
1128
|
return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Uint8Array);
|
|
@@ -1161,6 +1196,7 @@ function entriesOf(partitionId, raw) {
|
|
|
1161
1196
|
});
|
|
1162
1197
|
}
|
|
1163
1198
|
function decodeFeedMessage(bytes) {
|
|
1199
|
+
const { decode } = requireLoadedMessagePack();
|
|
1164
1200
|
let raw;
|
|
1165
1201
|
try {
|
|
1166
1202
|
raw = decode(bytes);
|
|
@@ -1286,7 +1322,7 @@ function openFeedConnection(url, credential, handlers) {
|
|
|
1286
1322
|
socket.onclose = (event) => finish(event.code);
|
|
1287
1323
|
return {
|
|
1288
1324
|
send(message) {
|
|
1289
|
-
if (!closed && socket.readyState === WebSocket.OPEN) socket.send(encode(message));
|
|
1325
|
+
if (!closed && socket.readyState === WebSocket.OPEN) socket.send(requireLoadedMessagePack().encode(message));
|
|
1290
1326
|
},
|
|
1291
1327
|
close(reason) {
|
|
1292
1328
|
closeSocket(reason);
|
|
@@ -1294,25 +1330,29 @@ function openFeedConnection(url, credential, handlers) {
|
|
|
1294
1330
|
}
|
|
1295
1331
|
};
|
|
1296
1332
|
}
|
|
1333
|
+
|
|
1334
|
+
// src/sync/device/local-writes.ts
|
|
1297
1335
|
var NO_VECTOR_FIELDS = /* @__PURE__ */ new Set();
|
|
1298
1336
|
function vectorFieldPathsOf(engine, indexName) {
|
|
1299
1337
|
if (!holdsIndex(engine, indexName)) return NO_VECTOR_FIELDS;
|
|
1300
|
-
return
|
|
1338
|
+
return new Set(extractVectorFieldsFromSchema(engine.getStats(indexName).schema).keys());
|
|
1301
1339
|
}
|
|
1302
1340
|
function decodedDocument(bytes, vectorFieldPaths) {
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1341
|
+
const code = requireLoadedMessagePack();
|
|
1342
|
+
const document = code.decode(bytes);
|
|
1343
|
+
code.restoreVectorFields(document, vectorFieldPaths);
|
|
1305
1344
|
return document;
|
|
1306
1345
|
}
|
|
1307
1346
|
function documentOfEntry(engine, indexName, bytes) {
|
|
1308
1347
|
return decodedDocument(bytes, vectorFieldPathsOf(engine, indexName));
|
|
1309
1348
|
}
|
|
1310
1349
|
function portableCopyOf(engine, indexName, document) {
|
|
1350
|
+
const code = requireLoadedMessagePack();
|
|
1311
1351
|
const vectorFieldPaths = vectorFieldPathsOf(engine, indexName);
|
|
1312
|
-
const copy = decodedDocument(encodeDocument(document), vectorFieldPaths);
|
|
1352
|
+
const copy = decodedDocument(code.encodeDocument(document), vectorFieldPaths);
|
|
1313
1353
|
for (const fieldPath of vectorFieldPaths) {
|
|
1314
1354
|
const vector = getNestedValue(copy, fieldPath);
|
|
1315
|
-
if (vector instanceof Float32Array) setNestedValue(copy, fieldPath, Array.from(vector));
|
|
1355
|
+
if (vector instanceof Float32Array) code.setNestedValue(copy, fieldPath, Array.from(vector));
|
|
1316
1356
|
}
|
|
1317
1357
|
return copy;
|
|
1318
1358
|
}
|
|
@@ -1343,7 +1383,7 @@ async function removeLocally(engine, indexName, documentId) {
|
|
|
1343
1383
|
async function holdsSameDocument(engine, indexName, documentId, encoded) {
|
|
1344
1384
|
const held = await engine.get(indexName, documentId);
|
|
1345
1385
|
if (encoded === null || held === void 0) return encoded === null && held === void 0;
|
|
1346
|
-
return bytesEqual(encodeDocument(held), encoded);
|
|
1386
|
+
return bytesEqual(requireLoadedMessagePack().encodeDocument(held), encoded);
|
|
1347
1387
|
}
|
|
1348
1388
|
async function applyEntryLocally(engine, indexName, entry) {
|
|
1349
1389
|
if (await holdsSameDocument(engine, indexName, entry.documentId, entry.document)) return;
|
|
@@ -1358,7 +1398,8 @@ async function applyWriteLocally(engine, indexName, write) {
|
|
|
1358
1398
|
await removeLocally(engine, indexName, write.documentId);
|
|
1359
1399
|
return;
|
|
1360
1400
|
}
|
|
1361
|
-
|
|
1401
|
+
const encoded = requireLoadedMessagePack().encodeDocument(write.document);
|
|
1402
|
+
if (await holdsSameDocument(engine, indexName, write.documentId, encoded)) return;
|
|
1362
1403
|
await putLocally(engine, indexName, write.documentId, write.document);
|
|
1363
1404
|
}
|
|
1364
1405
|
function newestByDocument(entries) {
|
|
@@ -1777,6 +1818,7 @@ function optionalString(value) {
|
|
|
1777
1818
|
return typeof value === "string" ? value : void 0;
|
|
1778
1819
|
}
|
|
1779
1820
|
async function readArchiveFacts(source) {
|
|
1821
|
+
const { createByteReader, decodeIndexConfiguration, readSnapshotArchive } = await loadStorageCode();
|
|
1780
1822
|
const reader = createByteReader(source);
|
|
1781
1823
|
const read = { config: null, seqNos: null };
|
|
1782
1824
|
try {
|
|
@@ -2084,16 +2126,16 @@ function createUploader(context, progress, session, state) {
|
|
|
2084
2126
|
}
|
|
2085
2127
|
|
|
2086
2128
|
// src/sync/device/index.ts
|
|
2087
|
-
function
|
|
2129
|
+
function invalid2(message) {
|
|
2088
2130
|
return new NarsilError(ErrorCodes.CONFIG_INVALID, message);
|
|
2089
2131
|
}
|
|
2090
2132
|
function validated(options) {
|
|
2091
2133
|
if (typeof options.indexName !== "string" || options.indexName.length === 0) {
|
|
2092
|
-
throw
|
|
2134
|
+
throw invalid2("Device sync needs an index name");
|
|
2093
2135
|
}
|
|
2094
2136
|
const limit = options.replayLimitOfSnapshot;
|
|
2095
2137
|
if (limit !== void 0 && (!Number.isFinite(limit) || limit < 0)) {
|
|
2096
|
-
throw
|
|
2138
|
+
throw invalid2("replayLimitOfSnapshot must be a finite number at or above 0");
|
|
2097
2139
|
}
|
|
2098
2140
|
}
|
|
2099
2141
|
function requireDocumentObject(document) {
|
|
@@ -2240,17 +2282,18 @@ function createDeviceSync(options) {
|
|
|
2240
2282
|
}
|
|
2241
2283
|
async function waitUntil(condition) {
|
|
2242
2284
|
while (!condition()) {
|
|
2243
|
-
if (stopped) throw
|
|
2285
|
+
if (stopped) throw invalid2("Device sync stopped before it settled");
|
|
2244
2286
|
await changes.next();
|
|
2245
2287
|
}
|
|
2246
2288
|
}
|
|
2247
2289
|
function requireRecovered() {
|
|
2248
|
-
if (recovered === null) throw
|
|
2290
|
+
if (recovered === null) throw invalid2("Call start before writing through device sync");
|
|
2249
2291
|
return recovered;
|
|
2250
2292
|
}
|
|
2251
2293
|
async function write(documentId, document) {
|
|
2252
2294
|
requireDocumentId(documentId);
|
|
2253
2295
|
if (document !== null) requireDocumentObject(document);
|
|
2296
|
+
if (loadedMessagePack() === null) await loadMessagePack();
|
|
2254
2297
|
await requireRecovered();
|
|
2255
2298
|
const copy = document === null ? null : portableCopyOf(engine, indexName, document);
|
|
2256
2299
|
await context.work.run(async () => {
|
|
@@ -2278,7 +2321,7 @@ function createDeviceSync(options) {
|
|
|
2278
2321
|
if (!stopped) return;
|
|
2279
2322
|
stopped = false;
|
|
2280
2323
|
aborts = new AbortController();
|
|
2281
|
-
recovered ??= progress.recover();
|
|
2324
|
+
recovered ??= loadMessagePack().then(() => progress.recover());
|
|
2282
2325
|
try {
|
|
2283
2326
|
await recovered;
|
|
2284
2327
|
} catch (error) {
|