@mailwoman/core 11.1.0 → 11.3.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 (477) hide show
  1. package/README.md +2 -2
  2. package/lib/api/arcgis.ts +194 -0
  3. package/lib/api/ckan.ts +1 -1
  4. package/lib/api/disk-storage.ts +2 -2
  5. package/lib/api/ogc.ts +1 -1
  6. package/lib/api/retry.ts +7 -2
  7. package/lib/api/test/transport.ts +1 -1
  8. package/lib/{binary-frame.ts → asset/binary-frame.ts} +1 -1
  9. package/lib/async/abort.ts +100 -0
  10. package/lib/{memoize.ts → async/memoize.ts} +2 -2
  11. package/lib/{promises.ts → async/promises.ts} +1 -1
  12. package/lib/cloudflare/tokens.ts +1 -1
  13. package/lib/cloudflare/wrangler.ts +3 -3
  14. package/lib/crypto/digest.ts +1 -1
  15. package/lib/crypto/ed25519.ts +8 -0
  16. package/lib/crypto/node.ts +1 -1
  17. package/lib/data-root.ts +16 -3
  18. package/lib/decoder/containment.ts +4 -1
  19. package/lib/decoder/serialize/outline.ts +50 -0
  20. package/lib/decoder/types.ts +9 -1
  21. package/lib/decoder.ts +1 -0
  22. package/lib/env/schema.ts +5 -0
  23. package/lib/fs/deflate64.ts +1 -1
  24. package/lib/fs/lock.ts +183 -25
  25. package/lib/fs/readers.ts +1 -1
  26. package/lib/fs/writers.ts +1 -1
  27. package/lib/geocode/result.ts +50 -6
  28. package/lib/html/text.ts +2 -2
  29. package/lib/index.ts +0 -1
  30. package/lib/layers/artifact.ts +2 -2
  31. package/lib/layers/coverage.ts +1 -1
  32. package/lib/layers/manifest.ts +94 -2
  33. package/lib/layers/provenance.ts +246 -0
  34. package/lib/layers/publication.ts +4 -3
  35. package/lib/layers/selection.ts +2 -2
  36. package/lib/license/branch.ts +66 -0
  37. package/lib/license/configured.ts +4 -2
  38. package/lib/license/declaration.ts +1 -1
  39. package/lib/license/key/file.ts +1 -1
  40. package/lib/license/key.ts +148 -201
  41. package/lib/license/provenance.ts +193 -0
  42. package/lib/license/register.ts +7 -78
  43. package/lib/license/stamp.ts +8 -2
  44. package/lib/license/text-url.ts +55 -0
  45. package/lib/license/training.ts +67 -0
  46. package/lib/license.ts +7 -6
  47. package/lib/locale/registry.ts +1 -1
  48. package/lib/locale/zh-cn-units.ts +1 -1
  49. package/lib/module/workspace.ts +1 -1
  50. package/lib/{routing.ts → network/routing.ts} +1 -1
  51. package/lib/pipeline/result.ts +7 -27
  52. package/lib/pipeline/runtime-pipeline.ts +131 -152
  53. package/lib/pipeline/stage.ts +290 -0
  54. package/lib/pipeline/types.ts +154 -20
  55. package/lib/pipeline.ts +14 -2
  56. package/lib/{git.ts → repo/git.ts} +21 -1
  57. package/lib/{release-config.ts → repo/release-config.ts} +8 -0
  58. package/lib/{scope-config.ts → repo/scope-config.ts} +8 -36
  59. package/lib/{spdx-header.ts → repo/spdx-header.ts} +8 -0
  60. package/lib/{workspaces.ts → repo/workspaces.ts} +1 -1
  61. package/lib/resolver/lookup-types.ts +1 -1
  62. package/lib/resolver/region-database-provider.ts +33 -0
  63. package/lib/resolver/synthetic-id-ranges.ts +76 -4
  64. package/lib/resolver/types.ts +231 -6
  65. package/lib/resolver.ts +14 -1
  66. package/lib/state-machine.ts +1 -1
  67. package/lib/strings/python-json.ts +15 -5
  68. package/lib/tokenization/Span.ts +12 -0
  69. package/lib/utils/chunk-process.ts +2 -2
  70. package/lib/utils/geodatabase-archive.ts +1 -1
  71. package/lib/utils/time.ts +190 -6
  72. package/lib/utils.ts +4 -4
  73. package/out/api/arcgis.d.ts +76 -0
  74. package/out/api/arcgis.d.ts.map +1 -1
  75. package/out/api/arcgis.js +123 -0
  76. package/out/api/arcgis.js.map +1 -1
  77. package/out/api/ckan.js +1 -1
  78. package/out/api/ckan.js.map +1 -1
  79. package/out/api/disk-storage.d.ts.map +1 -1
  80. package/out/api/disk-storage.js +2 -2
  81. package/out/api/disk-storage.js.map +1 -1
  82. package/out/api/ogc.js +1 -1
  83. package/out/api/ogc.js.map +1 -1
  84. package/out/api/retry.d.ts.map +1 -1
  85. package/out/api/retry.js +6 -2
  86. package/out/api/retry.js.map +1 -1
  87. package/out/api/test/transport.js +1 -1
  88. package/out/api/test/transport.js.map +1 -1
  89. package/out/asset/binary-frame.d.ts.map +1 -0
  90. package/out/{binary-frame.js → asset/binary-frame.js} +1 -1
  91. package/out/asset/binary-frame.js.map +1 -0
  92. package/out/asset/load-ledger.d.ts.map +1 -0
  93. package/out/asset/load-ledger.js.map +1 -0
  94. package/out/asset/overture-pins.d.ts.map +1 -0
  95. package/out/asset/overture-pins.js.map +1 -0
  96. package/out/asset/postcode-prefix-files.d.ts.map +1 -0
  97. package/out/asset/postcode-prefix-files.js.map +1 -0
  98. package/out/async/abort.d.ts +57 -0
  99. package/out/async/abort.d.ts.map +1 -0
  100. package/out/async/abort.js +89 -0
  101. package/out/async/abort.js.map +1 -0
  102. package/out/async/memoize.d.ts.map +1 -0
  103. package/out/{memoize.js → async/memoize.js} +2 -2
  104. package/out/async/memoize.js.map +1 -0
  105. package/out/{promises.d.ts → async/promises.d.ts} +1 -1
  106. package/out/async/promises.d.ts.map +1 -0
  107. package/out/{promises.js → async/promises.js} +1 -1
  108. package/out/async/promises.js.map +1 -0
  109. package/out/cloudflare/tokens.js +1 -1
  110. package/out/cloudflare/tokens.js.map +1 -1
  111. package/out/cloudflare/wrangler.js +3 -3
  112. package/out/cloudflare/wrangler.js.map +1 -1
  113. package/out/crypto/digest.d.ts +1 -1
  114. package/out/crypto/digest.js +1 -1
  115. package/out/crypto/ed25519.d.ts +7 -0
  116. package/out/crypto/ed25519.d.ts.map +1 -1
  117. package/out/crypto/ed25519.js +7 -0
  118. package/out/crypto/ed25519.js.map +1 -1
  119. package/out/crypto/hash.d.ts.map +1 -0
  120. package/out/crypto/hash.js.map +1 -0
  121. package/out/crypto/node.js +1 -1
  122. package/out/crypto/node.js.map +1 -1
  123. package/out/data-root.d.ts +11 -3
  124. package/out/data-root.d.ts.map +1 -1
  125. package/out/data-root.js +14 -3
  126. package/out/data-root.js.map +1 -1
  127. package/out/decoder/containment.d.ts.map +1 -1
  128. package/out/decoder/containment.js +1 -1
  129. package/out/decoder/containment.js.map +1 -1
  130. package/out/decoder/serialize/outline.d.ts +25 -0
  131. package/out/decoder/serialize/outline.d.ts.map +1 -0
  132. package/out/decoder/serialize/outline.js +37 -0
  133. package/out/decoder/serialize/outline.js.map +1 -0
  134. package/out/decoder/types.d.ts +8 -0
  135. package/out/decoder/types.d.ts.map +1 -1
  136. package/out/decoder/types.js +1 -1
  137. package/out/decoder/types.js.map +1 -1
  138. package/out/decoder.d.ts +1 -0
  139. package/out/decoder.d.ts.map +1 -1
  140. package/out/decoder.js +1 -0
  141. package/out/decoder.js.map +1 -1
  142. package/out/env/schema.d.ts +1 -0
  143. package/out/env/schema.d.ts.map +1 -1
  144. package/out/env/schema.js +4 -0
  145. package/out/env/schema.js.map +1 -1
  146. package/out/env.d.ts +1 -0
  147. package/out/env.d.ts.map +1 -1
  148. package/out/fs/deflate64.js +1 -1
  149. package/out/fs/deflate64.js.map +1 -1
  150. package/out/fs/lock.d.ts +73 -4
  151. package/out/fs/lock.d.ts.map +1 -1
  152. package/out/fs/lock.js +96 -19
  153. package/out/fs/lock.js.map +1 -1
  154. package/out/fs/readers.js +1 -1
  155. package/out/fs/readers.js.map +1 -1
  156. package/out/fs/writers.d.ts +1 -1
  157. package/out/fs/writers.d.ts.map +1 -1
  158. package/out/fs/writers.js +1 -1
  159. package/out/fs/writers.js.map +1 -1
  160. package/out/geocode/result.d.ts +25 -1
  161. package/out/geocode/result.d.ts.map +1 -1
  162. package/out/geocode/result.js +49 -6
  163. package/out/geocode/result.js.map +1 -1
  164. package/out/html/text.js +2 -2
  165. package/out/html/trust-policies.d.ts.map +1 -0
  166. package/out/html/trust-policies.js.map +1 -0
  167. package/out/index.d.ts +0 -1
  168. package/out/index.d.ts.map +1 -1
  169. package/out/index.js +0 -1
  170. package/out/index.js.map +1 -1
  171. package/out/layers/artifact.js +2 -2
  172. package/out/layers/artifact.js.map +1 -1
  173. package/out/layers/coverage.d.ts.map +1 -1
  174. package/out/layers/coverage.js +1 -1
  175. package/out/layers/coverage.js.map +1 -1
  176. package/out/layers/manifest.d.ts +53 -0
  177. package/out/layers/manifest.d.ts.map +1 -1
  178. package/out/layers/manifest.js +68 -2
  179. package/out/layers/manifest.js.map +1 -1
  180. package/out/layers/provenance.d.ts +127 -0
  181. package/out/layers/provenance.d.ts.map +1 -0
  182. package/out/layers/provenance.js +122 -0
  183. package/out/layers/provenance.js.map +1 -0
  184. package/out/layers/publication.d.ts.map +1 -1
  185. package/out/layers/publication.js +3 -3
  186. package/out/layers/publication.js.map +1 -1
  187. package/out/layers/selection.d.ts.map +1 -1
  188. package/out/layers/selection.js +2 -2
  189. package/out/layers/selection.js.map +1 -1
  190. package/out/license/branch.d.ts +33 -0
  191. package/out/license/branch.d.ts.map +1 -0
  192. package/out/license/branch.js +52 -0
  193. package/out/license/branch.js.map +1 -0
  194. package/out/license/configured.d.ts +1 -1
  195. package/out/license/configured.d.ts.map +1 -1
  196. package/out/license/configured.js +1 -9
  197. package/out/license/configured.js.map +1 -1
  198. package/out/license/declaration.d.ts +1 -1
  199. package/out/license/declaration.d.ts.map +1 -1
  200. package/out/license/key/file.js +1 -1
  201. package/out/license/key/file.js.map +1 -1
  202. package/out/license/key.d.ts +27 -115
  203. package/out/license/key.d.ts.map +1 -1
  204. package/out/license/key.js +98 -164
  205. package/out/license/key.js.map +1 -1
  206. package/out/license/provenance.d.ts +47 -0
  207. package/out/license/provenance.d.ts.map +1 -0
  208. package/out/license/provenance.js +134 -0
  209. package/out/license/provenance.js.map +1 -0
  210. package/out/license/register.d.ts +6 -47
  211. package/out/license/register.d.ts.map +1 -1
  212. package/out/license/register.js +7 -58
  213. package/out/license/register.js.map +1 -1
  214. package/out/license/stamp.d.ts +7 -1
  215. package/out/license/stamp.d.ts.map +1 -1
  216. package/out/license/stamp.js +2 -2
  217. package/out/license/stamp.js.map +1 -1
  218. package/out/license/text-url.d.ts +9 -0
  219. package/out/license/text-url.d.ts.map +1 -0
  220. package/out/license/text-url.js +49 -0
  221. package/out/license/text-url.js.map +1 -0
  222. package/out/license/training.d.ts +29 -0
  223. package/out/license/training.d.ts.map +1 -0
  224. package/out/license/training.js +52 -0
  225. package/out/license/training.js.map +1 -0
  226. package/out/license.d.ts +7 -6
  227. package/out/license.d.ts.map +1 -1
  228. package/out/license.js +7 -6
  229. package/out/license.js.map +1 -1
  230. package/out/locale/registry.d.ts.map +1 -1
  231. package/out/locale/registry.js +1 -1
  232. package/out/locale/registry.js.map +1 -1
  233. package/out/locale/zh-cn-units.js +1 -1
  234. package/out/locale/zh-cn-units.js.map +1 -1
  235. package/out/math/numeric.d.ts.map +1 -0
  236. package/out/math/numeric.js.map +1 -0
  237. package/out/math/random.d.ts.map +1 -0
  238. package/out/math/random.js.map +1 -0
  239. package/out/math/stats.d.ts.map +1 -0
  240. package/out/math/stats.js.map +1 -0
  241. package/out/module/workspace.js +1 -1
  242. package/out/module/workspace.js.map +1 -1
  243. package/out/network/routing.d.ts.map +1 -0
  244. package/out/{routing.js → network/routing.js} +1 -1
  245. package/out/network/routing.js.map +1 -0
  246. package/out/pipeline/result.d.ts +7 -25
  247. package/out/pipeline/result.d.ts.map +1 -1
  248. package/out/pipeline/runtime-pipeline.d.ts +8 -4
  249. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  250. package/out/pipeline/runtime-pipeline.js +56 -109
  251. package/out/pipeline/runtime-pipeline.js.map +1 -1
  252. package/out/pipeline/stage.d.ts +180 -0
  253. package/out/pipeline/stage.d.ts.map +1 -0
  254. package/out/pipeline/stage.js +130 -0
  255. package/out/pipeline/stage.js.map +1 -0
  256. package/out/pipeline/types.d.ts +146 -20
  257. package/out/pipeline/types.d.ts.map +1 -1
  258. package/out/pipeline/types.js +24 -8
  259. package/out/pipeline/types.js.map +1 -1
  260. package/out/pipeline.d.ts +5 -3
  261. package/out/pipeline.d.ts.map +1 -1
  262. package/out/pipeline.js +2 -1
  263. package/out/pipeline.js.map +1 -1
  264. package/out/{git.d.ts → repo/git.d.ts} +10 -1
  265. package/out/repo/git.d.ts.map +1 -0
  266. package/out/{git.js → repo/git.js} +14 -1
  267. package/out/repo/git.js.map +1 -0
  268. package/out/{release-config.d.ts → repo/release-config.d.ts} +8 -0
  269. package/out/repo/release-config.d.ts.map +1 -0
  270. package/out/repo/release-config.js.map +1 -0
  271. package/out/{scope-config.d.ts → repo/scope-config.d.ts} +8 -23
  272. package/out/repo/scope-config.d.ts.map +1 -0
  273. package/out/{scope-config.js → repo/scope-config.js} +0 -17
  274. package/out/repo/scope-config.js.map +1 -0
  275. package/out/repo/spdx-header.d.ts.map +1 -0
  276. package/out/{spdx-header.js → repo/spdx-header.js} +7 -0
  277. package/out/repo/spdx-header.js.map +1 -0
  278. package/out/repo/vale.d.ts.map +1 -0
  279. package/out/repo/vale.js.map +1 -0
  280. package/out/repo/workspaces.d.ts.map +1 -0
  281. package/out/{workspaces.js → repo/workspaces.js} +1 -1
  282. package/out/repo/workspaces.js.map +1 -0
  283. package/out/resolver/lookup-types.d.ts +1 -1
  284. package/out/resolver/region-database-provider.d.ts +30 -0
  285. package/out/resolver/region-database-provider.d.ts.map +1 -1
  286. package/out/resolver/synthetic-id-ranges.d.ts +46 -4
  287. package/out/resolver/synthetic-id-ranges.d.ts.map +1 -1
  288. package/out/resolver/synthetic-id-ranges.js +66 -4
  289. package/out/resolver/synthetic-id-ranges.js.map +1 -1
  290. package/out/resolver/types.d.ts +201 -7
  291. package/out/resolver/types.d.ts.map +1 -1
  292. package/out/resolver/types.js +57 -0
  293. package/out/resolver/types.js.map +1 -1
  294. package/out/resolver.d.ts +3 -3
  295. package/out/resolver.d.ts.map +1 -1
  296. package/out/resolver.js +1 -1
  297. package/out/resolver.js.map +1 -1
  298. package/out/scripting/process.d.ts.map +1 -0
  299. package/out/scripting/process.js.map +1 -0
  300. package/out/scripting/workers.d.ts.map +1 -0
  301. package/out/scripting/workers.js.map +1 -0
  302. package/out/state-machine.d.ts +1 -1
  303. package/out/strings/python-json.d.ts +12 -1
  304. package/out/strings/python-json.d.ts.map +1 -1
  305. package/out/strings/python-json.js +9 -4
  306. package/out/strings/python-json.js.map +1 -1
  307. package/out/tokenization/Span.d.ts +11 -0
  308. package/out/tokenization/Span.d.ts.map +1 -1
  309. package/out/tokenization/Span.js.map +1 -1
  310. package/out/tools/build-deflate64-wasm.run.js +2 -2
  311. package/out/tools/build-deflate64-wasm.run.js.map +1 -1
  312. package/out/tools/coarse-placer/build/dataset.js +1 -1
  313. package/out/tools/coarse-placer/build/dataset.js.map +1 -1
  314. package/out/tools/coarse-placer/build/outlier/exposure.js +1 -1
  315. package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
  316. package/out/tools/coarse-placer/build/outlier/latin.d.ts.map +1 -1
  317. package/out/tools/coarse-placer/build/outlier/latin.js +5 -1
  318. package/out/tools/coarse-placer/build/outlier/latin.js.map +1 -1
  319. package/out/tools/coarse-placer/country-sets.d.ts +2 -2
  320. package/out/tools/coarse-placer/country-sets.js +2 -2
  321. package/out/tools/coarse-placer/outlier-rows.js +2 -2
  322. package/out/tools/coarse-placer/outlier-rows.js.map +1 -1
  323. package/out/tools/coarse-placer/train.js +1 -1
  324. package/out/tools/coarse-placer/train.js.map +1 -1
  325. package/out/tools/generate-language-types.js +2 -2
  326. package/out/tools/generate-language-types.js.map +1 -1
  327. package/out/tools/license/product-fixtures.run.d.ts +2 -0
  328. package/out/tools/license/product-fixtures.run.d.ts.map +1 -0
  329. package/out/tools/license/product-fixtures.run.js +350 -0
  330. package/out/tools/license/product-fixtures.run.js.map +1 -0
  331. package/out/utils/chunk-process.js +2 -2
  332. package/out/utils/chunk-process.js.map +1 -1
  333. package/out/utils/geodatabase-archive.js +1 -1
  334. package/out/utils/geodatabase-archive.js.map +1 -1
  335. package/out/utils/time.d.ts +46 -3
  336. package/out/utils/time.d.ts.map +1 -1
  337. package/out/utils/time.js +139 -6
  338. package/out/utils/time.js.map +1 -1
  339. package/out/utils.d.ts +4 -4
  340. package/out/utils.d.ts.map +1 -1
  341. package/out/utils.js +4 -4
  342. package/out/utils.js.map +1 -1
  343. package/out/values/identical.d.ts.map +1 -0
  344. package/out/values/identical.js.map +1 -0
  345. package/out/values/json.d.ts.map +1 -0
  346. package/out/values/json.js.map +1 -0
  347. package/out/values/objects.d.ts.map +1 -0
  348. package/out/values/objects.js.map +1 -0
  349. package/package.json +278 -243
  350. package/tools/build-deflate64-wasm.run.ts +2 -2
  351. package/tools/coarse-placer/build/dataset.ts +1 -1
  352. package/tools/coarse-placer/build/outlier/exposure.ts +1 -1
  353. package/tools/coarse-placer/build/outlier/latin.ts +5 -1
  354. package/tools/coarse-placer/country-sets.ts +2 -2
  355. package/tools/coarse-placer/outlier-rows.ts +2 -2
  356. package/tools/coarse-placer/train.ts +1 -1
  357. package/tools/generate-language-types.ts +2 -2
  358. package/tools/license/product-fixtures.run.ts +449 -0
  359. package/lib/collections.ts +0 -5
  360. package/lib/license/decision.ts +0 -329
  361. package/lib/license/obligations.ts +0 -256
  362. package/lib/license/record.ts +0 -277
  363. package/lib/scripting/ingest-chunk-script.ts +0 -87
  364. package/out/binary-frame.d.ts.map +0 -1
  365. package/out/binary-frame.js.map +0 -1
  366. package/out/collections.d.ts +0 -2
  367. package/out/collections.d.ts.map +0 -1
  368. package/out/collections.js +0 -5
  369. package/out/collections.js.map +0 -1
  370. package/out/git.d.ts.map +0 -1
  371. package/out/git.js.map +0 -1
  372. package/out/hash.d.ts.map +0 -1
  373. package/out/hash.js.map +0 -1
  374. package/out/identical.d.ts.map +0 -1
  375. package/out/identical.js.map +0 -1
  376. package/out/json.d.ts.map +0 -1
  377. package/out/json.js.map +0 -1
  378. package/out/license/decision.d.ts +0 -179
  379. package/out/license/decision.d.ts.map +0 -1
  380. package/out/license/decision.js +0 -169
  381. package/out/license/decision.js.map +0 -1
  382. package/out/license/obligations.d.ts +0 -102
  383. package/out/license/obligations.d.ts.map +0 -1
  384. package/out/license/obligations.js +0 -188
  385. package/out/license/obligations.js.map +0 -1
  386. package/out/license/record.d.ts +0 -136
  387. package/out/license/record.d.ts.map +0 -1
  388. package/out/license/record.js +0 -222
  389. package/out/license/record.js.map +0 -1
  390. package/out/load-ledger.d.ts.map +0 -1
  391. package/out/load-ledger.js.map +0 -1
  392. package/out/memoize.d.ts.map +0 -1
  393. package/out/memoize.js.map +0 -1
  394. package/out/numeric.d.ts.map +0 -1
  395. package/out/numeric.js.map +0 -1
  396. package/out/objects.d.ts.map +0 -1
  397. package/out/objects.js.map +0 -1
  398. package/out/overture-pins.d.ts.map +0 -1
  399. package/out/overture-pins.js.map +0 -1
  400. package/out/postcode-prefix-files.d.ts.map +0 -1
  401. package/out/postcode-prefix-files.js.map +0 -1
  402. package/out/process.d.ts.map +0 -1
  403. package/out/process.js.map +0 -1
  404. package/out/promises.d.ts.map +0 -1
  405. package/out/promises.js.map +0 -1
  406. package/out/random.d.ts.map +0 -1
  407. package/out/random.js.map +0 -1
  408. package/out/release-config.d.ts.map +0 -1
  409. package/out/release-config.js.map +0 -1
  410. package/out/routing.d.ts.map +0 -1
  411. package/out/routing.js.map +0 -1
  412. package/out/scope-config.d.ts.map +0 -1
  413. package/out/scope-config.js.map +0 -1
  414. package/out/scripting/ingest-chunk-script.d.ts +0 -58
  415. package/out/scripting/ingest-chunk-script.d.ts.map +0 -1
  416. package/out/scripting/ingest-chunk-script.js +0 -47
  417. package/out/scripting/ingest-chunk-script.js.map +0 -1
  418. package/out/spdx-header.d.ts.map +0 -1
  419. package/out/spdx-header.js.map +0 -1
  420. package/out/stats.d.ts.map +0 -1
  421. package/out/stats.js.map +0 -1
  422. package/out/trust-policies.d.ts.map +0 -1
  423. package/out/trust-policies.js.map +0 -1
  424. package/out/vale.d.ts.map +0 -1
  425. package/out/vale.js.map +0 -1
  426. package/out/workers.d.ts.map +0 -1
  427. package/out/workers.js.map +0 -1
  428. package/out/workspaces.d.ts.map +0 -1
  429. package/out/workspaces.js.map +0 -1
  430. /package/lib/{load-ledger.ts → asset/load-ledger.ts} +0 -0
  431. /package/lib/{overture-pins.ts → asset/overture-pins.ts} +0 -0
  432. /package/lib/{postcode-prefix-files.ts → asset/postcode-prefix-files.ts} +0 -0
  433. /package/lib/{hash.ts → crypto/hash.ts} +0 -0
  434. /package/lib/{trust-policies.ts → html/trust-policies.ts} +0 -0
  435. /package/lib/{numeric.ts → math/numeric.ts} +0 -0
  436. /package/lib/{random.ts → math/random.ts} +0 -0
  437. /package/lib/{stats.ts → math/stats.ts} +0 -0
  438. /package/lib/{vale.ts → repo/vale.ts} +0 -0
  439. /package/lib/{process.ts → scripting/process.ts} +0 -0
  440. /package/lib/{workers.ts → scripting/workers.ts} +0 -0
  441. /package/lib/{identical.ts → values/identical.ts} +0 -0
  442. /package/lib/{json.ts → values/json.ts} +0 -0
  443. /package/lib/{objects.ts → values/objects.ts} +0 -0
  444. /package/out/{binary-frame.d.ts → asset/binary-frame.d.ts} +0 -0
  445. /package/out/{load-ledger.d.ts → asset/load-ledger.d.ts} +0 -0
  446. /package/out/{load-ledger.js → asset/load-ledger.js} +0 -0
  447. /package/out/{overture-pins.d.ts → asset/overture-pins.d.ts} +0 -0
  448. /package/out/{overture-pins.js → asset/overture-pins.js} +0 -0
  449. /package/out/{postcode-prefix-files.d.ts → asset/postcode-prefix-files.d.ts} +0 -0
  450. /package/out/{postcode-prefix-files.js → asset/postcode-prefix-files.js} +0 -0
  451. /package/out/{memoize.d.ts → async/memoize.d.ts} +0 -0
  452. /package/out/{hash.d.ts → crypto/hash.d.ts} +0 -0
  453. /package/out/{hash.js → crypto/hash.js} +0 -0
  454. /package/out/{trust-policies.d.ts → html/trust-policies.d.ts} +0 -0
  455. /package/out/{trust-policies.js → html/trust-policies.js} +0 -0
  456. /package/out/{numeric.d.ts → math/numeric.d.ts} +0 -0
  457. /package/out/{numeric.js → math/numeric.js} +0 -0
  458. /package/out/{random.d.ts → math/random.d.ts} +0 -0
  459. /package/out/{random.js → math/random.js} +0 -0
  460. /package/out/{stats.d.ts → math/stats.d.ts} +0 -0
  461. /package/out/{stats.js → math/stats.js} +0 -0
  462. /package/out/{routing.d.ts → network/routing.d.ts} +0 -0
  463. /package/out/{release-config.js → repo/release-config.js} +0 -0
  464. /package/out/{spdx-header.d.ts → repo/spdx-header.d.ts} +0 -0
  465. /package/out/{vale.d.ts → repo/vale.d.ts} +0 -0
  466. /package/out/{vale.js → repo/vale.js} +0 -0
  467. /package/out/{workspaces.d.ts → repo/workspaces.d.ts} +0 -0
  468. /package/out/{process.d.ts → scripting/process.d.ts} +0 -0
  469. /package/out/{process.js → scripting/process.js} +0 -0
  470. /package/out/{workers.d.ts → scripting/workers.d.ts} +0 -0
  471. /package/out/{workers.js → scripting/workers.js} +0 -0
  472. /package/out/{identical.d.ts → values/identical.d.ts} +0 -0
  473. /package/out/{identical.js → values/identical.js} +0 -0
  474. /package/out/{json.d.ts → values/json.d.ts} +0 -0
  475. /package/out/{json.js → values/json.js} +0 -0
  476. /package/out/{objects.d.ts → values/objects.d.ts} +0 -0
  477. /package/out/{objects.js → values/objects.js} +0 -0
@@ -7,21 +7,29 @@
7
7
  */
8
8
 
9
9
  import type { ComponentTag } from "@mailwoman/codex/component"
10
- import type { NormalizedInputLite } from "@mailwoman/query-shape"
11
10
 
12
11
  import { isBareTreeOf } from "#decoder/tree/shape"
13
12
  import type { AddressNode, AddressTree } from "#decoder/types"
14
- import { errorMessage } from "#errors/schema"
15
- import type { PipelineFault, PipelineResult } from "#pipeline/result"
13
+ import type { PipelineResult } from "#pipeline/result"
14
+ import {
15
+ createRequestContext,
16
+ type PipelineFaultStage,
17
+ type PipelineStage,
18
+ type RequestContext,
19
+ runStage,
20
+ StageID,
21
+ type StageRecord,
22
+ } from "#pipeline/stage"
16
23
  import {
17
24
  DEFAULT_CASE_NORMALIZATION,
18
25
  DEFAULT_PLACER_COUNTRY_USE,
19
- PipelineFaultStage,
20
26
  WORD_CONSISTENCY_SHIP_DEFAULT,
21
27
  deriveInputMode,
28
+ isPostcodeFormat,
22
29
  } from "#pipeline/types"
23
30
  import type {
24
31
  AddressClassifier,
32
+ NormalizedInputLite,
25
33
  CaseNormalization,
26
34
  AnchorRegionLookupLike,
27
35
  FSTMatcherLike,
@@ -49,13 +57,6 @@ const SHORT_CIRCUIT_MIN_CONFIDENCE = 0.95
49
57
  */
50
58
  const SHORT_CIRCUIT_MAX_LOCALITY_LENGTH = 30
51
59
 
52
- /**
53
- * Reports whether a query-shape format name denotes a postcode.
54
- */
55
- function isPostcodeFormat(format: string): boolean {
56
- return format === "us_zip" || format === "us_zip4" || format.endsWith("_postcode")
57
- }
58
-
59
60
  /**
60
61
  * The default resolver weight for the coarse-placer country prior.
61
62
  */
@@ -269,35 +270,49 @@ function buildFastPathTree(text: string, kind: QueryKindResult, shape: QueryShap
269
270
  /**
270
271
  * Runs the configured stages in order and returns the decoded tree with per-stage timings and faults.
271
272
  *
273
+ * Each stage runs through {@linkcode runStage}, which times it and checks the abort signal before it.
272
274
  * A failing classifier, grouper or resolver records a fault and the run continues.
273
- * An aborted signal throws between stages.
275
+ *
276
+ * A caller that runs stages of its own around the parse passes its request's `context`.
277
+ * The result's timing and faults are then that context's, and the context's signal cancels the run.
278
+ * Without one, the run builds a context from `opts.signal`.
274
279
  */
275
- export async function runPipeline(
280
+ export async function runPipeline<FaultStage extends string = PipelineFaultStage>(
276
281
  raw: string,
277
282
  stages: RuntimePipelineStages,
278
- opts?: PipelineOpts
279
- ): Promise<PipelineResult> {
280
- const timing: Record<string, number> = {}
281
- const faults: PipelineFault[] = []
282
- const t0 = performance.now()
283
+ opts?: PipelineOpts,
284
+ context: RequestContext<StageRecord, FaultStage | PipelineFaultStage> = createRequestContext({
285
+ signal: opts?.signal,
286
+ })
287
+ ): Promise<PipelineResult<FaultStage | PipelineFaultStage>> {
288
+ const { timing, faults } = context
283
289
 
284
290
  const normalize = stages.normalize ?? identityNormalize
285
291
  const computeQueryShape = stages.computeQueryShape ?? emptyQueryShape
286
292
  const detectLocale = stages.detectLocale ?? defaultDetectLocale
287
293
  const classifyKind = stages.classifyKind ?? defaultClassifyKind
288
294
 
289
- throwIfAborted(opts)
290
- const normalized = rewriteLineBreaks(normalize(raw, { locale: opts?.locale }), opts?.lineBreaks ?? "keep")
291
- timing["normalize"] = performance.now() - t0
295
+ const normalized = await runStage(
296
+ {
297
+ id: StageID.Normalize,
298
+ run: (text: string) => rewriteLineBreaks(normalize(text, { locale: opts?.locale }), opts?.lineBreaks ?? "keep"),
299
+ },
300
+ raw,
301
+ context
302
+ )
292
303
 
293
304
  // The coarse placer adds a country prior unless the caller already supplied one.
294
305
  let effectiveOpts = opts
295
306
  let placerAnchorApplied = false
296
307
 
297
308
  if (stages.placeCountry) {
298
- const tPlace = performance.now()
299
- const placed = stages.placeCountry(normalized.normalized)
300
- timing["place-country"] = performance.now() - tPlace
309
+ const placeCountry = stages.placeCountry
310
+
311
+ const placed = await runStage(
312
+ { id: StageID.PlaceCountry, run: (text: string) => placeCountry(text) },
313
+ normalized.normalized,
314
+ context
315
+ )
301
316
 
302
317
  if (placed.country && placed.country !== "OTHER" && !opts?.resolveOpts?.anchorPosterior) {
303
318
  const hardCountry = hardCountryFor(
@@ -325,30 +340,39 @@ export async function runPipeline(
325
340
  }
326
341
  }
327
342
 
328
- throwIfAborted(opts)
329
- const tQs = performance.now()
330
- const queryShape = computeQueryShape(normalized, { locale: opts?.locale })
331
- timing["query-shape"] = performance.now() - tQs
332
-
333
- throwIfAborted(opts)
334
- const tLocale = performance.now()
335
- const locale = await detectLocale(normalized, queryShape, { hint: opts?.locale })
336
- timing["locale-hint"] = performance.now() - tLocale
343
+ const queryShape = await runStage(
344
+ { id: StageID.QueryShape, run: (input: NormalizedInputLite) => computeQueryShape(input) },
345
+ normalized,
346
+ context
347
+ )
348
+
349
+ const locale = await runStage(
350
+ {
351
+ id: StageID.LocaleHint,
352
+ run: (input: NormalizedInputLite) => detectLocale(input, queryShape, { hint: opts?.locale }),
353
+ },
354
+ normalized,
355
+ context
356
+ )
337
357
 
338
- throwIfAborted(opts)
339
- const tKind = performance.now()
340
- const kind = await classifyKind(normalized, queryShape, locale)
341
- timing["kind-classifier"] = performance.now() - tKind
358
+ const kind = await runStage(
359
+ { id: StageID.KindClassifier, run: (input: NormalizedInputLite) => classifyKind(input, queryShape, locale) },
360
+ normalized,
361
+ context
362
+ )
342
363
 
343
364
  const intentMarkers: QueryIntentMarker[] = [...(kind.intentMarkers ?? [])]
344
365
 
345
366
  // A POI-shaped query goes to the intent stage first.
346
367
  // A null result falls through to parsing.
347
368
  if ((kind.kind === "poi_query" || kind.kind === "poi_category") && stages.poiIntent) {
348
- throwIfAborted(opts)
349
- const tPoi = performance.now()
350
- const poiOutcome = await stages.poiIntent(normalized, locale, effectiveOpts)
351
- timing["poi-intent"] = performance.now() - tPoi
369
+ const poiIntent = stages.poiIntent
370
+
371
+ const poiOutcome = await runStage(
372
+ { id: StageID.POIIntent, run: (input: NormalizedInputLite) => poiIntent(input, locale, effectiveOpts) },
373
+ normalized,
374
+ context
375
+ )
352
376
 
353
377
  if (poiOutcome) {
354
378
  const emptyTree: AddressTree = { raw: normalized.normalized, roots: [] }
@@ -375,10 +399,7 @@ export async function runPipeline(
375
399
  let tree = buildFastPathTree(normalized.normalized, kind, queryShape)
376
400
 
377
401
  if (stages.resolver) {
378
- throwIfAborted(opts)
379
- const tResolve = performance.now()
380
- tree = await safeResolve(faults, stages.resolver, tree, effectiveOpts)
381
- timing["resolve"] = performance.now() - tResolve
402
+ tree = await runStage(resolveStage(stages.resolver, effectiveOpts), tree, context)
382
403
  }
383
404
 
384
405
  return {
@@ -400,50 +421,57 @@ export async function runPipeline(
400
421
  let phraseProposals: PhraseProposal[] = []
401
422
 
402
423
  if (stages.groupPhrases) {
403
- throwIfAborted(opts)
404
- const tGroup = performance.now()
405
- phraseProposals = await safeGroupPhrases(faults, stages.groupPhrases, normalized, queryShape, locale)
406
- timing["phrase-grouper"] = performance.now() - tGroup
424
+ const groupPhrases = stages.groupPhrases
425
+
426
+ phraseProposals = await runStage(
427
+ {
428
+ id: StageID.PhraseGrouper,
429
+ run: (input: NormalizedInputLite) => groupPhrases(input, queryShape, locale),
430
+ recover: (): PhraseProposal[] => [],
431
+ },
432
+ normalized,
433
+ context
434
+ )
407
435
  }
408
436
 
409
437
  let tree: AddressTree = { raw: normalized.normalized, roots: [] }
410
438
 
411
439
  if (stages.classifier) {
412
- throwIfAborted(opts)
413
- const tClassify = performance.now()
414
-
415
- tree = await safeClassify(faults, stages.classifier, normalized.normalized, queryShape, {
416
- fst: stages.fst ?? null,
417
- caseNormalization: opts?.caseNormalization ?? DEFAULT_CASE_NORMALIZATION,
418
- placetypePair: opts?.placetypePair ?? "inherit",
419
- streetMorphology: stages.streetMorphology ?? null,
420
- streetMorphologyPrior: stages.streetMorphologyPrior ?? false,
421
- anchorRegions: stages.anchorRegions ?? null,
422
- venueHead: stages.venueHead?.(locale) ?? null,
423
- inputMode: deriveInputMode(opts?.inputMode ?? "auto", kind.kind),
424
- localeHint: opts?.localeHint ?? null,
425
- })
426
-
427
- timing["token-classify"] = performance.now() - tClassify
440
+ tree = await runStage(
441
+ classifyStage(stages.classifier, queryShape, {
442
+ fst: stages.fst ?? null,
443
+ caseNormalization: opts?.caseNormalization ?? DEFAULT_CASE_NORMALIZATION,
444
+ placetypePair: opts?.placetypePair ?? "inherit",
445
+ streetMorphology: stages.streetMorphology ?? null,
446
+ streetMorphologyPrior: stages.streetMorphologyPrior ?? false,
447
+ anchorRegions: stages.anchorRegions ?? null,
448
+ venueHead: stages.venueHead?.(locale) ?? null,
449
+ inputMode: deriveInputMode(opts?.inputMode ?? "auto", kind.kind),
450
+ localeHint: opts?.localeHint ?? null,
451
+ }),
452
+ normalized.normalized,
453
+ context
454
+ )
428
455
  }
429
456
 
430
457
  if (phraseProposals.length && tree.roots.length >= 0) {
431
- const tAudit = performance.now()
432
- tree = grouperAudit(tree, phraseProposals, normalized.normalized)
433
- timing["grouper-audit"] = performance.now() - tAudit
458
+ tree = await runStage(
459
+ {
460
+ id: StageID.GrouperAudit,
461
+ run: (decoded: AddressTree) => grouperAudit(decoded, phraseProposals, normalized.normalized),
462
+ },
463
+ tree,
464
+ context
465
+ )
434
466
  }
435
467
 
436
468
  if (stages.resolver) {
437
- throwIfAborted(opts)
438
- const tResolve = performance.now()
439
-
440
469
  // A bare locality or postcode query resolves without the placer's prior.
441
470
  if (placerAnchorApplied && (isBareLocalityTree(tree) || isBarePostcodeTree(tree))) {
442
471
  effectiveOpts = opts
443
472
  }
444
473
 
445
- tree = await safeResolve(faults, stages.resolver, tree, effectiveOpts)
446
- timing["resolve"] = performance.now() - tResolve
474
+ tree = await runStage(resolveStage(stages.resolver, effectiveOpts), tree, context)
447
475
  }
448
476
 
449
477
  return {
@@ -463,36 +491,12 @@ export async function runPipeline(
463
491
  }
464
492
 
465
493
  /**
466
- * Throws the signal's abort reason.
494
+ * The stage that runs the classifier over the normalized text.
467
495
  *
468
- * The pipeline checks between stages, so a running stage finishes first.
469
- */
470
- function throwIfAborted(opts?: PipelineOpts): void {
471
- if (opts?.signal?.aborted) {
472
- throw opts.signal.reason ?? new DOMException("Pipeline aborted", "AbortError")
473
- }
474
- }
475
-
476
- /**
477
- * Records a stage failure so callers can tell degraded output from a clean result.
478
- */
479
- function recordFault(faults: PipelineFault[], stage: PipelineFaultStage, cause: unknown): void {
480
- faults.push({
481
- stage,
482
- name: cause instanceof Error ? cause.name : "Error",
483
- message: errorMessage(cause),
484
- cause,
485
- })
486
- }
487
-
488
- /**
489
- * Runs the classifier.
490
- * On failure it records a fault and returns an empty tree.
496
+ * When the classifier throws, the run continues with an empty tree.
491
497
  */
492
- async function safeClassify(
493
- faults: PipelineFault[],
498
+ function classifyStage(
494
499
  classifier: AddressClassifier,
495
- text: string,
496
500
  queryShape: QueryShapeLite,
497
501
  knobs: {
498
502
  fst: FSTMatcherLike | null
@@ -505,7 +509,7 @@ async function safeClassify(
505
509
  inputMode: InputMode
506
510
  localeHint: string | null
507
511
  }
508
- ): Promise<AddressTree> {
512
+ ): PipelineStage<string, AddressTree> {
509
513
  const {
510
514
  fst,
511
515
  caseNormalization,
@@ -518,25 +522,24 @@ async function safeClassify(
518
522
  localeHint,
519
523
  } = knobs
520
524
 
521
- try {
522
- return await classifier.parse(text, {
523
- queryShape,
524
- inputMode,
525
- ...(localeHint ? { localeHint } : {}),
526
- fst,
527
- postcodeRepair: true,
528
- caseNormalization,
529
- enforceWordConsistency: WORD_CONSISTENCY_SHIP_DEFAULT,
530
- placetypePair,
531
- ...streetContextRequirementFor({ fst, streetMorphology }, { streetMorphologyPrior }),
532
- ...(fst && anchorRegions ? { anchorRegions } : {}),
533
- ...(venueHead ? { venueHead: venueHead.venueHead } : {}),
534
- ...(venueHead?.venueHeadOpts ? { venueHeadOpts: venueHead.venueHeadOpts } : {}),
535
- })
536
- } catch (error) {
537
- recordFault(faults, PipelineFaultStage.Classifier, error)
538
-
539
- return { raw: text, roots: [] }
525
+ return {
526
+ id: StageID.TokenClassify,
527
+ run: (text) =>
528
+ classifier.parse(text, {
529
+ queryShape,
530
+ inputMode,
531
+ ...(localeHint ? { localeHint } : {}),
532
+ fst,
533
+ postcodeRepair: true,
534
+ caseNormalization,
535
+ enforceWordConsistency: WORD_CONSISTENCY_SHIP_DEFAULT,
536
+ placetypePair,
537
+ ...streetContextRequirementFor({ fst, streetMorphology }, { streetMorphologyPrior }),
538
+ ...(fst && anchorRegions ? { anchorRegions } : {}),
539
+ ...(venueHead ? { venueHead: venueHead.venueHead } : {}),
540
+ ...(venueHead?.venueHeadOpts ? { venueHeadOpts: venueHead.venueHeadOpts } : {}),
541
+ }),
542
+ recover: (text) => ({ raw: text, roots: [] }),
540
543
  }
541
544
  }
542
545
 
@@ -591,26 +594,6 @@ export function streetContextRequirementFor(
591
594
  : {}
592
595
  }
593
596
 
594
- /**
595
- * Runs the phrase grouper.
596
- * On failure it records a fault and returns no proposals.
597
- */
598
- async function safeGroupPhrases(
599
- faults: PipelineFault[],
600
- groupPhrases: NonNullable<RuntimePipelineStages["groupPhrases"]>,
601
- normalized: NormalizedInputLite,
602
- shape: QueryShapeLite,
603
- locale: LocaleHint
604
- ): Promise<PhraseProposal[]> {
605
- try {
606
- return await groupPhrases(normalized, shape, locale)
607
- } catch (error) {
608
- recordFault(faults, PipelineFaultStage.PhraseGrouper, error)
609
-
610
- return []
611
- }
612
- }
613
-
614
597
  // MARK: Grouper-audit pass
615
598
 
616
599
  /**
@@ -687,21 +670,17 @@ export function grouperAudit(tree: AddressTree, proposals: PhraseProposal[], tex
687
670
  }
688
671
 
689
672
  /**
690
- * Runs the resolver.
673
+ * The stage that resolves the decoded tree.
691
674
  *
692
- * On failure it records a fault and returns the unresolved tree.
675
+ * When the resolver throws, the run continues with the unresolved tree.
693
676
  */
694
- async function safeResolve(
695
- faults: PipelineFault[],
677
+ function resolveStage(
696
678
  resolver: NonNullable<RuntimePipelineStages["resolver"]>,
697
- tree: AddressTree,
698
679
  opts?: PipelineOpts
699
- ): Promise<AddressTree> {
700
- try {
701
- return await resolver.resolveTree(tree, opts?.resolveOpts)
702
- } catch (error) {
703
- recordFault(faults, PipelineFaultStage.Resolver, error)
704
-
705
- return tree
680
+ ): PipelineStage<AddressTree, AddressTree> {
681
+ return {
682
+ id: StageID.Resolve,
683
+ run: (tree) => resolver.resolveTree(tree, opts?.resolveOpts),
684
+ recover: (tree) => tree,
706
685
  }
707
686
  }