@mailwoman/core 11.2.0 → 11.4.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 (463) hide show
  1. package/README.md +2 -2
  2. package/lib/api/ckan.ts +1 -1
  3. package/lib/api/disk-storage.ts +2 -2
  4. package/lib/api/ogc.ts +1 -1
  5. package/lib/api/retry.ts +7 -2
  6. package/lib/api/test/transport.ts +1 -1
  7. package/lib/{binary-frame.ts → asset/binary-frame.ts} +1 -1
  8. package/lib/async/abort.ts +100 -0
  9. package/lib/{memoize.ts → async/memoize.ts} +2 -2
  10. package/lib/{promises.ts → async/promises.ts} +1 -1
  11. package/lib/cloudflare/tokens.ts +1 -1
  12. package/lib/cloudflare/wrangler.ts +3 -3
  13. package/lib/crypto/digest.ts +1 -1
  14. package/lib/crypto/ed25519.ts +8 -0
  15. package/lib/{hash.ts → crypto/hash.ts} +16 -1
  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 +19 -6
  20. package/lib/decoder/types.ts +9 -1
  21. package/lib/env/schema.ts +5 -0
  22. package/lib/fs/deflate64.ts +1 -1
  23. package/lib/fs/lock.ts +183 -25
  24. package/lib/fs/readers.ts +1 -1
  25. package/lib/fs/writers.ts +18 -1
  26. package/lib/geocode/result.ts +50 -6
  27. package/lib/html/text.ts +2 -2
  28. package/lib/index.ts +0 -1
  29. package/lib/layers/artifact.ts +2 -2
  30. package/lib/layers/coverage.ts +1 -1
  31. package/lib/layers/manifest.ts +94 -2
  32. package/lib/layers/provenance.ts +246 -0
  33. package/lib/layers/publication.ts +4 -3
  34. package/lib/layers/selection.ts +2 -2
  35. package/lib/license/branch.ts +66 -0
  36. package/lib/license/configured.ts +4 -2
  37. package/lib/license/declaration.ts +1 -1
  38. package/lib/license/key/file.ts +1 -1
  39. package/lib/license/key.ts +148 -201
  40. package/lib/license/provenance.ts +193 -0
  41. package/lib/license/register.ts +7 -78
  42. package/lib/license/stamp.ts +8 -2
  43. package/lib/license/text-url.ts +55 -0
  44. package/lib/license/training.ts +67 -0
  45. package/lib/license.ts +7 -6
  46. package/lib/locale/registry.ts +1 -1
  47. package/lib/locale/zh-cn-units.ts +1 -1
  48. package/lib/module/workspace.ts +1 -1
  49. package/lib/{routing.ts → network/routing.ts} +1 -1
  50. package/lib/pipeline/result.ts +6 -25
  51. package/lib/pipeline/runtime-pipeline.ts +129 -144
  52. package/lib/pipeline/stage.ts +290 -0
  53. package/lib/pipeline/types.ts +33 -14
  54. package/lib/pipeline.ts +14 -2
  55. package/lib/{git.ts → repo/git.ts} +21 -1
  56. package/lib/{release-config.ts → repo/release-config.ts} +8 -0
  57. package/lib/{spdx-header.ts → repo/spdx-header.ts} +8 -0
  58. package/lib/{workspaces.ts → repo/workspaces.ts} +1 -1
  59. package/lib/resolver/lookup-types.ts +1 -1
  60. package/lib/resolver/region-database-provider.ts +33 -0
  61. package/lib/resolver/synthetic-id-ranges.ts +19 -9
  62. package/lib/resolver/types.ts +220 -7
  63. package/lib/resolver.ts +14 -1
  64. package/lib/state-machine.ts +1 -1
  65. package/lib/strings/python-json.ts +3 -2
  66. package/lib/utils/chunk-process.ts +2 -2
  67. package/lib/utils/geodatabase-archive.ts +1 -1
  68. package/lib/utils/time.ts +136 -12
  69. package/lib/utils.ts +4 -4
  70. package/out/api/ckan.js +1 -1
  71. package/out/api/ckan.js.map +1 -1
  72. package/out/api/disk-storage.d.ts.map +1 -1
  73. package/out/api/disk-storage.js +2 -2
  74. package/out/api/disk-storage.js.map +1 -1
  75. package/out/api/ogc.js +1 -1
  76. package/out/api/ogc.js.map +1 -1
  77. package/out/api/retry.d.ts.map +1 -1
  78. package/out/api/retry.js +6 -2
  79. package/out/api/retry.js.map +1 -1
  80. package/out/api/test/transport.js +1 -1
  81. package/out/api/test/transport.js.map +1 -1
  82. package/out/asset/binary-frame.d.ts.map +1 -0
  83. package/out/{binary-frame.js → asset/binary-frame.js} +1 -1
  84. package/out/asset/binary-frame.js.map +1 -0
  85. package/out/asset/load-ledger.d.ts.map +1 -0
  86. package/out/asset/load-ledger.js.map +1 -0
  87. package/out/asset/overture-pins.d.ts.map +1 -0
  88. package/out/asset/overture-pins.js.map +1 -0
  89. package/out/asset/postcode-prefix-files.d.ts.map +1 -0
  90. package/out/asset/postcode-prefix-files.js.map +1 -0
  91. package/out/async/abort.d.ts +57 -0
  92. package/out/async/abort.d.ts.map +1 -0
  93. package/out/async/abort.js +89 -0
  94. package/out/async/abort.js.map +1 -0
  95. package/out/async/memoize.d.ts.map +1 -0
  96. package/out/{memoize.js → async/memoize.js} +2 -2
  97. package/out/async/memoize.js.map +1 -0
  98. package/out/{promises.d.ts → async/promises.d.ts} +1 -1
  99. package/out/async/promises.d.ts.map +1 -0
  100. package/out/{promises.js → async/promises.js} +1 -1
  101. package/out/async/promises.js.map +1 -0
  102. package/out/cloudflare/tokens.js +1 -1
  103. package/out/cloudflare/tokens.js.map +1 -1
  104. package/out/cloudflare/wrangler.js +3 -3
  105. package/out/cloudflare/wrangler.js.map +1 -1
  106. package/out/crypto/digest.d.ts +1 -1
  107. package/out/crypto/digest.js +1 -1
  108. package/out/crypto/ed25519.d.ts +7 -0
  109. package/out/crypto/ed25519.d.ts.map +1 -1
  110. package/out/crypto/ed25519.js +7 -0
  111. package/out/crypto/ed25519.js.map +1 -1
  112. package/out/{hash.d.ts → crypto/hash.d.ts} +12 -0
  113. package/out/crypto/hash.d.ts.map +1 -0
  114. package/out/{hash.js → crypto/hash.js} +15 -1
  115. package/out/crypto/hash.js.map +1 -0
  116. package/out/crypto/node.js +1 -1
  117. package/out/crypto/node.js.map +1 -1
  118. package/out/data-root.d.ts +11 -3
  119. package/out/data-root.d.ts.map +1 -1
  120. package/out/data-root.js +14 -3
  121. package/out/data-root.js.map +1 -1
  122. package/out/decoder/containment.d.ts.map +1 -1
  123. package/out/decoder/containment.js +1 -1
  124. package/out/decoder/containment.js.map +1 -1
  125. package/out/decoder/serialize/outline.d.ts +9 -0
  126. package/out/decoder/serialize/outline.d.ts.map +1 -1
  127. package/out/decoder/serialize/outline.js +16 -6
  128. package/out/decoder/serialize/outline.js.map +1 -1
  129. package/out/decoder/types.d.ts +8 -0
  130. package/out/decoder/types.d.ts.map +1 -1
  131. package/out/decoder/types.js +1 -1
  132. package/out/decoder/types.js.map +1 -1
  133. package/out/env/schema.d.ts +1 -0
  134. package/out/env/schema.d.ts.map +1 -1
  135. package/out/env/schema.js +4 -0
  136. package/out/env/schema.js.map +1 -1
  137. package/out/env.d.ts +1 -0
  138. package/out/env.d.ts.map +1 -1
  139. package/out/fs/deflate64.js +1 -1
  140. package/out/fs/deflate64.js.map +1 -1
  141. package/out/fs/lock.d.ts +73 -4
  142. package/out/fs/lock.d.ts.map +1 -1
  143. package/out/fs/lock.js +96 -19
  144. package/out/fs/lock.js.map +1 -1
  145. package/out/fs/readers.js +1 -1
  146. package/out/fs/readers.js.map +1 -1
  147. package/out/fs/writers.d.ts +9 -1
  148. package/out/fs/writers.d.ts.map +1 -1
  149. package/out/fs/writers.js +15 -2
  150. package/out/fs/writers.js.map +1 -1
  151. package/out/geocode/result.d.ts +25 -1
  152. package/out/geocode/result.d.ts.map +1 -1
  153. package/out/geocode/result.js +49 -6
  154. package/out/geocode/result.js.map +1 -1
  155. package/out/html/text.js +2 -2
  156. package/out/html/trust-policies.d.ts.map +1 -0
  157. package/out/html/trust-policies.js.map +1 -0
  158. package/out/index.d.ts +0 -1
  159. package/out/index.d.ts.map +1 -1
  160. package/out/index.js +0 -1
  161. package/out/index.js.map +1 -1
  162. package/out/layers/artifact.js +2 -2
  163. package/out/layers/artifact.js.map +1 -1
  164. package/out/layers/coverage.d.ts.map +1 -1
  165. package/out/layers/coverage.js +1 -1
  166. package/out/layers/coverage.js.map +1 -1
  167. package/out/layers/manifest.d.ts +53 -0
  168. package/out/layers/manifest.d.ts.map +1 -1
  169. package/out/layers/manifest.js +68 -2
  170. package/out/layers/manifest.js.map +1 -1
  171. package/out/layers/provenance.d.ts +127 -0
  172. package/out/layers/provenance.d.ts.map +1 -0
  173. package/out/layers/provenance.js +122 -0
  174. package/out/layers/provenance.js.map +1 -0
  175. package/out/layers/publication.d.ts.map +1 -1
  176. package/out/layers/publication.js +3 -3
  177. package/out/layers/publication.js.map +1 -1
  178. package/out/layers/selection.d.ts.map +1 -1
  179. package/out/layers/selection.js +2 -2
  180. package/out/layers/selection.js.map +1 -1
  181. package/out/license/branch.d.ts +33 -0
  182. package/out/license/branch.d.ts.map +1 -0
  183. package/out/license/branch.js +52 -0
  184. package/out/license/branch.js.map +1 -0
  185. package/out/license/configured.d.ts +1 -1
  186. package/out/license/configured.d.ts.map +1 -1
  187. package/out/license/configured.js +1 -9
  188. package/out/license/configured.js.map +1 -1
  189. package/out/license/declaration.d.ts +1 -1
  190. package/out/license/declaration.d.ts.map +1 -1
  191. package/out/license/key/file.js +1 -1
  192. package/out/license/key/file.js.map +1 -1
  193. package/out/license/key.d.ts +27 -115
  194. package/out/license/key.d.ts.map +1 -1
  195. package/out/license/key.js +98 -164
  196. package/out/license/key.js.map +1 -1
  197. package/out/license/provenance.d.ts +47 -0
  198. package/out/license/provenance.d.ts.map +1 -0
  199. package/out/license/provenance.js +134 -0
  200. package/out/license/provenance.js.map +1 -0
  201. package/out/license/register.d.ts +6 -47
  202. package/out/license/register.d.ts.map +1 -1
  203. package/out/license/register.js +7 -58
  204. package/out/license/register.js.map +1 -1
  205. package/out/license/stamp.d.ts +7 -1
  206. package/out/license/stamp.d.ts.map +1 -1
  207. package/out/license/stamp.js +2 -2
  208. package/out/license/stamp.js.map +1 -1
  209. package/out/license/text-url.d.ts +9 -0
  210. package/out/license/text-url.d.ts.map +1 -0
  211. package/out/license/text-url.js +49 -0
  212. package/out/license/text-url.js.map +1 -0
  213. package/out/license/training.d.ts +29 -0
  214. package/out/license/training.d.ts.map +1 -0
  215. package/out/license/training.js +52 -0
  216. package/out/license/training.js.map +1 -0
  217. package/out/license.d.ts +7 -6
  218. package/out/license.d.ts.map +1 -1
  219. package/out/license.js +7 -6
  220. package/out/license.js.map +1 -1
  221. package/out/locale/registry.d.ts.map +1 -1
  222. package/out/locale/registry.js +1 -1
  223. package/out/locale/registry.js.map +1 -1
  224. package/out/locale/zh-cn-units.js +1 -1
  225. package/out/locale/zh-cn-units.js.map +1 -1
  226. package/out/math/numeric.d.ts.map +1 -0
  227. package/out/math/numeric.js.map +1 -0
  228. package/out/math/random.d.ts.map +1 -0
  229. package/out/math/random.js.map +1 -0
  230. package/out/math/stats.d.ts.map +1 -0
  231. package/out/math/stats.js.map +1 -0
  232. package/out/module/workspace.js +1 -1
  233. package/out/module/workspace.js.map +1 -1
  234. package/out/network/routing.d.ts.map +1 -0
  235. package/out/{routing.js → network/routing.js} +1 -1
  236. package/out/network/routing.js.map +1 -0
  237. package/out/pipeline/result.d.ts +7 -24
  238. package/out/pipeline/result.d.ts.map +1 -1
  239. package/out/pipeline/runtime-pipeline.d.ts +7 -2
  240. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  241. package/out/pipeline/runtime-pipeline.js +56 -103
  242. package/out/pipeline/runtime-pipeline.js.map +1 -1
  243. package/out/pipeline/stage.d.ts +180 -0
  244. package/out/pipeline/stage.d.ts.map +1 -0
  245. package/out/pipeline/stage.js +130 -0
  246. package/out/pipeline/stage.js.map +1 -0
  247. package/out/pipeline/types.d.ts +31 -12
  248. package/out/pipeline/types.d.ts.map +1 -1
  249. package/out/pipeline/types.js +0 -8
  250. package/out/pipeline/types.js.map +1 -1
  251. package/out/pipeline.d.ts +5 -3
  252. package/out/pipeline.d.ts.map +1 -1
  253. package/out/pipeline.js +2 -1
  254. package/out/pipeline.js.map +1 -1
  255. package/out/{git.d.ts → repo/git.d.ts} +10 -1
  256. package/out/repo/git.d.ts.map +1 -0
  257. package/out/{git.js → repo/git.js} +14 -1
  258. package/out/repo/git.js.map +1 -0
  259. package/out/{release-config.d.ts → repo/release-config.d.ts} +8 -0
  260. package/out/repo/release-config.d.ts.map +1 -0
  261. package/out/repo/release-config.js.map +1 -0
  262. package/out/repo/scope-config.d.ts.map +1 -0
  263. package/out/repo/scope-config.js.map +1 -0
  264. package/out/repo/spdx-header.d.ts.map +1 -0
  265. package/out/{spdx-header.js → repo/spdx-header.js} +7 -0
  266. package/out/repo/spdx-header.js.map +1 -0
  267. package/out/repo/vale.d.ts.map +1 -0
  268. package/out/repo/vale.js.map +1 -0
  269. package/out/repo/workspaces.d.ts.map +1 -0
  270. package/out/{workspaces.js → repo/workspaces.js} +1 -1
  271. package/out/repo/workspaces.js.map +1 -0
  272. package/out/resolver/lookup-types.d.ts +1 -1
  273. package/out/resolver/region-database-provider.d.ts +30 -0
  274. package/out/resolver/region-database-provider.d.ts.map +1 -1
  275. package/out/resolver/synthetic-id-ranges.d.ts +15 -8
  276. package/out/resolver/synthetic-id-ranges.d.ts.map +1 -1
  277. package/out/resolver/synthetic-id-ranges.js +18 -9
  278. package/out/resolver/synthetic-id-ranges.js.map +1 -1
  279. package/out/resolver/types.d.ts +192 -8
  280. package/out/resolver/types.d.ts.map +1 -1
  281. package/out/resolver/types.js +56 -0
  282. package/out/resolver/types.js.map +1 -1
  283. package/out/resolver.d.ts +3 -3
  284. package/out/resolver.d.ts.map +1 -1
  285. package/out/resolver.js +1 -1
  286. package/out/resolver.js.map +1 -1
  287. package/out/scripting/process.d.ts.map +1 -0
  288. package/out/scripting/process.js.map +1 -0
  289. package/out/scripting/workers.d.ts.map +1 -0
  290. package/out/scripting/workers.js.map +1 -0
  291. package/out/state-machine.d.ts +1 -1
  292. package/out/strings/python-json.d.ts +2 -1
  293. package/out/strings/python-json.d.ts.map +1 -1
  294. package/out/strings/python-json.js +1 -1
  295. package/out/strings/python-json.js.map +1 -1
  296. package/out/tools/build-deflate64-wasm.run.js +2 -2
  297. package/out/tools/build-deflate64-wasm.run.js.map +1 -1
  298. package/out/tools/coarse-placer/build/dataset.js +1 -1
  299. package/out/tools/coarse-placer/build/dataset.js.map +1 -1
  300. package/out/tools/coarse-placer/build/outlier/exposure.js +1 -1
  301. package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
  302. package/out/tools/coarse-placer/build/outlier/latin.d.ts.map +1 -1
  303. package/out/tools/coarse-placer/build/outlier/latin.js +5 -1
  304. package/out/tools/coarse-placer/build/outlier/latin.js.map +1 -1
  305. package/out/tools/coarse-placer/country-sets.d.ts +2 -2
  306. package/out/tools/coarse-placer/country-sets.js +2 -2
  307. package/out/tools/coarse-placer/outlier-rows.js +2 -2
  308. package/out/tools/coarse-placer/outlier-rows.js.map +1 -1
  309. package/out/tools/coarse-placer/train.js +1 -1
  310. package/out/tools/coarse-placer/train.js.map +1 -1
  311. package/out/tools/generate-language-types.js +2 -2
  312. package/out/tools/generate-language-types.js.map +1 -1
  313. package/out/tools/license/product-fixtures.run.d.ts +2 -0
  314. package/out/tools/license/product-fixtures.run.d.ts.map +1 -0
  315. package/out/tools/license/product-fixtures.run.js +350 -0
  316. package/out/tools/license/product-fixtures.run.js.map +1 -0
  317. package/out/utils/chunk-process.js +2 -2
  318. package/out/utils/chunk-process.js.map +1 -1
  319. package/out/utils/geodatabase-archive.js +1 -1
  320. package/out/utils/geodatabase-archive.js.map +1 -1
  321. package/out/utils/time.d.ts +15 -4
  322. package/out/utils/time.d.ts.map +1 -1
  323. package/out/utils/time.js +114 -12
  324. package/out/utils/time.js.map +1 -1
  325. package/out/utils.d.ts +4 -4
  326. package/out/utils.d.ts.map +1 -1
  327. package/out/utils.js +4 -4
  328. package/out/utils.js.map +1 -1
  329. package/out/values/identical.d.ts.map +1 -0
  330. package/out/values/identical.js.map +1 -0
  331. package/out/values/json.d.ts.map +1 -0
  332. package/out/values/json.js.map +1 -0
  333. package/out/values/objects.d.ts.map +1 -0
  334. package/out/values/objects.js.map +1 -0
  335. package/package.json +278 -243
  336. package/tools/build-deflate64-wasm.run.ts +2 -2
  337. package/tools/coarse-placer/build/dataset.ts +1 -1
  338. package/tools/coarse-placer/build/outlier/exposure.ts +1 -1
  339. package/tools/coarse-placer/build/outlier/latin.ts +5 -1
  340. package/tools/coarse-placer/country-sets.ts +2 -2
  341. package/tools/coarse-placer/outlier-rows.ts +2 -2
  342. package/tools/coarse-placer/train.ts +1 -1
  343. package/tools/generate-language-types.ts +2 -2
  344. package/tools/license/product-fixtures.run.ts +449 -0
  345. package/lib/collections.ts +0 -5
  346. package/lib/license/decision.ts +0 -329
  347. package/lib/license/obligations.ts +0 -256
  348. package/lib/license/record.ts +0 -277
  349. package/lib/scripting/ingest-chunk-script.ts +0 -87
  350. package/out/binary-frame.d.ts.map +0 -1
  351. package/out/binary-frame.js.map +0 -1
  352. package/out/collections.d.ts +0 -2
  353. package/out/collections.d.ts.map +0 -1
  354. package/out/collections.js +0 -5
  355. package/out/collections.js.map +0 -1
  356. package/out/git.d.ts.map +0 -1
  357. package/out/git.js.map +0 -1
  358. package/out/hash.d.ts.map +0 -1
  359. package/out/hash.js.map +0 -1
  360. package/out/identical.d.ts.map +0 -1
  361. package/out/identical.js.map +0 -1
  362. package/out/json.d.ts.map +0 -1
  363. package/out/json.js.map +0 -1
  364. package/out/license/decision.d.ts +0 -179
  365. package/out/license/decision.d.ts.map +0 -1
  366. package/out/license/decision.js +0 -169
  367. package/out/license/decision.js.map +0 -1
  368. package/out/license/obligations.d.ts +0 -102
  369. package/out/license/obligations.d.ts.map +0 -1
  370. package/out/license/obligations.js +0 -188
  371. package/out/license/obligations.js.map +0 -1
  372. package/out/license/record.d.ts +0 -136
  373. package/out/license/record.d.ts.map +0 -1
  374. package/out/license/record.js +0 -222
  375. package/out/license/record.js.map +0 -1
  376. package/out/load-ledger.d.ts.map +0 -1
  377. package/out/load-ledger.js.map +0 -1
  378. package/out/memoize.d.ts.map +0 -1
  379. package/out/memoize.js.map +0 -1
  380. package/out/numeric.d.ts.map +0 -1
  381. package/out/numeric.js.map +0 -1
  382. package/out/objects.d.ts.map +0 -1
  383. package/out/objects.js.map +0 -1
  384. package/out/overture-pins.d.ts.map +0 -1
  385. package/out/overture-pins.js.map +0 -1
  386. package/out/postcode-prefix-files.d.ts.map +0 -1
  387. package/out/postcode-prefix-files.js.map +0 -1
  388. package/out/process.d.ts.map +0 -1
  389. package/out/process.js.map +0 -1
  390. package/out/promises.d.ts.map +0 -1
  391. package/out/promises.js.map +0 -1
  392. package/out/random.d.ts.map +0 -1
  393. package/out/random.js.map +0 -1
  394. package/out/release-config.d.ts.map +0 -1
  395. package/out/release-config.js.map +0 -1
  396. package/out/routing.d.ts.map +0 -1
  397. package/out/routing.js.map +0 -1
  398. package/out/scope-config.d.ts.map +0 -1
  399. package/out/scope-config.js.map +0 -1
  400. package/out/scripting/ingest-chunk-script.d.ts +0 -58
  401. package/out/scripting/ingest-chunk-script.d.ts.map +0 -1
  402. package/out/scripting/ingest-chunk-script.js +0 -47
  403. package/out/scripting/ingest-chunk-script.js.map +0 -1
  404. package/out/spdx-header.d.ts.map +0 -1
  405. package/out/spdx-header.js.map +0 -1
  406. package/out/stats.d.ts.map +0 -1
  407. package/out/stats.js.map +0 -1
  408. package/out/trust-policies.d.ts.map +0 -1
  409. package/out/trust-policies.js.map +0 -1
  410. package/out/vale.d.ts.map +0 -1
  411. package/out/vale.js.map +0 -1
  412. package/out/workers.d.ts.map +0 -1
  413. package/out/workers.js.map +0 -1
  414. package/out/workspaces.d.ts.map +0 -1
  415. package/out/workspaces.js.map +0 -1
  416. /package/lib/{load-ledger.ts → asset/load-ledger.ts} +0 -0
  417. /package/lib/{overture-pins.ts → asset/overture-pins.ts} +0 -0
  418. /package/lib/{postcode-prefix-files.ts → asset/postcode-prefix-files.ts} +0 -0
  419. /package/lib/{trust-policies.ts → html/trust-policies.ts} +0 -0
  420. /package/lib/{numeric.ts → math/numeric.ts} +0 -0
  421. /package/lib/{random.ts → math/random.ts} +0 -0
  422. /package/lib/{stats.ts → math/stats.ts} +0 -0
  423. /package/lib/{scope-config.ts → repo/scope-config.ts} +0 -0
  424. /package/lib/{vale.ts → repo/vale.ts} +0 -0
  425. /package/lib/{process.ts → scripting/process.ts} +0 -0
  426. /package/lib/{workers.ts → scripting/workers.ts} +0 -0
  427. /package/lib/{identical.ts → values/identical.ts} +0 -0
  428. /package/lib/{json.ts → values/json.ts} +0 -0
  429. /package/lib/{objects.ts → values/objects.ts} +0 -0
  430. /package/out/{binary-frame.d.ts → asset/binary-frame.d.ts} +0 -0
  431. /package/out/{load-ledger.d.ts → asset/load-ledger.d.ts} +0 -0
  432. /package/out/{load-ledger.js → asset/load-ledger.js} +0 -0
  433. /package/out/{overture-pins.d.ts → asset/overture-pins.d.ts} +0 -0
  434. /package/out/{overture-pins.js → asset/overture-pins.js} +0 -0
  435. /package/out/{postcode-prefix-files.d.ts → asset/postcode-prefix-files.d.ts} +0 -0
  436. /package/out/{postcode-prefix-files.js → asset/postcode-prefix-files.js} +0 -0
  437. /package/out/{memoize.d.ts → async/memoize.d.ts} +0 -0
  438. /package/out/{trust-policies.d.ts → html/trust-policies.d.ts} +0 -0
  439. /package/out/{trust-policies.js → html/trust-policies.js} +0 -0
  440. /package/out/{numeric.d.ts → math/numeric.d.ts} +0 -0
  441. /package/out/{numeric.js → math/numeric.js} +0 -0
  442. /package/out/{random.d.ts → math/random.d.ts} +0 -0
  443. /package/out/{random.js → math/random.js} +0 -0
  444. /package/out/{stats.d.ts → math/stats.d.ts} +0 -0
  445. /package/out/{stats.js → math/stats.js} +0 -0
  446. /package/out/{routing.d.ts → network/routing.d.ts} +0 -0
  447. /package/out/{release-config.js → repo/release-config.js} +0 -0
  448. /package/out/{scope-config.d.ts → repo/scope-config.d.ts} +0 -0
  449. /package/out/{scope-config.js → repo/scope-config.js} +0 -0
  450. /package/out/{spdx-header.d.ts → repo/spdx-header.d.ts} +0 -0
  451. /package/out/{vale.d.ts → repo/vale.d.ts} +0 -0
  452. /package/out/{vale.js → repo/vale.js} +0 -0
  453. /package/out/{workspaces.d.ts → repo/workspaces.d.ts} +0 -0
  454. /package/out/{process.d.ts → scripting/process.d.ts} +0 -0
  455. /package/out/{process.js → scripting/process.js} +0 -0
  456. /package/out/{workers.d.ts → scripting/workers.d.ts} +0 -0
  457. /package/out/{workers.js → scripting/workers.js} +0 -0
  458. /package/out/{identical.d.ts → values/identical.d.ts} +0 -0
  459. /package/out/{identical.js → values/identical.js} +0 -0
  460. /package/out/{json.d.ts → values/json.d.ts} +0 -0
  461. /package/out/{json.js → values/json.js} +0 -0
  462. /package/out/{objects.d.ts → values/objects.d.ts} +0 -0
  463. /package/out/{objects.js → values/objects.js} +0 -0
@@ -11,12 +11,12 @@
11
11
  * Usage: `node packages/core/tools/build-deflate64-wasm.run.ts [--check]`
12
12
  */
13
13
 
14
+ import { sha256File } from "#crypto/hash"
14
15
  import { statPath } from "#fs/readers/stat"
15
16
  import { replaceFileAtomically } from "#fs/writers"
16
- import { sha256File } from "#hash"
17
17
  import { repoRootPath, workspacePath } from "#paths"
18
- import { runFile } from "#process"
19
18
  import { parseArguments } from "#scripting/arguments"
19
+ import { runFile } from "#scripting/process"
20
20
 
21
21
  const { values } = parseArguments({ options: { check: { type: "boolean", default: false } } })
22
22
 
@@ -9,11 +9,11 @@
9
9
 
10
10
  import { type PathBuilderLike, resolvePath, resolvePathBuilder } from "path-ts"
11
11
 
12
+ import { OVERTURE_ADDRESSES_RELEASE } from "#asset/overture-pins"
12
13
  import { hashFNV1a } from "#coarse-placer/fnv-hash"
13
14
  import { dataRootPath, snapshotSourcePath } from "#data-root"
14
15
  import { errorMessage } from "#errors/schema"
15
16
  import { makeDirectories, writeLocalJSONLFile } from "#fs/writers"
16
- import { OVERTURE_ADDRESSES_RELEASE } from "#overture-pins"
17
17
  import { COUNTRIES, IN_MAP_EU, NEW_EU } from "#tools/coarse-placer/country-sets"
18
18
  import { defaultDataDir } from "#tools/coarse-placer/paths"
19
19
 
@@ -18,8 +18,8 @@ import { scriptOf } from "#coarse-placer/featurize"
18
18
  import { hashFNV1a } from "#coarse-placer/fnv-hash"
19
19
  import { databaseRootPath, dataRootPath } from "#data-root"
20
20
  import { appendLocalTextFile } from "#fs/writers"
21
- import { stringifyJSON } from "#json"
22
21
  import { defaultDataDir } from "#tools/coarse-placer/paths"
22
+ import { stringifyJSON } from "#values/json"
23
23
 
24
24
  /**
25
25
  * The minimum share of counted characters that must be off-map for a name to be kept.
@@ -26,11 +26,11 @@
26
26
 
27
27
  import { type PathBuilderLike, resolvePath } from "path-ts"
28
28
 
29
+ import { OVERTURE_ADDRESSES_RELEASE } from "#asset/overture-pins"
29
30
  import { hashFNV1a } from "#coarse-placer/fnv-hash"
30
31
  import { snapshotSourcePath } from "#data-root"
31
32
  import { errorMessage } from "#errors/schema"
32
33
  import { appendLocalTextFile, writeLocalJSONLFile } from "#fs/writers"
33
- import { OVERTURE_ADDRESSES_RELEASE } from "#overture-pins"
34
34
  import { assembleOutlierRow, collectOutlierRows, otherRowsJSONL } from "#tools/coarse-placer/outlier-rows"
35
35
  import { defaultDataDir } from "#tools/coarse-placer/paths"
36
36
 
@@ -74,6 +74,8 @@ export interface BuildOutlierLatinResult {
74
74
  test: number
75
75
  }
76
76
 
77
+ // country-branch: BR and MX are the two Latin-script countries chosen as off-map training exposure.
78
+ // A draw from `countriesOfScript("Latn")` minus the trained countries would replace the list.
77
79
  /**
78
80
  * Off-map (not among the trained countries) and Latin-script.
79
81
  *
@@ -85,6 +87,8 @@ export interface BuildOutlierLatinResult {
85
87
  * Watch other-Latin recall in the openset eval.
86
88
  */
87
89
  const TRAIN_COUNTRIES = ["BR", "MX"]
90
+ // country-branch: CA and LI are held out as the near-twins of the trained US and DE.
91
+ // A nearest-neighbor ranking over the trained countries' features would replace the list.
88
92
  const HELDOUT_COUNTRIES = ["CA", "LI"]
89
93
 
90
94
  /**
@@ -4,8 +4,8 @@
4
4
  /**
5
5
  * The country sets the coarse-placer dataset is drawn from.
6
6
  *
7
- * `build-dataset.ts` samples them. the outlier builders consult them to keep
8
- * in-map countries out of the `other` pool.
7
+ * `build-dataset.ts` samples them.
8
+ * The outlier builders consult them to keep in-map countries out of the `other` pool.
9
9
  *
10
10
  * Every set is read from {@linkcode COARSE_CLASSES}, the model's label map,
11
11
  * through the source each class's rows are drawn from.
@@ -13,8 +13,8 @@
13
13
 
14
14
  import { hashFNV1a } from "#coarse-placer/fnv-hash"
15
15
  import { toLinesText } from "#fs/writers"
16
- import { stringifyJSON } from "#json"
17
- import { isPresent } from "#objects"
16
+ import { stringifyJSON } from "#values/json"
17
+ import { isPresent } from "#values/objects"
18
18
 
19
19
  /**
20
20
  * Shortest raw string kept as an outlier example.
@@ -20,7 +20,7 @@ import { JSONSpliterator } from "spliterator"
20
20
  import { COARSE_CLASSES, FEATURE_DIM, featurize } from "#coarse-placer/featurize"
21
21
  import { logsumexp, softmaxInto } from "#coarse-placer/math"
22
22
  import { makeDirectories, writeLocalBuffer, writeLocalJSONFile } from "#fs/writers"
23
- import { makeGlibcLcgInt32, shuffleWith } from "#random"
23
+ import { makeGlibcLcgInt32, shuffleWith } from "#math/random"
24
24
  import { defaultDataDir, defaultModelDir } from "#tools/coarse-placer/paths"
25
25
 
26
26
  /**
@@ -30,9 +30,9 @@ import { pascalCase } from "change-case"
30
30
  import { CSVSpliterator } from "spliterator"
31
31
 
32
32
  import { open } from "#fs/readers/stat"
33
- import { stringifyJSON } from "#json"
34
33
  import { workspacePath } from "#paths"
35
- import { SourceHeaderSyntax, spdxHeaderText } from "#spdx-header"
34
+ import { SourceHeaderSyntax, spdxHeaderText } from "#repo/spdx-header"
35
+ import { stringifyJSON } from "#values/json"
36
36
 
37
37
  /**
38
38
  * Options for {@linkcode generateLanguageTypes}.
@@ -0,0 +1,449 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * Writes the shared product-license fixtures that the TypeScript and Rust verifiers both read:
6
+ * `packages/license/test/fixtures/product/tokens.json` and the `provenance/` directory beside it.
7
+ *
8
+ * The signing keys come from `keys.json` in the same directory.
9
+ * It holds test keys no production register lists.
10
+ *
11
+ * Each case states the result the format specification
12
+ * (`docs/engineering/reference/product-license-tokens.mdx`) requires,
13
+ * so a verifier that disagrees with a case is the one to fix.
14
+ *
15
+ * Ed25519 signing is deterministic, so a rerun reproduces every file byte for byte.
16
+ *
17
+ * Usage: node packages/core/tools/license/product-fixtures.run.ts [--check]
18
+ *
19
+ * `--check` compares instead of writing, and exits 1 when a committed fixture
20
+ * differs from what the run would write.
21
+ */
22
+
23
+ import type { ProvenancePayload, TrainingRecord } from "@mailwoman/license/product/provenance"
24
+ import type { LicenseKeyPayload, TrainingGrantPayload } from "@mailwoman/license/product/token"
25
+
26
+ import { toBase64URL, utf8Bytes } from "#crypto/base64url"
27
+ import { signEd25519 } from "#crypto/ed25519"
28
+ import { sha256Hex } from "#crypto/hash"
29
+ import { readLocalJSONFile, readLocalTextFile } from "#fs/readers"
30
+ import { pathExists } from "#fs/readers/stat"
31
+ import { writeLocalTextFile } from "#fs/writers"
32
+ import { encodeLicenseKey, encodeTrainingGrant } from "#license/key"
33
+ import { encodeProvenanceManifest } from "#license/provenance"
34
+ import { resolvePackagePath } from "#module/resolvers"
35
+ import { parseArguments } from "#scripting/arguments"
36
+ import { prettyJSON, stringifyJSON } from "#values/json"
37
+
38
+ interface FixtureKey {
39
+ kid: string
40
+ privateKeyPEM: string
41
+ publicKeyPEM: string
42
+ }
43
+
44
+ interface FixtureKeys {
45
+ license: FixtureKey
46
+ provenance: FixtureKey
47
+ untrusted: FixtureKey
48
+ }
49
+
50
+ /**
51
+ * The result each verifier must return for a case.
52
+ *
53
+ * `license_key` and `training_grant` are the statuses of the `mwl1` and `mwt1` verifiers,
54
+ * and `training` is the training entitlement check's `admitted` or refusal code.
55
+ */
56
+ interface TokenExpectation {
57
+ license_key: "valid" | "expired" | "unknown_key" | "invalid"
58
+ training_grant: "valid" | "expired" | "unknown_key" | "invalid"
59
+ training: string
60
+ }
61
+
62
+ interface TokenCase {
63
+ name: string
64
+ token: string | null
65
+ now: string
66
+ expect: TokenExpectation
67
+ }
68
+
69
+ const fixtureDirectory = resolvePackagePath("@mailwoman/license", "test", "fixtures", "product")
70
+
71
+ const keys = await readLocalJSONFile<FixtureKeys>(
72
+ resolvePackagePath("@mailwoman/license", "test", "fixtures", "product", "keys.json")
73
+ )
74
+
75
+ const legacy = await readLocalJSONFile<{ token: string; kid: string; publicKeyPEM: string }>(
76
+ resolvePackagePath("@mailwoman/core", "test", "fixtures", "license", "legacy-token.json")
77
+ )
78
+
79
+ const grant: TrainingGrantPayload = {
80
+ v: 1,
81
+ kid: keys.license.kid,
82
+ grant: "mtg_0123456789abcdef01234567",
83
+ holder: "Fixture Training Customer Ltd",
84
+ agreement: "commercial-training-2026-11",
85
+ issued: "2026-11-01",
86
+ expires: "2027-01-31",
87
+ permits: ["train", "deploy"],
88
+ }
89
+
90
+ const platform: LicenseKeyPayload = {
91
+ v: 1,
92
+ kid: keys.license.kid,
93
+ licensee: "Fixture Platform Customer Ltd",
94
+ issued: "2026-11-01",
95
+ expires: "2027-01-31",
96
+ scope: "all",
97
+ terms: "LicenseRef-Commercial",
98
+ lid: "lic_0123456789abcdefghijkl",
99
+ agreement: "commercial-2026-11",
100
+ intent: "commercial",
101
+ seq: 1,
102
+ }
103
+
104
+ const declaration: LicenseKeyPayload = {
105
+ v: 1,
106
+ kid: keys.license.kid,
107
+ licensee: "Fixture Declarant",
108
+ issued: "2026-11-01",
109
+ expires: "2027-03-11",
110
+ scope: "all",
111
+ terms: "AGPL-3.0-only",
112
+ lid: "lic_abcdefghijkl0123456789",
113
+ intent: "open-source",
114
+ seq: 2,
115
+ install: "6f1e2a4c-9b3d-4e8f-a1c2-0d5e6f7a8b9c",
116
+ }
117
+
118
+ const evaluation: LicenseKeyPayload = {
119
+ ...declaration,
120
+ licensee: "Fixture Evaluator",
121
+ expires: "2026-12-01",
122
+ terms: "LicenseRef-Commercial",
123
+ intent: "evaluation",
124
+ seq: 1,
125
+ }
126
+
127
+ const DURING = "2026-12-01T00:00:00.000Z"
128
+
129
+ const validGrant = await encodeTrainingGrant(grant, keys.license.privateKeyPEM)
130
+ const [grantPrefix, grantPayload, grantSignature] = validGrant.split(".") as [string, string, string]
131
+ const platformKey = await encodeLicenseKey(platform, keys.license.privateKeyPEM)
132
+ const [, platformPayload, platformSignature] = platformKey.split(".") as [string, string, string]
133
+
134
+ /**
135
+ * A payload part encoding arbitrary JSON text, for cases whose signature never gets checked.
136
+ */
137
+ function payloadOf(json: string): string {
138
+ return toBase64URL(utf8Bytes(json))
139
+ }
140
+
141
+ const NOT_TRAINING = { license_key: "valid", training_grant: "invalid", training: "not_a_training_grant" } as const
142
+
143
+ const cases: TokenCase[] = [
144
+ {
145
+ name: "an active training grant admits a run",
146
+ token: validGrant,
147
+ now: DURING,
148
+ expect: { license_key: "invalid", training_grant: "valid", training: "admitted" },
149
+ },
150
+ {
151
+ name: "a training grant is valid at the last millisecond of its expiry date in UTC",
152
+ token: validGrant,
153
+ now: "2027-01-31T23:59:59.999Z",
154
+ expect: { license_key: "invalid", training_grant: "valid", training: "admitted" },
155
+ },
156
+ {
157
+ name: "a training grant is expired one millisecond after its expiry date ends in UTC",
158
+ token: validGrant,
159
+ now: "2027-02-01T00:00:00.000Z",
160
+ expect: { license_key: "invalid", training_grant: "expired", training: "expired" },
161
+ },
162
+ {
163
+ name: "a grant that permits only deploy refuses training",
164
+ token: await encodeTrainingGrant({ ...grant, permits: ["deploy"] }, keys.license.privateKeyPEM),
165
+ now: DURING,
166
+ expect: { license_key: "invalid", training_grant: "valid", training: "not_permitted" },
167
+ },
168
+ {
169
+ name: "a permission this verifier doesn't know grants nothing",
170
+ token: await encodeTrainingGrant({ ...grant, permits: ["train-everything"] }, keys.license.privateKeyPEM),
171
+ now: DURING,
172
+ expect: { license_key: "invalid", training_grant: "valid", training: "not_permitted" },
173
+ },
174
+ {
175
+ name: "a field the schema doesn't define is ignored",
176
+ token: await encodeTrainingGrant({ ...grant, note: "ignored" } as TrainingGrantPayload, keys.license.privateKeyPEM),
177
+ now: DURING,
178
+ expect: { license_key: "invalid", training_grant: "valid", training: "admitted" },
179
+ },
180
+ {
181
+ name: "a purchased platform key with scope all is no training grant",
182
+ token: platformKey,
183
+ now: DURING,
184
+ expect: NOT_TRAINING,
185
+ },
186
+ {
187
+ name: "an open-source declaration with scope all is no training grant",
188
+ token: await encodeLicenseKey(declaration, keys.license.privateKeyPEM),
189
+ now: DURING,
190
+ expect: NOT_TRAINING,
191
+ },
192
+ {
193
+ name: "an evaluation key is no training grant",
194
+ token: await encodeLicenseKey(evaluation, keys.license.privateKeyPEM),
195
+ now: "2026-11-15T00:00:00.000Z",
196
+ expect: NOT_TRAINING,
197
+ },
198
+ {
199
+ name: "the legacy node:crypto platform key verifies and is no training grant",
200
+ token: legacy.token,
201
+ now: DURING,
202
+ expect: NOT_TRAINING,
203
+ },
204
+ {
205
+ name: "an expired platform key is expired and is no training grant",
206
+ token: platformKey,
207
+ now: "2027-02-01T00:00:00.000Z",
208
+ expect: { license_key: "expired", training_grant: "invalid", training: "not_a_training_grant" },
209
+ },
210
+ {
211
+ name: "a training grant from a signer the register doesn't hold",
212
+ token: await encodeTrainingGrant({ ...grant, kid: keys.untrusted.kid }, keys.untrusted.privateKeyPEM),
213
+ now: DURING,
214
+ expect: { license_key: "invalid", training_grant: "unknown_key", training: "unknown_key" },
215
+ },
216
+ {
217
+ name: "an altered payload fails the signature",
218
+ token: `${grantPrefix}.${payloadOf(stringifyJSON({ ...grant, holder: "Someone Else" }))}.${grantSignature}`,
219
+ now: DURING,
220
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
221
+ },
222
+ {
223
+ name: "an extended expiry fails the signature",
224
+ token: `${grantPrefix}.${payloadOf(stringifyJSON({ ...grant, expires: "2099-12-31" }))}.${grantSignature}`,
225
+ now: DURING,
226
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
227
+ },
228
+ {
229
+ name: "a platform payload relabeled as a training grant fails",
230
+ token: `${grantPrefix}.${platformPayload}.${platformSignature}`,
231
+ now: DURING,
232
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
233
+ },
234
+ {
235
+ name: "a grant payload relabeled as a platform key fails",
236
+ token: `mwl1.${grantPayload}.${grantSignature}`,
237
+ now: DURING,
238
+ expect: { license_key: "invalid", training_grant: "invalid", training: "not_a_training_grant" },
239
+ },
240
+ {
241
+ name: "a grant ID outside the mtg_ shape is invalid",
242
+ token: await encodeTrainingGrantUnchecked({ ...grant, grant: "grant-1" }),
243
+ now: DURING,
244
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
245
+ },
246
+ {
247
+ name: "a grant without an expiry is invalid",
248
+ token: await encodeTrainingGrantUnchecked({ ...grant, expires: undefined }),
249
+ now: DURING,
250
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
251
+ },
252
+ {
253
+ name: "an expiry date that names no real day is invalid",
254
+ token: await encodeTrainingGrantUnchecked({ ...grant, expires: "2027-02-30" }),
255
+ now: DURING,
256
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
257
+ },
258
+ {
259
+ name: "an expiry month outside 01 to 12 is invalid",
260
+ token: await encodeTrainingGrantUnchecked({ ...grant, expires: "2027-13-01" }),
261
+ now: DURING,
262
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
263
+ },
264
+ {
265
+ name: "a token with two parts is malformed",
266
+ token: `${grantPrefix}.${grantPayload}`,
267
+ now: DURING,
268
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
269
+ },
270
+ {
271
+ name: "a payload outside the base64url alphabet is malformed",
272
+ token: `${grantPrefix}.${grantPayload.slice(0, 8)}+/${grantPayload.slice(8)}.${grantSignature}`,
273
+ now: DURING,
274
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
275
+ },
276
+ {
277
+ name: "a payload that isn't JSON is malformed",
278
+ token: `${grantPrefix}.${payloadOf("not json")}.${grantSignature}`,
279
+ now: DURING,
280
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
281
+ },
282
+ {
283
+ name: "a payload that isn't UTF-8 is malformed",
284
+ token: `${grantPrefix}.${toBase64URL(new Uint8Array([0x7b, 0xff, 0xfe, 0x7d]))}.${grantSignature}`,
285
+ now: DURING,
286
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
287
+ },
288
+ {
289
+ name: "a truncated signature fails",
290
+ token: `${grantPrefix}.${grantPayload}.${grantSignature.slice(0, 40)}`,
291
+ now: DURING,
292
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
293
+ },
294
+ {
295
+ name: "an unknown token prefix is malformed",
296
+ token: `mwl9.${grantPayload}.${grantSignature}`,
297
+ now: DURING,
298
+ expect: { license_key: "invalid", training_grant: "invalid", training: "invalid" },
299
+ },
300
+ {
301
+ name: "a missing credential grants nothing",
302
+ token: null,
303
+ now: DURING,
304
+ expect: { license_key: "invalid", training_grant: "invalid", training: "missing" },
305
+ },
306
+ ]
307
+
308
+ /**
309
+ * Signs a payload the schema refuses, for the cases that test the verifier's schema check.
310
+ */
311
+ async function encodeTrainingGrantUnchecked(payload: Record<string, unknown>): Promise<string> {
312
+ const body = `mwt1.${toBase64URL(utf8Bytes(stringifyJSON(payload)))}`
313
+
314
+ return `${body}.${toBase64URL(await signEd25519(utf8Bytes(body), keys.license.privateKeyPEM))}`
315
+ }
316
+
317
+ const tokens = {
318
+ $comment:
319
+ "Generated by packages/core/tools/license/product-fixtures.run.ts from keys.json; regenerate rather than edit. Each case states the statuses docs/engineering/reference/product-license-tokens.mdx requires of both verifiers.",
320
+ trusted_license_keys: { [keys.license.kid]: keys.license.publicKeyPEM, [legacy.kid]: legacy.publicKeyPEM },
321
+ cases,
322
+ }
323
+
324
+ const record: TrainingRecord = {
325
+ format: "mailwoman-training-record/1",
326
+ run_id: "mwrun_00112233445566778899aabb",
327
+ license_branch: "LicenseRef-Commercial",
328
+ grant: { grant: grant.grant, agreement: grant.agreement, kid: grant.kid, expires: grant.expires },
329
+ trainer: { version: "0.1.0", build: "commercial", image: "mailwoman-trainer-cu130-1.99.1-0123456789abcdef" },
330
+ resolved_config_sha256: "a".repeat(64),
331
+ corpus_manifest_sha256: "b".repeat(64),
332
+ parent: null,
333
+ verifications: [
334
+ {
335
+ event: "start",
336
+ at: "2026-11-02T10:00:00Z",
337
+ grant: { grant: grant.grant, agreement: grant.agreement, kid: grant.kid, expires: grant.expires },
338
+ },
339
+ ],
340
+ }
341
+
342
+ const sidecars: Record<string, string> = {
343
+ "model.onnx": "a stand-in for an ONNX graph: the manifest binds bytes, whatever they encode\n",
344
+ "CORPUS.json": prettyJSON({ corpus_dir: "/data/corpus", manifest_sha256: "b".repeat(64), corpus_version: "fixture" }),
345
+ "TRAINING.json": prettyJSON(record),
346
+ }
347
+
348
+ const outputs = new Map<string, string>([
349
+ [
350
+ resolvePackagePath("@mailwoman/license", "test", "fixtures", "product", "tokens.json").toString(),
351
+ prettyJSON(tokens),
352
+ ],
353
+ ])
354
+
355
+ for (const [name, contents] of Object.entries(sidecars)) {
356
+ outputs.set(
357
+ resolvePackagePath("@mailwoman/license", "test", "fixtures", "product", "provenance", name).toString(),
358
+ contents
359
+ )
360
+ }
361
+
362
+ const { values } = parseArguments({ options: { check: { type: "boolean", default: false } } })
363
+
364
+ const payload: ProvenancePayload = {
365
+ v: 1,
366
+ provenance_id: "mwprov_00112233445566778899aabb",
367
+ created: "2026-11-03T12:00:00Z",
368
+ attestation: "managed",
369
+ // The digests of the bytes this run writes, so a check run needs no file on disk.
370
+ artifacts: Object.entries(sidecars).map(([path, contents]) => {
371
+ const bytes = utf8Bytes(contents)
372
+
373
+ return { path, sha256: sha256Hex(bytes), bytes: bytes.length }
374
+ }),
375
+ training: record,
376
+ parent: null,
377
+ }
378
+
379
+ const manifests = {
380
+ "model.provenance.json": await encodeProvenanceManifest(payload, keys.provenance),
381
+ "license-key-signed.provenance.json": await encodeProvenanceManifest(payload, keys.license),
382
+ "unattested.provenance.json": await encodeProvenanceManifest({ ...payload, attestation: "unattested" }, null),
383
+ }
384
+
385
+ for (const [name, manifest] of Object.entries(manifests)) {
386
+ outputs.set(
387
+ resolvePackagePath("@mailwoman/license", "test", "fixtures", "product", "provenance", name).toString(),
388
+ prettyJSON(manifest)
389
+ )
390
+ }
391
+
392
+ const provenanceCases = {
393
+ $comment:
394
+ "Generated by packages/core/tools/license/product-fixtures.run.ts. Each case verifies a manifest in provenance/ against trusted_provenance_keys and states the result both verifiers must return.",
395
+ trusted_provenance_keys: { [keys.provenance.kid]: keys.provenance.publicKeyPEM },
396
+ cases: [
397
+ {
398
+ name: "a managed manifest signed by a provenance key verifies",
399
+ manifest: "model.provenance.json",
400
+ require_signature: true,
401
+ expect: "verified",
402
+ },
403
+ {
404
+ name: "a manifest signed by a license key is refused",
405
+ manifest: "license-key-signed.provenance.json",
406
+ require_signature: true,
407
+ expect: "unknown_key",
408
+ },
409
+ {
410
+ name: "an unattested manifest verifies its digests when no signature is required",
411
+ manifest: "unattested.provenance.json",
412
+ require_signature: false,
413
+ expect: "verified",
414
+ },
415
+ {
416
+ name: "an unattested manifest is refused where a signature is required",
417
+ manifest: "unattested.provenance.json",
418
+ require_signature: true,
419
+ expect: "unsigned",
420
+ },
421
+ ],
422
+ }
423
+
424
+ outputs.set(
425
+ resolvePackagePath("@mailwoman/license", "test", "fixtures", "product", "provenance.json").toString(),
426
+ prettyJSON(provenanceCases)
427
+ )
428
+
429
+ let stale = 0
430
+
431
+ for (const [path, contents] of outputs) {
432
+ if (values.check) {
433
+ const committed = (await pathExists(path)) ? await readLocalTextFile(path) : null
434
+
435
+ if (committed !== contents) {
436
+ console.error(`stale: ${path}`)
437
+
438
+ stale++
439
+ }
440
+ } else {
441
+ await writeLocalTextFile(contents, path)
442
+ }
443
+ }
444
+
445
+ console.log(`${values.check ? "checked" : "wrote"} ${outputs.size} fixture files under ${fixtureDirectory}`)
446
+
447
+ if (stale) {
448
+ process.exit(1)
449
+ }
@@ -1,5 +0,0 @@
1
- // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
- // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
-
4
- // Empty module: Fill out as needed.
5
- export {}