@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.
Files changed (329) hide show
  1. package/NOTICE +45 -0
  2. package/README.md +1 -0
  3. package/dist/adapters/filesystem.mjs +2 -2
  4. package/dist/adapters/gcs.mjs +2 -2
  5. package/dist/adapters/indexeddb.mjs +1 -1
  6. package/dist/adapters/s3.mjs +2 -2
  7. package/dist/{analysis-change-4GCRVRBW.mjs → analysis-change-5BQOQ4BF.mjs} +35 -28
  8. package/dist/{react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs → analysis-change-entry-TXX6JSMX.mjs} +1 -1
  9. package/dist/archive-history-E4R73RWD.mjs +29 -0
  10. package/dist/browser/{analysis-change-IXWPXXJJ.mjs → analysis-change-435CUEPZ.mjs} +32 -12
  11. package/dist/{analysis-change-entry-KYGSXW4K.mjs → browser/analysis-change-entry-HZXKPPGV.mjs} +1 -1
  12. package/dist/browser/archive-history-4IP5XQZY.mjs +29 -0
  13. package/dist/browser/{chunk-4PD752F6.mjs → chunk-23XRXIBW.mjs} +1 -1
  14. package/dist/browser/{chunk-J433A7P3.mjs → chunk-2CFI5VVV.mjs} +5 -5
  15. package/dist/{react-native/chunks/chunk-3XKMRNRE.mjs → browser/chunk-2TI4SSUP.mjs} +27 -10
  16. package/dist/browser/chunk-3SSRJMFN.mjs +100 -0
  17. package/dist/browser/{chunk-2SHAKW2Z.mjs → chunk-3V7DNNZL.mjs} +515 -733
  18. package/dist/browser/{chunk-C4KS2QNF.mjs → chunk-4NGKC4H4.mjs} +9 -9
  19. package/dist/browser/{chunk-XRV72TJD.mjs → chunk-6LWDPLTB.mjs} +2 -2
  20. package/dist/browser/chunk-7IGKGWSQ.mjs +79 -0
  21. package/dist/browser/{chunk-VCOYGVP7.mjs → chunk-7U3WVJUP.mjs} +3 -3
  22. package/dist/browser/chunk-ATEBYXP6.mjs +10 -0
  23. package/dist/browser/chunk-BHFQATSC.mjs +432 -0
  24. package/dist/browser/chunk-CRE3G7F3.mjs +1007 -0
  25. package/dist/browser/{chunk-QXTPSX2H.mjs → chunk-EA63E3D2.mjs} +7 -7
  26. package/dist/{react-native/chunks/chunk-DCKMICOB.mjs → browser/chunk-EXQZGUQH.mjs} +1 -1
  27. package/dist/browser/{chunk-ML6HY7T7.mjs → chunk-G64Q6OJF.mjs} +1 -1
  28. package/dist/browser/chunk-GPPOG6PT.mjs +9 -0
  29. package/dist/browser/{chunk-EUNBNLKM.mjs → chunk-IZXVW2ZJ.mjs} +5 -5
  30. package/dist/browser/{chunk-G7LUMBSG.mjs → chunk-K4Q6KX3R.mjs} +30 -20
  31. package/dist/browser/{chunk-H6QFBMVE.mjs → chunk-KZWSX6BH.mjs} +3 -3
  32. package/dist/browser/chunk-M3MQE2X7.mjs +151 -0
  33. package/dist/browser/chunk-MGI4BCXC.mjs +63 -0
  34. package/dist/browser/chunk-MOG4OVDK.mjs +51 -0
  35. package/dist/browser/{chunk-W5X2UFWQ.mjs → chunk-NLWTBAGB.mjs} +12 -3
  36. package/dist/browser/{chunk-AYY6PIKL.mjs → chunk-NQAME3RK.mjs} +2 -2
  37. package/dist/browser/{chunk-7MEYN7V6.mjs → chunk-NXQG7DRA.mjs} +29 -14
  38. package/dist/browser/chunk-OEDCEZXJ.mjs +92 -0
  39. package/dist/{chunk-KUZKUONM.mjs → browser/chunk-SRMZXJSL.mjs} +1 -0
  40. package/dist/browser/chunk-SSTPBZZX.mjs +1106 -0
  41. package/dist/browser/{chunk-7TTWXUH6.mjs → chunk-STOWQFT3.mjs} +3 -2
  42. package/dist/browser/{chunk-26A5JFT2.mjs → chunk-TK63WFXK.mjs} +2 -1
  43. package/dist/browser/{chunk-SJB6VIZG.mjs → chunk-U3JOQGWX.mjs} +1 -1
  44. package/dist/browser/{chunk-AJ4HHOVT.mjs → chunk-U4YDIBUT.mjs} +4 -4
  45. package/dist/browser/{chunk-2FX6ROWR.mjs → chunk-VLJQW4J6.mjs} +2986 -2986
  46. package/dist/{react-native/chunks/chunk-3O57C2ZO.mjs → browser/chunk-WI4MR75E.mjs} +2 -2
  47. package/dist/browser/{chunk-3U3QR5YP.mjs → chunk-WN464PTL.mjs} +2 -2
  48. package/dist/browser/{chunk-U2E3HMYW.mjs → chunk-XAWNZ4G2.mjs} +11 -11
  49. package/dist/browser/{cold-module-VTUGDYNY.mjs → cold-module-2EHCIV4K.mjs} +20 -18
  50. package/dist/browser/durability-config-TIYKW6XX.mjs +89 -0
  51. package/dist/browser/{durability-wiring-GL4A7KDV.mjs → durability-wiring-A7BVG2DW.mjs} +50 -153
  52. package/dist/browser/engine-hooks-E4UD67JD.mjs +17 -0
  53. package/dist/browser/geo-index-HHWGMNIS.mjs +1386 -0
  54. package/dist/browser/import-DXYB6756.mjs +19 -0
  55. package/dist/browser/{methods-LMUTS7OI.mjs → methods-KTQCSIN4.mjs} +3 -3
  56. package/dist/browser/{module-M4JNBV6V.mjs → module-NIYMEA5R.mjs} +16 -14
  57. package/dist/browser/{module-EC3FYW7N.mjs → module-TCT66FWA.mjs} +10 -9
  58. package/dist/browser/operations-OJ3BXS55.mjs +5 -0
  59. package/dist/browser/{phrase-module-NPYUVX75.mjs → phrase-module-HAT3TLZN.mjs} +2 -2
  60. package/dist/browser/{pool-WCGDZHJP.mjs → pool-3JLET5RO.mjs} +1 -1
  61. package/dist/browser/restore-hooks-YPN4ZFCY.mjs +114 -0
  62. package/dist/browser/restore-queue-G3RQGL3Y.mjs +55 -0
  63. package/dist/browser/{retention-6QMRS5VK.mjs → retention-ZWVMNC3Q.mjs} +18 -15
  64. package/dist/browser/{runtime-3EW2AGB6.mjs → runtime-OTAGEFQW.mjs} +1 -1
  65. package/dist/browser/{snapshot-DN3CRVUQ.mjs → snapshot-VEQNIE6C.mjs} +71 -36
  66. package/dist/browser/start-BM442C6R.mjs +25 -0
  67. package/dist/browser/{write-WAWAFGKQ.mjs → write-2EVMZWDE.mjs} +16 -14
  68. package/dist/{capabilities-B3Brs1Rc.d.ts → capabilities-Da4ywVVl.d.ts} +35 -3
  69. package/dist/{chunk-K4B7OH65.mjs → chunk-25KDNIZZ.mjs} +2 -2
  70. package/dist/{chunk-O43Z4MS6.mjs → chunk-2NE7VCYE.mjs} +2 -2
  71. package/dist/chunk-2UV4QBHW.mjs +1092 -0
  72. package/dist/{chunk-3Y3J4V2R.mjs → chunk-3C7MTCCI.mjs} +1 -1
  73. package/dist/{chunk-TRISKD4Q.mjs → chunk-3HYC4JRF.mjs} +2 -2
  74. package/dist/{chunk-HVYICDY3.mjs → chunk-3OH67G7R.mjs} +1 -1
  75. package/dist/{chunk-PFKM7VNZ.mjs → chunk-46KY2PJD.mjs} +30 -11
  76. package/dist/{chunk-IJU7LL7D.mjs → chunk-4KKXNJM6.mjs} +5 -5
  77. package/dist/{chunk-IQ4R2I6N.mjs → chunk-5FLRXF73.mjs} +5 -1
  78. package/dist/{chunk-BPSKLCS7.mjs → chunk-5VV4R6P7.mjs} +3017 -3017
  79. package/dist/chunk-5YNRKI2C.mjs +81 -0
  80. package/dist/chunk-6HTGOXIK.mjs +875 -0
  81. package/dist/{chunk-7HCZWC7B.mjs → chunk-6I6AYAXS.mjs} +50 -8
  82. package/dist/{chunk-C6ASEFZI.mjs → chunk-6OEGXLBX.mjs} +1 -1
  83. package/dist/{chunk-DVWYODEB.mjs → chunk-6RC4K46J.mjs} +2 -2
  84. package/dist/chunk-7GFE3PEY.mjs +40 -0
  85. package/dist/{chunk-QKZHLADX.mjs → chunk-7LXHHCXZ.mjs} +28 -19
  86. package/dist/{chunk-JUKYYXSP.mjs → chunk-7V5IUP2T.mjs} +1 -31
  87. package/dist/{react-native/chunks/chunk-7GWPJDOA.mjs → chunk-A4L7YTKX.mjs} +53 -90
  88. package/dist/{chunk-Z3TNWCI5.mjs → chunk-BU4SAIC4.mjs} +3 -3
  89. package/dist/chunk-BWZ3P4MU.mjs +20 -0
  90. package/dist/{chunk-OKX2BBNW.mjs → chunk-CITFCZKF.mjs} +5 -4
  91. package/dist/{chunk-4HWZV5MK.mjs → chunk-CSLGFPFQ.mjs} +5 -5
  92. package/dist/chunk-DP5C7YFQ.mjs +543 -0
  93. package/dist/{chunk-RVKFI3A2.mjs → chunk-DWEPMFJE.mjs} +11 -8
  94. package/dist/{chunk-LSM2YTKM.mjs → chunk-EFBDHH5P.mjs} +87 -144
  95. package/dist/{chunk-NZMAXR2S.mjs → chunk-FAKFUDZZ.mjs} +121 -11
  96. package/dist/chunk-FB6463IN.mjs +1499 -0
  97. package/dist/{chunk-REL7LFLR.mjs → chunk-FCJ553HS.mjs} +3 -3
  98. package/dist/{chunk-MMEMEUOO.mjs → chunk-FJKKCV4D.mjs} +2 -2
  99. package/dist/{chunk-K7KLL263.mjs → chunk-FNGAM5B7.mjs} +14 -13
  100. package/dist/{chunk-DMQPFLGI.mjs → chunk-FRBFVQFN.mjs} +6 -5
  101. package/dist/{chunk-IBNLW3AV.mjs → chunk-FYOVBEMM.mjs} +20 -6
  102. package/dist/chunk-G6HRSGOU.mjs +74 -0
  103. package/dist/{chunk-USR7FQRZ.mjs → chunk-GH4WQ22V.mjs} +2 -2
  104. package/dist/chunk-GQPTDQCL.mjs +54 -0
  105. package/dist/{chunk-VREK3MYG.mjs → chunk-HFPMMRQT.mjs} +3 -3
  106. package/dist/{chunk-MLHNSAPK.mjs → chunk-HHBUCIUY.mjs} +3 -3
  107. package/dist/{chunk-YROWNOMH.mjs → chunk-HJJI72X7.mjs} +1 -1
  108. package/dist/{chunk-ECX4SGX6.mjs → chunk-I2KPOLOZ.mjs} +9 -9
  109. package/dist/{chunk-TV2L3BN7.mjs → chunk-I53G4JAU.mjs} +266 -265
  110. package/dist/{chunk-3A5KI24C.mjs → chunk-I54T6CQP.mjs} +1 -1
  111. package/dist/{chunk-NTZOXVUZ.mjs → chunk-I5B7RXU7.mjs} +93 -24
  112. package/dist/{chunk-YBJDOA2T.mjs → chunk-INJYO3BU.mjs} +1 -1
  113. package/dist/{react-native/chunks/chunk-KWRW5U65.mjs → chunk-J4IJTTEX.mjs} +1 -1
  114. package/dist/{chunk-X6NSJYQ3.mjs → chunk-JDJBQLRO.mjs} +13 -13
  115. package/dist/{chunk-MMBEANB2.mjs → chunk-JWRUUCWD.mjs} +3 -3
  116. package/dist/{chunk-AO2FAYIZ.mjs → chunk-K4ZIGL2O.mjs} +1 -1
  117. package/dist/{chunk-JFNKIBDT.mjs → chunk-K5QFDYST.mjs} +2 -2
  118. package/dist/{chunk-C73JLU4E.mjs → chunk-KF4EXSM4.mjs} +2 -2
  119. package/dist/{chunk-WCBA2LVZ.mjs → chunk-KHKIRS5D.mjs} +1 -1
  120. package/dist/{chunk-7QUGDVFC.mjs → chunk-KJ3RTZDJ.mjs} +1 -1
  121. package/dist/{chunk-HVKXNBFL.mjs → chunk-KKQC526K.mjs} +20 -12
  122. package/dist/chunk-KP7TYHWT.mjs +92 -0
  123. package/dist/{chunk-VMXSVVXG.mjs → chunk-L6V6BST3.mjs} +9 -22
  124. package/dist/{chunk-URPCYQVJ.mjs → chunk-LHKOSI2J.mjs} +1 -1
  125. package/dist/chunk-LNGE7SLY.mjs +151 -0
  126. package/dist/{react-native/chunks/chunk-CUNGPR5R.mjs → chunk-MP7ABPTD.mjs} +1 -0
  127. package/dist/{chunk-5KGYQT6W.mjs → chunk-MQOJIO5B.mjs} +26 -9
  128. package/dist/{chunk-Q3TCTQCC.mjs → chunk-NF4DT3IH.mjs} +1 -1
  129. package/dist/{chunk-3OFU3NJT.mjs → chunk-OIJ64LGT.mjs} +1 -1
  130. package/dist/chunk-ORN5BLL7.mjs +11 -0
  131. package/dist/{chunk-HWEDFLB7.mjs → chunk-P5ZI2P2W.mjs} +126 -1701
  132. package/dist/{chunk-466PYR4P.mjs → chunk-PWC4VB3Q.mjs} +2 -2
  133. package/dist/{chunk-B7S6YEBP.mjs → chunk-QJVOLKU6.mjs} +12 -3
  134. package/dist/{chunk-KCUIFVVW.mjs → chunk-QOW2JPUI.mjs} +9 -9
  135. package/dist/chunk-RDXO6JST.mjs +63 -0
  136. package/dist/chunk-RLOES5SX.mjs +31 -0
  137. package/dist/{chunk-YPUEV6ZC.mjs → chunk-RVGRFOGN.mjs} +1 -1
  138. package/dist/{chunk-JCLTESFN.mjs → chunk-RZWWB2XR.mjs} +1 -1
  139. package/dist/chunk-S5LN746F.mjs +10 -0
  140. package/dist/chunk-SA5LOGO3.mjs +470 -0
  141. package/dist/chunk-SQJWAIF4.mjs +12 -0
  142. package/dist/{chunk-YTJCGKM4.mjs → chunk-TBC3XUL2.mjs} +29 -6
  143. package/dist/chunk-TDIK6NTV.mjs +10 -0
  144. package/dist/chunk-TGS5UXBE.mjs +216 -0
  145. package/dist/{chunk-CP5RRPJR.mjs → chunk-TQXHPFWT.mjs} +1 -1
  146. package/dist/{chunk-7NTMUDC5.mjs → chunk-TZ3355VS.mjs} +5 -5
  147. package/dist/{chunk-Q7MS6P2J.mjs → chunk-TZTRKM33.mjs} +2 -2
  148. package/dist/{chunk-4UMZ7KQL.mjs → chunk-U55XJEIG.mjs} +2 -1
  149. package/dist/{chunk-S2N75OTN.mjs → chunk-UHICS3JI.mjs} +1 -1
  150. package/dist/{chunk-5FUOVJKG.mjs → chunk-VTTRFF2C.mjs} +32 -19
  151. package/dist/{chunk-62G63NMH.mjs → chunk-WX4LAO6M.mjs} +4 -4
  152. package/dist/{chunk-LTUGDMV4.mjs → chunk-WZ7YV54N.mjs} +1 -1
  153. package/dist/chunk-XAXKV65G.mjs +72 -0
  154. package/dist/chunk-XXHN7J46.mjs +101 -0
  155. package/dist/{chunk-PGVPE7GJ.mjs → chunk-YEKL4JBK.mjs} +1 -1
  156. package/dist/chunk-YTWZVGCB.mjs +382 -0
  157. package/dist/chunk-Z2KAFCRT.mjs +30 -0
  158. package/dist/{chunk-LKUE5GXS.mjs → chunk-ZKP7G7TV.mjs} +2 -2
  159. package/dist/{client-Df76GNKm.d.ts → client-DRv7UVeY.d.ts} +123 -11
  160. package/dist/client.d.ts +9 -8
  161. package/dist/client.mjs +65 -3
  162. package/dist/{cold-module-YLWMTTZG.mjs → cold-module-6MO2XJF2.mjs} +45 -39
  163. package/dist/{config-B8DP2VwR.d.ts → config-CoSig5Ox.d.ts} +22 -3
  164. package/dist/{config-05G_hy-1.d.ts → config-DMwffLKn.d.ts} +20 -5
  165. package/dist/direct-executor-FTMYY3TI.mjs +34 -0
  166. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  167. package/dist/distribution/coordinator/etcd.mjs +3 -3
  168. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  169. package/dist/distribution/coordinator/in-memory.mjs +2 -2
  170. package/dist/distribution/transport/grpc.mjs +4 -4
  171. package/dist/distribution/transport/in-memory.mjs +2 -2
  172. package/dist/distribution/transport/tcp.mjs +3 -3
  173. package/dist/distribution.d.ts +8 -8
  174. package/dist/distribution.mjs +6799 -5939
  175. package/dist/durability-config-GE4U7MCZ.mjs +89 -0
  176. package/dist/{durability-wiring-RHLXDIVF.mjs → durability-wiring-VIF5MOSY.mjs} +82 -179
  177. package/dist/embeddings/openai.mjs +2 -2
  178. package/dist/{sync-uXR7MmM7.d.ts → engine-CFxPYqEk.d.ts} +702 -2
  179. package/dist/engine-hooks-EGUGNZYE.mjs +54 -0
  180. package/dist/geo-index-MRH5JMIR.mjs +1387 -0
  181. package/dist/import-XKDPJQDP.mjs +56 -0
  182. package/dist/{index-nRqDM6uS.d.ts → index-C4AmUnl1.d.ts} +1 -1
  183. package/dist/index.browser.mjs +9 -7
  184. package/dist/index.d.ts +134 -9
  185. package/dist/index.mjs +33 -26
  186. package/dist/index.react-native.mjs +20 -17
  187. package/dist/invalidation/filesystem.mjs +2 -2
  188. package/dist/{long-query-thread-EMYTGSJP.mjs → long-query-thread-YA4IAYSY.mjs} +34 -28
  189. package/dist/{methods-ABM5ELBR.mjs → methods-7IOINERF.mjs} +3 -3
  190. package/dist/{module-MG7JMV2U.mjs → module-FQ4JWNQJ.mjs} +41 -34
  191. package/dist/{module-3OMJZUFT.mjs → module-N55W4Q5C.mjs} +14 -14
  192. package/dist/operations-G5EP6JPX.mjs +5 -0
  193. package/dist/{paged-partition-archive-UOLHOEZJ.mjs → paged-partition-archive-PXW5XAYU.mjs} +48 -38
  194. package/dist/partial-words.mjs +11 -9
  195. package/dist/pattern.mjs +6 -5
  196. package/dist/persistence/durability/checkpoint-worker.d.ts +8 -1
  197. package/dist/persistence/durability/checkpoint-worker.mjs +44 -35
  198. package/dist/{phrase-module-O3MDRQXP.mjs → phrase-module-XW5MKWP5.mjs} +4 -3
  199. package/dist/{pool-CQXYPFLG.mjs → pool-Y4A46T36.mjs} +1 -1
  200. package/dist/query-suggestions/merge-worker.d.ts +55 -0
  201. package/dist/query-suggestions/merge-worker.mjs +88 -0
  202. package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
  203. package/dist/query-suggestions.browser.mjs +247 -0
  204. package/dist/query-suggestions.d.ts +20 -0
  205. package/dist/query-suggestions.mjs +69 -0
  206. package/dist/react-native/chunks/{analysis-change-EAYO3Y6Q.mjs → analysis-change-LT5QBQ3H.mjs} +43 -22
  207. package/dist/{browser/analysis-change-entry-FCSHFQSS.mjs → react-native/chunks/analysis-change-entry-SCVWK6OU.mjs} +1 -1
  208. package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +29 -0
  209. package/dist/{chunk-ZIFJXCKA.mjs → react-native/chunks/chunk-2PRHILX3.mjs} +54 -20
  210. package/dist/react-native/chunks/{chunk-VQSKZ3EZ.mjs → chunk-3JWDECAZ.mjs} +8 -8
  211. package/dist/{chunk-R6A773WK.mjs → react-native/chunks/chunk-3WI35N75.mjs} +1 -1
  212. package/dist/react-native/chunks/{chunk-75VWIY35.mjs → chunk-4DII3ZSM.mjs} +1 -1
  213. package/dist/react-native/chunks/{chunk-NKIZX26F.mjs → chunk-4J74WHQM.mjs} +2 -2
  214. package/dist/react-native/chunks/{chunk-UWDNZDWK.mjs → chunk-4JYO3JD2.mjs} +6 -6
  215. package/dist/react-native/chunks/chunk-5CQX3XXV.mjs +17 -0
  216. package/dist/react-native/chunks/chunk-6VBXNFLE.mjs +9 -0
  217. package/dist/react-native/chunks/{chunk-SJWDBRNP.mjs → chunk-6WA3C3DV.mjs} +1 -1
  218. package/dist/react-native/chunks/{chunk-OQQVRWZ2.mjs → chunk-C5G6TJ7A.mjs} +1 -1
  219. package/dist/react-native/chunks/{chunk-RVAEBN74.mjs → chunk-CKNRFDTZ.mjs} +1 -1
  220. package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +10 -0
  221. package/dist/react-native/chunks/{chunk-O32RB3BL.mjs → chunk-DNXOMPAQ.mjs} +4 -4
  222. package/dist/react-native/chunks/{chunk-YBEW6YTR.mjs → chunk-DVDX4SDR.mjs} +2 -2
  223. package/dist/react-native/chunks/chunk-DXRSEWA2.mjs +12 -0
  224. package/dist/{browser/chunk-MYITLCHT.mjs → react-native/chunks/chunk-DZ7H7D2C.mjs} +1 -0
  225. package/dist/react-native/chunks/{chunk-PPEPTUVV.mjs → chunk-EJ33LCHV.mjs} +29 -6
  226. package/dist/react-native/chunks/{chunk-RYMDHGL4.mjs → chunk-ENLMYKSX.mjs} +3045 -3075
  227. package/dist/react-native/chunks/chunk-FHPW7P2O.mjs +40 -0
  228. package/dist/react-native/chunks/{chunk-JV6VQY2S.mjs → chunk-FTZHMRD2.mjs} +2 -1
  229. package/dist/react-native/chunks/{chunk-YHKZSLOC.mjs → chunk-G43IPIDG.mjs} +5 -5
  230. package/dist/react-native/chunks/{chunk-AUT7PMA4.mjs → chunk-GXX3DQXP.mjs} +8 -22
  231. package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
  232. package/dist/react-native/chunks/{chunk-DH3TVWWK.mjs → chunk-IYNT75CE.mjs} +12 -3
  233. package/dist/react-native/chunks/chunk-KV46CT4D.mjs +1007 -0
  234. package/dist/{browser/chunk-ZPTA75ZC.mjs → react-native/chunks/chunk-LZSLNSUN.mjs} +1 -1
  235. package/dist/react-native/chunks/{chunk-63YSZOXB.mjs → chunk-MIP4SOR6.mjs} +1480 -826
  236. package/dist/react-native/chunks/{chunk-ZBSWRSBG.mjs → chunk-MJDQU5MW.mjs} +1 -1
  237. package/dist/react-native/chunks/{chunk-GFYFQLJD.mjs → chunk-MUWD2H2S.mjs} +2 -2
  238. package/dist/react-native/chunks/{chunk-IOY2SM2P.mjs → chunk-MVXELMJX.mjs} +1 -1
  239. package/dist/{browser/chunk-TTD27VXX.mjs → react-native/chunks/chunk-NB3LP33V.mjs} +27 -10
  240. package/dist/react-native/chunks/{chunk-I5PGWQJF.mjs → chunk-PDRWWPKV.mjs} +33 -24
  241. package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +79 -0
  242. package/dist/react-native/chunks/{chunk-2CGSQM4O.mjs → chunk-POPDAGH6.mjs} +13 -13
  243. package/dist/react-native/chunks/{chunk-NP7DD4G5.mjs → chunk-QUKQNI3H.mjs} +5 -5
  244. package/dist/react-native/chunks/{chunk-EH5CFV6Z.mjs → chunk-RDWG33MM.mjs} +2 -2
  245. package/dist/react-native/chunks/{chunk-JX2RIAXH.mjs → chunk-SK2PWYDH.mjs} +5 -5
  246. package/dist/react-native/chunks/{chunk-ZYDKJXQJ.mjs → chunk-SUPXRTMD.mjs} +1 -1
  247. package/dist/react-native/chunks/chunk-TP6KCKER.mjs +63 -0
  248. package/dist/react-native/chunks/{chunk-JPAJWO6D.mjs → chunk-U4KSKA4Z.mjs} +1 -1
  249. package/dist/react-native/chunks/chunk-UQ4OAXKU.mjs +1106 -0
  250. package/dist/react-native/chunks/{chunk-VVFYOADG.mjs → chunk-VWUDIOT6.mjs} +6 -6
  251. package/dist/{browser/chunk-SIR3LMTV.mjs → react-native/chunks/chunk-WBYQRHDY.mjs} +2 -2
  252. package/dist/react-native/chunks/{chunk-C2H2QQFW.mjs → chunk-YH7QY657.mjs} +3 -3
  253. package/dist/react-native/chunks/{chunk-NCJS3WIY.mjs → chunk-YZW4CHM6.mjs} +51 -12
  254. package/dist/react-native/chunks/chunk-ZLWVW734.mjs +100 -0
  255. package/dist/react-native/chunks/chunk-ZXZFN7FI.mjs +432 -0
  256. package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +92 -0
  257. package/dist/react-native/chunks/{cold-module-TJL6AFAD.mjs → cold-module-KVZYUGRY.mjs} +31 -28
  258. package/dist/react-native/chunks/durability-config-QXVZEO7T.mjs +89 -0
  259. package/dist/react-native/chunks/{durability-wiring-RRDYJLLM.mjs → durability-wiring-34OYO32E.mjs} +60 -162
  260. package/dist/react-native/chunks/engine-hooks-M7JV46NH.mjs +30 -0
  261. package/dist/react-native/chunks/geo-index-PX3BIHAH.mjs +1387 -0
  262. package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +3 -0
  263. package/dist/react-native/chunks/import-H6AQREWI.mjs +32 -0
  264. package/dist/react-native/chunks/{methods-X6F36SJE.mjs → methods-6W5U4C3H.mjs} +3 -3
  265. package/dist/react-native/chunks/module-LBZPGOWH.mjs +36 -0
  266. package/dist/react-native/chunks/{module-S4DKSWMF.mjs → module-TTEVPRCW.mjs} +14 -13
  267. package/dist/react-native/chunks/operations-GNRMD6EX.mjs +5 -0
  268. package/dist/react-native/chunks/{phrase-module-JZ37TB7N.mjs → phrase-module-QK22HSQ2.mjs} +2 -2
  269. package/dist/react-native/chunks/{pool-RTGXJXPU.mjs → pool-JR3NJCAF.mjs} +1 -1
  270. package/dist/react-native/chunks/restore-hooks-IBGIY3DR.mjs +127 -0
  271. package/dist/react-native/chunks/restore-queue-ZZX54AH7.mjs +55 -0
  272. package/dist/react-native/chunks/{retention-PPCTP2VY.mjs → retention-EW4TTDFB.mjs} +29 -25
  273. package/dist/react-native/chunks/{runtime-KUATOLYB.mjs → runtime-R5E3TB3J.mjs} +1 -1
  274. package/dist/react-native/chunks/{snapshot-ZBIEOZTZ.mjs → snapshot-REYVIN3X.mjs} +80 -44
  275. package/dist/react-native/chunks/start-BQK6KN3R.mjs +38 -0
  276. package/dist/react-native/chunks/{write-2W4FTX7J.mjs → write-FQAYCZF5.mjs} +27 -24
  277. package/dist/react-native/partial-words.mjs +11 -9
  278. package/dist/react-native/pattern.mjs +4 -4
  279. package/dist/react-native/query-suggestions.mjs +260 -0
  280. package/dist/react-native/sync.mjs +78 -15
  281. package/dist/react-native/synonyms.mjs +95 -27
  282. package/dist/react.d.ts +11 -11
  283. package/dist/react.mjs +1 -0
  284. package/dist/{rerank-IZOB6NII.mjs → rerank-MQ37IYRV.mjs} +4 -4
  285. package/dist/rerankers/http.mjs +2 -2
  286. package/dist/restore-hooks-CDERDEF4.mjs +153 -0
  287. package/dist/restore-queue-7NNSTROA.mjs +55 -0
  288. package/dist/retention-QSVBBNRM.mjs +66 -0
  289. package/dist/{runtime-UZOC3NPY.mjs → runtime-COIUORCN.mjs} +5 -5
  290. package/dist/{schema-DDauvDOv.d.ts → schema-Jwt928nJ.d.ts} +1 -1
  291. package/dist/server.d.ts +108 -12
  292. package/dist/server.mjs +303 -50
  293. package/dist/{snapshot-NFX2EYN2.mjs → snapshot-RH4NSKIZ.mjs} +98 -61
  294. package/dist/start-MCKCOGIW.mjs +66 -0
  295. package/dist/sync/filesystem.d.ts +4 -4
  296. package/dist/sync/filesystem.mjs +6 -6
  297. package/dist/sync/indexeddb.d.ts +4 -4
  298. package/dist/sync/indexeddb.mjs +2 -2
  299. package/dist/sync.browser.mjs +74 -11
  300. package/dist/sync.d.ts +5 -5
  301. package/dist/sync.mjs +78 -16
  302. package/dist/synonyms.mjs +9 -8
  303. package/dist/{tasks-BShx8pdK.d.ts → tasks-qrJojgST.d.ts} +13 -5
  304. package/dist/thread-O4SBJJJS.mjs +50 -0
  305. package/dist/{types-SnO7_tAI.d.ts → types-BZCGjfLn.d.ts} +2 -3
  306. package/dist/vector/search-worker.d.ts +1 -1
  307. package/dist/vector/search-worker.mjs +8 -8
  308. package/dist/workers/entry.mjs +19 -8
  309. package/dist/{write-FGB62BHQ.mjs → write-3FK7NG3Y.mjs} +40 -33
  310. package/openapi.json +798 -7
  311. package/package.json +32 -8
  312. package/dist/browser/import-YI5GNB4H.mjs +0 -17
  313. package/dist/browser/operations-WVYLF72Q.mjs +0 -5
  314. package/dist/browser/restore-queue-TYIGDL5L.mjs +0 -41
  315. package/dist/chunk-37IVJLP6.mjs +0 -44
  316. package/dist/chunk-DJHHF2L5.mjs +0 -17
  317. package/dist/direct-executor-FI5GJHWX.mjs +0 -29
  318. package/dist/engine-DYu-e0oR.d.ts +0 -674
  319. package/dist/import-SRBNC6TE.mjs +0 -49
  320. package/dist/operations-PGOAY2KS.mjs +0 -5
  321. package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +0 -25
  322. package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +0 -3
  323. package/dist/react-native/chunks/import-JYBMEJPQ.mjs +0 -29
  324. package/dist/react-native/chunks/module-QT5HZAY4.mjs +0 -33
  325. package/dist/react-native/chunks/operations-RYKTSZQA.mjs +0 -5
  326. package/dist/react-native/chunks/restore-queue-ZBVIKJWI.mjs +0 -41
  327. package/dist/restore-queue-COI2GSSK.mjs +0 -41
  328. package/dist/retention-55WA7GPU.mjs +0 -58
  329. package/dist/thread-P2G2FWM2.mjs +0 -44
@@ -0,0 +1,311 @@
1
+ /**
2
+ * The popular query suggestions setting of one index. Only `enabled` and
3
+ * `fields` are required, and each limit that you leave out takes its default.
4
+ *
5
+ * @public
6
+ */
7
+ interface QuerySuggestionsSetting {
8
+ /** Set this to true to count searches for the index and build its suggestions. */
9
+ enabled: boolean;
10
+ /** The `string` and `string[]` fields whose text a phrase must match before the engine publishes it. */
11
+ fields: string[];
12
+ /** The number of people, from 2 to 4,096, who must search a phrase before the engine publishes it. Defaults to 4. */
13
+ minPeople?: number;
14
+ /** The number of documents, from 1 to 10,000, that a phrase must match with every word. Defaults to 5. */
15
+ minResults?: number;
16
+ /** The number of days, from 1 to 365, that the engine keeps the counts of a day. Defaults to 30. */
17
+ retentionDays?: number;
18
+ /** The number of phrases, up to 16,384, that a node counts for the index each day. Defaults to 10,000. */
19
+ maxPhrasesPerDay?: number;
20
+ /** The number of phrases, up to 1,000, that a node counts for one person each day. Defaults to 100. */
21
+ maxPhrasesPerPerson?: number;
22
+ /** The number of people, up to 100,000, that a node counts for the index each day. Defaults to 100,000. */
23
+ maxPeoplePerDay?: number;
24
+ /** The number of groups, up to 1,000, that the index counts. Defaults to 100. */
25
+ maxGroups?: number;
26
+ /** The number of letters that a phrase must hold. Defaults to 4. */
27
+ minLetters?: number;
28
+ /** The number of characters, up to 150, that a phrase may hold. Defaults to 100. */
29
+ maxLength?: number;
30
+ /** The number of words, up to 50, that a phrase may hold. Defaults to 8. */
31
+ maxWords?: number;
32
+ /** The number of digits that a phrase may hold in total. Defaults to 5. */
33
+ maxDigits?: number;
34
+ /** The number of phrases, up to 500,000, that one build merges. Defaults to 100,000. */
35
+ maxMergePhrases?: number;
36
+ /** The memory, from 16 MiB to 1 GiB, of the worker that merges the counts. Defaults to 128 MiB. */
37
+ mergeMemoryBytes?: number;
38
+ /** How often, from 1 second to 1 hour, a node saves the counts of the day. Defaults to 5 minutes. */
39
+ saveIntervalMs?: number;
40
+ /** The number of result checks, up to 1,000, that a build runs each second. Defaults to 20. */
41
+ resultChecksPerSecond?: number;
42
+ /** A cron expression of five fields, or `off`. Defaults to `0 3 * * *`. */
43
+ schedule?: string;
44
+ /** The IANA time zone of `schedule`. Defaults to `UTC`. */
45
+ timeZone?: string;
46
+ }
47
+ /**
48
+ * The marker that the engine gives each suggestions index: the index whose
49
+ * searches it holds, and the group that it serves.
50
+ *
51
+ * @public
52
+ */
53
+ interface QuerySuggestionsSource {
54
+ /** The index whose searches the suggestions come from. */
55
+ index: string;
56
+ /** The group whose searches the suggestions come from. */
57
+ group: string;
58
+ }
59
+ /**
60
+ * Why a node counted no search, or `recorded` where it counted one.
61
+ *
62
+ * @public
63
+ */
64
+ type RecordQueryOutcome = 'recorded' | 'repeat' | 'invalid' | 'banned' | 'person-limit' | 'phrase-limit' | 'people-limit' | 'group-limit' | 'no-key' | 'unidentified';
65
+ /**
66
+ * What {@link QuerySuggestions.recordQuery} did with one search.
67
+ *
68
+ * @public
69
+ */
70
+ interface RecordQueryResult {
71
+ /** True where the node counted the search. */
72
+ recorded: boolean;
73
+ /** Why the node counted it or left it out. */
74
+ outcome: RecordQueryOutcome;
75
+ }
76
+ /**
77
+ * What started a build.
78
+ *
79
+ * @public
80
+ */
81
+ type QuerySuggestionsBuildTrigger = 'schedule' | 'missed' | 'caller';
82
+ /**
83
+ * One build of the suggestions of an index.
84
+ *
85
+ * @public
86
+ */
87
+ interface QuerySuggestionsBuild {
88
+ /** The ID of the build. */
89
+ buildId: string;
90
+ /** What started the build. */
91
+ trigger: QuerySuggestionsBuildTrigger;
92
+ /** Where the build stands. */
93
+ status: 'running' | 'completed' | 'failed' | 'skipped';
94
+ /** When the build started, in milliseconds since the Unix epoch. */
95
+ startedAt: number;
96
+ /** When the build ended, or null while it runs. */
97
+ endedAt: number | null;
98
+ /** The phrases that the build added or updated. */
99
+ published: number;
100
+ /** The phrases that the build removed. */
101
+ removed: number;
102
+ /** The phrases that the build left out because the merge held its limit. */
103
+ discarded: number;
104
+ /** The error code of a failed build, or null. */
105
+ errorCode: string | null;
106
+ }
107
+ /**
108
+ * The setting, the last build, and the next scheduled build of one index.
109
+ *
110
+ * @public
111
+ */
112
+ interface QuerySuggestionsStatus {
113
+ /** The index. */
114
+ indexName: string;
115
+ /** The setting, or null where nobody set one. */
116
+ setting: QuerySuggestionsSetting | null;
117
+ /** The last build, or null where none ran. */
118
+ lastBuild: QuerySuggestionsBuild | null;
119
+ /** When the schedule next matches, in milliseconds since the Unix epoch, or null where it is off. */
120
+ nextBuildAt: number | null;
121
+ /** The suggestions index of each group that holds one. */
122
+ suggestionIndexes: string[];
123
+ }
124
+ /**
125
+ * One phrase that a build would publish.
126
+ *
127
+ * @public
128
+ */
129
+ interface QuerySuggestionPreviewEntry {
130
+ /** The group whose suggestions index would hold the phrase. */
131
+ group: string;
132
+ /** The normalised phrase. */
133
+ query: string;
134
+ /** The number of people whose searches the counts hold. */
135
+ count: number;
136
+ }
137
+ /**
138
+ * What the next build would publish: the phrases that enough people searched
139
+ * for, that match enough documents, and that fall in a group the build keeps.
140
+ *
141
+ * @public
142
+ */
143
+ interface QuerySuggestionsPreview {
144
+ /** The phrases, most counted first. */
145
+ entries: QuerySuggestionPreviewEntry[];
146
+ /** True where the list stops at the limit that the caller passed while more phrases wait to be checked. */
147
+ truncated: boolean;
148
+ }
149
+ /**
150
+ * A suggestion that a caller adds by hand.
151
+ *
152
+ * @public
153
+ */
154
+ interface ManualQuerySuggestion {
155
+ /** The group whose suggestions index takes the phrase. */
156
+ group: string;
157
+ /** The phrase, which the engine normalises. */
158
+ query: string;
159
+ /** The count that ranks the phrase. Defaults to 0. */
160
+ count?: number;
161
+ }
162
+ /**
163
+ * The events of popular query suggestions. No event carries search text.
164
+ *
165
+ * @public
166
+ */
167
+ interface QuerySuggestionsBuildEvent {
168
+ /** The source index. */
169
+ indexName: string;
170
+ /** The ID of the build. */
171
+ buildId: string;
172
+ /** `started`, `completed`, `failed`, or `skipped`. */
173
+ phase: 'started' | 'completed' | 'failed' | 'skipped';
174
+ /** What started the build. */
175
+ trigger: QuerySuggestionsBuildTrigger;
176
+ /** The phrases that the build added or updated. */
177
+ published: number;
178
+ /** The phrases that the build removed. */
179
+ removed: number;
180
+ /** The phrases that the build left out. */
181
+ discarded: number;
182
+ /** The error code of a failed build. */
183
+ errorCode?: string;
184
+ }
185
+ /**
186
+ * Why the engine warns about popular query suggestions.
187
+ *
188
+ * @public
189
+ */
190
+ type QuerySuggestionsWarningReason = 'save-failed' | 'damaged-file' | 'other-key' | 'no-key' | 'phrase-limit' | 'people-limit' | 'ban-removal-failed';
191
+ /**
192
+ * A warning about popular query suggestions, which carries no search text.
193
+ *
194
+ * @public
195
+ */
196
+ interface QuerySuggestionsWarningEvent {
197
+ /** The source index. */
198
+ indexName: string;
199
+ /** What happened. */
200
+ reason: QuerySuggestionsWarningReason;
201
+ /** The history file that the warning concerns, where there is one. */
202
+ file?: string;
203
+ /** The error message of a failed save. */
204
+ message?: string;
205
+ }
206
+ /**
207
+ * One search that a person followed with a click.
208
+ *
209
+ * @public
210
+ */
211
+ interface RecordedQuery {
212
+ /** The search text, which the engine normalises before it counts it. */
213
+ query: string;
214
+ /** The ID of the person who searched, from 1 to 256 UTF-16 code units. The engine scrambles it with the key. */
215
+ person: string;
216
+ /** The audience whose suggestions the search counts towards, from 1 to 32 letters, digits, `_`, and `-`. */
217
+ group: string;
218
+ }
219
+ /**
220
+ * Popular query suggestions for one engine, which
221
+ * `querySuggestions(engine)` from `@delali/narsil/query-suggestions` returns.
222
+ *
223
+ * @public
224
+ */
225
+ interface QuerySuggestions {
226
+ /**
227
+ * Counts one search that a person followed with a click.
228
+ *
229
+ * @param indexName - The index that the person searched.
230
+ * @param query - The search, the person, and the group.
231
+ * @returns Whether the engine counted the search, and why not where it didn't.
232
+ */
233
+ recordQuery(indexName: string, query: RecordedQuery): Promise<RecordQueryResult>;
234
+ /**
235
+ * Replaces the setting of an index. Turning the feature off deletes the
236
+ * index's search history and keeps its suggestions indexes.
237
+ *
238
+ * @param indexName - The index whose searches the engine counts.
239
+ * @param setting - The setting, whose omitted limits take their defaults.
240
+ */
241
+ updateSetting(indexName: string, setting: QuerySuggestionsSetting): Promise<void>;
242
+ /**
243
+ * Reports the setting, the last build, and the next scheduled build.
244
+ *
245
+ * @param indexName - The source index.
246
+ * @returns The status of the index.
247
+ */
248
+ status(indexName: string): Promise<QuerySuggestionsStatus>;
249
+ /**
250
+ * Builds the suggestions of an index now. A build that finds another build
251
+ * of the index under way reports `skipped`.
252
+ *
253
+ * @param indexName - The source index.
254
+ * @returns The build once it ends.
255
+ */
256
+ build(indexName: string): Promise<QuerySuggestionsBuild>;
257
+ /**
258
+ * Lists what the next build would publish. The preview runs the same
259
+ * result checks as a build, at the same `resultChecksPerSecond`, until it
260
+ * holds `limit` phrases.
261
+ *
262
+ * @param indexName - The source index.
263
+ * @param limit - The most phrases to list, from 1 to 1,000. Defaults to 100.
264
+ * @returns The phrases, most counted first.
265
+ */
266
+ preview(indexName: string, limit?: number): Promise<QuerySuggestionsPreview>;
267
+ /**
268
+ * Returns the ban list of an index.
269
+ *
270
+ * @param indexName - The source index.
271
+ * @returns The banned phrases in their normal form.
272
+ */
273
+ bans(indexName: string): Promise<string[]>;
274
+ /**
275
+ * Replaces the ban list, and removes each newly banned phrase from every
276
+ * suggestions index of the index before it returns.
277
+ *
278
+ * @param indexName - The source index.
279
+ * @param phrases - At most 1,000 phrases, which the engine normalises.
280
+ * @returns The stored ban list.
281
+ */
282
+ updateBans(indexName: string, phrases: string[]): Promise<string[]>;
283
+ /**
284
+ * Bans a phrase and removes it from every suggestions index of the index.
285
+ *
286
+ * @param indexName - The source index.
287
+ * @param query - The phrase, which the engine normalises.
288
+ * @returns The number of suggestions indexes that held the phrase.
289
+ */
290
+ removeQuery(indexName: string, query: string): Promise<number>;
291
+ /**
292
+ * Adds a suggestion by hand, with `origin` set to `manual`, which a build
293
+ * leaves in place.
294
+ *
295
+ * @param indexName - The source index.
296
+ * @param suggestion - The group, the phrase, and its count.
297
+ * @returns The name of the suggestions index that holds it.
298
+ */
299
+ addSuggestion(indexName: string, suggestion: ManualQuerySuggestion): Promise<string>;
300
+ /**
301
+ * Returns the name of the suggestions index of a group, which an app
302
+ * queries with `{ term, prefix: true, termMatch: 'all', sort: { count: 'desc' } }`.
303
+ *
304
+ * @param indexName - The source index.
305
+ * @param group - The group.
306
+ * @returns The name of the suggestions index.
307
+ */
308
+ suggestionsIndexName(indexName: string, group: string): string;
309
+ }
310
+
311
+ export type { ManualQuerySuggestion as M, QuerySuggestionPreviewEntry as Q, RecordQueryOutcome as R, QuerySuggestionsBuild as a, QuerySuggestionsBuildTrigger as b, QuerySuggestionsPreview as c, QuerySuggestionsSetting as d, QuerySuggestionsStatus as e, RecordQueryResult as f, QuerySuggestions as g, QuerySuggestionsBuildEvent as h, QuerySuggestionsSource as i, QuerySuggestionsWarningEvent as j, QuerySuggestionsWarningReason as k, RecordedQuery as l };
@@ -0,0 +1,247 @@
1
+ import { suggestionsIndexName, markedSuggestionIndexes, ensureSuggestionsIndex, suggestionDocument, ORIGIN_MANUAL, removeSuggestions, enabledSetting, mergeHistory, groupsToWrite, meetsMinResults, localRuntimeOf } from './browser/chunk-SSTPBZZX.mjs';
2
+ import './browser/chunk-M3MQE2X7.mjs';
3
+ import { normaliseBan, banListFromInput, withState } from './browser/chunk-3SSRJMFN.mjs';
4
+ import './browser/chunk-CRE3G7F3.mjs';
5
+ import { isGroup, invalidSetting, GROUP_FORMAT, resolveSetting, acceptedPhrase, validateSetting, requireFieldsInSchema } from './browser/chunk-BHFQATSC.mjs';
6
+ import './browser/chunk-MGI4BCXC.mjs';
7
+ import './browser/chunk-OEDCEZXJ.mjs';
8
+ import './browser/chunk-ATEBYXP6.mjs';
9
+ import './browser/chunk-5W3MMTLG.mjs';
10
+ import { MAX_MANUAL_SUGGESTION_COUNT, MAX_SOURCE_INDEX_NAME_LENGTH, DEFAULT_PREVIEW_LIMIT, MAX_PREVIEW_LIMIT } from './browser/chunk-7IGKGWSQ.mjs';
11
+ import './browser/chunk-HOZW3PKP.mjs';
12
+ import { engineCoreOf } from './browser/chunk-3V7DNNZL.mjs';
13
+ import './browser/chunk-ML7THVLJ.mjs';
14
+ import './browser/chunk-VI7BQR4U.mjs';
15
+ import './browser/chunk-JPTQZWJQ.mjs';
16
+ import './browser/chunk-STOWQFT3.mjs';
17
+ import './browser/chunk-RA6LSBCM.mjs';
18
+ import './browser/chunk-MOG4OVDK.mjs';
19
+ import './browser/chunk-TK63WFXK.mjs';
20
+ import './browser/chunk-XAWNZ4G2.mjs';
21
+ import './browser/chunk-TY7L6OXO.mjs';
22
+ import './browser/chunk-4RD3AFSB.mjs';
23
+ import './browser/chunk-NXQG7DRA.mjs';
24
+ import './browser/chunk-GPPOG6PT.mjs';
25
+ import './browser/chunk-WXLBZJMT.mjs';
26
+ import { NarsilError, ErrorCodes } from './browser/chunk-SRMZXJSL.mjs';
27
+
28
+ // src/query-suggestions/preview.ts
29
+ function previewOrder(left, right) {
30
+ if (left.count !== right.count) return right.count - left.count;
31
+ if (left.group !== right.group) return left.group < right.group ? -1 : 1;
32
+ return left.query < right.query ? -1 : left.query > right.query ? 1 : 0;
33
+ }
34
+ async function previewBuild(ctx, indexName, max) {
35
+ const setting = enabledSetting(ctx.host, indexName);
36
+ const merged = await mergeHistory(ctx, indexName, setting, Date.now());
37
+ const { groups } = groupsToWrite(ctx, indexName, setting, merged.result);
38
+ const banned = new Set(ctx.host.view(indexName)?.state?.bannedQueries ?? []);
39
+ const candidates = [];
40
+ for (const group of groups) {
41
+ for (const { phrase, count } of merged.result.groups[group] ?? []) {
42
+ if (!banned.has(phrase)) candidates.push({ group, query: phrase, count });
43
+ }
44
+ }
45
+ candidates.sort(previewOrder);
46
+ const checked = /* @__PURE__ */ new Map();
47
+ const entries = [];
48
+ let next = 0;
49
+ while (next < candidates.length && entries.length < max) {
50
+ const candidate = candidates[next];
51
+ next += 1;
52
+ if (candidate === void 0) break;
53
+ let passes = checked.get(candidate.query);
54
+ if (passes === void 0) {
55
+ passes = await meetsMinResults(ctx, indexName, setting, candidate.query);
56
+ checked.set(candidate.query, passes);
57
+ }
58
+ if (passes) entries.push(candidate);
59
+ }
60
+ return { entries, truncated: next < candidates.length };
61
+ }
62
+
63
+ // src/query-suggestions/operations.ts
64
+ function requireView(runtime, indexName) {
65
+ const view = runtime.host.view(indexName);
66
+ if (view === null) {
67
+ throw new NarsilError(ErrorCodes.INDEX_NOT_FOUND, `Index "${indexName}" does not exist`, { indexName });
68
+ }
69
+ return view;
70
+ }
71
+ function requireSourceView(runtime, indexName) {
72
+ const view = requireView(runtime, indexName);
73
+ if (view.state?.querySuggestionsSource !== void 0) {
74
+ invalidSetting(`Index "${indexName}" is a suggestions index, so it takes no query suggestions of its own`, {
75
+ indexName
76
+ });
77
+ }
78
+ if (indexName.length > MAX_SOURCE_INDEX_NAME_LENGTH) {
79
+ invalidSetting(
80
+ `Index "${indexName}" has a name longer than ${MAX_SOURCE_INDEX_NAME_LENGTH} characters, which leaves no room for the names of its suggestions indexes`,
81
+ { indexName }
82
+ );
83
+ }
84
+ return view;
85
+ }
86
+ function requireAcceptable(runtime, indexName, setting) {
87
+ const view = requireSourceView(runtime, indexName);
88
+ requireFieldsInSchema(setting, view.schema);
89
+ if (!setting.enabled) return;
90
+ if (runtime.scrambler === null) {
91
+ invalidSetting("This engine has no query suggestions key, so it cannot turn the feature on", { indexName });
92
+ }
93
+ if (view.hasSync) {
94
+ invalidSetting(
95
+ `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`,
96
+ { indexName }
97
+ );
98
+ }
99
+ }
100
+ async function updateSetting(runtime, indexName, raw) {
101
+ const setting = validateSetting(raw);
102
+ requireAcceptable(runtime, indexName, setting);
103
+ await runtime.host.updateState(indexName, (current) => {
104
+ requireAcceptable(runtime, indexName, setting);
105
+ return withState(current, { querySuggestions: setting });
106
+ });
107
+ if (!setting.enabled) await runtime.discardHistory(indexName);
108
+ runtime.settingChanged(indexName);
109
+ }
110
+ async function status(runtime, indexName) {
111
+ const view = requireView(runtime, indexName);
112
+ return {
113
+ indexName,
114
+ setting: view.state?.querySuggestions ?? null,
115
+ lastBuild: await runtime.builds.lastBuild(indexName),
116
+ nextBuildAt: runtime.timers.nextBuildAt(indexName),
117
+ suggestionIndexes: [...markedSuggestionIndexes(runtime.host, indexName).values()].sort()
118
+ };
119
+ }
120
+ function previewLimitOf(limit) {
121
+ if (limit === void 0) return DEFAULT_PREVIEW_LIMIT;
122
+ if (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1 || limit > MAX_PREVIEW_LIMIT) {
123
+ invalidSetting(`The preview limit must be a whole number from 1 to ${MAX_PREVIEW_LIMIT}`);
124
+ }
125
+ return limit;
126
+ }
127
+ async function preview(runtime, indexName, limit) {
128
+ const max = previewLimitOf(limit);
129
+ runtime.enabledSetting(indexName);
130
+ const scrambler = runtime.scrambler;
131
+ if (scrambler === null) invalidSetting("This engine has no query suggestions key, so it holds no counts");
132
+ const context = {
133
+ host: runtime.host,
134
+ scrambler,
135
+ saveDay: (name) => runtime.saveDay(name),
136
+ withWriteLock: (name, work) => runtime.withWriteLock(name, work),
137
+ isStopping: () => runtime.isStopping
138
+ };
139
+ return previewBuild(context, indexName, max);
140
+ }
141
+ async function banPhrases(runtime, indexName, next) {
142
+ requireSourceView(runtime, indexName);
143
+ let added = [];
144
+ let stored = [];
145
+ await runtime.host.updateState(indexName, (current) => {
146
+ requireSourceView(runtime, indexName);
147
+ const previous = current?.bannedQueries ?? [];
148
+ stored = next(previous);
149
+ const before = new Set(previous);
150
+ added = stored.filter((phrase) => !before.has(phrase));
151
+ return withState(current, { bannedQueries: stored });
152
+ });
153
+ return { stored, added };
154
+ }
155
+ async function removeFromSuggestions(runtime, indexName, phrases) {
156
+ let holders = 0;
157
+ if (phrases.length === 0) return holders;
158
+ for (const name of markedSuggestionIndexes(runtime.host, indexName).values()) {
159
+ if (await removeSuggestions(runtime.host, name, phrases) > 0) holders += 1;
160
+ }
161
+ return holders;
162
+ }
163
+ function updateBans(runtime, indexName, raw) {
164
+ const phrases = banListFromInput(raw);
165
+ return runtime.withWriteLock(indexName, async () => {
166
+ const { stored, added } = await banPhrases(runtime, indexName, () => phrases);
167
+ await removeFromSuggestions(runtime, indexName, added);
168
+ return stored;
169
+ });
170
+ }
171
+ function removeQuery(runtime, indexName, raw) {
172
+ const phrase = normaliseBan(raw);
173
+ return runtime.withWriteLock(indexName, async () => {
174
+ await banPhrases(runtime, indexName, (current) => current.includes(phrase) ? [...current] : [...current, phrase]);
175
+ return removeFromSuggestions(runtime, indexName, [phrase]);
176
+ });
177
+ }
178
+ function manualCountOf(count) {
179
+ if (count === void 0) return 0;
180
+ if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0 || count > MAX_MANUAL_SUGGESTION_COUNT) {
181
+ invalidSetting(`A suggestion's count must be a whole number from 0 to ${MAX_MANUAL_SUGGESTION_COUNT}`);
182
+ }
183
+ return count;
184
+ }
185
+ function addSuggestion(runtime, indexName, raw) {
186
+ const { group, query, count } = raw ?? {};
187
+ if (!isGroup(group)) invalidSetting(`A suggestion needs a group of ${GROUP_FORMAT}`);
188
+ if (typeof query !== "string") invalidSetting("A suggestion needs its query as a string");
189
+ const documentCount = manualCountOf(count);
190
+ return runtime.withWriteLock(indexName, async () => {
191
+ const view = requireSourceView(runtime, indexName);
192
+ const setting = resolveSetting(view.state?.querySuggestions ?? { enabled: false, fields: [] });
193
+ const phrase = acceptedPhrase(query, setting);
194
+ if (phrase === null) invalidSetting("The suggestion is not a phrase that the setting of the index accepts");
195
+ if ((view.state?.bannedQueries ?? []).includes(phrase)) {
196
+ invalidSetting("The ban list of the index holds this phrase", { indexName });
197
+ }
198
+ const marked = markedSuggestionIndexes(runtime.host, indexName);
199
+ if (!marked.has(group) && marked.size >= setting.maxGroups) {
200
+ invalidSetting(`Index "${indexName}" already has ${setting.maxGroups} groups`, { indexName });
201
+ }
202
+ const name = await ensureSuggestionsIndex(runtime.host, indexName, group);
203
+ const document = suggestionDocument(phrase, documentCount, ORIGIN_MANUAL);
204
+ if (await runtime.host.engine.has(name, phrase)) await runtime.host.engine.update(name, phrase, document);
205
+ else await runtime.host.engine.insert(name, document);
206
+ return name;
207
+ });
208
+ }
209
+ function querySuggestionsOf(runtime) {
210
+ return {
211
+ recordQuery: async (indexName, query) => (await runtime()).record(indexName, query),
212
+ updateSetting: async (indexName, setting) => updateSetting(await runtime(), indexName, setting),
213
+ status: async (indexName) => status(await runtime(), indexName),
214
+ build: async (indexName) => (await runtime()).builds.start(indexName, "caller"),
215
+ preview: async (indexName, limit) => preview(await runtime(), indexName, limit),
216
+ bans: async (indexName) => [...requireView(await runtime(), indexName).state?.bannedQueries ?? []],
217
+ updateBans: async (indexName, phrases) => updateBans(await runtime(), indexName, phrases),
218
+ removeQuery: async (indexName, query) => removeQuery(await runtime(), indexName, query),
219
+ addSuggestion: async (indexName, suggestion) => addSuggestion(await runtime(), indexName, suggestion),
220
+ suggestionsIndexName: (indexName, group) => {
221
+ if (!isGroup(group)) invalidSetting(`A group holds ${GROUP_FORMAT}`);
222
+ return suggestionsIndexName(indexName, group);
223
+ }
224
+ };
225
+ }
226
+
227
+ // src/query-suggestions/providers.ts
228
+ var providers = /* @__PURE__ */ new WeakMap();
229
+ function boundQuerySuggestionsOf(owner) {
230
+ return providers.get(owner);
231
+ }
232
+
233
+ // src/query-suggestions/index.ts
234
+ function querySuggestions(engine) {
235
+ const bound = boundQuerySuggestionsOf(engine);
236
+ if (bound !== void 0) return bound();
237
+ const core = engineCoreOf(engine);
238
+ if (core === void 0) {
239
+ throw new NarsilError(
240
+ ErrorCodes.CONFIG_INVALID,
241
+ "Popular query suggestions need an engine that createNarsil made in this process"
242
+ );
243
+ }
244
+ return querySuggestionsOf(() => localRuntimeOf(core, engine, void 0));
245
+ }
246
+
247
+ export { querySuggestions };
@@ -0,0 +1,20 @@
1
+ import { g as Narsil } from './engine-CFxPYqEk.js';
2
+ import { g as QuerySuggestions } from './query-suggestions-CBYkrQ5T.js';
3
+ export { M as ManualQuerySuggestion, Q as QuerySuggestionPreviewEntry, a as QuerySuggestionsBuild, h as QuerySuggestionsBuildEvent, b as QuerySuggestionsBuildTrigger, c as QuerySuggestionsPreview, d as QuerySuggestionsSetting, i as QuerySuggestionsSource, e as QuerySuggestionsStatus, j as QuerySuggestionsWarningEvent, k as QuerySuggestionsWarningReason, R as RecordQueryOutcome, f as RecordQueryResult, l as RecordedQuery } from './query-suggestions-CBYkrQ5T.js';
4
+ import './adapters-pljAqmrC.js';
5
+ import './schema-Jwt928nJ.js';
6
+ import './synonyms-CpOAHPa-.js';
7
+
8
+ /**
9
+ * Returns popular query suggestions for an engine that {@link createNarsil}
10
+ * made. Give the engine a key through its `querySuggestions` setting before
11
+ * you turn the feature on for an index.
12
+ *
13
+ * @param engine - The engine whose indexes the suggestions come from.
14
+ * @returns The operations that count searches and build suggestions.
15
+ *
16
+ * @public
17
+ */
18
+ declare function querySuggestions(engine: Narsil): QuerySuggestions;
19
+
20
+ export { QuerySuggestions, querySuggestions };
@@ -0,0 +1,69 @@
1
+ export { querySuggestions } from './chunk-BWZ3P4MU.mjs';
2
+ import './chunk-Z2KAFCRT.mjs';
3
+ import './chunk-RDXO6JST.mjs';
4
+ import './chunk-S5LN746F.mjs';
5
+ import './chunk-TGS5UXBE.mjs';
6
+ import './chunk-2UV4QBHW.mjs';
7
+ import './chunk-LNGE7SLY.mjs';
8
+ import './chunk-DP5C7YFQ.mjs';
9
+ import './chunk-KP7TYHWT.mjs';
10
+ import './chunk-XXHN7J46.mjs';
11
+ import './chunk-YTWZVGCB.mjs';
12
+ import './chunk-V6EUBAIT.mjs';
13
+ import './chunk-BEZH7VEH.mjs';
14
+ import './chunk-XAXKV65G.mjs';
15
+ import './chunk-SA5LOGO3.mjs';
16
+ import './chunk-GQPTDQCL.mjs';
17
+ import './chunk-5YNRKI2C.mjs';
18
+ import './chunk-EFBDHH5P.mjs';
19
+ import './chunk-I53G4JAU.mjs';
20
+ import './chunk-HJSN7UYG.mjs';
21
+ import './chunk-LHKOSI2J.mjs';
22
+ import './chunk-XIHUI4KB.mjs';
23
+ import './chunk-3MXV3VHR.mjs';
24
+ import './chunk-EEBCDP36.mjs';
25
+ import './chunk-VTTRFF2C.mjs';
26
+ import './chunk-P5ZI2P2W.mjs';
27
+ import './chunk-GH4WQ22V.mjs';
28
+ import './chunk-3OH67G7R.mjs';
29
+ import './chunk-IPN7S4KX.mjs';
30
+ import './chunk-KAKQ74LS.mjs';
31
+ import './chunk-7GXJUJ24.mjs';
32
+ import './chunk-Q2UL2TPC.mjs';
33
+ import './chunk-CITFCZKF.mjs';
34
+ import './chunk-RLOES5SX.mjs';
35
+ import './chunk-L6V6BST3.mjs';
36
+ import './chunk-SQJWAIF4.mjs';
37
+ import './chunk-FQBFZAWG.mjs';
38
+ import './chunk-BU4SAIC4.mjs';
39
+ import './chunk-GES7U2PM.mjs';
40
+ import './chunk-I54T6CQP.mjs';
41
+ import './chunk-I5B7RXU7.mjs';
42
+ import './chunk-Y4WPNHMC.mjs';
43
+ import './chunk-RZWWB2XR.mjs';
44
+ import './chunk-TGP5M5R7.mjs';
45
+ import './chunk-G6HRSGOU.mjs';
46
+ import './chunk-U2BKYEC7.mjs';
47
+ import './chunk-6HTGOXIK.mjs';
48
+ import './chunk-QHPYS427.mjs';
49
+ import './chunk-QYRNLLLI.mjs';
50
+ import './chunk-TDIK6NTV.mjs';
51
+ import './chunk-FB6463IN.mjs';
52
+ import './chunk-7GFE3PEY.mjs';
53
+ import './chunk-ZXNQEW43.mjs';
54
+ import './chunk-7V5IUP2T.mjs';
55
+ import './chunk-L5ORED7V.mjs';
56
+ import './chunk-X5CV2E2B.mjs';
57
+ import './chunk-A4L7YTKX.mjs';
58
+ import './chunk-U55XJEIG.mjs';
59
+ import './chunk-KOKM4PQN.mjs';
60
+ import './chunk-ORN5BLL7.mjs';
61
+ import './chunk-BTPGQC6Z.mjs';
62
+ import './chunk-LQG5G2LY.mjs';
63
+ import './chunk-ZXX5GZEX.mjs';
64
+ import './chunk-RFBLQLLZ.mjs';
65
+ import './chunk-KKQC526K.mjs';
66
+ import './chunk-U476IXKQ.mjs';
67
+ import './chunk-MP7ABPTD.mjs';
68
+ import './chunk-J4IJTTEX.mjs';
69
+ import './chunk-TBC3XUL2.mjs';