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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (755) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +714 -2
  3. package/dist/cache/index.d.ts +191 -0
  4. package/dist/cache/index.d.ts.map +1 -0
  5. package/dist/cache/index.js +361 -0
  6. package/dist/cache/index.js.map +1 -0
  7. package/dist/canonical/jcs.d.ts +78 -0
  8. package/dist/canonical/jcs.d.ts.map +1 -0
  9. package/dist/canonical/jcs.js +500 -0
  10. package/dist/canonical/jcs.js.map +1 -0
  11. package/dist/canonical/restricted-json.d.ts +7 -0
  12. package/dist/canonical/restricted-json.d.ts.map +1 -0
  13. package/dist/canonical/restricted-json.js +318 -0
  14. package/dist/canonical/restricted-json.js.map +1 -0
  15. package/dist/canonical/restricted-value.d.ts +59 -0
  16. package/dist/canonical/restricted-value.d.ts.map +1 -0
  17. package/dist/canonical/restricted-value.js +156 -0
  18. package/dist/canonical/restricted-value.js.map +1 -0
  19. package/dist/canonical/restricted.d.ts +85 -0
  20. package/dist/canonical/restricted.d.ts.map +1 -0
  21. package/dist/canonical/restricted.js +163 -0
  22. package/dist/canonical/restricted.js.map +1 -0
  23. package/dist/canonical/signature.d.ts +38 -0
  24. package/dist/canonical/signature.d.ts.map +1 -0
  25. package/dist/canonical/signature.js +47 -0
  26. package/dist/canonical/signature.js.map +1 -0
  27. package/dist/eval/access/delivery.d.ts +63 -0
  28. package/dist/eval/access/delivery.d.ts.map +1 -0
  29. package/dist/eval/access/delivery.js +98 -0
  30. package/dist/eval/access/delivery.js.map +1 -0
  31. package/dist/eval/access/overlay.d.ts +72 -0
  32. package/dist/eval/access/overlay.d.ts.map +1 -0
  33. package/dist/eval/access/overlay.js +402 -0
  34. package/dist/eval/access/overlay.js.map +1 -0
  35. package/dist/eval/access/projection.d.ts +159 -0
  36. package/dist/eval/access/projection.d.ts.map +1 -0
  37. package/dist/eval/access/projection.js +211 -0
  38. package/dist/eval/access/projection.js.map +1 -0
  39. package/dist/eval/access/window.d.ts +128 -0
  40. package/dist/eval/access/window.d.ts.map +1 -0
  41. package/dist/eval/access/window.js +254 -0
  42. package/dist/eval/access/window.js.map +1 -0
  43. package/dist/eval/access/write.d.ts +113 -0
  44. package/dist/eval/access/write.d.ts.map +1 -0
  45. package/dist/eval/access/write.js +119 -0
  46. package/dist/eval/access/write.js.map +1 -0
  47. package/dist/eval/addressing.d.ts +131 -0
  48. package/dist/eval/addressing.d.ts.map +1 -0
  49. package/dist/eval/addressing.js +270 -0
  50. package/dist/eval/addressing.js.map +1 -0
  51. package/dist/eval/budget.d.ts +143 -0
  52. package/dist/eval/budget.d.ts.map +1 -0
  53. package/dist/eval/budget.js +387 -0
  54. package/dist/eval/budget.js.map +1 -0
  55. package/dist/eval/computed.d.ts +46 -0
  56. package/dist/eval/computed.d.ts.map +1 -0
  57. package/dist/eval/computed.js +89 -0
  58. package/dist/eval/computed.js.map +1 -0
  59. package/dist/eval/denials.d.ts +64 -0
  60. package/dist/eval/denials.d.ts.map +1 -0
  61. package/dist/eval/denials.js +87 -0
  62. package/dist/eval/denials.js.map +1 -0
  63. package/dist/eval/engine/cancellation.d.ts +12 -0
  64. package/dist/eval/engine/cancellation.d.ts.map +1 -0
  65. package/dist/eval/engine/cancellation.js +56 -0
  66. package/dist/eval/engine/cancellation.js.map +1 -0
  67. package/dist/eval/engine/delta.d.ts +104 -0
  68. package/dist/eval/engine/delta.d.ts.map +1 -0
  69. package/dist/eval/engine/delta.js +466 -0
  70. package/dist/eval/engine/delta.js.map +1 -0
  71. package/dist/eval/engine/deps.d.ts +136 -0
  72. package/dist/eval/engine/deps.d.ts.map +1 -0
  73. package/dist/eval/engine/deps.js +345 -0
  74. package/dist/eval/engine/deps.js.map +1 -0
  75. package/dist/eval/engine/identity.d.ts +128 -0
  76. package/dist/eval/engine/identity.d.ts.map +1 -0
  77. package/dist/eval/engine/identity.js +398 -0
  78. package/dist/eval/engine/identity.js.map +1 -0
  79. package/dist/eval/engine/index.d.ts +200 -0
  80. package/dist/eval/engine/index.d.ts.map +1 -0
  81. package/dist/eval/engine/index.js +1242 -0
  82. package/dist/eval/engine/index.js.map +1 -0
  83. package/dist/eval/engine/measurement.d.ts +23 -0
  84. package/dist/eval/engine/measurement.d.ts.map +1 -0
  85. package/dist/eval/engine/measurement.js +42 -0
  86. package/dist/eval/engine/measurement.js.map +1 -0
  87. package/dist/eval/engine/naive.d.ts +19 -0
  88. package/dist/eval/engine/naive.d.ts.map +1 -0
  89. package/dist/eval/engine/naive.js +59 -0
  90. package/dist/eval/engine/naive.js.map +1 -0
  91. package/dist/eval/engine/ops.d.ts +214 -0
  92. package/dist/eval/engine/ops.d.ts.map +1 -0
  93. package/dist/eval/engine/ops.js +1422 -0
  94. package/dist/eval/engine/ops.js.map +1 -0
  95. package/dist/eval/engine/patches.d.ts +40 -0
  96. package/dist/eval/engine/patches.d.ts.map +1 -0
  97. package/dist/eval/engine/patches.js +125 -0
  98. package/dist/eval/engine/patches.js.map +1 -0
  99. package/dist/eval/engine/ports.d.ts +71 -0
  100. package/dist/eval/engine/ports.d.ts.map +1 -0
  101. package/dist/eval/engine/ports.js +2 -0
  102. package/dist/eval/engine/ports.js.map +1 -0
  103. package/dist/eval/engine/session.d.ts +116 -0
  104. package/dist/eval/engine/session.d.ts.map +1 -0
  105. package/dist/eval/engine/session.js +653 -0
  106. package/dist/eval/engine/session.js.map +1 -0
  107. package/dist/eval/engine/snapshot.d.ts +97 -0
  108. package/dist/eval/engine/snapshot.d.ts.map +1 -0
  109. package/dist/eval/engine/snapshot.js +221 -0
  110. package/dist/eval/engine/snapshot.js.map +1 -0
  111. package/dist/eval/engine/subscriptions.d.ts +47 -0
  112. package/dist/eval/engine/subscriptions.d.ts.map +1 -0
  113. package/dist/eval/engine/subscriptions.js +103 -0
  114. package/dist/eval/engine/subscriptions.js.map +1 -0
  115. package/dist/eval/engine/trace.d.ts +77 -0
  116. package/dist/eval/engine/trace.d.ts.map +1 -0
  117. package/dist/eval/engine/trace.js +140 -0
  118. package/dist/eval/engine/trace.js.map +1 -0
  119. package/dist/eval/error-diagnostic.d.ts +26 -0
  120. package/dist/eval/error-diagnostic.d.ts.map +1 -0
  121. package/dist/eval/error-diagnostic.js +63 -0
  122. package/dist/eval/error-diagnostic.js.map +1 -0
  123. package/dist/eval/evaluate-expr.d.ts +44 -0
  124. package/dist/eval/evaluate-expr.d.ts.map +1 -0
  125. package/dist/eval/evaluate-expr.js +149 -0
  126. package/dist/eval/evaluate-expr.js.map +1 -0
  127. package/dist/eval/evaluate.d.ts +282 -0
  128. package/dist/eval/evaluate.d.ts.map +1 -0
  129. package/dist/eval/evaluate.js +391 -0
  130. package/dist/eval/evaluate.js.map +1 -0
  131. package/dist/eval/evolution/relocate.d.ts +72 -0
  132. package/dist/eval/evolution/relocate.d.ts.map +1 -0
  133. package/dist/eval/evolution/relocate.js +427 -0
  134. package/dist/eval/evolution/relocate.js.map +1 -0
  135. package/dist/eval/evolution/select.d.ts +11 -0
  136. package/dist/eval/evolution/select.d.ts.map +1 -0
  137. package/dist/eval/evolution/select.js +53 -0
  138. package/dist/eval/evolution/select.js.map +1 -0
  139. package/dist/eval/evolution/upcast.d.ts +13 -0
  140. package/dist/eval/evolution/upcast.d.ts.map +1 -0
  141. package/dist/eval/evolution/upcast.js +88 -0
  142. package/dist/eval/evolution/upcast.js.map +1 -0
  143. package/dist/eval/expr/aggregates.d.ts +75 -0
  144. package/dist/eval/expr/aggregates.d.ts.map +1 -0
  145. package/dist/eval/expr/aggregates.js +991 -0
  146. package/dist/eval/expr/aggregates.js.map +1 -0
  147. package/dist/eval/expr/arithmetic.d.ts +26 -0
  148. package/dist/eval/expr/arithmetic.d.ts.map +1 -0
  149. package/dist/eval/expr/arithmetic.js +387 -0
  150. package/dist/eval/expr/arithmetic.js.map +1 -0
  151. package/dist/eval/expr/between.d.ts +17 -0
  152. package/dist/eval/expr/between.d.ts.map +1 -0
  153. package/dist/eval/expr/between.js +46 -0
  154. package/dist/eval/expr/between.js.map +1 -0
  155. package/dist/eval/expr/binder.d.ts +96 -0
  156. package/dist/eval/expr/binder.d.ts.map +1 -0
  157. package/dist/eval/expr/binder.js +253 -0
  158. package/dist/eval/expr/binder.js.map +1 -0
  159. package/dist/eval/expr/call-dispatch.d.ts +28 -0
  160. package/dist/eval/expr/call-dispatch.d.ts.map +1 -0
  161. package/dist/eval/expr/call-dispatch.js +114 -0
  162. package/dist/eval/expr/call-dispatch.js.map +1 -0
  163. package/dist/eval/expr/collections.d.ts +20 -0
  164. package/dist/eval/expr/collections.d.ts.map +1 -0
  165. package/dist/eval/expr/collections.js +66 -0
  166. package/dist/eval/expr/collections.js.map +1 -0
  167. package/dist/eval/expr/compare.d.ts +36 -0
  168. package/dist/eval/expr/compare.d.ts.map +1 -0
  169. package/dist/eval/expr/compare.js +115 -0
  170. package/dist/eval/expr/compare.js.map +1 -0
  171. package/dist/eval/expr/datasets.d.ts +28 -0
  172. package/dist/eval/expr/datasets.d.ts.map +1 -0
  173. package/dist/eval/expr/datasets.js +304 -0
  174. package/dist/eval/expr/datasets.js.map +1 -0
  175. package/dist/eval/expr/digest.d.ts +23 -0
  176. package/dist/eval/expr/digest.d.ts.map +1 -0
  177. package/dist/eval/expr/digest.js +89 -0
  178. package/dist/eval/expr/digest.js.map +1 -0
  179. package/dist/eval/expr/domains.d.ts +19 -0
  180. package/dist/eval/expr/domains.d.ts.map +1 -0
  181. package/dist/eval/expr/domains.js +18 -0
  182. package/dist/eval/expr/domains.js.map +1 -0
  183. package/dist/eval/expr/host.d.ts +152 -0
  184. package/dist/eval/expr/host.d.ts.map +1 -0
  185. package/dist/eval/expr/host.js +36 -0
  186. package/dist/eval/expr/host.js.map +1 -0
  187. package/dist/eval/expr/lists.d.ts +24 -0
  188. package/dist/eval/expr/lists.d.ts.map +1 -0
  189. package/dist/eval/expr/lists.js +155 -0
  190. package/dist/eval/expr/lists.js.map +1 -0
  191. package/dist/eval/expr/member.d.ts +15 -0
  192. package/dist/eval/expr/member.d.ts.map +1 -0
  193. package/dist/eval/expr/member.js +32 -0
  194. package/dist/eval/expr/member.js.map +1 -0
  195. package/dist/eval/expr/money-ops.d.ts +10 -0
  196. package/dist/eval/expr/money-ops.d.ts.map +1 -0
  197. package/dist/eval/expr/money-ops.js +17 -0
  198. package/dist/eval/expr/money-ops.js.map +1 -0
  199. package/dist/eval/expr/operands.d.ts +27 -0
  200. package/dist/eval/expr/operands.d.ts.map +1 -0
  201. package/dist/eval/expr/operands.js +167 -0
  202. package/dist/eval/expr/operands.js.map +1 -0
  203. package/dist/eval/expr/presence.d.ts +27 -0
  204. package/dist/eval/expr/presence.d.ts.map +1 -0
  205. package/dist/eval/expr/presence.js +140 -0
  206. package/dist/eval/expr/presence.js.map +1 -0
  207. package/dist/eval/expr/records.d.ts +22 -0
  208. package/dist/eval/expr/records.d.ts.map +1 -0
  209. package/dist/eval/expr/records.js +101 -0
  210. package/dist/eval/expr/records.js.map +1 -0
  211. package/dist/eval/expr/rule-refs.d.ts +25 -0
  212. package/dist/eval/expr/rule-refs.d.ts.map +1 -0
  213. package/dist/eval/expr/rule-refs.js +60 -0
  214. package/dist/eval/expr/rule-refs.js.map +1 -0
  215. package/dist/eval/expr/sequences.d.ts +26 -0
  216. package/dist/eval/expr/sequences.d.ts.map +1 -0
  217. package/dist/eval/expr/sequences.js +151 -0
  218. package/dist/eval/expr/sequences.js.map +1 -0
  219. package/dist/eval/expr/value.d.ts +99 -0
  220. package/dist/eval/expr/value.d.ts.map +1 -0
  221. package/dist/eval/expr/value.js +14 -0
  222. package/dist/eval/expr/value.js.map +1 -0
  223. package/dist/eval/expression.d.ts +142 -0
  224. package/dist/eval/expression.d.ts.map +1 -0
  225. package/dist/eval/expression.js +446 -0
  226. package/dist/eval/expression.js.map +1 -0
  227. package/dist/eval/firing.d.ts +68 -0
  228. package/dist/eval/firing.d.ts.map +1 -0
  229. package/dist/eval/firing.js +222 -0
  230. package/dist/eval/firing.js.map +1 -0
  231. package/dist/eval/gate.d.ts +110 -0
  232. package/dist/eval/gate.d.ts.map +1 -0
  233. package/dist/eval/gate.js +278 -0
  234. package/dist/eval/gate.js.map +1 -0
  235. package/dist/eval/layout-visibility.d.ts +18 -0
  236. package/dist/eval/layout-visibility.d.ts.map +1 -0
  237. package/dist/eval/layout-visibility.js +61 -0
  238. package/dist/eval/layout-visibility.js.map +1 -0
  239. package/dist/eval/option-availability.d.ts +26 -0
  240. package/dist/eval/option-availability.d.ts.map +1 -0
  241. package/dist/eval/option-availability.js +580 -0
  242. package/dist/eval/option-availability.js.map +1 -0
  243. package/dist/eval/options-boundary.d.ts +15 -0
  244. package/dist/eval/options-boundary.d.ts.map +1 -0
  245. package/dist/eval/options-boundary.js +40 -0
  246. package/dist/eval/options-boundary.js.map +1 -0
  247. package/dist/eval/options.d.ts +99 -0
  248. package/dist/eval/options.d.ts.map +1 -0
  249. package/dist/eval/options.js +96 -0
  250. package/dist/eval/options.js.map +1 -0
  251. package/dist/eval/overrides.d.ts +116 -0
  252. package/dist/eval/overrides.d.ts.map +1 -0
  253. package/dist/eval/overrides.js +176 -0
  254. package/dist/eval/overrides.js.map +1 -0
  255. package/dist/eval/paths.d.ts +25 -0
  256. package/dist/eval/paths.d.ts.map +1 -0
  257. package/dist/eval/paths.js +47 -0
  258. package/dist/eval/paths.js.map +1 -0
  259. package/dist/eval/presentation-reads.d.ts +20 -0
  260. package/dist/eval/presentation-reads.d.ts.map +1 -0
  261. package/dist/eval/presentation-reads.js +2 -0
  262. package/dist/eval/presentation-reads.js.map +1 -0
  263. package/dist/eval/presentation.d.ts +122 -0
  264. package/dist/eval/presentation.d.ts.map +1 -0
  265. package/dist/eval/presentation.js +255 -0
  266. package/dist/eval/presentation.js.map +1 -0
  267. package/dist/eval/reader/context-value.d.ts +41 -0
  268. package/dist/eval/reader/context-value.d.ts.map +1 -0
  269. package/dist/eval/reader/context-value.js +129 -0
  270. package/dist/eval/reader/context-value.js.map +1 -0
  271. package/dist/eval/reader/covered.d.ts +53 -0
  272. package/dist/eval/reader/covered.d.ts.map +1 -0
  273. package/dist/eval/reader/covered.js +139 -0
  274. package/dist/eval/reader/covered.js.map +1 -0
  275. package/dist/eval/reader/declarations.d.ts +182 -0
  276. package/dist/eval/reader/declarations.d.ts.map +1 -0
  277. package/dist/eval/reader/declarations.js +153 -0
  278. package/dist/eval/reader/declarations.js.map +1 -0
  279. package/dist/eval/reader/member-access.d.ts +87 -0
  280. package/dist/eval/reader/member-access.d.ts.map +1 -0
  281. package/dist/eval/reader/member-access.js +212 -0
  282. package/dist/eval/reader/member-access.js.map +1 -0
  283. package/dist/eval/reader/memo.d.ts +34 -0
  284. package/dist/eval/reader/memo.d.ts.map +1 -0
  285. package/dist/eval/reader/memo.js +67 -0
  286. package/dist/eval/reader/memo.js.map +1 -0
  287. package/dist/eval/reader/overlay.d.ts +74 -0
  288. package/dist/eval/reader/overlay.d.ts.map +1 -0
  289. package/dist/eval/reader/overlay.js +365 -0
  290. package/dist/eval/reader/overlay.js.map +1 -0
  291. package/dist/eval/reader/questions.d.ts +37 -0
  292. package/dist/eval/reader/questions.d.ts.map +1 -0
  293. package/dist/eval/reader/questions.js +78 -0
  294. package/dist/eval/reader/questions.js.map +1 -0
  295. package/dist/eval/reader/resolve.d.ts +84 -0
  296. package/dist/eval/reader/resolve.d.ts.map +1 -0
  297. package/dist/eval/reader/resolve.js +310 -0
  298. package/dist/eval/reader/resolve.js.map +1 -0
  299. package/dist/eval/reader/value-read.d.ts +50 -0
  300. package/dist/eval/reader/value-read.d.ts.map +1 -0
  301. package/dist/eval/reader/value-read.js +133 -0
  302. package/dist/eval/reader/value-read.js.map +1 -0
  303. package/dist/eval/reader/withheld.d.ts +48 -0
  304. package/dist/eval/reader/withheld.d.ts.map +1 -0
  305. package/dist/eval/reader/withheld.js +108 -0
  306. package/dist/eval/reader/withheld.js.map +1 -0
  307. package/dist/eval/reader-paths.d.ts +24 -0
  308. package/dist/eval/reader-paths.d.ts.map +1 -0
  309. package/dist/eval/reader-paths.js +23 -0
  310. package/dist/eval/reader-paths.js.map +1 -0
  311. package/dist/eval/reader.d.ts +281 -0
  312. package/dist/eval/reader.d.ts.map +1 -0
  313. package/dist/eval/reader.js +560 -0
  314. package/dist/eval/reader.js.map +1 -0
  315. package/dist/eval/receipt.d.ts +37 -0
  316. package/dist/eval/receipt.d.ts.map +1 -0
  317. package/dist/eval/receipt.js +222 -0
  318. package/dist/eval/receipt.js.map +1 -0
  319. package/dist/eval/report/assemble.d.ts +84 -0
  320. package/dist/eval/report/assemble.d.ts.map +1 -0
  321. package/dist/eval/report/assemble.js +277 -0
  322. package/dist/eval/report/assemble.js.map +1 -0
  323. package/dist/eval/report/fold.d.ts +18 -0
  324. package/dist/eval/report/fold.d.ts.map +1 -0
  325. package/dist/eval/report/fold.js +58 -0
  326. package/dist/eval/report/fold.js.map +1 -0
  327. package/dist/eval/rule/alternatives.d.ts +23 -0
  328. package/dist/eval/rule/alternatives.d.ts.map +1 -0
  329. package/dist/eval/rule/alternatives.js +46 -0
  330. package/dist/eval/rule/alternatives.js.map +1 -0
  331. package/dist/eval/rule/behaviour.d.ts +47 -0
  332. package/dist/eval/rule/behaviour.d.ts.map +1 -0
  333. package/dist/eval/rule/behaviour.js +249 -0
  334. package/dist/eval/rule/behaviour.js.map +1 -0
  335. package/dist/eval/rule/compute.d.ts +46 -0
  336. package/dist/eval/rule/compute.d.ts.map +1 -0
  337. package/dist/eval/rule/compute.js +158 -0
  338. package/dist/eval/rule/compute.js.map +1 -0
  339. package/dist/eval/rule/create-state.d.ts +42 -0
  340. package/dist/eval/rule/create-state.d.ts.map +1 -0
  341. package/dist/eval/rule/create-state.js +134 -0
  342. package/dist/eval/rule/create-state.js.map +1 -0
  343. package/dist/eval/rule/diagnostics.d.ts +24 -0
  344. package/dist/eval/rule/diagnostics.d.ts.map +1 -0
  345. package/dist/eval/rule/diagnostics.js +45 -0
  346. package/dist/eval/rule/diagnostics.js.map +1 -0
  347. package/dist/eval/rule/execution.d.ts +24 -0
  348. package/dist/eval/rule/execution.d.ts.map +1 -0
  349. package/dist/eval/rule/execution.js +495 -0
  350. package/dist/eval/rule/execution.js.map +1 -0
  351. package/dist/eval/rule/gate.d.ts +12 -0
  352. package/dist/eval/rule/gate.d.ts.map +1 -0
  353. package/dist/eval/rule/gate.js +34 -0
  354. package/dist/eval/rule/gate.js.map +1 -0
  355. package/dist/eval/rule/item.d.ts +11 -0
  356. package/dist/eval/rule/item.d.ts.map +1 -0
  357. package/dist/eval/rule/item.js +265 -0
  358. package/dist/eval/rule/item.js.map +1 -0
  359. package/dist/eval/rule/prepare.d.ts +64 -0
  360. package/dist/eval/rule/prepare.d.ts.map +1 -0
  361. package/dist/eval/rule/prepare.js +131 -0
  362. package/dist/eval/rule/prepare.js.map +1 -0
  363. package/dist/eval/rule/result.d.ts +97 -0
  364. package/dist/eval/rule/result.d.ts.map +1 -0
  365. package/dist/eval/rule/result.js +347 -0
  366. package/dist/eval/rule/result.js.map +1 -0
  367. package/dist/eval/rule/runner.d.ts +128 -0
  368. package/dist/eval/rule/runner.d.ts.map +1 -0
  369. package/dist/eval/rule/runner.js +296 -0
  370. package/dist/eval/rule/runner.js.map +1 -0
  371. package/dist/eval/rule/screen.d.ts +32 -0
  372. package/dist/eval/rule/screen.d.ts.map +1 -0
  373. package/dist/eval/rule/screen.js +73 -0
  374. package/dist/eval/rule/screen.js.map +1 -0
  375. package/dist/eval/rule/state.d.ts +137 -0
  376. package/dist/eval/rule/state.d.ts.map +1 -0
  377. package/dist/eval/rule/state.js +2 -0
  378. package/dist/eval/rule/state.js.map +1 -0
  379. package/dist/eval/rule/steps.d.ts +44 -0
  380. package/dist/eval/rule/steps.d.ts.map +1 -0
  381. package/dist/eval/rule/steps.js +367 -0
  382. package/dist/eval/rule/steps.js.map +1 -0
  383. package/dist/eval/rule/visibility.d.ts +18 -0
  384. package/dist/eval/rule/visibility.d.ts.map +1 -0
  385. package/dist/eval/rule/visibility.js +79 -0
  386. package/dist/eval/rule/visibility.js.map +1 -0
  387. package/dist/eval/seal.d.ts +74 -0
  388. package/dist/eval/seal.d.ts.map +1 -0
  389. package/dist/eval/seal.js +154 -0
  390. package/dist/eval/seal.js.map +1 -0
  391. package/dist/eval/signature-coverage.d.ts +19 -0
  392. package/dist/eval/signature-coverage.d.ts.map +1 -0
  393. package/dist/eval/signature-coverage.js +160 -0
  394. package/dist/eval/signature-coverage.js.map +1 -0
  395. package/dist/eval/state/derive.d.ts +72 -0
  396. package/dist/eval/state/derive.d.ts.map +1 -0
  397. package/dist/eval/state/derive.js +61 -0
  398. package/dist/eval/state/derive.js.map +1 -0
  399. package/dist/eval/state/describe.d.ts +18 -0
  400. package/dist/eval/state/describe.d.ts.map +1 -0
  401. package/dist/eval/state/describe.js +19 -0
  402. package/dist/eval/state/describe.js.map +1 -0
  403. package/dist/eval/state/field-state.d.ts +471 -0
  404. package/dist/eval/state/field-state.d.ts.map +1 -0
  405. package/dist/eval/state/field-state.js +1604 -0
  406. package/dist/eval/state/field-state.js.map +1 -0
  407. package/dist/eval/state/measurement.d.ts +136 -0
  408. package/dist/eval/state/measurement.d.ts.map +1 -0
  409. package/dist/eval/state/measurement.js +209 -0
  410. package/dist/eval/state/measurement.js.map +1 -0
  411. package/dist/eval/state/options.d.ts +21 -0
  412. package/dist/eval/state/options.d.ts.map +1 -0
  413. package/dist/eval/state/options.js +3 -0
  414. package/dist/eval/state/options.js.map +1 -0
  415. package/dist/eval/state/readiness.d.ts +400 -0
  416. package/dist/eval/state/readiness.d.ts.map +1 -0
  417. package/dist/eval/state/readiness.js +1067 -0
  418. package/dist/eval/state/readiness.js.map +1 -0
  419. package/dist/eval/state/snapshot.d.ts +130 -0
  420. package/dist/eval/state/snapshot.d.ts.map +1 -0
  421. package/dist/eval/state/snapshot.js +35 -0
  422. package/dist/eval/state/snapshot.js.map +1 -0
  423. package/dist/eval/state/unavailable-options.d.ts +54 -0
  424. package/dist/eval/state/unavailable-options.d.ts.map +1 -0
  425. package/dist/eval/state/unavailable-options.js +82 -0
  426. package/dist/eval/state/unavailable-options.js.map +1 -0
  427. package/dist/eval/state/value-state.d.ts +38 -0
  428. package/dist/eval/state/value-state.d.ts.map +1 -0
  429. package/dist/eval/state/value-state.js +52 -0
  430. package/dist/eval/state/value-state.js.map +1 -0
  431. package/dist/eval/submission/admission.d.ts +50 -0
  432. package/dist/eval/submission/admission.d.ts.map +1 -0
  433. package/dist/eval/submission/admission.js +174 -0
  434. package/dist/eval/submission/admission.js.map +1 -0
  435. package/dist/eval/submission/authority.d.ts +71 -0
  436. package/dist/eval/submission/authority.d.ts.map +1 -0
  437. package/dist/eval/submission/authority.js +118 -0
  438. package/dist/eval/submission/authority.js.map +1 -0
  439. package/dist/eval/submission/datasets.d.ts +28 -0
  440. package/dist/eval/submission/datasets.d.ts.map +1 -0
  441. package/dist/eval/submission/datasets.js +109 -0
  442. package/dist/eval/submission/datasets.js.map +1 -0
  443. package/dist/eval/submission/index.d.ts +15 -0
  444. package/dist/eval/submission/index.d.ts.map +1 -0
  445. package/dist/eval/submission/index.js +13 -0
  446. package/dist/eval/submission/index.js.map +1 -0
  447. package/dist/eval/submission/refusals.d.ts +103 -0
  448. package/dist/eval/submission/refusals.d.ts.map +1 -0
  449. package/dist/eval/submission/refusals.js +15 -0
  450. package/dist/eval/submission/refusals.js.map +1 -0
  451. package/dist/eval/submission/signatures.d.ts +7 -0
  452. package/dist/eval/submission/signatures.d.ts.map +1 -0
  453. package/dist/eval/submission/signatures.js +215 -0
  454. package/dist/eval/submission/signatures.js.map +1 -0
  455. package/dist/eval/submission/writes.d.ts +51 -0
  456. package/dist/eval/submission/writes.d.ts.map +1 -0
  457. package/dist/eval/submission/writes.js +203 -0
  458. package/dist/eval/submission/writes.js.map +1 -0
  459. package/dist/eval/submission.d.ts +53 -0
  460. package/dist/eval/submission.d.ts.map +1 -0
  461. package/dist/eval/submission.js +521 -0
  462. package/dist/eval/submission.js.map +1 -0
  463. package/dist/eval/suggestions-to-engine.d.ts +18 -0
  464. package/dist/eval/suggestions-to-engine.d.ts.map +1 -0
  465. package/dist/eval/suggestions-to-engine.js +40 -0
  466. package/dist/eval/suggestions-to-engine.js.map +1 -0
  467. package/dist/eval/suggestions.d.ts +17 -0
  468. package/dist/eval/suggestions.d.ts.map +1 -0
  469. package/dist/eval/suggestions.js +314 -0
  470. package/dist/eval/suggestions.js.map +1 -0
  471. package/dist/eval/undecided.d.ts +64 -0
  472. package/dist/eval/undecided.d.ts.map +1 -0
  473. package/dist/eval/undecided.js +101 -0
  474. package/dist/eval/undecided.js.map +1 -0
  475. package/dist/eval/verdict.d.ts +66 -0
  476. package/dist/eval/verdict.d.ts.map +1 -0
  477. package/dist/eval/verdict.js +106 -0
  478. package/dist/eval/verdict.js.map +1 -0
  479. package/dist/eval/verify-signature.d.ts +78 -0
  480. package/dist/eval/verify-signature.d.ts.map +1 -0
  481. package/dist/eval/verify-signature.js +185 -0
  482. package/dist/eval/verify-signature.js.map +1 -0
  483. package/dist/eval/version-dispatch.d.ts +38 -0
  484. package/dist/eval/version-dispatch.d.ts.map +1 -0
  485. package/dist/eval/version-dispatch.js +61 -0
  486. package/dist/eval/version-dispatch.js.map +1 -0
  487. package/dist/eval/visibility.d.ts +33 -0
  488. package/dist/eval/visibility.d.ts.map +1 -0
  489. package/dist/eval/visibility.js +83 -0
  490. package/dist/eval/visibility.js.map +1 -0
  491. package/dist/evaluate.d.ts +24 -0
  492. package/dist/evaluate.d.ts.map +1 -0
  493. package/dist/evaluate.js +18 -0
  494. package/dist/evaluate.js.map +1 -0
  495. package/dist/expr/builtin-docs.d.ts +51 -0
  496. package/dist/expr/builtin-docs.d.ts.map +1 -0
  497. package/dist/expr/builtin-docs.js +874 -0
  498. package/dist/expr/builtin-docs.js.map +1 -0
  499. package/dist/expr/builtins.d.ts +50 -0
  500. package/dist/expr/builtins.d.ts.map +1 -0
  501. package/dist/expr/builtins.js +966 -0
  502. package/dist/expr/builtins.js.map +1 -0
  503. package/dist/expr/decimal-precision.d.ts +39 -0
  504. package/dist/expr/decimal-precision.d.ts.map +1 -0
  505. package/dist/expr/decimal-precision.js +62 -0
  506. package/dist/expr/decimal-precision.js.map +1 -0
  507. package/dist/expr/decimal.d.ts +172 -0
  508. package/dist/expr/decimal.d.ts.map +1 -0
  509. package/dist/expr/decimal.js +782 -0
  510. package/dist/expr/decimal.js.map +1 -0
  511. package/dist/expr/deprecations.d.ts +34 -0
  512. package/dist/expr/deprecations.d.ts.map +1 -0
  513. package/dist/expr/deprecations.js +17 -0
  514. package/dist/expr/deprecations.js.map +1 -0
  515. package/dist/expr/diagnostics.d.ts +21 -0
  516. package/dist/expr/diagnostics.d.ts.map +1 -0
  517. package/dist/expr/diagnostics.js +231 -0
  518. package/dist/expr/diagnostics.js.map +1 -0
  519. package/dist/expr/direction.d.ts +30 -0
  520. package/dist/expr/direction.d.ts.map +1 -0
  521. package/dist/expr/direction.js +77 -0
  522. package/dist/expr/direction.js.map +1 -0
  523. package/dist/expr/example-expression.d.ts +62 -0
  524. package/dist/expr/example-expression.d.ts.map +1 -0
  525. package/dist/expr/example-expression.js +670 -0
  526. package/dist/expr/example-expression.js.map +1 -0
  527. package/dist/expr/instant.d.ts +49 -0
  528. package/dist/expr/instant.d.ts.map +1 -0
  529. package/dist/expr/instant.js +111 -0
  530. package/dist/expr/instant.js.map +1 -0
  531. package/dist/expr/logic.d.ts +17 -0
  532. package/dist/expr/logic.d.ts.map +1 -0
  533. package/dist/expr/logic.js +65 -0
  534. package/dist/expr/logic.js.map +1 -0
  535. package/dist/expr/messages.d.ts +45 -0
  536. package/dist/expr/messages.d.ts.map +1 -0
  537. package/dist/expr/messages.js +280 -0
  538. package/dist/expr/messages.js.map +1 -0
  539. package/dist/expr/money.d.ts +38 -0
  540. package/dist/expr/money.d.ts.map +1 -0
  541. package/dist/expr/money.js +127 -0
  542. package/dist/expr/money.js.map +1 -0
  543. package/dist/expr/ordering.d.ts +56 -0
  544. package/dist/expr/ordering.d.ts.map +1 -0
  545. package/dist/expr/ordering.js +167 -0
  546. package/dist/expr/ordering.js.map +1 -0
  547. package/dist/expr/pattern.d.ts +44 -0
  548. package/dist/expr/pattern.d.ts.map +1 -0
  549. package/dist/expr/pattern.js +458 -0
  550. package/dist/expr/pattern.js.map +1 -0
  551. package/dist/expr/plain-date.d.ts +90 -0
  552. package/dist/expr/plain-date.d.ts.map +1 -0
  553. package/dist/expr/plain-date.js +230 -0
  554. package/dist/expr/plain-date.js.map +1 -0
  555. package/dist/expr/plural-categories.d.ts +8 -0
  556. package/dist/expr/plural-categories.d.ts.map +1 -0
  557. package/dist/expr/plural-categories.js +15 -0
  558. package/dist/expr/plural-categories.js.map +1 -0
  559. package/dist/expr/plural-keys.d.ts +39 -0
  560. package/dist/expr/plural-keys.d.ts.map +1 -0
  561. package/dist/expr/plural-keys.js +46 -0
  562. package/dist/expr/plural-keys.js.map +1 -0
  563. package/dist/expr/plural.d.ts +33 -0
  564. package/dist/expr/plural.d.ts.map +1 -0
  565. package/dist/expr/plural.js +50 -0
  566. package/dist/expr/plural.js.map +1 -0
  567. package/dist/expr/quantity.d.ts +31 -0
  568. package/dist/expr/quantity.d.ts.map +1 -0
  569. package/dist/expr/quantity.js +83 -0
  570. package/dist/expr/quantity.js.map +1 -0
  571. package/dist/expr/reduce.d.ts +50 -0
  572. package/dist/expr/reduce.d.ts.map +1 -0
  573. package/dist/expr/reduce.js +236 -0
  574. package/dist/expr/reduce.js.map +1 -0
  575. package/dist/expr/regex.d.ts +108 -0
  576. package/dist/expr/regex.d.ts.map +1 -0
  577. package/dist/expr/regex.js +1210 -0
  578. package/dist/expr/regex.js.map +1 -0
  579. package/dist/expr/select-locale.d.ts +67 -0
  580. package/dist/expr/select-locale.d.ts.map +1 -0
  581. package/dist/expr/select-locale.js +219 -0
  582. package/dist/expr/select-locale.js.map +1 -0
  583. package/dist/expr/sequences.d.ts +123 -0
  584. package/dist/expr/sequences.d.ts.map +1 -0
  585. package/dist/expr/sequences.js +234 -0
  586. package/dist/expr/sequences.js.map +1 -0
  587. package/dist/expr/strings.d.ts +50 -0
  588. package/dist/expr/strings.d.ts.map +1 -0
  589. package/dist/expr/strings.js +184 -0
  590. package/dist/expr/strings.js.map +1 -0
  591. package/dist/expr/validation.d.ts +32 -0
  592. package/dist/expr/validation.d.ts.map +1 -0
  593. package/dist/expr/validation.js +182 -0
  594. package/dist/expr/validation.js.map +1 -0
  595. package/dist/graph/freeze.d.ts +4 -0
  596. package/dist/graph/freeze.d.ts.map +1 -0
  597. package/dist/graph/freeze.js +52 -0
  598. package/dist/graph/freeze.js.map +1 -0
  599. package/dist/graph/index.d.ts +15 -0
  600. package/dist/graph/index.d.ts.map +1 -0
  601. package/dist/graph/index.js +13 -0
  602. package/dist/graph/index.js.map +1 -0
  603. package/dist/graph/inspect.d.ts +76 -0
  604. package/dist/graph/inspect.d.ts.map +1 -0
  605. package/dist/graph/inspect.js +263 -0
  606. package/dist/graph/inspect.js.map +1 -0
  607. package/dist/graph/read-walk.d.ts +101 -0
  608. package/dist/graph/read-walk.d.ts.map +1 -0
  609. package/dist/graph/read-walk.js +358 -0
  610. package/dist/graph/read-walk.js.map +1 -0
  611. package/dist/graph/record-index.d.ts +24 -0
  612. package/dist/graph/record-index.d.ts.map +1 -0
  613. package/dist/graph/record-index.js +35 -0
  614. package/dist/graph/record-index.js.map +1 -0
  615. package/dist/index.d.ts +104 -0
  616. package/dist/index.d.ts.map +1 -0
  617. package/dist/index.js +139 -0
  618. package/dist/index.js.map +1 -0
  619. package/dist/lookup/digest.d.ts +51 -0
  620. package/dist/lookup/digest.d.ts.map +1 -0
  621. package/dist/lookup/digest.js +46 -0
  622. package/dist/lookup/digest.js.map +1 -0
  623. package/dist/lookup/index.d.ts +28 -0
  624. package/dist/lookup/index.d.ts.map +1 -0
  625. package/dist/lookup/index.js +27 -0
  626. package/dist/lookup/index.js.map +1 -0
  627. package/dist/lookup/install.d.ts +48 -0
  628. package/dist/lookup/install.d.ts.map +1 -0
  629. package/dist/lookup/install.js +315 -0
  630. package/dist/lookup/install.js.map +1 -0
  631. package/dist/lookup/pass.d.ts +55 -0
  632. package/dist/lookup/pass.d.ts.map +1 -0
  633. package/dist/lookup/pass.js +212 -0
  634. package/dist/lookup/pass.js.map +1 -0
  635. package/dist/lookup/pins.d.ts +34 -0
  636. package/dist/lookup/pins.d.ts.map +1 -0
  637. package/dist/lookup/pins.js +39 -0
  638. package/dist/lookup/pins.js.map +1 -0
  639. package/dist/lookup/provenance.d.ts +23 -0
  640. package/dist/lookup/provenance.d.ts.map +1 -0
  641. package/dist/lookup/provenance.js +78 -0
  642. package/dist/lookup/provenance.js.map +1 -0
  643. package/dist/lookup/readiness.d.ts +13 -0
  644. package/dist/lookup/readiness.d.ts.map +1 -0
  645. package/dist/lookup/readiness.js +57 -0
  646. package/dist/lookup/readiness.js.map +1 -0
  647. package/dist/lookup/resolve.d.ts +24 -0
  648. package/dist/lookup/resolve.d.ts.map +1 -0
  649. package/dist/lookup/resolve.js +201 -0
  650. package/dist/lookup/resolve.js.map +1 -0
  651. package/dist/lookup/store.d.ts +41 -0
  652. package/dist/lookup/store.d.ts.map +1 -0
  653. package/dist/lookup/store.js +74 -0
  654. package/dist/lookup/store.js.map +1 -0
  655. package/dist/model/access.d.ts +200 -0
  656. package/dist/model/access.d.ts.map +1 -0
  657. package/dist/model/access.js +125 -0
  658. package/dist/model/access.js.map +1 -0
  659. package/dist/model/artifact-members.d.ts +3 -0
  660. package/dist/model/artifact-members.d.ts.map +1 -0
  661. package/dist/model/artifact-members.js +38 -0
  662. package/dist/model/artifact-members.js.map +1 -0
  663. package/dist/model/composition.d.ts +47 -0
  664. package/dist/model/composition.d.ts.map +1 -0
  665. package/dist/model/composition.js +66 -0
  666. package/dist/model/composition.js.map +1 -0
  667. package/dist/model/domain.d.ts +51 -0
  668. package/dist/model/domain.d.ts.map +1 -0
  669. package/dist/model/domain.js +75 -0
  670. package/dist/model/domain.js.map +1 -0
  671. package/dist/model/duration.d.ts +31 -0
  672. package/dist/model/duration.d.ts.map +1 -0
  673. package/dist/model/duration.js +136 -0
  674. package/dist/model/duration.js.map +1 -0
  675. package/dist/model/errors.d.ts +58 -0
  676. package/dist/model/errors.d.ts.map +1 -0
  677. package/dist/model/errors.js +81 -0
  678. package/dist/model/errors.js.map +1 -0
  679. package/dist/model/evolution.d.ts +177 -0
  680. package/dist/model/evolution.d.ts.map +1 -0
  681. package/dist/model/evolution.js +5 -0
  682. package/dist/model/evolution.js.map +1 -0
  683. package/dist/model/expr-children.d.ts +15 -0
  684. package/dist/model/expr-children.d.ts.map +1 -0
  685. package/dist/model/expr-children.js +45 -0
  686. package/dist/model/expr-children.js.map +1 -0
  687. package/dist/model/guards.d.ts +9 -0
  688. package/dist/model/guards.d.ts.map +1 -0
  689. package/dist/model/guards.js +11 -0
  690. package/dist/model/guards.js.map +1 -0
  691. package/dist/model/input.d.ts +42 -0
  692. package/dist/model/input.d.ts.map +1 -0
  693. package/dist/model/input.js +26 -0
  694. package/dist/model/input.js.map +1 -0
  695. package/dist/model/integer.d.ts +14 -0
  696. package/dist/model/integer.d.ts.map +1 -0
  697. package/dist/model/integer.js +16 -0
  698. package/dist/model/integer.js.map +1 -0
  699. package/dist/model/intrinsic.d.ts +18 -0
  700. package/dist/model/intrinsic.d.ts.map +1 -0
  701. package/dist/model/intrinsic.js +21 -0
  702. package/dist/model/intrinsic.js.map +1 -0
  703. package/dist/model/layout.d.ts +129 -0
  704. package/dist/model/layout.d.ts.map +1 -0
  705. package/dist/model/layout.js +2 -0
  706. package/dist/model/layout.js.map +1 -0
  707. package/dist/model/media.d.ts +33 -0
  708. package/dist/model/media.d.ts.map +1 -0
  709. package/dist/model/media.js +86 -0
  710. package/dist/model/media.js.map +1 -0
  711. package/dist/model/members.generated.d.ts +11 -0
  712. package/dist/model/members.generated.d.ts.map +1 -0
  713. package/dist/model/members.generated.js +71 -0
  714. package/dist/model/members.generated.js.map +1 -0
  715. package/dist/model/row-address.d.ts +27 -0
  716. package/dist/model/row-address.d.ts.map +1 -0
  717. package/dist/model/row-address.js +146 -0
  718. package/dist/model/row-address.js.map +1 -0
  719. package/dist/model/schema.d.ts +108 -0
  720. package/dist/model/schema.d.ts.map +1 -0
  721. package/dist/model/schema.js +2 -0
  722. package/dist/model/schema.js.map +1 -0
  723. package/dist/model/shape.d.ts +193 -0
  724. package/dist/model/shape.d.ts.map +1 -0
  725. package/dist/model/shape.js +2 -0
  726. package/dist/model/shape.js.map +1 -0
  727. package/dist/model/time.d.ts +61 -0
  728. package/dist/model/time.d.ts.map +1 -0
  729. package/dist/model/time.js +110 -0
  730. package/dist/model/time.js.map +1 -0
  731. package/dist/model/types.d.ts +1329 -0
  732. package/dist/model/types.d.ts.map +1 -0
  733. package/dist/model/types.js +424 -0
  734. package/dist/model/types.js.map +1 -0
  735. package/dist/model/values.d.ts +91 -0
  736. package/dist/model/values.d.ts.map +1 -0
  737. package/dist/model/values.js +195 -0
  738. package/dist/model/values.js.map +1 -0
  739. package/dist/model/wire.d.ts +356 -0
  740. package/dist/model/wire.d.ts.map +1 -0
  741. package/dist/model/wire.js +1504 -0
  742. package/dist/model/wire.js.map +1 -0
  743. package/dist/offline/index.d.ts +374 -0
  744. package/dist/offline/index.d.ts.map +1 -0
  745. package/dist/offline/index.js +422 -0
  746. package/dist/offline/index.js.map +1 -0
  747. package/dist/testing.d.ts +30 -0
  748. package/dist/testing.d.ts.map +1 -0
  749. package/dist/testing.js +42 -0
  750. package/dist/testing.js.map +1 -0
  751. package/dist/version.d.ts +30 -0
  752. package/dist/version.d.ts.map +1 -0
  753. package/dist/version.js +116 -0
  754. package/dist/version.js.map +1 -0
  755. package/package.json +98 -3
@@ -0,0 +1,167 @@
1
+ import { AxiomError } from '../../model/errors.js';
2
+ import { DEFERRED, isUndetermined, UNKNOWN } from '../../model/types.js';
3
+ import { isWireArray } from '../../model/values.js';
4
+ import { compareOrdered, valuesEqual } from './compare.js';
5
+ import { valueOf } from './value.js';
6
+ /**
7
+ * The fixed result domain of a built-in whose result type does not depend on its
8
+ * operands. A type-parameterised built-in (`min`,
9
+ * `max`, `least`, `greatest`, `lookup`, `decide`) has no such entry, so its result stays
10
+ * undomained until an operand declares what it is; spelling never supplies the answer.
11
+ */
12
+ const RESULT_DOMAINS = {
13
+ to_decimal: 'decimal',
14
+ parse_integer: 'integer',
15
+ parse_decimal: 'decimal',
16
+ round: 'decimal',
17
+ round_up: 'decimal',
18
+ round_down: 'decimal',
19
+ round_even: 'decimal',
20
+ '%': 'integer',
21
+ '//': 'integer',
22
+ money_minor: 'decimal',
23
+ len: 'integer',
24
+ count_where: 'integer',
25
+ days_between: 'integer',
26
+ months_between: 'integer',
27
+ minutes_between: 'integer',
28
+ money_scale: 'integer',
29
+ index_of: 'integer',
30
+ ceil: 'integer',
31
+ floor: 'integer',
32
+ year: 'integer',
33
+ month: 'integer',
34
+ day: 'integer',
35
+ weekday: 'integer',
36
+ lower: 'string',
37
+ upper: 'string',
38
+ trim: 'string',
39
+ to_string: 'string',
40
+ money_currency: 'string',
41
+ digest: 'string',
42
+ replace: 'string',
43
+ substring: 'string',
44
+ join: 'string',
45
+ concat: 'string',
46
+ starts_with: 'boolean',
47
+ ends_with: 'boolean',
48
+ contains: 'boolean',
49
+ ascii_match: 'boolean',
50
+ is_email: 'boolean',
51
+ is_phone: 'boolean',
52
+ is_url: 'boolean',
53
+ matches: 'boolean',
54
+ in: 'boolean',
55
+ is_unique: 'boolean',
56
+ all: 'boolean',
57
+ any: 'boolean',
58
+ present: 'boolean',
59
+ absent: 'boolean',
60
+ empty: 'boolean',
61
+ is_relevant: 'boolean',
62
+ in_set: 'boolean',
63
+ has_cap: 'boolean',
64
+ rule_ok: 'boolean',
65
+ no_blocking: 'boolean',
66
+ money_from_minor: 'money',
67
+ add_days: 'date',
68
+ add_months: 'date',
69
+ add_years: 'date',
70
+ add_minutes: 'instant',
71
+ start_of_day: 'instant',
72
+ civil_date: 'date',
73
+ parse_date: 'date',
74
+ parse_instant: 'instant',
75
+ };
76
+ /** The fixed result domain of one built-in, or `undefined` when it depends on its operands. */
77
+ export function resultDomain(op) {
78
+ return RESULT_DOMAINS[op];
79
+ }
80
+ /**
81
+ * Folds one undetermined member into the membership's pending answer: `UNKNOWN` wins over
82
+ * `DEFERRED`, so a member this device genuinely cannot decide is never
83
+ * reported as a value computed elsewhere.
84
+ */
85
+ export function foldUndetermined(pending, next) {
86
+ return pending === undefined || next === UNKNOWN ? next : pending;
87
+ }
88
+ /**
89
+ * The undetermined operand that decides a strict operation: `UNKNOWN`
90
+ * wins over `DEFERRED`, and an absent read is `UNKNOWN` — a missing local reading is
91
+ * never reported as a value computed elsewhere. The winning operand is returned as it
92
+ * was evaluated, so the domain the artifact pinned for it travels with it.
93
+ */
94
+ export function undeterminedOperand(operands) {
95
+ let deferred;
96
+ for (const operand of operands) {
97
+ if (operand.kind === 'absent')
98
+ return valueOf(UNKNOWN);
99
+ if (!isUndetermined(operand.value))
100
+ continue;
101
+ if (operand.value.undetermined === 'UNKNOWN')
102
+ return operand;
103
+ deferred ??= operand;
104
+ }
105
+ return deferred;
106
+ }
107
+ /** A resolved, decided operand: the fold above has already taken every other state. */
108
+ export function isDecidedValue(operand) {
109
+ return operand.kind === 'value' && !isUndetermined(operand.value);
110
+ }
111
+ /** Whether `op` orders two operands: ordering has no `null` case. */
112
+ export function isOrderingOperator(op) {
113
+ return op === '<' || op === '<=' || op === '>' || op === '>=';
114
+ }
115
+ /** One comparison's boolean answer under the equality and ordering rules. */
116
+ export function compareValues(op, left, right, path) {
117
+ switch (op) {
118
+ case '==':
119
+ return valuesEqual(left, right, path);
120
+ case '!=':
121
+ return !valuesEqual(left, right, path);
122
+ case 'in': {
123
+ // `in` is infix-only. A list value keeps the member domains its producer attached, so
124
+ // each member is compared with the domain declaration it was read under; an open list
125
+ // attaches none and its members are no domain's value. The equality rule still holds
126
+ // across `integer`/`decimal`, which is why a member is compared with `valuesEqual`
127
+ // rather than wire equality. A list literal is answered by `evalMembership`.
128
+ if (!isWireArray(right.value)) {
129
+ throw new AxiomError('ENGINE_ERROR', 'in requires a list as its right operand', path);
130
+ }
131
+ return right.value.some((element, index) => valuesEqual(left, valueOf(element, right.elementDomains?.[index]), path));
132
+ }
133
+ case '<':
134
+ case '<=':
135
+ case '>':
136
+ case '>=': {
137
+ const order = compareOrdered(left, right, path);
138
+ if (order === undefined) {
139
+ throw new AxiomError('ENGINE_ERROR', `operands of ${op} are not comparable`, path);
140
+ }
141
+ switch (op) {
142
+ case '<':
143
+ return order < 0;
144
+ case '<=':
145
+ return order <= 0;
146
+ case '>':
147
+ return order > 0;
148
+ case '>=':
149
+ return order >= 0;
150
+ }
151
+ }
152
+ }
153
+ }
154
+ /** The boolean a decided outcome stands for, or the sentinel itself. */
155
+ export function outcomeToValue(outcome) {
156
+ switch (outcome) {
157
+ case 'PASS':
158
+ return true;
159
+ case 'FAIL':
160
+ return false;
161
+ case 'UNKNOWN':
162
+ return UNKNOWN;
163
+ case 'DEFERRED':
164
+ return DEFERRED;
165
+ }
166
+ }
167
+ //# sourceMappingURL=operands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operands.js","sourceRoot":"","sources":["../../../src/eval/expr/operands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAQnD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC;;;;;GAKG;AACH,MAAM,cAAc,GAAiD;IACnE,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,SAAS;IACxB,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,SAAS;IACnB,UAAU,EA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GAAG;oBACN,OAAO,KAAK,GAAG,CAAC,CAAC;gBACnB,KAAK,IAAI;oBACP,OAAO,KAAK,IAAI,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,MAAM;YACT,OAAO,IAAI,CAAC;QACd,KAAK,MAAM;YACT,OAAO,KAAK,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC","sourcesContent":["import { AxiomError } from '../../model/errors.js';\nimport type {\n ComparisonOperator,\n ExprOperator,\n LiteralDomain,\n Outcome,\n Undetermined,\n} from '../../model/types.js';\nimport { DEFERRED, isUndetermined, UNKNOWN } from '../../model/types.js';\nimport { isWireArray } from '../../model/values.js';\nimport type { RuntimeValue } from '../../expr/builtins.js';\nimport { compareOrdered, valuesEqual } from './compare.js';\nimport { valueOf } from './value.js';\nimport type { Evaluated, EvaluatedValue } from './value.js';\n\n/**\n * The fixed result domain of a built-in whose result type does not depend on its\n * operands. A type-parameterised built-in (`min`,\n * `max`, `least`, `greatest`, `lookup`, `decide`) has no such entry, so its result stays\n * undomained until an operand declares what it is; spelling never supplies the answer.\n */\nconst RESULT_DOMAINS: Partial<Record<ExprOperator, LiteralDomain>> = {\n to_decimal: 'decimal',\n parse_integer: 'integer',\n parse_decimal: 'decimal',\n round: 'decimal',\n round_up: 'decimal',\n round_down: 'decimal',\n round_even: 'decimal',\n '%': 'integer',\n '//': 'integer',\n money_minor: 'decimal',\n len: 'integer',\n count_where: 'integer',\n days_between: 'integer',\n months_between: 'integer',\n minutes_between: 'integer',\n money_scale: 'integer',\n index_of: 'integer',\n ceil: 'integer',\n floor: 'integer',\n year: 'integer',\n month: 'integer',\n day: 'integer',\n weekday: 'integer',\n lower: 'string',\n upper: 'string',\n trim: 'string',\n to_string: 'string',\n money_currency: 'string',\n digest: 'string',\n replace: 'string',\n substring: 'string',\n join: 'string',\n concat: 'string',\n starts_with: 'boolean',\n ends_with: 'boolean',\n contains: 'boolean',\n ascii_match: 'boolean',\n is_email: 'boolean',\n is_phone: 'boolean',\n is_url: 'boolean',\n matches: 'boolean',\n in: 'boolean',\n is_unique: 'boolean',\n all: 'boolean',\n any: 'boolean',\n present: 'boolean',\n absent: 'boolean',\n empty: 'boolean',\n is_relevant: 'boolean',\n in_set: 'boolean',\n has_cap: 'boolean',\n rule_ok: 'boolean',\n no_blocking: 'boolean',\n money_from_minor: 'money',\n add_days: 'date',\n add_months: 'date',\n add_years: 'date',\n add_minutes: 'instant',\n start_of_day: 'instant',\n civil_date: 'date',\n parse_date: 'date',\n parse_instant: 'instant',\n};\n\n/** The fixed result domain of one built-in, or `undefined` when it depends on its operands. */\nexport function resultDomain(op: ExprOperator): LiteralDomain | undefined {\n return RESULT_DOMAINS[op];\n}\n\n/**\n * Folds one undetermined member into the membership's pending answer: `UNKNOWN` wins over\n * `DEFERRED`, so a member this device genuinely cannot decide is never\n * reported as a value computed elsewhere.\n */\nexport function foldUndetermined(\n pending: Undetermined | undefined,\n next: Undetermined,\n): Undetermined {\n return pending === undefined || next === UNKNOWN ? next : pending;\n}\n\n/**\n * The undetermined operand that decides a strict operation: `UNKNOWN`\n * wins over `DEFERRED`, and an absent read is `UNKNOWN` — a missing local reading is\n * never reported as a value computed elsewhere. The winning operand is returned as it\n * was evaluated, so the domain the artifact pinned for it travels with it.\n */\nexport function undeterminedOperand(operands: readonly Evaluated[]): Evaluated | undefined {\n let deferred: EvaluatedValue | undefined;\n for (const operand of operands) {\n if (operand.kind === 'absent') return valueOf(UNKNOWN);\n if (!isUndetermined(operand.value)) continue;\n if (operand.value.undetermined === 'UNKNOWN') return operand;\n deferred ??= operand;\n }\n return deferred;\n}\n\n/** A resolved, decided operand: the fold above has already taken every other state. */\nexport function isDecidedValue(operand: Evaluated): operand is EvaluatedValue {\n return operand.kind === 'value' && !isUndetermined(operand.value);\n}\n\n/** Whether `op` orders two operands: ordering has no `null` case. */\nexport function isOrderingOperator(op: ComparisonOperator): boolean {\n return op === '<' || op === '<=' || op === '>' || op === '>=';\n}\n\n/** One comparison's boolean answer under the equality and ordering rules. */\nexport function compareValues(\n op: ComparisonOperator,\n left: EvaluatedValue,\n right: EvaluatedValue,\n path: string,\n): boolean {\n switch (op) {\n case '==':\n return valuesEqual(left, right, path);\n case '!=':\n return !valuesEqual(left, right, path);\n case 'in': {\n // `in` is infix-only. A list value keeps the member domains its producer attached, so\n // each member is compared with the domain declaration it was read under; an open list\n // attaches none and its members are no domain's value. The equality rule still holds\n // across `integer`/`decimal`, which is why a member is compared with `valuesEqual`\n // rather than wire equality. A list literal is answered by `evalMembership`.\n if (!isWireArray(right.value)) {\n throw new AxiomError('ENGINE_ERROR', 'in requires a list as its right operand', path);\n }\n return right.value.some((element, index) =>\n valuesEqual(left, valueOf(element, right.elementDomains?.[index]), path),\n );\n }\n case '<':\n case '<=':\n case '>':\n case '>=': {\n const order = compareOrdered(left, right, path);\n if (order === undefined) {\n throw new AxiomError('ENGINE_ERROR', `operands of ${op} are not comparable`, path);\n }\n switch (op) {\n case '<':\n return order < 0;\n case '<=':\n return order <= 0;\n case '>':\n return order > 0;\n case '>=':\n return order >= 0;\n }\n }\n }\n}\n\n/** The boolean a decided outcome stands for, or the sentinel itself. */\nexport function outcomeToValue(outcome: Outcome): RuntimeValue {\n switch (outcome) {\n case 'PASS':\n return true;\n case 'FAIL':\n return false;\n case 'UNKNOWN':\n return UNKNOWN;\n case 'DEFERRED':\n return DEFERRED;\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import type { ExprNode } from '../../model/types.js';
2
+ import type { BinderPaths } from '../paths.js';
3
+ import type { BinderScope } from './binder.js';
4
+ import type { ExpressionHost } from './host.js';
5
+ import type { Evaluated } from './value.js';
6
+ /** The evaluator operations presence, relevance and capability questions need. */
7
+ export interface PresenceContext {
8
+ readonly host: ExpressionHost;
9
+ readonly scopes: BinderScope[];
10
+ readonly paths: BinderPaths;
11
+ evaluate(node: ExprNode): Evaluated;
12
+ }
13
+ /**
14
+ * A presence or relevance question reads metadata, never the value:
15
+ * its operand is a path the compiler has already checked, and the host answers the
16
+ * question the contract asks rather than a value question that would look the same.
17
+ */
18
+ export declare function presenceCall(context: PresenceContext, op: 'present' | 'absent' | 'empty' | 'is_relevant', args: readonly ExprNode[]): Evaluated;
19
+ /**
20
+ * `empty(x)`: a path answers absence from presence, which is the only place absence is directly
21
+ * observable, and content from the value it holds; every other expression answers from the value
22
+ * it produced, through the same seam every value built-in uses.
23
+ */
24
+ export declare function emptyCall(context: PresenceContext, args: readonly ExprNode[]): Evaluated;
25
+ /** `has_cap`: a capability flag, never an authorisation decision. */
26
+ export declare function capabilityCall(context: PresenceContext, args: readonly ExprNode[]): Evaluated;
27
+ //# sourceMappingURL=presence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../../../src/eval/expr/presence.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAG/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,YAAY,CAAC;AAEtD,kFAAkF;AAClF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,eAAe,EACxB,EAAE,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,EAClD,IAAI,EAAE,SAAS,QAAQ,EAAE,GACxB,SAAS,CAeX;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,CAcxF;AAyED,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,CAY7F"}
@@ -0,0 +1,140 @@
1
+ import { AxiomError } from '../../model/errors.js';
2
+ import { DEFERRED, isUndetermined, UNKNOWN } from '../../model/types.js';
3
+ import { applyBuiltin } from '../../expr/builtins.js';
4
+ import { readScoped, scopeFor } from './binder.js';
5
+ import { valueOf } from './value.js';
6
+ /**
7
+ * A presence or relevance question reads metadata, never the value:
8
+ * its operand is a path the compiler has already checked, and the host answers the
9
+ * question the contract asks rather than a value question that would look the same.
10
+ */
11
+ export function presenceCall(context, op, args) {
12
+ const [arg] = args;
13
+ if (args.length !== 1 || arg === undefined || arg.kind !== 'path') {
14
+ throw new AxiomError('ENGINE_ERROR', `${op} requires exactly one path operand`);
15
+ }
16
+ if (op === 'is_relevant') {
17
+ return valueOf(isRelevantPath(context, arg.path), 'boolean');
18
+ }
19
+ const presence = presenceOf(context, arg.path);
20
+ if (op === 'empty')
21
+ return emptiness(context, arg, presence);
22
+ // `present`/`absent` are boolean questions and never undetermined (`EXPR-9.1.4`,
23
+ // `EXPR-9.1.5`). Only a genuinely absent path answers `absent` true; a redacted,
24
+ // unreadable or undetermined path answers false to both, so neither can be confirmed.
25
+ if (op === 'present')
26
+ return valueOf(presence === 'present', 'boolean');
27
+ return valueOf(presence === 'absent', 'boolean');
28
+ }
29
+ /**
30
+ * `empty(x)`: a path answers absence from presence, which is the only place absence is directly
31
+ * observable, and content from the value it holds; every other expression answers from the value
32
+ * it produced, through the same seam every value built-in uses.
33
+ */
34
+ export function emptyCall(context, args) {
35
+ const [operand] = args;
36
+ if (args.length !== 1 || operand === undefined) {
37
+ throw new AxiomError('ENGINE_ERROR', 'empty requires exactly one operand');
38
+ }
39
+ if (operand.kind === 'path')
40
+ return presenceCall(context, 'empty', args);
41
+ const evaluated = context.evaluate(operand);
42
+ // Absence can still reach here through `if` or `??`, and it is no value at all —
43
+ // which is exactly the question `empty` asks, so it answers as `null` does rather
44
+ // than as a missing reading.
45
+ return valueOf(applyBuiltin('empty', [evaluated.kind === 'absent' ? null : evaluated.value]), 'boolean');
46
+ }
47
+ /**
48
+ * `empty(p)`: presence answers whether the member exists, and the value answers whether it has
49
+ * content. A genuinely absent path or an explicit `null` is empty; a present value is empty
50
+ * exactly when it has no content (`""`, `[]`), so a zero and a false are not. A path this device
51
+ * cannot resolve is not confirmed empty, so the question propagates: answering `false` for a
52
+ * redacted path would let `not empty(p)` pass on a value that was never read.
53
+ */
54
+ function emptiness(context, arg, presence) {
55
+ const path = arg.path;
56
+ // refuses an answer derived from an access decision, and presence is
57
+ // exactly that for a path that cannot be read: the metadata says the record holds a
58
+ // value the device may not have, so neither `true` nor `false` is confirmed there.
59
+ if (!canReadPath(context, path))
60
+ return valueOf(UNKNOWN);
61
+ switch (presence) {
62
+ case 'absent':
63
+ case 'null':
64
+ return valueOf(true, 'boolean');
65
+ case 'redacted':
66
+ return valueOf(DEFERRED);
67
+ case 'present': {
68
+ // The member exists, so content is the value's question and not presence's. Reading it
69
+ // here is safe: `canReadPath` has already confirmed this device may, and the value form
70
+ // of `empty` is the same rule every other expression answers through.
71
+ const evaluated = context.evaluate(arg);
72
+ if (evaluated.kind === 'absent')
73
+ return valueOf(true, 'boolean');
74
+ return valueOf(applyBuiltin('empty', [evaluated.value]), 'boolean');
75
+ }
76
+ case 'undetermined':
77
+ case 'unreadable':
78
+ return valueOf(UNKNOWN);
79
+ }
80
+ }
81
+ /** Presence of a binder-scoped path is answered from the element the binder holds. */
82
+ function presenceOf(context, path) {
83
+ if (context.scopes.length === 0)
84
+ return context.host.presence(path);
85
+ const scoped = readScoped(context.scopes, context.paths, path);
86
+ if (scoped === undefined)
87
+ return context.host.presence(path);
88
+ if (scoped.kind === 'absent')
89
+ return 'absent';
90
+ if (isUndetermined(scoped.value))
91
+ return 'undetermined';
92
+ return scoped.value === null ? 'null' : 'present';
93
+ }
94
+ /**
95
+ * Whether this device may read `path`. A binder element has already been delivered, so
96
+ * access to a path the binder names was decided before the element reached the evaluator.
97
+ */
98
+ function canReadPath(context, path) {
99
+ if (context.scopes.length === 0)
100
+ return context.host.canRead(path);
101
+ const head = context.paths.segmentsOf(path)[0] ?? '';
102
+ return scopeFor(context.scopes, head) === undefined ? context.host.canRead(path) : true;
103
+ }
104
+ /**
105
+ * Relevance of a path/. A binder element was delivered
106
+ * because hiding never prevents reading, so a path through a binder
107
+ * still asks the host against the declaration it came from — hiding the array or one of
108
+ * its item fields makes `$it` and `$it.member` irrelevant just as it excludes them.
109
+ */
110
+ function isRelevantPath(context, path) {
111
+ if (context.scopes.length === 0)
112
+ return context.host.isRelevant(path);
113
+ const segments = context.paths.segmentsOf(path);
114
+ const head = segments[0] ?? '';
115
+ const scope = scopeFor(context.scopes, head);
116
+ if (scope === undefined)
117
+ return context.host.isRelevant(path);
118
+ if (scope.origin === undefined || head === '$i')
119
+ return true;
120
+ const rest = segments.slice(1);
121
+ const declaration = rest.length === 0 ? scope.origin : `${scope.origin}.${rest.join('.')}`;
122
+ return context.host.isRelevant(declaration);
123
+ }
124
+ /** `has_cap`: a capability flag, never an authorisation decision. */
125
+ export function capabilityCall(context, args) {
126
+ const [arg] = args;
127
+ if (args.length !== 1 || arg === undefined) {
128
+ throw new AxiomError('ENGINE_ERROR', 'has_cap requires exactly one argument');
129
+ }
130
+ const evaluated = context.evaluate(arg);
131
+ if (evaluated.kind === 'absent' || evaluated.value === null)
132
+ return valueOf(UNKNOWN);
133
+ if (isUndetermined(evaluated.value))
134
+ return evaluated;
135
+ if (typeof evaluated.value !== 'string') {
136
+ throw new AxiomError('ENGINE_ERROR', 'has_cap requires a text operand');
137
+ }
138
+ return valueOf(context.host.hasCapability(evaluated.value), 'boolean');
139
+ }
140
+ //# sourceMappingURL=presence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presence.js","sourceRoot":"","sources":["../../../src/eval/expr/presence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAWrC;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAwB,EACxB,EAAkD,EAClD,IAAyB;IAEzB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACnB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAClE,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,GAAG,EAAE,oCAAoC,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,EAAE,KAAK,aAAa,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,EAAE,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC7D,iFAAiF;IAC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IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3F,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,cAAc,CAAC,OAAwB,EAAE,IAAyB;IAChF,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACnB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QAC3C,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,uCAAuC,CAAC,CAAC;IAChF,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;IACrF,IAAI,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACtD,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,iCAAiC,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import { AxiomError } from '../../model/errors.js';\nimport type { ExprNode, PathNode } from '../../model/types.js';\nimport { DEFERRED, isUndetermined, UNKNOWN } from '../../model/types.js';\nimport { applyBuiltin } from '../../expr/builtins.js';\nimport type { BinderPaths } from '../paths.js';\nimport type { BinderScope } from './binder.js';\nimport { readScoped, scopeFor } from './binder.js';\nimport type { ExpressionHost } from './host.js';\nimport { valueOf } from './value.js';\nimport type { Evaluated, Presence } from './value.js';\n\n/** The evaluator operations presence, relevance and capability questions need. */\nexport interface PresenceContext {\n readonly host: ExpressionHost;\n readonly scopes: BinderScope[];\n readonly paths: BinderPaths;\n evaluate(node: ExprNode): Evaluated;\n}\n\n/**\n * A presence or relevance question reads metadata, never the value:\n * its operand is a path the compiler has already checked, and the host answers the\n * question the contract asks rather than a value question that would look the same.\n */\nexport function presenceCall(\n context: PresenceContext,\n op: 'present' | 'absent' | 'empty' | 'is_relevant',\n args: readonly ExprNode[],\n): Evaluated {\n const [arg] = args;\n if (args.length !== 1 || arg === undefined || arg.kind !== 'path') {\n throw new AxiomError('ENGINE_ERROR', `${op} requires exactly one path operand`);\n }\n if (op === 'is_relevant') {\n return valueOf(isRelevantPath(context, arg.path), 'boolean');\n }\n const presence = presenceOf(context, arg.path);\n if (op === 'empty') return emptiness(context, arg, presence);\n // `present`/`absent` are boolean questions and never undetermined (`EXPR-9.1.4`,\n // `EXPR-9.1.5`). Only a genuinely absent path answers `absent` true; a redacted,\n // unreadable or undetermined path answers false to both, so neither can be confirmed.\n if (op === 'present') return valueOf(presence === 'present', 'boolean');\n return valueOf(presence === 'absent', 'boolean');\n}\n\n/**\n * `empty(x)`: a path answers absence from presence, which is the only place absence is directly\n * observable, and content from the value it holds; every other expression answers from the value\n * it produced, through the same seam every value built-in uses.\n */\nexport function emptyCall(context: PresenceContext, args: readonly ExprNode[]): Evaluated {\n const [operand] = args;\n if (args.length !== 1 || operand === undefined) {\n throw new AxiomError('ENGINE_ERROR', 'empty requires exactly one operand');\n }\n if (operand.kind === 'path') return presenceCall(context, 'empty', args);\n const evaluated = context.evaluate(operand);\n // Absence can still reach here through `if` or `??`, and it is no value at all —\n // which is exactly the question `empty` asks, so it answers as `null` does rather\n // than as a missing reading.\n return valueOf(\n applyBuiltin('empty', [evaluated.kind === 'absent' ? null : evaluated.value]),\n 'boolean',\n );\n}\n\n/**\n * `empty(p)`: presence answers whether the member exists, and the value answers whether it has\n * content. A genuinely absent path or an explicit `null` is empty; a present value is empty\n * exactly when it has no content (`\"\"`, `[]`), so a zero and a false are not. A path this device\n * cannot resolve is not confirmed empty, so the question propagates: answering `false` for a\n * redacted path would let `not empty(p)` pass on a value that was never read.\n */\nfunction emptiness(context: PresenceContext, arg: PathNode, presence: Presence): Evaluated {\n const path = arg.path;\n // refuses an answer derived from an access decision, and presence is\n // exactly that for a path that cannot be read: the metadata says the record holds a\n // value the device may not have, so neither `true` nor `false` is confirmed there.\n if (!canReadPath(context, path)) return valueOf(UNKNOWN);\n switch (presence) {\n case 'absent':\n case 'null':\n return valueOf(true, 'boolean');\n case 'redacted':\n return valueOf(DEFERRED);\n case 'present': {\n // The member exists, so content is the value's question and not presence's. Reading it\n // here is safe: `canReadPath` has already confirmed this device may, and the value form\n // of `empty` is the same rule every other expression answers through.\n const evaluated = context.evaluate(arg);\n if (evaluated.kind === 'absent') return valueOf(true, 'boolean');\n return valueOf(applyBuiltin('empty', [evaluated.value]), 'boolean');\n }\n case 'undetermined':\n case 'unreadable':\n return valueOf(UNKNOWN);\n }\n}\n\n/** Presence of a binder-scoped path is answered from the element the binder holds. */\nfunction presenceOf(context: PresenceContext, path: string): Presence {\n if (context.scopes.length === 0) return context.host.presence(path);\n const scoped = readScoped(context.scopes, context.paths, path);\n if (scoped === undefined) return context.host.presence(path);\n if (scoped.kind === 'absent') return 'absent';\n if (isUndetermined(scoped.value)) return 'undetermined';\n return scoped.value === null ? 'null' : 'present';\n}\n\n/**\n * Whether this device may read `path`. A binder element has already been delivered, so\n * access to a path the binder names was decided before the element reached the evaluator.\n */\nfunction canReadPath(context: PresenceContext, path: string): boolean {\n if (context.scopes.length === 0) return context.host.canRead(path);\n const head = context.paths.segmentsOf(path)[0] ?? '';\n return scopeFor(context.scopes, head) === undefined ? context.host.canRead(path) : true;\n}\n\n/**\n * Relevance of a path/. A binder element was delivered\n * because hiding never prevents reading, so a path through a binder\n * still asks the host against the declaration it came from — hiding the array or one of\n * its item fields makes `$it` and `$it.member` irrelevant just as it excludes them.\n */\nfunction isRelevantPath(context: PresenceContext, path: string): boolean {\n if (context.scopes.length === 0) return context.host.isRelevant(path);\n const segments = context.paths.segmentsOf(path);\n const head = segments[0] ?? '';\n const scope = scopeFor(context.scopes, head);\n if (scope === undefined) return context.host.isRelevant(path);\n if (scope.origin === undefined || head === '$i') return true;\n const rest = segments.slice(1);\n const declaration = rest.length === 0 ? scope.origin : `${scope.origin}.${rest.join('.')}`;\n return context.host.isRelevant(declaration);\n}\n\n/** `has_cap`: a capability flag, never an authorisation decision. */\nexport function capabilityCall(context: PresenceContext, args: readonly ExprNode[]): Evaluated {\n const [arg] = args;\n if (args.length !== 1 || arg === undefined) {\n throw new AxiomError('ENGINE_ERROR', 'has_cap requires exactly one argument');\n }\n const evaluated = context.evaluate(arg);\n if (evaluated.kind === 'absent' || evaluated.value === null) return valueOf(UNKNOWN);\n if (isUndetermined(evaluated.value)) return evaluated;\n if (typeof evaluated.value !== 'string') {\n throw new AxiomError('ENGINE_ERROR', 'has_cap requires a text operand');\n }\n return valueOf(context.host.hasCapability(evaluated.value), 'boolean');\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { ExprNode, LiteralDomain } from '../../model/types.js';
2
+ import type { Evaluated } from './value.js';
3
+ /** The record built-ins: the members a closed record declares and the values it states. */
4
+ export type RecordOperator = 'keys' | 'values';
5
+ /** The evaluator operations the record built-ins need. */
6
+ export interface RecordContext {
7
+ evaluate(node: ExprNode): Evaluated;
8
+ /** The declared members of a record path, with their domains; `undefined` when open. */
9
+ recordMembersOf(path: string): Readonly<Record<string, LiteralDomain>> | undefined;
10
+ }
11
+ /**
12
+ * `keys(record)` and `values(record)`, for a record whose declared members are known.
13
+ *
14
+ * Both are total over a closed record: a declared member the record omitted is still a key
15
+ * (the declaration says so) and contributes no value (absence is not a value,
16
+ * `EXPR-5.1.12`). A sentinel operand propagates unchanged, and the empty value is undecided
17
+ * rather than an empty record, exactly as a member read treats it. An open record is an
18
+ * engine error here because the compiler refuses it before this point; a hand-built artifact
19
+ * still gets a refusal that names the expression rather than an invented member list.
20
+ */
21
+ export declare function recordCall(context: RecordContext, op: RecordOperator, args: readonly ExprNode[]): Evaluated;
22
+ //# sourceMappingURL=records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../src/eval/expr/records.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAc,MAAM,sBAAsB,CAAC;AAIhF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,2FAA2F;AAC3F,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE/C,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IACpC,wFAAwF;IACxF,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GAAG,SAAS,CAAC;CACpF;AAwDD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,aAAa,EACtB,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE,SAAS,QAAQ,EAAE,GACxB,SAAS,CA4CX"}
@@ -0,0 +1,101 @@
1
+ import { AxiomError } from '../../model/errors.js';
2
+ import { isUndetermined, UNKNOWN } from '../../model/types.js';
3
+ import { isRecord } from '../../model/values.js';
4
+ import { ABSENT, valueOf } from './value.js';
5
+ /** The expression a refusal names, in the source shape its author recognises. */
6
+ function describeExpression(node) {
7
+ switch (node.kind) {
8
+ case 'path':
9
+ return `\`${node.path}\``;
10
+ case 'call':
11
+ return `\`${node.op}(…)\``;
12
+ case 'list':
13
+ return 'a list literal';
14
+ case 'comprehension':
15
+ return 'a comprehension';
16
+ default:
17
+ return `a \`${node.kind}\` expression`;
18
+ }
19
+ }
20
+ /** The path a refusal points at: the record operand's own path when it has one. */
21
+ function pathOf(node) {
22
+ return node.kind === 'path' ? node.path : '';
23
+ }
24
+ /**
25
+ * The declared members of the record an operand evaluated to.
26
+ *
27
+ * A path's declaration is the authority: it states the members the artifact admits, in
28
+ * declaration order, whether or not this record stated each one. A record a table or a writer
29
+ * produced carries the same statement on the value (`closedMembers`). A record neither source
30
+ * closes — a record-typed context root — is refused by name, because reading its current keys
31
+ * as its type would make `keys` answer differently for two records of one declared root.
32
+ */
33
+ function membersOf(context, op, node, closedMembers, memberDomains) {
34
+ if (node.kind === 'path') {
35
+ const declared = context.recordMembersOf(node.path);
36
+ if (declared !== undefined) {
37
+ return { names: Object.keys(declared), domains: declared };
38
+ }
39
+ }
40
+ if (closedMembers !== undefined)
41
+ return { names: closedMembers, domains: memberDomains };
42
+ throw new AxiomError('ENGINE_ERROR', `\`${op}\` requires a closed record whose members are declared, and ${describeExpression(node)} produced an open record; read a declared \`record\` field or a lookup result instead`, pathOf(node));
43
+ }
44
+ /**
45
+ * `keys(record)` and `values(record)`, for a record whose declared members are known.
46
+ *
47
+ * Both are total over a closed record: a declared member the record omitted is still a key
48
+ * (the declaration says so) and contributes no value (absence is not a value,
49
+ * `EXPR-5.1.12`). A sentinel operand propagates unchanged, and the empty value is undecided
50
+ * rather than an empty record, exactly as a member read treats it. An open record is an
51
+ * engine error here because the compiler refuses it before this point; a hand-built artifact
52
+ * still gets a refusal that names the expression rather than an invented member list.
53
+ */
54
+ export function recordCall(context, op, args) {
55
+ const [node] = args;
56
+ if (args.length !== 1 || node === undefined) {
57
+ throw new AxiomError('ENGINE_ERROR', `${op} takes one record`);
58
+ }
59
+ const evaluated = context.evaluate(node);
60
+ if (evaluated.kind === 'absent')
61
+ return ABSENT;
62
+ if (isUndetermined(evaluated.value))
63
+ return evaluated;
64
+ if (evaluated.value === null)
65
+ return valueOf(UNKNOWN);
66
+ if (!isRecord(evaluated.value)) {
67
+ throw new AxiomError('ENGINE_ERROR', `\`${op}\` requires a record, got ${typeof evaluated.value}`, pathOf(node));
68
+ }
69
+ const record = evaluated.value;
70
+ const members = membersOf(context, op, node, evaluated.closedMembers, evaluated.memberDomains);
71
+ if (op === 'keys') {
72
+ return {
73
+ kind: 'value',
74
+ value: [...members.names],
75
+ domain: undefined,
76
+ elementDomains: members.names.map(() => 'string'),
77
+ };
78
+ }
79
+ const values = [];
80
+ const domains = [];
81
+ for (const name of members.names) {
82
+ // A member the record did not state has no value: absence is not a value the list can
83
+ // carry, and inventing `null` would turn "not stated" into "explicitly empty".
84
+ if (!Object.hasOwn(record, name))
85
+ continue;
86
+ const member = record[name];
87
+ if (member === undefined)
88
+ continue;
89
+ values.push(member);
90
+ const domain = members.domains?.[name];
91
+ if (domain !== undefined)
92
+ domains.push(domain);
93
+ }
94
+ return {
95
+ kind: 'value',
96
+ value: values,
97
+ domain: undefined,
98
+ ...(domains.length === values.length ? { elementDomains: domains } : {}),
99
+ };
100
+ }
101
+ //# sourceMappingURL=records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"records.js","sourceRoot":"","sources":["../../../src/eval/expr/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAa7C,iFAAiF;AACjF,SAAS,kBAAkB,CAAC,IAAc;IACxC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC;QAC5B,KAAK,MAAM;YACT,OAAO,KAAK,IAAI,CAAC,EAAE,OAAO,CAAC;QAC7B,KAAK,MAAM;YACT,OAAO,gBAAgB,CAAC;QAC1B,KAAK,eAAe;YAClB,OAAO,iBAAiB,CAAC;QAC3B;YACE,OAAO,OAAO,IAAI,CAAC,IAAI,eAAe,CAAC;IA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M,CAAC,CAAC;QACpB,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IACD,OAAO;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,SAAS;QACjB,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzE,CAAC;AACJ,CAAC","sourcesContent":["import { AxiomError } from '../../model/errors.js';\nimport type { ExprNode, LiteralDomain, WireRecord } from '../../model/types.js';\nimport { isUndetermined, UNKNOWN } from '../../model/types.js';\nimport { isRecord } from '../../model/values.js';\nimport { ABSENT, valueOf } from './value.js';\nimport type { Evaluated } from './value.js';\n\n/** The record built-ins: the members a closed record declares and the values it states. */\nexport type RecordOperator = 'keys' | 'values';\n\n/** The evaluator operations the record built-ins need. */\nexport interface RecordContext {\n evaluate(node: ExprNode): Evaluated;\n /** The declared members of a record path, with their domains; `undefined` when open. */\n recordMembersOf(path: string): Readonly<Record<string, LiteralDomain>> | undefined;\n}\n\n/** The expression a refusal names, in the source shape its author recognises. */\nfunction describeExpression(node: ExprNode): string {\n switch (node.kind) {\n case 'path':\n return `\\`${node.path}\\``;\n case 'call':\n return `\\`${node.op}(…)\\``;\n case 'list':\n return 'a list literal';\n case 'comprehension':\n return 'a comprehension';\n default:\n return `a \\`${node.kind}\\` expression`;\n }\n}\n\n/** The path a refusal points at: the record operand's own path when it has one. */\nfunction pathOf(node: ExprNode): string {\n return node.kind === 'path' ? node.path : '';\n}\n\n/**\n * The declared members of the record an operand evaluated to.\n *\n * A path's declaration is the authority: it states the members the artifact admits, in\n * declaration order, whether or not this record stated each one. A record a table or a writer\n * produced carries the same statement on the value (`closedMembers`). A record neither source\n * closes — a record-typed context root — is refused by name, because reading its current keys\n * as its type would make `keys` answer differently for two records of one declared root.\n */\nfunction membersOf(\n context: RecordContext,\n op: RecordOperator,\n node: ExprNode,\n closedMembers: readonly string[] | undefined,\n memberDomains: Readonly<Record<string, LiteralDomain>> | undefined,\n): {\n readonly names: readonly string[];\n readonly domains: Readonly<Record<string, LiteralDomain>> | undefined;\n} {\n if (node.kind === 'path') {\n const declared = context.recordMembersOf(node.path);\n if (declared !== undefined) {\n return { names: Object.keys(declared), domains: declared };\n }\n }\n if (closedMembers !== undefined) return { names: closedMembers, domains: memberDomains };\n throw new AxiomError(\n 'ENGINE_ERROR',\n `\\`${op}\\` requires a closed record whose members are declared, and ${describeExpression(node)} produced an open record; read a declared \\`record\\` field or a lookup result instead`,\n pathOf(node),\n );\n}\n\n/**\n * `keys(record)` and `values(record)`, for a record whose declared members are known.\n *\n * Both are total over a closed record: a declared member the record omitted is still a key\n * (the declaration says so) and contributes no value (absence is not a value,\n * `EXPR-5.1.12`). A sentinel operand propagates unchanged, and the empty value is undecided\n * rather than an empty record, exactly as a member read treats it. An open record is an\n * engine error here because the compiler refuses it before this point; a hand-built artifact\n * still gets a refusal that names the expression rather than an invented member list.\n */\nexport function recordCall(\n context: RecordContext,\n op: RecordOperator,\n args: readonly ExprNode[],\n): Evaluated {\n const [node] = args;\n if (args.length !== 1 || node === undefined) {\n throw new AxiomError('ENGINE_ERROR', `${op} takes one record`);\n }\n const evaluated = context.evaluate(node);\n if (evaluated.kind === 'absent') return ABSENT;\n if (isUndetermined(evaluated.value)) return evaluated;\n if (evaluated.value === null) return valueOf(UNKNOWN);\n if (!isRecord(evaluated.value)) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `\\`${op}\\` requires a record, got ${typeof evaluated.value}`,\n pathOf(node),\n );\n }\n const record = evaluated.value;\n const members = membersOf(context, op, node, evaluated.closedMembers, evaluated.memberDomains);\n if (op === 'keys') {\n return {\n kind: 'value',\n value: [...members.names],\n domain: undefined,\n elementDomains: members.names.map((): LiteralDomain => 'string'),\n };\n }\n const values: WireRecord[string][] = [];\n const domains: LiteralDomain[] = [];\n for (const name of members.names) {\n // A member the record did not state has no value: absence is not a value the list can\n // carry, and inventing `null` would turn \"not stated\" into \"explicitly empty\".\n if (!Object.hasOwn(record, name)) continue;\n const member = record[name];\n if (member === undefined) continue;\n values.push(member);\n const domain = members.domains?.[name];\n if (domain !== undefined) domains.push(domain);\n }\n return {\n kind: 'value',\n value: values,\n domain: undefined,\n ...(domains.length === values.length ? { elementDomains: domains } : {}),\n };\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type { ExprNode } from '../../model/types.js';
2
+ import type { RuleHost } from './host.js';
3
+ import type { Evaluated } from './value.js';
4
+ /** The rule-scoped operations `rule_ok`/`no_blocking` and the step folds need. */
5
+ export interface RuleReferenceContext {
6
+ readonly rules: RuleHost | undefined;
7
+ }
8
+ /** `rule_ok(ruleId)`: the named rule's outcome lifted to boolean. */
9
+ export declare function ruleOkCall(context: RuleReferenceContext, args: readonly ExprNode[]): Evaluated;
10
+ /**
11
+ * `no_blocking(kind)`: `true` when no `block`-severity rule of that kind blocks
12
+ * (`RULES-1.1.9`). A folding query, so an undecided block rule makes it `false` rather than
13
+ * undetermined, while a `FAIL` that states a branch (`RULES-1.1.5`) blocks nothing.
14
+ */
15
+ export declare function noBlockingCall(context: RuleReferenceContext, args: readonly ExprNode[]): Evaluated;
16
+ /**
17
+ * `rule_ok_in(stepId)`, `no_blocking_in(stepId)` and `required_in(stepId)`: the step folds of
18
+ * `RULES-1.1.12`.
19
+ *
20
+ * A host that indexes the artifact's layout answers from its own state; one that does not
21
+ * leaves the question undecided, which is the answer every absent capability gives. It is
22
+ * never `true`, because silence must not read as permission.
23
+ */
24
+ export declare function stepFoldCall(context: RuleReferenceContext, op: 'rule_ok_in' | 'no_blocking_in' | 'required_in', args: readonly ExprNode[]): Evaluated;
25
+ //# sourceMappingURL=rule-refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-refs.d.ts","sourceRoot":"","sources":["../../../src/eval/expr/rule-refs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,kFAAkF;AAClF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;CACtC;AAuBD,qEAAqE;AACrE,wBAAgB,UAAU,CAAC,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,CAG9F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,oBAAoB,EAC7B,IAAI,EAAE,SAAS,QAAQ,EAAE,GACxB,SAAS,CAGX;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,oBAAoB,EAC7B,EAAE,EAAE,YAAY,GAAG,gBAAgB,GAAG,aAAa,EACnD,IAAI,EAAE,SAAS,QAAQ,EAAE,GACxB,SAAS,CAgBX"}
@@ -0,0 +1,60 @@
1
+ import { AxiomError } from '../../model/errors.js';
2
+ import { UNKNOWN } from '../../model/types.js';
3
+ import { outcomeToValue } from './operands.js';
4
+ import { valueOf } from './value.js';
5
+ /**
6
+ * The declared name a rule-reference built-in names. The compiler admits
7
+ * these only inside a gate rule and only as a literal, so an artifact that reaches another
8
+ * rule id at run time — or reaches one from a standalone guard — is refused rather than
9
+ * answered from a name the input chose.
10
+ */
11
+ function ruleReference(context, op, node) {
12
+ const host = context.rules;
13
+ if (host === undefined) {
14
+ throw new AxiomError('ENGINE_ERROR', `${op} is only available inside a gate rule`);
15
+ }
16
+ if (node === undefined || node.kind !== 'literal' || typeof node.value !== 'string') {
17
+ throw new AxiomError('ENGINE_ERROR', `${op} requires a declared name as its only argument`);
18
+ }
19
+ return { host, name: node.value };
20
+ }
21
+ /** `rule_ok(ruleId)`: the named rule's outcome lifted to boolean. */
22
+ export function ruleOkCall(context, args) {
23
+ const { host, name } = ruleReference(context, 'rule_ok', args[0]);
24
+ return valueOf(outcomeToValue(host.outcomeOf(name)), 'boolean');
25
+ }
26
+ /**
27
+ * `no_blocking(kind)`: `true` when no `block`-severity rule of that kind blocks
28
+ * (`RULES-1.1.9`). A folding query, so an undecided block rule makes it `false` rather than
29
+ * undetermined, while a `FAIL` that states a branch (`RULES-1.1.5`) blocks nothing.
30
+ */
31
+ export function noBlockingCall(context, args) {
32
+ const { host, name } = ruleReference(context, 'no_blocking', args[0]);
33
+ return valueOf(host.noBlocking(name), 'boolean');
34
+ }
35
+ /**
36
+ * `rule_ok_in(stepId)`, `no_blocking_in(stepId)` and `required_in(stepId)`: the step folds of
37
+ * `RULES-1.1.12`.
38
+ *
39
+ * A host that indexes the artifact's layout answers from its own state; one that does not
40
+ * leaves the question undecided, which is the answer every absent capability gives. It is
41
+ * never `true`, because silence must not read as permission.
42
+ */
43
+ export function stepFoldCall(context, op, args) {
44
+ const { host, name } = ruleReference(context, op, args[0]);
45
+ switch (op) {
46
+ case 'rule_ok_in':
47
+ return host.outcomeOfStep === undefined
48
+ ? valueOf(UNKNOWN)
49
+ : valueOf(outcomeToValue(host.outcomeOfStep(name)), 'boolean');
50
+ case 'no_blocking_in':
51
+ return host.noBlockingIn === undefined
52
+ ? valueOf(UNKNOWN)
53
+ : valueOf(host.noBlockingIn(name), 'boolean');
54
+ case 'required_in':
55
+ return host.requiredIn === undefined
56
+ ? valueOf(UNKNOWN)
57
+ : valueOf(outcomeToValue(host.requiredIn(name)), 'boolean');
58
+ }
59
+ }
60
+ //# sourceMappingURL=rule-refs.js.map