@mailwoman/resolver-wof-sqlite 9.2.0 → 9.4.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 +16 -19
- package/lib/address/index.ts +9 -0
- package/{address-point-interpolation.ts → lib/address/point-interpolation.ts} +25 -24
- package/{address-point-schema.ts → lib/address/point-schema.ts} +18 -4
- package/lib/address/point.ts +328 -0
- package/{ancestry-backfill.ts → lib/ancestry/backfill.ts} +14 -19
- package/{ancestry.ts → lib/ancestry/index.ts} +5 -4
- package/{build-candidate.ts → lib/build-candidate.ts} +99 -79
- package/{build-slim.ts → lib/build-slim.ts} +150 -165
- package/{candidate → lib/candidate}/alias-bags.ts +8 -6
- package/{candidate → lib/candidate}/ancestors-sidecar.ts +13 -15
- package/{candidate → lib/candidate}/country-display-names.ts +2 -2
- package/lib/candidate/extract-fold.ts +219 -0
- package/{candidate → lib/candidate}/name-roles.ts +17 -16
- package/{candidate → lib/candidate}/own-name.ts +2 -1
- package/{candidate → lib/candidate}/place-attrs.ts +3 -3
- package/{candidate-ancestors-schema.ts → lib/candidate-ancestors-schema.ts} +4 -4
- package/{candidate-fts.ts → lib/candidate-fts.ts} +3 -3
- package/{candidate-importance.ts → lib/candidate-importance.ts} +53 -57
- package/{candidate-lookup.ts → lib/candidate-lookup.ts} +84 -80
- package/{candidate-schema.ts → lib/candidate-schema.ts} +6 -6
- package/{candidate-scoring.ts → lib/candidate-scoring.ts} +15 -22
- package/{capital-schema.ts → lib/capital-schema.ts} +5 -6
- package/{capitals.ts → lib/capitals.ts} +2 -2
- package/{coincident-roles.ts → lib/coincident-roles.ts} +9 -13
- package/{convention.ts → lib/convention/index.ts} +3 -3
- package/{convention-schema.ts → lib/convention/schema.ts} +2 -2
- package/{coverage-manifest-schema.ts → lib/coverage-manifest-schema.ts} +10 -10
- package/{currency-backfill.ts → lib/currency-backfill.ts} +126 -41
- package/lib/env.ts +50 -0
- package/{exact-match.ts → lib/exact-match.ts} +23 -14
- package/{sharding.ts → lib/extracts.ts} +61 -58
- package/{fst-autocomplete.ts → lib/fst/autocomplete.ts} +4 -4
- package/{fst-builder.ts → lib/fst/builder.ts} +17 -16
- 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} +40 -74
- 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} +24 -19
- package/{fts-query.ts → lib/fts/query.ts} +1 -1
- 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} +14 -13
- package/{index.ts → lib/index.ts} +37 -37
- package/{interpolation.ts → lib/interpolation.ts} +28 -26
- package/{lookup.ts → lib/lookup.ts} +130 -142
- 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} +7 -16
- package/lib/poi/index.ts +8 -0
- package/{poi-lookup.ts → lib/poi/lookup.ts} +22 -29
- package/{poi-schema.ts → lib/poi/schema.ts} +3 -4
- package/{postal-city-alias-lookup.ts → lib/postal/city-alias-lookup.ts} +14 -20
- package/{postal-city-candidate-schema.ts → lib/postal/city-candidate-schema.ts} +2 -2
- package/lib/postal/index.ts +9 -0
- package/{postcode-point-lookup.ts → lib/postcode-point-lookup.ts} +17 -15
- package/{primary-preference.ts → lib/primary-preference.ts} +43 -14
- package/{proximity-rerank.ts → lib/proximity-rerank.ts} +2 -2
- package/{ranking-weights.ts → lib/ranking-weights.ts} +30 -4
- package/{region-keys.ts → lib/region-keys.ts} +9 -9
- package/{reverse.ts → lib/reverse.ts} +34 -47
- package/{schema.ts → lib/schema.ts} +10 -0
- package/{search-fetch.ts → lib/search-fetch.ts} +29 -29
- package/{sqlite-convention-source.ts → lib/sqlite-convention-source.ts} +9 -10
- package/{sqlite-utils.ts → lib/sqlite-utils.ts} +14 -19
- package/{street-centroid-schema.ts → lib/street/centroid-schema.ts} +5 -5
- package/{street-centroid.ts → lib/street/centroid.ts} +15 -22
- 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/{street-normalize.ts → lib/street/normalize.ts} +86 -20
- package/{street-segment-schema.ts → lib/street/segment-schema.ts} +7 -7
- package/{types.ts → lib/types.ts} +18 -12
- package/{unified-schema.ts → lib/unified-schema.ts} +20 -24
- package/lib/uprn/existence.ts +84 -0
- package/lib/uprn/index.ts +9 -0
- package/{uprn-lookup.ts → lib/uprn/lookup.ts} +14 -19
- package/{uprn-schema.ts → lib/uprn/schema.ts} +3 -3
- package/lib/weights-overlay-linker.ts +879 -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} +12 -11
- package/out/address/point-interpolation.d.ts.map +1 -0
- package/out/{address-point-interpolation.js → address/point-interpolation.js} +18 -18
- package/out/address/point-interpolation.js.map +1 -0
- package/out/{address-point-schema.d.ts → address/point-schema.d.ts} +16 -6
- 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} +19 -9
- package/out/address/point.d.ts.map +1 -0
- package/out/address/point.js +222 -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} +4 -3
- package/out/ancestry/index.d.ts.map +1 -0
- package/out/{ancestry.js → ancestry/index.js} +3 -2
- package/out/ancestry/index.js.map +1 -0
- package/out/build-candidate.d.ts +32 -24
- package/out/build-candidate.d.ts.map +1 -1
- package/out/build-candidate.js +60 -54
- package/out/build-candidate.js.map +1 -1
- package/out/build-slim.d.ts +4 -4
- package/out/build-slim.d.ts.map +1 -1
- package/out/build-slim.js +124 -139
- package/out/build-slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +5 -3
- package/out/candidate/alias-bags.d.ts.map +1 -1
- package/out/candidate/alias-bags.js +2 -2
- package/out/candidate/alias-bags.js.map +1 -1
- package/out/candidate/ancestors-sidecar.d.ts +9 -10
- package/out/candidate/ancestors-sidecar.d.ts.map +1 -1
- package/out/candidate/ancestors-sidecar.js +7 -7
- package/out/candidate/ancestors-sidecar.js.map +1 -1
- package/out/candidate/country-display-names.d.ts +1 -1
- package/out/candidate/country-display-names.d.ts.map +1 -1
- package/out/candidate/country-display-names.js +1 -1
- package/out/candidate/country-display-names.js.map +1 -1
- package/out/candidate/extract-fold.d.ts +41 -0
- package/out/candidate/extract-fold.d.ts.map +1 -0
- package/out/candidate/extract-fold.js +153 -0
- package/out/candidate/extract-fold.js.map +1 -0
- package/out/candidate/name-roles.d.ts +13 -11
- package/out/candidate/name-roles.d.ts.map +1 -1
- package/out/candidate/name-roles.js +11 -10
- package/out/candidate/name-roles.js.map +1 -1
- package/out/candidate/own-name.d.ts +1 -1
- package/out/candidate/own-name.d.ts.map +1 -1
- package/out/candidate/own-name.js +2 -1
- package/out/candidate/own-name.js.map +1 -1
- package/out/candidate/place-attrs.d.ts +3 -3
- package/out/candidate/place-attrs.d.ts.map +1 -1
- package/out/candidate/place-attrs.js +1 -1
- package/out/candidate/place-attrs.js.map +1 -1
- package/out/candidate-ancestors-schema.d.ts +4 -4
- package/out/candidate-ancestors-schema.d.ts.map +1 -1
- package/out/candidate-ancestors-schema.js +2 -2
- package/out/candidate-ancestors-schema.js.map +1 -1
- package/out/candidate-fts.d.ts +3 -3
- package/out/candidate-fts.d.ts.map +1 -1
- package/out/candidate-fts.js +1 -1
- 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 +46 -51
- package/out/candidate-importance.js.map +1 -1
- package/out/candidate-lookup.d.ts +16 -14
- package/out/candidate-lookup.d.ts.map +1 -1
- package/out/candidate-lookup.js +67 -63
- package/out/candidate-lookup.js.map +1 -1
- package/out/candidate-schema.d.ts +6 -6
- package/out/candidate-schema.d.ts.map +1 -1
- package/out/candidate-schema.js +1 -1
- package/out/candidate-schema.js.map +1 -1
- package/out/candidate-scoring.d.ts +7 -7
- package/out/candidate-scoring.d.ts.map +1 -1
- package/out/candidate-scoring.js +10 -14
- package/out/candidate-scoring.js.map +1 -1
- package/out/capital-schema.d.ts +3 -3
- package/out/capital-schema.d.ts.map +1 -1
- package/out/capital-schema.js +2 -2
- package/out/capital-schema.js.map +1 -1
- package/out/capitals.d.ts +1 -1
- package/out/capitals.d.ts.map +1 -1
- package/out/capitals.js +2 -2
- package/out/capitals.js.map +1 -1
- package/out/coincident-roles.d.ts +7 -6
- package/out/coincident-roles.d.ts.map +1 -1
- package/out/coincident-roles.js +2 -4
- package/out/coincident-roles.js.map +1 -1
- package/out/{convention.d.ts → convention/index.d.ts} +4 -4
- package/out/convention/index.d.ts.map +1 -0
- package/out/{convention.js → convention/index.js} +2 -2
- package/out/convention/index.js.map +1 -0
- package/out/{convention-schema.d.ts → convention/schema.d.ts} +2 -2
- package/out/convention/schema.d.ts.map +1 -0
- package/out/{convention-schema.js → convention/schema.js} +3 -3
- 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 +5 -4
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/currency-backfill.d.ts +51 -7
- package/out/currency-backfill.d.ts.map +1 -1
- package/out/currency-backfill.js +65 -49
- package/out/currency-backfill.js.map +1 -1
- 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 +5 -5
- package/out/exact-match.d.ts.map +1 -1
- package/out/exact-match.js +10 -11
- package/out/exact-match.js.map +1 -1
- 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} +2 -2
- package/out/fst/autocomplete.d.ts.map +1 -0
- package/out/{fst-autocomplete.js → fst/autocomplete.js} +3 -3
- 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} +14 -13
- 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} +9 -13
- package/out/fst/freshness.d.ts.map +1 -0
- package/out/{fst-freshness.js → fst/freshness.js} +40 -73
- 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} +16 -9
- package/out/fts/index.d.ts.map +1 -0
- package/out/{fts.js → fts/index.js} +16 -11
- 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} +1 -1
- 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} +10 -8
- package/out/geonames/postal.d.ts.map +1 -0
- package/out/{geonames-postal.js → geonames/postal.js} +9 -9
- package/out/geonames/postal.js.map +1 -0
- package/out/index.d.ts +32 -32
- 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 +11 -10
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +20 -20
- package/out/interpolation.js.map +1 -1
- package/out/lookup.d.ts +22 -21
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +103 -113
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts.map +1 -1
- 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 +5 -6
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +3 -4
- 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} +14 -18
- package/out/poi/lookup.js.map +1 -0
- package/out/{poi-schema.d.ts → poi/schema.d.ts} +4 -4
- 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.map +1 -1
- package/out/polygon-schema.js.map +1 -1
- package/out/{postal-city-alias-lookup.d.ts → postal/city-alias-lookup.d.ts} +6 -5
- package/out/postal/city-alias-lookup.d.ts.map +1 -0
- package/out/{postal-city-alias-lookup.js → postal/city-alias-lookup.js} +11 -15
- 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} +3 -3
- package/out/{postal-city-candidate-schema.d.ts.map → postal/city-candidate-schema.d.ts.map} +1 -1
- 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 +15 -7
- package/out/primary-preference.d.ts.map +1 -1
- package/out/primary-preference.js +28 -12
- package/out/primary-preference.js.map +1 -1
- package/out/proximity-rerank.d.ts +2 -2
- package/out/proximity-rerank.d.ts.map +1 -1
- package/out/proximity-rerank.js +2 -2
- package/out/proximity-rerank.js.map +1 -1
- 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 +8 -8
- package/out/region-keys.d.ts.map +1 -1
- package/out/region-keys.js +9 -9
- package/out/region-keys.js.map +1 -1
- package/out/reverse.d.ts +6 -6
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +20 -29
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +9 -0
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js.map +1 -1
- package/out/search-fetch.d.ts +12 -10
- package/out/search-fetch.d.ts.map +1 -1
- package/out/search-fetch.js +21 -20
- package/out/search-fetch.js.map +1 -1
- 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 +8 -9
- package/out/sqlite-utils.d.ts.map +1 -1
- package/out/sqlite-utils.js +6 -10
- package/out/sqlite-utils.js.map +1 -1
- package/out/{street-centroid-schema.d.ts → street/centroid-schema.d.ts} +6 -6
- package/out/{street-centroid-schema.d.ts.map → street/centroid-schema.d.ts.map} +1 -1
- 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} +7 -7
- package/out/street/centroid.d.ts.map +1 -0
- package/out/{street-centroid.js → street/centroid.js} +13 -19
- 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 → street/normalize.d.ts} +38 -15
- package/out/street/normalize.d.ts.map +1 -0
- package/out/{street-normalize.js → street/normalize.js} +73 -17
- package/out/street/normalize.js.map +1 -0
- package/out/{street-segment-schema.d.ts → street/segment-schema.d.ts} +8 -8
- package/out/{street-segment-schema.d.ts.map → street/segment-schema.d.ts.map} +1 -1
- 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 +18 -12
- package/out/types.d.ts.map +1 -1
- package/out/types.js.map +1 -1
- package/out/unified-schema.d.ts +5 -4
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +15 -18
- 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 → uprn/lookup.d.ts} +4 -4
- package/out/uprn/lookup.d.ts.map +1 -0
- package/out/{uprn-lookup.js → uprn/lookup.js} +11 -14
- package/out/uprn/lookup.js.map +1 -0
- package/out/{uprn-schema.d.ts → uprn/schema.d.ts} +4 -4
- package/out/uprn/schema.d.ts.map +1 -0
- package/out/{uprn-schema.js → uprn/schema.js} +4 -4
- package/out/uprn/schema.js.map +1 -0
- package/out/weights-overlay-linker.d.ts +184 -26
- package/out/weights-overlay-linker.d.ts.map +1 -1
- package/out/weights-overlay-linker.js +339 -86
- package/out/weights-overlay-linker.js.map +1 -1
- package/package.json +465 -269
- package/address-point.ts +0 -218
- package/candidate/shard-fold.ts +0 -137
- 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 -140
- 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/candidate/shard-fold.d.ts +0 -31
- package/out/candidate/shard-fold.d.ts.map +0 -1
- package/out/candidate/shard-fold.js +0 -104
- package/out/candidate/shard-fold.js.map +0 -1
- package/out/convention-schema.d.ts.map +0 -1
- package/out/convention-schema.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.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/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/sharding.d.ts +0 -114
- package/out/sharding.d.ts.map +0 -1
- package/out/sharding.js.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.map +0 -1
- package/out/street-normalize.js.map +0 -1
- package/out/uprn-lookup.d.ts.map +0 -1
- package/out/uprn-lookup.js.map +0 -1
- package/out/uprn-schema.d.ts.map +0 -1
- package/out/uprn-schema.js.map +0 -1
- package/weights-overlay-linker.ts +0 -377
- /package/{name-score.ts → lib/name-score.ts} +0 -0
- /package/{polygon-schema.ts → lib/polygon-schema.ts} +0 -0
- /package/{postal-city-alias-schema.ts → lib/postal/city-alias-schema.ts} +0 -0
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Typed schema for the TIGER STREET-SEGMENT interpolation
|
|
7
|
-
* built by `scripts/build-interpolation-
|
|
6
|
+
* Typed schema for the TIGER STREET-SEGMENT interpolation extracts (`street-segments-<cc>-<st>.db`,
|
|
7
|
+
* built by `scripts/build-interpolation-extract.ts` from TIGER EDGES) — the #483 Method-3 fallback
|
|
8
8
|
* the resolver drops to when the address-point tier (Method 2) can't bracket. Single source of
|
|
9
9
|
* truth for the columns the BUILDER writes and the READER ({@link StreetInterpolator}) probes, so
|
|
10
10
|
* a column rename in one is a compile error in the other.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* {@link STREET_SEGMENT_COLUMNS} so it can't drift from the DDL.
|
|
16
16
|
*/
|
|
17
17
|
import type { Kysely } from "kysely";
|
|
18
|
-
import type { RouteKey } from "
|
|
18
|
+
import type { RouteKey } from "#street/normalize";
|
|
19
19
|
/**
|
|
20
20
|
* One TIGER street-segment edge: a `(from_hn, to_hn)` house-number range on one `side` of a named street, with the
|
|
21
21
|
* geometry the interpolator walks. `min_hn`/`max_hn` are the sorted bounds (the probe filters on them); `parity` is
|
|
@@ -70,11 +70,11 @@ export interface StreetSegmentTable {
|
|
|
70
70
|
release: string;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* The
|
|
73
|
+
* The extract's single-row calibration metadata (#374 doctrine, 2026-07-26): the conformal radius multiplier is a
|
|
74
74
|
* property of the CALIBRATION SET the artifact was built against — so it ships IN the artifact (the pair-index δ
|
|
75
75
|
* precedent, `neural/pair-index-resolver.ts`), not in caller code. Written once by the builder; read at open time by
|
|
76
|
-
* {@link StreetInterpolator}.
|
|
77
|
-
* and callers fall back to the in-code per-region table (never patch shipped DBs — rebuild).
|
|
76
|
+
* {@link StreetInterpolator}. Extracts built before this table exists simply lack it — the reader degrades to
|
|
77
|
+
* `undefined` and callers fall back to the in-code per-region table (never patch shipped DBs — rebuild).
|
|
78
78
|
*/
|
|
79
79
|
export interface InterpCalibrationRow {
|
|
80
80
|
/**
|
|
@@ -108,7 +108,7 @@ export declare const STREET_SEGMENT_COLUMNS: readonly ["street_norm", "side", "f
|
|
|
108
108
|
export declare function createStreetSegmentTable(db: Kysely<StreetSegmentDatabase>): Promise<void>;
|
|
109
109
|
/**
|
|
110
110
|
* Create + populate the single-row `interp_calibration` metadata table (see {@link InterpCalibrationRow}) — called once
|
|
111
|
-
* by the
|
|
111
|
+
* by the extract builder, after the value is selected from the calibration source of record. Build-time only (async
|
|
112
112
|
* Kysely is fine here); the READ side is the raw sync probe in {@link StreetInterpolator}'s constructor, per the
|
|
113
113
|
* sync-by-interface doctrine.
|
|
114
114
|
*/
|
|
@@ -117,4 +117,4 @@ export declare function writeInterpCalibration(db: Kysely<StreetSegmentDatabase>
|
|
|
117
117
|
* Create the two probe indexes the reader relies on (postcode-scope, street-scope).
|
|
118
118
|
*/
|
|
119
119
|
export declare function createStreetSegmentIndexes(db: Kysely<StreetSegmentDatabase>): Promise<void>;
|
|
120
|
-
//# sourceMappingURL=
|
|
120
|
+
//# sourceMappingURL=segment-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"segment-schema.d.ts","sourceRoot":"","sources":["../../lib/street/segment-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,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ACvB,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,EAAE,EAAE,MAAM,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjG"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Typed schema for the TIGER STREET-SEGMENT interpolation
|
|
7
|
-
* built by `scripts/build-interpolation-
|
|
6
|
+
* Typed schema for the TIGER STREET-SEGMENT interpolation extracts (`street-segments-<cc>-<st>.db`,
|
|
7
|
+
* built by `scripts/build-interpolation-extract.ts` from TIGER EDGES) — the #483 Method-3 fallback
|
|
8
8
|
* the resolver drops to when the address-point tier (Method 2) can't bracket. Single source of
|
|
9
9
|
* truth for the columns the BUILDER writes and the READER ({@link StreetInterpolator}) probes, so
|
|
10
10
|
* a column rename in one is a compile error in the other.
|
|
@@ -56,7 +56,7 @@ export async function createStreetSegmentTable(db) {
|
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Create + populate the single-row `interp_calibration` metadata table (see {@link InterpCalibrationRow}) — called once
|
|
59
|
-
* by the
|
|
59
|
+
* by the extract builder, after the value is selected from the calibration source of record. Build-time only (async
|
|
60
60
|
* Kysely is fine here); the READ side is the raw sync probe in {@link StreetInterpolator}'s constructor, per the
|
|
61
61
|
* sync-by-interface doctrine.
|
|
62
62
|
*/
|
|
@@ -80,4 +80,4 @@ export async function createStreetSegmentIndexes(db) {
|
|
|
80
80
|
.execute();
|
|
81
81
|
await db.schema.createIndex("idx_seg_street").on("street_segment").columns(["street_norm", "min_hn"]).execute();
|
|
82
82
|
}
|
|
83
|
-
//# sourceMappingURL=
|
|
83
|
+
//# sourceMappingURL=segment-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"segment-schema.js","sourceRoot":"","sources":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AgB,CAAC;SACpB,OAAO,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;SAC9C,OAAO,EAAE,CAAA;IAEX,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;AAChH,CAAC"}
|
package/out/types.d.ts
CHANGED
|
@@ -75,8 +75,8 @@ export interface PlaceCandidate {
|
|
|
75
75
|
/**
|
|
76
76
|
* STRICT encyclopedia-evidence importance in [0, 1], fan-out-guarded per #1497 — CARRIED, NEVER RANKED ON.
|
|
77
77
|
*
|
|
78
|
-
* RESERVED SLOT awaiting a strict-channel source: present only when a
|
|
79
|
-
* split columns, and no shipped
|
|
78
|
+
* RESERVED SLOT awaiting a strict-channel source: present only when a extract's `place_importance` table carries the
|
|
79
|
+
* split columns, and no shipped extract does — the FTS lookup's clauses emit NULL for everything today. `undefined`
|
|
80
80
|
* means either "no encyclopedia entry for this place" or "this gazetteer predates the split"; both are absence, and
|
|
81
81
|
* neither is 0. The BLENDED prior the ranking reads is {@link PlaceCandidate.importance}.
|
|
82
82
|
*
|
|
@@ -110,10 +110,17 @@ export interface PlaceCandidate {
|
|
|
110
110
|
* Admin-containment stamp (#1717 stage 2) — TRI-STATE, mirroring `ResolvedPlace.containedByQualifier` in
|
|
111
111
|
* `@mailwoman/core`: `true` = the ancestors sidecar vouches this candidate sits under the query's
|
|
112
112
|
* {@link FindPlaceQuery.regionQualifier}; `false` = evaluated and not vouched for; absent = never evaluated (no
|
|
113
|
-
* qualifier on the query, or an artifact without the sidecar). Absence is
|
|
114
|
-
*
|
|
113
|
+
* qualifier on the query, or an artifact without the sidecar). Absence is required — the resolver walk reads it as
|
|
114
|
+
* `unavailable`, never as "not contained".
|
|
115
115
|
*/
|
|
116
116
|
containedByQualifier?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* The #1882 exemption's firing mark (#1893), mirroring `ResolvedPlace.variantAliasExempted` in `@mailwoman/core`:
|
|
119
|
+
* present only when this candidate's row would have taken the cross-country alias penalty and the exemption prevented
|
|
120
|
+
* it. Emitted by the candidate-table backend alone — the WASM FTS lookup never runs the ranker, and its candidates
|
|
121
|
+
* omit the field (not evaluated, never "did not fire").
|
|
122
|
+
*/
|
|
123
|
+
variantAliasExempted?: true;
|
|
117
124
|
}
|
|
118
125
|
/**
|
|
119
126
|
* A WGS-84 lat/lon point. Used as a proximity hint for `FindPlaceQuery.near`.
|
|
@@ -160,8 +167,8 @@ export interface FindPlaceQuery {
|
|
|
160
167
|
*/
|
|
161
168
|
fuzzyCountry?: string;
|
|
162
169
|
/**
|
|
163
|
-
* Restrict name matching to PRIMARY-keyed rows (#1632) — set by probes whose surface is a RE-READING (a token
|
|
164
|
-
* of a longer classified span), which never named an alias. See the ResolverBackend contract in
|
|
170
|
+
* Restrict name matching to PRIMARY-keyed rows (#1632) — set by probes whose surface is a RE-READING (a token taken
|
|
171
|
+
* out of a longer classified span), which never named an alias. See the ResolverBackend contract in
|
|
165
172
|
* `@mailwoman/core/resolver`.
|
|
166
173
|
*/
|
|
167
174
|
primaryOnly?: boolean;
|
|
@@ -178,14 +185,14 @@ export interface FindPlaceQuery {
|
|
|
178
185
|
* Sibling postcode. When set on a `locality` query AND a `postcode_locality` table is present, triggers the
|
|
179
186
|
* coordinate-first soft-score path: postcode→candidate localities are injected and scored `0.6·S_pc + 0.3·S_name +
|
|
180
187
|
* 0.1·S_pop` against the FTS name-match set, recovering small localities the name-match alone misses. Ignored when no
|
|
181
|
-
* postcode_locality
|
|
188
|
+
* postcode_locality extract is present.
|
|
182
189
|
*/
|
|
183
190
|
postcode?: string;
|
|
184
191
|
/**
|
|
185
192
|
* Postcode-containment coherence (#31, Mechanism 2) — when true on a locality query that also carries `postcode`,
|
|
186
|
-
* candidate rows within `
|
|
187
|
-
* rest appended in their original order. Set by the resolver from `ResolveOpts.postcodeContainmentCoherence`;
|
|
188
|
-
* → the population-first order is untouched (byte-identical).
|
|
193
|
+
* candidate rows within `POSTCODE_CONTAINMENT_THRESHOLD_KM` of the postcode's own centroid sort by distance first,
|
|
194
|
+
* the rest appended in their original order. Set by the resolver from `ResolveOpts.postcodeContainmentCoherence`;
|
|
195
|
+
* absent → the population-first order is untouched (byte-identical).
|
|
189
196
|
*/
|
|
190
197
|
postcodeContainmentCoherence?: boolean;
|
|
191
198
|
/**
|
|
@@ -227,8 +234,7 @@ export interface FindPlaceQuery {
|
|
|
227
234
|
* interface is async even though `node:sqlite` is sync — leaves room for `Worker`-backed implementations later without
|
|
228
235
|
* a public API break.
|
|
229
236
|
*/
|
|
230
|
-
export interface PlaceLookup {
|
|
237
|
+
export interface PlaceLookup extends Disposable {
|
|
231
238
|
findPlace(query: FindPlaceQuery): Promise<PlaceCandidate[]>;
|
|
232
|
-
close(): void;
|
|
233
239
|
}
|
|
234
240
|
//# sourceMappingURL=types.d.ts.map
|
package/out/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACrB,SAAS,GACT,aAAa,GACb,QAAQ,GACR,aAAa,GACb,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,SAAS,GACT,eAAe,GACf,WAAW,GACX,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,SAAS,CAAA;AAEZ;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,YAAY,CAAA;IACvB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,E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G;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5C;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5C;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC9C,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAA;CAC3D"}
|
package/out/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
package/out/unified-schema.d.ts
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
* table (which lookup.ts's parent-constraint subquery needs) — see `populateAncestors`. The
|
|
12
12
|
* `place_search` FTS5 + `place_bbox` R*Tree are built separately by `build-fts` (fts.ts).
|
|
13
13
|
*/
|
|
14
|
-
import type {
|
|
15
|
-
|
|
14
|
+
import type { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
15
|
+
import type { WOFDatabase } from "#schema";
|
|
16
|
+
export declare function createUnifiedSchema(db: DatabaseClient<WOFDatabase>): Promise<void>;
|
|
16
17
|
/**
|
|
17
18
|
* Populate the `ancestors` table by walking each place's `parent_id` chain in `spr` (transitive closure, including the
|
|
18
19
|
* place itself). Idempotent: drops + rebuilds the table contents. Returns the row count. Run after `spr` is fully
|
|
@@ -20,6 +21,6 @@ export declare function createUnifiedSchema(db: DatabaseSync): Promise<void>;
|
|
|
20
21
|
* Sentinel/negative parent_ids and cycles terminate the walk. ~4 rows/place average; a transaction keeps the ~5M
|
|
21
22
|
* inserts fast.
|
|
22
23
|
*/
|
|
23
|
-
export declare function populateAncestors(db:
|
|
24
|
-
export declare function createUnifiedIndexes(db:
|
|
24
|
+
export declare function populateAncestors<DB>(db: DatabaseClient<DB>): number;
|
|
25
|
+
export declare function createUnifiedIndexes(db: DatabaseClient<WOFDatabase>): Promise<void>;
|
|
25
26
|
//# sourceMappingURL=unified-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-schema.d.ts","sourceRoot":"","sources":["../unified-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"unified-schema.d.ts","sourceRoot":"","sources":["../lib/unified-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA+ExF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,MAAM,CA0CpE;AAED,wBAAsB,oBAAoB,CAAC,EAAE,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBzF"}
|
package/out/unified-schema.js
CHANGED
|
@@ -11,16 +11,14 @@
|
|
|
11
11
|
* table (which lookup.ts's parent-constraint subquery needs) — see `populateAncestors`. The
|
|
12
12
|
* `place_search` FTS5 + `place_bbox` R*Tree are built separately by `build-fts` (fts.ts).
|
|
13
13
|
*/
|
|
14
|
-
import { DatabaseClient } from "@mailwoman/core/kysley/client";
|
|
15
14
|
export async function createUnifiedSchema(db) {
|
|
16
15
|
// PRAGMAs stay raw — not Kysely-modelled, and these tune the bulk build.
|
|
17
16
|
db.exec("PRAGMA journal_mode = WAL");
|
|
18
17
|
db.exec("PRAGMA busy_timeout = 10000");
|
|
19
18
|
db.exec("PRAGMA synchronous = OFF");
|
|
20
|
-
// `
|
|
19
|
+
// `db` wraps `db` for the DDL (the house idiom); the caller owns `db`'s lifecycle, so we don't
|
|
21
20
|
// destroy it here. The bulk INSERTs (populateAncestors + build-unified-wof) stay on the raw handle.
|
|
22
|
-
|
|
23
|
-
await kdb.schema
|
|
21
|
+
await db.schema
|
|
24
22
|
.createTable("spr")
|
|
25
23
|
.ifNotExists()
|
|
26
24
|
.addColumn("id", "integer", (c) => c.primaryKey())
|
|
@@ -47,7 +45,7 @@ export async function createUnifiedSchema(db) {
|
|
|
47
45
|
// x_variant rows tagged with an official language ("MSP", "Frisco") stay 0. Primary-name mirror
|
|
48
46
|
// rows stay 0 too: the name-exact tier already consults spr.name; `official` only marks the
|
|
49
47
|
// ALIASES eligible to join it. Both are ingest-time facts, never computed at query time.
|
|
50
|
-
await
|
|
48
|
+
await db.schema
|
|
51
49
|
.createTable("names")
|
|
52
50
|
.ifNotExists()
|
|
53
51
|
.addColumn("id", "integer", (c) => c.notNull())
|
|
@@ -59,7 +57,7 @@ export async function createUnifiedSchema(db) {
|
|
|
59
57
|
.addColumn("official", "integer", (c) => c.notNull().defaultTo(0))
|
|
60
58
|
.addColumn("lastmodified", "integer", (c) => c.notNull().defaultTo(0))
|
|
61
59
|
.execute();
|
|
62
|
-
await
|
|
60
|
+
await db.schema
|
|
63
61
|
.createTable("concordances")
|
|
64
62
|
.ifNotExists()
|
|
65
63
|
.addColumn("id", "integer", (c) => c.notNull())
|
|
@@ -67,7 +65,7 @@ export async function createUnifiedSchema(db) {
|
|
|
67
65
|
.addColumn("other_source", "text", (c) => c.notNull())
|
|
68
66
|
.addColumn("lastmodified", "integer", (c) => c.notNull().defaultTo(0))
|
|
69
67
|
.execute();
|
|
70
|
-
await
|
|
68
|
+
await db.schema
|
|
71
69
|
.createTable("place_population")
|
|
72
70
|
.ifNotExists()
|
|
73
71
|
.addColumn("id", "integer", (c) => c.primaryKey())
|
|
@@ -78,7 +76,7 @@ export async function createUnifiedSchema(db) {
|
|
|
78
76
|
// `spr.id IN (SELECT id FROM ancestors WHERE ancestor_id = ?)`. The off-the-shelf WOF dumps
|
|
79
77
|
// ship this table; our build derives it from the parent_id chain (see populateAncestors) since
|
|
80
78
|
// we don't capture `wof:hierarchy`.
|
|
81
|
-
await
|
|
79
|
+
await db.schema
|
|
82
80
|
.createTable("ancestors")
|
|
83
81
|
.ifNotExists()
|
|
84
82
|
.addColumn("id", "integer", (c) => c.notNull())
|
|
@@ -124,19 +122,18 @@ export function populateAncestors(db) {
|
|
|
124
122
|
return count;
|
|
125
123
|
}
|
|
126
124
|
export async function createUnifiedIndexes(db) {
|
|
127
|
-
|
|
128
|
-
await
|
|
129
|
-
await
|
|
130
|
-
await
|
|
131
|
-
await
|
|
132
|
-
await
|
|
133
|
-
await kdb.schema
|
|
125
|
+
await db.schema.createIndex("spr_by_placetype").ifNotExists().on("spr").column("placetype").execute();
|
|
126
|
+
await db.schema.createIndex("spr_by_country").ifNotExists().on("spr").column("country").execute();
|
|
127
|
+
await db.schema.createIndex("spr_by_parent").ifNotExists().on("spr").column("parent_id").execute();
|
|
128
|
+
await db.schema.createIndex("names_by_id").ifNotExists().on("names").column("id").execute();
|
|
129
|
+
await db.schema.createIndex("names_by_name").ifNotExists().on("names").column("name").execute();
|
|
130
|
+
await db.schema
|
|
134
131
|
.createIndex("concordances_by_id")
|
|
135
132
|
.ifNotExists()
|
|
136
133
|
.on("concordances")
|
|
137
134
|
.columns(["id", "lastmodified"])
|
|
138
135
|
.execute();
|
|
139
|
-
await
|
|
136
|
+
await db.schema
|
|
140
137
|
.createIndex("concordances_by_other_id")
|
|
141
138
|
.ifNotExists()
|
|
142
139
|
.on("concordances")
|
|
@@ -144,7 +141,7 @@ export async function createUnifiedIndexes(db) {
|
|
|
144
141
|
.execute();
|
|
145
142
|
// ancestor_id is the hot column (parent-constraint queries `WHERE ancestor_id = ?`); id supports
|
|
146
143
|
// the reverse lookup.
|
|
147
|
-
await
|
|
148
|
-
await
|
|
144
|
+
await db.schema.createIndex("ancestors_by_ancestor").ifNotExists().on("ancestors").column("ancestor_id").execute();
|
|
145
|
+
await db.schema.createIndex("ancestors_by_id").ifNotExists().on("ancestors").column("id").execute();
|
|
149
146
|
}
|
|
150
147
|
//# sourceMappingURL=unified-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-schema.js","sourceRoot":"","sources":["../unified-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"unified-schema.js","sourceRoot":"","sources":["../lib/unified-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EAA+B;IACxE,yEAAyE;IACzE,EAAE,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;IACpC,EAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAA;IACtC,EAAE,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;IAEnC,+FAA+F;IAC/F,oGAAoG;IAEpG,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,KAAK,CAAC;SAClB,WAAW,EAAE;SACb,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;SACjD,SAAS,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CA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C,cAAc,CAAC;SAClB,OAAO,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;SACrC,OAAO,EAAE,CAAA;IAEX,iGAAiG;IACjG,sBAAsB;IACtB,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAA;IAClH,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;AACpG,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The consult `./lookup.ts`'s docstring instructs: "callers building negative evidence must consult
|
|
6
|
+
* `readLayerCoverage`, not this reader alone." A bare `null` from `nearestUPRN` is two different facts — no UPRN here,
|
|
7
|
+
* or nobody surveyed here — and this is the only place that separates them. It answers an {@link Exclusion} or `null`,
|
|
8
|
+
* so a caller cannot read an unsurveyed cell as an empty one by accident.
|
|
9
|
+
*
|
|
10
|
+
* `radiusM` is a CALLER'S parameter with no default. There is no radius that is correct for both "which property is
|
|
11
|
+
* this coordinate" and "is this street built at all", and picking one here would bury that choice where nobody
|
|
12
|
+
* reviewing an exclusion can see it.
|
|
13
|
+
*/
|
|
14
|
+
import { type LayerContractHandle } from "@mailwoman/core/layers";
|
|
15
|
+
import { type Exclusion } from "@mailwoman/evidence";
|
|
16
|
+
import type { UPRNLookup } from "#uprn/lookup";
|
|
17
|
+
/**
|
|
18
|
+
* The identity fold, on purpose: this probe keys on a COORDINATE, not a name, so there is no string folding for the
|
|
19
|
+
* builder and the probe to disagree about. Passing the same identity as both `probeFold` and `layerFold` records that
|
|
20
|
+
* the fold axis is not in play here, rather than silently omitting the check. It is not a stub.
|
|
21
|
+
*/
|
|
22
|
+
export declare const UPRN_EXISTENCE_FOLD: string;
|
|
23
|
+
/**
|
|
24
|
+
* The countries OS Open UPRN covers. Northern Ireland is outside the product, so a `null` there is unknown and must
|
|
25
|
+
* never become evidence of absence; the country check is what keeps it out.
|
|
26
|
+
*/
|
|
27
|
+
export declare const UPRN_COVERED_COUNTRIES: ReadonlySet<string>;
|
|
28
|
+
export interface UPRNAbsenceInput {
|
|
29
|
+
lookup: UPRNLookup;
|
|
30
|
+
/**
|
|
31
|
+
* The same file the lookup reads; the layer contract tables live beside the points.
|
|
32
|
+
*/
|
|
33
|
+
contractDB: LayerContractHandle;
|
|
34
|
+
latitude: number;
|
|
35
|
+
longitude: number;
|
|
36
|
+
radiusM: number;
|
|
37
|
+
/**
|
|
38
|
+
* ISO-2 country of the thing whose absence is being asserted, when known.
|
|
39
|
+
*/
|
|
40
|
+
country?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The coverage cell a coordinate falls in, derived from its stored res-9 cell exactly as the builder derives it — never
|
|
44
|
+
* from the centroid, which lands in a different parent for a fraction of cells.
|
|
45
|
+
*/
|
|
46
|
+
export declare function uprnCoverageCell(latitude: number, longitude: number): number;
|
|
47
|
+
/**
|
|
48
|
+
* An {@link Exclusion} when no UPRN lies within `radiusM` AND the layer's coverage licenses saying so; `null` on a hit
|
|
49
|
+
* (presence is not this probe's business) and on every refusal (unsurveyed cell, `source_present` basis, a country the
|
|
50
|
+
* product does not cover). Never throws on a refusal: the caller falls open to the ranking it already had.
|
|
51
|
+
*/
|
|
52
|
+
export declare function uprnAbsenceAt(input: UPRNAbsenceInput): Promise<Exclusion | null>;
|
|
53
|
+
//# sourceMappingURL=existence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"existence.d.ts","sourceRoot":"","sources":["../../lib/uprn/existence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAwC,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACvG,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAGzF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAG9C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAyB,CAAA;AAEzD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAAmB,CAAA;AAE1E,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,UAAU,CAAA;IAClB;;OAEG;IACH,UAAU,EAAE,mBAAmB,CAAA;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAqBtF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The consult `./lookup.ts`'s docstring instructs: "callers building negative evidence must consult
|
|
6
|
+
* `readLayerCoverage`, not this reader alone." A bare `null` from `nearestUPRN` is two different facts — no UPRN here,
|
|
7
|
+
* or nobody surveyed here — and this is the only place that separates them. It answers an {@link Exclusion} or `null`,
|
|
8
|
+
* so a caller cannot read an unsurveyed cell as an empty one by accident.
|
|
9
|
+
*
|
|
10
|
+
* `radiusM` is a CALLER'S parameter with no default. There is no radius that is correct for both "which property is
|
|
11
|
+
* this coordinate" and "is this street built at all", and picking one here would bury that choice where nobody
|
|
12
|
+
* reviewing an exclusion can see it.
|
|
13
|
+
*/
|
|
14
|
+
import { readLayerCoverage, readLayerManifest } from "@mailwoman/core/layers";
|
|
15
|
+
import { foldIdentity, requireExclusionBasis } from "@mailwoman/evidence";
|
|
16
|
+
import { shortCellToParentInt } from "@mailwoman/spatial";
|
|
17
|
+
import { UPRN_COVERAGE_H3_RESOLUTION, UPRN_H3_RESOLUTION, uprnH3Cell } from "#uprn/schema";
|
|
18
|
+
/**
|
|
19
|
+
* The identity fold, on purpose: this probe keys on a COORDINATE, not a name, so there is no string folding for the
|
|
20
|
+
* builder and the probe to disagree about. Passing the same identity as both `probeFold` and `layerFold` records that
|
|
21
|
+
* the fold axis is not in play here, rather than silently omitting the check. It is not a stub.
|
|
22
|
+
*/
|
|
23
|
+
export const UPRN_EXISTENCE_FOLD = foldIdentity((s) => s);
|
|
24
|
+
/**
|
|
25
|
+
* The countries OS Open UPRN covers. Northern Ireland is outside the product, so a `null` there is unknown and must
|
|
26
|
+
* never become evidence of absence; the country check is what keeps it out.
|
|
27
|
+
*/
|
|
28
|
+
export const UPRN_COVERED_COUNTRIES = new Set(["GB"]);
|
|
29
|
+
/**
|
|
30
|
+
* The coverage cell a coordinate falls in, derived from its stored res-9 cell exactly as the builder derives it — never
|
|
31
|
+
* from the centroid, which lands in a different parent for a fraction of cells.
|
|
32
|
+
*/
|
|
33
|
+
export function uprnCoverageCell(latitude, longitude) {
|
|
34
|
+
return shortCellToParentInt(uprnH3Cell(latitude, longitude), UPRN_H3_RESOLUTION, UPRN_COVERAGE_H3_RESOLUTION);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* An {@link Exclusion} when no UPRN lies within `radiusM` AND the layer's coverage licenses saying so; `null` on a hit
|
|
38
|
+
* (presence is not this probe's business) and on every refusal (unsurveyed cell, `source_present` basis, a country the
|
|
39
|
+
* product does not cover). Never throws on a refusal: the caller falls open to the ranking it already had.
|
|
40
|
+
*/
|
|
41
|
+
export async function uprnAbsenceAt(input) {
|
|
42
|
+
const coverageCell = uprnCoverageCell(input.latitude, input.longitude);
|
|
43
|
+
const coverage = await readLayerCoverage(input.contractDB, coverageCell);
|
|
44
|
+
if (!coverage)
|
|
45
|
+
return null;
|
|
46
|
+
if (input.lookup.nearestUPRN(input.latitude, input.longitude, input.radiusM))
|
|
47
|
+
return null;
|
|
48
|
+
const manifest = await readLayerManifest(input.contractDB);
|
|
49
|
+
return requireExclusionBasis({
|
|
50
|
+
layer: manifest.name,
|
|
51
|
+
source: manifest.source,
|
|
52
|
+
vintage: manifest.sourceVintage,
|
|
53
|
+
h3Cell: coverageCell,
|
|
54
|
+
cell: coverage,
|
|
55
|
+
probeFold: UPRN_EXISTENCE_FOLD,
|
|
56
|
+
layerFold: UPRN_EXISTENCE_FOLD,
|
|
57
|
+
country: input.country,
|
|
58
|
+
countries: UPRN_COVERED_COUNTRIES,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=existence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"existence.js","sourceRoot":"","sources":["../../lib/uprn/existence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAA4B,MAAM,wBAAwB,CAAA;AACvG,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAkB,MAAM,qBAAqB,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAGzD,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE1F;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAw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B,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/uprn/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA"}
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
* `latLngToCell`/`gridDisk` come from `h3-js`; the 48-bit short-cell packing is
|
|
25
25
|
* `@mailwoman/spatial`'s `shortCellToInt` via `uprnFullCell` — never reimplemented here.
|
|
26
26
|
*/
|
|
27
|
-
import {
|
|
27
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
28
|
+
import type { UPRNDatabase } from "#uprn/schema";
|
|
28
29
|
/**
|
|
29
30
|
* Hard ceiling on `radiusM`. Keeps the probe bounded (10 km → ~72 rings ≈ 15.8k cells ≈ 18 `IN` chunks); a caller who
|
|
30
31
|
* wants a wider search than "which property is this coordinate" has outgrown this reader and should say so loudly.
|
|
@@ -51,7 +52,7 @@ export interface UPRNLookupOpts {
|
|
|
51
52
|
/**
|
|
52
53
|
* Pre-opened handle (tests / shared connections). Mutually exclusive with `databasePath`.
|
|
53
54
|
*/
|
|
54
|
-
database?:
|
|
55
|
+
database?: DatabaseClient<UPRNDatabase>;
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
58
|
* Node reader over `uprn.db`. `implements Disposable` so callers can `using lookup = new UPRNLookup(...)` — the same
|
|
@@ -79,7 +80,6 @@ export declare class UPRNLookup implements Disposable {
|
|
|
79
80
|
* @throws {RangeError} When `radiusM` is not a positive finite number, or exceeds the cap.
|
|
80
81
|
*/
|
|
81
82
|
nearestUPRN(latitude: number, longitude: number, radiusM: number): UPRNNearestHit | null;
|
|
82
|
-
close(): void;
|
|
83
83
|
[Symbol.dispose](): void;
|
|
84
84
|
}
|
|
85
|
-
//# sourceMappingURL=
|
|
85
|
+
//# sourceMappingURL=lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../lib/uprn/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAGzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAiBhD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAA;AAO/C,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CACvC;AAQD;;;GAGG;AACH,qBAAa,UAAW,YAAW,UAAU;;gBAahC,IAAI,EAAE,cAAc;IAYhC;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAMjD;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAyDxF,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGxB"}
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
* `latLngToCell`/`gridDisk` come from `h3-js`; the 48-bit short-cell packing is
|
|
25
25
|
* `@mailwoman/spatial`'s `shortCellToInt` via `uprnFullCell` — never reimplemented here.
|
|
26
26
|
*/
|
|
27
|
-
import {
|
|
27
|
+
import { allRows } from "@mailwoman/core/utils";
|
|
28
28
|
import { haversineKm, shortCellToInt } from "@mailwoman/spatial";
|
|
29
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
29
30
|
import { gridDisk } from "h3-js";
|
|
30
|
-
import {
|
|
31
|
-
import { uprnFullCell } from "./uprn-schema.js";
|
|
31
|
+
import { uprnFullCell } from "#uprn/schema";
|
|
32
32
|
/**
|
|
33
33
|
* Conservative FLOOR on how much CENTRE distance one unit of res-9 GRID distance buys, metres. Adjacent centres sit √3
|
|
34
34
|
* × edge apart (avg edge 174.4 m → ≈302 m); the worst bearing across a ring costs a further ×0.866, and H3's projection
|
|
@@ -57,7 +57,11 @@ const CELL_PROBE_CHUNK = 900;
|
|
|
57
57
|
*/
|
|
58
58
|
export class UPRNLookup {
|
|
59
59
|
#db;
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Resources this instance opened. A connection handed in by a caller is NOT in here, so disposal cannot reach it —
|
|
62
|
+
* ownership is membership rather than a flag a later branch has to check.
|
|
63
|
+
*/
|
|
64
|
+
#resources = new DisposableStack();
|
|
61
65
|
/**
|
|
62
66
|
* `uprn` → its point (rowid-alias PK hit).
|
|
63
67
|
*/
|
|
@@ -65,11 +69,9 @@ export class UPRNLookup {
|
|
|
65
69
|
constructor(opts) {
|
|
66
70
|
if (opts.database) {
|
|
67
71
|
this.#db = opts.database;
|
|
68
|
-
this.#ownsDB = false;
|
|
69
72
|
}
|
|
70
73
|
else if (opts.databasePath) {
|
|
71
|
-
this.#db = new
|
|
72
|
-
this.#ownsDB = true;
|
|
74
|
+
this.#db = this.#resources.use(new DatabaseClient(opts.databasePath, { readOnly: true }));
|
|
73
75
|
}
|
|
74
76
|
else {
|
|
75
77
|
throw new Error("UPRNLookup needs `databasePath` or `database`");
|
|
@@ -140,13 +142,8 @@ export class UPRNLookup {
|
|
|
140
142
|
}
|
|
141
143
|
return best;
|
|
142
144
|
}
|
|
143
|
-
close() {
|
|
144
|
-
if (this.#ownsDB) {
|
|
145
|
-
this.#db.close();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
145
|
[Symbol.dispose]() {
|
|
149
|
-
this.
|
|
146
|
+
this.#resources[Symbol.dispose]();
|
|
150
147
|
}
|
|
151
148
|
}
|
|
152
|
-
//# sourceMappingURL=
|
|
149
|
+
//# sourceMappingURL=lookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../lib/uprn/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C;;;;;;GAMG;AACH,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAEvC;;;GAGG;AACH,MAAM,0BAA0B,GAAG,GAAG,CAAA;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAA;AAE/C;;GAEG;AACH,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAkC5B;;;GAGG;AACH,MAAM,OAAO,UAAU;IACtB,GAAG,CAA8B;IACjC;;;OAGG;IACM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAA;IAE3C;;OAEG;IACM,gBAAgB,CAAuC;IAEhE,YAAY,IAAoB;QAC/B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAA;QACzB,CAAC;aAAM,IAAI,IAAI,CA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