@mailwoman/core 8.1.0 → 8.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/api/APIClient.ts +3 -4
- package/api/responses.ts +6 -3
- package/coarse-placer/coarse-placer.ts +26 -11
- package/coarse-placer/featurize.ts +25 -16
- package/coarse-placer/tools/build-dataset.ts +42 -18
- package/coarse-placer/tools/build-outlier-exposure.ts +51 -18
- package/coarse-placer/tools/build-outlier-latin.ts +48 -22
- package/coarse-placer/tools/build-outlier-oa.ts +52 -20
- package/coarse-placer/tools/eval-latin-offmap.ts +37 -12
- package/coarse-placer/tools/eval-openset.ts +104 -37
- package/coarse-placer/tools/eval-quant-compare.ts +41 -11
- package/coarse-placer/tools/eval.ts +51 -13
- package/coarse-placer/tools/fnv-hash.ts +5 -3
- package/coarse-placer/tools/probe-frontier.ts +63 -32
- package/coarse-placer/tools/quantize.ts +30 -8
- package/coarse-placer/tools/train.ts +63 -17
- package/collections.ts +2 -2
- package/decoder/build-tree.ts +16 -3
- package/decoder/calibration.ts +23 -7
- package/decoder/containment.ts +3 -1
- package/decoder/proposals-to-tree.ts +2 -0
- package/decoder/resolve-proposal-overlaps.ts +5 -1
- package/decoder/serialize-json.ts +8 -2
- package/decoder/serialize-tuples.ts +7 -2
- package/decoder/serialize-xml.ts +29 -11
- package/decoder/types.ts +34 -12
- package/decoder/unknown-spans.ts +14 -5
- package/decoder/validate-tree.ts +6 -1
- package/env/index.ts +1 -1
- package/env/load.ts +1 -1
- package/env/paths.ts +1 -1
- package/env/schema.ts +12 -4
- package/errors/schema.ts +1 -1
- package/fs/node.ts +9 -10
- package/identifiers.ts +3 -3
- package/kysley/adapter.ts +1 -1
- package/layers/manifest.ts +22 -8
- package/layers/schema.ts +59 -19
- package/locale/locale.ts +6 -2
- package/locale/profiles/en-us.ts +3 -0
- package/locale/profiles/fr-fr.ts +3 -0
- package/locale/profiles/ja-jp.ts +3 -0
- package/locale/registry.ts +3 -1
- package/logging/shared.ts +1 -0
- package/logging/utils.ts +1 -1
- package/objects.ts +7 -2
- package/out/api/APIClient.d.ts +1 -1
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/APIClient.js +3 -2
- package/out/api/APIClient.js.map +1 -1
- package/out/api/responses.d.ts.map +1 -1
- package/out/api/responses.js +3 -3
- package/out/api/responses.js.map +1 -1
- package/out/coarse-placer/coarse-placer.d.ts +19 -9
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js +6 -4
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/coarse-placer/featurize.d.ts.map +1 -1
- package/out/coarse-placer/featurize.js +20 -16
- package/out/coarse-placer/featurize.js.map +1 -1
- package/out/coarse-placer/tools/build-dataset.d.ts +15 -5
- package/out/coarse-placer/tools/build-dataset.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-dataset.js +19 -14
- package/out/coarse-placer/tools/build-dataset.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts +21 -7
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.js +24 -12
- package/out/coarse-placer/tools/build-outlier-exposure.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.d.ts +18 -6
- package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.js +27 -17
- package/out/coarse-placer/tools/build-outlier-latin.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.d.ts +18 -6
- package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.js +29 -15
- package/out/coarse-placer/tools/build-outlier-oa.js.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts +18 -6
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.js +13 -7
- package/out/coarse-placer/tools/eval-latin-offmap.js.map +1 -1
- package/out/coarse-placer/tools/eval-openset.d.ts +24 -8
- package/out/coarse-placer/tools/eval-openset.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-openset.js +52 -31
- package/out/coarse-placer/tools/eval-openset.js.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.d.ts +30 -10
- package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.js +4 -2
- package/out/coarse-placer/tools/eval-quant-compare.js.map +1 -1
- package/out/coarse-placer/tools/eval.d.ts +24 -8
- package/out/coarse-placer/tools/eval.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval.js +16 -6
- package/out/coarse-placer/tools/eval.js.map +1 -1
- package/out/coarse-placer/tools/fnv-hash.d.ts +3 -1
- package/out/coarse-placer/tools/fnv-hash.d.ts.map +1 -1
- package/out/coarse-placer/tools/fnv-hash.js +5 -3
- package/out/coarse-placer/tools/fnv-hash.js.map +1 -1
- package/out/coarse-placer/tools/probe-frontier.d.ts +18 -6
- package/out/coarse-placer/tools/probe-frontier.d.ts.map +1 -1
- package/out/coarse-placer/tools/probe-frontier.js +39 -23
- package/out/coarse-placer/tools/probe-frontier.js.map +1 -1
- package/out/coarse-placer/tools/quantize.d.ts +15 -5
- package/out/coarse-placer/tools/quantize.d.ts.map +1 -1
- package/out/coarse-placer/tools/quantize.js +11 -4
- package/out/coarse-placer/tools/quantize.js.map +1 -1
- package/out/coarse-placer/tools/train.d.ts +24 -8
- package/out/coarse-placer/tools/train.d.ts.map +1 -1
- package/out/coarse-placer/tools/train.js +24 -10
- package/out/coarse-placer/tools/train.js.map +1 -1
- package/out/collections.js +2 -2
- package/out/collections.js.map +1 -1
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js +9 -3
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/calibration.d.ts +17 -3
- package/out/decoder/calibration.d.ts.map +1 -1
- package/out/decoder/calibration.js +12 -4
- package/out/decoder/calibration.js.map +1 -1
- package/out/decoder/containment.d.ts +3 -1
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js +3 -1
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.d.ts.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.js +5 -1
- package/out/decoder/resolve-proposal-overlaps.js.map +1 -1
- package/out/decoder/serialize-json.d.ts +6 -2
- package/out/decoder/serialize-json.d.ts.map +1 -1
- package/out/decoder/serialize-json.js.map +1 -1
- package/out/decoder/serialize-tuples.d.ts +6 -2
- 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 +21 -7
- package/out/decoder/serialize-xml.d.ts.map +1 -1
- package/out/decoder/serialize-xml.js +7 -5
- package/out/decoder/serialize-xml.js.map +1 -1
- package/out/decoder/types.d.ts +34 -12
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +1 -1
- package/out/decoder/types.js.map +1 -1
- package/out/decoder/unknown-spans.d.ts +9 -3
- package/out/decoder/unknown-spans.d.ts.map +1 -1
- package/out/decoder/unknown-spans.js +4 -2
- package/out/decoder/unknown-spans.js.map +1 -1
- package/out/decoder/validate-tree.d.ts +3 -1
- package/out/decoder/validate-tree.d.ts.map +1 -1
- package/out/decoder/validate-tree.js +3 -1
- package/out/decoder/validate-tree.js.map +1 -1
- package/out/env/index.js +0 -1
- package/out/env/index.js.map +1 -1
- package/out/env/load.js +1 -1
- package/out/env/load.js.map +1 -1
- package/out/env/paths.js +1 -1
- package/out/env/paths.js.map +1 -1
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +12 -4
- package/out/env/schema.js.map +1 -1
- package/out/errors/schema.js +1 -1
- package/out/errors/schema.js.map +1 -1
- package/out/fs/node.d.ts +1 -2
- package/out/fs/node.d.ts.map +1 -1
- package/out/fs/node.js +7 -8
- package/out/fs/node.js.map +1 -1
- package/out/identifiers.js +3 -3
- package/out/identifiers.js.map +1 -1
- package/out/kysley/adapter.d.ts +1 -1
- package/out/kysley/adapter.d.ts.map +1 -1
- package/out/kysley/adapter.js +1 -1
- package/out/kysley/adapter.js.map +1 -1
- package/out/layers/manifest.d.ts +18 -6
- package/out/layers/manifest.d.ts.map +1 -1
- package/out/layers/manifest.js +8 -4
- package/out/layers/manifest.js.map +1 -1
- package/out/layers/schema.d.ts +57 -19
- package/out/layers/schema.d.ts.map +1 -1
- package/out/layers/schema.js +24 -8
- package/out/layers/schema.js.map +1 -1
- package/out/locale/locale.d.ts +6 -2
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/profiles/en-us.d.ts +3 -0
- package/out/locale/profiles/en-us.d.ts.map +1 -1
- package/out/locale/profiles/en-us.js +3 -0
- package/out/locale/profiles/en-us.js.map +1 -1
- package/out/locale/profiles/fr-fr.d.ts +3 -0
- package/out/locale/profiles/fr-fr.d.ts.map +1 -1
- package/out/locale/profiles/fr-fr.js +3 -0
- package/out/locale/profiles/fr-fr.js.map +1 -1
- package/out/locale/profiles/ja-jp.d.ts +3 -0
- package/out/locale/profiles/ja-jp.d.ts.map +1 -1
- package/out/locale/profiles/ja-jp.js +3 -0
- package/out/locale/profiles/ja-jp.js.map +1 -1
- package/out/locale/registry.d.ts +3 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js +3 -1
- package/out/locale/registry.js.map +1 -1
- package/out/logging/shared.d.ts.map +1 -1
- package/out/logging/shared.js +1 -0
- package/out/logging/shared.js.map +1 -1
- package/out/logging/utils.js +1 -1
- package/out/logging/utils.js.map +1 -1
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +2 -2
- package/out/objects.js.map +1 -1
- package/out/pipeline/index.d.ts +2 -2
- package/out/pipeline/index.d.ts.map +1 -1
- package/out/pipeline/index.js +1 -1
- package/out/pipeline/index.js.map +1 -1
- package/out/pipeline/reconcile-lookups.d.ts.map +1 -1
- package/out/pipeline/reconcile-lookups.js.map +1 -1
- package/out/pipeline/reconcile.d.ts +30 -10
- package/out/pipeline/reconcile.d.ts.map +1 -1
- package/out/pipeline/reconcile.js +12 -9
- package/out/pipeline/reconcile.js.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +18 -0
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +73 -46
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-logit-aggregation.d.ts.map +1 -1
- package/out/pipeline/span-logit-aggregation.js +5 -2
- package/out/pipeline/span-logit-aggregation.js.map +1 -1
- package/out/pipeline/span-proposer.d.ts +19 -9
- package/out/pipeline/span-proposer.d.ts.map +1 -1
- package/out/pipeline/span-proposer.js +42 -22
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +77 -19
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +16 -0
- package/out/pipeline/types.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 +2 -3
- package/out/policy/proposal-collection.js.map +1 -1
- package/out/policy/registry.d.ts +9 -3
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +9 -3
- package/out/policy/registry.js.map +1 -1
- package/out/resolver/index.d.ts.map +1 -1
- package/out/resolver/types.d.ts +94 -30
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +7 -1
- package/out/resolver/types.js.map +1 -1
- package/out/resources/LocaleIndex.d.ts +1 -1
- package/out/resources/LocaleIndex.d.ts.map +1 -1
- package/out/resources/LocaleIndex.js +1 -2
- package/out/resources/LocaleIndex.js.map +1 -1
- package/out/resources/ResourceMapCache.d.ts.map +1 -1
- package/out/resources/ResourceMapCache.js +1 -1
- package/out/resources/ResourceMapCache.js.map +1 -1
- package/out/resources/collections.d.ts.map +1 -1
- package/out/resources/collections.js +3 -1
- package/out/resources/collections.js.map +1 -1
- package/out/resources/languages/index.d.ts +1 -1
- package/out/resources/languages/index.d.ts.map +1 -1
- package/out/resources/languages/index.js +1 -1
- package/out/resources/languages/index.js.map +1 -1
- package/out/resources/libpostal.d.ts +1 -1
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/libpostal.js +7 -5
- package/out/resources/libpostal.js.map +1 -1
- package/out/resources/set.js +6 -6
- package/out/resources/set.js.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts +1 -4
- package/out/resources/whosonfirst/DataSourceCache.d.ts.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.js +1 -20
- package/out/resources/whosonfirst/DataSourceCache.js.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 -2
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/backoff.d.ts +19 -0
- package/out/resources/whosonfirst/backoff.d.ts.map +1 -0
- package/out/resources/whosonfirst/backoff.js +35 -0
- package/out/resources/whosonfirst/backoff.js.map +1 -0
- package/out/resources/whosonfirst/loader.d.ts +1 -1
- package/out/resources/whosonfirst/loader.d.ts.map +1 -1
- package/out/resources/whosonfirst/loader.js +0 -1
- package/out/resources/whosonfirst/loader.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts +4 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +8 -6
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +6 -4
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +8 -4
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/definition.d.ts +5 -6
- package/out/resources/whosonfirst/placetypes/definition.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/definition.js +3 -0
- package/out/resources/whosonfirst/placetypes/definition.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.d.ts +4 -2
- package/out/resources/whosonfirst/placetypes/graph.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.js +0 -0
- package/out/resources/whosonfirst/placetypes/graph.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +4 -2
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js +0 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.d.ts +1 -1
- package/out/resources/whosonfirst/placetypes/tree.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.js +0 -1
- package/out/resources/whosonfirst/placetypes/tree.js.map +1 -1
- package/out/routing/index.d.ts.map +1 -1
- package/out/routing/index.js +1 -1
- package/out/routing/index.js.map +1 -1
- package/out/scripting/utils/index.d.ts +3 -1
- package/out/scripting/utils/index.d.ts.map +1 -1
- package/out/scripting/utils/index.js +3 -1
- package/out/scripting/utils/index.js.map +1 -1
- package/out/tokenization/Span.js.map +1 -1
- package/out/tokenization/normalizer.js +11 -11
- package/out/tokenization/normalizer.js.map +1 -1
- package/out/tools/download-libpostal-resources.d.ts.map +1 -1
- package/out/tools/download-libpostal-resources.js.map +1 -1
- package/out/tools/download-ssl-address.d.ts +9 -3
- package/out/tools/download-ssl-address.d.ts.map +1 -1
- package/out/tools/download-ssl-address.js +8 -4
- package/out/tools/download-ssl-address.js.map +1 -1
- package/out/tools/generate-language-types.d.ts +12 -4
- package/out/tools/generate-language-types.d.ts.map +1 -1
- package/out/tools/generate-language-types.js +3 -1
- package/out/tools/generate-language-types.js.map +1 -1
- package/out/types/Classification.d.ts.map +1 -1
- package/out/types/Classification.js.map +1 -1
- package/out/types/classifier.d.ts +27 -9
- package/out/types/classifier.d.ts.map +1 -1
- package/out/types/component.d.ts +6 -2
- package/out/types/component.d.ts.map +1 -1
- package/out/types/component.js.map +1 -1
- package/out/utils/data-root.d.ts +3 -1
- package/out/utils/data-root.d.ts.map +1 -1
- package/out/utils/data-root.js +3 -1
- package/out/utils/data-root.js.map +1 -1
- package/out/utils/hash.d.ts +6 -2
- package/out/utils/hash.d.ts.map +1 -1
- package/out/utils/hash.js +6 -2
- package/out/utils/hash.js.map +1 -1
- package/out/utils/jsonl.d.ts +9 -3
- package/out/utils/jsonl.d.ts.map +1 -1
- package/out/utils/jsonl.js +9 -3
- package/out/utils/jsonl.js.map +1 -1
- package/out/utils/python-json.d.ts +6 -2
- package/out/utils/python-json.d.ts.map +1 -1
- package/out/utils/python-json.js +9 -3
- package/out/utils/python-json.js.map +1 -1
- package/out/utils/python-random.d.ts +15 -5
- package/out/utils/python-random.d.ts.map +1 -1
- package/out/utils/python-random.js +17 -7
- package/out/utils/python-random.js.map +1 -1
- package/out/utils/repo.d.ts +4 -0
- package/out/utils/repo.d.ts.map +1 -1
- package/out/utils/repo.js +4 -0
- package/out/utils/repo.js.map +1 -1
- package/out/utils/sealed-db.d.ts +6 -2
- package/out/utils/sealed-db.d.ts.map +1 -1
- package/out/utils/sealed-db.js +6 -2
- package/out/utils/sealed-db.js.map +1 -1
- package/out/utils/stats.d.ts +9 -3
- package/out/utils/stats.d.ts.map +1 -1
- package/out/utils/stats.js +11 -5
- package/out/utils/stats.js.map +1 -1
- package/package.json +2 -2
- package/pipeline/index.ts +5 -1
- package/pipeline/reconcile-lookups.ts +3 -0
- package/pipeline/reconcile.ts +65 -24
- package/pipeline/runtime-pipeline.ts +95 -46
- package/pipeline/span-logit-aggregation.ts +7 -2
- package/pipeline/span-proposer.ts +95 -34
- package/pipeline/types.ts +88 -19
- package/policy/proposal-collection.ts +4 -3
- package/policy/registry.ts +13 -3
- package/resolver/index.ts +1 -0
- package/resolver/types.ts +95 -30
- package/resources/LocaleIndex.ts +2 -2
- package/resources/ResourceMapCache.ts +3 -2
- package/resources/collections.ts +4 -1
- package/resources/languages/index.ts +2 -1
- package/resources/libpostal.ts +6 -3
- package/resources/set.ts +6 -6
- package/resources/whosonfirst/DataSourceCache.ts +2 -24
- package/resources/whosonfirst/PlacetypeDataSource.ts +2 -2
- package/resources/whosonfirst/backoff.ts +39 -0
- package/resources/whosonfirst/loader.ts +2 -1
- package/resources/whosonfirst/placetypes/Placetype.ts +9 -6
- package/resources/whosonfirst/placetypes/admin.ts +12 -7
- package/resources/whosonfirst/placetypes/definition.ts +6 -6
- package/resources/whosonfirst/placetypes/graph.ts +0 -0
- package/resources/whosonfirst/placetypes/mermaid.ts +5 -2
- package/resources/whosonfirst/placetypes/tree.ts +1 -1
- package/routing/index.ts +5 -1
- package/scripting/utils/index.ts +3 -1
- package/tokenization/Span.ts +1 -1
- package/tokenization/normalizer.ts +11 -11
- package/tools/download-libpostal-resources.ts +1 -0
- package/tools/download-ssl-address.ts +19 -7
- package/tools/generate-language-types.ts +12 -4
- package/types/Classification.ts +5 -0
- package/types/classifier.ts +27 -9
- package/types/component.ts +6 -2
- package/utils/data-root.ts +3 -1
- package/utils/hash.ts +6 -2
- package/utils/jsonl.ts +11 -3
- package/utils/python-json.ts +13 -4
- package/utils/python-random.ts +17 -7
- package/utils/repo.ts +8 -0
- package/utils/sealed-db.ts +10 -2
- package/utils/stats.ts +11 -5
package/layers/manifest.ts
CHANGED
|
@@ -12,16 +12,24 @@ import type { Kysely } from "kysely"
|
|
|
12
12
|
|
|
13
13
|
import { LayerFreshnessPolicy, LayerTier, type LayerContractDatabase } from "./schema.ts"
|
|
14
14
|
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Which spine columns a layer carries. At least one key is required.
|
|
17
|
+
*/
|
|
16
18
|
export interface SpineKeys {
|
|
17
19
|
h3?: { column: string; resolution: number }
|
|
18
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Column name holding WOF ids, when present.
|
|
22
|
+
*/
|
|
19
23
|
wofID?: string
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Column name holding `@mailwoman/address-id` keys, when present.
|
|
26
|
+
*/
|
|
21
27
|
addressID?: string
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Parsed manifest — see {@link LayerManifestTable} for the storage form.
|
|
32
|
+
*/
|
|
25
33
|
export interface LayerManifest {
|
|
26
34
|
name: string
|
|
27
35
|
version: string
|
|
@@ -61,7 +69,9 @@ function assertManifestInvariants(manifest: Pick<LayerManifest, "tier" | "freshn
|
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
71
|
|
|
64
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Insert the single manifest row. Call exactly once, from the layer's build script.
|
|
74
|
+
*/
|
|
65
75
|
export async function writeLayerManifest(db: Kysely<LayerContractDatabase>, manifest: LayerManifest): Promise<void> {
|
|
66
76
|
assertManifestInvariants(manifest)
|
|
67
77
|
|
|
@@ -85,14 +95,18 @@ export async function writeLayerManifest(db: Kysely<LayerContractDatabase>, mani
|
|
|
85
95
|
.execute()
|
|
86
96
|
}
|
|
87
97
|
|
|
88
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Read + validate the manifest. Throws if the table is empty, multi-row, or invalid.
|
|
100
|
+
*/
|
|
89
101
|
export async function readLayerManifest(db: Kysely<LayerContractDatabase>): Promise<LayerManifest> {
|
|
90
102
|
const rows = await db.selectFrom("layer_manifest").selectAll().execute()
|
|
91
103
|
|
|
92
104
|
if (rows.length !== 1) {
|
|
93
105
|
throw new Error(`layer manifest: expected exactly 1 row, found ${rows.length}`)
|
|
94
106
|
}
|
|
107
|
+
|
|
95
108
|
const row = rows[0]!
|
|
109
|
+
|
|
96
110
|
const manifest: LayerManifest = {
|
|
97
111
|
name: row.name,
|
|
98
112
|
version: row.version,
|
|
@@ -119,14 +133,14 @@ export async function readLayerManifest(db: Kysely<LayerContractDatabase>): Prom
|
|
|
119
133
|
* bound-variable ceiling — a continental-scale build's res-6 coverage cell count blows past that limit in a single
|
|
120
134
|
* `.values()` call (found 2026-07-19).
|
|
121
135
|
*/
|
|
122
|
-
export const COVERAGE_INSERT_BATCH =
|
|
136
|
+
export const COVERAGE_INSERT_BATCH = 5000
|
|
123
137
|
|
|
124
138
|
/**
|
|
125
139
|
* Bulk-insert coverage cells (build-time; cold path, so Kysely inserts are fine), chunked to stay under SQLite's
|
|
126
140
|
* bound-variable limit.
|
|
127
141
|
*/
|
|
128
142
|
export async function writeLayerCoverage(db: Kysely<LayerContractDatabase>, cells: CoverageCell[]): Promise<void> {
|
|
129
|
-
if (cells.length
|
|
143
|
+
if (!cells.length) return
|
|
130
144
|
|
|
131
145
|
for (let i = 0; i < cells.length; i += COVERAGE_INSERT_BATCH) {
|
|
132
146
|
const batch = cells.slice(i, i + COVERAGE_INSERT_BATCH)
|
package/layers/schema.ts
CHANGED
|
@@ -15,64 +15,102 @@
|
|
|
15
15
|
|
|
16
16
|
import { sql, type Kysely } from "kysely"
|
|
17
17
|
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Distribution tier of a layer. Shipped = permissive-license, published by us.
|
|
20
|
+
*/
|
|
19
21
|
export const LayerTier = {
|
|
20
22
|
Shipped: "shipped",
|
|
21
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Share-alike sources (ODbL): we ship the builder CLI, the user builds locally.
|
|
25
|
+
*/
|
|
22
26
|
BuildLocal: "build-local",
|
|
23
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The user's own data, conforming to the contract, never distributed.
|
|
29
|
+
*/
|
|
24
30
|
Private: "private",
|
|
25
31
|
} as const
|
|
32
|
+
|
|
26
33
|
export type LayerTier = (typeof LayerTier)[keyof typeof LayerTier]
|
|
27
34
|
|
|
28
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* How a layer is kept current.
|
|
37
|
+
*/
|
|
29
38
|
export const LayerFreshnessPolicy = {
|
|
30
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Immutable artifact; updates are full rebuilds (the gazetteer discipline).
|
|
41
|
+
*/
|
|
31
42
|
Sealed: "sealed",
|
|
32
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Periodically re-issued under the same name (e.g. registries of people/programs).
|
|
45
|
+
*/
|
|
33
46
|
VersionedRefresh: "versioned-refresh",
|
|
34
47
|
} as const
|
|
48
|
+
|
|
35
49
|
export type LayerFreshnessPolicy = (typeof LayerFreshnessPolicy)[keyof typeof LayerFreshnessPolicy]
|
|
36
50
|
|
|
37
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* The single-row layer identity record. See {@link LayerManifest} for the parsed form.
|
|
53
|
+
*/
|
|
38
54
|
export interface LayerManifestTable {
|
|
39
55
|
name: string
|
|
40
56
|
version: string
|
|
41
57
|
schema_version: number
|
|
42
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* One of {@link LayerTier}.
|
|
60
|
+
*/
|
|
43
61
|
tier: string
|
|
44
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* SPDX-ish license expression, e.g. `CDLA-Permissive-2.0`, `ODbL-1.0`.
|
|
64
|
+
*/
|
|
45
65
|
license: string
|
|
46
66
|
attribution: string | null
|
|
47
67
|
source: string
|
|
48
68
|
source_vintage: string
|
|
49
69
|
build_cmd: string
|
|
50
70
|
build_sha: string
|
|
51
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* One of {@link LayerFreshnessPolicy}.
|
|
73
|
+
*/
|
|
52
74
|
freshness_policy: string
|
|
53
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* JSON-encoded spine-key declaration (see `SpineKeys` in `manifest.ts`).
|
|
77
|
+
*/
|
|
54
78
|
spine_keys: string
|
|
55
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* ISO-8601, supplied by the build script (never generated in-library).
|
|
81
|
+
*/
|
|
56
82
|
created_at: string
|
|
57
83
|
}
|
|
58
84
|
|
|
59
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Per-cell survey completeness. Missing row = unknown, NOT zero.
|
|
87
|
+
*/
|
|
60
88
|
export interface LayerCoverageTable {
|
|
61
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* 48-bit short H3 cell at the resolution declared by the manifest's spine keys.
|
|
91
|
+
*/
|
|
62
92
|
h3_cell: number
|
|
63
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Estimated completeness of the source survey in this cell, 0..1.
|
|
95
|
+
*/
|
|
64
96
|
completeness: number
|
|
65
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Rows this layer actually holds in the cell.
|
|
99
|
+
*/
|
|
66
100
|
observed_rows: number
|
|
67
101
|
}
|
|
68
102
|
|
|
69
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Pass to `new DatabaseClient<LayerContractDatabase>(...)` (or intersect into a layer's own schema).
|
|
105
|
+
*/
|
|
70
106
|
export interface LayerContractDatabase {
|
|
71
107
|
layer_manifest: LayerManifestTable
|
|
72
108
|
layer_coverage: LayerCoverageTable
|
|
73
109
|
}
|
|
74
110
|
|
|
75
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Create `layer_manifest`. Single row enforced by `name` PK + the writer's insert-once discipline.
|
|
113
|
+
*/
|
|
76
114
|
export async function createLayerManifestTable(db: Kysely<LayerContractDatabase>): Promise<void> {
|
|
77
115
|
await db.schema
|
|
78
116
|
.createTable("layer_manifest")
|
|
@@ -92,7 +130,9 @@ export async function createLayerManifestTable(db: Kysely<LayerContractDatabase>
|
|
|
92
130
|
.execute()
|
|
93
131
|
}
|
|
94
132
|
|
|
95
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Create `layer_coverage` — small fixed-width rows probed by PK, the WITHOUT ROWID sweet spot.
|
|
135
|
+
*/
|
|
96
136
|
export async function createLayerCoverageTable(db: Kysely<LayerContractDatabase>): Promise<void> {
|
|
97
137
|
await db.schema
|
|
98
138
|
.createTable("layer_coverage")
|
package/locale/locale.ts
CHANGED
|
@@ -18,7 +18,9 @@ import type { ComponentTag } from "@mailwoman/core/types"
|
|
|
18
18
|
import type { ClassifierPolicy } from "../policy/policy.ts"
|
|
19
19
|
|
|
20
20
|
export interface LocaleProfile {
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* BCP-47 locale tag (e.g. `"en-US"`, `"fr-FR"`, `"ja-JP"`).
|
|
23
|
+
*/
|
|
22
24
|
locale: string
|
|
23
25
|
|
|
24
26
|
/**
|
|
@@ -38,7 +40,9 @@ export interface LocaleProfile {
|
|
|
38
40
|
*/
|
|
39
41
|
componentsSupported: ComponentTag[]
|
|
40
42
|
|
|
41
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Per-component policy overrides for this locale.
|
|
45
|
+
*/
|
|
42
46
|
policy: ClassifierPolicy[]
|
|
43
47
|
}
|
|
44
48
|
|
package/locale/profiles/en-us.ts
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
import type { LocaleProfile } from "../locale.ts"
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* US English locale profile — the component ordering, casing and separators the formatter renders with.
|
|
15
|
+
*/
|
|
13
16
|
export const enUS: LocaleProfile = {
|
|
14
17
|
locale: "en-US",
|
|
15
18
|
ruleClassifiers: [
|
package/locale/profiles/fr-fr.ts
CHANGED
package/locale/profiles/ja-jp.ts
CHANGED
package/locale/registry.ts
CHANGED
|
@@ -31,7 +31,9 @@ export class InMemoryLocaleRegistry implements LocaleRegistry {
|
|
|
31
31
|
return Array.from(this.#profiles.values())
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Remove a locale. No-op if not present.
|
|
36
|
+
*/
|
|
35
37
|
unregister(locale: string): void {
|
|
36
38
|
this.#profiles.delete(locale)
|
|
37
39
|
}
|
package/logging/shared.ts
CHANGED
|
@@ -125,6 +125,7 @@ export function createLogger(prefix?: string, ...args: string[][]): Logger {
|
|
|
125
125
|
*
|
|
126
126
|
* @implements {IRuntimeLogger}
|
|
127
127
|
*/
|
|
128
|
+
// oxlint-disable-next-line unicorn/no-static-only-class -- a static façade whose members are bound to console's own methods
|
|
128
129
|
export class ConsoleLogger {
|
|
129
130
|
static info: typeof console.info
|
|
130
131
|
static warn: typeof console.warn
|
package/logging/utils.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export function castToLoggableEntries<T extends Record<string, unknown>>(input: T) {
|
|
13
13
|
return Object.entries(input)
|
|
14
|
-
.
|
|
14
|
+
.toSorted(([keyA], [keyB]) => keyA.localeCompare(keyB))
|
|
15
15
|
.filter(([_key, value]) => value && typeof value === "string") as [keyof T, string][]
|
|
16
16
|
}
|
|
17
17
|
|
package/objects.ts
CHANGED
|
@@ -43,6 +43,7 @@ export function pick<O extends object, K extends keyof O>(
|
|
|
43
43
|
setLike: SetLike<K>,
|
|
44
44
|
transform?: (value: O[keyof O], key: keyof O, input: O) => never
|
|
45
45
|
): Pick<O, K>
|
|
46
|
+
|
|
46
47
|
/**
|
|
47
48
|
* @param input Source object.
|
|
48
49
|
* @param scalarEnum Enum-like object whose members represent the subset of keys to pick.
|
|
@@ -54,6 +55,7 @@ export function pick<O extends object, K extends keyof O>(
|
|
|
54
55
|
scalarEnum: Record<K, K>,
|
|
55
56
|
transform?: (value: O[keyof O], key: keyof O, input: O) => never
|
|
56
57
|
): Pick<O, StringKeyOf<O>>
|
|
58
|
+
|
|
57
59
|
/**
|
|
58
60
|
* @param input Source object.
|
|
59
61
|
* @param constraints Unconstrained iterable of keys to pick, such as in array or Map.
|
|
@@ -77,6 +79,7 @@ export function pick<O extends object, K extends keyof O = StringKeyOf<O>>(
|
|
|
77
79
|
constraints: Record<K, K>,
|
|
78
80
|
transform?: (value: O[keyof O], key: keyof O, input: O) => never
|
|
79
81
|
): Pick<O, K>
|
|
82
|
+
|
|
80
83
|
/**
|
|
81
84
|
* @param input Source object.
|
|
82
85
|
* @param keys Unconstrained iterable of keys to pick, such as in array or Map.
|
|
@@ -88,6 +91,7 @@ export function pick<O extends object, K extends string>(
|
|
|
88
91
|
keys: Iterable<K>,
|
|
89
92
|
transform?: (value: O[keyof O], key: keyof O, input: O) => never
|
|
90
93
|
): Pick<O, StringKeyOf<O>>
|
|
94
|
+
|
|
91
95
|
/**
|
|
92
96
|
* @param input Source object.
|
|
93
97
|
* @param constraints Unconstrained iterable of keys to pick, such as in array or Map.
|
|
@@ -147,7 +151,7 @@ export function omitNullable<T extends object>(input: T): NonNullableObject<T> {
|
|
|
147
151
|
if (isRecordLike(currentValue)) {
|
|
148
152
|
const childResult = omitNullable(currentValue)
|
|
149
153
|
|
|
150
|
-
if (Object.keys(childResult).length
|
|
154
|
+
if (Object.keys(childResult).length) {
|
|
151
155
|
result[key] = childResult
|
|
152
156
|
}
|
|
153
157
|
} else if (Array.isArray(currentValue)) {
|
|
@@ -155,7 +159,7 @@ export function omitNullable<T extends object>(input: T): NonNullableObject<T> {
|
|
|
155
159
|
.map((entryValue) => (isRecordLike(entryValue) ? omitNullable(entryValue) : entryValue))
|
|
156
160
|
.filter((val) => val != null)
|
|
157
161
|
|
|
158
|
-
if (arr.length
|
|
162
|
+
if (arr.length) {
|
|
159
163
|
result[key] = arr
|
|
160
164
|
}
|
|
161
165
|
} else if (currentValue !== null) {
|
|
@@ -171,6 +175,7 @@ export function omitNullable<T extends object>(input: T): NonNullableObject<T> {
|
|
|
171
175
|
*/
|
|
172
176
|
export function tryParsingJSON<T = unknown>(input: unknown, fallback?: undefined): T | undefined
|
|
173
177
|
export function tryParsingJSON<T = unknown>(input: unknown, fallback: null): T | null
|
|
178
|
+
|
|
174
179
|
export function tryParsingJSON<T = unknown, F = null>(input: unknown, fallback?: F): T | F {
|
|
175
180
|
if (typeof input !== "string") return (fallback ?? null) as F
|
|
176
181
|
|
package/out/api/APIClient.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { type IRuntimeLogger } from "@mailwoman/core/logging";
|
|
7
7
|
import { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse, type CreateAxiosDefaults } from "axios";
|
|
8
8
|
import { type AxiosCacheInstance, type CacheAxiosResponse, type CacheOptions } from "axios-cache-interceptor";
|
|
9
|
-
export type
|
|
9
|
+
export { type IRuntimeLogger } from "@mailwoman/core/logging";
|
|
10
10
|
/**
|
|
11
11
|
* Configuration for an API client.
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIClient.d.ts","sourceRoot":"","sources":["../../api/APIClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE5E,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAA;AACxH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAEjB,MAAM,yBAAyB,CAAA;AAIhC,
|
|
1
|
+
{"version":3,"file":"APIClient.d.ts","sourceRoot":"","sources":["../../api/APIClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE5E,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAA;AACxH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAEjB,MAAM,yBAAyB,CAAA;AAIhC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IAEtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAA;CAC3B;AAED;;;GAGG;AACH,qBAAa,SAAS,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,CAAE,SAAQ,WAAY,YAAW,eAAe;;IACjH,SAAgB,MAAM,EAAE,CAAC,CAAA;IAOzB,IAAW,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpC;IAED;;OAEG;IACH,SAAgB,MAAM,EAAE,cAAc,CAAA;IACtC;;OAEG;IACH,SAAgB,KAAK,EAAE,aAAa,GAAG,kBAAkB,CAAA;gBAE7C,MAAM,EAAE,CAAC;IA0CrB;;OAEG;IACI,KAAK,GAAU,CAAC,EAAE,SAAS,kBAAkB,KAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAO/E;IAED,SAAS,CAAC,WAAW,GAAI,cAAc,MAAM,KAAG,IAAI,CAYnD;IAED,SAAS,CAAC,2BAA2B,GACpC,UAAU,kBAAkB,GAAG,aAAa,KAC1C,kBAAkB,GAAG,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAkBtD;IAEY,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAUnC,QAAQ;CAGxB"}
|
package/out/api/APIClient.js
CHANGED
|
@@ -8,6 +8,7 @@ import { isAsyncDisposable } from "async-init";
|
|
|
8
8
|
import Axios, {} from "axios";
|
|
9
9
|
import { setupCache, } from "axios-cache-interceptor";
|
|
10
10
|
import { delegateAxiosError } from "./responses.js";
|
|
11
|
+
export {} from "@mailwoman/core/logging";
|
|
11
12
|
/**
|
|
12
13
|
* A base class for API clients used in Mailwoman, providing features like request cooldowns, response caching, and
|
|
13
14
|
* integrated logging.
|
|
@@ -36,6 +37,7 @@ export class APIClient extends EventTarget {
|
|
|
36
37
|
const axiosInstance = Axios.create({
|
|
37
38
|
...config.axios,
|
|
38
39
|
});
|
|
40
|
+
// oxlint-disable-next-line unicorn/prefer-ternary -- the branches are multi-line client constructions
|
|
39
41
|
if (config.caching) {
|
|
40
42
|
this.axios = setupCache(axiosInstance, {
|
|
41
43
|
debug: (msg) => {
|
|
@@ -54,7 +56,7 @@ export class APIClient extends EventTarget {
|
|
|
54
56
|
return response;
|
|
55
57
|
});
|
|
56
58
|
this.axios.interceptors.response.use(undefined, delegateAxiosError);
|
|
57
|
-
this.#requestInterval = typeof config.requestsPerMinute === "number" ?
|
|
59
|
+
this.#requestInterval = typeof config.requestsPerMinute === "number" ? 60_000 / config.requestsPerMinute : 0;
|
|
58
60
|
if (this.#requestInterval) {
|
|
59
61
|
this.axios.interceptors.response.use(this.updateCooldownAfterResponse);
|
|
60
62
|
}
|
|
@@ -99,7 +101,6 @@ export class APIClient extends EventTarget {
|
|
|
99
101
|
if (isAsyncDisposable(storedCache)) {
|
|
100
102
|
await storedCache[Symbol.asyncDispose]();
|
|
101
103
|
}
|
|
102
|
-
return Promise.resolve();
|
|
103
104
|
}
|
|
104
105
|
toString() {
|
|
105
106
|
return `${this.config.displayName} API Client`;
|
package/out/api/APIClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIClient.js","sourceRoot":"","sources":["../../api/APIClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAuB,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,EAA6F,MAAM,OAAO,CAAA;AACxH,OAAO,EAIN,UAAU,GACV,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"APICl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;QAC3B,CAAC;QAED,OAAO,QAAQ,CAAA;IAChB,CAAC,CAAA;IAEM,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QACjC,IAAI,CAAC,sBAAsB,EAAE,OAAO,EAAE,CAAA;QAEtC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAA;QAEhD,IAAI,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;YACpC,MAAM,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAA;QACzC,CAAC;IACF,CAAC;IAEe,QAAQ;QACvB,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,aAAa,CAAA;IAC/C,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../api/responses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,IAAI;IACtC,IAAI,EAAE,IAAI,CAAA;CACV;AAED,MAAM,MAAM,YAAY,CAAC,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAE/D;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,iBAAiB,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../api/responses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,IAAI;IACtC,IAAI,EAAE,IAAI,CAAA;CACV;AAED,MAAM,MAAM,YAAY,CAAC,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAE/D;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,iBAAiB,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,CAAA;AAqBvF;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,CAAC,IAAI,IAAI,IAAI,SAAS;IACxD,IAAI,EAAE,MAAM,IAAI,CAAA;CAChB,GACE,uBAAuB,CAAC,IAAI,CAAC,GAC7B,IAAI,CAAA;AAEP;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAA;AAUlH,wBAAgB,iBAAiB,CAChC,eAAe,GAAE,GAAG,GAAG,MAA6D,GAClF,OAAO,CAAC,OAAO,CAAC,CAMlB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CA0CzE"}
|
package/out/api/responses.js
CHANGED
|
@@ -37,7 +37,7 @@ export function checkConnectivity(connectivityURL = "https://connectivitycheck.g
|
|
|
37
37
|
export async function delegateAxiosError(error) {
|
|
38
38
|
{
|
|
39
39
|
if (!isAxiosError(error))
|
|
40
|
-
|
|
40
|
+
throw error;
|
|
41
41
|
const { response, code: networkErrorCode } = error;
|
|
42
42
|
if (networkErrorCode === "ENOTFOUND") {
|
|
43
43
|
const internetReachable = await checkConnectivity();
|
|
@@ -58,11 +58,11 @@ export async function delegateAxiosError(error) {
|
|
|
58
58
|
case AxiosError.ERR_CANCELED:
|
|
59
59
|
case AxiosError.ECONNABORTED:
|
|
60
60
|
case AxiosError.ETIMEDOUT:
|
|
61
|
-
return
|
|
61
|
+
return;
|
|
62
62
|
default:
|
|
63
63
|
ConsoleLogger.warn(`Unhandled network error: ${networkErrorCode}`);
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
throw error;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
//# sourceMappingURL=responses.js.map
|
package/out/api/responses.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../api/responses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../api/responses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAuBnD,SAAS,mBAAmB,CAAO,KAAyB;IAC3D,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAA;AACtE,CAAC;AAQD,SAAS,iBAAiB,CAAO,KAAqC;IACrE,IAAI,mBAAmB,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,IAAI,CAAA;IAEjD,OAAO,KAAK,CAAA;AACb,CAAC;AAwBD,MAAM,UAAU,iBAAiB,CAAO,KAAqC;IAC5E,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAErC,IAAI,mBAAmB,CAAC,IAAI,CAAC;QAAE,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAE7D,OAAO,IAAqC,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAChC,kBAAgC,oDAAoD;IAEpF,OAAO,KAAK,CAAC,eAAe,EAAE;QAC7B,MAAM,EAAE,MAAM;KACd,CAAC;SACA,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,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CAAC,IAAI,CAAC,4BAA4B,gBAAgB,EAAE,CAAC,CAAA;QACpE,CAAC;QAED,MAAM,KAAK,CAAA;IACZ,CAAC;AACF,CAAC"}
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
* map") rather than emit a confident mis-placement. Pure + dependency-free — runs in node and the
|
|
10
10
|
* browser.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
/** Serialized model: metadata in JSON, the dense `weights` (row-major [class][feature]) alongside. */
|
|
12
|
+
export { COARSE_CLASSES, FEATURE_DIM, featurize } from "./featurize.ts";
|
|
14
13
|
export interface CoarsePlacerArtifact {
|
|
15
14
|
/**
|
|
16
15
|
* The coarse placer's classes (the country/region codes it routes to).
|
|
@@ -43,7 +42,9 @@ export interface CoarsePlacerMeta {
|
|
|
43
42
|
temperature: number;
|
|
44
43
|
bias: number[];
|
|
45
44
|
quantization?: "int8-per-row";
|
|
46
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Per-class dequantization scale; present iff `quantization === "int8-per-row"`.
|
|
47
|
+
*/
|
|
47
48
|
scales?: number[];
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
@@ -53,16 +54,24 @@ export interface CoarsePlacerMeta {
|
|
|
53
54
|
*/
|
|
54
55
|
export declare function dequantizeInt8Weights(int8: Int8Array, scales: readonly number[], classCount: number, dim: number): Float32Array;
|
|
55
56
|
export interface CoarsePrediction {
|
|
56
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* The predicted class, or `null` when the model abstained (confidence below the threshold).
|
|
59
|
+
*/
|
|
57
60
|
country: string | null;
|
|
58
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Calibrated probability of the top class (the abstention signal).
|
|
63
|
+
*/
|
|
59
64
|
confidence: number;
|
|
60
65
|
abstained: boolean;
|
|
61
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The full calibrated class distribution.
|
|
68
|
+
*/
|
|
62
69
|
probs: Record<string, number>;
|
|
63
70
|
}
|
|
64
71
|
export interface CoarsePlacerOpts {
|
|
65
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Abstain when the calibrated top-class confidence is below this (default 0.5).
|
|
74
|
+
*/
|
|
66
75
|
abstainBelow?: number;
|
|
67
76
|
/**
|
|
68
77
|
* Open-set reject rule (#244 M2). When `true`, the ABSTAIN decision uses the total IN-MAP probability mass `1 -
|
|
@@ -119,12 +128,13 @@ export declare function inMapPosterior(prediction: CoarsePrediction, opts?: {
|
|
|
119
128
|
*/
|
|
120
129
|
epsilonFloor?: number;
|
|
121
130
|
}): Record<string, number> | null;
|
|
122
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Load a coarse-placer from a JSON metadata file + a sibling `.weights.bin` (Float32).
|
|
133
|
+
*/
|
|
123
134
|
export declare function loadCoarsePlacer(metaJson: {
|
|
124
135
|
classes: string[];
|
|
125
136
|
featureDim: number;
|
|
126
137
|
temperature: number;
|
|
127
138
|
bias: number[];
|
|
128
139
|
}, weights: Float32Array, opts?: CoarsePlacerOpts): Promise<CoarsePlacer>;
|
|
129
|
-
export { COARSE_CLASSES, FEATURE_DIM, featurize };
|
|
130
140
|
//# sourceMappingURL=coarse-placer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coarse-placer.d.ts","sourceRoot":"","sources":["../../coarse-placer/coarse-placer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"coarse-placer.d.ts","sourceRoot":"","sources":["../../coarse-placer/coarse-placer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAEvE,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;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;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC7B,UAAU,EAAE,gBAAgB,EAC5B,IAAI,CAAC,EAAE;IACN;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB,GACC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAkB/B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACrC,QAAQ,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,EACxF,OAAO,EAAE,YAAY,EACrB,IAAI,CAAC,EAAE,gBAAgB,GACrB,OAAO,CAAC,YAAY,CAAC,CAEvB"}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* browser.
|
|
11
11
|
*/
|
|
12
12
|
import { $public } from "../env/index.js";
|
|
13
|
-
import {
|
|
13
|
+
import { featurize } from "./featurize.js";
|
|
14
|
+
export { COARSE_CLASSES, FEATURE_DIM, featurize } from "./featurize.js";
|
|
14
15
|
/**
|
|
15
16
|
* Dequantize a per-row int8 weight matrix back to fp32: `W[c][i] = int8[c*dim + i] * scales[c]`. The predict path stays
|
|
16
17
|
* fp32 (identical math); quantization only shrinks the serialized/wire artifact. Pure — usable in the browser loader
|
|
@@ -183,14 +184,15 @@ export function inMapPosterior(prediction, opts) {
|
|
|
183
184
|
}
|
|
184
185
|
// The argmax always survives (it is ≥ every other marginal; if even it fell below the floor the
|
|
185
186
|
// prediction would have abstained upstream) — but guard anyway so the posterior is never empty.
|
|
186
|
-
if (Object.keys(posterior).length
|
|
187
|
+
if (!Object.keys(posterior).length) {
|
|
187
188
|
posterior[prediction.country] = prediction.confidence;
|
|
188
189
|
}
|
|
189
190
|
return posterior;
|
|
190
191
|
}
|
|
191
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* Load a coarse-placer from a JSON metadata file + a sibling `.weights.bin` (Float32).
|
|
194
|
+
*/
|
|
192
195
|
export async function loadCoarsePlacer(metaJson, weights, opts) {
|
|
193
196
|
return new CoarsePlacer({ ...metaJson, weights }, opts);
|
|
194
197
|
}
|
|
195
|
-
export { COARSE_CLASSES, FEATURE_DIM, featurize };
|
|
196
198
|
//# sourceMappingURL=coarse-placer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coarse-placer.js","sourceRoot":"","sources":["../../coarse-placer/coarse-placer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"coarse-placer.js","sourceRoot":"","sources":["../../coarse-placer/coarse-placer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAyCvE;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,IAAe,EACf,MAAyB,EACzB,UAAkB,EAClB,GAAW;IAEX,MAAM,QAAQ,GAAG,UAAU,GAAG,GAAG,CAAA;IAEjC,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,MAAM,kBAAkB,QAAQ,EAAE,CAAC,CAAA;IAEjH,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,MAAM,CAAC,MAAM,aAAa,UAAU,UAAU,CAAC,CAAA;IAChH,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAA;IA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AAA;IAE5C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5D,IAAI,GAAG,KAAK,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;YACtC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;QACtB,CAAC;IACF,CAAC;IAED,gGAAgG;IAChG,gGAAgG;IAChG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC;QACpC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,UAAU,CAAA;IACtD,CAAC;IAED,OAAO,SAAS,CAAA;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,QAAwF,EACxF,OAAqB,EACrB,IAAuB;IAEvB,OAAO,IAAI,YAAY,CAAC,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,CAAA;AACxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featurize.d.ts","sourceRoot":"","sources":["../../coarse-placer/featurize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,4LAiCjB,CAAA;
|
|
1
|
+
{"version":3,"file":"featurize.d.ts","sourceRoot":"","sources":["../../coarse-placer/featurize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,4LAiCjB,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzD;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAU,CAAA;AA+DlC;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAsChD"}
|