@mailwoman/core 11.2.0 → 11.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (463) hide show
  1. package/README.md +2 -2
  2. package/lib/api/ckan.ts +1 -1
  3. package/lib/api/disk-storage.ts +2 -2
  4. package/lib/api/ogc.ts +1 -1
  5. package/lib/api/retry.ts +7 -2
  6. package/lib/api/test/transport.ts +1 -1
  7. package/lib/{binary-frame.ts → asset/binary-frame.ts} +1 -1
  8. package/lib/async/abort.ts +100 -0
  9. package/lib/{memoize.ts → async/memoize.ts} +2 -2
  10. package/lib/{promises.ts → async/promises.ts} +1 -1
  11. package/lib/cloudflare/tokens.ts +1 -1
  12. package/lib/cloudflare/wrangler.ts +3 -3
  13. package/lib/crypto/digest.ts +1 -1
  14. package/lib/crypto/ed25519.ts +8 -0
  15. package/lib/{hash.ts → crypto/hash.ts} +16 -1
  16. package/lib/crypto/node.ts +1 -1
  17. package/lib/data-root.ts +16 -3
  18. package/lib/decoder/containment.ts +4 -1
  19. package/lib/decoder/serialize/outline.ts +19 -6
  20. package/lib/decoder/types.ts +9 -1
  21. package/lib/env/schema.ts +5 -0
  22. package/lib/fs/deflate64.ts +1 -1
  23. package/lib/fs/lock.ts +183 -25
  24. package/lib/fs/readers.ts +1 -1
  25. package/lib/fs/writers.ts +18 -1
  26. package/lib/geocode/result.ts +50 -6
  27. package/lib/html/text.ts +2 -2
  28. package/lib/index.ts +0 -1
  29. package/lib/layers/artifact.ts +2 -2
  30. package/lib/layers/coverage.ts +1 -1
  31. package/lib/layers/manifest.ts +94 -2
  32. package/lib/layers/provenance.ts +246 -0
  33. package/lib/layers/publication.ts +4 -3
  34. package/lib/layers/selection.ts +2 -2
  35. package/lib/license/branch.ts +66 -0
  36. package/lib/license/configured.ts +4 -2
  37. package/lib/license/declaration.ts +1 -1
  38. package/lib/license/key/file.ts +1 -1
  39. package/lib/license/key.ts +148 -201
  40. package/lib/license/provenance.ts +193 -0
  41. package/lib/license/register.ts +7 -78
  42. package/lib/license/stamp.ts +8 -2
  43. package/lib/license/text-url.ts +55 -0
  44. package/lib/license/training.ts +67 -0
  45. package/lib/license.ts +7 -6
  46. package/lib/locale/registry.ts +1 -1
  47. package/lib/locale/zh-cn-units.ts +1 -1
  48. package/lib/module/workspace.ts +1 -1
  49. package/lib/{routing.ts → network/routing.ts} +1 -1
  50. package/lib/pipeline/result.ts +6 -25
  51. package/lib/pipeline/runtime-pipeline.ts +129 -144
  52. package/lib/pipeline/stage.ts +290 -0
  53. package/lib/pipeline/types.ts +33 -14
  54. package/lib/pipeline.ts +14 -2
  55. package/lib/{git.ts → repo/git.ts} +21 -1
  56. package/lib/{release-config.ts → repo/release-config.ts} +8 -0
  57. package/lib/{spdx-header.ts → repo/spdx-header.ts} +8 -0
  58. package/lib/{workspaces.ts → repo/workspaces.ts} +1 -1
  59. package/lib/resolver/lookup-types.ts +1 -1
  60. package/lib/resolver/region-database-provider.ts +33 -0
  61. package/lib/resolver/synthetic-id-ranges.ts +19 -9
  62. package/lib/resolver/types.ts +220 -7
  63. package/lib/resolver.ts +14 -1
  64. package/lib/state-machine.ts +1 -1
  65. package/lib/strings/python-json.ts +3 -2
  66. package/lib/utils/chunk-process.ts +2 -2
  67. package/lib/utils/geodatabase-archive.ts +1 -1
  68. package/lib/utils/time.ts +136 -12
  69. package/lib/utils.ts +4 -4
  70. package/out/api/ckan.js +1 -1
  71. package/out/api/ckan.js.map +1 -1
  72. package/out/api/disk-storage.d.ts.map +1 -1
  73. package/out/api/disk-storage.js +2 -2
  74. package/out/api/disk-storage.js.map +1 -1
  75. package/out/api/ogc.js +1 -1
  76. package/out/api/ogc.js.map +1 -1
  77. package/out/api/retry.d.ts.map +1 -1
  78. package/out/api/retry.js +6 -2
  79. package/out/api/retry.js.map +1 -1
  80. package/out/api/test/transport.js +1 -1
  81. package/out/api/test/transport.js.map +1 -1
  82. package/out/asset/binary-frame.d.ts.map +1 -0
  83. package/out/{binary-frame.js → asset/binary-frame.js} +1 -1
  84. package/out/asset/binary-frame.js.map +1 -0
  85. package/out/asset/load-ledger.d.ts.map +1 -0
  86. package/out/asset/load-ledger.js.map +1 -0
  87. package/out/asset/overture-pins.d.ts.map +1 -0
  88. package/out/asset/overture-pins.js.map +1 -0
  89. package/out/asset/postcode-prefix-files.d.ts.map +1 -0
  90. package/out/asset/postcode-prefix-files.js.map +1 -0
  91. package/out/async/abort.d.ts +57 -0
  92. package/out/async/abort.d.ts.map +1 -0
  93. package/out/async/abort.js +89 -0
  94. package/out/async/abort.js.map +1 -0
  95. package/out/async/memoize.d.ts.map +1 -0
  96. package/out/{memoize.js → async/memoize.js} +2 -2
  97. package/out/async/memoize.js.map +1 -0
  98. package/out/{promises.d.ts → async/promises.d.ts} +1 -1
  99. package/out/async/promises.d.ts.map +1 -0
  100. package/out/{promises.js → async/promises.js} +1 -1
  101. package/out/async/promises.js.map +1 -0
  102. package/out/cloudflare/tokens.js +1 -1
  103. package/out/cloudflare/tokens.js.map +1 -1
  104. package/out/cloudflare/wrangler.js +3 -3
  105. package/out/cloudflare/wrangler.js.map +1 -1
  106. package/out/crypto/digest.d.ts +1 -1
  107. package/out/crypto/digest.js +1 -1
  108. package/out/crypto/ed25519.d.ts +7 -0
  109. package/out/crypto/ed25519.d.ts.map +1 -1
  110. package/out/crypto/ed25519.js +7 -0
  111. package/out/crypto/ed25519.js.map +1 -1
  112. package/out/{hash.d.ts → crypto/hash.d.ts} +12 -0
  113. package/out/crypto/hash.d.ts.map +1 -0
  114. package/out/{hash.js → crypto/hash.js} +15 -1
  115. package/out/crypto/hash.js.map +1 -0
  116. package/out/crypto/node.js +1 -1
  117. package/out/crypto/node.js.map +1 -1
  118. package/out/data-root.d.ts +11 -3
  119. package/out/data-root.d.ts.map +1 -1
  120. package/out/data-root.js +14 -3
  121. package/out/data-root.js.map +1 -1
  122. package/out/decoder/containment.d.ts.map +1 -1
  123. package/out/decoder/containment.js +1 -1
  124. package/out/decoder/containment.js.map +1 -1
  125. package/out/decoder/serialize/outline.d.ts +9 -0
  126. package/out/decoder/serialize/outline.d.ts.map +1 -1
  127. package/out/decoder/serialize/outline.js +16 -6
  128. package/out/decoder/serialize/outline.js.map +1 -1
  129. package/out/decoder/types.d.ts +8 -0
  130. package/out/decoder/types.d.ts.map +1 -1
  131. package/out/decoder/types.js +1 -1
  132. package/out/decoder/types.js.map +1 -1
  133. package/out/env/schema.d.ts +1 -0
  134. package/out/env/schema.d.ts.map +1 -1
  135. package/out/env/schema.js +4 -0
  136. package/out/env/schema.js.map +1 -1
  137. package/out/env.d.ts +1 -0
  138. package/out/env.d.ts.map +1 -1
  139. package/out/fs/deflate64.js +1 -1
  140. package/out/fs/deflate64.js.map +1 -1
  141. package/out/fs/lock.d.ts +73 -4
  142. package/out/fs/lock.d.ts.map +1 -1
  143. package/out/fs/lock.js +96 -19
  144. package/out/fs/lock.js.map +1 -1
  145. package/out/fs/readers.js +1 -1
  146. package/out/fs/readers.js.map +1 -1
  147. package/out/fs/writers.d.ts +9 -1
  148. package/out/fs/writers.d.ts.map +1 -1
  149. package/out/fs/writers.js +15 -2
  150. package/out/fs/writers.js.map +1 -1
  151. package/out/geocode/result.d.ts +25 -1
  152. package/out/geocode/result.d.ts.map +1 -1
  153. package/out/geocode/result.js +49 -6
  154. package/out/geocode/result.js.map +1 -1
  155. package/out/html/text.js +2 -2
  156. package/out/html/trust-policies.d.ts.map +1 -0
  157. package/out/html/trust-policies.js.map +1 -0
  158. package/out/index.d.ts +0 -1
  159. package/out/index.d.ts.map +1 -1
  160. package/out/index.js +0 -1
  161. package/out/index.js.map +1 -1
  162. package/out/layers/artifact.js +2 -2
  163. package/out/layers/artifact.js.map +1 -1
  164. package/out/layers/coverage.d.ts.map +1 -1
  165. package/out/layers/coverage.js +1 -1
  166. package/out/layers/coverage.js.map +1 -1
  167. package/out/layers/manifest.d.ts +53 -0
  168. package/out/layers/manifest.d.ts.map +1 -1
  169. package/out/layers/manifest.js +68 -2
  170. package/out/layers/manifest.js.map +1 -1
  171. package/out/layers/provenance.d.ts +127 -0
  172. package/out/layers/provenance.d.ts.map +1 -0
  173. package/out/layers/provenance.js +122 -0
  174. package/out/layers/provenance.js.map +1 -0
  175. package/out/layers/publication.d.ts.map +1 -1
  176. package/out/layers/publication.js +3 -3
  177. package/out/layers/publication.js.map +1 -1
  178. package/out/layers/selection.d.ts.map +1 -1
  179. package/out/layers/selection.js +2 -2
  180. package/out/layers/selection.js.map +1 -1
  181. package/out/license/branch.d.ts +33 -0
  182. package/out/license/branch.d.ts.map +1 -0
  183. package/out/license/branch.js +52 -0
  184. package/out/license/branch.js.map +1 -0
  185. package/out/license/configured.d.ts +1 -1
  186. package/out/license/configured.d.ts.map +1 -1
  187. package/out/license/configured.js +1 -9
  188. package/out/license/configured.js.map +1 -1
  189. package/out/license/declaration.d.ts +1 -1
  190. package/out/license/declaration.d.ts.map +1 -1
  191. package/out/license/key/file.js +1 -1
  192. package/out/license/key/file.js.map +1 -1
  193. package/out/license/key.d.ts +27 -115
  194. package/out/license/key.d.ts.map +1 -1
  195. package/out/license/key.js +98 -164
  196. package/out/license/key.js.map +1 -1
  197. package/out/license/provenance.d.ts +47 -0
  198. package/out/license/provenance.d.ts.map +1 -0
  199. package/out/license/provenance.js +134 -0
  200. package/out/license/provenance.js.map +1 -0
  201. package/out/license/register.d.ts +6 -47
  202. package/out/license/register.d.ts.map +1 -1
  203. package/out/license/register.js +7 -58
  204. package/out/license/register.js.map +1 -1
  205. package/out/license/stamp.d.ts +7 -1
  206. package/out/license/stamp.d.ts.map +1 -1
  207. package/out/license/stamp.js +2 -2
  208. package/out/license/stamp.js.map +1 -1
  209. package/out/license/text-url.d.ts +9 -0
  210. package/out/license/text-url.d.ts.map +1 -0
  211. package/out/license/text-url.js +49 -0
  212. package/out/license/text-url.js.map +1 -0
  213. package/out/license/training.d.ts +29 -0
  214. package/out/license/training.d.ts.map +1 -0
  215. package/out/license/training.js +52 -0
  216. package/out/license/training.js.map +1 -0
  217. package/out/license.d.ts +7 -6
  218. package/out/license.d.ts.map +1 -1
  219. package/out/license.js +7 -6
  220. package/out/license.js.map +1 -1
  221. package/out/locale/registry.d.ts.map +1 -1
  222. package/out/locale/registry.js +1 -1
  223. package/out/locale/registry.js.map +1 -1
  224. package/out/locale/zh-cn-units.js +1 -1
  225. package/out/locale/zh-cn-units.js.map +1 -1
  226. package/out/math/numeric.d.ts.map +1 -0
  227. package/out/math/numeric.js.map +1 -0
  228. package/out/math/random.d.ts.map +1 -0
  229. package/out/math/random.js.map +1 -0
  230. package/out/math/stats.d.ts.map +1 -0
  231. package/out/math/stats.js.map +1 -0
  232. package/out/module/workspace.js +1 -1
  233. package/out/module/workspace.js.map +1 -1
  234. package/out/network/routing.d.ts.map +1 -0
  235. package/out/{routing.js → network/routing.js} +1 -1
  236. package/out/network/routing.js.map +1 -0
  237. package/out/pipeline/result.d.ts +7 -24
  238. package/out/pipeline/result.d.ts.map +1 -1
  239. package/out/pipeline/runtime-pipeline.d.ts +7 -2
  240. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  241. package/out/pipeline/runtime-pipeline.js +56 -103
  242. package/out/pipeline/runtime-pipeline.js.map +1 -1
  243. package/out/pipeline/stage.d.ts +180 -0
  244. package/out/pipeline/stage.d.ts.map +1 -0
  245. package/out/pipeline/stage.js +130 -0
  246. package/out/pipeline/stage.js.map +1 -0
  247. package/out/pipeline/types.d.ts +31 -12
  248. package/out/pipeline/types.d.ts.map +1 -1
  249. package/out/pipeline/types.js +0 -8
  250. package/out/pipeline/types.js.map +1 -1
  251. package/out/pipeline.d.ts +5 -3
  252. package/out/pipeline.d.ts.map +1 -1
  253. package/out/pipeline.js +2 -1
  254. package/out/pipeline.js.map +1 -1
  255. package/out/{git.d.ts → repo/git.d.ts} +10 -1
  256. package/out/repo/git.d.ts.map +1 -0
  257. package/out/{git.js → repo/git.js} +14 -1
  258. package/out/repo/git.js.map +1 -0
  259. package/out/{release-config.d.ts → repo/release-config.d.ts} +8 -0
  260. package/out/repo/release-config.d.ts.map +1 -0
  261. package/out/repo/release-config.js.map +1 -0
  262. package/out/repo/scope-config.d.ts.map +1 -0
  263. package/out/repo/scope-config.js.map +1 -0
  264. package/out/repo/spdx-header.d.ts.map +1 -0
  265. package/out/{spdx-header.js → repo/spdx-header.js} +7 -0
  266. package/out/repo/spdx-header.js.map +1 -0
  267. package/out/repo/vale.d.ts.map +1 -0
  268. package/out/repo/vale.js.map +1 -0
  269. package/out/repo/workspaces.d.ts.map +1 -0
  270. package/out/{workspaces.js → repo/workspaces.js} +1 -1
  271. package/out/repo/workspaces.js.map +1 -0
  272. package/out/resolver/lookup-types.d.ts +1 -1
  273. package/out/resolver/region-database-provider.d.ts +30 -0
  274. package/out/resolver/region-database-provider.d.ts.map +1 -1
  275. package/out/resolver/synthetic-id-ranges.d.ts +15 -8
  276. package/out/resolver/synthetic-id-ranges.d.ts.map +1 -1
  277. package/out/resolver/synthetic-id-ranges.js +18 -9
  278. package/out/resolver/synthetic-id-ranges.js.map +1 -1
  279. package/out/resolver/types.d.ts +192 -8
  280. package/out/resolver/types.d.ts.map +1 -1
  281. package/out/resolver/types.js +56 -0
  282. package/out/resolver/types.js.map +1 -1
  283. package/out/resolver.d.ts +3 -3
  284. package/out/resolver.d.ts.map +1 -1
  285. package/out/resolver.js +1 -1
  286. package/out/resolver.js.map +1 -1
  287. package/out/scripting/process.d.ts.map +1 -0
  288. package/out/scripting/process.js.map +1 -0
  289. package/out/scripting/workers.d.ts.map +1 -0
  290. package/out/scripting/workers.js.map +1 -0
  291. package/out/state-machine.d.ts +1 -1
  292. package/out/strings/python-json.d.ts +2 -1
  293. package/out/strings/python-json.d.ts.map +1 -1
  294. package/out/strings/python-json.js +1 -1
  295. package/out/strings/python-json.js.map +1 -1
  296. package/out/tools/build-deflate64-wasm.run.js +2 -2
  297. package/out/tools/build-deflate64-wasm.run.js.map +1 -1
  298. package/out/tools/coarse-placer/build/dataset.js +1 -1
  299. package/out/tools/coarse-placer/build/dataset.js.map +1 -1
  300. package/out/tools/coarse-placer/build/outlier/exposure.js +1 -1
  301. package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
  302. package/out/tools/coarse-placer/build/outlier/latin.d.ts.map +1 -1
  303. package/out/tools/coarse-placer/build/outlier/latin.js +5 -1
  304. package/out/tools/coarse-placer/build/outlier/latin.js.map +1 -1
  305. package/out/tools/coarse-placer/country-sets.d.ts +2 -2
  306. package/out/tools/coarse-placer/country-sets.js +2 -2
  307. package/out/tools/coarse-placer/outlier-rows.js +2 -2
  308. package/out/tools/coarse-placer/outlier-rows.js.map +1 -1
  309. package/out/tools/coarse-placer/train.js +1 -1
  310. package/out/tools/coarse-placer/train.js.map +1 -1
  311. package/out/tools/generate-language-types.js +2 -2
  312. package/out/tools/generate-language-types.js.map +1 -1
  313. package/out/tools/license/product-fixtures.run.d.ts +2 -0
  314. package/out/tools/license/product-fixtures.run.d.ts.map +1 -0
  315. package/out/tools/license/product-fixtures.run.js +350 -0
  316. package/out/tools/license/product-fixtures.run.js.map +1 -0
  317. package/out/utils/chunk-process.js +2 -2
  318. package/out/utils/chunk-process.js.map +1 -1
  319. package/out/utils/geodatabase-archive.js +1 -1
  320. package/out/utils/geodatabase-archive.js.map +1 -1
  321. package/out/utils/time.d.ts +15 -4
  322. package/out/utils/time.d.ts.map +1 -1
  323. package/out/utils/time.js +114 -12
  324. package/out/utils/time.js.map +1 -1
  325. package/out/utils.d.ts +4 -4
  326. package/out/utils.d.ts.map +1 -1
  327. package/out/utils.js +4 -4
  328. package/out/utils.js.map +1 -1
  329. package/out/values/identical.d.ts.map +1 -0
  330. package/out/values/identical.js.map +1 -0
  331. package/out/values/json.d.ts.map +1 -0
  332. package/out/values/json.js.map +1 -0
  333. package/out/values/objects.d.ts.map +1 -0
  334. package/out/values/objects.js.map +1 -0
  335. package/package.json +278 -243
  336. package/tools/build-deflate64-wasm.run.ts +2 -2
  337. package/tools/coarse-placer/build/dataset.ts +1 -1
  338. package/tools/coarse-placer/build/outlier/exposure.ts +1 -1
  339. package/tools/coarse-placer/build/outlier/latin.ts +5 -1
  340. package/tools/coarse-placer/country-sets.ts +2 -2
  341. package/tools/coarse-placer/outlier-rows.ts +2 -2
  342. package/tools/coarse-placer/train.ts +1 -1
  343. package/tools/generate-language-types.ts +2 -2
  344. package/tools/license/product-fixtures.run.ts +449 -0
  345. package/lib/collections.ts +0 -5
  346. package/lib/license/decision.ts +0 -329
  347. package/lib/license/obligations.ts +0 -256
  348. package/lib/license/record.ts +0 -277
  349. package/lib/scripting/ingest-chunk-script.ts +0 -87
  350. package/out/binary-frame.d.ts.map +0 -1
  351. package/out/binary-frame.js.map +0 -1
  352. package/out/collections.d.ts +0 -2
  353. package/out/collections.d.ts.map +0 -1
  354. package/out/collections.js +0 -5
  355. package/out/collections.js.map +0 -1
  356. package/out/git.d.ts.map +0 -1
  357. package/out/git.js.map +0 -1
  358. package/out/hash.d.ts.map +0 -1
  359. package/out/hash.js.map +0 -1
  360. package/out/identical.d.ts.map +0 -1
  361. package/out/identical.js.map +0 -1
  362. package/out/json.d.ts.map +0 -1
  363. package/out/json.js.map +0 -1
  364. package/out/license/decision.d.ts +0 -179
  365. package/out/license/decision.d.ts.map +0 -1
  366. package/out/license/decision.js +0 -169
  367. package/out/license/decision.js.map +0 -1
  368. package/out/license/obligations.d.ts +0 -102
  369. package/out/license/obligations.d.ts.map +0 -1
  370. package/out/license/obligations.js +0 -188
  371. package/out/license/obligations.js.map +0 -1
  372. package/out/license/record.d.ts +0 -136
  373. package/out/license/record.d.ts.map +0 -1
  374. package/out/license/record.js +0 -222
  375. package/out/license/record.js.map +0 -1
  376. package/out/load-ledger.d.ts.map +0 -1
  377. package/out/load-ledger.js.map +0 -1
  378. package/out/memoize.d.ts.map +0 -1
  379. package/out/memoize.js.map +0 -1
  380. package/out/numeric.d.ts.map +0 -1
  381. package/out/numeric.js.map +0 -1
  382. package/out/objects.d.ts.map +0 -1
  383. package/out/objects.js.map +0 -1
  384. package/out/overture-pins.d.ts.map +0 -1
  385. package/out/overture-pins.js.map +0 -1
  386. package/out/postcode-prefix-files.d.ts.map +0 -1
  387. package/out/postcode-prefix-files.js.map +0 -1
  388. package/out/process.d.ts.map +0 -1
  389. package/out/process.js.map +0 -1
  390. package/out/promises.d.ts.map +0 -1
  391. package/out/promises.js.map +0 -1
  392. package/out/random.d.ts.map +0 -1
  393. package/out/random.js.map +0 -1
  394. package/out/release-config.d.ts.map +0 -1
  395. package/out/release-config.js.map +0 -1
  396. package/out/routing.d.ts.map +0 -1
  397. package/out/routing.js.map +0 -1
  398. package/out/scope-config.d.ts.map +0 -1
  399. package/out/scope-config.js.map +0 -1
  400. package/out/scripting/ingest-chunk-script.d.ts +0 -58
  401. package/out/scripting/ingest-chunk-script.d.ts.map +0 -1
  402. package/out/scripting/ingest-chunk-script.js +0 -47
  403. package/out/scripting/ingest-chunk-script.js.map +0 -1
  404. package/out/spdx-header.d.ts.map +0 -1
  405. package/out/spdx-header.js.map +0 -1
  406. package/out/stats.d.ts.map +0 -1
  407. package/out/stats.js.map +0 -1
  408. package/out/trust-policies.d.ts.map +0 -1
  409. package/out/trust-policies.js.map +0 -1
  410. package/out/vale.d.ts.map +0 -1
  411. package/out/vale.js.map +0 -1
  412. package/out/workers.d.ts.map +0 -1
  413. package/out/workers.js.map +0 -1
  414. package/out/workspaces.d.ts.map +0 -1
  415. package/out/workspaces.js.map +0 -1
  416. /package/lib/{load-ledger.ts → asset/load-ledger.ts} +0 -0
  417. /package/lib/{overture-pins.ts → asset/overture-pins.ts} +0 -0
  418. /package/lib/{postcode-prefix-files.ts → asset/postcode-prefix-files.ts} +0 -0
  419. /package/lib/{trust-policies.ts → html/trust-policies.ts} +0 -0
  420. /package/lib/{numeric.ts → math/numeric.ts} +0 -0
  421. /package/lib/{random.ts → math/random.ts} +0 -0
  422. /package/lib/{stats.ts → math/stats.ts} +0 -0
  423. /package/lib/{scope-config.ts → repo/scope-config.ts} +0 -0
  424. /package/lib/{vale.ts → repo/vale.ts} +0 -0
  425. /package/lib/{process.ts → scripting/process.ts} +0 -0
  426. /package/lib/{workers.ts → scripting/workers.ts} +0 -0
  427. /package/lib/{identical.ts → values/identical.ts} +0 -0
  428. /package/lib/{json.ts → values/json.ts} +0 -0
  429. /package/lib/{objects.ts → values/objects.ts} +0 -0
  430. /package/out/{binary-frame.d.ts → asset/binary-frame.d.ts} +0 -0
  431. /package/out/{load-ledger.d.ts → asset/load-ledger.d.ts} +0 -0
  432. /package/out/{load-ledger.js → asset/load-ledger.js} +0 -0
  433. /package/out/{overture-pins.d.ts → asset/overture-pins.d.ts} +0 -0
  434. /package/out/{overture-pins.js → asset/overture-pins.js} +0 -0
  435. /package/out/{postcode-prefix-files.d.ts → asset/postcode-prefix-files.d.ts} +0 -0
  436. /package/out/{postcode-prefix-files.js → asset/postcode-prefix-files.js} +0 -0
  437. /package/out/{memoize.d.ts → async/memoize.d.ts} +0 -0
  438. /package/out/{trust-policies.d.ts → html/trust-policies.d.ts} +0 -0
  439. /package/out/{trust-policies.js → html/trust-policies.js} +0 -0
  440. /package/out/{numeric.d.ts → math/numeric.d.ts} +0 -0
  441. /package/out/{numeric.js → math/numeric.js} +0 -0
  442. /package/out/{random.d.ts → math/random.d.ts} +0 -0
  443. /package/out/{random.js → math/random.js} +0 -0
  444. /package/out/{stats.d.ts → math/stats.d.ts} +0 -0
  445. /package/out/{stats.js → math/stats.js} +0 -0
  446. /package/out/{routing.d.ts → network/routing.d.ts} +0 -0
  447. /package/out/{release-config.js → repo/release-config.js} +0 -0
  448. /package/out/{scope-config.d.ts → repo/scope-config.d.ts} +0 -0
  449. /package/out/{scope-config.js → repo/scope-config.js} +0 -0
  450. /package/out/{spdx-header.d.ts → repo/spdx-header.d.ts} +0 -0
  451. /package/out/{vale.d.ts → repo/vale.d.ts} +0 -0
  452. /package/out/{vale.js → repo/vale.js} +0 -0
  453. /package/out/{workspaces.d.ts → repo/workspaces.d.ts} +0 -0
  454. /package/out/{process.d.ts → scripting/process.d.ts} +0 -0
  455. /package/out/{process.js → scripting/process.js} +0 -0
  456. /package/out/{workers.d.ts → scripting/workers.d.ts} +0 -0
  457. /package/out/{workers.js → scripting/workers.js} +0 -0
  458. /package/out/{identical.d.ts → values/identical.d.ts} +0 -0
  459. /package/out/{identical.js → values/identical.js} +0 -0
  460. /package/out/{json.d.ts → values/json.d.ts} +0 -0
  461. /package/out/{json.js → values/json.js} +0 -0
  462. /package/out/{objects.d.ts → values/objects.d.ts} +0 -0
  463. /package/out/{objects.js → values/objects.js} +0 -0
@@ -814,6 +814,23 @@ export interface VenueHeadStage {
814
814
  venueHeadOpts?: VenueHeadPriorOpts
815
815
  }
816
816
 
817
+ /**
818
+ * The stated country that `pairIndexOwnCountry` compares against a placetype-pair index's own country.
819
+ */
820
+ export interface PairIndexOwnCountry {
821
+ /**
822
+ * The country the caller states for the parse, such as its locale's or default country.
823
+ *
824
+ * `null` leaves the decision to the locale head's confident verdict.
825
+ */
826
+ declaredCountry: string | null
827
+ }
828
+
829
+ /**
830
+ * Returns the gazetteer FST shipped for an ISO 3166-1 alpha-2 country, or `null` when none ships.
831
+ */
832
+ export type CountryFSTLookup = (country: string) => FSTMatcherLike | null | Promise<FSTMatcherLike | null>
833
+
817
834
  /**
818
835
  * Options for {@link AddressClassifier.parse}.
819
836
  */
@@ -880,6 +897,22 @@ export interface ClassifierOpts {
880
897
  */
881
898
  enforceWordConsistency?: WordConsistencySetting
882
899
  placetypePair?: PlacetypePairSelection
900
+ /**
901
+ * Whether the placetype-pair prior leaves separator pieces unbiased.
902
+ */
903
+ pairPriorWordPieces?: boolean
904
+ /**
905
+ * Whether a segment child's pair bias leaves out the same-field postcode its probe key stripped.
906
+ */
907
+ pairPriorChildPostcodeStrip?: boolean
908
+ /**
909
+ * Applies the placetype-pair index only when the parse's country is the index's country.
910
+ */
911
+ pairIndexOwnCountry?: PairIndexOwnCountry
912
+ /**
913
+ * The gazetteer FST for the country the locale head reads, used in place of `fst` when one ships.
914
+ */
915
+ fstForCountry?: CountryFSTLookup
883
916
  }
884
917
 
885
918
  /**
@@ -985,17 +1018,3 @@ export interface RuntimePipelineStages {
985
1018
  * Stage durations in milliseconds, keyed by stage name.
986
1019
  */
987
1020
  export type PipelineTiming = Record<string, number>
988
-
989
- /**
990
- * The stages whose failures the pipeline records before it continues.
991
- */
992
- export const PipelineFaultStage = {
993
- Classifier: "classifier",
994
- PhraseGrouper: "phrase-grouper",
995
- Resolver: "resolver",
996
- } as const
997
-
998
- /**
999
- * One of the {@link PipelineFaultStage} values.
1000
- */
1001
- export type PipelineFaultStage = (typeof PipelineFaultStage)[keyof typeof PipelineFaultStage]
package/lib/pipeline.ts CHANGED
@@ -31,7 +31,6 @@ export {
31
31
  deriveInputMode,
32
32
  InputModeSchema,
33
33
  InputModeSelectionSchema,
34
- PipelineFaultStage,
35
34
  POIIntentSchema,
36
35
  POIQueryResultSchema,
37
36
  POIResultSchema,
@@ -52,6 +51,7 @@ export type {
52
51
  ClassifierOpts,
53
52
  AnchorRegionAncestor,
54
53
  AnchorRegionLookupLike,
54
+ CountryFSTLookup,
55
55
  FSTMatcherLike,
56
56
  InputMode,
57
57
  InputModeSelection,
@@ -61,6 +61,7 @@ export type {
61
61
  PhraseKind,
62
62
  PhraseProposal,
63
63
  PipelineOpts,
64
+ PairIndexOwnCountry,
64
65
  PipelineTiming,
65
66
  PlacetypePairSelection,
66
67
  PlacerCountryUse,
@@ -84,4 +85,15 @@ export type {
84
85
  } from "#pipeline/types"
85
86
 
86
87
  export type { MachinePreferences } from "#pipeline/preferences"
87
- export type { PipelineFault, PipelineResult } from "#pipeline/result"
88
+ export type { PipelineResult } from "#pipeline/result"
89
+
90
+ export { createRequestContext, recordFault, runStage, runStages, StageID, treeRewriteStage } from "#pipeline/stage"
91
+
92
+ export type {
93
+ PipelineFault,
94
+ PipelineFaultStage,
95
+ PipelineStage,
96
+ RequestContext,
97
+ StageRecord,
98
+ TreeRewriteRecord,
99
+ } from "#pipeline/stage"
@@ -26,7 +26,7 @@ import {
26
26
  runFile,
27
27
  runFileSync,
28
28
  spawnProcess,
29
- } from "#process"
29
+ } from "#scripting/process"
30
30
  import { TypedEventTarget } from "#utils/events"
31
31
 
32
32
  /**
@@ -382,6 +382,26 @@ export async function gitCommonDirectory(repoRoot: PathBuilderLike = repoRootPat
382
382
  return git(["rev-parse", "--path-format=absolute", "--git-common-dir"], repoRoot)
383
383
  }
384
384
 
385
+ /**
386
+ * The count of commits `head` has that `base` lacks, and the count `base` has that `head` lacks.
387
+ *
388
+ * Both are read from local refs, so a remote-tracking `base` reflects the last fetch.
389
+ */
390
+ export async function commitsAheadBehind(
391
+ base: string,
392
+ head = "HEAD",
393
+ repoRoot: PathBuilderLike = repoRootPathBuilder
394
+ ): Promise<{ ahead: number; behind: number }> {
395
+ const counts = await git(["rev-list", "--left-right", "--count", `${base}...${head}`], repoRoot)
396
+ const [behind, ahead] = counts.trim().split(/\s+/u).map(Number)
397
+
398
+ if (!Number.isInteger(behind) || !Number.isInteger(ahead)) {
399
+ throw new TypeError(`git rev-list --left-right --count ${base}...${head} printed "${counts}"`)
400
+ }
401
+
402
+ return { ahead: ahead!, behind: behind! }
403
+ }
404
+
385
405
  /**
386
406
  * The absolute path of the working tree that contains `repoRoot`.
387
407
  */
@@ -96,6 +96,14 @@ export interface ReleaseConfig {
96
96
  charWeights?: Record<string, CharWeightsRecipe>
97
97
  softFeed?: SoftFeedRecipe
98
98
  assets?: { hfBucket?: string; [key: string]: unknown }
99
+ /**
100
+ * The address-layer version the release serves, keyed by ISO 3166-1 country code,
101
+ * such as `{ "US": "2026-11-13" }`.
102
+ *
103
+ * The data bill of materials reads that version's manifest and ledgers to list the layer's sources.
104
+ * A key starting with `$` is a comment.
105
+ */
106
+ addressLayers?: Record<string, string>
99
107
  }
100
108
 
101
109
  /**
@@ -76,6 +76,11 @@ export const SPDX_HEADER_EXEMPT_PATHS: readonly string[] = [
76
76
  "packages/sentencepiece-wasm/sentencepiece.mjs",
77
77
  ]
78
78
 
79
+ /**
80
+ * Matches a `*.snippet.*` file under `docs/`, which a page includes as a reader's script.
81
+ */
82
+ const DOCS_SNIPPET_PATH = /^docs\/.+\.snippet\.(?:ts|mts|tsx)$/
83
+
79
84
  /**
80
85
  * The header syntax for a repository-relative path, or null when the path takes no header.
81
86
  */
@@ -84,6 +89,9 @@ export function sourceHeaderSyntax(path: string): SourceHeaderSyntax | null {
84
89
  return null
85
90
  }
86
91
 
92
+ // A docs page prints the whole text of a snippet file to its reader.
93
+ if (DOCS_SNIPPET_PATH.test(path)) return null
94
+
87
95
  if (path.endsWith(".d.ts")) return SourceHeaderSyntax.Slash
88
96
 
89
97
  const extension = /\.([a-z]+)$/.exec(path)?.[1]
@@ -14,8 +14,8 @@ import { type PathBuilderLike, resolvePath } from "path-ts"
14
14
  import { Globerator } from "spliterator/node/fs"
15
15
 
16
16
  import { tryStat } from "#fs/readers/stat"
17
- import { stringifyJSON } from "#json"
18
17
  import { readPackageJSON } from "#module/resolve-from"
18
+ import { stringifyJSON } from "#values/json"
19
19
 
20
20
  const TRAILING_STAR = /^(?<parent>[^*]+)\/\*$/u
21
21
 
@@ -87,7 +87,7 @@ export interface AddressPointLookup {
87
87
  * One interpolated coordinate estimate, never an exact situs point.
88
88
  * `uncertaintyM` states the estimate's radius in meters.
89
89
  *
90
- * A structural mirror of `InterpolatedHit` in `resolver-wof-sqlite/interpolation.ts`.
90
+ * A structural mirror of `InterpolatedHit` in `resolver-wof-sqlite/labels/street/interpolation.ts`.
91
91
  * Keep this a subset of that shape so the concrete `StreetInterpolator`
92
92
  * and `AddressPointInterpolator` satisfy {@link InterpolationLookup} with no adapter,
93
93
  * following the {@link AddressPointHit} precedent.
@@ -54,4 +54,37 @@ export interface RegionDatabaseProvider<
54
54
  * A region with no database on disk yields a bundle with no members.
55
55
  */
56
56
  for(key: TKey): TDatabases
57
+
58
+ /**
59
+ * The database files `for(key)` reads, one per tier, and where a user obtains
60
+ * the sources their manifests record.
61
+ *
62
+ * A caller reads each file's `layer_manifest` to state the region's terms and sources.
63
+ * A region with no database on disk yields an empty array.
64
+ */
65
+ layerDatabases?(key: TKey): readonly RegionLayerDatabase[]
66
+ }
67
+
68
+ /**
69
+ * Where a user obtains one data source: a page that explains how, or lists its downloads.
70
+ */
71
+ export interface SourceLocation {
72
+ /**
73
+ * The source's name for a reader, such as `Base Adresse Nationale`.
74
+ */
75
+ title: string
76
+ url: string
77
+ }
78
+
79
+ /**
80
+ * One database file a region provider reads for a region.
81
+ */
82
+ export interface RegionLayerDatabase {
83
+ tier: keyof RegionDatabases
84
+ path: string
85
+ /**
86
+ * Where a user obtains each source the provider's layers record, keyed by the source's
87
+ * name in a manifest's `source`: the part before any `:` scope, such as `ban` in `ban:fr`.
88
+ */
89
+ sourceLocations: Readonly<Record<string, SourceLocation>>
57
90
  }
@@ -5,7 +5,7 @@
5
5
  * @file The one registry of synthetic place-id ranges, and of the range `mailwoman` mints WOF records from.
6
6
  *
7
7
  * An upstream WOF id is below 2e9, and a WOF record minted in a `mailwoman` fork takes an id from
8
- * {@link MAILWOMAN_WOF_ID_BASE}. Every other source a gazetteer artifact folds in mints ids from a higher base.
8
+ * {@link MAILWOMAN_WOF_ID_BASE}. Every other source whose places a gazetteer artifact adds mints ids from a higher base.
9
9
  * The bases must be pairwise distinct. The candidate table's `candidate_ancestor` and
10
10
  * `candidate_interval` sidecars are keyed only by `spr_id`, a result's `placeID` is `wof:<spr_id>`, and the
11
11
  * backend's `ancestors(id)` answers whichever row wrote last. Two builders that pick the same base give two places
@@ -61,35 +61,45 @@ export function nextMailwomanWOFID(minted: Iterable<number>): number {
61
61
  }
62
62
 
63
63
  /**
64
- * Overture-sourced admin rows (`fold-overture`).
64
+ * Overture-sourced admin rows (`add-overture`).
65
65
  *
66
66
  * Above any real WOF id.
67
67
  */
68
68
  export const OVERTURE_ID_BASE = 8_000_000_000_000
69
69
 
70
70
  /**
71
- * The GeoNames alias fold (`@mailwoman/resolver-wof-sqlite/geonames`).
71
+ * The places and aliases the GeoNames step adds (`@mailwoman/resolver-wof-sqlite/geonames`).
72
72
  */
73
73
  export const GEONAMES_ID_BASE = 9_000_000_000_000
74
74
 
75
+ /**
76
+ * Reports whether an id belongs to the Overture Divisions part of an admin or candidate gazetteer.
77
+ *
78
+ * The part is ODbL-1.0 and the rest of the file isn't, so a pass that reads one part's rows to
79
+ * change the other's needs this test, and the Overture part's offer selects its rows with it.
80
+ */
81
+ export function isOverturePartID(id: number): boolean {
82
+ return id >= OVERTURE_ID_BASE && id < GEONAMES_ID_BASE
83
+ }
84
+
75
85
  /**
76
86
  * GeoNames postal rows (`@mailwoman/resolver-wof-sqlite/geonames`).
77
87
  */
78
88
  export const GEONAMES_POSTAL_ID_BASE = 9_500_000_000_000
79
89
 
80
90
  /**
81
- * The id the GeoNames fold gives the place GeoNames numbers `geonameid`:
91
+ * The id the GeoNames step gives the place GeoNames numbers `geonameid`:
82
92
  * {@link GEONAMES_ID_BASE} plus that number.
83
93
  *
84
94
  * The id is computed from the GeoNames record's own number.
85
- * A place keeps its id whichever other countries a build folds, and every build
86
- * of one GeoNames dump numbers its places the same way.
95
+ * A place keeps its id whichever other countries a build adds, and every build of
96
+ * one GeoNames dump numbers its places the same way.
87
97
  *
88
- * @throws When `geonameid` isn't a positive integer below the fold's range width.
98
+ * @throws When `geonameid` isn't a positive integer below the GeoNames range's width.
89
99
  */
90
- export function geonamesFoldID(geonameid: number): number {
100
+ export function geonamesPlaceID(geonameid: number): number {
91
101
  if (!Number.isInteger(geonameid) || geonameid <= 0 || geonameid >= GEONAMES_POSTAL_ID_BASE - GEONAMES_ID_BASE) {
92
- throw new RangeError(`geonameid ${geonameid} falls outside the GeoNames fold's id range`)
102
+ throw new RangeError(`geonameid ${geonameid} falls outside the GeoNames id range`)
93
103
  }
94
104
 
95
105
  return GEONAMES_ID_BASE + geonameid
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
2
  // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
3
 
4
- import type { PlacetypeMap } from "@mailwoman/codex/placetype-map"
4
+ import type { PlacetypeMap } from "@mailwoman/codex/labels/placetype-map"
5
5
 
6
6
  import type { AddressTree } from "#decoder/types"
7
7
  import type { GazetteerArtifactCoverage } from "#resolver/coverage-facts"
@@ -12,6 +12,38 @@ import type {
12
12
  StreetCentroidLookup,
13
13
  } from "#resolver/lookup-types"
14
14
 
15
+ /**
16
+ * Why a place's ranking score is a rank without a measurement behind it.
17
+ *
18
+ * `population_unrecorded`: the backend ranks by population and the gazetteer records
19
+ * none for the place, so its score is the rank an unknown population sorts to.
20
+ * `population_estimated`: the gazetteer records no population for the place,
21
+ * and its score ranks a population estimated from the settlement that contains it.
22
+ * `unrecorded`: the resolver recorded no score for the place.
23
+ */
24
+ export const ScoreUnmeasuredReason = {
25
+ PopulationUnrecorded: "population_unrecorded",
26
+ PopulationEstimated: "population_estimated",
27
+ Unrecorded: "unrecorded",
28
+ } as const
29
+
30
+ export type ScoreUnmeasuredReason = (typeof ScoreUnmeasuredReason)[keyof typeof ScoreUnmeasuredReason]
31
+
32
+ /**
33
+ * Why a candidate-table row's score, `-neg_rank` with `neg_rank = -log10(population + 1)`,
34
+ * has no measured population behind it, or null when it has one.
35
+ *
36
+ * A row with no population and a negative `neg_rank` was ranked by a population estimate.
37
+ */
38
+ export function populationScoreUnmeasured(
39
+ population: number | null | undefined,
40
+ negRank: number
41
+ ): ScoreUnmeasuredReason | null {
42
+ if (typeof population === "number" && population > 0) return null
43
+
44
+ return negRank < 0 ? ScoreUnmeasuredReason.PopulationEstimated : ScoreUnmeasuredReason.PopulationUnrecorded
45
+ }
46
+
15
47
  export interface ResolvedPlace {
16
48
  /**
17
49
  * Resolver-specific place identifier.
@@ -43,8 +75,17 @@ export interface ResolvedPlace {
43
75
  parent_id: number | string | null
44
76
  /**
45
77
  * Resolver-defined ranking score.
78
+ *
79
+ * The ranking stages compare it whether or not `scoreUnmeasured` is set.
46
80
  */
47
81
  score: number
82
+ /**
83
+ * Why `score` and `prominence` are unmeasured for this place: each value is
84
+ * the rank an unmeasured input sorts to.
85
+ *
86
+ * Null or absent when the backend measured the score.
87
+ */
88
+ scoreUnmeasured?: ScoreUnmeasuredReason | null
48
89
  /**
49
90
  * Optional backend prominence score.
50
91
  */
@@ -93,6 +134,13 @@ export interface ResolvedPlace {
93
134
  * True when the input matched an alias of this place and differs from its primary name.
94
135
  */
95
136
  matchedAlias?: true | null
137
+ /**
138
+ * True when a hard scope excluded this place: it lies outside the default country
139
+ * or the caller's parent place.
140
+ *
141
+ * The resolver sets it only on a place it lists on a node's `considered` list.
142
+ */
143
+ outsideScope?: true | null
96
144
  /**
97
145
  * Optional stored extent.
98
146
  * A point-only row stores its coordinate as both corners.
@@ -161,6 +209,10 @@ export interface ResolverBackend {
161
209
  * Optional ancestor lineage lookup.
162
210
  */
163
211
  ancestors?(id: number | string): Ancestor[]
212
+ /**
213
+ * Optional lookup of one place by its id, or null when the gazetteer holds no such place.
214
+ */
215
+ place?(id: number): ResolvedPlace | null
164
216
  /**
165
217
  * Optional artifact coverage facts.
166
218
  */
@@ -219,6 +271,18 @@ export interface LandmarkHit {
219
271
  */
220
272
  export const OSM_LANDMARK_PREFIX = "osm:"
221
273
 
274
+ /**
275
+ * Parses the resolver's `placeID` URI back to a WOF id, returning `null` for anything else
276
+ * so a future non-WOF backend isn't silently read as one.
277
+ */
278
+ export function wofIDFromPlaceID(placeID: string | null): number | null {
279
+ if (!placeID) return null
280
+
281
+ const match = /^wof:(\d+)$/.exec(placeID)
282
+
283
+ return match ? Number(match[1]) : null
284
+ }
285
+
222
286
  /**
223
287
  * Returns a landmark's place ID: `openstreetmap:W427818536` or `wikidata:Q160409`.
224
288
  */
@@ -237,6 +301,46 @@ export interface LandmarkLookup {
237
301
  find(name: string): LandmarkHit[] | Promise<LandmarkHit[]>
238
302
  }
239
303
 
304
+ /**
305
+ * A former administrative division whose name an input wrote, with the current
306
+ * places its containment evidence ties it to.
307
+ */
308
+ export interface FormerDivisionMatch {
309
+ name: string
310
+ /**
311
+ * Upper-case ISO 3166-1 alpha-2 code.
312
+ */
313
+ country: string
314
+ /**
315
+ * The GeoNames feature code (`ADM1H`) or the WOF placetype of a ceased record.
316
+ */
317
+ kind: string
318
+ /**
319
+ * The `ComponentTag` the division takes in an address.
320
+ */
321
+ tag: string
322
+ geonamesID: number | null
323
+ wofID: number | null
324
+ /**
325
+ * WOF ids of the current places the division covered.
326
+ */
327
+ linkedIDs: ReadonlySet<number>
328
+ /**
329
+ * The kinds of evidence the links rest on.
330
+ */
331
+ evidence: readonly string[]
332
+ }
333
+
334
+ /**
335
+ * Finds the former divisions a written name belongs to.
336
+ */
337
+ export interface FormerDivisionLookup {
338
+ /**
339
+ * The former divisions whose name keys the same as `value`, in `country` when one is given.
340
+ */
341
+ divisionsNamed(value: string, country: string | null): readonly FormerDivisionMatch[]
342
+ }
343
+
240
344
  /**
241
345
  * Who chose a default country scope.
242
346
  *
@@ -246,6 +350,21 @@ export interface LandmarkLookup {
246
350
  */
247
351
  export type DefaultCountrySource = "caller" | "inferred"
248
352
 
353
+ /**
354
+ * How a scope acts on a lookup.
355
+ *
356
+ * - `"hard"`: a filter.
357
+ * A candidate outside the scope never answers.
358
+ * - `"soft"`: a bounded prior.
359
+ * A candidate outside the scope still answers when it's much larger.
360
+ */
361
+ export const ScopeStrength = {
362
+ Hard: "hard",
363
+ Soft: "soft",
364
+ } as const
365
+
366
+ export type ScopeStrength = (typeof ScopeStrength)[keyof typeof ScopeStrength]
367
+
249
368
  /**
250
369
  * A default top-level country scope for resolution.
251
370
  */
@@ -255,6 +374,38 @@ export interface DefaultCountry {
255
374
  */
256
375
  country: string
257
376
  source: DefaultCountrySource
377
+ /**
378
+ * How the scope acts on a lookup.
379
+ *
380
+ * Absent means `"hard"`.
381
+ */
382
+ strength?: ScopeStrength
383
+ }
384
+
385
+ /**
386
+ * The country of a scope that filters lookups, or null when the scope is absent or soft.
387
+ */
388
+ export function hardCountryOf(scope: DefaultCountry | null | undefined): string | null {
389
+ return scope && scope.strength !== ScopeStrength.Soft ? scope.country : null
390
+ }
391
+
392
+ /**
393
+ * A caller-supplied place that scopes every lookup of an address, such as a WOF borough or country.
394
+ *
395
+ * A hard parent keeps only candidates its ancestor lineage agrees with:
396
+ * the places inside it, the place itself and its ancestors.
397
+ * It also filters by the parent's country.
398
+ *
399
+ * A soft parent ranks the candidates it contains first and gives its country a soft scope.
400
+ * Both forms pass the parent to the backend as a containment qualifier.
401
+ */
402
+ export interface ParentPlaceScope {
403
+ /**
404
+ * The gazetteer id of the parent place.
405
+ */
406
+ id: number
407
+ source: DefaultCountrySource
408
+ strength: ScopeStrength
258
409
  }
259
410
 
260
411
  /**
@@ -278,6 +429,9 @@ export interface ResolveSwitches {
278
429
  adminContainmentRerank: boolean
279
430
  dependentLocalityContainment: boolean
280
431
  countyDesignatorFallback: boolean
432
+ formerDivisions: boolean
433
+ scopeCountryRetrieval: boolean
434
+ siblingLocalityContainment: boolean
281
435
  diagnoseUnreachable: boolean
282
436
  }
283
437
 
@@ -299,6 +453,9 @@ export const RESOLVE_SWITCH_DEFAULTS: Readonly<ResolveSwitches> = {
299
453
  adminContainmentRerank: true,
300
454
  dependentLocalityContainment: true,
301
455
  countyDesignatorFallback: false,
456
+ formerDivisions: false,
457
+ scopeCountryRetrieval: false,
458
+ siblingLocalityContainment: false,
302
459
  diagnoseUnreachable: false,
303
460
  }
304
461
 
@@ -329,7 +486,7 @@ export interface ResolveOpts {
329
486
  */
330
487
  candidatesPerLookup?: number
331
488
  /**
332
- * Default top-level country scope, and who chose it.
489
+ * Default top-level country scope, who chose it, and whether it filters or ranks.
333
490
  */
334
491
  defaultCountry?: DefaultCountry
335
492
  /**
@@ -363,13 +520,17 @@ export interface ResolveOpts {
363
520
  */
364
521
  anchorWeight?: number
365
522
  /**
366
- * Optional locale country prior.
523
+ * The bonus a soft country scope gives a candidate in its country, in log10-population units.
524
+ *
525
+ * @defaultValue `DEFAULT_COUNTRY_PRIOR_WEIGHT` from `@mailwoman/resolver/toponym-prior` (2)
367
526
  */
368
- localeCountryPrior?: string
527
+ softCountryWeight?: number
369
528
  /**
370
- * Weight for localeCountryPrior.
529
+ * A caller-supplied parent place that scopes every lookup.
530
+ *
531
+ * It needs a backend with `place` and `ancestors`, and the resolve throws without them.
371
532
  */
372
- localeCountryPriorWeight?: number
533
+ parentPlace?: ParentPlaceScope
373
534
  /**
374
535
  * Optional capital-level callback.
375
536
  */
@@ -528,11 +689,52 @@ export interface ResolveOpts {
528
689
  * Looks a `locality` span up as a WOF `county` in its resolved region
529
690
  * when no locality of that name is there and the value is written with
530
691
  * its country's county designator (`Harris County`, `Jefferson Parish`),
531
- * from `countyNameWithoutDesignator` in `@mailwoman/codex/county-designators`.
692
+ * from `countyNameWithoutDesignator` in `@mailwoman/codex/designators/county`.
532
693
  *
533
694
  * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
534
695
  */
535
696
  countyDesignatorFallback?: boolean
697
+ /**
698
+ * Accepts a `subregion` or `region` value that no current division answers when the value is the name
699
+ * of a former division of {@link ResolveOpts.formerDivisionLookup} linked to the resolved locality.
700
+ *
701
+ * The accepted node keeps no place and scopes no lookup, and its metadata records the division.
702
+ *
703
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
704
+ */
705
+ formerDivisions?: boolean
706
+ /**
707
+ * The former divisions {@link ResolveOpts.formerDivisions} reads.
708
+ *
709
+ * Without it the switch leaves every node as the walk resolved it.
710
+ */
711
+ formerDivisionLookup?: FormerDivisionLookup
712
+ /**
713
+ * Lets a soft country scope act inside retrieval.
714
+ *
715
+ * A region or locality lookup without a hard country also retrieves the soft
716
+ * country's rows and merges them by place id.
717
+ * A bounded bonus for that country then runs after the importance rerank, so the rerank can't undo it.
718
+ *
719
+ * The soft scope is the locale's country when the walk withholds it for a bare tree,
720
+ * or the locale head's country when the head contradicts the inferred scope.
721
+ * A lookup under a hard default country also probes without it and reports the
722
+ * same-name places outside the scope on `considered`.
723
+ *
724
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
725
+ */
726
+ scopeCountryRetrieval?: boolean
727
+ /**
728
+ * Resolves one of two `locality` spans inside the other when the gazetteer places
729
+ * a candidate of it inside the other's resolved place.
730
+ *
731
+ * The inner span is retagged `dependent_locality` and looked up with the outer place
732
+ * as its containment qualifier, as a written dependent locality is.
733
+ * The gazetteer decides which span is inner, so token order doesn't.
734
+ *
735
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
736
+ */
737
+ siblingLocalityContainment?: boolean
536
738
  /**
537
739
  * Optional sink for resolver-internal trace records.
538
740
  */
@@ -556,7 +758,17 @@ export interface ResolveCandidateTrace {
556
758
  */
557
759
  country: string | null
558
760
  placetype: string
761
+ /**
762
+ * The ranking key the stages compared.
763
+ * It is unmeasured when `scoreUnmeasured` is set.
764
+ */
559
765
  score: number
766
+ /**
767
+ * Why `score` and `prominence` are unmeasured, or null when they're measured.
768
+ *
769
+ * Optional because a trace recorded before the field existed holds no such entry.
770
+ */
771
+ scoreUnmeasured?: ScoreUnmeasuredReason | null
560
772
  prominence: number | null
561
773
  importance: number | null
562
774
  population: number | null
@@ -607,6 +819,7 @@ export interface ResolveNodeTrace {
607
819
  | "span_rescore"
608
820
  | "postal_compound_recovery"
609
821
  | "county_designator_fallback"
822
+ | "sibling_locality_containment"
610
823
  } | null
611
824
  }
612
825
 
package/lib/resolver.ts CHANGED
@@ -32,14 +32,24 @@ export type {
32
32
  AuthoritativeResponse,
33
33
  } from "#resolver/authoritative-provider"
34
34
 
35
- export type { RegionDatabaseProvider, RegionDatabases } from "#resolver/region-database-provider"
35
+ export type {
36
+ RegionDatabaseProvider,
37
+ RegionDatabases,
38
+ RegionLayerDatabase,
39
+ SourceLocation,
40
+ } from "#resolver/region-database-provider"
36
41
 
37
42
  export {
38
43
  EMPTY_PLACE_FIELDS,
44
+ hardCountryOf,
39
45
  landmarkPlaceID,
40
46
  OSM_LANDMARK_PREFIX,
47
+ populationScoreUnmeasured,
41
48
  RESOLVE_SWITCH_DEFAULTS,
42
49
  resolveSwitches,
50
+ ScopeStrength,
51
+ ScoreUnmeasuredReason,
52
+ wofIDFromPlaceID,
43
53
  } from "#resolver/types"
44
54
 
45
55
  export { hardCountrySafelistFromCoverage } from "#resolver/coverage-facts"
@@ -52,6 +62,7 @@ export type {
52
62
  ResolveSwitches,
53
63
  DefaultCountry,
54
64
  DefaultCountrySource,
65
+ ParentPlaceScope,
55
66
  ResolvedPlace,
56
67
  Resolver,
57
68
  ResolverBackend,
@@ -59,6 +70,8 @@ export type {
59
70
  LandmarkHit,
60
71
  LandmarkKind,
61
72
  LandmarkLookup,
73
+ FormerDivisionLookup,
74
+ FormerDivisionMatch,
62
75
  } from "#resolver/types"
63
76
 
64
77
  export type {