@mailwoman/core 9.1.0 → 9.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/README.md +1 -1
- package/api/responses.ts +12 -0
- package/coarse-placer/featurize.ts +0 -2
- package/coarse-placer/tools/build-dataset.ts +1 -1
- package/coarse-placer/tools/build-outlier-exposure.ts +1 -1
- package/coarse-placer/tools/build-outlier-latin.ts +13 -7
- package/coarse-placer/tools/build-outlier-oa.ts +11 -5
- package/coarse-placer/tools/eval-latin-offmap.ts +3 -2
- package/coarse-placer/tools/eval-openset.ts +3 -2
- package/coarse-placer/tools/eval-quant-compare.ts +3 -2
- package/coarse-placer/tools/eval.ts +3 -2
- package/coarse-placer/tools/fnv-hash.ts +1 -6
- package/coarse-placer/tools/index.ts +1 -1
- package/coarse-placer/tools/probe-frontier.ts +3 -2
- package/coarse-placer/tools/quantize.ts +2 -2
- package/coarse-placer/tools/train.ts +2 -1
- package/crypto/node.ts +3 -1
- package/data/internal/dictionaries/languages.csv +184 -184
- package/data/libpostal/README.md +8 -2
- package/db/schema.ts +12 -3
- package/decoder/containment.ts +5 -1
- package/decoder/index.ts +1 -0
- package/decoder/parse-diff.ts +347 -0
- package/decoder/proposals-to-tree.ts +1 -1
- package/decoder/serialize-json.ts +51 -7
- package/decoder/serialize-tuples.ts +7 -1
- package/decoder/serialize-xml.ts +1 -1
- package/decoder/tree-shape.ts +144 -0
- package/decoder/types.ts +8 -0
- package/decoder/validate-tree.ts +15 -3
- package/env/index.ts +3 -1
- package/env/paths.ts +21 -33
- package/env/schema.ts +26 -3
- package/fs/utils/formatters.ts +107 -0
- package/fs/utils/index.ts +7 -0
- package/fs/zip.ts +1 -1
- package/layers/manifest.ts +56 -15
- package/layers/schema.ts +54 -2
- package/locale/locale.ts +1 -1
- package/locale/registry.ts +1 -1
- package/objects.ts +20 -8
- package/out/api/responses.d.ts +9 -0
- package/out/api/responses.d.ts.map +1 -1
- package/out/api/responses.js +11 -0
- package/out/api/responses.js.map +1 -1
- package/out/coarse-placer/featurize.d.ts +0 -1
- package/out/coarse-placer/featurize.d.ts.map +1 -1
- package/out/coarse-placer/featurize.js.map +1 -1
- package/out/coarse-placer/tools/build-dataset.js +1 -1
- package/out/coarse-placer/tools/build-dataset.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.js +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.js +12 -7
- package/out/coarse-placer/tools/build-outlier-latin.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.js +10 -5
- package/out/coarse-placer/tools/build-outlier-oa.js.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.js +2 -2
- package/out/coarse-placer/tools/eval-latin-offmap.js.map +1 -1
- package/out/coarse-placer/tools/eval-openset.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-openset.js +2 -2
- package/out/coarse-placer/tools/eval-openset.js.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.js +2 -2
- package/out/coarse-placer/tools/eval-quant-compare.js.map +1 -1
- package/out/coarse-placer/tools/eval.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval.js +2 -2
- package/out/coarse-placer/tools/eval.js.map +1 -1
- package/out/coarse-placer/tools/fnv-hash.d.ts +1 -6
- package/out/coarse-placer/tools/fnv-hash.d.ts.map +1 -1
- package/out/coarse-placer/tools/fnv-hash.js +1 -6
- package/out/coarse-placer/tools/fnv-hash.js.map +1 -1
- package/out/coarse-placer/tools/index.d.ts +1 -1
- package/out/coarse-placer/tools/index.js +1 -1
- package/out/coarse-placer/tools/probe-frontier.d.ts.map +1 -1
- package/out/coarse-placer/tools/probe-frontier.js +2 -2
- package/out/coarse-placer/tools/probe-frontier.js.map +1 -1
- package/out/coarse-placer/tools/quantize.js +2 -2
- package/out/coarse-placer/tools/quantize.js.map +1 -1
- package/out/coarse-placer/tools/train.d.ts.map +1 -1
- package/out/coarse-placer/tools/train.js +1 -1
- package/out/coarse-placer/tools/train.js.map +1 -1
- package/out/crypto/node.d.ts.map +1 -1
- package/out/crypto/node.js +2 -1
- package/out/crypto/node.js.map +1 -1
- package/out/db/schema.d.ts +12 -3
- package/out/db/schema.d.ts.map +1 -1
- package/out/db/schema.js +6 -0
- package/out/db/schema.js.map +1 -1
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js +5 -1
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/index.d.ts +1 -0
- package/out/decoder/index.d.ts.map +1 -1
- package/out/decoder/index.js +1 -0
- package/out/decoder/index.js.map +1 -1
- package/out/decoder/parse-diff.d.ts +125 -0
- package/out/decoder/parse-diff.d.ts.map +1 -0
- package/out/decoder/parse-diff.js +219 -0
- package/out/decoder/parse-diff.js.map +1 -0
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/serialize-json.d.ts +29 -0
- package/out/decoder/serialize-json.d.ts.map +1 -1
- package/out/decoder/serialize-json.js +20 -4
- package/out/decoder/serialize-json.js.map +1 -1
- package/out/decoder/serialize-tuples.d.ts +8 -1
- package/out/decoder/serialize-tuples.d.ts.map +1 -1
- package/out/decoder/serialize-tuples.js +7 -1
- package/out/decoder/serialize-tuples.js.map +1 -1
- package/out/decoder/serialize-xml.js +1 -1
- package/out/decoder/serialize-xml.js.map +1 -1
- package/out/decoder/tree-shape.d.ts +84 -0
- package/out/decoder/tree-shape.d.ts.map +1 -0
- package/out/decoder/tree-shape.js +98 -0
- package/out/decoder/tree-shape.js.map +1 -0
- package/out/decoder/types.d.ts +11 -0
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/validate-tree.d.ts +8 -0
- package/out/decoder/validate-tree.d.ts.map +1 -1
- package/out/decoder/validate-tree.js +4 -3
- package/out/decoder/validate-tree.js.map +1 -1
- package/out/env/index.d.ts +10 -1
- package/out/env/index.d.ts.map +1 -1
- package/out/env/index.js +2 -1
- package/out/env/index.js.map +1 -1
- package/out/env/paths.d.ts +15 -8
- package/out/env/paths.d.ts.map +1 -1
- package/out/env/paths.js +19 -29
- package/out/env/paths.js.map +1 -1
- package/out/env/schema.d.ts +9 -1
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +25 -3
- package/out/env/schema.js.map +1 -1
- package/out/fs/utils/formatters.d.ts +57 -0
- package/out/fs/utils/formatters.d.ts.map +1 -0
- package/out/fs/utils/formatters.js +79 -0
- package/out/fs/utils/formatters.js.map +1 -0
- package/out/fs/utils/index.d.ts +7 -0
- package/out/fs/utils/index.d.ts.map +1 -0
- package/out/fs/utils/index.js +7 -0
- package/out/fs/utils/index.js.map +1 -0
- package/out/fs/zip.js +1 -1
- package/out/fs/zip.js.map +1 -1
- package/out/layers/manifest.d.ts +32 -7
- package/out/layers/manifest.d.ts.map +1 -1
- package/out/layers/manifest.js +31 -6
- package/out/layers/manifest.js.map +1 -1
- package/out/layers/schema.d.ts +48 -2
- package/out/layers/schema.d.ts.map +1 -1
- package/out/layers/schema.js +32 -0
- package/out/layers/schema.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.js +1 -1
- package/out/locale/registry.js.map +1 -1
- package/out/objects.d.ts +12 -6
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +4 -1
- package/out/objects.js.map +1 -1
- package/out/pipeline/index.d.ts +2 -6
- package/out/pipeline/index.d.ts.map +1 -1
- package/out/pipeline/index.js +1 -3
- package/out/pipeline/index.js.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +51 -9
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +29 -132
- 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 +22 -14
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js.map +1 -1
- package/out/policy/defaults.d.ts +1 -1
- package/out/policy/defaults.d.ts.map +1 -1
- package/out/policy/defaults.js +1 -1
- package/out/policy/defaults.js.map +1 -1
- package/out/policy/policy.d.ts +1 -1
- package/out/policy/policy.d.ts.map +1 -1
- package/out/policy/registry.d.ts +1 -1
- package/out/policy/registry.d.ts.map +1 -1
- package/out/resolver/coverage-facts.d.ts +89 -0
- package/out/resolver/coverage-facts.d.ts.map +1 -0
- package/out/resolver/coverage-facts.js +22 -0
- package/out/resolver/coverage-facts.js.map +1 -0
- package/out/resolver/index.d.ts +2 -1
- package/out/resolver/index.d.ts.map +1 -1
- package/out/resolver/index.js +1 -0
- package/out/resolver/index.js.map +1 -1
- package/out/resolver/lookup-types.d.ts +178 -0
- package/out/resolver/lookup-types.d.ts.map +1 -0
- package/out/resolver/lookup-types.js +11 -0
- package/out/resolver/lookup-types.js.map +1 -0
- package/out/resolver/placetype-map.d.ts +71 -0
- package/out/resolver/placetype-map.d.ts.map +1 -0
- package/out/resolver/placetype-map.js +98 -0
- package/out/resolver/placetype-map.js.map +1 -0
- package/out/resolver/postcode-format.d.ts +38 -0
- package/out/resolver/postcode-format.d.ts.map +1 -0
- package/out/resolver/postcode-format.js +83 -0
- package/out/resolver/postcode-format.js.map +1 -0
- package/out/resolver/types.d.ts +271 -297
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +4 -97
- package/out/resolver/types.js.map +1 -1
- package/out/resources/git.d.ts +8 -1
- package/out/resources/git.d.ts.map +1 -1
- package/out/resources/git.js +4 -3
- package/out/resources/git.js.map +1 -1
- package/out/resources/languages/types.gen.d.ts +1 -1
- package/out/resources/languages/types.gen.d.ts.map +1 -1
- package/out/resources/languages/types.gen.js +40 -0
- package/out/resources/languages/types.gen.js.map +1 -1
- package/out/resources/libpostal.d.ts +2 -2
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/libpostal.js +2 -2
- package/out/resources/libpostal.js.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +2 -2
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +28 -3
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/loader.d.ts +2 -2
- package/out/resources/whosonfirst/loader.d.ts.map +1 -1
- package/out/resources/whosonfirst/loader.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +2 -2
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +9 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/definition.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/definition.js +1 -1
- package/out/resources/whosonfirst/placetypes/definition.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/index.d.ts +1 -0
- package/out/resources/whosonfirst/placetypes/index.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/index.js +1 -0
- package/out/resources/whosonfirst/placetypes/index.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/specificity.d.ts +65 -0
- package/out/resources/whosonfirst/placetypes/specificity.d.ts.map +1 -0
- package/out/resources/whosonfirst/placetypes/specificity.js +101 -0
- package/out/resources/whosonfirst/placetypes/specificity.js.map +1 -0
- package/out/resources/whosonfirst/sharded-repo.d.ts +28 -0
- package/out/resources/whosonfirst/sharded-repo.d.ts.map +1 -1
- package/out/resources/whosonfirst/sharded-repo.js +46 -2
- package/out/resources/whosonfirst/sharded-repo.js.map +1 -1
- package/out/scripting/arguments.d.ts +27 -0
- package/out/scripting/arguments.d.ts.map +1 -0
- package/out/scripting/arguments.js +32 -0
- package/out/scripting/arguments.js.map +1 -0
- package/out/scripting/command.d.ts +28 -0
- package/out/scripting/command.d.ts.map +1 -0
- package/out/scripting/command.js +47 -0
- package/out/scripting/command.js.map +1 -0
- package/out/scripting/index.js +3 -3
- package/out/scripting/index.js.map +1 -1
- package/out/scripting/utils/index.d.ts +1 -12
- package/out/scripting/utils/index.d.ts.map +1 -1
- package/out/scripting/utils/index.js +4 -21
- package/out/scripting/utils/index.js.map +1 -1
- package/out/tools/download-libpostal-resources.d.ts.map +1 -1
- package/out/tools/download-libpostal-resources.js +4 -7
- package/out/tools/download-libpostal-resources.js.map +1 -1
- package/out/tools/download-ssl-address.d.ts +3 -3
- package/out/tools/download-ssl-address.d.ts.map +1 -1
- package/out/tools/download-ssl-address.js +26 -13
- package/out/tools/download-ssl-address.js.map +1 -1
- package/out/tools/generate-language-types.d.ts +16 -1
- package/out/tools/generate-language-types.d.ts.map +1 -1
- package/out/tools/generate-language-types.js +38 -5
- package/out/tools/generate-language-types.js.map +1 -1
- package/out/tools/index.d.ts +1 -2
- package/out/tools/index.d.ts.map +1 -1
- package/out/tools/index.js +1 -2
- package/out/tools/index.js.map +1 -1
- package/out/utils/data-root.d.ts +27 -7
- package/out/utils/data-root.d.ts.map +1 -1
- package/out/utils/data-root.js +36 -13
- package/out/utils/data-root.js.map +1 -1
- package/out/utils/hash.d.ts +2 -3
- package/out/utils/hash.d.ts.map +1 -1
- package/out/utils/hash.js +3 -3
- package/out/utils/hash.js.map +1 -1
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -0
- package/out/utils/index.js.map +1 -1
- package/out/utils/jsonl.js +1 -1
- package/out/utils/jsonl.js.map +1 -1
- package/out/utils/repo.d.ts +8 -0
- package/out/utils/repo.d.ts.map +1 -1
- package/out/utils/repo.js +10 -1
- package/out/utils/repo.js.map +1 -1
- package/out/utils/sealed-db.d.ts +11 -0
- package/out/utils/sealed-db.d.ts.map +1 -1
- package/out/utils/sealed-db.js +28 -1
- package/out/utils/sealed-db.js.map +1 -1
- package/out/utils/sqlite-rows.d.ts +34 -0
- package/out/utils/sqlite-rows.d.ts.map +1 -0
- package/out/utils/sqlite-rows.js +37 -0
- package/out/utils/sqlite-rows.js.map +1 -0
- package/out/utils/stats.d.ts +1 -6
- package/out/utils/stats.d.ts.map +1 -1
- package/out/utils/stats.js +1 -6
- package/out/utils/stats.js.map +1 -1
- package/package.json +476 -7
- package/pipeline/index.ts +12 -14
- package/pipeline/runtime-pipeline.ts +29 -183
- package/pipeline/span-proposer.ts +1 -1
- package/pipeline/types.ts +26 -15
- package/policy/defaults.ts +1 -1
- package/policy/policy.ts +1 -1
- package/policy/registry.ts +1 -1
- package/resolver/coverage-facts.ts +102 -0
- package/resolver/index.ts +5 -0
- package/resolver/lookup-types.ts +174 -0
- package/resolver/placetype-map.ts +122 -0
- package/resolver/postcode-format.ts +89 -0
- package/resolver/types.ts +293 -351
- package/resources/git.ts +18 -4
- package/resources/languages/types.gen.ts +60 -0
- package/resources/libpostal.ts +4 -3
- package/resources/whosonfirst/DataSourceCache.ts +2 -1
- package/resources/whosonfirst/PlacetypeDataSource.ts +36 -11
- package/resources/whosonfirst/loader.ts +3 -2
- package/resources/whosonfirst/placetypes/Placetype.ts +3 -2
- package/resources/whosonfirst/placetypes/admin.ts +11 -2
- package/resources/whosonfirst/placetypes/definition.ts +4 -3
- package/resources/whosonfirst/placetypes/index.ts +1 -0
- package/resources/whosonfirst/placetypes/specificity.ts +114 -0
- package/resources/whosonfirst/sharded-repo.ts +55 -2
- package/scripting/arguments.ts +38 -0
- package/scripting/command.ts +55 -0
- package/scripting/index.ts +3 -3
- package/scripting/utils/index.ts +6 -23
- package/tools/download-libpostal-resources.ts +4 -7
- package/tools/download-ssl-address.ts +28 -12
- package/tools/generate-language-types.ts +39 -5
- package/tools/index.ts +1 -2
- package/utils/data-root.ts +40 -14
- package/utils/hash.ts +5 -4
- package/utils/index.ts +1 -0
- package/utils/jsonl.ts +1 -1
- package/utils/repo.ts +12 -1
- package/utils/sealed-db.ts +30 -1
- package/utils/sqlite-rows.ts +40 -0
- package/utils/stats.ts +1 -6
- package/data/libpostal/dictionaries/all/chains.txt +0 -504
- package/kysley/adapter.ts +0 -29
- package/out/kysley/adapter.d.ts +0 -13
- package/out/kysley/adapter.d.ts.map +0 -1
- package/out/kysley/adapter.js +0 -25
- package/out/kysley/adapter.js.map +0 -1
- package/out/pipeline/reconcile-lookups.d.ts +0 -39
- package/out/pipeline/reconcile-lookups.d.ts.map +0 -1
- package/out/pipeline/reconcile-lookups.js +0 -88
- package/out/pipeline/reconcile-lookups.js.map +0 -1
- package/out/pipeline/reconcile.d.ts +0 -153
- package/out/pipeline/reconcile.d.ts.map +0 -1
- package/out/pipeline/reconcile.js +0 -388
- package/out/pipeline/reconcile.js.map +0 -1
- package/out/pipeline/span-logit-aggregation.d.ts +0 -58
- package/out/pipeline/span-logit-aggregation.d.ts.map +0 -1
- package/out/pipeline/span-logit-aggregation.js +0 -117
- package/out/pipeline/span-logit-aggregation.js.map +0 -1
- package/pipeline/reconcile-lookups.ts +0 -111
- package/pipeline/reconcile.ts +0 -583
- package/pipeline/span-logit-aggregation.ts +0 -156
|
@@ -3,24 +3,41 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Regenerate `core/resources/languages/types.gen.ts` — the ISO 639-1/639-
|
|
6
|
+
* Regenerate `core/resources/languages/types.gen.ts` — the ISO 639-1 / 639-2 language-code types +
|
|
7
7
|
* label maps — from the committed `internal/languages.csv` resource dictionary.
|
|
8
8
|
*
|
|
9
|
+
* BOTH 639-2 standards are emitted, and the reason is data, not completeness. ISO 639-2 has two
|
|
10
|
+
* three-letter forms: /B (bibliographic) and /T (terminological, identical to 639-3). They differ
|
|
11
|
+
* for exactly 20 languages, and **Who's On First keys its name properties in /T** — so a /B-only
|
|
12
|
+
* union excluded `deu`, `fra` and `nld`, three tier-1 locales, while admitting spellings the data
|
|
13
|
+
* never uses. Measured over the built gazetteer's `names` table: 3,591,751 rows on the /T side of
|
|
14
|
+
* those 20 pairs against 247 on the /B side, a ratio of 14,542:1.
|
|
15
|
+
*
|
|
16
|
+
* /B is NOT dropped: `packages/codex/country/official-languages.ts` lists both forms deliberately
|
|
17
|
+
* (`DE: ["de","deu","ger"]`) and 247 real rows carry one, so the union accepts either and both map
|
|
18
|
+
* to the same label and the same alpha-2.
|
|
19
|
+
*
|
|
20
|
+
* NAME DEBT, deliberately not paid here: `Alpha3bLanguageCode`, `Alpha3bLabelMap`, `Alpha3bToAlpha2`
|
|
21
|
+
* and the CSV's `alpha3-b` header all still say "b" while holding both standards. Renaming them is a
|
|
22
|
+
* published-API break and belongs in a major.
|
|
23
|
+
*
|
|
9
24
|
* Usage: mailwoman dev generate language-types
|
|
10
25
|
*/
|
|
11
26
|
import * as fs from "node:fs/promises";
|
|
12
27
|
import { pascalCase } from "change-case";
|
|
13
28
|
import { CSVSpliterator } from "spliterator";
|
|
14
|
-
import {
|
|
29
|
+
import { resourceDictionaryPath, workspacePath } from "../utils/index.js";
|
|
15
30
|
/**
|
|
16
31
|
* Regenerate the committed language-code types from `internal/languages.csv`.
|
|
17
32
|
*/
|
|
18
33
|
export async function generateLanguageTypes(options = {}, report) {
|
|
19
|
-
const outfile = options.out ??
|
|
34
|
+
const outfile = options.out ?? workspacePath("core", "resources", "languages", "types.gen.ts");
|
|
20
35
|
const dataSourcePath = resourceDictionaryPath("internal", "languages.csv");
|
|
21
36
|
const alpha2Entries = new Map();
|
|
22
37
|
const alpha3bEntries = new Map();
|
|
23
38
|
const entryLines = [];
|
|
39
|
+
// The 20 divergent /T spellings, kept apart so they widen the accepting direction only.
|
|
40
|
+
const alpha3tPairs = [];
|
|
24
41
|
report?.(`Reading ${dataSourcePath}`);
|
|
25
42
|
// Quote handling is on and load-bearing: six labels wrap an embedded comma
|
|
26
43
|
// (`gre,el,"Greek, Modern (1453-)"`), and the spliterator leaves quoting off by default.
|
|
@@ -29,10 +46,24 @@ export async function generateLanguageTypes(options = {}, report) {
|
|
|
29
46
|
const alpha3b = columns[0];
|
|
30
47
|
const alpha2 = columns[1];
|
|
31
48
|
const labelsConcatenated = columns[2];
|
|
49
|
+
// Empty for the 163 languages whose two 639-2 forms agree; a distinct code for the 20 that diverge.
|
|
50
|
+
const alpha3t = columns[3] ?? "";
|
|
32
51
|
const labels = labelsConcatenated.split("; ");
|
|
33
52
|
alpha2Entries.set(alpha2, labels);
|
|
34
53
|
alpha3bEntries.set(alpha3b, labels);
|
|
35
54
|
entryLines.push([alpha2, alpha3b]);
|
|
55
|
+
// The /T spelling is a first-class member of the same union and maps to the same label and the
|
|
56
|
+
// same alpha-2. It is the form WOF actually writes, so a lookup keyed on it must hit.
|
|
57
|
+
//
|
|
58
|
+
// It goes to `alpha3tPairs`, NOT to `entryLines`. Both lists build BOTH direction maps from a
|
|
59
|
+
// `new Map([...])`, where the LAST entry for a key wins — so appending the /T form to
|
|
60
|
+
// `entryLines` would silently flip `Alpha2ToAlpha3b.get("de")` from `ger` to `deu`. That map is
|
|
61
|
+
// named for the /B standard and documented as returning it; changing what it answers is a
|
|
62
|
+
// separate decision from widening what the union ACCEPTS, and it is not this one.
|
|
63
|
+
if (alpha3t) {
|
|
64
|
+
alpha3bEntries.set(alpha3t, labels);
|
|
65
|
+
alpha3tPairs.push([alpha2, alpha3t]);
|
|
66
|
+
}
|
|
36
67
|
}
|
|
37
68
|
const handle = await fs.open(outfile, "w");
|
|
38
69
|
const writeLine = (line) => handle.writeFile(`${line}\n`);
|
|
@@ -121,8 +152,10 @@ export const Alpha2ToAlpha3b: ReadonlyMap<Alpha2LanguageCode, Alpha3bLanguageCod
|
|
|
121
152
|
*/
|
|
122
153
|
export const Alpha3bToAlpha2: ReadonlyMap<Alpha3bLanguageCode, Alpha2LanguageCode> = new Map([
|
|
123
154
|
`);
|
|
124
|
-
|
|
125
|
-
|
|
155
|
+
// This direction ACCEPTS a code, so it takes both spellings — the keys are distinct, nothing is
|
|
156
|
+
// overwritten, and `deu` answers `de` exactly as `ger` does.
|
|
157
|
+
for (const [alpha2, alpha3] of [...entryLines, ...alpha3tPairs]) {
|
|
158
|
+
await writeLine(`["${alpha3}", "${alpha2}"],`);
|
|
126
159
|
}
|
|
127
160
|
await writeLine(`])`);
|
|
128
161
|
// Cleanup.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-language-types.js","sourceRoot":"","sources":["../../tools/generate-language-types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate-language-types.js","sourceRoot":"","sources":["../../tools/generate-language-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAoBzE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAC1C,UAAwC,EAAE,EAC1C,MAA+B;IAE/B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,IAAI,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;IAC9F,MAAM,cAAc,GAAG,sBAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAA;IAE1E,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB,CAAA;IACjD,MAAM,cAAc,GAAG,IAAI,GAAG,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CAAA;IAED,KAAK,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC;QAChD,MAAM,SAAS,CAAC,KAAK,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC9D,CAAC;IAED,MAAM,SAAS,CAAC,IAAI,CAAC,CAAA;IAErB,aAAa;IAEb,MAAM,SAAS,CAAC;;;;;CAKhB,CAAC,CAAA;IAED,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,UAAU,EAAE,CAAC;QAC5C,MAAM,SAAS,CAAC,KAAK,MAAM,OAAO,OAAO,KAAK,CAAC,CAAA;IAChD,CAAC;IAED,MAAM,SAAS,CAAC,IAAI,CAAC,CAAA;IAErB,MAAM,SAAS,CAAC;;;;;CAKhB,CAAC,CAAA;IAED,gGAAgG;IAChG,6DAA6D;IAC7D,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC;QACjE,MAAM,SAAS,CAAC,KAAK,MAAM,OAAO,MAAM,KAAK,CAAC,CAAA;IAC/C,CAAC;IAED,MAAM,SAAS,CAAC,IAAI,CAAC,CAAA;IAErB,WAAW;IAEX,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IAEpB,MAAM,EAAE,CAAC,SAAS,OAAO,EAAE,CAAC,CAAA;IAE5B,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAC1D,CAAC"}
|
package/out/tools/index.d.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Core operator tools — the `run()`-style modules behind `mailwoman dev generate …` commands. No
|
|
7
|
-
* argv, no `process.exit`: commands own parsing, rendering, and exit codes
|
|
8
|
-
* scripts→Pastel spec).
|
|
7
|
+
* argv, no `process.exit`: commands own parsing, rendering, and exit codes.
|
|
9
8
|
*/
|
|
10
9
|
export * from "./download-libpostal-resources.ts";
|
|
11
10
|
export * from "./download-ssl-address.ts";
|
package/out/tools/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA"}
|
package/out/tools/index.js
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Core operator tools — the `run()`-style modules behind `mailwoman dev generate …` commands. No
|
|
7
|
-
* argv, no `process.exit`: commands own parsing, rendering, and exit codes
|
|
8
|
-
* scripts→Pastel spec).
|
|
7
|
+
* argv, no `process.exit`: commands own parsing, rendering, and exit codes.
|
|
9
8
|
*/
|
|
10
9
|
export * from "./download-libpostal-resources.js";
|
|
11
10
|
export * from "./download-ssl-address.js";
|
package/out/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA"}
|
package/out/utils/data-root.d.ts
CHANGED
|
@@ -3,15 +3,10 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* manifest the runtime + build tooling read. Centralized here (mirroring isp-nexus's
|
|
8
|
-
* `dataSourcePathBuilder`) so the lab `/mnt/playpen/...` default lives in EXACTLY ONE place instead
|
|
9
|
-
* of as a literal scattered across the codebase, and so consumers compose paths through
|
|
10
|
-
* {@link dataRootPath} rather than re-deriving the string. Going public, this is the only file that
|
|
11
|
-
* names the operator's filesystem layout; everything else reads `$MAILWOMAN_DATA_ROOT`.
|
|
6
|
+
* Path builders for Mailwoman's platform-native application directories.
|
|
12
7
|
*/
|
|
13
8
|
/**
|
|
14
|
-
* The Mailwoman data root
|
|
9
|
+
* The Mailwoman data root from the typed public environment.
|
|
15
10
|
*/
|
|
16
11
|
export declare function mailwomanDataRoot(): string;
|
|
17
12
|
/**
|
|
@@ -19,6 +14,31 @@ export declare function mailwomanDataRoot(): string;
|
|
|
19
14
|
* each call, so a late environment change (or a test stub) is honored.
|
|
20
15
|
*/
|
|
21
16
|
export declare function dataRootPath(...segments: string[]): string;
|
|
17
|
+
/**
|
|
18
|
+
* The dev-weights overlay for a locale: `$MAILWOMAN_DATA_ROOT/weights/<locale>/`.
|
|
19
|
+
*
|
|
20
|
+
* ONE definition of the convention, because it is written by ten `link-dev-weights.ts` scripts and read by
|
|
21
|
+
* `@mailwoman/neural`'s `resolveWeights`, and a reader that disagreed with the writers about the directory would report
|
|
22
|
+
* the artifacts absent rather than misplaced — every sibling degrades `existsSync → undefined`.
|
|
23
|
+
*
|
|
24
|
+
* It lives OUTSIDE git deliberately. The binaries are not committed, so materializing them into the tracked package
|
|
25
|
+
* directory is what made a fresh worktree unable to geocode, made `yarn test` mutate tracked directories as a side
|
|
26
|
+
* effect, and put a symlink in a publish tarball (`YN0035`). The data root is shared across every checkout on the
|
|
27
|
+
* machine and is not packed by anything.
|
|
28
|
+
*/
|
|
29
|
+
export declare function weightsOverlayPath(locale: string, ...segments: string[]): string;
|
|
30
|
+
/**
|
|
31
|
+
* The Mailwoman temporary-file root from the typed public environment.
|
|
32
|
+
*/
|
|
33
|
+
export declare function mailwomanTempRoot(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Build an absolute path under Mailwoman's temporary-file root.
|
|
36
|
+
*/
|
|
37
|
+
export declare function tempRootPath(...segments: string[]): string;
|
|
38
|
+
/**
|
|
39
|
+
* Build an absolute path under Mailwoman's application cache directory.
|
|
40
|
+
*/
|
|
41
|
+
export declare function cacheRootPath(...segments: string[]): string;
|
|
22
42
|
/**
|
|
23
43
|
* The default WOF shard list the FTS backend probes when no single `--wof-db` is given: the global admin-priority shard
|
|
24
44
|
* plus the postcode shards, with country-aware routing in `pickShardForPlacetype` sending each postcode query to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-root.d.ts","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"data-root.d.ts","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAEhF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE3D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,GAAE,MAA4B,GACpC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAgBlD"}
|
package/out/utils/data-root.js
CHANGED
|
@@ -3,25 +3,15 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* manifest the runtime + build tooling read. Centralized here (mirroring isp-nexus's
|
|
8
|
-
* `dataSourcePathBuilder`) so the lab `/mnt/playpen/...` default lives in EXACTLY ONE place instead
|
|
9
|
-
* of as a literal scattered across the codebase, and so consumers compose paths through
|
|
10
|
-
* {@link dataRootPath} rather than re-deriving the string. Going public, this is the only file that
|
|
11
|
-
* names the operator's filesystem layout; everything else reads `$MAILWOMAN_DATA_ROOT`.
|
|
6
|
+
* Path builders for Mailwoman's platform-native application directories.
|
|
12
7
|
*/
|
|
13
8
|
import { resolvePath } from "path-ts";
|
|
14
9
|
import { $public } from "../env/index.js";
|
|
15
10
|
/**
|
|
16
|
-
* The
|
|
17
|
-
* {@link mailwomanDataRoot}; override per-deployment with `$MAILWOMAN_DATA_ROOT`.
|
|
18
|
-
*/
|
|
19
|
-
const DEFAULT_MAILWOMAN_DATA_ROOT = "/mnt/playpen/mailwoman-data";
|
|
20
|
-
/**
|
|
21
|
-
* The Mailwoman data root: `$MAILWOMAN_DATA_ROOT` when set, else the lab default.
|
|
11
|
+
* The Mailwoman data root from the typed public environment.
|
|
22
12
|
*/
|
|
23
13
|
export function mailwomanDataRoot() {
|
|
24
|
-
return $public.MAILWOMAN_DATA_ROOT
|
|
14
|
+
return $public.MAILWOMAN_DATA_ROOT;
|
|
25
15
|
}
|
|
26
16
|
/**
|
|
27
17
|
* Build an absolute path under the data root, e.g. `dataRootPath("wof", "admin-global-priority.db")`. Reads the env on
|
|
@@ -30,6 +20,39 @@ export function mailwomanDataRoot() {
|
|
|
30
20
|
export function dataRootPath(...segments) {
|
|
31
21
|
return resolvePath(mailwomanDataRoot(), ...segments);
|
|
32
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The dev-weights overlay for a locale: `$MAILWOMAN_DATA_ROOT/weights/<locale>/`.
|
|
25
|
+
*
|
|
26
|
+
* ONE definition of the convention, because it is written by ten `link-dev-weights.ts` scripts and read by
|
|
27
|
+
* `@mailwoman/neural`'s `resolveWeights`, and a reader that disagreed with the writers about the directory would report
|
|
28
|
+
* the artifacts absent rather than misplaced — every sibling degrades `existsSync → undefined`.
|
|
29
|
+
*
|
|
30
|
+
* It lives OUTSIDE git deliberately. The binaries are not committed, so materializing them into the tracked package
|
|
31
|
+
* directory is what made a fresh worktree unable to geocode, made `yarn test` mutate tracked directories as a side
|
|
32
|
+
* effect, and put a symlink in a publish tarball (`YN0035`). The data root is shared across every checkout on the
|
|
33
|
+
* machine and is not packed by anything.
|
|
34
|
+
*/
|
|
35
|
+
export function weightsOverlayPath(locale, ...segments) {
|
|
36
|
+
return dataRootPath("weights", locale.toLowerCase(), ...segments);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The Mailwoman temporary-file root from the typed public environment.
|
|
40
|
+
*/
|
|
41
|
+
export function mailwomanTempRoot() {
|
|
42
|
+
return $public.MAILWOMAN_TEMP_ROOT;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build an absolute path under Mailwoman's temporary-file root.
|
|
46
|
+
*/
|
|
47
|
+
export function tempRootPath(...segments) {
|
|
48
|
+
return resolvePath(mailwomanTempRoot(), ...segments);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build an absolute path under Mailwoman's application cache directory.
|
|
52
|
+
*/
|
|
53
|
+
export function cacheRootPath(...segments) {
|
|
54
|
+
return resolvePath($public.MAILWOMAN_CACHE_ROOT, ...segments);
|
|
55
|
+
}
|
|
33
56
|
/**
|
|
34
57
|
* The default WOF shard list the FTS backend probes when no single `--wof-db` is given: the global admin-priority shard
|
|
35
58
|
* plus the postcode shards, with country-aware routing in `pickShardForPlacetype` sending each postcode query to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-root.js","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"data-root.js","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAChC,OAAO,OAAO,CAAC,mBAAmB,CAAA;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAG,QAAkB;IACjD,OAAO,WAAW,CAAC,iBAAiB,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAA;AACrD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,GAAG,QAAkB;IACvE,OAAO,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAA;AAClE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAChC,OAAO,OAAO,CAAC,mBAAmB,CAAA;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,GAAG,QAAkB;IACjD,OAAO,WAAW,CAAC,iBAAiB,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAA;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAG,QAAkB;IAClD,OAAO,WAAW,CAAC,OAAO,CAAC,oBAAoB,EAAE,GAAG,QAAQ,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,aAAa,CAC5B,WAAmB,iBAAiB,EAAE;IAEtC,gCAAgC;IAChC,OAAO;QACN,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,0BAA0B,CAAC;QACxD,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC;QAChD,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,6BAA6B,CAAC;QAC3D,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,CAAC;QAClD,gGAAgG;QAChG,iGAAiG;QACjG,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,CAAC;QACpD,iGAAiG;QACjG,mGAAmG;QACnG,+FAA+F;QAC/F,2EAA2E;QAC3E,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,CAAC;KACpD,CAAA;AACF,CAAC"}
|
package/out/utils/hash.d.ts
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* File
|
|
7
|
-
* dedupe survey found across the corpus fetch scripts.
|
|
6
|
+
* File and content hashing utilities.
|
|
8
7
|
*/
|
|
9
8
|
/**
|
|
10
9
|
* Streaming SHA-256 of a file, hex-encoded.
|
|
@@ -13,7 +12,7 @@ export declare function sha256File(path: string): Promise<string>;
|
|
|
13
12
|
/**
|
|
14
13
|
* SHA-256 of in-memory content, hex-encoded.
|
|
15
14
|
*/
|
|
16
|
-
export declare function sha256Hex(data: string | NodeJS.ArrayBufferView): string;
|
|
15
|
+
export declare function sha256Hex(data: string | NodeJS.ArrayBufferView | string[]): string;
|
|
17
16
|
/**
|
|
18
17
|
* Streaming MD5 of a file, hex-encoded. MD5 (not SHA-256) is used for build-provenance fingerprints that follow an
|
|
19
18
|
* existing convention — the HM Land Registry PPD snapshot ships an `.md5` sibling, and
|
package/out/utils/hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../utils/hash.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../utils/hash.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ9D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,EAAE,GAAG,MAAM,CAIlF;AAED;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ3D;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAEpE"}
|
package/out/utils/hash.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* File
|
|
7
|
-
* dedupe survey found across the corpus fetch scripts.
|
|
6
|
+
* File and content hashing utilities.
|
|
8
7
|
*/
|
|
9
8
|
import { createHash } from "node:crypto";
|
|
10
9
|
import { createReadStream } from "node:fs";
|
|
@@ -22,7 +21,8 @@ export async function sha256File(path) {
|
|
|
22
21
|
* SHA-256 of in-memory content, hex-encoded.
|
|
23
22
|
*/
|
|
24
23
|
export function sha256Hex(data) {
|
|
25
|
-
|
|
24
|
+
const formattedData = Array.isArray(data) ? data.join("\n") : data;
|
|
25
|
+
return createHash("sha256").update(formattedData).digest("hex");
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Streaming MD5 of a file, hex-encoded. MD5 (not SHA-256) is used for build-provenance fingerprints that follow an
|
package/out/utils/hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../utils/hash.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../utils/hash.ts"],"names":[],"mappings":"A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AACpD,CAAC"}
|
package/out/utils/index.d.ts
CHANGED
package/out/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
|
package/out/utils/index.js
CHANGED
package/out/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
|
package/out/utils/jsonl.js
CHANGED
|
@@ -25,7 +25,7 @@ export function readJSONL(path) {
|
|
|
25
25
|
// function is deprecated FOR; rewriting either would change what remaining callers get.
|
|
26
26
|
return ([...TextSpliterator.from(readFileSync(path, "utf8"))]
|
|
27
27
|
.filter((line) => line.trim().length > 0)
|
|
28
|
-
// oxlint-disable-next-line no-restricted-properties
|
|
28
|
+
// oxlint-disable-next-line no-restricted-properties -- deprecated helper's throw-on-corrupt contract is preserved
|
|
29
29
|
.map((line) => JSON.parse(line)));
|
|
30
30
|
}
|
|
31
31
|
/**
|
package/out/utils/jsonl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl.js","sourceRoot":"","sources":["../../utils/jsonl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAI,IAAY;IACxC,kGAAkG;IAClG,wFAAwF;IACxF,OAAO,CACN,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;SACnD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;QACzC,
|
|
1
|
+
{"version":3,"file":"jsonl.js","sourceRoot":"","sources":["../../utils/js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IAAI,CAAM,CAAA;IAC5B,CAAC;AACF,CAAC"}
|
package/out/utils/repo.d.ts
CHANGED
|
@@ -25,6 +25,14 @@ export declare const repoRootPathBuilder: import("path-ts").PathBuilderResolver<
|
|
|
25
25
|
* for handing paths straight to `node:fs` and other string APIs without a `.toString()`.
|
|
26
26
|
*/
|
|
27
27
|
export declare const repoRootPath: import("path-ts").PathResolver<"mailwoman">;
|
|
28
|
+
/**
|
|
29
|
+
* Path builder relative to the directory containing the public workspaces.
|
|
30
|
+
*/
|
|
31
|
+
export declare const workspacePathBuilder: import("path-ts").PathBuilderResolver<"mailwoman">;
|
|
32
|
+
/**
|
|
33
|
+
* Absolute-path-string resolver relative to the directory containing the public workspaces.
|
|
34
|
+
*/
|
|
35
|
+
export declare const workspacePath: import("path-ts").PathResolver<"mailwoman">;
|
|
28
36
|
/**
|
|
29
37
|
* Path builder rooted at `@mailwoman/core`, so data under `core/data/` resolves the same in source and compiled trees.
|
|
30
38
|
* See the `__isCompiledTree` note in this file before reaching across that boundary.
|
package/out/utils/repo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../utils/repo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAiD,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AAEpG;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AAErC,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAA;AAEtD,QAAA,MAAM,aAAa,EAAG,WAAoB,CAAA;AAE1C,KAAK,aAAa,GAAG,OAAO,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../utils/repo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAiD,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AAEp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uilderResolver, createPathResolver } from "path-ts";
|
|
|
16
16
|
*/
|
|
17
17
|
export const OutDirectoryName = "out";
|
|
18
18
|
const RepoRootAlias = "mailwoman";
|
|
19
|
-
const PathReflection = ["core", "out", "utils"];
|
|
19
|
+
const PathReflection = ["packages", "core", "out", "utils"];
|
|
20
20
|
/**
|
|
21
21
|
* The directory path of the current file, post-compilation.
|
|
22
22
|
*/
|
|
@@ -54,6 +54,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
54
54
|
const __isCompiledTree = basename(resolve(__dirname, "..")) === OutDirectoryName;
|
|
55
55
|
const __upCount = __isCompiledTree ? PathReflection.length : PathReflection.length - 1;
|
|
56
56
|
const RepoRootAbsolutePath = resolve(__dirname, ...Array.from({ length: __upCount }, () => ".."));
|
|
57
|
+
const PackagesAbsolutePath = resolve(RepoRootAbsolutePath, "packages");
|
|
57
58
|
/**
|
|
58
59
|
* Path builder relative to the repo root.
|
|
59
60
|
*/
|
|
@@ -63,6 +64,14 @@ export const repoRootPathBuilder = createPathBuilderResolver(RepoRootAbsolutePat
|
|
|
63
64
|
* for handing paths straight to `node:fs` and other string APIs without a `.toString()`.
|
|
64
65
|
*/
|
|
65
66
|
export const repoRootPath = createPathResolver(RepoRootAbsolutePath);
|
|
67
|
+
/**
|
|
68
|
+
* Path builder relative to the directory containing the public workspaces.
|
|
69
|
+
*/
|
|
70
|
+
export const workspacePathBuilder = createPathBuilderResolver(PackagesAbsolutePath);
|
|
71
|
+
/**
|
|
72
|
+
* Absolute-path-string resolver relative to the directory containing the public workspaces.
|
|
73
|
+
*/
|
|
74
|
+
export const workspacePath = createPathResolver(PackagesAbsolutePath);
|
|
66
75
|
/**
|
|
67
76
|
* Path builder relative to the `@mailwoman/core` workspace root (the directory containing `package.json` for this
|
|
68
77
|
* package).
|
package/out/utils/repo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.js","sourceRoot":"","sources":["../../utils/repo.ts"],"names":[],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AY,CAAC,CAAA;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAgD,QAAW,EAAE,GAAG,YAAe;IACpH,OAAO,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,YAAY,CAAC,CAAA;AAC1E,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAA"}
|
package/out/utils/sealed-db.d.ts
CHANGED
|
@@ -14,6 +14,17 @@ export declare function isSealed(path: string): boolean;
|
|
|
14
14
|
* Idempotent. Throws if the checkpoint cannot complete (another writer holds the DB).
|
|
15
15
|
*/
|
|
16
16
|
export declare function sealDatabase(path: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Verify a freshly-built database is not corrupt, immediately before it is sealed and published.
|
|
19
|
+
*
|
|
20
|
+
* Belongs beside {@link sealDatabase} for the same reason `swapDatabaseIntoPlace` does: the check is part of the
|
|
21
|
+
* built-artifact lifecycle, and every builder was running it from its own copy. `integrity_check` answers with the
|
|
22
|
+
* single row `{ integrity_check: "ok" }` on a healthy file and one row per problem otherwise, so only the first matters
|
|
23
|
+
* — a builder that reads the column and compares it to `"ok"` has done the whole check.
|
|
24
|
+
*
|
|
25
|
+
* @throws When the database reports anything other than `ok`, naming the artifact and what SQLite said.
|
|
26
|
+
*/
|
|
27
|
+
export declare function assertDatabaseIntegrity(db: DatabaseSync, artifact: string): void;
|
|
17
28
|
/**
|
|
18
29
|
* Open a data artifact. Read-only by default. `write: true` is for builders working on UNsealed staging — against a
|
|
19
30
|
* sealed artifact it throws {@link SealedArtifactError}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sealed-db.d.ts","sourceRoot":"","sources":["../../utils/sealed-db.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAY/C;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBACjC,IAAI,EAAE,MAAM;CAQxB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CA4B/C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,YAAY,CAQ5F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"sealed-db.d.ts","sourceRoot":"","sources":["../../utils/sealed-db.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAY/C;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBACjC,IAAI,EAAE,MAAM;CAQxB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CA4B/C;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOhF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,YAAY,CAQ5F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CA4B9E"}
|
package/out/utils/sealed-db.js
CHANGED
|
@@ -69,6 +69,23 @@ export function sealDatabase(path) {
|
|
|
69
69
|
}
|
|
70
70
|
chmodSync(path, 0o444);
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Verify a freshly-built database is not corrupt, immediately before it is sealed and published.
|
|
74
|
+
*
|
|
75
|
+
* Belongs beside {@link sealDatabase} for the same reason `swapDatabaseIntoPlace` does: the check is part of the
|
|
76
|
+
* built-artifact lifecycle, and every builder was running it from its own copy. `integrity_check` answers with the
|
|
77
|
+
* single row `{ integrity_check: "ok" }` on a healthy file and one row per problem otherwise, so only the first matters
|
|
78
|
+
* — a builder that reads the column and compares it to `"ok"` has done the whole check.
|
|
79
|
+
*
|
|
80
|
+
* @throws When the database reports anything other than `ok`, naming the artifact and what SQLite said.
|
|
81
|
+
*/
|
|
82
|
+
export function assertDatabaseIntegrity(db, artifact) {
|
|
83
|
+
const row = db.prepare("PRAGMA integrity_check").get();
|
|
84
|
+
const verdict = row?.integrity_check;
|
|
85
|
+
if (verdict !== "ok") {
|
|
86
|
+
throw new Error(`integrity_check failed on ${basename(artifact)}: ${verdict ?? "no result"}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
72
89
|
/**
|
|
73
90
|
* Open a data artifact. Read-only by default. `write: true` is for builders working on UNsealed staging — against a
|
|
74
91
|
* sealed artifact it throws {@link SealedArtifactError}.
|
|
@@ -100,7 +117,17 @@ export function swapDatabaseIntoPlace(tmpPath, finalPath) {
|
|
|
100
117
|
for (const sfx of ["-wal", "-shm"]) {
|
|
101
118
|
rmSync(finalPath + sfx, { force: true });
|
|
102
119
|
}
|
|
103
|
-
|
|
120
|
+
try {
|
|
121
|
+
renameSync(tmpPath, finalPath);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
// The prior version is already aside at this point — a failed forward rename must not leave
|
|
125
|
+
// the slot empty while a restorable artifact sits one rename away.
|
|
126
|
+
if (existsSync(aside) && !existsSync(finalPath)) {
|
|
127
|
+
renameSync(aside, finalPath);
|
|
128
|
+
}
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
104
131
|
for (const sfx of ["-wal", "-shm"]) {
|
|
105
132
|
rmSync(tmpPath + sfx, { force: true });
|
|
106
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sealed-db.js","sourceRoot":"","sources":["../../utils/sealed-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGpC;;;;;GAKG;AACH,SAAS,MAAM;IACd,OAAO,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAA;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC7C,YAAY,IAAY;QACvB,KAAK,CACJ,GAAG,QAAQ,CAAC,IAAI,CAAC,oFAAoF;YACpG,yEAAyE,CAC1E,CAAA;QAED,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IAClC,CAAC;CACD;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACpC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,qFAAqF;IACrF,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACvB,CAAC;IAED,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC,GAAG,EA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C,CAAA;QAC7B,CAAC;QAED,MAAM,KAAK,CAAA;IACZ,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QACpC,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACvC,CAAC;IAED,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;AAC/B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The `node:sqlite` → typed-row seam, in ONE place.
|
|
7
|
+
*
|
|
8
|
+
* `node:sqlite` types every result as `Record<string, SQLOutputValue>` because it cannot infer a row shape from SQL
|
|
9
|
+
* text, so every raw read needs an assertion somewhere. That assertion belongs at this boundary rather than repeated
|
|
10
|
+
* at each query site: a cast written inline is invisible to review and indistinguishable from a cast that is
|
|
11
|
+
* defeating a real check, which is how a branded key column came to be written with an unfolded value (#1757).
|
|
12
|
+
*
|
|
13
|
+
* It lives in `core` rather than beside the resolver's readers because `@mailwoman/resolver-wof-sqlite` is an
|
|
14
|
+
* OPTIONAL peer of `mailwoman` — a static import of it from there would break the contract that lets a consumer
|
|
15
|
+
* install the CLI without the gazetteer backend. `core` is the one package every reader already depends on, and
|
|
16
|
+
* `core/kysley/driver.ts` already makes the identical assertion for the Kysely path.
|
|
17
|
+
*
|
|
18
|
+
* The type-only import keeps `node:sqlite` out of the emitted graph, so this module stays safe to reach from the
|
|
19
|
+
* browser tier and the docs bundler (see `sealed-db.ts` for the value-side counterpart).
|
|
20
|
+
*/
|
|
21
|
+
import type { SQLInputValue, StatementSync } from "node:sqlite";
|
|
22
|
+
/**
|
|
23
|
+
* Execute a prepared statement whose selected columns are described by `Row`.
|
|
24
|
+
*
|
|
25
|
+
* Callers own the correspondence: `Row` must match the statement's PROJECTION, not the table. A column added to the
|
|
26
|
+
* table without being selected does not belong in `Row`, and a `Row` field the `SELECT` omits reads back `undefined` at
|
|
27
|
+
* runtime while the type promises otherwise.
|
|
28
|
+
*/
|
|
29
|
+
export declare function allRows<Row>(statement: StatementSync, ...parameters: SQLInputValue[]): Row[];
|
|
30
|
+
/**
|
|
31
|
+
* Single-row counterpart to {@link allRows}. `undefined` when the statement matched nothing.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getRow<Row>(statement: StatementSync, ...parameters: SQLInputValue[]): Row | undefined;
|
|
34
|
+
//# sourceMappingURL=sqlite-rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-rows.d.ts","sourceRoot":"","sources":["../../utils/sqlite-rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE/D;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,aAAa,EAAE,GAAG,GAAG,EAAE,CAE5F;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,aAAa,EAAE,GAAG,GAAG,GAAG,SAAS,CAErG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The `node:sqlite` → typed-row seam, in ONE place.
|
|
7
|
+
*
|
|
8
|
+
* `node:sqlite` types every result as `Record<string, SQLOutputValue>` because it cannot infer a row shape from SQL
|
|
9
|
+
* text, so every raw read needs an assertion somewhere. That assertion belongs at this boundary rather than repeated
|
|
10
|
+
* at each query site: a cast written inline is invisible to review and indistinguishable from a cast that is
|
|
11
|
+
* defeating a real check, which is how a branded key column came to be written with an unfolded value (#1757).
|
|
12
|
+
*
|
|
13
|
+
* It lives in `core` rather than beside the resolver's readers because `@mailwoman/resolver-wof-sqlite` is an
|
|
14
|
+
* OPTIONAL peer of `mailwoman` — a static import of it from there would break the contract that lets a consumer
|
|
15
|
+
* install the CLI without the gazetteer backend. `core` is the one package every reader already depends on, and
|
|
16
|
+
* `core/kysley/driver.ts` already makes the identical assertion for the Kysely path.
|
|
17
|
+
*
|
|
18
|
+
* The type-only import keeps `node:sqlite` out of the emitted graph, so this module stays safe to reach from the
|
|
19
|
+
* browser tier and the docs bundler (see `sealed-db.ts` for the value-side counterpart).
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Execute a prepared statement whose selected columns are described by `Row`.
|
|
23
|
+
*
|
|
24
|
+
* Callers own the correspondence: `Row` must match the statement's PROJECTION, not the table. A column added to the
|
|
25
|
+
* table without being selected does not belong in `Row`, and a `Row` field the `SELECT` omits reads back `undefined` at
|
|
26
|
+
* runtime while the type promises otherwise.
|
|
27
|
+
*/
|
|
28
|
+
export function allRows(statement, ...parameters) {
|
|
29
|
+
return statement.all(...parameters);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Single-row counterpart to {@link allRows}. `undefined` when the statement matched nothing.
|
|
33
|
+
*/
|
|
34
|
+
export function getRow(statement, ...parameters) {
|
|
35
|
+
return statement.get(...parameters);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=sqlite-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-rows.js","sourceRoot":"","sources":["../../utils/sqlite-rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAM,SAAwB,EAAE,GAAG,UAA2B;IACpF,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAU,CAAA;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CAAM,SAAwB,EAAE,GAAG,UAA2B;IACnF,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAoB,CAAA;AACvD,CAAC"}
|