@mailwoman/corpus 10.0.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 (1382) hide show
  1. package/README.md +120 -34
  2. package/data/PROVENANCE.md +623 -17
  3. package/data/address-source-register.json +14249 -0
  4. package/data/builds/v0.7.0-de-holdout/inputs.json +22 -0
  5. package/data/builds/v0.8.0-registers/inputs.json +92 -0
  6. package/data/license-decisions.json +1603 -0
  7. package/data/licenses/PROVENANCE.md +65 -0
  8. package/data/licenses/cdla-permissive-2.0.md +43 -0
  9. package/data/licenses/geonames-publication.md +34 -0
  10. package/data/licenses/licence-ouverte-2.0.md +36 -0
  11. package/data/licenses/national-address-database.md +46 -0
  12. package/data/licenses/nlod-2.0.md +90 -0
  13. package/data/licenses/sirene-publication.md +38 -0
  14. package/data/licenses/whosonfirst-licenses.md +65 -0
  15. package/data/source-resolutions.json +804 -0
  16. package/data/sub-venue-lexicon.json +1 -1
  17. package/data/training-manifests/v0.7.0-de-holdout.effective.json +477 -0
  18. package/data/training-manifests/v0.7.0-de-holdout.json +78 -0
  19. package/lib/adapters/cordis/adapter.ts +791 -0
  20. package/lib/adapters/dedup-key.ts +40 -0
  21. package/lib/adapters/errors.ts +21 -0
  22. package/lib/adapters/geonames/adapter.ts +43 -53
  23. package/lib/adapters/geonames/postal/adapter.ts +31 -37
  24. package/lib/adapters/gleif/adapter.ts +829 -0
  25. package/lib/adapters/libpostal-dictionary.ts +37 -0
  26. package/lib/adapters/openaddresses/adapter.ts +52 -55
  27. package/lib/adapters/osm/adapter.ts +162 -83
  28. package/lib/adapters/overture/adapter.ts +52 -43
  29. package/lib/adapters/po-box/adapter.ts +207 -0
  30. package/lib/adapters/registry.ts +79 -0
  31. package/lib/adapters/sha256-stream.ts +49 -0
  32. package/lib/adapters/source-id.ts +49 -0
  33. package/lib/adapters/street-line.ts +136 -0
  34. package/lib/adapters/wof/admin/json/adapter.ts +50 -35
  35. package/lib/adapters/wof/json-rows.ts +57 -26
  36. package/lib/adapters/wof/postalcode-json/adapter.ts +63 -61
  37. package/lib/adapters.ts +230 -0
  38. package/lib/au/adapters/gnaf/adapter.ts +36 -44
  39. package/lib/au/adapters/gnaf/assemble.ts +31 -51
  40. package/lib/be/adapters/brussels/adapter.ts +566 -0
  41. package/lib/be/adapters/vlaanderen/adapter.ts +667 -0
  42. package/lib/be/adapters/wallonie/adapter.ts +537 -0
  43. package/lib/be/tools/fetch/brussels.ts +242 -0
  44. package/lib/be/tools/fetch/wallonie.ts +275 -0
  45. package/lib/build/adapters.ts +111 -0
  46. package/lib/build/align.ts +365 -0
  47. package/lib/build/checkpoint.ts +133 -0
  48. package/lib/build/eligibility.ts +96 -0
  49. package/lib/build/heap.ts +53 -0
  50. package/lib/build/inputs.ts +81 -0
  51. package/lib/build/rows.ts +21 -0
  52. package/lib/build/types.ts +234 -0
  53. package/lib/build.ts +127 -315
  54. package/lib/cn/recipes/organizational-units.ts +20 -41
  55. package/lib/cz/adapters/cuzk/adapter.ts +320 -0
  56. package/lib/cz/recipes/pcfirst-preposition.ts +40 -27
  57. package/lib/cz/tools/fetch/cuzk.ts +710 -0
  58. package/lib/de/recipes/locale.ts +69 -59
  59. package/lib/directory.ts +31 -0
  60. package/lib/dk/adapters/inspire/adapter.ts +345 -0
  61. package/lib/dk/tools/fetch/inspire.ts +323 -0
  62. package/lib/ee/adapters/ads/adapter.ts +240 -0
  63. package/lib/ee/tools/fetch/ads.ts +272 -0
  64. package/lib/env.ts +6 -2
  65. package/lib/es/adapters/bizkaia/adapter.ts +388 -0
  66. package/lib/es/adapters/catastro/adapter.ts +345 -0
  67. package/lib/es/adapters/gipuzkoa/adapter.ts +256 -0
  68. package/lib/es/adapters/navarra/adapter.ts +290 -0
  69. package/lib/es/cadastre.ts +194 -0
  70. package/lib/es/tools/fetch/bizkaia.ts +752 -0
  71. package/lib/es/tools/fetch/catastro.ts +765 -0
  72. package/lib/es/tools/fetch/gipuzkoa.ts +338 -0
  73. package/lib/es/tools/fetch/navarra.ts +496 -0
  74. package/lib/fi/adapters/ryhti/adapter.ts +319 -0
  75. package/lib/fi/tools/fetch/ryhti.ts +476 -0
  76. package/lib/fingerprints.ts +154 -0
  77. package/lib/fr/adapters/annuaire-education/adapter.ts +600 -0
  78. package/lib/fr/adapters/ban/adapter.ts +87 -59
  79. package/lib/fr/adapters/finess/adapter.ts +619 -0
  80. package/lib/fr/adapters/finess/postal-lines.ts +157 -0
  81. package/lib/fr/adapters/finess/voie-type.ts +201 -0
  82. package/lib/fr/insee-country.ts +62 -0
  83. package/lib/fr/recipes/admin-split.ts +38 -60
  84. package/lib/fr/recipes/bare-street.ts +37 -50
  85. package/lib/fr/recipes/fragment.ts +59 -142
  86. package/lib/fr/recipes/lieudit.ts +111 -73
  87. package/lib/fr/recipes/order.ts +32 -59
  88. package/lib/fr/{adapters/ban/street-decompose.ts → street-decompose.ts} +4 -3
  89. package/lib/fr/tools/fetch/annuaire-education.ts +309 -0
  90. package/lib/fr/tools/fetch/ban.ts +30 -20
  91. package/lib/fr/tools/fetch/finess.ts +353 -0
  92. package/lib/gauntlet-inputs.ts +92 -0
  93. package/lib/index.ts +9 -3
  94. package/lib/inspire/address.ts +465 -0
  95. package/lib/inspire/archive.ts +44 -0
  96. package/lib/inspire/errors.ts +72 -0
  97. package/lib/inspire/stream.ts +265 -0
  98. package/lib/international/recipes/locale.ts +146 -184
  99. package/lib/it/adapters/anac/adapter.ts +527 -0
  100. package/lib/it/tools/fetch/anac.ts +391 -0
  101. package/lib/jp/adapters/wof-admin/adapter.ts +29 -23
  102. package/lib/jp/tools/fetch/houjin.ts +19 -21
  103. package/lib/kr/adapters/juso/label-rows.ts +24 -44
  104. package/lib/kr/adapters/localdata/align.ts +20 -31
  105. package/lib/kr/adapters/localdata/key-index.ts +17 -25
  106. package/lib/kr/adapters/localdata/permit-rows.ts +34 -27
  107. package/lib/kr/tools/fetch/juso.ts +19 -21
  108. package/lib/kr/tools/fetch/localdata.ts +29 -30
  109. package/lib/lu/adapters/bd-adresses/adapter.ts +240 -0
  110. package/lib/lu/tools/fetch/bd-adresses.ts +353 -0
  111. package/lib/lv/adapters/varis/adapter.ts +500 -0
  112. package/lib/lv/tools/fetch/varis.ts +215 -0
  113. package/lib/nl/adapters/kadaster/adapter.ts +386 -0
  114. package/lib/nl/recipes/postcode.ts +46 -24
  115. package/lib/nl/tools/fetch/kadaster.ts +302 -0
  116. package/lib/no/adapters/matrikkelen/adapter.ts +188 -0
  117. package/lib/no/recipes/fragment.ts +34 -58
  118. package/lib/no/recipes/street/led.ts +44 -25
  119. package/lib/no/recipes/{street/index.ts → street.ts} +29 -11
  120. package/lib/no/tools/fetch/matrikkelen.ts +531 -0
  121. package/lib/parquet/duckdb.ts +147 -0
  122. package/lib/parquet/readers.ts +86 -0
  123. package/lib/parquet/schema.ts +214 -0
  124. package/lib/parquet/shuffle.ts +59 -0
  125. package/lib/parquet/span-sql.ts +54 -0
  126. package/lib/parquet/streams.ts +113 -0
  127. package/lib/parquet/writers.ts +452 -0
  128. package/lib/pl/adapters/emuia/adapter.ts +202 -0
  129. package/lib/pl/tools/fetch/emuia.ts +361 -0
  130. package/lib/recipes/anchor-absorption.ts +30 -19
  131. package/lib/recipes/bare/country.ts +24 -32
  132. package/lib/recipes/bare/postcode/eval.ts +1 -1
  133. package/lib/recipes/bare/postcode.ts +346 -0
  134. package/lib/recipes/boundary-stress.ts +37 -20
  135. package/lib/recipes/country-balanced.ts +66 -86
  136. package/lib/recipes/house-venue.ts +36 -14
  137. package/lib/recipes/intersection.ts +84 -62
  138. package/lib/recipes/po/box/cedex/au-nz.ts +3 -3
  139. package/lib/recipes/po/box/cedex/ca.ts +3 -2
  140. package/lib/recipes/po/box/cedex/fr.ts +4 -3
  141. package/lib/recipes/po/box/cedex/phrases.ts +7 -6
  142. package/lib/recipes/po/box/cedex/recipe.ts +31 -19
  143. package/lib/recipes/po/box/cedex/sources.ts +16 -4
  144. package/lib/recipes/po/box/cedex/us.ts +7 -2
  145. package/lib/recipes/po/{box/index.ts → box.ts} +39 -18
  146. package/lib/recipes/scaffold.ts +267 -158
  147. package/lib/recipes/sources.ts +412 -0
  148. package/lib/recipes/street/affix.ts +54 -154
  149. package/lib/recipes/street/bare.ts +30 -17
  150. package/lib/recipes/street.ts +35 -9
  151. package/lib/recipes/sub/venue/context.ts +32 -23
  152. package/lib/recipes/sub/venue/render.ts +170 -0
  153. package/lib/recipes/sub/venue/sources.ts +92 -248
  154. package/lib/recipes/sub/venue.ts +795 -0
  155. package/lib/recipes/trailing-region.ts +75 -87
  156. package/lib/recipes/unit/sources.ts +44 -0
  157. package/lib/recipes/unit.ts +101 -89
  158. package/lib/recipes/venue.ts +347 -0
  159. package/lib/{recipes/index.ts → recipes.ts} +15 -11
  160. package/lib/registers.ts +280 -0
  161. package/lib/ro/adapters/retea-scolara/adapter.ts +264 -0
  162. package/lib/ro/tools/fetch/retea-scolara.ts +187 -0
  163. package/lib/runner.ts +221 -84
  164. package/lib/sg/recipes/register.ts +47 -53
  165. package/lib/sg/tools/fetch/acra.ts +23 -28
  166. package/lib/si/recipes/bare-village.ts +34 -17
  167. package/lib/sk/adapters/inspire/adapter.ts +393 -0
  168. package/lib/sk/tools/fetch/inspire.ts +403 -0
  169. package/lib/source-register/effective-manifest.ts +659 -0
  170. package/lib/source-register/register.ts +539 -0
  171. package/lib/source-register/training-manifest.ts +218 -0
  172. package/lib/source-register/types.ts +589 -0
  173. package/lib/source-register.ts +71 -0
  174. package/lib/south-asia/recipes/register.ts +45 -26
  175. package/lib/subvenue/harvest.ts +251 -0
  176. package/lib/{tools/sub/venue → subvenue}/promotions.ts +33 -70
  177. package/lib/subvenue/surfaces.ts +94 -0
  178. package/lib/subvenue/table.ts +264 -0
  179. package/lib/surfaces/locale.ts +248 -0
  180. package/lib/synthesizers/anchor-absorption.ts +56 -91
  181. package/lib/synthesizers/boundary-stress.ts +67 -155
  182. package/lib/synthesizers/house-venue.ts +65 -127
  183. package/lib/synthesizers/no-street.ts +71 -119
  184. package/lib/synthesizers/po-box.ts +93 -105
  185. package/lib/synthesizers/tail.ts +55 -0
  186. package/lib/synthesizers/utils.ts +82 -219
  187. package/lib/test-kit/corpus-recipe.ts +45 -28
  188. package/lib/test-kit.ts +116 -0
  189. package/lib/tools/align-canonical.ts +64 -0
  190. package/lib/tools/audit.ts +117 -120
  191. package/lib/tools/corpus-stats.ts +45 -31
  192. package/lib/tools/fetch/atom.ts +164 -0
  193. package/lib/tools/fetch/cordis.ts +320 -0
  194. package/lib/tools/fetch/download/manifest.ts +36 -23
  195. package/lib/tools/fetch/download/network.ts +55 -31
  196. package/lib/tools/fetch/download/retry.ts +30 -29
  197. package/lib/tools/fetch/geonames/dump.ts +75 -55
  198. package/lib/tools/fetch/geonames/postal.ts +27 -62
  199. package/lib/tools/fetch/gleif.ts +362 -0
  200. package/lib/tools/fetch/header.ts +71 -0
  201. package/lib/tools/fetch/inspire-addresses.ts +500 -0
  202. package/lib/tools/fetch/openaddresses.ts +23 -112
  203. package/lib/tools/fetch/ourairports.ts +18 -51
  204. package/lib/tools/fetch/ppd.ts +10 -8
  205. package/lib/tools/fetch/vlaanderen-ad.ts +435 -0
  206. package/lib/tools/fetch/wfs-harvest.ts +954 -0
  207. package/lib/tools/fetch/wikidata-subvenue.ts +45 -145
  208. package/lib/tools/fetch/zip-archive.ts +100 -0
  209. package/lib/tools/fetch.ts +101 -0
  210. package/lib/tools/golden/expand.ts +75 -44
  211. package/lib/tools/golden/promote.ts +47 -34
  212. package/lib/tools/golden/relabel-street/directory.ts +67 -39
  213. package/lib/tools/golden/relabel-street/row.ts +32 -109
  214. package/lib/tools/ingest-csv.ts +48 -51
  215. package/lib/tools/jsonl-to-parquet.ts +59 -98
  216. package/lib/tools/lint/recipe-output/vocab.ts +371 -0
  217. package/lib/tools/lint/{slice/index.ts → recipe-output.ts} +130 -126
  218. package/lib/tools/migrate/overlay-parquet.ts +173 -0
  219. package/lib/tools/migrate/recipe-output.ts +153 -0
  220. package/lib/tools/migrate/source-names.ts +161 -0
  221. package/lib/tools/{slice → overlay}/kryptonite.ts +47 -39
  222. package/lib/tools/overlay/manifest.ts +409 -0
  223. package/lib/tools/overlay/merge-source.ts +139 -0
  224. package/lib/tools/overlay/split-slice.ts +144 -0
  225. package/lib/tools/overlay/translit.ts +236 -0
  226. package/lib/tools/overture-subvenue.ts +18 -91
  227. package/lib/tools/postcode-triples.ts +284 -212
  228. package/lib/tools/source-register/build.ts +822 -0
  229. package/lib/tools/sub/venue/head-nouns.ts +38 -75
  230. package/lib/tools/sub/venue/lexicon.ts +71 -110
  231. package/lib/tools/sub/venue/wikidata.ts +13 -10
  232. package/lib/tw/tools/fetch/gcis.ts +21 -20
  233. package/lib/types.ts +305 -101
  234. package/lib/us/adapters/fcc-bdc/adapter.ts +26 -41
  235. package/lib/us/adapters/state/hi-schools/adapter.ts +28 -17
  236. package/lib/us/adapters/state/hi-schools/workbook.ts +8 -3
  237. package/lib/us/adapters/state/ia-contractors/adapter.ts +27 -15
  238. package/lib/us/adapters/state/ny-notaries/adapter.ts +24 -25
  239. package/lib/us/adapters/state/tx-notaries/adapter.ts +21 -15
  240. package/lib/us/adapters/tiger/adapter.ts +19 -44
  241. package/lib/us/adapters/tiger/street-decompose.ts +7 -17
  242. package/lib/us/adapters/usgov/hrsa-fqhc/adapter.ts +49 -34
  243. package/lib/us/adapters/usgov/imls-pls/adapter.ts +25 -19
  244. package/lib/us/adapters/usgov/irs-bmf/adapter.ts +32 -23
  245. package/lib/us/adapters/usgov/nad/adapter.ts +61 -122
  246. package/lib/us/adapters/usgov/nppes/adapter.ts +72 -35
  247. package/lib/us/adapters/usgov/samhsa-treatment-locator/adapter.ts +47 -34
  248. package/lib/us/fips-state.ts +19 -10
  249. package/lib/{synthesizers → us/synthesizers}/intersection.ts +45 -35
  250. package/lib/{synthesizers → us/synthesizers}/street.ts +56 -43
  251. package/lib/us/tools/fetch/hrsa.ts +7 -8
  252. package/lib/us/tools/fetch/imls-pls.ts +18 -36
  253. package/lib/us/tools/fetch/nad.ts +51 -33
  254. package/lib/us/tools/fetch/nppes.ts +27 -39
  255. package/lib/us/tools/fetch/state/hi-schools.ts +24 -17
  256. package/lib/us/tools/fetch/state/sources.ts +12 -12
  257. package/lib/us/tools/fetch/tiger-full.ts +22 -74
  258. package/lib/utils/align.ts +52 -59
  259. package/lib/utils/{slice-stats.ts → cooccurrence-stats.ts} +22 -16
  260. package/lib/utils/golden.ts +36 -51
  261. package/lib/utils/license.ts +239 -27
  262. package/lib/utils/split.ts +209 -88
  263. package/lib/utils/tokenize.ts +25 -56
  264. package/lib/utils/wof-json.ts +130 -77
  265. package/lib/{utils/index.ts → utils.ts} +0 -1
  266. package/lib/ve/recipes/reviewed-postcode-tail.ts +40 -13
  267. package/out/adapters/cordis/adapter.d.ts +326 -0
  268. package/out/adapters/cordis/adapter.d.ts.map +1 -0
  269. package/out/adapters/cordis/adapter.js +622 -0
  270. package/out/adapters/cordis/adapter.js.map +1 -0
  271. package/out/adapters/dedup-key.d.ts +30 -0
  272. package/out/adapters/dedup-key.d.ts.map +1 -0
  273. package/out/adapters/dedup-key.js +35 -0
  274. package/out/adapters/dedup-key.js.map +1 -0
  275. package/out/adapters/errors.d.ts +17 -0
  276. package/out/adapters/errors.d.ts.map +1 -0
  277. package/out/adapters/errors.js +20 -0
  278. package/out/adapters/errors.js.map +1 -0
  279. package/out/adapters/geonames/adapter.d.ts +26 -28
  280. package/out/adapters/geonames/adapter.d.ts.map +1 -1
  281. package/out/adapters/geonames/adapter.js +40 -50
  282. package/out/adapters/geonames/adapter.js.map +1 -1
  283. package/out/adapters/geonames/postal/adapter.d.ts +14 -27
  284. package/out/adapters/geonames/postal/adapter.d.ts.map +1 -1
  285. package/out/adapters/geonames/postal/adapter.js +30 -35
  286. package/out/adapters/geonames/postal/adapter.js.map +1 -1
  287. package/out/adapters/gleif/adapter.d.ts +293 -0
  288. package/out/adapters/gleif/adapter.d.ts.map +1 -0
  289. package/out/adapters/gleif/adapter.js +685 -0
  290. package/out/adapters/gleif/adapter.js.map +1 -0
  291. package/out/adapters/libpostal-dictionary.d.ts +20 -0
  292. package/out/adapters/libpostal-dictionary.d.ts.map +1 -0
  293. package/out/adapters/libpostal-dictionary.js +34 -0
  294. package/out/adapters/libpostal-dictionary.js.map +1 -0
  295. package/out/adapters/openaddresses/adapter.d.ts +29 -43
  296. package/out/adapters/openaddresses/adapter.d.ts.map +1 -1
  297. package/out/adapters/openaddresses/adapter.js +34 -46
  298. package/out/adapters/openaddresses/adapter.js.map +1 -1
  299. package/out/adapters/osm/adapter.d.ts +59 -52
  300. package/out/adapters/osm/adapter.d.ts.map +1 -1
  301. package/out/adapters/osm/adapter.js +119 -69
  302. package/out/adapters/osm/adapter.js.map +1 -1
  303. package/out/adapters/overture/adapter.d.ts +11 -37
  304. package/out/adapters/overture/adapter.d.ts.map +1 -1
  305. package/out/adapters/overture/adapter.js +45 -42
  306. package/out/adapters/overture/adapter.js.map +1 -1
  307. package/out/adapters/po-box/adapter.d.ts +66 -0
  308. package/out/adapters/po-box/adapter.d.ts.map +1 -0
  309. package/out/adapters/{synth-po-box → po-box}/adapter.js +48 -47
  310. package/out/adapters/po-box/adapter.js.map +1 -0
  311. package/out/adapters/registry.d.ts +55 -0
  312. package/out/adapters/registry.d.ts.map +1 -0
  313. package/out/adapters/registry.js +43 -0
  314. package/out/adapters/registry.js.map +1 -0
  315. package/out/adapters/sha256-stream.d.ts +26 -0
  316. package/out/adapters/sha256-stream.d.ts.map +1 -0
  317. package/out/adapters/sha256-stream.js +34 -0
  318. package/out/adapters/sha256-stream.js.map +1 -0
  319. package/out/adapters/source-id.d.ts +33 -0
  320. package/out/adapters/source-id.d.ts.map +1 -0
  321. package/out/adapters/source-id.js +42 -0
  322. package/out/adapters/source-id.js.map +1 -0
  323. package/out/adapters/street-line.d.ts +103 -0
  324. package/out/adapters/street-line.d.ts.map +1 -0
  325. package/out/adapters/street-line.js +118 -0
  326. package/out/adapters/street-line.js.map +1 -0
  327. package/out/adapters/wof/admin/json/adapter.d.ts +27 -18
  328. package/out/adapters/wof/admin/json/adapter.d.ts.map +1 -1
  329. package/out/adapters/wof/admin/json/adapter.js +48 -32
  330. package/out/adapters/wof/admin/json/adapter.js.map +1 -1
  331. package/out/adapters/wof/json-rows.d.ts +36 -19
  332. package/out/adapters/wof/json-rows.d.ts.map +1 -1
  333. package/out/adapters/wof/json-rows.js +35 -15
  334. package/out/adapters/wof/json-rows.js.map +1 -1
  335. package/out/adapters/wof/postalcode-json/adapter.d.ts +22 -38
  336. package/out/adapters/wof/postalcode-json/adapter.d.ts.map +1 -1
  337. package/out/adapters/wof/postalcode-json/adapter.js +60 -58
  338. package/out/adapters/wof/postalcode-json/adapter.js.map +1 -1
  339. package/out/adapters.d.ts +75 -0
  340. package/out/adapters.d.ts.map +1 -0
  341. package/out/adapters.js +167 -0
  342. package/out/adapters.js.map +1 -0
  343. package/out/au/adapters/gnaf/adapter.d.ts +15 -27
  344. package/out/au/adapters/gnaf/adapter.d.ts.map +1 -1
  345. package/out/au/adapters/gnaf/adapter.js +35 -43
  346. package/out/au/adapters/gnaf/adapter.js.map +1 -1
  347. package/out/au/adapters/gnaf/assemble.d.ts +15 -26
  348. package/out/au/adapters/gnaf/assemble.d.ts.map +1 -1
  349. package/out/au/adapters/gnaf/assemble.js +26 -46
  350. package/out/au/adapters/gnaf/assemble.js.map +1 -1
  351. package/out/be/adapters/brussels/adapter.d.ts +212 -0
  352. package/out/be/adapters/brussels/adapter.d.ts.map +1 -0
  353. package/out/be/adapters/brussels/adapter.js +435 -0
  354. package/out/be/adapters/brussels/adapter.js.map +1 -0
  355. package/out/be/adapters/vlaanderen/adapter.d.ts +230 -0
  356. package/out/be/adapters/vlaanderen/adapter.d.ts.map +1 -0
  357. package/out/be/adapters/vlaanderen/adapter.js +418 -0
  358. package/out/be/adapters/vlaanderen/adapter.js.map +1 -0
  359. package/out/be/adapters/wallonie/adapter.d.ts +196 -0
  360. package/out/be/adapters/wallonie/adapter.d.ts.map +1 -0
  361. package/out/be/adapters/wallonie/adapter.js +437 -0
  362. package/out/be/adapters/wallonie/adapter.js.map +1 -0
  363. package/out/be/tools/fetch/brussels.d.ts +122 -0
  364. package/out/be/tools/fetch/brussels.d.ts.map +1 -0
  365. package/out/be/tools/fetch/brussels.js +148 -0
  366. package/out/be/tools/fetch/brussels.js.map +1 -0
  367. package/out/be/tools/fetch/wallonie.d.ts +120 -0
  368. package/out/be/tools/fetch/wallonie.d.ts.map +1 -0
  369. package/out/be/tools/fetch/wallonie.js +167 -0
  370. package/out/be/tools/fetch/wallonie.js.map +1 -0
  371. package/out/build/adapters.d.ts +33 -0
  372. package/out/build/adapters.d.ts.map +1 -0
  373. package/out/build/adapters.js +69 -0
  374. package/out/build/adapters.js.map +1 -0
  375. package/out/build/align.d.ts +74 -0
  376. package/out/build/align.d.ts.map +1 -0
  377. package/out/build/align.js +226 -0
  378. package/out/build/align.js.map +1 -0
  379. package/out/build/checkpoint.d.ts +94 -0
  380. package/out/build/checkpoint.d.ts.map +1 -0
  381. package/out/build/checkpoint.js +61 -0
  382. package/out/build/checkpoint.js.map +1 -0
  383. package/out/build/eligibility.d.ts +47 -0
  384. package/out/build/eligibility.d.ts.map +1 -0
  385. package/out/build/eligibility.js +80 -0
  386. package/out/build/eligibility.js.map +1 -0
  387. package/out/build/heap.d.ts +28 -0
  388. package/out/build/heap.d.ts.map +1 -0
  389. package/out/build/heap.js +47 -0
  390. package/out/build/heap.js.map +1 -0
  391. package/out/build/inputs.d.ts +52 -0
  392. package/out/build/inputs.d.ts.map +1 -0
  393. package/out/build/inputs.js +49 -0
  394. package/out/build/inputs.js.map +1 -0
  395. package/out/build/rows.d.ts +16 -0
  396. package/out/build/rows.d.ts.map +1 -0
  397. package/out/build/rows.js +19 -0
  398. package/out/build/rows.js.map +1 -0
  399. package/out/build/types.d.ts +222 -0
  400. package/out/build/types.d.ts.map +1 -0
  401. package/out/build/types.js +34 -0
  402. package/out/build/types.js.map +1 -0
  403. package/out/build.d.ts +6 -121
  404. package/out/build.d.ts.map +1 -1
  405. package/out/build.js +112 -207
  406. package/out/build.js.map +1 -1
  407. package/out/cn/recipes/organizational-units.d.ts +5 -22
  408. package/out/cn/recipes/organizational-units.d.ts.map +1 -1
  409. package/out/cn/recipes/organizational-units.js +20 -41
  410. package/out/cn/recipes/organizational-units.js.map +1 -1
  411. package/out/cz/adapters/cuzk/adapter.d.ts +52 -0
  412. package/out/cz/adapters/cuzk/adapter.d.ts.map +1 -0
  413. package/out/cz/adapters/cuzk/adapter.js +269 -0
  414. package/out/cz/adapters/cuzk/adapter.js.map +1 -0
  415. package/out/cz/recipes/pcfirst-preposition.d.ts +7 -11
  416. package/out/cz/recipes/pcfirst-preposition.d.ts.map +1 -1
  417. package/out/cz/recipes/pcfirst-preposition.js +36 -27
  418. package/out/cz/recipes/pcfirst-preposition.js.map +1 -1
  419. package/out/cz/tools/fetch/cuzk.d.ts +281 -0
  420. package/out/cz/tools/fetch/cuzk.d.ts.map +1 -0
  421. package/out/cz/tools/fetch/cuzk.js +448 -0
  422. package/out/cz/tools/fetch/cuzk.js.map +1 -0
  423. package/out/de/recipes/locale.d.ts +24 -26
  424. package/out/de/recipes/locale.d.ts.map +1 -1
  425. package/out/de/recipes/locale.js +67 -57
  426. package/out/de/recipes/locale.js.map +1 -1
  427. package/out/directory.d.ts +20 -0
  428. package/out/directory.d.ts.map +1 -0
  429. package/out/directory.js +27 -0
  430. package/out/directory.js.map +1 -0
  431. package/out/dk/adapters/inspire/adapter.d.ts +153 -0
  432. package/out/dk/adapters/inspire/adapter.d.ts.map +1 -0
  433. package/out/dk/adapters/inspire/adapter.js +258 -0
  434. package/out/dk/adapters/inspire/adapter.js.map +1 -0
  435. package/out/dk/tools/fetch/inspire.d.ts +101 -0
  436. package/out/dk/tools/fetch/inspire.d.ts.map +1 -0
  437. package/out/dk/tools/fetch/inspire.js +232 -0
  438. package/out/dk/tools/fetch/inspire.js.map +1 -0
  439. package/out/ee/adapters/ads/adapter.d.ts +102 -0
  440. package/out/ee/adapters/ads/adapter.d.ts.map +1 -0
  441. package/out/ee/adapters/ads/adapter.js +185 -0
  442. package/out/ee/adapters/ads/adapter.js.map +1 -0
  443. package/out/ee/tools/fetch/ads.d.ts +123 -0
  444. package/out/ee/tools/fetch/ads.d.ts.map +1 -0
  445. package/out/ee/tools/fetch/ads.js +197 -0
  446. package/out/ee/tools/fetch/ads.js.map +1 -0
  447. package/out/env.d.ts +6 -2
  448. package/out/env.d.ts.map +1 -1
  449. package/out/env.js +6 -2
  450. package/out/env.js.map +1 -1
  451. package/out/es/adapters/bizkaia/adapter.d.ts +143 -0
  452. package/out/es/adapters/bizkaia/adapter.d.ts.map +1 -0
  453. package/out/es/adapters/bizkaia/adapter.js +332 -0
  454. package/out/es/adapters/bizkaia/adapter.js.map +1 -0
  455. package/out/es/adapters/catastro/adapter.d.ts +103 -0
  456. package/out/es/adapters/catastro/adapter.d.ts.map +1 -0
  457. package/out/es/adapters/catastro/adapter.js +290 -0
  458. package/out/es/adapters/catastro/adapter.js.map +1 -0
  459. package/out/es/adapters/gipuzkoa/adapter.d.ts +84 -0
  460. package/out/es/adapters/gipuzkoa/adapter.d.ts.map +1 -0
  461. package/out/es/adapters/gipuzkoa/adapter.js +218 -0
  462. package/out/es/adapters/gipuzkoa/adapter.js.map +1 -0
  463. package/out/es/adapters/navarra/adapter.d.ts +106 -0
  464. package/out/es/adapters/navarra/adapter.d.ts.map +1 -0
  465. package/out/es/adapters/navarra/adapter.js +242 -0
  466. package/out/es/adapters/navarra/adapter.js.map +1 -0
  467. package/out/es/cadastre.d.ts +110 -0
  468. package/out/es/cadastre.d.ts.map +1 -0
  469. package/out/es/cadastre.js +128 -0
  470. package/out/es/cadastre.js.map +1 -0
  471. package/out/es/tools/fetch/bizkaia.d.ts +281 -0
  472. package/out/es/tools/fetch/bizkaia.d.ts.map +1 -0
  473. package/out/es/tools/fetch/bizkaia.js +478 -0
  474. package/out/es/tools/fetch/bizkaia.js.map +1 -0
  475. package/out/es/tools/fetch/catastro.d.ts +280 -0
  476. package/out/es/tools/fetch/catastro.d.ts.map +1 -0
  477. package/out/es/tools/fetch/catastro.js +491 -0
  478. package/out/es/tools/fetch/catastro.js.map +1 -0
  479. package/out/es/tools/fetch/gipuzkoa.d.ts +164 -0
  480. package/out/es/tools/fetch/gipuzkoa.d.ts.map +1 -0
  481. package/out/es/tools/fetch/gipuzkoa.js +210 -0
  482. package/out/es/tools/fetch/gipuzkoa.js.map +1 -0
  483. package/out/es/tools/fetch/navarra.d.ts +194 -0
  484. package/out/es/tools/fetch/navarra.d.ts.map +1 -0
  485. package/out/es/tools/fetch/navarra.js +321 -0
  486. package/out/es/tools/fetch/navarra.js.map +1 -0
  487. package/out/fi/adapters/ryhti/adapter.d.ts +111 -0
  488. package/out/fi/adapters/ryhti/adapter.d.ts.map +1 -0
  489. package/out/fi/adapters/ryhti/adapter.js +240 -0
  490. package/out/fi/adapters/ryhti/adapter.js.map +1 -0
  491. package/out/fi/tools/fetch/ryhti.d.ts +206 -0
  492. package/out/fi/tools/fetch/ryhti.d.ts.map +1 -0
  493. package/out/fi/tools/fetch/ryhti.js +324 -0
  494. package/out/fi/tools/fetch/ryhti.js.map +1 -0
  495. package/out/fingerprints.d.ts +68 -0
  496. package/out/fingerprints.d.ts.map +1 -0
  497. package/out/fingerprints.js +130 -0
  498. package/out/fingerprints.js.map +1 -0
  499. package/out/fr/adapters/annuaire-education/adapter.d.ts +236 -0
  500. package/out/fr/adapters/annuaire-education/adapter.d.ts.map +1 -0
  501. package/out/fr/adapters/annuaire-education/adapter.js +477 -0
  502. package/out/fr/adapters/annuaire-education/adapter.js.map +1 -0
  503. package/out/fr/adapters/ban/adapter.d.ts +19 -25
  504. package/out/fr/adapters/ban/adapter.d.ts.map +1 -1
  505. package/out/fr/adapters/ban/adapter.js +65 -54
  506. package/out/fr/adapters/ban/adapter.js.map +1 -1
  507. package/out/fr/adapters/finess/adapter.d.ts +277 -0
  508. package/out/fr/adapters/finess/adapter.d.ts.map +1 -0
  509. package/out/fr/adapters/finess/adapter.js +520 -0
  510. package/out/fr/adapters/finess/adapter.js.map +1 -0
  511. package/out/fr/adapters/finess/postal-lines.d.ts +61 -0
  512. package/out/fr/adapters/finess/postal-lines.d.ts.map +1 -0
  513. package/out/fr/adapters/finess/postal-lines.js +114 -0
  514. package/out/fr/adapters/finess/postal-lines.js.map +1 -0
  515. package/out/fr/adapters/finess/voie-type.d.ts +77 -0
  516. package/out/fr/adapters/finess/voie-type.d.ts.map +1 -0
  517. package/out/fr/adapters/finess/voie-type.js +173 -0
  518. package/out/fr/adapters/finess/voie-type.js.map +1 -0
  519. package/out/fr/insee-country.d.ts +45 -0
  520. package/out/fr/insee-country.d.ts.map +1 -0
  521. package/out/fr/insee-country.js +60 -0
  522. package/out/fr/insee-country.js.map +1 -0
  523. package/out/fr/recipes/admin-split.d.ts +4 -27
  524. package/out/fr/recipes/admin-split.d.ts.map +1 -1
  525. package/out/fr/recipes/admin-split.js +36 -58
  526. package/out/fr/recipes/admin-split.js.map +1 -1
  527. package/out/fr/recipes/bare-street.d.ts +2 -17
  528. package/out/fr/recipes/bare-street.d.ts.map +1 -1
  529. package/out/fr/recipes/bare-street.js +35 -50
  530. package/out/fr/recipes/bare-street.js.map +1 -1
  531. package/out/fr/recipes/fragment.d.ts +6 -65
  532. package/out/fr/recipes/fragment.d.ts.map +1 -1
  533. package/out/fr/recipes/fragment.js +55 -135
  534. package/out/fr/recipes/fragment.js.map +1 -1
  535. package/out/fr/recipes/lieudit.d.ts +17 -19
  536. package/out/fr/recipes/lieudit.d.ts.map +1 -1
  537. package/out/fr/recipes/lieudit.js +89 -68
  538. package/out/fr/recipes/lieudit.js.map +1 -1
  539. package/out/fr/recipes/order.d.ts +4 -27
  540. package/out/fr/recipes/order.d.ts.map +1 -1
  541. package/out/fr/recipes/order.js +31 -58
  542. package/out/fr/recipes/order.js.map +1 -1
  543. package/out/fr/{adapters/ban/street-decompose.d.ts → street-decompose.d.ts} +3 -2
  544. package/out/fr/street-decompose.d.ts.map +1 -0
  545. package/out/fr/{adapters/ban/street-decompose.js → street-decompose.js} +4 -3
  546. package/out/fr/street-decompose.js.map +1 -0
  547. package/out/fr/tools/fetch/annuaire-education.d.ts +133 -0
  548. package/out/fr/tools/fetch/annuaire-education.d.ts.map +1 -0
  549. package/out/fr/tools/fetch/annuaire-education.js +198 -0
  550. package/out/fr/tools/fetch/annuaire-education.js.map +1 -0
  551. package/out/fr/tools/fetch/ban.d.ts +9 -7
  552. package/out/fr/tools/fetch/ban.d.ts.map +1 -1
  553. package/out/fr/tools/fetch/ban.js +29 -19
  554. package/out/fr/tools/fetch/ban.js.map +1 -1
  555. package/out/fr/tools/fetch/finess.d.ts +145 -0
  556. package/out/fr/tools/fetch/finess.d.ts.map +1 -0
  557. package/out/fr/tools/fetch/finess.js +229 -0
  558. package/out/fr/tools/fetch/finess.js.map +1 -0
  559. package/out/gauntlet-inputs.d.ts +42 -0
  560. package/out/gauntlet-inputs.d.ts.map +1 -0
  561. package/out/gauntlet-inputs.js +78 -0
  562. package/out/gauntlet-inputs.js.map +1 -0
  563. package/out/index.d.ts +9 -3
  564. package/out/index.d.ts.map +1 -1
  565. package/out/index.js +9 -3
  566. package/out/index.js.map +1 -1
  567. package/out/inspire/address.d.ts +261 -0
  568. package/out/inspire/address.d.ts.map +1 -0
  569. package/out/inspire/address.js +395 -0
  570. package/out/inspire/address.js.map +1 -0
  571. package/out/inspire/archive.d.ts +36 -0
  572. package/out/inspire/archive.d.ts.map +1 -0
  573. package/out/inspire/archive.js +42 -0
  574. package/out/inspire/archive.js.map +1 -0
  575. package/out/inspire/errors.d.ts +56 -0
  576. package/out/inspire/errors.d.ts.map +1 -0
  577. package/out/inspire/errors.js +65 -0
  578. package/out/inspire/errors.js.map +1 -0
  579. package/out/inspire/stream.d.ts +140 -0
  580. package/out/inspire/stream.d.ts.map +1 -0
  581. package/out/inspire/stream.js +123 -0
  582. package/out/inspire/stream.js.map +1 -0
  583. package/out/international/recipes/locale.d.ts +40 -86
  584. package/out/international/recipes/locale.d.ts.map +1 -1
  585. package/out/international/recipes/locale.js +122 -157
  586. package/out/international/recipes/locale.js.map +1 -1
  587. package/out/it/adapters/anac/adapter.d.ts +269 -0
  588. package/out/it/adapters/anac/adapter.d.ts.map +1 -0
  589. package/out/it/adapters/anac/adapter.js +434 -0
  590. package/out/it/adapters/anac/adapter.js.map +1 -0
  591. package/out/it/tools/fetch/anac.d.ts +171 -0
  592. package/out/it/tools/fetch/anac.d.ts.map +1 -0
  593. package/out/it/tools/fetch/anac.js +269 -0
  594. package/out/it/tools/fetch/anac.js.map +1 -0
  595. package/out/jp/adapters/wof-admin/adapter.d.ts +14 -11
  596. package/out/jp/adapters/wof-admin/adapter.d.ts.map +1 -1
  597. package/out/jp/adapters/wof-admin/adapter.js +27 -16
  598. package/out/jp/adapters/wof-admin/adapter.js.map +1 -1
  599. package/out/jp/tools/fetch/houjin.d.ts +7 -4
  600. package/out/jp/tools/fetch/houjin.d.ts.map +1 -1
  601. package/out/jp/tools/fetch/houjin.js +17 -13
  602. package/out/jp/tools/fetch/houjin.js.map +1 -1
  603. package/out/kr/adapters/juso/label-rows.d.ts +17 -31
  604. package/out/kr/adapters/juso/label-rows.d.ts.map +1 -1
  605. package/out/kr/adapters/juso/label-rows.js +19 -41
  606. package/out/kr/adapters/juso/label-rows.js.map +1 -1
  607. package/out/kr/adapters/localdata/align.d.ts +4 -16
  608. package/out/kr/adapters/localdata/align.d.ts.map +1 -1
  609. package/out/kr/adapters/localdata/align.js +19 -30
  610. package/out/kr/adapters/localdata/align.js.map +1 -1
  611. package/out/kr/adapters/localdata/key-index.d.ts +13 -22
  612. package/out/kr/adapters/localdata/key-index.d.ts.map +1 -1
  613. package/out/kr/adapters/localdata/key-index.js +15 -21
  614. package/out/kr/adapters/localdata/key-index.js.map +1 -1
  615. package/out/kr/adapters/localdata/permit-rows.d.ts +21 -14
  616. package/out/kr/adapters/localdata/permit-rows.d.ts.map +1 -1
  617. package/out/kr/adapters/localdata/permit-rows.js +31 -26
  618. package/out/kr/adapters/localdata/permit-rows.js.map +1 -1
  619. package/out/kr/tools/fetch/juso.d.ts +11 -8
  620. package/out/kr/tools/fetch/juso.d.ts.map +1 -1
  621. package/out/kr/tools/fetch/juso.js +15 -14
  622. package/out/kr/tools/fetch/juso.js.map +1 -1
  623. package/out/kr/tools/fetch/localdata.d.ts +16 -9
  624. package/out/kr/tools/fetch/localdata.d.ts.map +1 -1
  625. package/out/kr/tools/fetch/localdata.js +24 -16
  626. package/out/kr/tools/fetch/localdata.js.map +1 -1
  627. package/out/lu/adapters/bd-adresses/adapter.d.ts +109 -0
  628. package/out/lu/adapters/bd-adresses/adapter.d.ts.map +1 -0
  629. package/out/lu/adapters/bd-adresses/adapter.js +196 -0
  630. package/out/lu/adapters/bd-adresses/adapter.js.map +1 -0
  631. package/out/lu/tools/fetch/bd-adresses.d.ts +165 -0
  632. package/out/lu/tools/fetch/bd-adresses.d.ts.map +1 -0
  633. package/out/lu/tools/fetch/bd-adresses.js +223 -0
  634. package/out/lu/tools/fetch/bd-adresses.js.map +1 -0
  635. package/out/lv/adapters/varis/adapter.d.ts +284 -0
  636. package/out/lv/adapters/varis/adapter.d.ts.map +1 -0
  637. package/out/lv/adapters/varis/adapter.js +405 -0
  638. package/out/lv/adapters/varis/adapter.js.map +1 -0
  639. package/out/lv/tools/fetch/varis.d.ts +81 -0
  640. package/out/lv/tools/fetch/varis.d.ts.map +1 -0
  641. package/out/lv/tools/fetch/varis.js +133 -0
  642. package/out/lv/tools/fetch/varis.js.map +1 -0
  643. package/out/nl/adapters/kadaster/adapter.d.ts +125 -0
  644. package/out/nl/adapters/kadaster/adapter.d.ts.map +1 -0
  645. package/out/nl/adapters/kadaster/adapter.js +309 -0
  646. package/out/nl/adapters/kadaster/adapter.js.map +1 -0
  647. package/out/nl/recipes/postcode.d.ts +12 -14
  648. package/out/nl/recipes/postcode.d.ts.map +1 -1
  649. package/out/nl/recipes/postcode.js +42 -24
  650. package/out/nl/recipes/postcode.js.map +1 -1
  651. package/out/nl/tools/fetch/kadaster.d.ts +159 -0
  652. package/out/nl/tools/fetch/kadaster.d.ts.map +1 -0
  653. package/out/nl/tools/fetch/kadaster.js +182 -0
  654. package/out/nl/tools/fetch/kadaster.js.map +1 -0
  655. package/out/no/adapters/matrikkelen/adapter.d.ts +44 -0
  656. package/out/no/adapters/matrikkelen/adapter.d.ts.map +1 -0
  657. package/out/no/adapters/matrikkelen/adapter.js +143 -0
  658. package/out/no/adapters/matrikkelen/adapter.js.map +1 -0
  659. package/out/no/recipes/fragment.d.ts +1 -33
  660. package/out/no/recipes/fragment.d.ts.map +1 -1
  661. package/out/no/recipes/fragment.js +23 -57
  662. package/out/no/recipes/fragment.js.map +1 -1
  663. package/out/no/recipes/street/led.d.ts +9 -12
  664. package/out/no/recipes/street/led.d.ts.map +1 -1
  665. package/out/no/recipes/street/led.js +34 -24
  666. package/out/no/recipes/street/led.js.map +1 -1
  667. package/out/no/recipes/street.d.ts +19 -0
  668. package/out/no/recipes/street.d.ts.map +1 -0
  669. package/out/no/recipes/{street/index.js → street.js} +28 -12
  670. package/out/no/recipes/street.js.map +1 -0
  671. package/out/no/tools/fetch/matrikkelen.d.ts +263 -0
  672. package/out/no/tools/fetch/matrikkelen.d.ts.map +1 -0
  673. package/out/no/tools/fetch/matrikkelen.js +353 -0
  674. package/out/no/tools/fetch/matrikkelen.js.map +1 -0
  675. package/out/parquet/duckdb.d.ts +103 -0
  676. package/out/parquet/duckdb.d.ts.map +1 -0
  677. package/out/parquet/duckdb.js +93 -0
  678. package/out/parquet/duckdb.js.map +1 -0
  679. package/out/parquet/readers.d.ts +44 -0
  680. package/out/parquet/readers.d.ts.map +1 -0
  681. package/out/parquet/readers.js +69 -0
  682. package/out/parquet/readers.js.map +1 -0
  683. package/out/parquet/schema.d.ts +95 -0
  684. package/out/parquet/schema.d.ts.map +1 -0
  685. package/out/parquet/schema.js +157 -0
  686. package/out/parquet/schema.js.map +1 -0
  687. package/out/parquet/shuffle.d.ts +25 -0
  688. package/out/parquet/shuffle.d.ts.map +1 -0
  689. package/out/parquet/shuffle.js +44 -0
  690. package/out/parquet/shuffle.js.map +1 -0
  691. package/out/parquet/span-sql.d.ts +49 -0
  692. package/out/parquet/span-sql.d.ts.map +1 -0
  693. package/out/parquet/span-sql.js +53 -0
  694. package/out/parquet/span-sql.js.map +1 -0
  695. package/out/parquet/streams.d.ts +47 -0
  696. package/out/parquet/streams.d.ts.map +1 -0
  697. package/out/parquet/streams.js +78 -0
  698. package/out/parquet/streams.js.map +1 -0
  699. package/out/parquet/writers.d.ts +124 -0
  700. package/out/parquet/writers.d.ts.map +1 -0
  701. package/out/parquet/writers.js +252 -0
  702. package/out/parquet/writers.js.map +1 -0
  703. package/out/pl/adapters/emuia/adapter.d.ts +81 -0
  704. package/out/pl/adapters/emuia/adapter.d.ts.map +1 -0
  705. package/out/pl/adapters/emuia/adapter.js +178 -0
  706. package/out/pl/adapters/emuia/adapter.js.map +1 -0
  707. package/out/pl/tools/fetch/emuia.d.ts +166 -0
  708. package/out/pl/tools/fetch/emuia.d.ts.map +1 -0
  709. package/out/pl/tools/fetch/emuia.js +261 -0
  710. package/out/pl/tools/fetch/emuia.js.map +1 -0
  711. package/out/recipes/anchor-absorption.d.ts +9 -9
  712. package/out/recipes/anchor-absorption.d.ts.map +1 -1
  713. package/out/recipes/anchor-absorption.js +29 -19
  714. package/out/recipes/anchor-absorption.js.map +1 -1
  715. package/out/recipes/bare/country.d.ts +2 -20
  716. package/out/recipes/bare/country.d.ts.map +1 -1
  717. package/out/recipes/bare/country.js +20 -31
  718. package/out/recipes/bare/country.js.map +1 -1
  719. package/out/recipes/bare/postcode/eval.d.ts +1 -1
  720. package/out/recipes/bare/postcode/eval.js +1 -1
  721. package/out/recipes/bare/postcode.d.ts +41 -0
  722. package/out/recipes/bare/postcode.d.ts.map +1 -0
  723. package/out/recipes/bare/{postcode/index.js → postcode.js} +92 -80
  724. package/out/recipes/bare/postcode.js.map +1 -0
  725. package/out/recipes/boundary-stress.d.ts +8 -8
  726. package/out/recipes/boundary-stress.d.ts.map +1 -1
  727. package/out/recipes/boundary-stress.js +37 -20
  728. package/out/recipes/boundary-stress.js.map +1 -1
  729. package/out/recipes/country-balanced.d.ts +3 -21
  730. package/out/recipes/country-balanced.d.ts.map +1 -1
  731. package/out/recipes/country-balanced.js +58 -76
  732. package/out/recipes/country-balanced.js.map +1 -1
  733. package/out/recipes/house-venue.d.ts +8 -6
  734. package/out/recipes/house-venue.d.ts.map +1 -1
  735. package/out/recipes/house-venue.js +33 -14
  736. package/out/recipes/house-venue.js.map +1 -1
  737. package/out/recipes/intersection.d.ts +20 -20
  738. package/out/recipes/intersection.d.ts.map +1 -1
  739. package/out/recipes/intersection.js +67 -55
  740. package/out/recipes/intersection.js.map +1 -1
  741. package/out/recipes/po/box/cedex/au-nz.d.ts.map +1 -1
  742. package/out/recipes/po/box/cedex/au-nz.js +3 -3
  743. package/out/recipes/po/box/cedex/au-nz.js.map +1 -1
  744. package/out/recipes/po/box/cedex/ca.d.ts.map +1 -1
  745. package/out/recipes/po/box/cedex/ca.js +2 -2
  746. package/out/recipes/po/box/cedex/ca.js.map +1 -1
  747. package/out/recipes/po/box/cedex/fr.d.ts.map +1 -1
  748. package/out/recipes/po/box/cedex/fr.js +3 -3
  749. package/out/recipes/po/box/cedex/fr.js.map +1 -1
  750. package/out/recipes/po/box/cedex/phrases.d.ts.map +1 -1
  751. package/out/recipes/po/box/cedex/phrases.js +7 -6
  752. package/out/recipes/po/box/cedex/phrases.js.map +1 -1
  753. package/out/recipes/po/box/cedex/recipe.d.ts +1 -1
  754. package/out/recipes/po/box/cedex/recipe.d.ts.map +1 -1
  755. package/out/recipes/po/box/cedex/recipe.js +27 -16
  756. package/out/recipes/po/box/cedex/recipe.js.map +1 -1
  757. package/out/recipes/po/box/cedex/sources.d.ts +20 -14
  758. package/out/recipes/po/box/cedex/sources.d.ts.map +1 -1
  759. package/out/recipes/po/box/cedex/sources.js +2 -2
  760. package/out/recipes/po/box/cedex/sources.js.map +1 -1
  761. package/out/recipes/po/box/cedex/us.d.ts.map +1 -1
  762. package/out/recipes/po/box/cedex/us.js +5 -2
  763. package/out/recipes/po/box/cedex/us.js.map +1 -1
  764. package/out/recipes/po/box.d.ts +18 -0
  765. package/out/recipes/po/box.d.ts.map +1 -0
  766. package/out/recipes/po/{box/index.js → box.js} +37 -19
  767. package/out/recipes/po/box.js.map +1 -0
  768. package/out/recipes/scaffold.d.ts +223 -141
  769. package/out/recipes/scaffold.d.ts.map +1 -1
  770. package/out/recipes/scaffold.js +75 -65
  771. package/out/recipes/scaffold.js.map +1 -1
  772. package/out/recipes/sources.d.ts +178 -0
  773. package/out/recipes/sources.d.ts.map +1 -0
  774. package/out/recipes/sources.js +361 -0
  775. package/out/recipes/sources.js.map +1 -0
  776. package/out/recipes/street/affix.d.ts +20 -50
  777. package/out/recipes/street/affix.d.ts.map +1 -1
  778. package/out/recipes/street/affix.js +45 -133
  779. package/out/recipes/street/affix.js.map +1 -1
  780. package/out/recipes/street/bare.d.ts +9 -7
  781. package/out/recipes/street/bare.d.ts.map +1 -1
  782. package/out/recipes/street/bare.js +27 -16
  783. package/out/recipes/street/bare.js.map +1 -1
  784. package/out/recipes/street.d.ts +6 -4
  785. package/out/recipes/street.d.ts.map +1 -1
  786. package/out/recipes/street.js +32 -9
  787. package/out/recipes/street.js.map +1 -1
  788. package/out/recipes/sub/venue/context.d.ts +12 -9
  789. package/out/recipes/sub/venue/context.d.ts.map +1 -1
  790. package/out/recipes/sub/venue/context.js +23 -17
  791. package/out/recipes/sub/venue/context.js.map +1 -1
  792. package/out/recipes/sub/venue/render.d.ts +58 -0
  793. package/out/recipes/sub/venue/render.d.ts.map +1 -0
  794. package/out/recipes/sub/venue/render.js +118 -0
  795. package/out/recipes/sub/venue/render.js.map +1 -0
  796. package/out/recipes/sub/venue/sources.d.ts +53 -93
  797. package/out/recipes/sub/venue/sources.d.ts.map +1 -1
  798. package/out/recipes/sub/venue/sources.js +57 -197
  799. package/out/recipes/sub/venue/sources.js.map +1 -1
  800. package/out/recipes/sub/venue.d.ts +173 -0
  801. package/out/recipes/sub/venue.d.ts.map +1 -0
  802. package/out/recipes/sub/venue.js +558 -0
  803. package/out/recipes/sub/venue.js.map +1 -0
  804. package/out/recipes/trailing-region.d.ts +9 -61
  805. package/out/recipes/trailing-region.d.ts.map +1 -1
  806. package/out/recipes/trailing-region.js +61 -86
  807. package/out/recipes/trailing-region.js.map +1 -1
  808. package/out/recipes/unit/sources.d.ts +28 -0
  809. package/out/recipes/unit/sources.d.ts.map +1 -0
  810. package/out/recipes/unit/sources.js +30 -0
  811. package/out/recipes/unit/sources.js.map +1 -0
  812. package/out/recipes/unit.d.ts +30 -17
  813. package/out/recipes/unit.d.ts.map +1 -1
  814. package/out/recipes/unit.js +90 -79
  815. package/out/recipes/unit.js.map +1 -1
  816. package/out/recipes/venue.d.ts +119 -0
  817. package/out/recipes/venue.d.ts.map +1 -0
  818. package/out/recipes/venue.js +245 -0
  819. package/out/recipes/venue.js.map +1 -0
  820. package/out/recipes.d.ts +26 -0
  821. package/out/recipes.d.ts.map +1 -0
  822. package/out/{recipes/index.js → recipes.js} +16 -12
  823. package/out/recipes.js.map +1 -0
  824. package/out/registers.d.ts +279 -0
  825. package/out/registers.d.ts.map +1 -0
  826. package/out/registers.js +275 -0
  827. package/out/registers.js.map +1 -0
  828. package/out/ro/adapters/retea-scolara/adapter.d.ts +114 -0
  829. package/out/ro/adapters/retea-scolara/adapter.d.ts.map +1 -0
  830. package/out/ro/adapters/retea-scolara/adapter.js +209 -0
  831. package/out/ro/adapters/retea-scolara/adapter.js.map +1 -0
  832. package/out/ro/tools/fetch/retea-scolara.d.ts +69 -0
  833. package/out/ro/tools/fetch/retea-scolara.d.ts.map +1 -0
  834. package/out/ro/tools/fetch/retea-scolara.js +117 -0
  835. package/out/ro/tools/fetch/retea-scolara.js.map +1 -0
  836. package/out/runner.d.ts +121 -60
  837. package/out/runner.d.ts.map +1 -1
  838. package/out/runner.js +130 -56
  839. package/out/runner.js.map +1 -1
  840. package/out/sg/recipes/register.d.ts +18 -32
  841. package/out/sg/recipes/register.d.ts.map +1 -1
  842. package/out/sg/recipes/register.js +45 -50
  843. package/out/sg/recipes/register.js.map +1 -1
  844. package/out/sg/tools/fetch/acra.d.ts +11 -14
  845. package/out/sg/tools/fetch/acra.d.ts.map +1 -1
  846. package/out/sg/tools/fetch/acra.js +18 -21
  847. package/out/sg/tools/fetch/acra.js.map +1 -1
  848. package/out/si/recipes/bare-village.d.ts +12 -13
  849. package/out/si/recipes/bare-village.d.ts.map +1 -1
  850. package/out/si/recipes/bare-village.js +31 -17
  851. package/out/si/recipes/bare-village.js.map +1 -1
  852. package/out/sk/adapters/inspire/adapter.d.ts +119 -0
  853. package/out/sk/adapters/inspire/adapter.d.ts.map +1 -0
  854. package/out/sk/adapters/inspire/adapter.js +318 -0
  855. package/out/sk/adapters/inspire/adapter.js.map +1 -0
  856. package/out/sk/tools/fetch/inspire.d.ts +196 -0
  857. package/out/sk/tools/fetch/inspire.d.ts.map +1 -0
  858. package/out/sk/tools/fetch/inspire.js +281 -0
  859. package/out/sk/tools/fetch/inspire.js.map +1 -0
  860. package/out/source-register/effective-manifest.d.ts +355 -0
  861. package/out/source-register/effective-manifest.d.ts.map +1 -0
  862. package/out/source-register/effective-manifest.js +355 -0
  863. package/out/source-register/effective-manifest.js.map +1 -0
  864. package/out/source-register/register.d.ts +79 -0
  865. package/out/source-register/register.d.ts.map +1 -0
  866. package/out/source-register/register.js +400 -0
  867. package/out/source-register/register.js.map +1 -0
  868. package/out/source-register/training-manifest.d.ts +111 -0
  869. package/out/source-register/training-manifest.d.ts.map +1 -0
  870. package/out/source-register/training-manifest.js +120 -0
  871. package/out/source-register/training-manifest.js.map +1 -0
  872. package/out/source-register/types.d.ts +538 -0
  873. package/out/source-register/types.d.ts.map +1 -0
  874. package/out/source-register/types.js +263 -0
  875. package/out/source-register/types.js.map +1 -0
  876. package/out/source-register.d.ts +19 -0
  877. package/out/source-register.d.ts.map +1 -0
  878. package/out/source-register.js +16 -0
  879. package/out/source-register.js.map +1 -0
  880. package/out/south-asia/recipes/register.d.ts +20 -17
  881. package/out/south-asia/recipes/register.d.ts.map +1 -1
  882. package/out/south-asia/recipes/register.js +44 -24
  883. package/out/south-asia/recipes/register.js.map +1 -1
  884. package/out/subvenue/harvest.d.ts +117 -0
  885. package/out/subvenue/harvest.d.ts.map +1 -0
  886. package/out/subvenue/harvest.js +172 -0
  887. package/out/subvenue/harvest.js.map +1 -0
  888. package/out/subvenue/promotions.d.ts +65 -0
  889. package/out/subvenue/promotions.d.ts.map +1 -0
  890. package/out/{tools/sub/venue → subvenue}/promotions.js +15 -55
  891. package/out/subvenue/promotions.js.map +1 -0
  892. package/out/subvenue/surfaces.d.ts +39 -0
  893. package/out/subvenue/surfaces.d.ts.map +1 -0
  894. package/out/subvenue/surfaces.js +75 -0
  895. package/out/subvenue/surfaces.js.map +1 -0
  896. package/out/subvenue/table.d.ts +212 -0
  897. package/out/subvenue/table.d.ts.map +1 -0
  898. package/out/subvenue/table.js +94 -0
  899. package/out/subvenue/table.js.map +1 -0
  900. package/out/surfaces/locale.d.ts +113 -0
  901. package/out/surfaces/locale.d.ts.map +1 -0
  902. package/out/surfaces/locale.js +138 -0
  903. package/out/surfaces/locale.js.map +1 -0
  904. package/out/synthesizers/anchor-absorption.d.ts +22 -30
  905. package/out/synthesizers/anchor-absorption.d.ts.map +1 -1
  906. package/out/synthesizers/anchor-absorption.js +30 -85
  907. package/out/synthesizers/anchor-absorption.js.map +1 -1
  908. package/out/synthesizers/boundary-stress.d.ts +18 -49
  909. package/out/synthesizers/boundary-stress.d.ts.map +1 -1
  910. package/out/synthesizers/boundary-stress.js +45 -142
  911. package/out/synthesizers/boundary-stress.js.map +1 -1
  912. package/out/synthesizers/house-venue.d.ts +23 -25
  913. package/out/synthesizers/house-venue.d.ts.map +1 -1
  914. package/out/synthesizers/house-venue.js +47 -118
  915. package/out/synthesizers/house-venue.js.map +1 -1
  916. package/out/synthesizers/no-street.d.ts +7 -37
  917. package/out/synthesizers/no-street.d.ts.map +1 -1
  918. package/out/synthesizers/no-street.js +55 -111
  919. package/out/synthesizers/no-street.js.map +1 -1
  920. package/out/synthesizers/po-box.d.ts +48 -45
  921. package/out/synthesizers/po-box.d.ts.map +1 -1
  922. package/out/synthesizers/po-box.js +57 -97
  923. package/out/synthesizers/po-box.js.map +1 -1
  924. package/out/synthesizers/tail.d.ts +36 -0
  925. package/out/synthesizers/tail.d.ts.map +1 -0
  926. package/out/synthesizers/tail.js +32 -0
  927. package/out/synthesizers/tail.js.map +1 -0
  928. package/out/synthesizers/utils.d.ts +33 -129
  929. package/out/synthesizers/utils.d.ts.map +1 -1
  930. package/out/synthesizers/utils.js +71 -167
  931. package/out/synthesizers/utils.js.map +1 -1
  932. package/out/test-kit/corpus-recipe.d.ts +29 -23
  933. package/out/test-kit/corpus-recipe.d.ts.map +1 -1
  934. package/out/test-kit/corpus-recipe.js +28 -13
  935. package/out/test-kit/corpus-recipe.js.map +1 -1
  936. package/out/test-kit.d.ts +63 -0
  937. package/out/test-kit.d.ts.map +1 -0
  938. package/out/test-kit.js +88 -0
  939. package/out/test-kit.js.map +1 -0
  940. package/out/tools/align-canonical.d.ts +7 -0
  941. package/out/tools/align-canonical.d.ts.map +1 -0
  942. package/out/tools/align-canonical.js +52 -0
  943. package/out/tools/align-canonical.js.map +1 -0
  944. package/out/tools/audit.d.ts +19 -11
  945. package/out/tools/audit.d.ts.map +1 -1
  946. package/out/tools/audit.js +89 -97
  947. package/out/tools/audit.js.map +1 -1
  948. package/out/tools/corpus-stats.d.ts +24 -15
  949. package/out/tools/corpus-stats.d.ts.map +1 -1
  950. package/out/tools/corpus-stats.js +34 -30
  951. package/out/tools/corpus-stats.js.map +1 -1
  952. package/out/tools/fetch/atom.d.ts +115 -0
  953. package/out/tools/fetch/atom.d.ts.map +1 -0
  954. package/out/tools/fetch/atom.js +83 -0
  955. package/out/tools/fetch/atom.js.map +1 -0
  956. package/out/tools/fetch/cordis.d.ts +124 -0
  957. package/out/tools/fetch/cordis.d.ts.map +1 -0
  958. package/out/tools/fetch/cordis.js +210 -0
  959. package/out/tools/fetch/cordis.js.map +1 -0
  960. package/out/tools/fetch/download/manifest.d.ts +27 -18
  961. package/out/tools/fetch/download/manifest.d.ts.map +1 -1
  962. package/out/tools/fetch/download/manifest.js +22 -14
  963. package/out/tools/fetch/download/manifest.js.map +1 -1
  964. package/out/tools/fetch/download/network.d.ts +48 -27
  965. package/out/tools/fetch/download/network.d.ts.map +1 -1
  966. package/out/tools/fetch/download/network.js +26 -16
  967. package/out/tools/fetch/download/network.js.map +1 -1
  968. package/out/tools/fetch/download/retry.d.ts +16 -15
  969. package/out/tools/fetch/download/retry.d.ts.map +1 -1
  970. package/out/tools/fetch/download/retry.js +28 -28
  971. package/out/tools/fetch/download/retry.js.map +1 -1
  972. package/out/tools/fetch/{download/index.d.ts → download.d.ts} +1 -1
  973. package/out/tools/fetch/download.d.ts.map +1 -0
  974. package/out/tools/fetch/{download/index.js → download.js} +1 -1
  975. package/out/tools/fetch/download.js.map +1 -0
  976. package/out/tools/fetch/geonames/dump.d.ts +51 -32
  977. package/out/tools/fetch/geonames/dump.d.ts.map +1 -1
  978. package/out/tools/fetch/geonames/dump.js +54 -43
  979. package/out/tools/fetch/geonames/dump.js.map +1 -1
  980. package/out/tools/fetch/geonames/postal.d.ts +14 -49
  981. package/out/tools/fetch/geonames/postal.d.ts.map +1 -1
  982. package/out/tools/fetch/geonames/postal.js +17 -56
  983. package/out/tools/fetch/geonames/postal.js.map +1 -1
  984. package/out/tools/fetch/gleif.d.ts +138 -0
  985. package/out/tools/fetch/gleif.d.ts.map +1 -0
  986. package/out/tools/fetch/gleif.js +222 -0
  987. package/out/tools/fetch/gleif.js.map +1 -0
  988. package/out/tools/fetch/header.d.ts +43 -0
  989. package/out/tools/fetch/header.d.ts.map +1 -0
  990. package/out/tools/fetch/header.js +61 -0
  991. package/out/tools/fetch/header.js.map +1 -0
  992. package/out/tools/fetch/inspire-addresses.d.ts +254 -0
  993. package/out/tools/fetch/inspire-addresses.d.ts.map +1 -0
  994. package/out/tools/fetch/inspire-addresses.js +277 -0
  995. package/out/tools/fetch/inspire-addresses.js.map +1 -0
  996. package/out/tools/fetch/openaddresses.d.ts +1 -4
  997. package/out/tools/fetch/openaddresses.d.ts.map +1 -1
  998. package/out/tools/fetch/openaddresses.js +20 -99
  999. package/out/tools/fetch/openaddresses.js.map +1 -1
  1000. package/out/tools/fetch/ourairports.d.ts +6 -33
  1001. package/out/tools/fetch/ourairports.d.ts.map +1 -1
  1002. package/out/tools/fetch/ourairports.js +14 -47
  1003. package/out/tools/fetch/ourairports.js.map +1 -1
  1004. package/out/tools/fetch/ppd.d.ts +4 -3
  1005. package/out/tools/fetch/ppd.d.ts.map +1 -1
  1006. package/out/tools/fetch/ppd.js +10 -7
  1007. package/out/tools/fetch/ppd.js.map +1 -1
  1008. package/out/tools/fetch/vlaanderen-ad.d.ts +131 -0
  1009. package/out/tools/fetch/vlaanderen-ad.d.ts.map +1 -0
  1010. package/out/tools/fetch/vlaanderen-ad.js +293 -0
  1011. package/out/tools/fetch/vlaanderen-ad.js.map +1 -0
  1012. package/out/tools/fetch/wfs-harvest.d.ts +420 -0
  1013. package/out/tools/fetch/wfs-harvest.d.ts.map +1 -0
  1014. package/out/tools/fetch/wfs-harvest.js +525 -0
  1015. package/out/tools/fetch/wfs-harvest.js.map +1 -0
  1016. package/out/tools/fetch/wikidata-subvenue.d.ts +32 -100
  1017. package/out/tools/fetch/wikidata-subvenue.d.ts.map +1 -1
  1018. package/out/tools/fetch/wikidata-subvenue.js +27 -122
  1019. package/out/tools/fetch/wikidata-subvenue.js.map +1 -1
  1020. package/out/tools/fetch/zip-archive.d.ts +54 -0
  1021. package/out/tools/fetch/zip-archive.d.ts.map +1 -0
  1022. package/out/tools/fetch/zip-archive.js +58 -0
  1023. package/out/tools/fetch/zip-archive.js.map +1 -0
  1024. package/out/tools/fetch.d.ts +99 -0
  1025. package/out/tools/fetch.d.ts.map +1 -0
  1026. package/out/tools/fetch.js +95 -0
  1027. package/out/tools/fetch.js.map +1 -0
  1028. package/out/tools/golden/expand.d.ts +28 -13
  1029. package/out/tools/golden/expand.d.ts.map +1 -1
  1030. package/out/tools/golden/expand.js +51 -37
  1031. package/out/tools/golden/expand.js.map +1 -1
  1032. package/out/tools/golden/promote.d.ts +13 -8
  1033. package/out/tools/golden/promote.d.ts.map +1 -1
  1034. package/out/tools/golden/promote.js +38 -30
  1035. package/out/tools/golden/promote.js.map +1 -1
  1036. package/out/tools/golden/relabel-street/directory.d.ts +25 -10
  1037. package/out/tools/golden/relabel-street/directory.d.ts.map +1 -1
  1038. package/out/tools/golden/relabel-street/directory.js +44 -32
  1039. package/out/tools/golden/relabel-street/directory.js.map +1 -1
  1040. package/out/tools/golden/relabel-street/row.d.ts +18 -69
  1041. package/out/tools/golden/relabel-street/row.d.ts.map +1 -1
  1042. package/out/tools/golden/relabel-street/row.js +19 -77
  1043. package/out/tools/golden/relabel-street/row.js.map +1 -1
  1044. package/out/tools/golden/{relabel-street/index.d.ts → relabel-street.d.ts} +1 -1
  1045. package/out/tools/golden/relabel-street.d.ts.map +1 -0
  1046. package/out/tools/golden/{relabel-street/index.js → relabel-street.js} +1 -1
  1047. package/out/tools/golden/relabel-street.js.map +1 -0
  1048. package/out/tools/ingest-csv.d.ts +19 -15
  1049. package/out/tools/ingest-csv.d.ts.map +1 -1
  1050. package/out/tools/ingest-csv.js +42 -46
  1051. package/out/tools/ingest-csv.js.map +1 -1
  1052. package/out/tools/jsonl-to-parquet.d.ts +15 -28
  1053. package/out/tools/jsonl-to-parquet.d.ts.map +1 -1
  1054. package/out/tools/jsonl-to-parquet.js +49 -91
  1055. package/out/tools/jsonl-to-parquet.js.map +1 -1
  1056. package/out/tools/lint/recipe-output/vocab.d.ts +82 -0
  1057. package/out/tools/lint/recipe-output/vocab.d.ts.map +1 -0
  1058. package/out/tools/lint/{slice → recipe-output}/vocab.js +54 -69
  1059. package/out/tools/lint/recipe-output/vocab.js.map +1 -0
  1060. package/out/tools/lint/recipe-output.d.ts +73 -0
  1061. package/out/tools/lint/recipe-output.d.ts.map +1 -0
  1062. package/out/tools/lint/{slice/index.js → recipe-output.js} +93 -96
  1063. package/out/tools/lint/recipe-output.js.map +1 -0
  1064. package/out/tools/migrate/overlay-parquet.d.ts +30 -0
  1065. package/out/tools/migrate/overlay-parquet.d.ts.map +1 -0
  1066. package/out/tools/migrate/overlay-parquet.js +141 -0
  1067. package/out/tools/migrate/overlay-parquet.js.map +1 -0
  1068. package/out/tools/migrate/recipe-output.d.ts +35 -0
  1069. package/out/tools/migrate/recipe-output.d.ts.map +1 -0
  1070. package/out/tools/migrate/recipe-output.js +124 -0
  1071. package/out/tools/migrate/recipe-output.js.map +1 -0
  1072. package/out/tools/migrate/source-names.d.ts +52 -0
  1073. package/out/tools/migrate/source-names.d.ts.map +1 -0
  1074. package/out/tools/migrate/source-names.js +105 -0
  1075. package/out/tools/migrate/source-names.js.map +1 -0
  1076. package/out/tools/overlay/kryptonite.d.ts +33 -0
  1077. package/out/tools/overlay/kryptonite.d.ts.map +1 -0
  1078. package/out/tools/{slice → overlay}/kryptonite.js +39 -29
  1079. package/out/tools/overlay/kryptonite.js.map +1 -0
  1080. package/out/tools/overlay/manifest.d.ts +143 -0
  1081. package/out/tools/overlay/manifest.d.ts.map +1 -0
  1082. package/out/tools/overlay/manifest.js +261 -0
  1083. package/out/tools/overlay/manifest.js.map +1 -0
  1084. package/out/tools/overlay/merge-source.d.ts +74 -0
  1085. package/out/tools/overlay/merge-source.d.ts.map +1 -0
  1086. package/out/tools/overlay/merge-source.js +63 -0
  1087. package/out/tools/overlay/merge-source.js.map +1 -0
  1088. package/out/tools/overlay/split-slice.d.ts +66 -0
  1089. package/out/tools/overlay/split-slice.d.ts.map +1 -0
  1090. package/out/tools/overlay/split-slice.js +78 -0
  1091. package/out/tools/overlay/split-slice.js.map +1 -0
  1092. package/out/tools/overlay/translit.d.ts +55 -0
  1093. package/out/tools/overlay/translit.d.ts.map +1 -0
  1094. package/out/tools/{slice → overlay}/translit.js +61 -49
  1095. package/out/tools/overlay/translit.js.map +1 -0
  1096. package/out/tools/overture-subvenue.d.ts +17 -76
  1097. package/out/tools/overture-subvenue.d.ts.map +1 -1
  1098. package/out/tools/overture-subvenue.js +7 -74
  1099. package/out/tools/overture-subvenue.js.map +1 -1
  1100. package/out/tools/postcode-triples.d.ts +78 -127
  1101. package/out/tools/postcode-triples.d.ts.map +1 -1
  1102. package/out/tools/postcode-triples.js +200 -193
  1103. package/out/tools/postcode-triples.js.map +1 -1
  1104. package/out/tools/source-register/build.d.ts +147 -0
  1105. package/out/tools/source-register/build.d.ts.map +1 -0
  1106. package/out/tools/source-register/build.js +517 -0
  1107. package/out/tools/source-register/build.js.map +1 -0
  1108. package/out/tools/sub/venue/head-nouns.d.ts +9 -38
  1109. package/out/tools/sub/venue/head-nouns.d.ts.map +1 -1
  1110. package/out/tools/sub/venue/head-nouns.js +37 -74
  1111. package/out/tools/sub/venue/head-nouns.js.map +1 -1
  1112. package/out/tools/sub/venue/lexicon.d.ts +53 -84
  1113. package/out/tools/sub/venue/lexicon.d.ts.map +1 -1
  1114. package/out/tools/sub/venue/lexicon.js +42 -90
  1115. package/out/tools/sub/venue/lexicon.js.map +1 -1
  1116. package/out/tools/sub/venue/wikidata.d.ts +8 -6
  1117. package/out/tools/sub/venue/wikidata.d.ts.map +1 -1
  1118. package/out/tools/sub/venue/wikidata.js +12 -9
  1119. package/out/tools/sub/venue/wikidata.js.map +1 -1
  1120. package/out/tw/tools/fetch/gcis.d.ts +9 -3
  1121. package/out/tw/tools/fetch/gcis.d.ts.map +1 -1
  1122. package/out/tw/tools/fetch/gcis.js +19 -13
  1123. package/out/tw/tools/fetch/gcis.js.map +1 -1
  1124. package/out/types.d.ts +271 -101
  1125. package/out/types.d.ts.map +1 -1
  1126. package/out/types.js +133 -9
  1127. package/out/types.js.map +1 -1
  1128. package/out/us/adapters/fcc-bdc/adapter.d.ts +18 -36
  1129. package/out/us/adapters/fcc-bdc/adapter.d.ts.map +1 -1
  1130. package/out/us/adapters/fcc-bdc/adapter.js +25 -38
  1131. package/out/us/adapters/fcc-bdc/adapter.js.map +1 -1
  1132. package/out/us/adapters/state/hi-schools/adapter.d.ts +12 -11
  1133. package/out/us/adapters/state/hi-schools/adapter.d.ts.map +1 -1
  1134. package/out/us/adapters/state/hi-schools/adapter.js +26 -16
  1135. package/out/us/adapters/state/hi-schools/adapter.js.map +1 -1
  1136. package/out/us/adapters/state/hi-schools/workbook.d.ts +8 -3
  1137. package/out/us/adapters/state/hi-schools/workbook.d.ts.map +1 -1
  1138. package/out/us/adapters/state/hi-schools/workbook.js +3 -1
  1139. package/out/us/adapters/state/hi-schools/workbook.js.map +1 -1
  1140. package/out/us/adapters/state/ia-contractors/adapter.d.ts +13 -6
  1141. package/out/us/adapters/state/ia-contractors/adapter.d.ts.map +1 -1
  1142. package/out/us/adapters/state/ia-contractors/adapter.js +27 -14
  1143. package/out/us/adapters/state/ia-contractors/adapter.js.map +1 -1
  1144. package/out/us/adapters/state/ny-notaries/adapter.d.ts +7 -6
  1145. package/out/us/adapters/state/ny-notaries/adapter.d.ts.map +1 -1
  1146. package/out/us/adapters/state/ny-notaries/adapter.js +24 -22
  1147. package/out/us/adapters/state/ny-notaries/adapter.js.map +1 -1
  1148. package/out/us/adapters/state/tx-notaries/adapter.d.ts +8 -7
  1149. package/out/us/adapters/state/tx-notaries/adapter.d.ts.map +1 -1
  1150. package/out/us/adapters/state/tx-notaries/adapter.js +21 -14
  1151. package/out/us/adapters/state/tx-notaries/adapter.js.map +1 -1
  1152. package/out/us/adapters/tiger/adapter.d.ts +10 -34
  1153. package/out/us/adapters/tiger/adapter.d.ts.map +1 -1
  1154. package/out/us/adapters/tiger/adapter.js +18 -42
  1155. package/out/us/adapters/tiger/adapter.js.map +1 -1
  1156. package/out/us/adapters/tiger/street-decompose.d.ts +6 -13
  1157. package/out/us/adapters/tiger/street-decompose.d.ts.map +1 -1
  1158. package/out/us/adapters/tiger/street-decompose.js +7 -17
  1159. package/out/us/adapters/tiger/street-decompose.js.map +1 -1
  1160. package/out/us/adapters/usgov/hrsa-fqhc/adapter.d.ts +26 -20
  1161. package/out/us/adapters/usgov/hrsa-fqhc/adapter.d.ts.map +1 -1
  1162. package/out/us/adapters/usgov/hrsa-fqhc/adapter.js +41 -29
  1163. package/out/us/adapters/usgov/hrsa-fqhc/adapter.js.map +1 -1
  1164. package/out/us/adapters/usgov/imls-pls/adapter.d.ts +8 -7
  1165. package/out/us/adapters/usgov/imls-pls/adapter.d.ts.map +1 -1
  1166. package/out/us/adapters/usgov/imls-pls/adapter.js +25 -18
  1167. package/out/us/adapters/usgov/imls-pls/adapter.js.map +1 -1
  1168. package/out/us/adapters/usgov/irs-bmf/adapter.d.ts +11 -10
  1169. package/out/us/adapters/usgov/irs-bmf/adapter.d.ts.map +1 -1
  1170. package/out/us/adapters/usgov/irs-bmf/adapter.js +32 -22
  1171. package/out/us/adapters/usgov/irs-bmf/adapter.js.map +1 -1
  1172. package/out/us/adapters/usgov/nad/adapter.d.ts +11 -31
  1173. package/out/us/adapters/usgov/nad/adapter.d.ts.map +1 -1
  1174. package/out/us/adapters/usgov/nad/adapter.js +57 -111
  1175. package/out/us/adapters/usgov/nad/adapter.js.map +1 -1
  1176. package/out/us/adapters/usgov/nppes/adapter.d.ts +12 -22
  1177. package/out/us/adapters/usgov/nppes/adapter.d.ts.map +1 -1
  1178. package/out/us/adapters/usgov/nppes/adapter.js +62 -32
  1179. package/out/us/adapters/usgov/nppes/adapter.js.map +1 -1
  1180. package/out/us/adapters/usgov/samhsa-treatment-locator/adapter.d.ts +16 -15
  1181. package/out/us/adapters/usgov/samhsa-treatment-locator/adapter.d.ts.map +1 -1
  1182. package/out/us/adapters/usgov/samhsa-treatment-locator/adapter.js +38 -28
  1183. package/out/us/adapters/usgov/samhsa-treatment-locator/adapter.js.map +1 -1
  1184. package/out/us/fips-state.d.ts +19 -10
  1185. package/out/us/fips-state.d.ts.map +1 -1
  1186. package/out/us/fips-state.js +17 -8
  1187. package/out/us/fips-state.js.map +1 -1
  1188. package/out/{synthesizers → us/synthesizers}/intersection.d.ts +10 -8
  1189. package/out/us/synthesizers/intersection.d.ts.map +1 -0
  1190. package/out/{synthesizers → us/synthesizers}/intersection.js +46 -35
  1191. package/out/us/synthesizers/intersection.js.map +1 -0
  1192. package/out/{synthesizers → us/synthesizers}/street.d.ts +19 -12
  1193. package/out/us/synthesizers/street.d.ts.map +1 -0
  1194. package/out/{synthesizers → us/synthesizers}/street.js +45 -38
  1195. package/out/us/synthesizers/street.js.map +1 -0
  1196. package/out/us/tools/fetch/hrsa.d.ts +3 -3
  1197. package/out/us/tools/fetch/hrsa.d.ts.map +1 -1
  1198. package/out/us/tools/fetch/hrsa.js +6 -7
  1199. package/out/us/tools/fetch/hrsa.js.map +1 -1
  1200. package/out/us/tools/fetch/imls-pls.d.ts +5 -16
  1201. package/out/us/tools/fetch/imls-pls.d.ts.map +1 -1
  1202. package/out/us/tools/fetch/imls-pls.js +17 -34
  1203. package/out/us/tools/fetch/imls-pls.js.map +1 -1
  1204. package/out/us/tools/fetch/nad.d.ts +22 -10
  1205. package/out/us/tools/fetch/nad.d.ts.map +1 -1
  1206. package/out/us/tools/fetch/nad.js +30 -25
  1207. package/out/us/tools/fetch/nad.js.map +1 -1
  1208. package/out/us/tools/fetch/nppes.d.ts +6 -16
  1209. package/out/us/tools/fetch/nppes.d.ts.map +1 -1
  1210. package/out/us/tools/fetch/nppes.js +24 -36
  1211. package/out/us/tools/fetch/nppes.js.map +1 -1
  1212. package/out/us/tools/fetch/state/hi-schools.d.ts +9 -5
  1213. package/out/us/tools/fetch/state/hi-schools.d.ts.map +1 -1
  1214. package/out/us/tools/fetch/state/hi-schools.js +16 -14
  1215. package/out/us/tools/fetch/state/hi-schools.js.map +1 -1
  1216. package/out/us/tools/fetch/state/sources.d.ts +8 -7
  1217. package/out/us/tools/fetch/state/sources.d.ts.map +1 -1
  1218. package/out/us/tools/fetch/state/sources.js +8 -9
  1219. package/out/us/tools/fetch/state/sources.js.map +1 -1
  1220. package/out/us/tools/fetch/tiger-full.d.ts +1 -14
  1221. package/out/us/tools/fetch/tiger-full.d.ts.map +1 -1
  1222. package/out/us/tools/fetch/tiger-full.js +16 -55
  1223. package/out/us/tools/fetch/tiger-full.js.map +1 -1
  1224. package/out/utils/align.d.ts +26 -19
  1225. package/out/utils/align.d.ts.map +1 -1
  1226. package/out/utils/align.js +32 -47
  1227. package/out/utils/align.js.map +1 -1
  1228. package/out/utils/cooccurrence-stats.d.ts +58 -0
  1229. package/out/utils/cooccurrence-stats.d.ts.map +1 -0
  1230. package/out/utils/cooccurrence-stats.js +62 -0
  1231. package/out/utils/cooccurrence-stats.js.map +1 -0
  1232. package/out/utils/golden.d.ts +21 -31
  1233. package/out/utils/golden.d.ts.map +1 -1
  1234. package/out/utils/golden.js +30 -46
  1235. package/out/utils/golden.js.map +1 -1
  1236. package/out/utils/license.d.ts +159 -22
  1237. package/out/utils/license.d.ts.map +1 -1
  1238. package/out/utils/license.js +156 -26
  1239. package/out/utils/license.js.map +1 -1
  1240. package/out/utils/split.d.ts +66 -70
  1241. package/out/utils/split.d.ts.map +1 -1
  1242. package/out/utils/split.js +162 -69
  1243. package/out/utils/split.js.map +1 -1
  1244. package/out/utils/tokenize.d.ts +15 -44
  1245. package/out/utils/tokenize.d.ts.map +1 -1
  1246. package/out/utils/tokenize.js +18 -31
  1247. package/out/utils/tokenize.js.map +1 -1
  1248. package/out/utils/wof-json.d.ts +88 -62
  1249. package/out/utils/wof-json.d.ts.map +1 -1
  1250. package/out/utils/wof-json.js +77 -56
  1251. package/out/utils/wof-json.js.map +1 -1
  1252. package/out/{utils/index.js → utils.d.ts} +1 -2
  1253. package/out/utils.d.ts.map +1 -0
  1254. package/out/{utils/index.d.ts → utils.js} +1 -2
  1255. package/out/utils.js.map +1 -0
  1256. package/out/ve/recipes/reviewed-postcode-tail.d.ts +25 -7
  1257. package/out/ve/recipes/reviewed-postcode-tail.d.ts.map +1 -1
  1258. package/out/ve/recipes/reviewed-postcode-tail.js +33 -12
  1259. package/out/ve/recipes/reviewed-postcode-tail.js.map +1 -1
  1260. package/package.json +45 -488
  1261. package/lib/adapters/index.ts +0 -160
  1262. package/lib/adapters/synth-po-box/adapter.ts +0 -204
  1263. package/lib/adapters/utils/index.ts +0 -307
  1264. package/lib/recipes/bare/postcode/index.ts +0 -327
  1265. package/lib/recipes/sub/venue/index.ts +0 -997
  1266. package/lib/synthesizers/locale.ts +0 -261
  1267. package/lib/test-kit/index.ts +0 -100
  1268. package/lib/tools/align-slice.ts +0 -68
  1269. package/lib/tools/fetch/index.ts +0 -174
  1270. package/lib/tools/gb-title-case.ts +0 -69
  1271. package/lib/tools/index.ts +0 -28
  1272. package/lib/tools/lint/slice/vocab.ts +0 -376
  1273. package/lib/tools/overlay-manifest.ts +0 -215
  1274. package/lib/tools/slice/translit.ts +0 -218
  1275. package/lib/tools/sub/venue/harvest.ts +0 -234
  1276. package/lib/tools/sub/venue/surfaces.ts +0 -95
  1277. package/lib/tools/sub/venue/table.ts +0 -281
  1278. package/lib/utils/parquet.ts +0 -582
  1279. package/out/adapters/index.d.ts +0 -51
  1280. package/out/adapters/index.d.ts.map +0 -1
  1281. package/out/adapters/index.js +0 -97
  1282. package/out/adapters/index.js.map +0 -1
  1283. package/out/adapters/synth-po-box/adapter.d.ts +0 -67
  1284. package/out/adapters/synth-po-box/adapter.d.ts.map +0 -1
  1285. package/out/adapters/synth-po-box/adapter.js.map +0 -1
  1286. package/out/adapters/utils/index.d.ts +0 -191
  1287. package/out/adapters/utils/index.d.ts.map +0 -1
  1288. package/out/adapters/utils/index.js +0 -206
  1289. package/out/adapters/utils/index.js.map +0 -1
  1290. package/out/fr/adapters/ban/street-decompose.d.ts.map +0 -1
  1291. package/out/fr/adapters/ban/street-decompose.js.map +0 -1
  1292. package/out/no/recipes/street/index.d.ts +0 -18
  1293. package/out/no/recipes/street/index.d.ts.map +0 -1
  1294. package/out/no/recipes/street/index.js.map +0 -1
  1295. package/out/recipes/bare/postcode/index.d.ts +0 -62
  1296. package/out/recipes/bare/postcode/index.d.ts.map +0 -1
  1297. package/out/recipes/bare/postcode/index.js.map +0 -1
  1298. package/out/recipes/index.d.ts +0 -24
  1299. package/out/recipes/index.d.ts.map +0 -1
  1300. package/out/recipes/index.js.map +0 -1
  1301. package/out/recipes/po/box/index.d.ts +0 -17
  1302. package/out/recipes/po/box/index.d.ts.map +0 -1
  1303. package/out/recipes/po/box/index.js.map +0 -1
  1304. package/out/recipes/sub/venue/index.d.ts +0 -270
  1305. package/out/recipes/sub/venue/index.d.ts.map +0 -1
  1306. package/out/recipes/sub/venue/index.js +0 -728
  1307. package/out/recipes/sub/venue/index.js.map +0 -1
  1308. package/out/synthesizers/intersection.d.ts.map +0 -1
  1309. package/out/synthesizers/intersection.js.map +0 -1
  1310. package/out/synthesizers/locale.d.ts +0 -116
  1311. package/out/synthesizers/locale.d.ts.map +0 -1
  1312. package/out/synthesizers/locale.js +0 -150
  1313. package/out/synthesizers/locale.js.map +0 -1
  1314. package/out/synthesizers/street.d.ts.map +0 -1
  1315. package/out/synthesizers/street.js.map +0 -1
  1316. package/out/test-kit/index.d.ts +0 -48
  1317. package/out/test-kit/index.d.ts.map +0 -1
  1318. package/out/test-kit/index.js +0 -78
  1319. package/out/test-kit/index.js.map +0 -1
  1320. package/out/tools/align-slice.d.ts +0 -7
  1321. package/out/tools/align-slice.d.ts.map +0 -1
  1322. package/out/tools/align-slice.js +0 -55
  1323. package/out/tools/align-slice.js.map +0 -1
  1324. package/out/tools/fetch/download/index.d.ts.map +0 -1
  1325. package/out/tools/fetch/download/index.js.map +0 -1
  1326. package/out/tools/fetch/index.d.ts +0 -171
  1327. package/out/tools/fetch/index.d.ts.map +0 -1
  1328. package/out/tools/fetch/index.js +0 -170
  1329. package/out/tools/fetch/index.js.map +0 -1
  1330. package/out/tools/gb-title-case.d.ts +0 -2
  1331. package/out/tools/gb-title-case.d.ts.map +0 -1
  1332. package/out/tools/gb-title-case.js +0 -65
  1333. package/out/tools/gb-title-case.js.map +0 -1
  1334. package/out/tools/golden/relabel-street/index.d.ts.map +0 -1
  1335. package/out/tools/golden/relabel-street/index.js.map +0 -1
  1336. package/out/tools/index.d.ts +0 -28
  1337. package/out/tools/index.d.ts.map +0 -1
  1338. package/out/tools/index.js +0 -28
  1339. package/out/tools/index.js.map +0 -1
  1340. package/out/tools/lint/slice/index.d.ts +0 -93
  1341. package/out/tools/lint/slice/index.d.ts.map +0 -1
  1342. package/out/tools/lint/slice/index.js.map +0 -1
  1343. package/out/tools/lint/slice/vocab.d.ts +0 -90
  1344. package/out/tools/lint/slice/vocab.d.ts.map +0 -1
  1345. package/out/tools/lint/slice/vocab.js.map +0 -1
  1346. package/out/tools/overlay-manifest.d.ts +0 -89
  1347. package/out/tools/overlay-manifest.d.ts.map +0 -1
  1348. package/out/tools/overlay-manifest.js +0 -131
  1349. package/out/tools/overlay-manifest.js.map +0 -1
  1350. package/out/tools/slice/kryptonite.d.ts +0 -32
  1351. package/out/tools/slice/kryptonite.d.ts.map +0 -1
  1352. package/out/tools/slice/kryptonite.js.map +0 -1
  1353. package/out/tools/slice/translit.d.ts +0 -51
  1354. package/out/tools/slice/translit.d.ts.map +0 -1
  1355. package/out/tools/slice/translit.js.map +0 -1
  1356. package/out/tools/sub/venue/harvest.d.ts +0 -100
  1357. package/out/tools/sub/venue/harvest.d.ts.map +0 -1
  1358. package/out/tools/sub/venue/harvest.js +0 -168
  1359. package/out/tools/sub/venue/harvest.js.map +0 -1
  1360. package/out/tools/sub/venue/promotions.d.ts +0 -94
  1361. package/out/tools/sub/venue/promotions.d.ts.map +0 -1
  1362. package/out/tools/sub/venue/promotions.js.map +0 -1
  1363. package/out/tools/sub/venue/surfaces.d.ts +0 -45
  1364. package/out/tools/sub/venue/surfaces.d.ts.map +0 -1
  1365. package/out/tools/sub/venue/surfaces.js +0 -77
  1366. package/out/tools/sub/venue/surfaces.js.map +0 -1
  1367. package/out/tools/sub/venue/table.d.ts +0 -229
  1368. package/out/tools/sub/venue/table.d.ts.map +0 -1
  1369. package/out/tools/sub/venue/table.js +0 -108
  1370. package/out/tools/sub/venue/table.js.map +0 -1
  1371. package/out/utils/index.d.ts.map +0 -1
  1372. package/out/utils/index.js.map +0 -1
  1373. package/out/utils/parquet.d.ts +0 -178
  1374. package/out/utils/parquet.d.ts.map +0 -1
  1375. package/out/utils/parquet.js +0 -371
  1376. package/out/utils/parquet.js.map +0 -1
  1377. package/out/utils/slice-stats.d.ts +0 -52
  1378. package/out/utils/slice-stats.d.ts.map +0 -1
  1379. package/out/utils/slice-stats.js +0 -58
  1380. package/out/utils/slice-stats.js.map +0 -1
  1381. /package/lib/tools/fetch/{download/index.ts → download.ts} +0 -0
  1382. /package/lib/tools/golden/{relabel-street/index.ts → relabel-street.ts} +0 -0
@@ -0,0 +1,954 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The paging, manifest and resumption machinery a paged WFS harvest shares.
7
+ *
8
+ * `./inspire-addresses.ts` owns what an INSPIRE Addresses service exposes — its capabilities, its
9
+ * feature-type names and its GeoJSON pages. This module owns what a harvest of any paged WFS does
10
+ * with those pages: it appends each one to the single file an adapter's `inputPath` points at,
11
+ * records the page in a manifest beside it, and resumes from that manifest after an interrupted run.
12
+ *
13
+ * One file rather than one file per page, because the adapters read one. `#ee/adapters/ads/adapter`
14
+ * opens `opts.inputPath` as newline-delimited JSON and `#pl/adapters/emuia/adapter` opens it as one
15
+ * markup stream, so a directory of pages reaches neither. The manifest therefore records each page's
16
+ * byte range inside that file: `offset`, `bytes` and the sha256 of exactly those bytes. A range is
17
+ * what makes a page verifiable after it has been concatenated into its neighbors, and what lets an
18
+ * interrupted append be truncated back to a page boundary rather than discarding the harvest.
19
+ *
20
+ * Three properties of a WFS make this harder than reading pages until they run out, and each is
21
+ * handled here rather than by each country's module:
22
+ *
23
+ * 1. A service may ignore `startIndex` and answer every page with the first. `countWFSFeaturesByPaging`
24
+ * in `@mailwoman/core/api` refuses such a service by comparing two pages' leading feature. A
25
+ * harvest sees the same defect as two consecutive pages with equal bytes. It refuses that pair.
26
+ * 2. A service's own `numberMatched` may be a per-request cap rather than a count. The caller states
27
+ * what its count is and where it came from, and {@linkcode PagedWFSHarvestOptions.featureCount}
28
+ * holds both. No count is written into this module, and a harvest with no usable count ends on
29
+ * the first page that returns no features.
30
+ * 3. A page may return fewer features than `count` asks for. The next `startIndex` therefore advances
31
+ * by the features the service returned rather than by the page size, so a service that caps a page
32
+ * below the requested size is read whole instead of being read in strides that skip features.
33
+ */
34
+
35
+ import { APIClient, assertNoOGCServiceException, type CheckedWFSFeatureCount } from "@mailwoman/core/api"
36
+ import { ByteFormatter } from "@mailwoman/core/fs/formatters"
37
+ import { readFileRange } from "@mailwoman/core/fs/readers"
38
+ import { tryStat } from "@mailwoman/core/fs/readers/stat"
39
+ import { appendLocalTextFile, makeDirectories, removePathIfPresent, truncateFile } from "@mailwoman/core/fs/writers"
40
+ import { sha256File, sha256Hex } from "@mailwoman/core/hash"
41
+ import { stringifyJSON } from "@mailwoman/core/json"
42
+ import { isoSecondsUTC } from "@mailwoman/core/utils"
43
+ import { PathBuilder, type PathBuilderLike } from "path-ts"
44
+
45
+ import { readManifest, writeManifest, type FetchSummary } from "#tools/fetch/download"
46
+
47
+ /**
48
+ * The WFS version this repository's harvesters speak.
49
+ *
50
+ * 2.0.0 defines `startIndex` paging and the `hits` result type, and it is what
51
+ * every service measured for these modules advertises.
52
+ */
53
+ export const WFS_VERSION = "2.0.0"
54
+
55
+ /**
56
+ * The file name a harvest writes its manifest under, beside the data file.
57
+ */
58
+ export const HARVEST_MANIFEST_FILE = "MANIFEST.json"
59
+
60
+ /**
61
+ * The first element of a response, as the service wrote it.
62
+ */
63
+ export interface MarkupRoot {
64
+ /**
65
+ * The opening tag verbatim, `<wfs:FeatureCollection …>`.
66
+ */
67
+ tag: string
68
+ /**
69
+ * The element's qualified name, prefix included.
70
+ */
71
+ name: string
72
+ /**
73
+ * The text between the name and the tag's terminator.
74
+ * It holds the attributes.
75
+ */
76
+ attributes: string
77
+ /**
78
+ * The offset just past the opening tag.
79
+ */
80
+ contentStart: number
81
+ }
82
+
83
+ /**
84
+ * The first element tag in a document.
85
+ *
86
+ * An index scan over the tag rather than a parse of the document: a harvest needs the
87
+ * opening tag verbatim to open the file it assembles, and parsing a 1.6 MB page per request
88
+ * to recover a tag that the first 400 bytes already hold costs a document parse per page.
89
+ *
90
+ * The leading `[A-Za-z_]` skips the XML declaration.
91
+ * That declaration opens `<?xml`.
92
+ */
93
+ const ROOT_OPENING_TAG = /<([A-Za-z_][\w.:-]*)([^>]*)>/u
94
+
95
+ /**
96
+ * One attribute of an opening tag, by local name.
97
+ */
98
+ function tagAttribute(root: MarkupRoot, attribute: string): string | null {
99
+ const pattern = new RegExp(`(?:^|\\s)(?:[\\w.-]+:)?${attribute}\\s*=\\s*"([^"]*)"`, "iu")
100
+
101
+ return pattern.exec(root.attributes)?.[1] ?? null
102
+ }
103
+
104
+ /**
105
+ * The count an opening tag states, or `null` where it states none or declines to state one.
106
+ *
107
+ * WFS 2.0 permits `numberMatched="unknown"`, which declines to count rather than counting none.
108
+ */
109
+ export function rootCount(root: MarkupRoot, attribute: string): number | null {
110
+ const value = tagAttribute(root, attribute)
111
+
112
+ return value && /^\d+$/u.test(value) ? Number(value) : null
113
+ }
114
+
115
+ /**
116
+ * The document's first element tag.
117
+ *
118
+ * @throws When the body holds no element tag, so a response that is not markup
119
+ * reads as unreadable rather than as a page of no features.
120
+ */
121
+ export function readMarkupRoot(body: string, context: string): MarkupRoot {
122
+ const match = ROOT_OPENING_TAG.exec(body)
123
+
124
+ if (!match) {
125
+ throw new TypeError(
126
+ `${context}: the response carried no element tag, so its root could not be read, beginning ${stringifyJSON(body.slice(0, 120))}`
127
+ )
128
+ }
129
+
130
+ return {
131
+ tag: match[0],
132
+ name: match[1] ?? "",
133
+ attributes: match[2] ?? "",
134
+ contentStart: match.index + match[0].length,
135
+ }
136
+ }
137
+
138
+ /**
139
+ * The content between a document's root tags.
140
+ * For a `wfs:FeatureCollection` those are its members.
141
+ *
142
+ * @throws When the root element is not closed, so a truncated transfer reads as
143
+ * unreadable rather than as a page of no features.
144
+ */
145
+ export function rootContent(body: string, root: MarkupRoot, context: string): string {
146
+ const closing = `</${root.name}>`
147
+ const end = body.lastIndexOf(closing)
148
+
149
+ if (end < root.contentStart) {
150
+ throw new TypeError(
151
+ `${context}: the response's ${root.name} element is not closed, so the members it holds could not be separated from the document that carries them`
152
+ )
153
+ }
154
+
155
+ return body.slice(root.contentStart, end)
156
+ }
157
+
158
+ /**
159
+ * The attributes a page states about itself rather than about the feature type.
160
+ *
161
+ * A harvest assembles many pages under one root element, so the first page's counts
162
+ * and timestamp would describe the assembled file wrongly.
163
+ * They are dropped and the manifest records them per page.
164
+ */
165
+ const PAGE_ATTRIBUTES = /\s(?:[\w.-]+:)?(?:numberMatched|numberReturned|timeStamp|next|previous)\s*=\s*"[^"]*"/giu
166
+
167
+ /**
168
+ * A page's root tag with its namespace declarations kept and its per-page attributes
169
+ * dropped, so it can open a file holding every page.
170
+ */
171
+ export function collectionOpeningTag(root: MarkupRoot): string {
172
+ return `<${root.name}${root.attributes.replace(PAGE_ATTRIBUTES, "")}>`
173
+ }
174
+
175
+ /**
176
+ * One `GetFeature` response in a markup format, with what its root states about itself.
177
+ */
178
+ export interface WFSMarkupPage {
179
+ body: string
180
+ root: MarkupRoot
181
+ /**
182
+ * The `numberReturned` the root states, or `null` where it states none.
183
+ */
184
+ numberReturned: number | null
185
+ /**
186
+ * The `numberMatched` the root states, or `null` where it answers `unknown`.
187
+ */
188
+ numberMatched: number | null
189
+ /**
190
+ * The `timeStamp` the root states, or `null` where it states none.
191
+ */
192
+ timeStamp: string | null
193
+ }
194
+
195
+ /**
196
+ * Issues one `GetFeature` and reads the counts off the root element.
197
+ *
198
+ * @throws When the service answers an OGC exception report, so an HTTP 400 carrying
199
+ * `ows:ExceptionCode` raises rather than being written into the harvest as a page.
200
+ */
201
+ export async function readWFSMarkupPage(
202
+ client: Pick<APIClient, "fetch">,
203
+ options: { wfsURL: string; context: string; params: Readonly<Record<string, string>> }
204
+ ): Promise<WFSMarkupPage> {
205
+ const { data } = await client.fetch<string>({
206
+ method: "GET",
207
+ url: options.wfsURL,
208
+ responseType: "text",
209
+ params: { service: "WFS", version: WFS_VERSION, request: "GetFeature", ...options.params },
210
+ })
211
+
212
+ assertNoOGCServiceException(data, options.context)
213
+
214
+ const root = readMarkupRoot(data, options.context)
215
+
216
+ return {
217
+ body: data,
218
+ root,
219
+ numberReturned: rootCount(root, "numberReturned"),
220
+ numberMatched: rootCount(root, "numberMatched"),
221
+ timeStamp: tagAttribute(root, "timeStamp"),
222
+ }
223
+ }
224
+
225
+ /**
226
+ * What a harvest asked the service for.
227
+ *
228
+ * Recorded in the manifest and compared against a resumed run's request: a harvest whose page
229
+ * size, ordering or format changed cannot be continued from pages taken under the old one.
230
+ */
231
+ export interface WFSHarvestRequest {
232
+ wfsURL: string
233
+ typeName: string
234
+ outputFormat: string
235
+ /**
236
+ * The property the service was asked to order by, or `null` where it grants no ordering.
237
+ *
238
+ * Without one, a resumed harvest rests on the service returning the same
239
+ * features in the same order as the earlier run.
240
+ * No WFS guarantees that order.
241
+ */
242
+ sortBy: string | null
243
+ }
244
+
245
+ /**
246
+ * A feature count and how it was obtained.
247
+ *
248
+ * `count` is `null` where the service states no usable count.
249
+ * The harvest then ends on the first page that returns no features, and
250
+ * `because` records what the service said instead.
251
+ */
252
+ export interface FeatureCountStatement {
253
+ count: number | null
254
+ because: string
255
+ }
256
+
257
+ /**
258
+ * The count a service states, or no count and the reason there is none.
259
+ *
260
+ * `readCheckedWFSFeatureCount` proves a reported `numberMatched` against a page of the same type.
261
+ * That comparison catches a service whose count is smaller than one of its own pages.
262
+ *
263
+ * It cannot catch a count that equals the service's page cap: no page can return more
264
+ * features than the cap, so the page it asks for agrees with the cap every time.
265
+ *
266
+ * Poland's service is that case.
267
+ * Measured 2026-10-02, `resultType=hits` at `startIndex=1` reports `numberMatched="1000"`, its
268
+ * capabilities document advertises `CountDefault` as 1000, and a page returns at most 1,000 features.
269
+ *
270
+ * The reported number is the cap, and a harvest that read it as a count would store 1,000
271
+ * of the 8.6 million features the service holds and record the type as read whole.
272
+ * The harvest therefore records no count when the reported number equals the cap.
273
+ *
274
+ * @param pageCap The largest page the service will serve, from its advertised `CountDefault`.
275
+ */
276
+ export function statedFeatureCount(checked: CheckedWFSFeatureCount, pageCap: number | null): FeatureCountStatement {
277
+ if (!checked.usable || checked.reported === null) {
278
+ return { count: null, because: `the service stated no usable count: ${checked.because}` }
279
+ }
280
+
281
+ if (pageCap !== null && checked.reported === pageCap) {
282
+ return {
283
+ count: null,
284
+ because: `the service reported numberMatched=${checked.reported}, which is the ${pageCap}-feature cap it advertises as CountDefault, so the number describes the largest page it will serve rather than what the type holds`,
285
+ }
286
+ }
287
+
288
+ return {
289
+ count: checked.reported,
290
+ because: `the service reported numberMatched=${checked.reported} past index 0, and ${checked.because}`,
291
+ }
292
+ }
293
+
294
+ /**
295
+ * One page's contribution to the harvest file.
296
+ */
297
+ export interface HarvestedPayload {
298
+ /**
299
+ * The text appended to the harvest file for this page.
300
+ */
301
+ payload: string
302
+ /**
303
+ * Text written once, before the first page's payload — a document prolog
304
+ * and root tag, where the format needs one.
305
+ *
306
+ * Read from the first page a run writes and recorded in the manifest.
307
+ */
308
+ header?: string
309
+ /**
310
+ * Text written once the harvest reaches the end of the feature type, such as a closing root tag.
311
+ */
312
+ footer?: string
313
+ /**
314
+ * The features the service returned.
315
+ * The next `startIndex` advances by this number.
316
+ *
317
+ * `null` where the service stated none.
318
+ * The harvest refuses that rather than reading it as zero.
319
+ */
320
+ numberReturned: number | null
321
+ numberMatched: number | null
322
+ retrievedAt: string | null
323
+ }
324
+
325
+ /**
326
+ * One page as the manifest records it.
327
+ *
328
+ * `offset` and `bytes` locate the page inside the harvest file and `sha256` is the digest of
329
+ * exactly those bytes, so a page stays verifiable after the pages around it were appended.
330
+ */
331
+ export interface WFSHarvestPageRecord {
332
+ start_index: number
333
+ /**
334
+ * The page size requested.
335
+ * A service may answer with fewer features.
336
+ */
337
+ count: number
338
+ offset: number
339
+ bytes: number
340
+ sha256: string
341
+ number_returned: number
342
+ /**
343
+ * The `numberMatched` this page stated, where the service states a real one.
344
+ */
345
+ number_matched: number | null
346
+ retrieved_at: string | null
347
+ }
348
+
349
+ /**
350
+ * The manifest a paged harvest writes beside its data file.
351
+ *
352
+ * Written after every page, so an interrupted run resumes from the last page that reached disk.
353
+ */
354
+ export interface WFSHarvestManifest {
355
+ source: string
356
+ source_url: string
357
+ wfs_version: string
358
+ type_name: string
359
+ output_format: string
360
+ sort_by: string | null
361
+ license: string
362
+ attribution: string
363
+ downloaded_at: string
364
+ /**
365
+ * The file an adapter's `inputPath` points at, beside this manifest.
366
+ */
367
+ filename: string
368
+ page_size: number
369
+ /**
370
+ * The service's own count where it states a usable one, and `null` where it does not.
371
+ */
372
+ feature_count: number | null
373
+ feature_count_source: string
374
+ features_written: number
375
+ header_bytes: number
376
+ /**
377
+ * The text that closes the data file, appended once the harvest reaches the end of the type.
378
+ */
379
+ footer: string
380
+ /**
381
+ * The data file's byte length as this manifest describes it, footer included once complete.
382
+ */
383
+ bytes: number
384
+ /**
385
+ * The whole data file's digest, once the harvest is complete.
386
+ *
387
+ * `null` on a partial harvest, where the file is still being appended to
388
+ * and a digest of it would describe a prefix rather than the harvest.
389
+ */
390
+ sha256: string | null
391
+ complete: boolean
392
+ pages: WFSHarvestPageRecord[]
393
+ }
394
+
395
+ export interface PagedWFSHarvestOptions {
396
+ /**
397
+ * Names the service in every refusal.
398
+ */
399
+ context: string
400
+ /**
401
+ * The adapter slug this harvest feeds, stamped into the manifest.
402
+ */
403
+ source: string
404
+ /**
405
+ * Where the harvest is written.
406
+ *
407
+ * The adapter reads {@linkcode PagedWFSHarvestOptions.filename} inside this directory.
408
+ */
409
+ outputDir: PathBuilderLike
410
+ filename: string
411
+ request: WFSHarvestRequest
412
+ /**
413
+ * The license the address-source register elected for this publisher.
414
+ */
415
+ license: string
416
+ /**
417
+ * The attribution the elected terms require, or an empty string where they require none.
418
+ */
419
+ attribution: string
420
+ featureCount: FeatureCountStatement
421
+ pageSize: number
422
+ /**
423
+ * Stop once the manifest holds this many pages, for a probe rather than a full harvest.
424
+ *
425
+ * A cap on the manifest rather than on the run, so a second run under the same cap makes no request.
426
+ */
427
+ maxPages?: number
428
+ signal?: AbortSignal
429
+ /**
430
+ * Reads one page and states the bytes the harvest file receives for it.
431
+ */
432
+ readPage: (request: { startIndex: number; count: number }) => Promise<HarvestedPayload>
433
+ report?: (line: string) => void
434
+ }
435
+
436
+ /**
437
+ * Does a recorded manifest describe the request being made now?
438
+ *
439
+ * A harvest taken at another page size, ordering, format or type cannot be continued:
440
+ * its pages were cut at different boundaries, and appending to them would leave
441
+ * a file whose manifest describes neither half.
442
+ */
443
+ function describesSameRequest(manifest: WFSHarvestManifest, options: PagedWFSHarvestOptions): boolean {
444
+ return (
445
+ manifest.source_url === options.request.wfsURL &&
446
+ manifest.type_name === options.request.typeName &&
447
+ manifest.output_format === options.request.outputFormat &&
448
+ manifest.sort_by === options.request.sortBy &&
449
+ manifest.page_size === options.pageSize &&
450
+ manifest.filename === options.filename
451
+ )
452
+ }
453
+
454
+ function emptyManifest(options: PagedWFSHarvestOptions): WFSHarvestManifest {
455
+ return {
456
+ source: options.source,
457
+ source_url: options.request.wfsURL,
458
+ wfs_version: WFS_VERSION,
459
+ type_name: options.request.typeName,
460
+ output_format: options.request.outputFormat,
461
+ sort_by: options.request.sortBy,
462
+ license: options.license,
463
+ attribution: options.attribution,
464
+ downloaded_at: isoSecondsUTC(),
465
+ filename: options.filename,
466
+ page_size: options.pageSize,
467
+ feature_count: options.featureCount.count,
468
+ feature_count_source: options.featureCount.because,
469
+ features_written: 0,
470
+ header_bytes: 0,
471
+ footer: "",
472
+ bytes: 0,
473
+ sha256: null,
474
+ complete: false,
475
+ pages: [],
476
+ }
477
+ }
478
+
479
+ /**
480
+ * The offset the next page is appended at: the header plus every recorded page.
481
+ */
482
+ function dataEndOf(manifest: WFSHarvestManifest): number {
483
+ let end = manifest.header_bytes
484
+
485
+ for (const page of manifest.pages) {
486
+ end += page.bytes
487
+ }
488
+
489
+ return end
490
+ }
491
+
492
+ /**
493
+ * The features the recorded pages hold between them.
494
+ */
495
+ function featuresIn(pages: readonly WFSHarvestPageRecord[]): number {
496
+ let features = 0
497
+
498
+ for (const page of pages) {
499
+ features += page.number_returned
500
+ }
501
+
502
+ return features
503
+ }
504
+
505
+ /**
506
+ * The index the next page starts at: one past the last feature any recorded page reached.
507
+ */
508
+ function nextStartIndexOf(pages: readonly WFSHarvestPageRecord[]): number {
509
+ let next = 0
510
+
511
+ for (const page of pages) {
512
+ next = Math.max(next, page.start_index + page.number_returned)
513
+ }
514
+
515
+ return next
516
+ }
517
+
518
+ /**
519
+ * The recorded pages present on disk, with the file truncated back to the last of them.
520
+ *
521
+ * An interrupted run can leave a partial page at the end of the file,
522
+ * or a footer the next page has to be appended past.
523
+ * Both are resolved by truncating the file at the last page boundary it reaches.
524
+ *
525
+ * @throws When the last surviving page's bytes no longer hash to what the manifest recorded.
526
+ * A mismatch means the file was altered after the harvest recorded it.
527
+ */
528
+ async function reconcileHarvestFile(
529
+ manifest: WFSHarvestManifest,
530
+ dataPath: PathBuilderLike,
531
+ context: string,
532
+ report?: (line: string) => void
533
+ ): Promise<WFSHarvestManifest> {
534
+ const stat = await tryStat(dataPath)
535
+ const size = stat?.size ?? 0
536
+
537
+ const kept: WFSHarvestPageRecord[] = []
538
+
539
+ for (const page of manifest.pages) {
540
+ if (page.offset + page.bytes > size) break
541
+
542
+ kept.push(page)
543
+ }
544
+
545
+ if (kept.length < manifest.pages.length) {
546
+ report?.(
547
+ ` ${manifest.pages.length - kept.length} of ${manifest.pages.length} recorded pages are not on disk — resuming from page ${kept.length}`
548
+ )
549
+ }
550
+
551
+ const reconciled: WFSHarvestManifest = {
552
+ ...manifest,
553
+ pages: kept,
554
+ features_written: featuresIn(kept),
555
+ complete: manifest.complete && kept.length === manifest.pages.length,
556
+ }
557
+
558
+ if (!kept.length) {
559
+ // A header with no page behind it describes an empty document, so the file starts over.
560
+ await removePathIfPresent(dataPath)
561
+
562
+ return { ...reconciled, header_bytes: 0, footer: "", bytes: 0, sha256: null, complete: false }
563
+ }
564
+
565
+ const last = kept.at(-1)!
566
+ const recordedBytes = await readFileRange(dataPath, last.offset, last.bytes)
567
+ const digest = sha256Hex(recordedBytes)
568
+
569
+ if (digest !== last.sha256) {
570
+ throw new Error(
571
+ `${context}: the ${last.bytes} bytes the manifest records for the page at startIndex ${last.start_index} hash to ${digest} rather than ${last.sha256}, so ${dataPath} holds something other than the harvest it describes`
572
+ )
573
+ }
574
+
575
+ const dataEnd = dataEndOf(reconciled)
576
+
577
+ if (reconciled.complete) {
578
+ const expected = dataEnd + Buffer.byteLength(reconciled.footer)
579
+
580
+ if (size === expected) return { ...reconciled, bytes: expected }
581
+
582
+ report?.(` The complete harvest records ${expected} bytes and ${size} are on disk — closing it again`)
583
+ }
584
+
585
+ if (size !== dataEnd) {
586
+ await truncateFile(dataPath, dataEnd)
587
+ }
588
+
589
+ return { ...reconciled, bytes: dataEnd, sha256: null, complete: false }
590
+ }
591
+
592
+ /**
593
+ * What a caller knows about the request it is about to make before it has asked the service.
594
+ *
595
+ * The type name and the output format come from a capabilities document, so they are not here:
596
+ * the point of this check is to answer whether a harvest is already current without sending a request.
597
+ */
598
+ export interface HarvestCurrencyExpectation {
599
+ wfsURL: string
600
+ sortBy: string | null
601
+ pageSize: number
602
+ }
603
+
604
+ /**
605
+ * The manifest of a harvest that needs no further request, or `null` where one does.
606
+ *
607
+ * A caller reads this before it reads a capabilities document, so a current harvest costs no request at all.
608
+ * Two harvests need none:
609
+ *
610
+ * - A complete one whose data file still hashes to the digest the manifest records.
611
+ * - A partial one that already holds `maxPages` pages, the cap a bounded probe requests.
612
+ *
613
+ * @throws When a page's recorded byte range no longer hashes to its recorded digest,
614
+ * so a file that was altered under its manifest is reported rather than used.
615
+ */
616
+ export async function readCurrentHarvest(options: {
617
+ outputDir: PathBuilderLike
618
+ filename: string
619
+ context: string
620
+ expect: HarvestCurrencyExpectation
621
+ maxPages?: number
622
+ }): Promise<WFSHarvestManifest | null> {
623
+ const root = PathBuilder.from(options.outputDir)
624
+ const manifest = await readManifest<WFSHarvestManifest>(root(HARVEST_MANIFEST_FILE))
625
+
626
+ if (!manifest || !Array.isArray(manifest.pages)) return null
627
+
628
+ const describesThisRequest =
629
+ manifest.filename === options.filename &&
630
+ manifest.source_url === options.expect.wfsURL &&
631
+ manifest.sort_by === options.expect.sortBy &&
632
+ manifest.page_size === options.expect.pageSize
633
+
634
+ if (!describesThisRequest) return null
635
+
636
+ const dataPath = root(options.filename)
637
+
638
+ if (manifest.complete) {
639
+ const stat = await tryStat(dataPath)
640
+
641
+ if (!stat || stat.size !== manifest.bytes) return null
642
+
643
+ return (await sha256File(dataPath)) === manifest.sha256 ? manifest : null
644
+ }
645
+
646
+ if (options.maxPages === undefined || manifest.pages.length < options.maxPages) return null
647
+
648
+ const last = manifest.pages.at(-1)
649
+
650
+ if (!last) return null
651
+
652
+ const stat = await tryStat(dataPath)
653
+
654
+ if (!stat || stat.size < last.offset + last.bytes) return null
655
+
656
+ const digest = sha256Hex(await readFileRange(dataPath, last.offset, last.bytes))
657
+
658
+ if (digest !== last.sha256) {
659
+ throw new Error(
660
+ `${options.context}: the ${last.bytes} bytes the manifest records for the page at startIndex ${last.start_index} hash to ${digest} rather than ${last.sha256}, so ${dataPath} holds something other than the harvest it describes`
661
+ )
662
+ }
663
+
664
+ return manifest
665
+ }
666
+
667
+ /**
668
+ * Harvests one WFS feature type into a single file, recording each page in a manifest beside it.
669
+ *
670
+ * Re-runnable in three ways, each of which makes no request:
671
+ *
672
+ * - A complete harvest whose file still hashes to the manifest's `sha256`.
673
+ * - A partial harvest that already holds {@linkcode PagedWFSHarvestOptions.maxPages} pages.
674
+ * - A partial harvest resumes at the page after the last one on disk,
675
+ * so the pages already taken are not taken again.
676
+ *
677
+ * @returns The manifest as written.
678
+ */
679
+ export async function harvestPagedWFS(options: PagedWFSHarvestOptions): Promise<WFSHarvestManifest> {
680
+ const root = PathBuilder.from(options.outputDir)
681
+
682
+ await makeDirectories(root)
683
+
684
+ const dataPath = root(options.filename)
685
+ const manifestPath = root(HARVEST_MANIFEST_FILE)
686
+ const recorded = await readManifest<WFSHarvestManifest>(manifestPath)
687
+ const resumable = recorded !== null && Array.isArray(recorded.pages) && describesSameRequest(recorded, options)
688
+
689
+ if (recorded && !resumable) {
690
+ options.report?.(" The manifest describes a different request — starting the harvest over")
691
+
692
+ await removePathIfPresent(dataPath)
693
+ }
694
+
695
+ let manifest = resumable
696
+ ? await reconcileHarvestFile(recorded, dataPath, options.context, options.report)
697
+ : emptyManifest(options)
698
+
699
+ // The count may have become readable, or stopped being readable, since the recorded run.
700
+ manifest = {
701
+ ...manifest,
702
+ feature_count: options.featureCount.count,
703
+ feature_count_source: options.featureCount.because,
704
+ }
705
+
706
+ if (manifest.complete) {
707
+ const digest = await sha256File(dataPath)
708
+
709
+ if (digest === manifest.sha256) {
710
+ options.report?.(` ✓ Already harvested (sha256 matches ${HARVEST_MANIFEST_FILE}) — no request made.`)
711
+
712
+ return manifest
713
+ }
714
+
715
+ options.report?.(` ${dataPath} hashes to ${digest} rather than ${manifest.sha256} — harvesting it again`)
716
+
717
+ manifest = { ...manifest, complete: false, sha256: null }
718
+ }
719
+
720
+ const atPageCap = (): boolean => options.maxPages !== undefined && manifest.pages.length >= options.maxPages
721
+
722
+ if (atPageCap()) {
723
+ options.report?.(` ✓ The manifest already holds ${manifest.pages.length} pages — no request made.`)
724
+
725
+ return manifest
726
+ }
727
+
728
+ let startIndex = nextStartIndexOf(manifest.pages)
729
+ let complete = false
730
+
731
+ for (;;) {
732
+ if (options.signal?.aborted) break
733
+
734
+ if (atPageCap()) break
735
+
736
+ if (manifest.feature_count !== null && manifest.features_written >= manifest.feature_count) {
737
+ complete = true
738
+
739
+ break
740
+ }
741
+
742
+ const page = await options.readPage({ startIndex, count: options.pageSize })
743
+
744
+ if (page.numberReturned === null) {
745
+ throw new Error(
746
+ `${options.context}: the page at startIndex ${startIndex} stated no numberReturned, so what it holds is unknown rather than empty`
747
+ )
748
+ }
749
+
750
+ if (page.numberReturned === 0) {
751
+ complete = true
752
+
753
+ break
754
+ }
755
+
756
+ const payloadBytes = Buffer.byteLength(page.payload)
757
+ const digest = sha256Hex(page.payload)
758
+ const previous = manifest.pages.at(-1)
759
+
760
+ // A service that ignores `startIndex` answers every page with the first,
761
+ // and a harvest of one would hold the same features repeated.
762
+ // `countWFSFeaturesByPaging` refuses such a service by comparing two pages' leading feature.
763
+ // Identical bytes is the same defect seen here.
764
+ if (previous && previous.bytes === payloadBytes && previous.sha256 === digest) {
765
+ throw new Error(
766
+ `${options.context}: the page at startIndex ${startIndex} is byte-identical to the page at startIndex ${previous.start_index}, so the service is answering a new startIndex with the previous page rather than paging`
767
+ )
768
+ }
769
+
770
+ if (!manifest.pages.length && page.header) {
771
+ await appendLocalTextFile(page.header, dataPath)
772
+
773
+ manifest = { ...manifest, header_bytes: Buffer.byteLength(page.header) }
774
+ }
775
+
776
+ const offset = dataEndOf(manifest)
777
+
778
+ await appendLocalTextFile(page.payload, dataPath)
779
+
780
+ manifest = {
781
+ ...manifest,
782
+ downloaded_at: isoSecondsUTC(),
783
+ footer: page.footer ?? manifest.footer,
784
+ features_written: manifest.features_written + page.numberReturned,
785
+ bytes: offset + payloadBytes,
786
+ pages: [
787
+ ...manifest.pages,
788
+ {
789
+ start_index: startIndex,
790
+ count: options.pageSize,
791
+ offset,
792
+ bytes: payloadBytes,
793
+ sha256: digest,
794
+ number_returned: page.numberReturned,
795
+ number_matched: page.numberMatched,
796
+ retrieved_at: page.retrievedAt,
797
+ },
798
+ ],
799
+ }
800
+
801
+ await writeManifest(manifestPath, manifest)
802
+
803
+ options.report?.(
804
+ ` page ${manifest.pages.length} at startIndex ${startIndex}: ${page.numberReturned} features, ${ByteFormatter.formatIEC(payloadBytes)} (${manifest.features_written} written)`
805
+ )
806
+
807
+ // The service's own answer rather than the page size: a service that caps a page below the
808
+ // requested size would otherwise be read in strides that skip the features it did not return.
809
+ startIndex += page.numberReturned
810
+ }
811
+
812
+ if (complete) {
813
+ if (manifest.footer) {
814
+ await appendLocalTextFile(manifest.footer, dataPath)
815
+ }
816
+
817
+ // A feature type of no features still needs the file the adapter opens, and an empty append creates it.
818
+ if (!(await tryStat(dataPath))) {
819
+ await appendLocalTextFile("", dataPath)
820
+ }
821
+
822
+ const stat = await tryStat(dataPath)
823
+
824
+ manifest = {
825
+ ...manifest,
826
+ downloaded_at: isoSecondsUTC(),
827
+ bytes: stat?.size ?? manifest.bytes,
828
+ sha256: await sha256File(dataPath),
829
+ complete: true,
830
+ }
831
+ }
832
+
833
+ await writeManifest(manifestPath, manifest)
834
+
835
+ return manifest
836
+ }
837
+
838
+ /**
839
+ * What a registered `mailwoman corpus fetch` entry needs to run one service's harvest.
840
+ */
841
+ export interface RunWFSHarvestOptions {
842
+ /**
843
+ * The slug the harvest is written under and reported by.
844
+ * It matches the adapter's own id.
845
+ */
846
+ slug: string
847
+
848
+ /**
849
+ * Where the harvest directory sits, as the fetch registry hands it over.
850
+ */
851
+ outRoot: (segment: string) => PathBuilderLike
852
+
853
+ /**
854
+ * The data file inside the harvest directory.
855
+ * The adapter's `inputPath` points here.
856
+ */
857
+ filename: string
858
+
859
+ /**
860
+ * What a stored manifest has to agree with before its harvest counts as current.
861
+ */
862
+ expect: HarvestCurrencyExpectation
863
+
864
+ /**
865
+ * The name the client reports itself under.
866
+ */
867
+ displayName: string
868
+
869
+ /**
870
+ * The floor between two requests to one government host.
871
+ */
872
+ minRequestIntervalMs: number
873
+
874
+ /**
875
+ * Runs the harvest against a client the caller does not own.
876
+ */
877
+ harvest: (client: Pick<APIClient, "fetch">) => Promise<WFSHarvestManifest>
878
+
879
+ /**
880
+ * A client to use rather than constructing one.
881
+ * A test supplies this.
882
+ */
883
+ client?: Pick<APIClient, "fetch">
884
+
885
+ /**
886
+ * A page cap.
887
+ * A capped run treats an incomplete harvest as a success.
888
+ */
889
+ maxPages?: number
890
+ }
891
+
892
+ /**
893
+ * Runs one service's harvest and reports it as a fetch registry entry does.
894
+ *
895
+ * Estonia and Poland wrote this sequence twice: ask whether the harvest on disk is
896
+ * already current, construct a paced client unless the caller supplied one, run,
897
+ * report, and decide whether an incomplete harvest is a failure.
898
+ * A third WFS source would have written it a third time.
899
+ *
900
+ * The currency check runs before any request, so a complete harvest or a bounded
901
+ * probe that already holds its pages makes no request at all.
902
+ *
903
+ * A bounded run stops short by instruction rather than by failure, so a page cap the caller
904
+ * asked for reads as a success while an incomplete harvest without one reads as a failure.
905
+ */
906
+ export async function runWFSHarvest(
907
+ options: RunWFSHarvestOptions,
908
+ report?: (line: string) => void
909
+ ): Promise<FetchSummary> {
910
+ report?.(`=== ${options.slug}`)
911
+
912
+ const destination = options.outRoot(options.slug)
913
+
914
+ const current = await readCurrentHarvest({
915
+ outputDir: destination,
916
+ filename: options.filename,
917
+ context: options.slug,
918
+ expect: options.expect,
919
+ maxPages: options.maxPages,
920
+ })
921
+
922
+ if (current) {
923
+ report?.(
924
+ ` ✓ Already harvested: ${current.features_written} features over ${current.pages.length} pages — no request made.`
925
+ )
926
+
927
+ return { fetched: 0, skipped: 1, failed: 0, failedCodes: [] }
928
+ }
929
+
930
+ let manifest: WFSHarvestManifest
931
+
932
+ if (options.client) {
933
+ manifest = await options.harvest(options.client)
934
+ } else {
935
+ // Bounded retry, because a harvest is many requests and one 5xx would otherwise end the run.
936
+ await using client = new APIClient({
937
+ displayName: options.displayName,
938
+ minRequestIntervalMs: options.minRequestIntervalMs,
939
+ retry: true,
940
+ })
941
+
942
+ manifest = await options.harvest(client)
943
+ }
944
+
945
+ report?.(
946
+ ` ${manifest.complete ? "✓" : "partial:"} ${manifest.features_written} features over ${manifest.pages.length} pages, ${manifest.bytes} bytes`
947
+ )
948
+
949
+ const bounded = options.maxPages !== undefined && manifest.pages.length >= options.maxPages
950
+
951
+ return manifest.complete || bounded
952
+ ? { fetched: 1, skipped: 0, failed: 0, failedCodes: [] }
953
+ : { fetched: 0, skipped: 0, failed: 1, failedCodes: [options.slug] }
954
+ }