@mailwoman/core 5.6.0 → 5.8.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 (146) hide show
  1. package/data/chromium-i18n/ssl-address-download.ts +7 -11
  2. package/data/libpostal/resources-download.ts +9 -12
  3. package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
  4. package/out/coarse-placer/coarse-placer.js +12 -7
  5. package/out/coarse-placer/coarse-placer.js.map +1 -1
  6. package/out/coarse-placer/tools/build-dataset.d.ts +21 -0
  7. package/out/coarse-placer/tools/build-dataset.d.ts.map +1 -0
  8. package/out/coarse-placer/tools/build-dataset.js +171 -0
  9. package/out/coarse-placer/tools/build-dataset.js.map +1 -0
  10. package/out/coarse-placer/tools/build-outlier-exposure.d.ts +19 -0
  11. package/out/coarse-placer/tools/build-outlier-exposure.d.ts.map +1 -0
  12. package/out/coarse-placer/tools/build-outlier-exposure.js +144 -0
  13. package/out/coarse-placer/tools/build-outlier-exposure.js.map +1 -0
  14. package/out/coarse-placer/tools/build-outlier-latin.d.ts +2 -0
  15. package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +1 -0
  16. package/out/coarse-placer/tools/build-outlier-latin.js +155 -0
  17. package/out/coarse-placer/tools/build-outlier-latin.js.map +1 -0
  18. package/out/coarse-placer/tools/build-outlier-oa.d.ts +2 -0
  19. package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +1 -0
  20. package/out/coarse-placer/tools/build-outlier-oa.js +182 -0
  21. package/out/coarse-placer/tools/build-outlier-oa.js.map +1 -0
  22. package/out/coarse-placer/tools/eval-latin-offmap.d.ts +2 -0
  23. package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +1 -0
  24. package/out/coarse-placer/tools/eval-latin-offmap.js +103 -0
  25. package/out/coarse-placer/tools/eval-latin-offmap.js.map +1 -0
  26. package/out/coarse-placer/tools/eval-openset.d.ts +34 -0
  27. package/out/coarse-placer/tools/eval-openset.d.ts.map +1 -0
  28. package/out/coarse-placer/tools/eval-openset.js +394 -0
  29. package/out/coarse-placer/tools/eval-openset.js.map +1 -0
  30. package/out/coarse-placer/tools/eval-quant-compare.d.ts +2 -0
  31. package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +1 -0
  32. package/out/coarse-placer/tools/eval-quant-compare.js +107 -0
  33. package/out/coarse-placer/tools/eval-quant-compare.js.map +1 -0
  34. package/out/coarse-placer/tools/eval.d.ts +14 -0
  35. package/out/coarse-placer/tools/eval.d.ts.map +1 -0
  36. package/out/coarse-placer/tools/eval.js +131 -0
  37. package/out/coarse-placer/tools/eval.js.map +1 -0
  38. package/out/coarse-placer/tools/probe-frontier.d.ts +23 -0
  39. package/out/coarse-placer/tools/probe-frontier.d.ts.map +1 -0
  40. package/out/coarse-placer/tools/probe-frontier.js +159 -0
  41. package/out/coarse-placer/tools/probe-frontier.js.map +1 -0
  42. package/out/coarse-placer/tools/quantize.d.ts +2 -0
  43. package/out/coarse-placer/tools/quantize.d.ts.map +1 -0
  44. package/out/coarse-placer/tools/quantize.js +80 -0
  45. package/out/coarse-placer/tools/quantize.js.map +1 -0
  46. package/out/coarse-placer/tools/train.d.ts +16 -0
  47. package/out/coarse-placer/tools/train.d.ts.map +1 -0
  48. package/out/coarse-placer/tools/train.js +173 -0
  49. package/out/coarse-placer/tools/train.js.map +1 -0
  50. package/out/data/chromium-i18n/ssl-address-download.js +5 -11
  51. package/out/data/chromium-i18n/ssl-address-download.js.map +1 -1
  52. package/out/data/libpostal/resources-download.js +7 -12
  53. package/out/data/libpostal/resources-download.js.map +1 -1
  54. package/out/decoder/arbitrate-tree.d.ts.map +1 -1
  55. package/out/decoder/arbitrate-tree.js +8 -4
  56. package/out/decoder/arbitrate-tree.js.map +1 -1
  57. package/out/decoder/build-tree.d.ts.map +1 -1
  58. package/out/decoder/build-tree.js +17 -9
  59. package/out/decoder/build-tree.js.map +1 -1
  60. package/out/decoder/calibration.d.ts.map +1 -1
  61. package/out/decoder/calibration.js +4 -2
  62. package/out/decoder/calibration.js.map +1 -1
  63. package/out/decoder/proposals-to-tree.d.ts.map +1 -1
  64. package/out/decoder/proposals-to-tree.js +4 -2
  65. package/out/decoder/proposals-to-tree.js.map +1 -1
  66. package/out/decoder/serialize-json.d.ts.map +1 -1
  67. package/out/decoder/serialize-json.js +10 -5
  68. package/out/decoder/serialize-json.js.map +1 -1
  69. package/out/decoder/serialize-tuples.d.ts.map +1 -1
  70. package/out/decoder/serialize-tuples.js +6 -3
  71. package/out/decoder/serialize-tuples.js.map +1 -1
  72. package/out/decoder/serialize-xml.d.ts.map +1 -1
  73. package/out/decoder/serialize-xml.js +6 -3
  74. package/out/decoder/serialize-xml.js.map +1 -1
  75. package/out/decoder/unknown-spans.d.ts.map +1 -1
  76. package/out/decoder/unknown-spans.js +6 -3
  77. package/out/decoder/unknown-spans.js.map +1 -1
  78. package/out/env/index.d.ts +7 -0
  79. package/out/env/index.d.ts.map +1 -1
  80. package/out/env/index.js +1 -0
  81. package/out/env/index.js.map +1 -1
  82. package/out/env/paths.d.ts.map +1 -1
  83. package/out/env/paths.js +2 -1
  84. package/out/env/paths.js.map +1 -1
  85. package/out/env/schema.d.ts +7 -0
  86. package/out/env/schema.d.ts.map +1 -1
  87. package/out/env/schema.js +11 -0
  88. package/out/env/schema.js.map +1 -1
  89. package/out/parser/proposal-pipeline.d.ts.map +1 -1
  90. package/out/parser/proposal-pipeline.js +8 -4
  91. package/out/parser/proposal-pipeline.js.map +1 -1
  92. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  93. package/out/pipeline/runtime-pipeline.js +12 -6
  94. package/out/pipeline/runtime-pipeline.js.map +1 -1
  95. package/out/pipeline/span-logit-aggregation.js +2 -1
  96. package/out/pipeline/span-logit-aggregation.js.map +1 -1
  97. package/out/pipeline/span-proposer.d.ts.map +1 -1
  98. package/out/pipeline/span-proposer.js +14 -7
  99. package/out/pipeline/span-proposer.js.map +1 -1
  100. package/out/resolver/types.d.ts.map +1 -1
  101. package/out/resolver/types.js +2 -1
  102. package/out/resolver/types.js.map +1 -1
  103. package/out/resources/fs.js +1 -1
  104. package/out/resources/fs.js.map +1 -1
  105. package/out/resources/git.js +1 -1
  106. package/out/resources/git.js.map +1 -1
  107. package/out/resources/libpostal.js +1 -1
  108. package/out/resources/libpostal.js.map +1 -1
  109. package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
  110. package/out/resources/whosonfirst/placetypes/mermaid.js +2 -1
  111. package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
  112. package/out/types/mapping.d.ts.map +1 -1
  113. package/out/types/mapping.js +2 -1
  114. package/out/types/mapping.js.map +1 -1
  115. package/out/utils/data-root.d.ts +1 -1
  116. package/out/utils/data-root.d.ts.map +1 -1
  117. package/out/utils/data-root.js +11 -9
  118. package/out/utils/data-root.js.map +1 -1
  119. package/out/utils/index.d.ts +4 -0
  120. package/out/utils/index.d.ts.map +1 -1
  121. package/out/utils/index.js +4 -0
  122. package/out/utils/index.js.map +1 -1
  123. package/out/utils/python-json.d.ts +38 -0
  124. package/out/utils/python-json.d.ts.map +1 -0
  125. package/out/utils/python-json.js +90 -0
  126. package/out/utils/python-json.js.map +1 -0
  127. package/out/utils/python-random.d.ts +41 -0
  128. package/out/utils/python-random.d.ts.map +1 -0
  129. package/out/utils/python-random.js +78 -0
  130. package/out/utils/python-random.js.map +1 -0
  131. package/out/utils/repo.d.ts +16 -1
  132. package/out/utils/repo.d.ts.map +1 -1
  133. package/out/utils/repo.js +18 -1
  134. package/out/utils/repo.js.map +1 -1
  135. package/out/utils/scripting.d.ts +50 -0
  136. package/out/utils/scripting.d.ts.map +1 -0
  137. package/out/utils/scripting.js +99 -0
  138. package/out/utils/scripting.js.map +1 -0
  139. package/out/utils/sealed-db.d.ts +20 -0
  140. package/out/utils/sealed-db.d.ts.map +1 -0
  141. package/out/utils/sealed-db.js +74 -0
  142. package/out/utils/sealed-db.js.map +1 -0
  143. package/out/vitest.config.d.ts.map +1 -1
  144. package/out/vitest.config.js +1 -2
  145. package/out/vitest.config.js.map +1 -1
  146. package/package.json +6 -3
@@ -1 +1 @@
1
- {"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../types/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAqBlD;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,GAAG,IAAI,CAE9F;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAuC,cAAc,EAAE,CAAA;AAiBjG;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,YAAY,GAAG,cAAc,GAAG,IAAI,CAEjG"}
1
+ {"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../types/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAqBlD;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,GAAG,IAAI,CAE9F;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAuC,cAAc,EAAE,CAAA;AAmBjG;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,YAAY,GAAG,cAAc,GAAG,IAAI,CAEjG"}
@@ -53,8 +53,9 @@ export const MAPPED_LEGACY_CLASSIFICATIONS = Object.keys(LEGACY_TO_COMPONENT);
53
53
  const COMPONENT_TO_LEGACY = (() => {
54
54
  const out = {};
55
55
  for (const [legacy, component] of Object.entries(LEGACY_TO_COMPONENT)) {
56
- if (!(component in out))
56
+ if (!(component in out)) {
57
57
  out[component] = legacy;
58
+ }
58
59
  }
59
60
  return out;
60
61
  })();
@@ -1 +1 @@
1
- {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../types/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;GAGG;AACH,MAAM,mBAAmB,GAAkD;IAC1E,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,oBAAoB;IAChC,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,gBAAgB;CAC9B,CAAA;AAED;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAAsB;IACxE,OAAO,mBAAmB,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAqB,CAAA;AAEjG;;;;GAIG;AACH,MAAM,mBAAmB,GAAkD,CAAC,GAAG,EAAE;IAChF,MAAM,GAAG,GAAkD,EAAE,CAAA;IAE7D,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAA0C,EAAE,CAAC;QAChH,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC;YAAE,GAAG,CAAC,SAAS,CAAC,GAAG,MAAM,CAAA;IACjD,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC,CAAC,EAAE,CAAA;AAEJ;;;;;;GAMG;AACH,MAAM,UAAU,kCAAkC,CAAC,SAAuB;IACzE,OAAO,mBAAmB,CAAC,SAAS,CAAC,IAAI,IAAI,CAAA;AAC9C,CAAC"}
1
+ {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../types/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;GAGG;AACH,MAAM,mBAAmB,GAAkD;IAC1E,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,oBAAoB;IAChC,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,gBAAgB;CAC9B,CAAA;AAED;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAAsB;IACxE,OAAO,mBAAmB,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAqB,CAAA;AAEjG;;;;GAIG;AACH,MAAM,mBAAmB,GAAkD,CAAC,GAAG,EAAE;IAChF,MAAM,GAAG,GAAkD,EAAE,CAAA;IAE7D,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAA0C,EAAE,CAAC;QAChH,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,EAAE,CAAC;YACzB,GAAG,CAAC,SAAS,CAAC,GAAG,MAAM,CAAA;QACxB,CAAC;IACF,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC,CAAC,EAAE,CAAA;AAEJ;;;;;;GAMG;AACH,MAAM,UAAU,kCAAkC,CAAC,SAAuB;IACzE,OAAO,mBAAmB,CAAC,SAAS,CAAC,IAAI,IAAI,CAAA;AAC9C,CAAC"}
@@ -14,7 +14,7 @@
14
14
  export declare function mailwomanDataRoot(): string;
15
15
  /**
16
16
  * Build an absolute path under the data root, e.g. `dataRootPath("wof", "admin-global-priority.db")`. Reads the env on
17
- * each call, so a late `process.env` change (or a test) is honored.
17
+ * each call, so a late environment change (or a test stub) is honored.
18
18
  */
19
19
  export declare function dataRootPath(...segments: string[]): string;
20
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"data-root.d.ts","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,sFAAsF;AACtF,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,CAU9G"}
1
+ {"version":3,"file":"data-root.d.ts","sourceRoot":"","sources":["../../utils/data-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,sFAAsF;AACtF,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"}
@@ -10,7 +10,8 @@
10
10
  * {@link dataRootPath} rather than re-deriving the string. Going public, this is the only file that
11
11
  * names the operator's filesystem layout; everything else reads `$MAILWOMAN_DATA_ROOT`.
12
12
  */
13
- import { resolvePathBuilder } from "path-ts";
13
+ import { resolvePath } from "path-ts";
14
+ import { $public } from "../env/index.js";
14
15
  /**
15
16
  * The lab default data root — the ONE place this literal appears. Everything else builds on {@link dataRootPath} /
16
17
  * {@link mailwomanDataRoot}; override per-deployment with `$MAILWOMAN_DATA_ROOT`.
@@ -18,14 +19,14 @@ import { resolvePathBuilder } from "path-ts";
18
19
  const DEFAULT_MAILWOMAN_DATA_ROOT = "/mnt/playpen/mailwoman-data";
19
20
  /** The Mailwoman data root: `$MAILWOMAN_DATA_ROOT` when set, else the lab default. */
20
21
  export function mailwomanDataRoot() {
21
- return process.env["MAILWOMAN_DATA_ROOT"] ?? DEFAULT_MAILWOMAN_DATA_ROOT;
22
+ return $public.MAILWOMAN_DATA_ROOT ?? DEFAULT_MAILWOMAN_DATA_ROOT;
22
23
  }
23
24
  /**
24
25
  * Build an absolute path under the data root, e.g. `dataRootPath("wof", "admin-global-priority.db")`. Reads the env on
25
- * each call, so a late `process.env` change (or a test) is honored.
26
+ * each call, so a late environment change (or a test stub) is honored.
26
27
  */
27
28
  export function dataRootPath(...segments) {
28
- return String(resolvePathBuilder(mailwomanDataRoot(), ...segments));
29
+ return resolvePath(mailwomanDataRoot(), ...segments);
29
30
  }
30
31
  /**
31
32
  * The default WOF shard list the FTS backend probes when no single `--wof-db` is given: the global admin-priority shard
@@ -36,14 +37,15 @@ export function dataRootPath(...segments) {
36
37
  * tail shard degrades to the pre-#920 pair.
37
38
  */
38
39
  export function wofShardPaths(dataRoot = mailwomanDataRoot()) {
40
+ // TODO: Redo this as an object.
39
41
  return [
40
- String(resolvePathBuilder(dataRoot, "wof", "admin-global-priority.db")),
41
- String(resolvePathBuilder(dataRoot, "wof", "postalcode-us.db")),
42
- String(resolvePathBuilder(dataRoot, "wof", "postalcode-geonames-tail.db")),
43
- String(resolvePathBuilder(dataRoot, "wof", "postalcode-intl.db")),
42
+ resolvePath(dataRoot, "wof", "admin-global-priority.db"),
43
+ resolvePath(dataRoot, "wof", "postalcode-us.db"),
44
+ resolvePath(dataRoot, "wof", "postalcode-geonames-tail.db"),
45
+ resolvePath(dataRoot, "wof", "postalcode-intl.db"),
44
46
  // #977: the NL PC6 full-postcode shard (CBS via PDOK; scripts/build-postalcode-nl-pc6.ts) — the
45
47
  // data the lookup's NL PC6 ladder ("1012 LG" → joined "1012LG" → 4-digit stem) resolves against.
46
- String(resolvePathBuilder(dataRoot, "wof", "postalcode-nl-pc6.db")),
48
+ resolvePath(dataRoot, "wof", "postalcode-nl-pc6.db"),
47
49
  ];
48
50
  }
49
51
  //# 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,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE5C;;;GAGG;AACH,MAAM,2BAA2B,GAAG,6BAA6B,CAAA;AAEjE,sFAAsF;AACtF,MAAM,UAAU,iBAAiB;IAChC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,2BAA2B,CAAA;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAG,QAAkB;IACjD,OAAO,MAAM,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAA;AACpE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmB,iBAAiB,EAAE;IACnE,OAAO;QACN,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,EAAE,0BAA0B,CAAC,CAAC;QACvE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;QAC/D,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC;QAC1E,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;QACjE,gGAAgG;QAChG,iGAAiG;QACjG,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC;KACnE,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,sFAAsF;AACtF,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"}
@@ -5,4 +5,8 @@
5
5
  */
6
6
  export * from "./data-root.js";
7
7
  export * from "./repo.js";
8
+ export * from "./sealed-db.js";
9
+ export * from "./python-json.js";
10
+ export * from "./python-random.js";
11
+ export * from "./scripting.js";
8
12
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
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,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA"}
@@ -5,4 +5,8 @@
5
5
  */
6
6
  export * from "./data-root.js";
7
7
  export * from "./repo.js";
8
+ export * from "./sealed-db.js";
9
+ export * from "./python-json.js";
10
+ export * from "./python-random.js";
11
+ export * from "./scripting.js";
8
12
  //# sourceMappingURL=index.js.map
@@ -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"}
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,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * A faithful reimplementation of Python's `json.dumps` single-line serialization, used by the
7
+ * ported `scripts/eval/*.ts` golden/eval builders so their JSONL output is byte-identical to the
8
+ * Python originals (the committed `data/eval/**` files were written by `json.dumps`).
9
+ *
10
+ * Two things `JSON.stringify` gets "wrong" relative to Python and that this fixes:
11
+ *
12
+ * 1. **Separators.** Python's default is `(", ", ": ")` — a space after every comma and colon.
13
+ * `JSON.stringify` is compact (`","` / `":"`). The committed files are spaced, so we match.
14
+ * 2. **`ensure_ascii`.** Python defaults to escaping every non-ASCII codepoint as `\uXXXX` (surrogate
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`).
17
+ *
18
+ * String escaping of ASCII (quote, backslash, `\n`/`\t`/`\r`/`\b`/`\f`, other control -> `\u00xx`)
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
21
+ * on.
22
+ *
23
+ * Caveat: JS has a single number type, so a whole-valued float (e.g. an exact `5.0` coordinate)
24
+ * serializes as `5`, whereas Python's `float(5.0)` -> `"5.0"`. Real-world lat/lon land on exact
25
+ * integers vanishingly rarely; the builders that emit coordinates accept this edge.
26
+ */
27
+ export interface PyJsonOptions {
28
+ /** Escape non-ASCII as `\uXXXX` (Python `ensure_ascii`). Defaults to `true`, matching Python. */
29
+ ensureAscii?: boolean;
30
+ }
31
+ /** `json.dumps(value)` — single line, `(", ", ": ")` separators, `ensure_ascii` per options. */
32
+ export declare function pyJsonDumps(value: unknown, options?: PyJsonOptions): string;
33
+ /**
34
+ * Render a string->number map the way Python prints `dict(...)` / `dict(Counter(...))` — single-quoted keys, `, ` / `:
35
+ * ` separators (e.g. `{'US': 1840, 'FR': 950}`). Insertion order is preserved.
36
+ */
37
+ export declare function pyReprDict(entries: Iterable<readonly [string, number]>): string;
38
+ //# sourceMappingURL=python-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-json.d.ts","sourceRoot":"","sources":["../../utils/python-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,aAAa;IAC7B,iGAAiG;IACjG,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB;AAyDD,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAE/E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAQ/E"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * A faithful reimplementation of Python's `json.dumps` single-line serialization, used by the
7
+ * ported `scripts/eval/*.ts` golden/eval builders so their JSONL output is byte-identical to the
8
+ * Python originals (the committed `data/eval/**` files were written by `json.dumps`).
9
+ *
10
+ * Two things `JSON.stringify` gets "wrong" relative to Python and that this fixes:
11
+ *
12
+ * 1. **Separators.** Python's default is `(", ", ": ")` — a space after every comma and colon.
13
+ * `JSON.stringify` is compact (`","` / `":"`). The committed files are spaced, so we match.
14
+ * 2. **`ensure_ascii`.** Python defaults to escaping every non-ASCII codepoint as `\uXXXX` (surrogate
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`).
17
+ *
18
+ * String escaping of ASCII (quote, backslash, `\n`/`\t`/`\r`/`\b`/`\f`, other control -> `\u00xx`)
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
21
+ * on.
22
+ *
23
+ * Caveat: JS has a single number type, so a whole-valued float (e.g. an exact `5.0` coordinate)
24
+ * serializes as `5`, whereas Python's `float(5.0)` -> `"5.0"`. Real-world lat/lon land on exact
25
+ * integers vanishingly rarely; the builders that emit coordinates accept this edge.
26
+ */
27
+ /** Serialize one string the way Python's json does (then optionally `ensure_ascii`-escape it). */
28
+ function serializeString(value, ensureAscii) {
29
+ // JSON.stringify handles the quote/backslash/control escaping identically to Python's json.
30
+ const out = JSON.stringify(value);
31
+ if (!ensureAscii)
32
+ return out;
33
+ // ensure_ascii: escape every code unit >= 0x80 as \uXXXX (surrogate halves handled per-unit,
34
+ // exactly as CPython emits astral codepoints as a \u-pair).
35
+ let escaped = "";
36
+ for (let i = 0; i < out.length; i++) {
37
+ const code = out.charCodeAt(i);
38
+ escaped += code > 0x7f ? "\\u" + code.toString(16).padStart(4, "0") : out[i];
39
+ }
40
+ return escaped;
41
+ }
42
+ /** Serialize one finite/non-finite number the way Python's json does. */
43
+ function serializeNumber(value) {
44
+ if (Number.isFinite(value))
45
+ return JSON.stringify(value);
46
+ // Python json renders these literally (not RFC-valid, but it's what json.dumps does by default).
47
+ if (Number.isNaN(value))
48
+ return "NaN";
49
+ return value > 0 ? "Infinity" : "-Infinity";
50
+ }
51
+ function serialize(value, ensureAscii) {
52
+ if (value === null || value === undefined)
53
+ return "null";
54
+ const t = typeof value;
55
+ if (t === "boolean")
56
+ return value ? "true" : "false";
57
+ if (t === "number")
58
+ return serializeNumber(value);
59
+ if (t === "string")
60
+ return serializeString(value, ensureAscii);
61
+ if (Array.isArray(value)) {
62
+ return "[" + value.map((v) => serialize(v, ensureAscii)).join(", ") + "]";
63
+ }
64
+ if (t === "object") {
65
+ const parts = [];
66
+ for (const [k, v] of Object.entries(value)) {
67
+ if (v === undefined)
68
+ continue; // a key Python would never have produced
69
+ parts.push(serializeString(k, ensureAscii) + ": " + serialize(v, ensureAscii));
70
+ }
71
+ return "{" + parts.join(", ") + "}";
72
+ }
73
+ throw new TypeError(`pyJsonDumps: unsupported value of type ${t}`);
74
+ }
75
+ /** `json.dumps(value)` — single line, `(", ", ": ")` separators, `ensure_ascii` per options. */
76
+ export function pyJsonDumps(value, options = {}) {
77
+ return serialize(value, options.ensureAscii ?? true);
78
+ }
79
+ /**
80
+ * Render a string->number map the way Python prints `dict(...)` / `dict(Counter(...))` — single-quoted keys, `, ` / `:
81
+ * ` separators (e.g. `{'US': 1840, 'FR': 950}`). Insertion order is preserved.
82
+ */
83
+ export function pyReprDict(entries) {
84
+ const parts = [];
85
+ for (const [k, v] of entries) {
86
+ parts.push(`'${k}': ${v}`);
87
+ }
88
+ return "{" + parts.join(", ") + "}";
89
+ }
90
+ //# sourceMappingURL=python-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-json.js","sourceRoot":"","sources":["../../utils/python-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAOH,kGAAkG;AAClG,SAAS,eAAe,CAAC,KAAa,EAAE,WAAoB;IAC3D,4FAA4F;IAC5F,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAEjC,IAAI,CAAC,WAAW;QAAE,OAAO,GAAG,CAAA;IAC5B,6FAA6F;IAC7F,4DAA4D;IAC5D,IAAI,OAAO,GAAG,EAAE,CAAA;IAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QAC9B,OAAO,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC7E,CAAC;IAED,OAAO,OAAO,CAAA;AACf,CAAC;AAED,yEAAyE;AACzE,SAAS,eAAe,CAAC,KAAa;IACrC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAExD,iGAAiG;IACjG,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAErC,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,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,EAAE,CAAC,CAAA;AACnE,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,WAAW,CAAC,KAAc,EAAE,UAAyB,EAAE;IACtE,OAAO,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,CAAA;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAA4C;IACtE,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;IAED,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;AACpC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * A tiny seeded PRNG shaped like Python's `random.Random` (the `random()` / `randint()` /
7
+ * `choice()` / `choices()` surface the `scripts/extract-tuples*.py` originals used). Lives here
8
+ * so the two ported extractors share one implementation.
9
+ *
10
+ * NOTE — this is deliberately NOT a bit-exact port of CPython's MT19937. The source scripts draw
11
+ * their rows with SQL `ORDER BY RANDOM()` (already non-deterministic across runs) and the
12
+ * postcodes are synthetic shape-data ("the model learns the SHAPE, not the exact mapping"), so a
13
+ * byte-identical random stream buys nothing observable. What is preserved is what matters: a
14
+ * seeded, deterministic-per-input stream and Python's helper semantics — inclusive `randint`,
15
+ * uniform `choice`, with-replacement `choices`.
16
+ */
17
+ /** Seeded `random.Random`-equivalent. Backed by mulberry32 (a 32-bit stateful generator). */
18
+ export declare class SeededRandom {
19
+ #private;
20
+ constructor(seed: number);
21
+ /** Float in `[0, 1)`. Mirrors Python `random.random()`. */
22
+ random(): number;
23
+ /** Integer in `[lo, hi]` inclusive. Mirrors Python `random.randint(lo, hi)`. */
24
+ randint(lo: number, hi: number): number;
25
+ /** One uniformly-chosen element. Mirrors Python `random.choice(seq)`. */
26
+ choice<T>(seq: readonly T[]): T;
27
+ /** `k` elements chosen with replacement. Mirrors Python `random.choices(seq, k=k)`. */
28
+ choices<T>(seq: readonly T[], k: number): T[];
29
+ /**
30
+ * In-place Fisher-Yates shuffle. Mirrors Python `random.shuffle(x)` — distribution-correct, but NOT bit-identical to
31
+ * CPython's `_randbelow` stream (see the module header on the seeded-but-not- MT19937 tradeoff).
32
+ */
33
+ shuffle<T>(arr: T[]): void;
34
+ /**
35
+ * `k` distinct elements without replacement, as a NEW array. Mirrors Python `random.sample(seq, k)` semantics
36
+ * (uniform, no mutation of the input); the selection ORDER is partial-Fisher-Yates, which — like {@link shuffle} — is
37
+ * uniform but not CPython-bit-identical. `k` must be `<= seq.length`.
38
+ */
39
+ sample<T>(seq: readonly T[], k: number): T[];
40
+ }
41
+ //# sourceMappingURL=python-random.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-random.d.ts","sourceRoot":"","sources":["../../utils/python-random.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,6FAA6F;AAC7F,qBAAa,YAAY;;gBAGZ,IAAI,EAAE,MAAM;IAKxB,2DAA2D;IAC3D,MAAM,IAAI,MAAM;IAQhB,gFAAgF;IAChF,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM;IAIvC,yEAAyE;IACzE,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC;IAI/B,uFAAuF;IACvF,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE;IAU7C;;;OAGG;IACH,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,IAAI;IAS1B;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE;CAe5C"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * A tiny seeded PRNG shaped like Python's `random.Random` (the `random()` / `randint()` /
7
+ * `choice()` / `choices()` surface the `scripts/extract-tuples*.py` originals used). Lives here
8
+ * so the two ported extractors share one implementation.
9
+ *
10
+ * NOTE — this is deliberately NOT a bit-exact port of CPython's MT19937. The source scripts draw
11
+ * their rows with SQL `ORDER BY RANDOM()` (already non-deterministic across runs) and the
12
+ * postcodes are synthetic shape-data ("the model learns the SHAPE, not the exact mapping"), so a
13
+ * byte-identical random stream buys nothing observable. What is preserved is what matters: a
14
+ * seeded, deterministic-per-input stream and Python's helper semantics — inclusive `randint`,
15
+ * uniform `choice`, with-replacement `choices`.
16
+ */
17
+ /** Seeded `random.Random`-equivalent. Backed by mulberry32 (a 32-bit stateful generator). */
18
+ export class SeededRandom {
19
+ #state;
20
+ constructor(seed) {
21
+ // mulberry32 wants a non-zero 32-bit state.
22
+ this.#state = seed >>> 0 || 1;
23
+ }
24
+ /** Float in `[0, 1)`. Mirrors Python `random.random()`. */
25
+ random() {
26
+ let t = (this.#state += 0x6d2b79f5);
27
+ t = Math.imul(t ^ (t >>> 15), t | 1);
28
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
29
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
30
+ }
31
+ /** Integer in `[lo, hi]` inclusive. Mirrors Python `random.randint(lo, hi)`. */
32
+ randint(lo, hi) {
33
+ return lo + Math.floor(this.random() * (hi - lo + 1));
34
+ }
35
+ /** One uniformly-chosen element. Mirrors Python `random.choice(seq)`. */
36
+ choice(seq) {
37
+ return seq[Math.floor(this.random() * seq.length)];
38
+ }
39
+ /** `k` elements chosen with replacement. Mirrors Python `random.choices(seq, k=k)`. */
40
+ choices(seq, k) {
41
+ const out = [];
42
+ for (let i = 0; i < k; i++) {
43
+ out.push(this.choice(seq));
44
+ }
45
+ return out;
46
+ }
47
+ /**
48
+ * In-place Fisher-Yates shuffle. Mirrors Python `random.shuffle(x)` — distribution-correct, but NOT bit-identical to
49
+ * CPython's `_randbelow` stream (see the module header on the seeded-but-not- MT19937 tradeoff).
50
+ */
51
+ shuffle(arr) {
52
+ for (let i = arr.length - 1; i > 0; i--) {
53
+ const j = this.randint(0, i);
54
+ const tmp = arr[i];
55
+ arr[i] = arr[j];
56
+ arr[j] = tmp;
57
+ }
58
+ }
59
+ /**
60
+ * `k` distinct elements without replacement, as a NEW array. Mirrors Python `random.sample(seq, k)` semantics
61
+ * (uniform, no mutation of the input); the selection ORDER is partial-Fisher-Yates, which — like {@link shuffle} — is
62
+ * uniform but not CPython-bit-identical. `k` must be `<= seq.length`.
63
+ */
64
+ sample(seq, k) {
65
+ const pool = seq.slice();
66
+ const n = pool.length;
67
+ const out = [];
68
+ for (let i = 0; i < k; i++) {
69
+ const j = this.randint(i, n - 1);
70
+ const tmp = pool[i];
71
+ pool[i] = pool[j];
72
+ pool[j] = tmp;
73
+ out.push(pool[i]);
74
+ }
75
+ return out;
76
+ }
77
+ }
78
+ //# sourceMappingURL=python-random.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-random.js","sourceRoot":"","sources":["../../utils/python-random.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,6FAA6F;AAC7F,MAAM,OAAO,YAAY;IACxB,MAAM,CAAQ;IAEd,YAAY,IAAY;QACvB,4CAA4C;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;IAED,2DAA2D;IAC3D,MAAM;QACL,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC,CAAA;QACnC,CAAC,GAAG,IAAI,CAAC,IAAI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AAA;YAC5B,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAE,CAAA;YACnB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAE,CAAA;YAChB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;QACb,CAAC;IACF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAI,GAAiB,EAAE,CAAS;QACrC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,EAAE,CAAA;QACxB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QACrB,MAAM,GAAG,GAAQ,EAAE,CAAA;QAEnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAChC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAA;YACpB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAA;YAClB,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;YACb,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAA;QACnB,CAAC;QAED,OAAO,GAAG,CAAA;IACX,CAAC;CACD"}
@@ -20,7 +20,17 @@ type RepoRootAlias = typeof RepoRootAlias;
20
20
  * Path builder relative to the repo root.
21
21
  */
22
22
  export declare const repoRootPathBuilder: import("path-ts").PathBuilderResolver<"mailwoman">;
23
+ /**
24
+ * Absolute-path-string resolver relative to the repo root — the string-returning sibling of {@link repoRootPathBuilder},
25
+ * for handing paths straight to `node:fs` and other string APIs without a `.toString()`.
26
+ */
27
+ export declare const repoRootPath: import("path-ts").PathResolver<"mailwoman">;
23
28
  export declare const corePackagePathBuilder: import("path-ts").PathBuilderResolver<"mailwoman">;
29
+ /**
30
+ * Absolute-path-string resolver relative to the `@mailwoman/core` workspace root — the string-returning sibling of
31
+ * {@link corePackagePathBuilder}.
32
+ */
33
+ export declare const corePackagePath: import("path-ts").PathResolver<"mailwoman">;
24
34
  /**
25
35
  * Path builder relative to a specific package's output directory.
26
36
  */
@@ -33,7 +43,12 @@ export type AddressResource = "chromium-i18n/ssl-address" | "libpostal" | "inter
33
43
  * `files` glob. Use {@link corePackagePathBuilder} directly for non- dictionary assets (e.g. chromium-i18n/ssl-address)
34
44
  * that don't have the `dictionaries/` subdir.
35
45
  */
36
- export declare function resourceDictionaryPathBuilder<A extends AddressResource, S extends string[]>(resource: A, ...pathSegments: S): PathBuilder<`mailwoman/${Join<["data", A, "dictionaries", ...S], "/">}`>;
46
+ export declare function resourceDictionaryPathBuilder<A extends AddressResource, S extends string[]>(resource: A, ...pathSegments: S): PathBuilder<import("path-ts").Resolve<`mailwoman/${Join<["data", A, "dictionaries", ...S], "/">}`>>;
47
+ /**
48
+ * Absolute-path-string resolver for an address resource dictionary directory — the string-returning sibling of
49
+ * {@link resourceDictionaryPathBuilder}.
50
+ */
51
+ export declare function resourceDictionaryPath<A extends AddressResource, S extends string[]>(resource: A, ...pathSegments: S): import("path-ts").Resolve<`mailwoman/${Join<["data", A, "dictionaries", ...S], "/">}`>;
37
52
  /**
38
53
  * Absolute path to the test directory.
39
54
  */
@@ -1 +1 @@
1
- {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../utils/repo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAA6B,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AAEhF;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AACrC,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAA;AAEtD,QAAA,MAAM,aAAa,EAAG,WAAoB,CAAA;AAC1C,KAAK,aAAa,GAAG,OAAO,aAAa,CAAA;AA2BzC;;GAEG;AACH,eAAO,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,CAAC,GAChB,WAAW,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAGjE;AAED,MAAM,MAAM,eAAe,GAAG,2BAA2B,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,CAAA;AAEpG;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,eAAe,EAAE,CAAC,SAAS,MAAM,EAAE,EAC1F,QAAQ,EAAE,CAAC,EACX,GAAG,YAAY,EAAE,CAAC,uGAGlB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,eAAe,EAAE,CAAC,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,YAAY,EAAE,CAAC,0FAEpH;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,+BAA8B,CAAA"}
package/out/utils/repo.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { basename, dirname, resolve } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
- import { createPathBuilderResolver } from "path-ts";
8
+ import { createPathBuilderResolver, createPathResolver } from "path-ts";
9
9
  /**
10
10
  * Aliased path to the root of the repository.
11
11
  *
@@ -40,6 +40,11 @@ const RepoRootAbsolutePath = resolve(__dirname, ...Array.from({ length: __upCoun
40
40
  * Path builder relative to the repo root.
41
41
  */
42
42
  export const repoRootPathBuilder = createPathBuilderResolver(RepoRootAbsolutePath);
43
+ /**
44
+ * Absolute-path-string resolver relative to the repo root — the string-returning sibling of {@link repoRootPathBuilder},
45
+ * for handing paths straight to `node:fs` and other string APIs without a `.toString()`.
46
+ */
47
+ export const repoRootPath = createPathResolver(RepoRootAbsolutePath);
43
48
  /**
44
49
  * Path builder relative to the `@mailwoman/core` workspace root (the directory containing `package.json` for this
45
50
  * package).
@@ -51,6 +56,11 @@ export const repoRootPathBuilder = createPathBuilderResolver(RepoRootAbsolutePat
51
56
  */
52
57
  const CorePackageAbsolutePath = resolve(__dirname, "..", __isCompiledTree ? ".." : "");
53
58
  export const corePackagePathBuilder = createPathBuilderResolver(CorePackageAbsolutePath);
59
+ /**
60
+ * Absolute-path-string resolver relative to the `@mailwoman/core` workspace root — the string-returning sibling of
61
+ * {@link corePackagePathBuilder}.
62
+ */
63
+ export const corePackagePath = createPathResolver(CorePackageAbsolutePath);
54
64
  /**
55
65
  * Path builder relative to a specific package's output directory.
56
66
  */
@@ -68,6 +78,13 @@ export function tsOutPathBuilder(...pathSegments) {
68
78
  export function resourceDictionaryPathBuilder(resource, ...pathSegments) {
69
79
  return corePackagePathBuilder("data", resource, "dictionaries", ...pathSegments);
70
80
  }
81
+ /**
82
+ * Absolute-path-string resolver for an address resource dictionary directory — the string-returning sibling of
83
+ * {@link resourceDictionaryPathBuilder}.
84
+ */
85
+ export function resourceDictionaryPath(resource, ...pathSegments) {
86
+ return corePackagePath("data", resource, "dictionaries", ...pathSegments);
87
+ }
71
88
  /**
72
89
  * Absolute path to the test directory.
73
90
  */
@@ -1 +1 @@
1
- {"version":3,"file":"repo.js","sourceRoot":"","sources":["../../utils/repo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,yBAAyB,EAA+B,MAAM,SAAS,CAAA;AAEhF;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAA;AAGrC,MAAM,aAAa,GAAG,WAAoB,CAAA;AAG1C,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAU,CAAA;AAGxD;;GAEG;AACH,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAkD,CAAA;AAE1G;;;;;;;;;;;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CAAgB,uBAAuB,CAAC,CAAA;AAEvG;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAgB,uBAAuB,CAAC,CAAA;AAEzF;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,GAAG,YAAe;IAElB,8DAA8D;IAC9D,OAAO,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,YAAY,CAAQ,CAAA;AACrE,CAAC;AAID;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B,CAC5C,QAAW,EACX,GAAG,YAAe;IAElB,OAAO,sBAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,YAAY,CAAC,CAAA;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAgD,QAAW,EAAE,GAAG,YAAe;IACpH,OAAO,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,YAAY,CAAC,CAAA;AAC1E,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAA"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Logs an error that occurred while running a script.
3
+ */
4
+ export declare function logScriptError(error: unknown): void;
5
+ /**
6
+ * A script callback function to invoke.
7
+ *
8
+ * @internal
9
+ */
10
+ export type ScriptCallback = (...args: unknown[]) => unknown | Promise<unknown>;
11
+ /**
12
+ * Cleans up services and exits the script cleanly.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare function postScriptCleanup(signal?: NodeJS.Signals, exitCode?: number): Promise<void>;
17
+ /**
18
+ * Runs a script callback and handles cleanup.
19
+ *
20
+ * @internal
21
+ */
22
+ export declare function runScript(scriptCallback: ScriptCallback): Promise<void>;
23
+ /**
24
+ * Given a module's import.meta object, resolves if the module was run as a NPM script.
25
+ *
26
+ * ```ts
27
+ * runIfScript(import.meta, async () => {...})
28
+ * ```
29
+ *
30
+ * This is useful for conditionally running scripts without too much boilerplate.
31
+ *
32
+ * @internal
33
+ */
34
+ export declare function runIfScript(meta: ImportMeta, scriptCallback: ScriptCallback): Promise<void>;
35
+ /**
36
+ * The ONE blessed accessor for CLI arguments. Everything outside `core/env` + this module is forbidden from touching
37
+ * `process.argv` directly (enforced by the `sister-software/no-process-globals` oxlint rule) — prefer `node:util`
38
+ * `parseArgs` (which reads this same slice by default) and reach for this only where `parseArgs` cannot express the
39
+ * grammar (e.g. negative-coordinate positionals).
40
+ */
41
+ export declare function cliArguments(): string[];
42
+ /**
43
+ * The ONE blessed way to build a child-process environment: the current environment with explicit overrides. Everything
44
+ * outside `core/env` + this module is forbidden from touching `process.env` directly (enforced by
45
+ * `scripts/lint-raw-env-argv.ts`) — read config through `$public`/`$private`.
46
+ */
47
+ export declare function childEnv(overrides?: Record<string, string | undefined>): NodeJS.ProcessEnv;
48
+ /** The path of the executing script (`argv[1]`) — for commands that re-spawn or reference their own CLI entry. */
49
+ export declare function scriptEntryPath(): string;
50
+ //# sourceMappingURL=scripting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripting.d.ts","sourceRoot":"","sources":["../../utils/scripting.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAYnD;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAE/E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,MAAM,CAAC,OAAmB,EAAE,QAAQ,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBjG;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CASvE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAajG;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAGvC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM,GAAG,MAAM,CAAC,UAAU,CAG9F;AAED,kHAAkH;AAClH,wBAAgB,eAAe,IAAI,MAAM,CAGxC"}