@mailwoman/resolver-wof-sqlite 9.2.0 → 9.4.0

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 (493) hide show
  1. package/README.md +16 -19
  2. package/lib/address/index.ts +9 -0
  3. package/{address-point-interpolation.ts → lib/address/point-interpolation.ts} +25 -24
  4. package/{address-point-schema.ts → lib/address/point-schema.ts} +18 -4
  5. package/lib/address/point.ts +328 -0
  6. package/{ancestry-backfill.ts → lib/ancestry/backfill.ts} +14 -19
  7. package/{ancestry.ts → lib/ancestry/index.ts} +5 -4
  8. package/{build-candidate.ts → lib/build-candidate.ts} +99 -79
  9. package/{build-slim.ts → lib/build-slim.ts} +150 -165
  10. package/{candidate → lib/candidate}/alias-bags.ts +8 -6
  11. package/{candidate → lib/candidate}/ancestors-sidecar.ts +13 -15
  12. package/{candidate → lib/candidate}/country-display-names.ts +2 -2
  13. package/lib/candidate/extract-fold.ts +219 -0
  14. package/{candidate → lib/candidate}/name-roles.ts +17 -16
  15. package/{candidate → lib/candidate}/own-name.ts +2 -1
  16. package/{candidate → lib/candidate}/place-attrs.ts +3 -3
  17. package/{candidate-ancestors-schema.ts → lib/candidate-ancestors-schema.ts} +4 -4
  18. package/{candidate-fts.ts → lib/candidate-fts.ts} +3 -3
  19. package/{candidate-importance.ts → lib/candidate-importance.ts} +53 -57
  20. package/{candidate-lookup.ts → lib/candidate-lookup.ts} +84 -80
  21. package/{candidate-schema.ts → lib/candidate-schema.ts} +6 -6
  22. package/{candidate-scoring.ts → lib/candidate-scoring.ts} +15 -22
  23. package/{capital-schema.ts → lib/capital-schema.ts} +5 -6
  24. package/{capitals.ts → lib/capitals.ts} +2 -2
  25. package/{coincident-roles.ts → lib/coincident-roles.ts} +9 -13
  26. package/{convention.ts → lib/convention/index.ts} +3 -3
  27. package/{convention-schema.ts → lib/convention/schema.ts} +2 -2
  28. package/{coverage-manifest-schema.ts → lib/coverage-manifest-schema.ts} +10 -10
  29. package/{currency-backfill.ts → lib/currency-backfill.ts} +126 -41
  30. package/lib/env.ts +50 -0
  31. package/{exact-match.ts → lib/exact-match.ts} +23 -14
  32. package/{sharding.ts → lib/extracts.ts} +61 -58
  33. package/{fst-autocomplete.ts → lib/fst/autocomplete.ts} +4 -4
  34. package/{fst-builder.ts → lib/fst/builder.ts} +17 -16
  35. package/{fst-deserialize-web.ts → lib/fst/deserialize-web.ts} +27 -87
  36. package/lib/fst/format.ts +106 -0
  37. package/{fst-freshness.ts → lib/fst/freshness.ts} +40 -74
  38. package/lib/fst/index.ts +14 -0
  39. package/{fst-matcher.ts → lib/fst/matcher.ts} +1 -1
  40. package/{fst-serialize.ts → lib/fst/serialize.ts} +37 -115
  41. package/{fst-types.ts → lib/fst/types.ts} +4 -2
  42. package/{fts.ts → lib/fts/index.ts} +24 -19
  43. package/{fts-query.ts → lib/fts/query.ts} +1 -1
  44. package/{geonames-aliases.ts → lib/geonames/aliases.ts} +13 -13
  45. package/lib/geonames/index.ts +8 -0
  46. package/{geonames-postal.ts → lib/geonames/postal.ts} +14 -13
  47. package/{index.ts → lib/index.ts} +37 -37
  48. package/{interpolation.ts → lib/interpolation.ts} +28 -26
  49. package/{lookup.ts → lib/lookup.ts} +130 -142
  50. package/lib/nsul/index.ts +8 -0
  51. package/lib/nsul/lookup.ts +144 -0
  52. package/lib/nsul/schema.ts +130 -0
  53. package/{place-importance-schema.ts → lib/place-importance-schema.ts} +7 -16
  54. package/lib/poi/index.ts +8 -0
  55. package/{poi-lookup.ts → lib/poi/lookup.ts} +22 -29
  56. package/{poi-schema.ts → lib/poi/schema.ts} +3 -4
  57. package/{postal-city-alias-lookup.ts → lib/postal/city-alias-lookup.ts} +14 -20
  58. package/{postal-city-candidate-schema.ts → lib/postal/city-candidate-schema.ts} +2 -2
  59. package/lib/postal/index.ts +9 -0
  60. package/{postcode-point-lookup.ts → lib/postcode-point-lookup.ts} +17 -15
  61. package/{primary-preference.ts → lib/primary-preference.ts} +43 -14
  62. package/{proximity-rerank.ts → lib/proximity-rerank.ts} +2 -2
  63. package/{ranking-weights.ts → lib/ranking-weights.ts} +30 -4
  64. package/{region-keys.ts → lib/region-keys.ts} +9 -9
  65. package/{reverse.ts → lib/reverse.ts} +34 -47
  66. package/{schema.ts → lib/schema.ts} +10 -0
  67. package/{search-fetch.ts → lib/search-fetch.ts} +29 -29
  68. package/{sqlite-convention-source.ts → lib/sqlite-convention-source.ts} +9 -10
  69. package/{sqlite-utils.ts → lib/sqlite-utils.ts} +14 -19
  70. package/{street-centroid-schema.ts → lib/street/centroid-schema.ts} +5 -5
  71. package/{street-centroid.ts → lib/street/centroid.ts} +15 -22
  72. package/lib/street/index.ts +13 -0
  73. package/{street-morphology-fst-builder.ts → lib/street/morphology-fst-builder.ts} +24 -14
  74. package/{street-morphology-fst-loader.ts → lib/street/morphology-fst-loader.ts} +14 -12
  75. package/{street-name-lookup.ts → lib/street/name-lookup.ts} +14 -30
  76. package/{street-normalize.ts → lib/street/normalize.ts} +86 -20
  77. package/{street-segment-schema.ts → lib/street/segment-schema.ts} +7 -7
  78. package/{types.ts → lib/types.ts} +18 -12
  79. package/{unified-schema.ts → lib/unified-schema.ts} +20 -24
  80. package/lib/uprn/existence.ts +84 -0
  81. package/lib/uprn/index.ts +9 -0
  82. package/{uprn-lookup.ts → lib/uprn/lookup.ts} +14 -19
  83. package/{uprn-schema.ts → lib/uprn/schema.ts} +3 -3
  84. package/lib/weights-overlay-linker.ts +879 -0
  85. package/out/address/index.d.ts +9 -0
  86. package/out/address/index.d.ts.map +1 -0
  87. package/out/address/index.js +9 -0
  88. package/out/address/index.js.map +1 -0
  89. package/out/{address-point-interpolation.d.ts → address/point-interpolation.d.ts} +12 -11
  90. package/out/address/point-interpolation.d.ts.map +1 -0
  91. package/out/{address-point-interpolation.js → address/point-interpolation.js} +18 -18
  92. package/out/address/point-interpolation.js.map +1 -0
  93. package/out/{address-point-schema.d.ts → address/point-schema.d.ts} +16 -6
  94. package/out/address/point-schema.d.ts.map +1 -0
  95. package/out/{address-point-schema.js → address/point-schema.js} +7 -3
  96. package/out/address/point-schema.js.map +1 -0
  97. package/out/{address-point.d.ts → address/point.d.ts} +19 -9
  98. package/out/address/point.d.ts.map +1 -0
  99. package/out/address/point.js +222 -0
  100. package/out/address/point.js.map +1 -0
  101. package/out/{ancestry-backfill.d.ts → ancestry/backfill.d.ts} +7 -5
  102. package/out/ancestry/backfill.d.ts.map +1 -0
  103. package/out/{ancestry-backfill.js → ancestry/backfill.js} +12 -16
  104. package/out/ancestry/backfill.js.map +1 -0
  105. package/out/{ancestry.d.ts → ancestry/index.d.ts} +4 -3
  106. package/out/ancestry/index.d.ts.map +1 -0
  107. package/out/{ancestry.js → ancestry/index.js} +3 -2
  108. package/out/ancestry/index.js.map +1 -0
  109. package/out/build-candidate.d.ts +32 -24
  110. package/out/build-candidate.d.ts.map +1 -1
  111. package/out/build-candidate.js +60 -54
  112. package/out/build-candidate.js.map +1 -1
  113. package/out/build-slim.d.ts +4 -4
  114. package/out/build-slim.d.ts.map +1 -1
  115. package/out/build-slim.js +124 -139
  116. package/out/build-slim.js.map +1 -1
  117. package/out/candidate/alias-bags.d.ts +5 -3
  118. package/out/candidate/alias-bags.d.ts.map +1 -1
  119. package/out/candidate/alias-bags.js +2 -2
  120. package/out/candidate/alias-bags.js.map +1 -1
  121. package/out/candidate/ancestors-sidecar.d.ts +9 -10
  122. package/out/candidate/ancestors-sidecar.d.ts.map +1 -1
  123. package/out/candidate/ancestors-sidecar.js +7 -7
  124. package/out/candidate/ancestors-sidecar.js.map +1 -1
  125. package/out/candidate/country-display-names.d.ts +1 -1
  126. package/out/candidate/country-display-names.d.ts.map +1 -1
  127. package/out/candidate/country-display-names.js +1 -1
  128. package/out/candidate/country-display-names.js.map +1 -1
  129. package/out/candidate/extract-fold.d.ts +41 -0
  130. package/out/candidate/extract-fold.d.ts.map +1 -0
  131. package/out/candidate/extract-fold.js +153 -0
  132. package/out/candidate/extract-fold.js.map +1 -0
  133. package/out/candidate/name-roles.d.ts +13 -11
  134. package/out/candidate/name-roles.d.ts.map +1 -1
  135. package/out/candidate/name-roles.js +11 -10
  136. package/out/candidate/name-roles.js.map +1 -1
  137. package/out/candidate/own-name.d.ts +1 -1
  138. package/out/candidate/own-name.d.ts.map +1 -1
  139. package/out/candidate/own-name.js +2 -1
  140. package/out/candidate/own-name.js.map +1 -1
  141. package/out/candidate/place-attrs.d.ts +3 -3
  142. package/out/candidate/place-attrs.d.ts.map +1 -1
  143. package/out/candidate/place-attrs.js +1 -1
  144. package/out/candidate/place-attrs.js.map +1 -1
  145. package/out/candidate-ancestors-schema.d.ts +4 -4
  146. package/out/candidate-ancestors-schema.d.ts.map +1 -1
  147. package/out/candidate-ancestors-schema.js +2 -2
  148. package/out/candidate-ancestors-schema.js.map +1 -1
  149. package/out/candidate-fts.d.ts +3 -3
  150. package/out/candidate-fts.d.ts.map +1 -1
  151. package/out/candidate-fts.js +1 -1
  152. package/out/candidate-fts.js.map +1 -1
  153. package/out/candidate-importance.d.ts +16 -16
  154. package/out/candidate-importance.d.ts.map +1 -1
  155. package/out/candidate-importance.js +46 -51
  156. package/out/candidate-importance.js.map +1 -1
  157. package/out/candidate-lookup.d.ts +16 -14
  158. package/out/candidate-lookup.d.ts.map +1 -1
  159. package/out/candidate-lookup.js +67 -63
  160. package/out/candidate-lookup.js.map +1 -1
  161. package/out/candidate-schema.d.ts +6 -6
  162. package/out/candidate-schema.d.ts.map +1 -1
  163. package/out/candidate-schema.js +1 -1
  164. package/out/candidate-schema.js.map +1 -1
  165. package/out/candidate-scoring.d.ts +7 -7
  166. package/out/candidate-scoring.d.ts.map +1 -1
  167. package/out/candidate-scoring.js +10 -14
  168. package/out/candidate-scoring.js.map +1 -1
  169. package/out/capital-schema.d.ts +3 -3
  170. package/out/capital-schema.d.ts.map +1 -1
  171. package/out/capital-schema.js +2 -2
  172. package/out/capital-schema.js.map +1 -1
  173. package/out/capitals.d.ts +1 -1
  174. package/out/capitals.d.ts.map +1 -1
  175. package/out/capitals.js +2 -2
  176. package/out/capitals.js.map +1 -1
  177. package/out/coincident-roles.d.ts +7 -6
  178. package/out/coincident-roles.d.ts.map +1 -1
  179. package/out/coincident-roles.js +2 -4
  180. package/out/coincident-roles.js.map +1 -1
  181. package/out/{convention.d.ts → convention/index.d.ts} +4 -4
  182. package/out/convention/index.d.ts.map +1 -0
  183. package/out/{convention.js → convention/index.js} +2 -2
  184. package/out/convention/index.js.map +1 -0
  185. package/out/{convention-schema.d.ts → convention/schema.d.ts} +2 -2
  186. package/out/convention/schema.d.ts.map +1 -0
  187. package/out/{convention-schema.js → convention/schema.js} +3 -3
  188. package/out/convention/schema.js.map +1 -0
  189. package/out/coverage-manifest-schema.d.ts +8 -8
  190. package/out/coverage-manifest-schema.d.ts.map +1 -1
  191. package/out/coverage-manifest-schema.js +5 -4
  192. package/out/coverage-manifest-schema.js.map +1 -1
  193. package/out/currency-backfill.d.ts +51 -7
  194. package/out/currency-backfill.d.ts.map +1 -1
  195. package/out/currency-backfill.js +65 -49
  196. package/out/currency-backfill.js.map +1 -1
  197. package/out/env.d.ts +43 -0
  198. package/out/env.d.ts.map +1 -0
  199. package/out/env.js +48 -0
  200. package/out/env.js.map +1 -0
  201. package/out/exact-match.d.ts +5 -5
  202. package/out/exact-match.d.ts.map +1 -1
  203. package/out/exact-match.js +10 -11
  204. package/out/exact-match.js.map +1 -1
  205. package/out/extracts.d.ts +114 -0
  206. package/out/extracts.d.ts.map +1 -0
  207. package/out/{sharding.js → extracts.js} +38 -38
  208. package/out/extracts.js.map +1 -0
  209. package/out/{fst-autocomplete.d.ts → fst/autocomplete.d.ts} +2 -2
  210. package/out/fst/autocomplete.d.ts.map +1 -0
  211. package/out/{fst-autocomplete.js → fst/autocomplete.js} +3 -3
  212. package/out/fst/autocomplete.js.map +1 -0
  213. package/out/{fst-builder.d.ts → fst/builder.d.ts} +5 -5
  214. package/out/fst/builder.d.ts.map +1 -0
  215. package/out/{fst-builder.js → fst/builder.js} +14 -13
  216. package/out/fst/builder.js.map +1 -0
  217. package/out/{fst-deserialize-web.d.ts → fst/deserialize-web.d.ts} +3 -3
  218. package/out/fst/deserialize-web.d.ts.map +1 -0
  219. package/out/{fst-deserialize-web.js → fst/deserialize-web.js} +10 -74
  220. package/out/fst/deserialize-web.js.map +1 -0
  221. package/out/fst/format.d.ts +80 -0
  222. package/out/fst/format.d.ts.map +1 -0
  223. package/out/fst/format.js +91 -0
  224. package/out/fst/format.js.map +1 -0
  225. package/out/{fst-freshness.d.ts → fst/freshness.d.ts} +9 -13
  226. package/out/fst/freshness.d.ts.map +1 -0
  227. package/out/{fst-freshness.js → fst/freshness.js} +40 -73
  228. package/out/fst/freshness.js.map +1 -0
  229. package/out/fst/index.d.ts +14 -0
  230. package/out/fst/index.d.ts.map +1 -0
  231. package/out/fst/index.js +14 -0
  232. package/out/fst/index.js.map +1 -0
  233. package/out/{fst-matcher.d.ts → fst/matcher.d.ts} +2 -2
  234. package/out/fst/matcher.d.ts.map +1 -0
  235. package/out/{fst-matcher.js → fst/matcher.js} +1 -1
  236. package/out/fst/matcher.js.map +1 -0
  237. package/out/{fst-serialize.d.ts → fst/serialize.d.ts} +5 -10
  238. package/out/fst/serialize.d.ts.map +1 -0
  239. package/out/{fst-serialize.js → fst/serialize.js} +18 -98
  240. package/out/fst/serialize.js.map +1 -0
  241. package/out/{fst-types.d.ts → fst/types.d.ts} +4 -3
  242. package/out/fst/types.d.ts.map +1 -0
  243. package/out/{fst-types.js → fst/types.js} +1 -1
  244. package/out/fst/types.js.map +1 -0
  245. package/out/{fts.d.ts → fts/index.d.ts} +16 -9
  246. package/out/fts/index.d.ts.map +1 -0
  247. package/out/{fts.js → fts/index.js} +16 -11
  248. package/out/fts/index.js.map +1 -0
  249. package/out/{fts-query.d.ts → fts/query.d.ts} +2 -2
  250. package/out/fts/query.d.ts.map +1 -0
  251. package/out/{fts-query.js → fts/query.js} +1 -1
  252. package/out/fts/query.js.map +1 -0
  253. package/out/{geonames-aliases.d.ts → geonames/aliases.d.ts} +8 -6
  254. package/out/geonames/aliases.d.ts.map +1 -0
  255. package/out/{geonames-aliases.js → geonames/aliases.js} +7 -7
  256. package/out/geonames/aliases.js.map +1 -0
  257. package/out/geonames/index.d.ts +8 -0
  258. package/out/geonames/index.d.ts.map +1 -0
  259. package/out/geonames/index.js +8 -0
  260. package/out/geonames/index.js.map +1 -0
  261. package/out/{geonames-postal.d.ts → geonames/postal.d.ts} +10 -8
  262. package/out/geonames/postal.d.ts.map +1 -0
  263. package/out/{geonames-postal.js → geonames/postal.js} +9 -9
  264. package/out/geonames/postal.js.map +1 -0
  265. package/out/index.d.ts +32 -32
  266. package/out/index.d.ts.map +1 -1
  267. package/out/index.js +24 -24
  268. package/out/index.js.map +1 -1
  269. package/out/interpolation.d.ts +11 -10
  270. package/out/interpolation.d.ts.map +1 -1
  271. package/out/interpolation.js +20 -20
  272. package/out/interpolation.js.map +1 -1
  273. package/out/lookup.d.ts +22 -21
  274. package/out/lookup.d.ts.map +1 -1
  275. package/out/lookup.js +103 -113
  276. package/out/lookup.js.map +1 -1
  277. package/out/name-score.d.ts.map +1 -1
  278. package/out/name-score.js.map +1 -1
  279. package/out/nsul/index.d.ts +8 -0
  280. package/out/nsul/index.d.ts.map +1 -0
  281. package/out/nsul/index.js +8 -0
  282. package/out/nsul/index.js.map +1 -0
  283. package/out/nsul/lookup.d.ts +83 -0
  284. package/out/nsul/lookup.d.ts.map +1 -0
  285. package/out/nsul/lookup.js +80 -0
  286. package/out/nsul/lookup.js.map +1 -0
  287. package/out/nsul/schema.d.ts +100 -0
  288. package/out/nsul/schema.d.ts.map +1 -0
  289. package/out/nsul/schema.js +78 -0
  290. package/out/nsul/schema.js.map +1 -0
  291. package/out/place-importance-schema.d.ts +5 -6
  292. package/out/place-importance-schema.d.ts.map +1 -1
  293. package/out/place-importance-schema.js +3 -4
  294. package/out/place-importance-schema.js.map +1 -1
  295. package/out/poi/index.d.ts +8 -0
  296. package/out/poi/index.d.ts.map +1 -0
  297. package/out/poi/index.js +8 -0
  298. package/out/poi/index.js.map +1 -0
  299. package/out/{poi-lookup.d.ts → poi/lookup.d.ts} +8 -10
  300. package/out/poi/lookup.d.ts.map +1 -0
  301. package/out/{poi-lookup.js → poi/lookup.js} +14 -18
  302. package/out/poi/lookup.js.map +1 -0
  303. package/out/{poi-schema.d.ts → poi/schema.d.ts} +4 -4
  304. package/out/poi/schema.d.ts.map +1 -0
  305. package/out/{poi-schema.js → poi/schema.js} +1 -1
  306. package/out/poi/schema.js.map +1 -0
  307. package/out/polygon-schema.d.ts.map +1 -1
  308. package/out/polygon-schema.js.map +1 -1
  309. package/out/{postal-city-alias-lookup.d.ts → postal/city-alias-lookup.d.ts} +6 -5
  310. package/out/postal/city-alias-lookup.d.ts.map +1 -0
  311. package/out/{postal-city-alias-lookup.js → postal/city-alias-lookup.js} +11 -15
  312. package/out/postal/city-alias-lookup.js.map +1 -0
  313. package/out/{postal-city-alias-schema.d.ts → postal/city-alias-schema.d.ts} +1 -1
  314. package/out/{postal-city-alias-schema.d.ts.map → postal/city-alias-schema.d.ts.map} +1 -1
  315. package/out/{postal-city-alias-schema.js → postal/city-alias-schema.js} +1 -1
  316. package/out/{postal-city-alias-schema.js.map → postal/city-alias-schema.js.map} +1 -1
  317. package/out/{postal-city-candidate-schema.d.ts → postal/city-candidate-schema.d.ts} +3 -3
  318. package/out/{postal-city-candidate-schema.d.ts.map → postal/city-candidate-schema.d.ts.map} +1 -1
  319. package/out/{postal-city-candidate-schema.js → postal/city-candidate-schema.js} +2 -2
  320. package/out/{postal-city-candidate-schema.js.map → postal/city-candidate-schema.js.map} +1 -1
  321. package/out/postal/index.d.ts +9 -0
  322. package/out/postal/index.d.ts.map +1 -0
  323. package/out/postal/index.js +9 -0
  324. package/out/postal/index.js.map +1 -0
  325. package/out/postcode-point-lookup.d.ts +10 -10
  326. package/out/postcode-point-lookup.d.ts.map +1 -1
  327. package/out/postcode-point-lookup.js +13 -13
  328. package/out/postcode-point-lookup.js.map +1 -1
  329. package/out/primary-preference.d.ts +15 -7
  330. package/out/primary-preference.d.ts.map +1 -1
  331. package/out/primary-preference.js +28 -12
  332. package/out/primary-preference.js.map +1 -1
  333. package/out/proximity-rerank.d.ts +2 -2
  334. package/out/proximity-rerank.d.ts.map +1 -1
  335. package/out/proximity-rerank.js +2 -2
  336. package/out/proximity-rerank.js.map +1 -1
  337. package/out/ranking-weights.d.ts +15 -3
  338. package/out/ranking-weights.d.ts.map +1 -1
  339. package/out/ranking-weights.js +21 -3
  340. package/out/ranking-weights.js.map +1 -1
  341. package/out/region-keys.d.ts +8 -8
  342. package/out/region-keys.d.ts.map +1 -1
  343. package/out/region-keys.js +9 -9
  344. package/out/region-keys.js.map +1 -1
  345. package/out/reverse.d.ts +6 -6
  346. package/out/reverse.d.ts.map +1 -1
  347. package/out/reverse.js +20 -29
  348. package/out/reverse.js.map +1 -1
  349. package/out/schema.d.ts +9 -0
  350. package/out/schema.d.ts.map +1 -1
  351. package/out/schema.js.map +1 -1
  352. package/out/search-fetch.d.ts +12 -10
  353. package/out/search-fetch.d.ts.map +1 -1
  354. package/out/search-fetch.js +21 -20
  355. package/out/search-fetch.js.map +1 -1
  356. package/out/sqlite-convention-source.d.ts +7 -7
  357. package/out/sqlite-convention-source.d.ts.map +1 -1
  358. package/out/sqlite-convention-source.js +5 -5
  359. package/out/sqlite-convention-source.js.map +1 -1
  360. package/out/sqlite-utils.d.ts +8 -9
  361. package/out/sqlite-utils.d.ts.map +1 -1
  362. package/out/sqlite-utils.js +6 -10
  363. package/out/sqlite-utils.js.map +1 -1
  364. package/out/{street-centroid-schema.d.ts → street/centroid-schema.d.ts} +6 -6
  365. package/out/{street-centroid-schema.d.ts.map → street/centroid-schema.d.ts.map} +1 -1
  366. package/out/{street-centroid-schema.js → street/centroid-schema.js} +5 -5
  367. package/out/{street-centroid-schema.js.map → street/centroid-schema.js.map} +1 -1
  368. package/out/{street-centroid.d.ts → street/centroid.d.ts} +7 -7
  369. package/out/street/centroid.d.ts.map +1 -0
  370. package/out/{street-centroid.js → street/centroid.js} +13 -19
  371. package/out/street/centroid.js.map +1 -0
  372. package/out/street/index.d.ts +13 -0
  373. package/out/street/index.d.ts.map +1 -0
  374. package/out/street/index.js +13 -0
  375. package/out/street/index.js.map +1 -0
  376. package/out/{street-morphology-fst-builder.d.ts → street/morphology-fst-builder.d.ts} +4 -4
  377. package/out/street/morphology-fst-builder.d.ts.map +1 -0
  378. package/out/{street-morphology-fst-builder.js → street/morphology-fst-builder.js} +18 -13
  379. package/out/street/morphology-fst-builder.js.map +1 -0
  380. package/out/{street-morphology-fst-loader.d.ts → street/morphology-fst-loader.d.ts} +5 -5
  381. package/out/street/morphology-fst-loader.d.ts.map +1 -0
  382. package/out/{street-morphology-fst-loader.js → street/morphology-fst-loader.js} +11 -10
  383. package/out/street/morphology-fst-loader.js.map +1 -0
  384. package/out/{street-name-lookup.d.ts → street/name-lookup.d.ts} +4 -7
  385. package/out/street/name-lookup.d.ts.map +1 -0
  386. package/out/{street-name-lookup.js → street/name-lookup.js} +9 -23
  387. package/out/street/name-lookup.js.map +1 -0
  388. package/out/{street-normalize.d.ts → street/normalize.d.ts} +38 -15
  389. package/out/street/normalize.d.ts.map +1 -0
  390. package/out/{street-normalize.js → street/normalize.js} +73 -17
  391. package/out/street/normalize.js.map +1 -0
  392. package/out/{street-segment-schema.d.ts → street/segment-schema.d.ts} +8 -8
  393. package/out/{street-segment-schema.d.ts.map → street/segment-schema.d.ts.map} +1 -1
  394. package/out/{street-segment-schema.js → street/segment-schema.js} +4 -4
  395. package/out/{street-segment-schema.js.map → street/segment-schema.js.map} +1 -1
  396. package/out/types.d.ts +18 -12
  397. package/out/types.d.ts.map +1 -1
  398. package/out/types.js.map +1 -1
  399. package/out/unified-schema.d.ts +5 -4
  400. package/out/unified-schema.d.ts.map +1 -1
  401. package/out/unified-schema.js +15 -18
  402. package/out/unified-schema.js.map +1 -1
  403. package/out/uprn/existence.d.ts +53 -0
  404. package/out/uprn/existence.d.ts.map +1 -0
  405. package/out/uprn/existence.js +61 -0
  406. package/out/uprn/existence.js.map +1 -0
  407. package/out/uprn/index.d.ts +9 -0
  408. package/out/uprn/index.d.ts.map +1 -0
  409. package/out/uprn/index.js +9 -0
  410. package/out/uprn/index.js.map +1 -0
  411. package/out/{uprn-lookup.d.ts → uprn/lookup.d.ts} +4 -4
  412. package/out/uprn/lookup.d.ts.map +1 -0
  413. package/out/{uprn-lookup.js → uprn/lookup.js} +11 -14
  414. package/out/uprn/lookup.js.map +1 -0
  415. package/out/{uprn-schema.d.ts → uprn/schema.d.ts} +4 -4
  416. package/out/uprn/schema.d.ts.map +1 -0
  417. package/out/{uprn-schema.js → uprn/schema.js} +4 -4
  418. package/out/uprn/schema.js.map +1 -0
  419. package/out/weights-overlay-linker.d.ts +184 -26
  420. package/out/weights-overlay-linker.d.ts.map +1 -1
  421. package/out/weights-overlay-linker.js +339 -86
  422. package/out/weights-overlay-linker.js.map +1 -1
  423. package/package.json +465 -269
  424. package/address-point.ts +0 -218
  425. package/candidate/shard-fold.ts +0 -137
  426. package/out/address-point-interpolation.d.ts.map +0 -1
  427. package/out/address-point-interpolation.js.map +0 -1
  428. package/out/address-point-schema.d.ts.map +0 -1
  429. package/out/address-point-schema.js.map +0 -1
  430. package/out/address-point.d.ts.map +0 -1
  431. package/out/address-point.js +0 -140
  432. package/out/address-point.js.map +0 -1
  433. package/out/ancestry-backfill.d.ts.map +0 -1
  434. package/out/ancestry-backfill.js.map +0 -1
  435. package/out/ancestry.d.ts.map +0 -1
  436. package/out/ancestry.js.map +0 -1
  437. package/out/candidate/shard-fold.d.ts +0 -31
  438. package/out/candidate/shard-fold.d.ts.map +0 -1
  439. package/out/candidate/shard-fold.js +0 -104
  440. package/out/candidate/shard-fold.js.map +0 -1
  441. package/out/convention-schema.d.ts.map +0 -1
  442. package/out/convention-schema.js.map +0 -1
  443. package/out/convention.d.ts.map +0 -1
  444. package/out/convention.js.map +0 -1
  445. package/out/fst-autocomplete.d.ts.map +0 -1
  446. package/out/fst-autocomplete.js.map +0 -1
  447. package/out/fst-builder.d.ts.map +0 -1
  448. package/out/fst-builder.js.map +0 -1
  449. package/out/fst-deserialize-web.d.ts.map +0 -1
  450. package/out/fst-deserialize-web.js.map +0 -1
  451. package/out/fst-freshness.d.ts.map +0 -1
  452. package/out/fst-freshness.js.map +0 -1
  453. package/out/fst-matcher.d.ts.map +0 -1
  454. package/out/fst-matcher.js.map +0 -1
  455. package/out/fst-serialize.d.ts.map +0 -1
  456. package/out/fst-serialize.js.map +0 -1
  457. package/out/fst-types.d.ts.map +0 -1
  458. package/out/fst-types.js.map +0 -1
  459. package/out/fts-query.d.ts.map +0 -1
  460. package/out/fts-query.js.map +0 -1
  461. package/out/fts.d.ts.map +0 -1
  462. package/out/fts.js.map +0 -1
  463. package/out/geonames-aliases.d.ts.map +0 -1
  464. package/out/geonames-aliases.js.map +0 -1
  465. package/out/geonames-postal.d.ts.map +0 -1
  466. package/out/geonames-postal.js.map +0 -1
  467. package/out/poi-lookup.d.ts.map +0 -1
  468. package/out/poi-lookup.js.map +0 -1
  469. package/out/poi-schema.d.ts.map +0 -1
  470. package/out/poi-schema.js.map +0 -1
  471. package/out/postal-city-alias-lookup.d.ts.map +0 -1
  472. package/out/postal-city-alias-lookup.js.map +0 -1
  473. package/out/sharding.d.ts +0 -114
  474. package/out/sharding.d.ts.map +0 -1
  475. package/out/sharding.js.map +0 -1
  476. package/out/street-centroid.d.ts.map +0 -1
  477. package/out/street-centroid.js.map +0 -1
  478. package/out/street-morphology-fst-builder.d.ts.map +0 -1
  479. package/out/street-morphology-fst-builder.js.map +0 -1
  480. package/out/street-morphology-fst-loader.d.ts.map +0 -1
  481. package/out/street-morphology-fst-loader.js.map +0 -1
  482. package/out/street-name-lookup.d.ts.map +0 -1
  483. package/out/street-name-lookup.js.map +0 -1
  484. package/out/street-normalize.d.ts.map +0 -1
  485. package/out/street-normalize.js.map +0 -1
  486. package/out/uprn-lookup.d.ts.map +0 -1
  487. package/out/uprn-lookup.js.map +0 -1
  488. package/out/uprn-schema.d.ts.map +0 -1
  489. package/out/uprn-schema.js.map +0 -1
  490. package/weights-overlay-linker.ts +0 -377
  491. /package/{name-score.ts → lib/name-score.ts} +0 -0
  492. /package/{polygon-schema.ts → lib/polygon-schema.ts} +0 -0
  493. /package/{postal-city-alias-schema.ts → lib/postal/city-alias-schema.ts} +0 -0
@@ -6,11 +6,11 @@
6
6
  * The exact-match tier's name probes — the two case-folded equality lookups that decide whether a
7
7
  * candidate holds the query text as its own name, an alias, or an official name.
8
8
  */
9
- import { aliasBagExactMatch } from "./fts.js";
9
+ import { aliasBagExactMatch, foldQueryText } from "#fts/index";
10
10
  /**
11
11
  * Among `ids`, return the subset whose name OR any alias equals `text` case-insensitively — the exact-match tier for
12
- * ranking. One indexed query over `<schema>.names`. When the shard has no `names` table (a slim DB built with
13
- * `dropNames`, or a postcode-only shard), fall back to the self-contained `place_search` FTS content: its `alt_names`
12
+ * ranking. One indexed query over `<schema>.names`. When the extract has no `names` table (a slim DB built with
13
+ * `dropNames`, or a postcode-only extract), fall back to the self-contained `place_search` FTS content: its `alt_names`
14
14
  * column is the same alias set joined on the boundary-preserving `ALIAS_SEPARATOR` (#523), so `aliasBagExactMatch`
15
15
  * recovers the exact alias tier ("New York City" → New York) that the dropped `names` table used to provide.
16
16
  */
@@ -30,23 +30,22 @@ export function exactMatchIDs(db, schemaName, ids, text) {
30
30
  return out;
31
31
  }
32
32
  catch {
33
- // No `names` table on this shard — fall through to the place_search alias bag.
33
+ // No `names` table on this extract — fall through to the place_search alias bag.
34
34
  }
35
35
  try {
36
36
  const rows = db
37
37
  .prepare(`SELECT wof_id AS id, name, alt_names FROM ${schemaName}.place_search WHERE wof_id IN (${placeholders})`)
38
38
  .all(...ids);
39
- const norm = (s) => s.toLowerCase().trim().replaceAll(/\s+/g, " ");
40
- const needle = norm(trimmed);
39
+ const needle = foldQueryText(trimmed);
41
40
  for (const r of rows) {
42
- if (r.name !== null && norm(r.name) === needle) {
41
+ if (r.name !== null && foldQueryText(r.name) === needle) {
43
42
  out.add(r.id);
44
43
  }
45
44
  }
46
45
  // Alias pass via the shared bag parser (#523). Separated bags (built since #523) get a true
47
- // per-alias equality check, ungated — matching the `names`-table branch above, where an
46
+ // per-alias equality check, unrestricted — matching the `names`-table branch above, where an
48
47
  // alias match counts as exact regardless of other candidates. Legacy bags (no separator)
49
- // fall back to padded containment, gated on "no canonical exact in the pool" because their
48
+ // fall back to padded containment, conditioned on "no canonical exact in the pool" because their
50
49
  // lost boundaries would otherwise false-promote interior fragments ("York" inside the alias
51
50
  // "New York City") or cross-alias fragments ("York New" across "…York" + "New City…").
52
51
  const anyCanonicalExact = out.size > 0;
@@ -57,7 +56,7 @@ export function exactMatchIDs(db, schemaName, ids, text) {
57
56
  }
58
57
  }
59
58
  catch {
60
- // Shard without place_search either → no exact-match tier. Falls back to weighted-sum order.
59
+ // Extract without place_search either → no exact-match tier. Falls back to weighted-sum order.
61
60
  }
62
61
  return out;
63
62
  }
@@ -82,7 +81,7 @@ export function officialNameIDs(db, schemaName, ids, text) {
82
81
  }
83
82
  }
84
83
  catch {
85
- // Pre-#940 gazetteer (no `official` column) or a names-less slim shard — feature inert.
84
+ // Pre-#940 gazetteer (no `official` column) or a names-less slim extract — feature inert.
86
85
  }
87
86
  return out;
88
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"exact-match.js","sourceRoot":"","sources":["../exact-match.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAAgB,EAAE,UAAkB,EAAE,GAAa,EAAE,IAAY;IAC9F,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAA;IAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAE3B,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAA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
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Multi-extract support for `WOFSQLitePlaceLookup` — opens multiple WOF SQLite distributions on one
7
+ * connection via `ATTACH DATABASE`, and routes queries to the right extract based on placetype.
8
+ *
9
+ * ## The FTS5 syntax rule that drove this design
10
+ *
11
+ * The naive `SELECT … FROM pc.place_search WHERE pc.place_search MATCH ?` fails — SQLite parses the
12
+ * schema-qualified table on the left of MATCH as "column place_search of table pc". Discovered in
13
+ * the spike at PR review time; documented as `_EXTRACT_RULE.md` should it ever bite again.
14
+ *
15
+ * The working form: schema-qualified in FROM, bare table name in MATCH:
16
+ *
17
+ * ```sql
18
+ * SELECT … FROM pc.place_search WHERE place_search MATCH ?
19
+ * ```
20
+ *
21
+ * Identical table names across attached extracts (which is what we have — every extract ships its own
22
+ * `place_search` + `place_bbox`) are fine because the bare-name MATCH resolves against FROM
23
+ * scope.
24
+ */
25
+ /**
26
+ * Derive a SQL-safe schema name from a WOF distribution filename. Used by `ATTACH DATABASE … AS <name>` so each extract
27
+ * gets a stable, predictable handle.
28
+ *
29
+ * Convention strips the `whosonfirst-data-` prefix and the `-latest.db` (or just `.db`) suffix, then replaces `-` with
30
+ * `_` for SQL identifier safety.
31
+ *
32
+ * Examples:
33
+ *
34
+ * - `whosonfirst-data-admin-us-latest.db` → `admin_us`
35
+ * - `whosonfirst-data-postalcode-us-latest.db` → `postalcode_us`
36
+ * - `whosonfirst-data-admin-latest.db` → `admin`
37
+ * - `my-custom.db` → `my_custom`
38
+ *
39
+ * Callers can override the derived name explicitly via `ExtractConfig.schemaName` when the filename doesn't follow WOF
40
+ * convention.
41
+ */
42
+ export declare function deriveSchemaName(path: string): string;
43
+ /**
44
+ * Per-extract configuration. The simple form is just a path string — the schema name is derived from it. The object
45
+ * form lets callers override the derived schema name (useful when a filename doesn't follow WOF convention) or attach
46
+ * an extra hint about which placetypes route here.
47
+ */
48
+ export interface ExtractConfig {
49
+ path: string;
50
+ /**
51
+ * Override the auto-derived schema name. Useful when the filename doesn't match WOF convention or when you want a
52
+ * memorable handle. Must be a valid SQLite identifier — `[a-zA-Z_][a-zA-Z0-9_]*`.
53
+ */
54
+ schemaName?: string;
55
+ /**
56
+ * Optional explicit list of placetypes this extract serves. When set, queries against any listed placetype are routed
57
+ * to this extract. When omitted, routing falls back to a name-match heuristic: a extract whose `schemaName` contains
58
+ * the placetype as a substring (e.g. `postalcode_us` for `postalcode` queries) is preferred for that placetype.
59
+ */
60
+ placetypes?: readonly string[];
61
+ }
62
+ /**
63
+ * Resolved post-derivation: paired path + chosen schema name + (possibly empty) placetypes hint. Used internally by
64
+ * `WOFSQLitePlaceLookup` so the routing logic operates on uniform structures.
65
+ */
66
+ export interface ResolvedExtract {
67
+ path: string;
68
+ schemaName: string;
69
+ placetypes: readonly string[];
70
+ }
71
+ /**
72
+ * Normalize the user-provided `databasePath` opt (which may be a single string, an array of strings, or an array of
73
+ * `ExtractConfig` objects) into a uniform `ResolvedExtract[]`.
74
+ *
75
+ * The first extract becomes `main` regardless of its derived schema name — that's the SQLite convention. Subsequent
76
+ * extracts keep their derived (or override) schema name.
77
+ */
78
+ export declare function resolveExtracts(input: string | ReadonlyArray<string | ExtractConfig>): ResolvedExtract[];
79
+ /**
80
+ * Pick the extract to route a query to given the requested placetype(s).
81
+ *
82
+ * Routing rules, in order:
83
+ *
84
+ * 1. If any extract has explicit `placetypes` that includes the requested placetype, use it.
85
+ * 2. Otherwise, if a non-main extract's `schemaName` matches the placetype (e.g. `postalcode_us` matches `postalcode`),
86
+ * use it.
87
+ * 3. Otherwise, fall back to `main`.
88
+ *
89
+ * This deliberately doesn't UNION across extracts — BM25 scores aren't comparable across separately- indexed corpora,
90
+ * and the typical mailwoman query has a single placetype anyway. If a caller needs cross-extract results they can issue
91
+ * two `findPlace` calls.
92
+ */
93
+ /**
94
+ * All placetype-matching extracts, in routing order (the country-aware pick chooses among these). Used by the bias
95
+ * path: a country-less postcode query with proximity hints fans out across every matching extract and merges, because
96
+ * single-extract routing would hide the cross-country ambiguity the hints exist to resolve ("48026" lives in
97
+ * postalcode-us AND postalcode-intl).
98
+ */
99
+ export declare function pickExtractsForPlacetype(extracts: ResolvedExtract[], placetype: string | undefined): ResolvedExtract[];
100
+ export declare function pickExtractForPlacetype(extracts: ResolvedExtract[], placetype: string | undefined, opts?: {
101
+ /**
102
+ * #920: the query's country constraint, when the caller has one. With MULTIPLE extracts matching a placetype
103
+ * (postalcode-us + postalcode-geonames-tail), first-match routing sent every postcode query to the first extract
104
+ * and starved the rest — a FI postcode could never reach the tail extract. When `country` is given and a matching
105
+ * extract's probed country set contains it, that extract wins; extracts without the country are skipped; the
106
+ * placetype-match order remains the tiebreak when no extract claims the country (or none was probed).
107
+ */
108
+ country?: string;
109
+ /**
110
+ * Per-schema probed country sets (see `WOFSQLitePlaceLookup`'s construction probe).
111
+ */
112
+ countriesBySchema?: ReadonlyMap<string, ReadonlySet<string>>;
113
+ }): ResolvedExtract;
114
+ //# sourceMappingURL=extracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extracts.d.ts","sourceRoot":"","sources":["../lib/extracts.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYrD;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CAC7B;AAOD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,eAAe,EAAE,CA0CxG;AAED;;;;;;;;;;;;;GAaG;AACH;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,QAAQ,EAAE,eAAe,EAAE,EAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,GAC3B,eAAe,EAAE,CAuBnB;AAED,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,eAAe,EAAE,EAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,CAAC,EAAE;IACN;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;CAC5D,GACC,eAAe,CAmCjB"}
@@ -1,16 +1,17 @@
1
+ import { basename } from "path-ts";
1
2
  /**
2
3
  * @copyright Sister Software
3
4
  * @license AGPL-3.0
4
5
  * @author Teffen Ellis, et al.
5
6
  *
6
- * Multi-shard support for `WOFSQLitePlaceLookup` — opens multiple WOF SQLite distributions on one
7
- * connection via `ATTACH DATABASE`, and routes queries to the right shard based on placetype.
7
+ * Multi-extract support for `WOFSQLitePlaceLookup` — opens multiple WOF SQLite distributions on one
8
+ * connection via `ATTACH DATABASE`, and routes queries to the right extract based on placetype.
8
9
  *
9
10
  * ## The FTS5 syntax rule that drove this design
10
11
  *
11
12
  * The naive `SELECT … FROM pc.place_search WHERE pc.place_search MATCH ?` fails — SQLite parses the
12
13
  * schema-qualified table on the left of MATCH as "column place_search of table pc". Discovered in
13
- * the spike at PR review time; documented as `_SHARD_RULE.md` should it ever bite again.
14
+ * the spike at PR review time; documented as `_EXTRACT_RULE.md` should it ever bite again.
14
15
  *
15
16
  * The working form: schema-qualified in FROM, bare table name in MATCH:
16
17
  *
@@ -18,13 +19,12 @@
18
19
  * SELECT … FROM pc.place_search WHERE place_search MATCH ?
19
20
  * ```
20
21
  *
21
- * Identical table names across attached shards (which is what we have — every shard ships its own
22
+ * Identical table names across attached extracts (which is what we have — every extract ships its own
22
23
  * `place_search` + `place_bbox`) are fine because the bare-name MATCH resolves against FROM
23
24
  * scope.
24
25
  */
25
- import { basename } from "node:path";
26
26
  /**
27
- * Derive a SQL-safe schema name from a WOF distribution filename. Used by `ATTACH DATABASE … AS <name>` so each shard
27
+ * Derive a SQL-safe schema name from a WOF distribution filename. Used by `ATTACH DATABASE … AS <name>` so each extract
28
28
  * gets a stable, predictable handle.
29
29
  *
30
30
  * Convention strips the `whosonfirst-data-` prefix and the `-latest.db` (or just `.db`) suffix, then replaces `-` with
@@ -37,7 +37,7 @@ import { basename } from "node:path";
37
37
  * - `whosonfirst-data-admin-latest.db` → `admin`
38
38
  * - `my-custom.db` → `my_custom`
39
39
  *
40
- * Callers can override the derived name explicitly via `ShardConfig.schemaName` when the filename doesn't follow WOF
40
+ * Callers can override the derived name explicitly via `ExtractConfig.schemaName` when the filename doesn't follow WOF
41
41
  * convention.
42
42
  */
43
43
  export function deriveSchemaName(path) {
@@ -57,15 +57,15 @@ export function deriveSchemaName(path) {
57
57
  const SQLITE_IDENT_RE = /^[A-Za-z_][A-Za-z0-9_]*$/u;
58
58
  /**
59
59
  * Normalize the user-provided `databasePath` opt (which may be a single string, an array of strings, or an array of
60
- * `ShardConfig` objects) into a uniform `ResolvedShard[]`.
60
+ * `ExtractConfig` objects) into a uniform `ResolvedExtract[]`.
61
61
  *
62
- * The first shard becomes `main` regardless of its derived schema name — that's the SQLite convention. Subsequent
63
- * shards keep their derived (or override) schema name.
62
+ * The first extract becomes `main` regardless of its derived schema name — that's the SQLite convention. Subsequent
63
+ * extracts keep their derived (or override) schema name.
64
64
  */
65
- export function resolveShards(input) {
65
+ export function resolveExtracts(input) {
66
66
  const list = typeof input === "string" ? [input] : input;
67
67
  if (!list.length)
68
- throw new Error("resolveShards: at least one shard is required");
68
+ throw new Error("resolveExtracts: at least one extract is required");
69
69
  const seen = new Set();
70
70
  const out = [];
71
71
  for (let i = 0; i < list.length; i++) {
@@ -73,16 +73,16 @@ export function resolveShards(input) {
73
73
  const cfg = typeof entry === "string" ? { path: entry } : entry;
74
74
  const derived = cfg.schemaName ?? deriveSchemaName(cfg.path);
75
75
  if (!SQLITE_IDENT_RE.test(derived)) {
76
- throw new Error(`resolveShards: schema name ${JSON.stringify(derived)} is not a valid SQLite identifier ` +
76
+ throw new Error(`resolveExtracts: schema name ${JSON.stringify(derived)} is not a valid SQLite identifier ` +
77
77
  `(derived from path ${JSON.stringify(cfg.path)}). Pass an explicit ` +
78
78
  `{ path, schemaName } to override.`);
79
79
  }
80
- // The first shard is always main per SQLite semantics — its derived name is informational
81
- // only. Subsequent shards must have unique non-main names.
80
+ // The first extract is always main per SQLite semantics — its derived name is informational
81
+ // only. Subsequent extracts must have unique non-main names.
82
82
  const schemaName = i === 0 ? "main" : derived;
83
83
  if (i > 0 && (schemaName === "main" || seen.has(schemaName))) {
84
- throw new Error(`resolveShards: schema name ${JSON.stringify(schemaName)} collides ` +
85
- `(either with "main" or another shard). Pass an explicit { path, schemaName }.`);
84
+ throw new Error(`resolveExtracts: schema name ${JSON.stringify(schemaName)} collides ` +
85
+ `(either with "main" or another extract). Pass an explicit { path, schemaName }.`);
86
86
  }
87
87
  seen.add(schemaName);
88
88
  out.push({
@@ -94,35 +94,35 @@ export function resolveShards(input) {
94
94
  return out;
95
95
  }
96
96
  /**
97
- * Pick the shard to route a query to given the requested placetype(s).
97
+ * Pick the extract to route a query to given the requested placetype(s).
98
98
  *
99
99
  * Routing rules, in order:
100
100
  *
101
- * 1. If any shard has explicit `placetypes` that includes the requested placetype, use it.
102
- * 2. Otherwise, if a non-main shard's `schemaName` matches the placetype (e.g. `postalcode_us` matches `postalcode`), use
103
- * it.
101
+ * 1. If any extract has explicit `placetypes` that includes the requested placetype, use it.
102
+ * 2. Otherwise, if a non-main extract's `schemaName` matches the placetype (e.g. `postalcode_us` matches `postalcode`),
103
+ * use it.
104
104
  * 3. Otherwise, fall back to `main`.
105
105
  *
106
- * This deliberately doesn't UNION across shards — BM25 scores aren't comparable across separately- indexed corpora, and
107
- * the typical mailwoman query has a single placetype anyway. If a caller needs cross-shard results they can issue two
108
- * `findPlace` calls.
106
+ * This deliberately doesn't UNION across extracts — BM25 scores aren't comparable across separately- indexed corpora,
107
+ * and the typical mailwoman query has a single placetype anyway. If a caller needs cross-extract results they can issue
108
+ * two `findPlace` calls.
109
109
  */
110
110
  /**
111
- * All placetype-matching shards, in routing order (the country-aware pick chooses among these). Used by the bias path:
112
- * a country-less postcode query with proximity hints fans out across every matching shard and merges, because
113
- * single-shard routing would hide the cross-country ambiguity the hints exist to resolve ("48026" lives in
111
+ * All placetype-matching extracts, in routing order (the country-aware pick chooses among these). Used by the bias
112
+ * path: a country-less postcode query with proximity hints fans out across every matching extract and merges, because
113
+ * single-extract routing would hide the cross-country ambiguity the hints exist to resolve ("48026" lives in
114
114
  * postalcode-us AND postalcode-intl).
115
115
  */
116
- export function pickShardsForPlacetype(shards, placetype) {
116
+ export function pickExtractsForPlacetype(extracts, placetype) {
117
117
  if (!placetype)
118
- return [shards[0]];
118
+ return [extracts[0]];
119
119
  const matches = [];
120
- for (const s of shards) {
120
+ for (const s of extracts) {
121
121
  if (s.placetypes.includes(placetype)) {
122
122
  matches.push(s);
123
123
  }
124
124
  }
125
- for (const s of shards) {
125
+ for (const s of extracts) {
126
126
  if (s.schemaName === "main" || matches.includes(s))
127
127
  continue;
128
128
  if (s.schemaName === placetype ||
@@ -131,18 +131,18 @@ export function pickShardsForPlacetype(shards, placetype) {
131
131
  matches.push(s);
132
132
  }
133
133
  }
134
- return matches.length ? matches : [shards[0]];
134
+ return matches.length ? matches : [extracts[0]];
135
135
  }
136
- export function pickShardForPlacetype(shards, placetype, opts) {
136
+ export function pickExtractForPlacetype(extracts, placetype, opts) {
137
137
  if (!placetype)
138
- return shards[0];
138
+ return extracts[0];
139
139
  const matches = [];
140
- for (const s of shards) {
140
+ for (const s of extracts) {
141
141
  if (s.placetypes.includes(placetype)) {
142
142
  matches.push(s);
143
143
  }
144
144
  }
145
- for (const s of shards) {
145
+ for (const s of extracts) {
146
146
  if (s.schemaName === "main" || matches.includes(s))
147
147
  continue;
148
148
  // Substring match: `postalcode_us` matches `postalcode`. Conservative — requires the
@@ -155,7 +155,7 @@ export function pickShardForPlacetype(shards, placetype, opts) {
155
155
  }
156
156
  }
157
157
  if (!matches.length)
158
- return shards[0];
158
+ return extracts[0];
159
159
  if (opts?.country && opts.countriesBySchema) {
160
160
  for (const s of matches) {
161
161
  if (opts.countriesBySchema.get(s.schemaName)?.has(opts.country))
@@ -164,4 +164,4 @@ export function pickShardForPlacetype(shards, placetype, opts) {
164
164
  }
165
165
  return matches[0];
166
166
  }
167
- //# sourceMappingURL=sharding.js.map
167
+ //# sourceMappingURL=extracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extracts.js","sourceRoot":"","sources":["../lib/extracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;SACzB,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC;SAClC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;SAC5B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,UAAU,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;IAEnC,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,kEAAkE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1G,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC;AAgCD;;GAEG;AACH,MAAM,eAAe,G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AA;QAC1E,CAAC;IACF,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,CAAE,CAAA;AACnB,CAAC"}
@@ -16,7 +16,7 @@
16
16
  * The matcher, both deserializers, and the serializer therefore stay here; what migrated is the
17
17
  * ALGORITHM, which is the half that drifts (the #861 share-the-function rule).
18
18
  */
19
- import type { FSTMatcher } from "./fst-matcher.ts";
19
+ import type { FSTMatcher } from "#fst/matcher";
20
20
  export interface AutocompleteResult {
21
21
  query: string;
22
22
  normalizedTokens: string[];
@@ -56,4 +56,4 @@ export interface AutocompleteOpts {
56
56
  * Autocomplete from the current prefix. Returns suggestions ranked referential-descending.
57
57
  */
58
58
  export declare function autocomplete(fst: FSTMatcher, query: string, opts?: AutocompleteOpts): AutocompleteResult;
59
- //# sourceMappingURL=fst-autocomplete.d.ts.map
59
+ //# sourceMappingURL=autocomplete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../lib/fst/autocomplete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAI9C,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,sBAAsB,EAAE,CAAA;CACrC;AAED,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACtB;AAyED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,kBAAkB,CA+B5G"}
@@ -17,7 +17,7 @@
17
17
  * ALGORITHM, which is the half that drifts (the #861 share-the-function rule).
18
18
  */
19
19
  import { autocomplete as ancestrieAutocomplete } from "@mailwoman/ancestrie";
20
- import { normalizeTokens } from "./fst-matcher.js";
20
+ import { normalizeTokens } from "#fst/matcher";
21
21
  /**
22
22
  * Max accepting entries collected per BFS branch — keeps one dense branch from starving the search.
23
23
  */
@@ -33,7 +33,7 @@ function topByReferential(entries, k) {
33
33
  return [...entries].toSorted((a, b) => b.referential - a.referential).slice(0, k);
34
34
  }
35
35
  /**
36
- * {@link FSTMatcher} presented through ancestrie's storage seam. Records carry the {@link PlaceEntry} itself as the
36
+ * {@link FSTMatcher} presented through ancestrie's storage interface. Records carry the {@link PlaceEntry} itself as the
37
37
  * payload, so the entry that WINS the algorithm's shallowest-depth rule is the entry whose fields the suggestion
38
38
  * reports — a side lookup keyed on id could pick a different surface's row (`crossCountryBranches` differs per
39
39
  * surface).
@@ -110,4 +110,4 @@ export function autocomplete(fst, query, opts = {}) {
110
110
  }),
111
111
  };
112
112
  }
113
- //# sourceMappingURL=fst-autocomplete.js.map
113
+ //# sourceMappingURL=autocomplete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../../lib/fst/autocomplete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AASH,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAG5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AA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/G,CAAC,CAAA;IAEF,OAAO;QACN,KAAK;QACL,gBAAgB;QAChB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACzC,6FAA6F;YAC7F,MAAM,KAAK,GAAG,CAAC,CAAC,OAAQ,CAAA;YAExB,OAAO;gBACN,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,GAAG,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;gBACjF,KAAK,EAAE,CAAC,CAAC,EAAE;gBACX,WAAW,EAAE,CAAC,CAAC,SAAS;gBACxB,UAAU,EAAE,CAAC,CAAC,UAAU;gBACxB,gBAAgB,EAAE,CAAC,CAAC,gBAAgB;aACpC,CAAA;QACF,CAAC,CAAC;KACF,CAAA;AACF,CAAC"}
@@ -10,11 +10,11 @@
10
10
  * Build pipeline: open WOF DB → query spr + names → normalize names → insert into trie → attach
11
11
  * PlaceEntry at terminals → return FSTMatcher.
12
12
  */
13
- import { FSTMatcher } from "./fst-matcher.ts";
14
- import type { BuildFSTOpts, BuildFSTResult, FSTProvenance } from "./fst-types.ts";
15
- export declare function buildFSTFromWOF(opts: BuildFSTOpts): {
13
+ import { FSTMatcher } from "#fst/matcher";
14
+ import type { BuildFSTOpts, BuildFSTResult, FSTProvenance } from "#fst/types";
15
+ export declare function buildFSTFromWOF(opts: BuildFSTOpts): Promise<{
16
16
  matcher: FSTMatcher;
17
17
  provenance: FSTProvenance;
18
18
  result: BuildFSTResult;
19
- };
20
- //# sourceMappingURL=fst-builder.d.ts.map
19
+ }>;
20
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../lib/fst/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAA2B,MAAM,YAAY,CAAA;AAsCtG,wBAAsB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC;IAClE,OAAO,EAAE,UAAU,CAAA;IACnB,UAAU,EAAE,aAAa,CAAA;IACzB,MAAM,EAAE,cAAc,CAAA;CACtB,CAAC,CAyTD"}
@@ -10,11 +10,12 @@
10
10
  * Build pipeline: open WOF DB → query spr + names → normalize names → insert into trie → attach
11
11
  * PlaceEntry at terminals → return FSTMatcher.
12
12
  */
13
- import { DatabaseSync } from "node:sqlite";
14
- import { readWOFSourceIdentity } from "./fst-freshness.js";
15
- import { FSTMatcher, normalizeTokens } from "./fst-matcher.js";
16
- import { loadImportanceSplit } from "./place-importance-schema.js";
17
- import { allRows, getRow } from "./sqlite-utils.js";
13
+ import { allRows, getRow } from "@mailwoman/core/utils";
14
+ import { DatabaseClient } from "@mailwoman/sqlite/client";
15
+ import { resolvePath } from "path-ts";
16
+ import { readWOFSourceIdentity } from "#fst/freshness";
17
+ import { FSTMatcher, normalizeTokens } from "#fst/matcher";
18
+ import { loadImportanceSplit } from "#place-importance-schema";
18
19
  const DEFAULT_PLACETYPES = [
19
20
  "country",
20
21
  "region",
@@ -31,13 +32,14 @@ const DEFAULT_LANGUAGES = ["eng", ""];
31
32
  * down, so both read paths bind the same shape.
32
33
  */
33
34
  const ANCESTOR_CHUNK = 500;
34
- export function buildFSTFromWOF(opts) {
35
+ export async function buildFSTFromWOF(opts) {
35
36
  const countries = opts.countries ?? DEFAULT_COUNTRIES;
36
37
  const placetypes = opts.placetypes ?? DEFAULT_PLACETYPES;
37
38
  const languages = opts.languages ?? DEFAULT_LANGUAGES;
38
39
  const progress = opts.onProgress ?? (() => { });
39
- progress("open", opts.dbPath);
40
- const db = new DatabaseSync(opts.dbPath, { open: true });
40
+ const dbPath = resolvePath(opts.dbPath);
41
+ progress("open", dbPath);
42
+ using db = new DatabaseClient(dbPath, { open: true });
41
43
  // Phase 1: Load all matching SPR rows.
42
44
  progress("spr", `Loading places for countries=[${countries}], placetypes=[${placetypes}]`);
43
45
  const placeholders = (arr) => arr.map(() => "?").join(",");
@@ -234,7 +236,6 @@ export function buildFSTFromWOF(opts) {
234
236
  }
235
237
  }
236
238
  }
237
- db.close();
238
239
  progress("done", `Built trie: ${nodes.length} states, ${insertCount} name insertions` +
239
240
  (excludedCount > 0 ? ` (${excludedCount} degenerate surfaces excluded)` : ""));
240
241
  const edgeCount = nodes.reduce((sum, n) => sum + n.edges.size, 0);
@@ -245,8 +246,8 @@ export function buildFSTFromWOF(opts) {
245
246
  // and is free whenever the `.md5` sidecar is current, which the admin build already writes.
246
247
  // `sourceIdentity` lets a caller that already knows the digest (or is building from something that
247
248
  // is not a file at all) supply it instead.
248
- progress("stamp", `Reading source identity for ${opts.dbPath}`);
249
- const source = opts.sourceIdentity ?? readWOFSourceIdentity(opts.dbPath);
249
+ progress("stamp", `Reading source identity for ${dbPath}`);
250
+ const source = opts.sourceIdentity ?? (await readWOFSourceIdentity(dbPath));
250
251
  const provenance = {
251
252
  builtAt: new Date().toISOString(),
252
253
  countries,
@@ -257,7 +258,7 @@ export function buildFSTFromWOF(opts) {
257
258
  importanceMatches: split.referential.size,
258
259
  encyclopedicMatches: split.encyclopedic.size,
259
260
  importanceSource: split.source,
260
- sourceDB: opts.dbPath,
261
+ sourceDB: dbPath,
261
262
  sourceDBMD5: source.md5,
262
263
  sourceDBBytes: source.bytes,
263
264
  ...(excludeSurfaces !== undefined || excludeAllTokensOf !== undefined
@@ -275,4 +276,4 @@ export function buildFSTFromWOF(opts) {
275
276
  },
276
277
  };
277
278
  }
278
- //# sourceMappingURL=fst-builder.js.map
279
+ //# sourceMappingURL=buil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AC,WAAW,CAAC,IAAI;QACzC,mBAAmB,EAAE,KAAK,CAAC,YAAY,CAAC,IAAI;QAC5C,gBAAgB,EAAE,KAAK,CAAC,MAAM;QAC9B,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,MAAM,CAAC,GAAG;QACvB,aAAa,EAAE,MAAM,CAAC,KAAK;QAC3B,GAAG,CAAC,eAAe,KAAK,SAAS,IAAI,kBAAkB,KAAK,SAAS;YACpE,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,IAAI,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE;YAC/F,CAAC,CAAC,EAAE,CAAC;KACN,CAAA;IAED,OAAO;QACN,OAAO;QACP,UAAU;QACV,MAAM,EAAE;YACP,UAAU,EAAE,KAAK,CAAC,MAAM;YACxB,UAAU,EAAE,OAAO,CAAC,MAAM;YAC1B,SAAS;YACT,UAAU,EAAE,WAAW;SACvB;KACD,CAAA;AACF,CAAC"}
@@ -9,8 +9,8 @@
9
9
  * This is a read-only counterpart to fst-serialize.ts — serialization stays Node-only (it's a
10
10
  * build-time operation).
11
11
  */
12
- import { FSTMatcher } from "./fst-matcher.ts";
13
- import type { FSTProvenance } from "./fst-types.ts";
12
+ import { FSTMatcher } from "#fst/matcher";
13
+ import type { FSTProvenance } from "#fst/types";
14
14
  export declare function deserializeFSTWeb(input: ArrayBuffer | Uint8Array): FSTMatcher;
15
15
  export declare function readFSTProvenanceWeb(input: ArrayBuffer | Uint8Array): FSTProvenance | undefined;
16
- //# sourceMappingURL=fst-deserialize-web.d.ts.map
16
+ //# sourceMappingURL=deserialize-web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deserialize-web.d.ts","sourceRoot":"","sources":["../../lib/fst/deserialize-web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,YAAY,CAAA;AAE3D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,CAyH7E;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,CAqB/F"}