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

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 +1207 -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 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/model/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA2CH,yFAAyF;AACzF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,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GAQG;AACH,MAAM,8BAA8B,GAAG;IACrC,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;CACmC,CAAC;AAEnD,+DAA+D;AAC/D,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;AAC3F,CAAC;AAED,6FAA6F;AAC7F,MAAM,CAAC,MAAM,yBAAyB,GAA+B,MAAM,CAAC,IAAI,CAC9E,8BAA8B,CAC/B,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAE5B,oFAAoF;AACpF,MAAM,CAAC,MAAM,4BAA4B,GAAiC,IAAI,GAAG,CAC/E,yBAAyB,CAC1B,CAAC","sourcesContent":["/**\n * Axiom's shared wire contracts.\n *\n * Everything here is the runtime's public vocabulary for a compiled artifact: the\n * closed expression AST, the schema and rule shapes a compiler emits, the outcome\n * lattice, and the frozen sentinels for a value the runtime could not determine.\n * Shapes follow `spec/metaschema/schema.v1.json`; meaning follows\n * `spec/semantics/*-v1.md`.\n */\n\nimport type { CompositionReport } from './composition.js';\n\n/** A JSON object holding only canonical wire values. */\nexport interface WireRecord {\n readonly [fieldId: string]: WireValue;\n}\n\n/** A money amount in minor units, per `spec/semantics/model-v1.md`. */\nexport interface MoneyValue {\n readonly minor: string;\n readonly currency: string;\n readonly scale: number;\n}\n\n/**\n * A measured quantity, `spec/semantics/model-v1.md` `MODEL-2.1.21`.\n *\n * `value` is canonical decimal text at the declaration's scale and `unit` is one of the unit\n * codes the field declares. Carrying the unit in the value is what makes a mixed-unit sum a\n * refusal rather than a silent conversion: v1 defines no unit conversion.\n */\nexport interface QuantityValue {\n readonly value: string;\n readonly unit: string;\n}\n\n/**\n * A bookable slot, `spec/semantics/model-v1.md`.\n *\n * `start` and `end` are UTC instants and `localDate` is the service-local civil date of\n * `start`. Axiom carries no timezone database, so `localDate` is a host commitment it cannot\n * verify; `start < end` it does verify. `slotId` is the option identity, so two resources may\n * share one range.\n */\nexport interface TimeslotValue {\n readonly slotId: string;\n readonly localDate: string;\n readonly start: string;\n readonly end: string;\n}\n\n/** The three units a duration may state, `spec/semantics/model-v1.md` `MODEL-2.1.24`. */\nexport const DURATION_UNITS = ['minutes', 'hours', 'seconds'] as const;\nexport type DurationUnit = (typeof DURATION_UNITS)[number];\n\n/** Whether an untrusted value names a duration unit. */\nexport function isDurationUnit(value: unknown): value is DurationUnit {\n return typeof value === 'string' && (DURATION_UNITS as readonly string[]).includes(value);\n}\n\n/**\n * A length of time, `spec/semantics/model-v1.md` `MODEL-2.1.24`.\n *\n * `amount` is a whole number of units and `unit` travels with it, so a mixed-unit sum is a refusal\n * rather than a silent conversion. v1 defines no unit conversion between minutes, hours and\n * seconds; `duration_minutes` and `duration_seconds` are the explicit conversions.\n */\nexport interface DurationValue {\n readonly amount: number;\n readonly unit: DurationUnit;\n}\n\n/**\n * A postal address, `spec/semantics/model-v1.md` `MODEL-2.1.25`.\n *\n * Structural only: the required members are non-empty, `country` is an upper-case ISO alpha-2\n * code, and no other member is admitted. Axiom validates no world postal format.\n */\nexport interface AddressValue {\n readonly line1: string;\n readonly line2?: string;\n readonly city: string;\n readonly region?: string;\n readonly postalCode: string;\n readonly country: string;\n}\n\n/**\n * A geographic position, `spec/semantics/model-v1.md` `MODEL-2.1.26`.\n *\n * Latitude and longitude are canonical decimal text so no JSON float enters a canonical hash;\n * `accuracy` is the optional radius in metres. v1 offers no distance and no geocoding.\n */\nexport interface CoordinateValue {\n readonly latitude: string;\n readonly longitude: string;\n readonly accuracy?: string;\n}\n\n/**\n * A canonical wire value. Floats, `NaN`, `Infinity`, `BigInt` and boxed primitives\n * are not part of this union: a value outside it is invalid input, never coerced.\n */\nexport type WireValue =\n | string\n | boolean\n | number\n | null\n | MoneyValue\n | QuantityValue\n | DurationValue\n | AddressValue\n | CoordinateValue\n | TimeslotValue\n | readonly WireValue[]\n | WireRecord;\n\n/**\n * A dataset scalar, `spec/metaschema/dataset.v1.json` `$defs/scalar`.\n *\n * A table's values, key columns and every provenance key are drawn from this union, which\n * is narrower than `WireValue`: no `null`, no record and no list is a member, a column value\n * or a query key. The report's contract states the same union, so a key\n * vector typed this way cannot produce an entry the published metaschema refuses.\n */\nexport type ScalarWireValue = string | boolean | number | MoneyValue | QuantityValue;\n\ndeclare const decimalStringBrand: unique symbol;\n\n/**\n * Canonical decimal text, as `spec/semantics/expr-v1.md` defines it:\n * no exponent, no leading zeros, no trailing fractional zeros and never `-0`.\n * Branding keeps a plain string from being passed where a normalised decimal is\n * required; `asDecimalString` is the only constructor.\n */\nexport type DecimalString = string & { readonly [decimalStringBrand]: 'DecimalString' };\n\n/** Canonical decimal text, as `asDecimalString` accepts it. */\nexport const DECIMAL_TEXT_PATTERN: RegExp = /^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*[1-9])?$/;\n\n/**\n * Canonical integer text, `spec/semantics/model-v1.md` `MODEL-2.1.5` and\n * `spec/semantics/expr-v1.md` `EXPR-7.2.9`: an optional `-`, then `0` or a non-zero digit\n * followed by digits. A leading `+`, a leading zero and `-0` are outside it, and `-0` is refused\n * by the pattern itself rather than by a second test beside it, so one authority decides what an\n * integer spelling is.\n */\nexport const INTEGER_TEXT_PATTERN: RegExp = /^(?:0|-?[1-9][0-9]*)$/;\n\n/** A civil date, `spec/semantics/model-v1.md`. */\nexport const PLAIN_DATE_PATTERN: RegExp = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/**\n * The single canonical spelling of a fixed-millisecond UTC instant.\n *\n * The pattern bounds the field widths and ranges that are expressible as a pattern;\n * `parseInstant` also refuses an impossible civil date or clock time.\n */\nexport const INSTANT_PATTERN: RegExp =\n /^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}Z$/;\n\n/** An ISO 4217-shaped currency code: three upper-case ASCII letters. */\nexport const CURRENCY_CODE_PATTERN: RegExp = /^[A-Z]{3}$/;\n\n/** An ISO 3166-1 alpha-2 country code as the address primitive states it, `MODEL-2.1.25`. */\nexport const COUNTRY_CODE_PATTERN: RegExp = /^[A-Z]{2}$/;\n\n/** A stable opaque identifier, `schema.v1.json` `identifier`. */\nexport const IDENTIFIER_PATTERN: RegExp = /^[a-z][a-z0-9_]{0,63}$/;\n\n/** A host-owned upper-case vocabulary code, `schema.v1.json` `code`. */\nexport const CODE_PATTERN: RegExp = /^[A-Z][A-Z0-9_]{1,63}$/;\n\n/** Lower-case hexadecimal SHA-256. */\nexport const SHA256_HEX_PATTERN: RegExp = /^[0-9a-f]{64}$/;\n\n/** A media type, `schema.v1.json` `mediaRef.mime`. */\nexport const MIME_TYPE_PATTERN: RegExp = /^[a-z]+\\/[a-z0-9.+-]+$/;\n\n/** A lower-case unit code, `schema.v1.json` `unitCode`, `MODEL-2.1.21`. */\nexport const UNIT_CODE_PATTERN: RegExp = /^[a-z][a-z0-9_]{0,15}$/;\n\n/** The admitted ceiling on a `rowsFrom` expected count, `MODEL-2.1.22`. */\nexport const ROW_COUNT_CEILING = 1000;\n\n/**\n * The undetermined values. They are frozen singleton objects, never strings and\n * never `null`, so identity is the only test that admits them:\n * `spec/semantics/expr-v1.md`.\n */\nexport type Undetermined =\n | { readonly undetermined: 'UNKNOWN' }\n | { readonly undetermined: 'DEFERRED' };\n\n/** A required local reading is missing or unreadable. */\nexport const UNKNOWN: Undetermined = Object.freeze({ undetermined: 'UNKNOWN' });\n\n/** The value is computed elsewhere: redacted input or a server-tier rule. */\nexport const DEFERRED: Undetermined = Object.freeze({ undetermined: 'DEFERRED' });\n\n/**\n * One row's members a writer could not produce, with the sentinel a read of each states.\n *\n * The row's wire value cannot carry an undetermined member, and the sentinel differs per row —\n * `UNKNOWN` for a local miss, `DEFERRED` for a value computed elsewhere. Keeping the member path\n * only would collapse both to one answer, so the sideband carries the pair. It is aligned with\n * the array's elements, the same way `withheldRows` names the members access removed.\n */\nexport type UndeterminedRows = readonly (readonly (readonly [string, Undetermined])[])[];\n\n/** Admits exactly the two frozen sentinels, so a lookalike object is never undetermined. */\nexport function isUndetermined(value: unknown): value is Undetermined {\n return value === UNKNOWN || value === DEFERRED;\n}\n\n/**\n * One computed field's value in an evaluation's overlay: the writer's semantic result, or the\n * sentinel that says why the writer could not produce one.\n *\n * `null` is a decided value — the empty value of every domain — so it is not a third state.\n * The union keeps \"the value is null\" and \"the value is undetermined\" apart, which is what\n * lets a reader propagate `UNKNOWN`/`DEFERRED` instead of handing a consumer a plausible\n * empty value.\n */\nexport type ComputedValue =\n | {\n readonly kind: 'decided';\n readonly value: WireValue;\n /** Access sideband the stripped wire value cannot carry through a later binder. */\n readonly withheldMembers?: readonly string[];\n readonly withheldRows?: readonly (readonly string[])[];\n /** The members a writer could not produce, per row, with the sentinel each read states. */\n readonly undeterminedRows?: UndeterminedRows;\n }\n | { readonly kind: 'undetermined'; readonly sentinel: Undetermined };\n\n/** The result lattice, `spec/semantics/expr-v1.md`. */\nexport type Outcome = 'PASS' | 'FAIL' | 'UNKNOWN' | 'DEFERRED';\n\n/** Rule severity, `spec/semantics/rules-v1.md`. */\nexport type Severity = 'block' | 'warn' | 'info';\n\n/**\n * Every rule kind, `spec/semantics/rules-v1.md`.\n *\n * The tuple is the vocabulary's one authority: `RuleKind` derives from it and every reader —\n * `isRuleKind`, the `no_blocking` checks in the runtime and the compiler, the compiled rule\n * walk — reads this list rather than spelling the eight names again. A kind added here is one\n * edit, and the exhaustive switches over `RuleKind` fail typecheck until they account for it.\n */\nexport const RULE_KINDS = [\n 'validate',\n 'visible',\n 'required',\n 'enabled',\n 'compute',\n 'defaultCompute',\n 'gate',\n 'screen',\n] as const;\n\n/** Rule kinds, `spec/semantics/rules-v1.md`. */\nexport type RuleKind = (typeof RULE_KINDS)[number];\n\n/** Rule scopes, `spec/semantics/rules-v1.md`. */\nexport type RuleScope = 'field' | 'record' | 'array' | 'item';\n\n/**\n * The tiers a rule, an artifact and an evaluation may name, `spec/semantics/rules-v1.md`.\n *\n * One vocabulary: a compiled rule's `evaluateOn`, an artifact's target, an evaluation's\n * environment and a publish report's environment are all a `Tier`. Every boundary that reads a\n * tier from untrusted input — the request reader, the CLI's `--target`, the CSV cell and the\n * scenario document — checks it against this tuple rather than restating the pair.\n */\nexport const TIERS = ['server', 'client'] as const;\n\n/** The tier a rule is evaluated on, an artifact is built for or a run judges under. */\nexport type Tier = (typeof TIERS)[number];\n\n/**\n * The tier the local evaluation door runs as when the caller names none.\n *\n * Evaluation holds no server authority, so an omitted tier is the device: a server-tier rule\n * reports `DEFERRED` with `DEFERRED_SERVER_CHECK` rather than being run by a host that never\n * asked to hold that authority. The diagnostic is the signal — a server host that means to\n * decide those rules states `tier: 'server'` explicitly.\n */\nexport const DEFAULT_EVALUATION_TIER: Tier = 'client';\n\n/**\n * The tier the evidence doors run as when the caller names none.\n *\n * Compilation picks the artifact's target; the vector and scenario readers, the suite runner and\n * publish readiness execute the evidence the artifact declares. That evidence is server-tier\n * unless the target says otherwise (`RULES-3.1.2`). This is not the local evaluation default: the two doors answer two\n * questions, so the two constants have two names.\n */\nexport const DEFAULT_EVIDENCE_TIER: Tier = 'server';\n\n/** Whether an untrusted value names a tier, so a boundary can refuse one that does not. */\nexport function isTier(value: unknown): value is Tier {\n return typeof value === 'string' && TIERS.some((tier) => tier === value);\n}\n\n/** Field access states, `spec/semantics/access-v1.md`. */\nexport type FieldAccess = 'read_write' | 'read_only' | 'write_only' | 'masked' | 'hidden';\n\n/** The seventeen wire primitives, `spec/semantics/model-v1.md` section 2. */\nexport type Primitive =\n | 'string'\n | 'boolean'\n | 'integer'\n | 'decimal'\n | 'money'\n | 'date'\n | 'instant'\n | 'time'\n | 'media_ref'\n | 'signature_ref'\n | 'timeslot'\n | 'quantity'\n | 'duration'\n | 'address'\n | 'coordinate'\n | 'record'\n | 'array';\n\n/**\n * The primitives one item of a scalar or attachment array may hold,\n * `spec/semantics/model-v1.md`. A record or a list is declared through\n * `fields`, never through `items`, and `timeslot` is one field's value rather than a list\n * element: its identity is the option it names, which a bare element would not carry.\n *\n * The tuple is the registry: the union is its key set, and every reader, palette and guard\n * derives from it, so a primitive this contract gains has one place to be added.\n */\nexport const ITEM_PRIMITIVES = [\n 'string',\n 'integer',\n 'decimal',\n 'money',\n 'date',\n 'media_ref',\n 'quantity',\n 'duration',\n] as const;\nexport type ItemPrimitive = (typeof ITEM_PRIMITIVES)[number];\n\n/** Whether untrusted text names an item primitive. */\nexport function isItemPrimitive(value: unknown): value is ItemPrimitive {\n return typeof value === 'string' && ITEM_PRIMITIVES.some((primitive) => primitive === value);\n}\n\n/** The item declaration of a scalar or attachment array, `schema.v1.json` `itemDeclaration`. */\nexport interface FieldItem {\n readonly primitive: ItemPrimitive;\n /**\n * The declared money domain of a `money` item, `spec/semantics/model-v1.md` `MODEL-2.1.15`.\n * `currency` and `scale` are present together on a money item and absent on every other\n * primitive, so a reader never has to guess how to parse or format the item.\n */\n readonly currency?: string;\n readonly scale?: number;\n /**\n * The declared unit domain of a `quantity` item, `MODEL-2.1.21`: a non-empty, duplicate-free,\n * ordered list of lower-case unit codes. Present on a quantity item and absent otherwise.\n */\n readonly units?: readonly string[];\n /**\n * The declared unit of a `duration` item, `MODEL-2.1.24`. Present on a duration item and\n * absent otherwise; the value's `unit` must name it.\n */\n readonly unit?: DurationUnit;\n}\n\n/**\n * Every control hint the language defines, `spec/semantics/model-v1.md`.\n *\n * A hint names a semantic affordance and never a UI component. Which hints a primitive admits\n * is the compiler's single control matrix, `CONTROLS_BY_PRIMITIVE`; this union is the closed\n * vocabulary the wire contract enumerates.\n *\n * The vocabulary is stated here rather than derived from that matrix because the dependency\n * runs compiler -> runtime: the runtime may not import the compiler, so the wire contract owns\n * the names and the matrix owns the pairing. `artifact-alignment.test.ts` pins the two\n * together — every control the union names is paired with some primitive, and the matrix\n * invents none — so a control added on either side fails the other.\n */\nexport const CONTROLS = [\n 'text',\n 'textarea',\n 'email',\n 'phone',\n 'url',\n 'password',\n 'select',\n 'radio',\n 'checkbox',\n 'combobox',\n 'switch',\n 'integer',\n 'decimal',\n 'money',\n 'quantity',\n 'duration',\n 'date',\n 'datetime',\n 'time',\n 'slider',\n 'media_capture',\n 'signature_capture',\n 'multiselect',\n 'rank',\n 'tags',\n 'rating',\n 'likert',\n 'percentage',\n 'timeslot',\n 'address',\n 'map',\n] as const;\nexport type Control = (typeof CONTROLS)[number];\n\n/** One declared option code and its localized label, `schema.v1.json` `option`. */\nexport interface FieldOption {\n /** A string code, or a safe integer for an ordinal scale such as a star rating. */\n readonly code: string | number;\n readonly labelKey: string;\n readonly deprecated?: boolean;\n /**\n * The condition under which this option may be chosen, `RULES-7.1.1`.\n *\n * Present only on an option the document declares: a host-loaded domain answers availability\n * itself, so no declaration exists for the compiler to evaluate. An absent member means the\n * option is always available.\n */\n readonly availableWhen?: ExprNode;\n /** The message key of the sentence an unavailable option states, `RULES-7.1.1`. */\n readonly unavailableMessageKey?: string;\n /** The message arguments of `unavailableMessageKey`, each evaluated against the record. */\n readonly unavailableParams?: Readonly<Record<string, ExprNode>>;\n /** The alternatives offered while this option's held code is unavailable, `RULES-7.1.4`. */\n readonly suggests?: readonly CompiledSuggestion[];\n}\n\n/**\n * A row address inside a suggestion, `schema.v1.json` `suggestedRef` and `suggestionOperation`.\n *\n * The reserved spelling `current` stands for the row an item-scoped rule judged, which the engine\n * resolves before it looks a row up. It is not a separate type: a natural key is the record's own\n * text, so a key spelled `current` is the same bytes the symbol is, and the contract states the\n * reserved spelling rather than inventing a second wire form for one word. A report states the key\n * the engine resolved, never the symbol (`RULES-6.1.2`).\n */\nexport type SuggestedRowKey = string | number;\n\n/**\n * The binding one suggestion operation writes, `schema.v1.json` `suggestedRef`.\n *\n * `current` stands for the row an item-scoped rule judged. The engine resolves it to the row's\n * key at evaluation, so the compiled artifact names the row relationally and the report states\n * the key it resolved to.\n */\nexport interface SuggestedRef {\n readonly fieldId: string;\n readonly rowKey?: SuggestedRowKey;\n}\n\n/**\n * One write a suggestion performs, `schema.v1.json` `suggestionOperation`.\n *\n * A compiled operation names an expression; the evaluated form a report carries is\n * `SuggestedOperation`, whose values are the wire values those expressions produced.\n */\nexport type CompiledSuggestionOperation =\n | { readonly kind: 'value'; readonly ref: SuggestedRef; readonly value: ExprNode }\n | { readonly kind: 'null'; readonly ref: SuggestedRef }\n | { readonly kind: 'remove'; readonly ref: SuggestedRef }\n | {\n readonly kind: 'append';\n readonly fieldId: string;\n readonly row: Readonly<Record<string, ExprNode>>;\n }\n | {\n readonly kind: 'removeRow';\n readonly fieldId: string;\n readonly rowKey: SuggestedRowKey;\n };\n\n/** One alternative a rule or an option declares, `schema.v1.json` `suggestion`. */\nexport interface CompiledSuggestion {\n readonly labelKey: string;\n readonly operations: readonly CompiledSuggestionOperation[];\n}\n\n/**\n * Where a field's option domain comes from when the document does not declare it,\n * `schema.v1.json` `optionSource`.\n *\n * `host` names a loader the host resolves for `sourceId` (optionally keyed by the values of\n * `dependsOn`); `field` derives the domain from another field's scalar array, which is what\n * makes \"enter three things, then rank them\" configuration rather than code.\n */\nexport type OptionSource =\n | { readonly kind: 'host'; readonly sourceId: string; readonly dependsOn?: readonly string[] }\n | { readonly kind: 'field'; readonly fieldId: string };\n\n/**\n * The comparison operators: infix only and non-associative.\n *\n * The tuple is the single source. The union is derived from it, so a name cannot exist in\n * the type without existing at runtime, and `EXPR_OPERATORS` below cannot drift from it.\n */\nexport const COMPARISON_OPERATORS = ['==', '!=', '<', '<=', '>', '>=', 'in'] as const;\nexport type ComparisonOperator = (typeof COMPARISON_OPERATORS)[number];\n\n/**\n * The arithmetic operators written infix in source.\n *\n * `/` is a canonical operator rather than an alias: it has its own semantics (numeric division\n * at 34 significant digits, and the money ratio) and its own refusals, so it is not parse-time\n * sugar for another node.\n */\nexport const ARITHMETIC_OPERATORS = ['+', '-', '*', '/', '%', '//'] as const;\nexport type ArithmeticOperator = (typeof ARITHMETIC_OPERATORS)[number];\n\n/** The callable built-ins. `in` is infix-only, so it is not one. */\nexport const BUILTIN_OPERATORS = [\n 'len',\n 'lower',\n 'upper',\n 'trim',\n 'starts_with',\n 'ends_with',\n 'contains',\n 'between',\n 'ascii_match',\n 'is_email',\n 'is_phone',\n 'is_url',\n 'is_unique',\n 'all',\n 'any',\n 'present',\n 'absent',\n 'empty',\n 'is_relevant',\n 'sum',\n 'count_where',\n 'count_distinct',\n 'min',\n 'max',\n 'to_decimal',\n 'to_string',\n 'parse_integer',\n 'parse_decimal',\n 'round',\n 'round_up',\n 'round_down',\n 'round_even',\n 'pow',\n 'money_minor',\n 'money_from_minor',\n 'money_currency',\n 'money_scale',\n 'add_days',\n 'add_months',\n 'add_minutes',\n 'days_between',\n 'months_between',\n 'minutes_between',\n 'duration_minutes',\n 'duration_seconds',\n 'in_set',\n 'lookup',\n 'decide_keys',\n 'digest',\n 'member',\n 'keys',\n 'values',\n 'has_cap',\n 'rule_ok',\n 'no_blocking',\n 'rule_ok_in',\n 'no_blocking_in',\n 'required_in',\n 'abs',\n 'ceil',\n 'floor',\n 'avg',\n 'median',\n 'first',\n 'last',\n 'replace',\n 'split',\n 'join',\n 'substring',\n 'index_of',\n 'add_years',\n 'start_of_day',\n 'civil_date',\n 'matches',\n 'map',\n 'filter',\n 'mode',\n 'concat',\n 'year',\n 'month',\n 'day',\n 'weekday',\n 'parse_date',\n 'parse_instant',\n 'sort',\n 'slice',\n 'distinct',\n 'reverse',\n] as const;\nexport type BuiltinOperator = (typeof BUILTIN_OPERATORS)[number];\n\n/**\n * The built-ins that name a table. Their first operand is an identifier\n * rather than a read, so every consumer that walks an expression asks this one set instead\n * of spelling the names again: the check that the table is declared, the typing rule, and\n * the dependency graph all start their operand walk at the second argument.\n */\nexport const DATASET_BUILTINS: ReadonlySet<string> = new Set(['in_set', 'lookup', 'decide_keys']);\n\n/** Every operator name a `call` node may carry, `schema.v1.json` `callOperator`. */\nexport type CallOperator = ArithmeticOperator | BuiltinOperator;\n\n/** Every operator name the closed language defines. */\nexport type ExprOperator = ComparisonOperator | CallOperator;\n\n/**\n * The closed operator set of `spec/semantics/expr-v1.md`, assembled from\n * the three families so a name added to one cannot be missing here.\n */\nexport const EXPR_OPERATORS: readonly ExprOperator[] = [\n ...COMPARISON_OPERATORS,\n ...ARITHMETIC_OPERATORS,\n ...BUILTIN_OPERATORS,\n];\n\n/**\n * The static domain of a literal: the value's domain is declared by the\n * compiler rather than guessed from the text, so the string `\"1.5\"` and the decimal\n * `1.5` are two literals of different domains, and `date`/`instant`/`money` literals\n * carry their domain explicitly.\n */\nexport type LiteralDomain = Primitive | 'null';\n\nexport interface LiteralNode {\n readonly kind: 'literal';\n readonly domain: LiteralDomain;\n readonly value: WireValue;\n}\n\nexport interface PathNode {\n readonly kind: 'path';\n /** Dot-separated path, keeping the `$` sigil of an implicit binder. */\n readonly path: string;\n}\n\nexport interface ListNode {\n readonly kind: 'list';\n readonly items: readonly ExprNode[];\n}\n\nexport interface AndNode {\n readonly kind: 'and';\n readonly args: readonly ExprNode[];\n}\n\nexport interface OrNode {\n readonly kind: 'or';\n readonly args: readonly ExprNode[];\n}\n\nexport interface NotNode {\n readonly kind: 'not';\n readonly args: readonly [ExprNode];\n}\n\nexport interface CompareNode {\n readonly kind: 'compare';\n readonly op: ComparisonOperator;\n readonly args: readonly [ExprNode, ExprNode];\n}\n\nexport interface IfNode {\n readonly kind: 'if';\n readonly args: readonly [ExprNode, ExprNode, ExprNode];\n}\n\nexport interface CoalesceNode {\n readonly kind: 'coalesce';\n readonly args: readonly ExprNode[];\n}\n\nexport interface CallNode {\n readonly kind: 'call';\n readonly op: CallOperator;\n readonly args: readonly ExprNode[];\n}\n\nexport interface ComprehensionBinder {\n readonly name: string;\n}\n\nexport interface ComprehensionNode {\n readonly kind: 'comprehension';\n readonly binder: ComprehensionBinder;\n readonly source: ExprNode;\n readonly valueExpr?: ExprNode;\n readonly predicate?: ExprNode;\n}\n\n/** A node of the closed compiled AST, `spec/metaschema/schema.v1.json` `exprNode`. */\nexport type ExprNode =\n | LiteralNode\n | PathNode\n | ListNode\n | AndNode\n | OrNode\n | NotNode\n | CompareNode\n | IfNode\n | CoalesceNode\n | CallNode\n | ComprehensionNode;\n\n/** A declared context root, `spec/semantics/context-v1.md`. */\nexport interface ContextRoot {\n readonly path: string;\n readonly primitive: Primitive;\n readonly nullability?: 'required' | 'optional';\n /**\n * The declared money domain, present on a `money` root and absent otherwise. A root is the one\n * channel where the artifact declares a host-supplied fact, so the same domain a field states\n * travels here (`CTX-3.1.6`): a value outside it is refused at the boundary rather than read.\n */\n readonly currency?: string;\n readonly scale?: number;\n /**\n * The declared unit domain of a `quantity` root, `MODEL-2.1.21`. `units` is required on a\n * quantity root, exactly as it is on a quantity field, so a mixed unit cannot be read; `scale`\n * is the largest number of fractional digits the value may carry.\n */\n readonly units?: readonly string[];\n /** The declared unit of a `duration` root, `MODEL-2.1.24`; absent means `minutes`. */\n readonly unit?: string;\n /** A scalar or attachment array root declares its item domain, as a field does. */\n readonly items?: FieldItem;\n}\n\n/**\n * The context roots every schema may read without declaring them.\n *\n * Their values come from the evaluation environment rather than from the record: the record\n * date is the host's and the schema version is the artifact's own. A schema\n * that declares one of these names is refused at the document boundary, so the two channels\n * cannot disagree about what `context.record_date` means.\n */\nexport type ReservedContextRoot = 'record_date' | 'schema_version';\n\nexport const RESERVED_CONTEXT_ROOTS: readonly {\n readonly path: ReservedContextRoot;\n readonly primitive: Primitive;\n}[] = [\n { path: 'record_date', primitive: 'date' },\n { path: 'schema_version', primitive: 'integer' },\n];\n\n/** Whether a root path (without the `context.` prefix) names a reserved root. */\nexport function isReservedContextRoot(path: string): path is ReservedContextRoot {\n return RESERVED_CONTEXT_ROOTS.some((root) => root.path === path);\n}\n\n/**\n * What a hidden field's captured value does in the submission projection,\n * `spec/semantics/rules-v1.md`: `preserve` keeps it and `exclude` drops\n * it. Hiding never destroys a value in a live draft either way.\n */\nexport type OnHidePolicy = 'preserve' | 'exclude';\n\n/** A declared field, `spec/metaschema/schema.v1.json` `field`. */\nexport interface CompiledField {\n readonly fieldId: string;\n readonly primitive: Primitive;\n readonly control?: Control;\n /**\n * The declared money domain, `spec/semantics/model-v1.md` `MODEL-2.1.15`. Present together\n * on a `money` field and absent on every other primitive. It is the parse/validate authority\n * the renderer and the wire reader read, so an artifact that dropped it would force every\n * host to configure a money format per field.\n */\n readonly currency?: string;\n readonly scale?: number;\n /**\n * The declared unit domain of a `quantity` field, `MODEL-2.1.21`. Present on a quantity field\n * and absent otherwise. `scale` states the largest number of fractional digits a captured\n * `value` may carry; it defaults to `0`, the integer quantity.\n */\n readonly units?: readonly string[];\n /**\n * The declared unit of a `duration` field, `MODEL-2.1.24`. Present on a duration field and\n * absent otherwise; it defaults to `minutes`, and every captured value must name it.\n */\n readonly unit?: DurationUnit;\n readonly labelKey?: string;\n /** The message key a renderer shows as the field's help text. */\n readonly descriptionKey?: string;\n /** The message key a renderer shows as the field's empty-input placeholder. */\n readonly placeholderKey?: string;\n /** The declared option domain, closed and with unique codes. */\n readonly options?: readonly FieldOption[];\n /** The host or cross-field domain a field without `options` takes instead. */\n readonly optionSource?: OptionSource;\n /** The item declaration of a scalar or attachment array. */\n readonly items?: FieldItem;\n readonly fields?: readonly CompiledField[];\n readonly rowKey?: { readonly mode: 'natural' | 'assigned'; readonly fieldId?: string };\n /**\n * The smallest and largest number of entries this array may hold, `MODEL-2.1.17`.\n *\n * They are declarations rather than rules because a count is a fact about the shape: a\n * `validate` over a length is undecided when the list is absent, and an undecided rule does\n * not block, so the empty form would submit. The runtime folds the count into readiness as a\n * decided fact, with an absent array counting as zero entries.\n */\n readonly minItems?: number;\n readonly maxItems?: number;\n /**\n * The largest number of fractional digits a `decimal` value may carry, `MODEL-2.1.27`.\n *\n * The bound counts the fractional digits the canonical decimal text carries, so `1.25` has\n * scale 2 and `1.5` has scale 1. It is a declaration rather than a rule for the reason\n * `minItems` is: a `validate` over fractional digits is undecided when the value is absent,\n * and an undecided rule does not block, so the empty form would submit. The runtime folds the\n * scale into readiness as a decided fact, and a value above it is a blocker naming the field,\n * the bound and the value.\n */\n readonly maxScale?: number;\n /**\n * The sentence a value above `maxScale` states, `MODEL-2.1.27`. Present with `maxScale`: the\n * fact is not a rule, so the artifact carries the message the blocker names rather than\n * leaving the host to invent one.\n */\n readonly maxScaleMessageKey?: string;\n /**\n * The Expr v1 integer expression whose value is this array's expected row count,\n * `spec/semantics/model-v1.md` `MODEL-2.1.22`. The compiled AST; `rowsFromSource` carries the\n * authored text a blocker names. A difference from the array's length is a decided blocker,\n * and the engine never creates or removes a row.\n */\n readonly rowsFrom?: ExprNode;\n /** The authored `rowsFrom` text the blocker states, when the field declares one. */\n readonly rowsFromSource?: string;\n /**\n * The media types a capture field admits, `MODEL-2.1.20`, in canonical lower-case spelling.\n *\n * Present on a `media_ref` field or on an array whose items are `media_ref`. A renderer\n * restricts its picker with the list, and the runtime folds a captured value that matches no\n * entry into readiness as a blocker. Absent means the declaration constrains no media type.\n */\n readonly accept?: readonly string[];\n /**\n * The smallest and largest `byteSize` a captured `media_ref` may carry, `MODEL-2.1.20`.\n *\n * They are declarations rather than rules for the reason `minItems` is: a size is a fact about\n * a captured value, and a `validate` rule cannot read a media value's intrinsic members under\n * this contract. A captured value outside the range is a decided blocker.\n */\n readonly minBytes?: number;\n readonly maxBytes?: number;\n /**\n * The inclusive bounds a number or temporal control presents, `MODEL-2.1.16`.\n *\n * These are presentation hints copied from the declaration, not the enforcement: a declared\n * bound still compiles to its `r_<fieldId>_minimum`/`r_<fieldId>_maximum` rule, and a renderer\n * paints the range without deciding anything. A `slider` requires both, so its range input has\n * a track; every other number or temporal control reads them only to set a native `min`/`max`.\n * A `decimal` bound is canonical decimal text; an integer bound is a safe integer.\n */\n readonly minimum?: number | string;\n readonly maximum?: number | string;\n /**\n * The increment a number control steps by, `MODEL-2.1.16`. A positive number of the field's\n * own kind: a safe integer on an `integer` field, canonical positive decimal text on a\n * `decimal` field. Absent means the control's own default. Presentation only, like the bounds.\n */\n readonly step?: number | string;\n readonly annotations?: Readonly<Record<string, WireValue>>;\n /** This declaration's own policy, absent when it follows the document's. */\n readonly onHide?: OnHidePolicy;\n /**\n * The `(fieldId)` targets a `signature_capture` field's signature binds, in the order the\n * signature declares them. The compiler refuses a list that names an undeclared field,\n * the declaring field itself or an ancestor container, an array item member, or a\n * different target list or version from the `digest(...)` that verifies the signature, so\n * the artifact's declared coverage and the binding it verifies are one fact.\n */\n readonly covers?: readonly string[];\n}\n\nexport interface GateItemDeclaration {\n readonly itemId: string;\n readonly expr: ExprNode;\n readonly messageKey: string;\n /** The message arguments this item binds; validated against its message. */\n readonly params?: Readonly<Record<string, ExprNode>>;\n}\n\n/**\n * What a non-hard gate does when a read-only diagnostic reaches it:\n * `defer` reports the diagnostic and lets the gate pass on this device, `warn` reports it\n * without blocking, and `block` fails the gate. A hard gate declares no policy because it\n * has no permissive setting.\n */\nexport type GatePolicy = 'defer' | 'warn' | 'block';\n\nexport interface RuleGate {\n readonly items: readonly GateItemDeclaration[];\n readonly hard: boolean;\n /**\n * The condition that turns the gate off, `spec/semantics/rules-v1.md` `[RULES-2.1.14]`.\n * Only a definite `FAIL` deactivates: an `UNKNOWN` or `DEFERRED` condition leaves the gate in\n * force, because a gate nobody could switch off is not one an author switched off.\n */\n readonly activeWhen?: ExprNode;\n /** Absent means `block`: silence must fail closed. */\n readonly onReadOnlyError?: GatePolicy;\n}\n\n/**\n * One reason a screen declares, `spec/semantics/rules-v1.md` `[RULES-2.1.3]`.\n *\n * The screen states the reason when `when` decides true, in declaration order. Its message is\n * bound by its own `params` block, so one reason's payload never borrows another's. An engine\n * cause is never declared here: the engine's reasons stay derived from the diagnostics it\n * recorded, so only the reasons a screen itself states are stored on the artifact.\n */\nexport interface ScreenReasonDeclaration {\n /** The stable problem code the reason states, an upper-case vocabulary code. */\n readonly code: string;\n readonly messageKey: string;\n readonly when: ExprNode;\n readonly params?: Readonly<Record<string, ExprNode>>;\n}\n\n/**\n * The members every compiled rule carries, `spec/metaschema/schema.v1.json` `rule`. A\n * member is optional here when only some kinds may state it; the per-kind interfaces\n * below make the members a kind cannot work without required, so an illegal rule is a\n * type error where a host or the compiler builds one rather than a throw at evaluation.\n */\ninterface CompiledRuleBase {\n readonly ruleId: string;\n readonly scope: RuleScope;\n readonly evaluateOn: Tier;\n readonly expr: ExprNode;\n /**\n * Author-facing documentation of why the rule exists, `schema.v1.json` `rule.note`.\n *\n * Never rendered, never translated and never a message key. It travels into the compiled\n * artifact so a shipped document stays self-describing, and it is presentation to the\n * behaviour identity (`RULES-5.1.2`), so annotating a rule moves neither `behaviorHash` nor\n * `reportHash`.\n */\n readonly note?: string;\n readonly severity?: Severity;\n readonly fieldId?: string;\n readonly messageKey?: string;\n readonly params?: Readonly<Record<string, ExprNode>>;\n readonly referWhen?: ExprNode;\n readonly overrideFieldId?: string;\n readonly gate?: RuleGate;\n readonly testCases?: readonly unknown[];\n /**\n * The fields a `visible` or `enabled` rule decides. Only those two kinds\n * may declare it; the list is duplicate-free and the compiler emits it in code-point\n * order so two documents that differ only in target order share one `ruleHash`.\n */\n readonly fieldIds?: readonly string[];\n /**\n * The member of the row an `item`-scope rule writes or constrains,\n * `spec/semantics/rules-v1.md` `RULES-1.1.11`. `fieldId` names the array; this names the\n * member inside one of its rows, so a per-row writer has a target the engine can address.\n * Optional on `validate`, where absent means the rule speaks about the whole row.\n */\n readonly targetFieldId?: string;\n /**\n * The alternatives this rule offers when it decides `FAIL`, `RULES-6.1.1`.\n *\n * Admitted on `kind: validate` only. They are evaluated only on `FAIL` and produce concrete\n * wire values, so the report carries data a host applies rather than source text; the engine\n * never applies one itself.\n */\n readonly suggests?: readonly CompiledSuggestion[];\n}\n\n/**\n * The fields a rule decides: the target list a `visible` or `enabled` rule\n * names, or the one field every other scoped rule is about. A rule naming several fields\n * declares `fieldIds` and is record-scoped, so the single-target spelling and the list never\n * describe one rule twice.\n */\nexport function ruleTargets(rule: CompiledRule): readonly string[] {\n if (rule.fieldIds !== undefined) return rule.fieldIds;\n return rule.fieldId === undefined ? [] : [rule.fieldId];\n}\n\n/** A validation rule must state the message key it raises. */\nexport interface ValidateRule extends CompiledRuleBase {\n readonly kind: 'validate';\n readonly messageKey: string;\n}\n\nexport interface VisibleRule extends CompiledRuleBase {\n readonly kind: 'visible';\n}\n\nexport interface RequiredRule extends CompiledRuleBase {\n readonly kind: 'required';\n}\n\nexport interface EnabledRule extends CompiledRuleBase {\n readonly kind: 'enabled';\n}\n\nexport interface ComputeRule extends CompiledRuleBase {\n readonly kind: 'compute';\n}\n\nexport interface DefaultComputeRule extends CompiledRuleBase {\n readonly kind: 'defaultCompute';\n}\n\n/** A gate rule must declare the items it always reports. */\nexport interface GateRule extends CompiledRuleBase {\n readonly kind: 'gate';\n readonly gate: RuleGate;\n}\n\nexport interface ScreenRule extends CompiledRuleBase {\n readonly kind: 'screen';\n readonly referWhen?: ExprNode;\n /** The reasons this screen itself states, in the order the report lists them. */\n readonly reasons?: readonly ScreenReasonDeclaration[];\n}\n\n/** A compiled rule, discriminated by its kind. */\nexport type CompiledRule =\n | ValidateRule\n | VisibleRule\n | RequiredRule\n | EnabledRule\n | ComputeRule\n | DefaultComputeRule\n | GateRule\n | ScreenRule;\n\n/** A compiled ICU MF1 subset node, `spec/metaschema/schema.v1.json` `messageNode`. */\nexport interface MessageContentNode {\n readonly kind: 'content';\n readonly value: string;\n}\n\nexport interface MessageArgumentNode {\n readonly kind: 'argument';\n readonly name: string;\n}\n\nexport interface MessageSelectNode {\n readonly kind: 'select';\n readonly name: string;\n readonly cases: Readonly<Record<string, readonly MessageNode[]>>;\n}\n\nexport interface MessagePluralNode {\n readonly kind: 'plural';\n readonly name: string;\n readonly offset: number;\n readonly cases: Readonly<Record<string, readonly MessageNode[]>>;\n}\n\nexport interface MessagePoundNode {\n readonly kind: 'pound';\n}\n\nexport type MessageNode =\n | MessageContentNode\n | MessageArgumentNode\n | MessageSelectNode\n | MessagePluralNode\n | MessagePoundNode;\n\n/** The compiled message form: data-only nodes beside the source text. */\nexport interface CompiledMessage {\n readonly source: string;\n readonly nodes: readonly MessageNode[];\n /**\n * The locale this entry was compiled for, which is the catalogue key it is filed under.\n *\n * A renderer needs it to select the plural branches of this text, and the key it reads the\n * entry from is not always passed on; carrying it removes the chance of rendering `pt` text\n * through `pt-PT` rules. Absent only on an AST a host assembled itself.\n */\n readonly locale?: string;\n}\n\n/**\n * One locale's entry in a message catalogue: the compiled AST a runtime interprets, or\n * the authored source text before an AST exists. A runtime never parses the latter, so\n * the two states cannot be confused at the seam.\n */\nexport type CompiledMessageEntry = string | CompiledMessage;\n\n/**\n * A field a rule, a report or an access projection refers to. `rowKey` is the natural\n * key's canonical wire value (a string or an integer) or the host-assigned id\n * so an integer natural key keeps its canonical form.\n */\nexport interface FieldRef {\n readonly fieldId: string;\n readonly rowKey?: string | number;\n}\n\n/** How a decimal is rounded when it must lose digits. */\nexport type RoundingMode = 'up' | 'down' | 'ceiling' | 'floor' | 'half_up' | 'half_even';\n\n/**\n * One field's effective access in a report.\n *\n * The report states the answer per declaration, never per row: a container read carries every\n * row it holds, so an entry that withholds one row already answers the container as hidden and\n * a row key would only restate part of that answer.\n */\nexport interface ReportAccessEntry {\n readonly fieldId: string;\n readonly access: FieldAccess;\n}\n\n/**\n * The declarations an expression is checked against. `fields` is the record the expression\n * may read; a standalone guard compiled without a form omits it, and a record read is then\n * a compile error.\n */\nexport interface ExpressionDeclarations {\n readonly fields?: readonly CompiledField[];\n readonly context?: { readonly roots: readonly ContextRoot[] };\n /** The tables the expression may name; a name absent here is refused. */\n readonly datasets?: readonly DatasetDeclaration[];\n /**\n * The schema version the expression was compiled against, where it was compiled against\n * one: `context.schema_version` reads it, and a standalone guard that names\n * no version reads the root as undetermined rather than inventing one.\n */\n readonly schemaVersion?: number;\n}\n\n/**\n * A standalone compiled expression: the closed AST plus the language\n * version and the declarations it was typed against. The declarations travel with the\n * artifact so a guard evaluates exactly the schema it was compiled for, with the same\n * stored-value validation and operand typing a rule expression receives.\n */\nexport interface CompiledExpression {\n readonly exprVersion: 1;\n readonly expr: ExprNode;\n readonly declarations: ExpressionDeclarations;\n}\n\n/**\n * The codes a report may carry, `spec/semantics/expr-v1.md`.\n *\n * The tuple is the single source: the union and the guard are derived from it, so the\n * compiler's reused code list and the runtime guard cannot disagree about the vocabulary.\n */\nexport const RUNTIME_DIAGNOSTIC_CODES = [\n 'UNDETERMINED',\n 'ENGINE_ERROR',\n 'STALE_DATA',\n 'ACCESS_DENIED',\n 'DEFERRED_SERVER_CHECK',\n 'REQUIRED_UNKNOWN',\n 'SIGNATURE_COVER_EXCLUDED',\n // A row-addressed question the array's identity cannot answer: two rows share one key, a\n // row states none, or the array's identity does not reconcile. It is its own code so a\n // duplicate is a cause a host can name, never an `ENGINE_ERROR` that says only that\n // evaluation stopped (`spec/semantics/identity-v1.md` `IDENT-2.1.9`).\n 'ROW_IDENTITY',\n // A host supplied a value that contradicts the declaration it is read into. The cause is the\n // host, not the form: the rule that read it stays `UNKNOWN` rather than inventing a verdict,\n // and the host logs the diagnostic. The path, declared domain, received domain and origin\n // travel in the diagnostic's params.\n 'LATE_BOUND_TYPE_MISMATCH',\n] as const;\n\nexport type RuntimeDiagnosticCode = (typeof RUNTIME_DIAGNOSTIC_CODES)[number];\n\n/** A compile problem code. */\nexport const COMPILE_DIAGNOSTIC_CODES = [\n 'EXPR_PARSE_ERROR',\n 'TYPE_MISMATCH',\n 'UNKNOWN_IDENTIFIER',\n 'MONEY_ARITHMETIC',\n 'PATTERN_UNSUPPORTED',\n 'COST_BUDGET_EXCEEDED',\n 'CYCLE_DETECTED',\n 'DUPLICATE_WRITER',\n 'TABLE_NOT_DECLARED',\n // A refusal: `rule_ok`, `no_blocking` or a step fold reads the gate fold outside the gate\n // rule that owns it, so the expression names state its evaluation context cannot supply\n // (`EXPR-15.1.7`, `EXPR-15.1.8`). Both the document door and `compileExpr` raise it.\n 'RULE_REFERENCE',\n // A warning, not a refusal: the compiler accepts the expression and returns the finding\n // beside the artifact (`EXPR-7.1.6`). The code lives in the compile vocabulary so the\n // generated catalogue and a host branch on the same name.\n 'DEPRECATED_BUILTIN',\n // A warning, not a refusal: an aggregate folds a list that may be empty, so the expression\n // is legal and silently decides nothing on an empty form (`EXPR-10.2.2`, `EXPR-18.1.2`).\n 'UNDECIDED_AGGREGATE',\n // A warning, not a refusal: `required: true` on an array asks only that a value is present,\n // and an empty list is a value, so the declaration admits `[]` where the author meant at\n // least one entry (`MODEL-2.1.17`). The code lives in the compile vocabulary so the\n // generated catalogue and a host branch on the same name.\n 'REQUIRED_ON_ARRAY',\n // A refusal: literal arithmetic overflows the integer domain, divides by a literal zero, or\n // states a `between` range whose low bound is above its high bound. The document can never\n // be right, so the compile refuses it (`EXPR-11.1.6`, `EXPR-11.1.10`, `EXPR-6.1.14`).\n 'INVALID_CONSTANT_EXPRESSION',\n // A warning, not a refusal: a comparison that is always true or always false from the\n // operand's declared range, or a `matches` over a literal empty pattern\n // (`EXPR-6.1.3`, `EXPR-14.1.13`). The document compiles and decides one way on every record.\n 'CONSTANT_COMPARISON',\n // A warning, not a refusal: a conjunction or disjunction whose literal bounds cannot both\n // hold, or a rule or gate item whose condition can never fire. The document compiles and\n // the condition decides nothing an author meant (`EXPR-6.1.3`).\n 'UNSATISFIABLE_CONDITION',\n // A warning, not a refusal: a disjunction repeats one of its own branches, so the branch\n // states nothing the first one did not.\n 'REDUNDANT_CONDITION',\n // A warning, not a refusal: a field is required but its `visibleWhen` can never hold, so the\n // requirement is addressed to a control the form never shows (`MODEL-2.1.18`).\n 'REQUIRED_NEVER_VISIBLE',\n] as const;\n\nexport type CompileDiagnosticCode = (typeof COMPILE_DIAGNOSTIC_CODES)[number];\n\n/** Every diagnostic code the language defines. */\nexport type DiagnosticCode = RuntimeDiagnosticCode | CompileDiagnosticCode;\n\n/**\n * A compile-time code reaching the runtime is a programmer error, so the guard separates the\n * two vocabularies instead of letting a report claim ``TYPE_MISMATCH`` at evaluation.\n */\nconst RUNTIME_DIAGNOSTIC_CODE_SET: ReadonlySet<string> = new Set(RUNTIME_DIAGNOSTIC_CODES);\n\nexport function isRuntimeDiagnosticCode(value: DiagnosticCode): value is RuntimeDiagnosticCode {\n return RUNTIME_DIAGNOSTIC_CODE_SET.has(value);\n}\n\n/* ------------------------------------------------------------------------------------ *\n * Supporting datasets, `spec/semantics/datasets-v1.md`.\n *\n * The table contract lives here rather than beside the store because a compiled\n * expression names the tables it reads (`ExpressionDeclarations.datasets`), the store\n * resolves them, and the evaluation report records what it resolved. One description of a\n * table keeps those three from drifting apart.\n * ------------------------------------------------------------------------------------ */\n\n/** A table's clock binding. */\nexport type TableBinding = 'behavior' | 'data';\n\n/** A table kind. */\nexport type TableKind = 'set' | 'lookup' | 'decision_table';\n\n/** The hit policy a keyed table resolves with. */\nexport type HitPolicy = 'UNIQUE' | 'FIRST' | 'COLLECT';\n\n/**\n * The primitives a dataset column may declare. Record and array columns\n * are invalid, so a column's domain is this narrower set rather than `Primitive`.\n */\nexport type ScalarPrimitive =\n | 'string'\n | 'boolean'\n | 'integer'\n | 'decimal'\n | 'money'\n | 'quantity'\n | 'date'\n | 'instant';\n\n/**\n * The dataset scalar primitives, `spec/metaschema/dataset.v1.json` `$defs/scalarPrimitive`.\n *\n * This table is the registry every surface derives from: the type above is its key set, the\n * compiler's CSV declaration reader and set-membership guard read the tuple built from it, and\n * the installer derives a column's wire declaration from the column itself. A primitive added to\n * the metaschema and not here fails the type: `satisfies Record<ScalarPrimitive, true>` makes a\n * missing member a compile error, and the object's own literal is the only list.\n */\nconst DATASET_SCALAR_PRIMITIVE_TABLE = {\n string: true,\n boolean: true,\n integer: true,\n decimal: true,\n money: true,\n quantity: true,\n date: true,\n instant: true,\n} as const satisfies Record<ScalarPrimitive, true>;\n\n/** Whether untrusted text names a dataset scalar primitive. */\nexport function isScalarPrimitive(value: unknown): value is ScalarPrimitive {\n return typeof value === 'string' && Object.hasOwn(DATASET_SCALAR_PRIMITIVE_TABLE, value);\n}\n\n/** The dataset scalar primitives in the order a refusal lists them: the metaschema's own. */\nexport const DATASET_SCALAR_PRIMITIVES: readonly ScalarPrimitive[] = Object.keys(\n DATASET_SCALAR_PRIMITIVE_TABLE,\n).filter(isScalarPrimitive);\n\n/** The same registry as a membership test, for a guard that asks once per value. */\nexport const DATASET_SCALAR_PRIMITIVE_SET: ReadonlySet<ScalarPrimitive> = new Set(\n DATASET_SCALAR_PRIMITIVES,\n);\n\n/** A declared column and its role. */\nexport interface DatasetColumn {\n readonly columnId: string;\n /** A key or output member is named by `columnId`, so it follows the identifier grammar. */\n readonly primitive: ScalarPrimitive;\n readonly role: 'key' | 'output';\n /**\n * The declared unit domain of a `quantity` column, `MODEL-2.1.21`. Present on a quantity\n * column and absent otherwise; a value whose `unit` is not a member is refused rather than\n * converted. A quantity column without it admits every unit code.\n */\n readonly units?: readonly string[];\n /**\n * The declared fractional scale of a `quantity` column, `MODEL-2.1.21`. Present on a\n * quantity column and absent otherwise; it defaults to `0`, the integer quantity, because a\n * money value carries its own scale and a quantity's is the declaration's.\n */\n readonly scale?: number;\n}\n\n/**\n * The declared shape of one table, without its rows.\n *\n * A compiled expression carries these for every table it names, so `in_set`, `lookup` and\n * `decide` are checked against the table's kind, key arity and output members at compile\n * time. Rows are deliberately absent: an expression\n * artifact has no business carrying a 30k-row catalogue.\n */\nexport interface DatasetDeclaration {\n readonly tableId: string;\n readonly kind: TableKind;\n readonly binding: TableBinding;\n readonly hitPolicy?: HitPolicy;\n readonly columns?: readonly DatasetColumn[];\n}\n\n/**\n * One table row. A lookup row carries no outcome; a\n * decision-table row declares one. `output` is required on a `PASS` row and may be absent\n * on a row that produces no result.\n */\nexport interface LookupRow {\n readonly rowId: string;\n readonly key: readonly WireValue[];\n readonly outcome?: Outcome;\n readonly output?: Readonly<Record<string, WireValue>>;\n}\n\n/** A dataset document as the store consumes it, `spec/metaschema/dataset.v1.json`. */\nexport interface LookupTableDocument {\n readonly tableId: string;\n readonly tableVersion: number;\n readonly binding: TableBinding;\n readonly kind: TableKind;\n readonly values?: readonly WireValue[];\n readonly columns?: readonly DatasetColumn[];\n readonly rows?: readonly LookupRow[];\n readonly hitPolicy?: HitPolicy;\n /** The hard cap on rows a `COLLECT` hit may return. */\n readonly collectLimit?: number;\n readonly effectiveFrom?: string;\n /** Exclusive upper bound of a data-bound table's effective range. */\n readonly effectiveTo?: string;\n}\n\n/** Why a table could not answer. */\nexport type LookupMissReason =\n | 'missing_table'\n | 'missing_as_of'\n | 'out_of_range'\n /** The store serves a version other than the one the artifact pins. */\n | 'version_mismatch';\n\n/**\n * The identity of the table version a call resolved against.\n *\n * Every resolution that reached a table carries it, so a hit and a miss are equally\n * reproduceable seven years later. `asOfDate` is present exactly when the table was\n * resolved by date. A table the store could not resolve has no identity\n * and answers `STALE` with the reason instead.\n */\nexport interface ResolvedTable {\n readonly tableId: string;\n readonly tableVersion: number;\n /** The restricted-JCS SHA-256 of the document that was resolved. */\n readonly tableSha256: string;\n readonly asOfDate?: string;\n}\n\n/**\n * The result of a set-membership test.\n *\n * `key` is the queried value as the canonical one-entry key vector, so a set test produces\n * the same provenance shape a keyed lookup does.\n */\nexport type SetResolution =\n | {\n readonly outcome: 'MEMBER' | 'ABSENT';\n readonly table: ResolvedTable;\n readonly key: readonly ScalarWireValue[];\n }\n | { readonly outcome: 'STALE'; readonly reason: LookupMissReason; readonly tableId: string };\n\n/**\n * The result of resolving one key or one input record against one table.\n *\n * `HIT` carries the hit policy because the policy decides the result's shape: one row for\n * `UNIQUE` and `FIRST`, an ordered list for `COLLECT`. `MISS` carries it\n * for the same reason — an empty collection is an empty list, while a missed single hit is\n * a reading this device does not hold. `UNDETERMINED` is a query rows matched whose verdict\n * could not be decided; it carries the policy and the matched rows for the same reason `HIT`\n * does, so the report states the match it observed instead of claiming the query matched\n * nothing, and `UNKNOWN` beats `DEFERRED`.\n *\n * `hit`, `matchedRowId` and single-versus-collection are not stored: the report derives\n * them from `rows` through `toProvenance`, so one fact never has two spellings.\n */\nexport type LookupResolution =\n | {\n readonly outcome: 'HIT';\n readonly table: ResolvedTable;\n readonly key: readonly ScalarWireValue[];\n readonly hitPolicy: HitPolicy;\n readonly rows: readonly LookupRow[];\n }\n | {\n readonly outcome: 'MISS';\n readonly table: ResolvedTable;\n readonly key: readonly ScalarWireValue[];\n readonly hitPolicy: HitPolicy;\n }\n | {\n readonly outcome: 'UNDETERMINED';\n /**\n * The table that was resolved, absent when no complete query was formed. The table, key,\n * policy and matched rows are stated together: without all four there is no question to\n * reproduce, and the report records no entry.\n */\n readonly table?: ResolvedTable;\n /** The key the query was made with, absent when no complete query was formed. */\n readonly key?: readonly ScalarWireValue[];\n /** The policy whose shape the matched rows take, present with `table` and `key`. */\n readonly hitPolicy?: HitPolicy;\n /** The rows whose key matched, in source order, present with `table` and `key`. */\n readonly rows?: readonly LookupRow[];\n readonly value: 'UNKNOWN' | 'DEFERRED';\n }\n | { readonly outcome: 'STALE'; readonly reason: LookupMissReason; readonly tableId: string };\n\n/** The resolution interface a host or a larger store backs. */\nexport interface LookupPort {\n /**\n * `in_set(table, v, asOf?)`. `recordDate` is the host's own record date\n * it resolves a data-bound set when the call names no `asOf` of its own,\n * and a behavior-bound set ignores it.\n */\n contains(tableId: string, value: ScalarWireValue, recordDate?: string): SetResolution;\n /** `lookup(table, keys, asOf?)`. */\n resolve(tableId: string, keys: readonly ScalarWireValue[], asOf?: string): LookupResolution;\n /** `decide(table, inputs, asOf?)`: key columns are matched by name. */\n decide(tableId: string, inputs: WireRecord, asOf?: string): LookupResolution;\n /** `decide_keys(table, keys, asOf?)`: key values in column order. */\n decideKeys(tableId: string, keys: readonly ScalarWireValue[], asOf?: string): LookupResolution;\n /**\n * The declared columns of one table this port holds, or `undefined` when it cannot answer.\n *\n * The evaluator reads an output member's primitive here, so a value a decision table returns\n * is the decimal its column declares rather than text that happens to be numeric. A port that\n * cannot answer leaves the member's domain undeclared, and an aggregate over it is undecided\n * rather than compared as text — the safe answer, never a wrong one.\n */\n columns?(tableId: string): readonly DatasetColumn[] | undefined;\n}\n\n/**\n * One entry in a report's `lookups`, `spec/semantics/datasets-v1.md`.\n *\n * A resolved entry states what was resolved against and whether it matched; a `STALE` entry\n * states the table that could not answer and why, because a table with no resolved document\n * has no version or digest to record.\n */\nexport type LookupProvenance = ResolvedLookupProvenance | StaleLookupProvenance;\n\n/** One lookup or set test that reached a table and did or did not match. */\nexport interface ResolvedLookupProvenance extends ResolvedTable {\n /**\n * The canonical query key, one value per key-role column in declaration order, and the\n * tested value as a one-entry vector for a set.\n */\n readonly key: readonly ScalarWireValue[];\n /**\n * Whether the query matched a row; a set test matches its value. A row whose key matched\n * matched even when its verdict was undecided, so `hit` is `true` exactly when\n * `matchedRowId` is not `null`.\n */\n readonly hit: boolean;\n /**\n * The single matched row id, the ordered row ids of a `COLLECT` hit, or `null` when the\n * query matched no row. A resolution whose verdict is undetermined states the rows that\n * matched rather than reporting the query as one that matched nothing.\n */\n readonly matchedRowId: string | readonly string[] | null;\n}\n\n/** One lookup that could not resolve a table at all. */\nexport interface StaleLookupProvenance {\n readonly tableId: string;\n readonly reason: LookupMissReason;\n}\n\n/** A diagnostic in a report: a code, a severity, a key and raw params. */\nexport interface Diagnostic {\n readonly code: DiagnosticCode;\n readonly severity: Severity;\n readonly messageKey: string;\n readonly params?: Readonly<Record<string, WireValue>>;\n readonly fieldId?: string;\n /** The row a row-scoped diagnostic belongs to: a string or a safe integer. */\n readonly rowKey?: string | number;\n readonly ruleId?: string;\n readonly itemId?: string;\n}\n\n/** One rule's result, `spec/metaschema/report.v1.json` `ruleResult`. */\nexport interface RuleResult {\n readonly ruleId: string;\n readonly ruleHash: string;\n readonly kind: RuleKind;\n readonly scope: RuleScope;\n readonly severity: Severity;\n readonly evaluateOn: Tier;\n readonly status: Outcome;\n readonly messageKey?: string;\n readonly params?: Readonly<Record<string, WireValue>>;\n readonly fields?: readonly FieldRef[];\n /**\n * The row an item-scoped rule produced this result for, keyed by the\n * natural key's canonical wire value so `\"1\"` and `1` never name one row.\n */\n readonly rowKey?: string | number;\n readonly value?: WireValue | null;\n /**\n * The alternatives a failing `validate` rule offers, `RULES-6.1.3`.\n *\n * Present only when the rule decided `FAIL` and at least one alternative survived the access\n * filter: an alternative naming a withheld target or reading a withheld value is absent rather\n * than stubbed, because a stub is still an answer about a value the reader may not see.\n */\n readonly suggestions?: readonly EvaluatedSuggestion[];\n}\n\n/**\n * One evaluated alternative, `report.v1.json` `ruleSuggestion`.\n *\n * This is the evaluated stage of `CompiledSuggestion`. A rule's alternatives travel on its\n * result and an option's on the blocker that states the unavailable code, so one type covers\n * both owners; the values are already evaluated against the record, so a host applies data\n * rather than compiling the source text it was handed.\n */\nexport interface EvaluatedSuggestion {\n readonly labelKey: string;\n readonly operations: readonly SuggestedOperation[];\n /**\n * Why a host must not apply this alternative though a reader may still see it.\n *\n * `read_only` is the one reason in this cut: the target is visibly read-only, and the write\n * guard stays authoritative at apply.\n */\n readonly disabledReason?: 'read_only';\n}\n\n/** One write an alternative performs, with the value it writes, `report.v1.json` `ruleSuggestedOperation`. */\nexport type SuggestedOperation =\n | { readonly kind: 'value'; readonly ref: FieldRef; readonly value: WireValue }\n | { readonly kind: 'null'; readonly ref: FieldRef }\n | { readonly kind: 'remove'; readonly ref: FieldRef }\n | {\n readonly kind: 'append';\n readonly fieldId: string;\n readonly row: Readonly<Record<string, WireValue>>;\n }\n | { readonly kind: 'removeRow'; readonly fieldId: string; readonly rowKey: string | number };\n\n/**\n * One gate item's result, `spec/semantics/rules-v1.md`. `ruleId` names the rule the item folds\n * when its expression is exactly `rule_ok(<ruleId>)`. An item that composes its own condition\n * folds no single rule and states none.\n */\nexport interface GateItemResult {\n readonly itemId: string;\n readonly ruleId?: string;\n readonly status: Outcome;\n readonly messageKey: string;\n readonly params?: Readonly<Record<string, WireValue>>;\n readonly fields?: readonly FieldRef[];\n}\n\n/**\n * One gate's result. The gate's identity is its key in `EvaluationReport.gates` — the gate\n * rule's `ruleId` — so the body never repeats it and a report cannot carry two identities that\n * disagree.\n *\n * A gate whose `activeWhen` decided false is not in force, so it states `active: false` and no\n * item verdicts: nothing the gate would have judged was read, and every item it would have reported\n * was never decided. An active gate states its items and no `active` member, so the two states\n * cannot both be read.\n */\nexport type GateReport =\n | {\n readonly active: false;\n /** The overrides this gate was satisfied by, in the order the host supplied them. */\n readonly overrides?: readonly GateOverride[];\n }\n | {\n readonly items: readonly GateItemResult[];\n /** The overrides this gate was satisfied by, in the order the host supplied them. */\n readonly overrides?: readonly GateOverride[];\n };\n\n/** Every gate the artifact declares, keyed by the gate rule's `ruleId`, in code-point order. */\nexport type GatesReport = Readonly<Record<string, GateReport>>;\n\n/**\n * A host's record of an approved gate override, `spec/semantics/rules-v1.md`\n * and `spec/metaschema/report.v1.json` `gateOverride`.\n *\n * Axiom never approves an override: the host does, and passes the record in. There is no\n * approval-state member, because that state is the host's own record and a constant here could\n * only be read as the engine's verdict. The three hashes are what makes an approval belong to\n * one gate decision, so `evaluateGate` refuses a record whose `inputHash`, `ruleHash` or\n * `behaviorHash` no longer matches the evaluation it would satisfy, and refuses any override of\n * a hard gate.\n */\nexport interface GateOverride {\n /** The `ruleId` of the gate rule the override was approved for. */\n readonly gateId: string;\n readonly actor: string;\n readonly reasonCode: string;\n /**\n * SHA-256 of the record the gate judged: the value tree, the submission projection, the\n * context, the withheld targets, the record date and every resolved table commitment\n * A change to any of them invalidates the approval.\n */\n readonly inputHash: string;\n readonly ruleHash: string;\n readonly behaviorHash: string;\n}\n\n/** The five screen outcomes. */\nexport type ScreenOutcome = 'SCREEN_PASS' | 'SCREEN_FAIL' | 'SCREEN_REFER' | 'UNKNOWN' | 'DEFERRED';\n\n/**\n * A structured screen reason: a cause the record needs attention for.\n *\n * `code` is an upper-case problem code. An engine reason carries the runtime diagnostic code\n * the evaluation recorded, so it corresponds to an entry in the report's `diagnostics` — by `code`\n * alone for a cause the engine does not attribute to a rule (`STALE_DATA`, `ACCESS_DENIED`), and by\n * `code` and `ruleId` where it does. An author reason carries the code the artifact declares for\n * it. The message is rendered from `messageKey` and `params`, never spelled here, so one reason\n * reads the same in every locale.\n */\nexport interface ScreenReason {\n readonly code: string;\n readonly messageKey: string;\n readonly params?: Readonly<Record<string, WireValue>>;\n}\n\n/**\n * One screen's result. The screen's identity is its key in `EvaluationReport.screens` — the\n * screen rule's `ruleId` — and `outcome` keeps the five states a screen decides so a report\n * distinguishes `SCREEN_REFER` from `SCREEN_FAIL` even though both fold to `FAIL` in\n * `rules[].status`.\n */\nexport interface ScreenReport {\n readonly outcome: ScreenOutcome;\n readonly reasons: readonly ScreenReason[];\n}\n\n/** Every screen the artifact declares, keyed by the screen rule's `ruleId`, in code-point order. */\nexport type ScreensReport = Readonly<Record<string, ScreenReport>>;\n\n/** The canonical evaluation report, `spec/metaschema/report.v1.json`. */\nexport interface EvaluationReport {\n readonly schemaId: string;\n readonly schemaVersion: number;\n readonly exprVersion: 1;\n readonly behaviorHash: string;\n readonly reportHash: string;\n /**\n * The rules fold: every block-severity rule result and diagnostic, and nothing else.\n *\n * It is deliberately not readiness. A declared `minItems`, a media constraint, a `rowsFrom`\n * count, a missing `required` value or a hidden section's blocker is not a rule result, so it\n * does not move this status; changing that would change the meaning of every sealed v1 report\n * (`EXPR-1.1.4`). Admission is `evaluateReadiness()`, or `submissionVerdict()`'s `outcome`, or\n * `evaluateSubmission().readiness`; a host decides whether to submit by one of those, never by\n * this value.\n */\n readonly status: Outcome;\n readonly accessVersion: number;\n readonly access: readonly ReportAccessEntry[];\n readonly rules: readonly RuleResult[];\n /**\n * Every declared gate, keyed by its rule's `ruleId`. Absent when the schema declares none,\n * never an empty object.\n */\n readonly gates?: GatesReport;\n /**\n * Every declared screen, keyed by its rule's `ruleId`. Absent when the schema declares none,\n * never an empty object.\n */\n readonly screens?: ScreensReport;\n /**\n * The gate a caller acts on when it names none: the designation this artifact carries, and\n * one of the gate rule ids it declares. Absent when the artifact declares no gate.\n */\n readonly primaryGateId?: string;\n /**\n * The screen a caller acts on when it names none: the designation this artifact carries, and\n * one of the screen rule ids it declares. Absent when the artifact declares no screen.\n */\n readonly primaryScreenId?: string;\n readonly diagnostics: readonly Diagnostic[];\n readonly lookups: readonly LookupProvenance[];\n /**\n * The base edition and every overlay edition the artifact was composed from, in order\n * (`[EVOL-4.1.4]`). Absent on a report produced from a single document, so an existing\n * report keeps its bytes and its `reportHash`.\n *\n * Copied from the artifact by the report assembly, and therefore covered by `reportHash`:\n * a dispute that names an artifact can read the exact configuration that produced it.\n */\n readonly composition?: CompositionReport;\n}\n\n/**\n * A report without its digest: every fact a derived form state carries.\n *\n * Sealing a report canonicalises it and hashes the result, which is the cost of *proving* a\n * decision, not of describing one. A per-keystroke derivation therefore carries the body and\n * leaves the digest to the entry point that returns a decision — `evaluate()`, an explicit\n * `sealReport(body)`, or `engine.report()`, which seals once per committed report body.\n */\nexport type ReportFacts = Omit<EvaluationReport, 'reportHash'>;\n"]}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Small predicates over untrusted or runtime values. They are shared so the wire reader,
3
+ * the record reader and the evaluator agree on what an object and a canonical integer are
4
+ * instead of each growing a slightly different copy.
5
+ */
6
+ import type { ScalarWireValue, WireValue } from './types.js';
7
+ export { isRecord } from './guards.js';
8
+ /**
9
+ * A wire value's members, when it is an object rather than a list, `null` or a primitive.
10
+ * The union's object members are the money, timeslot and open-record shapes, and each is exactly
11
+ * a string-keyed map of wire values, so one assertion states that instead of a cast at every
12
+ * member read.
13
+ */
14
+ export declare function wireMembers(value: WireValue): Readonly<Record<string, WireValue>> | undefined;
15
+ /**
16
+ * A wire value's elements, when it is a list.
17
+ *
18
+ * `Array.isArray` alone narrows to `any[]`, and asserting `WireValue[]` over `unknown` would
19
+ * claim an element walk this does not perform. The parameter is therefore already a wire value:
20
+ * every arm of the union other than the list is not an array, so the array branch is exactly the
21
+ * element list. A caller holding untrusted JSON uses `isWireValueArray`, which walks the
22
+ * elements and so tells the truth about `unknown`.
23
+ */
24
+ export declare function isWireArray(value: WireValue): value is readonly WireValue[];
25
+ /**
26
+ * Whether an untrusted value is a list of wire values, at any depth.
27
+ *
28
+ * This is the honest `unknown` guard beside `isWireValue`: it admits an array only when the wire
29
+ * profile admits the whole value, so a list holding a date, a class instance, a sparse hole or a
30
+ * nested invalid member is refused rather than passed into a path that assumes canonical data.
31
+ * It reuses `isWireValue` so there is one element and object rule, not a second weaker one.
32
+ */
33
+ export declare function isWireValueArray(value: unknown): value is readonly WireValue[];
34
+ /**
35
+ * Whether an untrusted value is one the wire contract admits, read structurally.
36
+ *
37
+ * The union's object members are string-keyed maps of wire values, so one predicate decides the
38
+ * whole profile at any depth.
39
+ * A declared shape (a money domain, a record's members) is still the wire reader's business;
40
+ * this answers only whether a tree is canonical wire data at all, which is what a caller
41
+ * holding untrusted JSON needs before treating it as one. An open record's member names are the
42
+ * reader's business for the same reason: only the reader knows which arm of the union it is
43
+ * reading a value under, and the generic record arm admits fewer names than a shape's own arm.
44
+ *
45
+ * The profile's own object rule decides the object and array arms: a class instance, a boxed
46
+ * primitive, a `Decimal`, an accessor, a symbol key, a non-enumerable member or an own
47
+ * callable `toJSON` is refused by `objectShapeViolation`, the same function `copyRestricted`
48
+ * refuses with, so a pre-flight pass here is the answer canonicalisation would give rather
49
+ * than a weaker one. The rule reads own members only, so a host's mutation of
50
+ * `Object.prototype` cannot change the verdict.
51
+ *
52
+ * The text rule decides the string arm and a record's member names: a lone surrogate has no
53
+ * UTF-8 encoding, so hashing it would hash replacement characters and two distinct values would
54
+ * collide. The copier refuses one in a value and in a name, so this walk refuses it in both —
55
+ * a pre-flight that admitted it would only move the refusal to a canonicalisation the caller
56
+ * has already stopped expecting.
57
+ */
58
+ export declare function isWireValue(value: unknown): value is WireValue;
59
+ /**
60
+ * A canonical integer: safe and never the negative zero JSON cannot spell.
61
+ *
62
+ * The definition lives in `model/integer.ts`, which imports nothing, so a leaf reader such as
63
+ * `expr/decimal.ts` can ask the same function without reaching this module's imports.
64
+ */
65
+ export { isSafeInteger } from './integer.js';
66
+ /**
67
+ * Whether two canonical wire values are the same value; `undefined` is absent, not a value.
68
+ *
69
+ * This is structural equality over the canonical form: list order is part of a value, and a
70
+ * record's member set is compared as a set of names, so two records written in different
71
+ * member orders are one value while a missing or an extra member is not. Both sides are
72
+ * canonical, so equality is exact: `1` and `"1"` are different values, and a money amount
73
+ * differs whenever its currency or scale differs.
74
+ *
75
+ * One copy lives here because the wire boundary, the reactive store and a host's option
76
+ * matching all need the same answer; a private copy per package is how two of them come to
77
+ * disagree about `7` and `"7"`.
78
+ */
79
+ export declare function sameWireValue(left: WireValue | undefined, right: WireValue | undefined): boolean;
80
+ /**
81
+ * Whether a value belongs to the dataset scalar union, `spec/metaschema/dataset.v1.json`
82
+ * `$defs/scalar`.
83
+ *
84
+ * The money and quantity arms are decided by the one reader each primitive owns rather than by
85
+ * a fourth copy of their rules, so a value the wire boundary would refuse as money or as a
86
+ * quantity is not accepted here either. The refusal is the answer: this predicate reports
87
+ * membership, so it lets the reader's `AxiomError` say no. Anything that is not an `AxiomError`
88
+ * is a programmer error in the reader and is rethrown rather than reported as "not a scalar".
89
+ */
90
+ export declare function isScalarWireValue(value: WireValue): value is ScalarWireValue;
91
+ //# sourceMappingURL=values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/model/values.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,SAAS,CAG7F;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,SAAS,SAAS,EAAE,CAE3E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,SAAS,EAAE,CAE9E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAoCD;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CA6BhG;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,eAAe,CAK5E"}
@@ -0,0 +1,195 @@
1
+ /**
2
+ * Small predicates over untrusted or runtime values. They are shared so the wire reader,
3
+ * the record reader and the evaluator agree on what an object and a canonical integer are
4
+ * instead of each growing a slightly different copy.
5
+ */
6
+ import { MAX_NESTING_DEPTH, hasUnpairedSurrogate, objectShapeViolation, prototypeOf, } from '../canonical/restricted.js';
7
+ import { toMoneyValue } from '../expr/money.js';
8
+ import { toQuantityValue } from '../expr/quantity.js';
9
+ import { AxiomError } from './errors.js';
10
+ import { isSafeInteger } from './integer.js';
11
+ export { isRecord } from './guards.js';
12
+ /**
13
+ * A wire value's members, when it is an object rather than a list, `null` or a primitive.
14
+ * The union's object members are the money, timeslot and open-record shapes, and each is exactly
15
+ * a string-keyed map of wire values, so one assertion states that instead of a cast at every
16
+ * member read.
17
+ */
18
+ export function wireMembers(value) {
19
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
20
+ return undefined;
21
+ return value;
22
+ }
23
+ /**
24
+ * A wire value's elements, when it is a list.
25
+ *
26
+ * `Array.isArray` alone narrows to `any[]`, and asserting `WireValue[]` over `unknown` would
27
+ * claim an element walk this does not perform. The parameter is therefore already a wire value:
28
+ * every arm of the union other than the list is not an array, so the array branch is exactly the
29
+ * element list. A caller holding untrusted JSON uses `isWireValueArray`, which walks the
30
+ * elements and so tells the truth about `unknown`.
31
+ */
32
+ export function isWireArray(value) {
33
+ return Array.isArray(value);
34
+ }
35
+ /**
36
+ * Whether an untrusted value is a list of wire values, at any depth.
37
+ *
38
+ * This is the honest `unknown` guard beside `isWireValue`: it admits an array only when the wire
39
+ * profile admits the whole value, so a list holding a date, a class instance, a sparse hole or a
40
+ * nested invalid member is refused rather than passed into a path that assumes canonical data.
41
+ * It reuses `isWireValue` so there is one element and object rule, not a second weaker one.
42
+ */
43
+ export function isWireValueArray(value) {
44
+ return isWireValue(value) && Array.isArray(value);
45
+ }
46
+ /**
47
+ * Whether an untrusted value is one the wire contract admits, read structurally.
48
+ *
49
+ * The union's object members are string-keyed maps of wire values, so one predicate decides the
50
+ * whole profile at any depth.
51
+ * A declared shape (a money domain, a record's members) is still the wire reader's business;
52
+ * this answers only whether a tree is canonical wire data at all, which is what a caller
53
+ * holding untrusted JSON needs before treating it as one. An open record's member names are the
54
+ * reader's business for the same reason: only the reader knows which arm of the union it is
55
+ * reading a value under, and the generic record arm admits fewer names than a shape's own arm.
56
+ *
57
+ * The profile's own object rule decides the object and array arms: a class instance, a boxed
58
+ * primitive, a `Decimal`, an accessor, a symbol key, a non-enumerable member or an own
59
+ * callable `toJSON` is refused by `objectShapeViolation`, the same function `copyRestricted`
60
+ * refuses with, so a pre-flight pass here is the answer canonicalisation would give rather
61
+ * than a weaker one. The rule reads own members only, so a host's mutation of
62
+ * `Object.prototype` cannot change the verdict.
63
+ *
64
+ * The text rule decides the string arm and a record's member names: a lone surrogate has no
65
+ * UTF-8 encoding, so hashing it would hash replacement characters and two distinct values would
66
+ * collide. The copier refuses one in a value and in a name, so this walk refuses it in both —
67
+ * a pre-flight that admitted it would only move the refusal to a canonicalisation the caller
68
+ * has already stopped expecting.
69
+ */
70
+ export function isWireValue(value) {
71
+ return isWireValueAt(value, new Set(), 0);
72
+ }
73
+ /** One recursive walk, with backtracking so a shared subtree is data but a cycle is refused. */
74
+ function isWireValueAt(value, seen, depth) {
75
+ if (value === null || typeof value === 'boolean')
76
+ return true;
77
+ if (typeof value === 'string')
78
+ return !hasUnpairedSurrogate(value);
79
+ if (typeof value === 'number')
80
+ return isSafeInteger(value);
81
+ if (typeof value !== 'object')
82
+ return false;
83
+ if (objectShapeViolation(value) !== undefined)
84
+ return false;
85
+ if (depth + 1 > MAX_NESTING_DEPTH || seen.has(value))
86
+ return false;
87
+ seen.add(value);
88
+ try {
89
+ if (Array.isArray(value)) {
90
+ // An `Array` subclass carries a prototype whose behaviour the canonical form would not
91
+ // preserve, exactly as `copyRestricted` refuses it.
92
+ if (prototypeOf(value) !== Array.prototype)
93
+ return false;
94
+ // `every` skips holes and never visits a named member, but both change what the canonical
95
+ // copier refuses. Check the index set explicitly so this pre-flight is the same boundary.
96
+ if (Object.getOwnPropertyNames(value).length !== value.length + 1)
97
+ return false;
98
+ for (let index = 0; index < value.length; index += 1) {
99
+ if (!Object.hasOwn(value, index) || !isWireValueAt(value[index], seen, depth + 1)) {
100
+ return false;
101
+ }
102
+ }
103
+ return true;
104
+ }
105
+ const prototype = prototypeOf(value);
106
+ if (prototype !== Object.prototype && prototype !== null)
107
+ return false;
108
+ return Object.entries(value).every(([key, member]) => !hasUnpairedSurrogate(key) && isWireValueAt(member, seen, depth + 1));
109
+ }
110
+ finally {
111
+ seen.delete(value);
112
+ }
113
+ }
114
+ /**
115
+ * A canonical integer: safe and never the negative zero JSON cannot spell.
116
+ *
117
+ * The definition lives in `model/integer.ts`, which imports nothing, so a leaf reader such as
118
+ * `expr/decimal.ts` can ask the same function without reaching this module's imports.
119
+ */
120
+ export { isSafeInteger } from './integer.js';
121
+ /**
122
+ * Whether two canonical wire values are the same value; `undefined` is absent, not a value.
123
+ *
124
+ * This is structural equality over the canonical form: list order is part of a value, and a
125
+ * record's member set is compared as a set of names, so two records written in different
126
+ * member orders are one value while a missing or an extra member is not. Both sides are
127
+ * canonical, so equality is exact: `1` and `"1"` are different values, and a money amount
128
+ * differs whenever its currency or scale differs.
129
+ *
130
+ * One copy lives here because the wire boundary, the reactive store and a host's option
131
+ * matching all need the same answer; a private copy per package is how two of them come to
132
+ * disagree about `7` and `"7"`.
133
+ */
134
+ export function sameWireValue(left, right) {
135
+ if (left === undefined || right === undefined)
136
+ return left === right;
137
+ if (isWireArray(left) || isWireArray(right)) {
138
+ if (!isWireArray(left) || !isWireArray(right) || left.length !== right.length)
139
+ return false;
140
+ return left.every((item, index) => {
141
+ const other = right[index];
142
+ return other !== undefined && sameWireValue(item, other);
143
+ });
144
+ }
145
+ if (typeof left === 'number' || typeof right === 'number') {
146
+ return (typeof left === 'number' &&
147
+ typeof right === 'number' &&
148
+ isSafeInteger(left) &&
149
+ isSafeInteger(right) &&
150
+ left === right);
151
+ }
152
+ if (typeof left !== 'object' || typeof right !== 'object' || left === null || right === null) {
153
+ return left === right;
154
+ }
155
+ const leftMembers = wireMembers(left);
156
+ const rightMembers = wireMembers(right);
157
+ if (leftMembers === undefined || rightMembers === undefined)
158
+ return false;
159
+ const keys = Object.keys(leftMembers);
160
+ if (keys.length !== Object.keys(rightMembers).length)
161
+ return false;
162
+ return keys.every((key) => Object.hasOwn(rightMembers, key) && sameWireValue(leftMembers[key], rightMembers[key]));
163
+ }
164
+ /**
165
+ * Whether a value belongs to the dataset scalar union, `spec/metaschema/dataset.v1.json`
166
+ * `$defs/scalar`.
167
+ *
168
+ * The money and quantity arms are decided by the one reader each primitive owns rather than by
169
+ * a fourth copy of their rules, so a value the wire boundary would refuse as money or as a
170
+ * quantity is not accepted here either. The refusal is the answer: this predicate reports
171
+ * membership, so it lets the reader's `AxiomError` say no. Anything that is not an `AxiomError`
172
+ * is a programmer error in the reader and is rethrown rather than reported as "not a scalar".
173
+ */
174
+ export function isScalarWireValue(value) {
175
+ if (typeof value === 'string' || typeof value === 'boolean')
176
+ return true;
177
+ if (typeof value === 'number')
178
+ return isSafeInteger(value);
179
+ if (value === null || Array.isArray(value))
180
+ return false;
181
+ return readsAs(value, toMoneyValue) || readsAs(value, toQuantityValue);
182
+ }
183
+ /** Whether one scalar reader admits `value`; a reader's `AxiomError` is its "no". */
184
+ function readsAs(value, read) {
185
+ try {
186
+ read(value);
187
+ return true;
188
+ }
189
+ catch (error) {
190
+ if (error instanceof AxiomError)
191
+ return false;
192
+ throw error;
193
+ }
194
+ }
195
+ //# sourceMappingURL=values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/model/values.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1F,OAAO,KAA4C,CAAC;AACtD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,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C,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAChG,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAgB;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACzE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAC3D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzD,OAAO,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACzE,CAAC;AAED,qFAAqF;AACrF,SAAS,OAAO,CAAC,KAAgB,EAAE,IAAiC;IAClE,IAAI,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,UAAU;YAAE,OAAO,KAAK,CAAC;QAC9C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["/**\n * Small predicates over untrusted or runtime values. They are shared so the wire reader,\n * the record reader and the evaluator agree on what an object and a canonical integer are\n * instead of each growing a slightly different copy.\n */\n\nimport {\n MAX_NESTING_DEPTH,\n hasUnpairedSurrogate,\n objectShapeViolation,\n prototypeOf,\n} from '../canonical/restricted.js';\nimport { toMoneyValue } from '../expr/money.js';\nimport { toQuantityValue } from '../expr/quantity.js';\nimport { AxiomError } from './errors.js';\nimport { isSafeInteger } from './integer.js';\nimport type { ScalarWireValue, WireValue } from './types.js';\n\nexport { isRecord } from './guards.js';\n\n/**\n * A wire value's members, when it is an object rather than a list, `null` or a primitive.\n * The union's object members are the money, timeslot and open-record shapes, and each is exactly\n * a string-keyed map of wire values, so one assertion states that instead of a cast at every\n * member read.\n */\nexport function wireMembers(value: WireValue): Readonly<Record<string, WireValue>> | undefined {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return undefined;\n return value as Readonly<Record<string, WireValue>>;\n}\n\n/**\n * A wire value's elements, when it is a list.\n *\n * `Array.isArray` alone narrows to `any[]`, and asserting `WireValue[]` over `unknown` would\n * claim an element walk this does not perform. The parameter is therefore already a wire value:\n * every arm of the union other than the list is not an array, so the array branch is exactly the\n * element list. A caller holding untrusted JSON uses `isWireValueArray`, which walks the\n * elements and so tells the truth about `unknown`.\n */\nexport function isWireArray(value: WireValue): value is readonly WireValue[] {\n return Array.isArray(value);\n}\n\n/**\n * Whether an untrusted value is a list of wire values, at any depth.\n *\n * This is the honest `unknown` guard beside `isWireValue`: it admits an array only when the wire\n * profile admits the whole value, so a list holding a date, a class instance, a sparse hole or a\n * nested invalid member is refused rather than passed into a path that assumes canonical data.\n * It reuses `isWireValue` so there is one element and object rule, not a second weaker one.\n */\nexport function isWireValueArray(value: unknown): value is readonly WireValue[] {\n return isWireValue(value) && Array.isArray(value);\n}\n\n/**\n * Whether an untrusted value is one the wire contract admits, read structurally.\n *\n * The union's object members are string-keyed maps of wire values, so one predicate decides the\n * whole profile at any depth.\n * A declared shape (a money domain, a record's members) is still the wire reader's business;\n * this answers only whether a tree is canonical wire data at all, which is what a caller\n * holding untrusted JSON needs before treating it as one. An open record's member names are the\n * reader's business for the same reason: only the reader knows which arm of the union it is\n * reading a value under, and the generic record arm admits fewer names than a shape's own arm.\n *\n * The profile's own object rule decides the object and array arms: a class instance, a boxed\n * primitive, a `Decimal`, an accessor, a symbol key, a non-enumerable member or an own\n * callable `toJSON` is refused by `objectShapeViolation`, the same function `copyRestricted`\n * refuses with, so a pre-flight pass here is the answer canonicalisation would give rather\n * than a weaker one. The rule reads own members only, so a host's mutation of\n * `Object.prototype` cannot change the verdict.\n *\n * The text rule decides the string arm and a record's member names: a lone surrogate has no\n * UTF-8 encoding, so hashing it would hash replacement characters and two distinct values would\n * collide. The copier refuses one in a value and in a name, so this walk refuses it in both —\n * a pre-flight that admitted it would only move the refusal to a canonicalisation the caller\n * has already stopped expecting.\n */\nexport function isWireValue(value: unknown): value is WireValue {\n return isWireValueAt(value, new Set(), 0);\n}\n\n/** One recursive walk, with backtracking so a shared subtree is data but a cycle is refused. */\nfunction isWireValueAt(value: unknown, seen: Set<object>, depth: number): value is WireValue {\n if (value === null || typeof value === 'boolean') return true;\n if (typeof value === 'string') return !hasUnpairedSurrogate(value);\n if (typeof value === 'number') return isSafeInteger(value);\n if (typeof value !== 'object') return false;\n if (objectShapeViolation(value) !== undefined) return false;\n if (depth + 1 > MAX_NESTING_DEPTH || seen.has(value)) return false;\n seen.add(value);\n try {\n if (Array.isArray(value)) {\n // An `Array` subclass carries a prototype whose behaviour the canonical form would not\n // preserve, exactly as `copyRestricted` refuses it.\n if (prototypeOf(value) !== Array.prototype) return false;\n // `every` skips holes and never visits a named member, but both change what the canonical\n // copier refuses. Check the index set explicitly so this pre-flight is the same boundary.\n if (Object.getOwnPropertyNames(value).length !== value.length + 1) return false;\n for (let index = 0; index < value.length; index += 1) {\n if (!Object.hasOwn(value, index) || !isWireValueAt(value[index], seen, depth + 1)) {\n return false;\n }\n }\n return true;\n }\n const prototype = prototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) return false;\n return Object.entries(value).every(\n ([key, member]) => !hasUnpairedSurrogate(key) && isWireValueAt(member, seen, depth + 1),\n );\n } finally {\n seen.delete(value);\n }\n}\n\n/**\n * A canonical integer: safe and never the negative zero JSON cannot spell.\n *\n * The definition lives in `model/integer.ts`, which imports nothing, so a leaf reader such as\n * `expr/decimal.ts` can ask the same function without reaching this module's imports.\n */\nexport { isSafeInteger } from './integer.js';\n\n/**\n * Whether two canonical wire values are the same value; `undefined` is absent, not a value.\n *\n * This is structural equality over the canonical form: list order is part of a value, and a\n * record's member set is compared as a set of names, so two records written in different\n * member orders are one value while a missing or an extra member is not. Both sides are\n * canonical, so equality is exact: `1` and `\"1\"` are different values, and a money amount\n * differs whenever its currency or scale differs.\n *\n * One copy lives here because the wire boundary, the reactive store and a host's option\n * matching all need the same answer; a private copy per package is how two of them come to\n * disagree about `7` and `\"7\"`.\n */\nexport function sameWireValue(left: WireValue | undefined, right: WireValue | undefined): boolean {\n if (left === undefined || right === undefined) return left === right;\n if (isWireArray(left) || isWireArray(right)) {\n if (!isWireArray(left) || !isWireArray(right) || left.length !== right.length) return false;\n return left.every((item, index) => {\n const other = right[index];\n return other !== undefined && sameWireValue(item, other);\n });\n }\n if (typeof left === 'number' || typeof right === 'number') {\n return (\n typeof left === 'number' &&\n typeof right === 'number' &&\n isSafeInteger(left) &&\n isSafeInteger(right) &&\n left === right\n );\n }\n if (typeof left !== 'object' || typeof right !== 'object' || left === null || right === null) {\n return left === right;\n }\n const leftMembers = wireMembers(left);\n const rightMembers = wireMembers(right);\n if (leftMembers === undefined || rightMembers === undefined) return false;\n const keys = Object.keys(leftMembers);\n if (keys.length !== Object.keys(rightMembers).length) return false;\n return keys.every(\n (key) => Object.hasOwn(rightMembers, key) && sameWireValue(leftMembers[key], rightMembers[key]),\n );\n}\n\n/**\n * Whether a value belongs to the dataset scalar union, `spec/metaschema/dataset.v1.json`\n * `$defs/scalar`.\n *\n * The money and quantity arms are decided by the one reader each primitive owns rather than by\n * a fourth copy of their rules, so a value the wire boundary would refuse as money or as a\n * quantity is not accepted here either. The refusal is the answer: this predicate reports\n * membership, so it lets the reader's `AxiomError` say no. Anything that is not an `AxiomError`\n * is a programmer error in the reader and is rethrown rather than reported as \"not a scalar\".\n */\nexport function isScalarWireValue(value: WireValue): value is ScalarWireValue {\n if (typeof value === 'string' || typeof value === 'boolean') return true;\n if (typeof value === 'number') return isSafeInteger(value);\n if (value === null || Array.isArray(value)) return false;\n return readsAs(value, toMoneyValue) || readsAs(value, toQuantityValue);\n}\n\n/** Whether one scalar reader admits `value`; a reader's `AxiomError` is its \"no\". */\nfunction readsAs(value: WireValue, read: (value: unknown) => unknown): boolean {\n try {\n read(value);\n return true;\n } catch (error) {\n if (error instanceof AxiomError) return false;\n throw error;\n }\n}\n"]}