@azx-pbc/axiom-runtime 0.0.0-stage → 0.0.5

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 (755) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +714 -2
  3. package/dist/cache/index.d.ts +191 -0
  4. package/dist/cache/index.d.ts.map +1 -0
  5. package/dist/cache/index.js +361 -0
  6. package/dist/cache/index.js.map +1 -0
  7. package/dist/canonical/jcs.d.ts +78 -0
  8. package/dist/canonical/jcs.d.ts.map +1 -0
  9. package/dist/canonical/jcs.js +500 -0
  10. package/dist/canonical/jcs.js.map +1 -0
  11. package/dist/canonical/restricted-json.d.ts +7 -0
  12. package/dist/canonical/restricted-json.d.ts.map +1 -0
  13. package/dist/canonical/restricted-json.js +318 -0
  14. package/dist/canonical/restricted-json.js.map +1 -0
  15. package/dist/canonical/restricted-value.d.ts +59 -0
  16. package/dist/canonical/restricted-value.d.ts.map +1 -0
  17. package/dist/canonical/restricted-value.js +156 -0
  18. package/dist/canonical/restricted-value.js.map +1 -0
  19. package/dist/canonical/restricted.d.ts +85 -0
  20. package/dist/canonical/restricted.d.ts.map +1 -0
  21. package/dist/canonical/restricted.js +163 -0
  22. package/dist/canonical/restricted.js.map +1 -0
  23. package/dist/canonical/signature.d.ts +38 -0
  24. package/dist/canonical/signature.d.ts.map +1 -0
  25. package/dist/canonical/signature.js +47 -0
  26. package/dist/canonical/signature.js.map +1 -0
  27. package/dist/eval/access/delivery.d.ts +63 -0
  28. package/dist/eval/access/delivery.d.ts.map +1 -0
  29. package/dist/eval/access/delivery.js +98 -0
  30. package/dist/eval/access/delivery.js.map +1 -0
  31. package/dist/eval/access/overlay.d.ts +72 -0
  32. package/dist/eval/access/overlay.d.ts.map +1 -0
  33. package/dist/eval/access/overlay.js +402 -0
  34. package/dist/eval/access/overlay.js.map +1 -0
  35. package/dist/eval/access/projection.d.ts +159 -0
  36. package/dist/eval/access/projection.d.ts.map +1 -0
  37. package/dist/eval/access/projection.js +211 -0
  38. package/dist/eval/access/projection.js.map +1 -0
  39. package/dist/eval/access/window.d.ts +128 -0
  40. package/dist/eval/access/window.d.ts.map +1 -0
  41. package/dist/eval/access/window.js +254 -0
  42. package/dist/eval/access/window.js.map +1 -0
  43. package/dist/eval/access/write.d.ts +113 -0
  44. package/dist/eval/access/write.d.ts.map +1 -0
  45. package/dist/eval/access/write.js +119 -0
  46. package/dist/eval/access/write.js.map +1 -0
  47. package/dist/eval/addressing.d.ts +131 -0
  48. package/dist/eval/addressing.d.ts.map +1 -0
  49. package/dist/eval/addressing.js +270 -0
  50. package/dist/eval/addressing.js.map +1 -0
  51. package/dist/eval/budget.d.ts +143 -0
  52. package/dist/eval/budget.d.ts.map +1 -0
  53. package/dist/eval/budget.js +387 -0
  54. package/dist/eval/budget.js.map +1 -0
  55. package/dist/eval/computed.d.ts +46 -0
  56. package/dist/eval/computed.d.ts.map +1 -0
  57. package/dist/eval/computed.js +89 -0
  58. package/dist/eval/computed.js.map +1 -0
  59. package/dist/eval/denials.d.ts +64 -0
  60. package/dist/eval/denials.d.ts.map +1 -0
  61. package/dist/eval/denials.js +87 -0
  62. package/dist/eval/denials.js.map +1 -0
  63. package/dist/eval/engine/cancellation.d.ts +12 -0
  64. package/dist/eval/engine/cancellation.d.ts.map +1 -0
  65. package/dist/eval/engine/cancellation.js +56 -0
  66. package/dist/eval/engine/cancellation.js.map +1 -0
  67. package/dist/eval/engine/delta.d.ts +104 -0
  68. package/dist/eval/engine/delta.d.ts.map +1 -0
  69. package/dist/eval/engine/delta.js +466 -0
  70. package/dist/eval/engine/delta.js.map +1 -0
  71. package/dist/eval/engine/deps.d.ts +136 -0
  72. package/dist/eval/engine/deps.d.ts.map +1 -0
  73. package/dist/eval/engine/deps.js +345 -0
  74. package/dist/eval/engine/deps.js.map +1 -0
  75. package/dist/eval/engine/identity.d.ts +128 -0
  76. package/dist/eval/engine/identity.d.ts.map +1 -0
  77. package/dist/eval/engine/identity.js +398 -0
  78. package/dist/eval/engine/identity.js.map +1 -0
  79. package/dist/eval/engine/index.d.ts +200 -0
  80. package/dist/eval/engine/index.d.ts.map +1 -0
  81. package/dist/eval/engine/index.js +1242 -0
  82. package/dist/eval/engine/index.js.map +1 -0
  83. package/dist/eval/engine/measurement.d.ts +23 -0
  84. package/dist/eval/engine/measurement.d.ts.map +1 -0
  85. package/dist/eval/engine/measurement.js +42 -0
  86. package/dist/eval/engine/measurement.js.map +1 -0
  87. package/dist/eval/engine/naive.d.ts +19 -0
  88. package/dist/eval/engine/naive.d.ts.map +1 -0
  89. package/dist/eval/engine/naive.js +59 -0
  90. package/dist/eval/engine/naive.js.map +1 -0
  91. package/dist/eval/engine/ops.d.ts +214 -0
  92. package/dist/eval/engine/ops.d.ts.map +1 -0
  93. package/dist/eval/engine/ops.js +1422 -0
  94. package/dist/eval/engine/ops.js.map +1 -0
  95. package/dist/eval/engine/patches.d.ts +40 -0
  96. package/dist/eval/engine/patches.d.ts.map +1 -0
  97. package/dist/eval/engine/patches.js +125 -0
  98. package/dist/eval/engine/patches.js.map +1 -0
  99. package/dist/eval/engine/ports.d.ts +71 -0
  100. package/dist/eval/engine/ports.d.ts.map +1 -0
  101. package/dist/eval/engine/ports.js +2 -0
  102. package/dist/eval/engine/ports.js.map +1 -0
  103. package/dist/eval/engine/session.d.ts +116 -0
  104. package/dist/eval/engine/session.d.ts.map +1 -0
  105. package/dist/eval/engine/session.js +653 -0
  106. package/dist/eval/engine/session.js.map +1 -0
  107. package/dist/eval/engine/snapshot.d.ts +97 -0
  108. package/dist/eval/engine/snapshot.d.ts.map +1 -0
  109. package/dist/eval/engine/snapshot.js +221 -0
  110. package/dist/eval/engine/snapshot.js.map +1 -0
  111. package/dist/eval/engine/subscriptions.d.ts +47 -0
  112. package/dist/eval/engine/subscriptions.d.ts.map +1 -0
  113. package/dist/eval/engine/subscriptions.js +103 -0
  114. package/dist/eval/engine/subscriptions.js.map +1 -0
  115. package/dist/eval/engine/trace.d.ts +77 -0
  116. package/dist/eval/engine/trace.d.ts.map +1 -0
  117. package/dist/eval/engine/trace.js +140 -0
  118. package/dist/eval/engine/trace.js.map +1 -0
  119. package/dist/eval/error-diagnostic.d.ts +26 -0
  120. package/dist/eval/error-diagnostic.d.ts.map +1 -0
  121. package/dist/eval/error-diagnostic.js +63 -0
  122. package/dist/eval/error-diagnostic.js.map +1 -0
  123. package/dist/eval/evaluate-expr.d.ts +44 -0
  124. package/dist/eval/evaluate-expr.d.ts.map +1 -0
  125. package/dist/eval/evaluate-expr.js +149 -0
  126. package/dist/eval/evaluate-expr.js.map +1 -0
  127. package/dist/eval/evaluate.d.ts +282 -0
  128. package/dist/eval/evaluate.d.ts.map +1 -0
  129. package/dist/eval/evaluate.js +391 -0
  130. package/dist/eval/evaluate.js.map +1 -0
  131. package/dist/eval/evolution/relocate.d.ts +72 -0
  132. package/dist/eval/evolution/relocate.d.ts.map +1 -0
  133. package/dist/eval/evolution/relocate.js +427 -0
  134. package/dist/eval/evolution/relocate.js.map +1 -0
  135. package/dist/eval/evolution/select.d.ts +11 -0
  136. package/dist/eval/evolution/select.d.ts.map +1 -0
  137. package/dist/eval/evolution/select.js +53 -0
  138. package/dist/eval/evolution/select.js.map +1 -0
  139. package/dist/eval/evolution/upcast.d.ts +13 -0
  140. package/dist/eval/evolution/upcast.d.ts.map +1 -0
  141. package/dist/eval/evolution/upcast.js +88 -0
  142. package/dist/eval/evolution/upcast.js.map +1 -0
  143. package/dist/eval/expr/aggregates.d.ts +75 -0
  144. package/dist/eval/expr/aggregates.d.ts.map +1 -0
  145. package/dist/eval/expr/aggregates.js +991 -0
  146. package/dist/eval/expr/aggregates.js.map +1 -0
  147. package/dist/eval/expr/arithmetic.d.ts +26 -0
  148. package/dist/eval/expr/arithmetic.d.ts.map +1 -0
  149. package/dist/eval/expr/arithmetic.js +387 -0
  150. package/dist/eval/expr/arithmetic.js.map +1 -0
  151. package/dist/eval/expr/between.d.ts +17 -0
  152. package/dist/eval/expr/between.d.ts.map +1 -0
  153. package/dist/eval/expr/between.js +46 -0
  154. package/dist/eval/expr/between.js.map +1 -0
  155. package/dist/eval/expr/binder.d.ts +96 -0
  156. package/dist/eval/expr/binder.d.ts.map +1 -0
  157. package/dist/eval/expr/binder.js +253 -0
  158. package/dist/eval/expr/binder.js.map +1 -0
  159. package/dist/eval/expr/call-dispatch.d.ts +28 -0
  160. package/dist/eval/expr/call-dispatch.d.ts.map +1 -0
  161. package/dist/eval/expr/call-dispatch.js +114 -0
  162. package/dist/eval/expr/call-dispatch.js.map +1 -0
  163. package/dist/eval/expr/collections.d.ts +20 -0
  164. package/dist/eval/expr/collections.d.ts.map +1 -0
  165. package/dist/eval/expr/collections.js +66 -0
  166. package/dist/eval/expr/collections.js.map +1 -0
  167. package/dist/eval/expr/compare.d.ts +36 -0
  168. package/dist/eval/expr/compare.d.ts.map +1 -0
  169. package/dist/eval/expr/compare.js +115 -0
  170. package/dist/eval/expr/compare.js.map +1 -0
  171. package/dist/eval/expr/datasets.d.ts +28 -0
  172. package/dist/eval/expr/datasets.d.ts.map +1 -0
  173. package/dist/eval/expr/datasets.js +304 -0
  174. package/dist/eval/expr/datasets.js.map +1 -0
  175. package/dist/eval/expr/digest.d.ts +23 -0
  176. package/dist/eval/expr/digest.d.ts.map +1 -0
  177. package/dist/eval/expr/digest.js +89 -0
  178. package/dist/eval/expr/digest.js.map +1 -0
  179. package/dist/eval/expr/domains.d.ts +19 -0
  180. package/dist/eval/expr/domains.d.ts.map +1 -0
  181. package/dist/eval/expr/domains.js +18 -0
  182. package/dist/eval/expr/domains.js.map +1 -0
  183. package/dist/eval/expr/host.d.ts +152 -0
  184. package/dist/eval/expr/host.d.ts.map +1 -0
  185. package/dist/eval/expr/host.js +36 -0
  186. package/dist/eval/expr/host.js.map +1 -0
  187. package/dist/eval/expr/lists.d.ts +24 -0
  188. package/dist/eval/expr/lists.d.ts.map +1 -0
  189. package/dist/eval/expr/lists.js +155 -0
  190. package/dist/eval/expr/lists.js.map +1 -0
  191. package/dist/eval/expr/member.d.ts +15 -0
  192. package/dist/eval/expr/member.d.ts.map +1 -0
  193. package/dist/eval/expr/member.js +32 -0
  194. package/dist/eval/expr/member.js.map +1 -0
  195. package/dist/eval/expr/money-ops.d.ts +10 -0
  196. package/dist/eval/expr/money-ops.d.ts.map +1 -0
  197. package/dist/eval/expr/money-ops.js +17 -0
  198. package/dist/eval/expr/money-ops.js.map +1 -0
  199. package/dist/eval/expr/operands.d.ts +27 -0
  200. package/dist/eval/expr/operands.d.ts.map +1 -0
  201. package/dist/eval/expr/operands.js +167 -0
  202. package/dist/eval/expr/operands.js.map +1 -0
  203. package/dist/eval/expr/presence.d.ts +27 -0
  204. package/dist/eval/expr/presence.d.ts.map +1 -0
  205. package/dist/eval/expr/presence.js +140 -0
  206. package/dist/eval/expr/presence.js.map +1 -0
  207. package/dist/eval/expr/records.d.ts +22 -0
  208. package/dist/eval/expr/records.d.ts.map +1 -0
  209. package/dist/eval/expr/records.js +101 -0
  210. package/dist/eval/expr/records.js.map +1 -0
  211. package/dist/eval/expr/rule-refs.d.ts +25 -0
  212. package/dist/eval/expr/rule-refs.d.ts.map +1 -0
  213. package/dist/eval/expr/rule-refs.js +60 -0
  214. package/dist/eval/expr/rule-refs.js.map +1 -0
  215. package/dist/eval/expr/sequences.d.ts +26 -0
  216. package/dist/eval/expr/sequences.d.ts.map +1 -0
  217. package/dist/eval/expr/sequences.js +151 -0
  218. package/dist/eval/expr/sequences.js.map +1 -0
  219. package/dist/eval/expr/value.d.ts +99 -0
  220. package/dist/eval/expr/value.d.ts.map +1 -0
  221. package/dist/eval/expr/value.js +14 -0
  222. package/dist/eval/expr/value.js.map +1 -0
  223. package/dist/eval/expression.d.ts +142 -0
  224. package/dist/eval/expression.d.ts.map +1 -0
  225. package/dist/eval/expression.js +446 -0
  226. package/dist/eval/expression.js.map +1 -0
  227. package/dist/eval/firing.d.ts +68 -0
  228. package/dist/eval/firing.d.ts.map +1 -0
  229. package/dist/eval/firing.js +222 -0
  230. package/dist/eval/firing.js.map +1 -0
  231. package/dist/eval/gate.d.ts +110 -0
  232. package/dist/eval/gate.d.ts.map +1 -0
  233. package/dist/eval/gate.js +278 -0
  234. package/dist/eval/gate.js.map +1 -0
  235. package/dist/eval/layout-visibility.d.ts +18 -0
  236. package/dist/eval/layout-visibility.d.ts.map +1 -0
  237. package/dist/eval/layout-visibility.js +61 -0
  238. package/dist/eval/layout-visibility.js.map +1 -0
  239. package/dist/eval/option-availability.d.ts +26 -0
  240. package/dist/eval/option-availability.d.ts.map +1 -0
  241. package/dist/eval/option-availability.js +580 -0
  242. package/dist/eval/option-availability.js.map +1 -0
  243. package/dist/eval/options-boundary.d.ts +15 -0
  244. package/dist/eval/options-boundary.d.ts.map +1 -0
  245. package/dist/eval/options-boundary.js +40 -0
  246. package/dist/eval/options-boundary.js.map +1 -0
  247. package/dist/eval/options.d.ts +99 -0
  248. package/dist/eval/options.d.ts.map +1 -0
  249. package/dist/eval/options.js +96 -0
  250. package/dist/eval/options.js.map +1 -0
  251. package/dist/eval/overrides.d.ts +116 -0
  252. package/dist/eval/overrides.d.ts.map +1 -0
  253. package/dist/eval/overrides.js +176 -0
  254. package/dist/eval/overrides.js.map +1 -0
  255. package/dist/eval/paths.d.ts +25 -0
  256. package/dist/eval/paths.d.ts.map +1 -0
  257. package/dist/eval/paths.js +47 -0
  258. package/dist/eval/paths.js.map +1 -0
  259. package/dist/eval/presentation-reads.d.ts +20 -0
  260. package/dist/eval/presentation-reads.d.ts.map +1 -0
  261. package/dist/eval/presentation-reads.js +2 -0
  262. package/dist/eval/presentation-reads.js.map +1 -0
  263. package/dist/eval/presentation.d.ts +122 -0
  264. package/dist/eval/presentation.d.ts.map +1 -0
  265. package/dist/eval/presentation.js +255 -0
  266. package/dist/eval/presentation.js.map +1 -0
  267. package/dist/eval/reader/context-value.d.ts +41 -0
  268. package/dist/eval/reader/context-value.d.ts.map +1 -0
  269. package/dist/eval/reader/context-value.js +129 -0
  270. package/dist/eval/reader/context-value.js.map +1 -0
  271. package/dist/eval/reader/covered.d.ts +53 -0
  272. package/dist/eval/reader/covered.d.ts.map +1 -0
  273. package/dist/eval/reader/covered.js +139 -0
  274. package/dist/eval/reader/covered.js.map +1 -0
  275. package/dist/eval/reader/declarations.d.ts +182 -0
  276. package/dist/eval/reader/declarations.d.ts.map +1 -0
  277. package/dist/eval/reader/declarations.js +153 -0
  278. package/dist/eval/reader/declarations.js.map +1 -0
  279. package/dist/eval/reader/member-access.d.ts +87 -0
  280. package/dist/eval/reader/member-access.d.ts.map +1 -0
  281. package/dist/eval/reader/member-access.js +212 -0
  282. package/dist/eval/reader/member-access.js.map +1 -0
  283. package/dist/eval/reader/memo.d.ts +34 -0
  284. package/dist/eval/reader/memo.d.ts.map +1 -0
  285. package/dist/eval/reader/memo.js +67 -0
  286. package/dist/eval/reader/memo.js.map +1 -0
  287. package/dist/eval/reader/overlay.d.ts +74 -0
  288. package/dist/eval/reader/overlay.d.ts.map +1 -0
  289. package/dist/eval/reader/overlay.js +365 -0
  290. package/dist/eval/reader/overlay.js.map +1 -0
  291. package/dist/eval/reader/questions.d.ts +37 -0
  292. package/dist/eval/reader/questions.d.ts.map +1 -0
  293. package/dist/eval/reader/questions.js +78 -0
  294. package/dist/eval/reader/questions.js.map +1 -0
  295. package/dist/eval/reader/resolve.d.ts +84 -0
  296. package/dist/eval/reader/resolve.d.ts.map +1 -0
  297. package/dist/eval/reader/resolve.js +310 -0
  298. package/dist/eval/reader/resolve.js.map +1 -0
  299. package/dist/eval/reader/value-read.d.ts +50 -0
  300. package/dist/eval/reader/value-read.d.ts.map +1 -0
  301. package/dist/eval/reader/value-read.js +133 -0
  302. package/dist/eval/reader/value-read.js.map +1 -0
  303. package/dist/eval/reader/withheld.d.ts +48 -0
  304. package/dist/eval/reader/withheld.d.ts.map +1 -0
  305. package/dist/eval/reader/withheld.js +108 -0
  306. package/dist/eval/reader/withheld.js.map +1 -0
  307. package/dist/eval/reader-paths.d.ts +24 -0
  308. package/dist/eval/reader-paths.d.ts.map +1 -0
  309. package/dist/eval/reader-paths.js +23 -0
  310. package/dist/eval/reader-paths.js.map +1 -0
  311. package/dist/eval/reader.d.ts +281 -0
  312. package/dist/eval/reader.d.ts.map +1 -0
  313. package/dist/eval/reader.js +560 -0
  314. package/dist/eval/reader.js.map +1 -0
  315. package/dist/eval/receipt.d.ts +37 -0
  316. package/dist/eval/receipt.d.ts.map +1 -0
  317. package/dist/eval/receipt.js +222 -0
  318. package/dist/eval/receipt.js.map +1 -0
  319. package/dist/eval/report/assemble.d.ts +84 -0
  320. package/dist/eval/report/assemble.d.ts.map +1 -0
  321. package/dist/eval/report/assemble.js +277 -0
  322. package/dist/eval/report/assemble.js.map +1 -0
  323. package/dist/eval/report/fold.d.ts +18 -0
  324. package/dist/eval/report/fold.d.ts.map +1 -0
  325. package/dist/eval/report/fold.js +58 -0
  326. package/dist/eval/report/fold.js.map +1 -0
  327. package/dist/eval/rule/alternatives.d.ts +23 -0
  328. package/dist/eval/rule/alternatives.d.ts.map +1 -0
  329. package/dist/eval/rule/alternatives.js +46 -0
  330. package/dist/eval/rule/alternatives.js.map +1 -0
  331. package/dist/eval/rule/behaviour.d.ts +47 -0
  332. package/dist/eval/rule/behaviour.d.ts.map +1 -0
  333. package/dist/eval/rule/behaviour.js +249 -0
  334. package/dist/eval/rule/behaviour.js.map +1 -0
  335. package/dist/eval/rule/compute.d.ts +46 -0
  336. package/dist/eval/rule/compute.d.ts.map +1 -0
  337. package/dist/eval/rule/compute.js +158 -0
  338. package/dist/eval/rule/compute.js.map +1 -0
  339. package/dist/eval/rule/create-state.d.ts +42 -0
  340. package/dist/eval/rule/create-state.d.ts.map +1 -0
  341. package/dist/eval/rule/create-state.js +134 -0
  342. package/dist/eval/rule/create-state.js.map +1 -0
  343. package/dist/eval/rule/diagnostics.d.ts +24 -0
  344. package/dist/eval/rule/diagnostics.d.ts.map +1 -0
  345. package/dist/eval/rule/diagnostics.js +45 -0
  346. package/dist/eval/rule/diagnostics.js.map +1 -0
  347. package/dist/eval/rule/execution.d.ts +24 -0
  348. package/dist/eval/rule/execution.d.ts.map +1 -0
  349. package/dist/eval/rule/execution.js +495 -0
  350. package/dist/eval/rule/execution.js.map +1 -0
  351. package/dist/eval/rule/gate.d.ts +12 -0
  352. package/dist/eval/rule/gate.d.ts.map +1 -0
  353. package/dist/eval/rule/gate.js +34 -0
  354. package/dist/eval/rule/gate.js.map +1 -0
  355. package/dist/eval/rule/item.d.ts +11 -0
  356. package/dist/eval/rule/item.d.ts.map +1 -0
  357. package/dist/eval/rule/item.js +265 -0
  358. package/dist/eval/rule/item.js.map +1 -0
  359. package/dist/eval/rule/prepare.d.ts +64 -0
  360. package/dist/eval/rule/prepare.d.ts.map +1 -0
  361. package/dist/eval/rule/prepare.js +131 -0
  362. package/dist/eval/rule/prepare.js.map +1 -0
  363. package/dist/eval/rule/result.d.ts +97 -0
  364. package/dist/eval/rule/result.d.ts.map +1 -0
  365. package/dist/eval/rule/result.js +347 -0
  366. package/dist/eval/rule/result.js.map +1 -0
  367. package/dist/eval/rule/runner.d.ts +128 -0
  368. package/dist/eval/rule/runner.d.ts.map +1 -0
  369. package/dist/eval/rule/runner.js +296 -0
  370. package/dist/eval/rule/runner.js.map +1 -0
  371. package/dist/eval/rule/screen.d.ts +32 -0
  372. package/dist/eval/rule/screen.d.ts.map +1 -0
  373. package/dist/eval/rule/screen.js +73 -0
  374. package/dist/eval/rule/screen.js.map +1 -0
  375. package/dist/eval/rule/state.d.ts +137 -0
  376. package/dist/eval/rule/state.d.ts.map +1 -0
  377. package/dist/eval/rule/state.js +2 -0
  378. package/dist/eval/rule/state.js.map +1 -0
  379. package/dist/eval/rule/steps.d.ts +44 -0
  380. package/dist/eval/rule/steps.d.ts.map +1 -0
  381. package/dist/eval/rule/steps.js +367 -0
  382. package/dist/eval/rule/steps.js.map +1 -0
  383. package/dist/eval/rule/visibility.d.ts +18 -0
  384. package/dist/eval/rule/visibility.d.ts.map +1 -0
  385. package/dist/eval/rule/visibility.js +79 -0
  386. package/dist/eval/rule/visibility.js.map +1 -0
  387. package/dist/eval/seal.d.ts +74 -0
  388. package/dist/eval/seal.d.ts.map +1 -0
  389. package/dist/eval/seal.js +154 -0
  390. package/dist/eval/seal.js.map +1 -0
  391. package/dist/eval/signature-coverage.d.ts +19 -0
  392. package/dist/eval/signature-coverage.d.ts.map +1 -0
  393. package/dist/eval/signature-coverage.js +160 -0
  394. package/dist/eval/signature-coverage.js.map +1 -0
  395. package/dist/eval/state/derive.d.ts +72 -0
  396. package/dist/eval/state/derive.d.ts.map +1 -0
  397. package/dist/eval/state/derive.js +61 -0
  398. package/dist/eval/state/derive.js.map +1 -0
  399. package/dist/eval/state/describe.d.ts +18 -0
  400. package/dist/eval/state/describe.d.ts.map +1 -0
  401. package/dist/eval/state/describe.js +19 -0
  402. package/dist/eval/state/describe.js.map +1 -0
  403. package/dist/eval/state/field-state.d.ts +471 -0
  404. package/dist/eval/state/field-state.d.ts.map +1 -0
  405. package/dist/eval/state/field-state.js +1604 -0
  406. package/dist/eval/state/field-state.js.map +1 -0
  407. package/dist/eval/state/measurement.d.ts +136 -0
  408. package/dist/eval/state/measurement.d.ts.map +1 -0
  409. package/dist/eval/state/measurement.js +209 -0
  410. package/dist/eval/state/measurement.js.map +1 -0
  411. package/dist/eval/state/options.d.ts +21 -0
  412. package/dist/eval/state/options.d.ts.map +1 -0
  413. package/dist/eval/state/options.js +3 -0
  414. package/dist/eval/state/options.js.map +1 -0
  415. package/dist/eval/state/readiness.d.ts +400 -0
  416. package/dist/eval/state/readiness.d.ts.map +1 -0
  417. package/dist/eval/state/readiness.js +1067 -0
  418. package/dist/eval/state/readiness.js.map +1 -0
  419. package/dist/eval/state/snapshot.d.ts +130 -0
  420. package/dist/eval/state/snapshot.d.ts.map +1 -0
  421. package/dist/eval/state/snapshot.js +35 -0
  422. package/dist/eval/state/snapshot.js.map +1 -0
  423. package/dist/eval/state/unavailable-options.d.ts +54 -0
  424. package/dist/eval/state/unavailable-options.d.ts.map +1 -0
  425. package/dist/eval/state/unavailable-options.js +82 -0
  426. package/dist/eval/state/unavailable-options.js.map +1 -0
  427. package/dist/eval/state/value-state.d.ts +38 -0
  428. package/dist/eval/state/value-state.d.ts.map +1 -0
  429. package/dist/eval/state/value-state.js +52 -0
  430. package/dist/eval/state/value-state.js.map +1 -0
  431. package/dist/eval/submission/admission.d.ts +50 -0
  432. package/dist/eval/submission/admission.d.ts.map +1 -0
  433. package/dist/eval/submission/admission.js +174 -0
  434. package/dist/eval/submission/admission.js.map +1 -0
  435. package/dist/eval/submission/authority.d.ts +71 -0
  436. package/dist/eval/submission/authority.d.ts.map +1 -0
  437. package/dist/eval/submission/authority.js +118 -0
  438. package/dist/eval/submission/authority.js.map +1 -0
  439. package/dist/eval/submission/datasets.d.ts +28 -0
  440. package/dist/eval/submission/datasets.d.ts.map +1 -0
  441. package/dist/eval/submission/datasets.js +109 -0
  442. package/dist/eval/submission/datasets.js.map +1 -0
  443. package/dist/eval/submission/index.d.ts +15 -0
  444. package/dist/eval/submission/index.d.ts.map +1 -0
  445. package/dist/eval/submission/index.js +13 -0
  446. package/dist/eval/submission/index.js.map +1 -0
  447. package/dist/eval/submission/refusals.d.ts +103 -0
  448. package/dist/eval/submission/refusals.d.ts.map +1 -0
  449. package/dist/eval/submission/refusals.js +15 -0
  450. package/dist/eval/submission/refusals.js.map +1 -0
  451. package/dist/eval/submission/signatures.d.ts +7 -0
  452. package/dist/eval/submission/signatures.d.ts.map +1 -0
  453. package/dist/eval/submission/signatures.js +215 -0
  454. package/dist/eval/submission/signatures.js.map +1 -0
  455. package/dist/eval/submission/writes.d.ts +51 -0
  456. package/dist/eval/submission/writes.d.ts.map +1 -0
  457. package/dist/eval/submission/writes.js +203 -0
  458. package/dist/eval/submission/writes.js.map +1 -0
  459. package/dist/eval/submission.d.ts +53 -0
  460. package/dist/eval/submission.d.ts.map +1 -0
  461. package/dist/eval/submission.js +521 -0
  462. package/dist/eval/submission.js.map +1 -0
  463. package/dist/eval/suggestions-to-engine.d.ts +18 -0
  464. package/dist/eval/suggestions-to-engine.d.ts.map +1 -0
  465. package/dist/eval/suggestions-to-engine.js +40 -0
  466. package/dist/eval/suggestions-to-engine.js.map +1 -0
  467. package/dist/eval/suggestions.d.ts +17 -0
  468. package/dist/eval/suggestions.d.ts.map +1 -0
  469. package/dist/eval/suggestions.js +314 -0
  470. package/dist/eval/suggestions.js.map +1 -0
  471. package/dist/eval/undecided.d.ts +64 -0
  472. package/dist/eval/undecided.d.ts.map +1 -0
  473. package/dist/eval/undecided.js +101 -0
  474. package/dist/eval/undecided.js.map +1 -0
  475. package/dist/eval/verdict.d.ts +66 -0
  476. package/dist/eval/verdict.d.ts.map +1 -0
  477. package/dist/eval/verdict.js +106 -0
  478. package/dist/eval/verdict.js.map +1 -0
  479. package/dist/eval/verify-signature.d.ts +78 -0
  480. package/dist/eval/verify-signature.d.ts.map +1 -0
  481. package/dist/eval/verify-signature.js +185 -0
  482. package/dist/eval/verify-signature.js.map +1 -0
  483. package/dist/eval/version-dispatch.d.ts +38 -0
  484. package/dist/eval/version-dispatch.d.ts.map +1 -0
  485. package/dist/eval/version-dispatch.js +61 -0
  486. package/dist/eval/version-dispatch.js.map +1 -0
  487. package/dist/eval/visibility.d.ts +33 -0
  488. package/dist/eval/visibility.d.ts.map +1 -0
  489. package/dist/eval/visibility.js +83 -0
  490. package/dist/eval/visibility.js.map +1 -0
  491. package/dist/evaluate.d.ts +24 -0
  492. package/dist/evaluate.d.ts.map +1 -0
  493. package/dist/evaluate.js +18 -0
  494. package/dist/evaluate.js.map +1 -0
  495. package/dist/expr/builtin-docs.d.ts +51 -0
  496. package/dist/expr/builtin-docs.d.ts.map +1 -0
  497. package/dist/expr/builtin-docs.js +874 -0
  498. package/dist/expr/builtin-docs.js.map +1 -0
  499. package/dist/expr/builtins.d.ts +50 -0
  500. package/dist/expr/builtins.d.ts.map +1 -0
  501. package/dist/expr/builtins.js +966 -0
  502. package/dist/expr/builtins.js.map +1 -0
  503. package/dist/expr/decimal-precision.d.ts +39 -0
  504. package/dist/expr/decimal-precision.d.ts.map +1 -0
  505. package/dist/expr/decimal-precision.js +62 -0
  506. package/dist/expr/decimal-precision.js.map +1 -0
  507. package/dist/expr/decimal.d.ts +172 -0
  508. package/dist/expr/decimal.d.ts.map +1 -0
  509. package/dist/expr/decimal.js +782 -0
  510. package/dist/expr/decimal.js.map +1 -0
  511. package/dist/expr/deprecations.d.ts +34 -0
  512. package/dist/expr/deprecations.d.ts.map +1 -0
  513. package/dist/expr/deprecations.js +17 -0
  514. package/dist/expr/deprecations.js.map +1 -0
  515. package/dist/expr/diagnostics.d.ts +21 -0
  516. package/dist/expr/diagnostics.d.ts.map +1 -0
  517. package/dist/expr/diagnostics.js +231 -0
  518. package/dist/expr/diagnostics.js.map +1 -0
  519. package/dist/expr/direction.d.ts +30 -0
  520. package/dist/expr/direction.d.ts.map +1 -0
  521. package/dist/expr/direction.js +77 -0
  522. package/dist/expr/direction.js.map +1 -0
  523. package/dist/expr/example-expression.d.ts +62 -0
  524. package/dist/expr/example-expression.d.ts.map +1 -0
  525. package/dist/expr/example-expression.js +670 -0
  526. package/dist/expr/example-expression.js.map +1 -0
  527. package/dist/expr/instant.d.ts +49 -0
  528. package/dist/expr/instant.d.ts.map +1 -0
  529. package/dist/expr/instant.js +111 -0
  530. package/dist/expr/instant.js.map +1 -0
  531. package/dist/expr/logic.d.ts +17 -0
  532. package/dist/expr/logic.d.ts.map +1 -0
  533. package/dist/expr/logic.js +65 -0
  534. package/dist/expr/logic.js.map +1 -0
  535. package/dist/expr/messages.d.ts +45 -0
  536. package/dist/expr/messages.d.ts.map +1 -0
  537. package/dist/expr/messages.js +280 -0
  538. package/dist/expr/messages.js.map +1 -0
  539. package/dist/expr/money.d.ts +38 -0
  540. package/dist/expr/money.d.ts.map +1 -0
  541. package/dist/expr/money.js +127 -0
  542. package/dist/expr/money.js.map +1 -0
  543. package/dist/expr/ordering.d.ts +56 -0
  544. package/dist/expr/ordering.d.ts.map +1 -0
  545. package/dist/expr/ordering.js +167 -0
  546. package/dist/expr/ordering.js.map +1 -0
  547. package/dist/expr/pattern.d.ts +44 -0
  548. package/dist/expr/pattern.d.ts.map +1 -0
  549. package/dist/expr/pattern.js +458 -0
  550. package/dist/expr/pattern.js.map +1 -0
  551. package/dist/expr/plain-date.d.ts +90 -0
  552. package/dist/expr/plain-date.d.ts.map +1 -0
  553. package/dist/expr/plain-date.js +230 -0
  554. package/dist/expr/plain-date.js.map +1 -0
  555. package/dist/expr/plural-categories.d.ts +8 -0
  556. package/dist/expr/plural-categories.d.ts.map +1 -0
  557. package/dist/expr/plural-categories.js +15 -0
  558. package/dist/expr/plural-categories.js.map +1 -0
  559. package/dist/expr/plural-keys.d.ts +39 -0
  560. package/dist/expr/plural-keys.d.ts.map +1 -0
  561. package/dist/expr/plural-keys.js +46 -0
  562. package/dist/expr/plural-keys.js.map +1 -0
  563. package/dist/expr/plural.d.ts +33 -0
  564. package/dist/expr/plural.d.ts.map +1 -0
  565. package/dist/expr/plural.js +50 -0
  566. package/dist/expr/plural.js.map +1 -0
  567. package/dist/expr/quantity.d.ts +31 -0
  568. package/dist/expr/quantity.d.ts.map +1 -0
  569. package/dist/expr/quantity.js +83 -0
  570. package/dist/expr/quantity.js.map +1 -0
  571. package/dist/expr/reduce.d.ts +50 -0
  572. package/dist/expr/reduce.d.ts.map +1 -0
  573. package/dist/expr/reduce.js +236 -0
  574. package/dist/expr/reduce.js.map +1 -0
  575. package/dist/expr/regex.d.ts +108 -0
  576. package/dist/expr/regex.d.ts.map +1 -0
  577. package/dist/expr/regex.js +1210 -0
  578. package/dist/expr/regex.js.map +1 -0
  579. package/dist/expr/select-locale.d.ts +67 -0
  580. package/dist/expr/select-locale.d.ts.map +1 -0
  581. package/dist/expr/select-locale.js +219 -0
  582. package/dist/expr/select-locale.js.map +1 -0
  583. package/dist/expr/sequences.d.ts +123 -0
  584. package/dist/expr/sequences.d.ts.map +1 -0
  585. package/dist/expr/sequences.js +234 -0
  586. package/dist/expr/sequences.js.map +1 -0
  587. package/dist/expr/strings.d.ts +50 -0
  588. package/dist/expr/strings.d.ts.map +1 -0
  589. package/dist/expr/strings.js +184 -0
  590. package/dist/expr/strings.js.map +1 -0
  591. package/dist/expr/validation.d.ts +32 -0
  592. package/dist/expr/validation.d.ts.map +1 -0
  593. package/dist/expr/validation.js +182 -0
  594. package/dist/expr/validation.js.map +1 -0
  595. package/dist/graph/freeze.d.ts +4 -0
  596. package/dist/graph/freeze.d.ts.map +1 -0
  597. package/dist/graph/freeze.js +52 -0
  598. package/dist/graph/freeze.js.map +1 -0
  599. package/dist/graph/index.d.ts +15 -0
  600. package/dist/graph/index.d.ts.map +1 -0
  601. package/dist/graph/index.js +13 -0
  602. package/dist/graph/index.js.map +1 -0
  603. package/dist/graph/inspect.d.ts +76 -0
  604. package/dist/graph/inspect.d.ts.map +1 -0
  605. package/dist/graph/inspect.js +263 -0
  606. package/dist/graph/inspect.js.map +1 -0
  607. package/dist/graph/read-walk.d.ts +101 -0
  608. package/dist/graph/read-walk.d.ts.map +1 -0
  609. package/dist/graph/read-walk.js +358 -0
  610. package/dist/graph/read-walk.js.map +1 -0
  611. package/dist/graph/record-index.d.ts +24 -0
  612. package/dist/graph/record-index.d.ts.map +1 -0
  613. package/dist/graph/record-index.js +35 -0
  614. package/dist/graph/record-index.js.map +1 -0
  615. package/dist/index.d.ts +104 -0
  616. package/dist/index.d.ts.map +1 -0
  617. package/dist/index.js +139 -0
  618. package/dist/index.js.map +1 -0
  619. package/dist/lookup/digest.d.ts +51 -0
  620. package/dist/lookup/digest.d.ts.map +1 -0
  621. package/dist/lookup/digest.js +46 -0
  622. package/dist/lookup/digest.js.map +1 -0
  623. package/dist/lookup/index.d.ts +28 -0
  624. package/dist/lookup/index.d.ts.map +1 -0
  625. package/dist/lookup/index.js +27 -0
  626. package/dist/lookup/index.js.map +1 -0
  627. package/dist/lookup/install.d.ts +48 -0
  628. package/dist/lookup/install.d.ts.map +1 -0
  629. package/dist/lookup/install.js +315 -0
  630. package/dist/lookup/install.js.map +1 -0
  631. package/dist/lookup/pass.d.ts +55 -0
  632. package/dist/lookup/pass.d.ts.map +1 -0
  633. package/dist/lookup/pass.js +212 -0
  634. package/dist/lookup/pass.js.map +1 -0
  635. package/dist/lookup/pins.d.ts +34 -0
  636. package/dist/lookup/pins.d.ts.map +1 -0
  637. package/dist/lookup/pins.js +39 -0
  638. package/dist/lookup/pins.js.map +1 -0
  639. package/dist/lookup/provenance.d.ts +23 -0
  640. package/dist/lookup/provenance.d.ts.map +1 -0
  641. package/dist/lookup/provenance.js +78 -0
  642. package/dist/lookup/provenance.js.map +1 -0
  643. package/dist/lookup/readiness.d.ts +13 -0
  644. package/dist/lookup/readiness.d.ts.map +1 -0
  645. package/dist/lookup/readiness.js +57 -0
  646. package/dist/lookup/readiness.js.map +1 -0
  647. package/dist/lookup/resolve.d.ts +24 -0
  648. package/dist/lookup/resolve.d.ts.map +1 -0
  649. package/dist/lookup/resolve.js +201 -0
  650. package/dist/lookup/resolve.js.map +1 -0
  651. package/dist/lookup/store.d.ts +41 -0
  652. package/dist/lookup/store.d.ts.map +1 -0
  653. package/dist/lookup/store.js +74 -0
  654. package/dist/lookup/store.js.map +1 -0
  655. package/dist/model/access.d.ts +200 -0
  656. package/dist/model/access.d.ts.map +1 -0
  657. package/dist/model/access.js +125 -0
  658. package/dist/model/access.js.map +1 -0
  659. package/dist/model/artifact-members.d.ts +3 -0
  660. package/dist/model/artifact-members.d.ts.map +1 -0
  661. package/dist/model/artifact-members.js +38 -0
  662. package/dist/model/artifact-members.js.map +1 -0
  663. package/dist/model/composition.d.ts +47 -0
  664. package/dist/model/composition.d.ts.map +1 -0
  665. package/dist/model/composition.js +66 -0
  666. package/dist/model/composition.js.map +1 -0
  667. package/dist/model/domain.d.ts +51 -0
  668. package/dist/model/domain.d.ts.map +1 -0
  669. package/dist/model/domain.js +75 -0
  670. package/dist/model/domain.js.map +1 -0
  671. package/dist/model/duration.d.ts +31 -0
  672. package/dist/model/duration.d.ts.map +1 -0
  673. package/dist/model/duration.js +136 -0
  674. package/dist/model/duration.js.map +1 -0
  675. package/dist/model/errors.d.ts +58 -0
  676. package/dist/model/errors.d.ts.map +1 -0
  677. package/dist/model/errors.js +81 -0
  678. package/dist/model/errors.js.map +1 -0
  679. package/dist/model/evolution.d.ts +177 -0
  680. package/dist/model/evolution.d.ts.map +1 -0
  681. package/dist/model/evolution.js +5 -0
  682. package/dist/model/evolution.js.map +1 -0
  683. package/dist/model/expr-children.d.ts +15 -0
  684. package/dist/model/expr-children.d.ts.map +1 -0
  685. package/dist/model/expr-children.js +45 -0
  686. package/dist/model/expr-children.js.map +1 -0
  687. package/dist/model/guards.d.ts +9 -0
  688. package/dist/model/guards.d.ts.map +1 -0
  689. package/dist/model/guards.js +11 -0
  690. package/dist/model/guards.js.map +1 -0
  691. package/dist/model/input.d.ts +42 -0
  692. package/dist/model/input.d.ts.map +1 -0
  693. package/dist/model/input.js +26 -0
  694. package/dist/model/input.js.map +1 -0
  695. package/dist/model/integer.d.ts +14 -0
  696. package/dist/model/integer.d.ts.map +1 -0
  697. package/dist/model/integer.js +16 -0
  698. package/dist/model/integer.js.map +1 -0
  699. package/dist/model/intrinsic.d.ts +18 -0
  700. package/dist/model/intrinsic.d.ts.map +1 -0
  701. package/dist/model/intrinsic.js +21 -0
  702. package/dist/model/intrinsic.js.map +1 -0
  703. package/dist/model/layout.d.ts +129 -0
  704. package/dist/model/layout.d.ts.map +1 -0
  705. package/dist/model/layout.js +2 -0
  706. package/dist/model/layout.js.map +1 -0
  707. package/dist/model/media.d.ts +33 -0
  708. package/dist/model/media.d.ts.map +1 -0
  709. package/dist/model/media.js +86 -0
  710. package/dist/model/media.js.map +1 -0
  711. package/dist/model/members.generated.d.ts +11 -0
  712. package/dist/model/members.generated.d.ts.map +1 -0
  713. package/dist/model/members.generated.js +71 -0
  714. package/dist/model/members.generated.js.map +1 -0
  715. package/dist/model/row-address.d.ts +27 -0
  716. package/dist/model/row-address.d.ts.map +1 -0
  717. package/dist/model/row-address.js +146 -0
  718. package/dist/model/row-address.js.map +1 -0
  719. package/dist/model/schema.d.ts +108 -0
  720. package/dist/model/schema.d.ts.map +1 -0
  721. package/dist/model/schema.js +2 -0
  722. package/dist/model/schema.js.map +1 -0
  723. package/dist/model/shape.d.ts +193 -0
  724. package/dist/model/shape.d.ts.map +1 -0
  725. package/dist/model/shape.js +2 -0
  726. package/dist/model/shape.js.map +1 -0
  727. package/dist/model/time.d.ts +61 -0
  728. package/dist/model/time.d.ts.map +1 -0
  729. package/dist/model/time.js +110 -0
  730. package/dist/model/time.js.map +1 -0
  731. package/dist/model/types.d.ts +1329 -0
  732. package/dist/model/types.d.ts.map +1 -0
  733. package/dist/model/types.js +424 -0
  734. package/dist/model/types.js.map +1 -0
  735. package/dist/model/values.d.ts +91 -0
  736. package/dist/model/values.d.ts.map +1 -0
  737. package/dist/model/values.js +195 -0
  738. package/dist/model/values.js.map +1 -0
  739. package/dist/model/wire.d.ts +356 -0
  740. package/dist/model/wire.d.ts.map +1 -0
  741. package/dist/model/wire.js +1504 -0
  742. package/dist/model/wire.js.map +1 -0
  743. package/dist/offline/index.d.ts +374 -0
  744. package/dist/offline/index.d.ts.map +1 -0
  745. package/dist/offline/index.js +422 -0
  746. package/dist/offline/index.js.map +1 -0
  747. package/dist/testing.d.ts +30 -0
  748. package/dist/testing.d.ts.map +1 -0
  749. package/dist/testing.js +42 -0
  750. package/dist/testing.js.map +1 -0
  751. package/dist/version.d.ts +30 -0
  752. package/dist/version.d.ts.map +1 -0
  753. package/dist/version.js +116 -0
  754. package/dist/version.js.map +1 -0
  755. package/package.json +98 -3
@@ -0,0 +1,66 @@
1
+ const OVERLAY_ID_PATTERN = /^[a-z][a-z0-9_]{0,63}$/;
2
+ /** The two members a composition report states, `spec/metaschema/report.v1.json`. */
3
+ const COMPOSITION_MEMBERS = new Set(['baseVersion', 'overlays']);
4
+ /** One own member, read by descriptor so an accessor on an untrusted value never runs. */
5
+ function ownMember(value, key) {
6
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
7
+ return descriptor === undefined ? undefined : descriptor.value;
8
+ }
9
+ /**
10
+ * The own member a composition report states beyond the two the contract carries, or `undefined`.
11
+ *
12
+ * Exported from this module for the wire receipt's refusal detail, which names the offending
13
+ * member; it is not on the package's host door, which re-exports `isCompositionReport` and the
14
+ * two types by name. `Object.keys` reads names without invoking an accessor, and the report
15
+ * contract is closed over the enumerable members JSON can carry.
16
+ */
17
+ export function compositionMemberOutside(value) {
18
+ for (const member of Object.keys(value)) {
19
+ if (!COMPOSITION_MEMBERS.has(member))
20
+ return member;
21
+ }
22
+ return undefined;
23
+ }
24
+ /** A positive safe integer, the shape every edition states. */
25
+ function isEdition(value) {
26
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= 1;
27
+ }
28
+ /**
29
+ * Whether `value` is the composition report the artifact and report contracts admit.
30
+ *
31
+ * This is the boundary parser for a member a host can rehydrate from storage. It is not a
32
+ * general JSON Schema check: it asks exactly the questions the runtime's report assembly and a
33
+ * reader of the version report depend on — a positive base edition and a non-empty ordered list
34
+ * of named editions — so a malformed value is refused where it enters rather than travelling
35
+ * into a sealed report.
36
+ */
37
+ export function isCompositionReport(value) {
38
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
39
+ return false;
40
+ // The composition itself is closed by the report contract, so a third member is refused for
41
+ // the same reason an overlay entry's third member is: a value the contract does not carry
42
+ // would otherwise be copied into the report body and hashed into `reportHash`.
43
+ if (compositionMemberOutside(value) !== undefined)
44
+ return false;
45
+ if (!isEdition(ownMember(value, 'baseVersion')))
46
+ return false;
47
+ const overlays = ownMember(value, 'overlays');
48
+ if (!Array.isArray(overlays) || overlays.length === 0)
49
+ return false;
50
+ for (const overlay of overlays) {
51
+ if (typeof overlay !== 'object' || overlay === null || Array.isArray(overlay))
52
+ return false;
53
+ // A composition entry states exactly its two facts. An extra member would be a value the
54
+ // report contract does not carry, and an unreported member in a hashed document is the
55
+ // silent difference the closed shape exists to refuse.
56
+ if (Object.keys(overlay).length !== 2)
57
+ return false;
58
+ const overlayId = ownMember(overlay, 'overlayId');
59
+ if (typeof overlayId !== 'string' || !OVERLAY_ID_PATTERN.test(overlayId))
60
+ return false;
61
+ if (!isEdition(ownMember(overlay, 'schemaVersion')))
62
+ return false;
63
+ }
64
+ return true;
65
+ }
66
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.js","sourceRoot":"","sources":["../../src/model/composition.ts"],"names":[],"mappings":"AA6BA,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAEpD,qFAAqF;AACrF,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC;AAEtF,0FAA0F;AAC1F,SAAS,SAAS,CAAC,KAAa,EAAE,GAAW;IAC3C,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/D,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;AACjE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAa;IACpD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;IACtD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,+DAA+D;AAC/D,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc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VOL-4.1.4]`.\n *\n * A layered configuration is one base document plus an ordered set of overlays. The artifact\n * that results names the base edition and every overlay edition it applied, in the order it\n * applied them, so a dispute can name exactly which configuration produced a report. The\n * member is behaviour rather than presentation: two artifacts that decide the same record but\n * were composed from different editions state different configurations, and a report's\n * `behaviorHash` and `reportHash` must distinguish them.\n *\n * The version is the overlay document's own `schemaVersion`; `overlayId` is the host's name for\n * the layer (for example `tenant` or `process`), which is not part of any schema document.\n */\nexport interface AppliedOverlay {\n /** The host's name for this layer, as it supplied it to `compileOverlay`. */\n readonly overlayId: string;\n /** The overlay document's own `schemaVersion`. */\n readonly schemaVersion: number;\n}\n\n/** The base edition and every overlay edition a compiled artifact applied, in order. */\nexport interface CompositionReport {\n /** The base document's `schemaVersion`; equal to the artifact's own `schemaVersion`. */\n readonly baseVersion: number;\n /** Every applied overlay, in application order. Never empty on a member that is present. */\n readonly overlays: readonly AppliedOverlay[];\n}\n\nconst OVERLAY_ID_PATTERN = /^[a-z][a-z0-9_]{0,63}$/;\n\n/** The two members a composition report states, `spec/metaschema/report.v1.json`. */\nconst COMPOSITION_MEMBERS: ReadonlySet<string> = new Set(['baseVersion', 'overlays']);\n\n/** One own member, read by descriptor so an accessor on an untrusted value never runs. */\nfunction ownMember(value: object, key: string): unknown {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n return descriptor === undefined ? undefined : descriptor.value;\n}\n\n/**\n * The own member a composition report states beyond the two the contract carries, or `undefined`.\n *\n * Exported from this module for the wire receipt's refusal detail, which names the offending\n * member; it is not on the package's host door, which re-exports `isCompositionReport` and the\n * two types by name. `Object.keys` reads names without invoking an accessor, and the report\n * contract is closed over the enumerable members JSON can carry.\n */\nexport function compositionMemberOutside(value: object): string | undefined {\n for (const member of Object.keys(value)) {\n if (!COMPOSITION_MEMBERS.has(member)) return member;\n }\n return undefined;\n}\n\n/** A positive safe integer, the shape every edition states. */\nfunction isEdition(value: unknown): value is number {\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 1;\n}\n\n/**\n * Whether `value` is the composition report the artifact and report contracts admit.\n *\n * This is the boundary parser for a member a host can rehydrate from storage. It is not a\n * general JSON Schema check: it asks exactly the questions the runtime's report assembly and a\n * reader of the version report depend on — a positive base edition and a non-empty ordered list\n * of named editions — so a malformed value is refused where it enters rather than travelling\n * into a sealed report.\n */\nexport function isCompositionReport(value: unknown): value is CompositionReport {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return false;\n // The composition itself is closed by the report contract, so a third member is refused for\n // the same reason an overlay entry's third member is: a value the contract does not carry\n // would otherwise be copied into the report body and hashed into `reportHash`.\n if (compositionMemberOutside(value) !== undefined) return false;\n if (!isEdition(ownMember(value, 'baseVersion'))) return false;\n const overlays = ownMember(value, 'overlays');\n if (!Array.isArray(overlays) || overlays.length === 0) return false;\n for (const overlay of overlays) {\n if (typeof overlay !== 'object' || overlay === null || Array.isArray(overlay)) return false;\n // A composition entry states exactly its two facts. An extra member would be a value the\n // report contract does not carry, and an unreported member in a hashed document is the\n // silent difference the closed shape exists to refuse.\n if (Object.keys(overlay).length !== 2) return false;\n const overlayId = ownMember(overlay, 'overlayId');\n if (typeof overlayId !== 'string' || !OVERLAY_ID_PATTERN.test(overlayId)) return false;\n if (!isEdition(ownMember(overlay, 'schemaVersion'))) return false;\n }\n return true;\n}\n"]}
@@ -0,0 +1,51 @@
1
+ import type { CompiledField, FieldItem, ItemPrimitive, Primitive } from './types.js';
2
+ /**
3
+ * The four domain members every declaration may state, with the reader's defaults applied.
4
+ *
5
+ * A field, an item, a context root and a record member all state the same domain: `currency`
6
+ * and `scale` for money, `units` and `scale` for quantity, `unit` for duration. The defaults are
7
+ * the reader's, not a caller's: a quantity's absent `scale` is `0` and a duration's absent `unit`
8
+ * is `minutes` (`MODEL-2.1.21`, `MODEL-2.1.24`), so the static type and the wire reader cannot
9
+ * disagree about what an omission means.
10
+ */
11
+ export interface ValueDomainFields {
12
+ /** The money domain, present only on a `money` declaration. */
13
+ readonly currency?: string;
14
+ readonly scale?: number;
15
+ /** The quantity unit domain, present only on a `quantity` declaration. */
16
+ readonly units?: readonly string[];
17
+ /** The duration unit, present only on a `duration` declaration. */
18
+ readonly unit?: string;
19
+ }
20
+ /** One element of a scalar or attachment array: an `ItemPrimitive` and its domain. */
21
+ export interface ItemValueDomain extends ValueDomainFields {
22
+ readonly primitive: ItemPrimitive;
23
+ }
24
+ /** One declaration's value domain. */
25
+ export interface ValueDomain extends ValueDomainFields {
26
+ readonly primitive: Primitive;
27
+ /** The item domain of a scalar or attachment array. */
28
+ readonly items?: ItemValueDomain;
29
+ /** The declared members of a record, or of an array's record items. */
30
+ readonly fields?: readonly CompiledField[];
31
+ }
32
+ /** The members any declaration states its value domain with. */
33
+ export interface ValueDomainDeclaration {
34
+ readonly primitive: Primitive;
35
+ readonly currency?: string;
36
+ readonly scale?: number;
37
+ readonly units?: readonly string[];
38
+ readonly unit?: string;
39
+ readonly items?: FieldItem;
40
+ readonly fields?: readonly CompiledField[];
41
+ }
42
+ /**
43
+ * The one derivation of what value a declaration admits.
44
+ *
45
+ * `wireDeclarationOf` builds the reader's `WireDeclaration` from this, the compiler's
46
+ * `staticTypeOf` builds its `StaticType` from this, and a context root is read and typed through
47
+ * the same function. One authority is what keeps a declaration the compiler types from being a
48
+ * declaration the boundary refuses.
49
+ */
50
+ export declare function valueDomainOf(declaration: ValueDomainDeclaration): ValueDomain;
51
+ //# sourceMappingURL=domain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/model/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAErF;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,sFAAsF;AACtF,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;CACnC;AAED,sCAAsC;AACtC,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IACpD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IACjC,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC5C;AAED,gEAAgE;AAChE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC5C;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,sBAAsB,GAAG,WAAW,CAsD9E"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The one derivation of what value a declaration admits.
3
+ *
4
+ * `wireDeclarationOf` builds the reader's `WireDeclaration` from this, the compiler's
5
+ * `staticTypeOf` builds its `StaticType` from this, and a context root is read and typed through
6
+ * the same function. One authority is what keeps a declaration the compiler types from being a
7
+ * declaration the boundary refuses.
8
+ */
9
+ export function valueDomainOf(declaration) {
10
+ const { primitive } = declaration;
11
+ switch (primitive) {
12
+ case 'money':
13
+ return {
14
+ primitive,
15
+ ...(declaration.currency === undefined ? {} : { currency: declaration.currency }),
16
+ ...(declaration.scale === undefined ? {} : { scale: declaration.scale }),
17
+ };
18
+ case 'quantity':
19
+ return {
20
+ primitive,
21
+ ...(declaration.units === undefined ? {} : { units: declaration.units }),
22
+ scale: declaration.scale ?? 0,
23
+ };
24
+ case 'duration':
25
+ return { primitive, unit: declaration.unit ?? 'minutes' };
26
+ case 'array':
27
+ return {
28
+ primitive,
29
+ ...(declaration.items === undefined ? {} : { items: itemValueDomainOf(declaration.items) }),
30
+ ...(declaration.fields === undefined ? {} : { fields: declaration.fields }),
31
+ };
32
+ case 'record':
33
+ return {
34
+ primitive,
35
+ ...(declaration.fields === undefined ? {} : { fields: declaration.fields }),
36
+ };
37
+ case 'string':
38
+ case 'boolean':
39
+ case 'integer':
40
+ case 'decimal':
41
+ case 'date':
42
+ case 'instant':
43
+ case 'time':
44
+ case 'media_ref':
45
+ case 'signature_ref':
46
+ case 'timeslot':
47
+ case 'address':
48
+ case 'coordinate':
49
+ // These primitives state nothing but their own name, so there is no domain member to
50
+ // apply. Naming them is what makes the switch exhaustive.
51
+ return { primitive };
52
+ default: {
53
+ // Every member of `Primitive` has an arm above, so a primitive added to the union narrows
54
+ // this arm to that variant and fails typecheck here until it is handled. At run time the
55
+ // arm is reached only by a primitive read from an artifact this build did not compile: it
56
+ // writes no member a value could disagree with, and the refusal belongs to
57
+ // `checkDeclaration` (`model/wire.ts`), which holds the value's path — the fact a refusal
58
+ // has to name and this derivation does not have.
59
+ const unsupported = primitive;
60
+ return { primitive: unsupported };
61
+ }
62
+ }
63
+ }
64
+ /** One array element's domain. The item's own primitive is preserved, so a reader sees one. */
65
+ function itemValueDomainOf(item) {
66
+ const domain = valueDomainOf(item);
67
+ return {
68
+ primitive: item.primitive,
69
+ ...(domain.currency === undefined ? {} : { currency: domain.currency }),
70
+ ...(domain.scale === undefined ? {} : { scale: domain.scale }),
71
+ ...(domain.units === undefined ? {} : { units: domain.units }),
72
+ ...(domain.unit === undefined ? {} : { unit: domain.unit }),
73
+ };
74
+ }
75
+ //# sourceMappingURL=domain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.js","sourceRoot":"","sources":["../../src/model/domain.ts"],"names":[],"mappings":"AA8CA;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmC;IAC/D,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC;IAClC,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO;gBACL,SAAS;gBACT,GAAG,CAAC,WAAW,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC;gBACjF,GAAG,CAAC,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC;aACzE,CAAC;QACJ,KAAK,UAAU;YACb,OAAO;gBACL,SAAS;gBACT,GAAG,CAAC,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC;gBACxE,KAAK,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;aAC9B,CAAC;QACJ,KAAK,UAAU;YACb,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;QAC5D,KAAK,OAAO;YACV,OAAO;gBACL,SAAS;gBACT,GAAG,CAAC,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CA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M,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;QAC9D,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;QAC9D,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;KAC5D,CAAC;AACJ,CAAC","sourcesContent":["import type { CompiledField, FieldItem, ItemPrimitive, Primitive } from './types.js';\n\n/**\n * The four domain members every declaration may state, with the reader's defaults applied.\n *\n * A field, an item, a context root and a record member all state the same domain: `currency`\n * and `scale` for money, `units` and `scale` for quantity, `unit` for duration. The defaults are\n * the reader's, not a caller's: a quantity's absent `scale` is `0` and a duration's absent `unit`\n * is `minutes` (`MODEL-2.1.21`, `MODEL-2.1.24`), so the static type and the wire reader cannot\n * disagree about what an omission means.\n */\nexport interface ValueDomainFields {\n /** The money domain, present only on a `money` declaration. */\n readonly currency?: string;\n readonly scale?: number;\n /** The quantity unit domain, present only on a `quantity` declaration. */\n readonly units?: readonly string[];\n /** The duration unit, present only on a `duration` declaration. */\n readonly unit?: string;\n}\n\n/** One element of a scalar or attachment array: an `ItemPrimitive` and its domain. */\nexport interface ItemValueDomain extends ValueDomainFields {\n readonly primitive: ItemPrimitive;\n}\n\n/** One declaration's value domain. */\nexport interface ValueDomain extends ValueDomainFields {\n readonly primitive: Primitive;\n /** The item domain of a scalar or attachment array. */\n readonly items?: ItemValueDomain;\n /** The declared members of a record, or of an array's record items. */\n readonly fields?: readonly CompiledField[];\n}\n\n/** The members any declaration states its value domain with. */\nexport interface ValueDomainDeclaration {\n readonly primitive: Primitive;\n readonly currency?: string;\n readonly scale?: number;\n readonly units?: readonly string[];\n readonly unit?: string;\n readonly items?: FieldItem;\n readonly fields?: readonly CompiledField[];\n}\n\n/**\n * The one derivation of what value a declaration admits.\n *\n * `wireDeclarationOf` builds the reader's `WireDeclaration` from this, the compiler's\n * `staticTypeOf` builds its `StaticType` from this, and a context root is read and typed through\n * the same function. One authority is what keeps a declaration the compiler types from being a\n * declaration the boundary refuses.\n */\nexport function valueDomainOf(declaration: ValueDomainDeclaration): ValueDomain {\n const { primitive } = declaration;\n switch (primitive) {\n case 'money':\n return {\n primitive,\n ...(declaration.currency === undefined ? {} : { currency: declaration.currency }),\n ...(declaration.scale === undefined ? {} : { scale: declaration.scale }),\n };\n case 'quantity':\n return {\n primitive,\n ...(declaration.units === undefined ? {} : { units: declaration.units }),\n scale: declaration.scale ?? 0,\n };\n case 'duration':\n return { primitive, unit: declaration.unit ?? 'minutes' };\n case 'array':\n return {\n primitive,\n ...(declaration.items === undefined ? {} : { items: itemValueDomainOf(declaration.items) }),\n ...(declaration.fields === undefined ? {} : { fields: declaration.fields }),\n };\n case 'record':\n return {\n primitive,\n ...(declaration.fields === undefined ? {} : { fields: declaration.fields }),\n };\n case 'string':\n case 'boolean':\n case 'integer':\n case 'decimal':\n case 'date':\n case 'instant':\n case 'time':\n case 'media_ref':\n case 'signature_ref':\n case 'timeslot':\n case 'address':\n case 'coordinate':\n // These primitives state nothing but their own name, so there is no domain member to\n // apply. Naming them is what makes the switch exhaustive.\n return { primitive };\n default: {\n // Every member of `Primitive` has an arm above, so a primitive added to the union narrows\n // this arm to that variant and fails typecheck here until it is handled. At run time the\n // arm is reached only by a primitive read from an artifact this build did not compile: it\n // writes no member a value could disagree with, and the refusal belongs to\n // `checkDeclaration` (`model/wire.ts`), which holds the value's path — the fact a refusal\n // has to name and this derivation does not have.\n const unsupported: never = primitive;\n return { primitive: unsupported };\n }\n }\n}\n\n/** One array element's domain. The item's own primitive is preserved, so a reader sees one. */\nfunction itemValueDomainOf(item: FieldItem): ItemValueDomain {\n const domain: ValueDomain = valueDomainOf(item);\n return {\n primitive: item.primitive,\n ...(domain.currency === undefined ? {} : { currency: domain.currency }),\n ...(domain.scale === undefined ? {} : { scale: domain.scale }),\n ...(domain.units === undefined ? {} : { units: domain.units }),\n ...(domain.unit === undefined ? {} : { unit: domain.unit }),\n };\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { DurationUnit } from './types.js';
2
+ /**
3
+ * A length of time, `spec/semantics/model-v1.md` `MODEL-2.1.24`.
4
+ *
5
+ * The value carries its unit, so every operation either proves both operands name one unit or
6
+ * refuses. v1 defines no conversion between minutes, hours and seconds: the two explicit
7
+ * conversions are `duration_minutes` and `duration_seconds`, and `add`/`sum`/comparison do not
8
+ * convert.
9
+ */
10
+ /** A duration value the engine has read and checked. */
11
+ export interface DurationLike {
12
+ readonly amount: number;
13
+ readonly unit: DurationUnit;
14
+ }
15
+ /** The canonical duration value, read from a value the engine produced. */
16
+ export declare function toDurationValue(value: unknown, path?: string): DurationLike;
17
+ /** The exact sum of two durations of one unit. */
18
+ export declare function durationAdd(left: DurationLike, right: DurationLike, path?: string): DurationLike;
19
+ /** The exact difference of two durations of one unit; a negative length is refused. */
20
+ export declare function durationSub(left: DurationLike, right: DurationLike, path?: string): DurationLike;
21
+ /** The order of two durations of one unit; a mixed pair is refused rather than compared. */
22
+ export declare function compareDurations(left: unknown, right: unknown, path?: string): number;
23
+ /** The amount as a whole number of minutes; an explicit conversion, never an implicit one. */
24
+ export declare function durationMinutes(value: unknown, path?: string): number;
25
+ /** The amount as a whole number of seconds; an explicit conversion, never an implicit one. */
26
+ export declare function durationSeconds(value: unknown, path?: string): number;
27
+ /** Whole minutes from `from` to `to`, `to - from`; the pair must name one unit. */
28
+ export declare function minutesBetweenDurations(from: unknown, to: unknown, path?: string): number;
29
+ /** The zero of one unit, for `sum` over a single-unit duration list. */
30
+ export declare function durationZero(unit: DurationUnit): DurationLike;
31
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/model/duration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;;;;;;GAOG;AAEH,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;CAC7B;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAK,GAAG,YAAY,CAgCvE;AAaD,kDAAkD;AAClD,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,SAAK,GAAG,YAAY,CAS5F;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,SAAK,GAAG,YAAY,CAS5F;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,SAAK,GAAG,MAAM,CAMjF;AAyBD,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAK,GAAG,MAAM,CAoBjE;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAK,GAAG,MAAM,CAUjE;AAED,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,SAAK,GAAG,MAAM,CAmBrF;AAED,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAE7D"}
@@ -0,0 +1,136 @@
1
+ import { AxiomError } from './errors.js';
2
+ import { isSafeInteger } from './integer.js';
3
+ import { isRecord } from './guards.js';
4
+ import { DURATION_UNITS, isDurationUnit } from './types.js';
5
+ /** The canonical duration value, read from a value the engine produced. */
6
+ export function toDurationValue(value, path = '') {
7
+ if (!isRecord(value)) {
8
+ throw new AxiomError('ENGINE_ERROR', 'duration must be an object', path);
9
+ }
10
+ const missing = ['amount', 'unit'].filter((member) => !Object.hasOwn(value, member));
11
+ if (missing.length > 0) {
12
+ throw new AxiomError('ENGINE_ERROR', `duration is missing required member \`${missing[0] ?? ''}\``, path);
13
+ }
14
+ const extra = Object.keys(value)
15
+ .filter((member) => member !== 'amount' && member !== 'unit')
16
+ .sort()[0];
17
+ if (extra !== undefined) {
18
+ throw new AxiomError('ENGINE_ERROR', `duration declares undeclared member \`${extra}\``, path);
19
+ }
20
+ const amount = value['amount'];
21
+ if (typeof amount !== 'number' || !isSafeInteger(amount) || amount < 0) {
22
+ throw new AxiomError('ENGINE_ERROR', 'duration amount must be a whole number at least zero', path);
23
+ }
24
+ const unit = value['unit'];
25
+ if (!isDurationUnit(unit)) {
26
+ const choices = `${DURATION_UNITS.slice(0, -1).join(', ')} or ${DURATION_UNITS.at(-1) ?? ''}`;
27
+ throw new AxiomError('ENGINE_ERROR', `duration unit must be ${choices}`, path);
28
+ }
29
+ return { amount, unit };
30
+ }
31
+ /** Whether two durations name one unit, refusing a mix rather than converting it. */
32
+ function assertSameDurationUnit(left, right, path) {
33
+ if (left.unit !== right.unit) {
34
+ throw new AxiomError('ENGINE_ERROR', `duration operands differ in unit: ${left.unit} and ${right.unit}; v1 defines no unit conversion`, path);
35
+ }
36
+ }
37
+ /** The exact sum of two durations of one unit. */
38
+ export function durationAdd(left, right, path = '') {
39
+ const a = toDurationValue(left, path);
40
+ const b = toDurationValue(right, path);
41
+ assertSameDurationUnit(a, b, path);
42
+ const amount = a.amount + b.amount;
43
+ if (!Number.isSafeInteger(amount)) {
44
+ throw new AxiomError('ENGINE_ERROR', 'duration sum overflows the canonical range', path);
45
+ }
46
+ return { amount, unit: a.unit };
47
+ }
48
+ /** The exact difference of two durations of one unit; a negative length is refused. */
49
+ export function durationSub(left, right, path = '') {
50
+ const a = toDurationValue(left, path);
51
+ const b = toDurationValue(right, path);
52
+ assertSameDurationUnit(a, b, path);
53
+ const amount = a.amount - b.amount;
54
+ if (amount < 0) {
55
+ throw new AxiomError('ENGINE_ERROR', 'a duration cannot be negative', path);
56
+ }
57
+ return { amount, unit: a.unit };
58
+ }
59
+ /** The order of two durations of one unit; a mixed pair is refused rather than compared. */
60
+ export function compareDurations(left, right, path = '') {
61
+ const a = toDurationValue(left, path);
62
+ const b = toDurationValue(right, path);
63
+ assertSameDurationUnit(a, b, path);
64
+ if (a.amount === b.amount)
65
+ return 0;
66
+ return a.amount < b.amount ? -1 : 1;
67
+ }
68
+ /**
69
+ * One amount multiplied into the integer domain, or a refusal.
70
+ *
71
+ * A duration amount is a safe integer and the conversion factor is exact, so the product is
72
+ * computed in BigInt: a `number` product above `2^53` rounds silently, and a rounded minute count
73
+ * is a plausible wrong answer in the report rather than a refusal. `EXPR-11.1.2` asks for the
74
+ * refusal.
75
+ */
76
+ function scaledAmount(amount, factor, path, operation) {
77
+ const product = BigInt(amount) * BigInt(factor);
78
+ if (product > MAX_SAFE || product < MIN_SAFE) {
79
+ throw new AxiomError('ENGINE_ERROR', `${operation} is outside the integer domain: ${String(amount)} x ${String(factor)}`, path);
80
+ }
81
+ return Number(product);
82
+ }
83
+ const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
84
+ const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
85
+ /** The amount as a whole number of minutes; an explicit conversion, never an implicit one. */
86
+ export function durationMinutes(value, path = '') {
87
+ const duration = toDurationValue(value, path);
88
+ switch (duration.unit) {
89
+ case 'minutes':
90
+ return duration.amount;
91
+ case 'hours':
92
+ return scaledAmount(duration.amount, 60, path, 'duration_minutes');
93
+ case 'seconds': {
94
+ const remainder = duration.amount % 60;
95
+ if (remainder !== 0) {
96
+ const wholeMinutes = (duration.amount - remainder) / 60;
97
+ throw new AxiomError('ENGINE_ERROR', `duration_minutes cannot state ${String(duration.amount)} seconds as a whole number of minutes; ${String(duration.amount)} seconds is ${String(wholeMinutes)} ${wholeMinutes === 1 ? 'minute' : 'minutes'} and ${String(remainder)} ${remainder === 1 ? 'second' : 'seconds'}`, path);
98
+ }
99
+ return duration.amount / 60;
100
+ }
101
+ }
102
+ }
103
+ /** The amount as a whole number of seconds; an explicit conversion, never an implicit one. */
104
+ export function durationSeconds(value, path = '') {
105
+ const duration = toDurationValue(value, path);
106
+ switch (duration.unit) {
107
+ case 'seconds':
108
+ return duration.amount;
109
+ case 'minutes':
110
+ return scaledAmount(duration.amount, 60, path, 'duration_seconds');
111
+ case 'hours':
112
+ return scaledAmount(duration.amount, 3600, path, 'duration_seconds');
113
+ }
114
+ }
115
+ /** Whole minutes from `from` to `to`, `to - from`; the pair must name one unit. */
116
+ export function minutesBetweenDurations(from, to, path = '') {
117
+ const a = toDurationValue(from, path);
118
+ const b = toDurationValue(to, path);
119
+ assertSameDurationUnit(a, b, path);
120
+ // Exact in BigInt: the difference and the hour scale can both leave the safe range, and BigInt
121
+ // division truncates toward zero, which is the whole-minute answer `minutes_between` declares.
122
+ const delta = BigInt(b.amount) - BigInt(a.amount);
123
+ const scaled = a.unit === 'seconds' ? delta / 60n : a.unit === 'hours' ? delta * 60n : delta;
124
+ if (scaled > MAX_SAFE || scaled < MIN_SAFE) {
125
+ throw new AxiomError('ENGINE_ERROR', `minutes_between is outside the integer domain: ${String(a.amount)} to ${String(b.amount)}`, path);
126
+ }
127
+ const minutes = Number(scaled);
128
+ // `Math.trunc` on a negative fraction yields `-0`, which is outside `WireValue` and seals a
129
+ // report the runtime's own reader refuses. Zero is zero.
130
+ return minutes === 0 ? 0 : minutes;
131
+ }
132
+ /** The zero of one unit, for `sum` over a single-unit duration list. */
133
+ export function durationZero(unit) {
134
+ return { amount: 0, unit };
135
+ }
136
+ //# sourceMappingURL=duration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.js","s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AC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACnC,+FAA+F;IAC/F,+FAA+F;IAC/F,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7F,IAAI,MAAM,GAAG,QAAQ,IAAI,MAAM,GAAG,QAAQ,EAAE,CAAC;QAC3C,MAAM,IAAI,UAAU,CAClB,cAAc,EACd,kDAAkD,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAC3F,IAAI,CACL,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,4FAA4F;IAC5F,yDAAyD;IACzD,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACrC,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,IAAkB;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["import { AxiomError } from './errors.js';\nimport { isSafeInteger } from './integer.js';\nimport { isRecord } from './guards.js';\nimport type { DurationUnit } from './types.js';\nimport { DURATION_UNITS, isDurationUnit } from './types.js';\n\n/**\n * A length of time, `spec/semantics/model-v1.md` `MODEL-2.1.24`.\n *\n * The value carries its unit, so every operation either proves both operands name one unit or\n * refuses. v1 defines no conversion between minutes, hours and seconds: the two explicit\n * conversions are `duration_minutes` and `duration_seconds`, and `add`/`sum`/comparison do not\n * convert.\n */\n\n/** A duration value the engine has read and checked. */\nexport interface DurationLike {\n readonly amount: number;\n readonly unit: DurationUnit;\n}\n\n/** The canonical duration value, read from a value the engine produced. */\nexport function toDurationValue(value: unknown, path = ''): DurationLike {\n if (!isRecord(value)) {\n throw new AxiomError('ENGINE_ERROR', 'duration must be an object', path);\n }\n const missing = ['amount', 'unit'].filter((member) => !Object.hasOwn(value, member));\n if (missing.length > 0) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `duration is missing required member \\`${missing[0] ?? ''}\\``,\n path,\n );\n }\n const extra = Object.keys(value)\n .filter((member) => member !== 'amount' && member !== 'unit')\n .sort()[0];\n if (extra !== undefined) {\n throw new AxiomError('ENGINE_ERROR', `duration declares undeclared member \\`${extra}\\``, path);\n }\n const amount = value['amount'];\n if (typeof amount !== 'number' || !isSafeInteger(amount) || amount < 0) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'duration amount must be a whole number at least zero',\n path,\n );\n }\n const unit = value['unit'];\n if (!isDurationUnit(unit)) {\n const choices = `${DURATION_UNITS.slice(0, -1).join(', ')} or ${DURATION_UNITS.at(-1) ?? ''}`;\n throw new AxiomError('ENGINE_ERROR', `duration unit must be ${choices}`, path);\n }\n return { amount, unit };\n}\n\n/** Whether two durations name one unit, refusing a mix rather than converting it. */\nfunction assertSameDurationUnit(left: DurationLike, right: DurationLike, path: string): void {\n if (left.unit !== right.unit) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `duration operands differ in unit: ${left.unit} and ${right.unit}; v1 defines no unit conversion`,\n path,\n );\n }\n}\n\n/** The exact sum of two durations of one unit. */\nexport function durationAdd(left: DurationLike, right: DurationLike, path = ''): DurationLike {\n const a = toDurationValue(left, path);\n const b = toDurationValue(right, path);\n assertSameDurationUnit(a, b, path);\n const amount = a.amount + b.amount;\n if (!Number.isSafeInteger(amount)) {\n throw new AxiomError('ENGINE_ERROR', 'duration sum overflows the canonical range', path);\n }\n return { amount, unit: a.unit };\n}\n\n/** The exact difference of two durations of one unit; a negative length is refused. */\nexport function durationSub(left: DurationLike, right: DurationLike, path = ''): DurationLike {\n const a = toDurationValue(left, path);\n const b = toDurationValue(right, path);\n assertSameDurationUnit(a, b, path);\n const amount = a.amount - b.amount;\n if (amount < 0) {\n throw new AxiomError('ENGINE_ERROR', 'a duration cannot be negative', path);\n }\n return { amount, unit: a.unit };\n}\n\n/** The order of two durations of one unit; a mixed pair is refused rather than compared. */\nexport function compareDurations(left: unknown, right: unknown, path = ''): number {\n const a = toDurationValue(left, path);\n const b = toDurationValue(right, path);\n assertSameDurationUnit(a, b, path);\n if (a.amount === b.amount) return 0;\n return a.amount < b.amount ? -1 : 1;\n}\n\n/**\n * One amount multiplied into the integer domain, or a refusal.\n *\n * A duration amount is a safe integer and the conversion factor is exact, so the product is\n * computed in BigInt: a `number` product above `2^53` rounds silently, and a rounded minute count\n * is a plausible wrong answer in the report rather than a refusal. `EXPR-11.1.2` asks for the\n * refusal.\n */\nfunction scaledAmount(amount: number, factor: number, path: string, operation: string): number {\n const product = BigInt(amount) * BigInt(factor);\n if (product > MAX_SAFE || product < MIN_SAFE) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `${operation} is outside the integer domain: ${String(amount)} x ${String(factor)}`,\n path,\n );\n }\n return Number(product);\n}\n\nconst MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);\nconst MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);\n\n/** The amount as a whole number of minutes; an explicit conversion, never an implicit one. */\nexport function durationMinutes(value: unknown, path = ''): number {\n const duration = toDurationValue(value, path);\n switch (duration.unit) {\n case 'minutes':\n return duration.amount;\n case 'hours':\n return scaledAmount(duration.amount, 60, path, 'duration_minutes');\n case 'seconds': {\n const remainder = duration.amount % 60;\n if (remainder !== 0) {\n const wholeMinutes = (duration.amount - remainder) / 60;\n throw new AxiomError(\n 'ENGINE_ERROR',\n `duration_minutes cannot state ${String(duration.amount)} seconds as a whole number of minutes; ${String(duration.amount)} seconds is ${String(wholeMinutes)} ${wholeMinutes === 1 ? 'minute' : 'minutes'} and ${String(remainder)} ${remainder === 1 ? 'second' : 'seconds'}`,\n path,\n );\n }\n return duration.amount / 60;\n }\n }\n}\n\n/** The amount as a whole number of seconds; an explicit conversion, never an implicit one. */\nexport function durationSeconds(value: unknown, path = ''): number {\n const duration = toDurationValue(value, path);\n switch (duration.unit) {\n case 'seconds':\n return duration.amount;\n case 'minutes':\n return scaledAmount(duration.amount, 60, path, 'duration_seconds');\n case 'hours':\n return scaledAmount(duration.amount, 3600, path, 'duration_seconds');\n }\n}\n\n/** Whole minutes from `from` to `to`, `to - from`; the pair must name one unit. */\nexport function minutesBetweenDurations(from: unknown, to: unknown, path = ''): number {\n const a = toDurationValue(from, path);\n const b = toDurationValue(to, path);\n assertSameDurationUnit(a, b, path);\n // Exact in BigInt: the difference and the hour scale can both leave the safe range, and BigInt\n // division truncates toward zero, which is the whole-minute answer `minutes_between` declares.\n const delta = BigInt(b.amount) - BigInt(a.amount);\n const scaled = a.unit === 'seconds' ? delta / 60n : a.unit === 'hours' ? delta * 60n : delta;\n if (scaled > MAX_SAFE || scaled < MIN_SAFE) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `minutes_between is outside the integer domain: ${String(a.amount)} to ${String(b.amount)}`,\n path,\n );\n }\n const minutes = Number(scaled);\n // `Math.trunc` on a negative fraction yields `-0`, which is outside `WireValue` and seals a\n // report the runtime's own reader refuses. Zero is zero.\n return minutes === 0 ? 0 : minutes;\n}\n\n/** The zero of one unit, for `sum` over a single-unit duration list. */\nexport function durationZero(unit: DurationUnit): DurationLike {\n return { amount: 0, unit };\n}\n"]}
@@ -0,0 +1,58 @@
1
+ import type { DiagnosticCode } from './types.js';
2
+ /**
3
+ * A refusal from the runtime that carries a diagnostic code and the path it
4
+ * happened at, so a caller can turn it into a diagnostic without the cause being
5
+ * discarded. `evaluate` catches these; nothing else swallows them.
6
+ */
7
+ export declare class AxiomError extends Error {
8
+ readonly code: DiagnosticCode;
9
+ readonly path: string;
10
+ /**
11
+ * The value-free cause of the refusal, without the ` at <path>` suffix `message` carries.
12
+ *
13
+ * A report may relay this sentence (`ENGINE_ERROR` with a cause an operator can act on), so it
14
+ * follows the same convention a wire refusal's `detail` does: it states the cause and never
15
+ * quotes the submitted value. A throw site whose message echoes an authored value — the
16
+ * authoring decimal reader, for example — passes the value-free form here.
17
+ */
18
+ readonly detail: string;
19
+ constructor(code: DiagnosticCode, message: string, path?: string, detail?: string);
20
+ }
21
+ /**
22
+ * A host supplied a value that contradicts the declared domain of the slot it is read into.
23
+ *
24
+ * This is a host bug, not a form error: the value never became a value of the declared domain,
25
+ * so the rule that read it cannot decide and stays `UNKNOWN`. The diagnostic carries the
26
+ * operand path, the declared domain, the received domain and `origin: 'host'`, so a host can
27
+ * branch on `LATE_BOUND_TYPE_MISMATCH` and log it rather than asking the respondent to repair
28
+ * a form they cannot see.
29
+ */
30
+ export declare class LateBoundTypeMismatch extends AxiomError {
31
+ readonly declaredDomain: string;
32
+ readonly receivedDomain: string;
33
+ readonly origin: 'host';
34
+ constructor(path: string, declaredDomain: string, receivedDomain: string, detail?: string);
35
+ }
36
+ /**
37
+ * A JSON document that is not a well-formed restricted-JSON input. Raised at
38
+ * ingestion, before validation or hashing, so a duplicate member name can never
39
+ * reach a validator that would silently keep the last one.
40
+ */
41
+ export type JsonIngestReason = 'syntax' | 'trailing_content' | 'nesting' | 'integer' | 'negative_zero' | 'unsafe_integer' | 'unterminated_string' | 'unpaired_surrogate' | 'control_character' | 'unicode_escape' | 'invalid_escape' | 'duplicate_member';
42
+ export declare class JsonIngestError extends Error {
43
+ readonly offset: number;
44
+ readonly path: string;
45
+ readonly reason: JsonIngestReason;
46
+ constructor(message: string, offset: number, path?: string, reason?: JsonIngestReason);
47
+ }
48
+ /**
49
+ * Proves a union is exhausted. A new variant reaching this function is a type error at
50
+ * the call site, so a switch over a closed union cannot silently fall through — the
51
+ * failure mode that would otherwise drop a message node or fold an outcome as `PASS`.
52
+ *
53
+ * The refusal names the variant tag or the value type, never the value: the file's own
54
+ * rule above keeps a submitted value out of a refusal, and a defect report is no
55
+ * exception.
56
+ */
57
+ export declare function assertNever(value: never): never;
58
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/model/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,SAAK,EAAE,MAAM,CAAC,EAAE,MAAM,EAM5E;CACF;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,UAAU;IACnD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAU;IAElC,YACE,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EACtB,MAAM,SAAyF,EAMhG;CACF;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,kBAAkB,GAClB,SAAS,GACT,SAAS,GACT,eAAe,GACf,gBAAgB,GAChB,qBAAqB,GACrB,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,CAAC;AAEvB,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC,YAAY,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,SAAK,EAAE,MAAM,GAAE,gBAA2B,EAM1F;CACF;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAK/C"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * A refusal from the runtime that carries a diagnostic code and the path it
3
+ * happened at, so a caller can turn it into a diagnostic without the cause being
4
+ * discarded. `evaluate` catches these; nothing else swallows them.
5
+ */
6
+ export class AxiomError extends Error {
7
+ code;
8
+ path;
9
+ /**
10
+ * The value-free cause of the refusal, without the ` at <path>` suffix `message` carries.
11
+ *
12
+ * A report may relay this sentence (`ENGINE_ERROR` with a cause an operator can act on), so it
13
+ * follows the same convention a wire refusal's `detail` does: it states the cause and never
14
+ * quotes the submitted value. A throw site whose message echoes an authored value — the
15
+ * authoring decimal reader, for example — passes the value-free form here.
16
+ */
17
+ detail;
18
+ constructor(code, message, path = '', detail) {
19
+ super(path === '' ? message : `${message} at ${path}`);
20
+ this.name = 'AxiomError';
21
+ this.code = code;
22
+ this.path = path;
23
+ this.detail = detail ?? message;
24
+ }
25
+ }
26
+ /**
27
+ * A host supplied a value that contradicts the declared domain of the slot it is read into.
28
+ *
29
+ * This is a host bug, not a form error: the value never became a value of the declared domain,
30
+ * so the rule that read it cannot decide and stays `UNKNOWN`. The diagnostic carries the
31
+ * operand path, the declared domain, the received domain and `origin: 'host'`, so a host can
32
+ * branch on `LATE_BOUND_TYPE_MISMATCH` and log it rather than asking the respondent to repair
33
+ * a form they cannot see.
34
+ */
35
+ export class LateBoundTypeMismatch extends AxiomError {
36
+ declaredDomain;
37
+ receivedDomain;
38
+ origin = 'host';
39
+ constructor(path, declaredDomain, receivedDomain, detail = `the host supplied a ${receivedDomain} where the declaration states ${declaredDomain}`) {
40
+ super('LATE_BOUND_TYPE_MISMATCH', detail, path, detail);
41
+ this.name = 'LateBoundTypeMismatch';
42
+ this.declaredDomain = declaredDomain;
43
+ this.receivedDomain = receivedDomain;
44
+ }
45
+ }
46
+ export class JsonIngestError extends Error {
47
+ offset;
48
+ path;
49
+ reason;
50
+ constructor(message, offset, path = '', reason = 'syntax') {
51
+ super(path === '' ? `${message} at offset ${offset}` : `${message} at ${path}`);
52
+ this.name = 'JsonIngestError';
53
+ this.offset = offset;
54
+ this.path = path;
55
+ this.reason = reason;
56
+ }
57
+ }
58
+ /**
59
+ * Proves a union is exhausted. A new variant reaching this function is a type error at
60
+ * the call site, so a switch over a closed union cannot silently fall through — the
61
+ * failure mode that would otherwise drop a message node or fold an outcome as `PASS`.
62
+ *
63
+ * The refusal names the variant tag or the value type, never the value: the file's own
64
+ * rule above keeps a submitted value out of a refusal, and a defect report is no
65
+ * exception.
66
+ */
67
+ export function assertNever(value) {
68
+ throw new AxiomError('ENGINE_ERROR', `internal error: the engine reached a case it cannot handle for ${variantTag(value)}; report the artifact and the rule that produced it`);
69
+ }
70
+ /** The tag an unreachable variant carries, or its type when it carries none. */
71
+ function variantTag(value) {
72
+ if (typeof value === 'object' && value !== null) {
73
+ const kind = Reflect.get(value, 'kind');
74
+ if (typeof kind === 'string') {
75
+ return `kind ${kind}`;
76
+ }
77
+ return 'an untagged object';
78
+ }
79
+ return `type ${typeof value}`;
80
+ }
81
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/model/errors.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,IAAI,CAAiB;IACrB,IAAI,CAAS;IACtB;;;;;;;OAOG;IACM,MAAM,CAAS;IAExB,YAAY,IAAoB,EAAE,OAAe,EAAE,IAAI,GAAG,EAAE,EAAE,MAAe;QAC3E,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC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,CAAC,KAAY;IACtC,MAAM,IAAI,UAAU,CAClB,cAAc,EACd,kEAAkE,UAAU,CAAC,KAAK,CAAC,qDAAqD,CACzI,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACjD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,QAAQ,IAAI,EAAE,CAAC;QACxB,CAAC;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IACD,OAAO,QAAQ,OAAO,KAAK,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import type { DiagnosticCode } from './types.js';\n\n/**\n * A refusal from the runtime that carries a diagnostic code and the path it\n * happened at, so a caller can turn it into a diagnostic without the cause being\n * discarded. `evaluate` catches these; nothing else swallows them.\n */\nexport class AxiomError extends Error {\n readonly code: DiagnosticCode;\n readonly path: string;\n /**\n * The value-free cause of the refusal, without the ` at <path>` suffix `message` carries.\n *\n * A report may relay this sentence (`ENGINE_ERROR` with a cause an operator can act on), so it\n * follows the same convention a wire refusal's `detail` does: it states the cause and never\n * quotes the submitted value. A throw site whose message echoes an authored value — the\n * authoring decimal reader, for example — passes the value-free form here.\n */\n readonly detail: string;\n\n constructor(code: DiagnosticCode, message: string, path = '', detail?: string) {\n super(path === '' ? message : `${message} at ${path}`);\n this.name = 'AxiomError';\n this.code = code;\n this.path = path;\n this.detail = detail ?? message;\n }\n}\n\n/**\n * A host supplied a value that contradicts the declared domain of the slot it is read into.\n *\n * This is a host bug, not a form error: the value never became a value of the declared domain,\n * so the rule that read it cannot decide and stays `UNKNOWN`. The diagnostic carries the\n * operand path, the declared domain, the received domain and `origin: 'host'`, so a host can\n * branch on `LATE_BOUND_TYPE_MISMATCH` and log it rather than asking the respondent to repair\n * a form they cannot see.\n */\nexport class LateBoundTypeMismatch extends AxiomError {\n readonly declaredDomain: string;\n readonly receivedDomain: string;\n readonly origin = 'host' as const;\n\n constructor(\n path: string,\n declaredDomain: string,\n receivedDomain: string,\n detail = `the host supplied a ${receivedDomain} where the declaration states ${declaredDomain}`,\n ) {\n super('LATE_BOUND_TYPE_MISMATCH', detail, path, detail);\n this.name = 'LateBoundTypeMismatch';\n this.declaredDomain = declaredDomain;\n this.receivedDomain = receivedDomain;\n }\n}\n\n/**\n * A JSON document that is not a well-formed restricted-JSON input. Raised at\n * ingestion, before validation or hashing, so a duplicate member name can never\n * reach a validator that would silently keep the last one.\n */\nexport type JsonIngestReason =\n | 'syntax'\n | 'trailing_content'\n | 'nesting'\n | 'integer'\n | 'negative_zero'\n | 'unsafe_integer'\n | 'unterminated_string'\n | 'unpaired_surrogate'\n | 'control_character'\n | 'unicode_escape'\n | 'invalid_escape'\n | 'duplicate_member';\n\nexport class JsonIngestError extends Error {\n readonly offset: number;\n readonly path: string;\n readonly reason: JsonIngestReason;\n\n constructor(message: string, offset: number, path = '', reason: JsonIngestReason = 'syntax') {\n super(path === '' ? `${message} at offset ${offset}` : `${message} at ${path}`);\n this.name = 'JsonIngestError';\n this.offset = offset;\n this.path = path;\n this.reason = reason;\n }\n}\n\n/**\n * Proves a union is exhausted. A new variant reaching this function is a type error at\n * the call site, so a switch over a closed union cannot silently fall through — the\n * failure mode that would otherwise drop a message node or fold an outcome as `PASS`.\n *\n * The refusal names the variant tag or the value type, never the value: the file's own\n * rule above keeps a submitted value out of a refusal, and a defect report is no\n * exception.\n */\nexport function assertNever(value: never): never {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `internal error: the engine reached a case it cannot handle for ${variantTag(value)}; report the artifact and the rule that produced it`,\n );\n}\n\n/** The tag an unreachable variant carries, or its type when it carries none. */\nfunction variantTag(value: unknown): string {\n if (typeof value === 'object' && value !== null) {\n const kind: unknown = Reflect.get(value, 'kind');\n if (typeof kind === 'string') {\n return `kind ${kind}`;\n }\n return 'an untagged object';\n }\n return `type ${typeof value}`;\n}\n"]}