@mailwoman/registry 10.8.0 → 11.1.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 (399) hide show
  1. package/README.md +93 -98
  2. package/data/manifests/artifacts.json +32 -0
  3. package/data/manifests/coverage.json +56 -0
  4. package/data/manifests/sources.lock.json +48 -0
  5. package/data/normalized/iata-airports.json +126749 -0
  6. package/data/normalized/iso3166-1.json +2035 -0
  7. package/definitions/namespaces.json +63 -0
  8. package/definitions/sections.json +73 -0
  9. package/docs/data-policy.md +81 -0
  10. package/docs/performance.md +146 -0
  11. package/docs/rgy1.md +144 -0
  12. package/lib/artifacts/country-airport-collision.ts +28 -0
  13. package/lib/artifacts/iata-airport/membership.ts +28 -0
  14. package/lib/artifacts/iata-airport/records.ts +28 -0
  15. package/lib/artifacts/iso3166-1/alpha2-membership.ts +28 -0
  16. package/lib/artifacts/iso3166-1/alpha3-membership.ts +28 -0
  17. package/lib/artifacts/iso3166-1/records.ts +28 -0
  18. package/lib/errors.ts +47 -0
  19. package/lib/iata/airports/records.ts +173 -0
  20. package/lib/iata/airports/validate.ts +50 -0
  21. package/lib/index.ts +32 -18
  22. package/lib/inspect.ts +56 -0
  23. package/lib/iso3166/alpha2.ts +48 -0
  24. package/lib/iso3166/alpha3.ts +51 -0
  25. package/lib/iso3166/records.ts +150 -0
  26. package/lib/iso3166/relations.ts +30 -0
  27. package/lib/key.ts +148 -0
  28. package/lib/normalize.ts +35 -0
  29. package/lib/overlap/country-airport.ts +110 -0
  30. package/lib/rgy1/base64.ts +23 -0
  31. package/lib/rgy1/reader.ts +317 -0
  32. package/lib/rgy1/sections.generated.ts +80 -0
  33. package/lib/rgy1/views.ts +266 -0
  34. package/lib/types.ts +92 -77
  35. package/lib/wasm.ts +287 -0
  36. package/out/artifacts/country-airport-collision.d.ts +7 -0
  37. package/out/artifacts/country-airport-collision.d.ts.map +1 -0
  38. package/out/artifacts/country-airport-collision.js +22 -0
  39. package/out/artifacts/country-airport-collision.js.map +1 -0
  40. package/out/artifacts/iata-airport/membership.d.ts +7 -0
  41. package/out/artifacts/iata-airport/membership.d.ts.map +1 -0
  42. package/out/artifacts/iata-airport/membership.js +22 -0
  43. package/out/artifacts/iata-airport/membership.js.map +1 -0
  44. package/out/artifacts/iata-airport/records.d.ts +7 -0
  45. package/out/artifacts/iata-airport/records.d.ts.map +1 -0
  46. package/out/artifacts/iata-airport/records.js +22 -0
  47. package/out/artifacts/iata-airport/records.js.map +1 -0
  48. package/out/artifacts/iso3166-1/alpha2-membership.d.ts +7 -0
  49. package/out/artifacts/iso3166-1/alpha2-membership.d.ts.map +1 -0
  50. package/out/artifacts/iso3166-1/alpha2-membership.js +22 -0
  51. package/out/artifacts/iso3166-1/alpha2-membership.js.map +1 -0
  52. package/out/artifacts/iso3166-1/alpha3-membership.d.ts +7 -0
  53. package/out/artifacts/iso3166-1/alpha3-membership.d.ts.map +1 -0
  54. package/out/artifacts/iso3166-1/alpha3-membership.js +22 -0
  55. package/out/artifacts/iso3166-1/alpha3-membership.js.map +1 -0
  56. package/out/artifacts/iso3166-1/records.d.ts +7 -0
  57. package/out/artifacts/iso3166-1/records.d.ts.map +1 -0
  58. package/out/artifacts/iso3166-1/records.js +22 -0
  59. package/out/artifacts/iso3166-1/records.js.map +1 -0
  60. package/out/errors.d.ts +38 -0
  61. package/out/errors.d.ts.map +1 -0
  62. package/out/errors.js +37 -0
  63. package/out/errors.js.map +1 -0
  64. package/out/iata/airports/records.d.ts +37 -0
  65. package/out/iata/airports/records.d.ts.map +1 -0
  66. package/out/iata/airports/records.js +135 -0
  67. package/out/iata/airports/records.js.map +1 -0
  68. package/out/iata/airports/validate.d.ts +19 -0
  69. package/out/iata/airports/validate.d.ts.map +1 -0
  70. package/out/iata/airports/validate.js +42 -0
  71. package/out/iata/airports/validate.js.map +1 -0
  72. package/out/index.d.ts +21 -18
  73. package/out/index.d.ts.map +1 -1
  74. package/out/index.js +12 -22
  75. package/out/index.js.map +1 -1
  76. package/out/inspect.d.ts +35 -0
  77. package/out/inspect.d.ts.map +1 -0
  78. package/out/inspect.js +32 -0
  79. package/out/inspect.js.map +1 -0
  80. package/out/iso3166/alpha2.d.ts +16 -0
  81. package/out/iso3166/alpha2.d.ts.map +1 -0
  82. package/out/iso3166/alpha2.js +40 -0
  83. package/out/iso3166/alpha2.js.map +1 -0
  84. package/out/iso3166/alpha3.d.ts +21 -0
  85. package/out/iso3166/alpha3.d.ts.map +1 -0
  86. package/out/iso3166/alpha3.js +43 -0
  87. package/out/iso3166/alpha3.js.map +1 -0
  88. package/out/iso3166/records.d.ts +27 -0
  89. package/out/iso3166/records.d.ts.map +1 -0
  90. package/out/iso3166/records.js +105 -0
  91. package/out/iso3166/records.js.map +1 -0
  92. package/out/iso3166/relations.d.ts +13 -0
  93. package/out/iso3166/relations.d.ts.map +1 -0
  94. package/out/iso3166/relations.js +26 -0
  95. package/out/iso3166/relations.js.map +1 -0
  96. package/out/key.d.ts +67 -0
  97. package/out/key.d.ts.map +1 -0
  98. package/out/key.js +123 -0
  99. package/out/key.js.map +1 -0
  100. package/out/normalize.d.ts +26 -0
  101. package/out/normalize.d.ts.map +1 -0
  102. package/out/normalize.js +11 -0
  103. package/out/normalize.js.map +1 -0
  104. package/out/overlap/country-airport.d.ts +43 -0
  105. package/out/overlap/country-airport.d.ts.map +1 -0
  106. package/out/overlap/country-airport.js +72 -0
  107. package/out/overlap/country-airport.js.map +1 -0
  108. package/out/rgy1/base64.d.ts +11 -0
  109. package/out/rgy1/base64.d.ts.map +1 -0
  110. package/out/rgy1/base64.js +20 -0
  111. package/out/rgy1/base64.js.map +1 -0
  112. package/out/rgy1/reader.d.ts +92 -0
  113. package/out/rgy1/reader.d.ts.map +1 -0
  114. package/out/rgy1/reader.js +230 -0
  115. package/out/rgy1/reader.js.map +1 -0
  116. package/out/rgy1/sections.generated.d.ts +52 -0
  117. package/out/rgy1/sections.generated.d.ts.map +1 -0
  118. package/out/rgy1/sections.generated.js +69 -0
  119. package/out/rgy1/sections.generated.js.map +1 -0
  120. package/out/rgy1/views.d.ts +89 -0
  121. package/out/rgy1/views.d.ts.map +1 -0
  122. package/out/rgy1/views.js +216 -0
  123. package/out/rgy1/views.js.map +1 -0
  124. package/out/sdk/fetch.d.ts +49 -0
  125. package/out/sdk/fetch.d.ts.map +1 -0
  126. package/out/sdk/fetch.js +105 -0
  127. package/out/sdk/fetch.js.map +1 -0
  128. package/out/sdk/fetch.run.d.ts +2 -0
  129. package/out/sdk/fetch.run.d.ts.map +1 -0
  130. package/out/sdk/fetch.run.js +19 -0
  131. package/out/sdk/fetch.run.js.map +1 -0
  132. package/out/sdk/sources.d.ts +102 -0
  133. package/out/sdk/sources.d.ts.map +1 -0
  134. package/out/sdk/sources.js +101 -0
  135. package/out/sdk/sources.js.map +1 -0
  136. package/out/tools/artifact-path.d.ts +5 -0
  137. package/out/tools/artifact-path.d.ts.map +1 -0
  138. package/out/tools/artifact-path.js +9 -0
  139. package/out/tools/artifact-path.js.map +1 -0
  140. package/out/tools/bench.run.d.ts +2 -0
  141. package/out/tools/bench.run.d.ts.map +1 -0
  142. package/out/tools/bench.run.js +207 -0
  143. package/out/tools/bench.run.js.map +1 -0
  144. package/out/tools/build-wasm.run.d.ts +2 -0
  145. package/out/tools/build-wasm.run.d.ts.map +1 -0
  146. package/out/tools/build-wasm.run.js +69 -0
  147. package/out/tools/build-wasm.run.js.map +1 -0
  148. package/out/tools/generate-sections.run.d.ts +2 -0
  149. package/out/tools/generate-sections.run.d.ts.map +1 -0
  150. package/out/tools/generate-sections.run.js +127 -0
  151. package/out/tools/generate-sections.run.js.map +1 -0
  152. package/out/tools/generate.run.d.ts +2 -0
  153. package/out/tools/generate.run.d.ts.map +1 -0
  154. package/out/tools/generate.run.js +115 -0
  155. package/out/tools/generate.run.js.map +1 -0
  156. package/out/tools/normalize.d.ts +143 -0
  157. package/out/tools/normalize.d.ts.map +1 -0
  158. package/out/tools/normalize.js +303 -0
  159. package/out/tools/normalize.js.map +1 -0
  160. package/out/tools/normalize.run.d.ts +2 -0
  161. package/out/tools/normalize.run.d.ts.map +1 -0
  162. package/out/tools/normalize.run.js +27 -0
  163. package/out/tools/normalize.run.js.map +1 -0
  164. package/out/types.d.ts +91 -79
  165. package/out/types.d.ts.map +1 -1
  166. package/out/types.js +15 -8
  167. package/out/types.js.map +1 -1
  168. package/out/wasm.d.ts +85 -0
  169. package/out/wasm.d.ts.map +1 -0
  170. package/out/wasm.js +138 -0
  171. package/out/wasm.js.map +1 -0
  172. package/package.json +54 -28
  173. package/sdk/fetch.run.ts +24 -0
  174. package/sdk/fetch.ts +145 -0
  175. package/sdk/sources.ts +166 -0
  176. package/tools/artifact-path.ts +9 -0
  177. package/tools/bench.run.ts +274 -0
  178. package/tools/build-wasm.run.ts +81 -0
  179. package/tools/generate-sections.run.ts +144 -0
  180. package/tools/generate.run.ts +144 -0
  181. package/tools/normalize.run.ts +35 -0
  182. package/tools/normalize.ts +475 -0
  183. package/wasm/registry-simd.wasm +0 -0
  184. package/wasm/registry.wasm +0 -0
  185. package/lib/address-key.ts +0 -46
  186. package/lib/geocode-handler.ts +0 -37
  187. package/lib/geojson.ts +0 -72
  188. package/lib/ingest.ts +0 -349
  189. package/lib/learned-scorer.ts +0 -134
  190. package/lib/map-html.ts +0 -287
  191. package/lib/models/crosssource-gbt-en-us.ts +0 -43
  192. package/lib/models/dedup-gbt-en-us.ts +0 -47
  193. package/lib/models/org-crosssource-gbt-en-us.ts +0 -43
  194. package/lib/reconcile.ts +0 -239
  195. package/lib/resolve.ts +0 -569
  196. package/out/address-key.d.ts +0 -34
  197. package/out/address-key.d.ts.map +0 -1
  198. package/out/address-key.js +0 -41
  199. package/out/address-key.js.map +0 -1
  200. package/out/geocode-handler.d.ts +0 -20
  201. package/out/geocode-handler.d.ts.map +0 -1
  202. package/out/geocode-handler.js +0 -29
  203. package/out/geocode-handler.js.map +0 -1
  204. package/out/geojson.d.ts +0 -28
  205. package/out/geojson.d.ts.map +0 -1
  206. package/out/geojson.js +0 -62
  207. package/out/geojson.js.map +0 -1
  208. package/out/ingest.d.ts +0 -173
  209. package/out/ingest.d.ts.map +0 -1
  210. package/out/ingest.js +0 -185
  211. package/out/ingest.js.map +0 -1
  212. package/out/learned-scorer.d.ts +0 -61
  213. package/out/learned-scorer.d.ts.map +0 -1
  214. package/out/learned-scorer.js +0 -91
  215. package/out/learned-scorer.js.map +0 -1
  216. package/out/map-html.d.ts +0 -39
  217. package/out/map-html.d.ts.map +0 -1
  218. package/out/map-html.js +0 -220
  219. package/out/map-html.js.map +0 -1
  220. package/out/models/crosssource-gbt-en-us.d.ts +0 -45
  221. package/out/models/crosssource-gbt-en-us.d.ts.map +0 -1
  222. package/out/models/crosssource-gbt-en-us.js +0 -40
  223. package/out/models/crosssource-gbt-en-us.js.map +0 -1
  224. package/out/models/dedup-gbt-en-us.d.ts +0 -44
  225. package/out/models/dedup-gbt-en-us.d.ts.map +0 -1
  226. package/out/models/dedup-gbt-en-us.js +0 -44
  227. package/out/models/dedup-gbt-en-us.js.map +0 -1
  228. package/out/models/org-crosssource-gbt-en-us.d.ts +0 -45
  229. package/out/models/org-crosssource-gbt-en-us.d.ts.map +0 -1
  230. package/out/models/org-crosssource-gbt-en-us.js +0 -40
  231. package/out/models/org-crosssource-gbt-en-us.js.map +0 -1
  232. package/out/reconcile.d.ts +0 -96
  233. package/out/reconcile.d.ts.map +0 -1
  234. package/out/reconcile.js +0 -127
  235. package/out/reconcile.js.map +0 -1
  236. package/out/resolve.d.ts +0 -264
  237. package/out/resolve.d.ts.map +0 -1
  238. package/out/resolve.js +0 -282
  239. package/out/resolve.js.map +0 -1
  240. package/out/tools/coverage-reconciliation.d.ts +0 -67
  241. package/out/tools/coverage-reconciliation.d.ts.map +0 -1
  242. package/out/tools/coverage-reconciliation.js +0 -113
  243. package/out/tools/coverage-reconciliation.js.map +0 -1
  244. package/out/tools/cross/dataset-correlation.d.ts +0 -61
  245. package/out/tools/cross/dataset-correlation.d.ts.map +0 -1
  246. package/out/tools/cross/dataset-correlation.js +0 -244
  247. package/out/tools/cross/dataset-correlation.js.map +0 -1
  248. package/out/tools/cross/source-threshold-sweep.d.ts +0 -60
  249. package/out/tools/cross/source-threshold-sweep.d.ts.map +0 -1
  250. package/out/tools/cross/source-threshold-sweep.js +0 -264
  251. package/out/tools/cross/source-threshold-sweep.js.map +0 -1
  252. package/out/tools/dedup-ceiling.d.ts +0 -62
  253. package/out/tools/dedup-ceiling.d.ts.map +0 -1
  254. package/out/tools/dedup-ceiling.js +0 -171
  255. package/out/tools/dedup-ceiling.js.map +0 -1
  256. package/out/tools/eval-geocoder.d.ts +0 -68
  257. package/out/tools/eval-geocoder.d.ts.map +0 -1
  258. package/out/tools/eval-geocoder.js +0 -13
  259. package/out/tools/eval-geocoder.js.map +0 -1
  260. package/out/tools/geocoder/namesake-probe.d.ts +0 -33
  261. package/out/tools/geocoder/namesake-probe.d.ts.map +0 -1
  262. package/out/tools/geocoder/namesake-probe.js +0 -60
  263. package/out/tools/geocoder/namesake-probe.js.map +0 -1
  264. package/out/tools/geocoder/vs-provided-coords.d.ts +0 -53
  265. package/out/tools/geocoder/vs-provided-coords.d.ts.map +0 -1
  266. package/out/tools/geocoder/vs-provided-coords.js +0 -161
  267. package/out/tools/geocoder/vs-provided-coords.js.map +0 -1
  268. package/out/tools/gold-set-sample.d.ts +0 -67
  269. package/out/tools/gold-set-sample.d.ts.map +0 -1
  270. package/out/tools/gold-set-sample.js +0 -81
  271. package/out/tools/gold-set-sample.js.map +0 -1
  272. package/out/tools/learned/scorer/clustering-eval.d.ts +0 -77
  273. package/out/tools/learned/scorer/clustering-eval.d.ts.map +0 -1
  274. package/out/tools/learned/scorer/clustering-eval.js +0 -207
  275. package/out/tools/learned/scorer/clustering-eval.js.map +0 -1
  276. package/out/tools/learned/scorer/crossstate-eval.d.ts +0 -65
  277. package/out/tools/learned/scorer/crossstate-eval.d.ts.map +0 -1
  278. package/out/tools/learned/scorer/crossstate-eval.js +0 -168
  279. package/out/tools/learned/scorer/crossstate-eval.js.map +0 -1
  280. package/out/tools/learned/scorer/eval.d.ts +0 -64
  281. package/out/tools/learned/scorer/eval.d.ts.map +0 -1
  282. package/out/tools/learned/scorer/eval.js +0 -275
  283. package/out/tools/learned/scorer/eval.js.map +0 -1
  284. package/out/tools/matcher-scale.d.ts +0 -40
  285. package/out/tools/matcher-scale.d.ts.map +0 -1
  286. package/out/tools/matcher-scale.js +0 -111
  287. package/out/tools/matcher-scale.js.map +0 -1
  288. package/out/tools/nppes/dedup-benchmark.d.ts +0 -82
  289. package/out/tools/nppes/dedup-benchmark.d.ts.map +0 -1
  290. package/out/tools/nppes/dedup-benchmark.js +0 -226
  291. package/out/tools/nppes/dedup-benchmark.js.map +0 -1
  292. package/out/tools/nppes/org-name.d.ts +0 -15
  293. package/out/tools/nppes/org-name.d.ts.map +0 -1
  294. package/out/tools/nppes/org-name.js +0 -6
  295. package/out/tools/nppes/org-name.js.map +0 -1
  296. package/out/tools/nppes/overmerge-packet.d.ts +0 -43
  297. package/out/tools/nppes/overmerge-packet.d.ts.map +0 -1
  298. package/out/tools/nppes/overmerge-packet.js +0 -54
  299. package/out/tools/nppes/overmerge-packet.js.map +0 -1
  300. package/out/tools/nppes/report.d.ts +0 -97
  301. package/out/tools/nppes/report.d.ts.map +0 -1
  302. package/out/tools/nppes/report.js +0 -178
  303. package/out/tools/nppes/report.js.map +0 -1
  304. package/out/tools/nppes/sample.d.ts +0 -101
  305. package/out/tools/nppes/sample.d.ts.map +0 -1
  306. package/out/tools/nppes/sample.js +0 -127
  307. package/out/tools/nppes/sample.js.map +0 -1
  308. package/out/tools/nppes/scoring.d.ts +0 -37
  309. package/out/tools/nppes/scoring.d.ts.map +0 -1
  310. package/out/tools/nppes/scoring.js +0 -81
  311. package/out/tools/nppes/scoring.js.map +0 -1
  312. package/out/tools/nppes/settings.d.ts +0 -41
  313. package/out/tools/nppes/settings.d.ts.map +0 -1
  314. package/out/tools/nppes/settings.js +0 -79
  315. package/out/tools/nppes/settings.js.map +0 -1
  316. package/out/tools/nppes/truth-grains.d.ts +0 -63
  317. package/out/tools/nppes/truth-grains.d.ts.map +0 -1
  318. package/out/tools/nppes/truth-grains.js +0 -142
  319. package/out/tools/nppes/truth-grains.js.map +0 -1
  320. package/out/tools/shared.d.ts +0 -325
  321. package/out/tools/shared.d.ts.map +0 -1
  322. package/out/tools/shared.js +0 -453
  323. package/out/tools/shared.js.map +0 -1
  324. package/out/tools/train/cross-gbt.d.ts +0 -89
  325. package/out/tools/train/cross-gbt.d.ts.map +0 -1
  326. package/out/tools/train/cross-gbt.js +0 -132
  327. package/out/tools/train/cross-gbt.js.map +0 -1
  328. package/out/tools/train/gbt.d.ts +0 -85
  329. package/out/tools/train/gbt.d.ts.map +0 -1
  330. package/out/tools/train/gbt.js +0 -155
  331. package/out/tools/train/gbt.js.map +0 -1
  332. package/out/tools/train/org-cross-gbt.d.ts +0 -85
  333. package/out/tools/train/org-cross-gbt.d.ts.map +0 -1
  334. package/out/tools/train/org-cross-gbt.js +0 -122
  335. package/out/tools/train/org-cross-gbt.js.map +0 -1
  336. package/out/tools/txhhsc-to-oarow.d.ts +0 -42
  337. package/out/tools/txhhsc-to-oarow.d.ts.map +0 -1
  338. package/out/tools/txhhsc-to-oarow.js +0 -78
  339. package/out/tools/txhhsc-to-oarow.js.map +0 -1
  340. package/out/tools/viz/browser.d.ts +0 -31
  341. package/out/tools/viz/browser.d.ts.map +0 -1
  342. package/out/tools/viz/browser.js +0 -26
  343. package/out/tools/viz/browser.js.map +0 -1
  344. package/out/tools/viz/cross-dataset-map.d.ts +0 -39
  345. package/out/tools/viz/cross-dataset-map.d.ts.map +0 -1
  346. package/out/tools/viz/cross-dataset-map.js +0 -84
  347. package/out/tools/viz/cross-dataset-map.js.map +0 -1
  348. package/out/tools/viz/geocode-first-surface.d.ts +0 -36
  349. package/out/tools/viz/geocode-first-surface.d.ts.map +0 -1
  350. package/out/tools/viz/geocode-first-surface.js +0 -234
  351. package/out/tools/viz/geocode-first-surface.js.map +0 -1
  352. package/out/tools/viz/render/map.d.ts +0 -42
  353. package/out/tools/viz/render/map.d.ts.map +0 -1
  354. package/out/tools/viz/render/map.js +0 -40
  355. package/out/tools/viz/render/map.js.map +0 -1
  356. package/out/tools/viz/render.d.ts +0 -46
  357. package/out/tools/viz/render.d.ts.map +0 -1
  358. package/out/tools/viz/render.js +0 -49
  359. package/out/tools/viz/render.js.map +0 -1
  360. package/out/tools/viz/source-provenance-map.d.ts +0 -57
  361. package/out/tools/viz/source-provenance-map.d.ts.map +0 -1
  362. package/out/tools/viz/source-provenance-map.js +0 -82
  363. package/out/tools/viz/source-provenance-map.js.map +0 -1
  364. package/out/tools/viz/yardstick-figure.d.ts +0 -22
  365. package/out/tools/viz/yardstick-figure.d.ts.map +0 -1
  366. package/out/tools/viz/yardstick-figure.js +0 -106
  367. package/out/tools/viz/yardstick-figure.js.map +0 -1
  368. package/tools/coverage-reconciliation.ts +0 -192
  369. package/tools/cross/dataset-correlation.ts +0 -380
  370. package/tools/cross/source-threshold-sweep.ts +0 -416
  371. package/tools/dedup-ceiling.ts +0 -225
  372. package/tools/eval-geocoder.ts +0 -77
  373. package/tools/geocoder/namesake-probe.ts +0 -91
  374. package/tools/geocoder/vs-provided-coords.ts +0 -232
  375. package/tools/gold-set-sample.ts +0 -147
  376. package/tools/learned/scorer/clustering-eval.ts +0 -349
  377. package/tools/learned/scorer/crossstate-eval.ts +0 -280
  378. package/tools/learned/scorer/eval.ts +0 -429
  379. package/tools/matcher-scale.ts +0 -185
  380. package/tools/nppes/dedup-benchmark.ts +0 -364
  381. package/tools/nppes/org-name.ts +0 -15
  382. package/tools/nppes/overmerge-packet.ts +0 -98
  383. package/tools/nppes/report.ts +0 -380
  384. package/tools/nppes/sample.ts +0 -250
  385. package/tools/nppes/scoring.ts +0 -115
  386. package/tools/nppes/settings.ts +0 -102
  387. package/tools/nppes/truth-grains.ts +0 -185
  388. package/tools/shared.ts +0 -743
  389. package/tools/train/cross-gbt.ts +0 -214
  390. package/tools/train/gbt.ts +0 -261
  391. package/tools/train/org-cross-gbt.ts +0 -189
  392. package/tools/txhhsc-to-oarow.ts +0 -118
  393. package/tools/viz/browser.ts +0 -41
  394. package/tools/viz/cross-dataset-map.ts +0 -133
  395. package/tools/viz/geocode-first-surface.ts +0 -305
  396. package/tools/viz/render/map.ts +0 -61
  397. package/tools/viz/render.ts +0 -103
  398. package/tools/viz/source-provenance-map.ts +0 -154
  399. package/tools/viz/yardstick-figure.ts +0 -197
@@ -0,0 +1,317 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * The synchronous RGY1 reader: validate an artifact once, then probe its tables in place.
6
+ *
7
+ * The reader mirrors `crates/registry-core/src/artifact.rs` and follows `docs/rgy1.md`.
8
+ * It reads through a `DataView` over the caller's bytes, honoring `byteOffset`, so an
9
+ * artifact handed over as a subarray behaves as the same bytes would in their own buffer.
10
+ *
11
+ * No `Map` is rebuilt: a probe is an arithmetic index into the section's payload.
12
+ */
13
+
14
+ import {
15
+ RGY1_ALIGNMENT,
16
+ RGY1_DIRECTORY_ENTRY_BYTES,
17
+ RGY1_FLAG_REQUIRED,
18
+ RGY1_HEADER_OFFSET,
19
+ RGY1_MAGIC,
20
+ RGY1_VERSION,
21
+ SECTION_ENCODING,
22
+ SectionKind,
23
+ } from "#rgy1/sections.generated"
24
+
25
+ /**
26
+ * Why bytes are not an RGY1 artifact this reader accepts.
27
+ */
28
+ export class RGY1Error extends Error {
29
+ readonly code: string
30
+
31
+ constructor(code: string, message: string) {
32
+ super(`RGY1 ${code}: ${message}`)
33
+ this.name = "RGY1Error"
34
+ this.code = code
35
+ }
36
+ }
37
+
38
+ /**
39
+ * One directory entry with its payload view.
40
+ */
41
+ export interface Section {
42
+ kind: number
43
+ encoding: number
44
+ elementWidth: number
45
+ flags: number
46
+ offset: number
47
+ length: number
48
+ count: number
49
+ aux: number
50
+ payload: Uint8Array
51
+ view: DataView
52
+ }
53
+
54
+ /**
55
+ * The header fields every artifact holds.
56
+ * A records artifact adds `columns`, `rows` and `relations`.
57
+ */
58
+ export interface ArtifactHeader {
59
+ artifact: string
60
+ profile: string
61
+ namespaces: string[]
62
+ sources: Array<{ id: string; sha256: string; publication: string }>
63
+ coverage: Record<string, number>
64
+ schemaVersion: number
65
+ normalizationVersion: number
66
+ envelopeVersion: number
67
+ encodings: Record<string, number>
68
+ generator: string
69
+ status?: string
70
+ kinds?: string[]
71
+ meaning?: string
72
+ rows?: number
73
+ columns?: Array<{ name: string; type: string; width: number; values?: string[]; absent?: number }>
74
+ relations?: Array<{ name: string; source: string; targets: string }>
75
+ }
76
+
77
+ const KEY_SPACES: Readonly<Record<number, number>> = { 0: 1000, 2: 676, 3: 17_576 }
78
+
79
+ /**
80
+ * The byte width of a `u32` cell.
81
+ */
82
+ const BYTES_PER_U32 = 4
83
+
84
+ /**
85
+ * Rounds up to the section alignment.
86
+ */
87
+ export function align(value: number): number {
88
+ return Math.ceil(value / RGY1_ALIGNMENT) * RGY1_ALIGNMENT
89
+ }
90
+
91
+ const decoder = new TextDecoder("utf-8", { fatal: true })
92
+
93
+ /**
94
+ * A validated artifact over the caller's bytes.
95
+ */
96
+ export class Artifact {
97
+ readonly bytes: Uint8Array
98
+ readonly header: ArtifactHeader
99
+ readonly sections: readonly Section[]
100
+
101
+ private constructor(bytes: Uint8Array, header: ArtifactHeader, sections: readonly Section[]) {
102
+ this.bytes = bytes
103
+ this.header = header
104
+ this.sections = sections
105
+ }
106
+
107
+ /**
108
+ * Parses and validates the envelope, directory and every section's framing.
109
+ */
110
+ static parse(bytes: Uint8Array): Artifact {
111
+ if (bytes.byteLength < RGY1_HEADER_OFFSET) throw new RGY1Error("truncated", `${bytes.byteLength} bytes`)
112
+
113
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
114
+
115
+ for (let index = 0; index < RGY1_MAGIC.length; index++) {
116
+ if (bytes[index] !== RGY1_MAGIC.charCodeAt(index)) throw new RGY1Error("magic", "the first bytes are not RGY1")
117
+ }
118
+
119
+ const version = view.getUint16(4, true)
120
+
121
+ if (version !== RGY1_VERSION) throw new RGY1Error("version", `envelope version ${version}`)
122
+
123
+ const flags = view.getUint16(6, true)
124
+
125
+ if (flags !== 0) throw new RGY1Error("flags", `envelope flags ${flags}`)
126
+
127
+ const headerLength = view.getUint32(8, true)
128
+ const sectionCount = view.getUint32(12, true)
129
+ const directoryOffset = view.getUint32(16, true)
130
+ const totalLength = view.getUint32(20, true)
131
+ const firstPayload = view.getUint32(24, true)
132
+
133
+ if (view.getUint32(28, true) !== 0) throw new RGY1Error("reserved", "the reserved field is set")
134
+
135
+ if (totalLength !== bytes.byteLength) {
136
+ throw new RGY1Error("length", `stated ${totalLength} bytes, given ${bytes.byteLength}`)
137
+ }
138
+
139
+ const headerEnd = RGY1_HEADER_OFFSET + headerLength
140
+
141
+ if (headerEnd > bytes.byteLength || directoryOffset !== align(headerEnd)) {
142
+ throw new RGY1Error("layout", `directory at ${directoryOffset}, header ends at ${headerEnd}`)
143
+ }
144
+
145
+ const directoryEnd = directoryOffset + sectionCount * RGY1_DIRECTORY_ENTRY_BYTES
146
+
147
+ if (directoryEnd > bytes.byteLength || firstPayload !== align(directoryEnd) || firstPayload > bytes.byteLength) {
148
+ throw new RGY1Error("layout", `first payload at ${firstPayload}, directory ends at ${directoryEnd}`)
149
+ }
150
+
151
+ let headerText: string
152
+
153
+ try {
154
+ headerText = decoder.decode(bytes.subarray(RGY1_HEADER_OFFSET, headerEnd))
155
+ } catch {
156
+ throw new RGY1Error("header-utf8", "the header is not strict UTF-8")
157
+ }
158
+
159
+ for (let at = headerEnd; at < directoryOffset; at++) {
160
+ if (bytes[at] !== 0) throw new RGY1Error("layout", `byte ${at} between header and directory is not zero`)
161
+ }
162
+
163
+ // oxlint-disable-next-line eslint/no-restricted-properties -- the library has no dependency on @mailwoman/core, so it reads the header with the platform parser
164
+ const header = JSON.parse(headerText) as ArtifactHeader
165
+ const sections: Section[] = []
166
+ let cursor = firstPayload
167
+
168
+ for (let index = 0; index < sectionCount; index++) {
169
+ const at = directoryOffset + index * RGY1_DIRECTORY_ENTRY_BYTES
170
+ const kind = view.getUint16(at, true)
171
+ const encoding = view.getUint16(at + 2, true)
172
+ const elementWidth = view.getUint16(at + 4, true)
173
+ const sectionFlags = view.getUint16(at + 6, true)
174
+ const offset = view.getUint32(at + 8, true)
175
+ const length = view.getUint32(at + 12, true)
176
+ const count = view.getUint32(at + 16, true)
177
+ const aux = view.getUint32(at + 20, true)
178
+ const known = (SECTION_ENCODING as Record<number, number | undefined>)[kind]
179
+
180
+ if (known == null) {
181
+ if (sectionFlags & RGY1_FLAG_REQUIRED)
182
+ throw new RGY1Error("unknown-required-kind", `section ${index} kind ${kind}`)
183
+ } else if (known !== encoding) {
184
+ throw new RGY1Error("encoding", `kind ${kind} encoding ${encoding}`)
185
+ }
186
+
187
+ const end = offset + length
188
+
189
+ if (offset % RGY1_ALIGNMENT !== 0 || offset < cursor || end > bytes.byteLength) {
190
+ throw new RGY1Error("section-bounds", `section ${index} at ${offset}..${end}`)
191
+ }
192
+
193
+ for (let gap = cursor; gap < offset; gap++) {
194
+ if (bytes[gap] !== 0) throw new RGY1Error("section-bounds", `byte ${gap} before section ${index} is not zero`)
195
+ }
196
+
197
+ const payload = bytes.subarray(offset, end)
198
+
199
+ const section: Section = {
200
+ kind,
201
+ encoding,
202
+ elementWidth,
203
+ flags: sectionFlags,
204
+ offset,
205
+ length,
206
+ count,
207
+ aux,
208
+ payload,
209
+ view: new DataView(payload.buffer, payload.byteOffset, payload.byteLength),
210
+ }
211
+
212
+ checkShape(section)
213
+ sections.push(section)
214
+ cursor = end
215
+ }
216
+
217
+ if (bytes.byteLength - cursor >= RGY1_ALIGNMENT)
218
+ throw new RGY1Error("layout", "trailing bytes after the last section")
219
+
220
+ for (let at = cursor; at < bytes.byteLength; at++) {
221
+ if (bytes[at] !== 0) throw new RGY1Error("layout", `trailing byte ${at} is not zero`)
222
+ }
223
+
224
+ return new Artifact(bytes, header, sections)
225
+ }
226
+
227
+ /**
228
+ * The first section of a kind with the given `aux`, or `null`.
229
+ */
230
+ section(kind: number, aux: number): Section | null {
231
+ return this.sections.find((section) => section.kind === kind && section.aux === aux) ?? null
232
+ }
233
+
234
+ /**
235
+ * The first section of a kind, whatever its `aux`, or `null`.
236
+ */
237
+ firstSection(kind: number): Section | null {
238
+ return this.sections.find((section) => section.kind === kind) ?? null
239
+ }
240
+
241
+ /**
242
+ * The section a lookup needs, or an error naming it.
243
+ */
244
+ require(kind: number, aux?: number): Section {
245
+ const section = aux == null ? this.firstSection(kind) : this.section(kind, aux)
246
+
247
+ if (!section) throw new RGY1Error("missing-section", `kind ${kind}${aux == null ? "" : ` aux ${aux}`}`)
248
+
249
+ return section
250
+ }
251
+ }
252
+
253
+ function checkShape(section: Section): void {
254
+ const { kind, elementWidth, length, count, aux } = section
255
+
256
+ switch (kind) {
257
+ case SectionKind.BITSET: {
258
+ if (elementWidth !== 0) throw new RGY1Error("element-width", `bitset width ${elementWidth}`)
259
+
260
+ const space = KEY_SPACES[aux]
261
+
262
+ if (space == null) throw new RGY1Error("key-space", `arity ${aux}`)
263
+
264
+ if (count !== space || length !== Math.ceil(count / 8))
265
+ throw new RGY1Error("count", `bitset ${count} keys in ${length} bytes`)
266
+
267
+ break
268
+ }
269
+ case SectionKind.ID_TABLE: {
270
+ if (![1, 2, 4].includes(elementWidth)) throw new RGY1Error("element-width", `id-table width ${elementWidth}`)
271
+
272
+ const space = KEY_SPACES[aux]
273
+
274
+ if (space == null) throw new RGY1Error("key-space", `arity ${aux}`)
275
+
276
+ if (count !== space || length !== count * elementWidth)
277
+ throw new RGY1Error("count", `id-table ${count} × ${elementWidth}`)
278
+
279
+ break
280
+ }
281
+ case SectionKind.STRING_OFFSETS:
282
+ case SectionKind.RELATION_OFFSETS:
283
+ case SectionKind.RELATION_TARGETS:
284
+ if (elementWidth !== BYTES_PER_U32) throw new RGY1Error("element-width", `kind ${kind} width ${elementWidth}`)
285
+
286
+ if (length !== count * BYTES_PER_U32) throw new RGY1Error("count", `kind ${kind} ${count} × ${BYTES_PER_U32}`)
287
+
288
+ break
289
+ case SectionKind.UTF8:
290
+ if (elementWidth !== 0) throw new RGY1Error("element-width", `utf8 width ${elementWidth}`)
291
+
292
+ if (length !== count) throw new RGY1Error("count", `utf8 ${count} in ${length}`)
293
+
294
+ break
295
+ case SectionKind.COLUMN:
296
+ if (![1, 2, 4, 8].includes(elementWidth)) throw new RGY1Error("element-width", `column width ${elementWidth}`)
297
+
298
+ if (length !== count * elementWidth) throw new RGY1Error("count", `column ${count} × ${elementWidth}`)
299
+
300
+ break
301
+ default:
302
+ }
303
+ }
304
+
305
+ /**
306
+ * Reads the unsigned element at `index` of a section of width 1, 2 or 4.
307
+ */
308
+ export function element(section: Section, index: number): number {
309
+ switch (section.elementWidth) {
310
+ case 1:
311
+ return section.payload[index]!
312
+ case 2:
313
+ return section.view.getUint16(index * 2, true)
314
+ default:
315
+ return section.view.getUint32(index * BYTES_PER_U32, true)
316
+ }
317
+ }
@@ -0,0 +1,80 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * The RGY1 section kinds.
6
+ *
7
+ * Generated from definitions/sections.json by tools/generate-sections.run.ts.
8
+ * Edit the definition rather than this file.
9
+ */
10
+
11
+ /**
12
+ * The four ASCII bytes an artifact starts with.
13
+ */
14
+ export const RGY1_MAGIC = "RGY1"
15
+
16
+ /**
17
+ * The envelope version this reader implements.
18
+ */
19
+ export const RGY1_VERSION = 1
20
+
21
+ /**
22
+ * The byte offset of the header JSON, after the fixed envelope fields.
23
+ */
24
+ export const RGY1_HEADER_OFFSET = 32
25
+
26
+ /**
27
+ * The byte length of one directory entry.
28
+ */
29
+ export const RGY1_DIRECTORY_ENTRY_BYTES = 24
30
+
31
+ /**
32
+ * The alignment of the directory and of every section payload.
33
+ */
34
+ export const RGY1_ALIGNMENT = 8
35
+
36
+ /**
37
+ * The section flag bit that marks a section required for interpretation.
38
+ */
39
+ export const RGY1_FLAG_REQUIRED = 1
40
+
41
+ /**
42
+ * Each section kind's identifier, as the directory entry stores it.
43
+ */
44
+ export const SectionKind = {
45
+ BITSET: 1,
46
+ ID_TABLE: 2,
47
+ STRING_OFFSETS: 3,
48
+ UTF8: 4,
49
+ COLUMN: 5,
50
+ RELATION_OFFSETS: 6,
51
+ RELATION_TARGETS: 7,
52
+ } as const
53
+
54
+ export type SectionKind = (typeof SectionKind)[keyof typeof SectionKind]
55
+
56
+ /**
57
+ * The encoding version each kind is written with.
58
+ */
59
+ export const SECTION_ENCODING: Readonly<Record<SectionKind, number>> = {
60
+ [SectionKind.BITSET]: 1,
61
+ [SectionKind.ID_TABLE]: 1,
62
+ [SectionKind.STRING_OFFSETS]: 1,
63
+ [SectionKind.UTF8]: 1,
64
+ [SectionKind.COLUMN]: 1,
65
+ [SectionKind.RELATION_OFFSETS]: 1,
66
+ [SectionKind.RELATION_TARGETS]: 1,
67
+ }
68
+
69
+ /**
70
+ * Each kind's name, for diagnostics.
71
+ */
72
+ export const SECTION_NAME: Readonly<Record<SectionKind, string>> = {
73
+ [SectionKind.BITSET]: "bitset",
74
+ [SectionKind.ID_TABLE]: "id-table",
75
+ [SectionKind.STRING_OFFSETS]: "string-offsets",
76
+ [SectionKind.UTF8]: "utf8",
77
+ [SectionKind.COLUMN]: "column",
78
+ [SectionKind.RELATION_OFFSETS]: "relation-offsets",
79
+ [SectionKind.RELATION_TARGETS]: "relation-targets",
80
+ }
@@ -0,0 +1,266 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * Typed views over an artifact's sections: bitset, id table, column, string pool and relation.
6
+ */
7
+
8
+ import { encodeForArity, NO_KEY } from "#key"
9
+ import { type Artifact, element, RGY1Error, type Section } from "#rgy1/reader"
10
+ import { SectionKind } from "#rgy1/sections.generated"
11
+
12
+ /**
13
+ * The byte width of an IEEE 754 double cell.
14
+ */
15
+ const BYTES_PER_DOUBLE = 8
16
+
17
+ /**
18
+ * A dense bitset over a key space.
19
+ */
20
+ export class BitsetView {
21
+ readonly #bits: Uint8Array
22
+ readonly arity: number
23
+
24
+ constructor(section: Section) {
25
+ this.#bits = section.payload
26
+ this.arity = section.aux
27
+ }
28
+
29
+ static of(artifact: Artifact): BitsetView {
30
+ return new BitsetView(artifact.require(SectionKind.BITSET))
31
+ }
32
+
33
+ /**
34
+ * Whether `key` is a member.
35
+ * A key outside the space isn't.
36
+ */
37
+ test(key: number): boolean {
38
+ if (key < 0) return false
39
+
40
+ const byte = key >> 3
41
+
42
+ return byte < this.#bits.length && (this.#bits[byte]! & (1 << (key & 7))) !== 0
43
+ }
44
+
45
+ /**
46
+ * Whether a code in its canonical spelling is a member.
47
+ * A code outside the grammar isn't.
48
+ */
49
+ contains(code: string): boolean {
50
+ return this.test(encodeForArity(this.arity, code))
51
+ }
52
+
53
+ /**
54
+ * The number of set bits.
55
+ */
56
+ get size(): number {
57
+ let count = 0
58
+
59
+ for (const byte of this.#bits) {
60
+ let value = byte
61
+
62
+ while (value) {
63
+ count += value & 1
64
+ value >>= 1
65
+ }
66
+ }
67
+
68
+ return count
69
+ }
70
+ }
71
+
72
+ /**
73
+ * A direct-address table from key to row id, with zero stored for absent.
74
+ */
75
+ export class IDTableView {
76
+ readonly #section: Section
77
+
78
+ constructor(section: Section) {
79
+ this.#section = section
80
+ }
81
+
82
+ static of(artifact: Artifact, arity: number): IDTableView {
83
+ return new IDTableView(artifact.require(SectionKind.ID_TABLE, arity))
84
+ }
85
+
86
+ /**
87
+ * The row id for a key, or `-1` when absent.
88
+ */
89
+ get(key: number): number {
90
+ if (key < 0 || key >= this.#section.count) return -1
91
+
92
+ return element(this.#section, key) - 1
93
+ }
94
+
95
+ /**
96
+ * The row id for a code in its canonical spelling, or `-1`.
97
+ */
98
+ lookup(code: string): number {
99
+ return this.get(encodeForArity(this.#section.aux, code))
100
+ }
101
+ }
102
+
103
+ /**
104
+ * A fixed-width record column.
105
+ */
106
+ export class ColumnView {
107
+ readonly #section: Section
108
+
109
+ constructor(section: Section) {
110
+ this.#section = section
111
+ }
112
+
113
+ static of(artifact: Artifact, index: number): ColumnView {
114
+ return new ColumnView(artifact.require(SectionKind.COLUMN, index))
115
+ }
116
+
117
+ get rows(): number {
118
+ return this.#section.count
119
+ }
120
+
121
+ /**
122
+ * An unsigned integer cell of width 1, 2 or 4.
123
+ */
124
+ integer(row: number): number {
125
+ if (row < 0 || row >= this.#section.count || this.#section.elementWidth === BYTES_PER_DOUBLE) return NO_KEY
126
+
127
+ return element(this.#section, row)
128
+ }
129
+
130
+ /**
131
+ * A double cell.
132
+ */
133
+ double(row: number): number {
134
+ if (row < 0 || row >= this.#section.count || this.#section.elementWidth !== BYTES_PER_DOUBLE) return Number.NaN
135
+
136
+ return this.#section.view.getFloat64(row * BYTES_PER_DOUBLE, true)
137
+ }
138
+ }
139
+
140
+ const decoder = new TextDecoder("utf-8", { fatal: true })
141
+
142
+ /**
143
+ * A string pool: offsets into a strict UTF-8 byte section, decoded on read.
144
+ */
145
+ export class StringPoolView {
146
+ readonly #offsets: Section
147
+ readonly #bytes: Uint8Array
148
+
149
+ constructor(offsets: Section, bytes: Section) {
150
+ if (offsets.count === 0) throw new RGY1Error("offsets", "a string pool needs at least one offset")
151
+
152
+ let previous = 0
153
+
154
+ for (let index = 0; index < offsets.count; index++) {
155
+ const offset = element(offsets, index)
156
+
157
+ if (offset < previous) throw new RGY1Error("offsets", `string offset ${index} goes backwards`)
158
+
159
+ previous = offset
160
+ }
161
+
162
+ if (previous !== bytes.length)
163
+ throw new RGY1Error("offsets", `string offsets end at ${previous}, bytes are ${bytes.length}`)
164
+
165
+ try {
166
+ decoder.decode(bytes.payload)
167
+ } catch {
168
+ throw new RGY1Error("string-utf8", "the pool is not strict UTF-8")
169
+ }
170
+
171
+ this.#offsets = offsets
172
+ this.#bytes = bytes.payload
173
+ }
174
+
175
+ static of(artifact: Artifact): StringPoolView {
176
+ return new StringPoolView(artifact.require(SectionKind.STRING_OFFSETS), artifact.require(SectionKind.UTF8))
177
+ }
178
+
179
+ get size(): number {
180
+ return this.#offsets.count - 1
181
+ }
182
+
183
+ /**
184
+ * The string at `index`, or `null` outside the pool.
185
+ */
186
+ get(index: number): string | null {
187
+ if (index < 0 || index >= this.size) return null
188
+
189
+ return decoder.decode(this.#bytes.subarray(element(this.#offsets, index), element(this.#offsets, index + 1)))
190
+ }
191
+ }
192
+
193
+ /**
194
+ * A relation from each source key to its target rows.
195
+ */
196
+ export class RelationView {
197
+ readonly #offsets: Section
198
+ readonly #targets: Section
199
+
200
+ constructor(offsets: Section, targets: Section) {
201
+ if (offsets.count === 0) throw new RGY1Error("offsets", "a relation needs at least one offset")
202
+
203
+ let previous = 0
204
+
205
+ for (let index = 0; index < offsets.count; index++) {
206
+ const offset = element(offsets, index)
207
+
208
+ if (offset < previous) throw new RGY1Error("offsets", `relation offset ${index} goes backwards`)
209
+
210
+ previous = offset
211
+ }
212
+
213
+ if (previous !== targets.count)
214
+ throw new RGY1Error("offsets", `relation offsets end at ${previous}, targets are ${targets.count}`)
215
+
216
+ this.#offsets = offsets
217
+ this.#targets = targets
218
+ }
219
+
220
+ static of(artifact: Artifact, index: number): RelationView {
221
+ return new RelationView(
222
+ artifact.require(SectionKind.RELATION_OFFSETS, index),
223
+ artifact.require(SectionKind.RELATION_TARGETS, index)
224
+ )
225
+ }
226
+
227
+ get sources(): number {
228
+ return this.#offsets.count - 1
229
+ }
230
+
231
+ /**
232
+ * The target rows of one source key, as a fresh array.
233
+ */
234
+ targets(source: number): number[] {
235
+ if (source < 0 || source >= this.sources) return []
236
+
237
+ const start = element(this.#offsets, source)
238
+ const end = element(this.#offsets, source + 1)
239
+ const out = new Array<number>(end - start)
240
+
241
+ for (let index = start; index < end; index++) {
242
+ out[index - start] = element(this.#targets, index)
243
+ }
244
+
245
+ return out
246
+ }
247
+
248
+ /**
249
+ * Writes the target rows of one source key into `out` and returns the count written,
250
+ * or `-1` when `out` is too small.
251
+ */
252
+ targetsInto(source: number, out: Uint32Array): number {
253
+ if (source < 0 || source >= this.sources) return 0
254
+
255
+ const start = element(this.#offsets, source)
256
+ const end = element(this.#offsets, source + 1)
257
+
258
+ if (end - start > out.length) return -1
259
+
260
+ for (let index = start; index < end; index++) {
261
+ out[index - start] = element(this.#targets, index)
262
+ }
263
+
264
+ return end - start
265
+ }
266
+ }