@mailwoman/core 10.1.0 → 10.2.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/lib/api/APIClient.ts +5 -6
- package/lib/api/arcgis.ts +5 -5
- package/lib/api/ckan.ts +2 -1
- package/lib/api/disk-storage.ts +3 -3
- package/lib/api/ogc.ts +56 -52
- package/lib/api/pacer.ts +1 -1
- package/lib/api/retry.ts +6 -4
- package/lib/api/test/transport.ts +20 -20
- package/lib/api.ts +1 -0
- package/lib/coarse-placer/coarse-placer.ts +4 -3
- package/lib/crypto/node.ts +1 -2
- package/lib/decoder/build-tree.ts +5 -5
- package/lib/decoder/parse-diff.ts +47 -31
- package/lib/decoder/proposals-to-tree.ts +1 -0
- package/lib/decoder/serialize/json.ts +9 -6
- package/lib/decoder/serialize/tuples.ts +2 -1
- package/lib/decoder/serialize/xml.ts +15 -14
- package/lib/decoder/tree/shape.ts +14 -14
- package/lib/decoder/tree/walk.ts +2 -2
- package/lib/decoder/types.ts +48 -2
- package/lib/env/schema.ts +21 -23
- package/lib/env/utils.ts +4 -3
- package/lib/env.ts +4 -4
- package/lib/fs/delimited.ts +35 -1
- package/lib/fs/readers.ts +2 -5
- package/lib/fs/zip.ts +1 -1
- package/lib/geocode/result.ts +337 -0
- package/lib/git.ts +1 -1
- package/lib/html/document.ts +6 -6
- package/lib/html/elements.ts +26 -23
- package/lib/identical.ts +20 -0
- package/lib/json.ts +5 -7
- package/lib/layers/coverage.ts +28 -1
- package/lib/layers/feature-count.ts +3 -3
- package/lib/layers/manifest.ts +22 -21
- package/lib/layers/schema.ts +25 -1
- package/lib/license/configured.ts +3 -3
- package/lib/license/key/file.ts +2 -1
- package/lib/license/key.ts +3 -3
- package/lib/license/stamp.ts +4 -4
- package/lib/locale/locale.ts +1 -1
- package/lib/locale/registry.ts +2 -2
- package/lib/module/compiled-freshness.ts +1 -1
- package/lib/module/package-command.ts +4 -2
- package/lib/module/packaged-data.ts +1 -1
- package/lib/module/resolve-from.ts +1 -1
- package/lib/numeric.ts +4 -4
- package/lib/objects.ts +3 -0
- package/lib/paths.ts +16 -1
- package/lib/pipeline/client-result.ts +14 -14
- package/lib/pipeline/result.ts +5 -4
- package/lib/pipeline/runtime-pipeline.ts +65 -42
- package/lib/pipeline/span-proposer.ts +1 -1
- package/lib/pipeline/types.ts +328 -161
- package/lib/pipeline.ts +32 -7
- package/lib/policy/proposal-collection.ts +1 -1
- package/lib/policy/registry.ts +5 -3
- package/lib/resolver/authoritative-provider.ts +17 -17
- package/lib/resolver/coverage-facts.ts +3 -3
- package/lib/resolver/fixture-authoritative-provider.ts +4 -0
- package/lib/resolver/lookup-types.ts +54 -14
- package/lib/resolver/postcode-format.ts +9 -9
- package/lib/resolver/referential.ts +2 -2
- package/lib/resolver/types.ts +155 -51
- package/lib/resolver.ts +22 -20
- package/lib/resources/git.ts +1 -1
- package/lib/resources/languages.ts +0 -2
- package/lib/resources/libpostal.ts +1 -1
- package/lib/resources/whosonfirst/PlacetypeDataSource.ts +2 -6
- package/lib/resources/whosonfirst/extract-repo.ts +2 -1
- package/lib/resources/whosonfirst/placetypes/admin.ts +20 -25
- package/lib/resources/whosonfirst/placetypes/mermaid.ts +4 -3
- package/lib/resources/whosonfirst/placetypes/specificity.ts +7 -7
- package/lib/resources.ts +1 -0
- package/lib/scripting/arguments.ts +6 -5
- package/lib/scripting/command.ts +3 -2
- package/lib/scripting/operation.ts +2 -2
- package/lib/scripting/utils.ts +3 -5
- package/lib/strings/python-json.ts +1 -1
- package/lib/tokenization/Span.ts +1 -1
- package/lib/trust-policies.ts +0 -2
- package/lib/types/Classification.ts +1 -1
- package/lib/types/classifier.ts +1 -1
- package/lib/utils/geodatabase-archive.ts +13 -5
- package/lib/utils/sqlite-rows.ts +3 -3
- package/lib/utils/stream-to-disk.ts +1 -3
- package/lib/utils/union-find.ts +1 -1
- package/lib/vale.ts +1 -1
- package/lib/workspaces.ts +2 -2
- package/out/api/APIClient.d.ts +3 -3
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/APIClient.js +2 -3
- package/out/api/APIClient.js.map +1 -1
- package/out/api/arcgis.d.ts +2 -2
- package/out/api/arcgis.d.ts.map +1 -1
- package/out/api/arcgis.js +6 -6
- package/out/api/arcgis.js.map +1 -1
- package/out/api/ckan.d.ts +2 -1
- package/out/api/ckan.d.ts.map +1 -1
- package/out/api/ckan.js.map +1 -1
- package/out/api/disk-storage.d.ts +1 -1
- package/out/api/disk-storage.js +2 -2
- package/out/api/disk-storage.js.map +1 -1
- package/out/api/ogc.d.ts +32 -27
- package/out/api/ogc.d.ts.map +1 -1
- package/out/api/ogc.js +41 -46
- package/out/api/ogc.js.map +1 -1
- package/out/api/pacer.d.ts +1 -1
- package/out/api/pacer.js +1 -1
- package/out/api/retry.d.ts +6 -4
- package/out/api/retry.d.ts.map +1 -1
- package/out/api/retry.js +1 -1
- package/out/api/retry.js.map +1 -1
- package/out/api/test/transport.d.ts +11 -11
- package/out/api/test/transport.d.ts.map +1 -1
- package/out/api/test/transport.js +16 -16
- package/out/api/test/transport.js.map +1 -1
- package/out/api.d.ts +1 -0
- package/out/api.d.ts.map +1 -1
- package/out/api.js +1 -0
- package/out/api.js.map +1 -1
- package/out/coarse-placer/coarse-placer.d.ts +3 -2
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js +1 -1
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/crypto/node.d.ts +1 -2
- package/out/crypto/node.d.ts.map +1 -1
- package/out/crypto/node.js +1 -2
- package/out/crypto/node.js.map +1 -1
- package/out/decoder/build-tree.js +5 -5
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/parse-diff.d.ts +19 -19
- package/out/decoder/parse-diff.d.ts.map +1 -1
- package/out/decoder/parse-diff.js +28 -12
- package/out/decoder/parse-diff.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js +1 -0
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/serialize/json.d.ts +35 -17
- package/out/decoder/serialize/json.d.ts.map +1 -1
- package/out/decoder/serialize/json.js +28 -0
- package/out/decoder/serialize/json.js.map +1 -1
- package/out/decoder/serialize/tuples.d.ts +2 -1
- package/out/decoder/serialize/tuples.d.ts.map +1 -1
- package/out/decoder/serialize/tuples.js.map +1 -1
- package/out/decoder/serialize/xml.d.ts +12 -11
- package/out/decoder/serialize/xml.d.ts.map +1 -1
- package/out/decoder/serialize/xml.js +3 -3
- package/out/decoder/serialize/xml.js.map +1 -1
- package/out/decoder/tree/shape.d.ts +6 -6
- package/out/decoder/tree/shape.d.ts.map +1 -1
- package/out/decoder/tree/shape.js +8 -8
- package/out/decoder/tree/shape.js.map +1 -1
- package/out/decoder/tree/walk.d.ts +1 -1
- package/out/decoder/tree/walk.d.ts.map +1 -1
- package/out/decoder/tree/walk.js +1 -1
- package/out/decoder/tree/walk.js.map +1 -1
- package/out/decoder/types.d.ts +55 -2
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +39 -1
- package/out/decoder/types.js.map +1 -1
- package/out/env/schema.d.ts +11 -12
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +15 -17
- package/out/env/schema.js.map +1 -1
- package/out/env/utils.d.ts +2 -2
- package/out/env/utils.d.ts.map +1 -1
- package/out/env/utils.js +2 -2
- package/out/env/utils.js.map +1 -1
- package/out/env.js +4 -4
- package/out/env.js.map +1 -1
- package/out/fs/delimited.d.ts +18 -0
- package/out/fs/delimited.d.ts.map +1 -1
- package/out/fs/delimited.js +31 -1
- package/out/fs/delimited.js.map +1 -1
- package/out/fs/readers.d.ts +2 -4
- package/out/fs/readers.d.ts.map +1 -1
- package/out/fs/readers.js +2 -4
- package/out/fs/readers.js.map +1 -1
- package/out/fs/zip.js +1 -1
- package/out/fs/zip.js.map +1 -1
- package/out/geocode/result.d.ts +475 -0
- package/out/geocode/result.d.ts.map +1 -0
- package/out/geocode/result.js +280 -0
- package/out/geocode/result.js.map +1 -0
- package/out/git.js +1 -1
- package/out/git.js.map +1 -1
- package/out/html/document.d.ts +3 -3
- package/out/html/document.d.ts.map +1 -1
- package/out/html/document.js +4 -4
- package/out/html/document.js.map +1 -1
- package/out/html/elements.d.ts +18 -15
- package/out/html/elements.d.ts.map +1 -1
- package/out/html/elements.js +17 -16
- package/out/html/elements.js.map +1 -1
- package/out/identical.d.ts +16 -0
- package/out/identical.d.ts.map +1 -0
- package/out/identical.js +19 -0
- package/out/identical.js.map +1 -0
- package/out/json.d.ts +3 -5
- package/out/json.d.ts.map +1 -1
- package/out/json.js +3 -5
- package/out/json.js.map +1 -1
- package/out/layers/coverage.d.ts +26 -1
- package/out/layers/coverage.d.ts.map +1 -1
- package/out/layers/coverage.js.map +1 -1
- package/out/layers/feature-count.d.ts +1 -1
- package/out/layers/feature-count.d.ts.map +1 -1
- package/out/layers/feature-count.js +2 -2
- package/out/layers/feature-count.js.map +1 -1
- package/out/layers/manifest.d.ts +11 -10
- package/out/layers/manifest.d.ts.map +1 -1
- package/out/layers/manifest.js +12 -13
- package/out/layers/manifest.js.map +1 -1
- package/out/layers/schema.d.ts +23 -0
- package/out/layers/schema.d.ts.map +1 -1
- package/out/layers/schema.js +1 -1
- package/out/layers/schema.js.map +1 -1
- package/out/license/configured.d.ts +1 -1
- package/out/license/configured.d.ts.map +1 -1
- package/out/license/configured.js +2 -2
- package/out/license/configured.js.map +1 -1
- package/out/license/key/file.d.ts.map +1 -1
- package/out/license/key/file.js +2 -1
- package/out/license/key/file.js.map +1 -1
- package/out/license/key.d.ts +1 -1
- package/out/license/key.d.ts.map +1 -1
- package/out/license/key.js +2 -2
- package/out/license/key.js.map +1 -1
- package/out/license/stamp.d.ts +2 -2
- package/out/license/stamp.d.ts.map +1 -1
- package/out/license/stamp.js +2 -2
- package/out/license/stamp.js.map +1 -1
- package/out/locale/locale.d.ts +1 -1
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/registry.d.ts +1 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js +1 -1
- package/out/locale/registry.js.map +1 -1
- package/out/module/compiled-freshness.js +1 -1
- package/out/module/compiled-freshness.js.map +1 -1
- package/out/module/package-command.d.ts +3 -2
- package/out/module/package-command.d.ts.map +1 -1
- package/out/module/package-command.js +3 -2
- package/out/module/package-command.js.map +1 -1
- package/out/module/packaged-data.js +1 -1
- package/out/module/packaged-data.js.map +1 -1
- package/out/module/resolve-from.js +1 -1
- package/out/module/resolve-from.js.map +1 -1
- package/out/numeric.d.ts +1 -1
- package/out/numeric.d.ts.map +1 -1
- package/out/numeric.js +3 -3
- package/out/numeric.js.map +1 -1
- package/out/objects.d.ts +3 -0
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +3 -0
- package/out/objects.js.map +1 -1
- package/out/paths.d.ts +20 -1
- package/out/paths.d.ts.map +1 -1
- package/out/paths.js +1 -1
- package/out/paths.js.map +1 -1
- package/out/pipeline/client-result.d.ts +15 -15
- package/out/pipeline/client-result.d.ts.map +1 -1
- package/out/pipeline/client-result.js +1 -1
- package/out/pipeline/result.d.ts +4 -3
- package/out/pipeline/result.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +16 -9
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +43 -27
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-proposer.js +1 -1
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +394 -175
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +199 -4
- package/out/pipeline/types.js.map +1 -1
- package/out/pipeline.d.ts +4 -2
- package/out/pipeline.d.ts.map +1 -1
- package/out/pipeline.js +1 -1
- package/out/pipeline.js.map +1 -1
- package/out/policy/proposal-collection.d.ts +1 -1
- package/out/policy/proposal-collection.d.ts.map +1 -1
- package/out/policy/proposal-collection.js.map +1 -1
- package/out/policy/registry.d.ts +3 -1
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +4 -2
- package/out/policy/registry.js.map +1 -1
- package/out/resolver/authoritative-provider.d.ts +17 -17
- package/out/resolver/authoritative-provider.d.ts.map +1 -1
- package/out/resolver/authoritative-provider.js +2 -2
- package/out/resolver/coverage-facts.d.ts +3 -3
- package/out/resolver/coverage-facts.d.ts.map +1 -1
- package/out/resolver/fixture-authoritative-provider.d.ts.map +1 -1
- package/out/resolver/fixture-authoritative-provider.js +4 -0
- package/out/resolver/fixture-authoritative-provider.js.map +1 -1
- package/out/resolver/lookup-types.d.ts +52 -15
- package/out/resolver/lookup-types.d.ts.map +1 -1
- package/out/resolver/postcode-format.d.ts +3 -3
- package/out/resolver/postcode-format.d.ts.map +1 -1
- package/out/resolver/postcode-format.js +7 -7
- package/out/resolver/postcode-format.js.map +1 -1
- package/out/resolver/referential.d.ts +2 -2
- package/out/resolver/referential.d.ts.map +1 -1
- package/out/resolver/types.d.ts +126 -40
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +43 -1
- package/out/resolver/types.js.map +1 -1
- package/out/resolver.d.ts +5 -3
- package/out/resolver.d.ts.map +1 -1
- package/out/resolver.js +2 -2
- package/out/resolver.js.map +1 -1
- package/out/resources/git.js +1 -1
- package/out/resources/git.js.map +1 -1
- package/out/resources/languages.d.ts +0 -1
- package/out/resources/languages.d.ts.map +1 -1
- package/out/resources/languages.js +0 -1
- package/out/resources/languages.js.map +1 -1
- package/out/resources/libpostal.d.ts +1 -1
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +2 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/extract-repo.d.ts.map +1 -1
- package/out/resources/whosonfirst/extract-repo.js +2 -1
- package/out/resources/whosonfirst/extract-repo.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +12 -12
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +9 -8
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +2 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/specificity.d.ts +3 -3
- package/out/resources/whosonfirst/placetypes/specificity.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/specificity.js +6 -6
- package/out/resources/whosonfirst/placetypes/specificity.js.map +1 -1
- package/out/resources.d.ts +1 -0
- package/out/resources.d.ts.map +1 -1
- package/out/resources.js +1 -0
- package/out/resources.js.map +1 -1
- package/out/scripting/arguments.d.ts +5 -4
- package/out/scripting/arguments.d.ts.map +1 -1
- package/out/scripting/arguments.js +5 -4
- package/out/scripting/arguments.js.map +1 -1
- package/out/scripting/command.d.ts +2 -2
- package/out/scripting/command.d.ts.map +1 -1
- package/out/scripting/command.js +1 -0
- package/out/scripting/command.js.map +1 -1
- package/out/scripting/operation.d.ts +1 -1
- package/out/scripting/operation.d.ts.map +1 -1
- package/out/scripting/operation.js +1 -1
- package/out/scripting/operation.js.map +1 -1
- package/out/scripting/utils.d.ts +3 -4
- package/out/scripting/utils.d.ts.map +1 -1
- package/out/scripting/utils.js +3 -4
- package/out/scripting/utils.js.map +1 -1
- package/out/strings/python-json.js +1 -1
- package/out/strings/python-json.js.map +1 -1
- package/out/tokenization/Span.d.ts +1 -1
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tools/coarse-placer/build/dataset.d.ts +4 -2
- package/out/tools/coarse-placer/build/dataset.d.ts.map +1 -1
- package/out/tools/coarse-placer/build/dataset.js.map +1 -1
- package/out/tools/coarse-placer/build/outlier/exposure.d.ts +5 -3
- package/out/tools/coarse-placer/build/outlier/exposure.d.ts.map +1 -1
- package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
- package/out/tools/coarse-placer/build/outlier/latin.d.ts +3 -3
- package/out/tools/coarse-placer/build/outlier/oa.d.ts +3 -3
- package/out/tools/coarse-placer/eval/latin-offmap.d.ts +3 -3
- package/out/tools/coarse-placer/eval/openset.js +2 -2
- package/out/tools/coarse-placer/eval/openset.js.map +1 -1
- package/out/tools/coarse-placer/eval/quant-compare.d.ts +4 -4
- package/out/tools/coarse-placer/eval.d.ts +3 -3
- package/out/tools/coarse-placer/paths.js +1 -1
- package/out/tools/coarse-placer/paths.js.map +1 -1
- package/out/tools/coarse-placer/probe-frontier.d.ts +2 -2
- package/out/tools/coarse-placer/quantize.d.ts +2 -2
- package/out/tools/coarse-placer/train.d.ts +5 -5
- package/out/tools/download/libpostal-resources.d.ts.map +1 -1
- package/out/tools/download/libpostal-resources.js +2 -1
- package/out/tools/download/libpostal-resources.js.map +1 -1
- package/out/tools/download/ssl-address.d.ts +2 -2
- package/out/tools/generate-language-types.d.ts +1 -1
- package/out/tools/generate-language-types.js +1 -1
- package/out/tools/generate-language-types.js.map +1 -1
- package/out/trust-policies.d.ts +0 -1
- package/out/trust-policies.d.ts.map +1 -1
- package/out/trust-policies.js +0 -1
- package/out/trust-policies.js.map +1 -1
- package/out/types/Classification.d.ts +1 -1
- package/out/types/Classification.d.ts.map +1 -1
- package/out/types/classifier.d.ts +1 -1
- package/out/types/classifier.d.ts.map +1 -1
- package/out/utils/geodatabase-archive.d.ts +11 -4
- package/out/utils/geodatabase-archive.d.ts.map +1 -1
- package/out/utils/geodatabase-archive.js +1 -1
- package/out/utils/geodatabase-archive.js.map +1 -1
- package/out/utils/sqlite-rows.d.ts +2 -2
- package/out/utils/sqlite-rows.d.ts.map +1 -1
- package/out/utils/sqlite-rows.js +2 -2
- package/out/utils/sqlite-rows.js.map +1 -1
- package/out/utils/stream-to-disk.d.ts.map +1 -1
- package/out/utils/stream-to-disk.js +1 -1
- package/out/utils/stream-to-disk.js.map +1 -1
- package/out/utils/union-find.js +1 -1
- package/out/utils/union-find.js.map +1 -1
- package/out/vale.js +1 -1
- package/out/vale.js.map +1 -1
- package/out/workspaces.d.ts +1 -1
- package/out/workspaces.js +1 -1
- package/out/workspaces.js.map +1 -1
- package/package.json +46 -14
- package/tools/coarse-placer/build/dataset.ts +4 -2
- package/tools/coarse-placer/build/outlier/exposure.ts +5 -3
- package/tools/coarse-placer/build/outlier/latin.ts +3 -3
- package/tools/coarse-placer/build/outlier/oa.ts +3 -3
- package/tools/coarse-placer/eval/latin-offmap.ts +3 -3
- package/tools/coarse-placer/eval/openset.ts +3 -3
- package/tools/coarse-placer/eval/quant-compare.ts +4 -4
- package/tools/coarse-placer/eval.ts +3 -3
- package/tools/coarse-placer/paths.ts +1 -1
- package/tools/coarse-placer/probe-frontier.ts +2 -2
- package/tools/coarse-placer/quantize.ts +2 -2
- package/tools/coarse-placer/train.ts +5 -5
- package/tools/download/libpostal-resources.ts +2 -1
- package/tools/download/ssl-address.ts +2 -2
- package/tools/generate-language-types.ts +3 -3
package/lib/resolver/types.ts
CHANGED
|
@@ -15,21 +15,6 @@ import type {
|
|
|
15
15
|
StreetCentroidLookup,
|
|
16
16
|
} from "#resolver/lookup-types"
|
|
17
17
|
|
|
18
|
-
export type { CountryBBoxFact, CountryCoverageFact, GazetteerArtifactCoverage } from "#resolver/coverage-facts"
|
|
19
|
-
export { hardCountrySafelistFromCoverage } from "#resolver/coverage-facts"
|
|
20
|
-
|
|
21
|
-
export type {
|
|
22
|
-
AddressPointHit,
|
|
23
|
-
AddressPointLookup,
|
|
24
|
-
InterpolatedPointHit,
|
|
25
|
-
InterpolationLookup,
|
|
26
|
-
PostcodePrefixAncestor,
|
|
27
|
-
PostcodePrefixIndexLike,
|
|
28
|
-
PostcodePrefixNode,
|
|
29
|
-
StreetCentroidHit,
|
|
30
|
-
StreetCentroidLookup,
|
|
31
|
-
} from "#resolver/lookup-types"
|
|
32
|
-
|
|
33
18
|
export interface ResolvedPlace {
|
|
34
19
|
/**
|
|
35
20
|
* Resolver-specific place identifier.
|
|
@@ -46,7 +31,7 @@ export interface ResolvedPlace {
|
|
|
46
31
|
/**
|
|
47
32
|
* ISO 3166-1 alpha-2 country code, if known.
|
|
48
33
|
*/
|
|
49
|
-
country
|
|
34
|
+
country: string | null
|
|
50
35
|
/**
|
|
51
36
|
* Centroid latitude.
|
|
52
37
|
*/
|
|
@@ -58,7 +43,7 @@ export interface ResolvedPlace {
|
|
|
58
43
|
/**
|
|
59
44
|
* Parent place id, if any.
|
|
60
45
|
*/
|
|
61
|
-
parent_id
|
|
46
|
+
parent_id: number | string | null
|
|
62
47
|
/**
|
|
63
48
|
* Resolver-defined ranking score.
|
|
64
49
|
*/
|
|
@@ -66,49 +51,63 @@ export interface ResolvedPlace {
|
|
|
66
51
|
/**
|
|
67
52
|
* Optional backend prominence score.
|
|
68
53
|
*/
|
|
69
|
-
prominence
|
|
54
|
+
prominence: number | null
|
|
70
55
|
/**
|
|
71
56
|
* Optional raw population.
|
|
72
57
|
*/
|
|
73
|
-
population
|
|
58
|
+
population: number | null
|
|
74
59
|
/**
|
|
75
60
|
* Optional referential likelihood in [0, 1].
|
|
76
61
|
*/
|
|
77
|
-
referential
|
|
62
|
+
referential: number | null
|
|
78
63
|
/**
|
|
79
64
|
* Optional strict encyclopedia importance in [0, 1].
|
|
80
65
|
*/
|
|
81
|
-
encyclopedic
|
|
66
|
+
encyclopedic: number | null
|
|
82
67
|
/**
|
|
83
68
|
* Optional blended global toponym prior in [0, 1].
|
|
84
69
|
*/
|
|
85
|
-
importance
|
|
70
|
+
importance: number | null
|
|
86
71
|
/**
|
|
87
72
|
* Optional exact name/alias match marker.
|
|
88
73
|
*/
|
|
89
|
-
exactMatch
|
|
74
|
+
exactMatch: boolean | null
|
|
90
75
|
/**
|
|
91
76
|
* Optional postcode/locality mismatch marker.
|
|
92
77
|
*/
|
|
93
|
-
mismatch?: boolean
|
|
78
|
+
mismatch?: boolean | null
|
|
94
79
|
/**
|
|
95
80
|
* Optional fallback-quality marker.
|
|
96
81
|
*/
|
|
97
|
-
resolutionQuality?: "fallback"
|
|
82
|
+
resolutionQuality?: "fallback" | null
|
|
98
83
|
/**
|
|
99
84
|
* Optional admin-containment verdict.
|
|
100
85
|
*/
|
|
101
|
-
containedByQualifier?: boolean
|
|
86
|
+
containedByQualifier?: boolean | null
|
|
102
87
|
/**
|
|
103
88
|
* Optional marker for a miss under parent scope.
|
|
104
89
|
*/
|
|
105
|
-
regionScopeMiss?: boolean
|
|
90
|
+
regionScopeMiss?: boolean | null
|
|
106
91
|
/**
|
|
107
92
|
* Optional marker for variant-alias exemption.
|
|
108
93
|
*/
|
|
109
|
-
variantAliasExempted?: true
|
|
94
|
+
variantAliasExempted?: true | null
|
|
110
95
|
}
|
|
111
96
|
|
|
97
|
+
/**
|
|
98
|
+
* The nullable {@link ResolvedPlace} signals, each `null`, spread first into a place literal.
|
|
99
|
+
*/
|
|
100
|
+
export const EMPTY_PLACE_FIELDS = Object.freeze({
|
|
101
|
+
country: null,
|
|
102
|
+
parent_id: null,
|
|
103
|
+
prominence: null,
|
|
104
|
+
population: null,
|
|
105
|
+
referential: null,
|
|
106
|
+
encyclopedic: null,
|
|
107
|
+
importance: null,
|
|
108
|
+
exactMatch: null,
|
|
109
|
+
}) satisfies Partial<ResolvedPlace>
|
|
110
|
+
|
|
112
111
|
export interface ResolverBackend {
|
|
113
112
|
findPlace(query: {
|
|
114
113
|
text: string
|
|
@@ -156,7 +155,7 @@ export interface ResolverBackend {
|
|
|
156
155
|
/**
|
|
157
156
|
* Optional artifact coverage facts.
|
|
158
157
|
*/
|
|
159
|
-
artifactCoverage?: GazetteerArtifactCoverage
|
|
158
|
+
artifactCoverage?: GazetteerArtifactCoverage | null
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
export interface BackendCapabilityGap {
|
|
@@ -208,6 +207,84 @@ export interface CoincidentLocality extends ResolvedPlace {
|
|
|
208
207
|
*/
|
|
209
208
|
export type WeakResolutionReading = "score" | "containment" | "either"
|
|
210
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Who chose a default country scope.
|
|
212
|
+
*
|
|
213
|
+
* - `"caller"`: the caller asked for the country.
|
|
214
|
+
* - `"inferred"`: the locale supplied it.
|
|
215
|
+
* `country` lookups ignore an inferred scope, and stronger evidence in the input can override it.
|
|
216
|
+
*/
|
|
217
|
+
export type DefaultCountrySource = "caller" | "inferred"
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* A default top-level country scope for resolution.
|
|
221
|
+
*/
|
|
222
|
+
export interface DefaultCountry {
|
|
223
|
+
/**
|
|
224
|
+
* ISO 3166-1 alpha-2 code.
|
|
225
|
+
*/
|
|
226
|
+
country: string
|
|
227
|
+
source: DefaultCountrySource
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* The on/off resolver passes and tiers, every one resolved against {@link RESOLVE_SWITCH_DEFAULTS}.
|
|
232
|
+
*
|
|
233
|
+
* Each is an optional {@link ResolveOpts} key.
|
|
234
|
+
* The resolver reads them only through {@link resolveSwitches}, so a default lives in exactly one place.
|
|
235
|
+
*/
|
|
236
|
+
export interface ResolveSwitches {
|
|
237
|
+
parentFallback: boolean
|
|
238
|
+
addressPointBboxFallback: boolean
|
|
239
|
+
spanRescore: boolean
|
|
240
|
+
spanRescoreRequireContextRemainder: boolean
|
|
241
|
+
postalCompoundRecovery: boolean
|
|
242
|
+
postcodeConsistency: boolean
|
|
243
|
+
postcodeCountryCoherence: boolean
|
|
244
|
+
postcodeShapeCoherence: boolean
|
|
245
|
+
postcodeContainmentCoherence: boolean
|
|
246
|
+
postcodePrefixPrior: boolean
|
|
247
|
+
adminCoherence: boolean
|
|
248
|
+
hierarchyCompletion: boolean
|
|
249
|
+
includeAncestors: boolean
|
|
250
|
+
adminContainmentRerank: boolean
|
|
251
|
+
diagnoseUnreachable: boolean
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* The default of every {@link ResolveSwitches} key.
|
|
256
|
+
*/
|
|
257
|
+
export const RESOLVE_SWITCH_DEFAULTS: Readonly<ResolveSwitches> = {
|
|
258
|
+
parentFallback: true,
|
|
259
|
+
addressPointBboxFallback: false,
|
|
260
|
+
spanRescore: true,
|
|
261
|
+
spanRescoreRequireContextRemainder: false,
|
|
262
|
+
postalCompoundRecovery: true,
|
|
263
|
+
postcodeConsistency: true,
|
|
264
|
+
postcodeCountryCoherence: true,
|
|
265
|
+
postcodeShapeCoherence: false,
|
|
266
|
+
postcodeContainmentCoherence: false,
|
|
267
|
+
postcodePrefixPrior: false,
|
|
268
|
+
adminCoherence: true,
|
|
269
|
+
hierarchyCompletion: true,
|
|
270
|
+
includeAncestors: false,
|
|
271
|
+
adminContainmentRerank: true,
|
|
272
|
+
diagnoseUnreachable: false,
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Fills each unset switch from {@link RESOLVE_SWITCH_DEFAULTS}.
|
|
277
|
+
*/
|
|
278
|
+
export function resolveSwitches(opts: Partial<ResolveSwitches>): ResolveSwitches {
|
|
279
|
+
const switches = { ...RESOLVE_SWITCH_DEFAULTS }
|
|
280
|
+
|
|
281
|
+
for (const key of Object.keys(RESOLVE_SWITCH_DEFAULTS) as (keyof ResolveSwitches)[]) {
|
|
282
|
+
switches[key] = opts[key] ?? RESOLVE_SWITCH_DEFAULTS[key]
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return switches
|
|
286
|
+
}
|
|
287
|
+
|
|
211
288
|
export interface ResolveOpts {
|
|
212
289
|
/**
|
|
213
290
|
* Max backend lookups per tree.
|
|
@@ -222,13 +299,9 @@ export interface ResolveOpts {
|
|
|
222
299
|
*/
|
|
223
300
|
candidatesPerLookup?: number
|
|
224
301
|
/**
|
|
225
|
-
* Default top-level country scope.
|
|
302
|
+
* Default top-level country scope, and who chose it.
|
|
226
303
|
*/
|
|
227
|
-
defaultCountry?:
|
|
228
|
-
/**
|
|
229
|
-
* True if defaultCountry is locale-inferred.
|
|
230
|
-
*/
|
|
231
|
-
defaultCountryIsInferred?: boolean
|
|
304
|
+
defaultCountry?: DefaultCountry
|
|
232
305
|
/**
|
|
233
306
|
* Country scope for fuzzy matching only.
|
|
234
307
|
*/
|
|
@@ -239,6 +312,8 @@ export interface ResolveOpts {
|
|
|
239
312
|
bias?: Array<{ lat: number; lon: number; weight?: number }>
|
|
240
313
|
/**
|
|
241
314
|
* Retry without parent constraint on scoped miss.
|
|
315
|
+
*
|
|
316
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
242
317
|
*/
|
|
243
318
|
parentFallback?: boolean
|
|
244
319
|
/**
|
|
@@ -268,7 +343,7 @@ export interface ResolveOpts {
|
|
|
268
343
|
/**
|
|
269
344
|
* Optional capital-level callback.
|
|
270
345
|
*/
|
|
271
|
-
capitalLevel?: (place: { name: string; country
|
|
346
|
+
capitalLevel?: (place: { name: string; country: string | null; lat: number; lon: number }) => number
|
|
272
347
|
/**
|
|
273
348
|
* Optional hard country filter from coarse placer.
|
|
274
349
|
*/
|
|
@@ -279,6 +354,7 @@ export interface ResolveOpts {
|
|
|
279
354
|
addressPoints?: AddressPointLookup
|
|
280
355
|
/**
|
|
281
356
|
* Enables locality-bbox fallback in address-point lookup.
|
|
357
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
282
358
|
*/
|
|
283
359
|
addressPointBboxFallback?: boolean
|
|
284
360
|
/**
|
|
@@ -292,13 +368,15 @@ export interface ResolveOpts {
|
|
|
292
368
|
/**
|
|
293
369
|
* Optional street-centroid provider by country.
|
|
294
370
|
*/
|
|
295
|
-
streetCentroids?: (country: string) => StreetCentroidLookup |
|
|
371
|
+
streetCentroids?: ((country: string) => StreetCentroidLookup | null) | null
|
|
296
372
|
/**
|
|
297
373
|
* Optional pre-resolution country hints for street-centroid tier.
|
|
298
374
|
*/
|
|
299
375
|
streetCountryHints?: readonly string[]
|
|
300
376
|
/**
|
|
301
377
|
* Enables span-rescore recovery tier.
|
|
378
|
+
*
|
|
379
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
302
380
|
*/
|
|
303
381
|
spanRescore?: boolean
|
|
304
382
|
/**
|
|
@@ -307,6 +385,8 @@ export interface ResolveOpts {
|
|
|
307
385
|
spanRescoreThresholdKm?: number
|
|
308
386
|
/**
|
|
309
387
|
* Require contextual remainder for span-rescore sub-spans.
|
|
388
|
+
*
|
|
389
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
310
390
|
*/
|
|
311
391
|
spanRescoreRequireContextRemainder?: boolean
|
|
312
392
|
/**
|
|
@@ -315,10 +395,14 @@ export interface ResolveOpts {
|
|
|
315
395
|
spanRescoreWeakResolution?: WeakResolutionReading
|
|
316
396
|
/**
|
|
317
397
|
* Enables postal-compound recovery in span-rescore tier.
|
|
398
|
+
*
|
|
399
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
318
400
|
*/
|
|
319
401
|
postalCompoundRecovery?: boolean
|
|
320
402
|
/**
|
|
321
403
|
* Enables postcode-based locality disambiguation.
|
|
404
|
+
*
|
|
405
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
322
406
|
*/
|
|
323
407
|
postcodeConsistency?: boolean
|
|
324
408
|
/**
|
|
@@ -331,6 +415,8 @@ export interface ResolveOpts {
|
|
|
331
415
|
postcodeConsistencyMaxMoveKm?: number
|
|
332
416
|
/**
|
|
333
417
|
* Enables postcode-country coherence pass.
|
|
418
|
+
*
|
|
419
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
334
420
|
*/
|
|
335
421
|
postcodeCountryCoherence?: boolean
|
|
336
422
|
/**
|
|
@@ -339,14 +425,20 @@ export interface ResolveOpts {
|
|
|
339
425
|
postcodeCountryCoherenceThresholdKm?: number
|
|
340
426
|
/**
|
|
341
427
|
* Enables postcode-shape coherence pass.
|
|
428
|
+
*
|
|
429
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
342
430
|
*/
|
|
343
431
|
postcodeShapeCoherence?: boolean
|
|
344
432
|
/**
|
|
345
433
|
* Enables postcode-containment coherence pass.
|
|
434
|
+
*
|
|
435
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
346
436
|
*/
|
|
347
437
|
postcodeContainmentCoherence?: boolean
|
|
348
438
|
/**
|
|
349
439
|
* Enables postcode-prefix prior tier.
|
|
440
|
+
*
|
|
441
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
350
442
|
*/
|
|
351
443
|
postcodePrefixPrior?: boolean
|
|
352
444
|
/**
|
|
@@ -359,18 +451,28 @@ export interface ResolveOpts {
|
|
|
359
451
|
postcodePrefixIndex?: PostcodePrefixIndexLike
|
|
360
452
|
/**
|
|
361
453
|
* Enables admin descendant-consistency correction.
|
|
454
|
+
*
|
|
455
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
362
456
|
*/
|
|
363
457
|
adminCoherence?: boolean
|
|
364
458
|
/**
|
|
365
459
|
* Enables dual-role hierarchy completion.
|
|
460
|
+
*
|
|
461
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
366
462
|
*/
|
|
367
463
|
hierarchyCompletion?: boolean
|
|
368
464
|
/**
|
|
369
465
|
* Attach ancestor lineage to resolved nodes.
|
|
466
|
+
*
|
|
467
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
370
468
|
*/
|
|
371
469
|
includeAncestors?: boolean
|
|
372
470
|
/**
|
|
373
|
-
*
|
|
471
|
+
* Reranks locality candidates by containment in a parsed region qualifier.
|
|
472
|
+
*
|
|
473
|
+
* It stands down under a caller-supplied `defaultCountry`.
|
|
474
|
+
*
|
|
475
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
374
476
|
*/
|
|
375
477
|
adminContainmentRerank?: boolean
|
|
376
478
|
/**
|
|
@@ -379,6 +481,8 @@ export interface ResolveOpts {
|
|
|
379
481
|
traceSink?: (record: ResolveNodeTrace) => void
|
|
380
482
|
/**
|
|
381
483
|
* Diagnose unresolved value reachability across placetypes.
|
|
484
|
+
*
|
|
485
|
+
* @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
|
|
382
486
|
*/
|
|
383
487
|
diagnoseUnreachable?: boolean
|
|
384
488
|
}
|
|
@@ -392,14 +496,14 @@ export interface ResolveCandidateTrace {
|
|
|
392
496
|
/**
|
|
393
497
|
* Optional country code.
|
|
394
498
|
*/
|
|
395
|
-
country
|
|
499
|
+
country: string | null
|
|
396
500
|
placetype: string
|
|
397
501
|
score: number
|
|
398
|
-
prominence
|
|
399
|
-
importance
|
|
400
|
-
population
|
|
401
|
-
exactMatch
|
|
402
|
-
containedByQualifier
|
|
502
|
+
prominence: number | null
|
|
503
|
+
importance: number | null
|
|
504
|
+
population: number | null
|
|
505
|
+
exactMatch: boolean | null
|
|
506
|
+
containedByQualifier: boolean | null
|
|
403
507
|
ranks: Record<string, number>
|
|
404
508
|
}
|
|
405
509
|
|
|
@@ -411,17 +515,17 @@ export interface ResolveNodeTrace {
|
|
|
411
515
|
value: string
|
|
412
516
|
placetype: string
|
|
413
517
|
query: {
|
|
414
|
-
country
|
|
415
|
-
parentID
|
|
416
|
-
postcode
|
|
417
|
-
regionQualifier
|
|
518
|
+
country: string | null
|
|
519
|
+
parentID: string | number | null
|
|
520
|
+
postcode: string | null
|
|
521
|
+
regionQualifier: string | null
|
|
418
522
|
limit: number
|
|
419
523
|
}
|
|
420
524
|
checks: string[]
|
|
421
525
|
/**
|
|
422
526
|
* Other placetypes where the value was reachable, if probed.
|
|
423
527
|
*/
|
|
424
|
-
reachableIn
|
|
528
|
+
reachableIn: Array<{ placetype: string; n: number }> | null
|
|
425
529
|
candidates: ResolveCandidateTrace[]
|
|
426
530
|
candidatesTruncated: number
|
|
427
531
|
picked: {
|
|
@@ -451,9 +555,9 @@ export interface Resolver {
|
|
|
451
555
|
/**
|
|
452
556
|
* Optional artifact coverage facts passthrough.
|
|
453
557
|
*/
|
|
454
|
-
artifactCoverage
|
|
558
|
+
artifactCoverage: GazetteerArtifactCoverage | null
|
|
455
559
|
/**
|
|
456
560
|
* Optional list of missing backend capabilities.
|
|
457
561
|
*/
|
|
458
|
-
capabilityGaps
|
|
562
|
+
capabilityGaps: readonly BackendCapabilityGap[] | null
|
|
459
563
|
}
|
package/lib/resolver.ts
CHANGED
|
@@ -34,38 +34,40 @@ export type {
|
|
|
34
34
|
AuthoritativeResponse,
|
|
35
35
|
} from "#resolver/authoritative-provider"
|
|
36
36
|
|
|
37
|
-
export {
|
|
38
|
-
createFixtureAuthoritativeProvider,
|
|
39
|
-
fixtureExactMatch,
|
|
40
|
-
type FixtureAuthoritativeProviderOptions,
|
|
41
|
-
type FixtureAuthoritativeRule,
|
|
42
|
-
} from "#resolver/fixture-authoritative-provider"
|
|
43
|
-
|
|
44
37
|
export type { RegionDatabaseProvider, RegionDatabases } from "#resolver/region-database-provider"
|
|
45
38
|
|
|
46
|
-
export {
|
|
39
|
+
export { EMPTY_PLACE_FIELDS, RESOLVE_SWITCH_DEFAULTS, resolveSwitches } from "#resolver/types"
|
|
40
|
+
export { hardCountrySafelistFromCoverage } from "#resolver/coverage-facts"
|
|
47
41
|
|
|
48
42
|
export type {
|
|
49
|
-
AddressPointHit,
|
|
50
|
-
AddressPointLookup,
|
|
51
43
|
Ancestor,
|
|
52
44
|
BackendCapabilityGap,
|
|
53
45
|
CoincidentLocality,
|
|
54
|
-
CountryBBoxFact,
|
|
55
|
-
CountryCoverageFact,
|
|
56
|
-
GazetteerArtifactCoverage,
|
|
57
|
-
InterpolatedPointHit,
|
|
58
|
-
InterpolationLookup,
|
|
59
|
-
PostcodePrefixAncestor,
|
|
60
|
-
PostcodePrefixIndexLike,
|
|
61
|
-
PostcodePrefixNode,
|
|
62
46
|
ResolveCandidateTrace,
|
|
63
47
|
ResolveNodeTrace,
|
|
64
48
|
ResolveOpts,
|
|
49
|
+
ResolveSwitches,
|
|
50
|
+
DefaultCountry,
|
|
51
|
+
DefaultCountrySource,
|
|
65
52
|
ResolvedPlace,
|
|
66
53
|
Resolver,
|
|
67
54
|
ResolverBackend,
|
|
68
|
-
StreetCentroidHit,
|
|
69
|
-
StreetCentroidLookup,
|
|
70
55
|
WeakResolutionReading,
|
|
71
56
|
} from "#resolver/types"
|
|
57
|
+
|
|
58
|
+
export type {
|
|
59
|
+
AddressPointHit,
|
|
60
|
+
AddressPointLookup,
|
|
61
|
+
InterpolatedPointHit,
|
|
62
|
+
InterpolationLookup,
|
|
63
|
+
POIDistanceHit,
|
|
64
|
+
PostcodePlace,
|
|
65
|
+
PostcodePrefixAncestor,
|
|
66
|
+
PostcodePrefixIndexLike,
|
|
67
|
+
PostcodePrefixNode,
|
|
68
|
+
StreetCentroidHit,
|
|
69
|
+
StreetCentroidLookup,
|
|
70
|
+
WOFAncestor,
|
|
71
|
+
} from "#resolver/lookup-types"
|
|
72
|
+
|
|
73
|
+
export type { CountryBBoxFact, CountryCoverageFact, GazetteerArtifactCoverage } from "#resolver/coverage-facts"
|
package/lib/resources/git.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* artifacts the parser loads at runtime.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { Alpha2LanguageCode } from "#resources/languages"
|
|
13
|
+
import type { Alpha2LanguageCode } from "#resources/languages/types.gen"
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* A libpostal dictionary language, or `all` for the language-agnostic directory.
|
|
@@ -8,12 +8,8 @@ import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
|
8
8
|
import type { DatabaseSyncOptions, SQLInputValue } from "@mailwoman/sqlite/client"
|
|
9
9
|
import { PathBuilder, type PathBuilderLike } from "path-ts"
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
type Alpha3bLanguageCode,
|
|
14
|
-
Alpha3bToAlpha2,
|
|
15
|
-
isAlpha3bLanguageCode,
|
|
16
|
-
} from "#resources/languages"
|
|
11
|
+
import { isAlpha3bLanguageCode } from "#resources/languages"
|
|
12
|
+
import { type Alpha2LanguageCode, type Alpha3bLanguageCode, Alpha3bToAlpha2 } from "#resources/languages/types.gen"
|
|
17
13
|
import { tryWithBackoff } from "#resources/whosonfirst/backoff"
|
|
18
14
|
import type { WhosOnFirstPlacetype } from "#resources/whosonfirst/placetypes/definition"
|
|
19
15
|
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
import { resolvePath, resolvePathBuilder, type PathBuilderLike } from "path-ts"
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { readLocalJSONFile } from "#fs/readers"
|
|
16
|
+
import { isDirectory, pathExists } from "#fs/readers/stat"
|
|
16
17
|
import type { WOFFeature } from "#resources/whosonfirst/placetypes/admin"
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -6,13 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import type { GeoFeature, GeometryLiteral } from "@mailwoman/spatial"
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
type Alpha3bLanguageCode,
|
|
12
|
-
Alpha3bToAlpha2,
|
|
13
|
-
isAlpha2LanguageCode,
|
|
14
|
-
isAlpha3bLanguageCode,
|
|
15
|
-
} from "#resources/languages"
|
|
9
|
+
import { isAlpha2LanguageCode, isAlpha3bLanguageCode } from "#resources/languages"
|
|
10
|
+
import { type Alpha2LanguageCode, type Alpha3bLanguageCode, Alpha3bToAlpha2 } from "#resources/languages/types.gen"
|
|
16
11
|
import type { WhosOnFirstPlacetype } from "#resources/whosonfirst/placetypes/definition"
|
|
17
12
|
|
|
18
13
|
export interface WOFBaseProperties {
|
|
@@ -92,17 +87,17 @@ export interface ParsedWOFPlacetype {
|
|
|
92
87
|
src: string
|
|
93
88
|
placetype: WhosOnFirstPlacetype
|
|
94
89
|
localizedPropMap: Map<Alpha3bLanguageCode, LocalizedPlacetypePropMap>
|
|
95
|
-
country
|
|
96
|
-
latitude
|
|
97
|
-
longitude
|
|
98
|
-
population
|
|
99
|
-
concordances
|
|
100
|
-
isCurrent
|
|
101
|
-
isDeprecated
|
|
102
|
-
isCeased
|
|
103
|
-
isSuperseded
|
|
104
|
-
isSuperseding
|
|
105
|
-
lastmodified
|
|
90
|
+
country: string | null
|
|
91
|
+
latitude: number | null
|
|
92
|
+
longitude: number | null
|
|
93
|
+
population: number | null
|
|
94
|
+
concordances: Record<string, string | number> | null
|
|
95
|
+
isCurrent: boolean | null
|
|
96
|
+
isDeprecated: boolean
|
|
97
|
+
isCeased: boolean
|
|
98
|
+
isSuperseded: boolean
|
|
99
|
+
isSuperseding: boolean
|
|
100
|
+
lastmodified: number | null
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
const langPattern = new RegExp(`:([a-z0-9\\-_]{2,3})_x_(${WOFNameKinds.join("|")})`)
|
|
@@ -167,9 +162,9 @@ export function pluckPlacetypeSpec({
|
|
|
167
162
|
if (!src) throw new Error(`No source found for placetype ${placetype} with ID ${id}`)
|
|
168
163
|
|
|
169
164
|
const population =
|
|
170
|
-
typeof wofPopulation === "number" ? wofPopulation : typeof gnPopulation === "number" ? gnPopulation :
|
|
165
|
+
typeof wofPopulation === "number" ? wofPopulation : typeof gnPopulation === "number" ? gnPopulation : null
|
|
171
166
|
|
|
172
|
-
const isCurrent = mzIsCurrent === undefined ?
|
|
167
|
+
const isCurrent = mzIsCurrent === undefined ? null : mzIsCurrent !== 0 && mzIsCurrent !== "0"
|
|
173
168
|
|
|
174
169
|
return {
|
|
175
170
|
id,
|
|
@@ -178,17 +173,17 @@ export function pluckPlacetypeSpec({
|
|
|
178
173
|
parent_id,
|
|
179
174
|
placetype,
|
|
180
175
|
localizedPropMap,
|
|
181
|
-
country: country ||
|
|
182
|
-
latitude: typeof latitude === "number" ? latitude :
|
|
183
|
-
longitude: typeof longitude === "number" ? longitude :
|
|
176
|
+
country: country || null,
|
|
177
|
+
latitude: typeof latitude === "number" ? latitude : null,
|
|
178
|
+
longitude: typeof longitude === "number" ? longitude : null,
|
|
184
179
|
population,
|
|
185
|
-
concordances: concordances && Object.keys(concordances).length ? concordances :
|
|
180
|
+
concordances: concordances && Object.keys(concordances).length ? concordances : null,
|
|
186
181
|
isCurrent,
|
|
187
182
|
isDeprecated: !!edtfDeprecated,
|
|
188
183
|
isCeased: !!edtfCessation,
|
|
189
184
|
isSuperseded: !!(superseded_by && superseded_by.length),
|
|
190
185
|
isSuperseding: !!(supersedes && supersedes.length),
|
|
191
|
-
lastmodified: typeof lastmodified === "number" ? lastmodified :
|
|
186
|
+
lastmodified: typeof lastmodified === "number" ? lastmodified : null,
|
|
192
187
|
}
|
|
193
188
|
}
|
|
194
189
|
|
|
@@ -52,7 +52,8 @@ export type InterpolateColorCallback = (t: number) => string
|
|
|
52
52
|
export interface GenerateMermaidMarkupOptions {
|
|
53
53
|
/**
|
|
54
54
|
* Restrict descendants to the given roles.
|
|
55
|
-
*
|
|
55
|
+
*
|
|
56
|
+
* @defaultValue all roles.
|
|
56
57
|
*/
|
|
57
58
|
roles?: Iterable<PlacetypeRole>
|
|
58
59
|
/**
|
|
@@ -81,7 +82,7 @@ const HAND_TUNED_PALETTE: Record<PlacetypeRole, RolePalette> = Object.fromEntrie
|
|
|
81
82
|
* Walk the filtered subtree once to find the deepest reachable descendant, mirroring the emit-walk in
|
|
82
83
|
* {@linkcode generateMermaidMarkup} so its depths line up with the edges that will be emitted.
|
|
83
84
|
*/
|
|
84
|
-
function measureMaxDepth(root: Placetype, roles: Iterable<PlacetypeRole> |
|
|
85
|
+
function measureMaxDepth(root: Placetype, roles: Iterable<PlacetypeRole> | null): number {
|
|
85
86
|
let maxDepth = 0
|
|
86
87
|
const visited = new Set<string>()
|
|
87
88
|
|
|
@@ -132,7 +133,7 @@ export function generateMermaidMarkup(placetype: Placetype, options: GenerateMer
|
|
|
132
133
|
]
|
|
133
134
|
|
|
134
135
|
// Pre-compute max depth once so every edge's `t` is consistent across the second pass.
|
|
135
|
-
const maxDepth = measureMaxDepth(placetype, roles)
|
|
136
|
+
const maxDepth = measureMaxDepth(placetype, roles ?? null)
|
|
136
137
|
|
|
137
138
|
const visited = new Set<string>()
|
|
138
139
|
let edgeIdx = 0
|
|
@@ -54,10 +54,10 @@ export const PLACETYPE_SPECIFICITY: Readonly<Partial<Record<WhosOnFirstPlacetype
|
|
|
54
54
|
*
|
|
55
55
|
* The two reasonable answers (block conservatively, or ignore) differ per call site.
|
|
56
56
|
*/
|
|
57
|
-
export function placetypeSpecificity(placetype: string | null | undefined): number |
|
|
58
|
-
if (!placetype) return
|
|
57
|
+
export function placetypeSpecificity(placetype: string | null | undefined): number | null {
|
|
58
|
+
if (!placetype) return null
|
|
59
59
|
|
|
60
|
-
return PLACETYPE_SPECIFICITY[placetype]
|
|
60
|
+
return PLACETYPE_SPECIFICITY[placetype] ?? null
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
@@ -72,11 +72,11 @@ export function placetypeSpecificity(placetype: string | null | undefined): numb
|
|
|
72
72
|
export function isAtLeastAsSpecific(
|
|
73
73
|
candidate: string | null | undefined,
|
|
74
74
|
reference: string | null | undefined
|
|
75
|
-
): boolean |
|
|
75
|
+
): boolean | null {
|
|
76
76
|
const a = placetypeSpecificity(candidate)
|
|
77
77
|
const b = placetypeSpecificity(reference)
|
|
78
78
|
|
|
79
|
-
if (a ===
|
|
79
|
+
if (a === null || b === null) return null
|
|
80
80
|
|
|
81
81
|
return a >= b
|
|
82
82
|
}
|
|
@@ -97,11 +97,11 @@ export function isAtLeastAsSpecific(
|
|
|
97
97
|
export function isStrictlyFiner(
|
|
98
98
|
candidate: string | null | undefined,
|
|
99
99
|
reference: string | null | undefined
|
|
100
|
-
): boolean |
|
|
100
|
+
): boolean | null {
|
|
101
101
|
const a = placetypeSpecificity(candidate)
|
|
102
102
|
const b = placetypeSpecificity(reference)
|
|
103
103
|
|
|
104
|
-
if (a ===
|
|
104
|
+
if (a === null || b === null) return null
|
|
105
105
|
|
|
106
106
|
return a > b
|
|
107
107
|
}
|
package/lib/resources.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export * from "#resources/debugging"
|
|
8
8
|
export * from "#resources/git"
|
|
9
9
|
export * from "#resources/languages"
|
|
10
|
+
export * from "#resources/languages/types.gen"
|
|
10
11
|
export * from "#resources/libpostal"
|
|
11
12
|
export * from "#resources/locale"
|
|
12
13
|
export * from "#resources/set"
|