@delali/narsil 0.3.1-next.154 → 0.3.1-next.156
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 +1 -0
- package/dist/adapters/filesystem.mjs +2 -2
- package/dist/adapters/gcs.mjs +2 -2
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +2 -2
- package/dist/{analysis-change-4GCRVRBW.mjs → analysis-change-5BQOQ4BF.mjs} +35 -28
- package/dist/{react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs → analysis-change-entry-TXX6JSMX.mjs} +1 -1
- package/dist/archive-history-E4R73RWD.mjs +29 -0
- package/dist/browser/{analysis-change-IXWPXXJJ.mjs → analysis-change-435CUEPZ.mjs} +32 -12
- package/dist/{analysis-change-entry-KYGSXW4K.mjs → browser/analysis-change-entry-HZXKPPGV.mjs} +1 -1
- package/dist/browser/archive-history-4IP5XQZY.mjs +29 -0
- package/dist/browser/{chunk-4PD752F6.mjs → chunk-23XRXIBW.mjs} +1 -1
- package/dist/browser/{chunk-J433A7P3.mjs → chunk-2CFI5VVV.mjs} +5 -5
- package/dist/{react-native/chunks/chunk-3XKMRNRE.mjs → browser/chunk-2TI4SSUP.mjs} +27 -10
- package/dist/browser/chunk-3SSRJMFN.mjs +100 -0
- package/dist/browser/{chunk-2SHAKW2Z.mjs → chunk-3V7DNNZL.mjs} +515 -733
- package/dist/browser/{chunk-C4KS2QNF.mjs → chunk-4NGKC4H4.mjs} +9 -9
- package/dist/browser/{chunk-XRV72TJD.mjs → chunk-6LWDPLTB.mjs} +2 -2
- package/dist/browser/chunk-7IGKGWSQ.mjs +79 -0
- package/dist/browser/{chunk-VCOYGVP7.mjs → chunk-7U3WVJUP.mjs} +3 -3
- package/dist/browser/chunk-ATEBYXP6.mjs +10 -0
- package/dist/browser/chunk-BHFQATSC.mjs +432 -0
- package/dist/browser/chunk-CRE3G7F3.mjs +1007 -0
- package/dist/browser/{chunk-QXTPSX2H.mjs → chunk-EA63E3D2.mjs} +7 -7
- package/dist/{react-native/chunks/chunk-DCKMICOB.mjs → browser/chunk-EXQZGUQH.mjs} +1 -1
- package/dist/browser/{chunk-ML6HY7T7.mjs → chunk-G64Q6OJF.mjs} +1 -1
- package/dist/browser/chunk-GPPOG6PT.mjs +9 -0
- package/dist/browser/{chunk-EUNBNLKM.mjs → chunk-IZXVW2ZJ.mjs} +5 -5
- package/dist/browser/{chunk-G7LUMBSG.mjs → chunk-K4Q6KX3R.mjs} +30 -20
- package/dist/browser/{chunk-H6QFBMVE.mjs → chunk-KZWSX6BH.mjs} +3 -3
- package/dist/browser/chunk-M3MQE2X7.mjs +151 -0
- package/dist/browser/chunk-MGI4BCXC.mjs +63 -0
- package/dist/browser/chunk-MOG4OVDK.mjs +51 -0
- package/dist/browser/{chunk-W5X2UFWQ.mjs → chunk-NLWTBAGB.mjs} +12 -3
- package/dist/browser/{chunk-AYY6PIKL.mjs → chunk-NQAME3RK.mjs} +2 -2
- package/dist/browser/{chunk-7MEYN7V6.mjs → chunk-NXQG7DRA.mjs} +29 -14
- package/dist/browser/chunk-OEDCEZXJ.mjs +92 -0
- package/dist/{chunk-KUZKUONM.mjs → browser/chunk-SRMZXJSL.mjs} +1 -0
- package/dist/browser/chunk-SSTPBZZX.mjs +1106 -0
- package/dist/browser/{chunk-7TTWXUH6.mjs → chunk-STOWQFT3.mjs} +3 -2
- package/dist/browser/{chunk-26A5JFT2.mjs → chunk-TK63WFXK.mjs} +2 -1
- package/dist/browser/{chunk-SJB6VIZG.mjs → chunk-U3JOQGWX.mjs} +1 -1
- package/dist/browser/{chunk-AJ4HHOVT.mjs → chunk-U4YDIBUT.mjs} +4 -4
- package/dist/browser/{chunk-2FX6ROWR.mjs → chunk-VLJQW4J6.mjs} +2986 -2986
- package/dist/{react-native/chunks/chunk-3O57C2ZO.mjs → browser/chunk-WI4MR75E.mjs} +2 -2
- package/dist/browser/{chunk-3U3QR5YP.mjs → chunk-WN464PTL.mjs} +2 -2
- package/dist/browser/{chunk-U2E3HMYW.mjs → chunk-XAWNZ4G2.mjs} +11 -11
- package/dist/browser/{cold-module-VTUGDYNY.mjs → cold-module-2EHCIV4K.mjs} +20 -18
- package/dist/browser/durability-config-TIYKW6XX.mjs +89 -0
- package/dist/browser/{durability-wiring-GL4A7KDV.mjs → durability-wiring-A7BVG2DW.mjs} +50 -153
- package/dist/browser/engine-hooks-E4UD67JD.mjs +17 -0
- package/dist/browser/geo-index-HHWGMNIS.mjs +1386 -0
- package/dist/browser/import-DXYB6756.mjs +19 -0
- package/dist/browser/{methods-LMUTS7OI.mjs → methods-KTQCSIN4.mjs} +3 -3
- package/dist/browser/{module-M4JNBV6V.mjs → module-NIYMEA5R.mjs} +16 -14
- package/dist/browser/{module-EC3FYW7N.mjs → module-TCT66FWA.mjs} +10 -9
- package/dist/browser/operations-OJ3BXS55.mjs +5 -0
- package/dist/browser/{phrase-module-NPYUVX75.mjs → phrase-module-HAT3TLZN.mjs} +2 -2
- package/dist/browser/{pool-WCGDZHJP.mjs → pool-3JLET5RO.mjs} +1 -1
- package/dist/browser/restore-hooks-YPN4ZFCY.mjs +114 -0
- package/dist/browser/restore-queue-G3RQGL3Y.mjs +55 -0
- package/dist/browser/{retention-6QMRS5VK.mjs → retention-ZWVMNC3Q.mjs} +18 -15
- package/dist/browser/{runtime-3EW2AGB6.mjs → runtime-OTAGEFQW.mjs} +1 -1
- package/dist/browser/{snapshot-DN3CRVUQ.mjs → snapshot-VEQNIE6C.mjs} +71 -36
- package/dist/browser/start-BM442C6R.mjs +25 -0
- package/dist/browser/{write-WAWAFGKQ.mjs → write-2EVMZWDE.mjs} +16 -14
- package/dist/{capabilities-B3Brs1Rc.d.ts → capabilities-Da4ywVVl.d.ts} +35 -3
- package/dist/{chunk-K4B7OH65.mjs → chunk-25KDNIZZ.mjs} +2 -2
- package/dist/{chunk-O43Z4MS6.mjs → chunk-2NE7VCYE.mjs} +2 -2
- package/dist/chunk-2UV4QBHW.mjs +1092 -0
- package/dist/{chunk-3Y3J4V2R.mjs → chunk-3C7MTCCI.mjs} +1 -1
- package/dist/{chunk-TRISKD4Q.mjs → chunk-3HYC4JRF.mjs} +2 -2
- package/dist/{chunk-HVYICDY3.mjs → chunk-3OH67G7R.mjs} +1 -1
- package/dist/{chunk-PFKM7VNZ.mjs → chunk-46KY2PJD.mjs} +30 -11
- package/dist/{chunk-IJU7LL7D.mjs → chunk-4KKXNJM6.mjs} +5 -5
- package/dist/{chunk-IQ4R2I6N.mjs → chunk-5FLRXF73.mjs} +5 -1
- package/dist/{chunk-BPSKLCS7.mjs → chunk-5VV4R6P7.mjs} +3017 -3017
- package/dist/chunk-5YNRKI2C.mjs +81 -0
- package/dist/chunk-6HTGOXIK.mjs +875 -0
- package/dist/{chunk-7HCZWC7B.mjs → chunk-6I6AYAXS.mjs} +50 -8
- package/dist/{chunk-C6ASEFZI.mjs → chunk-6OEGXLBX.mjs} +1 -1
- package/dist/{chunk-DVWYODEB.mjs → chunk-6RC4K46J.mjs} +2 -2
- package/dist/chunk-7GFE3PEY.mjs +40 -0
- package/dist/{chunk-QKZHLADX.mjs → chunk-7LXHHCXZ.mjs} +28 -19
- package/dist/{chunk-JUKYYXSP.mjs → chunk-7V5IUP2T.mjs} +1 -31
- package/dist/{react-native/chunks/chunk-7GWPJDOA.mjs → chunk-A4L7YTKX.mjs} +53 -90
- package/dist/{chunk-Z3TNWCI5.mjs → chunk-BU4SAIC4.mjs} +3 -3
- package/dist/chunk-BWZ3P4MU.mjs +20 -0
- package/dist/{chunk-OKX2BBNW.mjs → chunk-CITFCZKF.mjs} +5 -4
- package/dist/{chunk-4HWZV5MK.mjs → chunk-CSLGFPFQ.mjs} +5 -5
- package/dist/chunk-DP5C7YFQ.mjs +543 -0
- package/dist/{chunk-RVKFI3A2.mjs → chunk-DWEPMFJE.mjs} +11 -8
- package/dist/{chunk-LSM2YTKM.mjs → chunk-EFBDHH5P.mjs} +87 -144
- package/dist/{chunk-NZMAXR2S.mjs → chunk-FAKFUDZZ.mjs} +121 -11
- package/dist/chunk-FB6463IN.mjs +1499 -0
- package/dist/{chunk-REL7LFLR.mjs → chunk-FCJ553HS.mjs} +3 -3
- package/dist/{chunk-MMEMEUOO.mjs → chunk-FJKKCV4D.mjs} +2 -2
- package/dist/{chunk-K7KLL263.mjs → chunk-FNGAM5B7.mjs} +14 -13
- package/dist/{chunk-DMQPFLGI.mjs → chunk-FRBFVQFN.mjs} +6 -5
- package/dist/{chunk-IBNLW3AV.mjs → chunk-FYOVBEMM.mjs} +20 -6
- package/dist/chunk-G6HRSGOU.mjs +74 -0
- package/dist/{chunk-USR7FQRZ.mjs → chunk-GH4WQ22V.mjs} +2 -2
- package/dist/chunk-GQPTDQCL.mjs +54 -0
- package/dist/{chunk-VREK3MYG.mjs → chunk-HFPMMRQT.mjs} +3 -3
- package/dist/{chunk-MLHNSAPK.mjs → chunk-HHBUCIUY.mjs} +3 -3
- package/dist/{chunk-YROWNOMH.mjs → chunk-HJJI72X7.mjs} +1 -1
- package/dist/{chunk-ECX4SGX6.mjs → chunk-I2KPOLOZ.mjs} +9 -9
- package/dist/{chunk-TV2L3BN7.mjs → chunk-I53G4JAU.mjs} +266 -265
- package/dist/{chunk-3A5KI24C.mjs → chunk-I54T6CQP.mjs} +1 -1
- package/dist/{chunk-NTZOXVUZ.mjs → chunk-I5B7RXU7.mjs} +93 -24
- package/dist/{chunk-YBJDOA2T.mjs → chunk-INJYO3BU.mjs} +1 -1
- package/dist/{react-native/chunks/chunk-KWRW5U65.mjs → chunk-J4IJTTEX.mjs} +1 -1
- package/dist/{chunk-X6NSJYQ3.mjs → chunk-JDJBQLRO.mjs} +13 -13
- package/dist/{chunk-MMBEANB2.mjs → chunk-JWRUUCWD.mjs} +3 -3
- package/dist/{chunk-AO2FAYIZ.mjs → chunk-K4ZIGL2O.mjs} +1 -1
- package/dist/{chunk-JFNKIBDT.mjs → chunk-K5QFDYST.mjs} +2 -2
- package/dist/{chunk-C73JLU4E.mjs → chunk-KF4EXSM4.mjs} +2 -2
- package/dist/{chunk-WCBA2LVZ.mjs → chunk-KHKIRS5D.mjs} +1 -1
- package/dist/{chunk-7QUGDVFC.mjs → chunk-KJ3RTZDJ.mjs} +1 -1
- package/dist/{chunk-HVKXNBFL.mjs → chunk-KKQC526K.mjs} +20 -12
- package/dist/chunk-KP7TYHWT.mjs +92 -0
- package/dist/{chunk-VMXSVVXG.mjs → chunk-L6V6BST3.mjs} +9 -22
- package/dist/{chunk-URPCYQVJ.mjs → chunk-LHKOSI2J.mjs} +1 -1
- package/dist/chunk-LNGE7SLY.mjs +151 -0
- package/dist/{react-native/chunks/chunk-CUNGPR5R.mjs → chunk-MP7ABPTD.mjs} +1 -0
- package/dist/{chunk-5KGYQT6W.mjs → chunk-MQOJIO5B.mjs} +26 -9
- package/dist/{chunk-Q3TCTQCC.mjs → chunk-NF4DT3IH.mjs} +1 -1
- package/dist/{chunk-3OFU3NJT.mjs → chunk-OIJ64LGT.mjs} +1 -1
- package/dist/chunk-ORN5BLL7.mjs +11 -0
- package/dist/{chunk-HWEDFLB7.mjs → chunk-P5ZI2P2W.mjs} +126 -1701
- package/dist/{chunk-466PYR4P.mjs → chunk-PWC4VB3Q.mjs} +2 -2
- package/dist/{chunk-B7S6YEBP.mjs → chunk-QJVOLKU6.mjs} +12 -3
- package/dist/{chunk-KCUIFVVW.mjs → chunk-QOW2JPUI.mjs} +9 -9
- package/dist/chunk-RDXO6JST.mjs +63 -0
- package/dist/chunk-RLOES5SX.mjs +31 -0
- package/dist/{chunk-YPUEV6ZC.mjs → chunk-RVGRFOGN.mjs} +1 -1
- package/dist/{chunk-JCLTESFN.mjs → chunk-RZWWB2XR.mjs} +1 -1
- package/dist/chunk-S5LN746F.mjs +10 -0
- package/dist/chunk-SA5LOGO3.mjs +470 -0
- package/dist/chunk-SQJWAIF4.mjs +12 -0
- package/dist/{chunk-YTJCGKM4.mjs → chunk-TBC3XUL2.mjs} +29 -6
- package/dist/chunk-TDIK6NTV.mjs +10 -0
- package/dist/chunk-TGS5UXBE.mjs +216 -0
- package/dist/{chunk-CP5RRPJR.mjs → chunk-TQXHPFWT.mjs} +1 -1
- package/dist/{chunk-7NTMUDC5.mjs → chunk-TZ3355VS.mjs} +5 -5
- package/dist/{chunk-Q7MS6P2J.mjs → chunk-TZTRKM33.mjs} +2 -2
- package/dist/{chunk-4UMZ7KQL.mjs → chunk-U55XJEIG.mjs} +2 -1
- package/dist/{chunk-S2N75OTN.mjs → chunk-UHICS3JI.mjs} +1 -1
- package/dist/{chunk-5FUOVJKG.mjs → chunk-VTTRFF2C.mjs} +32 -19
- package/dist/{chunk-62G63NMH.mjs → chunk-WX4LAO6M.mjs} +4 -4
- package/dist/{chunk-LTUGDMV4.mjs → chunk-WZ7YV54N.mjs} +1 -1
- package/dist/chunk-XAXKV65G.mjs +72 -0
- package/dist/chunk-XXHN7J46.mjs +101 -0
- package/dist/{chunk-PGVPE7GJ.mjs → chunk-YEKL4JBK.mjs} +1 -1
- package/dist/chunk-YTWZVGCB.mjs +382 -0
- package/dist/chunk-Z2KAFCRT.mjs +30 -0
- package/dist/{chunk-LKUE5GXS.mjs → chunk-ZKP7G7TV.mjs} +2 -2
- package/dist/{client-Df76GNKm.d.ts → client-DRv7UVeY.d.ts} +123 -11
- package/dist/client.d.ts +9 -8
- package/dist/client.mjs +65 -3
- package/dist/{cold-module-YLWMTTZG.mjs → cold-module-6MO2XJF2.mjs} +45 -39
- package/dist/{config-B8DP2VwR.d.ts → config-CoSig5Ox.d.ts} +22 -3
- package/dist/{config-05G_hy-1.d.ts → config-DMwffLKn.d.ts} +20 -5
- package/dist/direct-executor-FTMYY3TI.mjs +34 -0
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +3 -3
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/coordinator/in-memory.mjs +2 -2
- package/dist/distribution/transport/grpc.mjs +4 -4
- package/dist/distribution/transport/in-memory.mjs +2 -2
- package/dist/distribution/transport/tcp.mjs +3 -3
- package/dist/distribution.d.ts +8 -8
- package/dist/distribution.mjs +6799 -5939
- package/dist/durability-config-GE4U7MCZ.mjs +89 -0
- package/dist/{durability-wiring-RHLXDIVF.mjs → durability-wiring-VIF5MOSY.mjs} +82 -179
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{sync-uXR7MmM7.d.ts → engine-CFxPYqEk.d.ts} +702 -2
- package/dist/engine-hooks-EGUGNZYE.mjs +54 -0
- package/dist/geo-index-MRH5JMIR.mjs +1387 -0
- package/dist/import-XKDPJQDP.mjs +56 -0
- package/dist/{index-nRqDM6uS.d.ts → index-C4AmUnl1.d.ts} +1 -1
- package/dist/index.browser.mjs +9 -7
- package/dist/index.d.ts +134 -9
- package/dist/index.mjs +33 -26
- package/dist/index.react-native.mjs +20 -17
- package/dist/invalidation/filesystem.mjs +2 -2
- package/dist/{long-query-thread-EMYTGSJP.mjs → long-query-thread-YA4IAYSY.mjs} +34 -28
- package/dist/{methods-ABM5ELBR.mjs → methods-7IOINERF.mjs} +3 -3
- package/dist/{module-MG7JMV2U.mjs → module-FQ4JWNQJ.mjs} +41 -34
- package/dist/{module-3OMJZUFT.mjs → module-N55W4Q5C.mjs} +14 -14
- package/dist/operations-G5EP6JPX.mjs +5 -0
- package/dist/{paged-partition-archive-UOLHOEZJ.mjs → paged-partition-archive-PXW5XAYU.mjs} +48 -38
- package/dist/partial-words.mjs +11 -9
- package/dist/pattern.mjs +6 -5
- package/dist/persistence/durability/checkpoint-worker.d.ts +8 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +44 -35
- package/dist/{phrase-module-O3MDRQXP.mjs → phrase-module-XW5MKWP5.mjs} +4 -3
- package/dist/{pool-CQXYPFLG.mjs → pool-Y4A46T36.mjs} +1 -1
- package/dist/query-suggestions/merge-worker.d.ts +55 -0
- package/dist/query-suggestions/merge-worker.mjs +88 -0
- package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
- package/dist/query-suggestions.browser.mjs +247 -0
- package/dist/query-suggestions.d.ts +20 -0
- package/dist/query-suggestions.mjs +69 -0
- package/dist/react-native/chunks/{analysis-change-EAYO3Y6Q.mjs → analysis-change-LT5QBQ3H.mjs} +43 -22
- package/dist/{browser/analysis-change-entry-FCSHFQSS.mjs → react-native/chunks/analysis-change-entry-SCVWK6OU.mjs} +1 -1
- package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +29 -0
- package/dist/{chunk-ZIFJXCKA.mjs → react-native/chunks/chunk-2PRHILX3.mjs} +54 -20
- package/dist/react-native/chunks/{chunk-VQSKZ3EZ.mjs → chunk-3JWDECAZ.mjs} +8 -8
- package/dist/{chunk-R6A773WK.mjs → react-native/chunks/chunk-3WI35N75.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-75VWIY35.mjs → chunk-4DII3ZSM.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-NKIZX26F.mjs → chunk-4J74WHQM.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-UWDNZDWK.mjs → chunk-4JYO3JD2.mjs} +6 -6
- package/dist/react-native/chunks/chunk-5CQX3XXV.mjs +17 -0
- package/dist/react-native/chunks/chunk-6VBXNFLE.mjs +9 -0
- package/dist/react-native/chunks/{chunk-SJWDBRNP.mjs → chunk-6WA3C3DV.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-OQQVRWZ2.mjs → chunk-C5G6TJ7A.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-RVAEBN74.mjs → chunk-CKNRFDTZ.mjs} +1 -1
- package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +10 -0
- package/dist/react-native/chunks/{chunk-O32RB3BL.mjs → chunk-DNXOMPAQ.mjs} +4 -4
- package/dist/react-native/chunks/{chunk-YBEW6YTR.mjs → chunk-DVDX4SDR.mjs} +2 -2
- package/dist/react-native/chunks/chunk-DXRSEWA2.mjs +12 -0
- package/dist/{browser/chunk-MYITLCHT.mjs → react-native/chunks/chunk-DZ7H7D2C.mjs} +1 -0
- package/dist/react-native/chunks/{chunk-PPEPTUVV.mjs → chunk-EJ33LCHV.mjs} +29 -6
- package/dist/react-native/chunks/{chunk-RYMDHGL4.mjs → chunk-ENLMYKSX.mjs} +3045 -3075
- package/dist/react-native/chunks/chunk-FHPW7P2O.mjs +40 -0
- package/dist/react-native/chunks/{chunk-JV6VQY2S.mjs → chunk-FTZHMRD2.mjs} +2 -1
- package/dist/react-native/chunks/{chunk-YHKZSLOC.mjs → chunk-G43IPIDG.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-AUT7PMA4.mjs → chunk-GXX3DQXP.mjs} +8 -22
- package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
- package/dist/react-native/chunks/{chunk-DH3TVWWK.mjs → chunk-IYNT75CE.mjs} +12 -3
- package/dist/react-native/chunks/chunk-KV46CT4D.mjs +1007 -0
- package/dist/{browser/chunk-ZPTA75ZC.mjs → react-native/chunks/chunk-LZSLNSUN.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-63YSZOXB.mjs → chunk-MIP4SOR6.mjs} +1480 -826
- package/dist/react-native/chunks/{chunk-ZBSWRSBG.mjs → chunk-MJDQU5MW.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-GFYFQLJD.mjs → chunk-MUWD2H2S.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-IOY2SM2P.mjs → chunk-MVXELMJX.mjs} +1 -1
- package/dist/{browser/chunk-TTD27VXX.mjs → react-native/chunks/chunk-NB3LP33V.mjs} +27 -10
- package/dist/react-native/chunks/{chunk-I5PGWQJF.mjs → chunk-PDRWWPKV.mjs} +33 -24
- package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +79 -0
- package/dist/react-native/chunks/{chunk-2CGSQM4O.mjs → chunk-POPDAGH6.mjs} +13 -13
- package/dist/react-native/chunks/{chunk-NP7DD4G5.mjs → chunk-QUKQNI3H.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-EH5CFV6Z.mjs → chunk-RDWG33MM.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-JX2RIAXH.mjs → chunk-SK2PWYDH.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-ZYDKJXQJ.mjs → chunk-SUPXRTMD.mjs} +1 -1
- package/dist/react-native/chunks/chunk-TP6KCKER.mjs +63 -0
- package/dist/react-native/chunks/{chunk-JPAJWO6D.mjs → chunk-U4KSKA4Z.mjs} +1 -1
- package/dist/react-native/chunks/chunk-UQ4OAXKU.mjs +1106 -0
- package/dist/react-native/chunks/{chunk-VVFYOADG.mjs → chunk-VWUDIOT6.mjs} +6 -6
- package/dist/{browser/chunk-SIR3LMTV.mjs → react-native/chunks/chunk-WBYQRHDY.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-C2H2QQFW.mjs → chunk-YH7QY657.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-NCJS3WIY.mjs → chunk-YZW4CHM6.mjs} +51 -12
- package/dist/react-native/chunks/chunk-ZLWVW734.mjs +100 -0
- package/dist/react-native/chunks/chunk-ZXZFN7FI.mjs +432 -0
- package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +92 -0
- package/dist/react-native/chunks/{cold-module-TJL6AFAD.mjs → cold-module-KVZYUGRY.mjs} +31 -28
- package/dist/react-native/chunks/durability-config-QXVZEO7T.mjs +89 -0
- package/dist/react-native/chunks/{durability-wiring-RRDYJLLM.mjs → durability-wiring-34OYO32E.mjs} +60 -162
- package/dist/react-native/chunks/engine-hooks-M7JV46NH.mjs +30 -0
- package/dist/react-native/chunks/geo-index-PX3BIHAH.mjs +1387 -0
- package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +3 -0
- package/dist/react-native/chunks/import-H6AQREWI.mjs +32 -0
- package/dist/react-native/chunks/{methods-X6F36SJE.mjs → methods-6W5U4C3H.mjs} +3 -3
- package/dist/react-native/chunks/module-LBZPGOWH.mjs +36 -0
- package/dist/react-native/chunks/{module-S4DKSWMF.mjs → module-TTEVPRCW.mjs} +14 -13
- package/dist/react-native/chunks/operations-GNRMD6EX.mjs +5 -0
- package/dist/react-native/chunks/{phrase-module-JZ37TB7N.mjs → phrase-module-QK22HSQ2.mjs} +2 -2
- package/dist/react-native/chunks/{pool-RTGXJXPU.mjs → pool-JR3NJCAF.mjs} +1 -1
- package/dist/react-native/chunks/restore-hooks-IBGIY3DR.mjs +127 -0
- package/dist/react-native/chunks/restore-queue-ZZX54AH7.mjs +55 -0
- package/dist/react-native/chunks/{retention-PPCTP2VY.mjs → retention-EW4TTDFB.mjs} +29 -25
- package/dist/react-native/chunks/{runtime-KUATOLYB.mjs → runtime-R5E3TB3J.mjs} +1 -1
- package/dist/react-native/chunks/{snapshot-ZBIEOZTZ.mjs → snapshot-REYVIN3X.mjs} +80 -44
- package/dist/react-native/chunks/start-BQK6KN3R.mjs +38 -0
- package/dist/react-native/chunks/{write-2W4FTX7J.mjs → write-FQAYCZF5.mjs} +27 -24
- package/dist/react-native/partial-words.mjs +11 -9
- package/dist/react-native/pattern.mjs +4 -4
- package/dist/react-native/query-suggestions.mjs +260 -0
- package/dist/react-native/sync.mjs +78 -15
- package/dist/react-native/synonyms.mjs +95 -27
- package/dist/react.d.ts +11 -11
- package/dist/react.mjs +1 -0
- package/dist/{rerank-IZOB6NII.mjs → rerank-MQ37IYRV.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/restore-hooks-CDERDEF4.mjs +153 -0
- package/dist/restore-queue-7NNSTROA.mjs +55 -0
- package/dist/retention-QSVBBNRM.mjs +66 -0
- package/dist/{runtime-UZOC3NPY.mjs → runtime-COIUORCN.mjs} +5 -5
- package/dist/{schema-DDauvDOv.d.ts → schema-Jwt928nJ.d.ts} +1 -1
- package/dist/server.d.ts +108 -12
- package/dist/server.mjs +303 -50
- package/dist/{snapshot-NFX2EYN2.mjs → snapshot-RH4NSKIZ.mjs} +98 -61
- package/dist/start-MCKCOGIW.mjs +66 -0
- package/dist/sync/filesystem.d.ts +4 -4
- package/dist/sync/filesystem.mjs +6 -6
- package/dist/sync/indexeddb.d.ts +4 -4
- package/dist/sync/indexeddb.mjs +2 -2
- package/dist/sync.browser.mjs +74 -11
- package/dist/sync.d.ts +5 -5
- package/dist/sync.mjs +78 -16
- package/dist/synonyms.mjs +9 -8
- package/dist/{tasks-BShx8pdK.d.ts → tasks-qrJojgST.d.ts} +13 -5
- package/dist/thread-O4SBJJJS.mjs +50 -0
- package/dist/{types-SnO7_tAI.d.ts → types-BZCGjfLn.d.ts} +2 -3
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +8 -8
- package/dist/workers/entry.mjs +19 -8
- package/dist/{write-FGB62BHQ.mjs → write-3FK7NG3Y.mjs} +40 -33
- package/openapi.json +798 -7
- package/package.json +32 -8
- package/dist/browser/import-YI5GNB4H.mjs +0 -17
- package/dist/browser/operations-WVYLF72Q.mjs +0 -5
- package/dist/browser/restore-queue-TYIGDL5L.mjs +0 -41
- package/dist/chunk-37IVJLP6.mjs +0 -44
- package/dist/chunk-DJHHF2L5.mjs +0 -17
- package/dist/direct-executor-FI5GJHWX.mjs +0 -29
- package/dist/engine-DYu-e0oR.d.ts +0 -674
- package/dist/import-SRBNC6TE.mjs +0 -49
- package/dist/operations-PGOAY2KS.mjs +0 -5
- package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +0 -25
- package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +0 -3
- package/dist/react-native/chunks/import-JYBMEJPQ.mjs +0 -29
- package/dist/react-native/chunks/module-QT5HZAY4.mjs +0 -33
- package/dist/react-native/chunks/operations-RYKTSZQA.mjs +0 -5
- package/dist/react-native/chunks/restore-queue-ZBVIKJWI.mjs +0 -41
- package/dist/restore-queue-COI2GSSK.mjs +0 -41
- package/dist/retention-55WA7GPU.mjs +0 -58
- package/dist/thread-P2G2FWM2.mjs +0 -44
|
@@ -1,46 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { vectorsPerFile } from './chunk-
|
|
1
|
+
import { restoredConfigFields, restoredEmbedding, rejectSnapshot } from './chunk-LZSLNSUN.mjs';
|
|
2
|
+
import { indexMetadataOf, writeCheckpointSegments, writeLiveVectors, commitCheckpointManifest, SINGLE_NODE_PRIMARY_TERM, partitionContentsOf, unpackIndexSnapshotEnvelope, encodeSegmentManifest, loadSegmentedCheckpoint, writeMetadataEnvelope, readVectorFile, readGraphParts, documentsOfPayloadV2, deserializePayloadV1 } from './chunk-PDRWWPKV.mjs';
|
|
3
|
+
import { vectorsPerFile } from './chunk-SK2PWYDH.mjs';
|
|
4
4
|
import './chunk-HJBJBH26.mjs';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import './chunk-ENLMYKSX.mjs';
|
|
6
|
+
import './chunk-CKNRFDTZ.mjs';
|
|
7
|
+
import { readSegmentFile } from './chunk-3JWDECAZ.mjs';
|
|
8
|
+
import './chunk-QUKQNI3H.mjs';
|
|
9
|
+
import { DEFAULT_COMPACTION_THRESHOLD } from './chunk-F753DA54.mjs';
|
|
10
|
+
import { requireRestoreMemory, earlierSnapshotFootprint, storedBytesOfSegments, archiveFootprint } from './chunk-G43IPIDG.mjs';
|
|
7
11
|
import { MAX_SNAPSHOT_ANALYSIS_ATTEMPTS } from './chunk-PB2YXVQW.mjs';
|
|
8
|
-
import { ARCHIVE_CONFIG_ENTRY, ARCHIVE_MANIFEST_ENTRY, tarEnd, readSnapshotArchive, tarEntryHeaders, tarPadding, ARCHIVE_FILE_CHUNK_BYTES } from './chunk-3XKMRNRE.mjs';
|
|
9
|
-
import { decodeSegmentManifest } from './chunk-UWDNZDWK.mjs';
|
|
10
12
|
import { createByteReader } from './chunk-NVVRSRX5.mjs';
|
|
13
|
+
import { ARCHIVE_CONFIG_ENTRY, ARCHIVE_MANIFEST_ENTRY, tarEnd, readSnapshotArchive, tarEntryHeaders, tarPadding, ARCHIVE_FILE_CHUNK_BYTES } from './chunk-NB3LP33V.mjs';
|
|
14
|
+
import { decodeSegmentManifest } from './chunk-4JYO3JD2.mjs';
|
|
15
|
+
import { decodeVectorIndexParts, vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION, bytesToVectors } from './chunk-DVDX4SDR.mjs';
|
|
16
|
+
import { manifestKey, manifestFileRefs } from './chunk-6WA3C3DV.mjs';
|
|
11
17
|
import { newSyncEpoch } from './chunk-JWUCMVRK.mjs';
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import { encodeIndexConfiguration, ARRAY_POSITION_GAP, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateRequiredFieldsInSchema, validateEmbeddingConfig, storedArrayPositionGap, prepareStoredSynonyms, loadVectorCodeFor, decodeEveryStoredDocument, isCompositePartition, arrayPositionsAreStale, insertDocumentVectors } from './chunk-63YSZOXB.mjs';
|
|
17
|
-
import './chunk-IO2SMUQD.mjs';
|
|
18
|
-
import './chunk-NCJS3WIY.mjs';
|
|
19
|
-
import './chunk-AM7RSBPF.mjs';
|
|
18
|
+
import { storedStateOf } from './chunk-ZLWVW734.mjs';
|
|
19
|
+
import './chunk-ZXZFN7FI.mjs';
|
|
20
|
+
import { oneSyncChangeAtATime } from './chunk-Q32DDFKX.mjs';
|
|
21
|
+
import { encodeIndexConfiguration, ARRAY_POSITION_GAP, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateRequiredFieldsInSchema, validateEmbeddingConfig, storedArrayPositionGap, prepareStoredSynonyms, loadSchemaCodeFor, decodeEveryStoredDocument, isCompositePartition, arrayPositionsAreStale, insertDocumentVectors } from './chunk-MIP4SOR6.mjs';
|
|
20
22
|
import './chunk-NNE4VDMM.mjs';
|
|
23
|
+
import './chunk-IO2SMUQD.mjs';
|
|
24
|
+
import './chunk-YZW4CHM6.mjs';
|
|
21
25
|
import './chunk-LU3Y3P63.mjs';
|
|
22
|
-
import './chunk-
|
|
23
|
-
import
|
|
26
|
+
import './chunk-AM7RSBPF.mjs';
|
|
27
|
+
import './chunk-MVXELMJX.mjs';
|
|
28
|
+
import './chunk-RDWG33MM.mjs';
|
|
29
|
+
import { raiseEarlierReleaseGraphSetting, validateVectorPromotion, validateVectorStorage, validateTextStorage, parseVectorDimension } from './chunk-GXX3DQXP.mjs';
|
|
24
30
|
import './chunk-UNUFZ2QY.mjs';
|
|
25
31
|
import './chunk-3NQOVO3K.mjs';
|
|
26
32
|
import { emitSyncChange } from './chunk-JDOEEMEF.mjs';
|
|
27
|
-
import './chunk-
|
|
28
|
-
import
|
|
29
|
-
import {
|
|
30
|
-
import { hasNrslMagic, HEADER_SIZE, readHeader, decodeIndexConfiguration } from './chunk-C2H2QQFW.mjs';
|
|
33
|
+
import './chunk-2PRHILX3.mjs';
|
|
34
|
+
import './chunk-PJHAB5ZY.mjs';
|
|
35
|
+
import { hasNrslMagic, HEADER_SIZE, readHeader, decodeIndexConfiguration } from './chunk-YH7QY657.mjs';
|
|
31
36
|
import './chunk-CHPTFFJM.mjs';
|
|
32
|
-
import { validateSchema, flattenSchema } from './chunk-
|
|
33
|
-
import
|
|
34
|
-
import './chunk-
|
|
35
|
-
import
|
|
36
|
-
import './chunk-
|
|
37
|
-
import './chunk-
|
|
37
|
+
import { validateSchema, flattenSchema } from './chunk-DNXOMPAQ.mjs';
|
|
38
|
+
import './chunk-5CQX3XXV.mjs';
|
|
39
|
+
import { MAX_FILE_BYTES } from './chunk-6VBXNFLE.mjs';
|
|
40
|
+
import './chunk-C5G6TJ7A.mjs';
|
|
41
|
+
import { getLanguage, resolveIndexAnalysis } from './chunk-MJDQU5MW.mjs';
|
|
42
|
+
import './chunk-3WI35N75.mjs';
|
|
43
|
+
import './chunk-EJ33LCHV.mjs';
|
|
44
|
+
import './chunk-FHPW7P2O.mjs';
|
|
45
|
+
import './chunk-DXRSEWA2.mjs';
|
|
38
46
|
import './chunk-LVIKKAA6.mjs';
|
|
39
47
|
import './chunk-AAAETEJK.mjs';
|
|
40
|
-
import './chunk-
|
|
41
|
-
import './chunk-
|
|
42
|
-
import './chunk-IOY2SM2P.mjs';
|
|
43
|
-
import { NarsilError, ErrorCodes } from './chunk-CUNGPR5R.mjs';
|
|
48
|
+
import './chunk-FTZHMRD2.mjs';
|
|
49
|
+
import { NarsilError, ErrorCodes } from './chunk-DZ7H7D2C.mjs';
|
|
44
50
|
import { decode } from '@msgpack/msgpack';
|
|
45
51
|
|
|
46
52
|
// src/persistence/archive/memory-store.ts
|
|
@@ -216,6 +222,9 @@ async function* archiveChunks(source) {
|
|
|
216
222
|
for (const ref of manifestFileRefs(source.manifest)) {
|
|
217
223
|
yield* fileEntryChunks(source, ref.key.slice(prefix.length), ref);
|
|
218
224
|
}
|
|
225
|
+
if (source.trailingEntries !== void 0) {
|
|
226
|
+
for await (const entry of source.trailingEntries()) yield* entryChunks(entry.name, entry.bytes);
|
|
227
|
+
}
|
|
219
228
|
yield tarEnd();
|
|
220
229
|
}
|
|
221
230
|
function archiveStream(source) {
|
|
@@ -294,7 +303,7 @@ async function validateStagedCheckpoint(store, manifest) {
|
|
|
294
303
|
for (const ref of partition.segments) {
|
|
295
304
|
const { directory } = store;
|
|
296
305
|
if (directory !== void 0) {
|
|
297
|
-
const { checkPagedSegmentFully, isPagedSegmentFile } = await import('./module-
|
|
306
|
+
const { checkPagedSegmentFully, isPagedSegmentFile } = await import('./module-LBZPGOWH.mjs');
|
|
298
307
|
if (await isPagedSegmentFile(directory, ref.key)) {
|
|
299
308
|
requireSchemaOfManifest(ref.key, await checkPagedSegmentFully(directory, ref), manifest);
|
|
300
309
|
continue;
|
|
@@ -391,7 +400,8 @@ function prepareRestoredIndex(configuration, deps, reject) {
|
|
|
391
400
|
storedRevision,
|
|
392
401
|
analysisGeneration,
|
|
393
402
|
storedArrayPositionGap: storedArrayPositionGap(configuration.arrayPositionGap),
|
|
394
|
-
synonyms
|
|
403
|
+
synonyms,
|
|
404
|
+
querySuggestions: storedStateOf(configuration)
|
|
395
405
|
};
|
|
396
406
|
}
|
|
397
407
|
function restoredSynonyms(raw, config, language, reject) {
|
|
@@ -399,8 +409,8 @@ function restoredSynonyms(raw, config, language, reject) {
|
|
|
399
409
|
return prepareStoredSynonyms(raw, config, language, (message) => reject(`synonyms: ${message}`));
|
|
400
410
|
}
|
|
401
411
|
async function prepareDetachedIndex(indexName, prepared, partitionCount, deps) {
|
|
402
|
-
const
|
|
403
|
-
if (
|
|
412
|
+
const loadingSchemaCode = loadSchemaCodeFor(prepared.config.schema);
|
|
413
|
+
if (loadingSchemaCode !== null) await loadingSchemaCode;
|
|
404
414
|
const detached = createDetachedIndex(
|
|
405
415
|
indexName,
|
|
406
416
|
prepared.config,
|
|
@@ -428,7 +438,8 @@ function restoredRegistryEntry(prepared, manager, deps) {
|
|
|
428
438
|
analysisGeneration: prepared.analysisGeneration,
|
|
429
439
|
pendingAnalysis: null,
|
|
430
440
|
durableAnalysis: null,
|
|
431
|
-
sync: null
|
|
441
|
+
sync: null,
|
|
442
|
+
querySuggestions: prepared.querySuggestions
|
|
432
443
|
};
|
|
433
444
|
}
|
|
434
445
|
|
|
@@ -541,6 +552,7 @@ async function replaceExisting(indexName, restored, entry, deps) {
|
|
|
541
552
|
for (const vectorIndex of vectorIndexes) await vectorIndex.releaseVectorFiles();
|
|
542
553
|
await commitToStorage(indexName, restored, previous?.partitionCount ?? 0, deps);
|
|
543
554
|
activate(indexName, restored, entry, deps);
|
|
555
|
+
await deps.querySuggestions?.afterActivate(entry);
|
|
544
556
|
});
|
|
545
557
|
} finally {
|
|
546
558
|
const ending = endRelease(indexName, release, deps).catch(() => void 0);
|
|
@@ -555,6 +567,7 @@ async function createFresh(indexName, restored, entry, deps) {
|
|
|
555
567
|
await deps.indexState.registerReplacing(indexName, async () => {
|
|
556
568
|
await commitToStorage(indexName, restored, 0, deps);
|
|
557
569
|
activate(indexName, restored, entry, deps);
|
|
570
|
+
await deps.querySuggestions?.afterActivate(entry);
|
|
558
571
|
});
|
|
559
572
|
} catch (error) {
|
|
560
573
|
if (deps.indexRegistry.get(indexName) === entry) deps.indexRegistry.delete(indexName);
|
|
@@ -567,12 +580,14 @@ async function stageMetadata(indexName, staging, entry) {
|
|
|
567
580
|
const metadata = indexMetadataOf(indexName, entry, entry.partitionCount);
|
|
568
581
|
await staging.store.write(`${indexName}/meta`, [await writeMetadataEnvelope(metadata, { checksum: true })]);
|
|
569
582
|
}
|
|
570
|
-
async function installRestoredIndex(indexName, restored, deps) {
|
|
583
|
+
async function installRestoredIndex(indexName, restored, deps, history = null) {
|
|
571
584
|
const entry = restoredRegistryEntry(restored.prepared, restored.detached.manager, deps);
|
|
572
585
|
const previousSync = deps.indexRegistry.get(indexName)?.sync ?? null;
|
|
573
586
|
if (previousSync !== null) entry.sync = { ...previousSync, active: false, epoch: newSyncEpoch() };
|
|
574
587
|
let replaced;
|
|
575
588
|
try {
|
|
589
|
+
if (deps.indexRegistry.has(indexName)) await deps.abandonAnalysisChange(indexName);
|
|
590
|
+
await deps.querySuggestions?.beforeInstall(entry, deps.indexRegistry.get(indexName));
|
|
576
591
|
if (restored.staging !== null) await stageMetadata(indexName, restored.staging, entry);
|
|
577
592
|
replaced = deps.indexRegistry.get(indexName);
|
|
578
593
|
if (replaced !== void 0) await replaceExisting(indexName, restored, entry, deps);
|
|
@@ -594,6 +609,7 @@ async function installRestoredIndex(indexName, restored, deps) {
|
|
|
594
609
|
await oneSyncChangeAtATime(deps.indexRegistry, indexName, () => storage.release(indexName));
|
|
595
610
|
emitSyncChange(deps.indexRegistry, { kind: "epoch", indexName });
|
|
596
611
|
}
|
|
612
|
+
await deps.querySuggestions?.afterInstall(entry, history);
|
|
597
613
|
if (replaced !== void 0) await deps.announceIndexDropped(indexName, replaced.config);
|
|
598
614
|
await deps.announceIndexCreated(indexName, restored.prepared.config);
|
|
599
615
|
for (const vectorIndex of restored.detached.manager.getVectorIndexes().values()) {
|
|
@@ -644,9 +660,14 @@ function missingPart(what) {
|
|
|
644
660
|
function keepsTextOnDisk(prepared, staging) {
|
|
645
661
|
return prepared.config.textStorage === "disk" && staging.directory !== void 0;
|
|
646
662
|
}
|
|
647
|
-
async function stageArchive(indexName, reader, staging, deps) {
|
|
648
|
-
const staged = { prepared: null, manifest: null };
|
|
663
|
+
async function stageArchive(indexName, reader, staging, deps, staged) {
|
|
649
664
|
await readSnapshotArchive(reader, {
|
|
665
|
+
history: async (chunks) => {
|
|
666
|
+
if (staged.history === void 0) {
|
|
667
|
+
staged.history = await deps.querySuggestions?.historySink(staged.prepared?.querySuggestions ?? null) ?? null;
|
|
668
|
+
}
|
|
669
|
+
await staged.history?.add(chunks);
|
|
670
|
+
},
|
|
650
671
|
config: async (bytes) => {
|
|
651
672
|
staged.prepared = prepareRestoredIndex(await decodeIndexConfiguration(bytes), deps, rejectConfiguration);
|
|
652
673
|
},
|
|
@@ -672,7 +693,7 @@ async function stageArchive(indexName, reader, staging, deps) {
|
|
|
672
693
|
if (manifest === null) missingPart("manifest");
|
|
673
694
|
const { directory } = staging;
|
|
674
695
|
if (keepsTextOnDisk(prepared, staging) && directory !== void 0) {
|
|
675
|
-
const { bytesThatSegmentsHoldInMemory } = await import('./module-
|
|
696
|
+
const { bytesThatSegmentsHoldInMemory } = await import('./module-LBZPGOWH.mjs');
|
|
676
697
|
const replacesIndex = deps.indexRegistry.has(indexName);
|
|
677
698
|
const segmentBytes = await bytesThatSegmentsHoldInMemory(directory, manifest);
|
|
678
699
|
requireRestoreMemory(indexName, archiveFootprint(prepared, manifest, replacesIndex, segmentBytes), replacesIndex);
|
|
@@ -701,9 +722,14 @@ async function loadStagedIndex(indexName, staged, staging, store, deps) {
|
|
|
701
722
|
async function restoreArchive(indexName, reader, deps) {
|
|
702
723
|
const staging = deps.durability?.manager.stageRestore?.(indexName) ?? null;
|
|
703
724
|
const store = staging?.store ?? memoryCheckpointStore();
|
|
725
|
+
const archive = { prepared: null, manifest: null, history: void 0 };
|
|
704
726
|
try {
|
|
705
|
-
const staged = await stageArchive(indexName, reader, store, deps);
|
|
706
|
-
|
|
727
|
+
const staged = await stageArchive(indexName, reader, store, deps, archive);
|
|
728
|
+
const restored = await loadStagedIndex(indexName, staged, staging, store, deps);
|
|
729
|
+
await installRestoredIndex(indexName, restored, deps, archive.history ?? null);
|
|
730
|
+
} catch (error) {
|
|
731
|
+
await archive.history?.abandon().catch(() => void 0);
|
|
732
|
+
throw error;
|
|
707
733
|
} finally {
|
|
708
734
|
await staging?.discard().catch(() => void 0);
|
|
709
735
|
await reader.close();
|
|
@@ -858,13 +884,23 @@ async function checkpointForArchive(deps) {
|
|
|
858
884
|
partitionId: null
|
|
859
885
|
});
|
|
860
886
|
}
|
|
861
|
-
async function
|
|
887
|
+
async function* queryHistoryEntries(core, indexName) {
|
|
888
|
+
const { historyArchiveEntries } = await import('./archive-history-MJKUQLSU.mjs');
|
|
889
|
+
yield* historyArchiveEntries(core, indexName);
|
|
890
|
+
}
|
|
891
|
+
async function createSnapshot(deps, coreWithAddedHistory) {
|
|
892
|
+
const trailingEntries = coreWithAddedHistory === null ? void 0 : () => queryHistoryEntries(coreWithAddedHistory, deps.indexName);
|
|
862
893
|
for (let attempt = 0; attempt < MAX_SNAPSHOT_ANALYSIS_ATTEMPTS; attempt += 1) {
|
|
863
894
|
const checkpoint = await checkpointForArchive(deps);
|
|
864
895
|
try {
|
|
865
896
|
if ((checkpoint.manifest.analysisGeneration ?? 0) === deps.entry.analysisGeneration) {
|
|
866
897
|
const config = await encodeIndexConfiguration(deps.entry);
|
|
867
|
-
return archiveStream({
|
|
898
|
+
return archiveStream({
|
|
899
|
+
...checkpoint,
|
|
900
|
+
config,
|
|
901
|
+
sourceIndexName: deps.indexName,
|
|
902
|
+
...trailingEntries !== void 0 ? { trailingEntries } : {}
|
|
903
|
+
});
|
|
868
904
|
}
|
|
869
905
|
} catch (error) {
|
|
870
906
|
checkpoint.release();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { localRuntimeOf } from './chunk-UQ4OAXKU.mjs';
|
|
2
|
+
import './chunk-KV46CT4D.mjs';
|
|
3
|
+
import './chunk-TP6KCKER.mjs';
|
|
4
|
+
import './chunk-ZZT7CEN7.mjs';
|
|
5
|
+
import './chunk-DIYDOIM4.mjs';
|
|
6
|
+
import './chunk-H3MDVPBO.mjs';
|
|
7
|
+
import './chunk-ZXZFN7FI.mjs';
|
|
8
|
+
import './chunk-PSWKQVVT.mjs';
|
|
9
|
+
import './chunk-Q32DDFKX.mjs';
|
|
10
|
+
import './chunk-MIP4SOR6.mjs';
|
|
11
|
+
import './chunk-NNE4VDMM.mjs';
|
|
12
|
+
import './chunk-IO2SMUQD.mjs';
|
|
13
|
+
import './chunk-YZW4CHM6.mjs';
|
|
14
|
+
import './chunk-LU3Y3P63.mjs';
|
|
15
|
+
import './chunk-AM7RSBPF.mjs';
|
|
16
|
+
import './chunk-MVXELMJX.mjs';
|
|
17
|
+
import './chunk-RDWG33MM.mjs';
|
|
18
|
+
import './chunk-GXX3DQXP.mjs';
|
|
19
|
+
import './chunk-UNUFZ2QY.mjs';
|
|
20
|
+
import './chunk-3NQOVO3K.mjs';
|
|
21
|
+
import './chunk-JDOEEMEF.mjs';
|
|
22
|
+
import './chunk-2PRHILX3.mjs';
|
|
23
|
+
import './chunk-PJHAB5ZY.mjs';
|
|
24
|
+
import './chunk-YH7QY657.mjs';
|
|
25
|
+
import './chunk-CHPTFFJM.mjs';
|
|
26
|
+
import './chunk-DNXOMPAQ.mjs';
|
|
27
|
+
import './chunk-5CQX3XXV.mjs';
|
|
28
|
+
import './chunk-6VBXNFLE.mjs';
|
|
29
|
+
import './chunk-C5G6TJ7A.mjs';
|
|
30
|
+
import './chunk-MJDQU5MW.mjs';
|
|
31
|
+
import './chunk-3WI35N75.mjs';
|
|
32
|
+
import './chunk-EJ33LCHV.mjs';
|
|
33
|
+
import './chunk-FHPW7P2O.mjs';
|
|
34
|
+
import './chunk-DXRSEWA2.mjs';
|
|
35
|
+
import './chunk-LVIKKAA6.mjs';
|
|
36
|
+
import './chunk-AAAETEJK.mjs';
|
|
37
|
+
import './chunk-FTZHMRD2.mjs';
|
|
38
|
+
import './chunk-DZ7H7D2C.mjs';
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
import { DOCUMENT_EXPORT_VERSION, DOCUMENT_EXPORT_FORMAT } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { DOCUMENT_EXPORT_VERSION, DOCUMENT_EXPORT_FORMAT } from './chunk-VWUDIOT6.mjs';
|
|
2
|
+
import './chunk-LZSLNSUN.mjs';
|
|
3
|
+
import { encodeExactJson, encodeDocumentJson } from './chunk-WBYQRHDY.mjs';
|
|
4
|
+
import './chunk-4J74WHQM.mjs';
|
|
5
|
+
import { setNestedValue, KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment } from './chunk-QUKQNI3H.mjs';
|
|
3
6
|
import './chunk-NVVRSRX5.mjs';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import './chunk-NKIZX26F.mjs';
|
|
7
|
-
import { decodeStoredDocument } from './chunk-63YSZOXB.mjs';
|
|
8
|
-
import './chunk-IO2SMUQD.mjs';
|
|
9
|
-
import './chunk-NCJS3WIY.mjs';
|
|
10
|
-
import { EXPORT_CHUNK_BYTES } from './chunk-AM7RSBPF.mjs';
|
|
7
|
+
import { decodeVectorFilePayload, isDead, bytesToVectors } from './chunk-DVDX4SDR.mjs';
|
|
8
|
+
import { decodeStoredDocument } from './chunk-MIP4SOR6.mjs';
|
|
11
9
|
import './chunk-NNE4VDMM.mjs';
|
|
10
|
+
import './chunk-IO2SMUQD.mjs';
|
|
11
|
+
import './chunk-YZW4CHM6.mjs';
|
|
12
12
|
import './chunk-LU3Y3P63.mjs';
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
13
|
+
import { EXPORT_CHUNK_BYTES } from './chunk-AM7RSBPF.mjs';
|
|
14
|
+
import './chunk-MVXELMJX.mjs';
|
|
15
|
+
import './chunk-RDWG33MM.mjs';
|
|
16
|
+
import './chunk-GXX3DQXP.mjs';
|
|
15
17
|
import './chunk-UNUFZ2QY.mjs';
|
|
16
18
|
import './chunk-3NQOVO3K.mjs';
|
|
17
19
|
import './chunk-JDOEEMEF.mjs';
|
|
18
|
-
import './chunk-
|
|
19
|
-
import {
|
|
20
|
-
import { openChecksummedEnvelope } from './chunk-C2H2QQFW.mjs';
|
|
20
|
+
import './chunk-2PRHILX3.mjs';
|
|
21
|
+
import { openChecksummedEnvelope } from './chunk-YH7QY657.mjs';
|
|
21
22
|
import './chunk-CHPTFFJM.mjs';
|
|
22
|
-
import './chunk-
|
|
23
|
-
import './chunk-
|
|
24
|
-
import './chunk-
|
|
25
|
-
import './chunk-
|
|
26
|
-
import './chunk-
|
|
27
|
-
import './chunk-
|
|
23
|
+
import './chunk-DNXOMPAQ.mjs';
|
|
24
|
+
import './chunk-5CQX3XXV.mjs';
|
|
25
|
+
import './chunk-6VBXNFLE.mjs';
|
|
26
|
+
import './chunk-C5G6TJ7A.mjs';
|
|
27
|
+
import './chunk-MJDQU5MW.mjs';
|
|
28
|
+
import './chunk-3WI35N75.mjs';
|
|
29
|
+
import './chunk-EJ33LCHV.mjs';
|
|
30
|
+
import './chunk-FHPW7P2O.mjs';
|
|
31
|
+
import './chunk-DXRSEWA2.mjs';
|
|
28
32
|
import './chunk-LVIKKAA6.mjs';
|
|
29
33
|
import './chunk-AAAETEJK.mjs';
|
|
30
|
-
import './chunk-
|
|
31
|
-
import './chunk-
|
|
32
|
-
import './chunk-CUNGPR5R.mjs';
|
|
34
|
+
import './chunk-FTZHMRD2.mjs';
|
|
35
|
+
import './chunk-DZ7H7D2C.mjs';
|
|
33
36
|
import { decode } from '@msgpack/msgpack';
|
|
34
37
|
|
|
35
38
|
var VECTOR_FILE_ENVELOPE_VERSION = 2;
|
|
@@ -111,7 +114,7 @@ async function wholeFileVectorReads(checkpoint) {
|
|
|
111
114
|
};
|
|
112
115
|
}
|
|
113
116
|
async function* pagedDocumentLines(checkpoint) {
|
|
114
|
-
const { openFileVectorReads, pagedPartitionLines } = await import('./module-
|
|
117
|
+
const { openFileVectorReads, pagedPartitionLines } = await import('./module-LBZPGOWH.mjs');
|
|
115
118
|
const vectors = await openFileVectorReads(checkpoint, () => wholeFileVectorReads(checkpoint));
|
|
116
119
|
try {
|
|
117
120
|
for (const partition of checkpoint.manifest.partitions) {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { spellingCountsOf, encodePartialSpellings, countSpelling, PARTIAL_WORD_RUN_CODE_POINTS, FROZEN_PARTIAL_REMOVED_ENTRY_BYTES, sameFields, countDocumentSpellings, GROWING_PARTIAL_ENTRY_BYTES, GROWING_PARTIAL_RUN_BYTES, GROWING_PARTIAL_RUN_MEMBER_BYTES, GROWING_PARTIAL_PENDING_ENTRY_BYTES, partitionDocumentFrequency, visitDocumentSpellings, visitDocumentSurfaceSpellings, codePointCountOf, GROWING_PARTIAL_PENDING_ENTRIES_PER_ENTRY } from './chunks/chunk-
|
|
1
|
+
import { spellingCountsOf, encodePartialSpellings, countSpelling, PARTIAL_WORD_RUN_CODE_POINTS, FROZEN_PARTIAL_REMOVED_ENTRY_BYTES, sameFields, countDocumentSpellings, GROWING_PARTIAL_ENTRY_BYTES, GROWING_PARTIAL_RUN_BYTES, GROWING_PARTIAL_RUN_MEMBER_BYTES, GROWING_PARTIAL_PENDING_ENTRY_BYTES, partitionDocumentFrequency, visitDocumentSpellings, visitDocumentSurfaceSpellings, codePointCountOf, GROWING_PARTIAL_PENDING_ENTRIES_PER_ENTRY } from './chunks/chunk-GXX3DQXP.mjs';
|
|
2
2
|
import { fuzzyTermMatches } from './chunks/chunk-UNUFZ2QY.mjs';
|
|
3
|
-
import { encodeStringBlob, tokenize, resolveStopWords, transformToken } from './chunks/chunk-
|
|
4
|
-
import './chunks/chunk-
|
|
5
|
-
import './chunks/chunk-
|
|
6
|
-
import './chunks/chunk-
|
|
7
|
-
import './chunks/chunk-
|
|
8
|
-
import
|
|
3
|
+
import { encodeStringBlob, tokenize, resolveStopWords, transformToken } from './chunks/chunk-2PRHILX3.mjs';
|
|
4
|
+
import './chunks/chunk-DNXOMPAQ.mjs';
|
|
5
|
+
import './chunks/chunk-5CQX3XXV.mjs';
|
|
6
|
+
import './chunks/chunk-6VBXNFLE.mjs';
|
|
7
|
+
import './chunks/chunk-C5G6TJ7A.mjs';
|
|
8
|
+
import './chunks/chunk-3WI35N75.mjs';
|
|
9
|
+
import { compareCodePoints, codePointCount } from './chunks/chunk-EJ33LCHV.mjs';
|
|
10
|
+
import './chunks/chunk-DXRSEWA2.mjs';
|
|
9
11
|
import { PARTIAL_WORD_MIN_CODE_POINTS, PARTIAL_WORDS_ADDED_PER_QUERY, DEFAULT_FUZZY_PREFIX_LENGTH } from './chunks/chunk-AAAETEJK.mjs';
|
|
10
|
-
import './chunks/chunk-
|
|
11
|
-
import './chunks/chunk-
|
|
12
|
+
import './chunks/chunk-FTZHMRD2.mjs';
|
|
13
|
+
import './chunks/chunk-DZ7H7D2C.mjs';
|
|
12
14
|
|
|
13
15
|
// src/core/partition/partial-words/text.ts
|
|
14
16
|
var encoder = new TextEncoder();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PATTERN_RUN_CODE_POINTS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, MAX_PATTERN_POSITIONS, MATCHER_STATE_OVERHEAD_BYTES, MAX_PATTERN_TOLERANCE, PATTERN_EXPRESSION_OPERATORS, invalid, MAX_PATTERN_TEXT_CODE_POINTS, TYPO_CLAIM_SLOTS_PER_WORD, MATCHER_CODE_POINT_BYTES, MATCHER_SIMULATION_BYTES_PER_POSITION } from './chunks/chunk-
|
|
1
|
+
import { PATTERN_RUN_CODE_POINTS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, MAX_PATTERN_POSITIONS, MATCHER_STATE_OVERHEAD_BYTES, MAX_PATTERN_TOLERANCE, PATTERN_EXPRESSION_OPERATORS, invalid, MAX_PATTERN_TEXT_CODE_POINTS, TYPO_CLAIM_SLOTS_PER_WORD, MATCHER_CODE_POINT_BYTES, MATCHER_SIMULATION_BYTES_PER_POSITION } from './chunks/chunk-RDWG33MM.mjs';
|
|
2
2
|
import { tabulatedLevenshtein } from './chunks/chunk-UNUFZ2QY.mjs';
|
|
3
|
-
import './chunks/chunk-
|
|
4
|
-
import { codePointCount, exceedsCodePoints } from './chunks/chunk-
|
|
3
|
+
import './chunks/chunk-C5G6TJ7A.mjs';
|
|
4
|
+
import { codePointCount, exceedsCodePoints } from './chunks/chunk-EJ33LCHV.mjs';
|
|
5
5
|
import { bitsetHas, bitsetSet, GrowableUint32, createBitSet, bitsetAnd, bitsetNot } from './chunks/chunk-LVIKKAA6.mjs';
|
|
6
|
-
import { NarsilError, ErrorCodes } from './chunks/chunk-
|
|
6
|
+
import { NarsilError, ErrorCodes } from './chunks/chunk-DZ7H7D2C.mjs';
|
|
7
7
|
|
|
8
8
|
// src/pattern/constants.ts
|
|
9
9
|
var MATCHER_TRANSITION_BYTES = 48;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { normaliseBan, banListFromInput, withState } from './chunks/chunk-ZLWVW734.mjs';
|
|
2
|
+
import { suggestionsIndexName, markedSuggestionIndexes, ensureSuggestionsIndex, suggestionDocument, ORIGIN_MANUAL, removeSuggestions, enabledSetting, mergeHistory, groupsToWrite, meetsMinResults, localRuntimeOf } from './chunks/chunk-UQ4OAXKU.mjs';
|
|
3
|
+
import './chunks/chunk-KV46CT4D.mjs';
|
|
4
|
+
import './chunks/chunk-TP6KCKER.mjs';
|
|
5
|
+
import './chunks/chunk-ZZT7CEN7.mjs';
|
|
6
|
+
import './chunks/chunk-DIYDOIM4.mjs';
|
|
7
|
+
import './chunks/chunk-H3MDVPBO.mjs';
|
|
8
|
+
import { isGroup, invalidSetting, GROUP_FORMAT, resolveSetting, acceptedPhrase, validateSetting, requireFieldsInSchema } from './chunks/chunk-ZXZFN7FI.mjs';
|
|
9
|
+
import './chunks/chunk-PSWKQVVT.mjs';
|
|
10
|
+
import './chunks/chunk-Q32DDFKX.mjs';
|
|
11
|
+
import { engineCoreOf } from './chunks/chunk-MIP4SOR6.mjs';
|
|
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-GXX3DQXP.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-DNXOMPAQ.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
|
+
}
|
|
239
|
+
|
|
240
|
+
// src/query-suggestions/providers.ts
|
|
241
|
+
var providers = /* @__PURE__ */ new WeakMap();
|
|
242
|
+
function boundQuerySuggestionsOf(owner) {
|
|
243
|
+
return providers.get(owner);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// src/query-suggestions/index.ts
|
|
247
|
+
function querySuggestions(engine) {
|
|
248
|
+
const bound = boundQuerySuggestionsOf(engine);
|
|
249
|
+
if (bound !== void 0) return bound();
|
|
250
|
+
const core = engineCoreOf(engine);
|
|
251
|
+
if (core === void 0) {
|
|
252
|
+
throw new NarsilError(
|
|
253
|
+
ErrorCodes.CONFIG_INVALID,
|
|
254
|
+
"Popular query suggestions need an engine that createNarsil made in this process"
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
return querySuggestionsOf(() => localRuntimeOf(core, engine, void 0));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export { querySuggestions };
|