@mailwoman/core 8.5.0 → 9.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 (209) hide show
  1. package/README.md +2 -2
  2. package/api/clock.ts +1 -1
  3. package/api/disk-storage.ts +7 -4
  4. package/api/test-clocks.ts +57 -9
  5. package/api/test-transport.ts +182 -0
  6. package/coarse-placer/coarse-placer.ts +2 -1
  7. package/coarse-placer/tools/build-outlier-latin.ts +1 -0
  8. package/coarse-placer/tools/build-outlier-oa.ts +1 -0
  9. package/coarse-placer/tools/eval-latin-offmap.ts +7 -5
  10. package/coarse-placer/tools/eval-openset.ts +19 -10
  11. package/coarse-placer/tools/eval-quant-compare.ts +7 -7
  12. package/coarse-placer/tools/eval.ts +29 -21
  13. package/coarse-placer/tools/probe-frontier.ts +8 -4
  14. package/coarse-placer/tools/quantize.ts +2 -1
  15. package/coarse-placer/tools/train.ts +9 -8
  16. package/collections.ts +2 -128
  17. package/crypto/node.ts +68 -0
  18. package/env/schema.ts +49 -2
  19. package/identifiers.ts +48 -0
  20. package/layers/manifest.ts +2 -1
  21. package/locale/profiles/en-us.ts +2 -3
  22. package/locale/profiles/fr-fr.ts +1 -1
  23. package/locale/profiles/ja-jp.ts +7 -7
  24. package/objects.ts +40 -8
  25. package/out/api/clock.d.ts +1 -1
  26. package/out/api/clock.js +1 -1
  27. package/out/api/disk-storage.d.ts +1 -1
  28. package/out/api/disk-storage.d.ts.map +1 -1
  29. package/out/api/disk-storage.js +5 -5
  30. package/out/api/disk-storage.js.map +1 -1
  31. package/out/api/test-clocks.d.ts +2 -2
  32. package/out/api/test-clocks.d.ts.map +1 -1
  33. package/out/api/test-clocks.js +51 -9
  34. package/out/api/test-clocks.js.map +1 -1
  35. package/out/api/test-transport.d.ts +112 -0
  36. package/out/api/test-transport.d.ts.map +1 -0
  37. package/out/api/test-transport.js +84 -0
  38. package/out/api/test-transport.js.map +1 -0
  39. package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
  40. package/out/coarse-placer/coarse-placer.js +2 -1
  41. package/out/coarse-placer/coarse-placer.js.map +1 -1
  42. package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +1 -1
  43. package/out/coarse-placer/tools/build-outlier-latin.js +1 -0
  44. package/out/coarse-placer/tools/build-outlier-latin.js.map +1 -1
  45. package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +1 -1
  46. package/out/coarse-placer/tools/build-outlier-oa.js +1 -0
  47. package/out/coarse-placer/tools/build-outlier-oa.js.map +1 -1
  48. package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +1 -1
  49. package/out/coarse-placer/tools/eval-latin-offmap.js +4 -5
  50. package/out/coarse-placer/tools/eval-latin-offmap.js.map +1 -1
  51. package/out/coarse-placer/tools/eval-openset.d.ts.map +1 -1
  52. package/out/coarse-placer/tools/eval-openset.js +11 -9
  53. package/out/coarse-placer/tools/eval-openset.js.map +1 -1
  54. package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +1 -1
  55. package/out/coarse-placer/tools/eval-quant-compare.js +6 -7
  56. package/out/coarse-placer/tools/eval-quant-compare.js.map +1 -1
  57. package/out/coarse-placer/tools/eval.d.ts.map +1 -1
  58. package/out/coarse-placer/tools/eval.js +19 -19
  59. package/out/coarse-placer/tools/eval.js.map +1 -1
  60. package/out/coarse-placer/tools/probe-frontier.d.ts.map +1 -1
  61. package/out/coarse-placer/tools/probe-frontier.js +7 -5
  62. package/out/coarse-placer/tools/probe-frontier.js.map +1 -1
  63. package/out/coarse-placer/tools/quantize.d.ts.map +1 -1
  64. package/out/coarse-placer/tools/quantize.js +2 -1
  65. package/out/coarse-placer/tools/quantize.js.map +1 -1
  66. package/out/coarse-placer/tools/train.d.ts.map +1 -1
  67. package/out/coarse-placer/tools/train.js +6 -8
  68. package/out/coarse-placer/tools/train.js.map +1 -1
  69. package/out/collections.d.ts +1 -59
  70. package/out/collections.d.ts.map +1 -1
  71. package/out/collections.js +2 -90
  72. package/out/collections.js.map +1 -1
  73. package/out/crypto/node.d.ts +43 -0
  74. package/out/crypto/node.d.ts.map +1 -0
  75. package/out/crypto/node.js +43 -0
  76. package/out/crypto/node.js.map +1 -0
  77. package/out/env/index.d.ts +5 -0
  78. package/out/env/index.d.ts.map +1 -1
  79. package/out/env/schema.d.ts +6 -1
  80. package/out/env/schema.d.ts.map +1 -1
  81. package/out/env/schema.js +46 -2
  82. package/out/env/schema.js.map +1 -1
  83. package/out/identifiers.d.ts +23 -0
  84. package/out/identifiers.d.ts.map +1 -1
  85. package/out/identifiers.js +39 -0
  86. package/out/identifiers.js.map +1 -1
  87. package/out/layers/manifest.d.ts.map +1 -1
  88. package/out/layers/manifest.js +2 -1
  89. package/out/layers/manifest.js.map +1 -1
  90. package/out/locale/profiles/en-us.d.ts +2 -3
  91. package/out/locale/profiles/en-us.d.ts.map +1 -1
  92. package/out/locale/profiles/en-us.js +2 -3
  93. package/out/locale/profiles/en-us.js.map +1 -1
  94. package/out/locale/profiles/fr-fr.d.ts +1 -1
  95. package/out/locale/profiles/fr-fr.js +1 -1
  96. package/out/locale/profiles/ja-jp.d.ts +7 -7
  97. package/out/locale/profiles/ja-jp.js +7 -7
  98. package/out/objects.d.ts +18 -2
  99. package/out/objects.d.ts.map +1 -1
  100. package/out/objects.js +29 -3
  101. package/out/objects.js.map +1 -1
  102. package/out/pipeline/index.d.ts +2 -2
  103. package/out/pipeline/index.d.ts.map +1 -1
  104. package/out/pipeline/index.js +1 -1
  105. package/out/pipeline/index.js.map +1 -1
  106. package/out/pipeline/runtime-pipeline.d.ts +1 -1
  107. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  108. package/out/pipeline/runtime-pipeline.js +57 -17
  109. package/out/pipeline/runtime-pipeline.js.map +1 -1
  110. package/out/pipeline/span-proposer.d.ts +24 -0
  111. package/out/pipeline/span-proposer.d.ts.map +1 -1
  112. package/out/pipeline/span-proposer.js +36 -1
  113. package/out/pipeline/span-proposer.js.map +1 -1
  114. package/out/pipeline/types.d.ts +40 -1
  115. package/out/pipeline/types.d.ts.map +1 -1
  116. package/out/pipeline/types.js +11 -1
  117. package/out/pipeline/types.js.map +1 -1
  118. package/out/resolver/types.d.ts +41 -0
  119. package/out/resolver/types.d.ts.map +1 -1
  120. package/out/resolver/types.js.map +1 -1
  121. package/out/resources/index.d.ts +0 -1
  122. package/out/resources/index.d.ts.map +1 -1
  123. package/out/resources/index.js +0 -1
  124. package/out/resources/index.js.map +1 -1
  125. package/out/resources/libpostal.d.ts.map +1 -1
  126. package/out/resources/libpostal.js +3 -4
  127. package/out/resources/libpostal.js.map +1 -1
  128. package/out/resources/whosonfirst/index.d.ts +1 -0
  129. package/out/resources/whosonfirst/index.d.ts.map +1 -1
  130. package/out/resources/whosonfirst/index.js +1 -0
  131. package/out/resources/whosonfirst/index.js.map +1 -1
  132. package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
  133. package/out/resources/whosonfirst/placetypes/Placetype.js +5 -4
  134. package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
  135. package/out/resources/whosonfirst/placetypes/admin.d.ts +17 -3
  136. package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
  137. package/out/resources/whosonfirst/placetypes/admin.js +1 -1
  138. package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
  139. package/out/resources/whosonfirst/sharded-repo.d.ts +28 -0
  140. package/out/resources/whosonfirst/sharded-repo.d.ts.map +1 -0
  141. package/out/resources/whosonfirst/sharded-repo.js +58 -0
  142. package/out/resources/whosonfirst/sharded-repo.js.map +1 -0
  143. package/out/tools/download-libpostal-resources.d.ts.map +1 -1
  144. package/out/tools/download-libpostal-resources.js +1 -0
  145. package/out/tools/download-libpostal-resources.js.map +1 -1
  146. package/out/tools/generate-language-types.d.ts.map +1 -1
  147. package/out/tools/generate-language-types.js +5 -11
  148. package/out/tools/generate-language-types.js.map +1 -1
  149. package/out/utils/data-root.d.ts +20 -6
  150. package/out/utils/data-root.d.ts.map +1 -1
  151. package/out/utils/data-root.js +24 -5
  152. package/out/utils/data-root.js.map +1 -1
  153. package/out/utils/hash.d.ts +6 -0
  154. package/out/utils/hash.d.ts.map +1 -1
  155. package/out/utils/hash.js +8 -0
  156. package/out/utils/hash.js.map +1 -1
  157. package/out/utils/index.d.ts +1 -0
  158. package/out/utils/index.d.ts.map +1 -1
  159. package/out/utils/index.js +1 -0
  160. package/out/utils/index.js.map +1 -1
  161. package/out/utils/jsonl.d.ts +17 -3
  162. package/out/utils/jsonl.d.ts.map +1 -1
  163. package/out/utils/jsonl.js +23 -6
  164. package/out/utils/jsonl.js.map +1 -1
  165. package/out/utils/python-json.d.ts +3 -3
  166. package/out/utils/python-json.js +9 -9
  167. package/out/utils/python-numeric.d.ts +33 -0
  168. package/out/utils/python-numeric.d.ts.map +1 -0
  169. package/out/utils/python-numeric.js +149 -0
  170. package/out/utils/python-numeric.js.map +1 -0
  171. package/out/utils/python-random.d.ts +26 -1
  172. package/out/utils/python-random.d.ts.map +1 -1
  173. package/out/utils/python-random.js +43 -7
  174. package/out/utils/python-random.js.map +1 -1
  175. package/out/utils/repo.d.ts.map +1 -1
  176. package/out/utils/repo.js +18 -0
  177. package/out/utils/repo.js.map +1 -1
  178. package/out/utils/sealed-db.d.ts +12 -0
  179. package/out/utils/sealed-db.d.ts.map +1 -1
  180. package/out/utils/sealed-db.js +32 -1
  181. package/out/utils/sealed-db.js.map +1 -1
  182. package/package.json +22 -6
  183. package/pipeline/index.ts +2 -1
  184. package/pipeline/runtime-pipeline.ts +69 -26
  185. package/pipeline/span-proposer.ts +64 -1
  186. package/pipeline/types.ts +43 -1
  187. package/resolver/types.ts +41 -0
  188. package/resources/index.ts +0 -1
  189. package/resources/libpostal.ts +8 -7
  190. package/resources/whosonfirst/index.ts +1 -0
  191. package/resources/whosonfirst/placetypes/Placetype.ts +12 -7
  192. package/resources/whosonfirst/placetypes/admin.ts +17 -2
  193. package/resources/whosonfirst/sharded-repo.ts +69 -0
  194. package/tools/download-libpostal-resources.ts +1 -0
  195. package/tools/generate-language-types.ts +5 -14
  196. package/utils/data-root.ts +27 -6
  197. package/utils/hash.ts +9 -0
  198. package/utils/index.ts +1 -0
  199. package/utils/jsonl.ts +26 -7
  200. package/utils/python-json.ts +10 -10
  201. package/utils/python-numeric.ts +168 -0
  202. package/utils/python-random.ts +49 -8
  203. package/utils/repo.ts +18 -0
  204. package/utils/sealed-db.ts +38 -1
  205. package/out/resources/collections.d.ts +0 -22
  206. package/out/resources/collections.d.ts.map +0 -1
  207. package/out/resources/collections.js +0 -69
  208. package/out/resources/collections.js.map +0 -1
  209. package/resources/collections.ts +0 -96
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Reading a place out of a cloned Who's On First data repo.
7
+ *
8
+ * WOF stores each record at a path derived from its own id: the decimal id split into three-character directories,
9
+ * then `<id>.geojson`. `85977539` lives at `859/775/39/85977539.geojson`. The rule is not written down in the data —
10
+ * it is layout knowledge every reader has to carry — so it lives here once, next to the {@link WOFFeature} type the
11
+ * parsed record has.
12
+ */
13
+ import type { WOFFeature } from "./placetypes/admin.ts";
14
+ /**
15
+ * A WOF id → its repo-relative path segments, ending in `<id>.geojson`.
16
+ *
17
+ * Segments rather than a joined string so a caller can append them to whatever root it already holds — the repos layout
18
+ * puts a `data` directory under each `whosonfirst-data-*` clone, and callers reach it differently.
19
+ */
20
+ export declare function wofIDPathSegments(id: number): string[];
21
+ /**
22
+ * Read a place's GeoJSON from the first `root` that holds it, or `null` when no root does or the file will not parse.
23
+ *
24
+ * `null` conflates "absent" with "unparseable" on purpose: every caller so far treats both as "no evidence for this
25
+ * place" and continues. A caller that needs to tell them apart should read the file itself.
26
+ */
27
+ export declare function readWOFFeature(id: number, roots: readonly string[]): WOFFeature | null;
28
+ //# sourceMappingURL=sharded-repo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharded-repo.d.ts","sourceRoot":"","sources":["../../../resources/whosonfirst/sharded-repo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAQvD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAWtD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,GAAG,IAAI,CAiBtF"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Reading a place out of a cloned Who's On First data repo.
7
+ *
8
+ * WOF stores each record at a path derived from its own id: the decimal id split into three-character directories,
9
+ * then `<id>.geojson`. `85977539` lives at `859/775/39/85977539.geojson`. The rule is not written down in the data —
10
+ * it is layout knowledge every reader has to carry — so it lives here once, next to the {@link WOFFeature} type the
11
+ * parsed record has.
12
+ */
13
+ import { existsSync, readFileSync } from "node:fs";
14
+ import { resolvePath } from "path-ts";
15
+ import { tryParsingJSON } from "../../objects.js";
16
+ /**
17
+ * Characters per directory level. A trailing group shorter than this is its own directory — `85977539` ends in `39`,
18
+ * not `390`.
19
+ */
20
+ const ID_CHUNK = 3;
21
+ /**
22
+ * A WOF id → its repo-relative path segments, ending in `<id>.geojson`.
23
+ *
24
+ * Segments rather than a joined string so a caller can append them to whatever root it already holds — the repos layout
25
+ * puts a `data` directory under each `whosonfirst-data-*` clone, and callers reach it differently.
26
+ */
27
+ export function wofIDPathSegments(id) {
28
+ const digits = String(id);
29
+ const segments = [];
30
+ for (let i = 0; i < digits.length; i += ID_CHUNK) {
31
+ segments.push(digits.slice(i, i + ID_CHUNK));
32
+ }
33
+ segments.push(`${digits}.geojson`);
34
+ return segments;
35
+ }
36
+ /**
37
+ * Read a place's GeoJSON from the first `root` that holds it, or `null` when no root does or the file will not parse.
38
+ *
39
+ * `null` conflates "absent" with "unparseable" on purpose: every caller so far treats both as "no evidence for this
40
+ * place" and continues. A caller that needs to tell them apart should read the file itself.
41
+ */
42
+ export function readWOFFeature(id, roots) {
43
+ const segments = wofIDPathSegments(id);
44
+ for (const root of roots) {
45
+ const path = resolvePath(root, ...segments);
46
+ if (!existsSync(path))
47
+ continue;
48
+ try {
49
+ return tryParsingJSON(readFileSync(path, "utf8"));
50
+ }
51
+ catch {
52
+ // The file vanished or turned unreadable between existsSync and the read — same "no evidence" verdict.
53
+ return null;
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+ //# sourceMappingURL=sharded-repo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharded-repo.js","sourceRoot":"","sources":["../../../resources/whosonfirst/sharded-repo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD;;;GAGG;AACH,MAAM,QAAQ,GAAG,CAAC,CAAA;AAElB;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAU;IAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;IACzB,MAAM,QAAQ,GAAa,EAAE,CAAA;IAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC;QAClD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAA;IAC7C,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,UAAU,CAAC,CAAA;IAElC,OAAO,QAAQ,CAAA;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU,EAAE,KAAwB;IAClE,MAAM,QAAQ,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAA;IAEtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAA;QAE3C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,SAAQ;QAE/B,IAAI,CAAC;YACJ,OAAO,cAAc,CAAa,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;QAC9D,CAAC;QAAC,MAAM,CAAC;YACR,uGAAuG;YACvG,OAAO,IAAI,CAAA;QACZ,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"download-libpostal-resources.d.ts","sourceRoot":"","sources":["../../tools/download-libpostal-resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AA8BH;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC/C,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,EACjC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,IAAI,CAAC,CAoCf"}
1
+ {"version":3,"file":"download-libpostal-resources.d.ts","sourceRoot":"","sources":["../../tools/download-libpostal-resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AA+BH;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC/C,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,EACjC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,IAAI,CAAC,CAoCf"}
@@ -37,6 +37,7 @@ const DICTIONARIES_DIR = resourceDictionaryPath("libpostal");
37
37
  async function sortFileInPlace(path) {
38
38
  const text = await readFile(path, "utf8");
39
39
  const hadTrailingNewline = text.endsWith("\n");
40
+ // oxlint-disable-next-line mailwoman/prefer-spliterator -- Sorting needs every line resident; the largest libpostal dictionary is 409 KB.
40
41
  const lines = text.split("\n");
41
42
  // Drop the empty element produced by a trailing newline so it isn't re-sorted as a blank line.
42
43
  if (hadTrailingNewline) {
@@ -1 +1 @@
1
- {"version":3,"file":"download-libpostal-resources.js","sourceRoot":"","sources":["../../tools/download-libpostal-resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAE9D,MAAM,QAAQ,GAAG,6CAA6C,CAAA;AAC9D,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAA;AAE5D;;;GAGG;AACH,KAAK,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACzC,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAE9B,+FAA+F;IAC/F,IAAI,kBAAkB,EAAE,CAAC;QACxB,KAAK,CAAC,GAAG,EAAE,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,IAAI,EAAE,CAAA;IACZ,MAAM,SAAS,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AAI,CAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;QAE/D,6DAA6D;QAC7D,KAAK,MAAM,KAAK,IAAI,MAAM,OAAO,CAAC,WAAW,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YACzE,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBACpB,MAAM,eAAe,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;YACrD,CAAC;QACF,CAAC;QAED,yEAAyE;QACzE,MAAM,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC7D,CAAC;YAAS,CAAC;QACV,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-language-types.d.ts","sourceRoot":"","sources":["../../tools/generate-language-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAC1C,OAAO,GAAE,4BAAiC,EAC1C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,4BAA4B,CAAC,CA+JvC"}
1
+ {"version":3,"file":"generate-language-types.d.ts","sourceRoot":"","sources":["../../tools/generate-language-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAC1C,OAAO,GAAE,4BAAiC,EAC1C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,4BAA4B,CAAC,CAsJvC"}
@@ -8,9 +8,9 @@
8
8
  *
9
9
  * Usage: mailwoman dev generate language-types
10
10
  */
11
- import { createReadStream } from "node:fs";
12
11
  import * as fs from "node:fs/promises";
13
12
  import { pascalCase } from "change-case";
13
+ import { CSVSpliterator } from "spliterator";
14
14
  import { repoRootPath, resourceDictionaryPath } from "../utils/index.js";
15
15
  /**
16
16
  * Regenerate the committed language-code types from `internal/languages.csv`.
@@ -22,16 +22,10 @@ export async function generateLanguageTypes(options = {}, report) {
22
22
  const alpha3bEntries = new Map();
23
23
  const entryLines = [];
24
24
  report?.(`Reading ${dataSourcePath}`);
25
- // csv-parse is an optional peer — lazy import (the pipeline convention).
26
- const csv = await import("csv-parse");
27
- const parser = csv.parse({
28
- delimiter: ",",
29
- columns: false,
30
- skip_empty_lines: true,
31
- from_line: 2,
32
- });
33
- const stream = createReadStream(dataSourcePath).pipe(parser);
34
- for await (const columns of stream) {
25
+ // Quote handling is on and load-bearing: six labels wrap an embedded comma
26
+ // (`gre,el,"Greek, Modern (1453-)"`), and the spliterator leaves quoting off by default.
27
+ // `header` defaults true, which is what skips the `alpha3-b,alpha2,English` line.
28
+ for await (const columns of CSVSpliterator.fromAsync(dataSourcePath, { enableQuoteHandling: true })) {
35
29
  const alpha3b = columns[0];
36
30
  const alpha2 = columns[1];
37
31
  const labelsConcatenated = columns[2];
@@ -1 +1 @@
1
- {"version":3,"file":"generate-language-types.js","sourceRoot":"","sources":["../../tools/generate-language-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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@@ -21,11 +21,25 @@ export declare function mailwomanDataRoot(): string;
21
21
  export declare function dataRootPath(...segments: string[]): string;
22
22
  /**
23
23
  * The default WOF shard list the FTS backend probes when no single `--wof-db` is given: the global admin-priority shard
24
- * + the US postcode shard + the GeoNames-postal tail shard (#920 — postcode coverage for the namesake-tail locales
25
- * FI/CZ/SK/SI/DK/NO/HR/PL; country-aware routing in `pickShardForPlacetype` sends each postcode query to the shard that
26
- * claims its country). All under `dataRoot` (defaults to the configured {@link mailwomanDataRoot}; callers thread a
27
- * `--data-root` option through). A fresh array each call; callers filter with `existsSync`, so a deployment without the
28
- * tail shard degrades to the pre-#920 pair.
24
+ * plus the postcode shards, with country-aware routing in `pickShardForPlacetype` sending each postcode query to the
25
+ * shard that claims its country (#920). All under `dataRoot` (defaults to the configured {@link mailwomanDataRoot};
26
+ * callers thread a `--data-root` option through). A fresh array each call; callers filter with `existsSync`, so a
27
+ * deployment missing any of them degrades to whatever is present.
28
+ *
29
+ * This list is DELIBERATELY SMALLER than `DEFAULT_POSTCODE_SHARDS` (`mailwoman/gazetteer-pipeline/index.ts`), which is
30
+ * the set the candidate gazetteer is BUILT from — twenty-odd shards including the 876 MB Code-Point Open GB one. These
31
+ * are attached live per query, so the cost of a member is paid at every boot rather than once at build time; membership
32
+ * here is earned by a shard the runtime cannot resolve its locales without.
33
+ *
34
+ * Two notes on specific members, because both look like mistakes and are not:
35
+ *
36
+ * - The tail shard's own contents moved on 2026-08-05. It carried GB (1,839,678 of 1,895,753 rows, ~946 MB) until
37
+ * Code-Point Open replaced those rows under a clean licence; it is now the nine-country namesake set
38
+ * FI/CZ/SK/SI/DK/NO/HR/PL/SE at 26 MB. Rebuild: `mailwoman gazetteer build postcode-geonames`.
39
+ * - `postalcode-ni-osm.db` is **build-local**: OSM `addr:postcode` under ODbL, never published, so on any machine that
40
+ * did not build it the `existsSync` filter simply drops it and GB postcode queries behave as they did before. It is
41
+ * listed rather than special-cased because that filter IS the tier's enforcement. It is also the only GB-claiming
42
+ * shard in this list — the Code-Point Open shard is not here — so nothing competes with it for `BT` routing.
29
43
  */
30
- export declare function wofShardPaths(dataRoot?: string): [string, string, string, string, string];
44
+ export declare function wofShardPaths(dataRoot?: string): [string, string, string, string, string, string];
31
45
  //# sourceMappingURL=data-root.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-root.d.ts","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,GAAE,MAA4B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAW9G"}
1
+ {"version":3,"file":"data-root.d.ts","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,GAAE,MAA4B,GACpC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAgBlD"}
@@ -32,11 +32,25 @@ export function dataRootPath(...segments) {
32
32
  }
33
33
  /**
34
34
  * The default WOF shard list the FTS backend probes when no single `--wof-db` is given: the global admin-priority shard
35
- * + the US postcode shard + the GeoNames-postal tail shard (#920 — postcode coverage for the namesake-tail locales
36
- * FI/CZ/SK/SI/DK/NO/HR/PL; country-aware routing in `pickShardForPlacetype` sends each postcode query to the shard that
37
- * claims its country). All under `dataRoot` (defaults to the configured {@link mailwomanDataRoot}; callers thread a
38
- * `--data-root` option through). A fresh array each call; callers filter with `existsSync`, so a deployment without the
39
- * tail shard degrades to the pre-#920 pair.
35
+ * plus the postcode shards, with country-aware routing in `pickShardForPlacetype` sending each postcode query to the
36
+ * shard that claims its country (#920). All under `dataRoot` (defaults to the configured {@link mailwomanDataRoot};
37
+ * callers thread a `--data-root` option through). A fresh array each call; callers filter with `existsSync`, so a
38
+ * deployment missing any of them degrades to whatever is present.
39
+ *
40
+ * This list is DELIBERATELY SMALLER than `DEFAULT_POSTCODE_SHARDS` (`mailwoman/gazetteer-pipeline/index.ts`), which is
41
+ * the set the candidate gazetteer is BUILT from — twenty-odd shards including the 876 MB Code-Point Open GB one. These
42
+ * are attached live per query, so the cost of a member is paid at every boot rather than once at build time; membership
43
+ * here is earned by a shard the runtime cannot resolve its locales without.
44
+ *
45
+ * Two notes on specific members, because both look like mistakes and are not:
46
+ *
47
+ * - The tail shard's own contents moved on 2026-08-05. It carried GB (1,839,678 of 1,895,753 rows, ~946 MB) until
48
+ * Code-Point Open replaced those rows under a clean licence; it is now the nine-country namesake set
49
+ * FI/CZ/SK/SI/DK/NO/HR/PL/SE at 26 MB. Rebuild: `mailwoman gazetteer build postcode-geonames`.
50
+ * - `postalcode-ni-osm.db` is **build-local**: OSM `addr:postcode` under ODbL, never published, so on any machine that
51
+ * did not build it the `existsSync` filter simply drops it and GB postcode queries behave as they did before. It is
52
+ * listed rather than special-cased because that filter IS the tier's enforcement. It is also the only GB-claiming
53
+ * shard in this list — the Code-Point Open shard is not here — so nothing competes with it for `BT` routing.
40
54
  */
41
55
  export function wofShardPaths(dataRoot = mailwomanDataRoot()) {
42
56
  // TODO: Redo this as an object.
@@ -48,6 +62,11 @@ export function wofShardPaths(dataRoot = mailwomanDataRoot()) {
48
62
  // #977: the NL PC6 full-postcode shard (CBS via PDOK; scripts/build-postalcode-nl-pc6.ts) — the
49
63
  // data the lookup's NL PC6 ladder ("1012 LG" → joined "1012LG" → 4-digit stem) resolves against.
50
64
  resolvePath(dataRoot, "wof", "postalcode-nl-pc6.db"),
65
+ // Northern Ireland (BT) from OpenStreetMap — 4,757 of 50,032 live NI postcodes (9.5 %), the only
66
+ // coverage that exists for the hole Code-Point Open leaves. ODbL, build-local, 2.5 MB. A miss on a
67
+ // BT code means NOT ATTESTED IN OSM; since #1480 an unknown postcode abstains, so the shard is
68
+ // strictly additive. Rebuild: `mailwoman gazetteer build postcode-ni-osm`.
69
+ resolvePath(dataRoot, "wof", "postalcode-ni-osm.db"),
51
70
  ];
52
71
  }
53
72
  //# sourceMappingURL=data-root.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-root.js","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC;;;GAGG;AACH,MAAM,2BAA2B,GAAG,6BAA6B,CAAA;AAEjE;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAChC,OAAO,OAAO,CAAC,mBAAmB,IAAI,2BAA2B,CAAA;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAG,QAAkB;IACjD,OAAO,WAAW,CAAC,iBAAiB,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAA;AACrD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmB,iBAAiB,EAAE;IACnE,gCAAgC;IAChC,OAAO;QACN,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,0BAA0B,CAAC;QACxD,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC;QAChD,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,6BAA6B,CAAC;QAC3D,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,CAAC;QAClD,gGAAgG;QAChG,iGAAiG;QACjG,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,CAAC;KACpD,CAAA;AACF,CAAC"}
1
+ {"version":3,"file":"data-root.js","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC;;;GAGG;AACH,MAAM,2BAA2B,GAAG,6BAA6B,CAAA;AAEjE;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAChC,OAAO,OAAO,CAAC,mBAAmB,IAAI,2BAA2B,CAAA;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAG,QAAkB;IACjD,OAAO,WAAW,CAAC,iBAAiB,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAA;AACrD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,aAAa,CAC5B,WAAmB,iBAAiB,EAAE;IAEtC,gCAAgC;IAChC,OAAO;QACN,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,0BAA0B,CAAC;QACxD,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC;QAChD,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,6BAA6B,CAAC;QAC3D,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,CAAC;QAClD,gGAAgG;QAChG,iGAAiG;QACjG,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,CAAC;QACpD,iGAAiG;QACjG,mGAAmG;QACnG,+FAA+F;QAC/F,2EAA2E;QAC3E,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,CAAC;KACpD,CAAA;AACF,CAAC"}
@@ -22,4 +22,10 @@ export declare function sha256Hex(data: string | NodeJS.ArrayBufferView): string
22
22
  * used for accidental-corruption / drift detection.
23
23
  */
24
24
  export declare function md5File(path: string): Promise<string>;
25
+ /**
26
+ * MD5 of in-memory content, hex-encoded — the {@link md5File} counterpart for a string that never becomes a file. Same
27
+ * provenance-only rationale, and the same non-security caveat: it exists so a query text, a manifest line or a config
28
+ * blob can be fingerprinted with the SAME algorithm as the files recorded beside it in one `meta` table.
29
+ */
30
+ export declare function md5Hex(data: string | NodeJS.ArrayBufferView): string;
25
31
  //# sourceMappingURL=hash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../utils/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ9D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAEvE;AAED;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ3D"}
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../utils/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ9D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAEvE;AAED;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ3D;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAEpE"}
package/out/utils/hash.js CHANGED
@@ -38,4 +38,12 @@ export async function md5File(path) {
38
38
  }
39
39
  return hash.digest("hex");
40
40
  }
41
+ /**
42
+ * MD5 of in-memory content, hex-encoded — the {@link md5File} counterpart for a string that never becomes a file. Same
43
+ * provenance-only rationale, and the same non-security caveat: it exists so a query text, a manifest line or a config
44
+ * blob can be fingerprinted with the SAME algorithm as the files recorded beside it in one `meta` table.
45
+ */
46
+ export function md5Hex(data) {
47
+ return createHash("md5").update(data).digest("hex");
48
+ }
41
49
  //# sourceMappingURL=hash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hash.js","sourceRoot":"","sources":["../../utils/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC5C,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAA;IAEjC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,KAAe,CAAC,CAAA;IAC7B,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAqC;IAC9D,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAY;IACzC,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IAE9B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,MA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AAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACpD,CAAC"}
@@ -7,6 +7,7 @@ export * from "./data-root.ts";
7
7
  export * from "./hash.ts";
8
8
  export * from "./jsonl.ts";
9
9
  export * from "./python-json.ts";
10
+ export * from "./python-numeric.ts";
10
11
  export * from "./python-random.ts";
11
12
  export * from "./repo.ts";
12
13
  export * from "./sealed-db.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
@@ -7,6 +7,7 @@ export * from "./data-root.js";
7
7
  export * from "./hash.js";
8
8
  export * from "./jsonl.js";
9
9
  export * from "./python-json.js";
10
+ export * from "./python-numeric.js";
10
11
  export * from "./python-random.js";
11
12
  export * from "./repo.js";
12
13
  export * from "./sealed-db.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
@@ -3,20 +3,34 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * JSON Lines helpers — the canonical home for the `split("\n") + JSON.parse` idiom that was
7
- * re-rolled across ~88 scripts (2026-07-09 dedupe survey). `iterateJSONL` streams via spliterator
8
- * for files too large to slurp.
6
+ * JSON Lines helpers, all three DEPRECATED — `spliterator` covers the whole surface, and a thin
7
+ * wrapper in front of it only hides which half you are getting.
8
+ *
9
+ * - `readJSONL` → `Array.fromAsync(JSONSpliterator.fromAsync<T>(path))`
10
+ * - `iterateJSONL` → `JSONSpliterator.fromAsync<T>(path)`
11
+ * - `writeJSONL` → `createNewlineWriter(path)`
12
+ *
13
+ * Kept exported because `@mailwoman/core` is published; they go in the next major.
9
14
  */
10
15
  /**
11
16
  * Read an entire JSONL file into memory. Blank and whitespace-only lines are skipped.
17
+ *
18
+ * @deprecated Use `Array.fromAsync(JSONSpliterator.fromAsync<T>(path))` from `spliterator`. This buffers the whole file
19
+ * as one string, which throws `ERR_STRING_TOO_LONG` past V8's 512 MiB cap.
12
20
  */
13
21
  export declare function readJSONL<T>(path: string): T[];
14
22
  /**
15
23
  * Write rows as JSONL (one `JSON.stringify` per line, trailing newline). Returns the row count.
24
+ *
25
+ * @deprecated Use `createNewlineWriter(path)` from `spliterator`. This concatenates every row into one string before it
26
+ * writes anything, so the output is capped the same way the input is.
16
27
  */
17
28
  export declare function writeJSONL(path: string, rows: Iterable<unknown>): number;
18
29
  /**
19
30
  * Stream a JSONL file row-by-row without loading it whole. Blank lines are skipped.
31
+ *
32
+ * @deprecated Use `JSONSpliterator.fromAsync<T>(path)` from `spliterator` — this is a decode-then-parse wrapper around
33
+ * exactly that.
20
34
  */
21
35
  export declare function iterateJSONL<T>(path: string): AsyncIterable<T>;
22
36
  //# sourceMappingURL=jsonl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../utils/jsonl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,CAK9C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,MAAM,CAaxE;AAED;;GAEG;AACH,wBAAuB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAKrE"}
1
+ {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../utils/jsonl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,CAS9C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,MAAM,CAaxE;AAED;;;;;GAKG;AACH,wBAAuB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAMrE"}
@@ -3,23 +3,36 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * JSON Lines helpers — the canonical home for the `split("\n") + JSON.parse` idiom that was
7
- * re-rolled across ~88 scripts (2026-07-09 dedupe survey). `iterateJSONL` streams via spliterator
8
- * for files too large to slurp.
6
+ * JSON Lines helpers, all three DEPRECATED — `spliterator` covers the whole surface, and a thin
7
+ * wrapper in front of it only hides which half you are getting.
8
+ *
9
+ * - `readJSONL` → `Array.fromAsync(JSONSpliterator.fromAsync<T>(path))`
10
+ * - `iterateJSONL` → `JSONSpliterator.fromAsync<T>(path)`
11
+ * - `writeJSONL` → `createNewlineWriter(path)`
12
+ *
13
+ * Kept exported because `@mailwoman/core` is published; they go in the next major.
9
14
  */
10
15
  import { readFileSync, writeFileSync } from "node:fs";
11
16
  import { TextSpliterator } from "spliterator";
12
17
  /**
13
18
  * Read an entire JSONL file into memory. Blank and whitespace-only lines are skipped.
19
+ *
20
+ * @deprecated Use `Array.fromAsync(JSONSpliterator.fromAsync<T>(path))` from `spliterator`. This buffers the whole file
21
+ * as one string, which throws `ERR_STRING_TOO_LONG` past V8's 512 MiB cap.
14
22
  */
15
23
  export function readJSONL(path) {
16
- return readFileSync(path, "utf8")
17
- .split("\n")
24
+ // The whole-buffer read and the throw-on-corrupt parse are both part of the shipped contract this
25
+ // function is deprecated FOR; rewriting either would change what remaining callers get.
26
+ return ([...TextSpliterator.from(readFileSync(path, "utf8"))]
18
27
  .filter((line) => line.trim().length > 0)
19
- .map((line) => JSON.parse(line));
28
+ // oxlint-disable-next-line no-restricted-properties
29
+ .map((line) => JSON.parse(line)));
20
30
  }
21
31
  /**
22
32
  * Write rows as JSONL (one `JSON.stringify` per line, trailing newline). Returns the row count.
33
+ *
34
+ * @deprecated Use `createNewlineWriter(path)` from `spliterator`. This concatenates every row into one string before it
35
+ * writes anything, so the output is capped the same way the input is.
23
36
  */
24
37
  export function writeJSONL(path, rows) {
25
38
  let count = 0;
@@ -33,11 +46,15 @@ export function writeJSONL(path, rows) {
33
46
  }
34
47
  /**
35
48
  * Stream a JSONL file row-by-row without loading it whole. Blank lines are skipped.
49
+ *
50
+ * @deprecated Use `JSONSpliterator.fromAsync<T>(path)` from `spliterator` — this is a decode-then-parse wrapper around
51
+ * exactly that.
36
52
  */
37
53
  export async function* iterateJSONL(path) {
38
54
  for await (const line of TextSpliterator.fromAsync(path)) {
39
55
  if (!line.trim())
40
56
  continue;
57
+ // oxlint-disable-next-line no-restricted-properties -- Throw-on-corrupt is this function's shipped contract.
41
58
  yield JSON.parse(line);
42
59
  }
43
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl.js","sourceRoot":"","sources":["../../utils/jsonl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;GAEG;AACH,MAAM,UAAU,SAAS,CAAI,IAAY;IACxC,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC;SAC/B,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;SACxC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC,CAAA;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,IAAuB;IAC/D,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,GAAG,GAAG,EAAE,CAAA;IAEZ,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;QAEjC,KAAK,EAAE,CAAA;IACR,CAAC;IAED,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,C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AE,CAAA;IACR,CAAC;IAED,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IAEhC,OAAO,KAAK,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,YAAY,CAAI,IAAY;IAClD,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,SAAQ;QAC1B,6GAA6G;QAC7G,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAA;IAC5B,CAAC;AACF,CAAC"}
@@ -13,11 +13,11 @@
13
13
  * `JSON.stringify` is compact (`","` / `":"`). The committed files are spaced, so we match.
14
14
  * 2. **`ensure_ascii`.** Python defaults to escaping every non-ASCII codepoint as `\uXXXX` (surrogate
15
15
  * pairs for astral chars). `JSON.stringify` emits raw UTF-8. We replicate Python's default
16
- * (`ensureAscii: true`) and allow `ensure_ascii=False` (`ensureAscii: false`).
16
+ * (`ensureASCII: true`) and allow `ensure_ascii=False` (`ensureASCII: false`).
17
17
  *
18
18
  * String escaping of ASCII (quote, backslash, `\n`/`\t`/`\r`/`\b`/`\f`, other control -> `\u00xx`)
19
19
  * is identical between `JSON.stringify` and Python's json, so we delegate per-string base
20
- * escaping to `JSON.stringify` and only post-escape the non-ASCII range when `ensureAscii` is
20
+ * escaping to `JSON.stringify` and only post-escape the non-ASCII range when `ensureASCII` is
21
21
  * on.
22
22
  *
23
23
  * Caveat: JS has a single number type, so a whole-valued float (e.g. an exact `5.0` coordinate)
@@ -28,7 +28,7 @@ export interface PyJSONOptions {
28
28
  /**
29
29
  * Escape non-ASCII as `\uXXXX` (Python `ensure_ascii`). Defaults to `true`, matching Python.
30
30
  */
31
- ensureAscii?: boolean;
31
+ ensureASCII?: boolean;
32
32
  }
33
33
  /**
34
34
  * `json.dumps(value)` — single line, `(", ", ": ")` separators, `ensure_ascii` per options.
@@ -13,11 +13,11 @@
13
13
  * `JSON.stringify` is compact (`","` / `":"`). The committed files are spaced, so we match.
14
14
  * 2. **`ensure_ascii`.** Python defaults to escaping every non-ASCII codepoint as `\uXXXX` (surrogate
15
15
  * pairs for astral chars). `JSON.stringify` emits raw UTF-8. We replicate Python's default
16
- * (`ensureAscii: true`) and allow `ensure_ascii=False` (`ensureAscii: false`).
16
+ * (`ensureASCII: true`) and allow `ensure_ascii=False` (`ensureASCII: false`).
17
17
  *
18
18
  * String escaping of ASCII (quote, backslash, `\n`/`\t`/`\r`/`\b`/`\f`, other control -> `\u00xx`)
19
19
  * is identical between `JSON.stringify` and Python's json, so we delegate per-string base
20
- * escaping to `JSON.stringify` and only post-escape the non-ASCII range when `ensureAscii` is
20
+ * escaping to `JSON.stringify` and only post-escape the non-ASCII range when `ensureASCII` is
21
21
  * on.
22
22
  *
23
23
  * Caveat: JS has a single number type, so a whole-valued float (e.g. an exact `5.0` coordinate)
@@ -27,10 +27,10 @@
27
27
  /**
28
28
  * Serialize one string the way Python's json does (then optionally `ensure_ascii`-escape it).
29
29
  */
30
- function serializeString(value, ensureAscii) {
30
+ function serializeString(value, ensureASCII) {
31
31
  // JSON.stringify handles the quote/backslash/control escaping identically to Python's json.
32
32
  const out = JSON.stringify(value);
33
- if (!ensureAscii)
33
+ if (!ensureASCII)
34
34
  return out;
35
35
  // ensure_ascii: escape every code unit >= 0x80 as \uXXXX (surrogate halves handled per-unit,
36
36
  // exactly as CPython emits astral codepoints as a \u-pair).
@@ -52,7 +52,7 @@ function serializeNumber(value) {
52
52
  return "NaN";
53
53
  return value > 0 ? "Infinity" : "-Infinity";
54
54
  }
55
- function serialize(value, ensureAscii) {
55
+ function serialize(value, ensureASCII) {
56
56
  if (value === null || value === undefined)
57
57
  return "null";
58
58
  const t = typeof value;
@@ -61,16 +61,16 @@ function serialize(value, ensureAscii) {
61
61
  if (t === "number")
62
62
  return serializeNumber(value);
63
63
  if (t === "string")
64
- return serializeString(value, ensureAscii);
64
+ return serializeString(value, ensureASCII);
65
65
  if (Array.isArray(value)) {
66
- return "[" + value.map((v) => serialize(v, ensureAscii)).join(", ") + "]";
66
+ return "[" + value.map((v) => serialize(v, ensureASCII)).join(", ") + "]";
67
67
  }
68
68
  if (t === "object") {
69
69
  const parts = [];
70
70
  for (const [k, v] of Object.entries(value)) {
71
71
  if (v === undefined)
72
72
  continue; // a key Python would never have produced
73
- parts.push(serializeString(k, ensureAscii) + ": " + serialize(v, ensureAscii));
73
+ parts.push(serializeString(k, ensureASCII) + ": " + serialize(v, ensureASCII));
74
74
  }
75
75
  return "{" + parts.join(", ") + "}";
76
76
  }
@@ -80,7 +80,7 @@ function serialize(value, ensureAscii) {
80
80
  * `json.dumps(value)` — single line, `(", ", ": ")` separators, `ensure_ascii` per options.
81
81
  */
82
82
  export function pyJSONDumps(value, options = {}) {
83
- return serialize(value, options.ensureAscii ?? true);
83
+ return serialize(value, options.ensureASCII ?? true);
84
84
  }
85
85
  /**
86
86
  * Render a string->number map the way Python prints `dict(...)` / `dict(Counter(...))` — single-quoted keys, `, ` / `:
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Python-parity numeric helpers — the third member of the `python-*` family in this directory,
7
+ * beside `python-json.ts` (CPython `json.dumps` spacing) and `python-random.ts` (`random.Random`).
8
+ *
9
+ * These exist because the gazetteer pipeline was ported from Python and its outputs have to match
10
+ * the originals bit for bit: a postcode centroid that rounds differently is a different centroid,
11
+ * and the shard it lands in is a different shard. Divergence here never throws — it surfaces as a
12
+ * shard that quietly disagrees with the reference.
13
+ */
14
+ /**
15
+ * Increment a non-negative decimal-digit string, propagating the carry (e.g. "999" → "1000").
16
+ */
17
+ export declare function incDecimalString(s: string): string;
18
+ /**
19
+ * Python `round()` — correctly-rounded, round-half-to-EVEN. Works off the double's EXACT (terminating) decimal
20
+ * expansion via `toFixed(80)`, so it matches Python both on ordinary values (where a naïve `x * 10**nd` would diverge
21
+ * by a ULP) and on exact half-way ties like `40.890625` → `40.89062` (where `toFixed(nd)` rounds half-UP and would
22
+ * diverge). `nd === 0` keeps a fast half-even path on the double.
23
+ */
24
+ export declare function pyRound(x: number, nd?: number): number;
25
+ /**
26
+ * Python `float()`: trimmed-empty / non-numeric → null (the build's try/except skip).
27
+ */
28
+ export declare function pyFloat(s: string | undefined): number | null;
29
+ /**
30
+ * Python `format(x, ".{d}f")` — round-half-to-even (banker's), unlike JS `toFixed` (half-away).
31
+ */
32
+ export declare function pyFixed(x: number, d: number): string;
33
+ //# sourceMappingURL=python-numeric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-numeric.d.ts","sourceRoot":"","sources":["../../utils/python-numeric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAmBlD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,SAAI,GAAG,MAAM,CA6CjD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAQ5D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAsDpD"}