@mailwoman/core 8.6.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 +12 -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 +12 -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
@@ -1,96 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- */
6
-
7
- /**
8
- * Given an iterable collection, returns an async iterable, executing the callback on each batch.
9
- *
10
- * This is useful for batching asynchronous operations.
11
- *
12
- * @param collection The collection to batch.
13
- * @param batchSize The size of each batch.
14
- * @param callback The async callback to execute on each batch.
15
- */
16
- export async function* takeInParallel<T, C extends (entry: T) => Promise<unknown>>(
17
- collection: Iterable<T> | AsyncIterable<T>,
18
- batchSize: number,
19
- callback: C,
20
- abortSignal?: AbortSignal
21
- ): AsyncIterable<Awaited<ReturnType<C>>> {
22
- const iterator =
23
- Symbol.asyncIterator in collection ? collection[Symbol.asyncIterator]() : collection[Symbol.iterator]()
24
-
25
- const runningTasks = new Map<T, Promise<unknown>>()
26
- const results = new Map<T, ReturnType<C>>()
27
-
28
- let iterationResult = await iterator.next()
29
-
30
- // oxlint-disable-next-line eslint/no-unmodified-loop-condition -- `abortSignal.aborted` is flipped by the controller, not by this loop
31
- while ((!iterationResult.done || results.size) && !abortSignal?.aborted) {
32
- for (const [key, result] of results) {
33
- yield result
34
-
35
- results.delete(key)
36
- }
37
-
38
- if (runningTasks.size >= batchSize) {
39
- await Promise.race(runningTasks.values())
40
-
41
- continue
42
- }
43
-
44
- if (iterationResult.done) {
45
- await Promise.all(runningTasks.values())
46
-
47
- break
48
- }
49
-
50
- const entry = iterationResult.value
51
-
52
- // oxlint-disable-next-line promise/always-return -- the handle tracks completion, not a value
53
- const futureResult = callback(entry).then((result) => {
54
- runningTasks.delete(entry)
55
-
56
- results.set(entry, result as ReturnType<C>)
57
- })
58
-
59
- runningTasks.set(entry, futureResult)
60
-
61
- iterationResult = await iterator.next()
62
- }
63
-
64
- if (!abortSignal || !abortSignal.aborted) {
65
- await Promise.all(runningTasks.values())
66
-
67
- for (const [key, result] of results) {
68
- yield result
69
-
70
- results.delete(key)
71
- }
72
- }
73
- }
74
-
75
- /**
76
- * Given an async iterable collection, returns an async iterable, yielding batches of items.
77
- *
78
- * This is useful for emitting asynchronous items in batches, such as when processing a stream of data.
79
- */
80
- export async function* takeAsync<T>(collection: AsyncIterable<T>, batchSize: number): AsyncIterable<T[]> {
81
- let buffer: T[] = []
82
-
83
- for await (const item of collection) {
84
- buffer.push(item)
85
-
86
- if (buffer.length === batchSize) {
87
- yield buffer
88
-
89
- buffer = []
90
- }
91
- }
92
-
93
- if (buffer.length) {
94
- yield buffer
95
- }
96
- }