@mailwoman/registry 10.8.0 → 11.0.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 +26 -0
  13. package/lib/artifacts/iata-airport/membership.ts +26 -0
  14. package/lib/artifacts/iata-airport/records.ts +26 -0
  15. package/lib/artifacts/iso3166-1/alpha2-membership.ts +26 -0
  16. package/lib/artifacts/iso3166-1/alpha3-membership.ts +26 -0
  17. package/lib/artifacts/iso3166-1/records.ts +26 -0
  18. package/lib/errors.ts +44 -0
  19. package/lib/iata/airports/records.ts +174 -0
  20. package/lib/iata/airports/validate.ts +49 -0
  21. package/lib/index.ts +25 -15
  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 +149 -0
  26. package/lib/iso3166/relations.ts +30 -0
  27. package/lib/key.ts +146 -0
  28. package/lib/normalize.ts +31 -0
  29. package/lib/overlap/country-airport.ts +108 -0
  30. package/lib/rgy1/base64.ts +24 -0
  31. package/lib/rgy1/reader.ts +316 -0
  32. package/lib/rgy1/sections.generated.ts +79 -0
  33. package/lib/rgy1/views.ts +267 -0
  34. package/lib/types.ts +88 -74
  35. package/lib/wasm.ts +285 -0
  36. package/out/artifacts/country-airport-collision.d.ts +15 -0
  37. package/out/artifacts/country-airport-collision.d.ts.map +1 -0
  38. package/out/artifacts/country-airport-collision.js +21 -0
  39. package/out/artifacts/country-airport-collision.js.map +1 -0
  40. package/out/artifacts/iata-airport/membership.d.ts +15 -0
  41. package/out/artifacts/iata-airport/membership.d.ts.map +1 -0
  42. package/out/artifacts/iata-airport/membership.js +21 -0
  43. package/out/artifacts/iata-airport/membership.js.map +1 -0
  44. package/out/artifacts/iata-airport/records.d.ts +15 -0
  45. package/out/artifacts/iata-airport/records.d.ts.map +1 -0
  46. package/out/artifacts/iata-airport/records.js +21 -0
  47. package/out/artifacts/iata-airport/records.js.map +1 -0
  48. package/out/artifacts/iso3166-1/alpha2-membership.d.ts +15 -0
  49. package/out/artifacts/iso3166-1/alpha2-membership.d.ts.map +1 -0
  50. package/out/artifacts/iso3166-1/alpha2-membership.js +21 -0
  51. package/out/artifacts/iso3166-1/alpha2-membership.js.map +1 -0
  52. package/out/artifacts/iso3166-1/alpha3-membership.d.ts +15 -0
  53. package/out/artifacts/iso3166-1/alpha3-membership.d.ts.map +1 -0
  54. package/out/artifacts/iso3166-1/alpha3-membership.js +21 -0
  55. package/out/artifacts/iso3166-1/alpha3-membership.js.map +1 -0
  56. package/out/artifacts/iso3166-1/records.d.ts +15 -0
  57. package/out/artifacts/iso3166-1/records.d.ts.map +1 -0
  58. package/out/artifacts/iso3166-1/records.js +21 -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 +35 -0
  63. package/out/errors.js.map +1 -0
  64. package/out/iata/airports/records.d.ts +44 -0
  65. package/out/iata/airports/records.d.ts.map +1 -0
  66. package/out/iata/airports/records.js +137 -0
  67. package/out/iata/airports/records.js.map +1 -0
  68. package/out/iata/airports/validate.d.ts +27 -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 +19 -15
  73. package/out/index.d.ts.map +1 -1
  74. package/out/index.js +14 -15
  75. package/out/index.js.map +1 -1
  76. package/out/inspect.d.ts +38 -0
  77. package/out/inspect.d.ts.map +1 -0
  78. package/out/inspect.js +33 -0
  79. package/out/inspect.js.map +1 -0
  80. package/out/iso3166/alpha2.d.ts +24 -0
  81. package/out/iso3166/alpha2.d.ts.map +1 -0
  82. package/out/iso3166/alpha2.js +41 -0
  83. package/out/iso3166/alpha2.js.map +1 -0
  84. package/out/iso3166/alpha3.d.ts +29 -0
  85. package/out/iso3166/alpha3.d.ts.map +1 -0
  86. package/out/iso3166/alpha3.js +44 -0
  87. package/out/iso3166/alpha3.js.map +1 -0
  88. package/out/iso3166/records.d.ts +38 -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 +20 -0
  93. package/out/iso3166/relations.d.ts.map +1 -0
  94. package/out/iso3166/relations.js +27 -0
  95. package/out/iso3166/relations.js.map +1 -0
  96. package/out/key.d.ts +68 -0
  97. package/out/key.d.ts.map +1 -0
  98. package/out/key.js +122 -0
  99. package/out/key.js.map +1 -0
  100. package/out/normalize.d.ts +25 -0
  101. package/out/normalize.d.ts.map +1 -0
  102. package/out/normalize.js +21 -0
  103. package/out/normalize.js.map +1 -0
  104. package/out/overlap/country-airport.d.ts +57 -0
  105. package/out/overlap/country-airport.d.ts.map +1 -0
  106. package/out/overlap/country-airport.js +71 -0
  107. package/out/overlap/country-airport.js.map +1 -0
  108. package/out/rgy1/base64.d.ts +15 -0
  109. package/out/rgy1/base64.d.ts.map +1 -0
  110. package/out/rgy1/base64.js +22 -0
  111. package/out/rgy1/base64.js.map +1 -0
  112. package/out/rgy1/reader.d.ts +103 -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 +54 -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 +96 -0
  121. package/out/rgy1/views.d.ts.map +1 -0
  122. package/out/rgy1/views.js +218 -0
  123. package/out/rgy1/views.js.map +1 -0
  124. package/out/sdk/fetch.d.ts +53 -0
  125. package/out/sdk/fetch.d.ts.map +1 -0
  126. package/out/sdk/fetch.js +107 -0
  127. package/out/sdk/fetch.js.map +1 -0
  128. package/out/sdk/fetch.run.d.ts +14 -0
  129. package/out/sdk/fetch.run.d.ts.map +1 -0
  130. package/out/sdk/fetch.run.js +20 -0
  131. package/out/sdk/fetch.run.js.map +1 -0
  132. package/out/sdk/sources.d.ts +111 -0
  133. package/out/sdk/sources.d.ts.map +1 -0
  134. package/out/sdk/sources.js +98 -0
  135. package/out/sdk/sources.js.map +1 -0
  136. package/out/tools/artifact-path.d.ts +10 -0
  137. package/out/tools/artifact-path.d.ts.map +1 -0
  138. package/out/tools/artifact-path.js +12 -0
  139. package/out/tools/artifact-path.js.map +1 -0
  140. package/out/tools/bench.run.d.ts +19 -0
  141. package/out/tools/bench.run.d.ts.map +1 -0
  142. package/out/tools/bench.run.js +204 -0
  143. package/out/tools/bench.run.js.map +1 -0
  144. package/out/tools/build-wasm.run.d.ts +18 -0
  145. package/out/tools/build-wasm.run.d.ts.map +1 -0
  146. package/out/tools/build-wasm.run.js +71 -0
  147. package/out/tools/build-wasm.run.js.map +1 -0
  148. package/out/tools/generate-sections.run.d.ts +13 -0
  149. package/out/tools/generate-sections.run.d.ts.map +1 -0
  150. package/out/tools/generate-sections.run.js +136 -0
  151. package/out/tools/generate-sections.run.js.map +1 -0
  152. package/out/tools/generate.run.d.ts +18 -0
  153. package/out/tools/generate.run.d.ts.map +1 -0
  154. package/out/tools/generate.run.js +118 -0
  155. package/out/tools/generate.run.js.map +1 -0
  156. package/out/tools/normalize.d.ts +155 -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 +14 -0
  161. package/out/tools/normalize.run.d.ts.map +1 -0
  162. package/out/tools/normalize.run.js +29 -0
  163. package/out/tools/normalize.run.js.map +1 -0
  164. package/out/types.d.ts +90 -76
  165. package/out/types.d.ts.map +1 -1
  166. package/out/types.js +20 -4
  167. package/out/types.js.map +1 -1
  168. package/out/wasm.d.ts +98 -0
  169. package/out/wasm.d.ts.map +1 -0
  170. package/out/wasm.js +137 -0
  171. package/out/wasm.js.map +1 -0
  172. package/package.json +48 -27
  173. package/sdk/fetch.run.ts +24 -0
  174. package/sdk/fetch.ts +146 -0
  175. package/sdk/sources.ts +162 -0
  176. package/tools/artifact-path.ts +12 -0
  177. package/tools/bench.run.ts +265 -0
  178. package/tools/build-wasm.run.ts +82 -0
  179. package/tools/generate-sections.run.ts +152 -0
  180. package/tools/generate.run.ts +146 -0
  181. package/tools/normalize.run.ts +36 -0
  182. package/tools/normalize.ts +474 -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,316 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The synchronous RGY1 reader: validate an artifact once, then probe its tables in place.
7
+ *
8
+ * The reader mirrors `crates/registry-core/src/artifact.rs` and follows `docs/rgy1.md`. It reads through a
9
+ * `DataView` over the caller's bytes, honoring `byteOffset`, so an artifact handed over as a subarray behaves as the
10
+ * same bytes would in their own buffer. No `Map` is rebuilt: a probe is an arithmetic index into the section's payload.
11
+ */
12
+
13
+ import {
14
+ RGY1_ALIGNMENT,
15
+ RGY1_DIRECTORY_ENTRY_BYTES,
16
+ RGY1_FLAG_REQUIRED,
17
+ RGY1_HEADER_OFFSET,
18
+ RGY1_MAGIC,
19
+ RGY1_VERSION,
20
+ SECTION_ENCODING,
21
+ SectionKind,
22
+ } from "#rgy1/sections.generated"
23
+
24
+ /**
25
+ * Why bytes are not an RGY1 artifact this reader accepts.
26
+ */
27
+ export class RGY1Error extends Error {
28
+ readonly code: string
29
+
30
+ constructor(code: string, message: string) {
31
+ super(`RGY1 ${code}: ${message}`)
32
+ this.name = "RGY1Error"
33
+ this.code = code
34
+ }
35
+ }
36
+
37
+ /**
38
+ * One directory entry with its payload view.
39
+ */
40
+ export interface Section {
41
+ kind: number
42
+ encoding: number
43
+ elementWidth: number
44
+ flags: number
45
+ offset: number
46
+ length: number
47
+ count: number
48
+ aux: number
49
+ payload: Uint8Array
50
+ view: DataView
51
+ }
52
+
53
+ /**
54
+ * The header fields every artifact holds.
55
+ * A records artifact adds `columns`, `rows` and `relations`.
56
+ */
57
+ export interface ArtifactHeader {
58
+ artifact: string
59
+ profile: string
60
+ namespaces: string[]
61
+ sources: Array<{ id: string; sha256: string; publication: string }>
62
+ coverage: Record<string, number>
63
+ schemaVersion: number
64
+ normalizationVersion: number
65
+ envelopeVersion: number
66
+ encodings: Record<string, number>
67
+ generator: string
68
+ status?: string
69
+ kinds?: string[]
70
+ meaning?: string
71
+ rows?: number
72
+ columns?: Array<{ name: string; type: string; width: number; values?: string[]; absent?: number }>
73
+ relations?: Array<{ name: string; source: string; targets: string }>
74
+ }
75
+
76
+ const KEY_SPACES: Readonly<Record<number, number>> = { 0: 1000, 2: 676, 3: 17_576 }
77
+
78
+ /**
79
+ * The byte width of a `u32` cell.
80
+ */
81
+ const BYTES_PER_U32 = 4
82
+
83
+ /**
84
+ * Rounds up to the section alignment.
85
+ */
86
+ export function align(value: number): number {
87
+ return Math.ceil(value / RGY1_ALIGNMENT) * RGY1_ALIGNMENT
88
+ }
89
+
90
+ const decoder = new TextDecoder("utf-8", { fatal: true })
91
+
92
+ /**
93
+ * A validated artifact over the caller's bytes.
94
+ */
95
+ export class Artifact {
96
+ readonly bytes: Uint8Array
97
+ readonly header: ArtifactHeader
98
+ readonly sections: readonly Section[]
99
+
100
+ private constructor(bytes: Uint8Array, header: ArtifactHeader, sections: readonly Section[]) {
101
+ this.bytes = bytes
102
+ this.header = header
103
+ this.sections = sections
104
+ }
105
+
106
+ /**
107
+ * Parses and validates the envelope, directory and every section's framing.
108
+ */
109
+ static parse(bytes: Uint8Array): Artifact {
110
+ if (bytes.byteLength < RGY1_HEADER_OFFSET) throw new RGY1Error("truncated", `${bytes.byteLength} bytes`)
111
+
112
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
113
+
114
+ for (let index = 0; index < RGY1_MAGIC.length; index++) {
115
+ if (bytes[index] !== RGY1_MAGIC.charCodeAt(index)) throw new RGY1Error("magic", "the first bytes are not RGY1")
116
+ }
117
+
118
+ const version = view.getUint16(4, true)
119
+
120
+ if (version !== RGY1_VERSION) throw new RGY1Error("version", `envelope version ${version}`)
121
+
122
+ const flags = view.getUint16(6, true)
123
+
124
+ if (flags !== 0) throw new RGY1Error("flags", `envelope flags ${flags}`)
125
+
126
+ const headerLength = view.getUint32(8, true)
127
+ const sectionCount = view.getUint32(12, true)
128
+ const directoryOffset = view.getUint32(16, true)
129
+ const totalLength = view.getUint32(20, true)
130
+ const firstPayload = view.getUint32(24, true)
131
+
132
+ if (view.getUint32(28, true) !== 0) throw new RGY1Error("reserved", "the reserved field is set")
133
+
134
+ if (totalLength !== bytes.byteLength) {
135
+ throw new RGY1Error("length", `stated ${totalLength} bytes, given ${bytes.byteLength}`)
136
+ }
137
+
138
+ const headerEnd = RGY1_HEADER_OFFSET + headerLength
139
+
140
+ if (headerEnd > bytes.byteLength || directoryOffset !== align(headerEnd)) {
141
+ throw new RGY1Error("layout", `directory at ${directoryOffset}, header ends at ${headerEnd}`)
142
+ }
143
+
144
+ const directoryEnd = directoryOffset + sectionCount * RGY1_DIRECTORY_ENTRY_BYTES
145
+
146
+ if (directoryEnd > bytes.byteLength || firstPayload !== align(directoryEnd) || firstPayload > bytes.byteLength) {
147
+ throw new RGY1Error("layout", `first payload at ${firstPayload}, directory ends at ${directoryEnd}`)
148
+ }
149
+
150
+ let headerText: string
151
+
152
+ try {
153
+ headerText = decoder.decode(bytes.subarray(RGY1_HEADER_OFFSET, headerEnd))
154
+ } catch {
155
+ throw new RGY1Error("header-utf8", "the header is not strict UTF-8")
156
+ }
157
+
158
+ for (let at = headerEnd; at < directoryOffset; at++) {
159
+ if (bytes[at] !== 0) throw new RGY1Error("layout", `byte ${at} between header and directory is not zero`)
160
+ }
161
+
162
+ // 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
163
+ const header = JSON.parse(headerText) as ArtifactHeader
164
+ const sections: Section[] = []
165
+ let cursor = firstPayload
166
+
167
+ for (let index = 0; index < sectionCount; index++) {
168
+ const at = directoryOffset + index * RGY1_DIRECTORY_ENTRY_BYTES
169
+ const kind = view.getUint16(at, true)
170
+ const encoding = view.getUint16(at + 2, true)
171
+ const elementWidth = view.getUint16(at + 4, true)
172
+ const sectionFlags = view.getUint16(at + 6, true)
173
+ const offset = view.getUint32(at + 8, true)
174
+ const length = view.getUint32(at + 12, true)
175
+ const count = view.getUint32(at + 16, true)
176
+ const aux = view.getUint32(at + 20, true)
177
+ const known = (SECTION_ENCODING as Record<number, number | undefined>)[kind]
178
+
179
+ if (known == null) {
180
+ if (sectionFlags & RGY1_FLAG_REQUIRED)
181
+ throw new RGY1Error("unknown-required-kind", `section ${index} kind ${kind}`)
182
+ } else if (known !== encoding) {
183
+ throw new RGY1Error("encoding", `kind ${kind} encoding ${encoding}`)
184
+ }
185
+
186
+ const end = offset + length
187
+
188
+ if (offset % RGY1_ALIGNMENT !== 0 || offset < cursor || end > bytes.byteLength) {
189
+ throw new RGY1Error("section-bounds", `section ${index} at ${offset}..${end}`)
190
+ }
191
+
192
+ for (let gap = cursor; gap < offset; gap++) {
193
+ if (bytes[gap] !== 0) throw new RGY1Error("section-bounds", `byte ${gap} before section ${index} is not zero`)
194
+ }
195
+
196
+ const payload = bytes.subarray(offset, end)
197
+
198
+ const section: Section = {
199
+ kind,
200
+ encoding,
201
+ elementWidth,
202
+ flags: sectionFlags,
203
+ offset,
204
+ length,
205
+ count,
206
+ aux,
207
+ payload,
208
+ view: new DataView(payload.buffer, payload.byteOffset, payload.byteLength),
209
+ }
210
+
211
+ checkShape(section)
212
+ sections.push(section)
213
+ cursor = end
214
+ }
215
+
216
+ if (bytes.byteLength - cursor >= RGY1_ALIGNMENT)
217
+ throw new RGY1Error("layout", "trailing bytes after the last section")
218
+
219
+ for (let at = cursor; at < bytes.byteLength; at++) {
220
+ if (bytes[at] !== 0) throw new RGY1Error("layout", `trailing byte ${at} is not zero`)
221
+ }
222
+
223
+ return new Artifact(bytes, header, sections)
224
+ }
225
+
226
+ /**
227
+ * The first section of a kind with the given `aux`, or `null`.
228
+ */
229
+ section(kind: number, aux: number): Section | null {
230
+ return this.sections.find((section) => section.kind === kind && section.aux === aux) ?? null
231
+ }
232
+
233
+ /**
234
+ * The first section of a kind, whatever its `aux`, or `null`.
235
+ */
236
+ firstSection(kind: number): Section | null {
237
+ return this.sections.find((section) => section.kind === kind) ?? null
238
+ }
239
+
240
+ /**
241
+ * The section a lookup needs, or an error naming it.
242
+ */
243
+ require(kind: number, aux?: number): Section {
244
+ const section = aux == null ? this.firstSection(kind) : this.section(kind, aux)
245
+
246
+ if (!section) throw new RGY1Error("missing-section", `kind ${kind}${aux == null ? "" : ` aux ${aux}`}`)
247
+
248
+ return section
249
+ }
250
+ }
251
+
252
+ function checkShape(section: Section): void {
253
+ const { kind, elementWidth, length, count, aux } = section
254
+
255
+ switch (kind) {
256
+ case SectionKind.BITSET: {
257
+ if (elementWidth !== 0) throw new RGY1Error("element-width", `bitset width ${elementWidth}`)
258
+
259
+ const space = KEY_SPACES[aux]
260
+
261
+ if (space == null) throw new RGY1Error("key-space", `arity ${aux}`)
262
+
263
+ if (count !== space || length !== Math.ceil(count / 8))
264
+ throw new RGY1Error("count", `bitset ${count} keys in ${length} bytes`)
265
+
266
+ break
267
+ }
268
+ case SectionKind.ID_TABLE: {
269
+ if (![1, 2, 4].includes(elementWidth)) throw new RGY1Error("element-width", `id-table width ${elementWidth}`)
270
+
271
+ const space = KEY_SPACES[aux]
272
+
273
+ if (space == null) throw new RGY1Error("key-space", `arity ${aux}`)
274
+
275
+ if (count !== space || length !== count * elementWidth)
276
+ throw new RGY1Error("count", `id-table ${count} × ${elementWidth}`)
277
+
278
+ break
279
+ }
280
+ case SectionKind.STRING_OFFSETS:
281
+ case SectionKind.RELATION_OFFSETS:
282
+ case SectionKind.RELATION_TARGETS:
283
+ if (elementWidth !== BYTES_PER_U32) throw new RGY1Error("element-width", `kind ${kind} width ${elementWidth}`)
284
+
285
+ if (length !== count * BYTES_PER_U32) throw new RGY1Error("count", `kind ${kind} ${count} × ${BYTES_PER_U32}`)
286
+
287
+ break
288
+ case SectionKind.UTF8:
289
+ if (elementWidth !== 0) throw new RGY1Error("element-width", `utf8 width ${elementWidth}`)
290
+
291
+ if (length !== count) throw new RGY1Error("count", `utf8 ${count} in ${length}`)
292
+
293
+ break
294
+ case SectionKind.COLUMN:
295
+ if (![1, 2, 4, 8].includes(elementWidth)) throw new RGY1Error("element-width", `column width ${elementWidth}`)
296
+
297
+ if (length !== count * elementWidth) throw new RGY1Error("count", `column ${count} × ${elementWidth}`)
298
+
299
+ break
300
+ default:
301
+ }
302
+ }
303
+
304
+ /**
305
+ * Reads the unsigned element at `index` of a section of width 1, 2 or 4.
306
+ */
307
+ export function element(section: Section, index: number): number {
308
+ switch (section.elementWidth) {
309
+ case 1:
310
+ return section.payload[index]!
311
+ case 2:
312
+ return section.view.getUint16(index * 2, true)
313
+ default:
314
+ return section.view.getUint32(index * BYTES_PER_U32, true)
315
+ }
316
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The RGY1 section kinds. Generated from definitions/sections.json by tools/generate-sections.run.ts. Edit the
7
+ * definition rather than this file.
8
+ */
9
+
10
+ /**
11
+ * The four ASCII bytes an artifact starts with.
12
+ */
13
+ export const RGY1_MAGIC = "RGY1"
14
+
15
+ /**
16
+ * The envelope version this reader implements.
17
+ */
18
+ export const RGY1_VERSION = 1
19
+
20
+ /**
21
+ * The byte offset of the header JSON, after the fixed envelope fields.
22
+ */
23
+ export const RGY1_HEADER_OFFSET = 32
24
+
25
+ /**
26
+ * The byte length of one directory entry.
27
+ */
28
+ export const RGY1_DIRECTORY_ENTRY_BYTES = 24
29
+
30
+ /**
31
+ * The alignment of the directory and of every section payload.
32
+ */
33
+ export const RGY1_ALIGNMENT = 8
34
+
35
+ /**
36
+ * The section flag bit that marks a section required for interpretation.
37
+ */
38
+ export const RGY1_FLAG_REQUIRED = 1
39
+
40
+ /**
41
+ * Each section kind's identifier, as the directory entry stores it.
42
+ */
43
+ export const SectionKind = {
44
+ BITSET: 1,
45
+ ID_TABLE: 2,
46
+ STRING_OFFSETS: 3,
47
+ UTF8: 4,
48
+ COLUMN: 5,
49
+ RELATION_OFFSETS: 6,
50
+ RELATION_TARGETS: 7,
51
+ } as const
52
+
53
+ export type SectionKind = (typeof SectionKind)[keyof typeof SectionKind]
54
+
55
+ /**
56
+ * The encoding version each kind is written with.
57
+ */
58
+ export const SECTION_ENCODING: Readonly<Record<SectionKind, number>> = {
59
+ [SectionKind.BITSET]: 1,
60
+ [SectionKind.ID_TABLE]: 1,
61
+ [SectionKind.STRING_OFFSETS]: 1,
62
+ [SectionKind.UTF8]: 1,
63
+ [SectionKind.COLUMN]: 1,
64
+ [SectionKind.RELATION_OFFSETS]: 1,
65
+ [SectionKind.RELATION_TARGETS]: 1,
66
+ }
67
+
68
+ /**
69
+ * Each kind's name, for diagnostics.
70
+ */
71
+ export const SECTION_NAME: Readonly<Record<SectionKind, string>> = {
72
+ [SectionKind.BITSET]: "bitset",
73
+ [SectionKind.ID_TABLE]: "id-table",
74
+ [SectionKind.STRING_OFFSETS]: "string-offsets",
75
+ [SectionKind.UTF8]: "utf8",
76
+ [SectionKind.COLUMN]: "column",
77
+ [SectionKind.RELATION_OFFSETS]: "relation-offsets",
78
+ [SectionKind.RELATION_TARGETS]: "relation-targets",
79
+ }
@@ -0,0 +1,267 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Typed views over an artifact's sections: bitset, id table, column, string pool and relation.
7
+ */
8
+
9
+ import { encodeForArity, NO_KEY } from "#key"
10
+ import { type Artifact, element, RGY1Error, type Section } from "#rgy1/reader"
11
+ import { SectionKind } from "#rgy1/sections.generated"
12
+
13
+ /**
14
+ * The byte width of an IEEE 754 double cell.
15
+ */
16
+ const BYTES_PER_DOUBLE = 8
17
+
18
+ /**
19
+ * A dense bitset over a key space.
20
+ */
21
+ export class BitsetView {
22
+ readonly #bits: Uint8Array
23
+ readonly arity: number
24
+
25
+ constructor(section: Section) {
26
+ this.#bits = section.payload
27
+ this.arity = section.aux
28
+ }
29
+
30
+ static of(artifact: Artifact): BitsetView {
31
+ return new BitsetView(artifact.require(SectionKind.BITSET))
32
+ }
33
+
34
+ /**
35
+ * Whether `key` is a member.
36
+ * A key outside the space is not.
37
+ */
38
+ test(key: number): boolean {
39
+ if (key < 0) return false
40
+
41
+ const byte = key >> 3
42
+
43
+ return byte < this.#bits.length && (this.#bits[byte]! & (1 << (key & 7))) !== 0
44
+ }
45
+
46
+ /**
47
+ * Whether a code in its canonical spelling is a member.
48
+ * A code outside the grammar is not.
49
+ */
50
+ contains(code: string): boolean {
51
+ return this.test(encodeForArity(this.arity, code))
52
+ }
53
+
54
+ /**
55
+ * The number of set bits.
56
+ */
57
+ get size(): number {
58
+ let count = 0
59
+
60
+ for (const byte of this.#bits) {
61
+ let value = byte
62
+
63
+ while (value) {
64
+ count += value & 1
65
+ value >>= 1
66
+ }
67
+ }
68
+
69
+ return count
70
+ }
71
+ }
72
+
73
+ /**
74
+ * A direct-address table from key to row id, with zero stored for absent.
75
+ */
76
+ export class IDTableView {
77
+ readonly #section: Section
78
+
79
+ constructor(section: Section) {
80
+ this.#section = section
81
+ }
82
+
83
+ static of(artifact: Artifact, arity: number): IDTableView {
84
+ return new IDTableView(artifact.require(SectionKind.ID_TABLE, arity))
85
+ }
86
+
87
+ /**
88
+ * The row id for a key, or `-1` when absent.
89
+ */
90
+ get(key: number): number {
91
+ if (key < 0 || key >= this.#section.count) return -1
92
+
93
+ return element(this.#section, key) - 1
94
+ }
95
+
96
+ /**
97
+ * The row id for a code in its canonical spelling, or `-1`.
98
+ */
99
+ lookup(code: string): number {
100
+ return this.get(encodeForArity(this.#section.aux, code))
101
+ }
102
+ }
103
+
104
+ /**
105
+ * A fixed-width record column.
106
+ */
107
+ export class ColumnView {
108
+ readonly #section: Section
109
+
110
+ constructor(section: Section) {
111
+ this.#section = section
112
+ }
113
+
114
+ static of(artifact: Artifact, index: number): ColumnView {
115
+ return new ColumnView(artifact.require(SectionKind.COLUMN, index))
116
+ }
117
+
118
+ get rows(): number {
119
+ return this.#section.count
120
+ }
121
+
122
+ /**
123
+ * An unsigned integer cell of width 1, 2 or 4.
124
+ */
125
+ integer(row: number): number {
126
+ if (row < 0 || row >= this.#section.count || this.#section.elementWidth === BYTES_PER_DOUBLE) return NO_KEY
127
+
128
+ return element(this.#section, row)
129
+ }
130
+
131
+ /**
132
+ * A double cell.
133
+ */
134
+ double(row: number): number {
135
+ if (row < 0 || row >= this.#section.count || this.#section.elementWidth !== BYTES_PER_DOUBLE) return Number.NaN
136
+
137
+ return this.#section.view.getFloat64(row * BYTES_PER_DOUBLE, true)
138
+ }
139
+ }
140
+
141
+ const decoder = new TextDecoder("utf-8", { fatal: true })
142
+
143
+ /**
144
+ * A string pool: offsets into a strict UTF-8 byte section, decoded on read.
145
+ */
146
+ export class StringPoolView {
147
+ readonly #offsets: Section
148
+ readonly #bytes: Uint8Array
149
+
150
+ constructor(offsets: Section, bytes: Section) {
151
+ if (offsets.count === 0) throw new RGY1Error("offsets", "a string pool needs at least one offset")
152
+
153
+ let previous = 0
154
+
155
+ for (let index = 0; index < offsets.count; index++) {
156
+ const offset = element(offsets, index)
157
+
158
+ if (offset < previous) throw new RGY1Error("offsets", `string offset ${index} goes backwards`)
159
+
160
+ previous = offset
161
+ }
162
+
163
+ if (previous !== bytes.length)
164
+ throw new RGY1Error("offsets", `string offsets end at ${previous}, bytes are ${bytes.length}`)
165
+
166
+ try {
167
+ decoder.decode(bytes.payload)
168
+ } catch {
169
+ throw new RGY1Error("string-utf8", "the pool is not strict UTF-8")
170
+ }
171
+
172
+ this.#offsets = offsets
173
+ this.#bytes = bytes.payload
174
+ }
175
+
176
+ static of(artifact: Artifact): StringPoolView {
177
+ return new StringPoolView(artifact.require(SectionKind.STRING_OFFSETS), artifact.require(SectionKind.UTF8))
178
+ }
179
+
180
+ get size(): number {
181
+ return this.#offsets.count - 1
182
+ }
183
+
184
+ /**
185
+ * The string at `index`, or `null` outside the pool.
186
+ */
187
+ get(index: number): string | null {
188
+ if (index < 0 || index >= this.size) return null
189
+
190
+ return decoder.decode(this.#bytes.subarray(element(this.#offsets, index), element(this.#offsets, index + 1)))
191
+ }
192
+ }
193
+
194
+ /**
195
+ * A relation from each source key to its target rows.
196
+ */
197
+ export class RelationView {
198
+ readonly #offsets: Section
199
+ readonly #targets: Section
200
+
201
+ constructor(offsets: Section, targets: Section) {
202
+ if (offsets.count === 0) throw new RGY1Error("offsets", "a relation needs at least one offset")
203
+
204
+ let previous = 0
205
+
206
+ for (let index = 0; index < offsets.count; index++) {
207
+ const offset = element(offsets, index)
208
+
209
+ if (offset < previous) throw new RGY1Error("offsets", `relation offset ${index} goes backwards`)
210
+
211
+ previous = offset
212
+ }
213
+
214
+ if (previous !== targets.count)
215
+ throw new RGY1Error("offsets", `relation offsets end at ${previous}, targets are ${targets.count}`)
216
+
217
+ this.#offsets = offsets
218
+ this.#targets = targets
219
+ }
220
+
221
+ static of(artifact: Artifact, index: number): RelationView {
222
+ return new RelationView(
223
+ artifact.require(SectionKind.RELATION_OFFSETS, index),
224
+ artifact.require(SectionKind.RELATION_TARGETS, index)
225
+ )
226
+ }
227
+
228
+ get sources(): number {
229
+ return this.#offsets.count - 1
230
+ }
231
+
232
+ /**
233
+ * The target rows of one source key, as a fresh array.
234
+ */
235
+ targets(source: number): number[] {
236
+ if (source < 0 || source >= this.sources) return []
237
+
238
+ const start = element(this.#offsets, source)
239
+ const end = element(this.#offsets, source + 1)
240
+ const out = new Array<number>(end - start)
241
+
242
+ for (let index = start; index < end; index++) {
243
+ out[index - start] = element(this.#targets, index)
244
+ }
245
+
246
+ return out
247
+ }
248
+
249
+ /**
250
+ * Writes the target rows of one source key into `out` and returns the count written,
251
+ * or `-1` when `out` is too small.
252
+ */
253
+ targetsInto(source: number, out: Uint32Array): number {
254
+ if (source < 0 || source >= this.sources) return 0
255
+
256
+ const start = element(this.#offsets, source)
257
+ const end = element(this.#offsets, source + 1)
258
+
259
+ if (end - start > out.length) return -1
260
+
261
+ for (let index = start; index < end; index++) {
262
+ out[index - start] = element(this.#targets, index)
263
+ }
264
+
265
+ return end - start
266
+ }
267
+ }