@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 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/eval/rule/state.ts"],"names":[],"mappings":"","sourcesContent":["import type { ProvenanceLedger } from '../../lookup/pass.js';\nimport type {\n CompiledRule,\n Diagnostic,\n EvaluationReport,\n GateReport,\n ReportFacts,\n RuleResult,\n ScreenReport,\n} from '../../model/types.js';\nimport type { EvaluationEnv, EvaluationInput } from '../../model/access.js';\nimport type { CompiledSchema } from '../../model/schema.js';\nimport type { AccessWindow } from '../access/window.js';\nimport type { ComputedOverlay } from '../computed.js';\nimport type { ExpressionEvaluator } from '../expression.js';\nimport type { RecordReader } from '../reader.js';\nimport type { PreparedSchema } from './prepare.js';\n\n/** What one artifact rule contributed to a report: one result per row, or one per rule. */\nexport interface RuleEvaluation {\n readonly results: readonly RuleResult[];\n readonly gate?: { readonly gateId: string; readonly report: GateReport };\n readonly screen?: { readonly screenId: string; readonly report: ScreenReport };\n}\n\n/**\n * One evaluation's mutable state.\n *\n * The state is the seam between the runner that owns an evaluation's lifetime and the\n * families that execute one rule: provenance, diagnostics, memoised outcomes and the rule\n * currently in force are one evaluation's, so they travel together and never outlive it.\n */\nexport interface EvaluationState {\n readonly compiled: CompiledSchema;\n readonly env: EvaluationEnv;\n readonly prepared: PreparedSchema;\n readonly reader: RecordReader;\n /** The checked record and host facts this evaluation was opened with. */\n readonly input: EvaluationInput;\n /**\n * Whether a `visible` rule leaves one field on screen.\n *\n * The admission folds use it to skip a rule whose subject the respondent cannot correct\n * (`RULES-2.1.10`). It is the `visible`-rule half of relevance only: the access overlay is a\n * disclosure decision, and a row-level restriction must not erase a rule about the array that\n * holds it.\n */\n readonly isVisible: (fieldId: string) => boolean;\n /**\n * Whether one field is hidden *and* excluded from delivery, `MODEL-3.1.11`.\n *\n * A `visible` rule can hide a field whose effective `onHide` is `exclude`, which is the one\n * visibility answer delivery may not state. The predicate is the disclosure taint's own, so a\n * message payload and a read cannot disagree about whether a value may be quoted.\n */\n readonly isWithheld: (fieldId: string) => boolean;\n /** The one access answer this evaluation resolved, so the report and every read share it. */\n readonly accessWindow: AccessWindow;\n readonly evaluator: ExpressionEvaluator;\n readonly diagnostics: Diagnostic[];\n /**\n * Every lookup's provenance this evaluation resolved, deduplicated and canonically\n * ordered, with each entry attributed to the rule that made it.\n */\n readonly provenance: ProvenanceLedger;\n /** One rule's outcome for this evaluation, so `rule_ok` never evaluates it twice. */\n readonly ruleOutcomes: Map<CompiledRule, RuleEvaluation>;\n /** The rules currently being evaluated, so a `rule_ok` cycle fails closed. */\n readonly rulesInProgress: Set<CompiledRule>;\n report: EvaluationReport | undefined;\n /** The assembled body, cached for a derivation that never asks for the digest. */\n body: ReportFacts | undefined;\n /** The diagnostics recorded under the rule currently evaluating, for `explain()`. */\n currentDiagnostics: Diagnostic[] | undefined;\n readonly ruleDiagnostics: Map<string, readonly Diagnostic[]>;\n /** The rule a body is being evaluated for, so its provenance and diagnostics stay its own. */\n currentRule: CompiledRule | undefined;\n /**\n * The row a body is being evaluated for: results and diagnostics built\n * while it is set name that row, so no row's answer can be reported against another.\n */\n currentRowKey: string | number | undefined;\n /**\n * The diagnostics a `visible` rule recorded while it was evaluated to answer an\n * `is_relevant` question. They stay in the report — they are facts about\n * the record — but they belong to that rule's evaluation, not to the rule that asked, so the\n * sections a gate and a screen project from the diagnostics raised during their own body\n * leave them out. Counting them would let the\n * declaration order of two unrelated rules decide a gate's verdict.\n */\n readonly relevanceDiagnostics: Set<Diagnostic>;\n /**\n * The rule each diagnostic was recorded under, when one was in force. A rule pulled in by\n * `rule_ok` records its own causes (a missing table, a refused read) while the asking screen\n * is the rule in the report's loop, so a screen reads this to keep another rule's cause out of\n * the reasons it states. Without it the screen's reasons depended on whether that rule had\n * already been evaluated when the screen ran.\n */\n readonly diagnosticOwners: Map<Diagnostic, CompiledRule>;\n /**\n * The fields each gate rule's own reads were refused, so an accepted override can waive the\n * refusal it approved and nothing else.\n */\n readonly gateDenialsByRule: Map<string, readonly string[]>;\n /** Whether the rule being evaluated answers a relevance question rather than the report. */\n answeringRelevance: boolean;\n /**\n * The fields whose hidden state is being resolved, so a `visible` rule that reads the field\n * it hides meets this guard and leaves the field visible instead of recursing.\n */\n readonly visibilityInProgress: Set<string>;\n /** The computed values this evaluation resolved, written once in dependency order. */\n readonly computed: ComputedOverlay;\n /** Whether the writer pre-pass has run, so it runs once per evaluation. */\n computedPrepared: boolean;\n /**\n * Whether the values in this evaluation are still being produced. While they are, no\n * `visible` rule may be evaluated: a visibility rule can read a computed field, and asking\n * it before the writers have run would memoise its answer against a base value. A writer\n * therefore sees every field as visible, the same fail-open answer a rule that is `UNKNOWN`\n * gives `is_relevant`.\n */\n resolvingWriters: boolean;\n /** Whether the artifact's graph has no writer order, so every writer fails closed. */\n computedUnorderable: boolean;\n /**\n * Called once for each rule this evaluation actually computes, so a session's pass trace\n * counts evaluations rather than reporting a private counter no test can see.\n */\n readonly onRuleEvaluated?: ((ruleId: string) => void) | undefined;\n /**\n * A second evaluation of this one's inputs, access answer and writer overlay.\n *\n * Its reader, considered fields, refusals, provenance and diagnostics are its own, so work that\n * is not itself a decision about the record — an option's availability condition, a rule's\n * alternatives — is evaluated there and discarded with it instead of entering this report\n * (`RULES-7.1.2`).\n */\n readonly isolate: () => EvaluationState;\n}\n"]}
@@ -0,0 +1,44 @@
1
+ import type { CompiledRule, Outcome } from '../../model/types.js';
2
+ import type { CompiledSchema } from '../../model/schema.js';
3
+ import type { LayoutStep } from '../../model/layout.js';
4
+ import type { EvaluationState } from './state.js';
5
+ /** Every rule in one step, in declaration order, excluding the rule that is asking. */
6
+ export declare function rulesInStep(compiled: CompiledSchema, stepId: string, asking: CompiledRule | undefined, op: string): readonly CompiledRule[];
7
+ /**
8
+ * `rule_ok_in(stepId)`: every rule the step places passes its admission question.
9
+ *
10
+ * Zero rules is `PASS`, the same empty fold `no_blocking` states. A rule the step gate itself
11
+ * is (the asking rule) is excluded, because its outcome does not exist until the fold answers.
12
+ * A `visible`, `required` or `enabled` `FAIL` is the branch in which that rule's condition does
13
+ * not apply — the field is hidden, nothing is required, the control is read-only — so it
14
+ * contributes `PASS`. Every real wizard step holds one of those conditions, and folding them
15
+ * as failures made a complete step permanently unpassable (`RULES-1.1.5`, `RULES-2.1.10`).
16
+ */
17
+ export declare function outcomeOfStep(state: EvaluationState, stepId: string, op: string): Outcome;
18
+ /**
19
+ * `no_blocking_in(stepId)`: no `block`-severity rule the step places blocks.
20
+ *
21
+ * The same classification the report status folds (`[RULES-1.1.9]`): a `FAIL` that states a
22
+ * branch blocks nothing, while an undecided result blocks because nothing was decided.
23
+ */
24
+ export declare function noBlockingIn(state: EvaluationState, stepId: string, op: string): boolean;
25
+ /**
26
+ * `required_in(stepId)`: every requirement the step's `required` rules state is satisfied.
27
+ *
28
+ * `required` is a condition, not a presence test (`[RULES-2.1.5]`), so the fold reads both: a
29
+ * rule whose condition is `PASS` requires its target, and the target then has to hold a value.
30
+ * An undecided condition is `FAIL` (an unreadable condition must never present as a satisfied
31
+ * requirement), a rule that decided `FAIL` requires nothing, and a fired target's presence folds
32
+ * across all four states (`PASS`, `FAIL`, `DEFERRED`, `UNKNOWN`) to agree with field-state
33
+ * derivation.
34
+ *
35
+ * This is the one foldable form of `required`: a gate can ask it once for a whole step instead
36
+ * of listing each `required` rule id, and a rule added to the step is weighed without editing
37
+ * the gate.
38
+ */
39
+ export declare function requiredIn(state: EvaluationState, stepId: string, op: string): Outcome;
40
+ /** One step's or section's field placements, for a caller that must name them without a rule. */
41
+ export declare function stepFieldsOf(compiled: CompiledSchema, stepId: string): readonly string[];
42
+ /** The `LayoutStep` one id names, when the artifact places it. */
43
+ export declare function declaredStep(compiled: CompiledSchema, stepId: string): LayoutStep | undefined;
44
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/eval/rule/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAY,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,uBAAuB,CAAC;AASpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAkGlD,uFAAuF;AACvF,wBAAgB,WAAW,CACzB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,GAAG,SAAS,EAChC,EAAE,EAAE,MAAM,GACT,SAAS,YAAY,EAAE,CAGzB;AAYD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAKzF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAOxF;AAkGD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAUtF;AAuFD,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAExF;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAiB7F"}
@@ -0,0 +1,367 @@
1
+ import { DEFERRED } from '../../model/types.js';
2
+ import { AxiomError, assertNever } from '../../model/errors.js';
3
+ import { andAll } from '../../expr/logic.js';
4
+ import { isRecord, isWireArray } from '../../model/values.js';
5
+ import { rowKeyToken, toWireValue, wireDeclarationOf } from '../../model/wire.js';
6
+ import { rowKeyOfItem } from '../addressing.js';
7
+ import { admissionOutcome, isBlocking } from '../seal.js';
8
+ import { evaluateRuleOnce, isRelevantRule } from './execution.js';
9
+ const TARGETS = new WeakMap();
10
+ /** Collects every field placement inside one layout subtree, at any nesting depth. */
11
+ function collectFields(nodes, into) {
12
+ for (const node of nodes) {
13
+ switch (node.kind) {
14
+ case 'field':
15
+ into.add(node.fieldId);
16
+ break;
17
+ case 'section':
18
+ case 'group':
19
+ case 'step':
20
+ case 'wizard':
21
+ collectFields(node.children, into);
22
+ break;
23
+ default:
24
+ break;
25
+ }
26
+ }
27
+ }
28
+ /**
29
+ * Every layout node a fold may target, with the fields its subtree places.
30
+ *
31
+ * A wizard step and a section are both addressable: a first-time adopter reaches for a
32
+ * section, and wrapping a form in a one-step wizard purely to get a presence fold is
33
+ * ceremony. A section states its id optionally, so one without an id is not a target — its
34
+ * fields still belong to the enclosing target's fold. A group names no id at all; its fields
35
+ * count towards the section or step that holds it.
36
+ */
37
+ function targetIndexOf(compiled) {
38
+ const cached = TARGETS.get(compiled);
39
+ if (cached !== undefined)
40
+ return cached;
41
+ const targets = new Map();
42
+ const visit = (nodes) => {
43
+ for (const node of nodes) {
44
+ if (node.kind === 'step') {
45
+ const fieldIds = new Set();
46
+ collectFields(node.children, fieldIds);
47
+ targets.set(node.stepId, { targetId: node.stepId, fieldIds });
48
+ }
49
+ if (node.kind === 'section' && node.sectionId !== undefined) {
50
+ // The subtree includes nested sections and groups, so a fold over an outer section
51
+ // covers every field its inner sections place.
52
+ const fieldIds = new Set();
53
+ collectFields(node.children, fieldIds);
54
+ targets.set(node.sectionId, { targetId: node.sectionId, fieldIds });
55
+ }
56
+ if (node.kind === 'section' || node.kind === 'group' || node.kind === 'step') {
57
+ visit(node.children);
58
+ }
59
+ if (node.kind === 'wizard')
60
+ visit(node.children);
61
+ }
62
+ };
63
+ visit(compiled.layout ?? []);
64
+ TARGETS.set(compiled, targets);
65
+ return targets;
66
+ }
67
+ /** Whether one rule decides any field a step places. */
68
+ function ruleIsInStep(step, rule) {
69
+ if (rule.fieldIds !== undefined)
70
+ return rule.fieldIds.some((fieldId) => step.fieldIds.has(fieldId));
71
+ return rule.fieldId !== undefined && step.fieldIds.has(rule.fieldId);
72
+ }
73
+ function stepOf(compiled, targetId, op) {
74
+ const step = targetIndexOf(compiled).get(targetId);
75
+ if (step === undefined) {
76
+ throw new AxiomError('ENGINE_ERROR', `${op} names layout target ${JSON.stringify(targetId)}, which this artifact does not declare`, targetId);
77
+ }
78
+ return step;
79
+ }
80
+ /** Every rule in one step, in declaration order, excluding the rule that is asking. */
81
+ export function rulesInStep(compiled, stepId, asking, op) {
82
+ const step = stepOf(compiled, stepId, op);
83
+ return (compiled.rules ?? []).filter((rule) => rule !== asking && ruleIsInStep(step, rule));
84
+ }
85
+ /** One rule's folded outcome across every row it produced. */
86
+ function foldOf(state, rule) {
87
+ return andAll(evaluateRuleOnce(state, rule).results.map((result) => result.status));
88
+ }
89
+ /** One rule's folded *admission* outcome across every row it produced, `RULES-1.1.5`. */
90
+ function admissionOf(state, rule) {
91
+ return andAll(evaluateRuleOnce(state, rule).results.map(admissionOutcome));
92
+ }
93
+ /**
94
+ * `rule_ok_in(stepId)`: every rule the step places passes its admission question.
95
+ *
96
+ * Zero rules is `PASS`, the same empty fold `no_blocking` states. A rule the step gate itself
97
+ * is (the asking rule) is excluded, because its outcome does not exist until the fold answers.
98
+ * A `visible`, `required` or `enabled` `FAIL` is the branch in which that rule's condition does
99
+ * not apply — the field is hidden, nothing is required, the control is read-only — so it
100
+ * contributes `PASS`. Every real wizard step holds one of those conditions, and folding them
101
+ * as failures made a complete step permanently unpassable (`RULES-1.1.5`, `RULES-2.1.10`).
102
+ */
103
+ export function outcomeOfStep(state, stepId, op) {
104
+ const rules = rulesInStep(state.compiled, stepId, state.currentRule, op);
105
+ return andAll(rules.filter((rule) => isRelevantRule(state, rule)).map((rule) => admissionOf(state, rule)));
106
+ }
107
+ /**
108
+ * `no_blocking_in(stepId)`: no `block`-severity rule the step places blocks.
109
+ *
110
+ * The same classification the report status folds (`[RULES-1.1.9]`): a `FAIL` that states a
111
+ * branch blocks nothing, while an undecided result blocks because nothing was decided.
112
+ */
113
+ export function noBlockingIn(state, stepId, op) {
114
+ for (const rule of rulesInStep(state.compiled, stepId, state.currentRule, op)) {
115
+ if ((rule.severity ?? 'block') !== 'block')
116
+ continue;
117
+ if (!isRelevantRule(state, rule))
118
+ continue;
119
+ if (evaluateRuleOnce(state, rule).results.some(isBlocking))
120
+ return false;
121
+ }
122
+ return true;
123
+ }
124
+ /**
125
+ * Maps one target's presence to the four-state outcome `required_in` folds, agreeing with
126
+ * `requiredStatus` in `eval/state/field-state.ts`.
127
+ */
128
+ function presenceOutcome(state, presence, ref) {
129
+ switch (presence) {
130
+ case 'present':
131
+ case 'unreadable':
132
+ return 'PASS';
133
+ case 'absent':
134
+ case 'null':
135
+ if (state.accessWindow.mayFill(ref))
136
+ return 'FAIL';
137
+ state.reader.noteDeferredInput();
138
+ return 'DEFERRED';
139
+ case 'redacted':
140
+ state.reader.noteDeferredInput();
141
+ return 'DEFERRED';
142
+ case 'undetermined':
143
+ return 'UNKNOWN';
144
+ default:
145
+ return assertNever(presence);
146
+ }
147
+ }
148
+ /** The member name an item-scoped required rule constrains. */
149
+ function requiredMember(rule) {
150
+ return rule.scope === 'item' ? rule.targetFieldId : rule.fieldId;
151
+ }
152
+ /** Locates a target member inside an array's row declaration, descending into nested records. */
153
+ function findRowMember(members, targetId, prefix = []) {
154
+ for (const candidate of members) {
155
+ const nextPath = [...prefix, candidate.fieldId];
156
+ if (candidate.fieldId === targetId)
157
+ return { field: candidate, path: nextPath };
158
+ if (candidate.primitive === 'record' && candidate.fields !== undefined) {
159
+ const nested = findRowMember(candidate.fields, targetId, nextPath);
160
+ if (nested !== undefined)
161
+ return nested;
162
+ }
163
+ }
164
+ return undefined;
165
+ }
166
+ /** Reads a raw value along `segments` without triggering access denials. */
167
+ function rawAt(values, segments) {
168
+ let current = values;
169
+ for (const segment of segments) {
170
+ if (!isRecord(current))
171
+ return undefined;
172
+ if (!Object.hasOwn(current, segment))
173
+ return undefined;
174
+ current = current[segment];
175
+ }
176
+ return current;
177
+ }
178
+ /**
179
+ * Presence metadata for one row member of an array, answered without reading the value through
180
+ * the access-denied value path. Matches `presenceOfField` in `eval/state/field-state.ts`.
181
+ */
182
+ function itemMemberPresence(state, memberField, rowPath, item, rowKey) {
183
+ if (state.accessWindow.isRedacted({ fieldId: memberField.fieldId, rowKey })) {
184
+ return 'redacted';
185
+ }
186
+ const computed = state.computed.getRow(memberField.fieldId, rowKey) ?? state.computed.get(memberField.fieldId);
187
+ if (computed !== undefined) {
188
+ if (computed.kind === 'undetermined') {
189
+ return computed.sentinel === DEFERRED ? 'redacted' : 'undetermined';
190
+ }
191
+ return computed.value === null ? 'null' : 'present';
192
+ }
193
+ let current = item;
194
+ for (const segment of rowPath) {
195
+ if (!isRecord(current))
196
+ return 'absent';
197
+ if (!Object.hasOwn(current, segment))
198
+ return 'absent';
199
+ current = current[segment];
200
+ if (current === undefined)
201
+ return 'undetermined';
202
+ }
203
+ if (current === null)
204
+ return 'null';
205
+ try {
206
+ toWireValue(current, `$.values.${rowPath.join('.')}`, wireDeclarationOf(memberField));
207
+ return 'present';
208
+ }
209
+ catch (error) {
210
+ if (!(error instanceof AxiomError))
211
+ throw error;
212
+ return 'undetermined';
213
+ }
214
+ }
215
+ /**
216
+ * `required_in(stepId)`: every requirement the step's `required` rules state is satisfied.
217
+ *
218
+ * `required` is a condition, not a presence test (`[RULES-2.1.5]`), so the fold reads both: a
219
+ * rule whose condition is `PASS` requires its target, and the target then has to hold a value.
220
+ * An undecided condition is `FAIL` (an unreadable condition must never present as a satisfied
221
+ * requirement), a rule that decided `FAIL` requires nothing, and a fired target's presence folds
222
+ * across all four states (`PASS`, `FAIL`, `DEFERRED`, `UNKNOWN`) to agree with field-state
223
+ * derivation.
224
+ *
225
+ * This is the one foldable form of `required`: a gate can ask it once for a whole step instead
226
+ * of listing each `required` rule id, and a rule added to the step is weighed without editing
227
+ * the gate.
228
+ */
229
+ export function requiredIn(state, stepId, op) {
230
+ const outcomes = [];
231
+ for (const rule of rulesInStep(state.compiled, stepId, state.currentRule, op)) {
232
+ if (rule.kind !== 'required')
233
+ continue;
234
+ // A requirement whose target is not on the form is not a requirement the respondent can
235
+ // satisfy, so it does not contribute to the step's fold.
236
+ if (!isRelevantRule(state, rule))
237
+ continue;
238
+ outcomes.push(requiredRuleOutcome(state, rule));
239
+ }
240
+ return andAll(outcomes);
241
+ }
242
+ /** One `required` rule's folded presence outcome across its target or every fired row. */
243
+ function requiredRuleOutcome(state, rule) {
244
+ const member = requiredMember(rule);
245
+ if (rule.scope !== 'item') {
246
+ const status = foldOf(state, rule);
247
+ if (status === 'FAIL')
248
+ return 'PASS';
249
+ if (status === 'DEFERRED') {
250
+ state.reader.noteDeferredInput();
251
+ return 'DEFERRED';
252
+ }
253
+ if (status !== 'PASS')
254
+ return 'FAIL';
255
+ if (member === undefined)
256
+ return 'PASS';
257
+ const path = state.reader.declarationPathOf(member);
258
+ return presenceOutcome(state, state.reader.presence(path), { fieldId: member });
259
+ }
260
+ const results = evaluateRuleOnce(state, rule).results;
261
+ if (results.length === 0)
262
+ return 'PASS';
263
+ if (results.some((result) => result.rowKey === undefined)) {
264
+ const status = andAll(results.map((result) => result.status));
265
+ if (status === 'FAIL')
266
+ return 'PASS';
267
+ if (status === 'DEFERRED') {
268
+ state.reader.noteDeferredInput();
269
+ return 'DEFERRED';
270
+ }
271
+ return status === 'PASS' ? 'PASS' : 'FAIL';
272
+ }
273
+ const outcomes = [];
274
+ const firedRows = new Set();
275
+ for (const result of results) {
276
+ if (result.status === 'FAIL')
277
+ continue;
278
+ if (result.status === 'DEFERRED') {
279
+ state.reader.noteDeferredInput();
280
+ outcomes.push('DEFERRED');
281
+ continue;
282
+ }
283
+ if (result.status !== 'PASS' || result.rowKey === undefined)
284
+ return 'FAIL';
285
+ firedRows.add(rowKeyToken(result.rowKey));
286
+ }
287
+ if (firedRows.size === 0)
288
+ return andAll(outcomes);
289
+ if (member === undefined)
290
+ return andAll(outcomes);
291
+ const arrayId = rule.fieldId;
292
+ if (arrayId === undefined)
293
+ return andAll(outcomes);
294
+ if (state.accessWindow.isRedacted({ fieldId: arrayId })) {
295
+ state.reader.noteDeferredInput();
296
+ outcomes.push('DEFERRED');
297
+ return andAll(outcomes);
298
+ }
299
+ const arrayPath = state.reader.declarationPathOf(arrayId);
300
+ const field = state.reader.index.fieldsByPath.get(arrayPath);
301
+ if (field === undefined || field.primitive !== 'array')
302
+ return 'UNKNOWN';
303
+ const located = findRowMember(field.fields ?? [], member);
304
+ if (located === undefined)
305
+ return 'UNKNOWN';
306
+ const computedArray = state.computed.get(arrayId);
307
+ let rows;
308
+ if (computedArray !== undefined) {
309
+ if (computedArray.kind === 'undetermined') {
310
+ if (computedArray.sentinel === DEFERRED) {
311
+ state.reader.noteDeferredInput();
312
+ outcomes.push('DEFERRED');
313
+ }
314
+ else {
315
+ outcomes.push('UNKNOWN');
316
+ }
317
+ return andAll(outcomes);
318
+ }
319
+ if (!isWireArray(computedArray.value))
320
+ return 'UNKNOWN';
321
+ rows = computedArray.value;
322
+ }
323
+ else {
324
+ const rawArray = rawAt(state.input.values, arrayPath.split('.'));
325
+ if (!Array.isArray(rawArray))
326
+ return 'UNKNOWN';
327
+ rows = rawArray;
328
+ }
329
+ const manifest = state.reader.index.assignedRowKeys?.(field.fieldId);
330
+ for (const [index, item] of rows.entries()) {
331
+ const rowKey = rowKeyOfItem(field, rows, index, manifest);
332
+ if (rowKey === undefined) {
333
+ outcomes.push('UNKNOWN');
334
+ continue;
335
+ }
336
+ if (!firedRows.has(rowKeyToken(rowKey)))
337
+ continue;
338
+ const presence = itemMemberPresence(state, located.field, located.path, item, rowKey);
339
+ outcomes.push(presenceOutcome(state, presence, { fieldId: located.field.fieldId, rowKey }));
340
+ }
341
+ return andAll(outcomes);
342
+ }
343
+ /** One step's or section's field placements, for a caller that must name them without a rule. */
344
+ export function stepFieldsOf(compiled, stepId) {
345
+ return [...(targetIndexOf(compiled).get(stepId)?.fieldIds ?? [])];
346
+ }
347
+ /** The `LayoutStep` one id names, when the artifact places it. */
348
+ export function declaredStep(compiled, stepId) {
349
+ const visit = (nodes) => {
350
+ for (const node of nodes) {
351
+ if (node.kind === 'step' && node.stepId === stepId)
352
+ return node;
353
+ const children = node.kind === 'section' ||
354
+ node.kind === 'group' ||
355
+ node.kind === 'step' ||
356
+ node.kind === 'wizard'
357
+ ? node.children
358
+ : [];
359
+ const found = visit(children);
360
+ if (found !== undefined)
361
+ return found;
362
+ }
363
+ return undefined;
364
+ };
365
+ return visit(compiled.layout ?? []);
366
+ }
367
+ //# sourceMappingURL=steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.js","sourceRoot":"","sources":["../../../src/eval/rule/steps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAqBlE,MAAM,OAAO,GAA6D,IAAI,OAAO,EAAE,CAAC;AAExF,sFAAsF;AACtF,SAAS,aAAa,CAAC,KAA4B,EAAE,IAAiB;IACpE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,OAAO;gBACV,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;YACR,KAAK,SAAS,CAAC;YACf,KAAK,OAAO,CAAC;YACb,KAAK,MAAM,CAAC;YACZ,KAAK,QAAQ;gBACX,aAAa,CAAC,IAAI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CAAC,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9F,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,YAAY,CAAC,QAAwB,EAAE,MAAc;IACnE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,YAAY,CAAC,QAAwB,EAAE,MAAc;IACnE,MAAM,KAAK,GAAG,CAAC,KAA4B,EAA0B,EAAE;QACrE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,IAAI,CAAC;YAChE,MAAM,QAAQ,GACZ,IAAI,CAAC,IAAI,KAAK,SAAS;gBACvB,IAAI,CAAC,IAAI,KAAK,OAAO;gBACrB,IAAI,CAAC,IAAI,KAAK,MAAM;gBACpB,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACpB,CAAC,CAAC,IAAI,CAAC,QAAQ;gBACf,CAAC,CAAC,EAAE,CAAC;YACT,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAC;QACxC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IACF,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import type { CompiledField, CompiledRule, FieldRef, Outcome } from '../../model/types.js';\nimport { DEFERRED } from '../../model/types.js';\nimport type { CompiledSchema } from '../../model/schema.js';\nimport type { LayoutNode, LayoutStep } from '../../model/layout.js';\nimport { AxiomError, assertNever } from '../../model/errors.js';\nimport { andAll } from '../../expr/logic.js';\nimport { isRecord, isWireArray } from '../../model/values.js';\nimport { rowKeyToken, toWireValue, wireDeclarationOf } from '../../model/wire.js';\nimport { rowKeyOfItem } from '../addressing.js';\nimport type { Presence } from '../expr/value.js';\nimport { admissionOutcome, isBlocking } from '../seal.js';\nimport { evaluateRuleOnce, isRelevantRule } from './execution.js';\nimport type { EvaluationState } from './state.js';\n\n/**\n * Step-scoped rule folds, `spec/semantics/rules-v1.md` `[RULES-1.1.12]`.\n *\n * Layout is presentation, but a wizard step is also the unit an author groups rules by. A step\n * names a set of field placements, and a rule is *in* that step when the fields it decides are\n * placed there. The index is derived from the artifact once, so a gate item can ask\n * \"does every rule in this step pass?\" without the author hand-listing rule ids, and the\n * answer cannot drift when a rule is added.\n *\n * A step the artifact does not declare is not a scope: the fold refuses it rather than\n * answering `true` over an empty set, because silence must never read as permission.\n */\n\ninterface FoldTarget {\n readonly targetId: string;\n readonly fieldIds: ReadonlySet<string>;\n}\n\nconst TARGETS: WeakMap<CompiledSchema, ReadonlyMap<string, FoldTarget>> = new WeakMap();\n\n/** Collects every field placement inside one layout subtree, at any nesting depth. */\nfunction collectFields(nodes: readonly LayoutNode[], into: Set<string>): void {\n for (const node of nodes) {\n switch (node.kind) {\n case 'field':\n into.add(node.fieldId);\n break;\n case 'section':\n case 'group':\n case 'step':\n case 'wizard':\n collectFields(node.children, into);\n break;\n default:\n break;\n }\n }\n}\n\n/**\n * Every layout node a fold may target, with the fields its subtree places.\n *\n * A wizard step and a section are both addressable: a first-time adopter reaches for a\n * section, and wrapping a form in a one-step wizard purely to get a presence fold is\n * ceremony. A section states its id optionally, so one without an id is not a target — its\n * fields still belong to the enclosing target's fold. A group names no id at all; its fields\n * count towards the section or step that holds it.\n */\nfunction targetIndexOf(compiled: CompiledSchema): ReadonlyMap<string, FoldTarget> {\n const cached = TARGETS.get(compiled);\n if (cached !== undefined) return cached;\n const targets = new Map<string, FoldTarget>();\n const visit = (nodes: readonly LayoutNode[]): void => {\n for (const node of nodes) {\n if (node.kind === 'step') {\n const fieldIds = new Set<string>();\n collectFields(node.children, fieldIds);\n targets.set(node.stepId, { targetId: node.stepId, fieldIds });\n }\n if (node.kind === 'section' && node.sectionId !== undefined) {\n // The subtree includes nested sections and groups, so a fold over an outer section\n // covers every field its inner sections place.\n const fieldIds = new Set<string>();\n collectFields(node.children, fieldIds);\n targets.set(node.sectionId, { targetId: node.sectionId, fieldIds });\n }\n if (node.kind === 'section' || node.kind === 'group' || node.kind === 'step') {\n visit(node.children);\n }\n if (node.kind === 'wizard') visit(node.children);\n }\n };\n visit(compiled.layout ?? []);\n TARGETS.set(compiled, targets);\n return targets;\n}\n\n/** Whether one rule decides any field a step places. */\nfunction ruleIsInStep(step: FoldTarget, rule: CompiledRule): boolean {\n if (rule.fieldIds !== undefined)\n return rule.fieldIds.some((fieldId) => step.fieldIds.has(fieldId));\n return rule.fieldId !== undefined && step.fieldIds.has(rule.fieldId);\n}\n\nfunction stepOf(compiled: CompiledSchema, targetId: string, op: string): FoldTarget {\n const step = targetIndexOf(compiled).get(targetId);\n if (step === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `${op} names layout target ${JSON.stringify(targetId)}, which this artifact does not declare`,\n targetId,\n );\n }\n return step;\n}\n\n/** Every rule in one step, in declaration order, excluding the rule that is asking. */\nexport function rulesInStep(\n compiled: CompiledSchema,\n stepId: string,\n asking: CompiledRule | undefined,\n op: string,\n): readonly CompiledRule[] {\n const step = stepOf(compiled, stepId, op);\n return (compiled.rules ?? []).filter((rule) => rule !== asking && ruleIsInStep(step, rule));\n}\n\n/** One rule's folded outcome across every row it produced. */\nfunction foldOf(state: EvaluationState, rule: CompiledRule): Outcome {\n return andAll(evaluateRuleOnce(state, rule).results.map((result) => result.status));\n}\n\n/** One rule's folded *admission* outcome across every row it produced, `RULES-1.1.5`. */\nfunction admissionOf(state: EvaluationState, rule: CompiledRule): Outcome {\n return andAll(evaluateRuleOnce(state, rule).results.map(admissionOutcome));\n}\n\n/**\n * `rule_ok_in(stepId)`: every rule the step places passes its admission question.\n *\n * Zero rules is `PASS`, the same empty fold `no_blocking` states. A rule the step gate itself\n * is (the asking rule) is excluded, because its outcome does not exist until the fold answers.\n * A `visible`, `required` or `enabled` `FAIL` is the branch in which that rule's condition does\n * not apply — the field is hidden, nothing is required, the control is read-only — so it\n * contributes `PASS`. Every real wizard step holds one of those conditions, and folding them\n * as failures made a complete step permanently unpassable (`RULES-1.1.5`, `RULES-2.1.10`).\n */\nexport function outcomeOfStep(state: EvaluationState, stepId: string, op: string): Outcome {\n const rules = rulesInStep(state.compiled, stepId, state.currentRule, op);\n return andAll(\n rules.filter((rule) => isRelevantRule(state, rule)).map((rule) => admissionOf(state, rule)),\n );\n}\n\n/**\n * `no_blocking_in(stepId)`: no `block`-severity rule the step places blocks.\n *\n * The same classification the report status folds (`[RULES-1.1.9]`): a `FAIL` that states a\n * branch blocks nothing, while an undecided result blocks because nothing was decided.\n */\nexport function noBlockingIn(state: EvaluationState, stepId: string, op: string): boolean {\n for (const rule of rulesInStep(state.compiled, stepId, state.currentRule, op)) {\n if ((rule.severity ?? 'block') !== 'block') continue;\n if (!isRelevantRule(state, rule)) continue;\n if (evaluateRuleOnce(state, rule).results.some(isBlocking)) return false;\n }\n return true;\n}\n\n/**\n * Maps one target's presence to the four-state outcome `required_in` folds, agreeing with\n * `requiredStatus` in `eval/state/field-state.ts`.\n */\nfunction presenceOutcome(state: EvaluationState, presence: Presence, ref: FieldRef): Outcome {\n switch (presence) {\n case 'present':\n case 'unreadable':\n return 'PASS';\n case 'absent':\n case 'null':\n if (state.accessWindow.mayFill(ref)) return 'FAIL';\n state.reader.noteDeferredInput();\n return 'DEFERRED';\n case 'redacted':\n state.reader.noteDeferredInput();\n return 'DEFERRED';\n case 'undetermined':\n return 'UNKNOWN';\n default:\n return assertNever(presence);\n }\n}\n\n/** The member name an item-scoped required rule constrains. */\nfunction requiredMember(rule: CompiledRule): string | undefined {\n return rule.scope === 'item' ? rule.targetFieldId : rule.fieldId;\n}\n\n/** Locates a target member inside an array's row declaration, descending into nested records. */\nfunction findRowMember(\n members: readonly CompiledField[],\n targetId: string,\n prefix: readonly string[] = [],\n): { readonly field: CompiledField; readonly path: readonly string[] } | undefined {\n for (const candidate of members) {\n const nextPath = [...prefix, candidate.fieldId];\n if (candidate.fieldId === targetId) return { field: candidate, path: nextPath };\n if (candidate.primitive === 'record' && candidate.fields !== undefined) {\n const nested = findRowMember(candidate.fields, targetId, nextPath);\n if (nested !== undefined) return nested;\n }\n }\n return undefined;\n}\n\n/** Reads a raw value along `segments` without triggering access denials. */\nfunction rawAt(values: unknown, segments: readonly string[]): unknown {\n let current: unknown = values;\n for (const segment of segments) {\n if (!isRecord(current)) return undefined;\n if (!Object.hasOwn(current, segment)) return undefined;\n current = current[segment];\n }\n return current;\n}\n\n/**\n * Presence metadata for one row member of an array, answered without reading the value through\n * the access-denied value path. Matches `presenceOfField` in `eval/state/field-state.ts`.\n */\nfunction itemMemberPresence(\n state: EvaluationState,\n memberField: CompiledField,\n rowPath: readonly string[],\n item: unknown,\n rowKey: string | number,\n): Presence {\n if (state.accessWindow.isRedacted({ fieldId: memberField.fieldId, rowKey })) {\n return 'redacted';\n }\n const computed =\n state.computed.getRow(memberField.fieldId, rowKey) ?? state.computed.get(memberField.fieldId);\n if (computed !== undefined) {\n if (computed.kind === 'undetermined') {\n return computed.sentinel === DEFERRED ? 'redacted' : 'undetermined';\n }\n return computed.value === null ? 'null' : 'present';\n }\n let current: unknown = item;\n for (const segment of rowPath) {\n if (!isRecord(current)) return 'absent';\n if (!Object.hasOwn(current, segment)) return 'absent';\n current = current[segment];\n if (current === undefined) return 'undetermined';\n }\n if (current === null) return 'null';\n try {\n toWireValue(current, `$.values.${rowPath.join('.')}`, wireDeclarationOf(memberField));\n return 'present';\n } catch (error) {\n if (!(error instanceof AxiomError)) throw error;\n return 'undetermined';\n }\n}\n\n/**\n * `required_in(stepId)`: every requirement the step's `required` rules state is satisfied.\n *\n * `required` is a condition, not a presence test (`[RULES-2.1.5]`), so the fold reads both: a\n * rule whose condition is `PASS` requires its target, and the target then has to hold a value.\n * An undecided condition is `FAIL` (an unreadable condition must never present as a satisfied\n * requirement), a rule that decided `FAIL` requires nothing, and a fired target's presence folds\n * across all four states (`PASS`, `FAIL`, `DEFERRED`, `UNKNOWN`) to agree with field-state\n * derivation.\n *\n * This is the one foldable form of `required`: a gate can ask it once for a whole step instead\n * of listing each `required` rule id, and a rule added to the step is weighed without editing\n * the gate.\n */\nexport function requiredIn(state: EvaluationState, stepId: string, op: string): Outcome {\n const outcomes: Outcome[] = [];\n for (const rule of rulesInStep(state.compiled, stepId, state.currentRule, op)) {\n if (rule.kind !== 'required') continue;\n // A requirement whose target is not on the form is not a requirement the respondent can\n // satisfy, so it does not contribute to the step's fold.\n if (!isRelevantRule(state, rule)) continue;\n outcomes.push(requiredRuleOutcome(state, rule));\n }\n return andAll(outcomes);\n}\n\n/** One `required` rule's folded presence outcome across its target or every fired row. */\nfunction requiredRuleOutcome(state: EvaluationState, rule: CompiledRule): Outcome {\n const member = requiredMember(rule);\n if (rule.scope !== 'item') {\n const status = foldOf(state, rule);\n if (status === 'FAIL') return 'PASS';\n if (status === 'DEFERRED') {\n state.reader.noteDeferredInput();\n return 'DEFERRED';\n }\n if (status !== 'PASS') return 'FAIL';\n if (member === undefined) return 'PASS';\n const path = state.reader.declarationPathOf(member);\n return presenceOutcome(state, state.reader.presence(path), { fieldId: member });\n }\n const results = evaluateRuleOnce(state, rule).results;\n if (results.length === 0) return 'PASS';\n if (results.some((result) => result.rowKey === undefined)) {\n const status = andAll(results.map((result) => result.status));\n if (status === 'FAIL') return 'PASS';\n if (status === 'DEFERRED') {\n state.reader.noteDeferredInput();\n return 'DEFERRED';\n }\n return status === 'PASS' ? 'PASS' : 'FAIL';\n }\n const outcomes: Outcome[] = [];\n const firedRows = new Set<string>();\n for (const result of results) {\n if (result.status === 'FAIL') continue;\n if (result.status === 'DEFERRED') {\n state.reader.noteDeferredInput();\n outcomes.push('DEFERRED');\n continue;\n }\n if (result.status !== 'PASS' || result.rowKey === undefined) return 'FAIL';\n firedRows.add(rowKeyToken(result.rowKey));\n }\n if (firedRows.size === 0) return andAll(outcomes);\n if (member === undefined) return andAll(outcomes);\n const arrayId = rule.fieldId;\n if (arrayId === undefined) return andAll(outcomes);\n if (state.accessWindow.isRedacted({ fieldId: arrayId })) {\n state.reader.noteDeferredInput();\n outcomes.push('DEFERRED');\n return andAll(outcomes);\n }\n const arrayPath = state.reader.declarationPathOf(arrayId);\n const field = state.reader.index.fieldsByPath.get(arrayPath);\n if (field === undefined || field.primitive !== 'array') return 'UNKNOWN';\n const located = findRowMember(field.fields ?? [], member);\n if (located === undefined) return 'UNKNOWN';\n const computedArray = state.computed.get(arrayId);\n let rows: readonly unknown[];\n if (computedArray !== undefined) {\n if (computedArray.kind === 'undetermined') {\n if (computedArray.sentinel === DEFERRED) {\n state.reader.noteDeferredInput();\n outcomes.push('DEFERRED');\n } else {\n outcomes.push('UNKNOWN');\n }\n return andAll(outcomes);\n }\n if (!isWireArray(computedArray.value)) return 'UNKNOWN';\n rows = computedArray.value;\n } else {\n const rawArray = rawAt(state.input.values, arrayPath.split('.'));\n if (!Array.isArray(rawArray)) return 'UNKNOWN';\n rows = rawArray;\n }\n const manifest = state.reader.index.assignedRowKeys?.(field.fieldId);\n for (const [index, item] of rows.entries()) {\n const rowKey = rowKeyOfItem(field, rows, index, manifest);\n if (rowKey === undefined) {\n outcomes.push('UNKNOWN');\n continue;\n }\n if (!firedRows.has(rowKeyToken(rowKey))) continue;\n const presence = itemMemberPresence(state, located.field, located.path, item, rowKey);\n outcomes.push(presenceOutcome(state, presence, { fieldId: located.field.fieldId, rowKey }));\n }\n return andAll(outcomes);\n}\n\n/** One step's or section's field placements, for a caller that must name them without a rule. */\nexport function stepFieldsOf(compiled: CompiledSchema, stepId: string): readonly string[] {\n return [...(targetIndexOf(compiled).get(stepId)?.fieldIds ?? [])];\n}\n\n/** The `LayoutStep` one id names, when the artifact places it. */\nexport function declaredStep(compiled: CompiledSchema, stepId: string): LayoutStep | undefined {\n const visit = (nodes: readonly LayoutNode[]): LayoutStep | undefined => {\n for (const node of nodes) {\n if (node.kind === 'step' && node.stepId === stepId) return node;\n const children =\n node.kind === 'section' ||\n node.kind === 'group' ||\n node.kind === 'step' ||\n node.kind === 'wizard'\n ? node.children\n : [];\n const found = visit(children);\n if (found !== undefined) return found;\n }\n return undefined;\n };\n return visit(compiled.layout ?? []);\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import type { EvaluationState } from './state.js';
2
+ /**
3
+ * Whether the `visible` rules naming one field leave it visible. Only a
4
+ * decided `FAIL` hides: an undecided rule leaves the field visible, and a rule this device
5
+ * was not given defers rather than hides.
6
+ *
7
+ * The rules are evaluated through the same memoised path every other reader of an outcome
8
+ * uses, so `is_relevant` inside one rule neither re-runs a rule nor loops: a rule that asks
9
+ * about the very field it hides meets the cycle guard and answers visible.
10
+ */
11
+ export declare function isFieldVisible(state: EvaluationState, fieldId: string): boolean;
12
+ /**
13
+ * Whether a value at `fieldId` is hidden *and* excluded from the report: the one state in
14
+ * which quoting the value anywhere but the submission would disclose it. A field with no
15
+ * `visible` rule that reaches it, or one the rules leave visible, is never withheld.
16
+ */
17
+ export declare function isWithheldField(state: EvaluationState, fieldId: string): boolean;
18
+ //# sourceMappingURL=visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/eval/rule/visibility.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAwB/E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAMhF"}
@@ -0,0 +1,79 @@
1
+ import { andAll } from '../../expr/logic.js';
2
+ import { AxiomError } from '../../model/errors.js';
3
+ import { isHiddenBy } from '../visibility.js';
4
+ import { recordEngineError } from './diagnostics.js';
5
+ import { evaluateRuleOnce } from './execution.js';
6
+ /**
7
+ * Whether the `visible` rules naming one field leave it visible. Only a
8
+ * decided `FAIL` hides: an undecided rule leaves the field visible, and a rule this device
9
+ * was not given defers rather than hides.
10
+ *
11
+ * The rules are evaluated through the same memoised path every other reader of an outcome
12
+ * uses, so `is_relevant` inside one rule neither re-runs a rule nor loops: a rule that asks
13
+ * about the very field it hides meets the cycle guard and answers visible.
14
+ */
15
+ export function isFieldVisible(state, fieldId) {
16
+ // No visibility decision is available while the computed values are being produced: a
17
+ // `visible` rule may itself read a computed field, and memoising it against a base value
18
+ // would make its answer depend on where the writer walk started. A writer sees its inputs
19
+ // as visible, which is the same fail-open answer an `UNKNOWN` rule gives.
20
+ if (state.resolvingWriters)
21
+ return true;
22
+ // A `visible` rule that reads the field it hides asks this question from inside its own
23
+ // evaluation. Leaving the field visible is the documented fail-open answer, and the guard
24
+ // makes it the answer without re-entering the rule.
25
+ if (state.visibilityInProgress.has(fieldId))
26
+ return true;
27
+ // The same question arrives through a value read (the disclosure-taint path) before any
28
+ // visibility walk has started, so `visibilityInProgress` does not know the field yet. A
29
+ // `visible` rule that is evaluating right now and reaches its own target must answer the
30
+ // same way here; re-entering it would raise the cycle guard, record an `ENGINE_ERROR`
31
+ // against a legal document and fold the record's status to `UNKNOWN`.
32
+ for (const rule of state.prepared.visibility.byField.get(fieldId) ?? []) {
33
+ if (state.rulesInProgress.has(rule))
34
+ return true;
35
+ }
36
+ state.visibilityInProgress.add(fieldId);
37
+ try {
38
+ return !isHiddenBy(state.prepared.visibility, (rule) => visibleStatusOf(state, rule), fieldId);
39
+ }
40
+ finally {
41
+ state.visibilityInProgress.delete(fieldId);
42
+ }
43
+ }
44
+ /**
45
+ * Whether a value at `fieldId` is hidden *and* excluded from the report: the one state in
46
+ * which quoting the value anywhere but the submission would disclose it. A field with no
47
+ * `visible` rule that reaches it, or one the rules leave visible, is never withheld.
48
+ */
49
+ export function isWithheldField(state, fieldId) {
50
+ if (!state.prepared.withholdable.has(fieldId))
51
+ return false;
52
+ if (isFieldVisible(state, fieldId))
53
+ return false;
54
+ const field = state.prepared.fieldById.get(fieldId);
55
+ const policy = field?.onHide ?? state.compiled.onHide ?? 'preserve';
56
+ return policy === 'exclude';
57
+ }
58
+ function visibleStatusOf(state, rule) {
59
+ const previous = state.answeringRelevance;
60
+ state.answeringRelevance = true;
61
+ try {
62
+ return andAll(evaluateRuleOnce(state, rule).results.map((result) => result.status));
63
+ }
64
+ catch (error) {
65
+ // The only refusal `evaluateRuleOnce` raises itself is its cycle guard; a rule whose
66
+ // expression raised is already folded to `UNKNOWN` there. Both leave the field visible
67
+ // and both are reported: the answer was a documented default rather
68
+ // than a decision, and silence would leave a rule that could not be answered
69
+ // indistinguishable from one that passed ( reports the same cycle).
70
+ if (!(error instanceof AxiomError))
71
+ throw error;
72
+ recordEngineError(state, rule.ruleId, error);
73
+ return 'UNKNOWN';
74
+ }
75
+ finally {
76
+ state.answeringRelevance = previous;
77
+ }
78
+ }
79
+ //# sourceMappingURL=visibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility.js","sourceRoot":"","sources":["../../../src/eval/rule/visibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGl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AQ,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,UAAU,CAAC;IACpE,OAAO,MAAM,KAAK,SAAS,CAAC;AAC9B,CAAC;AAED,SAAS,eAAe,CAAC,KAAsB,EAAE,IAAkB;IACjE,MAAM,QAAQ,GAAG,KAAK,CAAC,kBAAkB,CAAC;IAC1C,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAChC,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACtF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,qFAAqF;QACrF,uFAAuF;QACvF,oEAAoE;QACpE,6EAA6E;QAC7E,oEAAoE;QACpE,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC;YAAE,MAAM,KAAK,CAAC;QAChD,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7C,OAAO,SAAS,CAAC;IACnB,CAAC;YAAS,CAAC;QACT,KAAK,CAAC,kBAAkB,GAAG,QAAQ,CAAC;IACtC,CAAC;AACH,CAAC","sourcesContent":["import { andAll } from '../../expr/logic.js';\nimport { AxiomError } from '../../model/errors.js';\nimport type { CompiledRule, Outcome } from '../../model/types.js';\nimport { isHiddenBy } from '../visibility.js';\nimport { recordEngineError } from './diagnostics.js';\nimport { evaluateRuleOnce } from './execution.js';\nimport type { EvaluationState } from './state.js';\n\n/**\n * Whether the `visible` rules naming one field leave it visible. Only a\n * decided `FAIL` hides: an undecided rule leaves the field visible, and a rule this device\n * was not given defers rather than hides.\n *\n * The rules are evaluated through the same memoised path every other reader of an outcome\n * uses, so `is_relevant` inside one rule neither re-runs a rule nor loops: a rule that asks\n * about the very field it hides meets the cycle guard and answers visible.\n */\nexport function isFieldVisible(state: EvaluationState, fieldId: string): boolean {\n // No visibility decision is available while the computed values are being produced: a\n // `visible` rule may itself read a computed field, and memoising it against a base value\n // would make its answer depend on where the writer walk started. A writer sees its inputs\n // as visible, which is the same fail-open answer an `UNKNOWN` rule gives.\n if (state.resolvingWriters) return true;\n // A `visible` rule that reads the field it hides asks this question from inside its own\n // evaluation. Leaving the field visible is the documented fail-open answer, and the guard\n // makes it the answer without re-entering the rule.\n if (state.visibilityInProgress.has(fieldId)) return true;\n // The same question arrives through a value read (the disclosure-taint path) before any\n // visibility walk has started, so `visibilityInProgress` does not know the field yet. A\n // `visible` rule that is evaluating right now and reaches its own target must answer the\n // same way here; re-entering it would raise the cycle guard, record an `ENGINE_ERROR`\n // against a legal document and fold the record's status to `UNKNOWN`.\n for (const rule of state.prepared.visibility.byField.get(fieldId) ?? []) {\n if (state.rulesInProgress.has(rule)) return true;\n }\n state.visibilityInProgress.add(fieldId);\n try {\n return !isHiddenBy(state.prepared.visibility, (rule) => visibleStatusOf(state, rule), fieldId);\n } finally {\n state.visibilityInProgress.delete(fieldId);\n }\n}\n\n/**\n * Whether a value at `fieldId` is hidden *and* excluded from the report: the one state in\n * which quoting the value anywhere but the submission would disclose it. A field with no\n * `visible` rule that reaches it, or one the rules leave visible, is never withheld.\n */\nexport function isWithheldField(state: EvaluationState, fieldId: string): boolean {\n if (!state.prepared.withholdable.has(fieldId)) return false;\n if (isFieldVisible(state, fieldId)) return false;\n const field = state.prepared.fieldById.get(fieldId);\n const policy = field?.onHide ?? state.compiled.onHide ?? 'preserve';\n return policy === 'exclude';\n}\n\nfunction visibleStatusOf(state: EvaluationState, rule: CompiledRule): Outcome {\n const previous = state.answeringRelevance;\n state.answeringRelevance = true;\n try {\n return andAll(evaluateRuleOnce(state, rule).results.map((result) => result.status));\n } catch (error) {\n // The only refusal `evaluateRuleOnce` raises itself is its cycle guard; a rule whose\n // expression raised is already folded to `UNKNOWN` there. Both leave the field visible\n // and both are reported: the answer was a documented default rather\n // than a decision, and silence would leave a rule that could not be answered\n // indistinguishable from one that passed ( reports the same cycle).\n if (!(error instanceof AxiomError)) throw error;\n recordEngineError(state, rule.ruleId, error);\n return 'UNKNOWN';\n } finally {\n state.answeringRelevance = previous;\n }\n}\n"]}