@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
@@ -1,11 +1,11 @@
1
- import { restoredConfigFields, restoredEmbedding } from './chunk-DCKMICOB.mjs';
1
+ import { restoredConfigFields, restoredEmbedding } from './chunk-LZSLNSUN.mjs';
2
+ import { untagDocumentLine } from './chunk-4J74WHQM.mjs';
2
3
  import { chunksOf } from './chunk-NVVRSRX5.mjs';
3
- import { untagDocumentLine } from './chunk-NKIZX26F.mjs';
4
- import { turnsAreBudgeted, turnIsSpent, yieldTurn } from './chunk-NCJS3WIY.mjs';
4
+ import { turnsAreBudgeted, turnIsSpent, yieldTurn } from './chunk-YZW4CHM6.mjs';
5
5
  import { MAX_EXPORT_LINE_BYTES, IMPORT_BATCH_DOCUMENTS, MAX_IMPORT_REFUSALS_REPORTED } from './chunk-AM7RSBPF.mjs';
6
- import { requireConfigurationShape } from './chunk-C2H2QQFW.mjs';
7
- import { flattenSchema } from './chunk-O32RB3BL.mjs';
8
- import { NarsilError, ErrorCodes } from './chunk-CUNGPR5R.mjs';
6
+ import { requireConfigurationShape } from './chunk-YH7QY657.mjs';
7
+ import { flattenSchema } from './chunk-DNXOMPAQ.mjs';
8
+ import { NarsilError, ErrorCodes } from './chunk-DZ7H7D2C.mjs';
9
9
 
10
10
  // src/engine/export/lines.ts
11
11
  var NEWLINE = 10;
@@ -1,5 +1,5 @@
1
- import { NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND } from './chunk-XRV72TJD.mjs';
2
- import { NarsilError, ErrorCodes } from './chunk-MYITLCHT.mjs';
1
+ import { NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND } from './chunk-4J74WHQM.mjs';
2
+ import { NarsilError, ErrorCodes } from './chunk-DZ7H7D2C.mjs';
3
3
 
4
4
  // src/engine/export/json-line.ts
5
5
  function refuse(path, kind, docId) {
@@ -1,5 +1,5 @@
1
- import { MAX_FILE_BYTES, CHECKSUM_YIELD_CHUNK_BYTES } from './chunk-TJMSKBEM.mjs';
2
- import { NarsilError, ErrorCodes } from './chunk-CUNGPR5R.mjs';
1
+ import { MAX_FILE_BYTES, CHECKSUM_YIELD_CHUNK_BYTES } from './chunk-6VBXNFLE.mjs';
2
+ import { NarsilError, ErrorCodes } from './chunk-DZ7H7D2C.mjs';
3
3
  import { decode } from '@msgpack/msgpack';
4
4
 
5
5
  // src/serialization/header.ts
@@ -189,7 +189,7 @@ function loadFailed(message, details) {
189
189
  throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, message, details);
190
190
  }
191
191
  async function gunzipWithinLimit(compressed, what) {
192
- const { gunzip } = await import('./gzip.react-native-DNB5YNFA.mjs');
192
+ const { gunzip } = await import('./gzip.react-native-HLEPDKZ3.mjs');
193
193
  try {
194
194
  return await gunzip(compressed, MAX_FILE_BYTES);
195
195
  } catch (error) {
@@ -1,5 +1,5 @@
1
+ import { reactNativeHost } from './chunk-MVXELMJX.mjs';
1
2
  import { FNV_PRIME, FNV_OFFSET_BASIS } from './chunk-CHPTFFJM.mjs';
2
- import { reactNativeHost } from './chunk-IOY2SM2P.mjs';
3
3
 
4
4
  var REFUSAL_COLLECTION_MIN_INTERVAL_MS = 1e3;
5
5
  var REFUSAL_COLLECTION_TIME_MULTIPLE = 10;
@@ -358,16 +358,6 @@ function collectYoungGeneration() {
358
358
  return false;
359
359
  }
360
360
 
361
- // src/vector/osq/constants.ts
362
- var OSQ_GRID = { 1: 0.798, 2: 1.493, 4: 2.514, 8: 3.922 };
363
- var OSQ_STEPS = { 1: 1, 2: 3, 4: 15, 8: 255 };
364
- var OSQ_QUERY_BITS = { 1: 4, 2: 4, 4: 4, 8: 8 };
365
- var OSQ_PLACEMENT_QUERY_BITS = { 1: 4, 2: 4, 4: 8, 8: 8 };
366
- var OSQ_LAMBDA = 0.1;
367
- var OSQ_REFINE_ROUNDS = 5;
368
- var OSQ_REFINE_TOLERANCE = 1e-8;
369
- var MIN_OVERSAMPLE = 1;
370
-
371
361
  // src/workers/thread-slot.ts
372
362
  var goneThreadSlots = /* @__PURE__ */ new Set();
373
363
  function threadSlotOfWorker(workerId) {
@@ -383,6 +373,32 @@ function threadSlotGone(threadSlot) {
383
373
  return goneThreadSlots.has(threadSlot);
384
374
  }
385
375
 
376
+ // src/vector/native/backend.ts
377
+ var nativeSearchCoreEnabled = true;
378
+ function nativeSearchCoreIsEnabled() {
379
+ return nativeSearchCoreEnabled;
380
+ }
381
+ function stopUsingTheNativeSearchCore(error) {
382
+ if (!nativeSearchCoreEnabled) return;
383
+ nativeSearchCoreEnabled = false;
384
+ console.warn(
385
+ "The native search core raised an error, so this thread searches through WebAssembly from now on:",
386
+ error instanceof Error ? error.message : String(error)
387
+ );
388
+ }
389
+ function noteFallback(operation) {
390
+ }
391
+
392
+ // src/vector/osq/constants.ts
393
+ var OSQ_GRID = { 1: 0.798, 2: 1.493, 4: 2.514, 8: 3.922 };
394
+ var OSQ_STEPS = { 1: 1, 2: 3, 4: 15, 8: 255 };
395
+ var OSQ_QUERY_BITS = { 1: 4, 2: 4, 4: 4, 8: 8 };
396
+ var OSQ_PLACEMENT_QUERY_BITS = { 1: 4, 2: 4, 4: 8, 8: 8 };
397
+ var OSQ_LAMBDA = 0.1;
398
+ var OSQ_REFINE_ROUNDS = 5;
399
+ var OSQ_REFINE_TOLERANCE = 1e-8;
400
+ var MIN_OVERSAMPLE = 1;
401
+
386
402
  // src/core/doc-id-tables/constants.ts
387
403
  var DOC_ID_TABLE_SHARD_BITS = 6;
388
404
 
@@ -437,6 +453,29 @@ function createDocIdMap() {
437
453
  return new ShardedDocIdMap();
438
454
  }
439
455
 
456
+ // src/vector/native/types.ts
457
+ var NATIVE_CORE_ABI_VERSION = 8;
458
+ var NATIVE_OK = 0;
459
+ var NATIVE_NEEDS_ROOM = 3;
460
+ var NATIVE_GRAPH_NOT_HELD_ALONE = 4;
461
+
462
+ // src/vector/native/loader.react-native.ts
463
+ var loaded;
464
+ function loadNativeCore() {
465
+ if (loaded !== void 0) return loaded;
466
+ const core = reactNativeHost().core;
467
+ const reported = core.abiVersion();
468
+ if (reported !== NATIVE_CORE_ABI_VERSION) {
469
+ console.warn(
470
+ `Narsil searches without its native core on this phone, because the core reports ABI version ${reported} while this build of Narsil needs ${NATIVE_CORE_ABI_VERSION}.`
471
+ );
472
+ loaded = null;
473
+ return loaded;
474
+ }
475
+ loaded = core;
476
+ return loaded;
477
+ }
478
+
440
479
  // src/runtime/detect.ts
441
480
  function detectRuntimeName() {
442
481
  if ("Bun" in globalThis) {
@@ -520,4 +559,4 @@ function collectYoungGenerationBeforeRefusal() {
520
559
  return collectYoungGeneration();
521
560
  }
522
561
 
523
- export { HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, MIN_OVERSAMPLE, OSQ_GRID, OSQ_LAMBDA, OSQ_PLACEMENT_QUERY_BITS, OSQ_QUERY_BITS, OSQ_REFINE_ROUNDS, OSQ_REFINE_TOLERANCE, OSQ_STEPS, admittedHeapBytes, backgroundTurnIsSpent, changeIndexOutsideExternalWaits, chargeHeapBytes, collectAndReturnPages, collectGarbageBeforeRefusal, collectYoungGenerationBeforeRefusal, countWrite, createDocIdMap, detectRuntime, holdWrites, holdWritesAndBackgroundWork, indexChangeOutsideExternalWaits, isSimdAvailable, markSimdUnavailable, noteThreadSlotGone, noteThreadSlotLive, reserveHeapBytes, reservedHeapBytes, threadSlotGone, threadSlotOfWorker, turnIsSpent, turnsAreBudgeted, waitOutsideCountedWrite, yieldBackgroundTurn, yieldTurn };
562
+ export { HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, MIN_OVERSAMPLE, NATIVE_GRAPH_NOT_HELD_ALONE, NATIVE_NEEDS_ROOM, NATIVE_OK, OSQ_GRID, OSQ_LAMBDA, OSQ_PLACEMENT_QUERY_BITS, OSQ_QUERY_BITS, OSQ_REFINE_ROUNDS, OSQ_REFINE_TOLERANCE, OSQ_STEPS, admittedHeapBytes, backgroundTurnIsSpent, changeIndexOutsideExternalWaits, chargeHeapBytes, collectAndReturnPages, collectGarbageBeforeRefusal, collectYoungGenerationBeforeRefusal, countWrite, createDocIdMap, detectRuntime, holdWrites, holdWritesAndBackgroundWork, indexChangeOutsideExternalWaits, isSimdAvailable, loadNativeCore, markSimdUnavailable, nativeSearchCoreIsEnabled, noteFallback, noteThreadSlotGone, noteThreadSlotLive, reserveHeapBytes, reservedHeapBytes, stopUsingTheNativeSearchCore, threadSlotGone, threadSlotOfWorker, turnIsSpent, turnsAreBudgeted, waitOutsideCountedWrite, yieldBackgroundTurn, yieldTurn };
@@ -0,0 +1,100 @@
1
+ import { invalidSetting, acceptedPhrase, validateSetting, validateSource, settingToWire, settingFromWire, isNormalPhrase } from './chunk-ZXZFN7FI.mjs';
2
+ import { MAX_BANNED_PHRASE_CODE_POINTS, MAX_BANNED_PHRASES, MAX_BAN_LIST_BYTES } from './chunk-PJHAB5ZY.mjs';
3
+ import { encode } from '@msgpack/msgpack';
4
+
5
+ var BAN_LIMITS = {
6
+ minLetters: 0,
7
+ maxLength: MAX_BANNED_PHRASE_CODE_POINTS,
8
+ maxWords: MAX_BANNED_PHRASE_CODE_POINTS,
9
+ maxDigits: MAX_BANNED_PHRASE_CODE_POINTS
10
+ };
11
+ function requireWithinLimits(phrases) {
12
+ if (phrases.length > MAX_BANNED_PHRASES) {
13
+ invalidSetting(`A ban list holds at most ${MAX_BANNED_PHRASES} phrases`, { phrases: phrases.length });
14
+ }
15
+ if (encode(phrases).byteLength > MAX_BAN_LIST_BYTES) {
16
+ invalidSetting(`A ban list must encode to at most ${MAX_BAN_LIST_BYTES} bytes`);
17
+ }
18
+ }
19
+ function normaliseBan(raw) {
20
+ if (typeof raw !== "string") invalidSetting("Each banned phrase must be a string");
21
+ const phrase = acceptedPhrase(raw, BAN_LIMITS);
22
+ if (phrase === null) {
23
+ invalidSetting(
24
+ `A banned phrase must hold up to ${MAX_BANNED_PHRASE_CODE_POINTS} letters, digits, spaces, hyphens, and apostrophes`
25
+ );
26
+ }
27
+ return phrase;
28
+ }
29
+ function banListFromInput(raw) {
30
+ if (!Array.isArray(raw)) invalidSetting("A ban list must be an array of phrases");
31
+ if (raw.length > MAX_BANNED_PHRASES) {
32
+ invalidSetting(`A ban list holds at most ${MAX_BANNED_PHRASES} phrases`, { phrases: raw.length });
33
+ }
34
+ const phrases = [...new Set(raw.map(normaliseBan))];
35
+ requireWithinLimits(phrases);
36
+ return phrases;
37
+ }
38
+ function storedBanList(raw) {
39
+ if (!Array.isArray(raw)) invalidSetting("The stored ban list is not an array");
40
+ const seen = /* @__PURE__ */ new Set();
41
+ for (const phrase of raw) {
42
+ if (typeof phrase !== "string" || !isNormalPhrase(phrase, BAN_LIMITS) || seen.has(phrase)) {
43
+ invalidSetting("The stored ban list holds a phrase that is not in normal form, or one twice");
44
+ }
45
+ seen.add(phrase);
46
+ }
47
+ const phrases = [...seen];
48
+ requireWithinLimits(phrases);
49
+ return phrases;
50
+ }
51
+ function unionOfBans(first, second) {
52
+ const union = [.../* @__PURE__ */ new Set([...first, ...second])];
53
+ requireWithinLimits(union);
54
+ return union;
55
+ }
56
+
57
+ // src/query-suggestions/stored-state.ts
58
+ function isPresent(value) {
59
+ return value !== void 0 && value !== null;
60
+ }
61
+ function storedStateOf(raw) {
62
+ const state = {};
63
+ if (isPresent(raw.querySuggestions)) state.querySuggestions = validateSetting(raw.querySuggestions);
64
+ if (isPresent(raw.bannedQueries)) {
65
+ const banned = storedBanList(raw.bannedQueries);
66
+ if (banned.length > 0) state.bannedQueries = banned;
67
+ }
68
+ if (isPresent(raw.querySuggestionsSource)) state.querySuggestionsSource = validateSource(raw.querySuggestionsSource);
69
+ return Object.keys(state).length === 0 ? null : state;
70
+ }
71
+ function storedStateToWire(state) {
72
+ const wire = {};
73
+ if (state.querySuggestions !== void 0) wire.query_suggestions = settingToWire(state.querySuggestions);
74
+ if (state.bannedQueries !== void 0) wire.banned_queries = [...state.bannedQueries];
75
+ if (state.querySuggestionsSource !== void 0) {
76
+ wire.query_suggestions_source = {
77
+ index: state.querySuggestionsSource.index,
78
+ group: state.querySuggestionsSource.group
79
+ };
80
+ }
81
+ return wire;
82
+ }
83
+ function storedStateFromWire(raw) {
84
+ const state = storedStateOf({
85
+ bannedQueries: raw.banned_queries,
86
+ querySuggestionsSource: raw.query_suggestions_source
87
+ });
88
+ if (!isPresent(raw.query_suggestions)) return state;
89
+ return { ...state, querySuggestions: settingFromWire(raw.query_suggestions) };
90
+ }
91
+ function withState(current, change) {
92
+ const next = { ...current, ...change };
93
+ for (const key of Object.keys(next)) {
94
+ const value = next[key];
95
+ if (value === void 0 || Array.isArray(value) && value.length === 0) delete next[key];
96
+ }
97
+ return Object.keys(next).length === 0 ? null : next;
98
+ }
99
+
100
+ export { banListFromInput, normaliseBan, storedStateFromWire, storedStateOf, storedStateToWire, unionOfBans, withState };
@@ -0,0 +1,432 @@
1
+ import { MAX_MIN_PEOPLE, MIN_MIN_PEOPLE, DEFAULT_MIN_PEOPLE, MAX_MIN_RESULTS, MIN_MIN_RESULTS, DEFAULT_MIN_RESULTS, MAX_RETENTION_DAYS, MIN_RETENTION_DAYS, DEFAULT_RETENTION_DAYS, MAX_MAX_PHRASES_PER_DAY, DEFAULT_MAX_PHRASES_PER_DAY, MAX_MAX_PHRASES_PER_PERSON, DEFAULT_MAX_PHRASES_PER_PERSON, MAX_MAX_PEOPLE_PER_DAY, DEFAULT_MAX_PEOPLE_PER_DAY, MAX_MAX_GROUPS, DEFAULT_MAX_GROUPS, MAX_MAX_LENGTH, DEFAULT_MAX_LENGTH, DEFAULT_MIN_LETTERS, MAX_MAX_WORDS, DEFAULT_MAX_WORDS, DEFAULT_MAX_DIGITS, MAX_MAX_MERGE_PHRASES, DEFAULT_MAX_MERGE_PHRASES, MAX_MERGE_MEMORY_BYTES, MIN_MERGE_MEMORY_BYTES, DEFAULT_MERGE_MEMORY_BYTES, MAX_SAVE_INTERVAL_MS, MIN_SAVE_INTERVAL_MS, DEFAULT_SAVE_INTERVAL_MS, MAX_RESULT_CHECKS_PER_SECOND, DEFAULT_RESULT_CHECKS_PER_SECOND, MAX_GROUP_LENGTH, MAX_PERSON_UTF16_UNITS, MAX_SCHEDULE_LENGTH, SCHEDULE_LOOKAHEAD_DAYS, DEFAULT_TIME_ZONE, DEFAULT_SCHEDULE, MAX_FIELDS, SCHEDULE_OFF, MAX_SETTING_BYTES, MAX_SOURCE_INDEX_NAME_LENGTH, RAW_PHRASE_UTF16_UNITS_PER_CODE_POINT, MAX_PERSON_PAIRS_PER_DAY, MAX_FILE_PEOPLE_PER_DAY, MAX_MERGE_PEOPLE, DAY_MS } from './chunk-PJHAB5ZY.mjs';
2
+ import { flattenSchema } from './chunk-DNXOMPAQ.mjs';
3
+ import { NarsilError, ErrorCodes } from './chunk-DZ7H7D2C.mjs';
4
+ import { encode } from '@msgpack/msgpack';
5
+
6
+ // src/query-suggestions/phrase.ts
7
+ var APOSTROPHE_VARIANTS = /[\u2018\u2019\u02bc]/g;
8
+ var HYPHEN_VARIANTS = /[\u2010\u2011]/g;
9
+ var WHITE_SPACE_RUNS = /\p{White_Space}+/gu;
10
+ var ALLOWED_PHRASE = /^[\p{L}\p{M}\p{Nd} '-]+$/u;
11
+ var LETTER = /\p{L}/gu;
12
+ var DIGIT = /\p{Nd}/gu;
13
+ var GROUP_PATTERN = new RegExp(`^[A-Za-z0-9][A-Za-z0-9_-]{0,${MAX_GROUP_LENGTH - 1}}$`);
14
+ var GROUP_FORMAT = `1 to ${MAX_GROUP_LENGTH} letters, digits, "_", and "-"`;
15
+ function countMatches(text, pattern) {
16
+ pattern.lastIndex = 0;
17
+ let count = 0;
18
+ while (pattern.exec(text) !== null) count++;
19
+ return count;
20
+ }
21
+ function codePointCount(text, stopAfter) {
22
+ let count = 0;
23
+ for (const _ of text) {
24
+ count++;
25
+ if (count > stopAfter) break;
26
+ }
27
+ return count;
28
+ }
29
+ function normalisePhrase(raw, maxLength) {
30
+ if (raw.length === 0 || raw.length > maxLength * RAW_PHRASE_UTF16_UNITS_PER_CODE_POINT) return null;
31
+ return raw.normalize("NFKC").toLowerCase().replace(APOSTROPHE_VARIANTS, "'").replace(HYPHEN_VARIANTS, "-").replace(WHITE_SPACE_RUNS, " ").trim();
32
+ }
33
+ function phraseFits(phrase, limits) {
34
+ if (phrase.length === 0 || phrase.length > limits.maxLength * 2) return false;
35
+ if (phrase !== phrase.trim() || phrase.includes(" ")) return false;
36
+ if (!ALLOWED_PHRASE.test(phrase)) return false;
37
+ if (codePointCount(phrase, limits.maxLength) > limits.maxLength) return false;
38
+ if (phrase.split(" ").length > limits.maxWords) return false;
39
+ if (countMatches(phrase, DIGIT) > limits.maxDigits) return false;
40
+ return countMatches(phrase, LETTER) >= limits.minLetters;
41
+ }
42
+ function isNormalPhrase(phrase, limits) {
43
+ return phraseFits(phrase, limits) && normalisePhrase(phrase, limits.maxLength) === phrase;
44
+ }
45
+ function acceptedPhrase(raw, limits) {
46
+ const phrase = normalisePhrase(raw, limits.maxLength);
47
+ if (phrase === null || !phraseFits(phrase, limits)) return null;
48
+ return phrase;
49
+ }
50
+ function isGroup(value) {
51
+ return typeof value === "string" && GROUP_PATTERN.test(value);
52
+ }
53
+ function isPerson(value) {
54
+ return typeof value === "string" && value.length > 0 && value.length <= MAX_PERSON_UTF16_UNITS;
55
+ }
56
+
57
+ // src/query-suggestions/schedule.ts
58
+ var FIELD_RANGES = [
59
+ { min: 0, max: 59 },
60
+ { min: 0, max: 23 },
61
+ { min: 1, max: 31 },
62
+ { min: 1, max: 12 },
63
+ { min: 0, max: 6 }
64
+ ];
65
+ var NUMBER = /^\d{1,2}$/;
66
+ function parseNumber(text, range) {
67
+ if (!NUMBER.test(text)) return null;
68
+ const value = Number(text);
69
+ return value >= range.min && value <= range.max ? value : null;
70
+ }
71
+ function parseField(text, range) {
72
+ const allowed = new Array(range.max + 1).fill(false);
73
+ for (const part of text.split(",")) {
74
+ const [base, stepText, ...extra] = part.split("/");
75
+ if (base === void 0 || extra.length > 0) return null;
76
+ let step = 1;
77
+ if (stepText !== void 0) {
78
+ if (!NUMBER.test(stepText) || Number(stepText) < 1) return null;
79
+ step = Number(stepText);
80
+ }
81
+ let start;
82
+ let end;
83
+ if (base === "*") {
84
+ start = range.min;
85
+ end = range.max;
86
+ } else {
87
+ const bounds = base.split("-");
88
+ if (bounds.length > 2) return null;
89
+ const first = parseNumber(bounds[0] ?? "", range);
90
+ if (first === null) return null;
91
+ start = first;
92
+ if (bounds.length === 2) {
93
+ const last = parseNumber(bounds[1] ?? "", range);
94
+ if (last === null || last < first) return null;
95
+ end = last;
96
+ } else end = stepText === void 0 ? first : range.max;
97
+ }
98
+ for (let value = start; value <= end; value += step) allowed[value] = true;
99
+ }
100
+ return allowed;
101
+ }
102
+ function parseSchedule(expression) {
103
+ if (expression.length > MAX_SCHEDULE_LENGTH) return null;
104
+ const fields = expression.trim().split(/\s+/);
105
+ if (fields.length !== FIELD_RANGES.length) return null;
106
+ const parsed = [];
107
+ for (let i = 0; i < fields.length; i++) {
108
+ const field = parseField(fields[i] ?? "", FIELD_RANGES[i]);
109
+ if (field === null) return null;
110
+ parsed.push(field);
111
+ }
112
+ const [minutes, hours, daysOfMonth, months, daysOfWeek] = parsed;
113
+ return {
114
+ minutes,
115
+ hours,
116
+ daysOfMonth,
117
+ months,
118
+ daysOfWeek,
119
+ dayOfMonthAny: fields[2] === "*",
120
+ dayOfWeekAny: fields[4] === "*"
121
+ };
122
+ }
123
+ var formatters = /* @__PURE__ */ new Map();
124
+ function formatterOf(timeZone) {
125
+ let formatter = formatters.get(timeZone);
126
+ if (formatter === void 0) {
127
+ formatter = new Intl.DateTimeFormat("en-US", {
128
+ timeZone,
129
+ hourCycle: "h23",
130
+ year: "numeric",
131
+ month: "numeric",
132
+ day: "numeric",
133
+ hour: "numeric",
134
+ minute: "numeric"
135
+ });
136
+ formatters.set(timeZone, formatter);
137
+ }
138
+ return formatter;
139
+ }
140
+ function wallTimeAt(instant, timeZone) {
141
+ const parts = {};
142
+ for (const part of formatterOf(timeZone).formatToParts(instant)) {
143
+ if (part.type !== "literal") parts[part.type] = Number(part.value);
144
+ }
145
+ return { year: parts.year, month: parts.month, day: parts.day, hour: parts.hour, minute: parts.minute };
146
+ }
147
+ function wallAsUtc(wall) {
148
+ return Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute);
149
+ }
150
+ function instantOf(wall, timeZone) {
151
+ const target = wallAsUtc(wall);
152
+ let guess = target;
153
+ for (let attempt = 0; attempt < 3; attempt++) {
154
+ const offset = wallAsUtc(wallTimeAt(guess, timeZone)) - guess;
155
+ guess = target - offset;
156
+ }
157
+ const landed = wallTimeAt(guess, timeZone);
158
+ return wallAsUtc(landed) === target ? guess : null;
159
+ }
160
+ function dayMatches(schedule, dayStartUtc) {
161
+ const date = new Date(dayStartUtc);
162
+ if (!schedule.months[date.getUTCMonth() + 1]) return false;
163
+ const monthDay = schedule.daysOfMonth[date.getUTCDate()] === true;
164
+ const weekDay = schedule.daysOfWeek[date.getUTCDay()] === true;
165
+ if (!schedule.dayOfMonthAny && !schedule.dayOfWeekAny) return monthDay || weekDay;
166
+ return monthDay && weekDay;
167
+ }
168
+ function matchesOfDay(schedule, dayStartUtc, timeZone) {
169
+ const date = new Date(dayStartUtc);
170
+ const instants = [];
171
+ for (let hour = 0; hour < 24; hour++) {
172
+ if (!schedule.hours[hour]) continue;
173
+ for (let minute = 0; minute < 60; minute++) {
174
+ if (!schedule.minutes[minute]) continue;
175
+ const wall = { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate(), hour, minute };
176
+ const instant = instantOf(wall, timeZone);
177
+ if (instant !== null) instants.push(instant);
178
+ }
179
+ }
180
+ return instants;
181
+ }
182
+ function localDayStart(instant, timeZone) {
183
+ const wall = wallTimeAt(instant, timeZone);
184
+ return Date.UTC(wall.year, wall.month - 1, wall.day);
185
+ }
186
+ function nextMatchAfter(schedule, timeZone, after) {
187
+ const firstDay = localDayStart(after, timeZone);
188
+ for (let day = 0; day <= SCHEDULE_LOOKAHEAD_DAYS; day++) {
189
+ const dayStart = firstDay + day * DAY_MS;
190
+ if (!dayMatches(schedule, dayStart)) continue;
191
+ for (const instant of matchesOfDay(schedule, dayStart, timeZone)) {
192
+ if (instant > after) return instant;
193
+ }
194
+ }
195
+ return null;
196
+ }
197
+ function latestMatchAtOrBefore(schedule, timeZone, at) {
198
+ const firstDay = localDayStart(at, timeZone);
199
+ for (let day = 0; day <= SCHEDULE_LOOKAHEAD_DAYS; day++) {
200
+ const dayStart = firstDay - day * DAY_MS;
201
+ if (!dayMatches(schedule, dayStart)) continue;
202
+ const instants = matchesOfDay(schedule, dayStart, timeZone);
203
+ for (let i = instants.length - 1; i >= 0; i--) {
204
+ if (instants[i] <= at) return instants[i];
205
+ }
206
+ }
207
+ return null;
208
+ }
209
+
210
+ // src/query-suggestions/setting.ts
211
+ var RANGES = [
212
+ {
213
+ key: "minPeople",
214
+ wire: "min_people",
215
+ fallback: DEFAULT_MIN_PEOPLE,
216
+ min: MIN_MIN_PEOPLE,
217
+ max: MAX_MIN_PEOPLE
218
+ },
219
+ {
220
+ key: "minResults",
221
+ wire: "min_results",
222
+ fallback: DEFAULT_MIN_RESULTS,
223
+ min: MIN_MIN_RESULTS,
224
+ max: MAX_MIN_RESULTS
225
+ },
226
+ {
227
+ key: "retentionDays",
228
+ wire: "retention_days",
229
+ fallback: DEFAULT_RETENTION_DAYS,
230
+ min: MIN_RETENTION_DAYS,
231
+ max: MAX_RETENTION_DAYS
232
+ },
233
+ {
234
+ key: "maxPhrasesPerDay",
235
+ wire: "max_phrases_per_day",
236
+ fallback: DEFAULT_MAX_PHRASES_PER_DAY,
237
+ min: 1,
238
+ max: MAX_MAX_PHRASES_PER_DAY
239
+ },
240
+ {
241
+ key: "maxPhrasesPerPerson",
242
+ wire: "max_phrases_per_person",
243
+ fallback: DEFAULT_MAX_PHRASES_PER_PERSON,
244
+ min: 1,
245
+ max: MAX_MAX_PHRASES_PER_PERSON
246
+ },
247
+ {
248
+ key: "maxPeoplePerDay",
249
+ wire: "max_people_per_day",
250
+ fallback: DEFAULT_MAX_PEOPLE_PER_DAY,
251
+ min: 1,
252
+ max: MAX_MAX_PEOPLE_PER_DAY
253
+ },
254
+ { key: "maxGroups", wire: "max_groups", fallback: DEFAULT_MAX_GROUPS, min: 1, max: MAX_MAX_GROUPS },
255
+ { key: "maxLength", wire: "max_length", fallback: DEFAULT_MAX_LENGTH, min: 1, max: MAX_MAX_LENGTH },
256
+ { key: "minLetters", wire: "min_letters", fallback: DEFAULT_MIN_LETTERS, min: 1, max: "maxLength" },
257
+ { key: "maxWords", wire: "max_words", fallback: DEFAULT_MAX_WORDS, min: 1, max: MAX_MAX_WORDS },
258
+ { key: "maxDigits", wire: "max_digits", fallback: DEFAULT_MAX_DIGITS, min: 0, max: "maxLength" },
259
+ {
260
+ key: "maxMergePhrases",
261
+ wire: "max_merge_phrases",
262
+ fallback: DEFAULT_MAX_MERGE_PHRASES,
263
+ min: 1,
264
+ max: MAX_MAX_MERGE_PHRASES
265
+ },
266
+ {
267
+ key: "mergeMemoryBytes",
268
+ wire: "merge_memory_bytes",
269
+ fallback: DEFAULT_MERGE_MEMORY_BYTES,
270
+ min: MIN_MERGE_MEMORY_BYTES,
271
+ max: MAX_MERGE_MEMORY_BYTES
272
+ },
273
+ {
274
+ key: "saveIntervalMs",
275
+ wire: "save_interval_ms",
276
+ fallback: DEFAULT_SAVE_INTERVAL_MS,
277
+ min: MIN_SAVE_INTERVAL_MS,
278
+ max: MAX_SAVE_INTERVAL_MS
279
+ },
280
+ {
281
+ key: "resultChecksPerSecond",
282
+ wire: "result_checks_per_second",
283
+ fallback: DEFAULT_RESULT_CHECKS_PER_SECOND,
284
+ min: 1,
285
+ max: MAX_RESULT_CHECKS_PER_SECOND
286
+ }
287
+ ];
288
+ var SETTING_KEYS = /* @__PURE__ */ new Set(["enabled", "fields", "schedule", "timeZone", ...RANGES.map((range) => range.key)]);
289
+ function invalidSetting(message, details = {}) {
290
+ throw new NarsilError(ErrorCodes.CONFIG_INVALID, message, details);
291
+ }
292
+ function isWholeNumber(value) {
293
+ return typeof value === "number" && Number.isSafeInteger(value);
294
+ }
295
+ function knowsTimeZone(timeZone) {
296
+ try {
297
+ new Intl.DateTimeFormat("en-US", { timeZone });
298
+ return true;
299
+ } catch {
300
+ return false;
301
+ }
302
+ }
303
+ function resolveSetting(setting) {
304
+ const resolved = {
305
+ enabled: setting.enabled,
306
+ fields: [...setting.fields],
307
+ schedule: setting.schedule ?? DEFAULT_SCHEDULE,
308
+ timeZone: setting.timeZone ?? DEFAULT_TIME_ZONE
309
+ };
310
+ for (const range of RANGES) resolved[range.key] = setting[range.key] ?? range.fallback;
311
+ return resolved;
312
+ }
313
+ function requireProducts(resolved) {
314
+ if (resolved.maxPeoplePerDay * resolved.maxPhrasesPerPerson > MAX_PERSON_PAIRS_PER_DAY) {
315
+ invalidSetting(`maxPeoplePerDay times maxPhrasesPerPerson must stay at or below ${MAX_PERSON_PAIRS_PER_DAY}`);
316
+ }
317
+ if (resolved.maxPhrasesPerDay * resolved.minPeople > MAX_FILE_PEOPLE_PER_DAY) {
318
+ invalidSetting(`maxPhrasesPerDay times minPeople must stay at or below ${MAX_FILE_PEOPLE_PER_DAY}`);
319
+ }
320
+ if (resolved.maxMergePhrases * resolved.minPeople > MAX_MERGE_PEOPLE) {
321
+ invalidSetting(`maxMergePhrases times minPeople must stay at or below ${MAX_MERGE_PEOPLE}`);
322
+ }
323
+ }
324
+ function validateSetting(raw) {
325
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
326
+ invalidSetting("The query suggestions setting must be an object");
327
+ }
328
+ const input = raw;
329
+ for (const key of Object.keys(input)) {
330
+ if (!SETTING_KEYS.has(key)) invalidSetting(`The query suggestions setting holds an unknown key "${key}"`, { key });
331
+ }
332
+ if (typeof input.enabled !== "boolean") invalidSetting('The query suggestions setting needs a boolean "enabled"');
333
+ const fields = input.fields;
334
+ if (!Array.isArray(fields) || fields.length === 0 || fields.length > MAX_FIELDS) {
335
+ invalidSetting(`The query suggestions setting needs from 1 to ${MAX_FIELDS} fields`);
336
+ }
337
+ const seen = /* @__PURE__ */ new Set();
338
+ for (const field of fields) {
339
+ if (typeof field !== "string" || field.length === 0 || seen.has(field)) {
340
+ invalidSetting("Each field of the query suggestions setting must be a distinct, non-empty path");
341
+ }
342
+ seen.add(field);
343
+ }
344
+ const setting = { enabled: input.enabled, fields: [...seen] };
345
+ for (const range of RANGES) {
346
+ const value = input[range.key];
347
+ if (value === void 0) continue;
348
+ if (!isWholeNumber(value)) invalidSetting(`${range.key} must be a whole number`, { key: range.key });
349
+ setting[range.key] = value;
350
+ }
351
+ const resolved = resolveSetting(setting);
352
+ for (const range of RANGES) {
353
+ const value = resolved[range.key];
354
+ const max = typeof range.max === "number" ? range.max : resolved[range.max];
355
+ if (value < range.min || value > max) {
356
+ invalidSetting(`${range.key} must be from ${range.min} to ${max}`, { key: range.key, value });
357
+ }
358
+ }
359
+ requireProducts(resolved);
360
+ if (input.schedule !== void 0) {
361
+ if (typeof input.schedule !== "string") invalidSetting("schedule must be a string");
362
+ if (input.schedule !== SCHEDULE_OFF && parseSchedule(input.schedule) === null) {
363
+ invalidSetting('schedule must be "off" or a cron expression of five fields', { schedule: input.schedule });
364
+ }
365
+ setting.schedule = input.schedule;
366
+ }
367
+ if (input.timeZone !== void 0) {
368
+ if (typeof input.timeZone !== "string" || !knowsTimeZone(input.timeZone)) {
369
+ invalidSetting("timeZone must name an IANA time zone", { timeZone: String(input.timeZone) });
370
+ }
371
+ setting.timeZone = input.timeZone;
372
+ }
373
+ if (encode(settingToWire(setting)).byteLength > MAX_SETTING_BYTES) {
374
+ invalidSetting(`The query suggestions setting must encode to at most ${MAX_SETTING_BYTES} bytes`);
375
+ }
376
+ return setting;
377
+ }
378
+ function requireFieldsInSchema(setting, schema) {
379
+ const flat = flattenSchema(schema);
380
+ for (const field of setting.fields) {
381
+ const type = flat[field];
382
+ if (type !== "string" && type !== "string[]") {
383
+ invalidSetting(`Field "${field}" must be a string or string[] field of the schema`, { field });
384
+ }
385
+ }
386
+ }
387
+ function settingToWire(setting) {
388
+ const wire = { enabled: setting.enabled, fields: [...setting.fields] };
389
+ for (const range of RANGES) {
390
+ const value = setting[range.key];
391
+ if (value !== void 0) wire[range.wire] = value;
392
+ }
393
+ if (setting.schedule !== void 0) wire.schedule = setting.schedule;
394
+ if (setting.timeZone !== void 0) wire.time_zone = setting.timeZone;
395
+ return wire;
396
+ }
397
+ function settingFromWire(raw) {
398
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
399
+ invalidSetting("The stored query suggestions setting is not a map");
400
+ }
401
+ const wire = raw;
402
+ const camel = {};
403
+ const byWire = new Map([
404
+ ["enabled", "enabled"],
405
+ ["fields", "fields"],
406
+ ["schedule", "schedule"],
407
+ ["time_zone", "timeZone"],
408
+ ...RANGES.map((range) => [range.wire, range.key])
409
+ ]);
410
+ for (const [key, value] of Object.entries(wire)) {
411
+ const camelKey = byWire.get(key);
412
+ if (camelKey === void 0) invalidSetting(`The stored query suggestions setting holds an unknown key "${key}"`);
413
+ camel[camelKey] = value;
414
+ }
415
+ return validateSetting(camel);
416
+ }
417
+ function validateSource(raw) {
418
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
419
+ invalidSetting("The suggestions index marker must be a map");
420
+ }
421
+ const { index, group, ...rest } = raw;
422
+ if (Object.keys(rest).length > 0) invalidSetting("The suggestions index marker holds an unknown key");
423
+ if (typeof index !== "string" || index.length === 0 || index.length > MAX_SOURCE_INDEX_NAME_LENGTH) {
424
+ invalidSetting("The suggestions index marker needs the name of its source index");
425
+ }
426
+ if (!isGroup(group)) {
427
+ invalidSetting("The suggestions index marker needs a valid group");
428
+ }
429
+ return { index, group };
430
+ }
431
+
432
+ export { GROUP_FORMAT, acceptedPhrase, invalidSetting, isGroup, isNormalPhrase, isPerson, latestMatchAtOrBefore, nextMatchAfter, parseSchedule, requireFieldsInSchema, resolveSetting, settingFromWire, settingToWire, validateSetting, validateSource };