@mailwoman/registry 10.8.0 → 11.0.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.
- package/README.md +93 -98
- package/data/manifests/artifacts.json +32 -0
- package/data/manifests/coverage.json +56 -0
- package/data/manifests/sources.lock.json +48 -0
- package/data/normalized/iata-airports.json +126749 -0
- package/data/normalized/iso3166-1.json +2035 -0
- package/definitions/namespaces.json +63 -0
- package/definitions/sections.json +73 -0
- package/docs/data-policy.md +81 -0
- package/docs/performance.md +146 -0
- package/docs/rgy1.md +144 -0
- package/lib/artifacts/country-airport-collision.ts +26 -0
- package/lib/artifacts/iata-airport/membership.ts +26 -0
- package/lib/artifacts/iata-airport/records.ts +26 -0
- package/lib/artifacts/iso3166-1/alpha2-membership.ts +26 -0
- package/lib/artifacts/iso3166-1/alpha3-membership.ts +26 -0
- package/lib/artifacts/iso3166-1/records.ts +26 -0
- package/lib/errors.ts +44 -0
- package/lib/iata/airports/records.ts +174 -0
- package/lib/iata/airports/validate.ts +49 -0
- package/lib/index.ts +25 -15
- package/lib/inspect.ts +56 -0
- package/lib/iso3166/alpha2.ts +48 -0
- package/lib/iso3166/alpha3.ts +51 -0
- package/lib/iso3166/records.ts +149 -0
- package/lib/iso3166/relations.ts +30 -0
- package/lib/key.ts +146 -0
- package/lib/normalize.ts +31 -0
- package/lib/overlap/country-airport.ts +108 -0
- package/lib/rgy1/base64.ts +24 -0
- package/lib/rgy1/reader.ts +316 -0
- package/lib/rgy1/sections.generated.ts +79 -0
- package/lib/rgy1/views.ts +267 -0
- package/lib/types.ts +88 -74
- package/lib/wasm.ts +285 -0
- package/out/artifacts/country-airport-collision.d.ts +15 -0
- package/out/artifacts/country-airport-collision.d.ts.map +1 -0
- package/out/artifacts/country-airport-collision.js +21 -0
- package/out/artifacts/country-airport-collision.js.map +1 -0
- package/out/artifacts/iata-airport/membership.d.ts +15 -0
- package/out/artifacts/iata-airport/membership.d.ts.map +1 -0
- package/out/artifacts/iata-airport/membership.js +21 -0
- package/out/artifacts/iata-airport/membership.js.map +1 -0
- package/out/artifacts/iata-airport/records.d.ts +15 -0
- package/out/artifacts/iata-airport/records.d.ts.map +1 -0
- package/out/artifacts/iata-airport/records.js +21 -0
- package/out/artifacts/iata-airport/records.js.map +1 -0
- package/out/artifacts/iso3166-1/alpha2-membership.d.ts +15 -0
- package/out/artifacts/iso3166-1/alpha2-membership.d.ts.map +1 -0
- package/out/artifacts/iso3166-1/alpha2-membership.js +21 -0
- package/out/artifacts/iso3166-1/alpha2-membership.js.map +1 -0
- package/out/artifacts/iso3166-1/alpha3-membership.d.ts +15 -0
- package/out/artifacts/iso3166-1/alpha3-membership.d.ts.map +1 -0
- package/out/artifacts/iso3166-1/alpha3-membership.js +21 -0
- package/out/artifacts/iso3166-1/alpha3-membership.js.map +1 -0
- package/out/artifacts/iso3166-1/records.d.ts +15 -0
- package/out/artifacts/iso3166-1/records.d.ts.map +1 -0
- package/out/artifacts/iso3166-1/records.js +21 -0
- package/out/artifacts/iso3166-1/records.js.map +1 -0
- package/out/errors.d.ts +38 -0
- package/out/errors.d.ts.map +1 -0
- package/out/errors.js +35 -0
- package/out/errors.js.map +1 -0
- package/out/iata/airports/records.d.ts +44 -0
- package/out/iata/airports/records.d.ts.map +1 -0
- package/out/iata/airports/records.js +137 -0
- package/out/iata/airports/records.js.map +1 -0
- package/out/iata/airports/validate.d.ts +27 -0
- package/out/iata/airports/validate.d.ts.map +1 -0
- package/out/iata/airports/validate.js +42 -0
- package/out/iata/airports/validate.js.map +1 -0
- package/out/index.d.ts +19 -15
- package/out/index.d.ts.map +1 -1
- package/out/index.js +14 -15
- package/out/index.js.map +1 -1
- package/out/inspect.d.ts +38 -0
- package/out/inspect.d.ts.map +1 -0
- package/out/inspect.js +33 -0
- package/out/inspect.js.map +1 -0
- package/out/iso3166/alpha2.d.ts +24 -0
- package/out/iso3166/alpha2.d.ts.map +1 -0
- package/out/iso3166/alpha2.js +41 -0
- package/out/iso3166/alpha2.js.map +1 -0
- package/out/iso3166/alpha3.d.ts +29 -0
- package/out/iso3166/alpha3.d.ts.map +1 -0
- package/out/iso3166/alpha3.js +44 -0
- package/out/iso3166/alpha3.js.map +1 -0
- package/out/iso3166/records.d.ts +38 -0
- package/out/iso3166/records.d.ts.map +1 -0
- package/out/iso3166/records.js +105 -0
- package/out/iso3166/records.js.map +1 -0
- package/out/iso3166/relations.d.ts +20 -0
- package/out/iso3166/relations.d.ts.map +1 -0
- package/out/iso3166/relations.js +27 -0
- package/out/iso3166/relations.js.map +1 -0
- package/out/key.d.ts +68 -0
- package/out/key.d.ts.map +1 -0
- package/out/key.js +122 -0
- package/out/key.js.map +1 -0
- package/out/normalize.d.ts +25 -0
- package/out/normalize.d.ts.map +1 -0
- package/out/normalize.js +21 -0
- package/out/normalize.js.map +1 -0
- package/out/overlap/country-airport.d.ts +57 -0
- package/out/overlap/country-airport.d.ts.map +1 -0
- package/out/overlap/country-airport.js +71 -0
- package/out/overlap/country-airport.js.map +1 -0
- package/out/rgy1/base64.d.ts +15 -0
- package/out/rgy1/base64.d.ts.map +1 -0
- package/out/rgy1/base64.js +22 -0
- package/out/rgy1/base64.js.map +1 -0
- package/out/rgy1/reader.d.ts +103 -0
- package/out/rgy1/reader.d.ts.map +1 -0
- package/out/rgy1/reader.js +230 -0
- package/out/rgy1/reader.js.map +1 -0
- package/out/rgy1/sections.generated.d.ts +54 -0
- package/out/rgy1/sections.generated.d.ts.map +1 -0
- package/out/rgy1/sections.generated.js +69 -0
- package/out/rgy1/sections.generated.js.map +1 -0
- package/out/rgy1/views.d.ts +96 -0
- package/out/rgy1/views.d.ts.map +1 -0
- package/out/rgy1/views.js +218 -0
- package/out/rgy1/views.js.map +1 -0
- package/out/sdk/fetch.d.ts +53 -0
- package/out/sdk/fetch.d.ts.map +1 -0
- package/out/sdk/fetch.js +107 -0
- package/out/sdk/fetch.js.map +1 -0
- package/out/sdk/fetch.run.d.ts +14 -0
- package/out/sdk/fetch.run.d.ts.map +1 -0
- package/out/sdk/fetch.run.js +20 -0
- package/out/sdk/fetch.run.js.map +1 -0
- package/out/sdk/sources.d.ts +111 -0
- package/out/sdk/sources.d.ts.map +1 -0
- package/out/sdk/sources.js +98 -0
- package/out/sdk/sources.js.map +1 -0
- package/out/tools/artifact-path.d.ts +10 -0
- package/out/tools/artifact-path.d.ts.map +1 -0
- package/out/tools/artifact-path.js +12 -0
- package/out/tools/artifact-path.js.map +1 -0
- package/out/tools/bench.run.d.ts +19 -0
- package/out/tools/bench.run.d.ts.map +1 -0
- package/out/tools/bench.run.js +204 -0
- package/out/tools/bench.run.js.map +1 -0
- package/out/tools/build-wasm.run.d.ts +18 -0
- package/out/tools/build-wasm.run.d.ts.map +1 -0
- package/out/tools/build-wasm.run.js +71 -0
- package/out/tools/build-wasm.run.js.map +1 -0
- package/out/tools/generate-sections.run.d.ts +13 -0
- package/out/tools/generate-sections.run.d.ts.map +1 -0
- package/out/tools/generate-sections.run.js +136 -0
- package/out/tools/generate-sections.run.js.map +1 -0
- package/out/tools/generate.run.d.ts +18 -0
- package/out/tools/generate.run.d.ts.map +1 -0
- package/out/tools/generate.run.js +118 -0
- package/out/tools/generate.run.js.map +1 -0
- package/out/tools/normalize.d.ts +155 -0
- package/out/tools/normalize.d.ts.map +1 -0
- package/out/tools/normalize.js +303 -0
- package/out/tools/normalize.js.map +1 -0
- package/out/tools/normalize.run.d.ts +14 -0
- package/out/tools/normalize.run.d.ts.map +1 -0
- package/out/tools/normalize.run.js +29 -0
- package/out/tools/normalize.run.js.map +1 -0
- package/out/types.d.ts +90 -76
- package/out/types.d.ts.map +1 -1
- package/out/types.js +20 -4
- package/out/types.js.map +1 -1
- package/out/wasm.d.ts +98 -0
- package/out/wasm.d.ts.map +1 -0
- package/out/wasm.js +137 -0
- package/out/wasm.js.map +1 -0
- package/package.json +48 -27
- package/sdk/fetch.run.ts +24 -0
- package/sdk/fetch.ts +146 -0
- package/sdk/sources.ts +162 -0
- package/tools/artifact-path.ts +12 -0
- package/tools/bench.run.ts +265 -0
- package/tools/build-wasm.run.ts +82 -0
- package/tools/generate-sections.run.ts +152 -0
- package/tools/generate.run.ts +146 -0
- package/tools/normalize.run.ts +36 -0
- package/tools/normalize.ts +474 -0
- package/wasm/registry-simd.wasm +0 -0
- package/wasm/registry.wasm +0 -0
- package/lib/address-key.ts +0 -46
- package/lib/geocode-handler.ts +0 -37
- package/lib/geojson.ts +0 -72
- package/lib/ingest.ts +0 -349
- package/lib/learned-scorer.ts +0 -134
- package/lib/map-html.ts +0 -287
- package/lib/models/crosssource-gbt-en-us.ts +0 -43
- package/lib/models/dedup-gbt-en-us.ts +0 -47
- package/lib/models/org-crosssource-gbt-en-us.ts +0 -43
- package/lib/reconcile.ts +0 -239
- package/lib/resolve.ts +0 -569
- package/out/address-key.d.ts +0 -34
- package/out/address-key.d.ts.map +0 -1
- package/out/address-key.js +0 -41
- package/out/address-key.js.map +0 -1
- package/out/geocode-handler.d.ts +0 -20
- package/out/geocode-handler.d.ts.map +0 -1
- package/out/geocode-handler.js +0 -29
- package/out/geocode-handler.js.map +0 -1
- package/out/geojson.d.ts +0 -28
- package/out/geojson.d.ts.map +0 -1
- package/out/geojson.js +0 -62
- package/out/geojson.js.map +0 -1
- package/out/ingest.d.ts +0 -173
- package/out/ingest.d.ts.map +0 -1
- package/out/ingest.js +0 -185
- package/out/ingest.js.map +0 -1
- package/out/learned-scorer.d.ts +0 -61
- package/out/learned-scorer.d.ts.map +0 -1
- package/out/learned-scorer.js +0 -91
- package/out/learned-scorer.js.map +0 -1
- package/out/map-html.d.ts +0 -39
- package/out/map-html.d.ts.map +0 -1
- package/out/map-html.js +0 -220
- package/out/map-html.js.map +0 -1
- package/out/models/crosssource-gbt-en-us.d.ts +0 -45
- package/out/models/crosssource-gbt-en-us.d.ts.map +0 -1
- package/out/models/crosssource-gbt-en-us.js +0 -40
- package/out/models/crosssource-gbt-en-us.js.map +0 -1
- package/out/models/dedup-gbt-en-us.d.ts +0 -44
- package/out/models/dedup-gbt-en-us.d.ts.map +0 -1
- package/out/models/dedup-gbt-en-us.js +0 -44
- package/out/models/dedup-gbt-en-us.js.map +0 -1
- package/out/models/org-crosssource-gbt-en-us.d.ts +0 -45
- package/out/models/org-crosssource-gbt-en-us.d.ts.map +0 -1
- package/out/models/org-crosssource-gbt-en-us.js +0 -40
- package/out/models/org-crosssource-gbt-en-us.js.map +0 -1
- package/out/reconcile.d.ts +0 -96
- package/out/reconcile.d.ts.map +0 -1
- package/out/reconcile.js +0 -127
- package/out/reconcile.js.map +0 -1
- package/out/resolve.d.ts +0 -264
- package/out/resolve.d.ts.map +0 -1
- package/out/resolve.js +0 -282
- package/out/resolve.js.map +0 -1
- package/out/tools/coverage-reconciliation.d.ts +0 -67
- package/out/tools/coverage-reconciliation.d.ts.map +0 -1
- package/out/tools/coverage-reconciliation.js +0 -113
- package/out/tools/coverage-reconciliation.js.map +0 -1
- package/out/tools/cross/dataset-correlation.d.ts +0 -61
- package/out/tools/cross/dataset-correlation.d.ts.map +0 -1
- package/out/tools/cross/dataset-correlation.js +0 -244
- package/out/tools/cross/dataset-correlation.js.map +0 -1
- package/out/tools/cross/source-threshold-sweep.d.ts +0 -60
- package/out/tools/cross/source-threshold-sweep.d.ts.map +0 -1
- package/out/tools/cross/source-threshold-sweep.js +0 -264
- package/out/tools/cross/source-threshold-sweep.js.map +0 -1
- package/out/tools/dedup-ceiling.d.ts +0 -62
- package/out/tools/dedup-ceiling.d.ts.map +0 -1
- package/out/tools/dedup-ceiling.js +0 -171
- package/out/tools/dedup-ceiling.js.map +0 -1
- package/out/tools/eval-geocoder.d.ts +0 -68
- package/out/tools/eval-geocoder.d.ts.map +0 -1
- package/out/tools/eval-geocoder.js +0 -13
- package/out/tools/eval-geocoder.js.map +0 -1
- package/out/tools/geocoder/namesake-probe.d.ts +0 -33
- package/out/tools/geocoder/namesake-probe.d.ts.map +0 -1
- package/out/tools/geocoder/namesake-probe.js +0 -60
- package/out/tools/geocoder/namesake-probe.js.map +0 -1
- package/out/tools/geocoder/vs-provided-coords.d.ts +0 -53
- package/out/tools/geocoder/vs-provided-coords.d.ts.map +0 -1
- package/out/tools/geocoder/vs-provided-coords.js +0 -161
- package/out/tools/geocoder/vs-provided-coords.js.map +0 -1
- package/out/tools/gold-set-sample.d.ts +0 -67
- package/out/tools/gold-set-sample.d.ts.map +0 -1
- package/out/tools/gold-set-sample.js +0 -81
- package/out/tools/gold-set-sample.js.map +0 -1
- package/out/tools/learned/scorer/clustering-eval.d.ts +0 -77
- package/out/tools/learned/scorer/clustering-eval.d.ts.map +0 -1
- package/out/tools/learned/scorer/clustering-eval.js +0 -207
- package/out/tools/learned/scorer/clustering-eval.js.map +0 -1
- package/out/tools/learned/scorer/crossstate-eval.d.ts +0 -65
- package/out/tools/learned/scorer/crossstate-eval.d.ts.map +0 -1
- package/out/tools/learned/scorer/crossstate-eval.js +0 -168
- package/out/tools/learned/scorer/crossstate-eval.js.map +0 -1
- package/out/tools/learned/scorer/eval.d.ts +0 -64
- package/out/tools/learned/scorer/eval.d.ts.map +0 -1
- package/out/tools/learned/scorer/eval.js +0 -275
- package/out/tools/learned/scorer/eval.js.map +0 -1
- package/out/tools/matcher-scale.d.ts +0 -40
- package/out/tools/matcher-scale.d.ts.map +0 -1
- package/out/tools/matcher-scale.js +0 -111
- package/out/tools/matcher-scale.js.map +0 -1
- package/out/tools/nppes/dedup-benchmark.d.ts +0 -82
- package/out/tools/nppes/dedup-benchmark.d.ts.map +0 -1
- package/out/tools/nppes/dedup-benchmark.js +0 -226
- package/out/tools/nppes/dedup-benchmark.js.map +0 -1
- package/out/tools/nppes/org-name.d.ts +0 -15
- package/out/tools/nppes/org-name.d.ts.map +0 -1
- package/out/tools/nppes/org-name.js +0 -6
- package/out/tools/nppes/org-name.js.map +0 -1
- package/out/tools/nppes/overmerge-packet.d.ts +0 -43
- package/out/tools/nppes/overmerge-packet.d.ts.map +0 -1
- package/out/tools/nppes/overmerge-packet.js +0 -54
- package/out/tools/nppes/overmerge-packet.js.map +0 -1
- package/out/tools/nppes/report.d.ts +0 -97
- package/out/tools/nppes/report.d.ts.map +0 -1
- package/out/tools/nppes/report.js +0 -178
- package/out/tools/nppes/report.js.map +0 -1
- package/out/tools/nppes/sample.d.ts +0 -101
- package/out/tools/nppes/sample.d.ts.map +0 -1
- package/out/tools/nppes/sample.js +0 -127
- package/out/tools/nppes/sample.js.map +0 -1
- package/out/tools/nppes/scoring.d.ts +0 -37
- package/out/tools/nppes/scoring.d.ts.map +0 -1
- package/out/tools/nppes/scoring.js +0 -81
- package/out/tools/nppes/scoring.js.map +0 -1
- package/out/tools/nppes/settings.d.ts +0 -41
- package/out/tools/nppes/settings.d.ts.map +0 -1
- package/out/tools/nppes/settings.js +0 -79
- package/out/tools/nppes/settings.js.map +0 -1
- package/out/tools/nppes/truth-grains.d.ts +0 -63
- package/out/tools/nppes/truth-grains.d.ts.map +0 -1
- package/out/tools/nppes/truth-grains.js +0 -142
- package/out/tools/nppes/truth-grains.js.map +0 -1
- package/out/tools/shared.d.ts +0 -325
- package/out/tools/shared.d.ts.map +0 -1
- package/out/tools/shared.js +0 -453
- package/out/tools/shared.js.map +0 -1
- package/out/tools/train/cross-gbt.d.ts +0 -89
- package/out/tools/train/cross-gbt.d.ts.map +0 -1
- package/out/tools/train/cross-gbt.js +0 -132
- package/out/tools/train/cross-gbt.js.map +0 -1
- package/out/tools/train/gbt.d.ts +0 -85
- package/out/tools/train/gbt.d.ts.map +0 -1
- package/out/tools/train/gbt.js +0 -155
- package/out/tools/train/gbt.js.map +0 -1
- package/out/tools/train/org-cross-gbt.d.ts +0 -85
- package/out/tools/train/org-cross-gbt.d.ts.map +0 -1
- package/out/tools/train/org-cross-gbt.js +0 -122
- package/out/tools/train/org-cross-gbt.js.map +0 -1
- package/out/tools/txhhsc-to-oarow.d.ts +0 -42
- package/out/tools/txhhsc-to-oarow.d.ts.map +0 -1
- package/out/tools/txhhsc-to-oarow.js +0 -78
- package/out/tools/txhhsc-to-oarow.js.map +0 -1
- package/out/tools/viz/browser.d.ts +0 -31
- package/out/tools/viz/browser.d.ts.map +0 -1
- package/out/tools/viz/browser.js +0 -26
- package/out/tools/viz/browser.js.map +0 -1
- package/out/tools/viz/cross-dataset-map.d.ts +0 -39
- package/out/tools/viz/cross-dataset-map.d.ts.map +0 -1
- package/out/tools/viz/cross-dataset-map.js +0 -84
- package/out/tools/viz/cross-dataset-map.js.map +0 -1
- package/out/tools/viz/geocode-first-surface.d.ts +0 -36
- package/out/tools/viz/geocode-first-surface.d.ts.map +0 -1
- package/out/tools/viz/geocode-first-surface.js +0 -234
- package/out/tools/viz/geocode-first-surface.js.map +0 -1
- package/out/tools/viz/render/map.d.ts +0 -42
- package/out/tools/viz/render/map.d.ts.map +0 -1
- package/out/tools/viz/render/map.js +0 -40
- package/out/tools/viz/render/map.js.map +0 -1
- package/out/tools/viz/render.d.ts +0 -46
- package/out/tools/viz/render.d.ts.map +0 -1
- package/out/tools/viz/render.js +0 -49
- package/out/tools/viz/render.js.map +0 -1
- package/out/tools/viz/source-provenance-map.d.ts +0 -57
- package/out/tools/viz/source-provenance-map.d.ts.map +0 -1
- package/out/tools/viz/source-provenance-map.js +0 -82
- package/out/tools/viz/source-provenance-map.js.map +0 -1
- package/out/tools/viz/yardstick-figure.d.ts +0 -22
- package/out/tools/viz/yardstick-figure.d.ts.map +0 -1
- package/out/tools/viz/yardstick-figure.js +0 -106
- package/out/tools/viz/yardstick-figure.js.map +0 -1
- package/tools/coverage-reconciliation.ts +0 -192
- package/tools/cross/dataset-correlation.ts +0 -380
- package/tools/cross/source-threshold-sweep.ts +0 -416
- package/tools/dedup-ceiling.ts +0 -225
- package/tools/eval-geocoder.ts +0 -77
- package/tools/geocoder/namesake-probe.ts +0 -91
- package/tools/geocoder/vs-provided-coords.ts +0 -232
- package/tools/gold-set-sample.ts +0 -147
- package/tools/learned/scorer/clustering-eval.ts +0 -349
- package/tools/learned/scorer/crossstate-eval.ts +0 -280
- package/tools/learned/scorer/eval.ts +0 -429
- package/tools/matcher-scale.ts +0 -185
- package/tools/nppes/dedup-benchmark.ts +0 -364
- package/tools/nppes/org-name.ts +0 -15
- package/tools/nppes/overmerge-packet.ts +0 -98
- package/tools/nppes/report.ts +0 -380
- package/tools/nppes/sample.ts +0 -250
- package/tools/nppes/scoring.ts +0 -115
- package/tools/nppes/settings.ts +0 -102
- package/tools/nppes/truth-grains.ts +0 -185
- package/tools/shared.ts +0 -743
- package/tools/train/cross-gbt.ts +0 -214
- package/tools/train/gbt.ts +0 -261
- package/tools/train/org-cross-gbt.ts +0 -189
- package/tools/txhhsc-to-oarow.ts +0 -118
- package/tools/viz/browser.ts +0 -41
- package/tools/viz/cross-dataset-map.ts +0 -133
- package/tools/viz/geocode-first-surface.ts +0 -305
- package/tools/viz/render/map.ts +0 -61
- package/tools/viz/render.ts +0 -103
- package/tools/viz/source-provenance-map.ts +0 -154
- package/tools/viz/yardstick-figure.ts +0 -197
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Compiles the normalized data into RGY1 artifacts with `crates/registry-build`, writes each artifact as a
|
|
7
|
+
* TypeScript module under `lib/artifacts/`, and records every artifact's SHA-256 in `data/manifests/artifacts.json`.
|
|
8
|
+
*
|
|
9
|
+
* Each artifact is its own module exporting one lazily decoded getter, so a bundle that imports the collision
|
|
10
|
+
* predicate holds the collision bitset and no airport record. The fixture profile under `test/fixtures/` is compiled
|
|
11
|
+
* too, into `test/fixtures/artifacts/*.rgy1`, so the committed fixtures stay equal to the compiler's output.
|
|
12
|
+
*
|
|
13
|
+
* Usage: `node packages/registry/tools/generate.run.ts [--check]`
|
|
14
|
+
*
|
|
15
|
+
* `--check` compiles without writing and exits non-zero when a generated module or manifest differs.
|
|
16
|
+
*/
|
|
17
|
+
import { readLocalBuffer, readLocalJSONFile } from "@mailwoman/core/fs/readers";
|
|
18
|
+
import { temporaryDirectory } from "@mailwoman/core/fs/temporary";
|
|
19
|
+
import { writeLocalFile } from "@mailwoman/core/fs/writers";
|
|
20
|
+
import { sha256File } from "@mailwoman/core/hash";
|
|
21
|
+
import { prettyJSON } from "@mailwoman/core/json";
|
|
22
|
+
import { repoRootPath, workspacePath } from "@mailwoman/core/paths";
|
|
23
|
+
import { runFile } from "@mailwoman/core/process";
|
|
24
|
+
import { parseArguments } from "@mailwoman/core/scripting/arguments";
|
|
25
|
+
import { artifactModulePath } from "#tools/artifact-path";
|
|
26
|
+
const { values } = parseArguments({ options: { check: { type: "boolean", default: false } } });
|
|
27
|
+
const registry = (...segments) => workspacePath("registry", ...segments);
|
|
28
|
+
const ARTIFACTS = [
|
|
29
|
+
"iso3166-1-alpha2-membership",
|
|
30
|
+
"iso3166-1-alpha3-membership",
|
|
31
|
+
"iso3166-1-records",
|
|
32
|
+
"iata-airport-membership",
|
|
33
|
+
"iata-airport-records",
|
|
34
|
+
"country-airport-collision",
|
|
35
|
+
];
|
|
36
|
+
const camel = (name) => name.replaceAll(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(/^(\d)/, "_$1");
|
|
37
|
+
await runFile("cargo", ["build", "--release", "--locked", "-p", "registry-build"], { cwd: workspacePath("registry") });
|
|
38
|
+
const binary = repoRootPath("target", "release", "registry-build");
|
|
39
|
+
async function compileProfile(normalized, lock, out) {
|
|
40
|
+
await runFile(binary, [`${normalized}/iso3166-1.json`, `${normalized}/iata-airports.json`, lock, out]);
|
|
41
|
+
}
|
|
42
|
+
await using scratch = await temporaryDirectory("registry-generate-");
|
|
43
|
+
const openOut = scratch.path.toString();
|
|
44
|
+
const profile = await readLocalJSONFile(registry("data", "manifests", "sources.lock.json"));
|
|
45
|
+
await compileProfile(registry("data", "normalized"), registry("data", "manifests", "sources.lock.json"), openOut);
|
|
46
|
+
let stale = 0;
|
|
47
|
+
async function emit(path, content) {
|
|
48
|
+
if (values.check) {
|
|
49
|
+
const current = await readLocalBuffer(path).catch(() => null);
|
|
50
|
+
const next = typeof content === "string" ? Buffer.from(content) : Buffer.from(content);
|
|
51
|
+
if (!current || !current.equals(next)) {
|
|
52
|
+
console.error(`${path} differs from the generator's output`);
|
|
53
|
+
stale++;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
await writeLocalFile(content, path);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const manifest = {};
|
|
61
|
+
for (const name of ARTIFACTS) {
|
|
62
|
+
const built = `${openOut}/${name}.rgy1`;
|
|
63
|
+
const bytes = await readLocalBuffer(built);
|
|
64
|
+
const sha256 = await sha256File(built);
|
|
65
|
+
const getter = `${camel(name)}Artifact`;
|
|
66
|
+
manifest[name] = { sha256, bytes: bytes.byteLength, profile: profile.profile };
|
|
67
|
+
const module = `/**
|
|
68
|
+
* @copyright Sister Software
|
|
69
|
+
* @license AGPL-3.0
|
|
70
|
+
* @author Teffen Ellis, et al.
|
|
71
|
+
*
|
|
72
|
+
* The \`${name}\` artifact of the \`${profile.profile}\` profile, ${bytes.byteLength} bytes, SHA-256 ${sha256}.
|
|
73
|
+
* Generated by tools/generate.run.ts from data/normalized. Edit the data or the compiler rather than this file.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
import { decodeBase64 } from "#rgy1/base64"
|
|
77
|
+
|
|
78
|
+
const BASE64 =
|
|
79
|
+
"${bytes.toString("base64")}"
|
|
80
|
+
|
|
81
|
+
let bytes: Uint8Array | null = null
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Returns the artifact's bytes, decoded on first call and shared afterwards.
|
|
85
|
+
*
|
|
86
|
+
* Callers read the bytes and never write them.
|
|
87
|
+
*/
|
|
88
|
+
export function ${getter}(): Uint8Array {
|
|
89
|
+
bytes ??= decodeBase64(BASE64)
|
|
90
|
+
|
|
91
|
+
return bytes
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
await emit(registry("lib", "artifacts", `${artifactModulePath(name)}.ts`), module);
|
|
95
|
+
}
|
|
96
|
+
await emit(registry("data", "manifests", "artifacts.json"), prettyJSON(manifest));
|
|
97
|
+
// The fixture profile, committed as bytes so the layout test and the Rust tests read the same artifacts.
|
|
98
|
+
const fixtureOut = values.check ? `${openOut}/fixtures` : registry("test", "fixtures", "artifacts");
|
|
99
|
+
await compileProfile(registry("test", "fixtures", "normalized"), registry("test", "fixtures", "normalized", "sources.lock.json"), fixtureOut);
|
|
100
|
+
if (values.check) {
|
|
101
|
+
for (const name of ARTIFACTS) {
|
|
102
|
+
const built = await readLocalBuffer(`${fixtureOut}/${name}.rgy1`);
|
|
103
|
+
const committed = await readLocalBuffer(registry("test", "fixtures", "artifacts", `${name}.rgy1`)).catch(() => null);
|
|
104
|
+
if (!committed || !committed.equals(built)) {
|
|
105
|
+
console.error(`test/fixtures/artifacts/${name}.rgy1 differs from the compiler's output`);
|
|
106
|
+
stale++;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (stale) {
|
|
111
|
+
process.exitCode = 1;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
for (const [name, entry] of Object.entries(manifest)) {
|
|
115
|
+
console.log(`${name}\t${entry.bytes} bytes\t${entry.sha256}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=generate.run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.run.js","sourceRoot":"","sources":["../../tools/generate.run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OA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KAAK,EAAE,CAAC;IAClB,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,GAAG,UAAU,IAAI,IAAI,OAAO,CAAC,CAAA;QACjE,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;QAEpH,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,2BAA2B,IAAI,0CAA0C,CAAC,CAAA;YAExF,KAAK,EAAE,CAAA;QACR,CAAC;IACF,CAAC;AACF,CAAC;AAED,IAAI,KAAK,EAAE,CAAC;IACX,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACrB,CAAC;KAAM,CAAC;IACP,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,KAAK,CAAC,KAAK,WAAW,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IAC9D,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Turns the pinned sources into the reviewable normalized JSON the compiler reads.
|
|
7
|
+
*
|
|
8
|
+
* Every record keeps the source's own identity (`entityID`), the code as the source spells it, and the source's
|
|
9
|
+
* status words. Each record comes from one source: a country record from Wikidata, an airport record from
|
|
10
|
+
* OurAirports. An airport's `country` is the alpha-2 string OurAirports states, with a status that records whether
|
|
11
|
+
* that string is an officially assigned ISO code, a source extension such as `XK`, or absent.
|
|
12
|
+
*/
|
|
13
|
+
import { type SourceLock } from "#sdk/sources";
|
|
14
|
+
/**
|
|
15
|
+
* One ISO 3166-1 entry.
|
|
16
|
+
*/
|
|
17
|
+
export interface CountryRecord {
|
|
18
|
+
/**
|
|
19
|
+
* The Wikidata item, such as `wikidata:Q408`.
|
|
20
|
+
*/
|
|
21
|
+
entityID: string;
|
|
22
|
+
alpha2: string;
|
|
23
|
+
alpha3: string;
|
|
24
|
+
numeric: string;
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* `officially-assigned` for a current entry.
|
|
28
|
+
* `formerly-used` when the source records a dissolution date.
|
|
29
|
+
*/
|
|
30
|
+
status: "officially-assigned" | "formerly-used";
|
|
31
|
+
/**
|
|
32
|
+
* The dissolution date the source states, for a `formerly-used` entry.
|
|
33
|
+
*/
|
|
34
|
+
dissolved?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One OurAirports row that holds an IATA code.
|
|
38
|
+
*/
|
|
39
|
+
export interface AirportRecord {
|
|
40
|
+
/**
|
|
41
|
+
* The OurAirports row id, such as `ourairports:3632`.
|
|
42
|
+
*/
|
|
43
|
+
entityID: string;
|
|
44
|
+
iata: string;
|
|
45
|
+
/**
|
|
46
|
+
* The `icao_code` column, read as the ICAO assignment.
|
|
47
|
+
* `ident` and `gps_code` are other identifiers.
|
|
48
|
+
*/
|
|
49
|
+
icao: string | null;
|
|
50
|
+
name: string;
|
|
51
|
+
facility: string;
|
|
52
|
+
scheduledService: boolean;
|
|
53
|
+
latitude: number;
|
|
54
|
+
longitude: number;
|
|
55
|
+
/**
|
|
56
|
+
* The `iso_country` column as the source spells it, or null when empty.
|
|
57
|
+
*/
|
|
58
|
+
country: string | null;
|
|
59
|
+
/**
|
|
60
|
+
* Whether `country` is an officially assigned ISO 3166-1 alpha-2 code, a source extension, or absent.
|
|
61
|
+
*/
|
|
62
|
+
countryStatus: "iso3166-1" | "source-extension" | "unstated";
|
|
63
|
+
isoRegion: string | null;
|
|
64
|
+
municipality: string | null;
|
|
65
|
+
}
|
|
66
|
+
export interface NormalizedCountries {
|
|
67
|
+
profile: string;
|
|
68
|
+
source: string;
|
|
69
|
+
normalizationVersion: number;
|
|
70
|
+
records: CountryRecord[];
|
|
71
|
+
}
|
|
72
|
+
export interface NormalizedAirports {
|
|
73
|
+
profile: string;
|
|
74
|
+
source: string;
|
|
75
|
+
normalizationVersion: number;
|
|
76
|
+
records: AirportRecord[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The coverage a profile declares: what each namespace's artifact can and cannot answer.
|
|
80
|
+
*/
|
|
81
|
+
export interface CoverageDeclaration {
|
|
82
|
+
profile: string;
|
|
83
|
+
namespaces: Record<string, {
|
|
84
|
+
source: string;
|
|
85
|
+
count: number;
|
|
86
|
+
statuses?: Record<string, number>;
|
|
87
|
+
kinds?: string[];
|
|
88
|
+
unsupported?: string[];
|
|
89
|
+
missMeans: string;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The version of the normalization rules below.
|
|
94
|
+
*
|
|
95
|
+
* A change to a rule that moves a record's bytes moves this number.
|
|
96
|
+
*/
|
|
97
|
+
export declare const NORMALIZATION_VERSION = 1;
|
|
98
|
+
interface SPARQLResults {
|
|
99
|
+
results: {
|
|
100
|
+
bindings: Array<Record<string, {
|
|
101
|
+
type: string;
|
|
102
|
+
value: string;
|
|
103
|
+
}>>;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Reads the Wikidata answer into country records, sorted by alpha-2 then item id.
|
|
108
|
+
*
|
|
109
|
+
* A code outside its grammar is an error naming the item, because the compiler's key
|
|
110
|
+
* space cannot hold it and an omitted row would be a silent loss.
|
|
111
|
+
*/
|
|
112
|
+
export declare function normalizeCountries(results: SPARQLResults, profile: string): NormalizedCountries;
|
|
113
|
+
/**
|
|
114
|
+
* Splits one CSV line whose fields are all double-quoted, as OurAirports writes them,
|
|
115
|
+
* with `""` as an escaped quote.
|
|
116
|
+
*/
|
|
117
|
+
export declare function splitQuotedCSVLine(line: string): string[];
|
|
118
|
+
/**
|
|
119
|
+
* Reads the OurAirports CSV into airport records: every row with an `iata_code`, sorted by code.
|
|
120
|
+
*
|
|
121
|
+
* `currentAlpha2` is the set of officially assigned alpha-2 codes,
|
|
122
|
+
* used only to label the row's country status.
|
|
123
|
+
*/
|
|
124
|
+
export declare function normalizeAirports(csv: string, currentAlpha2: ReadonlySet<string>, profile: string): NormalizedAirports;
|
|
125
|
+
/**
|
|
126
|
+
* Checks the country set against OurAirports' own country list and reports each side's extras.
|
|
127
|
+
*
|
|
128
|
+
* The two sources disagree on purpose: OurAirports adds `XK`, `XP` and `ZZ` as extensions
|
|
129
|
+
* and lists no entry for a territory with no airport.
|
|
130
|
+
* The report goes in the coverage declaration rather than changing either dataset.
|
|
131
|
+
*/
|
|
132
|
+
export declare function compareCountryLists(countries: readonly CountryRecord[], countriesCSV: string): {
|
|
133
|
+
onlyOurAirports: string[];
|
|
134
|
+
onlyWikidata: string[];
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* The coverage declaration for the open profile.
|
|
138
|
+
*/
|
|
139
|
+
export declare function declareCoverage(countries: NormalizedCountries, airports: NormalizedAirports, comparison: ReturnType<typeof compareCountryLists>): CoverageDeclaration;
|
|
140
|
+
/**
|
|
141
|
+
* Serializes a normalized collection with one record per line, so a source update diffs by record.
|
|
142
|
+
*
|
|
143
|
+
* The envelope keys come first, then `records`, each on its own line.
|
|
144
|
+
*/
|
|
145
|
+
export declare function formatNormalized(collection: NormalizedCountries | NormalizedAirports): string;
|
|
146
|
+
/**
|
|
147
|
+
* Reads the three pinned sources and normalizes them, refusing bytes the lock does not describe.
|
|
148
|
+
*/
|
|
149
|
+
export declare function normalizeFromLock(lock: SourceLock): Promise<{
|
|
150
|
+
countries: NormalizedCountries;
|
|
151
|
+
airports: NormalizedAirports;
|
|
152
|
+
coverage: CoverageDeclaration;
|
|
153
|
+
}>;
|
|
154
|
+
export {};
|
|
155
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../tools/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAAyB,KAAK,UAAU,EAAuB,MAAM,cAAc,CAAA;AAE1F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAAA;IAC/C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,OAAO,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB;;OAEG;IACH,aAAa,EAAE,WAAW,GAAG,kBAAkB,GAAG,UAAU,CAAA;IAC5D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED,MAAM,WAAW,mBAAmB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA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mB,CAClC,SAAS,EAAE,SAAS,aAAa,EAAE,EACnC,YAAY,EAAE,MAAM,GAClB;IAAE,eAAe,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAcvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,UAAU,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,GAChD,mBAAmB,CAiDrB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,mBAAmB,GAAG,kBAAkB,GAAG,MAAM,CAM7F;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IAClE,SAAS,EAAE,mBAAmB,CAAA;IAC9B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,QAAQ,EAAE,mBAAmB,CAAA;CAC7B,CAAC,CA+BD"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Turns the pinned sources into the reviewable normalized JSON the compiler reads.
|
|
7
|
+
*
|
|
8
|
+
* Every record keeps the source's own identity (`entityID`), the code as the source spells it, and the source's
|
|
9
|
+
* status words. Each record comes from one source: a country record from Wikidata, an airport record from
|
|
10
|
+
* OurAirports. An airport's `country` is the alpha-2 string OurAirports states, with a status that records whether
|
|
11
|
+
* that string is an officially assigned ISO code, a source extension such as `XK`, or absent.
|
|
12
|
+
*/
|
|
13
|
+
import { readLocalJSONFile, readLocalTextFile } from "@mailwoman/core/fs/readers";
|
|
14
|
+
import { sha256File } from "@mailwoman/core/hash";
|
|
15
|
+
import { stringifyJSON } from "@mailwoman/core/json";
|
|
16
|
+
import { TextSpliterator } from "spliterator";
|
|
17
|
+
import { sourcePath, SOURCES } from "#sdk/sources";
|
|
18
|
+
/**
|
|
19
|
+
* The version of the normalization rules below.
|
|
20
|
+
*
|
|
21
|
+
* A change to a rule that moves a record's bytes moves this number.
|
|
22
|
+
*/
|
|
23
|
+
export const NORMALIZATION_VERSION = 1;
|
|
24
|
+
const ALPHA2 = /^[A-Z]{2}$/;
|
|
25
|
+
const ALPHA3 = /^[A-Z]{3}$/;
|
|
26
|
+
const NUMERIC = /^\d{3}$/;
|
|
27
|
+
function sourceDefinition(id) {
|
|
28
|
+
const found = SOURCES.find((candidate) => candidate.id === id);
|
|
29
|
+
if (!found)
|
|
30
|
+
throw new Error(`no source ${id}`);
|
|
31
|
+
return found;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads the Wikidata answer into country records, sorted by alpha-2 then item id.
|
|
35
|
+
*
|
|
36
|
+
* A code outside its grammar is an error naming the item, because the compiler's key
|
|
37
|
+
* space cannot hold it and an omitted row would be a silent loss.
|
|
38
|
+
*/
|
|
39
|
+
export function normalizeCountries(results, profile) {
|
|
40
|
+
const records = [];
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
for (const binding of results.results.bindings) {
|
|
43
|
+
const qid = binding["item"]?.value.split("/").at(-1);
|
|
44
|
+
const alpha2 = binding["alpha2"]?.value;
|
|
45
|
+
const alpha3 = binding["alpha3"]?.value;
|
|
46
|
+
const numeric = binding["numeric"]?.value;
|
|
47
|
+
if (!qid || !alpha2 || !alpha3 || !numeric)
|
|
48
|
+
throw new Error(`incomplete binding: ${stringifyJSON(binding)}`);
|
|
49
|
+
if (!ALPHA2.test(alpha2) || !ALPHA3.test(alpha3) || !NUMERIC.test(numeric)) {
|
|
50
|
+
throw new Error(`${qid}: codes ${alpha2}/${alpha3}/${numeric} are outside the ISO 3166-1 grammars`);
|
|
51
|
+
}
|
|
52
|
+
// The dissolution date can repeat an item, and the first row keeps it.
|
|
53
|
+
if (seen.has(qid))
|
|
54
|
+
continue;
|
|
55
|
+
seen.add(qid);
|
|
56
|
+
const dissolved = binding["dissolved"]?.value;
|
|
57
|
+
records.push({
|
|
58
|
+
entityID: `wikidata:${qid}`,
|
|
59
|
+
alpha2,
|
|
60
|
+
alpha3,
|
|
61
|
+
numeric,
|
|
62
|
+
name: binding["itemLabel"]?.value ?? qid,
|
|
63
|
+
status: dissolved ? "formerly-used" : "officially-assigned",
|
|
64
|
+
...(dissolved ? { dissolved } : {}),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const sorted = records.toSorted((a, b) => a.alpha2.localeCompare(b.alpha2, "en") || a.entityID.localeCompare(b.entityID, "en"));
|
|
68
|
+
assertUniqueCurrent(sorted);
|
|
69
|
+
return { profile, source: "wikidata-iso3166-1", normalizationVersion: NORMALIZATION_VERSION, records: sorted };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Two current entries cannot share a code.
|
|
73
|
+
* Two historical entries, or one of each, can.
|
|
74
|
+
*/
|
|
75
|
+
function assertUniqueCurrent(records) {
|
|
76
|
+
for (const field of ["alpha2", "alpha3", "numeric"]) {
|
|
77
|
+
const held = new Map();
|
|
78
|
+
for (const record of records) {
|
|
79
|
+
if (record.status !== "officially-assigned")
|
|
80
|
+
continue;
|
|
81
|
+
const other = held.get(record[field]);
|
|
82
|
+
if (other)
|
|
83
|
+
throw new Error(`${field} ${record[field]} is held by ${other} and ${record.entityID}`);
|
|
84
|
+
held.set(record[field], record.entityID);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Splits one CSV line whose fields are all double-quoted, as OurAirports writes them,
|
|
90
|
+
* with `""` as an escaped quote.
|
|
91
|
+
*/
|
|
92
|
+
export function splitQuotedCSVLine(line) {
|
|
93
|
+
const cells = [];
|
|
94
|
+
let cell = "";
|
|
95
|
+
let quoted = false;
|
|
96
|
+
for (let index = 0; index < line.length; index++) {
|
|
97
|
+
const char = line[index];
|
|
98
|
+
if (quoted) {
|
|
99
|
+
if (char === '"') {
|
|
100
|
+
if (line[index + 1] === '"') {
|
|
101
|
+
cell += '"';
|
|
102
|
+
index++;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
quoted = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
cell += char;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else if (char === '"') {
|
|
113
|
+
quoted = true;
|
|
114
|
+
}
|
|
115
|
+
else if (char === ",") {
|
|
116
|
+
cells.push(cell);
|
|
117
|
+
cell = "";
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
cell += char;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
cells.push(cell);
|
|
124
|
+
return cells;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The lines of a CSV text, with the header first and no empty line.
|
|
128
|
+
*/
|
|
129
|
+
function csvLines(csv) {
|
|
130
|
+
return TextSpliterator.from(csv)
|
|
131
|
+
.filter((line) => line.length > 0)
|
|
132
|
+
.toArray();
|
|
133
|
+
}
|
|
134
|
+
function columnIndex(header, name, file) {
|
|
135
|
+
const index = header.indexOf(name);
|
|
136
|
+
if (index === -1)
|
|
137
|
+
throw new Error(`${file} has no ${name} column. The header is ${header.join(",")}`);
|
|
138
|
+
return index;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Reads the OurAirports CSV into airport records: every row with an `iata_code`, sorted by code.
|
|
142
|
+
*
|
|
143
|
+
* `currentAlpha2` is the set of officially assigned alpha-2 codes,
|
|
144
|
+
* used only to label the row's country status.
|
|
145
|
+
*/
|
|
146
|
+
export function normalizeAirports(csv, currentAlpha2, profile) {
|
|
147
|
+
const lines = csvLines(csv);
|
|
148
|
+
const header = splitQuotedCSVLine(lines[0]);
|
|
149
|
+
const column = (name) => columnIndex(header, name, "airports.csv");
|
|
150
|
+
const at = {
|
|
151
|
+
id: column("id"),
|
|
152
|
+
type: column("type"),
|
|
153
|
+
name: column("name"),
|
|
154
|
+
latitude: column("latitude_deg"),
|
|
155
|
+
longitude: column("longitude_deg"),
|
|
156
|
+
country: column("iso_country"),
|
|
157
|
+
region: column("iso_region"),
|
|
158
|
+
municipality: column("municipality"),
|
|
159
|
+
scheduled: column("scheduled_service"),
|
|
160
|
+
icao: column("icao_code"),
|
|
161
|
+
iata: column("iata_code"),
|
|
162
|
+
};
|
|
163
|
+
const records = [];
|
|
164
|
+
const held = new Map();
|
|
165
|
+
for (const line of lines.slice(1)) {
|
|
166
|
+
const cells = splitQuotedCSVLine(line);
|
|
167
|
+
if (cells.length !== header.length)
|
|
168
|
+
throw new Error(`airports.csv row has ${cells.length} cells: ${line.slice(0, 80)}`);
|
|
169
|
+
const iata = cells[at.iata];
|
|
170
|
+
if (!iata)
|
|
171
|
+
continue;
|
|
172
|
+
if (!ALPHA3.test(iata))
|
|
173
|
+
throw new Error(`row ${cells[at.id]}: iata_code ${stringifyJSON(iata)} is outside [A-Z]{3}`);
|
|
174
|
+
const other = held.get(iata);
|
|
175
|
+
if (other)
|
|
176
|
+
throw new Error(`iata ${iata} is held by rows ${other} and ${cells[at.id]}`);
|
|
177
|
+
held.set(iata, cells[at.id]);
|
|
178
|
+
const latitude = Number(cells[at.latitude]);
|
|
179
|
+
const longitude = Number(cells[at.longitude]);
|
|
180
|
+
if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) {
|
|
181
|
+
throw new TypeError(`row ${cells[at.id]}: unreadable coordinate ${cells[at.latitude]},${cells[at.longitude]}`);
|
|
182
|
+
}
|
|
183
|
+
const country = cells[at.country] || null;
|
|
184
|
+
const icao = cells[at.icao] || null;
|
|
185
|
+
records.push({
|
|
186
|
+
entityID: `ourairports:${cells[at.id]}`,
|
|
187
|
+
iata,
|
|
188
|
+
icao,
|
|
189
|
+
name: cells[at.name],
|
|
190
|
+
facility: cells[at.type],
|
|
191
|
+
scheduledService: cells[at.scheduled] === "yes",
|
|
192
|
+
latitude,
|
|
193
|
+
longitude,
|
|
194
|
+
country,
|
|
195
|
+
countryStatus: country ? (currentAlpha2.has(country) ? "iso3166-1" : "source-extension") : "unstated",
|
|
196
|
+
isoRegion: cells[at.region] || null,
|
|
197
|
+
municipality: cells[at.municipality] || null,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
profile,
|
|
202
|
+
source: "ourairports-airports",
|
|
203
|
+
normalizationVersion: NORMALIZATION_VERSION,
|
|
204
|
+
records: records.toSorted((a, b) => a.iata.localeCompare(b.iata, "en")),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Checks the country set against OurAirports' own country list and reports each side's extras.
|
|
209
|
+
*
|
|
210
|
+
* The two sources disagree on purpose: OurAirports adds `XK`, `XP` and `ZZ` as extensions
|
|
211
|
+
* and lists no entry for a territory with no airport.
|
|
212
|
+
* The report goes in the coverage declaration rather than changing either dataset.
|
|
213
|
+
*/
|
|
214
|
+
export function compareCountryLists(countries, countriesCSV) {
|
|
215
|
+
const lines = csvLines(countriesCSV);
|
|
216
|
+
const header = splitQuotedCSVLine(lines[0]);
|
|
217
|
+
const codeIndex = columnIndex(header, "code", "countries.csv");
|
|
218
|
+
const ourAirports = new Set(lines.slice(1).map((line) => splitQuotedCSVLine(line)[codeIndex]));
|
|
219
|
+
const current = new Set(countries.filter((record) => record.status === "officially-assigned").map((record) => record.alpha2));
|
|
220
|
+
return {
|
|
221
|
+
onlyOurAirports: [...ourAirports].filter((code) => !current.has(code)).toSorted(),
|
|
222
|
+
onlyWikidata: [...current].filter((code) => !ourAirports.has(code)).toSorted(),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The coverage declaration for the open profile.
|
|
227
|
+
*/
|
|
228
|
+
export function declareCoverage(countries, airports, comparison) {
|
|
229
|
+
const statuses = {};
|
|
230
|
+
for (const record of countries.records) {
|
|
231
|
+
statuses[record.status] = (statuses[record.status] ?? 0) + 1;
|
|
232
|
+
}
|
|
233
|
+
const current = countries.records.filter((record) => record.status === "officially-assigned").length;
|
|
234
|
+
const airportCountryStatuses = {};
|
|
235
|
+
for (const record of airports.records) {
|
|
236
|
+
airportCountryStatuses[record.countryStatus] = (airportCountryStatuses[record.countryStatus] ?? 0) + 1;
|
|
237
|
+
}
|
|
238
|
+
const missMeans = "not-found-in-snapshot: the source holds no such code, and the issuing authority may still have assigned it";
|
|
239
|
+
return {
|
|
240
|
+
profile: countries.profile,
|
|
241
|
+
namespaces: {
|
|
242
|
+
"iso3166-1-alpha2": { source: countries.source, count: current, statuses, missMeans },
|
|
243
|
+
"iso3166-1-alpha3": { source: countries.source, count: current, statuses, missMeans },
|
|
244
|
+
"iso3166-1-numeric": { source: countries.source, count: current, statuses, missMeans },
|
|
245
|
+
"iata-location": {
|
|
246
|
+
source: airports.source,
|
|
247
|
+
count: airports.records.length,
|
|
248
|
+
kinds: ["airport"],
|
|
249
|
+
unsupported: ["metropolitan", "intermodal", "rail", "bus"],
|
|
250
|
+
statuses: airportCountryStatuses,
|
|
251
|
+
missMeans,
|
|
252
|
+
},
|
|
253
|
+
"icao-location": {
|
|
254
|
+
source: airports.source,
|
|
255
|
+
count: airports.records.filter((record) => record.icao).length,
|
|
256
|
+
kinds: ["airport"],
|
|
257
|
+
unsupported: ["a location with no IATA code: the source rows without iata_code are left unread"],
|
|
258
|
+
missMeans,
|
|
259
|
+
},
|
|
260
|
+
$countryListComparison: {
|
|
261
|
+
source: "ourairports-countries",
|
|
262
|
+
count: comparison.onlyOurAirports.length + comparison.onlyWikidata.length,
|
|
263
|
+
kinds: [
|
|
264
|
+
`onlyOurAirports: ${comparison.onlyOurAirports.join(",")}`,
|
|
265
|
+
`onlyWikidata: ${comparison.onlyWikidata.join(",")}`,
|
|
266
|
+
],
|
|
267
|
+
missMeans: "a comparison rather than a namespace",
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Serializes a normalized collection with one record per line, so a source update diffs by record.
|
|
274
|
+
*
|
|
275
|
+
* The envelope keys come first, then `records`, each on its own line.
|
|
276
|
+
*/
|
|
277
|
+
export function formatNormalized(collection) {
|
|
278
|
+
const { records, ...envelope } = collection;
|
|
279
|
+
const head = stringifyJSON(envelope).slice(1, -1);
|
|
280
|
+
const body = records.map((record) => `\t\t${stringifyJSON(record)}`).join(",\n");
|
|
281
|
+
return `{${head},\n\t"records": [\n${body}\n\t]\n}\n`;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Reads the three pinned sources and normalizes them, refusing bytes the lock does not describe.
|
|
285
|
+
*/
|
|
286
|
+
export async function normalizeFromLock(lock) {
|
|
287
|
+
for (const definition of SOURCES.filter((candidate) => candidate.terms.elected)) {
|
|
288
|
+
const locked = lock.sources[definition.id];
|
|
289
|
+
const digest = await sha256File(sourcePath(definition));
|
|
290
|
+
if (!locked)
|
|
291
|
+
throw new Error(`${definition.id} is outside the lock`);
|
|
292
|
+
if (digest !== locked.sha256) {
|
|
293
|
+
throw new Error(`${definition.id}: file digest ${digest} differs from the lock's ${locked.sha256}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const results = await readLocalJSONFile(sourcePath(sourceDefinition("wikidata-iso3166-1")));
|
|
297
|
+
const countries = normalizeCountries(results, lock.profile);
|
|
298
|
+
const current = new Set(countries.records.filter((record) => record.status === "officially-assigned").map((record) => record.alpha2));
|
|
299
|
+
const airports = normalizeAirports(await readLocalTextFile(sourcePath(sourceDefinition("ourairports-airports"))), current, lock.profile);
|
|
300
|
+
const comparison = compareCountryLists(countries.records, await readLocalTextFile(sourcePath(sourceDefinition("ourairports-countries"))));
|
|
301
|
+
return { countries, airports, coverage: declareCoverage(countries, airports, comparison) };
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../tools/normalize.ts"],"names":[],"mappings":"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`data/manifests/coverage.json` from the pinned sources.
|
|
8
|
+
*
|
|
9
|
+
* Usage: `node packages/registry/tools/normalize.run.ts`
|
|
10
|
+
*
|
|
11
|
+
* The run refuses a source file whose digest differs from `data/manifests/sources.lock.json`.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=normalize.run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.run.d.ts","sourceRoot":"","sources":["../../tools/normalize.run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Writes `data/normalized/iso3166-1.json`, `data/normalized/iata-airports.json` and
|
|
7
|
+
* `data/manifests/coverage.json` from the pinned sources.
|
|
8
|
+
*
|
|
9
|
+
* Usage: `node packages/registry/tools/normalize.run.ts`
|
|
10
|
+
*
|
|
11
|
+
* The run refuses a source file whose digest differs from `data/manifests/sources.lock.json`.
|
|
12
|
+
*/
|
|
13
|
+
import { writeLocalFile, writeLocalJSONFile } from "@mailwoman/core/fs/writers";
|
|
14
|
+
import { stringifyJSON } from "@mailwoman/core/json";
|
|
15
|
+
import { workspacePathBuilder } from "@mailwoman/core/paths";
|
|
16
|
+
import { readSourceLock } from "#sdk/fetch";
|
|
17
|
+
import { formatNormalized, normalizeFromLock } from "#tools/normalize";
|
|
18
|
+
const lock = await readSourceLock();
|
|
19
|
+
if (!lock)
|
|
20
|
+
throw new Error("no sources.lock.json; run packages/registry/sdk/fetch.run.ts --repin first");
|
|
21
|
+
const { countries, airports, coverage } = await normalizeFromLock(lock);
|
|
22
|
+
const data = workspacePathBuilder("registry", "data");
|
|
23
|
+
await writeLocalFile(formatNormalized(countries), data("normalized", "iso3166-1.json"));
|
|
24
|
+
await writeLocalFile(formatNormalized(airports), data("normalized", "iata-airports.json"));
|
|
25
|
+
await writeLocalJSONFile(coverage, data("manifests", "coverage.json"));
|
|
26
|
+
console.log(`countries: ${countries.records.length} (${stringifyJSON(coverage.namespaces["iso3166-1-alpha2"].statuses)})`);
|
|
27
|
+
console.log(`airports: ${airports.records.length} (${stringifyJSON(coverage.namespaces["iata-location"].statuses)})`);
|
|
28
|
+
console.log(`country lists: ${coverage.namespaces["$countryListComparison"].kinds.join("; ")}`);
|
|
29
|
+
//# sourceMappingURL=normalize.run.js.map
|