@mailwoman/core 10.8.0 → 11.1.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 (1116) hide show
  1. package/README.md +24 -1
  2. package/THIRD_PARTY_NOTICES.md +27 -0
  3. package/lib/api/APIClient.ts +6 -5
  4. package/lib/api/arcgis.ts +6 -5
  5. package/lib/api/ckan.ts +8 -7
  6. package/lib/api/clock.ts +3 -3
  7. package/lib/api/content-range.ts +33 -0
  8. package/lib/api/defaults.ts +3 -3
  9. package/lib/api/disk-storage.ts +6 -6
  10. package/lib/api/headless.ts +3 -4
  11. package/lib/api/host.ts +5 -5
  12. package/lib/api/ogc.ts +11 -11
  13. package/lib/api/paced-client.ts +9 -7
  14. package/lib/api/pacer.ts +5 -5
  15. package/lib/api/responses.ts +44 -9
  16. package/lib/api/retry.ts +4 -4
  17. package/lib/api/test/clocks.ts +7 -7
  18. package/lib/api/test/transport.ts +5 -5
  19. package/lib/api.ts +3 -4
  20. package/lib/asset/names.ts +6 -6
  21. package/lib/asset/paths.ts +5 -6
  22. package/lib/binary-frame.ts +2 -5
  23. package/lib/cloudflare/tokens.ts +141 -0
  24. package/lib/cloudflare/wrangler.ts +98 -0
  25. package/lib/cloudflare.ts +10 -0
  26. package/lib/coarse-placer/coarse-placer.ts +6 -5
  27. package/lib/coarse-placer/featurize.ts +6 -6
  28. package/lib/coarse-placer/fnv-hash.ts +6 -6
  29. package/lib/coarse-placer/math.ts +10 -6
  30. package/lib/collections.ts +2 -5
  31. package/lib/crypto/base64url.ts +5 -6
  32. package/lib/crypto/digest.ts +7 -6
  33. package/lib/crypto/ed25519.ts +9 -9
  34. package/lib/crypto/node.ts +2 -5
  35. package/lib/data-root.ts +85 -11
  36. package/lib/decoder/build-tree.ts +14 -15
  37. package/lib/decoder/calibration.ts +20 -18
  38. package/lib/decoder/containment.ts +17 -15
  39. package/lib/decoder/excluded-span.ts +3 -3
  40. package/lib/decoder/parse-diff.ts +11 -8
  41. package/lib/decoder/proposals-to-tree.ts +5 -6
  42. package/lib/decoder/serialize/json.ts +13 -12
  43. package/lib/decoder/serialize/tuples.ts +7 -7
  44. package/lib/decoder/serialize/xml.ts +15 -12
  45. package/lib/decoder/tree/shape.ts +10 -11
  46. package/lib/decoder/tree/walk.ts +6 -6
  47. package/lib/decoder/types.ts +8 -7
  48. package/lib/decoder/unknown-spans.ts +9 -7
  49. package/lib/decoder/validate-tree.ts +11 -8
  50. package/lib/decoder.ts +2 -5
  51. package/lib/env/env-file.ts +4 -7
  52. package/lib/env/paths.ts +3 -7
  53. package/lib/env/schema.ts +3 -4
  54. package/lib/env/utils.ts +3 -4
  55. package/lib/env.ts +6 -9
  56. package/lib/errors/schema.ts +3 -4
  57. package/lib/fs/compression.ts +7 -4
  58. package/lib/fs/deflate64.ts +183 -0
  59. package/lib/fs/delimited.ts +4 -4
  60. package/lib/fs/formatters.ts +2 -5
  61. package/lib/fs/lock.ts +4 -4
  62. package/lib/fs/readers/stat.ts +12 -11
  63. package/lib/fs/readers.ts +22 -12
  64. package/lib/fs/snapshot.ts +111 -0
  65. package/lib/fs/streams.ts +9 -9
  66. package/lib/fs/temporary.ts +4 -4
  67. package/lib/fs/writers.ts +6 -6
  68. package/lib/fs/zip.ts +113 -28
  69. package/lib/geocode/result.ts +16 -7
  70. package/lib/git.ts +43 -8
  71. package/lib/hash.ts +13 -4
  72. package/lib/html/document.ts +9 -6
  73. package/lib/html/elements.ts +18 -14
  74. package/lib/html/tables.ts +5 -5
  75. package/lib/html/text.ts +10 -10
  76. package/lib/identical.ts +7 -6
  77. package/lib/index.ts +2 -5
  78. package/lib/json.ts +11 -9
  79. package/lib/layers/artifact.ts +14 -14
  80. package/lib/layers/build-command.ts +7 -7
  81. package/lib/layers/coverage.ts +7 -7
  82. package/lib/layers/feature-count.ts +3 -6
  83. package/lib/layers/manifest.ts +6 -7
  84. package/lib/layers/outcome.ts +12 -12
  85. package/lib/layers/publication.ts +4 -4
  86. package/lib/layers/recipe.ts +4 -4
  87. package/lib/layers/schema.ts +18 -15
  88. package/lib/layers/selection.ts +9 -9
  89. package/lib/layers.ts +5 -5
  90. package/lib/license/configured.ts +8 -8
  91. package/lib/license/decision.ts +17 -16
  92. package/lib/license/declaration.ts +8 -7
  93. package/lib/license/docs-site.ts +6 -5
  94. package/lib/license/install-id.ts +8 -6
  95. package/lib/license/key/file.ts +12 -8
  96. package/lib/license/key.ts +9 -8
  97. package/lib/license/obligations.ts +8 -9
  98. package/lib/license/publication.ts +9 -9
  99. package/lib/license/record.ts +8 -7
  100. package/lib/license/register.ts +12 -11
  101. package/lib/license/stamp.ts +5 -4
  102. package/lib/license/status.ts +10 -8
  103. package/lib/license.ts +10 -7
  104. package/lib/load-ledger.ts +105 -0
  105. package/lib/locale/locale.ts +9 -8
  106. package/lib/locale/profiles/en-us.ts +5 -5
  107. package/lib/locale/profiles/fr-fr.ts +6 -5
  108. package/lib/locale/profiles/ja-jp.ts +5 -5
  109. package/lib/locale/profiles.ts +2 -5
  110. package/lib/locale/registry.ts +7 -6
  111. package/lib/locale/zh-cn-units.ts +5 -5
  112. package/lib/locale.ts +2 -5
  113. package/lib/logging/shared.ts +4 -7
  114. package/lib/logging/utils.ts +3 -5
  115. package/lib/logging.ts +2 -5
  116. package/lib/memoize.ts +29 -0
  117. package/lib/module/checkout-locality.ts +174 -0
  118. package/lib/module/clean.ts +6 -5
  119. package/lib/module/compiled-freshness.ts +3 -3
  120. package/lib/module/file-url.ts +4 -5
  121. package/lib/module/package-command.ts +3 -0
  122. package/lib/module/packaged-data.ts +9 -8
  123. package/lib/module/resolve-from.ts +17 -12
  124. package/lib/module/resolvers.ts +8 -9
  125. package/lib/module/runtime.ts +2 -5
  126. package/lib/module/workspace.ts +7 -6
  127. package/lib/network/connectivity.ts +112 -0
  128. package/lib/network/reachability.ts +90 -0
  129. package/lib/numeric.ts +11 -11
  130. package/lib/objects.ts +5 -6
  131. package/lib/overture-pins.ts +4 -4
  132. package/lib/paths.ts +10 -10
  133. package/lib/pipeline/client-result.ts +42 -17
  134. package/lib/pipeline/preferences.ts +3 -2
  135. package/lib/pipeline/result.ts +3 -5
  136. package/lib/pipeline/runtime-pipeline.ts +26 -8
  137. package/lib/pipeline/span-proposer.ts +10 -9
  138. package/lib/pipeline/types.ts +33 -8
  139. package/lib/pipeline.ts +3 -4
  140. package/lib/policy/defaults.ts +5 -6
  141. package/lib/policy/policy.ts +3 -4
  142. package/lib/policy/proposal-collection.ts +3 -4
  143. package/lib/policy/registry.ts +9 -7
  144. package/lib/policy.ts +2 -5
  145. package/lib/postcode-prefix-files.ts +8 -7
  146. package/lib/process.ts +14 -14
  147. package/lib/promises.ts +6 -4
  148. package/lib/random.ts +7 -6
  149. package/lib/release-config.ts +12 -4
  150. package/lib/resolver/authoritative-provider.ts +17 -11
  151. package/lib/resolver/coverage-facts.ts +7 -6
  152. package/lib/resolver/fixture-authoritative-provider.ts +13 -11
  153. package/lib/resolver/lookup-types.ts +10 -5
  154. package/lib/resolver/referential.ts +11 -6
  155. package/lib/resolver/region-database-provider.ts +4 -4
  156. package/lib/resolver/synthetic-id-ranges.ts +4 -4
  157. package/lib/resolver/types.ts +75 -57
  158. package/lib/resolver.ts +20 -12
  159. package/lib/resources/debugging.ts +2 -5
  160. package/lib/resources/languages/types.gen.ts +3 -4
  161. package/lib/resources/languages.ts +2 -5
  162. package/lib/resources/libpostal.ts +3 -4
  163. package/lib/resources/locale.ts +2 -5
  164. package/lib/resources/set.ts +2 -5
  165. package/lib/resources.ts +2 -6
  166. package/lib/routing.ts +4 -7
  167. package/lib/scope-config.ts +12 -8
  168. package/lib/scripting/arguments.ts +10 -9
  169. package/lib/scripting/command.ts +6 -5
  170. package/lib/scripting/ingest-chunk-script.ts +5 -6
  171. package/lib/scripting/operation.ts +45 -5
  172. package/lib/scripting/utils.ts +3 -0
  173. package/lib/scripting.ts +4 -1
  174. package/lib/spdx-header.ts +314 -0
  175. package/lib/state-machine.ts +149 -0
  176. package/lib/stats.ts +3 -4
  177. package/lib/strings/code-points.ts +3 -4
  178. package/lib/strings/compare.ts +4 -4
  179. package/lib/strings/escape.ts +3 -3
  180. package/lib/strings/format.ts +3 -3
  181. package/lib/strings/markdown-table.ts +4 -4
  182. package/lib/strings/python-json.ts +11 -10
  183. package/lib/strings/regexp.ts +3 -3
  184. package/lib/strings/terminal.ts +20 -0
  185. package/lib/strings/unicode.ts +6 -6
  186. package/lib/tokenization/Graph.ts +3 -4
  187. package/lib/tokenization/Span.ts +3 -4
  188. package/lib/tokenization/normalizer.ts +3 -4
  189. package/lib/tokenization.ts +2 -5
  190. package/lib/trust-policies.ts +20 -15
  191. package/lib/types/Classification.ts +3 -6
  192. package/lib/types/classifier.ts +10 -9
  193. package/lib/types/mapping.ts +13 -14
  194. package/lib/types.ts +2 -5
  195. package/lib/utils/chunk-process.ts +14 -10
  196. package/lib/utils/collections.ts +3 -3
  197. package/lib/utils/events.ts +2 -5
  198. package/lib/utils/geodatabase-archive.ts +10 -8
  199. package/lib/utils/sleep.ts +2 -5
  200. package/lib/utils/sqlite-rows.ts +9 -7
  201. package/lib/utils/stream-to-disk.ts +26 -9
  202. package/lib/utils/system.ts +4 -4
  203. package/lib/utils/time.ts +3 -3
  204. package/lib/utils/union-find.ts +3 -3
  205. package/lib/utils.ts +2 -5
  206. package/lib/vale.ts +5 -5
  207. package/lib/workers.ts +10 -5
  208. package/lib/workspaces.ts +5 -4
  209. package/out/api/APIClient.d.ts +0 -7
  210. package/out/api/APIClient.d.ts.map +1 -1
  211. package/out/api/APIClient.js +5 -4
  212. package/out/api/APIClient.js.map +1 -1
  213. package/out/api/arcgis.d.ts +3 -5
  214. package/out/api/arcgis.d.ts.map +1 -1
  215. package/out/api/arcgis.js +2 -8
  216. package/out/api/arcgis.js.map +1 -1
  217. package/out/api/ckan.d.ts +5 -7
  218. package/out/api/ckan.d.ts.map +1 -1
  219. package/out/api/ckan.js +2 -11
  220. package/out/api/ckan.js.map +1 -1
  221. package/out/api/clock.d.ts +0 -3
  222. package/out/api/clock.d.ts.map +1 -1
  223. package/out/api/clock.js +2 -16
  224. package/out/api/clock.js.map +1 -1
  225. package/out/api/content-range.d.ts +17 -0
  226. package/out/api/content-range.d.ts.map +1 -0
  227. package/out/api/content-range.js +28 -0
  228. package/out/api/content-range.js.map +1 -0
  229. package/out/api/defaults.d.ts +0 -3
  230. package/out/api/defaults.d.ts.map +1 -1
  231. package/out/api/defaults.js +2 -3
  232. package/out/api/defaults.js.map +1 -1
  233. package/out/api/disk-storage.d.ts +1 -4
  234. package/out/api/disk-storage.d.ts.map +1 -1
  235. package/out/api/disk-storage.js +5 -6
  236. package/out/api/disk-storage.js.map +1 -1
  237. package/out/api/headless.d.ts +0 -4
  238. package/out/api/headless.d.ts.map +1 -1
  239. package/out/api/headless.js +2 -4
  240. package/out/api/headless.js.map +1 -1
  241. package/out/api/host.d.ts +2 -8
  242. package/out/api/host.d.ts.map +1 -1
  243. package/out/api/host.js +3 -4
  244. package/out/api/host.js.map +1 -1
  245. package/out/api/ogc.d.ts +3 -13
  246. package/out/api/ogc.d.ts.map +1 -1
  247. package/out/api/ogc.js +10 -11
  248. package/out/api/ogc.js.map +1 -1
  249. package/out/api/paced-client.d.ts +6 -7
  250. package/out/api/paced-client.d.ts.map +1 -1
  251. package/out/api/paced-client.js +2 -13
  252. package/out/api/paced-client.js.map +1 -1
  253. package/out/api/pacer.d.ts +2 -5
  254. package/out/api/pacer.d.ts.map +1 -1
  255. package/out/api/pacer.js +4 -5
  256. package/out/api/pacer.js.map +1 -1
  257. package/out/api/responses.d.ts +2 -9
  258. package/out/api/responses.d.ts.map +1 -1
  259. package/out/api/responses.js +37 -9
  260. package/out/api/responses.js.map +1 -1
  261. package/out/api/retry.d.ts +1 -7
  262. package/out/api/retry.d.ts.map +1 -1
  263. package/out/api/retry.js +3 -4
  264. package/out/api/retry.js.map +1 -1
  265. package/out/api/test/clocks.d.ts +1 -4
  266. package/out/api/test/clocks.d.ts.map +1 -1
  267. package/out/api/test/clocks.js +6 -14
  268. package/out/api/test/clocks.js.map +1 -1
  269. package/out/api/test/transport.d.ts +2 -23
  270. package/out/api/test/transport.d.ts.map +1 -1
  271. package/out/api/test/transport.js +3 -22
  272. package/out/api/test/transport.js.map +1 -1
  273. package/out/api.d.ts +0 -4
  274. package/out/api.d.ts.map +1 -1
  275. package/out/api.js +2 -4
  276. package/out/api.js.map +1 -1
  277. package/out/asset/names.d.ts +3 -6
  278. package/out/asset/names.d.ts.map +1 -1
  279. package/out/asset/names.js +5 -6
  280. package/out/asset/names.js.map +1 -1
  281. package/out/asset/paths.d.ts +2 -6
  282. package/out/asset/paths.d.ts.map +1 -1
  283. package/out/asset/paths.js +4 -6
  284. package/out/asset/paths.js.map +1 -1
  285. package/out/binary-frame.d.ts +0 -5
  286. package/out/binary-frame.d.ts.map +1 -1
  287. package/out/binary-frame.js +2 -5
  288. package/out/binary-frame.js.map +1 -1
  289. package/out/cloudflare/tokens.d.ts +61 -0
  290. package/out/cloudflare/tokens.d.ts.map +1 -0
  291. package/out/cloudflare/tokens.js +79 -0
  292. package/out/cloudflare/tokens.js.map +1 -0
  293. package/out/cloudflare/wrangler.d.ts +30 -0
  294. package/out/cloudflare/wrangler.d.ts.map +1 -0
  295. package/out/cloudflare/wrangler.js +68 -0
  296. package/out/cloudflare/wrangler.js.map +1 -0
  297. package/out/cloudflare.d.ts +7 -0
  298. package/out/cloudflare.d.ts.map +1 -0
  299. package/out/cloudflare.js +9 -0
  300. package/out/cloudflare.js.map +1 -0
  301. package/out/coarse-placer/coarse-placer.d.ts +3 -5
  302. package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
  303. package/out/coarse-placer/coarse-placer.js +2 -9
  304. package/out/coarse-placer/coarse-placer.js.map +1 -1
  305. package/out/coarse-placer/featurize.d.ts +0 -13
  306. package/out/coarse-placer/featurize.d.ts.map +1 -1
  307. package/out/coarse-placer/featurize.js +5 -6
  308. package/out/coarse-placer/featurize.js.map +1 -1
  309. package/out/coarse-placer/fnv-hash.d.ts +3 -6
  310. package/out/coarse-placer/fnv-hash.d.ts.map +1 -1
  311. package/out/coarse-placer/fnv-hash.js +5 -6
  312. package/out/coarse-placer/fnv-hash.js.map +1 -1
  313. package/out/coarse-placer/math.d.ts +7 -6
  314. package/out/coarse-placer/math.d.ts.map +1 -1
  315. package/out/coarse-placer/math.js +2 -11
  316. package/out/coarse-placer/math.js.map +1 -1
  317. package/out/collections.d.ts +0 -5
  318. package/out/collections.d.ts.map +1 -1
  319. package/out/collections.js +2 -5
  320. package/out/collections.js.map +1 -1
  321. package/out/crypto/base64url.d.ts +2 -6
  322. package/out/crypto/base64url.d.ts.map +1 -1
  323. package/out/crypto/base64url.js +4 -6
  324. package/out/crypto/base64url.js.map +1 -1
  325. package/out/crypto/digest.d.ts +4 -6
  326. package/out/crypto/digest.d.ts.map +1 -1
  327. package/out/crypto/digest.js +6 -6
  328. package/out/crypto/digest.js.map +1 -1
  329. package/out/crypto/ed25519.d.ts +1 -13
  330. package/out/crypto/ed25519.d.ts.map +1 -1
  331. package/out/crypto/ed25519.js +8 -9
  332. package/out/crypto/ed25519.js.map +1 -1
  333. package/out/crypto/node.d.ts +0 -5
  334. package/out/crypto/node.d.ts.map +1 -1
  335. package/out/crypto/node.js +2 -5
  336. package/out/crypto/node.js.map +1 -1
  337. package/out/data-root.d.ts +53 -11
  338. package/out/data-root.d.ts.map +1 -1
  339. package/out/data-root.js +76 -11
  340. package/out/data-root.js.map +1 -1
  341. package/out/decoder/build-tree.d.ts +0 -26
  342. package/out/decoder/build-tree.d.ts.map +1 -1
  343. package/out/decoder/build-tree.js +6 -30
  344. package/out/decoder/build-tree.js.map +1 -1
  345. package/out/decoder/calibration.d.ts +17 -18
  346. package/out/decoder/calibration.d.ts.map +1 -1
  347. package/out/decoder/calibration.js +2 -24
  348. package/out/decoder/calibration.js.map +1 -1
  349. package/out/decoder/containment.d.ts +14 -15
  350. package/out/decoder/containment.d.ts.map +1 -1
  351. package/out/decoder/containment.js +2 -29
  352. package/out/decoder/containment.js.map +1 -1
  353. package/out/decoder/excluded-span.d.ts +0 -3
  354. package/out/decoder/excluded-span.d.ts.map +1 -1
  355. package/out/decoder/excluded-span.js +2 -6
  356. package/out/decoder/excluded-span.js.map +1 -1
  357. package/out/decoder/parse-diff.d.ts +0 -21
  358. package/out/decoder/parse-diff.d.ts.map +1 -1
  359. package/out/decoder/parse-diff.js +10 -8
  360. package/out/decoder/parse-diff.js.map +1 -1
  361. package/out/decoder/proposals-to-tree.d.ts +2 -6
  362. package/out/decoder/proposals-to-tree.d.ts.map +1 -1
  363. package/out/decoder/proposals-to-tree.js +4 -9
  364. package/out/decoder/proposals-to-tree.js.map +1 -1
  365. package/out/decoder/serialize/json.d.ts +9 -11
  366. package/out/decoder/serialize/json.d.ts.map +1 -1
  367. package/out/decoder/serialize/json.js +4 -18
  368. package/out/decoder/serialize/json.js.map +1 -1
  369. package/out/decoder/serialize/tuples.d.ts +4 -7
  370. package/out/decoder/serialize/tuples.d.ts.map +1 -1
  371. package/out/decoder/serialize/tuples.js +2 -11
  372. package/out/decoder/serialize/tuples.js.map +1 -1
  373. package/out/decoder/serialize/xml.d.ts +12 -12
  374. package/out/decoder/serialize/xml.d.ts.map +1 -1
  375. package/out/decoder/serialize/xml.js +2 -27
  376. package/out/decoder/serialize/xml.js.map +1 -1
  377. package/out/decoder/tree/shape.d.ts +7 -11
  378. package/out/decoder/tree/shape.d.ts.map +1 -1
  379. package/out/decoder/tree/shape.js +3 -13
  380. package/out/decoder/tree/shape.js.map +1 -1
  381. package/out/decoder/tree/walk.d.ts +3 -11
  382. package/out/decoder/tree/walk.d.ts.map +1 -1
  383. package/out/decoder/tree/walk.js +5 -6
  384. package/out/decoder/tree/walk.js.map +1 -1
  385. package/out/decoder/types.d.ts +5 -7
  386. package/out/decoder/types.d.ts.map +1 -1
  387. package/out/decoder/types.js +3 -5
  388. package/out/decoder/types.js.map +1 -1
  389. package/out/decoder/unknown-spans.d.ts.map +1 -1
  390. package/out/decoder/unknown-spans.js +8 -7
  391. package/out/decoder/unknown-spans.js.map +1 -1
  392. package/out/decoder/validate-tree.d.ts +8 -8
  393. package/out/decoder/validate-tree.d.ts.map +1 -1
  394. package/out/decoder/validate-tree.js +2 -23
  395. package/out/decoder/validate-tree.js.map +1 -1
  396. package/out/decoder.d.ts +0 -5
  397. package/out/decoder.d.ts.map +1 -1
  398. package/out/decoder.js +2 -5
  399. package/out/decoder.js.map +1 -1
  400. package/out/env/env-file.d.ts +1 -6
  401. package/out/env/env-file.d.ts.map +1 -1
  402. package/out/env/env-file.js +4 -7
  403. package/out/env/env-file.js.map +1 -1
  404. package/out/env/paths.d.ts +1 -7
  405. package/out/env/paths.d.ts.map +1 -1
  406. package/out/env/paths.js +3 -7
  407. package/out/env/paths.js.map +1 -1
  408. package/out/env/schema.d.ts +0 -8
  409. package/out/env/schema.d.ts.map +1 -1
  410. package/out/env/schema.js +2 -4
  411. package/out/env/schema.js.map +1 -1
  412. package/out/env/utils.d.ts +0 -7
  413. package/out/env/utils.d.ts.map +1 -1
  414. package/out/env/utils.js +2 -4
  415. package/out/env/utils.js.map +1 -1
  416. package/out/env.d.ts +2 -7
  417. package/out/env.d.ts.map +1 -1
  418. package/out/env.js +6 -9
  419. package/out/env.js.map +1 -1
  420. package/out/errors/schema.d.ts +0 -4
  421. package/out/errors/schema.d.ts.map +1 -1
  422. package/out/errors/schema.js +2 -0
  423. package/out/errors/schema.js.map +1 -1
  424. package/out/fs/compression.d.ts +4 -4
  425. package/out/fs/compression.d.ts.map +1 -1
  426. package/out/fs/compression.js +5 -3
  427. package/out/fs/compression.js.map +1 -1
  428. package/out/fs/deflate64.d.ts +21 -0
  429. package/out/fs/deflate64.d.ts.map +1 -0
  430. package/out/fs/deflate64.js +121 -0
  431. package/out/fs/deflate64.js.map +1 -0
  432. package/out/fs/delimited.d.ts +1 -4
  433. package/out/fs/delimited.d.ts.map +1 -1
  434. package/out/fs/delimited.js +2 -23
  435. package/out/fs/delimited.js.map +1 -1
  436. package/out/fs/formatters.d.ts +0 -5
  437. package/out/fs/formatters.d.ts.map +1 -1
  438. package/out/fs/formatters.js +2 -5
  439. package/out/fs/formatters.js.map +1 -1
  440. package/out/fs/lock.d.ts +0 -3
  441. package/out/fs/lock.d.ts.map +1 -1
  442. package/out/fs/lock.js +3 -12
  443. package/out/fs/lock.js.map +1 -1
  444. package/out/fs/readers/stat.d.ts +9 -14
  445. package/out/fs/readers/stat.d.ts.map +1 -1
  446. package/out/fs/readers/stat.js +11 -11
  447. package/out/fs/readers/stat.js.map +1 -1
  448. package/out/fs/readers.d.ts +11 -16
  449. package/out/fs/readers.d.ts.map +1 -1
  450. package/out/fs/readers.js +15 -10
  451. package/out/fs/readers.js.map +1 -1
  452. package/out/fs/snapshot.d.ts +51 -0
  453. package/out/fs/snapshot.d.ts.map +1 -0
  454. package/out/fs/snapshot.js +67 -0
  455. package/out/fs/snapshot.js.map +1 -0
  456. package/out/fs/streams.d.ts +6 -9
  457. package/out/fs/streams.d.ts.map +1 -1
  458. package/out/fs/streams.js +8 -9
  459. package/out/fs/streams.js.map +1 -1
  460. package/out/fs/temporary.d.ts +1 -10
  461. package/out/fs/temporary.d.ts.map +1 -1
  462. package/out/fs/temporary.js +3 -4
  463. package/out/fs/temporary.js.map +1 -1
  464. package/out/fs/writers.d.ts +3 -11
  465. package/out/fs/writers.d.ts.map +1 -1
  466. package/out/fs/writers.js +5 -6
  467. package/out/fs/writers.js.map +1 -1
  468. package/out/fs/zip.d.ts +2 -19
  469. package/out/fs/zip.d.ts.map +1 -1
  470. package/out/fs/zip.js +82 -20
  471. package/out/fs/zip.js.map +1 -1
  472. package/out/geocode/result.d.ts +3 -11
  473. package/out/geocode/result.d.ts.map +1 -1
  474. package/out/geocode/result.js +15 -7
  475. package/out/geocode/result.js.map +1 -1
  476. package/out/git.d.ts +15 -8
  477. package/out/git.d.ts.map +1 -1
  478. package/out/git.js +34 -9
  479. package/out/git.js.map +1 -1
  480. package/out/hash.d.ts +8 -6
  481. package/out/hash.d.ts.map +1 -1
  482. package/out/hash.js +2 -4
  483. package/out/hash.js.map +1 -1
  484. package/out/html/document.d.ts +0 -13
  485. package/out/html/document.d.ts.map +1 -1
  486. package/out/html/document.js +8 -6
  487. package/out/html/document.js.map +1 -1
  488. package/out/html/elements.d.ts +1 -20
  489. package/out/html/elements.d.ts.map +1 -1
  490. package/out/html/elements.js +17 -14
  491. package/out/html/elements.js.map +1 -1
  492. package/out/html/tables.d.ts +0 -8
  493. package/out/html/tables.d.ts.map +1 -1
  494. package/out/html/tables.js +4 -5
  495. package/out/html/tables.js.map +1 -1
  496. package/out/html/text.d.ts +1 -17
  497. package/out/html/text.d.ts.map +1 -1
  498. package/out/html/text.js +9 -10
  499. package/out/html/text.js.map +1 -1
  500. package/out/identical.d.ts +0 -9
  501. package/out/identical.d.ts.map +1 -1
  502. package/out/identical.js +6 -6
  503. package/out/identical.js.map +1 -1
  504. package/out/index.d.ts +0 -5
  505. package/out/index.d.ts.map +1 -1
  506. package/out/index.js +2 -5
  507. package/out/index.js.map +1 -1
  508. package/out/json.d.ts +8 -9
  509. package/out/json.d.ts.map +1 -1
  510. package/out/json.js +6 -16
  511. package/out/json.js.map +1 -1
  512. package/out/layers/artifact.d.ts +9 -27
  513. package/out/layers/artifact.d.ts.map +1 -1
  514. package/out/layers/artifact.js +6 -7
  515. package/out/layers/artifact.js.map +1 -1
  516. package/out/layers/build-command.d.ts +0 -10
  517. package/out/layers/build-command.d.ts.map +1 -1
  518. package/out/layers/build-command.js +6 -7
  519. package/out/layers/build-command.js.map +1 -1
  520. package/out/layers/coverage.d.ts +4 -10
  521. package/out/layers/coverage.d.ts.map +1 -1
  522. package/out/layers/coverage.js +4 -5
  523. package/out/layers/coverage.js.map +1 -1
  524. package/out/layers/feature-count.d.ts +1 -6
  525. package/out/layers/feature-count.d.ts.map +1 -1
  526. package/out/layers/feature-count.js +3 -6
  527. package/out/layers/feature-count.js.map +1 -1
  528. package/out/layers/manifest.d.ts +3 -7
  529. package/out/layers/manifest.d.ts.map +1 -1
  530. package/out/layers/manifest.js +2 -4
  531. package/out/layers/manifest.js.map +1 -1
  532. package/out/layers/outcome.d.ts +9 -12
  533. package/out/layers/outcome.d.ts.map +1 -1
  534. package/out/layers/outcome.js +11 -12
  535. package/out/layers/outcome.js.map +1 -1
  536. package/out/layers/publication.d.ts +1 -21
  537. package/out/layers/publication.d.ts.map +1 -1
  538. package/out/layers/publication.js +3 -4
  539. package/out/layers/publication.js.map +1 -1
  540. package/out/layers/recipe.d.ts +1 -4
  541. package/out/layers/recipe.d.ts.map +1 -1
  542. package/out/layers/recipe.js +2 -15
  543. package/out/layers/recipe.js.map +1 -1
  544. package/out/layers/schema.d.ts +15 -15
  545. package/out/layers/schema.d.ts.map +1 -1
  546. package/out/layers/schema.js +2 -13
  547. package/out/layers/schema.js.map +1 -1
  548. package/out/layers/selection.d.ts +4 -24
  549. package/out/layers/selection.d.ts.map +1 -1
  550. package/out/layers/selection.js +6 -7
  551. package/out/layers/selection.js.map +1 -1
  552. package/out/layers.d.ts +2 -5
  553. package/out/layers.d.ts.map +1 -1
  554. package/out/layers.js +4 -5
  555. package/out/layers.js.map +1 -1
  556. package/out/license/configured.d.ts +5 -8
  557. package/out/license/configured.d.ts.map +1 -1
  558. package/out/license/configured.js +7 -8
  559. package/out/license/configured.js.map +1 -1
  560. package/out/license/decision.d.ts +4 -20
  561. package/out/license/decision.d.ts.map +1 -1
  562. package/out/license/decision.js +15 -14
  563. package/out/license/decision.js.map +1 -1
  564. package/out/license/declaration.d.ts +5 -7
  565. package/out/license/declaration.d.ts.map +1 -1
  566. package/out/license/declaration.js +2 -9
  567. package/out/license/declaration.js.map +1 -1
  568. package/out/license/docs-site.d.ts +0 -8
  569. package/out/license/docs-site.d.ts.map +1 -1
  570. package/out/license/docs-site.js +5 -5
  571. package/out/license/docs-site.js.map +1 -1
  572. package/out/license/install-id.d.ts +0 -9
  573. package/out/license/install-id.d.ts.map +1 -1
  574. package/out/license/install-id.js +7 -6
  575. package/out/license/install-id.js.map +1 -1
  576. package/out/license/key/file.d.ts +0 -11
  577. package/out/license/key/file.d.ts.map +1 -1
  578. package/out/license/key/file.js +11 -8
  579. package/out/license/key/file.js.map +1 -1
  580. package/out/license/key.d.ts +5 -7
  581. package/out/license/key.d.ts.map +1 -1
  582. package/out/license/key.js +8 -8
  583. package/out/license/key.js.map +1 -1
  584. package/out/license/obligations.d.ts +2 -10
  585. package/out/license/obligations.d.ts.map +1 -1
  586. package/out/license/obligations.js +7 -9
  587. package/out/license/obligations.js.map +1 -1
  588. package/out/license/publication.d.ts +4 -7
  589. package/out/license/publication.d.ts.map +1 -1
  590. package/out/license/publication.js +8 -9
  591. package/out/license/publication.js.map +1 -1
  592. package/out/license/record.d.ts +2 -5
  593. package/out/license/record.d.ts.map +1 -1
  594. package/out/license/record.js +7 -7
  595. package/out/license/record.js.map +1 -1
  596. package/out/license/register.d.ts +9 -11
  597. package/out/license/register.d.ts.map +1 -1
  598. package/out/license/register.js +11 -11
  599. package/out/license/register.js.map +1 -1
  600. package/out/license/stamp.d.ts +0 -8
  601. package/out/license/stamp.d.ts.map +1 -1
  602. package/out/license/stamp.js +4 -4
  603. package/out/license/stamp.js.map +1 -1
  604. package/out/license/status.d.ts +2 -16
  605. package/out/license/status.d.ts.map +1 -1
  606. package/out/license/status.js +6 -18
  607. package/out/license/status.js.map +1 -1
  608. package/out/license.d.ts +7 -7
  609. package/out/license.d.ts.map +1 -1
  610. package/out/license.js +9 -7
  611. package/out/license.js.map +1 -1
  612. package/out/load-ledger.d.ts +80 -0
  613. package/out/load-ledger.d.ts.map +1 -0
  614. package/out/load-ledger.js +53 -0
  615. package/out/load-ledger.js.map +1 -0
  616. package/out/locale/locale.d.ts +6 -8
  617. package/out/locale/locale.d.ts.map +1 -1
  618. package/out/locale/locale.js +2 -12
  619. package/out/locale/locale.js.map +1 -1
  620. package/out/locale/profiles/en-us.d.ts +2 -5
  621. package/out/locale/profiles/en-us.d.ts.map +1 -1
  622. package/out/locale/profiles/en-us.js +2 -7
  623. package/out/locale/profiles/en-us.js.map +1 -1
  624. package/out/locale/profiles/fr-fr.d.ts +3 -5
  625. package/out/locale/profiles/fr-fr.d.ts.map +1 -1
  626. package/out/locale/profiles/fr-fr.js +2 -8
  627. package/out/locale/profiles/fr-fr.js.map +1 -1
  628. package/out/locale/profiles/ja-jp.d.ts +2 -5
  629. package/out/locale/profiles/ja-jp.d.ts.map +1 -1
  630. package/out/locale/profiles/ja-jp.js +2 -7
  631. package/out/locale/profiles/ja-jp.js.map +1 -1
  632. package/out/locale/profiles.d.ts +0 -5
  633. package/out/locale/profiles.d.ts.map +1 -1
  634. package/out/locale/profiles.js +2 -5
  635. package/out/locale/profiles.js.map +1 -1
  636. package/out/locale/registry.d.ts +0 -9
  637. package/out/locale/registry.d.ts.map +1 -1
  638. package/out/locale/registry.js +6 -6
  639. package/out/locale/registry.js.map +1 -1
  640. package/out/locale/zh-cn-units.d.ts +2 -5
  641. package/out/locale/zh-cn-units.d.ts.map +1 -1
  642. package/out/locale/zh-cn-units.js +4 -5
  643. package/out/locale/zh-cn-units.js.map +1 -1
  644. package/out/locale.d.ts +0 -5
  645. package/out/locale.d.ts.map +1 -1
  646. package/out/locale.js +2 -5
  647. package/out/locale.js.map +1 -1
  648. package/out/logging/shared.d.ts +0 -5
  649. package/out/logging/shared.d.ts.map +1 -1
  650. package/out/logging/shared.js +4 -7
  651. package/out/logging/shared.js.map +1 -1
  652. package/out/logging/utils.d.ts +0 -5
  653. package/out/logging/utils.d.ts.map +1 -1
  654. package/out/logging/utils.js +2 -5
  655. package/out/logging/utils.js.map +1 -1
  656. package/out/logging.d.ts +0 -5
  657. package/out/logging.d.ts.map +1 -1
  658. package/out/logging.js +2 -5
  659. package/out/logging.js.map +1 -1
  660. package/out/memoize.d.ts +13 -0
  661. package/out/memoize.d.ts.map +1 -0
  662. package/out/memoize.js +26 -0
  663. package/out/memoize.js.map +1 -0
  664. package/out/module/checkout-locality.d.ts +102 -0
  665. package/out/module/checkout-locality.d.ts.map +1 -0
  666. package/out/module/checkout-locality.js +130 -0
  667. package/out/module/checkout-locality.js.map +1 -0
  668. package/out/module/clean.d.ts +3 -5
  669. package/out/module/clean.d.ts.map +1 -1
  670. package/out/module/clean.js +2 -8
  671. package/out/module/clean.js.map +1 -1
  672. package/out/module/compiled-freshness.d.ts +0 -3
  673. package/out/module/compiled-freshness.d.ts.map +1 -1
  674. package/out/module/compiled-freshness.js +2 -3
  675. package/out/module/compiled-freshness.js.map +1 -1
  676. package/out/module/file-url.d.ts +1 -8
  677. package/out/module/file-url.d.ts.map +1 -1
  678. package/out/module/file-url.js +3 -5
  679. package/out/module/file-url.js.map +1 -1
  680. package/out/module/package-command.d.ts +0 -3
  681. package/out/module/package-command.d.ts.map +1 -1
  682. package/out/module/package-command.js +2 -0
  683. package/out/module/package-command.js.map +1 -1
  684. package/out/module/packaged-data.d.ts +0 -11
  685. package/out/module/packaged-data.d.ts.map +1 -1
  686. package/out/module/packaged-data.js +8 -8
  687. package/out/module/packaged-data.js.map +1 -1
  688. package/out/module/resolve-from.d.ts +3 -16
  689. package/out/module/resolve-from.d.ts.map +1 -1
  690. package/out/module/resolve-from.js +16 -12
  691. package/out/module/resolve-from.js.map +1 -1
  692. package/out/module/resolvers.d.ts +5 -12
  693. package/out/module/resolvers.d.ts.map +1 -1
  694. package/out/module/resolvers.js +7 -9
  695. package/out/module/resolvers.js.map +1 -1
  696. package/out/module/runtime.d.ts +0 -5
  697. package/out/module/runtime.d.ts.map +1 -1
  698. package/out/module/runtime.js +2 -5
  699. package/out/module/runtime.js.map +1 -1
  700. package/out/module/workspace.d.ts +4 -6
  701. package/out/module/workspace.d.ts.map +1 -1
  702. package/out/module/workspace.js +6 -6
  703. package/out/module/workspace.js.map +1 -1
  704. package/out/network/connectivity.d.ts +60 -0
  705. package/out/network/connectivity.d.ts.map +1 -0
  706. package/out/network/connectivity.js +66 -0
  707. package/out/network/connectivity.js.map +1 -0
  708. package/out/network/reachability.d.ts +45 -0
  709. package/out/network/reachability.d.ts.map +1 -0
  710. package/out/network/reachability.js +79 -0
  711. package/out/network/reachability.js.map +1 -0
  712. package/out/numeric.d.ts +0 -3
  713. package/out/numeric.d.ts.map +1 -1
  714. package/out/numeric.js +10 -11
  715. package/out/numeric.js.map +1 -1
  716. package/out/objects.d.ts +2 -6
  717. package/out/objects.d.ts.map +1 -1
  718. package/out/objects.js +4 -9
  719. package/out/objects.js.map +1 -1
  720. package/out/overture-pins.d.ts +1 -4
  721. package/out/overture-pins.d.ts.map +1 -1
  722. package/out/overture-pins.js +3 -4
  723. package/out/overture-pins.js.map +1 -1
  724. package/out/paths.d.ts +4 -7
  725. package/out/paths.d.ts.map +1 -1
  726. package/out/paths.js +9 -10
  727. package/out/paths.js.map +1 -1
  728. package/out/pipeline/client-result.d.ts +38 -16
  729. package/out/pipeline/client-result.d.ts.map +1 -1
  730. package/out/pipeline/client-result.js +2 -10
  731. package/out/pipeline/client-result.js.map +1 -1
  732. package/out/pipeline/preferences.d.ts +0 -2
  733. package/out/pipeline/preferences.d.ts.map +1 -1
  734. package/out/pipeline/preferences.js +2 -5
  735. package/out/pipeline/preferences.js.map +1 -1
  736. package/out/pipeline/result.d.ts +1 -5
  737. package/out/pipeline/result.d.ts.map +1 -1
  738. package/out/pipeline/result.js +2 -4
  739. package/out/pipeline/result.js.map +1 -1
  740. package/out/pipeline/runtime-pipeline.d.ts +10 -7
  741. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  742. package/out/pipeline/runtime-pipeline.js +21 -11
  743. package/out/pipeline/runtime-pipeline.js.map +1 -1
  744. package/out/pipeline/span-proposer.d.ts +2 -10
  745. package/out/pipeline/span-proposer.d.ts.map +1 -1
  746. package/out/pipeline/span-proposer.js +8 -8
  747. package/out/pipeline/span-proposer.js.map +1 -1
  748. package/out/pipeline/types.d.ts +27 -6
  749. package/out/pipeline/types.d.ts.map +1 -1
  750. package/out/pipeline/types.js +5 -9
  751. package/out/pipeline/types.js.map +1 -1
  752. package/out/pipeline.d.ts +0 -4
  753. package/out/pipeline.d.ts.map +1 -1
  754. package/out/pipeline.js +2 -4
  755. package/out/pipeline.js.map +1 -1
  756. package/out/policy/defaults.d.ts +2 -6
  757. package/out/policy/defaults.d.ts.map +1 -1
  758. package/out/policy/defaults.js +4 -6
  759. package/out/policy/defaults.js.map +1 -1
  760. package/out/policy/policy.d.ts +0 -4
  761. package/out/policy/policy.d.ts.map +1 -1
  762. package/out/policy/policy.js +2 -7
  763. package/out/policy/policy.js.map +1 -1
  764. package/out/policy/proposal-collection.d.ts +0 -4
  765. package/out/policy/proposal-collection.d.ts.map +1 -1
  766. package/out/policy/proposal-collection.js +2 -7
  767. package/out/policy/proposal-collection.js.map +1 -1
  768. package/out/policy/registry.d.ts +6 -7
  769. package/out/policy/registry.d.ts.map +1 -1
  770. package/out/policy/registry.js +2 -11
  771. package/out/policy/registry.js.map +1 -1
  772. package/out/policy.d.ts +0 -5
  773. package/out/policy.d.ts.map +1 -1
  774. package/out/policy.js +2 -5
  775. package/out/policy.js.map +1 -1
  776. package/out/postcode-prefix-files.d.ts +5 -7
  777. package/out/postcode-prefix-files.d.ts.map +1 -1
  778. package/out/postcode-prefix-files.js +7 -7
  779. package/out/postcode-prefix-files.js.map +1 -1
  780. package/out/process.d.ts +10 -13
  781. package/out/process.d.ts.map +1 -1
  782. package/out/process.js +11 -12
  783. package/out/process.js.map +1 -1
  784. package/out/promises.d.ts +3 -4
  785. package/out/promises.d.ts.map +1 -1
  786. package/out/promises.js +5 -4
  787. package/out/promises.js.map +1 -1
  788. package/out/random.d.ts +0 -10
  789. package/out/random.d.ts.map +1 -1
  790. package/out/random.js +6 -6
  791. package/out/random.js.map +1 -1
  792. package/out/release-config.d.ts +9 -4
  793. package/out/release-config.d.ts.map +1 -1
  794. package/out/release-config.js +4 -4
  795. package/out/release-config.js.map +1 -1
  796. package/out/resolver/authoritative-provider.d.ts +14 -11
  797. package/out/resolver/authoritative-provider.d.ts.map +1 -1
  798. package/out/resolver/authoritative-provider.js +3 -15
  799. package/out/resolver/authoritative-provider.js.map +1 -1
  800. package/out/resolver/coverage-facts.d.ts +4 -6
  801. package/out/resolver/coverage-facts.d.ts.map +1 -1
  802. package/out/resolver/coverage-facts.js +2 -10
  803. package/out/resolver/coverage-facts.js.map +1 -1
  804. package/out/resolver/fixture-authoritative-provider.d.ts +10 -11
  805. package/out/resolver/fixture-authoritative-provider.d.ts.map +1 -1
  806. package/out/resolver/fixture-authoritative-provider.js +12 -11
  807. package/out/resolver/fixture-authoritative-provider.js.map +1 -1
  808. package/out/resolver/lookup-types.d.ts +7 -5
  809. package/out/resolver/lookup-types.d.ts.map +1 -1
  810. package/out/resolver/lookup-types.js +2 -11
  811. package/out/resolver/lookup-types.js.map +1 -1
  812. package/out/resolver/referential.d.ts +8 -6
  813. package/out/resolver/referential.d.ts.map +1 -1
  814. package/out/resolver/referential.js +10 -6
  815. package/out/resolver/referential.js.map +1 -1
  816. package/out/resolver/region-database-provider.d.ts +1 -4
  817. package/out/resolver/region-database-provider.d.ts.map +1 -1
  818. package/out/resolver/region-database-provider.js +2 -6
  819. package/out/resolver/region-database-provider.js.map +1 -1
  820. package/out/resolver/synthetic-id-ranges.d.ts +1 -4
  821. package/out/resolver/synthetic-id-ranges.d.ts.map +1 -1
  822. package/out/resolver/synthetic-id-ranges.js +3 -4
  823. package/out/resolver/synthetic-id-ranges.js.map +1 -1
  824. package/out/resolver/types.d.ts +64 -55
  825. package/out/resolver/types.d.ts.map +1 -1
  826. package/out/resolver/types.js +15 -7
  827. package/out/resolver/types.js.map +1 -1
  828. package/out/resolver.d.ts +8 -11
  829. package/out/resolver.d.ts.map +1 -1
  830. package/out/resolver.js +9 -10
  831. package/out/resolver.js.map +1 -1
  832. package/out/resources/debugging.d.ts +0 -5
  833. package/out/resources/debugging.d.ts.map +1 -1
  834. package/out/resources/debugging.js +2 -5
  835. package/out/resources/debugging.js.map +1 -1
  836. package/out/resources/languages/types.gen.d.ts +0 -4
  837. package/out/resources/languages/types.gen.d.ts.map +1 -1
  838. package/out/resources/languages/types.gen.js +2 -7
  839. package/out/resources/languages/types.gen.js.map +1 -1
  840. package/out/resources/languages.d.ts +0 -5
  841. package/out/resources/languages.d.ts.map +1 -1
  842. package/out/resources/languages.js +2 -5
  843. package/out/resources/languages.js.map +1 -1
  844. package/out/resources/libpostal.d.ts +0 -9
  845. package/out/resources/libpostal.d.ts.map +1 -1
  846. package/out/resources/libpostal.js +2 -4
  847. package/out/resources/libpostal.js.map +1 -1
  848. package/out/resources/locale.d.ts +0 -5
  849. package/out/resources/locale.d.ts.map +1 -1
  850. package/out/resources/locale.js +2 -5
  851. package/out/resources/locale.js.map +1 -1
  852. package/out/resources/set.d.ts +0 -5
  853. package/out/resources/set.d.ts.map +1 -1
  854. package/out/resources/set.js +2 -5
  855. package/out/resources/set.js.map +1 -1
  856. package/out/resources.d.ts +0 -6
  857. package/out/resources.d.ts.map +1 -1
  858. package/out/resources.js +2 -6
  859. package/out/resources.js.map +1 -1
  860. package/out/routing.d.ts +0 -5
  861. package/out/routing.d.ts.map +1 -1
  862. package/out/routing.js +3 -6
  863. package/out/routing.js.map +1 -1
  864. package/out/scope-config.d.ts +9 -8
  865. package/out/scope-config.d.ts.map +1 -1
  866. package/out/scope-config.js +3 -13
  867. package/out/scope-config.js.map +1 -1
  868. package/out/scripting/arguments.d.ts +7 -9
  869. package/out/scripting/arguments.d.ts.map +1 -1
  870. package/out/scripting/arguments.js +8 -8
  871. package/out/scripting/arguments.js.map +1 -1
  872. package/out/scripting/command.d.ts +3 -5
  873. package/out/scripting/command.d.ts.map +1 -1
  874. package/out/scripting/command.js +5 -5
  875. package/out/scripting/command.js.map +1 -1
  876. package/out/scripting/ingest-chunk-script.d.ts +2 -6
  877. package/out/scripting/ingest-chunk-script.d.ts.map +1 -1
  878. package/out/scripting/ingest-chunk-script.js +4 -6
  879. package/out/scripting/ingest-chunk-script.js.map +1 -1
  880. package/out/scripting/operation.d.ts +39 -5
  881. package/out/scripting/operation.d.ts.map +1 -1
  882. package/out/scripting/operation.js +23 -15
  883. package/out/scripting/operation.js.map +1 -1
  884. package/out/scripting/utils.d.ts.map +1 -1
  885. package/out/scripting/utils.js +2 -0
  886. package/out/scripting/utils.js.map +1 -1
  887. package/out/scripting.d.ts.map +1 -1
  888. package/out/scripting.js +3 -1
  889. package/out/scripting.js.map +1 -1
  890. package/out/spdx-header.d.ts +86 -0
  891. package/out/spdx-header.d.ts.map +1 -0
  892. package/out/spdx-header.js +244 -0
  893. package/out/spdx-header.js.map +1 -0
  894. package/out/state-machine.d.ts +98 -0
  895. package/out/state-machine.d.ts.map +1 -0
  896. package/out/state-machine.js +37 -0
  897. package/out/state-machine.js.map +1 -0
  898. package/out/stats.d.ts +0 -4
  899. package/out/stats.d.ts.map +1 -1
  900. package/out/stats.js +2 -4
  901. package/out/stats.js.map +1 -1
  902. package/out/strings/code-points.d.ts +0 -4
  903. package/out/strings/code-points.d.ts.map +1 -1
  904. package/out/strings/code-points.js +2 -4
  905. package/out/strings/code-points.js.map +1 -1
  906. package/out/strings/compare.d.ts +1 -4
  907. package/out/strings/compare.d.ts.map +1 -1
  908. package/out/strings/compare.js +3 -4
  909. package/out/strings/compare.js.map +1 -1
  910. package/out/strings/escape.d.ts +0 -6
  911. package/out/strings/escape.d.ts.map +1 -1
  912. package/out/strings/escape.js +2 -3
  913. package/out/strings/escape.js.map +1 -1
  914. package/out/strings/format.d.ts +0 -3
  915. package/out/strings/format.d.ts.map +1 -1
  916. package/out/strings/format.js +2 -3
  917. package/out/strings/format.js.map +1 -1
  918. package/out/strings/markdown-table.d.ts +1 -11
  919. package/out/strings/markdown-table.d.ts.map +1 -1
  920. package/out/strings/markdown-table.js +3 -4
  921. package/out/strings/markdown-table.js.map +1 -1
  922. package/out/strings/python-json.d.ts +8 -10
  923. package/out/strings/python-json.d.ts.map +1 -1
  924. package/out/strings/python-json.js +3 -1
  925. package/out/strings/python-json.js.map +1 -1
  926. package/out/strings/regexp.d.ts +0 -3
  927. package/out/strings/regexp.d.ts.map +1 -1
  928. package/out/strings/regexp.js +2 -3
  929. package/out/strings/regexp.js.map +1 -1
  930. package/out/strings/terminal.d.ts +5 -0
  931. package/out/strings/terminal.d.ts.map +1 -0
  932. package/out/strings/terminal.js +18 -0
  933. package/out/strings/terminal.js.map +1 -0
  934. package/out/strings/unicode.d.ts +0 -8
  935. package/out/strings/unicode.d.ts.map +1 -1
  936. package/out/strings/unicode.js +5 -6
  937. package/out/strings/unicode.js.map +1 -1
  938. package/out/tokenization/Graph.d.ts +0 -4
  939. package/out/tokenization/Graph.d.ts.map +1 -1
  940. package/out/tokenization/Graph.js +2 -4
  941. package/out/tokenization/Graph.js.map +1 -1
  942. package/out/tokenization/Span.d.ts +0 -4
  943. package/out/tokenization/Span.d.ts.map +1 -1
  944. package/out/tokenization/Span.js +2 -8
  945. package/out/tokenization/Span.js.map +1 -1
  946. package/out/tokenization/normalizer.d.ts +0 -8
  947. package/out/tokenization/normalizer.d.ts.map +1 -1
  948. package/out/tokenization/normalizer.js +2 -4
  949. package/out/tokenization/normalizer.js.map +1 -1
  950. package/out/tokenization.d.ts +0 -5
  951. package/out/tokenization.d.ts.map +1 -1
  952. package/out/tokenization.js +2 -5
  953. package/out/tokenization.js.map +1 -1
  954. package/out/tools/build-deflate64-wasm.run.d.ts +2 -0
  955. package/out/tools/build-deflate64-wasm.run.d.ts.map +1 -0
  956. package/out/tools/build-deflate64-wasm.run.js +39 -0
  957. package/out/tools/build-deflate64-wasm.run.js.map +1 -0
  958. package/out/tools/coarse-placer/build/dataset.d.ts +2 -5
  959. package/out/tools/coarse-placer/build/dataset.d.ts.map +1 -1
  960. package/out/tools/coarse-placer/build/dataset.js +6 -7
  961. package/out/tools/coarse-placer/build/dataset.js.map +1 -1
  962. package/out/tools/coarse-placer/build/outlier/exposure.d.ts +0 -12
  963. package/out/tools/coarse-placer/build/outlier/exposure.d.ts.map +1 -1
  964. package/out/tools/coarse-placer/build/outlier/exposure.js +7 -8
  965. package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
  966. package/out/tools/coarse-placer/build/outlier/latin.d.ts +16 -17
  967. package/out/tools/coarse-placer/build/outlier/latin.d.ts.map +1 -1
  968. package/out/tools/coarse-placer/build/outlier/latin.js +19 -18
  969. package/out/tools/coarse-placer/build/outlier/latin.js.map +1 -1
  970. package/out/tools/coarse-placer/build/outlier/oa.d.ts +18 -19
  971. package/out/tools/coarse-placer/build/outlier/oa.d.ts.map +1 -1
  972. package/out/tools/coarse-placer/build/outlier/oa.js +21 -20
  973. package/out/tools/coarse-placer/build/outlier/oa.js.map +1 -1
  974. package/out/tools/coarse-placer/country-sets.d.ts +6 -7
  975. package/out/tools/coarse-placer/country-sets.d.ts.map +1 -1
  976. package/out/tools/coarse-placer/country-sets.js +10 -8
  977. package/out/tools/coarse-placer/country-sets.js.map +1 -1
  978. package/out/tools/coarse-placer/eval/latin-offmap.d.ts +6 -8
  979. package/out/tools/coarse-placer/eval/latin-offmap.d.ts.map +1 -1
  980. package/out/tools/coarse-placer/eval/latin-offmap.js +8 -8
  981. package/out/tools/coarse-placer/eval/latin-offmap.js.map +1 -1
  982. package/out/tools/coarse-placer/eval/openset.d.ts +2 -4
  983. package/out/tools/coarse-placer/eval/openset.d.ts.map +1 -1
  984. package/out/tools/coarse-placer/eval/openset.js +4 -4
  985. package/out/tools/coarse-placer/eval/openset.js.map +1 -1
  986. package/out/tools/coarse-placer/eval/quant-compare.d.ts +5 -7
  987. package/out/tools/coarse-placer/eval/quant-compare.d.ts.map +1 -1
  988. package/out/tools/coarse-placer/eval/quant-compare.js +7 -7
  989. package/out/tools/coarse-placer/eval/quant-compare.js.map +1 -1
  990. package/out/tools/coarse-placer/eval.d.ts +5 -7
  991. package/out/tools/coarse-placer/eval.d.ts.map +1 -1
  992. package/out/tools/coarse-placer/eval.js +7 -7
  993. package/out/tools/coarse-placer/eval.js.map +1 -1
  994. package/out/tools/coarse-placer/outlier-rows.d.ts +0 -10
  995. package/out/tools/coarse-placer/outlier-rows.d.ts.map +1 -1
  996. package/out/tools/coarse-placer/outlier-rows.js +9 -8
  997. package/out/tools/coarse-placer/outlier-rows.js.map +1 -1
  998. package/out/tools/coarse-placer/paths.d.ts +3 -5
  999. package/out/tools/coarse-placer/paths.d.ts.map +1 -1
  1000. package/out/tools/coarse-placer/paths.js +5 -5
  1001. package/out/tools/coarse-placer/paths.js.map +1 -1
  1002. package/out/tools/coarse-placer/probe-frontier.d.ts +0 -22
  1003. package/out/tools/coarse-placer/probe-frontier.d.ts.map +1 -1
  1004. package/out/tools/coarse-placer/probe-frontier.js +14 -12
  1005. package/out/tools/coarse-placer/probe-frontier.js.map +1 -1
  1006. package/out/tools/coarse-placer/quantize.d.ts +7 -8
  1007. package/out/tools/coarse-placer/quantize.d.ts.map +1 -1
  1008. package/out/tools/coarse-placer/quantize.js +9 -8
  1009. package/out/tools/coarse-placer/quantize.js.map +1 -1
  1010. package/out/tools/coarse-placer/train.d.ts +6 -8
  1011. package/out/tools/coarse-placer/train.d.ts.map +1 -1
  1012. package/out/tools/coarse-placer/train.js +8 -8
  1013. package/out/tools/coarse-placer/train.js.map +1 -1
  1014. package/out/tools/generate-language-types.d.ts +0 -23
  1015. package/out/tools/generate-language-types.d.ts.map +1 -1
  1016. package/out/tools/generate-language-types.js +16 -17
  1017. package/out/tools/generate-language-types.js.map +1 -1
  1018. package/out/trust-policies.d.ts +0 -20
  1019. package/out/trust-policies.d.ts.map +1 -1
  1020. package/out/trust-policies.js +19 -15
  1021. package/out/trust-policies.js.map +1 -1
  1022. package/out/types/Classification.d.ts +1 -6
  1023. package/out/types/Classification.d.ts.map +1 -1
  1024. package/out/types/Classification.js +3 -6
  1025. package/out/types/Classification.js.map +1 -1
  1026. package/out/types/classifier.d.ts +7 -9
  1027. package/out/types/classifier.d.ts.map +1 -1
  1028. package/out/types/classifier.js +2 -12
  1029. package/out/types/classifier.js.map +1 -1
  1030. package/out/types/mapping.d.ts +10 -14
  1031. package/out/types/mapping.d.ts.map +1 -1
  1032. package/out/types/mapping.js +2 -20
  1033. package/out/types/mapping.js.map +1 -1
  1034. package/out/types.d.ts +0 -5
  1035. package/out/types.d.ts.map +1 -1
  1036. package/out/types.js +2 -5
  1037. package/out/types.js.map +1 -1
  1038. package/out/utils/chunk-process.d.ts +2 -23
  1039. package/out/utils/chunk-process.d.ts.map +1 -1
  1040. package/out/utils/chunk-process.js +13 -10
  1041. package/out/utils/chunk-process.js.map +1 -1
  1042. package/out/utils/collections.d.ts +0 -3
  1043. package/out/utils/collections.d.ts.map +1 -1
  1044. package/out/utils/collections.js +2 -3
  1045. package/out/utils/collections.js.map +1 -1
  1046. package/out/utils/events.d.ts +0 -5
  1047. package/out/utils/events.d.ts.map +1 -1
  1048. package/out/utils/events.js +2 -5
  1049. package/out/utils/events.js.map +1 -1
  1050. package/out/utils/geodatabase-archive.d.ts +7 -8
  1051. package/out/utils/geodatabase-archive.d.ts.map +1 -1
  1052. package/out/utils/geodatabase-archive.js +9 -8
  1053. package/out/utils/geodatabase-archive.js.map +1 -1
  1054. package/out/utils/sleep.d.ts +0 -5
  1055. package/out/utils/sleep.d.ts.map +1 -1
  1056. package/out/utils/sleep.js +2 -5
  1057. package/out/utils/sleep.js.map +1 -1
  1058. package/out/utils/sqlite-rows.d.ts +6 -7
  1059. package/out/utils/sqlite-rows.d.ts.map +1 -1
  1060. package/out/utils/sqlite-rows.js +2 -13
  1061. package/out/utils/sqlite-rows.js.map +1 -1
  1062. package/out/utils/stream-to-disk.d.ts +14 -8
  1063. package/out/utils/stream-to-disk.d.ts.map +1 -1
  1064. package/out/utils/stream-to-disk.js +11 -11
  1065. package/out/utils/stream-to-disk.js.map +1 -1
  1066. package/out/utils/system.d.ts +0 -8
  1067. package/out/utils/system.d.ts.map +1 -1
  1068. package/out/utils/system.js +3 -4
  1069. package/out/utils/system.js.map +1 -1
  1070. package/out/utils/time.d.ts +0 -3
  1071. package/out/utils/time.d.ts.map +1 -1
  1072. package/out/utils/time.js +2 -3
  1073. package/out/utils/time.js.map +1 -1
  1074. package/out/utils/union-find.d.ts +0 -3
  1075. package/out/utils/union-find.d.ts.map +1 -1
  1076. package/out/utils/union-find.js +2 -6
  1077. package/out/utils/union-find.js.map +1 -1
  1078. package/out/utils.d.ts +0 -5
  1079. package/out/utils.d.ts.map +1 -1
  1080. package/out/utils.js +2 -5
  1081. package/out/utils.js.map +1 -1
  1082. package/out/vale.d.ts +0 -9
  1083. package/out/vale.d.ts.map +1 -1
  1084. package/out/vale.js +4 -5
  1085. package/out/vale.js.map +1 -1
  1086. package/out/workers.d.ts +3 -3
  1087. package/out/workers.d.ts.map +1 -1
  1088. package/out/workers.js +8 -4
  1089. package/out/workers.js.map +1 -1
  1090. package/out/workspaces.d.ts +2 -4
  1091. package/out/workspaces.d.ts.map +1 -1
  1092. package/out/workspaces.js +4 -4
  1093. package/out/workspaces.js.map +1 -1
  1094. package/package.json +106 -47
  1095. package/tools/build-deflate64-wasm.run.ts +50 -0
  1096. package/tools/coarse-placer/build/dataset.ts +7 -7
  1097. package/tools/coarse-placer/build/outlier/exposure.ts +8 -8
  1098. package/tools/coarse-placer/build/outlier/latin.ts +21 -19
  1099. package/tools/coarse-placer/build/outlier/oa.ts +23 -21
  1100. package/tools/coarse-placer/country-sets.ts +11 -8
  1101. package/tools/coarse-placer/eval/latin-offmap.ts +9 -8
  1102. package/tools/coarse-placer/eval/openset.ts +5 -4
  1103. package/tools/coarse-placer/eval/quant-compare.ts +8 -7
  1104. package/tools/coarse-placer/eval.ts +8 -7
  1105. package/tools/coarse-placer/outlier-rows.ts +10 -8
  1106. package/tools/coarse-placer/paths.ts +6 -5
  1107. package/tools/coarse-placer/probe-frontier.ts +15 -12
  1108. package/tools/coarse-placer/quantize.ts +10 -8
  1109. package/tools/coarse-placer/train.ts +9 -8
  1110. package/tools/generate-language-types.ts +17 -17
  1111. package/wasm/deflate64.wasm +0 -0
  1112. package/lib/resources/git.ts +0 -69
  1113. package/out/resources/git.d.ts +0 -36
  1114. package/out/resources/git.d.ts.map +0 -1
  1115. package/out/resources/git.js +0 -34
  1116. package/out/resources/git.js.map +0 -1
@@ -1,21 +1,29 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
1
3
  /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
4
+ * What an operation or a state machine's effect does to the world, declared rather than inferred.
5
5
  *
6
- * This module defines the shape of each operator capability.
7
- * An operation has an ID and a declared effect.
8
- * It accepts typed input and returns typed output.
9
- * Its `run` function performs the operation.
10
- * An adapter such as the private `mwops` CLI or an MCP server views a registry of operations.
11
- * The adapter adds no separate logic.
12
- *
13
- * An operation family chooses its effect union and context.
14
- * Release operations are one example. Storage and shop are two others.
15
- * The family binds its effect and context through {@link operationDefiner}.
16
- * A call site infers input and output types from its schemas.
17
- * The `run` function receives the family's context without the caller naming it.
6
+ * `external-write` marks the writes that leave this machine: a publish to npm,
7
+ * Hugging Face or R2, a ledger row, a Stripe call, an email.
18
8
  */
9
+ export const OperationEffect = {
10
+ /**
11
+ * Reads the checkout, the data root, a database or a registry.
12
+ * It makes no changes.
13
+ */
14
+ Read: "read",
15
+ /**
16
+ * Writes inside the checkout or the data root (a staging tree, a materialized binary, a generated surface).
17
+ */
18
+ LocalWrite: "local-write",
19
+ /**
20
+ * Writes to a system outside this machine.
21
+ *
22
+ * A release operation with this effect is irreversible and credentialed,
23
+ * and only the plan → execute interface can reach it.
24
+ */
25
+ ExternalWrite: "external-write",
26
+ };
19
27
  /**
20
28
  * Bind a family's effect union and context once.
21
29
  *
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../lib/scripting/operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAyDH;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB;IAI/B,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAA;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC5B,QAAmC,EACnC,MAAc,EACd,IAAY;IAEZ,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAA;IAE1D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAA;AACjE,CAAC"}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../lib/scripting/operation.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AA0BlE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B;;;OAGG;IACH,IAAI,EAAE,MAAM;IACZ;;OAEG;IACH,UAAU,EAAE,aAAa;IACzB;;;;;OAKG;IACH,aAAa,EAAE,gBAAgB;CACtB,CAAA;AAgEV;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB;IAI/B,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAA;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAC5B,QAAmC,EACnC,MAAc,EACd,IAAY;IAEZ,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAA;IAE1D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAA;AACjE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/scripting/utils.ts"],"names":[],"mappings":"AAKA;;;;GA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AAO,CAAC,IAAI,CAAC,CAevE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAM,GAAG,MAAM,CAAC,UAAU,CASrG"}
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
1
3
  import { defaultRegistry } from "async-init";
2
4
  import { ResourceError } from "#errors/schema";
3
5
  import { ConsoleLogger } from "#logging";
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/scripting/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAA;IAEpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,aAAa,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAA;IAElE,MAAM,eAAe,GAAG,KAAK,YAAY,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAE1F,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IAEpC,IAAI,eAAe,CAAC,KAAK,YAAY,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAC3E,aAAa,CAAC,KAAK,CAAC,oBAAoB,GAAG,eAAe,CAAC,KAAK,CAAC,KAAK,C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AG,OAAO,CAAC,IAAI,CAAC,CAyBjG"}
1
+ {"version":3,"file":"scripting.d.ts","sourceRoot":"","sources":["../lib/scripting.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,cAAc,sBAAsB,CAAA;AAEpC;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBjG"}
package/out/scripting.js CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
1
3
  export * from "#scripting/operation";
2
4
  /**
3
5
  * Given the calling module's import.meta object, runs the callback if that module is the entry script.
@@ -15,7 +17,7 @@ export * from "#scripting/operation";
15
17
  export async function runIfScript(meta, scriptCallback) {
16
18
  if (typeof meta.main !== "boolean") {
17
19
  // Vite/vitest module graphs define import.meta.env but never import.meta.main.
18
- // A module imported there is not the entry script, so importing it must stay side-effect-free.
20
+ // A module imported there's not the entry script, so importing it must stay side-effect-free.
19
21
  if (meta.env)
20
22
  return;
21
23
  throw new Error("Expected import.meta.main to be a boolean. Are we on Node.js 24+?");
@@ -1 +1 @@
1
- {"version":3,"file":"scripting.js","sourceRoot":"","sources":["../lib/scripting.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAA;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAgB,EAAE,cAA8B;IACjF,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACpC,+EAA+E;QAC/E,+FAA+F;QAC/F,IAAK,IAA0B,CAAC,GAAG;YAAE,OAAM;QAE3C,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAA;IACrF,CAAC;IAED,IAAI,CAAC,IAA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QAC9B,WAAW,EAAE,oBAAoB;QACjC,UAAU,EAAE,IAAI;KAChB,CAAC,CACF,CAAA;IAED,OAAO,SAAS,CAAC,cAAc,CAAC,CAAA;AACjC,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @file The SPDX header every first-party source file starts with, and the rewrite from the old JSDoc header.
3
+ *
4
+ * A file starts with an optional shebang, then the two SPDX lines in the file's comment syntax, then one blank line.
5
+ * Oxfmt's import sorter attaches a comment that touches the first import to that import.
6
+ * Without the blank line, a reordering of the imports moves the header away from the top of the file.
7
+ *
8
+ * The `mailwoman/spdx-header` oxlint rule, the `spdx-header` repository check and the sweep tool all call
9
+ * {@linkcode rewriteSourceHeader}, so each of them agrees on what a correct file is.
10
+ */
11
+ /**
12
+ * The copyright holders a header names.
13
+ *
14
+ * Contributors keep the copyright in their own contributions, because `CONTRIBUTING.md` asks for a license grant.
15
+ */
16
+ export declare const SPDX_FILE_COPYRIGHT_TEXT = "Teffen Ellis and Mailwoman contributors";
17
+ /**
18
+ * The license expression every `package.json`, `Cargo.toml` and `LICENSE.md` declares.
19
+ */
20
+ export declare const SPDX_LICENSE_EXPRESSION = "AGPL-3.0-only OR LicenseRef-Commercial";
21
+ /**
22
+ * The comment syntax a header is written in.
23
+ */
24
+ export declare const SourceHeaderSyntax: {
25
+ /**
26
+ * `//` line comments: JavaScript, TypeScript, Rust, Java and C++.
27
+ */
28
+ readonly Slash: "slash";
29
+ /**
30
+ * `#` line comments: shell.
31
+ */
32
+ readonly Hash: "hash";
33
+ /**
34
+ * One `/* … *\/` comment per line: CSS.
35
+ */
36
+ readonly CSS: "css";
37
+ };
38
+ /**
39
+ * A comment syntax from {@linkcode SourceHeaderSyntax}.
40
+ */
41
+ export type SourceHeaderSyntax = (typeof SourceHeaderSyntax)[keyof typeof SourceHeaderSyntax];
42
+ /**
43
+ * Repository paths whose content is generated or vendored, or whose exact lines a test reads.
44
+ *
45
+ * A directory entry ends with `/`.
46
+ */
47
+ export declare const SPDX_HEADER_EXEMPT_PATHS: readonly string[];
48
+ /**
49
+ * The header syntax for a repository-relative path, or null when the path takes no header.
50
+ */
51
+ export declare function sourceHeaderSyntax(path: string): SourceHeaderSyntax | null;
52
+ /**
53
+ * Whether a path is JavaScript or TypeScript.
54
+ *
55
+ * The header rewrite for such a path needs the parser's comment ranges.
56
+ */
57
+ export declare function isScriptSourcePath(path: string): boolean;
58
+ /**
59
+ * The two SPDX lines for a syntax, without line endings.
60
+ */
61
+ export declare function spdxHeaderLines(syntax: SourceHeaderSyntax): readonly [string, string];
62
+ /**
63
+ * The header text a generator writes before a module's own content: both SPDX lines and the blank line.
64
+ */
65
+ export declare function spdxHeaderText(syntax: SourceHeaderSyntax): string;
66
+ /**
67
+ * The start and end offsets of one comment, as a parser reports it.
68
+ */
69
+ export type CommentRange = readonly [start: number, end: number];
70
+ /**
71
+ * Returns `text` with the SPDX header as its first lines and the old JSDoc header's tags removed.
72
+ *
73
+ * The rest of the old header's comment stays where it was.
74
+ * A comment left empty is deleted.
75
+ *
76
+ * A file that already starts correctly comes back unchanged, so the rewrite is idempotent.
77
+ *
78
+ * A JavaScript or TypeScript caller passes `comments`, the parser's comment ranges.
79
+ * A template literal can spell the old header, and only the parser tells it from a comment.
80
+ */
81
+ export declare function rewriteSourceHeader(text: string, syntax: SourceHeaderSyntax, comments?: readonly CommentRange[]): string;
82
+ /**
83
+ * Describes what's wrong with a file's header, or returns null when the file starts correctly.
84
+ */
85
+ export declare function sourceHeaderProblem(text: string, syntax: SourceHeaderSyntax, comments?: readonly CommentRange[]): string | null;
86
+ //# sourceMappingURL=spdx-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spdx-header.d.ts","sourceRoot":"","sources":["../lib/spdx-header.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,4CAA4C,CAAA;AAEjF;;GAEG;AACH,eAAO,MAAM,uBAAuB,2CAA2C,CAAA;AAE/E;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ial
3
+ /**
4
+ * @file The SPDX header every first-party source file starts with, and the rewrite from the old JSDoc header.
5
+ *
6
+ * A file starts with an optional shebang, then the two SPDX lines in the file's comment syntax, then one blank line.
7
+ * Oxfmt's import sorter attaches a comment that touches the first import to that import.
8
+ * Without the blank line, a reordering of the imports moves the header away from the top of the file.
9
+ *
10
+ * The `mailwoman/spdx-header` oxlint rule, the `spdx-header` repository check and the sweep tool all call
11
+ * {@linkcode rewriteSourceHeader}, so each of them agrees on what a correct file is.
12
+ */
13
+ /**
14
+ * The copyright holders a header names.
15
+ *
16
+ * Contributors keep the copyright in their own contributions, because `CONTRIBUTING.md` asks for a license grant.
17
+ */
18
+ export const SPDX_FILE_COPYRIGHT_TEXT = "Teffen Ellis and Mailwoman contributors";
19
+ /**
20
+ * The license expression every `package.json`, `Cargo.toml` and `LICENSE.md` declares.
21
+ */
22
+ export const SPDX_LICENSE_EXPRESSION = "AGPL-3.0-only OR LicenseRef-Commercial";
23
+ /**
24
+ * The comment syntax a header is written in.
25
+ */
26
+ export const SourceHeaderSyntax = {
27
+ /**
28
+ * `//` line comments: JavaScript, TypeScript, Rust, Java and C++.
29
+ */
30
+ Slash: "slash",
31
+ /**
32
+ * `#` line comments: shell.
33
+ */
34
+ Hash: "hash",
35
+ /**
36
+ * One `/* … *\/` comment per line: CSS.
37
+ */
38
+ CSS: "css",
39
+ };
40
+ const SYNTAX_BY_EXTENSION = new Map([
41
+ ["ts", SourceHeaderSyntax.Slash],
42
+ ["tsx", SourceHeaderSyntax.Slash],
43
+ ["mts", SourceHeaderSyntax.Slash],
44
+ ["cts", SourceHeaderSyntax.Slash],
45
+ ["js", SourceHeaderSyntax.Slash],
46
+ ["mjs", SourceHeaderSyntax.Slash],
47
+ ["cjs", SourceHeaderSyntax.Slash],
48
+ ["rs", SourceHeaderSyntax.Slash],
49
+ ["java", SourceHeaderSyntax.Slash],
50
+ ["cpp", SourceHeaderSyntax.Slash],
51
+ ["sh", SourceHeaderSyntax.Hash],
52
+ ["css", SourceHeaderSyntax.CSS],
53
+ ]);
54
+ /**
55
+ * Repository paths whose content is generated or vendored, or whose exact lines a test reads.
56
+ *
57
+ * A directory entry ends with `/`.
58
+ */
59
+ export const SPDX_HEADER_EXEMPT_PATHS = [
60
+ // Yarn's own release bundle.
61
+ ".yarn/",
62
+ // The Vale fixtures assert alerts by line.
63
+ "config/vale/fixtures/",
64
+ // Emscripten writes this loader; `build.sh` regenerates it.
65
+ "packages/sentencepiece-wasm/sentencepiece.mjs",
66
+ ];
67
+ /**
68
+ * The header syntax for a repository-relative path, or null when the path takes no header.
69
+ */
70
+ export function sourceHeaderSyntax(path) {
71
+ if (SPDX_HEADER_EXEMPT_PATHS.some((exempt) => (exempt.endsWith("/") ? path.startsWith(exempt) : path === exempt))) {
72
+ return null;
73
+ }
74
+ if (path.endsWith(".d.ts"))
75
+ return SourceHeaderSyntax.Slash;
76
+ const extension = /\.([a-z]+)$/.exec(path)?.[1];
77
+ return extension == null ? null : (SYNTAX_BY_EXTENSION.get(extension) ?? null);
78
+ }
79
+ const SCRIPT_EXTENSIONS = /\.(?:ts|tsx|mts|cts|js|mjs|cjs)$/;
80
+ /**
81
+ * Whether a path is JavaScript or TypeScript.
82
+ *
83
+ * The header rewrite for such a path needs the parser's comment ranges.
84
+ */
85
+ export function isScriptSourcePath(path) {
86
+ return SCRIPT_EXTENSIONS.test(path);
87
+ }
88
+ /**
89
+ * The two SPDX lines for a syntax, without line endings.
90
+ */
91
+ export function spdxHeaderLines(syntax) {
92
+ const tags = [
93
+ `SPDX-FileCopyrightText: ${SPDX_FILE_COPYRIGHT_TEXT}`,
94
+ `SPDX-License-Identifier: ${SPDX_LICENSE_EXPRESSION}`,
95
+ ];
96
+ switch (syntax) {
97
+ case SourceHeaderSyntax.Slash:
98
+ return [`// ${tags[0]}`, `// ${tags[1]}`];
99
+ case SourceHeaderSyntax.Hash:
100
+ return [`# ${tags[0]}`, `# ${tags[1]}`];
101
+ case SourceHeaderSyntax.CSS:
102
+ return [`/* ${tags[0]} */`, `/* ${tags[1]} */`];
103
+ }
104
+ }
105
+ /**
106
+ * The header text a generator writes before a module's own content: both SPDX lines and the blank line.
107
+ */
108
+ export function spdxHeaderText(syntax) {
109
+ return `${spdxHeaderLines(syntax).join("\n")}\n\n`;
110
+ }
111
+ /**
112
+ * Matches the first line of an old header, in any of its comment forms.
113
+ *
114
+ * The match is anchored to the line, so the rewrite keeps prose that mentions the old header mid-sentence.
115
+ */
116
+ const OLD_HEADER_COPYRIGHT_LINE = /^[\t ]*(?:\*|\/\/|#)[\t ]*@copyright Sister Software\b/;
117
+ /**
118
+ * Matches a tag line of an old header inside its comment.
119
+ */
120
+ const OLD_HEADER_TAG_LINE = /^[\t ]*(?:\*|\/\/|#)[\t ]*@(?:copyright|license|author)\b/;
121
+ const EMPTY_STAR_LINE = /^[\t ]*\*[\t ]*\r?$/;
122
+ const EMPTY_LINE_COMMENT = /^[\t ]*(?:\/\/|#)[\t ]*\r?$/;
123
+ const BLANK_LINE = /^[\t ]*\r?$/;
124
+ /**
125
+ * Removes the old header's tag lines from every comment holding them, in place.
126
+ *
127
+ * With `comments`, a tag line counts only when it lies inside one of those ranges.
128
+ * A generator's template literal can spell the old header as text, and that check keeps it unchanged.
129
+ *
130
+ * Without `comments`, a tag line counts when the lines around it form a comment.
131
+ * Comments are processed from the bottom up, so the offsets of the earlier ones stay valid.
132
+ */
133
+ function removeOldHeaders(lines, comments) {
134
+ const lineStarts = [];
135
+ let offset = 0;
136
+ for (const line of lines) {
137
+ lineStarts.push(offset);
138
+ offset += line.length + 1;
139
+ }
140
+ const isComment = (index) => {
141
+ if (comments == null)
142
+ return insideComment(lines, index);
143
+ const at = lineStarts[index] + /^[\t ]*/.exec(lines[index])[0].length;
144
+ return comments.some(([start, end]) => start <= at && at < end);
145
+ };
146
+ const candidates = lines.flatMap((line, index) => OLD_HEADER_COPYRIGHT_LINE.test(line) && isComment(index) ? [index] : []);
147
+ for (const tagLine of candidates.toReversed()) {
148
+ removeOldHeaderAt(lines, tagLine);
149
+ }
150
+ }
151
+ function removeOldHeaderAt(lines, tagLine) {
152
+ if (/^[\t ]*\*/.test(lines[tagLine])) {
153
+ const opener = findOpener(lines, tagLine);
154
+ const closer = lines.findIndex((line, index) => index >= tagLine && line.includes("*/"));
155
+ if (opener === -1 || closer === -1 || opener === closer)
156
+ return;
157
+ const body = lines.slice(opener + 1, closer).filter((line) => !OLD_HEADER_TAG_LINE.test(line));
158
+ while (body.length && EMPTY_STAR_LINE.test(body[0])) {
159
+ body.shift();
160
+ }
161
+ if (!body.length &&
162
+ /^[\t ]*\/\*\*?[\t ]*\r?$/.test(lines[opener]) &&
163
+ /^[\t ]*\*\/[\t ]*\r?$/.test(lines[closer])) {
164
+ let end = closer + 1;
165
+ while (end < lines.length && BLANK_LINE.test(lines[end]) && end < lines.length - 1) {
166
+ end++;
167
+ }
168
+ lines.splice(opener, end - opener);
169
+ }
170
+ else {
171
+ lines.splice(opener + 1, closer - opener - 1, ...body);
172
+ }
173
+ return;
174
+ }
175
+ const marker = /^[\t ]*(\/\/|#)/.exec(lines[tagLine])[1];
176
+ const isRunLine = (line) => line.trimStart().startsWith(marker) && !line.startsWith("#!");
177
+ let start = tagLine;
178
+ let end = tagLine;
179
+ while (start > 0 && isRunLine(lines[start - 1])) {
180
+ start--;
181
+ }
182
+ while (end + 1 < lines.length && isRunLine(lines[end + 1])) {
183
+ end++;
184
+ }
185
+ const run = lines.slice(start, end + 1).filter((line) => !OLD_HEADER_TAG_LINE.test(line));
186
+ while (run.length && EMPTY_LINE_COMMENT.test(run[0])) {
187
+ run.shift();
188
+ }
189
+ lines.splice(start, end - start + 1, ...run);
190
+ }
191
+ function findOpener(lines, from) {
192
+ for (let index = from; index >= 0; index--) {
193
+ const line = lines[index];
194
+ if (index < from && line.includes("*/"))
195
+ return -1;
196
+ if (line.includes("/*"))
197
+ return index;
198
+ }
199
+ return -1;
200
+ }
201
+ function insideComment(lines, index) {
202
+ const line = lines[index];
203
+ if (/^[\t ]*(?:\/\/|#)/.test(line))
204
+ return true;
205
+ return findOpener(lines, index) >= 0;
206
+ }
207
+ /**
208
+ * Returns `text` with the SPDX header as its first lines and the old JSDoc header's tags removed.
209
+ *
210
+ * The rest of the old header's comment stays where it was.
211
+ * A comment left empty is deleted.
212
+ *
213
+ * A file that already starts correctly comes back unchanged, so the rewrite is idempotent.
214
+ *
215
+ * A JavaScript or TypeScript caller passes `comments`, the parser's comment ranges.
216
+ * A template literal can spell the old header, and only the parser tells it from a comment.
217
+ */
218
+ export function rewriteSourceHeader(text, syntax, comments) {
219
+ const header = spdxHeaderLines(syntax);
220
+ // oxlint-disable-next-line mailwoman/prefer-spliterator -- one source file, already in memory, edited by line index
221
+ const lines = text.split("\n");
222
+ removeOldHeaders(lines, comments);
223
+ const shebang = lines[0]?.startsWith("#!") ? lines.shift() : null;
224
+ // A misplaced copy of the SPDX lines moves to the top rather than being written twice.
225
+ const rest = lines.filter((line) => line.replace(/\r$/, "") !== header[0] && line.replace(/\r$/, "") !== header[1]);
226
+ while (rest.length > 1 && BLANK_LINE.test(rest[0])) {
227
+ rest.shift();
228
+ }
229
+ const endsWithNewline = text.endsWith("\n");
230
+ const body = rest.length === 1 && rest[0] === "" ? [] : rest;
231
+ const composed = [...(shebang == null ? [] : [shebang]), ...header, ...(body.length ? ["", ...body] : [])].join("\n");
232
+ return endsWithNewline && !composed.endsWith("\n") ? `${composed}\n` : composed;
233
+ }
234
+ /**
235
+ * Describes what's wrong with a file's header, or returns null when the file starts correctly.
236
+ */
237
+ export function sourceHeaderProblem(text, syntax, comments) {
238
+ if (rewriteSourceHeader(text, syntax, comments) === text)
239
+ return null;
240
+ const [copyright, license] = spdxHeaderLines(syntax);
241
+ return (`The file must start with \`${copyright}\` and \`${license}\`, after any shebang, followed by one blank line. ` +
242
+ "The old `@copyright`/`@license`/`@author` JSDoc tags go. The autofix writes the header.");
243
+ }
244
+ //# sourceMappingURL=spdx-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3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AI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAErH,OAAO,eAAe,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAClC,IAAY,EACZ,MAA0B,EAC1B,QAAkC;IAElC,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAErE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAEpD,OAAO,CACN,8BAA8B,SAAS,YAAY,OAAO,qDAAqD;QAC/G,yFAAyF,CACzF,CAAA;AACF,CAAC"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * A state machine as a pure transition function and a shell that applies its steps.
3
+ *
4
+ * `transition(state, event)` decides a step: the next state, the values its carrier
5
+ * writes in the same write as the state, and the effects to run once that write lands,
6
+ * each described rather than performed and tagged with an {@link OperationEffect}.
7
+ * A test reads every step without a database or a network. {@link applyStep} writes a
8
+ * step through a {@link StateCarrier} with compare-and-set, so a step decided from a
9
+ * state another writer has since left is refused rather than written over it.
10
+ */
11
+ import type { OperationEffect } from "#scripting/operation";
12
+ /**
13
+ * A write a transition asks its shell to run after the state lands, described rather than performed.
14
+ */
15
+ export interface MachineEffect<TKind extends string = string> {
16
+ readonly kind: TKind;
17
+ /**
18
+ * What the write does to the world.
19
+ */
20
+ readonly effect: OperationEffect;
21
+ }
22
+ /**
23
+ * What a transition decides from one state and one event.
24
+ */
25
+ export interface Step<TState extends string, TRecord extends object, TEffect extends MachineEffect = MachineEffect> {
26
+ readonly next: TState;
27
+ /**
28
+ * Values the carrier writes in the same compare-and-set as the state, such as a row's other columns.
29
+ * A key holding `undefined` leaves its column as it was.
30
+ */
31
+ readonly record: Readonly<Partial<TRecord>>;
32
+ /**
33
+ * Writes to run, in order, once the state lands.
34
+ */
35
+ readonly effects: readonly TEffect[];
36
+ }
37
+ /**
38
+ * A machine's states and its pure transition function.
39
+ */
40
+ export interface StateMachine<TState extends string, TEvent, TRecord extends object = Record<never, never>, TEffect extends MachineEffect = MachineEffect> {
41
+ readonly name: string;
42
+ readonly states: readonly TState[];
43
+ /**
44
+ * One event for each case the transition distinguishes, keyed by a label for that case.
45
+ *
46
+ * The effects register applies every event to every state to print the machine's
47
+ * transition table, and a test can assert the same table.
48
+ */
49
+ readonly events?: Readonly<Record<string, TEvent>>;
50
+ /**
51
+ * The step from `state` on `event`.
52
+ *
53
+ * It reads only its arguments, and its caller performs every write.
54
+ */
55
+ transition(state: TState, event: TEvent): Step<TState, TRecord, TEffect>;
56
+ }
57
+ /**
58
+ * Declares a machine, keeping its types for the shell and its tests.
59
+ */
60
+ export declare function defineStateMachine<TState extends string, TEvent, TRecord extends object = Record<never, never>, TEffect extends MachineEffect = MachineEffect>(machine: StateMachine<TState, TEvent, TRecord, TEffect>): StateMachine<TState, TEvent, TRecord, TEffect>;
61
+ /**
62
+ * Where a machine's state is stored.
63
+ *
64
+ * `compareAndSet` writes `to` and the step's record only while the store still
65
+ * holds `from`, and reports whether it wrote.
66
+ */
67
+ export interface StateCarrier<TState extends string, TRecord extends object> {
68
+ compareAndSet(from: TState, to: TState, record: Readonly<Partial<TRecord>>): Promise<boolean>;
69
+ }
70
+ /**
71
+ * How {@link applyStep} ended.
72
+ *
73
+ * - `unchanged`: the step keeps the state with an empty record and an empty effect list,
74
+ * and the carrier was not called.
75
+ * - `applied`: the carrier wrote the step, and every effect ran.
76
+ * - `conflict`: the store left `from` before the write.
77
+ * The row keeps the other writer's values, and the effects didn't run.
78
+ * The caller reads the state again and decides from it.
79
+ */
80
+ export interface StepOutcome<TState extends string, TRecord extends object, TEffect extends MachineEffect> {
81
+ status: "unchanged" | "applied" | "conflict";
82
+ from: TState;
83
+ step: Step<TState, TRecord, TEffect>;
84
+ }
85
+ /**
86
+ * Whether a step leaves the store as it is: it keeps the state, its record holds
87
+ * only `undefined`, and its effect list is empty.
88
+ */
89
+ export declare function isNoopStep<TState extends string, TRecord extends object, TEffect extends MachineEffect>(from: TState, step: Step<TState, TRecord, TEffect>): boolean;
90
+ /**
91
+ * Decides the step from `current` on `event`, writes it through `carrier`,
92
+ * and runs its effects with `runEffect`.
93
+ *
94
+ * @throws When the step has effects and no `runEffect` was given, or
95
+ * when an effect throws after the state landed.
96
+ */
97
+ export declare function applyStep<TState extends string, TEvent, TRecord extends object, TEffect extends MachineEffect>(machine: StateMachine<TState, TEvent, TRecord, TEffect>, carrier: StateCarrier<TState, TRecord>, current: TState, event: TEvent, runEffect?: (effect: TEffect) => Promise<void>): Promise<StepOutcome<TState, TRecord, TEffect>>;
98
+ //# sourceMappingURL=state-machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-machine.d.ts","sourceRoot":"","sources":["../lib/state-machine.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM;IAC3D,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,IAAI,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,aAAa,GAAG,aAAa;IACjH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAA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WAAW,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,aAAa;IACxG,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,UAAU,CAAA;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;CACpC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,aAAa,EACtG,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,GAClC,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,SAAS,MAAM,EAAE,OAAO,SAAS,aAAa,EACnH,OAAO,EAAE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EACvD,OAAO,EAAE,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAC5C,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAiBhD"}
@@ -0,0 +1,37 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+ /**
4
+ * Declares a machine, keeping its types for the shell and its tests.
5
+ */
6
+ export function defineStateMachine(machine) {
7
+ return machine;
8
+ }
9
+ /**
10
+ * Whether a step leaves the store as it is: it keeps the state, its record holds
11
+ * only `undefined`, and its effect list is empty.
12
+ */
13
+ export function isNoopStep(from, step) {
14
+ return step.next === from && Object.values(step.record).every((value) => value === undefined) && !step.effects.length;
15
+ }
16
+ /**
17
+ * Decides the step from `current` on `event`, writes it through `carrier`,
18
+ * and runs its effects with `runEffect`.
19
+ *
20
+ * @throws When the step has effects and no `runEffect` was given, or
21
+ * when an effect throws after the state landed.
22
+ */
23
+ export async function applyStep(machine, carrier, current, event, runEffect) {
24
+ const step = machine.transition(current, event);
25
+ if (isNoopStep(current, step))
26
+ return { status: "unchanged", from: current, step };
27
+ if (step.effects.length && !runEffect) {
28
+ throw new Error(`${machine.name}: the step from ${current} to ${step.next} has effects and no runner`);
29
+ }
30
+ if (!(await carrier.compareAndSet(current, step.next, step.record)))
31
+ return { status: "conflict", from: current, step };
32
+ for (const effect of step.effects) {
33
+ await runEffect(effect);
34
+ }
35
+ return { status: "applied", from: current, step };
36
+ }
37
+ //# sourceMappingURL=state-machine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-machine.js","sourceRoot":"","sources":["../lib/state-machine.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAoElE;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAKhC,OAAuD;IACxD,OAAO,OAAO,CAAA;AACf,CAAC;AA4BD;;;GAGG;AACH,MAAM,UAAU,UAAU,CACzB,IAAY,EACZ,IAAoC;IAEpC,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;AACtH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC9B,OAAuD,EACvD,OAAsC,EACtC,OAAe,EACf,KAAa,EACb,SAA8C;IAE9C,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAE/C,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IAElF,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,mBAAmB,OAAO,OAAO,IAAI,CAAC,IAAI,4BAA4B,CAAC,CAAA;IACvG,CAAC;IAED,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAClE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IAEnD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,SAAU,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AAClD,CAAC"}
package/out/stats.d.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- *
6
2
  * Statistical helpers for percentiles, averages and percentages.
7
3
  */
8
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../lib/stats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK1E;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAE3D;AAED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,CAQR;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAIzD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIpF;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,SAAI,GAAG,IAAI,CAE1E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAEjF"}
package/out/stats.js CHANGED
@@ -1,8 +1,6 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
1
3
  /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- *
6
4
  * Statistical helpers for percentiles, averages and percentages.
7
5
  */
8
6
  /**