@mailwoman/resolver-wof-sqlite 9.1.0 → 9.3.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 (501) hide show
  1. package/README.md +36 -20
  2. package/lib/address/index.ts +9 -0
  3. package/{address-point-interpolation.ts → lib/address/point-interpolation.ts} +40 -28
  4. package/{address-point-schema.ts → lib/address/point-schema.ts} +34 -8
  5. package/lib/address/point.ts +280 -0
  6. package/{ancestry-backfill.ts → lib/ancestry/backfill.ts} +14 -19
  7. package/{ancestry.ts → lib/ancestry/index.ts} +13 -8
  8. package/{build-candidate.ts → lib/build-candidate.ts} +243 -199
  9. package/{build-slim.ts → lib/build-slim.ts} +153 -168
  10. package/lib/candidate/alias-bags.ts +56 -0
  11. package/lib/candidate/ancestors-sidecar.ts +204 -0
  12. package/lib/candidate/country-display-names.ts +79 -0
  13. package/lib/candidate/extract-fold.ts +138 -0
  14. package/lib/candidate/name-roles.ts +238 -0
  15. package/lib/candidate/own-name.ts +146 -0
  16. package/lib/candidate/place-attrs.ts +44 -0
  17. package/lib/candidate-ancestors-schema.ts +195 -0
  18. package/{candidate-fts.ts → lib/candidate-fts.ts} +7 -5
  19. package/{candidate-importance.ts → lib/candidate-importance.ts} +54 -57
  20. package/lib/candidate-lookup.ts +976 -0
  21. package/{candidate-schema.ts → lib/candidate-schema.ts} +34 -6
  22. package/lib/candidate-scoring.ts +261 -0
  23. package/lib/capital-schema.ts +89 -0
  24. package/lib/capitals.ts +148 -0
  25. package/{coincident-roles.ts → lib/coincident-roles.ts} +75 -19
  26. package/{convention.ts → lib/convention/index.ts} +5 -5
  27. package/lib/convention/schema.ts +72 -0
  28. package/{coverage-manifest-schema.ts → lib/coverage-manifest-schema.ts} +15 -16
  29. package/lib/currency-backfill.ts +334 -0
  30. package/lib/env.ts +50 -0
  31. package/lib/exact-match.ts +113 -0
  32. package/{sharding.ts → lib/extracts.ts} +63 -60
  33. package/lib/fst/autocomplete.ts +176 -0
  34. package/{fst-builder.ts → lib/fst/builder.ts} +30 -27
  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} +42 -75
  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} +28 -23
  43. package/{fts-query.ts → lib/fts/query.ts} +2 -2
  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} +16 -15
  47. package/{index.ts → lib/index.ts} +52 -48
  48. package/{interpolation.ts → lib/interpolation.ts} +137 -41
  49. package/lib/lookup.ts +861 -0
  50. package/{name-score.ts → lib/name-score.ts} +6 -4
  51. package/lib/nsul/index.ts +8 -0
  52. package/lib/nsul/lookup.ts +144 -0
  53. package/lib/nsul/schema.ts +130 -0
  54. package/{place-importance-schema.ts → lib/place-importance-schema.ts} +70 -22
  55. package/lib/poi/index.ts +8 -0
  56. package/{poi-lookup.ts → lib/poi/lookup.ts} +32 -39
  57. package/{poi-schema.ts → lib/poi/schema.ts} +10 -6
  58. package/lib/polygon-schema.ts +47 -0
  59. package/{postal-city-alias-lookup.ts → lib/postal/city-alias-lookup.ts} +15 -21
  60. package/{postal-city-candidate-schema.ts → lib/postal/city-candidate-schema.ts} +4 -2
  61. package/lib/postal/index.ts +9 -0
  62. package/{postcode-point-lookup.ts → lib/postcode-point-lookup.ts} +17 -15
  63. package/lib/primary-preference.ts +226 -0
  64. package/lib/proximity-rerank.ts +120 -0
  65. package/{ranking-weights.ts → lib/ranking-weights.ts} +30 -4
  66. package/lib/region-keys.ts +144 -0
  67. package/{reverse.ts → lib/reverse.ts} +45 -56
  68. package/{schema.ts → lib/schema.ts} +11 -1
  69. package/lib/search-fetch.ts +257 -0
  70. package/{sqlite-convention-source.ts → lib/sqlite-convention-source.ts} +9 -10
  71. package/lib/sqlite-utils.ts +83 -0
  72. package/{street-centroid-schema.ts → lib/street/centroid-schema.ts} +12 -6
  73. package/{street-centroid.ts → lib/street/centroid.ts} +26 -28
  74. package/lib/street/index.ts +13 -0
  75. package/{street-morphology-fst-builder.ts → lib/street/morphology-fst-builder.ts} +24 -14
  76. package/{street-morphology-fst-loader.ts → lib/street/morphology-fst-loader.ts} +14 -12
  77. package/{street-name-lookup.ts → lib/street/name-lookup.ts} +14 -30
  78. package/lib/street/normalize.ts +572 -0
  79. package/{street-segment-schema.ts → lib/street/segment-schema.ts} +13 -8
  80. package/{types.ts → lib/types.ts} +49 -9
  81. package/{unified-schema.ts → lib/unified-schema.ts} +21 -25
  82. package/lib/uprn/existence.ts +84 -0
  83. package/lib/uprn/index.ts +9 -0
  84. package/lib/uprn/lookup.ts +206 -0
  85. package/lib/uprn/schema.ts +124 -0
  86. package/lib/weights-overlay-linker.ts +878 -0
  87. package/out/address/index.d.ts +9 -0
  88. package/out/address/index.d.ts.map +1 -0
  89. package/out/address/index.js +9 -0
  90. package/out/address/index.js.map +1 -0
  91. package/out/{address-point-interpolation.d.ts → address/point-interpolation.d.ts} +11 -10
  92. package/out/address/point-interpolation.d.ts.map +1 -0
  93. package/out/{address-point-interpolation.js → address/point-interpolation.js} +29 -23
  94. package/out/address/point-interpolation.js.map +1 -0
  95. package/out/{address-point-schema.d.ts → address/point-schema.d.ts} +30 -10
  96. package/out/address/point-schema.d.ts.map +1 -0
  97. package/out/{address-point-schema.js → address/point-schema.js} +7 -3
  98. package/out/address/point-schema.js.map +1 -0
  99. package/out/{address-point.d.ts → address/point.d.ts} +16 -8
  100. package/out/address/point.d.ts.map +1 -0
  101. package/out/address/point.js +191 -0
  102. package/out/address/point.js.map +1 -0
  103. package/out/{ancestry-backfill.d.ts → ancestry/backfill.d.ts} +7 -5
  104. package/out/ancestry/backfill.d.ts.map +1 -0
  105. package/out/{ancestry-backfill.js → ancestry/backfill.js} +12 -16
  106. package/out/ancestry/backfill.js.map +1 -0
  107. package/out/{ancestry.d.ts → ancestry/index.d.ts} +6 -5
  108. package/out/ancestry/index.d.ts.map +1 -0
  109. package/out/{ancestry.js → ancestry/index.js} +7 -7
  110. package/out/ancestry/index.js.map +1 -0
  111. package/out/build-candidate.d.ts +88 -7
  112. package/out/build-candidate.d.ts.map +1 -1
  113. package/out/build-candidate.js +145 -149
  114. package/out/build-candidate.js.map +1 -1
  115. package/out/build-slim.d.ts +5 -5
  116. package/out/build-slim.d.ts.map +1 -1
  117. package/out/build-slim.js +127 -142
  118. package/out/build-slim.js.map +1 -1
  119. package/out/candidate/alias-bags.d.ts +19 -0
  120. package/out/candidate/alias-bags.d.ts.map +1 -0
  121. package/out/candidate/alias-bags.js +39 -0
  122. package/out/candidate/alias-bags.js.map +1 -0
  123. package/out/candidate/ancestors-sidecar.d.ts +32 -0
  124. package/out/candidate/ancestors-sidecar.d.ts.map +1 -0
  125. package/out/candidate/ancestors-sidecar.js +140 -0
  126. package/out/candidate/ancestors-sidecar.js.map +1 -0
  127. package/out/candidate/country-display-names.d.ts +35 -0
  128. package/out/candidate/country-display-names.d.ts.map +1 -0
  129. package/out/candidate/country-display-names.js +59 -0
  130. package/out/candidate/country-display-names.js.map +1 -0
  131. package/out/candidate/extract-fold.d.ts +32 -0
  132. package/out/candidate/extract-fold.d.ts.map +1 -0
  133. package/out/candidate/extract-fold.js +104 -0
  134. package/out/candidate/extract-fold.js.map +1 -0
  135. package/out/candidate/name-roles.d.ts +57 -0
  136. package/out/candidate/name-roles.d.ts.map +1 -0
  137. package/out/candidate/name-roles.js +166 -0
  138. package/out/candidate/name-roles.js.map +1 -0
  139. package/out/candidate/own-name.d.ts +50 -0
  140. package/out/candidate/own-name.d.ts.map +1 -0
  141. package/out/candidate/own-name.js +132 -0
  142. package/out/candidate/own-name.js.map +1 -0
  143. package/out/candidate/place-attrs.d.ts +43 -0
  144. package/out/candidate/place-attrs.d.ts.map +1 -0
  145. package/out/candidate/place-attrs.js +15 -0
  146. package/out/candidate/place-attrs.js.map +1 -0
  147. package/out/candidate-ancestors-schema.d.ts +150 -0
  148. package/out/candidate-ancestors-schema.d.ts.map +1 -0
  149. package/out/candidate-ancestors-schema.js +123 -0
  150. package/out/candidate-ancestors-schema.js.map +1 -0
  151. package/out/candidate-fts.d.ts +7 -5
  152. package/out/candidate-fts.d.ts.map +1 -1
  153. package/out/candidate-fts.js +5 -3
  154. package/out/candidate-fts.js.map +1 -1
  155. package/out/candidate-importance.d.ts +16 -16
  156. package/out/candidate-importance.d.ts.map +1 -1
  157. package/out/candidate-importance.js +47 -52
  158. package/out/candidate-importance.js.map +1 -1
  159. package/out/candidate-lookup.d.ts +31 -52
  160. package/out/candidate-lookup.d.ts.map +1 -1
  161. package/out/candidate-lookup.js +380 -172
  162. package/out/candidate-lookup.js.map +1 -1
  163. package/out/candidate-schema.d.ts +31 -7
  164. package/out/candidate-schema.d.ts.map +1 -1
  165. package/out/candidate-schema.js +3 -0
  166. package/out/candidate-schema.js.map +1 -1
  167. package/out/candidate-scoring.d.ts +34 -0
  168. package/out/candidate-scoring.d.ts.map +1 -0
  169. package/out/candidate-scoring.js +196 -0
  170. package/out/candidate-scoring.js.map +1 -0
  171. package/out/capital-schema.d.ts +51 -0
  172. package/out/capital-schema.d.ts.map +1 -0
  173. package/out/capital-schema.js +63 -0
  174. package/out/capital-schema.js.map +1 -0
  175. package/out/capitals.d.ts +69 -0
  176. package/out/capitals.d.ts.map +1 -0
  177. package/out/capitals.js +98 -0
  178. package/out/capitals.js.map +1 -0
  179. package/out/coincident-roles.d.ts +12 -4
  180. package/out/coincident-roles.d.ts.map +1 -1
  181. package/out/coincident-roles.js +43 -11
  182. package/out/coincident-roles.js.map +1 -1
  183. package/out/{convention.d.ts → convention/index.d.ts} +5 -5
  184. package/out/convention/index.d.ts.map +1 -0
  185. package/out/{convention.js → convention/index.js} +4 -4
  186. package/out/convention/index.js.map +1 -0
  187. package/out/convention/schema.d.ts +51 -0
  188. package/out/convention/schema.d.ts.map +1 -0
  189. package/out/convention/schema.js +34 -0
  190. package/out/convention/schema.js.map +1 -0
  191. package/out/coverage-manifest-schema.d.ts +8 -8
  192. package/out/coverage-manifest-schema.d.ts.map +1 -1
  193. package/out/coverage-manifest-schema.js +6 -10
  194. package/out/coverage-manifest-schema.js.map +1 -1
  195. package/out/currency-backfill.d.ts +90 -0
  196. package/out/currency-backfill.d.ts.map +1 -0
  197. package/out/currency-backfill.js +196 -0
  198. package/out/currency-backfill.js.map +1 -0
  199. package/out/env.d.ts +43 -0
  200. package/out/env.d.ts.map +1 -0
  201. package/out/env.js +48 -0
  202. package/out/env.js.map +1 -0
  203. package/out/exact-match.d.ts +25 -0
  204. package/out/exact-match.d.ts.map +1 -0
  205. package/out/exact-match.js +88 -0
  206. package/out/exact-match.js.map +1 -0
  207. package/out/extracts.d.ts +114 -0
  208. package/out/extracts.d.ts.map +1 -0
  209. package/out/{sharding.js → extracts.js} +38 -38
  210. package/out/extracts.js.map +1 -0
  211. package/out/{fst-autocomplete.d.ts → fst/autocomplete.d.ts} +13 -13
  212. package/out/fst/autocomplete.d.ts.map +1 -0
  213. package/out/fst/autocomplete.js +113 -0
  214. package/out/fst/autocomplete.js.map +1 -0
  215. package/out/{fst-builder.d.ts → fst/builder.d.ts} +5 -5
  216. package/out/fst/builder.d.ts.map +1 -0
  217. package/out/{fst-builder.js → fst/builder.js} +24 -24
  218. package/out/fst/builder.js.map +1 -0
  219. package/out/{fst-deserialize-web.d.ts → fst/deserialize-web.d.ts} +3 -3
  220. package/out/fst/deserialize-web.d.ts.map +1 -0
  221. package/out/{fst-deserialize-web.js → fst/deserialize-web.js} +10 -74
  222. package/out/fst/deserialize-web.js.map +1 -0
  223. package/out/fst/format.d.ts +80 -0
  224. package/out/fst/format.d.ts.map +1 -0
  225. package/out/fst/format.js +91 -0
  226. package/out/fst/format.js.map +1 -0
  227. package/out/{fst-freshness.d.ts → fst/freshness.d.ts} +11 -14
  228. package/out/fst/freshness.d.ts.map +1 -0
  229. package/out/{fst-freshness.js → fst/freshness.js} +42 -74
  230. package/out/fst/freshness.js.map +1 -0
  231. package/out/fst/index.d.ts +14 -0
  232. package/out/fst/index.d.ts.map +1 -0
  233. package/out/fst/index.js +14 -0
  234. package/out/fst/index.js.map +1 -0
  235. package/out/{fst-matcher.d.ts → fst/matcher.d.ts} +2 -2
  236. package/out/fst/matcher.d.ts.map +1 -0
  237. package/out/{fst-matcher.js → fst/matcher.js} +1 -1
  238. package/out/fst/matcher.js.map +1 -0
  239. package/out/{fst-serialize.d.ts → fst/serialize.d.ts} +5 -10
  240. package/out/fst/serialize.d.ts.map +1 -0
  241. package/out/{fst-serialize.js → fst/serialize.js} +18 -98
  242. package/out/fst/serialize.js.map +1 -0
  243. package/out/{fst-types.d.ts → fst/types.d.ts} +4 -3
  244. package/out/fst/types.d.ts.map +1 -0
  245. package/out/{fst-types.js → fst/types.js} +1 -1
  246. package/out/fst/types.js.map +1 -0
  247. package/out/{fts.d.ts → fts/index.d.ts} +20 -13
  248. package/out/fts/index.d.ts.map +1 -0
  249. package/out/{fts.js → fts/index.js} +20 -15
  250. package/out/fts/index.js.map +1 -0
  251. package/out/{fts-query.d.ts → fts/query.d.ts} +2 -2
  252. package/out/fts/query.d.ts.map +1 -0
  253. package/out/{fts-query.js → fts/query.js} +2 -2
  254. package/out/fts/query.js.map +1 -0
  255. package/out/{geonames-aliases.d.ts → geonames/aliases.d.ts} +8 -6
  256. package/out/geonames/aliases.d.ts.map +1 -0
  257. package/out/{geonames-aliases.js → geonames/aliases.js} +7 -7
  258. package/out/geonames/aliases.js.map +1 -0
  259. package/out/geonames/index.d.ts +8 -0
  260. package/out/geonames/index.d.ts.map +1 -0
  261. package/out/geonames/index.js +8 -0
  262. package/out/geonames/index.js.map +1 -0
  263. package/out/{geonames-postal.d.ts → geonames/postal.d.ts} +12 -10
  264. package/out/geonames/postal.d.ts.map +1 -0
  265. package/out/{geonames-postal.js → geonames/postal.js} +11 -11
  266. package/out/geonames/postal.js.map +1 -0
  267. package/out/index.d.ts +32 -31
  268. package/out/index.d.ts.map +1 -1
  269. package/out/index.js +24 -24
  270. package/out/index.js.map +1 -1
  271. package/out/interpolation.d.ts +18 -9
  272. package/out/interpolation.d.ts.map +1 -1
  273. package/out/interpolation.js +108 -36
  274. package/out/interpolation.js.map +1 -1
  275. package/out/lookup.d.ts +25 -25
  276. package/out/lookup.d.ts.map +1 -1
  277. package/out/lookup.js +174 -558
  278. package/out/lookup.js.map +1 -1
  279. package/out/name-score.d.ts +0 -10
  280. package/out/name-score.d.ts.map +1 -1
  281. package/out/name-score.js +6 -4
  282. package/out/name-score.js.map +1 -1
  283. package/out/nsul/index.d.ts +8 -0
  284. package/out/nsul/index.d.ts.map +1 -0
  285. package/out/nsul/index.js +8 -0
  286. package/out/nsul/index.js.map +1 -0
  287. package/out/nsul/lookup.d.ts +83 -0
  288. package/out/nsul/lookup.d.ts.map +1 -0
  289. package/out/nsul/lookup.js +80 -0
  290. package/out/nsul/lookup.js.map +1 -0
  291. package/out/nsul/schema.d.ts +100 -0
  292. package/out/nsul/schema.d.ts.map +1 -0
  293. package/out/nsul/schema.js +78 -0
  294. package/out/nsul/schema.js.map +1 -0
  295. package/out/place-importance-schema.d.ts +47 -10
  296. package/out/place-importance-schema.d.ts.map +1 -1
  297. package/out/place-importance-schema.js +56 -10
  298. package/out/place-importance-schema.js.map +1 -1
  299. package/out/poi/index.d.ts +8 -0
  300. package/out/poi/index.d.ts.map +1 -0
  301. package/out/poi/index.js +8 -0
  302. package/out/poi/index.js.map +1 -0
  303. package/out/{poi-lookup.d.ts → poi/lookup.d.ts} +8 -10
  304. package/out/poi/lookup.d.ts.map +1 -0
  305. package/out/{poi-lookup.js → poi/lookup.js} +24 -29
  306. package/out/poi/lookup.js.map +1 -0
  307. package/out/{poi-schema.d.ts → poi/schema.d.ts} +10 -6
  308. package/out/poi/schema.d.ts.map +1 -0
  309. package/out/{poi-schema.js → poi/schema.js} +1 -1
  310. package/out/poi/schema.js.map +1 -0
  311. package/out/polygon-schema.d.ts +37 -0
  312. package/out/polygon-schema.d.ts.map +1 -0
  313. package/out/polygon-schema.js +23 -0
  314. package/out/polygon-schema.js.map +1 -0
  315. package/out/{postal-city-alias-lookup.d.ts → postal/city-alias-lookup.d.ts} +7 -6
  316. package/out/postal/city-alias-lookup.d.ts.map +1 -0
  317. package/out/{postal-city-alias-lookup.js → postal/city-alias-lookup.js} +12 -16
  318. package/out/postal/city-alias-lookup.js.map +1 -0
  319. package/out/{postal-city-alias-schema.d.ts → postal/city-alias-schema.d.ts} +1 -1
  320. package/out/{postal-city-alias-schema.d.ts.map → postal/city-alias-schema.d.ts.map} +1 -1
  321. package/out/{postal-city-alias-schema.js → postal/city-alias-schema.js} +1 -1
  322. package/out/{postal-city-alias-schema.js.map → postal/city-alias-schema.js.map} +1 -1
  323. package/out/{postal-city-candidate-schema.d.ts → postal/city-candidate-schema.d.ts} +4 -3
  324. package/out/postal/city-candidate-schema.d.ts.map +1 -0
  325. package/out/{postal-city-candidate-schema.js → postal/city-candidate-schema.js} +2 -2
  326. package/out/{postal-city-candidate-schema.js.map → postal/city-candidate-schema.js.map} +1 -1
  327. package/out/postal/index.d.ts +9 -0
  328. package/out/postal/index.d.ts.map +1 -0
  329. package/out/postal/index.js +9 -0
  330. package/out/postal/index.js.map +1 -0
  331. package/out/postcode-point-lookup.d.ts +10 -10
  332. package/out/postcode-point-lookup.d.ts.map +1 -1
  333. package/out/postcode-point-lookup.js +13 -13
  334. package/out/postcode-point-lookup.js.map +1 -1
  335. package/out/primary-preference.d.ts +133 -0
  336. package/out/primary-preference.d.ts.map +1 -0
  337. package/out/primary-preference.js +146 -0
  338. package/out/primary-preference.js.map +1 -0
  339. package/out/proximity-rerank.d.ts +77 -0
  340. package/out/proximity-rerank.d.ts.map +1 -0
  341. package/out/proximity-rerank.js +86 -0
  342. package/out/proximity-rerank.js.map +1 -0
  343. package/out/ranking-weights.d.ts +15 -3
  344. package/out/ranking-weights.d.ts.map +1 -1
  345. package/out/ranking-weights.js +21 -3
  346. package/out/ranking-weights.js.map +1 -1
  347. package/out/region-keys.d.ts +47 -0
  348. package/out/region-keys.d.ts.map +1 -0
  349. package/out/region-keys.js +121 -0
  350. package/out/region-keys.js.map +1 -0
  351. package/out/reverse.d.ts +6 -6
  352. package/out/reverse.d.ts.map +1 -1
  353. package/out/reverse.js +23 -35
  354. package/out/reverse.js.map +1 -1
  355. package/out/schema.d.ts +10 -1
  356. package/out/schema.d.ts.map +1 -1
  357. package/out/schema.js.map +1 -1
  358. package/out/search-fetch.d.ts +59 -0
  359. package/out/search-fetch.d.ts.map +1 -0
  360. package/out/search-fetch.js +184 -0
  361. package/out/search-fetch.js.map +1 -0
  362. package/out/sqlite-convention-source.d.ts +7 -7
  363. package/out/sqlite-convention-source.d.ts.map +1 -1
  364. package/out/sqlite-convention-source.js +5 -5
  365. package/out/sqlite-convention-source.js.map +1 -1
  366. package/out/sqlite-utils.d.ts +24 -6
  367. package/out/sqlite-utils.d.ts.map +1 -1
  368. package/out/sqlite-utils.js +24 -7
  369. package/out/sqlite-utils.js.map +1 -1
  370. package/out/{street-centroid-schema.d.ts → street/centroid-schema.d.ts} +12 -7
  371. package/out/street/centroid-schema.d.ts.map +1 -0
  372. package/out/{street-centroid-schema.js → street/centroid-schema.js} +5 -5
  373. package/out/{street-centroid-schema.js.map → street/centroid-schema.js.map} +1 -1
  374. package/out/{street-centroid.d.ts → street/centroid.d.ts} +6 -6
  375. package/out/street/centroid.d.ts.map +1 -0
  376. package/out/{street-centroid.js → street/centroid.js} +18 -24
  377. package/out/street/centroid.js.map +1 -0
  378. package/out/street/index.d.ts +13 -0
  379. package/out/street/index.d.ts.map +1 -0
  380. package/out/street/index.js +13 -0
  381. package/out/street/index.js.map +1 -0
  382. package/out/{street-morphology-fst-builder.d.ts → street/morphology-fst-builder.d.ts} +4 -4
  383. package/out/street/morphology-fst-builder.d.ts.map +1 -0
  384. package/out/{street-morphology-fst-builder.js → street/morphology-fst-builder.js} +18 -13
  385. package/out/street/morphology-fst-builder.js.map +1 -0
  386. package/out/{street-morphology-fst-loader.d.ts → street/morphology-fst-loader.d.ts} +5 -5
  387. package/out/street/morphology-fst-loader.d.ts.map +1 -0
  388. package/out/{street-morphology-fst-loader.js → street/morphology-fst-loader.js} +11 -10
  389. package/out/street/morphology-fst-loader.js.map +1 -0
  390. package/out/{street-name-lookup.d.ts → street/name-lookup.d.ts} +4 -7
  391. package/out/street/name-lookup.d.ts.map +1 -0
  392. package/out/{street-name-lookup.js → street/name-lookup.js} +9 -23
  393. package/out/street/name-lookup.js.map +1 -0
  394. package/out/street/normalize.d.ts +179 -0
  395. package/out/street/normalize.d.ts.map +1 -0
  396. package/out/street/normalize.js +457 -0
  397. package/out/street/normalize.js.map +1 -0
  398. package/out/{street-segment-schema.d.ts → street/segment-schema.d.ts} +13 -9
  399. package/out/street/segment-schema.d.ts.map +1 -0
  400. package/out/{street-segment-schema.js → street/segment-schema.js} +4 -4
  401. package/out/{street-segment-schema.js.map → street/segment-schema.js.map} +1 -1
  402. package/out/types.d.ts +49 -9
  403. package/out/types.d.ts.map +1 -1
  404. package/out/types.js.map +1 -1
  405. package/out/unified-schema.d.ts +6 -5
  406. package/out/unified-schema.d.ts.map +1 -1
  407. package/out/unified-schema.js +16 -19
  408. package/out/unified-schema.js.map +1 -1
  409. package/out/uprn/existence.d.ts +53 -0
  410. package/out/uprn/existence.d.ts.map +1 -0
  411. package/out/uprn/existence.js +61 -0
  412. package/out/uprn/existence.js.map +1 -0
  413. package/out/uprn/index.d.ts +9 -0
  414. package/out/uprn/index.d.ts.map +1 -0
  415. package/out/uprn/index.js +9 -0
  416. package/out/uprn/index.js.map +1 -0
  417. package/out/uprn/lookup.d.ts +85 -0
  418. package/out/uprn/lookup.d.ts.map +1 -0
  419. package/out/uprn/lookup.js +149 -0
  420. package/out/uprn/lookup.js.map +1 -0
  421. package/out/uprn/schema.d.ts +93 -0
  422. package/out/uprn/schema.d.ts.map +1 -0
  423. package/out/uprn/schema.js +78 -0
  424. package/out/uprn/schema.js.map +1 -0
  425. package/out/weights-overlay-linker.d.ts +299 -0
  426. package/out/weights-overlay-linker.d.ts.map +1 -0
  427. package/out/weights-overlay-linker.js +511 -0
  428. package/out/weights-overlay-linker.js.map +1 -0
  429. package/package.json +622 -154
  430. package/address-point.ts +0 -125
  431. package/candidate-lookup.ts +0 -720
  432. package/fst-autocomplete.ts +0 -204
  433. package/geo.ts +0 -121
  434. package/lookup.ts +0 -1354
  435. package/out/address-point-interpolation.d.ts.map +0 -1
  436. package/out/address-point-interpolation.js.map +0 -1
  437. package/out/address-point-schema.d.ts.map +0 -1
  438. package/out/address-point-schema.js.map +0 -1
  439. package/out/address-point.d.ts.map +0 -1
  440. package/out/address-point.js +0 -84
  441. package/out/address-point.js.map +0 -1
  442. package/out/ancestry-backfill.d.ts.map +0 -1
  443. package/out/ancestry-backfill.js.map +0 -1
  444. package/out/ancestry.d.ts.map +0 -1
  445. package/out/ancestry.js.map +0 -1
  446. package/out/convention.d.ts.map +0 -1
  447. package/out/convention.js.map +0 -1
  448. package/out/fst-autocomplete.d.ts.map +0 -1
  449. package/out/fst-autocomplete.js +0 -130
  450. package/out/fst-autocomplete.js.map +0 -1
  451. package/out/fst-builder.d.ts.map +0 -1
  452. package/out/fst-builder.js.map +0 -1
  453. package/out/fst-deserialize-web.d.ts.map +0 -1
  454. package/out/fst-deserialize-web.js.map +0 -1
  455. package/out/fst-freshness.d.ts.map +0 -1
  456. package/out/fst-freshness.js.map +0 -1
  457. package/out/fst-matcher.d.ts.map +0 -1
  458. package/out/fst-matcher.js.map +0 -1
  459. package/out/fst-serialize.d.ts.map +0 -1
  460. package/out/fst-serialize.js.map +0 -1
  461. package/out/fst-types.d.ts.map +0 -1
  462. package/out/fst-types.js.map +0 -1
  463. package/out/fts-query.d.ts.map +0 -1
  464. package/out/fts-query.js.map +0 -1
  465. package/out/fts.d.ts.map +0 -1
  466. package/out/fts.js.map +0 -1
  467. package/out/geo.d.ts +0 -74
  468. package/out/geo.d.ts.map +0 -1
  469. package/out/geo.js +0 -71
  470. package/out/geo.js.map +0 -1
  471. package/out/geonames-aliases.d.ts.map +0 -1
  472. package/out/geonames-aliases.js.map +0 -1
  473. package/out/geonames-postal.d.ts.map +0 -1
  474. package/out/geonames-postal.js.map +0 -1
  475. package/out/poi-lookup.d.ts.map +0 -1
  476. package/out/poi-lookup.js.map +0 -1
  477. package/out/poi-schema.d.ts.map +0 -1
  478. package/out/poi-schema.js.map +0 -1
  479. package/out/postal-city-alias-lookup.d.ts.map +0 -1
  480. package/out/postal-city-alias-lookup.js.map +0 -1
  481. package/out/postal-city-candidate-schema.d.ts.map +0 -1
  482. package/out/sharding.d.ts +0 -114
  483. package/out/sharding.d.ts.map +0 -1
  484. package/out/sharding.js.map +0 -1
  485. package/out/street-centroid-schema.d.ts.map +0 -1
  486. package/out/street-centroid.d.ts.map +0 -1
  487. package/out/street-centroid.js.map +0 -1
  488. package/out/street-morphology-fst-builder.d.ts.map +0 -1
  489. package/out/street-morphology-fst-builder.js.map +0 -1
  490. package/out/street-morphology-fst-loader.d.ts.map +0 -1
  491. package/out/street-morphology-fst-loader.js.map +0 -1
  492. package/out/street-name-lookup.d.ts.map +0 -1
  493. package/out/street-name-lookup.js.map +0 -1
  494. package/out/street-normalize.d.ts +0 -95
  495. package/out/street-normalize.d.ts.map +0 -1
  496. package/out/street-normalize.js +0 -272
  497. package/out/street-normalize.js.map +0 -1
  498. package/out/street-segment-schema.d.ts.map +0 -1
  499. package/sqlite-utils.ts +0 -46
  500. package/street-normalize.ts +0 -318
  501. /package/{postal-city-alias-schema.ts → lib/postal/city-alias-schema.ts} +0 -0
@@ -26,11 +26,11 @@
26
26
  * ABOVE the place every user means. Referentially the suburb wins by 230x on population. One score
27
27
  * cannot serve both readers, which is why there are two.
28
28
  *
29
- * THE LEGACY COLUMN STAYS, AND IS DERIVED. `importance` remains as `COALESCE(encyclopedic,
30
- * referential)` — byte-for-byte today's semantics — so every reader built against the old table
31
- * keeps working while the split rolls out. It is the CONFLATION, and nothing new should read it.
29
+ * THE LEGACY COLUMN STAYS, AND IS DERIVED. `importance` is written by {@link blendImportance} — the
30
+ * bounded blend the bare-toponym fame consumer (#28) ranks on. It is the CONFLATION, and nothing new
31
+ * should read it; new code reads the split columns.
32
32
  */
33
- import type { DatabaseSync } from "node:sqlite";
33
+ import type { DatabaseClient } from "@mailwoman/sqlite/client";
34
34
  import type { Kysely } from "kysely";
35
35
  /**
36
36
  * One row of `place_importance`. Keyed by WOF place id.
@@ -49,8 +49,8 @@ export interface PlaceImportanceTable {
49
49
  */
50
50
  encyclopedic: number | null;
51
51
  /**
52
- * DEPRECATED — the pre-split conflation, written as `COALESCE(encyclopedic, referential)` so pre-split readers keep
53
- * working unchanged. New code reads {@link PlaceImportanceTable.referential} (to rank) or
52
+ * DEPRECATED — the pre-split conflation, written by {@link blendImportance} so the bare-toponym fame consumer (#28)
53
+ * keeps one cross-bearer scale. New code reads {@link PlaceImportanceTable.referential} (to rank) or
54
54
  * {@link PlaceImportanceTable.encyclopedic} (to display).
55
55
  */
56
56
  importance: number;
@@ -77,6 +77,43 @@ export declare function createPlaceImportanceTable(db: Kysely<PlaceImportanceDat
77
77
  * the one-stop read for the table: the column and the function that fills it are one hop apart.
78
78
  */
79
79
  export { compareReferential, REFERENTIAL_LOG2_SCALE, REFERENTIAL_POPULATION_DIVISOR, REFERENTIAL_SATURATION_POPULATION, referentialFromPopulation, } from "@mailwoman/core/resolver";
80
+ /**
81
+ * The most the encyclopedic channel may raise a place's blended importance above its population-anchored referential
82
+ * score.
83
+ *
84
+ * In referential units 0.25 is 3.5 population doublings (the referential curve divides log2 by 14), so an article can
85
+ * promote a place as if it were up to ~11x its recorded population — never more. The bound exists because the two
86
+ * channels' scales CROSS at the article floor: merely having a Wikipedia article scores ~0.25–0.35, which exceeds the
87
+ * referential score of a mid-size town, so an unbounded blend ranks a 136-person village with an article above a
88
+ * 16,026-person town without one.
89
+ *
90
+ * The value is bracketed by two decided contests, measured on the 2026-08-24 staging build:
91
+ *
92
+ * - `> 0.2282`, or bare `Whitby` stops answering Whitby GB (pop 13,130, referential 0.2729, encyclopedic 0.5496) over
93
+ * Whitby CA (pop 128,377, referential 0.5011) — the #28 design case the fame prior exists to serve.
94
+ * - `< 0.2790`, or bare `Tó`/`To` answers Tó PT (pop 136, referential 0.0131, encyclopedic 0.3375) over Tô BF (pop
95
+ * 16,026, no article) — the `bf-gloss-to-*` board pair.
96
+ *
97
+ * 0.25 sits mid-interval with ~0.02 margin to each bound.
98
+ */
99
+ export declare const ENCYCLOPEDIC_BOOST_CAP = 0.25;
100
+ /**
101
+ * The legacy `importance` blend — one cross-bearer fame scale for the #28 consumer, derived from the two split
102
+ * channels:
103
+ *
104
+ * - No article → the referential score.
105
+ * - No population evidence (`referential` 0) → the encyclopedic score stands alone: there is nothing to bound the
106
+ * article's claim against, and a constant cap would demote every famous place WOF records no population for
107
+ * (meaning-of-zero: referential 0 is "unmeasured", not "tiny").
108
+ * - Both present → the encyclopedic value clamped to at most {@link ENCYCLOPEDIC_BOOST_CAP} above the referential score,
109
+ * and never below it. The floor half repairs the downward inversion (the Seine-Saint-Denis suburb's weak article
110
+ * scored 0.1173 and REPLACED its referential 0.4716 under the old `COALESCE`, so a 418-person Aude hamlet outranked
111
+ * it 4.8x); the cap half repairs the upward one (`Tó`, above).
112
+ *
113
+ * Scale of the clamp on the 2026-08-24 staging build: of 628,202 article-bearing rows, 209,738 sit above the cap and
114
+ * 13,888 sit below their referential floor; the 305,168 article-without-population rows pass through unchanged.
115
+ */
116
+ export declare function blendImportance(referential: number, encyclopedic: number | null | undefined): number;
80
117
  /**
81
118
  * Where a reader's two scores came from. Recorded into the FST stamp so an artifact says, in its own provenance,
82
119
  * whether its encyclopedic channel is real, reconstructed, or absent.
@@ -112,12 +149,12 @@ export type ImportanceSplitSource = (typeof IMPORTANCE_SPLIT_SOURCES)[keyof type
112
149
  *
113
150
  * There is deliberately no ORDER BY counterpart, and there should never be one: §2's policy is that this score is
114
151
  * carried and never ranked on. Without the column the select degrades to a literal `NULL` and the join is the empty
115
- * string, so a pre-split shard's query plan is byte-identical to what it was before the split. No shipped gazetteer
152
+ * string, so a pre-split extract's query plan is byte-identical to what it was before the split. No shipped gazetteer
116
153
  * carries the column yet, so today that degraded form is the only one anything builds.
117
154
  *
118
- * Call it ONCE per shard and cache the result — it runs a `PRAGMA`, and the callers are per-keystroke hot.
155
+ * Call it ONCE per extract and cache the result — it runs a `PRAGMA`, and the callers are per-keystroke hot.
119
156
  */
120
- export declare function encyclopedicClauses(db: DatabaseSync, schemaName: string): {
157
+ export declare function encyclopedicClauses<DB>(db: DatabaseClient<DB>, schemaName: string): {
121
158
  select: string;
122
159
  join: string;
123
160
  };
@@ -185,5 +222,5 @@ export interface ImportanceSplit {
185
222
  * builder in particular must read the shipped population-only databases, the read-only 2026-08-05 staging database
186
223
  * (legacy conflated column), and post-split builds with one code path.
187
224
  */
188
- export declare function loadImportanceSplit(db: DatabaseSync): ImportanceSplit;
225
+ export declare function loadImportanceSplit<DB>(db: DatabaseClient<DB>): ImportanceSplit;
189
226
  //# sourceMappingURL=place-importance-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"place-importance-schema.d.ts","sourceRoot":"","sources":["../place-importance-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAIpC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,EAAE,EAAE,MAAM,CAAA;IACV;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,I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AAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAMpG;AAMD;;;GAGG;AACH,eAAO,MAAM,wBAAwB;IACpC;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;CAEM,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAA;AAE5G;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAiBpH;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,QAAqB,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAQhD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC;;OAEG;IACH,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,MAAM,EAAE,qBAAqB,CAAA;IAC7B;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAA;CAC1B;AAeD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,eAAe,CAgF/E"}
@@ -26,11 +26,12 @@
26
26
  * ABOVE the place every user means. Referentially the suburb wins by 230x on population. One score
27
27
  * cannot serve both readers, which is why there are two.
28
28
  *
29
- * THE LEGACY COLUMN STAYS, AND IS DERIVED. `importance` remains as `COALESCE(encyclopedic,
30
- * referential)` — byte-for-byte today's semantics — so every reader built against the old table
31
- * keeps working while the split rolls out. It is the CONFLATION, and nothing new should read it.
29
+ * THE LEGACY COLUMN STAYS, AND IS DERIVED. `importance` is written by {@link blendImportance} — the
30
+ * bounded blend the bare-toponym fame consumer (#28) ranks on. It is the CONFLATION, and nothing new
31
+ * should read it; new code reads the split columns.
32
32
  */
33
33
  import { referentialFromPopulation } from "@mailwoman/core/resolver";
34
+ import { allRows } from "#sqlite-utils";
34
35
  /**
35
36
  * The columns in declaration order. The builder's INSERT derives its column list from this, so a field added to
36
37
  * {@link PlaceImportanceTable} without a matching DDL column is a compile error at the insert site.
@@ -64,6 +65,51 @@ export async function createPlaceImportanceTable(db) {
64
65
  */
65
66
  export { compareReferential, REFERENTIAL_LOG2_SCALE, REFERENTIAL_POPULATION_DIVISOR, REFERENTIAL_SATURATION_POPULATION, referentialFromPopulation, } from "@mailwoman/core/resolver";
66
67
  //#endregion
68
+ //#region The legacy blend
69
+ /**
70
+ * The most the encyclopedic channel may raise a place's blended importance above its population-anchored referential
71
+ * score.
72
+ *
73
+ * In referential units 0.25 is 3.5 population doublings (the referential curve divides log2 by 14), so an article can
74
+ * promote a place as if it were up to ~11x its recorded population — never more. The bound exists because the two
75
+ * channels' scales CROSS at the article floor: merely having a Wikipedia article scores ~0.25–0.35, which exceeds the
76
+ * referential score of a mid-size town, so an unbounded blend ranks a 136-person village with an article above a
77
+ * 16,026-person town without one.
78
+ *
79
+ * The value is bracketed by two decided contests, measured on the 2026-08-24 staging build:
80
+ *
81
+ * - `> 0.2282`, or bare `Whitby` stops answering Whitby GB (pop 13,130, referential 0.2729, encyclopedic 0.5496) over
82
+ * Whitby CA (pop 128,377, referential 0.5011) — the #28 design case the fame prior exists to serve.
83
+ * - `< 0.2790`, or bare `Tó`/`To` answers Tó PT (pop 136, referential 0.0131, encyclopedic 0.3375) over Tô BF (pop
84
+ * 16,026, no article) — the `bf-gloss-to-*` board pair.
85
+ *
86
+ * 0.25 sits mid-interval with ~0.02 margin to each bound.
87
+ */
88
+ export const ENCYCLOPEDIC_BOOST_CAP = 0.25;
89
+ /**
90
+ * The legacy `importance` blend — one cross-bearer fame scale for the #28 consumer, derived from the two split
91
+ * channels:
92
+ *
93
+ * - No article → the referential score.
94
+ * - No population evidence (`referential` 0) → the encyclopedic score stands alone: there is nothing to bound the
95
+ * article's claim against, and a constant cap would demote every famous place WOF records no population for
96
+ * (meaning-of-zero: referential 0 is "unmeasured", not "tiny").
97
+ * - Both present → the encyclopedic value clamped to at most {@link ENCYCLOPEDIC_BOOST_CAP} above the referential score,
98
+ * and never below it. The floor half repairs the downward inversion (the Seine-Saint-Denis suburb's weak article
99
+ * scored 0.1173 and REPLACED its referential 0.4716 under the old `COALESCE`, so a 418-person Aude hamlet outranked
100
+ * it 4.8x); the cap half repairs the upward one (`Tó`, above).
101
+ *
102
+ * Scale of the clamp on the 2026-08-24 staging build: of 628,202 article-bearing rows, 209,738 sit above the cap and
103
+ * 13,888 sit below their referential floor; the 305,168 article-without-population rows pass through unchanged.
104
+ */
105
+ export function blendImportance(referential, encyclopedic) {
106
+ if (encyclopedic === null || encyclopedic === undefined)
107
+ return referential;
108
+ if (referential <= 0)
109
+ return encyclopedic;
110
+ return Math.max(referential, Math.min(encyclopedic, referential + ENCYCLOPEDIC_BOOST_CAP));
111
+ }
112
+ //#endregion
67
113
  //#region Reading a database that may or may not carry the split
68
114
  /**
69
115
  * Where a reader's two scores came from. Recorded into the FST stamp so an artifact says, in its own provenance,
@@ -99,15 +145,15 @@ export const IMPORTANCE_SPLIT_SOURCES = {
99
145
  *
100
146
  * There is deliberately no ORDER BY counterpart, and there should never be one: §2's policy is that this score is
101
147
  * carried and never ranked on. Without the column the select degrades to a literal `NULL` and the join is the empty
102
- * string, so a pre-split shard's query plan is byte-identical to what it was before the split. No shipped gazetteer
148
+ * string, so a pre-split extract's query plan is byte-identical to what it was before the split. No shipped gazetteer
103
149
  * carries the column yet, so today that degraded form is the only one anything builds.
104
150
  *
105
- * Call it ONCE per shard and cache the result — it runs a `PRAGMA`, and the callers are per-keystroke hot.
151
+ * Call it ONCE per extract and cache the result — it runs a `PRAGMA`, and the callers are per-keystroke hot.
106
152
  */
107
153
  export function encyclopedicClauses(db, schemaName) {
108
154
  let present;
109
155
  try {
110
- const rows = db.prepare(`PRAGMA ${schemaName}.table_info(place_importance)`).all();
156
+ const rows = allRows(db.prepare(`PRAGMA ${schemaName}.table_info(place_importance)`));
111
157
  present = rows.some((r) => r.name === "encyclopedic");
112
158
  }
113
159
  catch {
@@ -167,7 +213,7 @@ export function splitLegacyImportance(legacy, population) {
167
213
  */
168
214
  function tableColumns(db, table) {
169
215
  try {
170
- const rows = db.prepare(`PRAGMA table_info(${table})`).all();
216
+ const rows = allRows(db.prepare(`PRAGMA table_info(${table})`));
171
217
  return new Set(rows.map((r) => r.name));
172
218
  }
173
219
  catch {
@@ -187,7 +233,7 @@ export function loadImportanceSplit(db) {
187
233
  const population = new Map();
188
234
  const populationColumns = tableColumns(db, "place_population");
189
235
  if (populationColumns.has("population")) {
190
- const rows = db.prepare("SELECT id, population FROM place_population").all();
236
+ const rows = allRows(db.prepare("SELECT id, population FROM place_population"));
191
237
  for (const row of rows) {
192
238
  population.set(row.id, row.population);
193
239
  const score = referentialFromPopulation(row.population);
@@ -201,7 +247,7 @@ export function loadImportanceSplit(db) {
201
247
  // Post-split build: the columns ARE the contract. Referential is read verbatim rather than
202
248
  // re-derived, so a build that scored referential differently stays visible instead of being
203
249
  // silently overwritten by this reader's own formula.
204
- const rows = db.prepare("SELECT id, referential, encyclopedic FROM place_importance").all();
250
+ const rows = allRows(db.prepare("SELECT id, referential, encyclopedic FROM place_importance"));
205
251
  for (const row of rows) {
206
252
  if (row.referential > 0) {
207
253
  referential.set(row.id, row.referential);
@@ -213,7 +259,7 @@ export function loadImportanceSplit(db) {
213
259
  return { referential, encyclopedic, source: IMPORTANCE_SPLIT_SOURCES.splitColumns, legacyFallbackRows: 0 };
214
260
  }
215
261
  if (importanceColumns.has("importance")) {
216
- const rows = db.prepare("SELECT id, importance FROM place_importance").all();
262
+ const rows = allRows(db.prepare("SELECT id, importance FROM place_importance"));
217
263
  let legacyFallbackRows = 0;
218
264
  for (const row of rows) {
219
265
  const split = splitLegacyImportance(row.importance, population.get(row.id));
@@ -1 +1 @@
1
- {"version":3,"file":"place-importance-schema.js","sourceRoot":"","sources":["../place-importance-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAoCpE;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC,IAAI;IACJ,aAAa;IACb,cAAc;IACd,YAAY;CAC+C,CAAA;AAE5D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,EAAmC;IACnF,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAA;IAElE,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,kBAAkB,CAAC;SAC/B,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;SACjD,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACpD,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;SACjC,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACnD,OAAO,EAAE,CAAA;AACZ,CAAC;AAED,YAAY;AAEZ,oCAAoC;AAEpC;;;;GAIG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,MAAM,EAAE,wBAAwB,CAAC,mBAAmB;YACpD,kBAAkB;SAClB,CAAA;IACF,CAAC;IAED,OAAO;QACN,WAAW;QACX,YAAY;QACZ,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC,CAAC,wBAAwB,CAAC,IAAI;QAClG,kBAAkB,EAAE,CAAC;KACrB,CAAA;AACF,CAAC;AAED,YAAY"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+ export * from "#poi/lookup";
7
+ export * from "#poi/schema";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/poi/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+ export * from "#poi/lookup";
7
+ export * from "#poi/schema";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/poi/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
@@ -24,7 +24,8 @@
24
24
  * is NEVER reimplemented here (see AGENTS.md on `@mailwoman/spatial` being the one true home for
25
25
  * it).
26
26
  */
27
- import { DatabaseSync } from "node:sqlite";
27
+ import { DatabaseClient } from "@mailwoman/sqlite/client";
28
+ import type { POIDatabase } from "#poi/schema";
28
29
  /**
29
30
  * Resolution the `poi` table's `h3_cell` column is keyed at — matches the builder (spec §3.4).
30
31
  */
@@ -77,7 +78,7 @@ export interface POISearchHit {
77
78
  gersID: string | null;
78
79
  distanceM?: number;
79
80
  }
80
- export interface POILookupOpts {
81
+ export interface POILookupOpts<DB extends POIDatabase = POIDatabase> {
81
82
  /**
82
83
  * Path to a `poi.db` built by the (future) POI builder. Opened read-only.
83
84
  */
@@ -85,18 +86,15 @@ export interface POILookupOpts {
85
86
  /**
86
87
  * Pre-opened handle (tests / shared connections). Mutually exclusive with `databasePath`.
87
88
  */
88
- database?: DatabaseSync;
89
+ database?: DatabaseClient<DB>;
89
90
  }
90
91
  /**
91
- * Node reader over `poi.db`. `implements Disposable` so callers can `using lookup = new POILookup(...)` (or call
92
- * `[Symbol.dispose]()` explicitly), the same precedent as {@link WOFCandidateTableLookup} /
93
- * {@link WOFSqlitePlaceLookup}.
92
+ * Node reader over `poi.db`.
94
93
  */
95
- export declare class POILookup implements Disposable {
94
+ export declare class POILookup<DB extends POIDatabase = POIDatabase> implements Disposable {
96
95
  #private;
97
- constructor(opts: POILookupOpts);
96
+ constructor(opts: POILookupOpts<DB>);
98
97
  search(query: POISearchQuery): POISearchHit[];
99
- close(): void;
100
98
  [Symbol.dispose](): void;
101
99
  }
102
- //# sourceMappingURL=poi-lookup.d.ts.map
100
+ //# sourceMappingURL=lookup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../lib/poi/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAGzD,OAAO,KAAK,EAAwB,WAAW,EAAY,MAAM,aAAa,CAAA;AAG9E;;GAEG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAA;AA8BlC,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,MAAM,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;IAChD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,WAAW;IAClE;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,EAAE,CAAC,CAAA;CAC7B;AAkBD;;GAEG;AACH,qBAAa,SAAS,CAAC,EAAE,SAAS,WAAW,GAAG,WAAW,CAAE,YAAW,UAAU;;gBAuBrE,IAAI,EAAE,aAAa,CAAC,EAAE,CAAC;IA6BnC,MAAM,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,EAAE;IA8J7C,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGxB"}
@@ -24,9 +24,10 @@
24
24
  * is NEVER reimplemented here (see AGENTS.md on `@mailwoman/spatial` being the one true home for
25
25
  * it).
26
26
  */
27
- import { DatabaseSync } from "node:sqlite";
28
27
  import { haversineKm, shortCellToInt } from "@mailwoman/spatial";
28
+ import { DatabaseClient } from "@mailwoman/sqlite/client";
29
29
  import { gridDisk, latLngToCell } from "h3-js";
30
+ import { allRows } from "#sqlite-utils";
30
31
  /**
31
32
  * Resolution the `poi` table's `h3_cell` column is keyed at — matches the builder (spec §3.4).
32
33
  */
@@ -41,8 +42,9 @@ export const POI_H3_RESOLUTION = 9;
41
42
  * unaffected: the loop breaks the ring it accumulates `limit` rows (cafe@Paris fills 20 by ring 2), so this ceiling
42
43
  * never enters their probe budget. Only sparse-but-present categories that never reach `limit` scan the fuller budget —
43
44
  * a cold, one-shot `mailwoman poi` path, not per-keystroke. 16 (not the bare threshold 14) leaves ~2 rings of margin so
44
- * the gate is stable against small db rebuilds, while staying ~4x tighter than the board's 25 km "roughly right place"
45
- * window (no wrong-city false positives). The browser reader passes its own smaller `maxRings` and is untouched.
45
+ * the radius is stable against small db rebuilds, while staying ~4x tighter than the board's 25 km "roughly right
46
+ * place" window (no wrong-city false positives). The browser reader passes its own smaller `maxRings` and is
47
+ * untouched.
46
48
  */
47
49
  const DEFAULT_MAX_RINGS = 16;
48
50
  /**
@@ -56,13 +58,15 @@ const BRAND_MAX_DISTANCE_KM = 500;
56
58
  */
57
59
  const DEFAULT_LIMIT = 20;
58
60
  /**
59
- * Node reader over `poi.db`. `implements Disposable` so callers can `using lookup = new POILookup(...)` (or call
60
- * `[Symbol.dispose]()` explicitly), the same precedent as {@link WOFCandidateTableLookup} /
61
- * {@link WOFSqlitePlaceLookup}.
61
+ * Node reader over `poi.db`.
62
62
  */
63
63
  export class POILookup {
64
64
  #db;
65
- #ownsDB;
65
+ /**
66
+ * Resources this instance opened. A connection handed in by a caller is NOT in here, so disposal cannot reach it —
67
+ * ownership is membership rather than a flag a later branch has to check.
68
+ */
69
+ #resources = new DisposableStack();
66
70
  #categoryToID = new Map();
67
71
  #idToCategory = new Map();
68
72
  /**
@@ -80,20 +84,16 @@ export class POILookup {
80
84
  constructor(opts) {
81
85
  if (opts.database) {
82
86
  this.#db = opts.database;
83
- this.#ownsDB = false;
84
87
  }
85
88
  else if (opts.databasePath) {
86
- this.#db = new DatabaseSync(opts.databasePath, { readOnly: true });
87
- this.#ownsDB = true;
89
+ this.#db = this.#resources.use(new DatabaseClient(opts.databasePath, { readOnly: true }));
88
90
  }
89
91
  else {
90
92
  throw new Error("POILookup needs `databasePath` or `database`");
91
93
  }
92
94
  // The category dictionary is tiny (poi-taxonomy's category count) — load it once at
93
95
  // construction so `search` never round-trips to it.
94
- for (const r of this.#db
95
- .prepare("SELECT id, category FROM poi_category_codes")
96
- .all()) {
96
+ for (const r of allRows(this.#db.prepare("SELECT id, category FROM poi_category_codes"))) {
97
97
  this.#categoryToID.set(String(r.category), Number(r.id));
98
98
  this.#idToCategory.set(Number(r.id), String(r.category));
99
99
  }
@@ -127,7 +127,7 @@ export class POILookup {
127
127
  * nearest at any distance — the reach ceiling k-ring hits on sparse brand rows is gone.
128
128
  */
129
129
  #searchBrand(brandWikidata, center, limit) {
130
- const rows = this.#brandProbe.all(brandWikidata);
130
+ const rows = allRows(this.#brandProbe, brandWikidata);
131
131
  return sortByDistance(rows, center)
132
132
  .filter((row) => haversineKm(center.latitude, center.longitude, row.latitude, row.longitude) <= BRAND_MAX_DISTANCE_KM)
133
133
  .slice(0, limit)
@@ -139,18 +139,18 @@ export class POILookup {
139
139
  #searchKRing(query, limit) {
140
140
  const center = query.center;
141
141
  const maxRings = query.maxRings ?? DEFAULT_MAX_RINGS;
142
- const categoryIds = [];
142
+ const categoryIDs = [];
143
143
  // `categoryIDs` (the fan-out list) supersedes the single `categoryID`; either way, resolve each id through the
144
144
  // dictionary and drop the ones the db doesn't carry (Overture-taxonomy drift, or an identity id with no rows).
145
145
  const seedIDs = query.categoryIDs?.length ? query.categoryIDs : query.categoryID ? [query.categoryID] : [];
146
146
  for (const id of seedIDs) {
147
147
  const resolved = this.#categoryToID.get(id);
148
148
  if (resolved !== undefined) {
149
- categoryIds.push(resolved);
149
+ categoryIDs.push(resolved);
150
150
  }
151
151
  }
152
152
  // No resolvable leaf (every id unknown to the dictionary) can't have rows — a clean miss, not a throw.
153
- if (!categoryIds.length)
153
+ if (!categoryIDs.length)
154
154
  return [];
155
155
  const origin = latLngToCell(center.latitude, center.longitude, POI_H3_RESOLUTION);
156
156
  const seenCells = new Set();
@@ -166,8 +166,8 @@ export class POILookup {
166
166
  const shortCell = shortCellToInt(cell);
167
167
  // Fan-out: probe every resolved Overture leaf for this canonical category, unioning the rows. The
168
168
  // post-ring distance sort + `slice(0, limit)` below dedupes the pool down to the nearest `limit`.
169
- for (const categoryID of categoryIds) {
170
- rows.push(...this.#categoryCellProbe.all(shortCell, categoryID, limit));
169
+ for (const categoryID of categoryIDs) {
170
+ rows.push(...allRows(this.#categoryCellProbe, shortCell, categoryID, limit));
171
171
  }
172
172
  }
173
173
  rows = sortByDistance(rows, center);
@@ -187,7 +187,7 @@ export class POILookup {
187
187
  const matchQuery = sanitizePOINameQuery(name);
188
188
  if (!matchQuery)
189
189
  return [];
190
- const ftsHits = this.#nameFTSProbe.all(matchQuery, limit);
190
+ const ftsHits = allRows(this.#nameFTSProbe, matchQuery, limit);
191
191
  const uniqueKeys = [];
192
192
  const seenKeys = new Set();
193
193
  for (const hit of ftsHits) {
@@ -229,15 +229,10 @@ export class POILookup {
229
229
  const columns = "name, category_id, brand_wikidata, latitude, longitude, country, confidence, name_key, gers_id";
230
230
  const placeholders = nameKeys.map(() => "?").join(", ");
231
231
  const stmt = this.#db.prepare(`SELECT ${columns} FROM poi WHERE name_key IN (${placeholders})`);
232
- return stmt.all(...nameKeys);
233
- }
234
- close() {
235
- if (this.#ownsDB) {
236
- this.#db.close();
237
- }
232
+ return allRows(stmt, ...nameKeys);
238
233
  }
239
234
  [Symbol.dispose]() {
240
- this.close();
235
+ this.#resources[Symbol.dispose]();
241
236
  }
242
237
  }
243
238
  function sortByDistance(rows, center) {
@@ -273,8 +268,8 @@ function sanitizePOINameQuery(text) {
273
268
  .replaceAll(/["*:]/g, "")
274
269
  .trim()
275
270
  .split(/\s+/u)
276
- .filter(Boolean)
271
+ .filter((token) => token.length > 0)
277
272
  .map((token) => `"${token.replaceAll('"', '""')}"`)
278
273
  .join(" ");
279
274
  }
280
- //# sourceMappingURL=poi-lookup.js.map
275
+ //# sourceMappingURL=lookup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../lib/poi/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAElC;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAE5B;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAEjC;;GAEG;AACH,MAAM,aAAa,GAAG,EAAE,CAAA;AA4ExB;;GAEG;AACH,MAAM,OAAO,SAAS;IACrB,GAAG,CAAoB;IACvB;;;OAGG;IACM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAA;IAClC,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAA;IACzC,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAA;IAElD;;OAEG;IACM,kBAAkB,CAAuC;IAClE;;OAEG;IACM,WAAW,CAAuC;IAC3D;;OAEG;IACM,aAAa,CAAuC;IAE7D,YAAY,IAAuB;QAClC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAA;QACzB,CAAC;aAAM,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,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AC1B,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,GAAG,CAAC,MAAM;YACT,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE;YACnG,CAAC,CAAC,EAAE,CAAC;KACN,CAAA;AACF,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,oBAAoB,CAAC,IAAY;IACzC,OAAO,IAAI;SACT,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;SACxB,IAAI,EAAE;SACN,KAAK,CAAC,MAAM,CAAC;SACb,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;SACnC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;SAClD,IAAI,CAAC,GAAG,CAAC,CAAA;AACZ,CAAC"}
@@ -11,9 +11,10 @@
11
11
  * embeds the layer-contract tables from `@mailwoman/core/layers` — the builder writes the
12
12
  * manifest (tier `shipped`, spine `h3` res 9) and per-res-6-cell coverage.
13
13
  */
14
- import type { DatabaseSync } from "node:sqlite";
15
14
  import type { LayerContractDatabase } from "@mailwoman/core/layers";
15
+ import type { DatabaseClient } from "@mailwoman/sqlite/client";
16
16
  import { type Kysely } from "kysely";
17
+ import type { NameKey } from "#street/normalize";
17
18
  /**
18
19
  * One POI row. Clustered PK: h3_cell → category_id → neg_rank → rowid_key.
19
20
  */
@@ -36,9 +37,12 @@ export interface POITable {
36
37
  rowid_key: number;
37
38
  name: string | null;
38
39
  /**
39
- * Lowercased, diacritic-flattened probe key for exact name lookups.
40
+ * Probe key for exact name lookups, minted by {@link normalizeLocalityForKey} at build AND at query.
41
+ *
42
+ * Branded because a `toLowerCase()` approximation of the fold is still a `string`: it binds to the parameter, returns
43
+ * fewer rows, and the shortfall reads as a coverage gap in the data rather than a defect in the probe.
40
44
  */
41
- name_key: string | null;
45
+ name_key: NameKey | null;
42
46
  brand_wikidata: string | null;
43
47
  latitude: number;
44
48
  longitude: number;
@@ -65,7 +69,7 @@ export interface POIStageTable {
65
69
  neg_rank: number | null;
66
70
  rowid_key: number | null;
67
71
  name: string | null;
68
- name_key: string | null;
72
+ name_key: NameKey | null;
69
73
  brand_wikidata: string | null;
70
74
  latitude: number;
71
75
  longitude: number;
@@ -111,5 +115,5 @@ export declare const POI_FTS_TABLE = "poi_search";
111
115
  /**
112
116
  * FTS5 stays raw SQL by project rule (Kysely can't express virtual tables). Content-keyed by name_key.
113
117
  */
114
- export declare function createPOISearchFTS(db: DatabaseSync): void;
115
- //# sourceMappingURL=poi-schema.d.ts.map
118
+ export declare function createPOISearchFTS<DB>(db: DatabaseClient<DB>): void;
119
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../lib/poi/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAO,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB;;;;;OAKG;IACH,QAAQ,EAAE,OAAO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M,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB3E;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAElF;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhF;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,eAAe,CAAA;AAEzC;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,IAAI,CAInE"}
@@ -103,4 +103,4 @@ export const POI_FTS_TABLE = "poi_search";
103
103
  export function createPOISearchFTS(db) {
104
104
  db.exec(`CREATE VIRTUAL TABLE ${POI_FTS_TABLE} USING fts5(name, name_key UNINDEXED, h3_cell UNINDEXED, tokenize = 'unicode61')`);
105
105
  }
106
- //# sourceMappingURL=poi-schema.js.map
106
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../lib/poi/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,GAAG,EAAe,MAAM,QAAQ,CAAA;AAkFzC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,SAAS;IACT,aAAa;IACb,UAAU;IACV,WAAW;IACX,MAAM;IACN,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,WAAW;IACX,SAAS;IACT,YAAY;IACZ,SAAS;CACA,CAAA;AAEV,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,EAAuB;IACnE,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,oBAAoB,CAAC;SACjC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,C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;SACxB,KAAK,CAAC,gBAAgB,EAAE,QAAQ,EAAE,IAAI,CAAC;SACvC,OAAO,EAAE,CAAA;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAA;AAEzC;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAK,EAAsB;IAC5D,EAAE,CAAC,IAAI,CACN,wBAAwB,aAAa,kFAAkF,CACvH,CAAA;AACF,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Typed schema for the polygon sidecar (`wof-polygons.db`) — the one table `WOFReverseGeocoder` probes for a
7
+ * place's geometry. The interface is the read/write contract and {@link createPolygonsTable} creates the table, so a
8
+ * column added to one is a compile error against the other.
9
+ *
10
+ * The sidecar is OPTIONAL to the reverse geocoder: without it every result falls back to a centroid, so the reader
11
+ * checks for the table's presence rather than assuming it.
12
+ */
13
+ import type { Kysely } from "kysely";
14
+ /**
15
+ * One admin polygon, keyed by WOF id.
16
+ */
17
+ export interface PolygonsTable {
18
+ id: number;
19
+ /**
20
+ * The GeoJSON geometry, JSON-encoded. A row that fails to parse reads as no-polygon, never as an error — a malformed
21
+ * geometry must not fail the whole reverse query.
22
+ */
23
+ geom: string;
24
+ }
25
+ export interface PolygonDatabase {
26
+ polygons: PolygonsTable;
27
+ }
28
+ /**
29
+ * The slice of a Kysely handle the polygon DDL touches. Kysely is invariant in its schema parameter, so naming only
30
+ * `schema` lets a builder holding a wider handle pass it without a cast.
31
+ */
32
+ export type PolygonSchemaHandle = Pick<Kysely<PolygonDatabase>, "schema">;
33
+ /**
34
+ * Create the `polygons` table — called before the streaming bulk load.
35
+ */
36
+ export declare function createPolygonsTable(db: PolygonSchemaHandle): Promise<void>;
37
+ //# sourceMappingURL=polygon-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon-schema.d.ts","sourceRoot":"","sources":["../lib/polygon-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,aAAa,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEzE;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Typed schema for the polygon sidecar (`wof-polygons.db`) — the one table `WOFReverseGeocoder` probes for a
7
+ * place's geometry. The interface is the read/write contract and {@link createPolygonsTable} creates the table, so a
8
+ * column added to one is a compile error against the other.
9
+ *
10
+ * The sidecar is OPTIONAL to the reverse geocoder: without it every result falls back to a centroid, so the reader
11
+ * checks for the table's presence rather than assuming it.
12
+ */
13
+ /**
14
+ * Create the `polygons` table — called before the streaming bulk load.
15
+ */
16
+ export async function createPolygonsTable(db) {
17
+ await db.schema
18
+ .createTable("polygons")
19
+ .addColumn("id", "integer", (column) => column.primaryKey())
20
+ .addColumn("geom", "text", (column) => column.notNull())
21
+ .execute();
22
+ }
23
+ //# sourceMappingURL=polygon-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon-schema.js","sourceRoot":"","sources":["../lib/polygon-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA0BH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EAAuB;IAChE,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,UAAU,CAAC;SACvB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;SAC3D,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SACvD,OAAO,EAAE,CAAA;AACZ,CAAC"}