@mailwoman/core 11.1.0 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (477) hide show
  1. package/README.md +2 -2
  2. package/lib/api/arcgis.ts +194 -0
  3. package/lib/api/ckan.ts +1 -1
  4. package/lib/api/disk-storage.ts +2 -2
  5. package/lib/api/ogc.ts +1 -1
  6. package/lib/api/retry.ts +7 -2
  7. package/lib/api/test/transport.ts +1 -1
  8. package/lib/{binary-frame.ts → asset/binary-frame.ts} +1 -1
  9. package/lib/async/abort.ts +100 -0
  10. package/lib/{memoize.ts → async/memoize.ts} +2 -2
  11. package/lib/{promises.ts → async/promises.ts} +1 -1
  12. package/lib/cloudflare/tokens.ts +1 -1
  13. package/lib/cloudflare/wrangler.ts +3 -3
  14. package/lib/crypto/digest.ts +1 -1
  15. package/lib/crypto/ed25519.ts +8 -0
  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 +50 -0
  20. package/lib/decoder/types.ts +9 -1
  21. package/lib/decoder.ts +1 -0
  22. package/lib/env/schema.ts +5 -0
  23. package/lib/fs/deflate64.ts +1 -1
  24. package/lib/fs/lock.ts +183 -25
  25. package/lib/fs/readers.ts +1 -1
  26. package/lib/fs/writers.ts +1 -1
  27. package/lib/geocode/result.ts +50 -6
  28. package/lib/html/text.ts +2 -2
  29. package/lib/index.ts +0 -1
  30. package/lib/layers/artifact.ts +2 -2
  31. package/lib/layers/coverage.ts +1 -1
  32. package/lib/layers/manifest.ts +94 -2
  33. package/lib/layers/provenance.ts +246 -0
  34. package/lib/layers/publication.ts +4 -3
  35. package/lib/layers/selection.ts +2 -2
  36. package/lib/license/branch.ts +66 -0
  37. package/lib/license/configured.ts +4 -2
  38. package/lib/license/declaration.ts +1 -1
  39. package/lib/license/key/file.ts +1 -1
  40. package/lib/license/key.ts +148 -201
  41. package/lib/license/provenance.ts +193 -0
  42. package/lib/license/register.ts +7 -78
  43. package/lib/license/stamp.ts +8 -2
  44. package/lib/license/text-url.ts +55 -0
  45. package/lib/license/training.ts +67 -0
  46. package/lib/license.ts +7 -6
  47. package/lib/locale/registry.ts +1 -1
  48. package/lib/locale/zh-cn-units.ts +1 -1
  49. package/lib/module/workspace.ts +1 -1
  50. package/lib/{routing.ts → network/routing.ts} +1 -1
  51. package/lib/pipeline/result.ts +7 -27
  52. package/lib/pipeline/runtime-pipeline.ts +131 -152
  53. package/lib/pipeline/stage.ts +290 -0
  54. package/lib/pipeline/types.ts +154 -20
  55. package/lib/pipeline.ts +14 -2
  56. package/lib/{git.ts → repo/git.ts} +21 -1
  57. package/lib/{release-config.ts → repo/release-config.ts} +8 -0
  58. package/lib/{scope-config.ts → repo/scope-config.ts} +8 -36
  59. package/lib/{spdx-header.ts → repo/spdx-header.ts} +8 -0
  60. package/lib/{workspaces.ts → repo/workspaces.ts} +1 -1
  61. package/lib/resolver/lookup-types.ts +1 -1
  62. package/lib/resolver/region-database-provider.ts +33 -0
  63. package/lib/resolver/synthetic-id-ranges.ts +76 -4
  64. package/lib/resolver/types.ts +231 -6
  65. package/lib/resolver.ts +14 -1
  66. package/lib/state-machine.ts +1 -1
  67. package/lib/strings/python-json.ts +15 -5
  68. package/lib/tokenization/Span.ts +12 -0
  69. package/lib/utils/chunk-process.ts +2 -2
  70. package/lib/utils/geodatabase-archive.ts +1 -1
  71. package/lib/utils/time.ts +190 -6
  72. package/lib/utils.ts +4 -4
  73. package/out/api/arcgis.d.ts +76 -0
  74. package/out/api/arcgis.d.ts.map +1 -1
  75. package/out/api/arcgis.js +123 -0
  76. package/out/api/arcgis.js.map +1 -1
  77. package/out/api/ckan.js +1 -1
  78. package/out/api/ckan.js.map +1 -1
  79. package/out/api/disk-storage.d.ts.map +1 -1
  80. package/out/api/disk-storage.js +2 -2
  81. package/out/api/disk-storage.js.map +1 -1
  82. package/out/api/ogc.js +1 -1
  83. package/out/api/ogc.js.map +1 -1
  84. package/out/api/retry.d.ts.map +1 -1
  85. package/out/api/retry.js +6 -2
  86. package/out/api/retry.js.map +1 -1
  87. package/out/api/test/transport.js +1 -1
  88. package/out/api/test/transport.js.map +1 -1
  89. package/out/asset/binary-frame.d.ts.map +1 -0
  90. package/out/{binary-frame.js → asset/binary-frame.js} +1 -1
  91. package/out/asset/binary-frame.js.map +1 -0
  92. package/out/asset/load-ledger.d.ts.map +1 -0
  93. package/out/asset/load-ledger.js.map +1 -0
  94. package/out/asset/overture-pins.d.ts.map +1 -0
  95. package/out/asset/overture-pins.js.map +1 -0
  96. package/out/asset/postcode-prefix-files.d.ts.map +1 -0
  97. package/out/asset/postcode-prefix-files.js.map +1 -0
  98. package/out/async/abort.d.ts +57 -0
  99. package/out/async/abort.d.ts.map +1 -0
  100. package/out/async/abort.js +89 -0
  101. package/out/async/abort.js.map +1 -0
  102. package/out/async/memoize.d.ts.map +1 -0
  103. package/out/{memoize.js → async/memoize.js} +2 -2
  104. package/out/async/memoize.js.map +1 -0
  105. package/out/{promises.d.ts → async/promises.d.ts} +1 -1
  106. package/out/async/promises.d.ts.map +1 -0
  107. package/out/{promises.js → async/promises.js} +1 -1
  108. package/out/async/promises.js.map +1 -0
  109. package/out/cloudflare/tokens.js +1 -1
  110. package/out/cloudflare/tokens.js.map +1 -1
  111. package/out/cloudflare/wrangler.js +3 -3
  112. package/out/cloudflare/wrangler.js.map +1 -1
  113. package/out/crypto/digest.d.ts +1 -1
  114. package/out/crypto/digest.js +1 -1
  115. package/out/crypto/ed25519.d.ts +7 -0
  116. package/out/crypto/ed25519.d.ts.map +1 -1
  117. package/out/crypto/ed25519.js +7 -0
  118. package/out/crypto/ed25519.js.map +1 -1
  119. package/out/crypto/hash.d.ts.map +1 -0
  120. package/out/crypto/hash.js.map +1 -0
  121. package/out/crypto/node.js +1 -1
  122. package/out/crypto/node.js.map +1 -1
  123. package/out/data-root.d.ts +11 -3
  124. package/out/data-root.d.ts.map +1 -1
  125. package/out/data-root.js +14 -3
  126. package/out/data-root.js.map +1 -1
  127. package/out/decoder/containment.d.ts.map +1 -1
  128. package/out/decoder/containment.js +1 -1
  129. package/out/decoder/containment.js.map +1 -1
  130. package/out/decoder/serialize/outline.d.ts +25 -0
  131. package/out/decoder/serialize/outline.d.ts.map +1 -0
  132. package/out/decoder/serialize/outline.js +37 -0
  133. package/out/decoder/serialize/outline.js.map +1 -0
  134. package/out/decoder/types.d.ts +8 -0
  135. package/out/decoder/types.d.ts.map +1 -1
  136. package/out/decoder/types.js +1 -1
  137. package/out/decoder/types.js.map +1 -1
  138. package/out/decoder.d.ts +1 -0
  139. package/out/decoder.d.ts.map +1 -1
  140. package/out/decoder.js +1 -0
  141. package/out/decoder.js.map +1 -1
  142. package/out/env/schema.d.ts +1 -0
  143. package/out/env/schema.d.ts.map +1 -1
  144. package/out/env/schema.js +4 -0
  145. package/out/env/schema.js.map +1 -1
  146. package/out/env.d.ts +1 -0
  147. package/out/env.d.ts.map +1 -1
  148. package/out/fs/deflate64.js +1 -1
  149. package/out/fs/deflate64.js.map +1 -1
  150. package/out/fs/lock.d.ts +73 -4
  151. package/out/fs/lock.d.ts.map +1 -1
  152. package/out/fs/lock.js +96 -19
  153. package/out/fs/lock.js.map +1 -1
  154. package/out/fs/readers.js +1 -1
  155. package/out/fs/readers.js.map +1 -1
  156. package/out/fs/writers.d.ts +1 -1
  157. package/out/fs/writers.d.ts.map +1 -1
  158. package/out/fs/writers.js +1 -1
  159. package/out/fs/writers.js.map +1 -1
  160. package/out/geocode/result.d.ts +25 -1
  161. package/out/geocode/result.d.ts.map +1 -1
  162. package/out/geocode/result.js +49 -6
  163. package/out/geocode/result.js.map +1 -1
  164. package/out/html/text.js +2 -2
  165. package/out/html/trust-policies.d.ts.map +1 -0
  166. package/out/html/trust-policies.js.map +1 -0
  167. package/out/index.d.ts +0 -1
  168. package/out/index.d.ts.map +1 -1
  169. package/out/index.js +0 -1
  170. package/out/index.js.map +1 -1
  171. package/out/layers/artifact.js +2 -2
  172. package/out/layers/artifact.js.map +1 -1
  173. package/out/layers/coverage.d.ts.map +1 -1
  174. package/out/layers/coverage.js +1 -1
  175. package/out/layers/coverage.js.map +1 -1
  176. package/out/layers/manifest.d.ts +53 -0
  177. package/out/layers/manifest.d.ts.map +1 -1
  178. package/out/layers/manifest.js +68 -2
  179. package/out/layers/manifest.js.map +1 -1
  180. package/out/layers/provenance.d.ts +127 -0
  181. package/out/layers/provenance.d.ts.map +1 -0
  182. package/out/layers/provenance.js +122 -0
  183. package/out/layers/provenance.js.map +1 -0
  184. package/out/layers/publication.d.ts.map +1 -1
  185. package/out/layers/publication.js +3 -3
  186. package/out/layers/publication.js.map +1 -1
  187. package/out/layers/selection.d.ts.map +1 -1
  188. package/out/layers/selection.js +2 -2
  189. package/out/layers/selection.js.map +1 -1
  190. package/out/license/branch.d.ts +33 -0
  191. package/out/license/branch.d.ts.map +1 -0
  192. package/out/license/branch.js +52 -0
  193. package/out/license/branch.js.map +1 -0
  194. package/out/license/configured.d.ts +1 -1
  195. package/out/license/configured.d.ts.map +1 -1
  196. package/out/license/configured.js +1 -9
  197. package/out/license/configured.js.map +1 -1
  198. package/out/license/declaration.d.ts +1 -1
  199. package/out/license/declaration.d.ts.map +1 -1
  200. package/out/license/key/file.js +1 -1
  201. package/out/license/key/file.js.map +1 -1
  202. package/out/license/key.d.ts +27 -115
  203. package/out/license/key.d.ts.map +1 -1
  204. package/out/license/key.js +98 -164
  205. package/out/license/key.js.map +1 -1
  206. package/out/license/provenance.d.ts +47 -0
  207. package/out/license/provenance.d.ts.map +1 -0
  208. package/out/license/provenance.js +134 -0
  209. package/out/license/provenance.js.map +1 -0
  210. package/out/license/register.d.ts +6 -47
  211. package/out/license/register.d.ts.map +1 -1
  212. package/out/license/register.js +7 -58
  213. package/out/license/register.js.map +1 -1
  214. package/out/license/stamp.d.ts +7 -1
  215. package/out/license/stamp.d.ts.map +1 -1
  216. package/out/license/stamp.js +2 -2
  217. package/out/license/stamp.js.map +1 -1
  218. package/out/license/text-url.d.ts +9 -0
  219. package/out/license/text-url.d.ts.map +1 -0
  220. package/out/license/text-url.js +49 -0
  221. package/out/license/text-url.js.map +1 -0
  222. package/out/license/training.d.ts +29 -0
  223. package/out/license/training.d.ts.map +1 -0
  224. package/out/license/training.js +52 -0
  225. package/out/license/training.js.map +1 -0
  226. package/out/license.d.ts +7 -6
  227. package/out/license.d.ts.map +1 -1
  228. package/out/license.js +7 -6
  229. package/out/license.js.map +1 -1
  230. package/out/locale/registry.d.ts.map +1 -1
  231. package/out/locale/registry.js +1 -1
  232. package/out/locale/registry.js.map +1 -1
  233. package/out/locale/zh-cn-units.js +1 -1
  234. package/out/locale/zh-cn-units.js.map +1 -1
  235. package/out/math/numeric.d.ts.map +1 -0
  236. package/out/math/numeric.js.map +1 -0
  237. package/out/math/random.d.ts.map +1 -0
  238. package/out/math/random.js.map +1 -0
  239. package/out/math/stats.d.ts.map +1 -0
  240. package/out/math/stats.js.map +1 -0
  241. package/out/module/workspace.js +1 -1
  242. package/out/module/workspace.js.map +1 -1
  243. package/out/network/routing.d.ts.map +1 -0
  244. package/out/{routing.js → network/routing.js} +1 -1
  245. package/out/network/routing.js.map +1 -0
  246. package/out/pipeline/result.d.ts +7 -25
  247. package/out/pipeline/result.d.ts.map +1 -1
  248. package/out/pipeline/runtime-pipeline.d.ts +8 -4
  249. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  250. package/out/pipeline/runtime-pipeline.js +56 -109
  251. package/out/pipeline/runtime-pipeline.js.map +1 -1
  252. package/out/pipeline/stage.d.ts +180 -0
  253. package/out/pipeline/stage.d.ts.map +1 -0
  254. package/out/pipeline/stage.js +130 -0
  255. package/out/pipeline/stage.js.map +1 -0
  256. package/out/pipeline/types.d.ts +146 -20
  257. package/out/pipeline/types.d.ts.map +1 -1
  258. package/out/pipeline/types.js +24 -8
  259. package/out/pipeline/types.js.map +1 -1
  260. package/out/pipeline.d.ts +5 -3
  261. package/out/pipeline.d.ts.map +1 -1
  262. package/out/pipeline.js +2 -1
  263. package/out/pipeline.js.map +1 -1
  264. package/out/{git.d.ts → repo/git.d.ts} +10 -1
  265. package/out/repo/git.d.ts.map +1 -0
  266. package/out/{git.js → repo/git.js} +14 -1
  267. package/out/repo/git.js.map +1 -0
  268. package/out/{release-config.d.ts → repo/release-config.d.ts} +8 -0
  269. package/out/repo/release-config.d.ts.map +1 -0
  270. package/out/repo/release-config.js.map +1 -0
  271. package/out/{scope-config.d.ts → repo/scope-config.d.ts} +8 -23
  272. package/out/repo/scope-config.d.ts.map +1 -0
  273. package/out/{scope-config.js → repo/scope-config.js} +0 -17
  274. package/out/repo/scope-config.js.map +1 -0
  275. package/out/repo/spdx-header.d.ts.map +1 -0
  276. package/out/{spdx-header.js → repo/spdx-header.js} +7 -0
  277. package/out/repo/spdx-header.js.map +1 -0
  278. package/out/repo/vale.d.ts.map +1 -0
  279. package/out/repo/vale.js.map +1 -0
  280. package/out/repo/workspaces.d.ts.map +1 -0
  281. package/out/{workspaces.js → repo/workspaces.js} +1 -1
  282. package/out/repo/workspaces.js.map +1 -0
  283. package/out/resolver/lookup-types.d.ts +1 -1
  284. package/out/resolver/region-database-provider.d.ts +30 -0
  285. package/out/resolver/region-database-provider.d.ts.map +1 -1
  286. package/out/resolver/synthetic-id-ranges.d.ts +46 -4
  287. package/out/resolver/synthetic-id-ranges.d.ts.map +1 -1
  288. package/out/resolver/synthetic-id-ranges.js +66 -4
  289. package/out/resolver/synthetic-id-ranges.js.map +1 -1
  290. package/out/resolver/types.d.ts +201 -7
  291. package/out/resolver/types.d.ts.map +1 -1
  292. package/out/resolver/types.js +57 -0
  293. package/out/resolver/types.js.map +1 -1
  294. package/out/resolver.d.ts +3 -3
  295. package/out/resolver.d.ts.map +1 -1
  296. package/out/resolver.js +1 -1
  297. package/out/resolver.js.map +1 -1
  298. package/out/scripting/process.d.ts.map +1 -0
  299. package/out/scripting/process.js.map +1 -0
  300. package/out/scripting/workers.d.ts.map +1 -0
  301. package/out/scripting/workers.js.map +1 -0
  302. package/out/state-machine.d.ts +1 -1
  303. package/out/strings/python-json.d.ts +12 -1
  304. package/out/strings/python-json.d.ts.map +1 -1
  305. package/out/strings/python-json.js +9 -4
  306. package/out/strings/python-json.js.map +1 -1
  307. package/out/tokenization/Span.d.ts +11 -0
  308. package/out/tokenization/Span.d.ts.map +1 -1
  309. package/out/tokenization/Span.js.map +1 -1
  310. package/out/tools/build-deflate64-wasm.run.js +2 -2
  311. package/out/tools/build-deflate64-wasm.run.js.map +1 -1
  312. package/out/tools/coarse-placer/build/dataset.js +1 -1
  313. package/out/tools/coarse-placer/build/dataset.js.map +1 -1
  314. package/out/tools/coarse-placer/build/outlier/exposure.js +1 -1
  315. package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
  316. package/out/tools/coarse-placer/build/outlier/latin.d.ts.map +1 -1
  317. package/out/tools/coarse-placer/build/outlier/latin.js +5 -1
  318. package/out/tools/coarse-placer/build/outlier/latin.js.map +1 -1
  319. package/out/tools/coarse-placer/country-sets.d.ts +2 -2
  320. package/out/tools/coarse-placer/country-sets.js +2 -2
  321. package/out/tools/coarse-placer/outlier-rows.js +2 -2
  322. package/out/tools/coarse-placer/outlier-rows.js.map +1 -1
  323. package/out/tools/coarse-placer/train.js +1 -1
  324. package/out/tools/coarse-placer/train.js.map +1 -1
  325. package/out/tools/generate-language-types.js +2 -2
  326. package/out/tools/generate-language-types.js.map +1 -1
  327. package/out/tools/license/product-fixtures.run.d.ts +2 -0
  328. package/out/tools/license/product-fixtures.run.d.ts.map +1 -0
  329. package/out/tools/license/product-fixtures.run.js +350 -0
  330. package/out/tools/license/product-fixtures.run.js.map +1 -0
  331. package/out/utils/chunk-process.js +2 -2
  332. package/out/utils/chunk-process.js.map +1 -1
  333. package/out/utils/geodatabase-archive.js +1 -1
  334. package/out/utils/geodatabase-archive.js.map +1 -1
  335. package/out/utils/time.d.ts +46 -3
  336. package/out/utils/time.d.ts.map +1 -1
  337. package/out/utils/time.js +139 -6
  338. package/out/utils/time.js.map +1 -1
  339. package/out/utils.d.ts +4 -4
  340. package/out/utils.d.ts.map +1 -1
  341. package/out/utils.js +4 -4
  342. package/out/utils.js.map +1 -1
  343. package/out/values/identical.d.ts.map +1 -0
  344. package/out/values/identical.js.map +1 -0
  345. package/out/values/json.d.ts.map +1 -0
  346. package/out/values/json.js.map +1 -0
  347. package/out/values/objects.d.ts.map +1 -0
  348. package/out/values/objects.js.map +1 -0
  349. package/package.json +278 -243
  350. package/tools/build-deflate64-wasm.run.ts +2 -2
  351. package/tools/coarse-placer/build/dataset.ts +1 -1
  352. package/tools/coarse-placer/build/outlier/exposure.ts +1 -1
  353. package/tools/coarse-placer/build/outlier/latin.ts +5 -1
  354. package/tools/coarse-placer/country-sets.ts +2 -2
  355. package/tools/coarse-placer/outlier-rows.ts +2 -2
  356. package/tools/coarse-placer/train.ts +1 -1
  357. package/tools/generate-language-types.ts +2 -2
  358. package/tools/license/product-fixtures.run.ts +449 -0
  359. package/lib/collections.ts +0 -5
  360. package/lib/license/decision.ts +0 -329
  361. package/lib/license/obligations.ts +0 -256
  362. package/lib/license/record.ts +0 -277
  363. package/lib/scripting/ingest-chunk-script.ts +0 -87
  364. package/out/binary-frame.d.ts.map +0 -1
  365. package/out/binary-frame.js.map +0 -1
  366. package/out/collections.d.ts +0 -2
  367. package/out/collections.d.ts.map +0 -1
  368. package/out/collections.js +0 -5
  369. package/out/collections.js.map +0 -1
  370. package/out/git.d.ts.map +0 -1
  371. package/out/git.js.map +0 -1
  372. package/out/hash.d.ts.map +0 -1
  373. package/out/hash.js.map +0 -1
  374. package/out/identical.d.ts.map +0 -1
  375. package/out/identical.js.map +0 -1
  376. package/out/json.d.ts.map +0 -1
  377. package/out/json.js.map +0 -1
  378. package/out/license/decision.d.ts +0 -179
  379. package/out/license/decision.d.ts.map +0 -1
  380. package/out/license/decision.js +0 -169
  381. package/out/license/decision.js.map +0 -1
  382. package/out/license/obligations.d.ts +0 -102
  383. package/out/license/obligations.d.ts.map +0 -1
  384. package/out/license/obligations.js +0 -188
  385. package/out/license/obligations.js.map +0 -1
  386. package/out/license/record.d.ts +0 -136
  387. package/out/license/record.d.ts.map +0 -1
  388. package/out/license/record.js +0 -222
  389. package/out/license/record.js.map +0 -1
  390. package/out/load-ledger.d.ts.map +0 -1
  391. package/out/load-ledger.js.map +0 -1
  392. package/out/memoize.d.ts.map +0 -1
  393. package/out/memoize.js.map +0 -1
  394. package/out/numeric.d.ts.map +0 -1
  395. package/out/numeric.js.map +0 -1
  396. package/out/objects.d.ts.map +0 -1
  397. package/out/objects.js.map +0 -1
  398. package/out/overture-pins.d.ts.map +0 -1
  399. package/out/overture-pins.js.map +0 -1
  400. package/out/postcode-prefix-files.d.ts.map +0 -1
  401. package/out/postcode-prefix-files.js.map +0 -1
  402. package/out/process.d.ts.map +0 -1
  403. package/out/process.js.map +0 -1
  404. package/out/promises.d.ts.map +0 -1
  405. package/out/promises.js.map +0 -1
  406. package/out/random.d.ts.map +0 -1
  407. package/out/random.js.map +0 -1
  408. package/out/release-config.d.ts.map +0 -1
  409. package/out/release-config.js.map +0 -1
  410. package/out/routing.d.ts.map +0 -1
  411. package/out/routing.js.map +0 -1
  412. package/out/scope-config.d.ts.map +0 -1
  413. package/out/scope-config.js.map +0 -1
  414. package/out/scripting/ingest-chunk-script.d.ts +0 -58
  415. package/out/scripting/ingest-chunk-script.d.ts.map +0 -1
  416. package/out/scripting/ingest-chunk-script.js +0 -47
  417. package/out/scripting/ingest-chunk-script.js.map +0 -1
  418. package/out/spdx-header.d.ts.map +0 -1
  419. package/out/spdx-header.js.map +0 -1
  420. package/out/stats.d.ts.map +0 -1
  421. package/out/stats.js.map +0 -1
  422. package/out/trust-policies.d.ts.map +0 -1
  423. package/out/trust-policies.js.map +0 -1
  424. package/out/vale.d.ts.map +0 -1
  425. package/out/vale.js.map +0 -1
  426. package/out/workers.d.ts.map +0 -1
  427. package/out/workers.js.map +0 -1
  428. package/out/workspaces.d.ts.map +0 -1
  429. package/out/workspaces.js.map +0 -1
  430. /package/lib/{load-ledger.ts → asset/load-ledger.ts} +0 -0
  431. /package/lib/{overture-pins.ts → asset/overture-pins.ts} +0 -0
  432. /package/lib/{postcode-prefix-files.ts → asset/postcode-prefix-files.ts} +0 -0
  433. /package/lib/{hash.ts → crypto/hash.ts} +0 -0
  434. /package/lib/{trust-policies.ts → html/trust-policies.ts} +0 -0
  435. /package/lib/{numeric.ts → math/numeric.ts} +0 -0
  436. /package/lib/{random.ts → math/random.ts} +0 -0
  437. /package/lib/{stats.ts → math/stats.ts} +0 -0
  438. /package/lib/{vale.ts → repo/vale.ts} +0 -0
  439. /package/lib/{process.ts → scripting/process.ts} +0 -0
  440. /package/lib/{workers.ts → scripting/workers.ts} +0 -0
  441. /package/lib/{identical.ts → values/identical.ts} +0 -0
  442. /package/lib/{json.ts → values/json.ts} +0 -0
  443. /package/lib/{objects.ts → values/objects.ts} +0 -0
  444. /package/out/{binary-frame.d.ts → asset/binary-frame.d.ts} +0 -0
  445. /package/out/{load-ledger.d.ts → asset/load-ledger.d.ts} +0 -0
  446. /package/out/{load-ledger.js → asset/load-ledger.js} +0 -0
  447. /package/out/{overture-pins.d.ts → asset/overture-pins.d.ts} +0 -0
  448. /package/out/{overture-pins.js → asset/overture-pins.js} +0 -0
  449. /package/out/{postcode-prefix-files.d.ts → asset/postcode-prefix-files.d.ts} +0 -0
  450. /package/out/{postcode-prefix-files.js → asset/postcode-prefix-files.js} +0 -0
  451. /package/out/{memoize.d.ts → async/memoize.d.ts} +0 -0
  452. /package/out/{hash.d.ts → crypto/hash.d.ts} +0 -0
  453. /package/out/{hash.js → crypto/hash.js} +0 -0
  454. /package/out/{trust-policies.d.ts → html/trust-policies.d.ts} +0 -0
  455. /package/out/{trust-policies.js → html/trust-policies.js} +0 -0
  456. /package/out/{numeric.d.ts → math/numeric.d.ts} +0 -0
  457. /package/out/{numeric.js → math/numeric.js} +0 -0
  458. /package/out/{random.d.ts → math/random.d.ts} +0 -0
  459. /package/out/{random.js → math/random.js} +0 -0
  460. /package/out/{stats.d.ts → math/stats.d.ts} +0 -0
  461. /package/out/{stats.js → math/stats.js} +0 -0
  462. /package/out/{routing.d.ts → network/routing.d.ts} +0 -0
  463. /package/out/{release-config.js → repo/release-config.js} +0 -0
  464. /package/out/{spdx-header.d.ts → repo/spdx-header.d.ts} +0 -0
  465. /package/out/{vale.d.ts → repo/vale.d.ts} +0 -0
  466. /package/out/{vale.js → repo/vale.js} +0 -0
  467. /package/out/{workspaces.d.ts → repo/workspaces.d.ts} +0 -0
  468. /package/out/{process.d.ts → scripting/process.d.ts} +0 -0
  469. /package/out/{process.js → scripting/process.js} +0 -0
  470. /package/out/{workers.d.ts → scripting/workers.d.ts} +0 -0
  471. /package/out/{workers.js → scripting/workers.js} +0 -0
  472. /package/out/{identical.d.ts → values/identical.d.ts} +0 -0
  473. /package/out/{identical.js → values/identical.js} +0 -0
  474. /package/out/{json.d.ts → values/json.d.ts} +0 -0
  475. /package/out/{json.js → values/json.js} +0 -0
  476. /package/out/{objects.d.ts → values/objects.d.ts} +0 -0
  477. /package/out/{objects.js → values/objects.js} +0 -0
@@ -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
  }
@@ -2,9 +2,10 @@
2
2
  // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
3
 
4
4
  /**
5
- * @file The one registry of synthetic place-id ranges.
5
+ * @file The one registry of synthetic place-id ranges, and of the range `mailwoman` mints WOF records from.
6
6
  *
7
- * A real WOF id is below 2e9. Every other source a gazetteer artifact folds in mints ids from a higher base.
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 whose places a gazetteer artifact adds mints ids from a higher base.
8
9
  * The bases must be pairwise distinct. The candidate table's `candidate_ancestor` and
9
10
  * `candidate_interval` sidecars are keyed only by `spr_id`, a result's `placeID` is `wof:<spr_id>`, and the
10
11
  * backend's `ancestors(id)` answers whichever row wrote last. Two builders that pick the same base give two places
@@ -17,22 +18,93 @@
17
18
  */
18
19
 
19
20
  /**
20
- * Overture-sourced admin rows (`fold-overture`).
21
+ * The first id of the WOF records minted in the `mailwoman` forks, `989 5xx xxxx`.
22
+ *
23
+ * 9895 is the integer code point of `⚧`, so a record's id identifies it as one of ours.
24
+ * The range holds one million ids, above every upstream WOF id and below every synthetic base.
25
+ */
26
+ export const MAILWOMAN_WOF_ID_BASE = 9_895_000_000
27
+
28
+ /**
29
+ * The first id past the `mailwoman` WOF range.
30
+ */
31
+ export const MAILWOMAN_WOF_ID_END = 9_896_000_000
32
+
33
+ /**
34
+ * Reports whether an id was minted in the `mailwoman` WOF range.
35
+ */
36
+ export function isMailwomanWOFID(id: number): boolean {
37
+ return Number.isInteger(id) && id >= MAILWOMAN_WOF_ID_BASE && id < MAILWOMAN_WOF_ID_END
38
+ }
39
+
40
+ /**
41
+ * The next free id in the `mailwoman` WOF range: one past the largest id already
42
+ * minted there, or the range's first id when none is.
43
+ * Ids outside the range are ignored.
44
+ *
45
+ * @throws When the range is exhausted.
46
+ */
47
+ export function nextMailwomanWOFID(minted: Iterable<number>): number {
48
+ let largest = MAILWOMAN_WOF_ID_BASE - 1
49
+
50
+ for (const id of minted) {
51
+ if (isMailwomanWOFID(id) && id > largest) {
52
+ largest = id
53
+ }
54
+ }
55
+
56
+ const next = largest + 1
57
+
58
+ if (next >= MAILWOMAN_WOF_ID_END) throw new Error(`the mailwoman WOF id range ends at ${MAILWOMAN_WOF_ID_END - 1}`)
59
+
60
+ return next
61
+ }
62
+
63
+ /**
64
+ * Overture-sourced admin rows (`add-overture`).
21
65
  *
22
66
  * Above any real WOF id.
23
67
  */
24
68
  export const OVERTURE_ID_BASE = 8_000_000_000_000
25
69
 
26
70
  /**
27
- * The GeoNames alias fold (`@mailwoman/resolver-wof-sqlite/geonames`).
71
+ * The places and aliases the GeoNames step adds (`@mailwoman/resolver-wof-sqlite/geonames`).
28
72
  */
29
73
  export const GEONAMES_ID_BASE = 9_000_000_000_000
30
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
+
31
85
  /**
32
86
  * GeoNames postal rows (`@mailwoman/resolver-wof-sqlite/geonames`).
33
87
  */
34
88
  export const GEONAMES_POSTAL_ID_BASE = 9_500_000_000_000
35
89
 
90
+ /**
91
+ * The id the GeoNames step gives the place GeoNames numbers `geonameid`:
92
+ * {@link GEONAMES_ID_BASE} plus that number.
93
+ *
94
+ * The id is computed from the GeoNames record's own number.
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.
97
+ *
98
+ * @throws When `geonameid` isn't a positive integer below the GeoNames range's width.
99
+ */
100
+ export function geonamesPlaceID(geonameid: number): number {
101
+ if (!Number.isInteger(geonameid) || geonameid <= 0 || geonameid >= GEONAMES_POSTAL_ID_BASE - GEONAMES_ID_BASE) {
102
+ throw new RangeError(`geonameid ${geonameid} falls outside the GeoNames id range`)
103
+ }
104
+
105
+ return GEONAMES_ID_BASE + geonameid
106
+ }
107
+
36
108
  /**
37
109
  * The Dutch PC6 postcode database (`gazetteer build nl-pc6`).
38
110
  */
@@ -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
  /**
@@ -277,6 +428,10 @@ export interface ResolveSwitches {
277
428
  includeAncestors: boolean
278
429
  adminContainmentRerank: boolean
279
430
  dependentLocalityContainment: boolean
431
+ countyDesignatorFallback: boolean
432
+ formerDivisions: boolean
433
+ scopeCountryRetrieval: boolean
434
+ siblingLocalityContainment: boolean
280
435
  diagnoseUnreachable: boolean
281
436
  }
282
437
 
@@ -297,6 +452,10 @@ export const RESOLVE_SWITCH_DEFAULTS: Readonly<ResolveSwitches> = {
297
452
  includeAncestors: false,
298
453
  adminContainmentRerank: true,
299
454
  dependentLocalityContainment: true,
455
+ countyDesignatorFallback: false,
456
+ formerDivisions: false,
457
+ scopeCountryRetrieval: false,
458
+ siblingLocalityContainment: false,
300
459
  diagnoseUnreachable: false,
301
460
  }
302
461
 
@@ -327,7 +486,7 @@ export interface ResolveOpts {
327
486
  */
328
487
  candidatesPerLookup?: number
329
488
  /**
330
- * Default top-level country scope, and who chose it.
489
+ * Default top-level country scope, who chose it, and whether it filters or ranks.
331
490
  */
332
491
  defaultCountry?: DefaultCountry
333
492
  /**
@@ -361,13 +520,17 @@ export interface ResolveOpts {
361
520
  */
362
521
  anchorWeight?: number
363
522
  /**
364
- * 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)
365
526
  */
366
- localeCountryPrior?: string
527
+ softCountryWeight?: number
367
528
  /**
368
- * 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.
369
532
  */
370
- localeCountryPriorWeight?: number
533
+ parentPlace?: ParentPlaceScope
371
534
  /**
372
535
  * Optional capital-level callback.
373
536
  */
@@ -522,6 +685,56 @@ export interface ResolveOpts {
522
685
  * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
523
686
  */
524
687
  dependentLocalityContainment?: boolean
688
+ /**
689
+ * Looks a `locality` span up as a WOF `county` in its resolved region
690
+ * when no locality of that name is there and the value is written with
691
+ * its country's county designator (`Harris County`, `Jefferson Parish`),
692
+ * from `countyNameWithoutDesignator` in `@mailwoman/codex/designators/county`.
693
+ *
694
+ * @defaultValue {@linkcode RESOLVE_SWITCH_DEFAULTS}
695
+ */
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
525
738
  /**
526
739
  * Optional sink for resolver-internal trace records.
527
740
  */
@@ -545,7 +758,17 @@ export interface ResolveCandidateTrace {
545
758
  */
546
759
  country: string | null
547
760
  placetype: string
761
+ /**
762
+ * The ranking key the stages compared.
763
+ * It is unmeasured when `scoreUnmeasured` is set.
764
+ */
548
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
549
772
  prominence: number | null
550
773
  importance: number | null
551
774
  population: number | null
@@ -595,6 +818,8 @@ export interface ResolveNodeTrace {
595
818
  | "empty_admin"
596
819
  | "span_rescore"
597
820
  | "postal_compound_recovery"
821
+ | "county_designator_fallback"
822
+ | "sibling_locality_containment"
598
823
  } | null
599
824
  }
600
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 {
@@ -55,7 +55,7 @@ export interface StateMachine<
55
55
  /**
56
56
  * One event for each case the transition distinguishes, keyed by a label for that case.
57
57
  *
58
- * The effects register applies every event to every state to print the machine's
58
+ * `yarn mwops effects` applies every event to every state to print the machine's
59
59
  * transition table, and a test can assert the same table.
60
60
  */
61
61
  readonly events?: Readonly<Record<string, TEvent>>
@@ -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 { stringifyJSON } from "#json"
4
+ import { stringifyJSON } from "#values/json"
5
5
 
6
6
  /**
7
7
  * Python's one-line `json.dumps`, kept for the two hashes whose recorded
@@ -11,7 +11,12 @@ import { stringifyJSON } from "#json"
11
11
  * the encoder-parity records store it, so a sampler change verifies against the 15 records.
12
12
  * The DeepSeek transliteration batch id in `packages/corpus/lib/recipes/deepseek/batches.ts` hashes the
13
13
  * seed ids as the first requested batches did, so a resumed run skips the batches already requested.
14
- * New output uses `orderedJSON` from `@mailwoman/core/json`.
14
+ *
15
+ * New output uses `orderedJSON` from `@mailwoman/core/values/json`.
16
+ *
17
+ * {@linkcode pythonJSONString} also prints the strings of a Who's On First
18
+ * record (`@mailwoman/gazetteer/tools/pipeline/wof/record`).
19
+ * The WOF exporter is a Python `json` writer.
15
20
  */
16
21
 
17
22
  /**
@@ -25,7 +30,12 @@ export interface PythonJSONOptions {
25
30
  ensureASCII?: boolean
26
31
  }
27
32
 
28
- function pythonString(value: string, ensureASCII: boolean): string {
33
+ /**
34
+ * One string as Python's `json.dumps` writes it, with `ensure_ascii` on unless `ensureASCII` is false.
35
+ *
36
+ * The WOF record writer prints every string through it, because the WOF exporter is a Python `json` writer.
37
+ */
38
+ export function pythonJSONString(value: string, ensureASCII = true): string {
29
39
  // JSON.stringify escapes the quote, the backslash and the C0 controls as Python's json does.
30
40
  // Python's `ensure_ascii` also escapes DEL and every code unit above it, one `\uXXXX` per UTF-16 unit.
31
41
  const out = stringifyJSON(value)
@@ -55,7 +65,7 @@ function pythonValue(value: unknown, options: Required<PythonJSONOptions>): stri
55
65
  return Object.is(value, -0) ? "0" : String(value)
56
66
  }
57
67
 
58
- if (typeof value === "string") return pythonString(value, options.ensureASCII)
68
+ if (typeof value === "string") return pythonJSONString(value, options.ensureASCII)
59
69
 
60
70
  if (Array.isArray(value)) return `[${value.map((item) => pythonValue(item, options)).join(", ")}]`
61
71
 
@@ -67,7 +77,7 @@ function pythonValue(value: unknown, options: Required<PythonJSONOptions>): stri
67
77
  }
68
78
 
69
79
  const items = entries.map(
70
- ([key, item]) => `${pythonString(key, options.ensureASCII)}: ${pythonValue(item, options)}`
80
+ ([key, item]) => `${pythonJSONString(key, options.ensureASCII)}: ${pythonValue(item, options)}`
71
81
  )
72
82
 
73
83
  return `{${items.join(", ")}}`
@@ -18,6 +18,18 @@ import { type Classification, type ClassificationMatch, ClassificationsMatchMap
18
18
 
19
19
  const MAX_SPAN_LENGTH = 140
20
20
 
21
+ /**
22
+ * A piece of text with half-open UTF-16 offsets into the string it was read from.
23
+ *
24
+ * It is the plain shape that tokenizers hand to alignment code, and unlike a
25
+ * {@link Span} it holds no classifications or children.
26
+ */
27
+ export interface TextFragment {
28
+ text: string
29
+ start: number
30
+ end: number
31
+ }
32
+
21
33
  export interface SpanCreationOptions {
22
34
  start?: number
23
35
  classifications?: Iterable<Classification>
@@ -26,8 +26,8 @@
26
26
 
27
27
  import { TextSpliterator } from "spliterator"
28
28
 
29
- import { parseJSONStrict } from "#json"
30
- import { spawnProcess } from "#process"
29
+ import { spawnProcess } from "#scripting/process"
30
+ import { parseJSONStrict } from "#values/json"
31
31
 
32
32
  export interface RunChunkProcessOptions {
33
33
  /**
@@ -18,7 +18,7 @@ import { PathBuilder, type PathBuilderLike } from "path-ts"
18
18
 
19
19
  import { tryStat } from "#fs/readers/stat"
20
20
  import { makeDirectories } from "#fs/writers"
21
- import { runFile } from "#process"
21
+ import { runFile } from "#scripting/process"
22
22
  import { streamToDisk } from "#utils/stream-to-disk"
23
23
 
24
24
  /**