@mailwoman/resolver-wof-sqlite 9.1.0 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -20
- package/lib/address/index.ts +9 -0
- package/{address-point-interpolation.ts → lib/address/point-interpolation.ts} +40 -28
- package/{address-point-schema.ts → lib/address/point-schema.ts} +34 -8
- package/lib/address/point.ts +280 -0
- package/{ancestry-backfill.ts → lib/ancestry/backfill.ts} +14 -19
- package/{ancestry.ts → lib/ancestry/index.ts} +13 -8
- package/{build-candidate.ts → lib/build-candidate.ts} +243 -199
- package/{build-slim.ts → lib/build-slim.ts} +153 -168
- package/lib/candidate/alias-bags.ts +56 -0
- package/lib/candidate/ancestors-sidecar.ts +204 -0
- package/lib/candidate/country-display-names.ts +79 -0
- package/lib/candidate/extract-fold.ts +138 -0
- package/lib/candidate/name-roles.ts +238 -0
- package/lib/candidate/own-name.ts +146 -0
- package/lib/candidate/place-attrs.ts +44 -0
- package/lib/candidate-ancestors-schema.ts +195 -0
- package/{candidate-fts.ts → lib/candidate-fts.ts} +7 -5
- package/{candidate-importance.ts → lib/candidate-importance.ts} +54 -57
- package/lib/candidate-lookup.ts +976 -0
- package/{candidate-schema.ts → lib/candidate-schema.ts} +34 -6
- package/lib/candidate-scoring.ts +261 -0
- package/lib/capital-schema.ts +89 -0
- package/lib/capitals.ts +148 -0
- package/{coincident-roles.ts → lib/coincident-roles.ts} +75 -19
- package/{convention.ts → lib/convention/index.ts} +5 -5
- package/lib/convention/schema.ts +72 -0
- package/{coverage-manifest-schema.ts → lib/coverage-manifest-schema.ts} +15 -16
- package/lib/currency-backfill.ts +334 -0
- package/lib/env.ts +50 -0
- package/lib/exact-match.ts +113 -0
- package/{sharding.ts → lib/extracts.ts} +63 -60
- package/lib/fst/autocomplete.ts +176 -0
- package/{fst-builder.ts → lib/fst/builder.ts} +30 -27
- package/{fst-deserialize-web.ts → lib/fst/deserialize-web.ts} +27 -87
- package/lib/fst/format.ts +106 -0
- package/{fst-freshness.ts → lib/fst/freshness.ts} +42 -75
- package/lib/fst/index.ts +14 -0
- package/{fst-matcher.ts → lib/fst/matcher.ts} +1 -1
- package/{fst-serialize.ts → lib/fst/serialize.ts} +37 -115
- package/{fst-types.ts → lib/fst/types.ts} +4 -2
- package/{fts.ts → lib/fts/index.ts} +28 -23
- package/{fts-query.ts → lib/fts/query.ts} +2 -2
- package/{geonames-aliases.ts → lib/geonames/aliases.ts} +13 -13
- package/lib/geonames/index.ts +8 -0
- package/{geonames-postal.ts → lib/geonames/postal.ts} +16 -15
- package/{index.ts → lib/index.ts} +52 -48
- package/{interpolation.ts → lib/interpolation.ts} +137 -41
- package/lib/lookup.ts +861 -0
- package/{name-score.ts → lib/name-score.ts} +6 -4
- package/lib/nsul/index.ts +8 -0
- package/lib/nsul/lookup.ts +144 -0
- package/lib/nsul/schema.ts +130 -0
- package/{place-importance-schema.ts → lib/place-importance-schema.ts} +70 -22
- package/lib/poi/index.ts +8 -0
- package/{poi-lookup.ts → lib/poi/lookup.ts} +32 -39
- package/{poi-schema.ts → lib/poi/schema.ts} +10 -6
- package/lib/polygon-schema.ts +47 -0
- package/{postal-city-alias-lookup.ts → lib/postal/city-alias-lookup.ts} +15 -21
- package/{postal-city-candidate-schema.ts → lib/postal/city-candidate-schema.ts} +4 -2
- package/lib/postal/index.ts +9 -0
- package/{postcode-point-lookup.ts → lib/postcode-point-lookup.ts} +17 -15
- package/lib/primary-preference.ts +226 -0
- package/lib/proximity-rerank.ts +120 -0
- package/{ranking-weights.ts → lib/ranking-weights.ts} +30 -4
- package/lib/region-keys.ts +144 -0
- package/{reverse.ts → lib/reverse.ts} +45 -56
- package/{schema.ts → lib/schema.ts} +11 -1
- package/lib/search-fetch.ts +257 -0
- package/{sqlite-convention-source.ts → lib/sqlite-convention-source.ts} +9 -10
- package/lib/sqlite-utils.ts +83 -0
- package/{street-centroid-schema.ts → lib/street/centroid-schema.ts} +12 -6
- package/{street-centroid.ts → lib/street/centroid.ts} +26 -28
- package/lib/street/index.ts +13 -0
- package/{street-morphology-fst-builder.ts → lib/street/morphology-fst-builder.ts} +24 -14
- package/{street-morphology-fst-loader.ts → lib/street/morphology-fst-loader.ts} +14 -12
- package/{street-name-lookup.ts → lib/street/name-lookup.ts} +14 -30
- package/lib/street/normalize.ts +572 -0
- package/{street-segment-schema.ts → lib/street/segment-schema.ts} +13 -8
- package/{types.ts → lib/types.ts} +49 -9
- package/{unified-schema.ts → lib/unified-schema.ts} +21 -25
- package/lib/uprn/existence.ts +84 -0
- package/lib/uprn/index.ts +9 -0
- package/lib/uprn/lookup.ts +206 -0
- package/lib/uprn/schema.ts +124 -0
- package/lib/weights-overlay-linker.ts +878 -0
- package/out/address/index.d.ts +9 -0
- package/out/address/index.d.ts.map +1 -0
- package/out/address/index.js +9 -0
- package/out/address/index.js.map +1 -0
- package/out/{address-point-interpolation.d.ts → address/point-interpolation.d.ts} +11 -10
- package/out/address/point-interpolation.d.ts.map +1 -0
- package/out/{address-point-interpolation.js → address/point-interpolation.js} +29 -23
- package/out/address/point-interpolation.js.map +1 -0
- package/out/{address-point-schema.d.ts → address/point-schema.d.ts} +30 -10
- package/out/address/point-schema.d.ts.map +1 -0
- package/out/{address-point-schema.js → address/point-schema.js} +7 -3
- package/out/address/point-schema.js.map +1 -0
- package/out/{address-point.d.ts → address/point.d.ts} +16 -8
- package/out/address/point.d.ts.map +1 -0
- package/out/address/point.js +191 -0
- package/out/address/point.js.map +1 -0
- package/out/{ancestry-backfill.d.ts → ancestry/backfill.d.ts} +7 -5
- package/out/ancestry/backfill.d.ts.map +1 -0
- package/out/{ancestry-backfill.js → ancestry/backfill.js} +12 -16
- package/out/ancestry/backfill.js.map +1 -0
- package/out/{ancestry.d.ts → ancestry/index.d.ts} +6 -5
- package/out/ancestry/index.d.ts.map +1 -0
- package/out/{ancestry.js → ancestry/index.js} +7 -7
- package/out/ancestry/index.js.map +1 -0
- package/out/build-candidate.d.ts +88 -7
- package/out/build-candidate.d.ts.map +1 -1
- package/out/build-candidate.js +145 -149
- package/out/build-candidate.js.map +1 -1
- package/out/build-slim.d.ts +5 -5
- package/out/build-slim.d.ts.map +1 -1
- package/out/build-slim.js +127 -142
- package/out/build-slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +19 -0
- package/out/candidate/alias-bags.d.ts.map +1 -0
- package/out/candidate/alias-bags.js +39 -0
- package/out/candidate/alias-bags.js.map +1 -0
- package/out/candidate/ancestors-sidecar.d.ts +32 -0
- package/out/candidate/ancestors-sidecar.d.ts.map +1 -0
- package/out/candidate/ancestors-sidecar.js +140 -0
- package/out/candidate/ancestors-sidecar.js.map +1 -0
- package/out/candidate/country-display-names.d.ts +35 -0
- package/out/candidate/country-display-names.d.ts.map +1 -0
- package/out/candidate/country-display-names.js +59 -0
- package/out/candidate/country-display-names.js.map +1 -0
- package/out/candidate/extract-fold.d.ts +32 -0
- package/out/candidate/extract-fold.d.ts.map +1 -0
- package/out/candidate/extract-fold.js +104 -0
- package/out/candidate/extract-fold.js.map +1 -0
- package/out/candidate/name-roles.d.ts +57 -0
- package/out/candidate/name-roles.d.ts.map +1 -0
- package/out/candidate/name-roles.js +166 -0
- package/out/candidate/name-roles.js.map +1 -0
- package/out/candidate/own-name.d.ts +50 -0
- package/out/candidate/own-name.d.ts.map +1 -0
- package/out/candidate/own-name.js +132 -0
- package/out/candidate/own-name.js.map +1 -0
- package/out/candidate/place-attrs.d.ts +43 -0
- package/out/candidate/place-attrs.d.ts.map +1 -0
- package/out/candidate/place-attrs.js +15 -0
- package/out/candidate/place-attrs.js.map +1 -0
- package/out/candidate-ancestors-schema.d.ts +150 -0
- package/out/candidate-ancestors-schema.d.ts.map +1 -0
- package/out/candidate-ancestors-schema.js +123 -0
- package/out/candidate-ancestors-schema.js.map +1 -0
- package/out/candidate-fts.d.ts +7 -5
- package/out/candidate-fts.d.ts.map +1 -1
- package/out/candidate-fts.js +5 -3
- package/out/candidate-fts.js.map +1 -1
- package/out/candidate-importance.d.ts +16 -16
- package/out/candidate-importance.d.ts.map +1 -1
- package/out/candidate-importance.js +47 -52
- package/out/candidate-importance.js.map +1 -1
- package/out/candidate-lookup.d.ts +31 -52
- package/out/candidate-lookup.d.ts.map +1 -1
- package/out/candidate-lookup.js +380 -172
- package/out/candidate-lookup.js.map +1 -1
- package/out/candidate-schema.d.ts +31 -7
- package/out/candidate-schema.d.ts.map +1 -1
- package/out/candidate-schema.js +3 -0
- package/out/candidate-schema.js.map +1 -1
- package/out/candidate-scoring.d.ts +34 -0
- package/out/candidate-scoring.d.ts.map +1 -0
- package/out/candidate-scoring.js +196 -0
- package/out/candidate-scoring.js.map +1 -0
- package/out/capital-schema.d.ts +51 -0
- package/out/capital-schema.d.ts.map +1 -0
- package/out/capital-schema.js +63 -0
- package/out/capital-schema.js.map +1 -0
- package/out/capitals.d.ts +69 -0
- package/out/capitals.d.ts.map +1 -0
- package/out/capitals.js +98 -0
- package/out/capitals.js.map +1 -0
- package/out/coincident-roles.d.ts +12 -4
- package/out/coincident-roles.d.ts.map +1 -1
- package/out/coincident-roles.js +43 -11
- package/out/coincident-roles.js.map +1 -1
- package/out/{convention.d.ts → convention/index.d.ts} +5 -5
- package/out/convention/index.d.ts.map +1 -0
- package/out/{convention.js → convention/index.js} +4 -4
- package/out/convention/index.js.map +1 -0
- package/out/convention/schema.d.ts +51 -0
- package/out/convention/schema.d.ts.map +1 -0
- package/out/convention/schema.js +34 -0
- package/out/convention/schema.js.map +1 -0
- package/out/coverage-manifest-schema.d.ts +8 -8
- package/out/coverage-manifest-schema.d.ts.map +1 -1
- package/out/coverage-manifest-schema.js +6 -10
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/currency-backfill.d.ts +90 -0
- package/out/currency-backfill.d.ts.map +1 -0
- package/out/currency-backfill.js +196 -0
- package/out/currency-backfill.js.map +1 -0
- package/out/env.d.ts +43 -0
- package/out/env.d.ts.map +1 -0
- package/out/env.js +48 -0
- package/out/env.js.map +1 -0
- package/out/exact-match.d.ts +25 -0
- package/out/exact-match.d.ts.map +1 -0
- package/out/exact-match.js +88 -0
- package/out/exact-match.js.map +1 -0
- package/out/extracts.d.ts +114 -0
- package/out/extracts.d.ts.map +1 -0
- package/out/{sharding.js → extracts.js} +38 -38
- package/out/extracts.js.map +1 -0
- package/out/{fst-autocomplete.d.ts → fst/autocomplete.d.ts} +13 -13
- package/out/fst/autocomplete.d.ts.map +1 -0
- package/out/fst/autocomplete.js +113 -0
- package/out/fst/autocomplete.js.map +1 -0
- package/out/{fst-builder.d.ts → fst/builder.d.ts} +5 -5
- package/out/fst/builder.d.ts.map +1 -0
- package/out/{fst-builder.js → fst/builder.js} +24 -24
- package/out/fst/builder.js.map +1 -0
- package/out/{fst-deserialize-web.d.ts → fst/deserialize-web.d.ts} +3 -3
- package/out/fst/deserialize-web.d.ts.map +1 -0
- package/out/{fst-deserialize-web.js → fst/deserialize-web.js} +10 -74
- package/out/fst/deserialize-web.js.map +1 -0
- package/out/fst/format.d.ts +80 -0
- package/out/fst/format.d.ts.map +1 -0
- package/out/fst/format.js +91 -0
- package/out/fst/format.js.map +1 -0
- package/out/{fst-freshness.d.ts → fst/freshness.d.ts} +11 -14
- package/out/fst/freshness.d.ts.map +1 -0
- package/out/{fst-freshness.js → fst/freshness.js} +42 -74
- package/out/fst/freshness.js.map +1 -0
- package/out/fst/index.d.ts +14 -0
- package/out/fst/index.d.ts.map +1 -0
- package/out/fst/index.js +14 -0
- package/out/fst/index.js.map +1 -0
- package/out/{fst-matcher.d.ts → fst/matcher.d.ts} +2 -2
- package/out/fst/matcher.d.ts.map +1 -0
- package/out/{fst-matcher.js → fst/matcher.js} +1 -1
- package/out/fst/matcher.js.map +1 -0
- package/out/{fst-serialize.d.ts → fst/serialize.d.ts} +5 -10
- package/out/fst/serialize.d.ts.map +1 -0
- package/out/{fst-serialize.js → fst/serialize.js} +18 -98
- package/out/fst/serialize.js.map +1 -0
- package/out/{fst-types.d.ts → fst/types.d.ts} +4 -3
- package/out/fst/types.d.ts.map +1 -0
- package/out/{fst-types.js → fst/types.js} +1 -1
- package/out/fst/types.js.map +1 -0
- package/out/{fts.d.ts → fts/index.d.ts} +20 -13
- package/out/fts/index.d.ts.map +1 -0
- package/out/{fts.js → fts/index.js} +20 -15
- package/out/fts/index.js.map +1 -0
- package/out/{fts-query.d.ts → fts/query.d.ts} +2 -2
- package/out/fts/query.d.ts.map +1 -0
- package/out/{fts-query.js → fts/query.js} +2 -2
- package/out/fts/query.js.map +1 -0
- package/out/{geonames-aliases.d.ts → geonames/aliases.d.ts} +8 -6
- package/out/geonames/aliases.d.ts.map +1 -0
- package/out/{geonames-aliases.js → geonames/aliases.js} +7 -7
- package/out/geonames/aliases.js.map +1 -0
- package/out/geonames/index.d.ts +8 -0
- package/out/geonames/index.d.ts.map +1 -0
- package/out/geonames/index.js +8 -0
- package/out/geonames/index.js.map +1 -0
- package/out/{geonames-postal.d.ts → geonames/postal.d.ts} +12 -10
- package/out/geonames/postal.d.ts.map +1 -0
- package/out/{geonames-postal.js → geonames/postal.js} +11 -11
- package/out/geonames/postal.js.map +1 -0
- package/out/index.d.ts +32 -31
- package/out/index.d.ts.map +1 -1
- package/out/index.js +24 -24
- package/out/index.js.map +1 -1
- package/out/interpolation.d.ts +18 -9
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +108 -36
- package/out/interpolation.js.map +1 -1
- package/out/lookup.d.ts +25 -25
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +174 -558
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts +0 -10
- package/out/name-score.d.ts.map +1 -1
- package/out/name-score.js +6 -4
- package/out/name-score.js.map +1 -1
- package/out/nsul/index.d.ts +8 -0
- package/out/nsul/index.d.ts.map +1 -0
- package/out/nsul/index.js +8 -0
- package/out/nsul/index.js.map +1 -0
- package/out/nsul/lookup.d.ts +83 -0
- package/out/nsul/lookup.d.ts.map +1 -0
- package/out/nsul/lookup.js +80 -0
- package/out/nsul/lookup.js.map +1 -0
- package/out/nsul/schema.d.ts +100 -0
- package/out/nsul/schema.d.ts.map +1 -0
- package/out/nsul/schema.js +78 -0
- package/out/nsul/schema.js.map +1 -0
- package/out/place-importance-schema.d.ts +47 -10
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +56 -10
- package/out/place-importance-schema.js.map +1 -1
- package/out/poi/index.d.ts +8 -0
- package/out/poi/index.d.ts.map +1 -0
- package/out/poi/index.js +8 -0
- package/out/poi/index.js.map +1 -0
- package/out/{poi-lookup.d.ts → poi/lookup.d.ts} +8 -10
- package/out/poi/lookup.d.ts.map +1 -0
- package/out/{poi-lookup.js → poi/lookup.js} +24 -29
- package/out/poi/lookup.js.map +1 -0
- package/out/{poi-schema.d.ts → poi/schema.d.ts} +10 -6
- package/out/poi/schema.d.ts.map +1 -0
- package/out/{poi-schema.js → poi/schema.js} +1 -1
- package/out/poi/schema.js.map +1 -0
- package/out/polygon-schema.d.ts +37 -0
- package/out/polygon-schema.d.ts.map +1 -0
- package/out/polygon-schema.js +23 -0
- package/out/polygon-schema.js.map +1 -0
- package/out/{postal-city-alias-lookup.d.ts → postal/city-alias-lookup.d.ts} +7 -6
- package/out/postal/city-alias-lookup.d.ts.map +1 -0
- package/out/{postal-city-alias-lookup.js → postal/city-alias-lookup.js} +12 -16
- package/out/postal/city-alias-lookup.js.map +1 -0
- package/out/{postal-city-alias-schema.d.ts → postal/city-alias-schema.d.ts} +1 -1
- package/out/{postal-city-alias-schema.d.ts.map → postal/city-alias-schema.d.ts.map} +1 -1
- package/out/{postal-city-alias-schema.js → postal/city-alias-schema.js} +1 -1
- package/out/{postal-city-alias-schema.js.map → postal/city-alias-schema.js.map} +1 -1
- package/out/{postal-city-candidate-schema.d.ts → postal/city-candidate-schema.d.ts} +4 -3
- package/out/postal/city-candidate-schema.d.ts.map +1 -0
- package/out/{postal-city-candidate-schema.js → postal/city-candidate-schema.js} +2 -2
- package/out/{postal-city-candidate-schema.js.map → postal/city-candidate-schema.js.map} +1 -1
- package/out/postal/index.d.ts +9 -0
- package/out/postal/index.d.ts.map +1 -0
- package/out/postal/index.js +9 -0
- package/out/postal/index.js.map +1 -0
- package/out/postcode-point-lookup.d.ts +10 -10
- package/out/postcode-point-lookup.d.ts.map +1 -1
- package/out/postcode-point-lookup.js +13 -13
- package/out/postcode-point-lookup.js.map +1 -1
- package/out/primary-preference.d.ts +133 -0
- package/out/primary-preference.d.ts.map +1 -0
- package/out/primary-preference.js +146 -0
- package/out/primary-preference.js.map +1 -0
- package/out/proximity-rerank.d.ts +77 -0
- package/out/proximity-rerank.d.ts.map +1 -0
- package/out/proximity-rerank.js +86 -0
- package/out/proximity-rerank.js.map +1 -0
- package/out/ranking-weights.d.ts +15 -3
- package/out/ranking-weights.d.ts.map +1 -1
- package/out/ranking-weights.js +21 -3
- package/out/ranking-weights.js.map +1 -1
- package/out/region-keys.d.ts +47 -0
- package/out/region-keys.d.ts.map +1 -0
- package/out/region-keys.js +121 -0
- package/out/region-keys.js.map +1 -0
- package/out/reverse.d.ts +6 -6
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +23 -35
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +10 -1
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js.map +1 -1
- package/out/search-fetch.d.ts +59 -0
- package/out/search-fetch.d.ts.map +1 -0
- package/out/search-fetch.js +184 -0
- package/out/search-fetch.js.map +1 -0
- package/out/sqlite-convention-source.d.ts +7 -7
- package/out/sqlite-convention-source.d.ts.map +1 -1
- package/out/sqlite-convention-source.js +5 -5
- package/out/sqlite-convention-source.js.map +1 -1
- package/out/sqlite-utils.d.ts +24 -6
- package/out/sqlite-utils.d.ts.map +1 -1
- package/out/sqlite-utils.js +24 -7
- package/out/sqlite-utils.js.map +1 -1
- package/out/{street-centroid-schema.d.ts → street/centroid-schema.d.ts} +12 -7
- package/out/street/centroid-schema.d.ts.map +1 -0
- package/out/{street-centroid-schema.js → street/centroid-schema.js} +5 -5
- package/out/{street-centroid-schema.js.map → street/centroid-schema.js.map} +1 -1
- package/out/{street-centroid.d.ts → street/centroid.d.ts} +6 -6
- package/out/street/centroid.d.ts.map +1 -0
- package/out/{street-centroid.js → street/centroid.js} +18 -24
- package/out/street/centroid.js.map +1 -0
- package/out/street/index.d.ts +13 -0
- package/out/street/index.d.ts.map +1 -0
- package/out/street/index.js +13 -0
- package/out/street/index.js.map +1 -0
- package/out/{street-morphology-fst-builder.d.ts → street/morphology-fst-builder.d.ts} +4 -4
- package/out/street/morphology-fst-builder.d.ts.map +1 -0
- package/out/{street-morphology-fst-builder.js → street/morphology-fst-builder.js} +18 -13
- package/out/street/morphology-fst-builder.js.map +1 -0
- package/out/{street-morphology-fst-loader.d.ts → street/morphology-fst-loader.d.ts} +5 -5
- package/out/street/morphology-fst-loader.d.ts.map +1 -0
- package/out/{street-morphology-fst-loader.js → street/morphology-fst-loader.js} +11 -10
- package/out/street/morphology-fst-loader.js.map +1 -0
- package/out/{street-name-lookup.d.ts → street/name-lookup.d.ts} +4 -7
- package/out/street/name-lookup.d.ts.map +1 -0
- package/out/{street-name-lookup.js → street/name-lookup.js} +9 -23
- package/out/street/name-lookup.js.map +1 -0
- package/out/street/normalize.d.ts +179 -0
- package/out/street/normalize.d.ts.map +1 -0
- package/out/street/normalize.js +457 -0
- package/out/street/normalize.js.map +1 -0
- package/out/{street-segment-schema.d.ts → street/segment-schema.d.ts} +13 -9
- package/out/street/segment-schema.d.ts.map +1 -0
- package/out/{street-segment-schema.js → street/segment-schema.js} +4 -4
- package/out/{street-segment-schema.js.map → street/segment-schema.js.map} +1 -1
- package/out/types.d.ts +49 -9
- package/out/types.d.ts.map +1 -1
- package/out/types.js.map +1 -1
- package/out/unified-schema.d.ts +6 -5
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +16 -19
- package/out/unified-schema.js.map +1 -1
- package/out/uprn/existence.d.ts +53 -0
- package/out/uprn/existence.d.ts.map +1 -0
- package/out/uprn/existence.js +61 -0
- package/out/uprn/existence.js.map +1 -0
- package/out/uprn/index.d.ts +9 -0
- package/out/uprn/index.d.ts.map +1 -0
- package/out/uprn/index.js +9 -0
- package/out/uprn/index.js.map +1 -0
- package/out/uprn/lookup.d.ts +85 -0
- package/out/uprn/lookup.d.ts.map +1 -0
- package/out/uprn/lookup.js +149 -0
- package/out/uprn/lookup.js.map +1 -0
- package/out/uprn/schema.d.ts +93 -0
- package/out/uprn/schema.d.ts.map +1 -0
- package/out/uprn/schema.js +78 -0
- package/out/uprn/schema.js.map +1 -0
- package/out/weights-overlay-linker.d.ts +299 -0
- package/out/weights-overlay-linker.d.ts.map +1 -0
- package/out/weights-overlay-linker.js +511 -0
- package/out/weights-overlay-linker.js.map +1 -0
- package/package.json +622 -154
- package/address-point.ts +0 -125
- package/candidate-lookup.ts +0 -720
- package/fst-autocomplete.ts +0 -204
- package/geo.ts +0 -121
- package/lookup.ts +0 -1354
- package/out/address-point-interpolation.d.ts.map +0 -1
- package/out/address-point-interpolation.js.map +0 -1
- package/out/address-point-schema.d.ts.map +0 -1
- package/out/address-point-schema.js.map +0 -1
- package/out/address-point.d.ts.map +0 -1
- package/out/address-point.js +0 -84
- package/out/address-point.js.map +0 -1
- package/out/ancestry-backfill.d.ts.map +0 -1
- package/out/ancestry-backfill.js.map +0 -1
- package/out/ancestry.d.ts.map +0 -1
- package/out/ancestry.js.map +0 -1
- package/out/convention.d.ts.map +0 -1
- package/out/convention.js.map +0 -1
- package/out/fst-autocomplete.d.ts.map +0 -1
- package/out/fst-autocomplete.js +0 -130
- package/out/fst-autocomplete.js.map +0 -1
- package/out/fst-builder.d.ts.map +0 -1
- package/out/fst-builder.js.map +0 -1
- package/out/fst-deserialize-web.d.ts.map +0 -1
- package/out/fst-deserialize-web.js.map +0 -1
- package/out/fst-freshness.d.ts.map +0 -1
- package/out/fst-freshness.js.map +0 -1
- package/out/fst-matcher.d.ts.map +0 -1
- package/out/fst-matcher.js.map +0 -1
- package/out/fst-serialize.d.ts.map +0 -1
- package/out/fst-serialize.js.map +0 -1
- package/out/fst-types.d.ts.map +0 -1
- package/out/fst-types.js.map +0 -1
- package/out/fts-query.d.ts.map +0 -1
- package/out/fts-query.js.map +0 -1
- package/out/fts.d.ts.map +0 -1
- package/out/fts.js.map +0 -1
- package/out/geo.d.ts +0 -74
- package/out/geo.d.ts.map +0 -1
- package/out/geo.js +0 -71
- package/out/geo.js.map +0 -1
- package/out/geonames-aliases.d.ts.map +0 -1
- package/out/geonames-aliases.js.map +0 -1
- package/out/geonames-postal.d.ts.map +0 -1
- package/out/geonames-postal.js.map +0 -1
- package/out/poi-lookup.d.ts.map +0 -1
- package/out/poi-lookup.js.map +0 -1
- package/out/poi-schema.d.ts.map +0 -1
- package/out/poi-schema.js.map +0 -1
- package/out/postal-city-alias-lookup.d.ts.map +0 -1
- package/out/postal-city-alias-lookup.js.map +0 -1
- package/out/postal-city-candidate-schema.d.ts.map +0 -1
- package/out/sharding.d.ts +0 -114
- package/out/sharding.d.ts.map +0 -1
- package/out/sharding.js.map +0 -1
- package/out/street-centroid-schema.d.ts.map +0 -1
- package/out/street-centroid.d.ts.map +0 -1
- package/out/street-centroid.js.map +0 -1
- package/out/street-morphology-fst-builder.d.ts.map +0 -1
- package/out/street-morphology-fst-builder.js.map +0 -1
- package/out/street-morphology-fst-loader.d.ts.map +0 -1
- package/out/street-morphology-fst-loader.js.map +0 -1
- package/out/street-name-lookup.d.ts.map +0 -1
- package/out/street-name-lookup.js.map +0 -1
- package/out/street-normalize.d.ts +0 -95
- package/out/street-normalize.d.ts.map +0 -1
- package/out/street-normalize.js +0 -272
- package/out/street-normalize.js.map +0 -1
- package/out/street-segment-schema.d.ts.map +0 -1
- package/sqlite-utils.ts +0 -46
- package/street-normalize.ts +0 -318
- /package/{postal-city-alias-schema.ts → lib/postal/city-alias-schema.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../lib/geonames/aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAIpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,gBAAoB,CAAA;AAQjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAY1F;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;CAChB;AAqFD;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAC1C,EAAE,EAAE,cAAc,CAAC,WAAW,CAAC,EAC/B,SAAS,EAAE,MAAM,EAAE,EACnB,WAAW,EAAE,eAAe,EAC5B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,EACpD,IAAI,CAAC,EAAE;IACN;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACvC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,eAAe,CAAA;CAC9B,GACC,OAAO,CAAC,MAAM,CAAC,CA8MjB"}
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
* ONE implementation. GeoNames dump = `download.geonames.org/export/dump/<CC>.zip` → `<CC>.txt`
|
|
24
24
|
* (TSV).
|
|
25
25
|
*/
|
|
26
|
-
import { existsSync } from "node:fs";
|
|
27
26
|
import { isOfficialLanguage } from "@mailwoman/codex/country";
|
|
27
|
+
import { pathExists } from "@mailwoman/core/fs/readers";
|
|
28
28
|
import { join } from "path-ts";
|
|
29
29
|
import { TSVSpliterator } from "spliterator";
|
|
30
|
-
import { GEONAMES_POSTAL_ID_BASE } from "
|
|
30
|
+
import { GEONAMES_POSTAL_ID_BASE } from "#geonames/postal";
|
|
31
31
|
/**
|
|
32
32
|
* Synthetic id base for GeoNames-sourced rows (#743/#193) — above Overture's 8e12 so the three sources (WOF real ids,
|
|
33
33
|
* Overture, GeoNames) never collide in a combined DB.
|
|
@@ -55,7 +55,7 @@ const FOLD_OWNED_TABLES = ["spr", "names", "place_population", "ancestors"];
|
|
|
55
55
|
* country. Gaborone/BW at id 9000000121151 became Aichegg/AT and kept all 26 of its names; Kinshasa's 16,000,000
|
|
56
56
|
* population landed on a Lithuanian hamlet.
|
|
57
57
|
*
|
|
58
|
-
* The upper bound is NOT the end of the id space. Each later
|
|
58
|
+
* The upper bound is NOT the end of the id space. Each later extract owns a range above this one — GeoNames-postal @
|
|
59
59
|
* 9.5e12, NL-PC6 @ 9.6e12, Code-Point @ 9.7e12, NI @ 9.8e12 — and a purge that ran past {@link GEONAMES_POSTAL_ID_BASE}
|
|
60
60
|
* would delete them.
|
|
61
61
|
*/
|
|
@@ -82,7 +82,7 @@ async function parseAlternateNamesV2(v2File, cc, wanted) {
|
|
|
82
82
|
// spelling across rows — Malabo carries "Santa Isabel" as (es, unflagged) AND as (no-language,
|
|
83
83
|
// isHistoric=1, to=1973). Officialness must see the flags from EVERY row for the spelling, or the
|
|
84
84
|
// colonial-era name sails through on the language-tagged row (the #936 review's Malabo finding).
|
|
85
|
-
// Do NOT
|
|
85
|
+
// Do NOT condition on isPreferredName instead — it's sparse annotation, not a signal (Turku's sv "Åbo"
|
|
86
86
|
// is unflagged; FI has 1,746 flags across the whole dump).
|
|
87
87
|
//
|
|
88
88
|
// Both passes STREAM the file rather than sharing one materialized array: NO's V2 dump is 33 MB,
|
|
@@ -171,7 +171,7 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
|
|
|
171
171
|
purgeGeonamesAliasRange(db);
|
|
172
172
|
for (const cc of countries) {
|
|
173
173
|
const file = join(geonamesDir, `${cc}.txt`);
|
|
174
|
-
if (!
|
|
174
|
+
if (!(await pathExists(file))) {
|
|
175
175
|
report({ country: cc, places: 0, skipped: true }, file);
|
|
176
176
|
continue;
|
|
177
177
|
}
|
|
@@ -179,7 +179,7 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
|
|
|
179
179
|
// #267: add A-class admin + ancestry only for the gap countries this country is in (never the EU set).
|
|
180
180
|
const addAdmin = opts?.adminForCountries?.has(cc) ?? false;
|
|
181
181
|
const v2File = opts?.alternateDir ? join(opts.alternateDir, `${cc}.txt`) : undefined;
|
|
182
|
-
const readV2 = Boolean(v2File &&
|
|
182
|
+
const readV2 = Boolean(v2File && (await pathExists(v2File)));
|
|
183
183
|
// Survey pass. The dump is STREAMED — NO's is 71 MB and only the caller knows which country
|
|
184
184
|
// comes next — so what a later pass needs has to be collected here rather than re-scanned off a
|
|
185
185
|
// materialized array. Two things qualify, and both are small: the P-class geonameid set the V2
|
|
@@ -303,4 +303,4 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
|
|
|
303
303
|
db.exec("COMMIT");
|
|
304
304
|
return total;
|
|
305
305
|
}
|
|
306
|
-
//# sourceMappingURL=
|
|
306
|
+
//# sourceMappingURL=aliases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliases.js","sourceRoot":"","sources":["../../lib/geonames/aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,IAAI,EAAwB,MAAM,SAAS,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/geonames/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* #920 — fold GeoNames POSTAL codes into a WOF/unified postcode
|
|
6
|
+
* #920 — fold GeoNames POSTAL codes into a WOF/unified postcode extract as first-class
|
|
7
7
|
* `postalcode` places, for the countries whose WOF postalcode repos don't exist (the
|
|
8
8
|
* namesake-tail locales: FI/CZ/SK/SI/DK/NO/HR/PL and any future gap).
|
|
9
9
|
*
|
|
10
10
|
* Why: the night-31 taxonomy measured the cross-locale resolve tail as NAMESAKE COLLISION
|
|
11
|
-
* (FI 300/1k … PL 75/1k offender rows), and the controlled experiment showed postcode-
|
|
11
|
+
* (FI 300/1k … PL 75/1k offender rows), and the controlled experiment showed postcode-extract
|
|
12
12
|
* coverage alone collapses it (FI 300→1, CZ 131→4): a resolvable postcode node feeds the
|
|
13
13
|
* resolver's coordinate-first sibling-postcode candidate injection, which binds the locality
|
|
14
|
-
* pick to its postcode neighborhood. The
|
|
14
|
+
* pick to its postcode neighborhood. The implementation already ships; it was coverage-starved.
|
|
15
15
|
*
|
|
16
16
|
* Two hard-won laws from the experiment are enforced HERE, in code, not in a runbook:
|
|
17
17
|
*
|
|
@@ -30,10 +30,12 @@
|
|
|
30
30
|
* --geonames-postal-countries`, any standalone fold, and the `mailwoman gazetteer` commands
|
|
31
31
|
* share ONE implementation. GeoNames postal dump = `download.geonames.org/export/zip/<CC>.zip`
|
|
32
32
|
* → `<CC>.txt` (TSV: country, postcode, place, admin1, code1, admin2, code2, admin3, code3,
|
|
33
|
-
* lat, lon, accuracy). License CC BY 4.0 — attribution rides the
|
|
33
|
+
* lat, lon, accuracy). License CC BY 4.0 — attribution rides the extract's `meta` provenance and
|
|
34
34
|
* the model card like the existing GeoNames alias fold.
|
|
35
35
|
*/
|
|
36
|
-
import type {
|
|
36
|
+
import type { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
37
|
+
import { type PathBuilderLike } from "path-ts";
|
|
38
|
+
import type { WOFDatabase } from "#schema";
|
|
37
39
|
/**
|
|
38
40
|
* Synthetic id base for GeoNames-POSTAL rows — its own namespace above the alias fold's {@link GEONAMES_ID_BASE} (9e12)
|
|
39
41
|
* allocation so all four sources (WOF, Overture, GeoNames-alias, GeoNames-postal) coexist collision-free in a combined
|
|
@@ -41,7 +43,7 @@ import type { DatabaseSync } from "node:sqlite";
|
|
|
41
43
|
*/
|
|
42
44
|
export declare const GEONAMES_POSTAL_ID_BASE = 9500000000000;
|
|
43
45
|
/**
|
|
44
|
-
* The #920 name law: reduce a
|
|
46
|
+
* The #920 name law: reduce a postcode to the sanitized-query token shape — strip every non-letter/number — so the
|
|
45
47
|
* stored name matches what `sanitizeFTSQuery` produces from the parsed postcode token. `"110 00"` → `"11000"`,
|
|
46
48
|
* `"11-041"` → `"11041"`, `"AD500"` → `"AD500"`.
|
|
47
49
|
*/
|
|
@@ -60,7 +62,7 @@ export type PostcodePoint = readonly [number, number];
|
|
|
60
62
|
*
|
|
61
63
|
* Distance is squared-Euclidean in DEGREES, not haversine. At the scale a postcode spans, the ranking the two produce
|
|
62
64
|
* is the same, and this one carries no trig into a per-group inner loop. Ties go to the earliest member, which makes
|
|
63
|
-
* the result a pure function of the input order — the property a rebuilt
|
|
65
|
+
* the result a pure function of the input order — the property a rebuilt extract's ids depend on.
|
|
64
66
|
*
|
|
65
67
|
* Exported (rather than inlined at each ingest) because it is the second half of the #920 pair: every postcode source
|
|
66
68
|
* that groups member points — GeoNames postal, OSM `addr:postcode` — owes the same law, and a second hand-rolled copy
|
|
@@ -82,10 +84,10 @@ export interface GeonamesPostalIngestResult {
|
|
|
82
84
|
missing: string[];
|
|
83
85
|
}
|
|
84
86
|
/**
|
|
85
|
-
* Fold GeoNames
|
|
87
|
+
* Fold GeoNames postcodes for `countries` into an open unified/postcode ingest DB: one `spr` row per distinct
|
|
86
88
|
* normalized postcode (placetype `postalcode`, medoid centroid, degenerate bbox), the normalized form as `name`, and
|
|
87
89
|
* the display form as an extra `names` row when it differs. The caller owns the FTS rebuild (rows ride the standard
|
|
88
90
|
* freeze phase).
|
|
89
91
|
*/
|
|
90
|
-
export declare function ingestGeonamesPostal(db:
|
|
91
|
-
//# sourceMappingURL=
|
|
92
|
+
export declare function ingestGeonamesPostal(db: DatabaseClient<WOFDatabase>, countries: readonly string[], postalDir: PathBuilderLike): Promise<GeonamesPostalIngestResult>;
|
|
93
|
+
//# sourceMappingURL=postal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postal.d.ts","sourceRoot":"","sources":["../../lib/geonames/postal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAQ1C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,gBAAoB,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAErD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,aAAa,CA+B3E;AAED,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACzC,EAAE,EAAE,cAAc,CAAC,WAAW,CAAC,EAC/B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,SAAS,EAAE,eAAe,GACxB,OAAO,CAAC,0BAA0B,CAAC,CAsErC"}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* #920 — fold GeoNames POSTAL codes into a WOF/unified postcode
|
|
6
|
+
* #920 — fold GeoNames POSTAL codes into a WOF/unified postcode extract as first-class
|
|
7
7
|
* `postalcode` places, for the countries whose WOF postalcode repos don't exist (the
|
|
8
8
|
* namesake-tail locales: FI/CZ/SK/SI/DK/NO/HR/PL and any future gap).
|
|
9
9
|
*
|
|
10
10
|
* Why: the night-31 taxonomy measured the cross-locale resolve tail as NAMESAKE COLLISION
|
|
11
|
-
* (FI 300/1k … PL 75/1k offender rows), and the controlled experiment showed postcode-
|
|
11
|
+
* (FI 300/1k … PL 75/1k offender rows), and the controlled experiment showed postcode-extract
|
|
12
12
|
* coverage alone collapses it (FI 300→1, CZ 131→4): a resolvable postcode node feeds the
|
|
13
13
|
* resolver's coordinate-first sibling-postcode candidate injection, which binds the locality
|
|
14
|
-
* pick to its postcode neighborhood. The
|
|
14
|
+
* pick to its postcode neighborhood. The implementation already ships; it was coverage-starved.
|
|
15
15
|
*
|
|
16
16
|
* Two hard-won laws from the experiment are enforced HERE, in code, not in a runbook:
|
|
17
17
|
*
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
* --geonames-postal-countries`, any standalone fold, and the `mailwoman gazetteer` commands
|
|
31
31
|
* share ONE implementation. GeoNames postal dump = `download.geonames.org/export/zip/<CC>.zip`
|
|
32
32
|
* → `<CC>.txt` (TSV: country, postcode, place, admin1, code1, admin2, code2, admin3, code3,
|
|
33
|
-
* lat, lon, accuracy). License CC BY 4.0 — attribution rides the
|
|
33
|
+
* lat, lon, accuracy). License CC BY 4.0 — attribution rides the extract's `meta` provenance and
|
|
34
34
|
* the model card like the existing GeoNames alias fold.
|
|
35
35
|
*/
|
|
36
|
-
import {
|
|
36
|
+
import { pathExists } from "@mailwoman/core/fs/readers";
|
|
37
37
|
import { join } from "path-ts";
|
|
38
38
|
import { TSVSpliterator } from "spliterator";
|
|
39
39
|
/**
|
|
@@ -48,7 +48,7 @@ const GEONAMES_POSTAL_COLUMNS = 11;
|
|
|
48
48
|
*/
|
|
49
49
|
export const GEONAMES_POSTAL_ID_BASE = 9_500_000_000_000;
|
|
50
50
|
/**
|
|
51
|
-
* The #920 name law: reduce a
|
|
51
|
+
* The #920 name law: reduce a postcode to the sanitized-query token shape — strip every non-letter/number — so the
|
|
52
52
|
* stored name matches what `sanitizeFTSQuery` produces from the parsed postcode token. `"110 00"` → `"11000"`,
|
|
53
53
|
* `"11-041"` → `"11041"`, `"AD500"` → `"AD500"`.
|
|
54
54
|
*/
|
|
@@ -65,7 +65,7 @@ export function normalizePostcodeName(raw) {
|
|
|
65
65
|
*
|
|
66
66
|
* Distance is squared-Euclidean in DEGREES, not haversine. At the scale a postcode spans, the ranking the two produce
|
|
67
67
|
* is the same, and this one carries no trig into a per-group inner loop. Ties go to the earliest member, which makes
|
|
68
|
-
* the result a pure function of the input order — the property a rebuilt
|
|
68
|
+
* the result a pure function of the input order — the property a rebuilt extract's ids depend on.
|
|
69
69
|
*
|
|
70
70
|
* Exported (rather than inlined at each ingest) because it is the second half of the #920 pair: every postcode source
|
|
71
71
|
* that groups member points — GeoNames postal, OSM `addr:postcode` — owes the same law, and a second hand-rolled copy
|
|
@@ -97,7 +97,7 @@ export function medoidPoint(points) {
|
|
|
97
97
|
return best;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
|
-
* Fold GeoNames
|
|
100
|
+
* Fold GeoNames postcodes for `countries` into an open unified/postcode ingest DB: one `spr` row per distinct
|
|
101
101
|
* normalized postcode (placetype `postalcode`, medoid centroid, degenerate bbox), the normalized form as `name`, and
|
|
102
102
|
* the display form as an extra `names` row when it differs. The caller owns the FTS rebuild (rows ride the standard
|
|
103
103
|
* freeze phase).
|
|
@@ -112,7 +112,7 @@ export async function ingestGeonamesPostal(db, countries, postalDir) {
|
|
|
112
112
|
for (const country of countries) {
|
|
113
113
|
const cc = country.toUpperCase();
|
|
114
114
|
const file = join(postalDir, `${cc}.txt`);
|
|
115
|
-
if (!
|
|
115
|
+
if (!(await pathExists(file))) {
|
|
116
116
|
missing.push(cc);
|
|
117
117
|
console.error(` GeoNames postal ${cc}: ${file} missing — download from download.geonames.org/export/zip/${cc}.zip; skipped`);
|
|
118
118
|
continue;
|
|
@@ -120,7 +120,7 @@ export async function ingestGeonamesPostal(db, countries, postalDir) {
|
|
|
120
120
|
// Group member settlement points per NORMALIZED code; remember one display form.
|
|
121
121
|
const members = new Map();
|
|
122
122
|
// Streamed: a national dump is a caller-supplied size — GB's is 177 MB, and only the caller
|
|
123
|
-
// knows which country is next. `header: false` is
|
|
123
|
+
// knows which country is next. `header: false` is required; the GeoNames postal dump is
|
|
124
124
|
// headerless, so row 1 would be consumed as column names and its postcode lost.
|
|
125
125
|
for await (const cols of TSVSpliterator.fromAsync(file, { header: false })) {
|
|
126
126
|
if (cols.length < GEONAMES_POSTAL_COLUMNS)
|
|
@@ -153,4 +153,4 @@ export async function ingestGeonamesPostal(db, countries, postalDir) {
|
|
|
153
153
|
}
|
|
154
154
|
return { inserted, byCountry, missing };
|
|
155
155
|
}
|
|
156
|
-
//# sourceMappingURL=
|
|
156
|
+
//# sourceMappingURL=postal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postal.js","sourceRoot":"","sources":["../../lib/geonames/postal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH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AAI,CAAC,CAAC,CAAC,CAAC,CAAA;YACjF,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;YAE7B,IAAI,CAAC,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;gBACxB,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;YACnC,CAAC;YAED,QAAQ,EAAE,CAAA;QACX,CAAC;QAED,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjB,SAAS,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAA;QAE5B,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,oCAAoC,CAAC,CAAA;IAC7G,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;AACxC,CAAC"}
|
package/out/index.d.ts
CHANGED
|
@@ -3,35 +3,36 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
|
-
export type { FindPlaceQuery, GeoBbox, GeoPoint, PlaceCandidate, PlaceLookup, WOFPlacetype } from "
|
|
7
|
-
export type { AncestorsTable, CoincidentRolesTable, ConcordancesTable, GeojsonTable, NamesTable, PlaceAbbrTable, PlacePopulationTable, PlaceSearchTable, SprTable, WOFDatabase, } from "
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
20
|
-
export type {
|
|
21
|
-
export {
|
|
22
|
-
export type {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
6
|
+
export type { FindPlaceQuery, GeoBbox, GeoPoint, PlaceCandidate, PlaceLookup, WOFPlacetype } from "#types";
|
|
7
|
+
export type { AncestorsTable, CoincidentRolesTable, ConcordancesTable, GeojsonTable, NamesTable, PlaceAbbrTable, PlacePopulationTable, PlaceSearchTable, SprTable, WOFDatabase, } from "#schema";
|
|
8
|
+
export { WOFSQLitePlaceLookup, type RankingWeights, type WOFSQLitePlaceLookupOpts } from "#lookup";
|
|
9
|
+
export { CANDIDATE_ANCESTOR_COLUMNS, CANDIDATE_ANCESTOR_TABLE, CANDIDATE_INTERVAL_TABLE, createCandidateAncestorTable, createCandidateIntervalTable, intervalContains, MAX_ANCESTOR_DEPTH, } from "#candidate-ancestors-schema";
|
|
10
|
+
export type { CandidateAncestorsDatabase, CandidateAncestorTable, CandidateIntervalTable, IntervalLabel, } from "#candidate-ancestors-schema";
|
|
11
|
+
export { CANDIDATE_FTS_TABLE, createCandidateFTS } from "#candidate-fts";
|
|
12
|
+
export { ImportanceIndex, IMPORTANCE_JOIN_RADIUS_KM, type ImportanceIndexStats, loadImportanceIndex, } from "#candidate-importance";
|
|
13
|
+
export { WOFCandidateTableLookup, type WOFCandidateTableLookupOpts } from "#candidate-lookup";
|
|
14
|
+
export { COUNTRY_BBOX_TABLE, COUNTRY_COVERAGE_TABLE, createCountryBBoxTable, createCountryCoverageTable, readGazetteerCoverageManifest, writeGazetteerCoverageManifest, } from "#coverage-manifest-schema";
|
|
15
|
+
export type { CountryBBoxTable, CountryCoverageTable, GazetteerCoverageDatabase } from "#coverage-manifest-schema";
|
|
16
|
+
export { SQLiteStreetNameLookup, type SQLiteStreetNameLookupOpts } from "#street/name-lookup";
|
|
17
|
+
export { GEONAMES_ID_BASE, type GeonamesIngestProgress, ingestGeonamesAliases, purgeGeonamesAliasRange, } from "#geonames/aliases";
|
|
18
|
+
export { GEONAMES_POSTAL_ID_BASE } from "#geonames/postal";
|
|
19
|
+
export { ADDRESS_POINT_COLUMNS, createAddressPointIndexes, createAddressPointTable } from "#address/point-schema";
|
|
20
|
+
export type { AddressPointDatabase, AddressPointTable } from "#address/point-schema";
|
|
21
|
+
export { WOFPostalCityAliasLookup, type PostalCityAlias, type WOFPostalCityAliasLookupOpts, } from "#postal/city-alias-lookup";
|
|
22
|
+
export type { PostalCityAliasDatabase, PostalCityAliasTable } from "#postal/city-alias-schema";
|
|
23
|
+
export { POSTAL_CITY_CANDIDATE_COLUMNS, POSTAL_CITY_CANDIDATE_TABLE, createPostalCityCandidateTable, } from "#postal/city-candidate-schema";
|
|
24
|
+
export type { PostalCityCandidateDatabase, PostalCityCandidateTable } from "#postal/city-candidate-schema";
|
|
25
|
+
export { ADDRESS_CONVENTION_TABLE, BUILTIN_STRATEGY_NAMES, SeedConventionSource, WORLD_DEFAULT, mergeConventions, resolveConvention, type Convention, type ConventionSource, type ResolvedConvention, type ScoringWeights, type Strategy, } from "#convention/index";
|
|
26
|
+
export { SqliteConventionSource } from "#sqlite-convention-source";
|
|
27
|
+
export { WOFPostcodeLookup, type PostcodePlace } from "#postcode-point-lookup";
|
|
28
|
+
export { PLACE_BBOX_TABLE, PLACE_SEARCH_TABLE, buildPlaceSearchFTS, placeBboxExists, placeSearchFTSExists, type BuildPlaceSearchFTSOpts, type BuildPlaceSearchFTSResult, } from "#fts/index";
|
|
29
|
+
export { PLACETYPE_DEPTH, ancestorLineage, placetypeDepth, type AncestorPlaceRow } from "#ancestry/index";
|
|
30
|
+
export { WOFReverseGeocoder, type ContainmentKind, type ReverseGeocodeOpts, type ReverseGeocodeResult, type WOFReverseGeocoderOpts, } from "#reverse";
|
|
31
|
+
export { AddressPointInterpolator } from "#address/point-interpolation";
|
|
32
|
+
export { AddressPointSqliteLookup } from "#address/point";
|
|
33
|
+
export { STREET_CENTROID_COLUMNS, createStreetCentroidIndexes, createStreetCentroidTable, } from "#street/centroid-schema";
|
|
34
|
+
export type { StreetCentroidDatabase, StreetCentroidTable } from "#street/centroid-schema";
|
|
35
|
+
export { StreetCentroidSqliteLookup } from "#street/centroid";
|
|
36
|
+
export { StreetInterpolator, type InterpolatedHit, type InterpolationMethod, type InterpolationQuery, } from "#interpolation";
|
|
37
|
+
export { deriveSchemaName, pickExtractForPlacetype, resolveExtracts, type ResolvedExtract, type ExtractConfig, } from "#extracts";
|
|
37
38
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAE1G,YAAY,EACX,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,EACR,WAAW,GACX,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,KAAK,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAElG,OAAO,EACN,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,EAC5B,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,6BAA6B,CAAA;AAEpC,YAAY,EACX,0BAA0B,EAC1B,sBAAsB,EACtB,sB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
@@ -3,28 +3,28 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export { PLACETYPE_DEPTH, ancestorLineage, placetypeDepth } from "
|
|
23
|
-
export { WOFReverseGeocoder, } from "
|
|
24
|
-
export { AddressPointInterpolator } from "
|
|
25
|
-
export { AddressPointSqliteLookup } from "
|
|
26
|
-
export { STREET_CENTROID_COLUMNS, createStreetCentroidIndexes, createStreetCentroidTable, } from "
|
|
27
|
-
export { StreetCentroidSqliteLookup } from "
|
|
28
|
-
export { StreetInterpolator, } from "
|
|
29
|
-
export { deriveSchemaName,
|
|
6
|
+
export { WOFSQLitePlaceLookup } from "#lookup";
|
|
7
|
+
export { CANDIDATE_ANCESTOR_COLUMNS, CANDIDATE_ANCESTOR_TABLE, CANDIDATE_INTERVAL_TABLE, createCandidateAncestorTable, createCandidateIntervalTable, intervalContains, MAX_ANCESTOR_DEPTH, } from "#candidate-ancestors-schema";
|
|
8
|
+
export { CANDIDATE_FTS_TABLE, createCandidateFTS } from "#candidate-fts";
|
|
9
|
+
export { ImportanceIndex, IMPORTANCE_JOIN_RADIUS_KM, loadImportanceIndex, } from "#candidate-importance";
|
|
10
|
+
export { WOFCandidateTableLookup } from "#candidate-lookup";
|
|
11
|
+
export { COUNTRY_BBOX_TABLE, COUNTRY_COVERAGE_TABLE, createCountryBBoxTable, createCountryCoverageTable, readGazetteerCoverageManifest, writeGazetteerCoverageManifest, } from "#coverage-manifest-schema";
|
|
12
|
+
export { SQLiteStreetNameLookup } from "#street/name-lookup";
|
|
13
|
+
export { GEONAMES_ID_BASE, ingestGeonamesAliases, purgeGeonamesAliasRange, } from "#geonames/aliases";
|
|
14
|
+
export { GEONAMES_POSTAL_ID_BASE } from "#geonames/postal";
|
|
15
|
+
export { ADDRESS_POINT_COLUMNS, createAddressPointIndexes, createAddressPointTable } from "#address/point-schema";
|
|
16
|
+
export { WOFPostalCityAliasLookup, } from "#postal/city-alias-lookup";
|
|
17
|
+
export { POSTAL_CITY_CANDIDATE_COLUMNS, POSTAL_CITY_CANDIDATE_TABLE, createPostalCityCandidateTable, } from "#postal/city-candidate-schema";
|
|
18
|
+
export { ADDRESS_CONVENTION_TABLE, BUILTIN_STRATEGY_NAMES, SeedConventionSource, WORLD_DEFAULT, mergeConventions, resolveConvention, } from "#convention/index";
|
|
19
|
+
export { SqliteConventionSource } from "#sqlite-convention-source";
|
|
20
|
+
export { WOFPostcodeLookup } from "#postcode-point-lookup";
|
|
21
|
+
export { PLACE_BBOX_TABLE, PLACE_SEARCH_TABLE, buildPlaceSearchFTS, placeBboxExists, placeSearchFTSExists, } from "#fts/index";
|
|
22
|
+
export { PLACETYPE_DEPTH, ancestorLineage, placetypeDepth } from "#ancestry/index";
|
|
23
|
+
export { WOFReverseGeocoder, } from "#reverse";
|
|
24
|
+
export { AddressPointInterpolator } from "#address/point-interpolation";
|
|
25
|
+
export { AddressPointSqliteLookup } from "#address/point";
|
|
26
|
+
export { STREET_CENTROID_COLUMNS, createStreetCentroidIndexes, createStreetCentroidTable, } from "#street/centroid-schema";
|
|
27
|
+
export { StreetCentroidSqliteLookup } from "#street/centroid";
|
|
28
|
+
export { StreetInterpolator, } from "#interpolation";
|
|
29
|
+
export { deriveSchemaName, pickExtractForPlacetype, resolveExtracts, } from "#extracts";
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;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MAAM,2BAA2B,CAAA;AAElE,OAAO,EAAE,iBAAiB,EAAsB,MAAM,wBAAwB,CAAA;AAE9E,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,GAGpB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAyB,MAAM,iBAAiB,CAAA;AAEzG,OAAO,EACN,kBAAkB,GAKlB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,GACzB,MAAM,yBAAyB,CAAA;AAGhC,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAE7D,OAAO,EACN,kBAAkB,GAIlB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACN,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,GAGf,MAAM,WAAW,CAAA"}
|
package/out/interpolation.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* then linear interpolation along the segment polyline. Design:
|
|
9
9
|
* `docs/articles/plan/2026-06-11-interpolation-design.md`.
|
|
10
10
|
*
|
|
11
|
-
* Reads the per-state
|
|
11
|
+
* Reads the per-state extract built by `scripts/build-interpolation-extract.ts` (`street_segment`: one
|
|
12
12
|
* row per TIGER edge SIDE — independent left/right ranges, ZIPs, parity). Query-side
|
|
13
13
|
* normalization is THE shared normalizer (`street-normalize.ts`) — identical to build-side, by
|
|
14
14
|
* construction.
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
* exact-point fall-through) is a noted follow-up on #483, so the `find()` shape mirrors
|
|
26
26
|
* `AddressPointLookup.find()` to keep that wiring mechanical.
|
|
27
27
|
*/
|
|
28
|
-
import { DatabaseSync } from "node:sqlite";
|
|
29
28
|
import type { InterpolationLookup } from "@mailwoman/resolver";
|
|
29
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
30
|
+
import type { StreetSegmentDatabase } from "#street/segment-schema";
|
|
30
31
|
/**
|
|
31
32
|
* How an interpolated answer was computed (#483 Method 2):
|
|
32
33
|
*
|
|
33
|
-
* - `address_point` — bracketed/extrapolated between REAL neighbor points from the #476
|
|
34
|
+
* - `address_point` — bracketed/extrapolated between REAL neighbor points from the #476 extract
|
|
34
35
|
* (`AddressPointInterpolator`), replacing TIGER's uniform-spacing assumption with occupancy.
|
|
35
36
|
* - `tiger_range` — linear position within a TIGER segment's theoretical house-number range (`StreetInterpolator`), the
|
|
36
37
|
* fallback for streets too sparse to bracket.
|
|
@@ -81,20 +82,28 @@ export interface InterpolationQuery {
|
|
|
81
82
|
* ZIP scope — strongly preferred; without it common street names abstain (see module doc).
|
|
82
83
|
*/
|
|
83
84
|
postcode?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The resolved locality's coordinate — the tie-breaker when no postcode was given and the parity-preferred covering
|
|
87
|
+
* ranges still span several postcodes. See {@link NEAR_MAX_KM} for the acceptance geometry.
|
|
88
|
+
*/
|
|
89
|
+
near?: {
|
|
90
|
+
lat: number;
|
|
91
|
+
lon: number;
|
|
92
|
+
};
|
|
84
93
|
}
|
|
85
|
-
export declare class StreetInterpolator implements InterpolationLookup {
|
|
94
|
+
export declare class StreetInterpolator<DB extends StreetSegmentDatabase = StreetSegmentDatabase> implements InterpolationLookup {
|
|
86
95
|
#private;
|
|
87
96
|
constructor(opts: {
|
|
88
97
|
dbPath?: string;
|
|
89
|
-
database?:
|
|
98
|
+
database?: DatabaseClient<DB>;
|
|
90
99
|
});
|
|
91
100
|
/**
|
|
92
|
-
* The artifact's own conformal radius multiplier (#374), read from the
|
|
93
|
-
* construction. `undefined` = the
|
|
94
|
-
* artifact default and callers may supply a legacy fallback.
|
|
101
|
+
* The artifact's own conformal radius multiplier (#374), read from the extract's `interp_calibration` metadata table
|
|
102
|
+
* at construction. `undefined` = the extract predates the table (or carries no valid row) — the resolver then applies
|
|
103
|
+
* no artifact default and callers may supply a legacy fallback.
|
|
95
104
|
*/
|
|
96
105
|
get radiusCalibration(): number | undefined;
|
|
97
106
|
find(query: InterpolationQuery): InterpolatedHit | null;
|
|
98
|
-
|
|
107
|
+
[Symbol.dispose](): void;
|
|
99
108
|
}
|
|
100
109
|
//# sourceMappingURL=interpolation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../interpolation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;
|
|
1
|
+
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../lib/interpolation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAIzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAEnE;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,aAAa,CAAA;AAEjE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,YAAY,EAAE,IAAI,CAAA;IAClB;;OAEG;IACH,MAAM,EAAE,mBAAmB,CAAA;IAC3B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IAC3B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAA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