@mailwoman/registry 10.8.0 → 11.1.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 (399) hide show
  1. package/README.md +93 -98
  2. package/data/manifests/artifacts.json +32 -0
  3. package/data/manifests/coverage.json +56 -0
  4. package/data/manifests/sources.lock.json +48 -0
  5. package/data/normalized/iata-airports.json +126749 -0
  6. package/data/normalized/iso3166-1.json +2035 -0
  7. package/definitions/namespaces.json +63 -0
  8. package/definitions/sections.json +73 -0
  9. package/docs/data-policy.md +81 -0
  10. package/docs/performance.md +146 -0
  11. package/docs/rgy1.md +144 -0
  12. package/lib/artifacts/country-airport-collision.ts +28 -0
  13. package/lib/artifacts/iata-airport/membership.ts +28 -0
  14. package/lib/artifacts/iata-airport/records.ts +28 -0
  15. package/lib/artifacts/iso3166-1/alpha2-membership.ts +28 -0
  16. package/lib/artifacts/iso3166-1/alpha3-membership.ts +28 -0
  17. package/lib/artifacts/iso3166-1/records.ts +28 -0
  18. package/lib/errors.ts +47 -0
  19. package/lib/iata/airports/records.ts +173 -0
  20. package/lib/iata/airports/validate.ts +50 -0
  21. package/lib/index.ts +32 -18
  22. package/lib/inspect.ts +56 -0
  23. package/lib/iso3166/alpha2.ts +48 -0
  24. package/lib/iso3166/alpha3.ts +51 -0
  25. package/lib/iso3166/records.ts +150 -0
  26. package/lib/iso3166/relations.ts +30 -0
  27. package/lib/key.ts +148 -0
  28. package/lib/normalize.ts +35 -0
  29. package/lib/overlap/country-airport.ts +110 -0
  30. package/lib/rgy1/base64.ts +23 -0
  31. package/lib/rgy1/reader.ts +317 -0
  32. package/lib/rgy1/sections.generated.ts +80 -0
  33. package/lib/rgy1/views.ts +266 -0
  34. package/lib/types.ts +92 -77
  35. package/lib/wasm.ts +287 -0
  36. package/out/artifacts/country-airport-collision.d.ts +7 -0
  37. package/out/artifacts/country-airport-collision.d.ts.map +1 -0
  38. package/out/artifacts/country-airport-collision.js +22 -0
  39. package/out/artifacts/country-airport-collision.js.map +1 -0
  40. package/out/artifacts/iata-airport/membership.d.ts +7 -0
  41. package/out/artifacts/iata-airport/membership.d.ts.map +1 -0
  42. package/out/artifacts/iata-airport/membership.js +22 -0
  43. package/out/artifacts/iata-airport/membership.js.map +1 -0
  44. package/out/artifacts/iata-airport/records.d.ts +7 -0
  45. package/out/artifacts/iata-airport/records.d.ts.map +1 -0
  46. package/out/artifacts/iata-airport/records.js +22 -0
  47. package/out/artifacts/iata-airport/records.js.map +1 -0
  48. package/out/artifacts/iso3166-1/alpha2-membership.d.ts +7 -0
  49. package/out/artifacts/iso3166-1/alpha2-membership.d.ts.map +1 -0
  50. package/out/artifacts/iso3166-1/alpha2-membership.js +22 -0
  51. package/out/artifacts/iso3166-1/alpha2-membership.js.map +1 -0
  52. package/out/artifacts/iso3166-1/alpha3-membership.d.ts +7 -0
  53. package/out/artifacts/iso3166-1/alpha3-membership.d.ts.map +1 -0
  54. package/out/artifacts/iso3166-1/alpha3-membership.js +22 -0
  55. package/out/artifacts/iso3166-1/alpha3-membership.js.map +1 -0
  56. package/out/artifacts/iso3166-1/records.d.ts +7 -0
  57. package/out/artifacts/iso3166-1/records.d.ts.map +1 -0
  58. package/out/artifacts/iso3166-1/records.js +22 -0
  59. package/out/artifacts/iso3166-1/records.js.map +1 -0
  60. package/out/errors.d.ts +38 -0
  61. package/out/errors.d.ts.map +1 -0
  62. package/out/errors.js +37 -0
  63. package/out/errors.js.map +1 -0
  64. package/out/iata/airports/records.d.ts +37 -0
  65. package/out/iata/airports/records.d.ts.map +1 -0
  66. package/out/iata/airports/records.js +135 -0
  67. package/out/iata/airports/records.js.map +1 -0
  68. package/out/iata/airports/validate.d.ts +19 -0
  69. package/out/iata/airports/validate.d.ts.map +1 -0
  70. package/out/iata/airports/validate.js +42 -0
  71. package/out/iata/airports/validate.js.map +1 -0
  72. package/out/index.d.ts +21 -18
  73. package/out/index.d.ts.map +1 -1
  74. package/out/index.js +12 -22
  75. package/out/index.js.map +1 -1
  76. package/out/inspect.d.ts +35 -0
  77. package/out/inspect.d.ts.map +1 -0
  78. package/out/inspect.js +32 -0
  79. package/out/inspect.js.map +1 -0
  80. package/out/iso3166/alpha2.d.ts +16 -0
  81. package/out/iso3166/alpha2.d.ts.map +1 -0
  82. package/out/iso3166/alpha2.js +40 -0
  83. package/out/iso3166/alpha2.js.map +1 -0
  84. package/out/iso3166/alpha3.d.ts +21 -0
  85. package/out/iso3166/alpha3.d.ts.map +1 -0
  86. package/out/iso3166/alpha3.js +43 -0
  87. package/out/iso3166/alpha3.js.map +1 -0
  88. package/out/iso3166/records.d.ts +27 -0
  89. package/out/iso3166/records.d.ts.map +1 -0
  90. package/out/iso3166/records.js +105 -0
  91. package/out/iso3166/records.js.map +1 -0
  92. package/out/iso3166/relations.d.ts +13 -0
  93. package/out/iso3166/relations.d.ts.map +1 -0
  94. package/out/iso3166/relations.js +26 -0
  95. package/out/iso3166/relations.js.map +1 -0
  96. package/out/key.d.ts +67 -0
  97. package/out/key.d.ts.map +1 -0
  98. package/out/key.js +123 -0
  99. package/out/key.js.map +1 -0
  100. package/out/normalize.d.ts +26 -0
  101. package/out/normalize.d.ts.map +1 -0
  102. package/out/normalize.js +11 -0
  103. package/out/normalize.js.map +1 -0
  104. package/out/overlap/country-airport.d.ts +43 -0
  105. package/out/overlap/country-airport.d.ts.map +1 -0
  106. package/out/overlap/country-airport.js +72 -0
  107. package/out/overlap/country-airport.js.map +1 -0
  108. package/out/rgy1/base64.d.ts +11 -0
  109. package/out/rgy1/base64.d.ts.map +1 -0
  110. package/out/rgy1/base64.js +20 -0
  111. package/out/rgy1/base64.js.map +1 -0
  112. package/out/rgy1/reader.d.ts +92 -0
  113. package/out/rgy1/reader.d.ts.map +1 -0
  114. package/out/rgy1/reader.js +230 -0
  115. package/out/rgy1/reader.js.map +1 -0
  116. package/out/rgy1/sections.generated.d.ts +52 -0
  117. package/out/rgy1/sections.generated.d.ts.map +1 -0
  118. package/out/rgy1/sections.generated.js +69 -0
  119. package/out/rgy1/sections.generated.js.map +1 -0
  120. package/out/rgy1/views.d.ts +89 -0
  121. package/out/rgy1/views.d.ts.map +1 -0
  122. package/out/rgy1/views.js +216 -0
  123. package/out/rgy1/views.js.map +1 -0
  124. package/out/sdk/fetch.d.ts +49 -0
  125. package/out/sdk/fetch.d.ts.map +1 -0
  126. package/out/sdk/fetch.js +105 -0
  127. package/out/sdk/fetch.js.map +1 -0
  128. package/out/sdk/fetch.run.d.ts +2 -0
  129. package/out/sdk/fetch.run.d.ts.map +1 -0
  130. package/out/sdk/fetch.run.js +19 -0
  131. package/out/sdk/fetch.run.js.map +1 -0
  132. package/out/sdk/sources.d.ts +102 -0
  133. package/out/sdk/sources.d.ts.map +1 -0
  134. package/out/sdk/sources.js +101 -0
  135. package/out/sdk/sources.js.map +1 -0
  136. package/out/tools/artifact-path.d.ts +5 -0
  137. package/out/tools/artifact-path.d.ts.map +1 -0
  138. package/out/tools/artifact-path.js +9 -0
  139. package/out/tools/artifact-path.js.map +1 -0
  140. package/out/tools/bench.run.d.ts +2 -0
  141. package/out/tools/bench.run.d.ts.map +1 -0
  142. package/out/tools/bench.run.js +207 -0
  143. package/out/tools/bench.run.js.map +1 -0
  144. package/out/tools/build-wasm.run.d.ts +2 -0
  145. package/out/tools/build-wasm.run.d.ts.map +1 -0
  146. package/out/tools/build-wasm.run.js +69 -0
  147. package/out/tools/build-wasm.run.js.map +1 -0
  148. package/out/tools/generate-sections.run.d.ts +2 -0
  149. package/out/tools/generate-sections.run.d.ts.map +1 -0
  150. package/out/tools/generate-sections.run.js +127 -0
  151. package/out/tools/generate-sections.run.js.map +1 -0
  152. package/out/tools/generate.run.d.ts +2 -0
  153. package/out/tools/generate.run.d.ts.map +1 -0
  154. package/out/tools/generate.run.js +115 -0
  155. package/out/tools/generate.run.js.map +1 -0
  156. package/out/tools/normalize.d.ts +143 -0
  157. package/out/tools/normalize.d.ts.map +1 -0
  158. package/out/tools/normalize.js +303 -0
  159. package/out/tools/normalize.js.map +1 -0
  160. package/out/tools/normalize.run.d.ts +2 -0
  161. package/out/tools/normalize.run.d.ts.map +1 -0
  162. package/out/tools/normalize.run.js +27 -0
  163. package/out/tools/normalize.run.js.map +1 -0
  164. package/out/types.d.ts +91 -79
  165. package/out/types.d.ts.map +1 -1
  166. package/out/types.js +15 -8
  167. package/out/types.js.map +1 -1
  168. package/out/wasm.d.ts +85 -0
  169. package/out/wasm.d.ts.map +1 -0
  170. package/out/wasm.js +138 -0
  171. package/out/wasm.js.map +1 -0
  172. package/package.json +54 -28
  173. package/sdk/fetch.run.ts +24 -0
  174. package/sdk/fetch.ts +145 -0
  175. package/sdk/sources.ts +166 -0
  176. package/tools/artifact-path.ts +9 -0
  177. package/tools/bench.run.ts +274 -0
  178. package/tools/build-wasm.run.ts +81 -0
  179. package/tools/generate-sections.run.ts +144 -0
  180. package/tools/generate.run.ts +144 -0
  181. package/tools/normalize.run.ts +35 -0
  182. package/tools/normalize.ts +475 -0
  183. package/wasm/registry-simd.wasm +0 -0
  184. package/wasm/registry.wasm +0 -0
  185. package/lib/address-key.ts +0 -46
  186. package/lib/geocode-handler.ts +0 -37
  187. package/lib/geojson.ts +0 -72
  188. package/lib/ingest.ts +0 -349
  189. package/lib/learned-scorer.ts +0 -134
  190. package/lib/map-html.ts +0 -287
  191. package/lib/models/crosssource-gbt-en-us.ts +0 -43
  192. package/lib/models/dedup-gbt-en-us.ts +0 -47
  193. package/lib/models/org-crosssource-gbt-en-us.ts +0 -43
  194. package/lib/reconcile.ts +0 -239
  195. package/lib/resolve.ts +0 -569
  196. package/out/address-key.d.ts +0 -34
  197. package/out/address-key.d.ts.map +0 -1
  198. package/out/address-key.js +0 -41
  199. package/out/address-key.js.map +0 -1
  200. package/out/geocode-handler.d.ts +0 -20
  201. package/out/geocode-handler.d.ts.map +0 -1
  202. package/out/geocode-handler.js +0 -29
  203. package/out/geocode-handler.js.map +0 -1
  204. package/out/geojson.d.ts +0 -28
  205. package/out/geojson.d.ts.map +0 -1
  206. package/out/geojson.js +0 -62
  207. package/out/geojson.js.map +0 -1
  208. package/out/ingest.d.ts +0 -173
  209. package/out/ingest.d.ts.map +0 -1
  210. package/out/ingest.js +0 -185
  211. package/out/ingest.js.map +0 -1
  212. package/out/learned-scorer.d.ts +0 -61
  213. package/out/learned-scorer.d.ts.map +0 -1
  214. package/out/learned-scorer.js +0 -91
  215. package/out/learned-scorer.js.map +0 -1
  216. package/out/map-html.d.ts +0 -39
  217. package/out/map-html.d.ts.map +0 -1
  218. package/out/map-html.js +0 -220
  219. package/out/map-html.js.map +0 -1
  220. package/out/models/crosssource-gbt-en-us.d.ts +0 -45
  221. package/out/models/crosssource-gbt-en-us.d.ts.map +0 -1
  222. package/out/models/crosssource-gbt-en-us.js +0 -40
  223. package/out/models/crosssource-gbt-en-us.js.map +0 -1
  224. package/out/models/dedup-gbt-en-us.d.ts +0 -44
  225. package/out/models/dedup-gbt-en-us.d.ts.map +0 -1
  226. package/out/models/dedup-gbt-en-us.js +0 -44
  227. package/out/models/dedup-gbt-en-us.js.map +0 -1
  228. package/out/models/org-crosssource-gbt-en-us.d.ts +0 -45
  229. package/out/models/org-crosssource-gbt-en-us.d.ts.map +0 -1
  230. package/out/models/org-crosssource-gbt-en-us.js +0 -40
  231. package/out/models/org-crosssource-gbt-en-us.js.map +0 -1
  232. package/out/reconcile.d.ts +0 -96
  233. package/out/reconcile.d.ts.map +0 -1
  234. package/out/reconcile.js +0 -127
  235. package/out/reconcile.js.map +0 -1
  236. package/out/resolve.d.ts +0 -264
  237. package/out/resolve.d.ts.map +0 -1
  238. package/out/resolve.js +0 -282
  239. package/out/resolve.js.map +0 -1
  240. package/out/tools/coverage-reconciliation.d.ts +0 -67
  241. package/out/tools/coverage-reconciliation.d.ts.map +0 -1
  242. package/out/tools/coverage-reconciliation.js +0 -113
  243. package/out/tools/coverage-reconciliation.js.map +0 -1
  244. package/out/tools/cross/dataset-correlation.d.ts +0 -61
  245. package/out/tools/cross/dataset-correlation.d.ts.map +0 -1
  246. package/out/tools/cross/dataset-correlation.js +0 -244
  247. package/out/tools/cross/dataset-correlation.js.map +0 -1
  248. package/out/tools/cross/source-threshold-sweep.d.ts +0 -60
  249. package/out/tools/cross/source-threshold-sweep.d.ts.map +0 -1
  250. package/out/tools/cross/source-threshold-sweep.js +0 -264
  251. package/out/tools/cross/source-threshold-sweep.js.map +0 -1
  252. package/out/tools/dedup-ceiling.d.ts +0 -62
  253. package/out/tools/dedup-ceiling.d.ts.map +0 -1
  254. package/out/tools/dedup-ceiling.js +0 -171
  255. package/out/tools/dedup-ceiling.js.map +0 -1
  256. package/out/tools/eval-geocoder.d.ts +0 -68
  257. package/out/tools/eval-geocoder.d.ts.map +0 -1
  258. package/out/tools/eval-geocoder.js +0 -13
  259. package/out/tools/eval-geocoder.js.map +0 -1
  260. package/out/tools/geocoder/namesake-probe.d.ts +0 -33
  261. package/out/tools/geocoder/namesake-probe.d.ts.map +0 -1
  262. package/out/tools/geocoder/namesake-probe.js +0 -60
  263. package/out/tools/geocoder/namesake-probe.js.map +0 -1
  264. package/out/tools/geocoder/vs-provided-coords.d.ts +0 -53
  265. package/out/tools/geocoder/vs-provided-coords.d.ts.map +0 -1
  266. package/out/tools/geocoder/vs-provided-coords.js +0 -161
  267. package/out/tools/geocoder/vs-provided-coords.js.map +0 -1
  268. package/out/tools/gold-set-sample.d.ts +0 -67
  269. package/out/tools/gold-set-sample.d.ts.map +0 -1
  270. package/out/tools/gold-set-sample.js +0 -81
  271. package/out/tools/gold-set-sample.js.map +0 -1
  272. package/out/tools/learned/scorer/clustering-eval.d.ts +0 -77
  273. package/out/tools/learned/scorer/clustering-eval.d.ts.map +0 -1
  274. package/out/tools/learned/scorer/clustering-eval.js +0 -207
  275. package/out/tools/learned/scorer/clustering-eval.js.map +0 -1
  276. package/out/tools/learned/scorer/crossstate-eval.d.ts +0 -65
  277. package/out/tools/learned/scorer/crossstate-eval.d.ts.map +0 -1
  278. package/out/tools/learned/scorer/crossstate-eval.js +0 -168
  279. package/out/tools/learned/scorer/crossstate-eval.js.map +0 -1
  280. package/out/tools/learned/scorer/eval.d.ts +0 -64
  281. package/out/tools/learned/scorer/eval.d.ts.map +0 -1
  282. package/out/tools/learned/scorer/eval.js +0 -275
  283. package/out/tools/learned/scorer/eval.js.map +0 -1
  284. package/out/tools/matcher-scale.d.ts +0 -40
  285. package/out/tools/matcher-scale.d.ts.map +0 -1
  286. package/out/tools/matcher-scale.js +0 -111
  287. package/out/tools/matcher-scale.js.map +0 -1
  288. package/out/tools/nppes/dedup-benchmark.d.ts +0 -82
  289. package/out/tools/nppes/dedup-benchmark.d.ts.map +0 -1
  290. package/out/tools/nppes/dedup-benchmark.js +0 -226
  291. package/out/tools/nppes/dedup-benchmark.js.map +0 -1
  292. package/out/tools/nppes/org-name.d.ts +0 -15
  293. package/out/tools/nppes/org-name.d.ts.map +0 -1
  294. package/out/tools/nppes/org-name.js +0 -6
  295. package/out/tools/nppes/org-name.js.map +0 -1
  296. package/out/tools/nppes/overmerge-packet.d.ts +0 -43
  297. package/out/tools/nppes/overmerge-packet.d.ts.map +0 -1
  298. package/out/tools/nppes/overmerge-packet.js +0 -54
  299. package/out/tools/nppes/overmerge-packet.js.map +0 -1
  300. package/out/tools/nppes/report.d.ts +0 -97
  301. package/out/tools/nppes/report.d.ts.map +0 -1
  302. package/out/tools/nppes/report.js +0 -178
  303. package/out/tools/nppes/report.js.map +0 -1
  304. package/out/tools/nppes/sample.d.ts +0 -101
  305. package/out/tools/nppes/sample.d.ts.map +0 -1
  306. package/out/tools/nppes/sample.js +0 -127
  307. package/out/tools/nppes/sample.js.map +0 -1
  308. package/out/tools/nppes/scoring.d.ts +0 -37
  309. package/out/tools/nppes/scoring.d.ts.map +0 -1
  310. package/out/tools/nppes/scoring.js +0 -81
  311. package/out/tools/nppes/scoring.js.map +0 -1
  312. package/out/tools/nppes/settings.d.ts +0 -41
  313. package/out/tools/nppes/settings.d.ts.map +0 -1
  314. package/out/tools/nppes/settings.js +0 -79
  315. package/out/tools/nppes/settings.js.map +0 -1
  316. package/out/tools/nppes/truth-grains.d.ts +0 -63
  317. package/out/tools/nppes/truth-grains.d.ts.map +0 -1
  318. package/out/tools/nppes/truth-grains.js +0 -142
  319. package/out/tools/nppes/truth-grains.js.map +0 -1
  320. package/out/tools/shared.d.ts +0 -325
  321. package/out/tools/shared.d.ts.map +0 -1
  322. package/out/tools/shared.js +0 -453
  323. package/out/tools/shared.js.map +0 -1
  324. package/out/tools/train/cross-gbt.d.ts +0 -89
  325. package/out/tools/train/cross-gbt.d.ts.map +0 -1
  326. package/out/tools/train/cross-gbt.js +0 -132
  327. package/out/tools/train/cross-gbt.js.map +0 -1
  328. package/out/tools/train/gbt.d.ts +0 -85
  329. package/out/tools/train/gbt.d.ts.map +0 -1
  330. package/out/tools/train/gbt.js +0 -155
  331. package/out/tools/train/gbt.js.map +0 -1
  332. package/out/tools/train/org-cross-gbt.d.ts +0 -85
  333. package/out/tools/train/org-cross-gbt.d.ts.map +0 -1
  334. package/out/tools/train/org-cross-gbt.js +0 -122
  335. package/out/tools/train/org-cross-gbt.js.map +0 -1
  336. package/out/tools/txhhsc-to-oarow.d.ts +0 -42
  337. package/out/tools/txhhsc-to-oarow.d.ts.map +0 -1
  338. package/out/tools/txhhsc-to-oarow.js +0 -78
  339. package/out/tools/txhhsc-to-oarow.js.map +0 -1
  340. package/out/tools/viz/browser.d.ts +0 -31
  341. package/out/tools/viz/browser.d.ts.map +0 -1
  342. package/out/tools/viz/browser.js +0 -26
  343. package/out/tools/viz/browser.js.map +0 -1
  344. package/out/tools/viz/cross-dataset-map.d.ts +0 -39
  345. package/out/tools/viz/cross-dataset-map.d.ts.map +0 -1
  346. package/out/tools/viz/cross-dataset-map.js +0 -84
  347. package/out/tools/viz/cross-dataset-map.js.map +0 -1
  348. package/out/tools/viz/geocode-first-surface.d.ts +0 -36
  349. package/out/tools/viz/geocode-first-surface.d.ts.map +0 -1
  350. package/out/tools/viz/geocode-first-surface.js +0 -234
  351. package/out/tools/viz/geocode-first-surface.js.map +0 -1
  352. package/out/tools/viz/render/map.d.ts +0 -42
  353. package/out/tools/viz/render/map.d.ts.map +0 -1
  354. package/out/tools/viz/render/map.js +0 -40
  355. package/out/tools/viz/render/map.js.map +0 -1
  356. package/out/tools/viz/render.d.ts +0 -46
  357. package/out/tools/viz/render.d.ts.map +0 -1
  358. package/out/tools/viz/render.js +0 -49
  359. package/out/tools/viz/render.js.map +0 -1
  360. package/out/tools/viz/source-provenance-map.d.ts +0 -57
  361. package/out/tools/viz/source-provenance-map.d.ts.map +0 -1
  362. package/out/tools/viz/source-provenance-map.js +0 -82
  363. package/out/tools/viz/source-provenance-map.js.map +0 -1
  364. package/out/tools/viz/yardstick-figure.d.ts +0 -22
  365. package/out/tools/viz/yardstick-figure.d.ts.map +0 -1
  366. package/out/tools/viz/yardstick-figure.js +0 -106
  367. package/out/tools/viz/yardstick-figure.js.map +0 -1
  368. package/tools/coverage-reconciliation.ts +0 -192
  369. package/tools/cross/dataset-correlation.ts +0 -380
  370. package/tools/cross/source-threshold-sweep.ts +0 -416
  371. package/tools/dedup-ceiling.ts +0 -225
  372. package/tools/eval-geocoder.ts +0 -77
  373. package/tools/geocoder/namesake-probe.ts +0 -91
  374. package/tools/geocoder/vs-provided-coords.ts +0 -232
  375. package/tools/gold-set-sample.ts +0 -147
  376. package/tools/learned/scorer/clustering-eval.ts +0 -349
  377. package/tools/learned/scorer/crossstate-eval.ts +0 -280
  378. package/tools/learned/scorer/eval.ts +0 -429
  379. package/tools/matcher-scale.ts +0 -185
  380. package/tools/nppes/dedup-benchmark.ts +0 -364
  381. package/tools/nppes/org-name.ts +0 -15
  382. package/tools/nppes/overmerge-packet.ts +0 -98
  383. package/tools/nppes/report.ts +0 -380
  384. package/tools/nppes/sample.ts +0 -250
  385. package/tools/nppes/scoring.ts +0 -115
  386. package/tools/nppes/settings.ts +0 -102
  387. package/tools/nppes/truth-grains.ts +0 -185
  388. package/tools/shared.ts +0 -743
  389. package/tools/train/cross-gbt.ts +0 -214
  390. package/tools/train/gbt.ts +0 -261
  391. package/tools/train/org-cross-gbt.ts +0 -189
  392. package/tools/txhhsc-to-oarow.ts +0 -118
  393. package/tools/viz/browser.ts +0 -41
  394. package/tools/viz/cross-dataset-map.ts +0 -133
  395. package/tools/viz/geocode-first-surface.ts +0 -305
  396. package/tools/viz/render/map.ts +0 -61
  397. package/tools/viz/render.ts +0 -103
  398. package/tools/viz/source-provenance-map.ts +0 -154
  399. package/tools/viz/yardstick-figure.ts +0 -197
@@ -0,0 +1,48 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * The strict alpha-2 country-code predicate over the `iso3166-1-alpha2-membership` bitset.
6
+ *
7
+ * An import of it retains that 85-byte bitset and the reader, and no name, airport or record.
8
+ */
9
+
10
+ import { iso31661Alpha2MembershipArtifact } from "#artifacts/iso3166-1/alpha2-membership"
11
+ import { type Parsed, ParseFailure, shapeFailure } from "#errors"
12
+ import { encode2 } from "#key"
13
+ import { Artifact } from "#rgy1/reader"
14
+ import { BitsetView } from "#rgy1/views"
15
+ import type { ISO } from "#types"
16
+
17
+ let bitset: BitsetView | null = null
18
+
19
+ function membership(): BitsetView {
20
+ bitset ??= BitsetView.of(Artifact.parse(iso31661Alpha2MembershipArtifact()))
21
+
22
+ return bitset
23
+ }
24
+
25
+ /**
26
+ * Whether `input` is an officially assigned alpha-2 code in its canonical spelling, in the built profile.
27
+ *
28
+ * `GB` is one.
29
+ * `gb`, ` GB` and `GBR` are not.
30
+ *
31
+ * `canonicalSpelling` is the step that accepts the case or the whitespace.
32
+ */
33
+ export function isCountryCodeAlpha2(input: string): input is ISO.CountryCode_3166_1_Alpha2 {
34
+ return membership().test(encode2(input))
35
+ }
36
+
37
+ /**
38
+ * The branded alpha-2 code, or the reason the input was refused.
39
+ */
40
+ export function parseCountryCodeAlpha2(input: string): Parsed<ISO.CountryCode_3166_1_Alpha2> {
41
+ const shape = shapeFailure(input, 2, true)
42
+
43
+ if (shape) return { ok: false, reason: shape, input }
44
+
45
+ if (!isCountryCodeAlpha2(input)) return { ok: false, reason: ParseFailure.NotFound, input }
46
+
47
+ return { ok: true, value: input }
48
+ }
@@ -0,0 +1,51 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * The strict alpha-3 country-code predicate over the `iso3166-1-alpha3-membership` bitset.
6
+ *
7
+ * An import of it retains that 2,197-byte bitset and the reader, and no name, airport or record.
8
+ */
9
+
10
+ import { iso31661Alpha3MembershipArtifact } from "#artifacts/iso3166-1/alpha3-membership"
11
+ import { type Parsed, ParseFailure, shapeFailure } from "#errors"
12
+ import { encode3 } from "#key"
13
+ import { Artifact } from "#rgy1/reader"
14
+ import { BitsetView } from "#rgy1/views"
15
+ import type { ISO } from "#types"
16
+
17
+ let bitset: BitsetView | null = null
18
+
19
+ /**
20
+ * Returns the alpha-3 membership bitset, parsing the artifact on first use.
21
+ */
22
+ export function alpha3Membership(): BitsetView {
23
+ bitset ??= BitsetView.of(Artifact.parse(iso31661Alpha3MembershipArtifact()))
24
+
25
+ return bitset
26
+ }
27
+
28
+ /**
29
+ * Whether `input` is an officially assigned alpha-3 code in its canonical spelling, in the built profile.
30
+ *
31
+ * `AUS` is one.
32
+ * `aus` and `AU` are not.
33
+ *
34
+ * A former code such as `DDR` isn't: the records artifact still describes it.
35
+ */
36
+ export function isCountryCodeAlpha3(input: string): input is ISO.CountryCode_3166_1_Alpha3 {
37
+ return alpha3Membership().test(encode3(input))
38
+ }
39
+
40
+ /**
41
+ * The branded alpha-3 code, or the reason the input was refused.
42
+ */
43
+ export function parseCountryCodeAlpha3(input: string): Parsed<ISO.CountryCode_3166_1_Alpha3> {
44
+ const shape = shapeFailure(input, 3, true)
45
+
46
+ if (shape) return { ok: false, reason: shape, input }
47
+
48
+ if (!isCountryCodeAlpha3(input)) return { ok: false, reason: ParseFailure.NotFound, input }
49
+
50
+ return { ok: true, value: input }
51
+ }
@@ -0,0 +1,150 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * Country record retrieval over the `iso3166-1-records` artifact: three id tables,
6
+ * six columns and a string pool.
7
+ *
8
+ * A record is materialized on request and cached by row, so a repeated read
9
+ * of one country returns one object.
10
+ * The artifact holds every status; `getCountry*` answers a record of any status and reports it,
11
+ * while the brands and the membership predicates cover officially assigned codes only.
12
+ */
13
+
14
+ import { iso31661RecordsArtifact } from "#artifacts/iso3166-1/records"
15
+ import {
16
+ ARITY_NUMERIC,
17
+ CODE_LENGTH_2,
18
+ CODE_LENGTH_3,
19
+ decode2,
20
+ decode3,
21
+ decodeNumeric,
22
+ encode2,
23
+ encode3,
24
+ encodeNumeric,
25
+ } from "#key"
26
+ import { Artifact } from "#rgy1/reader"
27
+ import { ColumnView, IDTableView, StringPoolView } from "#rgy1/views"
28
+ import { type CountryRecord, CountryStatus } from "#types"
29
+
30
+ interface Tables {
31
+ artifact: Artifact
32
+ alpha2: IDTableView
33
+ alpha3: IDTableView
34
+ numeric: IDTableView
35
+ columns: {
36
+ alpha2Key: ColumnView
37
+ alpha3Key: ColumnView
38
+ numeric: ColumnView
39
+ status: ColumnView
40
+ name: ColumnView
41
+ entityID: ColumnView
42
+ }
43
+ pool: StringPoolView
44
+ records: Array<CountryRecord | undefined>
45
+ }
46
+
47
+ let tables: Tables | null = null
48
+
49
+ /**
50
+ * The column order the compiler writes.
51
+ * `header.columns` states the same order.
52
+ */
53
+ const COLUMN = {
54
+ alpha2Key: 0,
55
+ alpha3Key: 1,
56
+ numeric: 2,
57
+ status: 3,
58
+ name: 4,
59
+ entityID: 5,
60
+ } as const
61
+
62
+ function openCountryTables(): Tables {
63
+ if (tables) return tables
64
+
65
+ const artifact = Artifact.parse(iso31661RecordsArtifact())
66
+
67
+ tables = {
68
+ artifact,
69
+ alpha2: IDTableView.of(artifact, CODE_LENGTH_2),
70
+ alpha3: IDTableView.of(artifact, CODE_LENGTH_3),
71
+ numeric: IDTableView.of(artifact, ARITY_NUMERIC),
72
+ columns: {
73
+ alpha2Key: ColumnView.of(artifact, COLUMN.alpha2Key),
74
+ alpha3Key: ColumnView.of(artifact, COLUMN.alpha3Key),
75
+ numeric: ColumnView.of(artifact, COLUMN.numeric),
76
+ status: ColumnView.of(artifact, COLUMN.status),
77
+ name: ColumnView.of(artifact, COLUMN.name),
78
+ entityID: ColumnView.of(artifact, COLUMN.entityID),
79
+ },
80
+ pool: StringPoolView.of(artifact),
81
+ records: new Array<CountryRecord | undefined>(artifact.header.rows ?? 0),
82
+ }
83
+
84
+ return tables
85
+ }
86
+
87
+ const STATUSES: readonly CountryStatus[] = [CountryStatus.OfficiallyAssigned, CountryStatus.FormerlyUsed]
88
+
89
+ /**
90
+ * The record at `row`, materialized once.
91
+ */
92
+ export function countryRecordAt(row: number): CountryRecord | null {
93
+ const tables_ = openCountryTables()
94
+
95
+ if (row < 0 || row >= tables_.records.length) return null
96
+
97
+ let record = tables_.records[row]
98
+
99
+ if (!record) {
100
+ const { columns, pool } = tables_
101
+
102
+ record = Object.freeze({
103
+ entityID: pool.get(columns.entityID.integer(row)) ?? "",
104
+ alpha2: decode2(columns.alpha2Key.integer(row)),
105
+ alpha3: decode3(columns.alpha3Key.integer(row)),
106
+ numeric: decodeNumeric(columns.numeric.integer(row)),
107
+ name: pool.get(columns.name.integer(row)) ?? "",
108
+ status: STATUSES[columns.status.integer(row)] ?? CountryStatus.FormerlyUsed,
109
+ })
110
+
111
+ tables_.records[row] = record
112
+ }
113
+
114
+ return record
115
+ }
116
+
117
+ /**
118
+ * The country holding an alpha-2 code in its canonical spelling, of any status, or `null`.
119
+ */
120
+ export function getCountryByAlpha2(code: string): CountryRecord | null {
121
+ return countryRecordAt(openCountryTables().alpha2.get(encode2(code)))
122
+ }
123
+
124
+ /**
125
+ * The country holding an alpha-3 code in its canonical spelling, of any status, or `null`.
126
+ */
127
+ export function getCountryByAlpha3(code: string): CountryRecord | null {
128
+ return countryRecordAt(openCountryTables().alpha3.get(encode3(code)))
129
+ }
130
+
131
+ /**
132
+ * The country holding a three-digit numeric code, of any status, or `null`.
133
+ */
134
+ export function getCountryByNumeric(code: string): CountryRecord | null {
135
+ return countryRecordAt(openCountryTables().numeric.get(encodeNumeric(code)))
136
+ }
137
+
138
+ /**
139
+ * The number of country records of every status.
140
+ */
141
+ export function countryRecordCount(): number {
142
+ return openCountryTables().records.length
143
+ }
144
+
145
+ /**
146
+ * The records artifact's header: profile, sources and coverage.
147
+ */
148
+ export function countryRecordsHeader(): Artifact["header"] {
149
+ return openCountryTables().artifact.header
150
+ }
@@ -0,0 +1,30 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * The code-equivalence relations of one country entity: alpha-2, alpha-3
6
+ * and numeric codes of the same record.
7
+ */
8
+
9
+ import { getCountryByAlpha2, getCountryByAlpha3, getCountryByNumeric } from "#iso3166/records"
10
+
11
+ /**
12
+ * The alpha-3 code of the entity an alpha-2 code identifies, or `null`.
13
+ */
14
+ export function alpha3ForAlpha2(alpha2: string): string | null {
15
+ return getCountryByAlpha2(alpha2)?.alpha3 ?? null
16
+ }
17
+
18
+ /**
19
+ * The alpha-2 code of the entity an alpha-3 code identifies, or `null`.
20
+ */
21
+ export function alpha2ForAlpha3(alpha3: string): string | null {
22
+ return getCountryByAlpha3(alpha3)?.alpha2 ?? null
23
+ }
24
+
25
+ /**
26
+ * The alpha-2 code of the entity a numeric code identifies, or `null`.
27
+ */
28
+ export function alpha2ForNumeric(numeric: string): string | null {
29
+ return getCountryByNumeric(numeric)?.alpha2 ?? null
30
+ }
package/lib/key.ts ADDED
@@ -0,0 +1,148 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * Key encodings: the position of a code in its direct-address key space,
6
+ * mirroring `crates/registry-core/src/key.rs`.
7
+ *
8
+ * Two or three upper-case ASCII letters encode base-26 with the first letter in the highest place.
9
+ * A three-digit numeric code encodes as its decimal value.
10
+ *
11
+ * Every encoder checks length and alphabet first and answers `-1` for anything else.
12
+ * A caller normalizes case or whitespace before calling, never here.
13
+ */
14
+
15
+ /**
16
+ * The number of two-letter keys, 26².
17
+ */
18
+ export const KEY_SPACE_2 = 676
19
+
20
+ /**
21
+ * The number of three-letter keys, 26³.
22
+ */
23
+ export const KEY_SPACE_3 = 17_576
24
+
25
+ /**
26
+ * The number of three-digit numeric keys.
27
+ */
28
+ export const KEY_SPACE_NUMERIC = 1000
29
+
30
+ /**
31
+ * The arity value a section's `aux` field holds for a numeric key space.
32
+ */
33
+ export const ARITY_NUMERIC = 0
34
+
35
+ /**
36
+ * The value an encoder answers for a code outside its grammar.
37
+ */
38
+ export const NO_KEY = -1
39
+
40
+ /**
41
+ * The length of a two-letter code.
42
+ */
43
+ export const CODE_LENGTH_2 = 2
44
+
45
+ /**
46
+ * The length of a three-letter or three-digit code.
47
+ */
48
+ export const CODE_LENGTH_3 = 3
49
+
50
+ const LETTERS = 26
51
+ const A = 65
52
+ const Z = 90
53
+ const ZERO = 48
54
+ const NINE = 57
55
+ const DECIMAL = 10
56
+
57
+ function isUpperLetter(charCode: number): boolean {
58
+ return charCode >= A && charCode <= Z
59
+ }
60
+
61
+ /**
62
+ * Encodes two upper-case ASCII letters, or answers {@link NO_KEY}.
63
+ */
64
+ export function encode2(code: string): number {
65
+ if (code.length !== CODE_LENGTH_2) return NO_KEY
66
+
67
+ const a = code.charCodeAt(0)
68
+ const b = code.charCodeAt(1)
69
+
70
+ if (!isUpperLetter(a) || !isUpperLetter(b)) return NO_KEY
71
+
72
+ return (a - A) * LETTERS + (b - A)
73
+ }
74
+
75
+ /**
76
+ * Encodes three upper-case ASCII letters, or answers {@link NO_KEY}.
77
+ */
78
+ export function encode3(code: string): number {
79
+ if (code.length !== CODE_LENGTH_3) return NO_KEY
80
+
81
+ const a = code.charCodeAt(0)
82
+ const b = code.charCodeAt(1)
83
+ const c = code.charCodeAt(2)
84
+
85
+ if (!isUpperLetter(a) || !isUpperLetter(b) || !isUpperLetter(c)) return NO_KEY
86
+
87
+ return ((a - A) * LETTERS + (b - A)) * LETTERS + (c - A)
88
+ }
89
+
90
+ /**
91
+ * Encodes three ASCII digits, keeping a leading zero's position, or answers {@link NO_KEY}.
92
+ */
93
+ export function encodeNumeric(code: string): number {
94
+ if (code.length !== CODE_LENGTH_3) return NO_KEY
95
+
96
+ let value = 0
97
+
98
+ for (let index = 0; index < CODE_LENGTH_3; index++) {
99
+ const digit = code.charCodeAt(index)
100
+
101
+ if (digit < ZERO || digit > NINE) return NO_KEY
102
+
103
+ value = value * DECIMAL + (digit - ZERO)
104
+ }
105
+
106
+ return value
107
+ }
108
+
109
+ /**
110
+ * Encodes a code for the arity a section declares.
111
+ */
112
+ export function encodeForArity(arity: number, code: string): number {
113
+ switch (arity) {
114
+ case ARITY_NUMERIC:
115
+ return encodeNumeric(code)
116
+ case CODE_LENGTH_2:
117
+ return encode2(code)
118
+ case CODE_LENGTH_3:
119
+ return encode3(code)
120
+ default:
121
+ return NO_KEY
122
+ }
123
+ }
124
+
125
+ /**
126
+ * The three letters of a three-letter key.
127
+ */
128
+ export function decode3(key: number): string {
129
+ return String.fromCharCode(
130
+ A + Math.floor(key / KEY_SPACE_2),
131
+ A + (Math.floor(key / LETTERS) % LETTERS),
132
+ A + (key % LETTERS)
133
+ )
134
+ }
135
+
136
+ /**
137
+ * The two letters of a two-letter key.
138
+ */
139
+ export function decode2(key: number): string {
140
+ return String.fromCharCode(A + Math.floor(key / LETTERS), A + (key % LETTERS))
141
+ }
142
+
143
+ /**
144
+ * The three digits of a numeric key, with its leading zeroes.
145
+ */
146
+ export function decodeNumeric(key: number): string {
147
+ return String(key).padStart(CODE_LENGTH_3, "0")
148
+ }
@@ -0,0 +1,35 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * Explicit input normalization, separate from the strict predicates.
6
+ *
7
+ * `canonicalSpelling` trims ASCII whitespace and upper-cases ASCII letters.
8
+ * It reports each change.
9
+ *
10
+ * A caller who wants `" aus "` to reach `AUS` asks for that step.
11
+ * Every other character stays as written.
12
+ *
13
+ * A dot, a dash or a non-ASCII letter reaches the strict predicate unchanged
14
+ * and is refused there with `shape`.
15
+ * Free-text tokenization belongs to Mailwoman, outside this package.
16
+ */
17
+
18
+ /**
19
+ * What {@link canonicalSpelling} changed.
20
+ */
21
+ export interface Normalization {
22
+ value: string
23
+ trimmed: boolean
24
+ uppercased: boolean
25
+ }
26
+
27
+ /**
28
+ * Trims ASCII whitespace and upper-cases ASCII letters, reporting each change.
29
+ */
30
+ export function canonicalSpelling(input: string): Normalization {
31
+ const trimmedValue = input.replaceAll(/^[ \t\r\n]+|[ \t\r\n]+$/g, "")
32
+ const value = trimmedValue.replaceAll(/[a-z]+/g, (run) => run.toUpperCase())
33
+
34
+ return { value, trimmed: trimmedValue !== input, uppercased: value !== trimmedValue }
35
+ }
@@ -0,0 +1,110 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * The country/airport collision index: codes that are both an officially assigned
6
+ * ISO 3166-1 alpha-3 code and an IATA airport code in the profile.
7
+ *
8
+ * `isCountryAirportCollision` reads only the 2,197-byte collision bitset.
9
+ * `interpretCountryOrAirportCode` reads the records artifacts and answers every
10
+ * interpretation as a discriminated union, each branch with its own brand and entity,
11
+ * so `AUS` is Australia under one namespace and an airport in the United States under another.
12
+ *
13
+ * The two relations are separate: `same-spelling-as` is the collision,
14
+ * `located-in` is each branch's `country`.
15
+ * The caller ranks the interpretations, and the resolver in Mailwoman does it.
16
+ */
17
+
18
+ import { countryAirportCollisionArtifact } from "#artifacts/country-airport-collision"
19
+ import { airportRowByIATA, getAirportByIATA } from "#iata/airports/records"
20
+ import { getCountryByAlpha3 } from "#iso3166/records"
21
+ import { encode3 } from "#key"
22
+ import { Artifact } from "#rgy1/reader"
23
+ import { BitsetView } from "#rgy1/views"
24
+ import { type AirportCountryStatus, CountryStatus, type IATA, type ISO } from "#types"
25
+
26
+ let bitset: BitsetView | null = null
27
+
28
+ /**
29
+ * Returns the collision bitset, parsing the artifact on first use.
30
+ */
31
+ export function collisionMembership(): BitsetView {
32
+ bitset ??= BitsetView.of(Artifact.parse(countryAirportCollisionArtifact()))
33
+
34
+ return bitset
35
+ }
36
+
37
+ /**
38
+ * Whether a three-letter code in its canonical spelling is both a current country code and an airport code.
39
+ */
40
+ export function isCountryAirportCollision(input: string): boolean {
41
+ return collisionMembership().test(encode3(input))
42
+ }
43
+
44
+ /**
45
+ * One interpretation of a three-letter spelling.
46
+ */
47
+ export type CodeMatch =
48
+ | {
49
+ system: "iso3166-1-alpha3"
50
+ code: ISO.CountryCode_3166_1_Alpha3
51
+ /**
52
+ * The alpha-2 code of the same entity.
53
+ */
54
+ country: string
55
+ entityID: string
56
+ name: string
57
+ }
58
+ | {
59
+ system: "iata-location"
60
+ code: IATA.AirportCode
61
+ kind: "airport"
62
+ /**
63
+ * The alpha-2 code the source places the airport in, or null for an extension or an unstated country.
64
+ */
65
+ country: string | null
66
+ countryStatus: AirportCountryStatus
67
+ entityID: string
68
+ name: string
69
+ }
70
+
71
+ /**
72
+ * Every namespace that holds the spelling, in namespace order: country first, then airport.
73
+ *
74
+ * The order is the namespace list's and isn't a ranking.
75
+ * An empty array is `not-found-in-snapshot` in every namespace, and a former country code
76
+ * isn't an interpretation here because the current-assignment brand leaves it out.
77
+ */
78
+ export function interpretCountryOrAirportCode(input: string): CodeMatch[] {
79
+ const matches: CodeMatch[] = []
80
+
81
+ if (encode3(input) < 0) return matches
82
+
83
+ const country = getCountryByAlpha3(input)
84
+
85
+ if (country && country.status === CountryStatus.OfficiallyAssigned) {
86
+ matches.push({
87
+ system: "iso3166-1-alpha3",
88
+ code: input as ISO.CountryCode_3166_1_Alpha3,
89
+ country: country.alpha2,
90
+ entityID: country.entityID,
91
+ name: country.name,
92
+ })
93
+ }
94
+
95
+ if (airportRowByIATA(input) >= 0) {
96
+ const airport = getAirportByIATA(input)!
97
+
98
+ matches.push({
99
+ system: "iata-location",
100
+ code: airport.iata,
101
+ kind: "airport",
102
+ country: airport.countryStatus === "iso3166-1" ? airport.country : null,
103
+ countryStatus: airport.countryStatus,
104
+ entityID: airport.entityID,
105
+ name: airport.name,
106
+ })
107
+ }
108
+
109
+ return matches
110
+ }
@@ -0,0 +1,23 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * Decodes a generated artifact module's base64 text into bytes, on the platforms the readers run on.
6
+ */
7
+
8
+ /**
9
+ * Decodes standard base64 into a fresh `Uint8Array`.
10
+ *
11
+ * `atob` is a global in Node 16 and later and in every browser, so the decoder
12
+ * needs no `Buffer` and no `node:` import.
13
+ */
14
+ export function decodeBase64(text: string): Uint8Array {
15
+ const binary = atob(text)
16
+ const bytes = new Uint8Array(binary.length)
17
+
18
+ for (let index = 0; index < binary.length; index++) {
19
+ bytes[index] = binary.charCodeAt(index)
20
+ }
21
+
22
+ return bytes
23
+ }