@mailwoman/resolver-wof-sqlite 9.2.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 +16 -19
- package/lib/address/index.ts +9 -0
- package/{address-point-interpolation.ts → lib/address/point-interpolation.ts} +24 -22
- package/{address-point-schema.ts → lib/address/point-schema.ts} +18 -4
- package/{address-point.ts → lib/address/point.ts} +89 -27
- package/{ancestry-backfill.ts → lib/ancestry/backfill.ts} +14 -19
- package/{ancestry.ts → lib/ancestry/index.ts} +5 -3
- package/{build-candidate.ts → lib/build-candidate.ts} +84 -77
- 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/{candidate/shard-fold.ts → lib/candidate/extract-fold.ts} +26 -25
- package/{candidate → lib/candidate}/name-roles.ts +17 -16
- package/{candidate → lib/candidate}/own-name.ts +1 -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} +76 -73
- package/{candidate-schema.ts → lib/candidate-schema.ts} +5 -5
- 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} +8 -11
- 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} +9 -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} +41 -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} +27 -25
- package/{lookup.ts → lib/lookup.ts} +129 -141
- 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 -8
- package/lib/poi/index.ts +8 -0
- package/{poi-lookup.ts → lib/poi/lookup.ts} +22 -28
- 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} +29 -10
- 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 -46
- package/{schema.ts → lib/schema.ts} +10 -0
- package/{search-fetch.ts → lib/search-fetch.ts} +29 -28
- package/{sqlite-convention-source.ts → lib/sqlite-convention-source.ts} +9 -10
- package/{sqlite-utils.ts → lib/sqlite-utils.ts} +14 -18
- package/{street-centroid-schema.ts → lib/street/centroid-schema.ts} +5 -5
- package/{street-centroid.ts → lib/street/centroid.ts} +14 -21
- 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} +44 -19
- 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 -18
- package/{uprn-schema.ts → lib/uprn/schema.ts} +3 -3
- 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} +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} +16 -8
- package/out/address/point.d.ts.map +1 -0
- package/out/{address-point.js → address/point.js} +71 -20
- 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 +30 -24
- package/out/build-candidate.d.ts.map +1 -1
- package/out/build-candidate.js +50 -52
- 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 +32 -0
- package/out/candidate/extract-fold.d.ts.map +1 -0
- package/out/candidate/{shard-fold.js → extract-fold.js} +20 -20
- 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 +1 -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 +11 -9
- package/out/candidate-lookup.d.ts.map +1 -1
- package/out/candidate-lookup.js +61 -58
- package/out/candidate-lookup.js.map +1 -1
- package/out/candidate-schema.d.ts +5 -5
- package/out/candidate-schema.d.ts.map +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 +6 -5
- 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 +4 -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} +10 -13
- package/out/fst/freshness.d.ts.map +1 -0
- package/out/{fst-freshness.js → fst/freshness.js} +41 -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 +10 -9
- 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 +21 -20
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +102 -112
- 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 -5
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +3 -3
- 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 +13 -5
- package/out/primary-preference.d.ts.map +1 -1
- package/out/primary-preference.js +16 -8
- 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 -8
- package/out/sqlite-utils.d.ts.map +1 -1
- package/out/sqlite-utils.js +7 -8
- 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} +6 -6
- 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} +25 -14
- package/out/street/normalize.d.ts.map +1 -0
- package/out/{street-normalize.js → street/normalize.js} +36 -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 +338 -86
- package/out/weights-overlay-linker.js.map +1 -1
- package/package.json +465 -269
- 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.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.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
|
@@ -9,88 +9,24 @@
|
|
|
9
9
|
* This is a read-only counterpart to fst-serialize.ts — serialization stays Node-only (it's a
|
|
10
10
|
* build-time operation).
|
|
11
11
|
*/
|
|
12
|
-
import { tryParsingJSON } from "@mailwoman/core/
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
* Format version that widened the per-state edge and place counters from 16 to 32 bits, growing the state entry from 12
|
|
16
|
-
* to 16 bytes. Readers branch on it to stay backward-compatible with v2/v3 files.
|
|
17
|
-
*/
|
|
18
|
-
const VERSION_WIDE_STATE_COUNTERS = 4;
|
|
19
|
-
/**
|
|
20
|
-
* State-table entry size in bytes at or above {@link VERSION_WIDE_STATE_COUNTERS}.
|
|
21
|
-
*/
|
|
22
|
-
const WIDE_STATE_ENTRY_SIZE = 16;
|
|
23
|
-
/**
|
|
24
|
-
* State-table entry size in bytes below {@link VERSION_WIDE_STATE_COUNTERS}.
|
|
25
|
-
*/
|
|
26
|
-
const NARROW_STATE_ENTRY_SIZE = 12;
|
|
27
|
-
/**
|
|
28
|
-
* First format version carrying the trailing metadata block; older files simply have none.
|
|
29
|
-
*/
|
|
30
|
-
const VERSION_WITH_METADATA = 3;
|
|
31
|
-
const HEADER_SIZE = 32;
|
|
32
|
-
const EDGE_ENTRY_SIZE = 8;
|
|
33
|
-
/**
|
|
34
|
-
* Format version that split the single `importance` float into `referential` + `encyclopedic` (ROAD_TO_V9 §2 R1),
|
|
35
|
-
* growing the place entry from 56 to 60 bytes. Mirrors `fst-serialize.ts`'s constant of the same name.
|
|
36
|
-
*/
|
|
37
|
-
const VERSION_TWO_SCORE_SPLIT = 5;
|
|
38
|
-
/**
|
|
39
|
-
* Place-entry size in bytes at or above {@link VERSION_TWO_SCORE_SPLIT}.
|
|
40
|
-
*/
|
|
41
|
-
const SPLIT_PLACE_ENTRY_SIZE = 60;
|
|
42
|
-
/**
|
|
43
|
-
* Place-entry size in bytes below {@link VERSION_TWO_SCORE_SPLIT}.
|
|
44
|
-
*/
|
|
45
|
-
const LEGACY_PLACE_ENTRY_SIZE = 56;
|
|
46
|
-
/**
|
|
47
|
-
* Byte offset of the encyclopedic float inside a v5 place entry — immediately after the 8-slot parent chain.
|
|
48
|
-
*/
|
|
49
|
-
const ENCYCLOPEDIC_OFFSET = 56;
|
|
50
|
-
/**
|
|
51
|
-
* `placeFlags` bit 0 (byte `pp+7`, v5+): this place carries an encyclopedic score. Per-place because absence is the
|
|
52
|
-
* common case; see `fst-serialize.ts`.
|
|
53
|
-
*/
|
|
54
|
-
const PLACE_FLAG_HAS_ENCYCLOPEDIC = 1;
|
|
55
|
-
/**
|
|
56
|
-
* "FST\0".
|
|
57
|
-
*/
|
|
58
|
-
const MAGIC_BYTES = [0x46, 0x53, 0x54, 0x00];
|
|
59
|
-
/**
|
|
60
|
-
* Must track the serializer's VERSION (fst-serialize.ts, currently 5). The v3 provenance + v4 16-byte-state/u32-count
|
|
61
|
-
* layout logic below already matches the Node deserializer; only this gate was left stale at 2, so the browser FST
|
|
62
|
-
* loader rejected every real (v4) artifact. It was left stale again at 4 by the v5 two-score split until this line
|
|
63
|
-
* moved with it — the gate is a SEPARATE number from the layout branches, which is exactly why it keeps drifting.
|
|
64
|
-
*/
|
|
65
|
-
const MAX_VERSION = 5;
|
|
66
|
-
const PLACETYPE_ORDER = [
|
|
67
|
-
"country",
|
|
68
|
-
"region",
|
|
69
|
-
"county",
|
|
70
|
-
"locality",
|
|
71
|
-
"localadmin",
|
|
72
|
-
"borough",
|
|
73
|
-
"neighbourhood",
|
|
74
|
-
"postalcode",
|
|
75
|
-
"campus",
|
|
76
|
-
"dependency",
|
|
77
|
-
"street_affix",
|
|
78
|
-
];
|
|
12
|
+
import { tryParsingJSON } from "@mailwoman/core/json";
|
|
13
|
+
import { EDGE_ENTRY_SIZE, ENCYCLOPEDIC_OFFSET, FST_FORMAT_VERSION, FST_MAGIC_BYTES, HEADER_SIZE, LEGACY_PLACE_ENTRY_SIZE, NARROW_STATE_ENTRY_SIZE, PLACE_FLAG_HAS_ENCYCLOPEDIC, PLACETYPE_ORDER, SPLIT_PLACE_ENTRY_SIZE, VERSION_TWO_SCORE_SPLIT, VERSION_WIDE_STATE_COUNTERS, VERSION_WITH_METADATA, WIDE_STATE_ENTRY_SIZE, } from "#fst/format";
|
|
14
|
+
import { FSTMatcher } from "#fst/matcher";
|
|
79
15
|
export function deserializeFSTWeb(input) {
|
|
80
16
|
const bytes = input instanceof ArrayBuffer ? new Uint8Array(input) : input;
|
|
81
17
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
82
18
|
const decoder = new TextDecoder("utf-8");
|
|
83
19
|
if (bytes.byteLength < HEADER_SIZE)
|
|
84
20
|
throw new Error("FST buffer too small for header");
|
|
85
|
-
if (bytes[0] !==
|
|
86
|
-
bytes[1] !==
|
|
87
|
-
bytes[2] !==
|
|
88
|
-
bytes[3] !==
|
|
21
|
+
if (bytes[0] !== FST_MAGIC_BYTES[0] ||
|
|
22
|
+
bytes[1] !== FST_MAGIC_BYTES[1] ||
|
|
23
|
+
bytes[2] !== FST_MAGIC_BYTES[2] ||
|
|
24
|
+
bytes[3] !== FST_MAGIC_BYTES[3]) {
|
|
89
25
|
throw new Error("FST magic mismatch");
|
|
90
26
|
}
|
|
91
27
|
const version = view.getUint16(4, true);
|
|
92
|
-
if (version < 1 || version >
|
|
93
|
-
throw new Error(`FST version ${version} unsupported (expected 1..${
|
|
28
|
+
if (version < 1 || version > FST_FORMAT_VERSION) {
|
|
29
|
+
throw new Error(`FST version ${version} unsupported (expected 1..${FST_FORMAT_VERSION})`);
|
|
94
30
|
}
|
|
95
31
|
const isV2 = version >= 2;
|
|
96
32
|
const isSplit = version >= VERSION_TWO_SCORE_SPLIT;
|
|
@@ -188,4 +124,4 @@ export function readFSTProvenanceWeb(input) {
|
|
|
188
124
|
return undefined;
|
|
189
125
|
}
|
|
190
126
|
}
|
|
191
|
-
//# sourceMappingURL=
|
|
127
|
+
//# sourceMappingURL=deserialize-web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deserialize-web.js","sourceRoot":"","sources":["../../lib/fst/deserialize-web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,GACrB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGzC,MAAM,UAAU,iBAAiB,CAAC,KAA+B;IAChE,MAAM,KAAK,GAAG,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAC1E,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;IAC3E,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAA;IAExC,IAAI,KAAK,CAAC,UAAU,GAAG,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IAEtF,IACC,KAAK,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC;QAC/B,KAAK,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,C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,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAEjD,IAAI,gBAAgB,KAAK,CAAC,IAAI,gBAAgB,IAAI,KAAK,CAAC,UAAU;QAAE,OAAO,SAAS,CAAA;IAEpF,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAA;QACtD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAA;QAEpG,OAAO,cAAc,CAAgB,OAAO,CAAC,IAAI,SAAS,CAAA;IAC3D,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAA;IACjB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The FST binary-format constants, shared by the Node serializer/deserializer (`fst-serialize.ts`)
|
|
7
|
+
* and the browser deserializer (`fst-deserialize-web.ts`). Platform-free by design — no Buffer at
|
|
8
|
+
* module scope; both runtimes convert {@link FST_MAGIC_BYTES} themselves.
|
|
9
|
+
*/
|
|
10
|
+
import type { PlacetypeID } from "#fst/types";
|
|
11
|
+
/**
|
|
12
|
+
* Format version this tree WRITES and the maximum either deserializer accepts, published so a freshness guard can call
|
|
13
|
+
* an older artifact format-stale without re-typing the number (mirrors `REQUIRED_PAIR_INDEX_SCHEMA`'s role for PIX1 —
|
|
14
|
+
* see `fst-freshness.ts`).
|
|
15
|
+
*
|
|
16
|
+
* ONE constant for the writer and both readers, deliberately. The browser reader's acceptance criterion was a SEPARATE
|
|
17
|
+
* `MAX_VERSION` number from the layout branches, and it drifted twice: left stale at 2 when the v4 wide-state layout
|
|
18
|
+
* shipped (rejecting every real artifact), and stale again at 4 through the v5 two-score split until the line moved by
|
|
19
|
+
* hand. A check that is the writer's version cannot drift from it.
|
|
20
|
+
*/
|
|
21
|
+
export declare const FST_FORMAT_VERSION = 5;
|
|
22
|
+
/**
|
|
23
|
+
* Fixed header size in bytes: magic, version, and the section offsets that follow it.
|
|
24
|
+
*/
|
|
25
|
+
export declare const HEADER_SIZE = 32;
|
|
26
|
+
/**
|
|
27
|
+
* Edge-table entry: the transition label and the target state index.
|
|
28
|
+
*/
|
|
29
|
+
export declare const EDGE_ENTRY_SIZE = 8;
|
|
30
|
+
/**
|
|
31
|
+
* Format version that widened the per-state edge and place counters from 16 to 32 bits, growing the state entry from 12
|
|
32
|
+
* to 16 bytes. Readers branch on it to stay backward-compatible with v2/v3 files.
|
|
33
|
+
*/
|
|
34
|
+
export declare const VERSION_WIDE_STATE_COUNTERS = 4;
|
|
35
|
+
/**
|
|
36
|
+
* State-table entry size in bytes at or above {@link VERSION_WIDE_STATE_COUNTERS}.
|
|
37
|
+
*/
|
|
38
|
+
export declare const WIDE_STATE_ENTRY_SIZE = 16;
|
|
39
|
+
/**
|
|
40
|
+
* State-table entry size in bytes below {@link VERSION_WIDE_STATE_COUNTERS}.
|
|
41
|
+
*/
|
|
42
|
+
export declare const NARROW_STATE_ENTRY_SIZE = 12;
|
|
43
|
+
/**
|
|
44
|
+
* First format version carrying the trailing metadata block; older files simply have none.
|
|
45
|
+
*/
|
|
46
|
+
export declare const VERSION_WITH_METADATA = 3;
|
|
47
|
+
/**
|
|
48
|
+
* Format version that split the single `importance` float into `referential` + `encyclopedic` (ROAD_TO_V9 §2 R1),
|
|
49
|
+
* growing the place entry from 56 to 60 bytes and claiming the previously-reserved `pp+7` byte as
|
|
50
|
+
* {@link PLACE_FLAG_HAS_ENCYCLOPEDIC}.
|
|
51
|
+
*/
|
|
52
|
+
export declare const VERSION_TWO_SCORE_SPLIT = 5;
|
|
53
|
+
/**
|
|
54
|
+
* Place-entry size in bytes at or above {@link VERSION_TWO_SCORE_SPLIT}.
|
|
55
|
+
*/
|
|
56
|
+
export declare const SPLIT_PLACE_ENTRY_SIZE = 60;
|
|
57
|
+
/**
|
|
58
|
+
* Place-entry size in bytes below {@link VERSION_TWO_SCORE_SPLIT}.
|
|
59
|
+
*/
|
|
60
|
+
export declare const LEGACY_PLACE_ENTRY_SIZE = 56;
|
|
61
|
+
/**
|
|
62
|
+
* Byte offset of the encyclopedic float inside a v5 place entry — immediately after the 8-slot parent chain.
|
|
63
|
+
*/
|
|
64
|
+
export declare const ENCYCLOPEDIC_OFFSET = 56;
|
|
65
|
+
/**
|
|
66
|
+
* `placeFlags` bit 0 (byte `pp+7`, v5+): this place carries an encyclopedic score. Per-PLACE rather than per-file
|
|
67
|
+
* because absence is the common case — roughly 89% of the 2026-08-05 gazetteer has no Wikipedia article — and a
|
|
68
|
+
* file-level flag would force every one of those rows to claim a 0 it never had.
|
|
69
|
+
*/
|
|
70
|
+
export declare const PLACE_FLAG_HAS_ENCYCLOPEDIC = 1;
|
|
71
|
+
/**
|
|
72
|
+
* File magic, "FST\0" as bytes. A reader rejects anything not starting with these four bytes before parsing further.
|
|
73
|
+
*/
|
|
74
|
+
export declare const FST_MAGIC_BYTES: readonly number[];
|
|
75
|
+
/**
|
|
76
|
+
* Placetypes in hierarchy order, largest first. The index into this array is what gets written into a place entry, so
|
|
77
|
+
* REORDERING IT BREAKS EVERY EXISTING FILE — append instead, and bump the version.
|
|
78
|
+
*/
|
|
79
|
+
export declare const PLACETYPE_ORDER: readonly PlacetypeID[];
|
|
80
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../lib/fst/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B;;GAEG;AACH,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC;;;GAGG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAA;AAEvC;;GAEG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAA6B,CAAA;AAE1E;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,EAYjD,CAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The FST binary-format constants, shared by the Node serializer/deserializer (`fst-serialize.ts`)
|
|
7
|
+
* and the browser deserializer (`fst-deserialize-web.ts`). Platform-free by design — no Buffer at
|
|
8
|
+
* module scope; both runtimes convert {@link FST_MAGIC_BYTES} themselves.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Format version this tree WRITES and the maximum either deserializer accepts, published so a freshness guard can call
|
|
12
|
+
* an older artifact format-stale without re-typing the number (mirrors `REQUIRED_PAIR_INDEX_SCHEMA`'s role for PIX1 —
|
|
13
|
+
* see `fst-freshness.ts`).
|
|
14
|
+
*
|
|
15
|
+
* ONE constant for the writer and both readers, deliberately. The browser reader's acceptance criterion was a SEPARATE
|
|
16
|
+
* `MAX_VERSION` number from the layout branches, and it drifted twice: left stale at 2 when the v4 wide-state layout
|
|
17
|
+
* shipped (rejecting every real artifact), and stale again at 4 through the v5 two-score split until the line moved by
|
|
18
|
+
* hand. A check that is the writer's version cannot drift from it.
|
|
19
|
+
*/
|
|
20
|
+
export const FST_FORMAT_VERSION = 5;
|
|
21
|
+
/**
|
|
22
|
+
* Fixed header size in bytes: magic, version, and the section offsets that follow it.
|
|
23
|
+
*/
|
|
24
|
+
export const HEADER_SIZE = 32;
|
|
25
|
+
/**
|
|
26
|
+
* Edge-table entry: the transition label and the target state index.
|
|
27
|
+
*/
|
|
28
|
+
export const EDGE_ENTRY_SIZE = 8;
|
|
29
|
+
/**
|
|
30
|
+
* Format version that widened the per-state edge and place counters from 16 to 32 bits, growing the state entry from 12
|
|
31
|
+
* to 16 bytes. Readers branch on it to stay backward-compatible with v2/v3 files.
|
|
32
|
+
*/
|
|
33
|
+
export const VERSION_WIDE_STATE_COUNTERS = 4;
|
|
34
|
+
/**
|
|
35
|
+
* State-table entry size in bytes at or above {@link VERSION_WIDE_STATE_COUNTERS}.
|
|
36
|
+
*/
|
|
37
|
+
export const WIDE_STATE_ENTRY_SIZE = 16;
|
|
38
|
+
/**
|
|
39
|
+
* State-table entry size in bytes below {@link VERSION_WIDE_STATE_COUNTERS}.
|
|
40
|
+
*/
|
|
41
|
+
export const NARROW_STATE_ENTRY_SIZE = 12;
|
|
42
|
+
/**
|
|
43
|
+
* First format version carrying the trailing metadata block; older files simply have none.
|
|
44
|
+
*/
|
|
45
|
+
export const VERSION_WITH_METADATA = 3;
|
|
46
|
+
/**
|
|
47
|
+
* Format version that split the single `importance` float into `referential` + `encyclopedic` (ROAD_TO_V9 §2 R1),
|
|
48
|
+
* growing the place entry from 56 to 60 bytes and claiming the previously-reserved `pp+7` byte as
|
|
49
|
+
* {@link PLACE_FLAG_HAS_ENCYCLOPEDIC}.
|
|
50
|
+
*/
|
|
51
|
+
export const VERSION_TWO_SCORE_SPLIT = 5;
|
|
52
|
+
/**
|
|
53
|
+
* Place-entry size in bytes at or above {@link VERSION_TWO_SCORE_SPLIT}.
|
|
54
|
+
*/
|
|
55
|
+
export const SPLIT_PLACE_ENTRY_SIZE = 60;
|
|
56
|
+
/**
|
|
57
|
+
* Place-entry size in bytes below {@link VERSION_TWO_SCORE_SPLIT}.
|
|
58
|
+
*/
|
|
59
|
+
export const LEGACY_PLACE_ENTRY_SIZE = 56;
|
|
60
|
+
/**
|
|
61
|
+
* Byte offset of the encyclopedic float inside a v5 place entry — immediately after the 8-slot parent chain.
|
|
62
|
+
*/
|
|
63
|
+
export const ENCYCLOPEDIC_OFFSET = 56;
|
|
64
|
+
/**
|
|
65
|
+
* `placeFlags` bit 0 (byte `pp+7`, v5+): this place carries an encyclopedic score. Per-PLACE rather than per-file
|
|
66
|
+
* because absence is the common case — roughly 89% of the 2026-08-05 gazetteer has no Wikipedia article — and a
|
|
67
|
+
* file-level flag would force every one of those rows to claim a 0 it never had.
|
|
68
|
+
*/
|
|
69
|
+
export const PLACE_FLAG_HAS_ENCYCLOPEDIC = 1;
|
|
70
|
+
/**
|
|
71
|
+
* File magic, "FST\0" as bytes. A reader rejects anything not starting with these four bytes before parsing further.
|
|
72
|
+
*/
|
|
73
|
+
export const FST_MAGIC_BYTES = [0x46, 0x53, 0x54, 0x00];
|
|
74
|
+
/**
|
|
75
|
+
* Placetypes in hierarchy order, largest first. The index into this array is what gets written into a place entry, so
|
|
76
|
+
* REORDERING IT BREAKS EVERY EXISTING FILE — append instead, and bump the version.
|
|
77
|
+
*/
|
|
78
|
+
export const PLACETYPE_ORDER = [
|
|
79
|
+
"country",
|
|
80
|
+
"region",
|
|
81
|
+
"county",
|
|
82
|
+
"locality",
|
|
83
|
+
"localadmin",
|
|
84
|
+
"borough",
|
|
85
|
+
"neighbourhood",
|
|
86
|
+
"postalcode",
|
|
87
|
+
"campus",
|
|
88
|
+
"dependency",
|
|
89
|
+
"street_affix",
|
|
90
|
+
];
|
|
91
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../lib/fst/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAA;AAE7B;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAEhC;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAA;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAA;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAA;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE1E;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,SAAS;IACT,eAAe;IACf,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,cAAc;CACd,CAAA"}
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
* decode-time bias list, not a correctness dependency. Callers print {@link formatFSTStaleWarning}
|
|
29
29
|
* and continue.
|
|
30
30
|
*/
|
|
31
|
-
import type
|
|
31
|
+
import { type PathBuilderLike } from "path-ts";
|
|
32
|
+
import type { FSTProvenance } from "#fst/types";
|
|
32
33
|
/**
|
|
33
34
|
* First serializer version carrying the trailing provenance block. Below this a file has no place to put a stamp, so
|
|
34
35
|
* "unstamped" is a statement about the FORMAT, not about the builder.
|
|
@@ -81,16 +82,12 @@ export interface FSTExpectation {
|
|
|
81
82
|
* Returns `undefined` for a file that is absent, too small, or not an FST at all — none of which is this function's
|
|
82
83
|
* business to diagnose.
|
|
83
84
|
*/
|
|
84
|
-
export declare function peekFSTStampFields(path: string): FSTStampFields | undefined
|
|
85
|
+
export declare function peekFSTStampFields(path: string): Promise<FSTStampFields | undefined>;
|
|
85
86
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* The async `md5File` in `@mailwoman/core/utils` is the one to reach for anywhere else. This exists because the FST
|
|
89
|
-
* builder and its whole call chain are synchronous by design (`buildFSTFromWOF` → `buildLocaleFSTs`), and making them
|
|
90
|
-
* async to stamp a checksum would cascade through command callers and tests for one hash. It reads in
|
|
91
|
-
* {@link MD5_CHUNK_BYTES} chunks rather than `readFileSync` — the source is a multi-gigabyte database.
|
|
87
|
+
* Re-exported from `@mailwoman/core/hash`. This package's own test imports it from here, and the sidecar convention
|
|
88
|
+
* below is what it is for.
|
|
92
89
|
*/
|
|
93
|
-
export
|
|
90
|
+
export { md5File } from "@mailwoman/core/hash";
|
|
94
91
|
/**
|
|
95
92
|
* The source identity an FST build should stamp, or a check should compare against.
|
|
96
93
|
*
|
|
@@ -103,9 +100,9 @@ export declare function md5FileSync(path: string): string;
|
|
|
103
100
|
* write and the caller still gets its answer, because refusing to check freshness on a read-only tree would be the
|
|
104
101
|
* wrong trade.
|
|
105
102
|
*/
|
|
106
|
-
export declare function readWOFSourceIdentity(
|
|
103
|
+
export declare function readWOFSourceIdentity(source: PathBuilderLike, { refreshSidecar }?: {
|
|
107
104
|
refreshSidecar?: boolean | undefined;
|
|
108
|
-
}): FSTSourceIdentity
|
|
105
|
+
}): Promise<FSTSourceIdentity>;
|
|
109
106
|
/**
|
|
110
107
|
* Why an FST artifact is stale against `expected`, or `undefined` when it still matches.
|
|
111
108
|
*
|
|
@@ -126,7 +123,7 @@ export declare function fstFreshnessWarning({ fstPath, sourceDBPath, formatVersi
|
|
|
126
123
|
formatVersion?: number;
|
|
127
124
|
exclusionPolicy?: string;
|
|
128
125
|
rebuildCommand: string;
|
|
129
|
-
}): string | undefined
|
|
126
|
+
}): Promise<string | undefined>;
|
|
130
127
|
/**
|
|
131
128
|
* The one warning format, so `grep -r "FST STALE"` finds every site that can emit one.
|
|
132
129
|
*/
|
|
@@ -135,4 +132,4 @@ export declare function formatFSTStaleWarning({ fstPath, reason, rebuildCommand,
|
|
|
135
132
|
reason: string;
|
|
136
133
|
rebuildCommand: string;
|
|
137
134
|
}): string;
|
|
138
|
-
//# sourceMappingURL=
|
|
135
|
+
//# sourceMappingURL=freshness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freshness.d.ts","sourceRoot":"","sources":["../../lib/fst/freshness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAMH,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAmB/C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAA;AAO3C;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CAC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,CAAA;CACtB,GAAG,MAAM,CAET"}
|
|
@@ -28,10 +28,12 @@
|
|
|
28
28
|
* decode-time bias list, not a correctness dependency. Callers print {@link formatFSTStaleWarning}
|
|
29
29
|
* and continue.
|
|
30
30
|
*/
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
31
|
+
import { pathExists, readFileRange, readLocalTextFile, statPath } from "@mailwoman/core/fs/readers";
|
|
32
|
+
import { writeLocalTextFile } from "@mailwoman/core/fs/writers";
|
|
33
|
+
import { md5File } from "@mailwoman/core/hash";
|
|
34
|
+
import { tryParsingJSON } from "@mailwoman/core/json";
|
|
35
|
+
import { basename, resolvePath } from "path-ts";
|
|
36
|
+
import { FST_FORMAT_VERSION } from "#fst/serialize";
|
|
35
37
|
/**
|
|
36
38
|
* Fixed header size in bytes — mirrors `fst-serialize.ts`'s `HEADER_SIZE`. Duplicated rather than exported across
|
|
37
39
|
* because this module reads the header by SEEK (never buffering the file), and the serializer's constant is private to
|
|
@@ -55,11 +57,6 @@ export const MIN_STAMPED_FORMAT_VERSION = 3;
|
|
|
55
57
|
* Hex characters in an md5 digest.
|
|
56
58
|
*/
|
|
57
59
|
const MD5_HEX_LENGTH = 32;
|
|
58
|
-
/**
|
|
59
|
-
* Bytes per read in {@link md5FileSync}. 8 MiB measured at 7.3 s for the 5.27 GB admin DB on the lab playpen — the same
|
|
60
|
-
* throughput as `md5sum(1)`, so the sidecar below is what makes the check cheap, not the chunk size.
|
|
61
|
-
*/
|
|
62
|
-
const MD5_CHUNK_BYTES = 8 * 1024 * 1024;
|
|
63
60
|
/**
|
|
64
61
|
* Read an artifact's stamp WITHOUT deserializing it — a header seek plus the trailer, three reads totalling a few
|
|
65
62
|
* kilobytes. The distinction matters: `fst-global-priority.bin` is 317 MB and this runs on every `yarn test` via the
|
|
@@ -69,64 +66,34 @@ const MD5_CHUNK_BYTES = 8 * 1024 * 1024;
|
|
|
69
66
|
* Returns `undefined` for a file that is absent, too small, or not an FST at all — none of which is this function's
|
|
70
67
|
* business to diagnose.
|
|
71
68
|
*/
|
|
72
|
-
export function peekFSTStampFields(path) {
|
|
73
|
-
if (!
|
|
69
|
+
export async function peekFSTStampFields(path) {
|
|
70
|
+
if (!(await pathExists(path)))
|
|
74
71
|
return undefined;
|
|
75
|
-
const size =
|
|
72
|
+
const size = (await statPath(path)).size;
|
|
76
73
|
if (size < HEADER_SIZE)
|
|
77
74
|
return undefined;
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const jsonLength = lengthBytes.readUInt32LE(0);
|
|
95
|
-
if (jsonLength === 0 || trailerStart + 4 + jsonLength > size)
|
|
96
|
-
return { formatVersion, provenance: undefined };
|
|
97
|
-
const json = Buffer.alloc(jsonLength);
|
|
98
|
-
readSync(fd, json, 0, jsonLength, trailerStart + 4);
|
|
99
|
-
return { formatVersion, provenance: tryParsingJSON(json.toString("utf8")) ?? undefined };
|
|
100
|
-
}
|
|
101
|
-
finally {
|
|
102
|
-
closeSync(fd);
|
|
103
|
-
}
|
|
75
|
+
const header = await readFileRange(path, 0, HEADER_SIZE);
|
|
76
|
+
if (header.readUInt32LE(0) !== MAGIC)
|
|
77
|
+
return undefined;
|
|
78
|
+
const formatVersion = header.readUInt16LE(4);
|
|
79
|
+
if (formatVersion < MIN_STAMPED_FORMAT_VERSION)
|
|
80
|
+
return { formatVersion, provenance: undefined };
|
|
81
|
+
const trailerStart = header.readUInt32LE(PROVENANCE_OFFSET_FIELD);
|
|
82
|
+
// 0 = "this build wrote no trailer" (the serializer's own encoding); anything past EOF is a
|
|
83
|
+
// truncated file. Both read as "no stamp", which is what the caller does with them anyway.
|
|
84
|
+
if (trailerStart === 0 || trailerStart + 4 > size)
|
|
85
|
+
return { formatVersion, provenance: undefined };
|
|
86
|
+
const jsonLength = (await readFileRange(path, trailerStart, 4)).readUInt32LE(0);
|
|
87
|
+
if (jsonLength === 0 || trailerStart + 4 + jsonLength > size)
|
|
88
|
+
return { formatVersion, provenance: undefined };
|
|
89
|
+
const json = await readFileRange(path, trailerStart + 4, jsonLength);
|
|
90
|
+
return { formatVersion, provenance: tryParsingJSON(json.toString("utf8")) ?? undefined };
|
|
104
91
|
}
|
|
105
92
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* The async `md5File` in `@mailwoman/core/utils` is the one to reach for anywhere else. This exists because the FST
|
|
109
|
-
* builder and its whole call chain are synchronous by design (`buildFSTFromWOF` → `buildLocaleFSTs`), and making them
|
|
110
|
-
* async to stamp a checksum would cascade through command callers and tests for one hash. It reads in
|
|
111
|
-
* {@link MD5_CHUNK_BYTES} chunks rather than `readFileSync` — the source is a multi-gigabyte database.
|
|
93
|
+
* Re-exported from `@mailwoman/core/hash`. This package's own test imports it from here, and the sidecar convention
|
|
94
|
+
* below is what it is for.
|
|
112
95
|
*/
|
|
113
|
-
export
|
|
114
|
-
const hash = createHash("md5");
|
|
115
|
-
const fd = openSync(path, "r");
|
|
116
|
-
try {
|
|
117
|
-
const chunk = Buffer.alloc(MD5_CHUNK_BYTES);
|
|
118
|
-
for (;;) {
|
|
119
|
-
const read = readSync(fd, chunk, 0, MD5_CHUNK_BYTES, null);
|
|
120
|
-
if (read <= 0)
|
|
121
|
-
break;
|
|
122
|
-
hash.update(chunk.subarray(0, read));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
finally {
|
|
126
|
-
closeSync(fd);
|
|
127
|
-
}
|
|
128
|
-
return hash.digest("hex");
|
|
129
|
-
}
|
|
96
|
+
export { md5File } from "@mailwoman/core/hash";
|
|
130
97
|
/**
|
|
131
98
|
* The source identity an FST build should stamp, or a check should compare against.
|
|
132
99
|
*
|
|
@@ -139,28 +106,29 @@ export function md5FileSync(path) {
|
|
|
139
106
|
* write and the caller still gets its answer, because refusing to check freshness on a read-only tree would be the
|
|
140
107
|
* wrong trade.
|
|
141
108
|
*/
|
|
142
|
-
export function readWOFSourceIdentity(
|
|
143
|
-
const
|
|
109
|
+
export async function readWOFSourceIdentity(source, { refreshSidecar = true } = {}) {
|
|
110
|
+
const path = resolvePath(source);
|
|
111
|
+
const stats = await statPath(path);
|
|
144
112
|
const memoKey = `${path}\0${stats.mtimeMs}\0${stats.size}`;
|
|
145
113
|
const hit = sourceIdentityMemo.get(memoKey);
|
|
146
114
|
if (hit)
|
|
147
115
|
return hit;
|
|
148
116
|
const sidecarPath = `${path}.md5`;
|
|
149
117
|
let md5;
|
|
150
|
-
if (
|
|
151
|
-
const sidecarStats =
|
|
118
|
+
if (await pathExists(sidecarPath)) {
|
|
119
|
+
const sidecarStats = await statPath(sidecarPath);
|
|
152
120
|
if (sidecarStats.mtimeMs >= stats.mtimeMs) {
|
|
153
|
-
const [hash] =
|
|
121
|
+
const [hash] = (await readLocalTextFile(sidecarPath)).trim().split(/\s+/);
|
|
154
122
|
if (hash && hash.length === MD5_HEX_LENGTH) {
|
|
155
123
|
md5 = hash;
|
|
156
124
|
}
|
|
157
125
|
}
|
|
158
126
|
}
|
|
159
127
|
if (!md5) {
|
|
160
|
-
md5 =
|
|
128
|
+
md5 = await md5File(path);
|
|
161
129
|
if (refreshSidecar) {
|
|
162
130
|
try {
|
|
163
|
-
|
|
131
|
+
await writeLocalTextFile(`${md5} ${basename(path)}\n`, sidecarPath);
|
|
164
132
|
}
|
|
165
133
|
catch {
|
|
166
134
|
// Read-only data root — the digest is still correct, it just isn't cached.
|
|
@@ -219,11 +187,11 @@ export function fstStaleReason(fields, expected) {
|
|
|
219
187
|
* Returns `undefined` when the artifact is current OR when it is absent — an absent artifact is a different problem
|
|
220
188
|
* with a different message, and every existing caller already reports it in place.
|
|
221
189
|
*/
|
|
222
|
-
export function fstFreshnessWarning({ fstPath, sourceDBPath, formatVersion, exclusionPolicy, rebuildCommand, }) {
|
|
223
|
-
if (!
|
|
190
|
+
export async function fstFreshnessWarning({ fstPath, sourceDBPath, formatVersion, exclusionPolicy, rebuildCommand, }) {
|
|
191
|
+
if (!(await pathExists(fstPath)) || !(await pathExists(sourceDBPath)))
|
|
224
192
|
return undefined;
|
|
225
|
-
const reason = fstStaleReason(peekFSTStampFields(fstPath), {
|
|
226
|
-
source: readWOFSourceIdentity(sourceDBPath),
|
|
193
|
+
const reason = fstStaleReason(await peekFSTStampFields(fstPath), {
|
|
194
|
+
source: await readWOFSourceIdentity(sourceDBPath),
|
|
227
195
|
...(formatVersion === undefined ? {} : { formatVersion }),
|
|
228
196
|
...(exclusionPolicy === undefined ? {} : { exclusionPolicy }),
|
|
229
197
|
});
|
|
@@ -235,4 +203,4 @@ export function fstFreshnessWarning({ fstPath, sourceDBPath, formatVersion, excl
|
|
|
235
203
|
export function formatFSTStaleWarning({ fstPath, reason, rebuildCommand, }) {
|
|
236
204
|
return `WARNING: FST STALE — ${fstPath}: ${reason}. Rebuild with: ${rebuildCommand}`;
|
|
237
205
|
}
|
|
238
|
-
//# sourceMappingURL=
|
|
206
|
+
//# sourceMappingURL=freshness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freshness.js","sourceRoot":"","sources":["../../lib/fst/freshness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAwB,MAAM,SAAS,CAAA;AAErE,OAAO,EAAE,kBAAkB,EAA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O,SAAS,CAAA;IAEvF,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,kBAAkB,CAAC,OAAO,CAAC,EAAE;QAChE,MAAM,EAAE,MAAM,qBAAqB,CAAC,YAAY,CAAC;QACjD,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;QACzD,GAAG,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC;KAC7D,CAAC,CAAA;IAEF,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAA;AACrG,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACrC,OAAO,EACP,MAAM,EACN,cAAc,GAKd;IACA,OAAO,wBAAwB,OAAO,KAAK,MAAM,mBAAmB,cAAc,EAAE,CAAA;AACrF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
export * from "#fst/autocomplete";
|
|
7
|
+
export * from "#fst/builder";
|
|
8
|
+
export * from "#fst/deserialize-web";
|
|
9
|
+
export * from "#fst/format";
|
|
10
|
+
export * from "#fst/freshness";
|
|
11
|
+
export * from "#fst/matcher";
|
|
12
|
+
export * from "#fst/serialize";
|
|
13
|
+
export * from "#fst/types";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/fst/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
package/out/fst/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
export * from "#fst/autocomplete";
|
|
7
|
+
export * from "#fst/builder";
|
|
8
|
+
export * from "#fst/deserialize-web";
|
|
9
|
+
export * from "#fst/format";
|
|
10
|
+
export * from "#fst/freshness";
|
|
11
|
+
export * from "#fst/matcher";
|
|
12
|
+
export * from "#fst/serialize";
|
|
13
|
+
export * from "#fst/types";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/fst/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* introspection. The structure is a deterministic trie over normalized tokens with PlaceEntry
|
|
8
8
|
* arrays at accepting states.
|
|
9
9
|
*/
|
|
10
|
-
import type { FSTContinuation, FSTMatchResult, FSTQueryResult, PlaceEntry } from "
|
|
10
|
+
import type { FSTContinuation, FSTMatchResult, FSTQueryResult, PlaceEntry } from "#fst/types";
|
|
11
11
|
interface FSTNode {
|
|
12
12
|
edges: Map<string, number>;
|
|
13
13
|
places: PlaceEntry[];
|
|
@@ -34,4 +34,4 @@ export declare class FSTMatcher {
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function normalizeTokens(text: string): string[];
|
|
36
36
|
export type { FSTNode };
|
|
37
|
-
//# sourceMappingURL=
|
|
37
|
+
//# sourceMappingURL=matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../../lib/fst/matcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE7F,UAAU,OAAO;IAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC1B,MAAM,EAAE,UAAU,EAAE,CAAA;CACpB;AAED,qBAAa,UAAU;IACtB,OAAO,CAAC,KAAK,CAAW;gBAEZ,KAAK,EAAE,OAAO,EAAE;IAI5B,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,UAAU,IAAI,MAAM,CAQvB;IAED,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,GAAG,IAAI;IAkB7C,QAAQ,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAYpE,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE;IAIxC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE;IAmBjD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc;IAqCnC,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,OAAO,IAAI,SAAS,OAAO,EAAE;IAI7B,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU;CAG9C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAO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