@mailwoman/core 10.1.0 → 10.2.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 (429) hide show
  1. package/lib/api/APIClient.ts +5 -6
  2. package/lib/api/arcgis.ts +5 -5
  3. package/lib/api/ckan.ts +2 -1
  4. package/lib/api/disk-storage.ts +3 -3
  5. package/lib/api/ogc.ts +56 -52
  6. package/lib/api/pacer.ts +1 -1
  7. package/lib/api/retry.ts +6 -4
  8. package/lib/api/test/transport.ts +20 -20
  9. package/lib/api.ts +1 -0
  10. package/lib/coarse-placer/coarse-placer.ts +4 -3
  11. package/lib/crypto/node.ts +1 -2
  12. package/lib/decoder/build-tree.ts +5 -5
  13. package/lib/decoder/parse-diff.ts +47 -31
  14. package/lib/decoder/proposals-to-tree.ts +1 -0
  15. package/lib/decoder/serialize/json.ts +9 -6
  16. package/lib/decoder/serialize/tuples.ts +2 -1
  17. package/lib/decoder/serialize/xml.ts +15 -14
  18. package/lib/decoder/tree/shape.ts +14 -14
  19. package/lib/decoder/tree/walk.ts +2 -2
  20. package/lib/decoder/types.ts +48 -2
  21. package/lib/env/schema.ts +21 -23
  22. package/lib/env/utils.ts +4 -3
  23. package/lib/env.ts +4 -4
  24. package/lib/fs/delimited.ts +35 -1
  25. package/lib/fs/readers.ts +2 -5
  26. package/lib/fs/zip.ts +1 -1
  27. package/lib/geocode/result.ts +337 -0
  28. package/lib/git.ts +1 -1
  29. package/lib/html/document.ts +6 -6
  30. package/lib/html/elements.ts +26 -23
  31. package/lib/identical.ts +20 -0
  32. package/lib/json.ts +5 -7
  33. package/lib/layers/coverage.ts +28 -1
  34. package/lib/layers/feature-count.ts +3 -3
  35. package/lib/layers/manifest.ts +22 -21
  36. package/lib/layers/schema.ts +25 -1
  37. package/lib/license/configured.ts +3 -3
  38. package/lib/license/key/file.ts +2 -1
  39. package/lib/license/key.ts +3 -3
  40. package/lib/license/stamp.ts +4 -4
  41. package/lib/locale/locale.ts +1 -1
  42. package/lib/locale/registry.ts +2 -2
  43. package/lib/module/compiled-freshness.ts +1 -1
  44. package/lib/module/package-command.ts +4 -2
  45. package/lib/module/packaged-data.ts +1 -1
  46. package/lib/module/resolve-from.ts +1 -1
  47. package/lib/numeric.ts +4 -4
  48. package/lib/objects.ts +3 -0
  49. package/lib/paths.ts +16 -1
  50. package/lib/pipeline/client-result.ts +14 -14
  51. package/lib/pipeline/result.ts +5 -4
  52. package/lib/pipeline/runtime-pipeline.ts +65 -42
  53. package/lib/pipeline/span-proposer.ts +1 -1
  54. package/lib/pipeline/types.ts +328 -161
  55. package/lib/pipeline.ts +32 -7
  56. package/lib/policy/proposal-collection.ts +1 -1
  57. package/lib/policy/registry.ts +5 -3
  58. package/lib/resolver/authoritative-provider.ts +17 -17
  59. package/lib/resolver/coverage-facts.ts +3 -3
  60. package/lib/resolver/fixture-authoritative-provider.ts +4 -0
  61. package/lib/resolver/lookup-types.ts +54 -14
  62. package/lib/resolver/postcode-format.ts +9 -9
  63. package/lib/resolver/referential.ts +2 -2
  64. package/lib/resolver/types.ts +155 -51
  65. package/lib/resolver.ts +22 -20
  66. package/lib/resources/git.ts +1 -1
  67. package/lib/resources/languages.ts +0 -2
  68. package/lib/resources/libpostal.ts +1 -1
  69. package/lib/resources/whosonfirst/PlacetypeDataSource.ts +2 -6
  70. package/lib/resources/whosonfirst/extract-repo.ts +2 -1
  71. package/lib/resources/whosonfirst/placetypes/admin.ts +20 -25
  72. package/lib/resources/whosonfirst/placetypes/mermaid.ts +4 -3
  73. package/lib/resources/whosonfirst/placetypes/specificity.ts +7 -7
  74. package/lib/resources.ts +1 -0
  75. package/lib/scripting/arguments.ts +6 -5
  76. package/lib/scripting/command.ts +3 -2
  77. package/lib/scripting/operation.ts +2 -2
  78. package/lib/scripting/utils.ts +3 -5
  79. package/lib/strings/python-json.ts +1 -1
  80. package/lib/tokenization/Span.ts +1 -1
  81. package/lib/trust-policies.ts +0 -2
  82. package/lib/types/Classification.ts +1 -1
  83. package/lib/types/classifier.ts +1 -1
  84. package/lib/utils/geodatabase-archive.ts +13 -5
  85. package/lib/utils/sqlite-rows.ts +3 -3
  86. package/lib/utils/stream-to-disk.ts +1 -3
  87. package/lib/utils/union-find.ts +1 -1
  88. package/lib/vale.ts +1 -1
  89. package/lib/workspaces.ts +2 -2
  90. package/out/api/APIClient.d.ts +3 -3
  91. package/out/api/APIClient.d.ts.map +1 -1
  92. package/out/api/APIClient.js +2 -3
  93. package/out/api/APIClient.js.map +1 -1
  94. package/out/api/arcgis.d.ts +2 -2
  95. package/out/api/arcgis.d.ts.map +1 -1
  96. package/out/api/arcgis.js +6 -6
  97. package/out/api/arcgis.js.map +1 -1
  98. package/out/api/ckan.d.ts +2 -1
  99. package/out/api/ckan.d.ts.map +1 -1
  100. package/out/api/ckan.js.map +1 -1
  101. package/out/api/disk-storage.d.ts +1 -1
  102. package/out/api/disk-storage.js +2 -2
  103. package/out/api/disk-storage.js.map +1 -1
  104. package/out/api/ogc.d.ts +32 -27
  105. package/out/api/ogc.d.ts.map +1 -1
  106. package/out/api/ogc.js +41 -46
  107. package/out/api/ogc.js.map +1 -1
  108. package/out/api/pacer.d.ts +1 -1
  109. package/out/api/pacer.js +1 -1
  110. package/out/api/retry.d.ts +6 -4
  111. package/out/api/retry.d.ts.map +1 -1
  112. package/out/api/retry.js +1 -1
  113. package/out/api/retry.js.map +1 -1
  114. package/out/api/test/transport.d.ts +11 -11
  115. package/out/api/test/transport.d.ts.map +1 -1
  116. package/out/api/test/transport.js +16 -16
  117. package/out/api/test/transport.js.map +1 -1
  118. package/out/api.d.ts +1 -0
  119. package/out/api.d.ts.map +1 -1
  120. package/out/api.js +1 -0
  121. package/out/api.js.map +1 -1
  122. package/out/coarse-placer/coarse-placer.d.ts +3 -2
  123. package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
  124. package/out/coarse-placer/coarse-placer.js +1 -1
  125. package/out/coarse-placer/coarse-placer.js.map +1 -1
  126. package/out/crypto/node.d.ts +1 -2
  127. package/out/crypto/node.d.ts.map +1 -1
  128. package/out/crypto/node.js +1 -2
  129. package/out/crypto/node.js.map +1 -1
  130. package/out/decoder/build-tree.js +5 -5
  131. package/out/decoder/build-tree.js.map +1 -1
  132. package/out/decoder/parse-diff.d.ts +19 -19
  133. package/out/decoder/parse-diff.d.ts.map +1 -1
  134. package/out/decoder/parse-diff.js +28 -12
  135. package/out/decoder/parse-diff.js.map +1 -1
  136. package/out/decoder/proposals-to-tree.d.ts.map +1 -1
  137. package/out/decoder/proposals-to-tree.js +1 -0
  138. package/out/decoder/proposals-to-tree.js.map +1 -1
  139. package/out/decoder/serialize/json.d.ts +35 -17
  140. package/out/decoder/serialize/json.d.ts.map +1 -1
  141. package/out/decoder/serialize/json.js +28 -0
  142. package/out/decoder/serialize/json.js.map +1 -1
  143. package/out/decoder/serialize/tuples.d.ts +2 -1
  144. package/out/decoder/serialize/tuples.d.ts.map +1 -1
  145. package/out/decoder/serialize/tuples.js.map +1 -1
  146. package/out/decoder/serialize/xml.d.ts +12 -11
  147. package/out/decoder/serialize/xml.d.ts.map +1 -1
  148. package/out/decoder/serialize/xml.js +3 -3
  149. package/out/decoder/serialize/xml.js.map +1 -1
  150. package/out/decoder/tree/shape.d.ts +6 -6
  151. package/out/decoder/tree/shape.d.ts.map +1 -1
  152. package/out/decoder/tree/shape.js +8 -8
  153. package/out/decoder/tree/shape.js.map +1 -1
  154. package/out/decoder/tree/walk.d.ts +1 -1
  155. package/out/decoder/tree/walk.d.ts.map +1 -1
  156. package/out/decoder/tree/walk.js +1 -1
  157. package/out/decoder/tree/walk.js.map +1 -1
  158. package/out/decoder/types.d.ts +55 -2
  159. package/out/decoder/types.d.ts.map +1 -1
  160. package/out/decoder/types.js +39 -1
  161. package/out/decoder/types.js.map +1 -1
  162. package/out/env/schema.d.ts +11 -12
  163. package/out/env/schema.d.ts.map +1 -1
  164. package/out/env/schema.js +15 -17
  165. package/out/env/schema.js.map +1 -1
  166. package/out/env/utils.d.ts +2 -2
  167. package/out/env/utils.d.ts.map +1 -1
  168. package/out/env/utils.js +2 -2
  169. package/out/env/utils.js.map +1 -1
  170. package/out/env.js +4 -4
  171. package/out/env.js.map +1 -1
  172. package/out/fs/delimited.d.ts +18 -0
  173. package/out/fs/delimited.d.ts.map +1 -1
  174. package/out/fs/delimited.js +31 -1
  175. package/out/fs/delimited.js.map +1 -1
  176. package/out/fs/readers.d.ts +2 -4
  177. package/out/fs/readers.d.ts.map +1 -1
  178. package/out/fs/readers.js +2 -4
  179. package/out/fs/readers.js.map +1 -1
  180. package/out/fs/zip.js +1 -1
  181. package/out/fs/zip.js.map +1 -1
  182. package/out/geocode/result.d.ts +475 -0
  183. package/out/geocode/result.d.ts.map +1 -0
  184. package/out/geocode/result.js +280 -0
  185. package/out/geocode/result.js.map +1 -0
  186. package/out/git.js +1 -1
  187. package/out/git.js.map +1 -1
  188. package/out/html/document.d.ts +3 -3
  189. package/out/html/document.d.ts.map +1 -1
  190. package/out/html/document.js +4 -4
  191. package/out/html/document.js.map +1 -1
  192. package/out/html/elements.d.ts +18 -15
  193. package/out/html/elements.d.ts.map +1 -1
  194. package/out/html/elements.js +17 -16
  195. package/out/html/elements.js.map +1 -1
  196. package/out/identical.d.ts +16 -0
  197. package/out/identical.d.ts.map +1 -0
  198. package/out/identical.js +19 -0
  199. package/out/identical.js.map +1 -0
  200. package/out/json.d.ts +3 -5
  201. package/out/json.d.ts.map +1 -1
  202. package/out/json.js +3 -5
  203. package/out/json.js.map +1 -1
  204. package/out/layers/coverage.d.ts +26 -1
  205. package/out/layers/coverage.d.ts.map +1 -1
  206. package/out/layers/coverage.js.map +1 -1
  207. package/out/layers/feature-count.d.ts +1 -1
  208. package/out/layers/feature-count.d.ts.map +1 -1
  209. package/out/layers/feature-count.js +2 -2
  210. package/out/layers/feature-count.js.map +1 -1
  211. package/out/layers/manifest.d.ts +11 -10
  212. package/out/layers/manifest.d.ts.map +1 -1
  213. package/out/layers/manifest.js +12 -13
  214. package/out/layers/manifest.js.map +1 -1
  215. package/out/layers/schema.d.ts +23 -0
  216. package/out/layers/schema.d.ts.map +1 -1
  217. package/out/layers/schema.js +1 -1
  218. package/out/layers/schema.js.map +1 -1
  219. package/out/license/configured.d.ts +1 -1
  220. package/out/license/configured.d.ts.map +1 -1
  221. package/out/license/configured.js +2 -2
  222. package/out/license/configured.js.map +1 -1
  223. package/out/license/key/file.d.ts.map +1 -1
  224. package/out/license/key/file.js +2 -1
  225. package/out/license/key/file.js.map +1 -1
  226. package/out/license/key.d.ts +1 -1
  227. package/out/license/key.d.ts.map +1 -1
  228. package/out/license/key.js +2 -2
  229. package/out/license/key.js.map +1 -1
  230. package/out/license/stamp.d.ts +2 -2
  231. package/out/license/stamp.d.ts.map +1 -1
  232. package/out/license/stamp.js +2 -2
  233. package/out/license/stamp.js.map +1 -1
  234. package/out/locale/locale.d.ts +1 -1
  235. package/out/locale/locale.d.ts.map +1 -1
  236. package/out/locale/registry.d.ts +1 -1
  237. package/out/locale/registry.d.ts.map +1 -1
  238. package/out/locale/registry.js +1 -1
  239. package/out/locale/registry.js.map +1 -1
  240. package/out/module/compiled-freshness.js +1 -1
  241. package/out/module/compiled-freshness.js.map +1 -1
  242. package/out/module/package-command.d.ts +3 -2
  243. package/out/module/package-command.d.ts.map +1 -1
  244. package/out/module/package-command.js +3 -2
  245. package/out/module/package-command.js.map +1 -1
  246. package/out/module/packaged-data.js +1 -1
  247. package/out/module/packaged-data.js.map +1 -1
  248. package/out/module/resolve-from.js +1 -1
  249. package/out/module/resolve-from.js.map +1 -1
  250. package/out/numeric.d.ts +1 -1
  251. package/out/numeric.d.ts.map +1 -1
  252. package/out/numeric.js +3 -3
  253. package/out/numeric.js.map +1 -1
  254. package/out/objects.d.ts +3 -0
  255. package/out/objects.d.ts.map +1 -1
  256. package/out/objects.js +3 -0
  257. package/out/objects.js.map +1 -1
  258. package/out/paths.d.ts +20 -1
  259. package/out/paths.d.ts.map +1 -1
  260. package/out/paths.js +1 -1
  261. package/out/paths.js.map +1 -1
  262. package/out/pipeline/client-result.d.ts +15 -15
  263. package/out/pipeline/client-result.d.ts.map +1 -1
  264. package/out/pipeline/client-result.js +1 -1
  265. package/out/pipeline/result.d.ts +4 -3
  266. package/out/pipeline/result.d.ts.map +1 -1
  267. package/out/pipeline/runtime-pipeline.d.ts +16 -9
  268. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  269. package/out/pipeline/runtime-pipeline.js +43 -27
  270. package/out/pipeline/runtime-pipeline.js.map +1 -1
  271. package/out/pipeline/span-proposer.js +1 -1
  272. package/out/pipeline/span-proposer.js.map +1 -1
  273. package/out/pipeline/types.d.ts +394 -175
  274. package/out/pipeline/types.d.ts.map +1 -1
  275. package/out/pipeline/types.js +199 -4
  276. package/out/pipeline/types.js.map +1 -1
  277. package/out/pipeline.d.ts +4 -2
  278. package/out/pipeline.d.ts.map +1 -1
  279. package/out/pipeline.js +1 -1
  280. package/out/pipeline.js.map +1 -1
  281. package/out/policy/proposal-collection.d.ts +1 -1
  282. package/out/policy/proposal-collection.d.ts.map +1 -1
  283. package/out/policy/proposal-collection.js.map +1 -1
  284. package/out/policy/registry.d.ts +3 -1
  285. package/out/policy/registry.d.ts.map +1 -1
  286. package/out/policy/registry.js +4 -2
  287. package/out/policy/registry.js.map +1 -1
  288. package/out/resolver/authoritative-provider.d.ts +17 -17
  289. package/out/resolver/authoritative-provider.d.ts.map +1 -1
  290. package/out/resolver/authoritative-provider.js +2 -2
  291. package/out/resolver/coverage-facts.d.ts +3 -3
  292. package/out/resolver/coverage-facts.d.ts.map +1 -1
  293. package/out/resolver/fixture-authoritative-provider.d.ts.map +1 -1
  294. package/out/resolver/fixture-authoritative-provider.js +4 -0
  295. package/out/resolver/fixture-authoritative-provider.js.map +1 -1
  296. package/out/resolver/lookup-types.d.ts +52 -15
  297. package/out/resolver/lookup-types.d.ts.map +1 -1
  298. package/out/resolver/postcode-format.d.ts +3 -3
  299. package/out/resolver/postcode-format.d.ts.map +1 -1
  300. package/out/resolver/postcode-format.js +7 -7
  301. package/out/resolver/postcode-format.js.map +1 -1
  302. package/out/resolver/referential.d.ts +2 -2
  303. package/out/resolver/referential.d.ts.map +1 -1
  304. package/out/resolver/types.d.ts +126 -40
  305. package/out/resolver/types.d.ts.map +1 -1
  306. package/out/resolver/types.js +43 -1
  307. package/out/resolver/types.js.map +1 -1
  308. package/out/resolver.d.ts +5 -3
  309. package/out/resolver.d.ts.map +1 -1
  310. package/out/resolver.js +2 -2
  311. package/out/resolver.js.map +1 -1
  312. package/out/resources/git.js +1 -1
  313. package/out/resources/git.js.map +1 -1
  314. package/out/resources/languages.d.ts +0 -1
  315. package/out/resources/languages.d.ts.map +1 -1
  316. package/out/resources/languages.js +0 -1
  317. package/out/resources/languages.js.map +1 -1
  318. package/out/resources/libpostal.d.ts +1 -1
  319. package/out/resources/libpostal.d.ts.map +1 -1
  320. package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
  321. package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
  322. package/out/resources/whosonfirst/PlacetypeDataSource.js +2 -1
  323. package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
  324. package/out/resources/whosonfirst/extract-repo.d.ts.map +1 -1
  325. package/out/resources/whosonfirst/extract-repo.js +2 -1
  326. package/out/resources/whosonfirst/extract-repo.js.map +1 -1
  327. package/out/resources/whosonfirst/placetypes/admin.d.ts +12 -12
  328. package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
  329. package/out/resources/whosonfirst/placetypes/admin.js +9 -8
  330. package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
  331. package/out/resources/whosonfirst/placetypes/mermaid.d.ts +2 -1
  332. package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
  333. package/out/resources/whosonfirst/placetypes/mermaid.js +1 -1
  334. package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
  335. package/out/resources/whosonfirst/placetypes/specificity.d.ts +3 -3
  336. package/out/resources/whosonfirst/placetypes/specificity.d.ts.map +1 -1
  337. package/out/resources/whosonfirst/placetypes/specificity.js +6 -6
  338. package/out/resources/whosonfirst/placetypes/specificity.js.map +1 -1
  339. package/out/resources.d.ts +1 -0
  340. package/out/resources.d.ts.map +1 -1
  341. package/out/resources.js +1 -0
  342. package/out/resources.js.map +1 -1
  343. package/out/scripting/arguments.d.ts +5 -4
  344. package/out/scripting/arguments.d.ts.map +1 -1
  345. package/out/scripting/arguments.js +5 -4
  346. package/out/scripting/arguments.js.map +1 -1
  347. package/out/scripting/command.d.ts +2 -2
  348. package/out/scripting/command.d.ts.map +1 -1
  349. package/out/scripting/command.js +1 -0
  350. package/out/scripting/command.js.map +1 -1
  351. package/out/scripting/operation.d.ts +1 -1
  352. package/out/scripting/operation.d.ts.map +1 -1
  353. package/out/scripting/operation.js +1 -1
  354. package/out/scripting/operation.js.map +1 -1
  355. package/out/scripting/utils.d.ts +3 -4
  356. package/out/scripting/utils.d.ts.map +1 -1
  357. package/out/scripting/utils.js +3 -4
  358. package/out/scripting/utils.js.map +1 -1
  359. package/out/strings/python-json.js +1 -1
  360. package/out/strings/python-json.js.map +1 -1
  361. package/out/tokenization/Span.d.ts +1 -1
  362. package/out/tokenization/Span.d.ts.map +1 -1
  363. package/out/tools/coarse-placer/build/dataset.d.ts +4 -2
  364. package/out/tools/coarse-placer/build/dataset.d.ts.map +1 -1
  365. package/out/tools/coarse-placer/build/dataset.js.map +1 -1
  366. package/out/tools/coarse-placer/build/outlier/exposure.d.ts +5 -3
  367. package/out/tools/coarse-placer/build/outlier/exposure.d.ts.map +1 -1
  368. package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
  369. package/out/tools/coarse-placer/build/outlier/latin.d.ts +3 -3
  370. package/out/tools/coarse-placer/build/outlier/oa.d.ts +3 -3
  371. package/out/tools/coarse-placer/eval/latin-offmap.d.ts +3 -3
  372. package/out/tools/coarse-placer/eval/openset.js +2 -2
  373. package/out/tools/coarse-placer/eval/openset.js.map +1 -1
  374. package/out/tools/coarse-placer/eval/quant-compare.d.ts +4 -4
  375. package/out/tools/coarse-placer/eval.d.ts +3 -3
  376. package/out/tools/coarse-placer/paths.js +1 -1
  377. package/out/tools/coarse-placer/paths.js.map +1 -1
  378. package/out/tools/coarse-placer/probe-frontier.d.ts +2 -2
  379. package/out/tools/coarse-placer/quantize.d.ts +2 -2
  380. package/out/tools/coarse-placer/train.d.ts +5 -5
  381. package/out/tools/download/libpostal-resources.d.ts.map +1 -1
  382. package/out/tools/download/libpostal-resources.js +2 -1
  383. package/out/tools/download/libpostal-resources.js.map +1 -1
  384. package/out/tools/download/ssl-address.d.ts +2 -2
  385. package/out/tools/generate-language-types.d.ts +1 -1
  386. package/out/tools/generate-language-types.js +1 -1
  387. package/out/tools/generate-language-types.js.map +1 -1
  388. package/out/trust-policies.d.ts +0 -1
  389. package/out/trust-policies.d.ts.map +1 -1
  390. package/out/trust-policies.js +0 -1
  391. package/out/trust-policies.js.map +1 -1
  392. package/out/types/Classification.d.ts +1 -1
  393. package/out/types/Classification.d.ts.map +1 -1
  394. package/out/types/classifier.d.ts +1 -1
  395. package/out/types/classifier.d.ts.map +1 -1
  396. package/out/utils/geodatabase-archive.d.ts +11 -4
  397. package/out/utils/geodatabase-archive.d.ts.map +1 -1
  398. package/out/utils/geodatabase-archive.js +1 -1
  399. package/out/utils/geodatabase-archive.js.map +1 -1
  400. package/out/utils/sqlite-rows.d.ts +2 -2
  401. package/out/utils/sqlite-rows.d.ts.map +1 -1
  402. package/out/utils/sqlite-rows.js +2 -2
  403. package/out/utils/sqlite-rows.js.map +1 -1
  404. package/out/utils/stream-to-disk.d.ts.map +1 -1
  405. package/out/utils/stream-to-disk.js +1 -1
  406. package/out/utils/stream-to-disk.js.map +1 -1
  407. package/out/utils/union-find.js +1 -1
  408. package/out/utils/union-find.js.map +1 -1
  409. package/out/vale.js +1 -1
  410. package/out/vale.js.map +1 -1
  411. package/out/workspaces.d.ts +1 -1
  412. package/out/workspaces.js +1 -1
  413. package/out/workspaces.js.map +1 -1
  414. package/package.json +46 -14
  415. package/tools/coarse-placer/build/dataset.ts +4 -2
  416. package/tools/coarse-placer/build/outlier/exposure.ts +5 -3
  417. package/tools/coarse-placer/build/outlier/latin.ts +3 -3
  418. package/tools/coarse-placer/build/outlier/oa.ts +3 -3
  419. package/tools/coarse-placer/eval/latin-offmap.ts +3 -3
  420. package/tools/coarse-placer/eval/openset.ts +3 -3
  421. package/tools/coarse-placer/eval/quant-compare.ts +4 -4
  422. package/tools/coarse-placer/eval.ts +3 -3
  423. package/tools/coarse-placer/paths.ts +1 -1
  424. package/tools/coarse-placer/probe-frontier.ts +2 -2
  425. package/tools/coarse-placer/quantize.ts +2 -2
  426. package/tools/coarse-placer/train.ts +5 -5
  427. package/tools/download/libpostal-resources.ts +2 -1
  428. package/tools/download/ssl-address.ts +2 -2
  429. package/tools/generate-language-types.ts +3 -3
@@ -15,21 +15,6 @@ import type {
15
15
  StreetCentroidLookup,
16
16
  } from "#resolver/lookup-types"
17
17
 
18
- export type { CountryBBoxFact, CountryCoverageFact, GazetteerArtifactCoverage } from "#resolver/coverage-facts"
19
- export { hardCountrySafelistFromCoverage } from "#resolver/coverage-facts"
20
-
21
- export type {
22
- AddressPointHit,
23
- AddressPointLookup,
24
- InterpolatedPointHit,
25
- InterpolationLookup,
26
- PostcodePrefixAncestor,
27
- PostcodePrefixIndexLike,
28
- PostcodePrefixNode,
29
- StreetCentroidHit,
30
- StreetCentroidLookup,
31
- } from "#resolver/lookup-types"
32
-
33
18
  export interface ResolvedPlace {
34
19
  /**
35
20
  * Resolver-specific place identifier.
@@ -46,7 +31,7 @@ export interface ResolvedPlace {
46
31
  /**
47
32
  * ISO 3166-1 alpha-2 country code, if known.
48
33
  */
49
- country?: string
34
+ country: string | null
50
35
  /**
51
36
  * Centroid latitude.
52
37
  */
@@ -58,7 +43,7 @@ export interface ResolvedPlace {
58
43
  /**
59
44
  * Parent place id, if any.
60
45
  */
61
- parent_id?: number | string
46
+ parent_id: number | string | null
62
47
  /**
63
48
  * Resolver-defined ranking score.
64
49
  */
@@ -66,49 +51,63 @@ export interface ResolvedPlace {
66
51
  /**
67
52
  * Optional backend prominence score.
68
53
  */
69
- prominence?: number
54
+ prominence: number | null
70
55
  /**
71
56
  * Optional raw population.
72
57
  */
73
- population?: number
58
+ population: number | null
74
59
  /**
75
60
  * Optional referential likelihood in [0, 1].
76
61
  */
77
- referential?: number
62
+ referential: number | null
78
63
  /**
79
64
  * Optional strict encyclopedia importance in [0, 1].
80
65
  */
81
- encyclopedic?: number
66
+ encyclopedic: number | null
82
67
  /**
83
68
  * Optional blended global toponym prior in [0, 1].
84
69
  */
85
- importance?: number
70
+ importance: number | null
86
71
  /**
87
72
  * Optional exact name/alias match marker.
88
73
  */
89
- exactMatch?: boolean
74
+ exactMatch: boolean | null
90
75
  /**
91
76
  * Optional postcode/locality mismatch marker.
92
77
  */
93
- mismatch?: boolean
78
+ mismatch?: boolean | null
94
79
  /**
95
80
  * Optional fallback-quality marker.
96
81
  */
97
- resolutionQuality?: "fallback"
82
+ resolutionQuality?: "fallback" | null
98
83
  /**
99
84
  * Optional admin-containment verdict.
100
85
  */
101
- containedByQualifier?: boolean
86
+ containedByQualifier?: boolean | null
102
87
  /**
103
88
  * Optional marker for a miss under parent scope.
104
89
  */
105
- regionScopeMiss?: boolean
90
+ regionScopeMiss?: boolean | null
106
91
  /**
107
92
  * Optional marker for variant-alias exemption.
108
93
  */
109
- variantAliasExempted?: true
94
+ variantAliasExempted?: true | null
110
95
  }
111
96
 
97
+ /**
98
+ * The nullable {@link ResolvedPlace} signals, each `null`, spread first into a place literal.
99
+ */
100
+ export const EMPTY_PLACE_FIELDS = Object.freeze({
101
+ country: null,
102
+ parent_id: null,
103
+ prominence: null,
104
+ population: null,
105
+ referential: null,
106
+ encyclopedic: null,
107
+ importance: null,
108
+ exactMatch: null,
109
+ }) satisfies Partial<ResolvedPlace>
110
+
112
111
  export interface ResolverBackend {
113
112
  findPlace(query: {
114
113
  text: string
@@ -156,7 +155,7 @@ export interface ResolverBackend {
156
155
  /**
157
156
  * Optional artifact coverage facts.
158
157
  */
159
- artifactCoverage?: GazetteerArtifactCoverage
158
+ artifactCoverage?: GazetteerArtifactCoverage | null
160
159
  }
161
160
 
162
161
  export interface BackendCapabilityGap {
@@ -208,6 +207,84 @@ export interface CoincidentLocality extends ResolvedPlace {
208
207
  */
209
208
  export type WeakResolutionReading = "score" | "containment" | "either"
210
209
 
210
+ /**
211
+ * Who chose a default country scope.
212
+ *
213
+ * - `"caller"`: the caller asked for the country.
214
+ * - `"inferred"`: the locale supplied it.
215
+ * `country` lookups ignore an inferred scope, and stronger evidence in the input can override it.
216
+ */
217
+ export type DefaultCountrySource = "caller" | "inferred"
218
+
219
+ /**
220
+ * A default top-level country scope for resolution.
221
+ */
222
+ export interface DefaultCountry {
223
+ /**
224
+ * ISO 3166-1 alpha-2 code.
225
+ */
226
+ country: string
227
+ source: DefaultCountrySource
228
+ }
229
+
230
+ /**
231
+ * The on/off resolver passes and tiers, every one resolved against {@link RESOLVE_SWITCH_DEFAULTS}.
232
+ *
233
+ * Each is an optional {@link ResolveOpts} key.
234
+ * The resolver reads them only through {@link resolveSwitches}, so a default lives in exactly one place.
235
+ */
236
+ export interface ResolveSwitches {
237
+ parentFallback: boolean
238
+ addressPointBboxFallback: boolean
239
+ spanRescore: boolean
240
+ spanRescoreRequireContextRemainder: boolean
241
+ postalCompoundRecovery: boolean
242
+ postcodeConsistency: boolean
243
+ postcodeCountryCoherence: boolean
244
+ postcodeShapeCoherence: boolean
245
+ postcodeContainmentCoherence: boolean
246
+ postcodePrefixPrior: boolean
247
+ adminCoherence: boolean
248
+ hierarchyCompletion: boolean
249
+ includeAncestors: boolean
250
+ adminContainmentRerank: boolean
251
+ diagnoseUnreachable: boolean
252
+ }
253
+
254
+ /**
255
+ * The default of every {@link ResolveSwitches} key.
256
+ */
257
+ export const RESOLVE_SWITCH_DEFAULTS: Readonly<ResolveSwitches> = {
258
+ parentFallback: true,
259
+ addressPointBboxFallback: false,
260
+ spanRescore: true,
261
+ spanRescoreRequireContextRemainder: false,
262
+ postalCompoundRecovery: true,
263
+ postcodeConsistency: true,
264
+ postcodeCountryCoherence: true,
265
+ postcodeShapeCoherence: false,
266
+ postcodeContainmentCoherence: false,
267
+ postcodePrefixPrior: false,
268
+ adminCoherence: true,
269
+ hierarchyCompletion: true,
270
+ includeAncestors: false,
271
+ adminContainmentRerank: true,
272
+ diagnoseUnreachable: false,
273
+ }
274
+
275
+ /**
276
+ * Fills each unset switch from {@link RESOLVE_SWITCH_DEFAULTS}.
277
+ */
278
+ export function resolveSwitches(opts: Partial<ResolveSwitches>): ResolveSwitches {
279
+ const switches = { ...RESOLVE_SWITCH_DEFAULTS }
280
+
281
+ for (const key of Object.keys(RESOLVE_SWITCH_DEFAULTS) as (keyof ResolveSwitches)[]) {
282
+ switches[key] = opts[key] ?? RESOLVE_SWITCH_DEFAULTS[key]
283
+ }
284
+
285
+ return switches
286
+ }
287
+
211
288
  export interface ResolveOpts {
212
289
  /**
213
290
  * Max backend lookups per tree.
@@ -222,13 +299,9 @@ export interface ResolveOpts {
222
299
  */
223
300
  candidatesPerLookup?: number
224
301
  /**
225
- * Default top-level country scope.
302
+ * Default top-level country scope, and who chose it.
226
303
  */
227
- defaultCountry?: string
228
- /**
229
- * True if defaultCountry is locale-inferred.
230
- */
231
- defaultCountryIsInferred?: boolean
304
+ defaultCountry?: DefaultCountry
232
305
  /**
233
306
  * Country scope for fuzzy matching only.
234
307
  */
@@ -239,6 +312,8 @@ export interface ResolveOpts {
239
312
  bias?: Array<{ lat: number; lon: number; weight?: number }>
240
313
  /**
241
314
  * Retry without parent constraint on scoped miss.
315
+ *
316
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
242
317
  */
243
318
  parentFallback?: boolean
244
319
  /**
@@ -268,7 +343,7 @@ export interface ResolveOpts {
268
343
  /**
269
344
  * Optional capital-level callback.
270
345
  */
271
- capitalLevel?: (place: { name: string; country?: string; lat: number; lon: number }) => number
346
+ capitalLevel?: (place: { name: string; country: string | null; lat: number; lon: number }) => number
272
347
  /**
273
348
  * Optional hard country filter from coarse placer.
274
349
  */
@@ -279,6 +354,7 @@ export interface ResolveOpts {
279
354
  addressPoints?: AddressPointLookup
280
355
  /**
281
356
  * Enables locality-bbox fallback in address-point lookup.
357
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
282
358
  */
283
359
  addressPointBboxFallback?: boolean
284
360
  /**
@@ -292,13 +368,15 @@ export interface ResolveOpts {
292
368
  /**
293
369
  * Optional street-centroid provider by country.
294
370
  */
295
- streetCentroids?: (country: string) => StreetCentroidLookup | undefined
371
+ streetCentroids?: ((country: string) => StreetCentroidLookup | null) | null
296
372
  /**
297
373
  * Optional pre-resolution country hints for street-centroid tier.
298
374
  */
299
375
  streetCountryHints?: readonly string[]
300
376
  /**
301
377
  * Enables span-rescore recovery tier.
378
+ *
379
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
302
380
  */
303
381
  spanRescore?: boolean
304
382
  /**
@@ -307,6 +385,8 @@ export interface ResolveOpts {
307
385
  spanRescoreThresholdKm?: number
308
386
  /**
309
387
  * Require contextual remainder for span-rescore sub-spans.
388
+ *
389
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
310
390
  */
311
391
  spanRescoreRequireContextRemainder?: boolean
312
392
  /**
@@ -315,10 +395,14 @@ export interface ResolveOpts {
315
395
  spanRescoreWeakResolution?: WeakResolutionReading
316
396
  /**
317
397
  * Enables postal-compound recovery in span-rescore tier.
398
+ *
399
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
318
400
  */
319
401
  postalCompoundRecovery?: boolean
320
402
  /**
321
403
  * Enables postcode-based locality disambiguation.
404
+ *
405
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
322
406
  */
323
407
  postcodeConsistency?: boolean
324
408
  /**
@@ -331,6 +415,8 @@ export interface ResolveOpts {
331
415
  postcodeConsistencyMaxMoveKm?: number
332
416
  /**
333
417
  * Enables postcode-country coherence pass.
418
+ *
419
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
334
420
  */
335
421
  postcodeCountryCoherence?: boolean
336
422
  /**
@@ -339,14 +425,20 @@ export interface ResolveOpts {
339
425
  postcodeCountryCoherenceThresholdKm?: number
340
426
  /**
341
427
  * Enables postcode-shape coherence pass.
428
+ *
429
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
342
430
  */
343
431
  postcodeShapeCoherence?: boolean
344
432
  /**
345
433
  * Enables postcode-containment coherence pass.
434
+ *
435
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
346
436
  */
347
437
  postcodeContainmentCoherence?: boolean
348
438
  /**
349
439
  * Enables postcode-prefix prior tier.
440
+ *
441
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
350
442
  */
351
443
  postcodePrefixPrior?: boolean
352
444
  /**
@@ -359,18 +451,28 @@ export interface ResolveOpts {
359
451
  postcodePrefixIndex?: PostcodePrefixIndexLike
360
452
  /**
361
453
  * Enables admin descendant-consistency correction.
454
+ *
455
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
362
456
  */
363
457
  adminCoherence?: boolean
364
458
  /**
365
459
  * Enables dual-role hierarchy completion.
460
+ *
461
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
366
462
  */
367
463
  hierarchyCompletion?: boolean
368
464
  /**
369
465
  * Attach ancestor lineage to resolved nodes.
466
+ *
467
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
370
468
  */
371
469
  includeAncestors?: boolean
372
470
  /**
373
- * Enables admin-containment rerank for locality candidates.
471
+ * Reranks locality candidates by containment in a parsed region qualifier.
472
+ *
473
+ * It stands down under a caller-supplied `defaultCountry`.
474
+ *
475
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
374
476
  */
375
477
  adminContainmentRerank?: boolean
376
478
  /**
@@ -379,6 +481,8 @@ export interface ResolveOpts {
379
481
  traceSink?: (record: ResolveNodeTrace) => void
380
482
  /**
381
483
  * Diagnose unresolved value reachability across placetypes.
484
+ *
485
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
382
486
  */
383
487
  diagnoseUnreachable?: boolean
384
488
  }
@@ -392,14 +496,14 @@ export interface ResolveCandidateTrace {
392
496
  /**
393
497
  * Optional country code.
394
498
  */
395
- country?: string
499
+ country: string | null
396
500
  placetype: string
397
501
  score: number
398
- prominence?: number
399
- importance?: number
400
- population?: number
401
- exactMatch?: boolean
402
- containedByQualifier?: boolean
502
+ prominence: number | null
503
+ importance: number | null
504
+ population: number | null
505
+ exactMatch: boolean | null
506
+ containedByQualifier: boolean | null
403
507
  ranks: Record<string, number>
404
508
  }
405
509
 
@@ -411,17 +515,17 @@ export interface ResolveNodeTrace {
411
515
  value: string
412
516
  placetype: string
413
517
  query: {
414
- country?: string
415
- parentID?: string | number
416
- postcode?: string
417
- regionQualifier?: string
518
+ country: string | null
519
+ parentID: string | number | null
520
+ postcode: string | null
521
+ regionQualifier: string | null
418
522
  limit: number
419
523
  }
420
524
  checks: string[]
421
525
  /**
422
526
  * Other placetypes where the value was reachable, if probed.
423
527
  */
424
- reachableIn?: Array<{ placetype: string; n: number }>
528
+ reachableIn: Array<{ placetype: string; n: number }> | null
425
529
  candidates: ResolveCandidateTrace[]
426
530
  candidatesTruncated: number
427
531
  picked: {
@@ -451,9 +555,9 @@ export interface Resolver {
451
555
  /**
452
556
  * Optional artifact coverage facts passthrough.
453
557
  */
454
- artifactCoverage?: GazetteerArtifactCoverage
558
+ artifactCoverage: GazetteerArtifactCoverage | null
455
559
  /**
456
560
  * Optional list of missing backend capabilities.
457
561
  */
458
- capabilityGaps?: readonly BackendCapabilityGap[]
562
+ capabilityGaps: readonly BackendCapabilityGap[] | null
459
563
  }
package/lib/resolver.ts CHANGED
@@ -34,38 +34,40 @@ export type {
34
34
  AuthoritativeResponse,
35
35
  } from "#resolver/authoritative-provider"
36
36
 
37
- export {
38
- createFixtureAuthoritativeProvider,
39
- fixtureExactMatch,
40
- type FixtureAuthoritativeProviderOptions,
41
- type FixtureAuthoritativeRule,
42
- } from "#resolver/fixture-authoritative-provider"
43
-
44
37
  export type { RegionDatabaseProvider, RegionDatabases } from "#resolver/region-database-provider"
45
38
 
46
- export { hardCountrySafelistFromCoverage } from "#resolver/types"
39
+ export { EMPTY_PLACE_FIELDS, RESOLVE_SWITCH_DEFAULTS, resolveSwitches } from "#resolver/types"
40
+ export { hardCountrySafelistFromCoverage } from "#resolver/coverage-facts"
47
41
 
48
42
  export type {
49
- AddressPointHit,
50
- AddressPointLookup,
51
43
  Ancestor,
52
44
  BackendCapabilityGap,
53
45
  CoincidentLocality,
54
- CountryBBoxFact,
55
- CountryCoverageFact,
56
- GazetteerArtifactCoverage,
57
- InterpolatedPointHit,
58
- InterpolationLookup,
59
- PostcodePrefixAncestor,
60
- PostcodePrefixIndexLike,
61
- PostcodePrefixNode,
62
46
  ResolveCandidateTrace,
63
47
  ResolveNodeTrace,
64
48
  ResolveOpts,
49
+ ResolveSwitches,
50
+ DefaultCountry,
51
+ DefaultCountrySource,
65
52
  ResolvedPlace,
66
53
  Resolver,
67
54
  ResolverBackend,
68
- StreetCentroidHit,
69
- StreetCentroidLookup,
70
55
  WeakResolutionReading,
71
56
  } from "#resolver/types"
57
+
58
+ export type {
59
+ AddressPointHit,
60
+ AddressPointLookup,
61
+ InterpolatedPointHit,
62
+ InterpolationLookup,
63
+ POIDistanceHit,
64
+ PostcodePlace,
65
+ PostcodePrefixAncestor,
66
+ PostcodePrefixIndexLike,
67
+ PostcodePrefixNode,
68
+ StreetCentroidHit,
69
+ StreetCentroidLookup,
70
+ WOFAncestor,
71
+ } from "#resolver/lookup-types"
72
+
73
+ export type { CountryBBoxFact, CountryCoverageFact, GazetteerArtifactCoverage } from "#resolver/coverage-facts"
@@ -6,7 +6,7 @@
6
6
 
7
7
  import { PathBuilder, type PathBuilderLike } from "path-ts"
8
8
 
9
- import { tryStat } from "#fs/readers"
9
+ import { tryStat } from "#fs/readers/stat"
10
10
  import { makeDirectories } from "#fs/writers"
11
11
  import { git } from "#git"
12
12
 
@@ -11,8 +11,6 @@ import {
11
11
  type Alpha3bLanguageCode,
12
12
  } from "#resources/languages/types.gen"
13
13
 
14
- export * from "#resources/languages/types.gen"
15
-
16
14
  /**
17
15
  * Prefixed languages are those which use a street prefix instead of a suffix.
18
16
  */
@@ -10,7 +10,7 @@
10
10
  * artifacts the parser loads at runtime.
11
11
  */
12
12
 
13
- import type { Alpha2LanguageCode } from "#resources/languages"
13
+ import type { Alpha2LanguageCode } from "#resources/languages/types.gen"
14
14
 
15
15
  /**
16
16
  * A libpostal dictionary language, or `all` for the language-agnostic directory.
@@ -8,12 +8,8 @@ import { DatabaseClient } from "@mailwoman/sqlite/client"
8
8
  import type { DatabaseSyncOptions, SQLInputValue } from "@mailwoman/sqlite/client"
9
9
  import { PathBuilder, type PathBuilderLike } from "path-ts"
10
10
 
11
- import {
12
- type Alpha2LanguageCode,
13
- type Alpha3bLanguageCode,
14
- Alpha3bToAlpha2,
15
- isAlpha3bLanguageCode,
16
- } from "#resources/languages"
11
+ import { isAlpha3bLanguageCode } from "#resources/languages"
12
+ import { type Alpha2LanguageCode, type Alpha3bLanguageCode, Alpha3bToAlpha2 } from "#resources/languages/types.gen"
17
13
  import { tryWithBackoff } from "#resources/whosonfirst/backoff"
18
14
  import type { WhosOnFirstPlacetype } from "#resources/whosonfirst/placetypes/definition"
19
15
 
@@ -12,7 +12,8 @@
12
12
 
13
13
  import { resolvePath, resolvePathBuilder, type PathBuilderLike } from "path-ts"
14
14
 
15
- import { isDirectory, pathExists, readLocalJSONFile } from "#fs/readers"
15
+ import { readLocalJSONFile } from "#fs/readers"
16
+ import { isDirectory, pathExists } from "#fs/readers/stat"
16
17
  import type { WOFFeature } from "#resources/whosonfirst/placetypes/admin"
17
18
 
18
19
  /**
@@ -6,13 +6,8 @@
6
6
 
7
7
  import type { GeoFeature, GeometryLiteral } from "@mailwoman/spatial"
8
8
 
9
- import {
10
- type Alpha2LanguageCode,
11
- type Alpha3bLanguageCode,
12
- Alpha3bToAlpha2,
13
- isAlpha2LanguageCode,
14
- isAlpha3bLanguageCode,
15
- } from "#resources/languages"
9
+ import { isAlpha2LanguageCode, isAlpha3bLanguageCode } from "#resources/languages"
10
+ import { type Alpha2LanguageCode, type Alpha3bLanguageCode, Alpha3bToAlpha2 } from "#resources/languages/types.gen"
16
11
  import type { WhosOnFirstPlacetype } from "#resources/whosonfirst/placetypes/definition"
17
12
 
18
13
  export interface WOFBaseProperties {
@@ -92,17 +87,17 @@ export interface ParsedWOFPlacetype {
92
87
  src: string
93
88
  placetype: WhosOnFirstPlacetype
94
89
  localizedPropMap: Map<Alpha3bLanguageCode, LocalizedPlacetypePropMap>
95
- country?: string
96
- latitude?: number
97
- longitude?: number
98
- population?: number
99
- concordances?: Record<string, string | number>
100
- isCurrent?: boolean
101
- isDeprecated?: boolean
102
- isCeased?: boolean
103
- isSuperseded?: boolean
104
- isSuperseding?: boolean
105
- lastmodified?: number
90
+ country: string | null
91
+ latitude: number | null
92
+ longitude: number | null
93
+ population: number | null
94
+ concordances: Record<string, string | number> | null
95
+ isCurrent: boolean | null
96
+ isDeprecated: boolean
97
+ isCeased: boolean
98
+ isSuperseded: boolean
99
+ isSuperseding: boolean
100
+ lastmodified: number | null
106
101
  }
107
102
 
108
103
  const langPattern = new RegExp(`:([a-z0-9\\-_]{2,3})_x_(${WOFNameKinds.join("|")})`)
@@ -167,9 +162,9 @@ export function pluckPlacetypeSpec({
167
162
  if (!src) throw new Error(`No source found for placetype ${placetype} with ID ${id}`)
168
163
 
169
164
  const population =
170
- typeof wofPopulation === "number" ? wofPopulation : typeof gnPopulation === "number" ? gnPopulation : undefined
165
+ typeof wofPopulation === "number" ? wofPopulation : typeof gnPopulation === "number" ? gnPopulation : null
171
166
 
172
- const isCurrent = mzIsCurrent === undefined ? undefined : mzIsCurrent !== 0 && mzIsCurrent !== "0"
167
+ const isCurrent = mzIsCurrent === undefined ? null : mzIsCurrent !== 0 && mzIsCurrent !== "0"
173
168
 
174
169
  return {
175
170
  id,
@@ -178,17 +173,17 @@ export function pluckPlacetypeSpec({
178
173
  parent_id,
179
174
  placetype,
180
175
  localizedPropMap,
181
- country: country || undefined,
182
- latitude: typeof latitude === "number" ? latitude : undefined,
183
- longitude: typeof longitude === "number" ? longitude : undefined,
176
+ country: country || null,
177
+ latitude: typeof latitude === "number" ? latitude : null,
178
+ longitude: typeof longitude === "number" ? longitude : null,
184
179
  population,
185
- concordances: concordances && Object.keys(concordances).length ? concordances : undefined,
180
+ concordances: concordances && Object.keys(concordances).length ? concordances : null,
186
181
  isCurrent,
187
182
  isDeprecated: !!edtfDeprecated,
188
183
  isCeased: !!edtfCessation,
189
184
  isSuperseded: !!(superseded_by && superseded_by.length),
190
185
  isSuperseding: !!(supersedes && supersedes.length),
191
- lastmodified: typeof lastmodified === "number" ? lastmodified : undefined,
186
+ lastmodified: typeof lastmodified === "number" ? lastmodified : null,
192
187
  }
193
188
  }
194
189
 
@@ -52,7 +52,8 @@ export type InterpolateColorCallback = (t: number) => string
52
52
  export interface GenerateMermaidMarkupOptions {
53
53
  /**
54
54
  * Restrict descendants to the given roles.
55
- * Defaults to all roles.
55
+ *
56
+ * @defaultValue all roles.
56
57
  */
57
58
  roles?: Iterable<PlacetypeRole>
58
59
  /**
@@ -81,7 +82,7 @@ const HAND_TUNED_PALETTE: Record<PlacetypeRole, RolePalette> = Object.fromEntrie
81
82
  * Walk the filtered subtree once to find the deepest reachable descendant, mirroring the emit-walk in
82
83
  * {@linkcode generateMermaidMarkup} so its depths line up with the edges that will be emitted.
83
84
  */
84
- function measureMaxDepth(root: Placetype, roles: Iterable<PlacetypeRole> | undefined): number {
85
+ function measureMaxDepth(root: Placetype, roles: Iterable<PlacetypeRole> | null): number {
85
86
  let maxDepth = 0
86
87
  const visited = new Set<string>()
87
88
 
@@ -132,7 +133,7 @@ export function generateMermaidMarkup(placetype: Placetype, options: GenerateMer
132
133
  ]
133
134
 
134
135
  // Pre-compute max depth once so every edge's `t` is consistent across the second pass.
135
- const maxDepth = measureMaxDepth(placetype, roles)
136
+ const maxDepth = measureMaxDepth(placetype, roles ?? null)
136
137
 
137
138
  const visited = new Set<string>()
138
139
  let edgeIdx = 0
@@ -54,10 +54,10 @@ export const PLACETYPE_SPECIFICITY: Readonly<Partial<Record<WhosOnFirstPlacetype
54
54
  *
55
55
  * The two reasonable answers (block conservatively, or ignore) differ per call site.
56
56
  */
57
- export function placetypeSpecificity(placetype: string | null | undefined): number | undefined {
58
- if (!placetype) return undefined
57
+ export function placetypeSpecificity(placetype: string | null | undefined): number | null {
58
+ if (!placetype) return null
59
59
 
60
- return PLACETYPE_SPECIFICITY[placetype]
60
+ return PLACETYPE_SPECIFICITY[placetype] ?? null
61
61
  }
62
62
 
63
63
  /**
@@ -72,11 +72,11 @@ export function placetypeSpecificity(placetype: string | null | undefined): numb
72
72
  export function isAtLeastAsSpecific(
73
73
  candidate: string | null | undefined,
74
74
  reference: string | null | undefined
75
- ): boolean | undefined {
75
+ ): boolean | null {
76
76
  const a = placetypeSpecificity(candidate)
77
77
  const b = placetypeSpecificity(reference)
78
78
 
79
- if (a === undefined || b === undefined) return undefined
79
+ if (a === null || b === null) return null
80
80
 
81
81
  return a >= b
82
82
  }
@@ -97,11 +97,11 @@ export function isAtLeastAsSpecific(
97
97
  export function isStrictlyFiner(
98
98
  candidate: string | null | undefined,
99
99
  reference: string | null | undefined
100
- ): boolean | undefined {
100
+ ): boolean | null {
101
101
  const a = placetypeSpecificity(candidate)
102
102
  const b = placetypeSpecificity(reference)
103
103
 
104
- if (a === undefined || b === undefined) return undefined
104
+ if (a === null || b === null) return null
105
105
 
106
106
  return a > b
107
107
  }
package/lib/resources.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  export * from "#resources/debugging"
8
8
  export * from "#resources/git"
9
9
  export * from "#resources/languages"
10
+ export * from "#resources/languages/types.gen"
10
11
  export * from "#resources/libpostal"
11
12
  export * from "#resources/locale"
12
13
  export * from "#resources/set"