@mailwoman/core 10.1.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/lib/api/APIClient.ts +5 -6
  2. package/lib/api/arcgis.ts +5 -5
  3. package/lib/api/ckan.ts +2 -1
  4. package/lib/api/disk-storage.ts +3 -3
  5. package/lib/api/ogc.ts +56 -52
  6. package/lib/api/pacer.ts +1 -1
  7. package/lib/api/retry.ts +6 -4
  8. package/lib/api/test/transport.ts +20 -20
  9. package/lib/api.ts +1 -0
  10. package/lib/coarse-placer/coarse-placer.ts +4 -3
  11. package/lib/crypto/node.ts +1 -2
  12. package/lib/decoder/build-tree.ts +5 -5
  13. package/lib/decoder/parse-diff.ts +47 -31
  14. package/lib/decoder/proposals-to-tree.ts +1 -0
  15. package/lib/decoder/serialize/json.ts +9 -6
  16. package/lib/decoder/serialize/tuples.ts +2 -1
  17. package/lib/decoder/serialize/xml.ts +15 -14
  18. package/lib/decoder/tree/shape.ts +14 -14
  19. package/lib/decoder/tree/walk.ts +2 -2
  20. package/lib/decoder/types.ts +48 -2
  21. package/lib/env/schema.ts +21 -23
  22. package/lib/env/utils.ts +4 -3
  23. package/lib/env.ts +4 -4
  24. package/lib/fs/delimited.ts +35 -1
  25. package/lib/fs/readers.ts +2 -5
  26. package/lib/fs/zip.ts +1 -1
  27. package/lib/geocode/result.ts +337 -0
  28. package/lib/git.ts +1 -1
  29. package/lib/html/document.ts +6 -6
  30. package/lib/html/elements.ts +26 -23
  31. package/lib/identical.ts +20 -0
  32. package/lib/json.ts +5 -7
  33. package/lib/layers/coverage.ts +28 -1
  34. package/lib/layers/feature-count.ts +3 -3
  35. package/lib/layers/manifest.ts +22 -21
  36. package/lib/layers/schema.ts +25 -1
  37. package/lib/license/configured.ts +3 -3
  38. package/lib/license/key/file.ts +2 -1
  39. package/lib/license/key.ts +3 -3
  40. package/lib/license/stamp.ts +4 -4
  41. package/lib/locale/locale.ts +1 -1
  42. package/lib/locale/registry.ts +2 -2
  43. package/lib/module/compiled-freshness.ts +1 -1
  44. package/lib/module/package-command.ts +4 -2
  45. package/lib/module/packaged-data.ts +1 -1
  46. package/lib/module/resolve-from.ts +1 -1
  47. package/lib/numeric.ts +4 -4
  48. package/lib/objects.ts +3 -0
  49. package/lib/paths.ts +16 -1
  50. package/lib/pipeline/client-result.ts +14 -14
  51. package/lib/pipeline/result.ts +5 -4
  52. package/lib/pipeline/runtime-pipeline.ts +65 -42
  53. package/lib/pipeline/span-proposer.ts +1 -1
  54. package/lib/pipeline/types.ts +328 -161
  55. package/lib/pipeline.ts +32 -7
  56. package/lib/policy/proposal-collection.ts +1 -1
  57. package/lib/policy/registry.ts +5 -3
  58. package/lib/resolver/authoritative-provider.ts +17 -17
  59. package/lib/resolver/coverage-facts.ts +3 -3
  60. package/lib/resolver/fixture-authoritative-provider.ts +4 -0
  61. package/lib/resolver/lookup-types.ts +54 -14
  62. package/lib/resolver/postcode-format.ts +9 -9
  63. package/lib/resolver/referential.ts +2 -2
  64. package/lib/resolver/types.ts +155 -51
  65. package/lib/resolver.ts +22 -20
  66. package/lib/resources/git.ts +1 -1
  67. package/lib/resources/languages.ts +0 -2
  68. package/lib/resources/libpostal.ts +1 -1
  69. package/lib/resources/whosonfirst/PlacetypeDataSource.ts +2 -6
  70. package/lib/resources/whosonfirst/extract-repo.ts +2 -1
  71. package/lib/resources/whosonfirst/placetypes/admin.ts +20 -25
  72. package/lib/resources/whosonfirst/placetypes/mermaid.ts +4 -3
  73. package/lib/resources/whosonfirst/placetypes/specificity.ts +7 -7
  74. package/lib/resources.ts +1 -0
  75. package/lib/scripting/arguments.ts +6 -5
  76. package/lib/scripting/command.ts +3 -2
  77. package/lib/scripting/operation.ts +2 -2
  78. package/lib/scripting/utils.ts +3 -5
  79. package/lib/strings/python-json.ts +1 -1
  80. package/lib/tokenization/Span.ts +1 -1
  81. package/lib/trust-policies.ts +0 -2
  82. package/lib/types/Classification.ts +1 -1
  83. package/lib/types/classifier.ts +1 -1
  84. package/lib/utils/geodatabase-archive.ts +13 -5
  85. package/lib/utils/sqlite-rows.ts +3 -3
  86. package/lib/utils/stream-to-disk.ts +1 -3
  87. package/lib/utils/union-find.ts +1 -1
  88. package/lib/vale.ts +1 -1
  89. package/lib/workspaces.ts +2 -2
  90. package/out/api/APIClient.d.ts +3 -3
  91. package/out/api/APIClient.d.ts.map +1 -1
  92. package/out/api/APIClient.js +2 -3
  93. package/out/api/APIClient.js.map +1 -1
  94. package/out/api/arcgis.d.ts +2 -2
  95. package/out/api/arcgis.d.ts.map +1 -1
  96. package/out/api/arcgis.js +6 -6
  97. package/out/api/arcgis.js.map +1 -1
  98. package/out/api/ckan.d.ts +2 -1
  99. package/out/api/ckan.d.ts.map +1 -1
  100. package/out/api/ckan.js.map +1 -1
  101. package/out/api/disk-storage.d.ts +1 -1
  102. package/out/api/disk-storage.js +2 -2
  103. package/out/api/disk-storage.js.map +1 -1
  104. package/out/api/ogc.d.ts +32 -27
  105. package/out/api/ogc.d.ts.map +1 -1
  106. package/out/api/ogc.js +41 -46
  107. package/out/api/ogc.js.map +1 -1
  108. package/out/api/pacer.d.ts +1 -1
  109. package/out/api/pacer.js +1 -1
  110. package/out/api/retry.d.ts +6 -4
  111. package/out/api/retry.d.ts.map +1 -1
  112. package/out/api/retry.js +1 -1
  113. package/out/api/retry.js.map +1 -1
  114. package/out/api/test/transport.d.ts +11 -11
  115. package/out/api/test/transport.d.ts.map +1 -1
  116. package/out/api/test/transport.js +16 -16
  117. package/out/api/test/transport.js.map +1 -1
  118. package/out/api.d.ts +1 -0
  119. package/out/api.d.ts.map +1 -1
  120. package/out/api.js +1 -0
  121. package/out/api.js.map +1 -1
  122. package/out/coarse-placer/coarse-placer.d.ts +3 -2
  123. package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
  124. package/out/coarse-placer/coarse-placer.js +1 -1
  125. package/out/coarse-placer/coarse-placer.js.map +1 -1
  126. package/out/crypto/node.d.ts +1 -2
  127. package/out/crypto/node.d.ts.map +1 -1
  128. package/out/crypto/node.js +1 -2
  129. package/out/crypto/node.js.map +1 -1
  130. package/out/decoder/build-tree.js +5 -5
  131. package/out/decoder/build-tree.js.map +1 -1
  132. package/out/decoder/parse-diff.d.ts +19 -19
  133. package/out/decoder/parse-diff.d.ts.map +1 -1
  134. package/out/decoder/parse-diff.js +28 -12
  135. package/out/decoder/parse-diff.js.map +1 -1
  136. package/out/decoder/proposals-to-tree.d.ts.map +1 -1
  137. package/out/decoder/proposals-to-tree.js +1 -0
  138. package/out/decoder/proposals-to-tree.js.map +1 -1
  139. package/out/decoder/serialize/json.d.ts +35 -17
  140. package/out/decoder/serialize/json.d.ts.map +1 -1
  141. package/out/decoder/serialize/json.js +28 -0
  142. package/out/decoder/serialize/json.js.map +1 -1
  143. package/out/decoder/serialize/tuples.d.ts +2 -1
  144. package/out/decoder/serialize/tuples.d.ts.map +1 -1
  145. package/out/decoder/serialize/tuples.js.map +1 -1
  146. package/out/decoder/serialize/xml.d.ts +12 -11
  147. package/out/decoder/serialize/xml.d.ts.map +1 -1
  148. package/out/decoder/serialize/xml.js +3 -3
  149. package/out/decoder/serialize/xml.js.map +1 -1
  150. package/out/decoder/tree/shape.d.ts +6 -6
  151. package/out/decoder/tree/shape.d.ts.map +1 -1
  152. package/out/decoder/tree/shape.js +8 -8
  153. package/out/decoder/tree/shape.js.map +1 -1
  154. package/out/decoder/tree/walk.d.ts +1 -1
  155. package/out/decoder/tree/walk.d.ts.map +1 -1
  156. package/out/decoder/tree/walk.js +1 -1
  157. package/out/decoder/tree/walk.js.map +1 -1
  158. package/out/decoder/types.d.ts +55 -2
  159. package/out/decoder/types.d.ts.map +1 -1
  160. package/out/decoder/types.js +39 -1
  161. package/out/decoder/types.js.map +1 -1
  162. package/out/env/schema.d.ts +11 -12
  163. package/out/env/schema.d.ts.map +1 -1
  164. package/out/env/schema.js +15 -17
  165. package/out/env/schema.js.map +1 -1
  166. package/out/env/utils.d.ts +2 -2
  167. package/out/env/utils.d.ts.map +1 -1
  168. package/out/env/utils.js +2 -2
  169. package/out/env/utils.js.map +1 -1
  170. package/out/env.js +4 -4
  171. package/out/env.js.map +1 -1
  172. package/out/fs/delimited.d.ts +18 -0
  173. package/out/fs/delimited.d.ts.map +1 -1
  174. package/out/fs/delimited.js +31 -1
  175. package/out/fs/delimited.js.map +1 -1
  176. package/out/fs/readers.d.ts +2 -4
  177. package/out/fs/readers.d.ts.map +1 -1
  178. package/out/fs/readers.js +2 -4
  179. package/out/fs/readers.js.map +1 -1
  180. package/out/fs/zip.js +1 -1
  181. package/out/fs/zip.js.map +1 -1
  182. package/out/geocode/result.d.ts +475 -0
  183. package/out/geocode/result.d.ts.map +1 -0
  184. package/out/geocode/result.js +280 -0
  185. package/out/geocode/result.js.map +1 -0
  186. package/out/git.js +1 -1
  187. package/out/git.js.map +1 -1
  188. package/out/html/document.d.ts +3 -3
  189. package/out/html/document.d.ts.map +1 -1
  190. package/out/html/document.js +4 -4
  191. package/out/html/document.js.map +1 -1
  192. package/out/html/elements.d.ts +18 -15
  193. package/out/html/elements.d.ts.map +1 -1
  194. package/out/html/elements.js +17 -16
  195. package/out/html/elements.js.map +1 -1
  196. package/out/identical.d.ts +16 -0
  197. package/out/identical.d.ts.map +1 -0
  198. package/out/identical.js +19 -0
  199. package/out/identical.js.map +1 -0
  200. package/out/json.d.ts +3 -5
  201. package/out/json.d.ts.map +1 -1
  202. package/out/json.js +3 -5
  203. package/out/json.js.map +1 -1
  204. package/out/layers/coverage.d.ts +26 -1
  205. package/out/layers/coverage.d.ts.map +1 -1
  206. package/out/layers/coverage.js.map +1 -1
  207. package/out/layers/feature-count.d.ts +1 -1
  208. package/out/layers/feature-count.d.ts.map +1 -1
  209. package/out/layers/feature-count.js +2 -2
  210. package/out/layers/feature-count.js.map +1 -1
  211. package/out/layers/manifest.d.ts +11 -10
  212. package/out/layers/manifest.d.ts.map +1 -1
  213. package/out/layers/manifest.js +12 -13
  214. package/out/layers/manifest.js.map +1 -1
  215. package/out/layers/schema.d.ts +23 -0
  216. package/out/layers/schema.d.ts.map +1 -1
  217. package/out/layers/schema.js +1 -1
  218. package/out/layers/schema.js.map +1 -1
  219. package/out/license/configured.d.ts +1 -1
  220. package/out/license/configured.d.ts.map +1 -1
  221. package/out/license/configured.js +2 -2
  222. package/out/license/configured.js.map +1 -1
  223. package/out/license/key/file.d.ts.map +1 -1
  224. package/out/license/key/file.js +2 -1
  225. package/out/license/key/file.js.map +1 -1
  226. package/out/license/key.d.ts +1 -1
  227. package/out/license/key.d.ts.map +1 -1
  228. package/out/license/key.js +2 -2
  229. package/out/license/key.js.map +1 -1
  230. package/out/license/stamp.d.ts +2 -2
  231. package/out/license/stamp.d.ts.map +1 -1
  232. package/out/license/stamp.js +2 -2
  233. package/out/license/stamp.js.map +1 -1
  234. package/out/locale/locale.d.ts +1 -1
  235. package/out/locale/locale.d.ts.map +1 -1
  236. package/out/locale/registry.d.ts +1 -1
  237. package/out/locale/registry.d.ts.map +1 -1
  238. package/out/locale/registry.js +1 -1
  239. package/out/locale/registry.js.map +1 -1
  240. package/out/module/compiled-freshness.js +1 -1
  241. package/out/module/compiled-freshness.js.map +1 -1
  242. package/out/module/package-command.d.ts +3 -2
  243. package/out/module/package-command.d.ts.map +1 -1
  244. package/out/module/package-command.js +3 -2
  245. package/out/module/package-command.js.map +1 -1
  246. package/out/module/packaged-data.js +1 -1
  247. package/out/module/packaged-data.js.map +1 -1
  248. package/out/module/resolve-from.js +1 -1
  249. package/out/module/resolve-from.js.map +1 -1
  250. package/out/numeric.d.ts +1 -1
  251. package/out/numeric.d.ts.map +1 -1
  252. package/out/numeric.js +3 -3
  253. package/out/numeric.js.map +1 -1
  254. package/out/objects.d.ts +3 -0
  255. package/out/objects.d.ts.map +1 -1
  256. package/out/objects.js +3 -0
  257. package/out/objects.js.map +1 -1
  258. package/out/paths.d.ts +20 -1
  259. package/out/paths.d.ts.map +1 -1
  260. package/out/paths.js +1 -1
  261. package/out/paths.js.map +1 -1
  262. package/out/pipeline/client-result.d.ts +15 -15
  263. package/out/pipeline/client-result.d.ts.map +1 -1
  264. package/out/pipeline/client-result.js +1 -1
  265. package/out/pipeline/result.d.ts +4 -3
  266. package/out/pipeline/result.d.ts.map +1 -1
  267. package/out/pipeline/runtime-pipeline.d.ts +16 -9
  268. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  269. package/out/pipeline/runtime-pipeline.js +43 -27
  270. package/out/pipeline/runtime-pipeline.js.map +1 -1
  271. package/out/pipeline/span-proposer.js +1 -1
  272. package/out/pipeline/span-proposer.js.map +1 -1
  273. package/out/pipeline/types.d.ts +394 -175
  274. package/out/pipeline/types.d.ts.map +1 -1
  275. package/out/pipeline/types.js +199 -4
  276. package/out/pipeline/types.js.map +1 -1
  277. package/out/pipeline.d.ts +4 -2
  278. package/out/pipeline.d.ts.map +1 -1
  279. package/out/pipeline.js +1 -1
  280. package/out/pipeline.js.map +1 -1
  281. package/out/policy/proposal-collection.d.ts +1 -1
  282. package/out/policy/proposal-collection.d.ts.map +1 -1
  283. package/out/policy/proposal-collection.js.map +1 -1
  284. package/out/policy/registry.d.ts +3 -1
  285. package/out/policy/registry.d.ts.map +1 -1
  286. package/out/policy/registry.js +4 -2
  287. package/out/policy/registry.js.map +1 -1
  288. package/out/resolver/authoritative-provider.d.ts +17 -17
  289. package/out/resolver/authoritative-provider.d.ts.map +1 -1
  290. package/out/resolver/authoritative-provider.js +2 -2
  291. package/out/resolver/coverage-facts.d.ts +3 -3
  292. package/out/resolver/coverage-facts.d.ts.map +1 -1
  293. package/out/resolver/fixture-authoritative-provider.d.ts.map +1 -1
  294. package/out/resolver/fixture-authoritative-provider.js +4 -0
  295. package/out/resolver/fixture-authoritative-provider.js.map +1 -1
  296. package/out/resolver/lookup-types.d.ts +52 -15
  297. package/out/resolver/lookup-types.d.ts.map +1 -1
  298. package/out/resolver/postcode-format.d.ts +3 -3
  299. package/out/resolver/postcode-format.d.ts.map +1 -1
  300. package/out/resolver/postcode-format.js +7 -7
  301. package/out/resolver/postcode-format.js.map +1 -1
  302. package/out/resolver/referential.d.ts +2 -2
  303. package/out/resolver/referential.d.ts.map +1 -1
  304. package/out/resolver/types.d.ts +126 -40
  305. package/out/resolver/types.d.ts.map +1 -1
  306. package/out/resolver/types.js +43 -1
  307. package/out/resolver/types.js.map +1 -1
  308. package/out/resolver.d.ts +5 -3
  309. package/out/resolver.d.ts.map +1 -1
  310. package/out/resolver.js +2 -2
  311. package/out/resolver.js.map +1 -1
  312. package/out/resources/git.js +1 -1
  313. package/out/resources/git.js.map +1 -1
  314. package/out/resources/languages.d.ts +0 -1
  315. package/out/resources/languages.d.ts.map +1 -1
  316. package/out/resources/languages.js +0 -1
  317. package/out/resources/languages.js.map +1 -1
  318. package/out/resources/libpostal.d.ts +1 -1
  319. package/out/resources/libpostal.d.ts.map +1 -1
  320. package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
  321. package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
  322. package/out/resources/whosonfirst/PlacetypeDataSource.js +2 -1
  323. package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
  324. package/out/resources/whosonfirst/extract-repo.d.ts.map +1 -1
  325. package/out/resources/whosonfirst/extract-repo.js +2 -1
  326. package/out/resources/whosonfirst/extract-repo.js.map +1 -1
  327. package/out/resources/whosonfirst/placetypes/admin.d.ts +12 -12
  328. package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
  329. package/out/resources/whosonfirst/placetypes/admin.js +9 -8
  330. package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
  331. package/out/resources/whosonfirst/placetypes/mermaid.d.ts +2 -1
  332. package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
  333. package/out/resources/whosonfirst/placetypes/mermaid.js +1 -1
  334. package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
  335. package/out/resources/whosonfirst/placetypes/specificity.d.ts +3 -3
  336. package/out/resources/whosonfirst/placetypes/specificity.d.ts.map +1 -1
  337. package/out/resources/whosonfirst/placetypes/specificity.js +6 -6
  338. package/out/resources/whosonfirst/placetypes/specificity.js.map +1 -1
  339. package/out/resources.d.ts +1 -0
  340. package/out/resources.d.ts.map +1 -1
  341. package/out/resources.js +1 -0
  342. package/out/resources.js.map +1 -1
  343. package/out/scripting/arguments.d.ts +5 -4
  344. package/out/scripting/arguments.d.ts.map +1 -1
  345. package/out/scripting/arguments.js +5 -4
  346. package/out/scripting/arguments.js.map +1 -1
  347. package/out/scripting/command.d.ts +2 -2
  348. package/out/scripting/command.d.ts.map +1 -1
  349. package/out/scripting/command.js +1 -0
  350. package/out/scripting/command.js.map +1 -1
  351. package/out/scripting/operation.d.ts +1 -1
  352. package/out/scripting/operation.d.ts.map +1 -1
  353. package/out/scripting/operation.js +1 -1
  354. package/out/scripting/operation.js.map +1 -1
  355. package/out/scripting/utils.d.ts +3 -4
  356. package/out/scripting/utils.d.ts.map +1 -1
  357. package/out/scripting/utils.js +3 -4
  358. package/out/scripting/utils.js.map +1 -1
  359. package/out/strings/python-json.js +1 -1
  360. package/out/strings/python-json.js.map +1 -1
  361. package/out/tokenization/Span.d.ts +1 -1
  362. package/out/tokenization/Span.d.ts.map +1 -1
  363. package/out/tools/coarse-placer/build/dataset.d.ts +4 -2
  364. package/out/tools/coarse-placer/build/dataset.d.ts.map +1 -1
  365. package/out/tools/coarse-placer/build/dataset.js.map +1 -1
  366. package/out/tools/coarse-placer/build/outlier/exposure.d.ts +5 -3
  367. package/out/tools/coarse-placer/build/outlier/exposure.d.ts.map +1 -1
  368. package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
  369. package/out/tools/coarse-placer/build/outlier/latin.d.ts +3 -3
  370. package/out/tools/coarse-placer/build/outlier/oa.d.ts +3 -3
  371. package/out/tools/coarse-placer/eval/latin-offmap.d.ts +3 -3
  372. package/out/tools/coarse-placer/eval/openset.js +2 -2
  373. package/out/tools/coarse-placer/eval/openset.js.map +1 -1
  374. package/out/tools/coarse-placer/eval/quant-compare.d.ts +4 -4
  375. package/out/tools/coarse-placer/eval.d.ts +3 -3
  376. package/out/tools/coarse-placer/paths.js +1 -1
  377. package/out/tools/coarse-placer/paths.js.map +1 -1
  378. package/out/tools/coarse-placer/probe-frontier.d.ts +2 -2
  379. package/out/tools/coarse-placer/quantize.d.ts +2 -2
  380. package/out/tools/coarse-placer/train.d.ts +5 -5
  381. package/out/tools/download/libpostal-resources.d.ts.map +1 -1
  382. package/out/tools/download/libpostal-resources.js +2 -1
  383. package/out/tools/download/libpostal-resources.js.map +1 -1
  384. package/out/tools/download/ssl-address.d.ts +2 -2
  385. package/out/tools/generate-language-types.d.ts +1 -1
  386. package/out/tools/generate-language-types.js +1 -1
  387. package/out/tools/generate-language-types.js.map +1 -1
  388. package/out/trust-policies.d.ts +0 -1
  389. package/out/trust-policies.d.ts.map +1 -1
  390. package/out/trust-policies.js +0 -1
  391. package/out/trust-policies.js.map +1 -1
  392. package/out/types/Classification.d.ts +1 -1
  393. package/out/types/Classification.d.ts.map +1 -1
  394. package/out/types/classifier.d.ts +1 -1
  395. package/out/types/classifier.d.ts.map +1 -1
  396. package/out/utils/geodatabase-archive.d.ts +11 -4
  397. package/out/utils/geodatabase-archive.d.ts.map +1 -1
  398. package/out/utils/geodatabase-archive.js +1 -1
  399. package/out/utils/geodatabase-archive.js.map +1 -1
  400. package/out/utils/sqlite-rows.d.ts +2 -2
  401. package/out/utils/sqlite-rows.d.ts.map +1 -1
  402. package/out/utils/sqlite-rows.js +2 -2
  403. package/out/utils/sqlite-rows.js.map +1 -1
  404. package/out/utils/stream-to-disk.d.ts.map +1 -1
  405. package/out/utils/stream-to-disk.js +1 -1
  406. package/out/utils/stream-to-disk.js.map +1 -1
  407. package/out/utils/union-find.js +1 -1
  408. package/out/utils/union-find.js.map +1 -1
  409. package/out/vale.js +1 -1
  410. package/out/vale.js.map +1 -1
  411. package/out/workspaces.d.ts +1 -1
  412. package/out/workspaces.js +1 -1
  413. package/out/workspaces.js.map +1 -1
  414. package/package.json +46 -14
  415. package/tools/coarse-placer/build/dataset.ts +4 -2
  416. package/tools/coarse-placer/build/outlier/exposure.ts +5 -3
  417. package/tools/coarse-placer/build/outlier/latin.ts +3 -3
  418. package/tools/coarse-placer/build/outlier/oa.ts +3 -3
  419. package/tools/coarse-placer/eval/latin-offmap.ts +3 -3
  420. package/tools/coarse-placer/eval/openset.ts +3 -3
  421. package/tools/coarse-placer/eval/quant-compare.ts +4 -4
  422. package/tools/coarse-placer/eval.ts +3 -3
  423. package/tools/coarse-placer/paths.ts +1 -1
  424. package/tools/coarse-placer/probe-frontier.ts +2 -2
  425. package/tools/coarse-placer/quantize.ts +2 -2
  426. package/tools/coarse-placer/train.ts +5 -5
  427. package/tools/download/libpostal-resources.ts +2 -1
  428. package/tools/download/ssl-address.ts +2 -2
  429. package/tools/generate-language-types.ts +3 -3
package/lib/fs/readers.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * @file The asynchronous read surface. Every reader here takes a {@linkcode PathBuilderLike} and answers a promise.
6
6
  *
7
7
  * Repository code accesses `node:fs` through this directory. Every reader returns a promise, so executable code
8
- * makes no blocking filesystem calls. The `debt` check in `packages/repo-health` counts any violations.
8
+ * makes no blocking filesystem calls. The `debt` check in `lib/repo-health` counts any violations.
9
9
  */
10
10
 
11
11
  import { readFile } from "node:fs/promises"
@@ -15,8 +15,6 @@ import { type PathBuilderLike, resolvePath } from "path-ts"
15
15
  import { open } from "#fs/readers/stat"
16
16
  import { parseJSONStrict } from "#json"
17
17
 
18
- export * from "#fs/readers/stat"
19
-
20
18
  export type { Dirent, PathLike, Stats } from "node:fs"
21
19
  export type { FileHandle } from "node:fs/promises"
22
20
 
@@ -26,8 +24,7 @@ export type { FileHandle } from "node:fs/promises"
26
24
  * Read the first `byteSize` bytes of a file, or the whole file if it is smaller.
27
25
  *
28
26
  * @param path The file to read.
29
- * @param byteSize How many bytes to read.
30
- * Defaults to 65,536 bytes.
27
+ * @param byteSize [65536] How many bytes to read.
31
28
  * That size is enough to sniff a file's format.
32
29
  *
33
30
  * @returns The bytes read, as a UTF-8 string.
package/lib/fs/zip.ts CHANGED
@@ -24,7 +24,7 @@ import iconv from "iconv-lite"
24
24
  import { resolvePath, dirname, basename, type PathBuilderLike } from "path-ts"
25
25
  import { open as openArchive, type Entry, type ZipFileOptions } from "yauzl-promise"
26
26
 
27
- import { tryStat } from "#fs/readers"
27
+ import { tryStat } from "#fs/readers/stat"
28
28
  import { openWriteStream } from "#fs/streams"
29
29
  import { makeDirectories } from "#fs/writers"
30
30
  import { once } from "#utils/events"
@@ -0,0 +1,337 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The geocode result: the data shape one geocoded input projects to.
7
+ *
8
+ * The schemas here are the source of truth and each type is inferred from its schema.
9
+ * The `mailwoman` package computes the result and the HTTP surfaces serve it.
10
+ */
11
+
12
+ import { RESOLUTION_TIERS } from "@mailwoman/annotations/geo"
13
+ import { DerivationProjectionSchema, EpistemicStatusSchema } from "@mailwoman/evidence"
14
+ import { z } from "zod"
15
+
16
+ import { DroppedSpanSchema } from "#decoder/serialize/json"
17
+ import { ComponentTagSchema } from "#decoder/types"
18
+ import { QueryIntentMarkerSchema } from "#pipeline/types"
19
+
20
+ /**
21
+ * The geocoder resolution tier that produced a coordinate.
22
+ */
23
+ export const ResolutionTierSchema = z
24
+ .enum(RESOLUTION_TIERS)
25
+ .meta({ id: "ResolutionTier", description: "The geocoder tier that produced the coordinate." })
26
+
27
+ /**
28
+ * One entry of {@link GeocodeResult.hierarchy}, locality to country, most specific first.
29
+ */
30
+ export const HierarchyEntrySchema = z
31
+ .object({
32
+ tag: z.string(),
33
+ /**
34
+ * The raw parsed span.
35
+ */
36
+ value: z.string(),
37
+ /**
38
+ * The resolved gazetteer name.
39
+ */
40
+ name: z.string(),
41
+ lat: z.number().nullable(),
42
+ lon: z.number().nullable(),
43
+ placeID: z.string().nullable(),
44
+ /**
45
+ * `true` when the winner's ancestor chain vouches for this entry, `false` when it
46
+ * resolved outside the winner's lineage, and `null` when the lineage is unverifiable.
47
+ */
48
+ in_winner_lineage: z.boolean().nullable(),
49
+ })
50
+ .meta({ id: "HierarchyEntry", description: "One resolved admin level, most specific first." })
51
+
52
+ export type HierarchyEntry = z.infer<typeof HierarchyEntrySchema>
53
+
54
+ /**
55
+ * One ranked alternative place: the winner first, then same-query runner-ups.
56
+ */
57
+ export const GeocodeCandidateSchema = z
58
+ .object({
59
+ name: z.string(),
60
+ tag: z.string(),
61
+ lat: z.number(),
62
+ lon: z.number(),
63
+ countryCode: z.string().nullable(),
64
+ placeID: z.string().nullable(),
65
+ })
66
+ .meta({ id: "GeocodeCandidate", description: "A ranked candidate place." })
67
+
68
+ export type GeocodeCandidate = z.infer<typeof GeocodeCandidateSchema>
69
+
70
+ /**
71
+ * The verdict for one parsed admin qualifier.
72
+ */
73
+ export const AdminCoherenceVerdictSchema = z.enum(["confirmed", "contradicted", "unstated", "unverifiable"])
74
+
75
+ export type AdminCoherenceVerdict = z.infer<typeof AdminCoherenceVerdictSchema>
76
+
77
+ /**
78
+ * Whether the variant-alias exemption lifted a node's winner past the cross-country alias penalty.
79
+ */
80
+ export const VariantAliasExemptionSchema = z
81
+ .enum(["applied", "not_applied"])
82
+ .meta({ id: "VariantAliasExemption", description: "Whether the variant-alias exemption chose a node's winner." })
83
+
84
+ export type VariantAliasExemption = z.infer<typeof VariantAliasExemptionSchema>
85
+
86
+ /**
87
+ * Whether the winner's resolved ancestry confirms, contradicts or cannot check
88
+ * the parsed `region` and `country`.
89
+ *
90
+ * `unstated` is the explicit claim that the input had no such qualifier.
91
+ */
92
+ export const AdminCoherenceReportSchema = z
93
+ .object({ region: AdminCoherenceVerdictSchema, country: AdminCoherenceVerdictSchema })
94
+ .meta({ id: "AdminCoherenceReport", description: "Flag-only verdicts for the parsed region and country." })
95
+
96
+ export type AdminCoherenceReport = z.infer<typeof AdminCoherenceReportSchema>
97
+
98
+ /**
99
+ * One authoritative-provider match, field for field from the provider's answer.
100
+ */
101
+ export const AuthoritativeAssertionMatchSchema = z.object({
102
+ provider_place_id: z.string(),
103
+ object_ids: z.record(z.string(), z.string()).nullable(),
104
+ canonical_fields: z.record(z.string(), z.string()).nullable(),
105
+ lat: z.number().nullable(),
106
+ lon: z.number().nullable(),
107
+ precision: z.string().nullable(),
108
+ match_status: z.enum(["exact", "approximate"]),
109
+ provider_score: z.number().nullable(),
110
+ })
111
+
112
+ export type AuthoritativeAssertionMatch = z.infer<typeof AuthoritativeAssertionMatchSchema>
113
+
114
+ /**
115
+ * A configured authoritative provider's answer.
116
+ *
117
+ * `status` is the provider's response status plus `transport_error`.
118
+ * `matches` is non-null exactly when the provider returned candidates: one for `matched`,
119
+ * all of them in the provider's order for `ambiguous`.
120
+ */
121
+ export const AuthoritativeAssertionSchema = z
122
+ .object({
123
+ provider: z.string(),
124
+ status: z.enum(["matched", "ambiguous", "refused", "transport_error"]),
125
+ matches: z.array(AuthoritativeAssertionMatchSchema).nullable(),
126
+ attribution: z.string().nullable(),
127
+ license: z.string().nullable(),
128
+ retrieved_at: z.string().nullable(),
129
+ dataset_version: z.string().nullable(),
130
+ /**
131
+ * `transport_error` only: the thrown message, verbatim.
132
+ */
133
+ error: z.string().nullable(),
134
+ })
135
+ .meta({ id: "AuthoritativeAssertion", description: "A configured authoritative provider's answer." })
136
+
137
+ export type AuthoritativeAssertion = z.infer<typeof AuthoritativeAssertionSchema>
138
+
139
+ /**
140
+ * A parsed component that the answer's coordinate ignored.
141
+ *
142
+ * The only current `reason`, `postcode_move_refused`, means the postcode resolved
143
+ * too far from the selected locality.
144
+ */
145
+ export const UnfollowedComponentSchema = z.object({
146
+ tag: ComponentTagSchema,
147
+ value: z.string(),
148
+ reason: z.literal("postcode_move_refused"),
149
+ /**
150
+ * The distance in kilometers that following this component would have moved the answer.
151
+ */
152
+ distance_km: z.number(),
153
+ })
154
+
155
+ export type UnfollowedComponent = z.infer<typeof UnfollowedComponentSchema>
156
+
157
+ /**
158
+ * The locality key and postcode stored on the matched address-point row.
159
+ */
160
+ export const RooftopSchema = z.object({ localityNorm: z.string().nullable(), postcode: z.string().nullable() })
161
+
162
+ export type Rooftop = z.infer<typeof RooftopSchema>
163
+
164
+ /**
165
+ * The poi.db entity that supplied a `venue`-tier coordinate.
166
+ */
167
+ export const GeocodeEntitySchema = z.object({
168
+ name: z.string(),
169
+ categoryID: z.string().nullable(),
170
+ confidence: z.number(),
171
+ country: z.string(),
172
+ })
173
+
174
+ export type GeocodeEntity = z.infer<typeof GeocodeEntitySchema>
175
+
176
+ /**
177
+ * The result of geocoding one input.
178
+ */
179
+ export const GeocodeResultSchema = z
180
+ .object({
181
+ input: z.string(),
182
+
183
+ /**
184
+ * Every parsed component, projected from the resolved tree.
185
+ *
186
+ * It includes locale-specific tags, such as `prefecture` and `block`, that the fixed fields omit.
187
+ */
188
+ components: z.partialRecord(ComponentTagSchema, z.string()),
189
+
190
+ /**
191
+ * Spans that the one-value-per-tag projection dropped.
192
+ * The field is null unless some were dropped.
193
+ */
194
+ dropped_components: z.array(DroppedSpanSchema).nullable(),
195
+
196
+ /**
197
+ * Components in `components` that the coordinate ignored.
198
+ * The field is null unless some exist.
199
+ */
200
+ unfollowed_components: z.array(UnfollowedComponentSchema).nullable(),
201
+ lat: z.number().nullable(),
202
+ lon: z.number().nullable(),
203
+ resolution_tier: ResolutionTierSchema,
204
+
205
+ /**
206
+ * What may be claimed about the coordinate.
207
+ *
208
+ * It varies independently of `resolution_tier`.
209
+ * A rooftop answer is `designated` when its register is declared complete
210
+ * and `observed` when it comes from a crowdsourced extract.
211
+ */
212
+ epistemic_status: EpistemicStatusSchema,
213
+
214
+ /**
215
+ * The derivation behind this answer.
216
+ *
217
+ * It is null unless the caller supplied a resolver trace sink.
218
+ */
219
+ derivation: DerivationProjectionSchema.nullable(),
220
+
221
+ /**
222
+ * The poi.db entity that supplied the coordinate.
223
+ * It is null unless the `venue` tier answered.
224
+ */
225
+ entity: GeocodeEntitySchema.nullable(),
226
+
227
+ /**
228
+ * The locality key and postcode stored on the matched address-point row.
229
+ *
230
+ * These values describe the rooftop rather than the query.
231
+ * Consumers may display them but must not filter on them.
232
+ */
233
+ rooftop: RooftopSchema.nullable(),
234
+
235
+ /**
236
+ * The uncertainty radius in meters, or null when the tier reports none.
237
+ */
238
+ uncertainty_m: z.number().nullable(),
239
+ locality: z.string().nullable(),
240
+ region: z.string().nullable(),
241
+ postcode: z.string().nullable(),
242
+
243
+ /**
244
+ * The parsed house number, filled on every tier.
245
+ *
246
+ * Only the `address_point` and `interpolated` tiers place the coordinate at the house.
247
+ */
248
+ house_number: z.string().nullable(),
249
+
250
+ /**
251
+ * The parsed street name, reassembled from prefix, base and suffix.
252
+ */
253
+ street: z.string().nullable(),
254
+
255
+ /**
256
+ * The parsed venue span.
257
+ */
258
+ venue: z.string().nullable(),
259
+
260
+ /**
261
+ * The parsed dependent-locality span.
262
+ *
263
+ * It appears here even when `hierarchy` omits it for lack of a gazetteer match.
264
+ */
265
+ dependent_locality: z.string().nullable(),
266
+
267
+ /**
268
+ * The parsed unit or sub-venue span, such as `Suite 300` or `Apt 4B`.
269
+ */
270
+ unit: z.string().nullable(),
271
+
272
+ /**
273
+ * The uppercase ISO 3166-1 alpha-2 code from the first node that includes a resolver country.
274
+ */
275
+ countryCode: z.string().nullable(),
276
+
277
+ /**
278
+ * The admin hierarchy from the resolver, most specific first.
279
+ */
280
+ hierarchy: z.array(HierarchyEntrySchema),
281
+
282
+ /**
283
+ * Candidate places for the query's primary place.
284
+ *
285
+ * The winner comes first, followed by the resolver's alternatives with distinct coordinates.
286
+ */
287
+ candidates: z.array(GeocodeCandidateSchema),
288
+
289
+ /**
290
+ * The country that the postcode-country coherence pass scoped the resolve to.
291
+ *
292
+ * It is null unless the pass overrode the default country.
293
+ */
294
+ postcode_country_scope: z.string().nullable(),
295
+
296
+ /**
297
+ * The promoted candidate's country.
298
+ *
299
+ * It is null unless capital promotion changed a node's leading candidate.
300
+ */
301
+ capital_promotion: z.string().nullable(),
302
+
303
+ /**
304
+ * `applied` when the variant-alias exemption lifted a node's winner past
305
+ * the cross-country alias penalty.
306
+ */
307
+ variant_alias_exemption: VariantAliasExemptionSchema,
308
+
309
+ /**
310
+ * Query-intent advisories.
311
+ * They never change the answer.
312
+ *
313
+ * The field is always present.
314
+ * An empty array means no intent marker matched.
315
+ */
316
+ intent_markers: z.array(QueryIntentMarkerSchema),
317
+
318
+ /**
319
+ * Whether the winner's resolved ancestry confirms, contradicts or cannot
320
+ * check the parsed `region` and `country`.
321
+ *
322
+ * It is non-null whenever a winner resolved.
323
+ * Downstream ranking does not read it.
324
+ */
325
+ admin_coherence: AdminCoherenceReportSchema.nullable(),
326
+
327
+ /**
328
+ * The answer from a configured authoritative provider, reported alongside Mailwoman's own answer.
329
+ *
330
+ * The field is null when no provider is configured.
331
+ * Every value inside comes from the provider, including `refused` and `transport_error`.
332
+ */
333
+ authoritative: AuthoritativeAssertionSchema.nullable(),
334
+ })
335
+ .meta({ id: "GeocodeResult", description: "One geocoded input: its coordinate, tier, components and evidence." })
336
+
337
+ export type GeocodeResult = z.infer<typeof GeocodeResultSchema>
package/lib/git.ts CHANGED
@@ -41,7 +41,7 @@ export async function gitHead(
41
41
  ): Promise<string> {
42
42
  const args = options.short ? ["rev-parse", "--short", "HEAD"] : ["rev-parse", "HEAD"]
43
43
 
44
- return await git(args, repoRoot)
44
+ return git(args, repoRoot)
45
45
  }
46
46
 
47
47
  /**
@@ -111,10 +111,10 @@ export function elementTexts(markup: string, name: string, options: MarkupQueryO
111
111
  }
112
112
 
113
113
  /**
114
- * The text of the first element with the tag `name`, or `undefined` when the document states none.
114
+ * The text of the first element with the tag `name`, or `null` when the document states none.
115
115
  */
116
- export function elementText(markup: string, name: string, options: MarkupQueryOptions = {}): string | undefined {
117
- return elementTexts(markup, name, options).at(0)
116
+ export function elementText(markup: string, name: string, options: MarkupQueryOptions = {}): string | null {
117
+ return elementTexts(markup, name, options).at(0) ?? null
118
118
  }
119
119
 
120
120
  /**
@@ -125,11 +125,11 @@ export function elementText(markup: string, name: string, options: MarkupQueryOp
125
125
  *
126
126
  * A regex over the whole body cannot distinguish that count from a repeated descendant value.
127
127
  */
128
- export function rootAttribute(markup: string, attribute: string, options: MarkupQueryOptions = {}): string | undefined {
128
+ export function rootAttribute(markup: string, attribute: string, options: MarkupQueryOptions = {}): string | null {
129
129
  const document = parseDocument(markup, { decodeEntities: true, xmlMode: options.xml ?? false })
130
130
  const root = findAll(() => true, document).at(0)
131
131
 
132
- if (!root) return undefined
132
+ if (!root) return null
133
133
 
134
134
  const wanted = attribute.toLowerCase()
135
135
 
@@ -137,5 +137,5 @@ export function rootAttribute(markup: string, attribute: string, options: Markup
137
137
  if (localName(key) === wanted) return value
138
138
  }
139
139
 
140
- return undefined
140
+ return null
141
141
  }
@@ -9,10 +9,10 @@
9
9
  * a page. It does not fit a feature collection: one INSPIRE Addresses download inflates to roughly 32
10
10
  * GB of GML, and the caller wants each `ad:Address` subtree rather than the document.
11
11
  *
12
- * This module yields one named element at a time, with its attributes and its nested children, and
13
- * holds only the elements a single chunk completed. A caller reads an attribute, which
14
- * `./document.ts` cannot do except on the root, and walks a nested path, which `elementTexts`
15
- * flattens.
12
+ * This module yields one matching element at a time, with its attributes and its nested children, and
13
+ * holds only the elements a single chunk completed. A caller reads an attribute. `./document.ts`
14
+ * cannot do that except on the root. A caller also walks a nested path. `elementTexts` flattens
15
+ * that path.
16
16
  *
17
17
  * It decodes bytes with a streaming `TextDecoder`, so a multi-byte character split across two chunks
18
18
  * survives.
@@ -48,7 +48,7 @@ export interface MarkupElement {
48
48
  /**
49
49
  * The text directly inside this element, trimmed, with no text from its children.
50
50
  *
51
- * Keeping a child's text out means a caller reading a leaf gets that leaf's value
51
+ * A child's text stays out, so a caller reading a leaf gets that leaf's value
52
52
  * rather than a concatenation of everything beneath its parent.
53
53
  */
54
54
  readonly text: string
@@ -66,10 +66,12 @@ interface MutableElement {
66
66
  */
67
67
  export interface StreamMarkupOptions {
68
68
  /**
69
- * Parse as XML, which preserves tag case and requires every element to close.
69
+ * Parse as XML.
70
+ * It preserves tag case and requires every element to close.
70
71
  *
71
72
  * GML and every other INSPIRE payload needs this.
72
- * It defaults to false, matching `./document.ts`.
73
+ *
74
+ * @defaultValue `false`, matching `./document.ts`
73
75
  */
74
76
  xml?: boolean
75
77
 
@@ -83,7 +85,7 @@ export interface StreamMarkupOptions {
83
85
  }
84
86
 
85
87
  /**
86
- * The elements named `name`, each complete, in document order.
88
+ * The elements matching `name`, each complete, in document order.
87
89
  *
88
90
  * A nested element of the same name is not yielded separately: capture starts at the
89
91
  * outermost occurrence and ends when that one closes, so one `ad:Address` arrives
@@ -128,9 +130,9 @@ export async function* streamMarkupElements(
128
130
  * With several requested names, the close that ends a capture is the one matching
129
131
  * the tag capture began on, rather than any requested name.
130
132
  */
131
- let capturing: string | undefined
133
+ let capturing: string | null = null
132
134
  let depth = 0
133
- let failure: Error | undefined
135
+ let failure: Error | null = null
134
136
 
135
137
  const parser = new Parser(
136
138
  {
@@ -176,7 +178,7 @@ export async function* streamMarkupElements(
176
178
  }
177
179
 
178
180
  completed.push(open.pop()!)
179
- capturing = undefined
181
+ capturing = null
180
182
 
181
183
  return
182
184
  }
@@ -223,7 +225,7 @@ export async function* streamMarkupElements(
223
225
  *
224
226
  * A caller that buffers a whole document and yields it once would otherwise
225
227
  * ask for a string past V8's maximum length.
226
- * The decoder's state carries across the pieces, so a multi-byte character spanning
228
+ * The decoder's state persists across the pieces, so a multi-byte character spanning
227
229
  * a slice boundary survives, as it does across chunks.
228
230
  */
229
231
  const decodePieces = (chunk: Uint8Array): string[] => {
@@ -262,14 +264,14 @@ export async function* streamMarkupElements(
262
264
  }
263
265
 
264
266
  /**
265
- * The first child of `element` named `name`, or undefined.
267
+ * The first child of `element` with the tag `name`, or null.
266
268
  */
267
- export function childElement(element: MarkupElement, name: string): MarkupElement | undefined {
268
- return element.children.find((child) => child.name === name)
269
+ export function childElement(element: MarkupElement, name: string): MarkupElement | null {
270
+ return element.children.find((child) => child.name === name) ?? null
269
271
  }
270
272
 
271
273
  /**
272
- * Every child of `element` named `name`, in document order.
274
+ * Every child of `element` with the tag `name`, in document order.
273
275
  */
274
276
  export function childElements(element: MarkupElement, name: string): readonly MarkupElement[] {
275
277
  return element.children.filter((child) => child.name === name)
@@ -281,11 +283,11 @@ export function childElements(element: MarkupElement, name: string): readonly Ma
281
283
  * An INSPIRE value sits five or six elements down, so the path form reads better than
282
284
  * a chain of `childElement` calls and reports the same absence.
283
285
  */
284
- export function elementAtPath(element: MarkupElement, ...path: readonly string[]): MarkupElement | undefined {
285
- let current: MarkupElement | undefined = element
286
+ export function elementAtPath(element: MarkupElement, ...path: readonly string[]): MarkupElement | null {
287
+ let current: MarkupElement | null = element
286
288
 
287
289
  for (const step of path) {
288
- if (!current) return undefined
290
+ if (!current) return null
289
291
 
290
292
  current = childElement(current, step)
291
293
  }
@@ -296,9 +298,10 @@ export function elementAtPath(element: MarkupElement, ...path: readonly string[]
296
298
  /**
297
299
  * The text at `path`, or undefined when any step of the path is absent.
298
300
  *
299
- * An empty element answers an empty string, which a caller distinguishes from undefined:
300
- * the publisher wrote the element and left it blank, rather than omitting it.
301
+ * An empty element answers an empty string.
302
+ * A caller distinguishes that from undefined: the publisher wrote the element
303
+ * and left it blank, rather than omitting it.
301
304
  */
302
- export function textAtPath(element: MarkupElement, ...path: readonly string[]): string | undefined {
303
- return elementAtPath(element, ...path)?.text
305
+ export function textAtPath(element: MarkupElement, ...path: readonly string[]): string | null {
306
+ return elementAtPath(element, ...path)?.text ?? null
304
307
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Deep identity for JSON-shaped values, wrapping the runtime's `isDeepStrictEqual` so a record whose
7
+ * fields were reordered no longer reads as changed. Node-only: `node:util` has no browser build, and
8
+ * `objects.ts` stays on the browser client's static import path.
9
+ */
10
+
11
+ import { isDeepStrictEqual } from "node:util"
12
+
13
+ /**
14
+ * Predicate to check if two values are deeply identical.
15
+ *
16
+ * Not a type predicate: asserting one would narrow the arguments at call sites that keep both values.
17
+ */
18
+ export function isIdentical<A, E>(actual: A, expected: E): boolean {
19
+ return isDeepStrictEqual(actual, expected)
20
+ }
package/lib/json.ts CHANGED
@@ -26,10 +26,8 @@ export type StringifiedJSON<T = unknown> = Tagged<string, "JSON", T>
26
26
  * It also allows for optional newline and indentation settings.
27
27
  *
28
28
  * @param input The object to be pretty-printed.
29
- * @param newline Whether to append a newline character at the end of the output.
30
- * Defaults to `true`.
31
- * @param space The indent: a string to repeat, or a count of spaces.
32
- * Defaults to a tab character (`"\t"`).
29
+ * @param newline [true] Whether to append a newline character at the end of the output.
30
+ * @param space ["\t"] The indent: a string to repeat, or a count of spaces.
33
31
  * The builtin accepts a string or number for indentation.
34
32
  * This parameter handles the conversion from `2` to `" "` for callers that need it.
35
33
  *
@@ -58,7 +56,7 @@ export function prettyJSON<T = unknown>(input: T, newline = true, space: string
58
56
  * @see {@linkcode prettyJSON} for human-friendly JSON output.
59
57
  */
60
58
  export function stringifyJSON<T>(input: T, keys?: readonly string[]): StringifiedJSON<T> {
61
- return JSON.stringify(input, keys as string[] | undefined) as StringifiedJSON<T>
59
+ return JSON.stringify(input, keys as string[] | null) as StringifiedJSON<T>
62
60
  }
63
61
 
64
62
  /**
@@ -120,8 +118,8 @@ export function parseJSONStrict<T = unknown>(input: string): T {
120
118
  *
121
119
  * @param scope Names the reader in the error, e.g. `coastal client`.
122
120
  */
123
- export function parseJSONArray<T>(raw: string | undefined, scope: string): T[] {
124
- if (raw === undefined) return []
121
+ export function parseJSONArray<T>(raw: string | null | undefined, scope: string): T[] {
122
+ if (!raw) return []
125
123
 
126
124
  const parsed = parseJSONStrict<unknown>(raw)
127
125
 
@@ -144,6 +144,33 @@ export interface ResolutionMeasurementOptions {
144
144
  progressEvery?: number
145
145
  }
146
146
 
147
+ /**
148
+ * What a resolution instrument reports for a single-layer source: the features it streamed,
149
+ * the count the source declares for itself, and one measurement per candidate resolution.
150
+ *
151
+ * A streamed total that differs from the declared count means a truncated read.
152
+ */
153
+ export interface ResolutionMeasurementReport<Measurement> {
154
+ features: number
155
+ declaredFeatureCount: number
156
+ measurements: Measurement[]
157
+ }
158
+
159
+ /**
160
+ * A verification sample point outside the authority's published coverage.
161
+ *
162
+ * `passed` is true when the artifact answered `unknown` with no designation,
163
+ * the only acceptable reading there.
164
+ */
165
+ export interface OutsideCoverageRow {
166
+ label: string
167
+ latitude: number
168
+ longitude: number
169
+ kind: string
170
+ designations: number
171
+ passed: boolean
172
+ }
173
+
147
174
  /**
148
175
  * The area a build streamed, beside the area the source reports for itself.
149
176
  */
@@ -196,7 +223,7 @@ export type AreaAgreementReading =
196
223
  * Both readings of a build's streamed ring areas against the source's own figure,
197
224
  * or the stated absence of one.
198
225
  */
199
- export function areaAgreementFrom(streamed: StreamedAreaTotals, sourceM2: number | undefined): AreaAgreementReading {
226
+ export function areaAgreementFrom(streamed: StreamedAreaTotals, sourceM2: number | null): AreaAgreementReading {
200
227
  const nestedKM2 = streamed.nestedM2 / M2_PER_KM2
201
228
  const allExteriorKM2 = streamed.allExteriorM2 / M2_PER_KM2
202
229
 
@@ -11,8 +11,8 @@
11
11
  * the layer's count rather than the limit's: a builder that compares streamed count to
12
12
  * the limit as strict equality would otherwise refuse a complete download as short.
13
13
  */
14
- export function limitedFeatureCount(layerCount: number, limit: number | undefined): number {
15
- return limit === undefined ? layerCount : Math.min(limit, layerCount)
14
+ export function limitedFeatureCount(layerCount: number, limit: number | null): number {
15
+ return limit === null ? layerCount : Math.min(limit, layerCount)
16
16
  }
17
17
 
18
18
  export interface DeclaredFeatureCountInput {
@@ -33,5 +33,5 @@ export interface DeclaredFeatureCountInput {
33
33
  * else the layer's count bounded by the limit.
34
34
  */
35
35
  export function declaredFeatureCount(input: DeclaredFeatureCountInput): number {
36
- return input.declared ?? limitedFeatureCount(input.layerCount, input.limit)
36
+ return input.declared ?? limitedFeatureCount(input.layerCount, input.limit ?? null)
37
37
  }