@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,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Returns the module an artifact's bytes live in under `lib/artifacts/`, grouped by the dataset it reads.
|
|
8
|
+
*/
|
|
9
|
+
export declare function artifactModulePath(name: string): string;
|
|
10
|
+
//# sourceMappingURL=artifact-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-path.d.ts","sourceRoot":"","sources":["../../tools/artifact-path.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Returns the module an artifact's bytes live in under `lib/artifacts/`, grouped by the dataset it reads.
|
|
8
|
+
*/
|
|
9
|
+
export function artifactModulePath(name) {
|
|
10
|
+
return name.replace(/^(iso3166-1|iata-airport)-/u, "$1/");
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=artifact-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-path.js","sourceRoot":"","sources":["../../tools/artifact-path.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAA;AAC1D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Measures the readers on this host and prints a Markdown report for `docs/performance.md`.
|
|
7
|
+
*
|
|
8
|
+
* Arms: a JavaScript `Set` of strings as the baseline, the TypeScript bitset reader, and the WebAssembly batch
|
|
9
|
+
* kernels, scalar and simd. Inputs: strings end to end, and packed bytes where an arm takes them. Batch sizes 1, 16,
|
|
10
|
+
* 256, 4,096 and the whole 17,576-key domain. Distributions: hits, misses, and a shuffled sweep of the domain. Startup:
|
|
11
|
+
* module import, artifact decode and validation, wasm compile and instantiate, first query. Every result is consumed
|
|
12
|
+
* so the work is kept.
|
|
13
|
+
*
|
|
14
|
+
* Usage: `node packages/registry/tools/bench.run.ts [--json]`
|
|
15
|
+
*
|
|
16
|
+
* The numbers describe one host and one run. The report records the host, Node and the artifact digests beside them.
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=bench.run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bench.run.d.ts","sourceRoot":"","sources":["../../tools/bench.run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Measures the readers on this host and prints a Markdown report for `docs/performance.md`.
|
|
7
|
+
*
|
|
8
|
+
* Arms: a JavaScript `Set` of strings as the baseline, the TypeScript bitset reader, and the WebAssembly batch
|
|
9
|
+
* kernels, scalar and simd. Inputs: strings end to end, and packed bytes where an arm takes them. Batch sizes 1, 16,
|
|
10
|
+
* 256, 4,096 and the whole 17,576-key domain. Distributions: hits, misses, and a shuffled sweep of the domain. Startup:
|
|
11
|
+
* module import, artifact decode and validation, wasm compile and instantiate, first query. Every result is consumed
|
|
12
|
+
* so the work is kept.
|
|
13
|
+
*
|
|
14
|
+
* Usage: `node packages/registry/tools/bench.run.ts [--json]`
|
|
15
|
+
*
|
|
16
|
+
* The numbers describe one host and one run. The report records the host, Node and the artifact digests beside them.
|
|
17
|
+
*/
|
|
18
|
+
import { readLocalBuffer, readLocalJSONFile } from "@mailwoman/core/fs/readers";
|
|
19
|
+
import { prettyJSON } from "@mailwoman/core/json";
|
|
20
|
+
import { workspacePath } from "@mailwoman/core/paths";
|
|
21
|
+
import { mulberry32, shuffleWith } from "@mailwoman/core/random";
|
|
22
|
+
import { parseArguments } from "@mailwoman/core/scripting/arguments";
|
|
23
|
+
import { cpuCount, cpuModel, totalMemoryBytes } from "@mailwoman/core/utils/system";
|
|
24
|
+
import { decode3, KEY_SPACE_3 } from "#key";
|
|
25
|
+
const { values } = parseArguments({ options: { json: { type: "boolean", default: false } } });
|
|
26
|
+
const encoder = new TextEncoder();
|
|
27
|
+
function nanoseconds(start) {
|
|
28
|
+
return Number(process.hrtime.bigint() - start);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Runs `run` over `rounds` repetitions and reports the median nanoseconds per code.
|
|
32
|
+
*/
|
|
33
|
+
function measure(label, codesPerRound, rounds, run) {
|
|
34
|
+
const samples = [];
|
|
35
|
+
let sink = 0;
|
|
36
|
+
for (let round = 0; round < rounds; round++) {
|
|
37
|
+
const start = process.hrtime.bigint();
|
|
38
|
+
sink += run();
|
|
39
|
+
samples.push(nanoseconds(start) / codesPerRound);
|
|
40
|
+
}
|
|
41
|
+
samples.sort((a, b) => a - b);
|
|
42
|
+
return { label, nsPerCode: samples[Math.floor(samples.length / 2)], sink };
|
|
43
|
+
}
|
|
44
|
+
// Startup: module import.
|
|
45
|
+
const importStart = process.hrtime.bigint();
|
|
46
|
+
const [{ collisionMembership, isCountryAirportCollision }, { alpha3Membership }, { airportMembership }, wasm] = await Promise.all([
|
|
47
|
+
import("#overlap/country-airport"),
|
|
48
|
+
import("#iso3166/alpha3"),
|
|
49
|
+
import("#iata/airports/validate"),
|
|
50
|
+
import("#wasm"),
|
|
51
|
+
]);
|
|
52
|
+
const importNs = nanoseconds(importStart);
|
|
53
|
+
// Startup: decode and validate the three bitsets on first use.
|
|
54
|
+
const decodeStart = process.hrtime.bigint();
|
|
55
|
+
collisionMembership();
|
|
56
|
+
alpha3Membership();
|
|
57
|
+
airportMembership();
|
|
58
|
+
const decodeNs = nanoseconds(decodeStart);
|
|
59
|
+
const firstQueryStart = process.hrtime.bigint();
|
|
60
|
+
isCountryAirportCollision("AUS");
|
|
61
|
+
const firstQueryNs = nanoseconds(firstQueryStart);
|
|
62
|
+
// The baseline: a Set of strings built from the normalized JSON.
|
|
63
|
+
const countries = await readLocalJSONFile(workspacePath("registry", "data", "normalized", "iso3166-1.json"));
|
|
64
|
+
const airports = await readLocalJSONFile(workspacePath("registry", "data", "normalized", "iata-airports.json"));
|
|
65
|
+
const setStart = process.hrtime.bigint();
|
|
66
|
+
const countrySet = new Set(countries.records.filter((record) => record.status === "officially-assigned").map((record) => record.alpha3));
|
|
67
|
+
const airportSet = new Set(airports.records.map((record) => record.iata));
|
|
68
|
+
const collisionSet = new Set([...countrySet].filter((code) => airportSet.has(code)));
|
|
69
|
+
const setBuildNs = nanoseconds(setStart);
|
|
70
|
+
// Inputs.
|
|
71
|
+
const allCodes = Array.from({ length: KEY_SPACE_3 }, (_, key) => decode3(key));
|
|
72
|
+
const hits = [...collisionSet];
|
|
73
|
+
const misses = allCodes.filter((code) => !countrySet.has(code) && !airportSet.has(code)).slice(0, 4096);
|
|
74
|
+
const shuffled = [...allCodes];
|
|
75
|
+
// A fixed-seed shuffle so two runs read the same order.
|
|
76
|
+
shuffleWith(shuffled, mulberry32(0x9e_37_79_b9));
|
|
77
|
+
function packed(codes) {
|
|
78
|
+
const bytes = new Uint8Array(codes.length * 3);
|
|
79
|
+
codes.forEach((code, index) => bytes.set(encoder.encode(code), index * 3));
|
|
80
|
+
return bytes;
|
|
81
|
+
}
|
|
82
|
+
const results = [];
|
|
83
|
+
const batches = [1, 16, 256, 4096, KEY_SPACE_3];
|
|
84
|
+
for (const [distribution, codes] of [
|
|
85
|
+
["hits", hits],
|
|
86
|
+
["misses", misses],
|
|
87
|
+
["shuffled sweep", shuffled],
|
|
88
|
+
]) {
|
|
89
|
+
for (const batch of batches) {
|
|
90
|
+
if (batch > codes.length && batch !== KEY_SPACE_3)
|
|
91
|
+
continue;
|
|
92
|
+
const sample = codes.slice(0, Math.min(batch, codes.length));
|
|
93
|
+
const rounds = Math.max(5, Math.min(2000, Math.floor(200_000 / sample.length)));
|
|
94
|
+
results.push({
|
|
95
|
+
arm: "JS Set (baseline)",
|
|
96
|
+
input: "strings",
|
|
97
|
+
distribution,
|
|
98
|
+
batch,
|
|
99
|
+
...measure("set", sample.length, rounds, () => {
|
|
100
|
+
let count = 0;
|
|
101
|
+
for (const code of sample) {
|
|
102
|
+
count += collisionSet.has(code) ? 1 : 0;
|
|
103
|
+
}
|
|
104
|
+
return count;
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
107
|
+
results.push({
|
|
108
|
+
arm: "TypeScript bitset",
|
|
109
|
+
input: "strings",
|
|
110
|
+
distribution,
|
|
111
|
+
batch,
|
|
112
|
+
...measure("ts", sample.length, rounds, () => {
|
|
113
|
+
let count = 0;
|
|
114
|
+
for (const code of sample) {
|
|
115
|
+
count += isCountryAirportCollision(code) ? 1 : 0;
|
|
116
|
+
}
|
|
117
|
+
return count;
|
|
118
|
+
}),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const variants = wasm.preferredWasmVariant() === "simd" ? ["scalar", "simd"] : ["scalar"];
|
|
123
|
+
const startup = {
|
|
124
|
+
"module import": importNs,
|
|
125
|
+
"artifact decode + validate (3 bitsets)": decodeNs,
|
|
126
|
+
"first query": firstQueryNs,
|
|
127
|
+
"JS Set build from JSON (baseline)": setBuildNs,
|
|
128
|
+
};
|
|
129
|
+
for (const variant of variants) {
|
|
130
|
+
const bytes = await readLocalBuffer(wasm.registryWasmURL(variant));
|
|
131
|
+
const compileStart = process.hrtime.bigint();
|
|
132
|
+
const registry = await wasm.createRegistry({ wasm: bytes });
|
|
133
|
+
startup[`wasm ${variant}: compile + instantiate + load 3 artifacts`] = nanoseconds(compileStart);
|
|
134
|
+
for (const [distribution, codes] of [
|
|
135
|
+
["hits", hits],
|
|
136
|
+
["misses", misses],
|
|
137
|
+
["shuffled sweep", shuffled],
|
|
138
|
+
]) {
|
|
139
|
+
for (const batch of batches) {
|
|
140
|
+
if (batch > codes.length && batch !== KEY_SPACE_3)
|
|
141
|
+
continue;
|
|
142
|
+
const sample = codes.slice(0, Math.min(batch, codes.length));
|
|
143
|
+
const input = packed(sample);
|
|
144
|
+
const out = new Uint8Array(sample.length);
|
|
145
|
+
const rounds = Math.max(5, Math.min(2000, Math.floor(200_000 / sample.length)));
|
|
146
|
+
results.push({
|
|
147
|
+
arm: `wasm ${variant} batch`,
|
|
148
|
+
input: "packed bytes",
|
|
149
|
+
distribution,
|
|
150
|
+
batch,
|
|
151
|
+
...measure("wasm", sample.length, rounds, () => {
|
|
152
|
+
registry.countryAirport.classifyManyInto(input, out);
|
|
153
|
+
let count = 0;
|
|
154
|
+
for (const mask of out) {
|
|
155
|
+
count += mask & 4 ? 1 : 0;
|
|
156
|
+
}
|
|
157
|
+
return count;
|
|
158
|
+
}),
|
|
159
|
+
});
|
|
160
|
+
results.push({
|
|
161
|
+
arm: `wasm ${variant} batch`,
|
|
162
|
+
input: "strings (encode + copy included)",
|
|
163
|
+
distribution,
|
|
164
|
+
batch,
|
|
165
|
+
...measure("wasm-strings", sample.length, rounds, () => {
|
|
166
|
+
const masks = registry.countryAirport.classify(sample);
|
|
167
|
+
let count = 0;
|
|
168
|
+
for (const mask of masks) {
|
|
169
|
+
count += mask & 4 ? 1 : 0;
|
|
170
|
+
}
|
|
171
|
+
return count;
|
|
172
|
+
}),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
registry.dispose();
|
|
177
|
+
}
|
|
178
|
+
const manifest = await readLocalJSONFile(workspacePath("registry", "data", "manifests", "artifacts.json"));
|
|
179
|
+
const host = {
|
|
180
|
+
node: process.version,
|
|
181
|
+
cpu: cpuModel(),
|
|
182
|
+
cores: cpuCount(),
|
|
183
|
+
memoryGB: Math.round(totalMemoryBytes() / 1e9),
|
|
184
|
+
platform: `${process.platform} ${process.arch}`,
|
|
185
|
+
};
|
|
186
|
+
if (values.json) {
|
|
187
|
+
console.log(prettyJSON({ host, startup, results, manifest }));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
console.log(`Host: ${host.cpu}, ${host.cores} cores, ${host.memoryGB} GB, ${host.platform}, Node ${host.node}\n`);
|
|
191
|
+
console.log("| Startup | µs |\n| --- | --- |");
|
|
192
|
+
for (const [label, ns] of Object.entries(startup)) {
|
|
193
|
+
console.log(`| ${label} | ${(ns / 1000).toFixed(0)} |`);
|
|
194
|
+
}
|
|
195
|
+
console.log("\n| Arm | Input | Distribution | Batch | ns per code (median) |\n| --- | --- | --- | --- | --- |");
|
|
196
|
+
for (const row of results) {
|
|
197
|
+
console.log(`| ${row.arm} | ${row.input} | ${row.distribution} | ${row.batch} | ${row.nsPerCode.toFixed(1)} |`);
|
|
198
|
+
}
|
|
199
|
+
console.log("\n| Artifact | Bytes | SHA-256 |\n| --- | --- | --- |");
|
|
200
|
+
for (const [name, entry] of Object.entries(manifest)) {
|
|
201
|
+
console.log(`| ${name} | ${entry.bytes} | ${entry.sha256.slice(0, 16)}… |`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=bench.run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bench.run.js","sourceRoot":"","sources":["../../tools/bench.run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEnF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAE3C,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAA;AAE7F,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC,SAAS,WAAW,CAAC,KAAa;IACjC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE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,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACxD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,kGAAkG,CAAC,CAAA;IAE/G,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,KAAK,MAAM,GAAG,CAAC,YAAY,MAAM,GAAG,CAAC,KAAK,MAAM,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAChH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAA;IAEpE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,MAAM,KAAK,CAAC,KAAK,MAAM,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;IAC5E,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Builds `crates/registry-wasm` for `wasm32-unknown-unknown` twice, once with `simd128` and once without, and
|
|
7
|
+
* writes `wasm/registry-simd.wasm` and `wasm/registry.wasm`.
|
|
8
|
+
*
|
|
9
|
+
* The two builds use separate target directories, because a `RUSTFLAGS` change would otherwise invalidate every
|
|
10
|
+
* crate in the shared target directory.
|
|
11
|
+
*
|
|
12
|
+
* With `--check`, the tool builds without writing and exits non-zero when a build's SHA-256 differs from the
|
|
13
|
+
* committed binary's.
|
|
14
|
+
*
|
|
15
|
+
* Usage: `node packages/registry/tools/build-wasm.run.ts [--check]`
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=build-wasm.run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-wasm.run.d.ts","sourceRoot":"","sources":["../../tools/build-wasm.run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Builds `crates/registry-wasm` for `wasm32-unknown-unknown` twice, once with `simd128` and once without, and
|
|
7
|
+
* writes `wasm/registry-simd.wasm` and `wasm/registry.wasm`.
|
|
8
|
+
*
|
|
9
|
+
* The two builds use separate target directories, because a `RUSTFLAGS` change would otherwise invalidate every
|
|
10
|
+
* crate in the shared target directory.
|
|
11
|
+
*
|
|
12
|
+
* With `--check`, the tool builds without writing and exits non-zero when a build's SHA-256 differs from the
|
|
13
|
+
* committed binary's.
|
|
14
|
+
*
|
|
15
|
+
* Usage: `node packages/registry/tools/build-wasm.run.ts [--check]`
|
|
16
|
+
*/
|
|
17
|
+
import { statPath } from "@mailwoman/core/fs/readers/stat";
|
|
18
|
+
import { replaceFileAtomically } from "@mailwoman/core/fs/writers";
|
|
19
|
+
import { sha256File } from "@mailwoman/core/hash";
|
|
20
|
+
import { repoRootPath, workspacePath } from "@mailwoman/core/paths";
|
|
21
|
+
import { runFile } from "@mailwoman/core/process";
|
|
22
|
+
import { parseArguments } from "@mailwoman/core/scripting/arguments";
|
|
23
|
+
const { values } = parseArguments({ options: { check: { type: "boolean", default: false } } });
|
|
24
|
+
const workspace = workspacePath("registry");
|
|
25
|
+
/**
|
|
26
|
+
* The two builds.
|
|
27
|
+
*
|
|
28
|
+
* The simd build passes its target feature through cargo's `--config`,
|
|
29
|
+
* so the environment stays as the caller set it.
|
|
30
|
+
*/
|
|
31
|
+
const VARIANTS = [
|
|
32
|
+
{ file: "registry.wasm", targetDir: repoRootPath("target", "registry-wasm"), config: [] },
|
|
33
|
+
{
|
|
34
|
+
file: "registry-simd.wasm",
|
|
35
|
+
targetDir: repoRootPath("target", "registry-wasm-simd"),
|
|
36
|
+
config: ["--config", 'build.rustflags=["-C","target-feature=+simd128"]'],
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
for (const variant of VARIANTS) {
|
|
40
|
+
await runFile("cargo", [
|
|
41
|
+
"build",
|
|
42
|
+
"--release",
|
|
43
|
+
"--locked",
|
|
44
|
+
"--target",
|
|
45
|
+
"wasm32-unknown-unknown",
|
|
46
|
+
"-p",
|
|
47
|
+
"registry-wasm",
|
|
48
|
+
"--target-dir",
|
|
49
|
+
variant.targetDir,
|
|
50
|
+
...variant.config,
|
|
51
|
+
], { cwd: workspace });
|
|
52
|
+
const built = `${variant.targetDir}/wasm32-unknown-unknown/release/registry_wasm.wasm`;
|
|
53
|
+
const committed = workspacePath("registry", "wasm", variant.file);
|
|
54
|
+
const builtDigest = await sha256File(built);
|
|
55
|
+
const { size } = await statPath(built);
|
|
56
|
+
if (values.check) {
|
|
57
|
+
const committedDigest = await sha256File(committed);
|
|
58
|
+
if (committedDigest === builtDigest) {
|
|
59
|
+
console.log(`wasm/${variant.file} matches the build: ${builtDigest} (${size} bytes)`);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
console.error(`wasm/${variant.file} is stale: committed ${committedDigest}, built ${builtDigest} (${size} bytes)`);
|
|
63
|
+
process.exitCode = 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
await replaceFileAtomically(built, committed);
|
|
68
|
+
console.log(`wrote wasm/${variant.file}: ${builtDigest} (${size} bytes)`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=build-wasm.run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,CAAA;IAED,MAAM,KAAK,GAAG,GAAG,OAAO,CAAC,SAAS,oDAAoD,CAAA;IACtF,MAAM,SAAS,GAAG,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACjE,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,CAAA;IAC3C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEtC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAA;QAEnD,IAAI,eAAe,KAAK,WAAW,EAAE,CAAC;YACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,OAAO,CAAC,IAAI,uBAAuB,WAAW,KAAK,IAAI,SAAS,CAAC,CAAA;QACtF,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,KAAK,CAAC,QAAQ,OAAO,CAAC,IAAI,wBAAwB,eAAe,WAAW,WAAW,KAAK,IAAI,SAAS,CAAC,CAAA;YAElH,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACrB,CAAC;IACF,CAAC;SAAM,CAAC;QACP,MAAM,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QAE7C,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,IAAI,KAAK,WAAW,KAAK,IAAI,SAAS,CAAC,CAAA;IAC1E,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Writes the section-kind constants TypeScript and Rust share from `definitions/sections.json`.
|
|
7
|
+
*
|
|
8
|
+
* Usage: `node packages/registry/tools/generate-sections.run.ts [--check]`
|
|
9
|
+
*
|
|
10
|
+
* `--check` exits non-zero when either generated file differs from what the definition produces.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=generate-sections.run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-sections.run.d.ts","sourceRoot":"","sources":["../../tools/generate-sections.run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Writes the section-kind constants TypeScript and Rust share from `definitions/sections.json`.
|
|
7
|
+
*
|
|
8
|
+
* Usage: `node packages/registry/tools/generate-sections.run.ts [--check]`
|
|
9
|
+
*
|
|
10
|
+
* `--check` exits non-zero when either generated file differs from what the definition produces.
|
|
11
|
+
*/
|
|
12
|
+
import { readLocalJSONFile, readLocalTextFile } from "@mailwoman/core/fs/readers";
|
|
13
|
+
import { writeLocalFile } from "@mailwoman/core/fs/writers";
|
|
14
|
+
import { stringifyJSON } from "@mailwoman/core/json";
|
|
15
|
+
import { workspacePath } from "@mailwoman/core/paths";
|
|
16
|
+
import { parseArguments } from "@mailwoman/core/scripting/arguments";
|
|
17
|
+
const { values } = parseArguments({ options: { check: { type: "boolean", default: false } } });
|
|
18
|
+
const registry = (...segments) => workspacePath("registry", ...segments);
|
|
19
|
+
const definitions = await readLocalJSONFile(registry("definitions", "sections.json"));
|
|
20
|
+
const constant = (name) => name.toUpperCase().replaceAll("-", "_");
|
|
21
|
+
const typescript = `/**
|
|
22
|
+
* @copyright Sister Software
|
|
23
|
+
* @license AGPL-3.0
|
|
24
|
+
* @author Teffen Ellis, et al.
|
|
25
|
+
*
|
|
26
|
+
* The RGY1 section kinds. Generated from definitions/sections.json by tools/generate-sections.run.ts. Edit the
|
|
27
|
+
* definition rather than this file.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The four ASCII bytes an artifact starts with.
|
|
32
|
+
*/
|
|
33
|
+
export const RGY1_MAGIC = ${stringifyJSON(definitions.envelope.magic)}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The envelope version this reader implements.
|
|
37
|
+
*/
|
|
38
|
+
export const RGY1_VERSION = ${definitions.envelope.version}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The byte offset of the header JSON, after the fixed envelope fields.
|
|
42
|
+
*/
|
|
43
|
+
export const RGY1_HEADER_OFFSET = ${definitions.envelope.headerOffset}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The byte length of one directory entry.
|
|
47
|
+
*/
|
|
48
|
+
export const RGY1_DIRECTORY_ENTRY_BYTES = ${definitions.envelope.directoryEntryBytes}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The alignment of the directory and of every section payload.
|
|
52
|
+
*/
|
|
53
|
+
export const RGY1_ALIGNMENT = ${definitions.envelope.alignment}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The section flag bit that marks a section required for interpretation.
|
|
57
|
+
*/
|
|
58
|
+
export const RGY1_FLAG_REQUIRED = ${definitions.flags.required}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Each section kind's identifier, as the directory entry stores it.
|
|
62
|
+
*/
|
|
63
|
+
export const SectionKind = {
|
|
64
|
+
${definitions.kinds.map((kind) => `\t${constant(kind.name)}: ${kind.id},`).join("\n")}
|
|
65
|
+
} as const
|
|
66
|
+
|
|
67
|
+
export type SectionKind = (typeof SectionKind)[keyof typeof SectionKind]
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The encoding version each kind is written with.
|
|
71
|
+
*/
|
|
72
|
+
export const SECTION_ENCODING: Readonly<Record<SectionKind, number>> = {
|
|
73
|
+
${definitions.kinds.map((kind) => `\t[SectionKind.${constant(kind.name)}]: ${kind.encoding},`).join("\n")}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Each kind's name, for diagnostics.
|
|
78
|
+
*/
|
|
79
|
+
export const SECTION_NAME: Readonly<Record<SectionKind, string>> = {
|
|
80
|
+
${definitions.kinds.map((kind) => `\t[SectionKind.${constant(kind.name)}]: ${stringifyJSON(kind.name)},`).join("\n")}
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
const rust = `// @copyright Sister Software
|
|
84
|
+
// @license AGPL-3.0
|
|
85
|
+
// @author Teffen Ellis, et al.
|
|
86
|
+
|
|
87
|
+
//! The RGY1 section kinds. Generated from \`definitions/sections.json\` by
|
|
88
|
+
//! \`tools/generate-sections.run.ts\`. Edit the definition rather than this file.
|
|
89
|
+
|
|
90
|
+
pub const MAGIC: &[u8; 4] = b${stringifyJSON(definitions.envelope.magic)};
|
|
91
|
+
pub const VERSION: u16 = ${definitions.envelope.version};
|
|
92
|
+
pub const HEADER_OFFSET: usize = ${definitions.envelope.headerOffset};
|
|
93
|
+
pub const DIRECTORY_ENTRY_BYTES: usize = ${definitions.envelope.directoryEntryBytes};
|
|
94
|
+
pub const ALIGNMENT: usize = ${definitions.envelope.alignment};
|
|
95
|
+
pub const FLAG_REQUIRED: u16 = ${definitions.flags.required};
|
|
96
|
+
|
|
97
|
+
${definitions.kinds.map((kind) => `pub const KIND_${constant(kind.name)}: u16 = ${kind.id};`).join("\n")}
|
|
98
|
+
|
|
99
|
+
/// The encoding version a kind is written with, or \`None\` for an unknown kind.
|
|
100
|
+
pub fn encoding_of(kind: u16) -> Option<u16> {
|
|
101
|
+
\tmatch kind {
|
|
102
|
+
${definitions.kinds.map((kind) => `\t\tKIND_${constant(kind.name)} => Some(${kind.encoding}),`).join("\n")}
|
|
103
|
+
\t\t_ => None,
|
|
104
|
+
\t}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/// The kind's name, for diagnostics.
|
|
108
|
+
pub fn name_of(kind: u16) -> &'static str {
|
|
109
|
+
\tmatch kind {
|
|
110
|
+
${definitions.kinds.map((kind) => `\t\tKIND_${constant(kind.name)} => ${stringifyJSON(kind.name)},`).join("\n")}
|
|
111
|
+
\t\t_ => "unknown",
|
|
112
|
+
\t}
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
const outputs = [
|
|
116
|
+
[registry("lib", "rgy1", "sections.generated.ts"), typescript],
|
|
117
|
+
[registry("crates", "registry-core", "src", "sections.rs"), rust],
|
|
118
|
+
];
|
|
119
|
+
let stale = 0;
|
|
120
|
+
for (const [path, content] of outputs) {
|
|
121
|
+
if (values.check) {
|
|
122
|
+
const current = await readLocalTextFile(path).catch(() => "");
|
|
123
|
+
if (current !== content) {
|
|
124
|
+
console.error(`${path} differs from definitions/sections.json`);
|
|
125
|
+
stale++;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
await writeLocalFile(content, path);
|
|
130
|
+
console.log(`wrote ${path}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (stale) {
|
|
134
|
+
process.exitCode = 1;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=generate-sections.run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-sections.run.js","sourceRoot":"","sources":["../../tools/generate-sections.run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAQpE,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,K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EAAE,OAAO,CAAC,IAAI,OAAO,EAAE,CAAC;IACvC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;QAE7D,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,yCAAyC,CAAC,CAAA;YAE/D,KAAK,EAAE,CAAA;QACR,CAAC;IACF,CAAC;SAAM,CAAC;QACP,MAAM,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAEnC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAA;IAC7B,CAAC;AACF,CAAC;AAED,IAAI,KAAK,EAAE,CAAC;IACX,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=generate.run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.run.d.ts","sourceRoot":"","sources":["../../tools/generate.run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|