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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (755) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +714 -2
  3. package/dist/cache/index.d.ts +191 -0
  4. package/dist/cache/index.d.ts.map +1 -0
  5. package/dist/cache/index.js +361 -0
  6. package/dist/cache/index.js.map +1 -0
  7. package/dist/canonical/jcs.d.ts +78 -0
  8. package/dist/canonical/jcs.d.ts.map +1 -0
  9. package/dist/canonical/jcs.js +500 -0
  10. package/dist/canonical/jcs.js.map +1 -0
  11. package/dist/canonical/restricted-json.d.ts +7 -0
  12. package/dist/canonical/restricted-json.d.ts.map +1 -0
  13. package/dist/canonical/restricted-json.js +318 -0
  14. package/dist/canonical/restricted-json.js.map +1 -0
  15. package/dist/canonical/restricted-value.d.ts +59 -0
  16. package/dist/canonical/restricted-value.d.ts.map +1 -0
  17. package/dist/canonical/restricted-value.js +156 -0
  18. package/dist/canonical/restricted-value.js.map +1 -0
  19. package/dist/canonical/restricted.d.ts +85 -0
  20. package/dist/canonical/restricted.d.ts.map +1 -0
  21. package/dist/canonical/restricted.js +163 -0
  22. package/dist/canonical/restricted.js.map +1 -0
  23. package/dist/canonical/signature.d.ts +38 -0
  24. package/dist/canonical/signature.d.ts.map +1 -0
  25. package/dist/canonical/signature.js +47 -0
  26. package/dist/canonical/signature.js.map +1 -0
  27. package/dist/eval/access/delivery.d.ts +63 -0
  28. package/dist/eval/access/delivery.d.ts.map +1 -0
  29. package/dist/eval/access/delivery.js +98 -0
  30. package/dist/eval/access/delivery.js.map +1 -0
  31. package/dist/eval/access/overlay.d.ts +72 -0
  32. package/dist/eval/access/overlay.d.ts.map +1 -0
  33. package/dist/eval/access/overlay.js +402 -0
  34. package/dist/eval/access/overlay.js.map +1 -0
  35. package/dist/eval/access/projection.d.ts +159 -0
  36. package/dist/eval/access/projection.d.ts.map +1 -0
  37. package/dist/eval/access/projection.js +211 -0
  38. package/dist/eval/access/projection.js.map +1 -0
  39. package/dist/eval/access/window.d.ts +128 -0
  40. package/dist/eval/access/window.d.ts.map +1 -0
  41. package/dist/eval/access/window.js +254 -0
  42. package/dist/eval/access/window.js.map +1 -0
  43. package/dist/eval/access/write.d.ts +113 -0
  44. package/dist/eval/access/write.d.ts.map +1 -0
  45. package/dist/eval/access/write.js +119 -0
  46. package/dist/eval/access/write.js.map +1 -0
  47. package/dist/eval/addressing.d.ts +131 -0
  48. package/dist/eval/addressing.d.ts.map +1 -0
  49. package/dist/eval/addressing.js +270 -0
  50. package/dist/eval/addressing.js.map +1 -0
  51. package/dist/eval/budget.d.ts +143 -0
  52. package/dist/eval/budget.d.ts.map +1 -0
  53. package/dist/eval/budget.js +387 -0
  54. package/dist/eval/budget.js.map +1 -0
  55. package/dist/eval/computed.d.ts +46 -0
  56. package/dist/eval/computed.d.ts.map +1 -0
  57. package/dist/eval/computed.js +89 -0
  58. package/dist/eval/computed.js.map +1 -0
  59. package/dist/eval/denials.d.ts +64 -0
  60. package/dist/eval/denials.d.ts.map +1 -0
  61. package/dist/eval/denials.js +87 -0
  62. package/dist/eval/denials.js.map +1 -0
  63. package/dist/eval/engine/cancellation.d.ts +12 -0
  64. package/dist/eval/engine/cancellation.d.ts.map +1 -0
  65. package/dist/eval/engine/cancellation.js +56 -0
  66. package/dist/eval/engine/cancellation.js.map +1 -0
  67. package/dist/eval/engine/delta.d.ts +104 -0
  68. package/dist/eval/engine/delta.d.ts.map +1 -0
  69. package/dist/eval/engine/delta.js +466 -0
  70. package/dist/eval/engine/delta.js.map +1 -0
  71. package/dist/eval/engine/deps.d.ts +136 -0
  72. package/dist/eval/engine/deps.d.ts.map +1 -0
  73. package/dist/eval/engine/deps.js +345 -0
  74. package/dist/eval/engine/deps.js.map +1 -0
  75. package/dist/eval/engine/identity.d.ts +128 -0
  76. package/dist/eval/engine/identity.d.ts.map +1 -0
  77. package/dist/eval/engine/identity.js +398 -0
  78. package/dist/eval/engine/identity.js.map +1 -0
  79. package/dist/eval/engine/index.d.ts +200 -0
  80. package/dist/eval/engine/index.d.ts.map +1 -0
  81. package/dist/eval/engine/index.js +1242 -0
  82. package/dist/eval/engine/index.js.map +1 -0
  83. package/dist/eval/engine/measurement.d.ts +23 -0
  84. package/dist/eval/engine/measurement.d.ts.map +1 -0
  85. package/dist/eval/engine/measurement.js +42 -0
  86. package/dist/eval/engine/measurement.js.map +1 -0
  87. package/dist/eval/engine/naive.d.ts +19 -0
  88. package/dist/eval/engine/naive.d.ts.map +1 -0
  89. package/dist/eval/engine/naive.js +59 -0
  90. package/dist/eval/engine/naive.js.map +1 -0
  91. package/dist/eval/engine/ops.d.ts +214 -0
  92. package/dist/eval/engine/ops.d.ts.map +1 -0
  93. package/dist/eval/engine/ops.js +1422 -0
  94. package/dist/eval/engine/ops.js.map +1 -0
  95. package/dist/eval/engine/patches.d.ts +40 -0
  96. package/dist/eval/engine/patches.d.ts.map +1 -0
  97. package/dist/eval/engine/patches.js +125 -0
  98. package/dist/eval/engine/patches.js.map +1 -0
  99. package/dist/eval/engine/ports.d.ts +71 -0
  100. package/dist/eval/engine/ports.d.ts.map +1 -0
  101. package/dist/eval/engine/ports.js +2 -0
  102. package/dist/eval/engine/ports.js.map +1 -0
  103. package/dist/eval/engine/session.d.ts +116 -0
  104. package/dist/eval/engine/session.d.ts.map +1 -0
  105. package/dist/eval/engine/session.js +653 -0
  106. package/dist/eval/engine/session.js.map +1 -0
  107. package/dist/eval/engine/snapshot.d.ts +97 -0
  108. package/dist/eval/engine/snapshot.d.ts.map +1 -0
  109. package/dist/eval/engine/snapshot.js +221 -0
  110. package/dist/eval/engine/snapshot.js.map +1 -0
  111. package/dist/eval/engine/subscriptions.d.ts +47 -0
  112. package/dist/eval/engine/subscriptions.d.ts.map +1 -0
  113. package/dist/eval/engine/subscriptions.js +103 -0
  114. package/dist/eval/engine/subscriptions.js.map +1 -0
  115. package/dist/eval/engine/trace.d.ts +77 -0
  116. package/dist/eval/engine/trace.d.ts.map +1 -0
  117. package/dist/eval/engine/trace.js +140 -0
  118. package/dist/eval/engine/trace.js.map +1 -0
  119. package/dist/eval/error-diagnostic.d.ts +26 -0
  120. package/dist/eval/error-diagnostic.d.ts.map +1 -0
  121. package/dist/eval/error-diagnostic.js +63 -0
  122. package/dist/eval/error-diagnostic.js.map +1 -0
  123. package/dist/eval/evaluate-expr.d.ts +44 -0
  124. package/dist/eval/evaluate-expr.d.ts.map +1 -0
  125. package/dist/eval/evaluate-expr.js +149 -0
  126. package/dist/eval/evaluate-expr.js.map +1 -0
  127. package/dist/eval/evaluate.d.ts +282 -0
  128. package/dist/eval/evaluate.d.ts.map +1 -0
  129. package/dist/eval/evaluate.js +391 -0
  130. package/dist/eval/evaluate.js.map +1 -0
  131. package/dist/eval/evolution/relocate.d.ts +72 -0
  132. package/dist/eval/evolution/relocate.d.ts.map +1 -0
  133. package/dist/eval/evolution/relocate.js +427 -0
  134. package/dist/eval/evolution/relocate.js.map +1 -0
  135. package/dist/eval/evolution/select.d.ts +11 -0
  136. package/dist/eval/evolution/select.d.ts.map +1 -0
  137. package/dist/eval/evolution/select.js +53 -0
  138. package/dist/eval/evolution/select.js.map +1 -0
  139. package/dist/eval/evolution/upcast.d.ts +13 -0
  140. package/dist/eval/evolution/upcast.d.ts.map +1 -0
  141. package/dist/eval/evolution/upcast.js +88 -0
  142. package/dist/eval/evolution/upcast.js.map +1 -0
  143. package/dist/eval/expr/aggregates.d.ts +75 -0
  144. package/dist/eval/expr/aggregates.d.ts.map +1 -0
  145. package/dist/eval/expr/aggregates.js +991 -0
  146. package/dist/eval/expr/aggregates.js.map +1 -0
  147. package/dist/eval/expr/arithmetic.d.ts +26 -0
  148. package/dist/eval/expr/arithmetic.d.ts.map +1 -0
  149. package/dist/eval/expr/arithmetic.js +387 -0
  150. package/dist/eval/expr/arithmetic.js.map +1 -0
  151. package/dist/eval/expr/between.d.ts +17 -0
  152. package/dist/eval/expr/between.d.ts.map +1 -0
  153. package/dist/eval/expr/between.js +46 -0
  154. package/dist/eval/expr/between.js.map +1 -0
  155. package/dist/eval/expr/binder.d.ts +96 -0
  156. package/dist/eval/expr/binder.d.ts.map +1 -0
  157. package/dist/eval/expr/binder.js +253 -0
  158. package/dist/eval/expr/binder.js.map +1 -0
  159. package/dist/eval/expr/call-dispatch.d.ts +28 -0
  160. package/dist/eval/expr/call-dispatch.d.ts.map +1 -0
  161. package/dist/eval/expr/call-dispatch.js +114 -0
  162. package/dist/eval/expr/call-dispatch.js.map +1 -0
  163. package/dist/eval/expr/collections.d.ts +20 -0
  164. package/dist/eval/expr/collections.d.ts.map +1 -0
  165. package/dist/eval/expr/collections.js +66 -0
  166. package/dist/eval/expr/collections.js.map +1 -0
  167. package/dist/eval/expr/compare.d.ts +36 -0
  168. package/dist/eval/expr/compare.d.ts.map +1 -0
  169. package/dist/eval/expr/compare.js +115 -0
  170. package/dist/eval/expr/compare.js.map +1 -0
  171. package/dist/eval/expr/datasets.d.ts +28 -0
  172. package/dist/eval/expr/datasets.d.ts.map +1 -0
  173. package/dist/eval/expr/datasets.js +304 -0
  174. package/dist/eval/expr/datasets.js.map +1 -0
  175. package/dist/eval/expr/digest.d.ts +23 -0
  176. package/dist/eval/expr/digest.d.ts.map +1 -0
  177. package/dist/eval/expr/digest.js +89 -0
  178. package/dist/eval/expr/digest.js.map +1 -0
  179. package/dist/eval/expr/domains.d.ts +19 -0
  180. package/dist/eval/expr/domains.d.ts.map +1 -0
  181. package/dist/eval/expr/domains.js +18 -0
  182. package/dist/eval/expr/domains.js.map +1 -0
  183. package/dist/eval/expr/host.d.ts +152 -0
  184. package/dist/eval/expr/host.d.ts.map +1 -0
  185. package/dist/eval/expr/host.js +36 -0
  186. package/dist/eval/expr/host.js.map +1 -0
  187. package/dist/eval/expr/lists.d.ts +24 -0
  188. package/dist/eval/expr/lists.d.ts.map +1 -0
  189. package/dist/eval/expr/lists.js +155 -0
  190. package/dist/eval/expr/lists.js.map +1 -0
  191. package/dist/eval/expr/member.d.ts +15 -0
  192. package/dist/eval/expr/member.d.ts.map +1 -0
  193. package/dist/eval/expr/member.js +32 -0
  194. package/dist/eval/expr/member.js.map +1 -0
  195. package/dist/eval/expr/money-ops.d.ts +10 -0
  196. package/dist/eval/expr/money-ops.d.ts.map +1 -0
  197. package/dist/eval/expr/money-ops.js +17 -0
  198. package/dist/eval/expr/money-ops.js.map +1 -0
  199. package/dist/eval/expr/operands.d.ts +27 -0
  200. package/dist/eval/expr/operands.d.ts.map +1 -0
  201. package/dist/eval/expr/operands.js +167 -0
  202. package/dist/eval/expr/operands.js.map +1 -0
  203. package/dist/eval/expr/presence.d.ts +27 -0
  204. package/dist/eval/expr/presence.d.ts.map +1 -0
  205. package/dist/eval/expr/presence.js +140 -0
  206. package/dist/eval/expr/presence.js.map +1 -0
  207. package/dist/eval/expr/records.d.ts +22 -0
  208. package/dist/eval/expr/records.d.ts.map +1 -0
  209. package/dist/eval/expr/records.js +101 -0
  210. package/dist/eval/expr/records.js.map +1 -0
  211. package/dist/eval/expr/rule-refs.d.ts +25 -0
  212. package/dist/eval/expr/rule-refs.d.ts.map +1 -0
  213. package/dist/eval/expr/rule-refs.js +60 -0
  214. package/dist/eval/expr/rule-refs.js.map +1 -0
  215. package/dist/eval/expr/sequences.d.ts +26 -0
  216. package/dist/eval/expr/sequences.d.ts.map +1 -0
  217. package/dist/eval/expr/sequences.js +151 -0
  218. package/dist/eval/expr/sequences.js.map +1 -0
  219. package/dist/eval/expr/value.d.ts +99 -0
  220. package/dist/eval/expr/value.d.ts.map +1 -0
  221. package/dist/eval/expr/value.js +14 -0
  222. package/dist/eval/expr/value.js.map +1 -0
  223. package/dist/eval/expression.d.ts +142 -0
  224. package/dist/eval/expression.d.ts.map +1 -0
  225. package/dist/eval/expression.js +446 -0
  226. package/dist/eval/expression.js.map +1 -0
  227. package/dist/eval/firing.d.ts +68 -0
  228. package/dist/eval/firing.d.ts.map +1 -0
  229. package/dist/eval/firing.js +222 -0
  230. package/dist/eval/firing.js.map +1 -0
  231. package/dist/eval/gate.d.ts +110 -0
  232. package/dist/eval/gate.d.ts.map +1 -0
  233. package/dist/eval/gate.js +278 -0
  234. package/dist/eval/gate.js.map +1 -0
  235. package/dist/eval/layout-visibility.d.ts +18 -0
  236. package/dist/eval/layout-visibility.d.ts.map +1 -0
  237. package/dist/eval/layout-visibility.js +61 -0
  238. package/dist/eval/layout-visibility.js.map +1 -0
  239. package/dist/eval/option-availability.d.ts +26 -0
  240. package/dist/eval/option-availability.d.ts.map +1 -0
  241. package/dist/eval/option-availability.js +580 -0
  242. package/dist/eval/option-availability.js.map +1 -0
  243. package/dist/eval/options-boundary.d.ts +15 -0
  244. package/dist/eval/options-boundary.d.ts.map +1 -0
  245. package/dist/eval/options-boundary.js +40 -0
  246. package/dist/eval/options-boundary.js.map +1 -0
  247. package/dist/eval/options.d.ts +99 -0
  248. package/dist/eval/options.d.ts.map +1 -0
  249. package/dist/eval/options.js +96 -0
  250. package/dist/eval/options.js.map +1 -0
  251. package/dist/eval/overrides.d.ts +116 -0
  252. package/dist/eval/overrides.d.ts.map +1 -0
  253. package/dist/eval/overrides.js +176 -0
  254. package/dist/eval/overrides.js.map +1 -0
  255. package/dist/eval/paths.d.ts +25 -0
  256. package/dist/eval/paths.d.ts.map +1 -0
  257. package/dist/eval/paths.js +47 -0
  258. package/dist/eval/paths.js.map +1 -0
  259. package/dist/eval/presentation-reads.d.ts +20 -0
  260. package/dist/eval/presentation-reads.d.ts.map +1 -0
  261. package/dist/eval/presentation-reads.js +2 -0
  262. package/dist/eval/presentation-reads.js.map +1 -0
  263. package/dist/eval/presentation.d.ts +122 -0
  264. package/dist/eval/presentation.d.ts.map +1 -0
  265. package/dist/eval/presentation.js +255 -0
  266. package/dist/eval/presentation.js.map +1 -0
  267. package/dist/eval/reader/context-value.d.ts +41 -0
  268. package/dist/eval/reader/context-value.d.ts.map +1 -0
  269. package/dist/eval/reader/context-value.js +129 -0
  270. package/dist/eval/reader/context-value.js.map +1 -0
  271. package/dist/eval/reader/covered.d.ts +53 -0
  272. package/dist/eval/reader/covered.d.ts.map +1 -0
  273. package/dist/eval/reader/covered.js +139 -0
  274. package/dist/eval/reader/covered.js.map +1 -0
  275. package/dist/eval/reader/declarations.d.ts +182 -0
  276. package/dist/eval/reader/declarations.d.ts.map +1 -0
  277. package/dist/eval/reader/declarations.js +153 -0
  278. package/dist/eval/reader/declarations.js.map +1 -0
  279. package/dist/eval/reader/member-access.d.ts +87 -0
  280. package/dist/eval/reader/member-access.d.ts.map +1 -0
  281. package/dist/eval/reader/member-access.js +212 -0
  282. package/dist/eval/reader/member-access.js.map +1 -0
  283. package/dist/eval/reader/memo.d.ts +34 -0
  284. package/dist/eval/reader/memo.d.ts.map +1 -0
  285. package/dist/eval/reader/memo.js +67 -0
  286. package/dist/eval/reader/memo.js.map +1 -0
  287. package/dist/eval/reader/overlay.d.ts +74 -0
  288. package/dist/eval/reader/overlay.d.ts.map +1 -0
  289. package/dist/eval/reader/overlay.js +365 -0
  290. package/dist/eval/reader/overlay.js.map +1 -0
  291. package/dist/eval/reader/questions.d.ts +37 -0
  292. package/dist/eval/reader/questions.d.ts.map +1 -0
  293. package/dist/eval/reader/questions.js +78 -0
  294. package/dist/eval/reader/questions.js.map +1 -0
  295. package/dist/eval/reader/resolve.d.ts +84 -0
  296. package/dist/eval/reader/resolve.d.ts.map +1 -0
  297. package/dist/eval/reader/resolve.js +310 -0
  298. package/dist/eval/reader/resolve.js.map +1 -0
  299. package/dist/eval/reader/value-read.d.ts +50 -0
  300. package/dist/eval/reader/value-read.d.ts.map +1 -0
  301. package/dist/eval/reader/value-read.js +133 -0
  302. package/dist/eval/reader/value-read.js.map +1 -0
  303. package/dist/eval/reader/withheld.d.ts +48 -0
  304. package/dist/eval/reader/withheld.d.ts.map +1 -0
  305. package/dist/eval/reader/withheld.js +108 -0
  306. package/dist/eval/reader/withheld.js.map +1 -0
  307. package/dist/eval/reader-paths.d.ts +24 -0
  308. package/dist/eval/reader-paths.d.ts.map +1 -0
  309. package/dist/eval/reader-paths.js +23 -0
  310. package/dist/eval/reader-paths.js.map +1 -0
  311. package/dist/eval/reader.d.ts +281 -0
  312. package/dist/eval/reader.d.ts.map +1 -0
  313. package/dist/eval/reader.js +560 -0
  314. package/dist/eval/reader.js.map +1 -0
  315. package/dist/eval/receipt.d.ts +37 -0
  316. package/dist/eval/receipt.d.ts.map +1 -0
  317. package/dist/eval/receipt.js +222 -0
  318. package/dist/eval/receipt.js.map +1 -0
  319. package/dist/eval/report/assemble.d.ts +84 -0
  320. package/dist/eval/report/assemble.d.ts.map +1 -0
  321. package/dist/eval/report/assemble.js +277 -0
  322. package/dist/eval/report/assemble.js.map +1 -0
  323. package/dist/eval/report/fold.d.ts +18 -0
  324. package/dist/eval/report/fold.d.ts.map +1 -0
  325. package/dist/eval/report/fold.js +58 -0
  326. package/dist/eval/report/fold.js.map +1 -0
  327. package/dist/eval/rule/alternatives.d.ts +23 -0
  328. package/dist/eval/rule/alternatives.d.ts.map +1 -0
  329. package/dist/eval/rule/alternatives.js +46 -0
  330. package/dist/eval/rule/alternatives.js.map +1 -0
  331. package/dist/eval/rule/behaviour.d.ts +47 -0
  332. package/dist/eval/rule/behaviour.d.ts.map +1 -0
  333. package/dist/eval/rule/behaviour.js +249 -0
  334. package/dist/eval/rule/behaviour.js.map +1 -0
  335. package/dist/eval/rule/compute.d.ts +46 -0
  336. package/dist/eval/rule/compute.d.ts.map +1 -0
  337. package/dist/eval/rule/compute.js +158 -0
  338. package/dist/eval/rule/compute.js.map +1 -0
  339. package/dist/eval/rule/create-state.d.ts +42 -0
  340. package/dist/eval/rule/create-state.d.ts.map +1 -0
  341. package/dist/eval/rule/create-state.js +134 -0
  342. package/dist/eval/rule/create-state.js.map +1 -0
  343. package/dist/eval/rule/diagnostics.d.ts +24 -0
  344. package/dist/eval/rule/diagnostics.d.ts.map +1 -0
  345. package/dist/eval/rule/diagnostics.js +45 -0
  346. package/dist/eval/rule/diagnostics.js.map +1 -0
  347. package/dist/eval/rule/execution.d.ts +24 -0
  348. package/dist/eval/rule/execution.d.ts.map +1 -0
  349. package/dist/eval/rule/execution.js +495 -0
  350. package/dist/eval/rule/execution.js.map +1 -0
  351. package/dist/eval/rule/gate.d.ts +12 -0
  352. package/dist/eval/rule/gate.d.ts.map +1 -0
  353. package/dist/eval/rule/gate.js +34 -0
  354. package/dist/eval/rule/gate.js.map +1 -0
  355. package/dist/eval/rule/item.d.ts +11 -0
  356. package/dist/eval/rule/item.d.ts.map +1 -0
  357. package/dist/eval/rule/item.js +265 -0
  358. package/dist/eval/rule/item.js.map +1 -0
  359. package/dist/eval/rule/prepare.d.ts +64 -0
  360. package/dist/eval/rule/prepare.d.ts.map +1 -0
  361. package/dist/eval/rule/prepare.js +131 -0
  362. package/dist/eval/rule/prepare.js.map +1 -0
  363. package/dist/eval/rule/result.d.ts +97 -0
  364. package/dist/eval/rule/result.d.ts.map +1 -0
  365. package/dist/eval/rule/result.js +347 -0
  366. package/dist/eval/rule/result.js.map +1 -0
  367. package/dist/eval/rule/runner.d.ts +128 -0
  368. package/dist/eval/rule/runner.d.ts.map +1 -0
  369. package/dist/eval/rule/runner.js +296 -0
  370. package/dist/eval/rule/runner.js.map +1 -0
  371. package/dist/eval/rule/screen.d.ts +32 -0
  372. package/dist/eval/rule/screen.d.ts.map +1 -0
  373. package/dist/eval/rule/screen.js +73 -0
  374. package/dist/eval/rule/screen.js.map +1 -0
  375. package/dist/eval/rule/state.d.ts +137 -0
  376. package/dist/eval/rule/state.d.ts.map +1 -0
  377. package/dist/eval/rule/state.js +2 -0
  378. package/dist/eval/rule/state.js.map +1 -0
  379. package/dist/eval/rule/steps.d.ts +44 -0
  380. package/dist/eval/rule/steps.d.ts.map +1 -0
  381. package/dist/eval/rule/steps.js +367 -0
  382. package/dist/eval/rule/steps.js.map +1 -0
  383. package/dist/eval/rule/visibility.d.ts +18 -0
  384. package/dist/eval/rule/visibility.d.ts.map +1 -0
  385. package/dist/eval/rule/visibility.js +79 -0
  386. package/dist/eval/rule/visibility.js.map +1 -0
  387. package/dist/eval/seal.d.ts +74 -0
  388. package/dist/eval/seal.d.ts.map +1 -0
  389. package/dist/eval/seal.js +154 -0
  390. package/dist/eval/seal.js.map +1 -0
  391. package/dist/eval/signature-coverage.d.ts +19 -0
  392. package/dist/eval/signature-coverage.d.ts.map +1 -0
  393. package/dist/eval/signature-coverage.js +160 -0
  394. package/dist/eval/signature-coverage.js.map +1 -0
  395. package/dist/eval/state/derive.d.ts +72 -0
  396. package/dist/eval/state/derive.d.ts.map +1 -0
  397. package/dist/eval/state/derive.js +61 -0
  398. package/dist/eval/state/derive.js.map +1 -0
  399. package/dist/eval/state/describe.d.ts +18 -0
  400. package/dist/eval/state/describe.d.ts.map +1 -0
  401. package/dist/eval/state/describe.js +19 -0
  402. package/dist/eval/state/describe.js.map +1 -0
  403. package/dist/eval/state/field-state.d.ts +471 -0
  404. package/dist/eval/state/field-state.d.ts.map +1 -0
  405. package/dist/eval/state/field-state.js +1604 -0
  406. package/dist/eval/state/field-state.js.map +1 -0
  407. package/dist/eval/state/measurement.d.ts +136 -0
  408. package/dist/eval/state/measurement.d.ts.map +1 -0
  409. package/dist/eval/state/measurement.js +209 -0
  410. package/dist/eval/state/measurement.js.map +1 -0
  411. package/dist/eval/state/options.d.ts +21 -0
  412. package/dist/eval/state/options.d.ts.map +1 -0
  413. package/dist/eval/state/options.js +3 -0
  414. package/dist/eval/state/options.js.map +1 -0
  415. package/dist/eval/state/readiness.d.ts +400 -0
  416. package/dist/eval/state/readiness.d.ts.map +1 -0
  417. package/dist/eval/state/readiness.js +1067 -0
  418. package/dist/eval/state/readiness.js.map +1 -0
  419. package/dist/eval/state/snapshot.d.ts +130 -0
  420. package/dist/eval/state/snapshot.d.ts.map +1 -0
  421. package/dist/eval/state/snapshot.js +35 -0
  422. package/dist/eval/state/snapshot.js.map +1 -0
  423. package/dist/eval/state/unavailable-options.d.ts +54 -0
  424. package/dist/eval/state/unavailable-options.d.ts.map +1 -0
  425. package/dist/eval/state/unavailable-options.js +82 -0
  426. package/dist/eval/state/unavailable-options.js.map +1 -0
  427. package/dist/eval/state/value-state.d.ts +38 -0
  428. package/dist/eval/state/value-state.d.ts.map +1 -0
  429. package/dist/eval/state/value-state.js +52 -0
  430. package/dist/eval/state/value-state.js.map +1 -0
  431. package/dist/eval/submission/admission.d.ts +50 -0
  432. package/dist/eval/submission/admission.d.ts.map +1 -0
  433. package/dist/eval/submission/admission.js +174 -0
  434. package/dist/eval/submission/admission.js.map +1 -0
  435. package/dist/eval/submission/authority.d.ts +71 -0
  436. package/dist/eval/submission/authority.d.ts.map +1 -0
  437. package/dist/eval/submission/authority.js +118 -0
  438. package/dist/eval/submission/authority.js.map +1 -0
  439. package/dist/eval/submission/datasets.d.ts +28 -0
  440. package/dist/eval/submission/datasets.d.ts.map +1 -0
  441. package/dist/eval/submission/datasets.js +109 -0
  442. package/dist/eval/submission/datasets.js.map +1 -0
  443. package/dist/eval/submission/index.d.ts +15 -0
  444. package/dist/eval/submission/index.d.ts.map +1 -0
  445. package/dist/eval/submission/index.js +13 -0
  446. package/dist/eval/submission/index.js.map +1 -0
  447. package/dist/eval/submission/refusals.d.ts +103 -0
  448. package/dist/eval/submission/refusals.d.ts.map +1 -0
  449. package/dist/eval/submission/refusals.js +15 -0
  450. package/dist/eval/submission/refusals.js.map +1 -0
  451. package/dist/eval/submission/signatures.d.ts +7 -0
  452. package/dist/eval/submission/signatures.d.ts.map +1 -0
  453. package/dist/eval/submission/signatures.js +215 -0
  454. package/dist/eval/submission/signatures.js.map +1 -0
  455. package/dist/eval/submission/writes.d.ts +51 -0
  456. package/dist/eval/submission/writes.d.ts.map +1 -0
  457. package/dist/eval/submission/writes.js +203 -0
  458. package/dist/eval/submission/writes.js.map +1 -0
  459. package/dist/eval/submission.d.ts +53 -0
  460. package/dist/eval/submission.d.ts.map +1 -0
  461. package/dist/eval/submission.js +521 -0
  462. package/dist/eval/submission.js.map +1 -0
  463. package/dist/eval/suggestions-to-engine.d.ts +18 -0
  464. package/dist/eval/suggestions-to-engine.d.ts.map +1 -0
  465. package/dist/eval/suggestions-to-engine.js +40 -0
  466. package/dist/eval/suggestions-to-engine.js.map +1 -0
  467. package/dist/eval/suggestions.d.ts +17 -0
  468. package/dist/eval/suggestions.d.ts.map +1 -0
  469. package/dist/eval/suggestions.js +314 -0
  470. package/dist/eval/suggestions.js.map +1 -0
  471. package/dist/eval/undecided.d.ts +64 -0
  472. package/dist/eval/undecided.d.ts.map +1 -0
  473. package/dist/eval/undecided.js +101 -0
  474. package/dist/eval/undecided.js.map +1 -0
  475. package/dist/eval/verdict.d.ts +66 -0
  476. package/dist/eval/verdict.d.ts.map +1 -0
  477. package/dist/eval/verdict.js +106 -0
  478. package/dist/eval/verdict.js.map +1 -0
  479. package/dist/eval/verify-signature.d.ts +78 -0
  480. package/dist/eval/verify-signature.d.ts.map +1 -0
  481. package/dist/eval/verify-signature.js +185 -0
  482. package/dist/eval/verify-signature.js.map +1 -0
  483. package/dist/eval/version-dispatch.d.ts +38 -0
  484. package/dist/eval/version-dispatch.d.ts.map +1 -0
  485. package/dist/eval/version-dispatch.js +61 -0
  486. package/dist/eval/version-dispatch.js.map +1 -0
  487. package/dist/eval/visibility.d.ts +33 -0
  488. package/dist/eval/visibility.d.ts.map +1 -0
  489. package/dist/eval/visibility.js +83 -0
  490. package/dist/eval/visibility.js.map +1 -0
  491. package/dist/evaluate.d.ts +24 -0
  492. package/dist/evaluate.d.ts.map +1 -0
  493. package/dist/evaluate.js +18 -0
  494. package/dist/evaluate.js.map +1 -0
  495. package/dist/expr/builtin-docs.d.ts +51 -0
  496. package/dist/expr/builtin-docs.d.ts.map +1 -0
  497. package/dist/expr/builtin-docs.js +874 -0
  498. package/dist/expr/builtin-docs.js.map +1 -0
  499. package/dist/expr/builtins.d.ts +50 -0
  500. package/dist/expr/builtins.d.ts.map +1 -0
  501. package/dist/expr/builtins.js +966 -0
  502. package/dist/expr/builtins.js.map +1 -0
  503. package/dist/expr/decimal-precision.d.ts +39 -0
  504. package/dist/expr/decimal-precision.d.ts.map +1 -0
  505. package/dist/expr/decimal-precision.js +62 -0
  506. package/dist/expr/decimal-precision.js.map +1 -0
  507. package/dist/expr/decimal.d.ts +172 -0
  508. package/dist/expr/decimal.d.ts.map +1 -0
  509. package/dist/expr/decimal.js +782 -0
  510. package/dist/expr/decimal.js.map +1 -0
  511. package/dist/expr/deprecations.d.ts +34 -0
  512. package/dist/expr/deprecations.d.ts.map +1 -0
  513. package/dist/expr/deprecations.js +17 -0
  514. package/dist/expr/deprecations.js.map +1 -0
  515. package/dist/expr/diagnostics.d.ts +21 -0
  516. package/dist/expr/diagnostics.d.ts.map +1 -0
  517. package/dist/expr/diagnostics.js +231 -0
  518. package/dist/expr/diagnostics.js.map +1 -0
  519. package/dist/expr/direction.d.ts +30 -0
  520. package/dist/expr/direction.d.ts.map +1 -0
  521. package/dist/expr/direction.js +77 -0
  522. package/dist/expr/direction.js.map +1 -0
  523. package/dist/expr/example-expression.d.ts +62 -0
  524. package/dist/expr/example-expression.d.ts.map +1 -0
  525. package/dist/expr/example-expression.js +670 -0
  526. package/dist/expr/example-expression.js.map +1 -0
  527. package/dist/expr/instant.d.ts +49 -0
  528. package/dist/expr/instant.d.ts.map +1 -0
  529. package/dist/expr/instant.js +111 -0
  530. package/dist/expr/instant.js.map +1 -0
  531. package/dist/expr/logic.d.ts +17 -0
  532. package/dist/expr/logic.d.ts.map +1 -0
  533. package/dist/expr/logic.js +65 -0
  534. package/dist/expr/logic.js.map +1 -0
  535. package/dist/expr/messages.d.ts +45 -0
  536. package/dist/expr/messages.d.ts.map +1 -0
  537. package/dist/expr/messages.js +280 -0
  538. package/dist/expr/messages.js.map +1 -0
  539. package/dist/expr/money.d.ts +38 -0
  540. package/dist/expr/money.d.ts.map +1 -0
  541. package/dist/expr/money.js +127 -0
  542. package/dist/expr/money.js.map +1 -0
  543. package/dist/expr/ordering.d.ts +56 -0
  544. package/dist/expr/ordering.d.ts.map +1 -0
  545. package/dist/expr/ordering.js +167 -0
  546. package/dist/expr/ordering.js.map +1 -0
  547. package/dist/expr/pattern.d.ts +44 -0
  548. package/dist/expr/pattern.d.ts.map +1 -0
  549. package/dist/expr/pattern.js +458 -0
  550. package/dist/expr/pattern.js.map +1 -0
  551. package/dist/expr/plain-date.d.ts +90 -0
  552. package/dist/expr/plain-date.d.ts.map +1 -0
  553. package/dist/expr/plain-date.js +230 -0
  554. package/dist/expr/plain-date.js.map +1 -0
  555. package/dist/expr/plural-categories.d.ts +8 -0
  556. package/dist/expr/plural-categories.d.ts.map +1 -0
  557. package/dist/expr/plural-categories.js +15 -0
  558. package/dist/expr/plural-categories.js.map +1 -0
  559. package/dist/expr/plural-keys.d.ts +39 -0
  560. package/dist/expr/plural-keys.d.ts.map +1 -0
  561. package/dist/expr/plural-keys.js +46 -0
  562. package/dist/expr/plural-keys.js.map +1 -0
  563. package/dist/expr/plural.d.ts +33 -0
  564. package/dist/expr/plural.d.ts.map +1 -0
  565. package/dist/expr/plural.js +50 -0
  566. package/dist/expr/plural.js.map +1 -0
  567. package/dist/expr/quantity.d.ts +31 -0
  568. package/dist/expr/quantity.d.ts.map +1 -0
  569. package/dist/expr/quantity.js +83 -0
  570. package/dist/expr/quantity.js.map +1 -0
  571. package/dist/expr/reduce.d.ts +50 -0
  572. package/dist/expr/reduce.d.ts.map +1 -0
  573. package/dist/expr/reduce.js +236 -0
  574. package/dist/expr/reduce.js.map +1 -0
  575. package/dist/expr/regex.d.ts +108 -0
  576. package/dist/expr/regex.d.ts.map +1 -0
  577. package/dist/expr/regex.js +1207 -0
  578. package/dist/expr/regex.js.map +1 -0
  579. package/dist/expr/select-locale.d.ts +67 -0
  580. package/dist/expr/select-locale.d.ts.map +1 -0
  581. package/dist/expr/select-locale.js +219 -0
  582. package/dist/expr/select-locale.js.map +1 -0
  583. package/dist/expr/sequences.d.ts +123 -0
  584. package/dist/expr/sequences.d.ts.map +1 -0
  585. package/dist/expr/sequences.js +234 -0
  586. package/dist/expr/sequences.js.map +1 -0
  587. package/dist/expr/strings.d.ts +50 -0
  588. package/dist/expr/strings.d.ts.map +1 -0
  589. package/dist/expr/strings.js +184 -0
  590. package/dist/expr/strings.js.map +1 -0
  591. package/dist/expr/validation.d.ts +32 -0
  592. package/dist/expr/validation.d.ts.map +1 -0
  593. package/dist/expr/validation.js +182 -0
  594. package/dist/expr/validation.js.map +1 -0
  595. package/dist/graph/freeze.d.ts +4 -0
  596. package/dist/graph/freeze.d.ts.map +1 -0
  597. package/dist/graph/freeze.js +52 -0
  598. package/dist/graph/freeze.js.map +1 -0
  599. package/dist/graph/index.d.ts +15 -0
  600. package/dist/graph/index.d.ts.map +1 -0
  601. package/dist/graph/index.js +13 -0
  602. package/dist/graph/index.js.map +1 -0
  603. package/dist/graph/inspect.d.ts +76 -0
  604. package/dist/graph/inspect.d.ts.map +1 -0
  605. package/dist/graph/inspect.js +263 -0
  606. package/dist/graph/inspect.js.map +1 -0
  607. package/dist/graph/read-walk.d.ts +101 -0
  608. package/dist/graph/read-walk.d.ts.map +1 -0
  609. package/dist/graph/read-walk.js +358 -0
  610. package/dist/graph/read-walk.js.map +1 -0
  611. package/dist/graph/record-index.d.ts +24 -0
  612. package/dist/graph/record-index.d.ts.map +1 -0
  613. package/dist/graph/record-index.js +35 -0
  614. package/dist/graph/record-index.js.map +1 -0
  615. package/dist/index.d.ts +104 -0
  616. package/dist/index.d.ts.map +1 -0
  617. package/dist/index.js +139 -0
  618. package/dist/index.js.map +1 -0
  619. package/dist/lookup/digest.d.ts +51 -0
  620. package/dist/lookup/digest.d.ts.map +1 -0
  621. package/dist/lookup/digest.js +46 -0
  622. package/dist/lookup/digest.js.map +1 -0
  623. package/dist/lookup/index.d.ts +28 -0
  624. package/dist/lookup/index.d.ts.map +1 -0
  625. package/dist/lookup/index.js +27 -0
  626. package/dist/lookup/index.js.map +1 -0
  627. package/dist/lookup/install.d.ts +48 -0
  628. package/dist/lookup/install.d.ts.map +1 -0
  629. package/dist/lookup/install.js +315 -0
  630. package/dist/lookup/install.js.map +1 -0
  631. package/dist/lookup/pass.d.ts +55 -0
  632. package/dist/lookup/pass.d.ts.map +1 -0
  633. package/dist/lookup/pass.js +212 -0
  634. package/dist/lookup/pass.js.map +1 -0
  635. package/dist/lookup/pins.d.ts +34 -0
  636. package/dist/lookup/pins.d.ts.map +1 -0
  637. package/dist/lookup/pins.js +39 -0
  638. package/dist/lookup/pins.js.map +1 -0
  639. package/dist/lookup/provenance.d.ts +23 -0
  640. package/dist/lookup/provenance.d.ts.map +1 -0
  641. package/dist/lookup/provenance.js +78 -0
  642. package/dist/lookup/provenance.js.map +1 -0
  643. package/dist/lookup/readiness.d.ts +13 -0
  644. package/dist/lookup/readiness.d.ts.map +1 -0
  645. package/dist/lookup/readiness.js +57 -0
  646. package/dist/lookup/readiness.js.map +1 -0
  647. package/dist/lookup/resolve.d.ts +24 -0
  648. package/dist/lookup/resolve.d.ts.map +1 -0
  649. package/dist/lookup/resolve.js +201 -0
  650. package/dist/lookup/resolve.js.map +1 -0
  651. package/dist/lookup/store.d.ts +41 -0
  652. package/dist/lookup/store.d.ts.map +1 -0
  653. package/dist/lookup/store.js +74 -0
  654. package/dist/lookup/store.js.map +1 -0
  655. package/dist/model/access.d.ts +200 -0
  656. package/dist/model/access.d.ts.map +1 -0
  657. package/dist/model/access.js +125 -0
  658. package/dist/model/access.js.map +1 -0
  659. package/dist/model/artifact-members.d.ts +3 -0
  660. package/dist/model/artifact-members.d.ts.map +1 -0
  661. package/dist/model/artifact-members.js +38 -0
  662. package/dist/model/artifact-members.js.map +1 -0
  663. package/dist/model/composition.d.ts +47 -0
  664. package/dist/model/composition.d.ts.map +1 -0
  665. package/dist/model/composition.js +66 -0
  666. package/dist/model/composition.js.map +1 -0
  667. package/dist/model/domain.d.ts +51 -0
  668. package/dist/model/domain.d.ts.map +1 -0
  669. package/dist/model/domain.js +75 -0
  670. package/dist/model/domain.js.map +1 -0
  671. package/dist/model/duration.d.ts +31 -0
  672. package/dist/model/duration.d.ts.map +1 -0
  673. package/dist/model/duration.js +136 -0
  674. package/dist/model/duration.js.map +1 -0
  675. package/dist/model/errors.d.ts +58 -0
  676. package/dist/model/errors.d.ts.map +1 -0
  677. package/dist/model/errors.js +81 -0
  678. package/dist/model/errors.js.map +1 -0
  679. package/dist/model/evolution.d.ts +177 -0
  680. package/dist/model/evolution.d.ts.map +1 -0
  681. package/dist/model/evolution.js +5 -0
  682. package/dist/model/evolution.js.map +1 -0
  683. package/dist/model/expr-children.d.ts +15 -0
  684. package/dist/model/expr-children.d.ts.map +1 -0
  685. package/dist/model/expr-children.js +45 -0
  686. package/dist/model/expr-children.js.map +1 -0
  687. package/dist/model/guards.d.ts +9 -0
  688. package/dist/model/guards.d.ts.map +1 -0
  689. package/dist/model/guards.js +11 -0
  690. package/dist/model/guards.js.map +1 -0
  691. package/dist/model/input.d.ts +42 -0
  692. package/dist/model/input.d.ts.map +1 -0
  693. package/dist/model/input.js +26 -0
  694. package/dist/model/input.js.map +1 -0
  695. package/dist/model/integer.d.ts +14 -0
  696. package/dist/model/integer.d.ts.map +1 -0
  697. package/dist/model/integer.js +16 -0
  698. package/dist/model/integer.js.map +1 -0
  699. package/dist/model/intrinsic.d.ts +18 -0
  700. package/dist/model/intrinsic.d.ts.map +1 -0
  701. package/dist/model/intrinsic.js +21 -0
  702. package/dist/model/intrinsic.js.map +1 -0
  703. package/dist/model/layout.d.ts +129 -0
  704. package/dist/model/layout.d.ts.map +1 -0
  705. package/dist/model/layout.js +2 -0
  706. package/dist/model/layout.js.map +1 -0
  707. package/dist/model/media.d.ts +33 -0
  708. package/dist/model/media.d.ts.map +1 -0
  709. package/dist/model/media.js +86 -0
  710. package/dist/model/media.js.map +1 -0
  711. package/dist/model/members.generated.d.ts +11 -0
  712. package/dist/model/members.generated.d.ts.map +1 -0
  713. package/dist/model/members.generated.js +71 -0
  714. package/dist/model/members.generated.js.map +1 -0
  715. package/dist/model/row-address.d.ts +27 -0
  716. package/dist/model/row-address.d.ts.map +1 -0
  717. package/dist/model/row-address.js +146 -0
  718. package/dist/model/row-address.js.map +1 -0
  719. package/dist/model/schema.d.ts +108 -0
  720. package/dist/model/schema.d.ts.map +1 -0
  721. package/dist/model/schema.js +2 -0
  722. package/dist/model/schema.js.map +1 -0
  723. package/dist/model/shape.d.ts +193 -0
  724. package/dist/model/shape.d.ts.map +1 -0
  725. package/dist/model/shape.js +2 -0
  726. package/dist/model/shape.js.map +1 -0
  727. package/dist/model/time.d.ts +61 -0
  728. package/dist/model/time.d.ts.map +1 -0
  729. package/dist/model/time.js +110 -0
  730. package/dist/model/time.js.map +1 -0
  731. package/dist/model/types.d.ts +1329 -0
  732. package/dist/model/types.d.ts.map +1 -0
  733. package/dist/model/types.js +424 -0
  734. package/dist/model/types.js.map +1 -0
  735. package/dist/model/values.d.ts +91 -0
  736. package/dist/model/values.d.ts.map +1 -0
  737. package/dist/model/values.js +195 -0
  738. package/dist/model/values.js.map +1 -0
  739. package/dist/model/wire.d.ts +356 -0
  740. package/dist/model/wire.d.ts.map +1 -0
  741. package/dist/model/wire.js +1504 -0
  742. package/dist/model/wire.js.map +1 -0
  743. package/dist/offline/index.d.ts +374 -0
  744. package/dist/offline/index.d.ts.map +1 -0
  745. package/dist/offline/index.js +422 -0
  746. package/dist/offline/index.js.map +1 -0
  747. package/dist/testing.d.ts +30 -0
  748. package/dist/testing.d.ts.map +1 -0
  749. package/dist/testing.js +42 -0
  750. package/dist/testing.js.map +1 -0
  751. package/dist/version.d.ts +30 -0
  752. package/dist/version.d.ts.map +1 -0
  753. package/dist/version.js +116 -0
  754. package/dist/version.js.map +1 -0
  755. package/package.json +98 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.js","sourceRoot":"","sources":["../../../src/eval/access/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAw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,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;IACvD,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAwB,EACxB,IAAyB,EACzB,aAAkC;IAElC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC/C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;SAC1B,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3D,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { AxiomError } from '../../model/errors.js';\nimport { isSafeInteger } from '../../model/integer.js';\nimport { compareCodePoints } from '../../expr/strings.js';\nimport type { AccessOverlay, AccessOverlayRule } from '../../model/access.js';\nimport type { CompiledField, FieldAccess, FieldRef } from '../../model/types.js';\nimport { rowKeyToken } from '../../model/wire.js';\nimport type { AccessProjection } from './projection.js';\nimport { fieldKey, permitsReadOf, resolveProjectedAccess } from './projection.js';\n\n/**\n * The 4-level overlay resolver, `spec/semantics/access-v1.md` section 2.\n *\n * One authority owns the specificity order, the 5×5 meet table and the resolution of a host\n * overlay into the projection every read consults. A read is then a map lookup rather than a\n * second walk of the rules, and the report's projection, the reader's answer and the UI\n * binding cannot disagree about which level won.\n *\n * The resolution is fail-closed: an absent overlay grants the caller nothing it did not\n * state, `defaultAccess` falls back to `read_only` rather than an inferred grant, and a rule\n * that matches no declaration grants nothing.\n */\n\n/** A resolved overlay: the version it carries, the fields whose masks rule reads lift, and the projection. */\nexport interface ResolvedAccess {\n readonly version: number;\n readonly allowMaskedRead: ReadonlySet<string>;\n readonly entries: AccessProjection;\n}\n\n/** One declaration the overlay can address, with the identifiers its specificity matches. */\ninterface DeclaredField {\n readonly field: CompiledField;\n /** The record ids a `container` rule may match: this record and every record above it. */\n readonly containerIds: readonly string[];\n /** The section this declaration belongs to, inherited from the record that declares it. */\n readonly sectionId: string | undefined;\n}\n\n/**\n * The 5×5 orthogonal meet table, `[ACCESS-2.1.5]`.\n *\n * `canRead` meets by taking the more restrictive of the pair (`none` beats `masked` beats\n * `full`) and `canWrite` meets by AND. The table is written once here and nowhere else, so a\n * resolver, a report and a UI binding cannot each carry their own copy that drifts.\n */\nconst MEET: Readonly<Record<FieldAccess, Readonly<Record<FieldAccess, FieldAccess>>>> = {\n read_write: {\n read_write: 'read_write',\n read_only: 'read_only',\n write_only: 'write_only',\n masked: 'masked',\n hidden: 'hidden',\n },\n read_only: {\n read_write: 'read_only',\n read_only: 'read_only',\n write_only: 'hidden',\n masked: 'masked',\n hidden: 'hidden',\n },\n write_only: {\n read_write: 'write_only',\n read_only: 'hidden',\n write_only: 'write_only',\n masked: 'hidden',\n hidden: 'hidden',\n },\n masked: {\n read_write: 'masked',\n read_only: 'masked',\n write_only: 'hidden',\n masked: 'masked',\n hidden: 'hidden',\n },\n hidden: {\n read_write: 'hidden',\n read_only: 'hidden',\n write_only: 'hidden',\n masked: 'hidden',\n hidden: 'hidden',\n },\n};\n\n/** The access two states of the same specificity intersect to. */\nexport function meetAccess(left: FieldAccess, right: FieldAccess): FieldAccess {\n return MEET[left][right];\n}\n\n/** The access a set of states intersects to, or `undefined` for none. */\nfunction meetAccesses(accesses: Iterable<FieldAccess>): FieldAccess | undefined {\n let met: FieldAccess | undefined;\n for (const access of accesses) met = met === undefined ? access : meetAccess(met, access);\n return met;\n}\n\n/** The access a set of rules at one specificity level intersects to, or `undefined` for none. */\nfunction meetRules(rules: readonly AccessOverlayRule[]): FieldAccess | undefined {\n return meetAccesses(rules.map((rule) => rule.access));\n}\n\n/**\n * The exact-row rules this process has compared while resolving an overlay.\n *\n * A measurement hook, never an input: no decision reads it. A host that grants one row at a\n * time declares one rule per row, and the resolver must meet each of those rules once. A count\n * of the rules visited — not a stopwatch — is what shows the resolve is linear in them rather\n * than intersecting every rule with every rule for the same row, which was the rows squared.\n */\nlet rowRuleComparisons = 0;\n\nfunction noteRowRuleComparison(): void {\n rowRuleComparisons += 1;\n}\n\n/** The exact-row rule comparisons since the process started. */\nexport function overlayRowRuleComparisons(): number {\n return rowRuleComparisons;\n}\n\n/** The identifier a `template` rule names: the field every one of its rows belongs to. */\nfunction templateFieldOf(match: string): string {\n const at = match.indexOf('@');\n return at < 0 ? match : match.slice(0, at);\n}\n\n/**\n * The record a `container` rule names, `[ACCESS-2.1.3]`.\n *\n * The clause states the level as `container` (`recordFieldId.*`) while the field id alone is\n * the same record, so both spellings name one rule. A match that names no record is refused\n * here for the same reason a malformed exact match is: a host that wrote a rule the resolver\n * could only ignore would believe it had granted the subtree.\n */\nfunction containerFieldOf(match: string, rulePath: string): string {\n const fieldId = match.endsWith('.*') ? match.slice(0, -2) : match;\n if (fieldId === '') {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `a container access match names a record fieldId; ${JSON.stringify(match)} does not`,\n rulePath,\n );\n }\n return fieldId;\n}\n\n/** The field and row key an `exact` match names, or `undefined` when it names a whole field. */\nfunction parseRowMatch(\n match: string,\n rulePath: string,\n): { readonly fieldId: string; readonly rowKey: string | number } | undefined {\n const at = match.indexOf('@');\n if (at < 0) return undefined;\n const fieldId = match.slice(0, at);\n const token = match.slice(at + 1);\n const rowKey = parseRowToken(token);\n if (fieldId === '' || rowKey === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `an exact access match states \\`fieldId@<rowKeyToken>\\`; ${JSON.stringify(match)} does not`,\n rulePath,\n );\n }\n return { fieldId, rowKey };\n}\n\n/** Reads the wire-typed row token an exact match carries, refusing a spelling that is not one. */\nfunction parseRowToken(token: string): string | number | undefined {\n const separator = token.indexOf(':');\n if (separator < 0) return undefined;\n const kind = token.slice(0, separator);\n const text = token.slice(separator + 1);\n if (kind === 'string') return text === '' ? undefined : text;\n if (kind !== 'number') return undefined;\n const parsed = Number(text);\n if (!isSafeInteger(parsed)) return undefined;\n return rowKeyToken(parsed) === token ? parsed : undefined;\n}\n\n/** The `sectionId` a field's annotations name, never a layout anchor. */\nfunction sectionOf(field: CompiledField): string | undefined {\n const value = field.annotations?.['sectionId'];\n return typeof value === 'string' && value !== '' ? value : undefined;\n}\n\n/** Every declared field, with the containers whose ids a `container` rule may match. */\nfunction declarationsOf(fields: readonly CompiledField[]): readonly DeclaredField[] {\n const declared: DeclaredField[] = [];\n const walk = (\n members: readonly CompiledField[],\n ancestors: readonly string[],\n inheritedSection: string | undefined,\n ): void => {\n for (const field of members) {\n const sectionId = sectionOf(field) ?? inheritedSection;\n declared.push({\n field,\n containerIds: field.primitive === 'record' ? [field.fieldId, ...ancestors] : ancestors,\n sectionId,\n });\n const nextAncestors =\n field.primitive === 'record' ? [...ancestors, field.fieldId] : ancestors;\n if (field.fields !== undefined && field.fields.length > 0) {\n walk(field.fields, nextAncestors, sectionId);\n }\n }\n };\n walk(fields, [], undefined);\n return declared;\n}\n\n/** One exact row rule, already split into the field and wire-typed row key it names. */\ninterface RowRule {\n readonly fieldId: string;\n readonly rowKey: string | number;\n readonly access: FieldAccess;\n}\n\n/** The rules an overlay states, grouped by the level and identifier they match under. */\ninterface RuleIndex {\n readonly exactField: ReadonlyMap<string, readonly AccessOverlayRule[]>;\n readonly exactRow: ReadonlyMap<string, readonly RowRule[]>;\n readonly template: ReadonlyMap<string, readonly AccessOverlayRule[]>;\n readonly container: ReadonlyMap<string, readonly AccessOverlayRule[]>;\n readonly section: ReadonlyMap<string, readonly AccessOverlayRule[]>;\n}\n\nfunction group(\n rules: readonly AccessOverlayRule[],\n keyOf: (rule: AccessOverlayRule) => string | undefined,\n): ReadonlyMap<string, readonly AccessOverlayRule[]> {\n const grouped = new Map<string, AccessOverlayRule[]>();\n for (const rule of rules) {\n const key = keyOf(rule);\n if (key === undefined) continue;\n const group = grouped.get(key);\n if (group === undefined) grouped.set(key, [rule]);\n else group.push(rule);\n }\n return grouped;\n}\n\n/** Indexes an overlay's rules by the level and identifier each one matches under. */\nfunction indexRules(overlay: AccessOverlay, path: string): RuleIndex {\n const exactField: AccessOverlayRule[] = [];\n const exactRow: RowRule[] = [];\n const template: AccessOverlayRule[] = [];\n const container = new Map<string, AccessOverlayRule[]>();\n const section: AccessOverlayRule[] = [];\n for (const [index, rule] of overlay.rules.entries()) {\n const rulePath = `${path}.rules[${String(index)}].match`;\n switch (rule.kind) {\n case 'exact': {\n const row = parseRowMatch(rule.match, rulePath);\n if (row === undefined) exactField.push(rule);\n else exactRow.push({ ...row, access: rule.access });\n break;\n }\n case 'template':\n template.push(rule);\n break;\n case 'container': {\n const fieldId = containerFieldOf(rule.match, rulePath);\n const grouped = container.get(fieldId);\n if (grouped === undefined) container.set(fieldId, [rule]);\n else grouped.push(rule);\n break;\n }\n case 'section':\n section.push(rule);\n break;\n }\n }\n const rows = new Map<string, RowRule[]>();\n for (const row of exactRow) {\n const grouped = rows.get(row.fieldId);\n if (grouped === undefined) rows.set(row.fieldId, [row]);\n else grouped.push(row);\n }\n return {\n exactField: group(exactField, (rule) => rule.match),\n exactRow: rows,\n template: group(template, (rule) => templateFieldOf(rule.match)),\n container,\n section: group(section, (rule) => rule.match),\n };\n}\n\n/** Whether one rule's match names a row rather than a whole field. */\nfunction rowMatchFieldOf(rule: AccessOverlayRule): string | undefined {\n if (rule.kind === 'template') return templateFieldOf(rule.match);\n if (rule.kind !== 'exact') return undefined;\n const at = rule.match.indexOf('@');\n return at < 0 ? undefined : rule.match.slice(0, at);\n}\n\n/**\n * Refuses rules whose match contradicts the declared primitive of the field they name.\n *\n * `template` states every row of one array and an exact `fieldId@rowKey` names one item of\n * one array, `[ACCESS-2.1.4]`. `container` names a record subtree, `[ACCESS-2.1.3]`. Naming a\n * declaration with the wrong primitive would either silently match nothing or split a container's\n * own answer from its descendants, so each mismatch is refused at the rule's own match path.\n */\nfunction refuseMismatchedDeclarationMatches(\n rules: readonly AccessOverlayRule[],\n primitives: ReadonlyMap<string, CompiledField['primitive']>,\n path: string,\n): void {\n for (const [index, rule] of rules.entries()) {\n const rulePath = `${path}.rules[${String(index)}].match`;\n if (rule.kind === 'container') {\n const fieldId = containerFieldOf(rule.match, rulePath);\n const primitive = primitives.get(fieldId);\n // A rule naming no declaration is already inert: it grants nothing, and `[ACCESS-2.1.2]`\n // is what answers the reference. Only a declaration that exists can be contradicted.\n if (primitive === undefined || primitive === 'record') continue;\n throw new AxiomError(\n 'ENGINE_ERROR',\n `a container access match names a record; ${fieldId} is ${primitive}`,\n rulePath,\n );\n }\n const fieldId = rowMatchFieldOf(rule);\n if (fieldId === undefined) continue;\n const primitive = primitives.get(fieldId);\n // A rule naming no declaration is already inert: it grants nothing, and `[ACCESS-2.1.2]`\n // is what answers the reference. Only a declaration that exists can be contradicted.\n if (primitive === undefined || primitive === 'array') continue;\n throw new AxiomError(\n 'ENGINE_ERROR',\n `a ${rule.kind} access match names rows of ${fieldId}, which is not an array`,\n rulePath,\n );\n }\n}\n\n/**\n * Resolves an overlay into the projection every read consults, `[ACCESS-2.1.3]`.\n *\n * Each declaration's field-level state comes from the most specific level that matches it:\n * an exact rule on the field, then a `container` rule on one of its record ancestors, then a\n * `section` rule on the section its annotations name, then `defaultAccess`. A `template`\n * rule never governs a container's own structural state, and never governs a scalar field:\n * it states the state of every row of one array, so it is resolved into the row default and\n * is weighed whenever a container read would carry those rows.\n *\n * An exact `fieldId@rowKey` rule is resolved at the exact level beside an exact field-wide\n * rule, so a row rule may narrow but never re-open the field's own answer.\n *\n * `path` names where the caller supplied the overlay, so a rule a JavaScript caller wrote is\n * refused at the path the caller used — `$.overlay.rules[0].match` for a direct evaluation,\n * `authority.overlay.rules[0].match` for a submission's host facts.\n */\nexport function resolveOverlay(\n fields: readonly CompiledField[],\n overlay: AccessOverlay,\n path = '$.overlay',\n): ResolvedAccess {\n const index = indexRules(overlay, path);\n const declared = declarationsOf(fields);\n refuseMismatchedDeclarationMatches(\n overlay.rules,\n new Map(declared.map(({ field }) => [field.fieldId, field.primitive])),\n path,\n );\n const entries = new Map<string, FieldAccess>();\n const stated = new Set<string>();\n const rowEntries = new Map<string, { readonly key: string; readonly access: FieldAccess }[]>();\n const rowDefaults = new Map<string, FieldAccess>();\n const exactFields = new Set<string>();\n for (const { field, containerIds, sectionId } of declared) {\n const exact = index.exactField.get(field.fieldId) ?? [];\n if (exact.length > 0) exactFields.add(field.fieldId);\n // The exact level's answer is the same for every row of this field, so it is met once\n // rather than rebuilt per row the host addressed.\n const exactMet = meetRules(exact);\n // A `container` rule names a record, and the subtree it governs includes the record\n // itself: a member is never delivered around its container's own answer. The ancestry\n // list already carries the record itself for a record declaration.\n const containers = containerIds.flatMap((id) => index.container.get(id) ?? []);\n const sections = sectionId === undefined ? [] : (index.section.get(sectionId) ?? []);\n const fieldAccess =\n exactMet ?? meetRules(containers) ?? meetRules(sections) ?? overlay.defaultAccess;\n entries.set(fieldKey({ fieldId: field.fieldId }), fieldAccess);\n // A level that matched answered this declaration; `defaultAccess` is the host declining to.\n if (exactMet !== undefined || containers.length > 0 || sections.length > 0) {\n stated.add(field.fieldId);\n }\n if (field.primitive !== 'array') continue;\n // A row is a member of the array's declaration subtree, so it inherits the container and\n // section rules that reach the array, but it is addressed by the template level rather\n // than by the array's own structural rule.\n const templates = index.template.get(field.fieldId) ?? [];\n // A template states every row of the array, which is the level a row's own answer comes\n // from; the row reference below reads it as `fieldId@*`.\n if (templates.length > 0) stated.add(`${field.fieldId}@*`);\n rowDefaults.set(\n field.fieldId,\n exactMet ??\n meetRules(templates) ??\n meetRules(containers) ??\n meetRules(sections) ??\n overlay.defaultAccess,\n );\n const rowsAtField = index.exactRow.get(field.fieldId) ?? [];\n if (rowsAtField.length === 0) continue;\n // The exact level holds the field-wide rules beside the rules for one row, so a row rule\n // can narrow the field's own answer but never widen it. Folding each rule into its own\n // row as it is read makes that one intersect per row: intersecting the field's rules with\n // every rule for the same row, once per rule, was the rows times the rows.\n const byRow = new Map<string, { readonly rowKey: string | number; access: FieldAccess }>();\n for (const rule of rowsAtField) {\n noteRowRuleComparison();\n const token = rowKeyToken(rule.rowKey);\n const known = byRow.get(token);\n if (known === undefined) {\n byRow.set(token, {\n rowKey: rule.rowKey,\n access: exactMet === undefined ? rule.access : meetAccess(exactMet, rule.access),\n });\n } else {\n known.access = meetAccess(known.access, rule.access);\n }\n }\n for (const { rowKey, access } of byRow.values()) {\n const key = fieldKey({ fieldId: field.fieldId, rowKey });\n // The flat map holds the row entry beside the field-wide one, so a row read is one\n // lookup rather than a second walk over the rules.\n entries.set(key, access);\n stated.add(key);\n const existing = rowEntries.get(field.fieldId);\n const entry = { key, access };\n if (existing === undefined) rowEntries.set(field.fieldId, [entry]);\n else existing.push(entry);\n }\n }\n return {\n version: overlay.accessVersion,\n allowMaskedRead: new Set(overlay.allowMaskedRead ?? []),\n entries: { entries, rowEntries, rowDefaults, exactFields, stated },\n };\n}\n\n/**\n * The effective access of one reference, `[ACCESS-2.1.4]`.\n *\n * The session writes are part of the question: a stored `write_only` value is readable only\n * once this session wrote it, and a container that carries such a row is withdrawn as a\n * whole rather than delivered around its own entry.\n */\nexport function accessFor(\n resolved: ResolvedAccess,\n ref: FieldRef,\n sessionWrites: ReadonlySet<string>,\n): FieldAccess {\n return resolveProjectedAccess(resolved.entries, ref, sessionWrites);\n}\n\n/**\n * Whether a rule may read one reference, `[ACCESS-1.3.2]`, `[ACCESS-1.3.3]`.\n *\n * `allowMaskedRead` lifts a `masked` or `hidden` answer for expression reads only. It never\n * lifts `write_only`: a stored write-only value stays unreadable until this session writes\n * it, because the host's list is about masks and not about secrets.\n */\nexport function ruleReadFor(\n resolved: ResolvedAccess,\n ref: FieldRef,\n sessionWrites: ReadonlySet<string>,\n): boolean {\n const access = accessFor(resolved, ref, sessionWrites);\n if (access === 'masked' || access === 'hidden') {\n return resolved.allowMaskedRead.has(ref.fieldId);\n }\n return permitsReadOf(access, fieldKey(ref), sessionWrites);\n}\n\n/**\n * The report's access projection for the references an evaluation considered.\n *\n * The answer is per declaration, never per row (`[ACCESS-5.1.1]`): a container read carries\n * every row it holds, so the container's own answer already states what a row key would\n * restate. Entries are deduplicated by `fieldId` and sorted in code-point order\n * (`[ACCESS-5.1.4]`).\n */\nexport function projectAccessEntries(\n resolved: ResolvedAccess,\n refs: readonly FieldRef[],\n sessionWrites: ReadonlySet<string>,\n): readonly { readonly fieldId: string; readonly access: FieldAccess }[] {\n const byField = new Map<string, FieldAccess>();\n for (const ref of refs) {\n byField.set(ref.fieldId, accessFor(resolved, { fieldId: ref.fieldId }, sessionWrites));\n }\n return [...byField.entries()]\n .sort((left, right) => compareCodePoints(left[0], right[0]))\n .map(([fieldId, access]) => ({ fieldId, access }));\n}\n"]}
@@ -0,0 +1,159 @@
1
+ import type { AccessEntry } from '../../model/access.js';
2
+ import type { CompiledField, FieldAccess, FieldRef } from '../../model/types.js';
3
+ /**
4
+ * Access resolution over the host-supplied projection, `spec/semantics/access-v1.md`
5
+ * section 2.
6
+ *
7
+ * The host resolves its overlay into per-field entries and hands the result over; this
8
+ * module answers the only two questions the engine asks of it — may this reference be
9
+ * read, and may it be exported — and does so fail-closed. It validates the entries at
10
+ * the boundary, because a malformed projection would otherwise reach the report and the
11
+ * hash the report carries.
12
+ */
13
+ /** One validated per-row entry, kept so a container read can weigh every row it carries. */
14
+ interface RowAccess {
15
+ /** `fieldId@rowKey`, the key the entry is matched under and the session write is named by. */
16
+ readonly key: string;
17
+ readonly access: FieldAccess;
18
+ }
19
+ /** The validated projection: exact `fieldId@rowKey` entries beside field-wide ones. */
20
+ export interface AccessProjection {
21
+ /** Keyed by `fieldId` or `fieldId@rowKey`. */
22
+ readonly entries: ReadonlyMap<string, FieldAccess>;
23
+ /** Per-row entries grouped by the field they restrict. */
24
+ readonly rowEntries: ReadonlyMap<string, readonly RowAccess[]>;
25
+ /**
26
+ * The state every row of an array inherits when no exact rule names it, from a `template`
27
+ * rule or the levels below it. Absent on a flat projection, where a row no entry names
28
+ * takes the field's own answer.
29
+ */
30
+ readonly rowDefaults?: ReadonlyMap<string, FieldAccess>;
31
+ /**
32
+ * The fields an `exact` rule answers field-wide. A row's fallback must use the field's own
33
+ * answer only when that answer came from the exact level: a default or section rule must
34
+ * not outrank a template rule that states the row.
35
+ */
36
+ readonly exactFields?: ReadonlySet<string>;
37
+ /**
38
+ * The references the host stated an access answer for, keyed as `entries` is.
39
+ *
40
+ * The fail-closed default is `read_only` (`[ACCESS-2.1.2]`), which is the right answer to "may
41
+ * this device write" and says nothing about who supplies the value. Recording which
42
+ * references a rule or an entry actually answered is what lets a caller tell the two apart.
43
+ * A flat projection leaves this `undefined`: every entry it holds is a statement.
44
+ */
45
+ readonly stated?: ReadonlySet<string>;
46
+ }
47
+ /**
48
+ * The access answer one evaluated snapshot projects with: the projection
49
+ * the report renders, and the session writes it is resolved against. Passing both keeps a
50
+ * projection from resolving a second, possibly different, answer.
51
+ */
52
+ export interface SnapshotAccess {
53
+ readonly access: AccessProjection;
54
+ readonly sessionWrites: ReadonlySet<string>;
55
+ }
56
+ /**
57
+ * The key a reference is matched under: a scalar is its `fieldId`, a row adds its key.
58
+ *
59
+ * The key carries the row key's wire type (`rowKeyToken`), which makes the
60
+ * integer `7` and the text `"7"` two different keys. `String(rowKey)` would collapse them, so
61
+ * a session write to one row could unlock a `write_only` entry for the other.
62
+ */
63
+ export declare function fieldKey(ref: FieldRef): string;
64
+ /**
65
+ * The redacted references still withheld, given the references this session wrote.
66
+ *
67
+ * Redaction describes the record the host delivered; a reference this session wrote holds the
68
+ * device's own value instead, so it is no longer the server's to withhold. Both sides are read
69
+ * under `redactionKey`, so the comparison is exact and one rule decides what a reference names:
70
+ * a write to a member of a redacted container does not unlock it, one row's key never unlocks
71
+ * another, and a row reference on a declared array resolves to the whole payload, which a row
72
+ * write therefore never unlocks. A write that replaces a named container removes exactly that
73
+ * entry, and the value the device now holds is its own.
74
+ *
75
+ * Called where an input is resolved (the evaluation boundary and the submission projection's
76
+ * policy set), so the derived value, the expression reader, the presentational pass and the
77
+ * report's access projection read one answer about which entries are still redacted.
78
+ */
79
+ export declare function stillRedacted(fields: readonly CompiledField[], redacted: readonly FieldRef[], written: readonly FieldRef[] | undefined): readonly FieldRef[];
80
+ export declare function arrayFieldIds(fields: readonly CompiledField[]): ReadonlySet<string>;
81
+ /**
82
+ * The key one redaction entry is resolved under.
83
+ *
84
+ * A row reference on a declared array names the whole payload, so its key is the declaration's
85
+ * own `fieldId`; every other reference keeps its `fieldKey`. The access window and the submission
86
+ * projection both read this one rule, so the reader, the derived value, the report's access
87
+ * projection, and exported submissions agree on what a redaction names.
88
+ */
89
+ export declare function redactionKey(arrays: ReadonlySet<string>, ref: FieldRef): string;
90
+ /** Validates and indexes the access entries a caller supplied. */
91
+ export declare function projectAccess(entries: readonly AccessEntry[] | undefined): AccessProjection;
92
+ /** Validates a caller-supplied reference list into the keys it names. */
93
+ export declare function fieldRefKeys(refs: readonly FieldRef[] | undefined, path: string): ReadonlySet<string>;
94
+ /**
95
+ * The field ids a reference list names, whatever row each entry also names. A container
96
+ * read carries every row it holds, so a redaction scoped to one row withholds the
97
+ * container, not only the row.
98
+ */
99
+ export declare function fieldRefFields(refs: readonly FieldRef[] | undefined, path: string): ReadonlySet<string>;
100
+ /**
101
+ * Whether one resolved access permits reading the value it governs:
102
+ * `write_only` is readable only for a value written in this session, and `masked` and `hidden`
103
+ * never are. Delivery uses this answer; a rule read applies `allowMaskedRead` in the window.
104
+ */
105
+ export declare function permitsReadOf(access: FieldAccess, key: string, sessionWrites: ReadonlySet<string>): boolean;
106
+ /**
107
+ * The effective access for one reference: the exact `fieldId@rowKey` entry, then the
108
+ * entry that governs the whole field, then `read_only` — the fail-closed default of
109
+ * (reads allowed, writes not) — for a reference the projection does not
110
+ * mention. Two closures keep the answer safe rather than open.
111
+ *
112
+ * A container-level reference keys under its own `fieldId`, so its "exact" entry *is* the
113
+ * field-wide one. That entry is answered as `hidden` when a per-row entry withholds one of
114
+ * the rows the read would carry: no state delivers a container while withholding a row.
115
+ *
116
+ * A field the host answered *only* per row has no field-wide answer, and the projection
117
+ * cannot derive one — a per-row entry says nothing about the rows it does not name — so the
118
+ * field-level question is denied rather than guessed.
119
+ */
120
+ export declare function resolveProjectedAccess(projection: AccessProjection, ref: FieldRef, sessionWrites: ReadonlySet<string>): FieldAccess;
121
+ /** Whether the reference may be read. */
122
+ export declare function mayRead(projection: AccessProjection, ref: FieldRef, sessionWrites: ReadonlySet<string>): boolean;
123
+ /**
124
+ * The access-layer answer for one field under a host projection: the resolved access state,
125
+ * whether the value may be delivered to the device, and whether the access state permits a
126
+ * user write.
127
+ *
128
+ * This is the access layer alone, not fillability. A computed field, a `signature_ref`, an
129
+ * `enabled` rule or visibility can still prevent a user write when `writable` is `true`. To
130
+ * decide whether a control may accept user input, read `FormFieldState.fillable` (from
131
+ * `describeFormState` or `Engine.getField`) or `FieldProps.mayWrite` in `@azx-pbc/axiom-react`.
132
+ *
133
+ * `permitsUserWrite` allows a user write on `read_write` and `write_only` only; a `write_only`
134
+ * value is deliverable only once this session wrote it, and `masked` and `hidden` are never
135
+ * deliverable.
136
+ */
137
+ export interface FieldAccessState {
138
+ readonly access: FieldAccess;
139
+ readonly readable: boolean;
140
+ /**
141
+ * Whether the resolved access state permits a user write (`read_write` or `write_only`).
142
+ * This checks only the access layer; use `FormFieldState.fillable` or `FieldProps.mayWrite`
143
+ * for the composite fillability answer (which also accounts for computed writers,
144
+ * `signature_ref`, `enabled` rules and visibility).
145
+ */
146
+ readonly writable: boolean;
147
+ }
148
+ /**
149
+ * Answers `FieldAccessState` for the references one binding asks about. The projection is
150
+ * validated once when the resolver is built, so a binding that resolves a field on every
151
+ * render neither re-validates the overlay nor drifts from the engine's own resolution.
152
+ */
153
+ export interface AccessResolver {
154
+ field(ref: FieldRef): FieldAccessState;
155
+ }
156
+ /** Builds the resolver a binding holds for the life of one access projection. */
157
+ export declare function createAccessResolver(access: readonly AccessEntry[] | undefined, sessionWrites: readonly FieldRef[] | undefined): AccessResolver;
158
+ export {};
159
+ //# sourceMappingURL=projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../src/eval/access/projection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIjF;;;;;;;;;GASG;AAEH,4FAA4F;AAC5F,UAAU,SAAS;IACjB,8FAA8F;IAC9F,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED,uFAAuF;AACvF,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnD,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC,CAAC;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,WAAW,C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E,MAAM,GACX,WAAW,CAAC,MAAM,CAAC,CAIrB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,OAAO,CAWT;AAmCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,gBAAgB,EAC5B,GAAG,EAAE,QAAQ,EACb,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,WAAW,CAsBb;AAOD,yCAAyC;AACzC,wBAAgB,OAAO,CACrB,UAAU,EAAE,gBAAgB,EAC5B,GAAG,EAAE,QAAQ,EACb,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,OAAO,CAMT;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,GAAG,EAAE,QAAQ,GAAG,gBAAgB,CAAC;CACxC;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,EAC1C,aAAa,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,GAC7C,cAAc,CAahB"}
@@ -0,0 +1,211 @@
1
+ import { AxiomError } from '../../model/errors.js';
2
+ import { rowKeyToken, toAccessEntry, toFieldRef } from '../../model/wire.js';
3
+ import { permitsUserWrite } from './write.js';
4
+ /**
5
+ * The key a reference is matched under: a scalar is its `fieldId`, a row adds its key.
6
+ *
7
+ * The key carries the row key's wire type (`rowKeyToken`), which makes the
8
+ * integer `7` and the text `"7"` two different keys. `String(rowKey)` would collapse them, so
9
+ * a session write to one row could unlock a `write_only` entry for the other.
10
+ */
11
+ export function fieldKey(ref) {
12
+ return ref.rowKey === undefined ? ref.fieldId : `${ref.fieldId}@${rowKeyToken(ref.rowKey)}`;
13
+ }
14
+ /**
15
+ * The redacted references still withheld, given the references this session wrote.
16
+ *
17
+ * Redaction describes the record the host delivered; a reference this session wrote holds the
18
+ * device's own value instead, so it is no longer the server's to withhold. Both sides are read
19
+ * under `redactionKey`, so the comparison is exact and one rule decides what a reference names:
20
+ * a write to a member of a redacted container does not unlock it, one row's key never unlocks
21
+ * another, and a row reference on a declared array resolves to the whole payload, which a row
22
+ * write therefore never unlocks. A write that replaces a named container removes exactly that
23
+ * entry, and the value the device now holds is its own.
24
+ *
25
+ * Called where an input is resolved (the evaluation boundary and the submission projection's
26
+ * policy set), so the derived value, the expression reader, the presentational pass and the
27
+ * report's access projection read one answer about which entries are still redacted.
28
+ */
29
+ export function stillRedacted(fields, redacted, written) {
30
+ if (redacted.length === 0)
31
+ return redacted;
32
+ if (written === undefined || written.length === 0)
33
+ return redacted;
34
+ // Validate before dropping anything: an unlock must never make a malformed redacted reference
35
+ // disappear before the boundary that refuses it. The paths match the access window's own reader.
36
+ const checkedRedacted = redacted.map((ref, index) => toFieldRef(ref, `$.redacted[${String(index)}]`));
37
+ const writtenKeys = new Set(written.map((ref, index) => fieldKey(toFieldRef(ref, `$.sessionWrites[${String(index)}]`))));
38
+ const arrays = arrayFieldIds(fields);
39
+ const kept = checkedRedacted.filter((ref) => !writtenKeys.has(redactionKey(arrays, ref)));
40
+ return kept.length === checkedRedacted.length ? redacted : kept;
41
+ }
42
+ /**
43
+ * Every declared array field id, nested rows included, cached per artifact.
44
+ *
45
+ * The overlay resolves a row-scoped redaction of one of these as the whole declaration, because a
46
+ * list the server holds part of is not one the device may receive.
47
+ */
48
+ const ARRAY_FIELD_IDS = new WeakMap();
49
+ export function arrayFieldIds(fields) {
50
+ const cached = ARRAY_FIELD_IDS.get(fields);
51
+ if (cached !== undefined)
52
+ return cached;
53
+ const ids = new Set();
54
+ const visit = (members) => {
55
+ for (const member of members) {
56
+ if (member.primitive === 'array')
57
+ ids.add(member.fieldId);
58
+ visit(member.fields ?? []);
59
+ }
60
+ };
61
+ visit(fields);
62
+ ARRAY_FIELD_IDS.set(fields, ids);
63
+ return ids;
64
+ }
65
+ /**
66
+ * The key one redaction entry is resolved under.
67
+ *
68
+ * A row reference on a declared array names the whole payload, so its key is the declaration's
69
+ * own `fieldId`; every other reference keeps its `fieldKey`. The access window and the submission
70
+ * projection both read this one rule, so the reader, the derived value, the report's access
71
+ * projection, and exported submissions agree on what a redaction names.
72
+ */
73
+ export function redactionKey(arrays, ref) {
74
+ return ref.rowKey !== undefined && arrays.has(ref.fieldId) ? ref.fieldId : fieldKey(ref);
75
+ }
76
+ /** Validates and indexes the access entries a caller supplied. */
77
+ export function projectAccess(entries) {
78
+ const indexed = new Map();
79
+ const rowEntries = new Map();
80
+ for (const [index, entry] of (entries ?? []).entries()) {
81
+ const checked = toAccessEntry(entry, `$.access[${String(index)}]`);
82
+ const key = fieldKey(checked);
83
+ if (indexed.has(key)) {
84
+ // Two entries for one reference make the effective access depend on lookup order
85
+ // so the projection is refused rather than resolved by position.
86
+ throw new AxiomError('ENGINE_ERROR', `access is projected twice for ${key}`, `$.access[${String(index)}]`);
87
+ }
88
+ indexed.set(key, checked.access);
89
+ if (checked.rowKey !== undefined) {
90
+ const rows = rowEntries.get(checked.fieldId);
91
+ if (rows === undefined)
92
+ rowEntries.set(checked.fieldId, [{ key, access: checked.access }]);
93
+ else
94
+ rows.push({ key, access: checked.access });
95
+ }
96
+ }
97
+ return { entries: indexed, rowEntries };
98
+ }
99
+ /** Validates a caller-supplied reference list into the keys it names. */
100
+ export function fieldRefKeys(refs, path) {
101
+ return new Set((refs ?? []).map((ref, index) => fieldKey(toFieldRef(ref, `${path}[${String(index)}]`))));
102
+ }
103
+ /**
104
+ * The field ids a reference list names, whatever row each entry also names. A container
105
+ * read carries every row it holds, so a redaction scoped to one row withholds the
106
+ * container, not only the row.
107
+ */
108
+ export function fieldRefFields(refs, path) {
109
+ return new Set((refs ?? []).map((ref, index) => toFieldRef(ref, `${path}[${String(index)}]`).fieldId));
110
+ }
111
+ /**
112
+ * Whether one resolved access permits reading the value it governs:
113
+ * `write_only` is readable only for a value written in this session, and `masked` and `hidden`
114
+ * never are. Delivery uses this answer; a rule read applies `allowMaskedRead` in the window.
115
+ */
116
+ export function permitsReadOf(access, key, sessionWrites) {
117
+ switch (access) {
118
+ case 'read_write':
119
+ case 'read_only':
120
+ return true;
121
+ case 'write_only':
122
+ return sessionWrites.has(key);
123
+ case 'masked':
124
+ case 'hidden':
125
+ return false;
126
+ }
127
+ }
128
+ /**
129
+ * Whether every row of a container field is readable. A container read carries the whole
130
+ * list, so one row whose entry withholds its value makes the container undeliverable: an
131
+ * answer taken from the field-wide entry would hand the caller the row the per-row entry
132
+ * restricts. A per-row entry that withholds only the write — `read_only`
133
+ * — withholds no value, so the container keeps whatever its own entry states.
134
+ */
135
+ function rowsPermitRead(projection, fieldId, containerAccess, sessionWrites) {
136
+ // A template rule states every row's state, so a container that carries those rows is
137
+ // withheld unless the inherited state delivers a value. When container and rows already
138
+ // have the same state there is no narrower row answer to fold in: in particular, a
139
+ // `write_only` array stays writable and a `masked` array stays visible.
140
+ const inherited = projection.rowDefaults?.get(fieldId);
141
+ if (inherited !== undefined &&
142
+ inherited !== containerAccess &&
143
+ inherited !== 'read_write' &&
144
+ inherited !== 'read_only') {
145
+ return false;
146
+ }
147
+ const rows = projection.rowEntries.get(fieldId);
148
+ if (rows === undefined)
149
+ return true;
150
+ return rows.every((row) => row.access === containerAccess || permitsReadOf(row.access, row.key, sessionWrites));
151
+ }
152
+ /**
153
+ * The effective access for one reference: the exact `fieldId@rowKey` entry, then the
154
+ * entry that governs the whole field, then `read_only` — the fail-closed default of
155
+ * (reads allowed, writes not) — for a reference the projection does not
156
+ * mention. Two closures keep the answer safe rather than open.
157
+ *
158
+ * A container-level reference keys under its own `fieldId`, so its "exact" entry *is* the
159
+ * field-wide one. That entry is answered as `hidden` when a per-row entry withholds one of
160
+ * the rows the read would carry: no state delivers a container while withholding a row.
161
+ *
162
+ * A field the host answered *only* per row has no field-wide answer, and the projection
163
+ * cannot derive one — a per-row entry says nothing about the rows it does not name — so the
164
+ * field-level question is denied rather than guessed.
165
+ */
166
+ export function resolveProjectedAccess(projection, ref, sessionWrites) {
167
+ const exact = projection.entries.get(fieldKey(ref));
168
+ if (ref.rowKey !== undefined && isContainer(projection, ref.fieldId)) {
169
+ // A field-wide answer is the exact level's only when an exact rule stated it. Otherwise
170
+ // the level below (a template rule) owns the row and the field's container/section/default
171
+ // answer must not outrank it.
172
+ const fieldWide = projection.exactFields === undefined || projection.exactFields.has(ref.fieldId)
173
+ ? projection.entries.get(ref.fieldId)
174
+ : undefined;
175
+ return exact ?? fieldWide ?? projection.rowDefaults?.get(ref.fieldId) ?? 'read_only';
176
+ }
177
+ // A row key on a field that declares no rows is a reference to the field itself: a member
178
+ // of an array has one value per row of its container, never a row of its own, so the
179
+ // field's own answer governs it.
180
+ const fieldAccess = exact ?? projection.entries.get(ref.fieldId);
181
+ if (fieldAccess !== undefined) {
182
+ return rowsPermitRead(projection, ref.fieldId, fieldAccess, sessionWrites)
183
+ ? fieldAccess
184
+ : 'hidden';
185
+ }
186
+ return projection.rowEntries.has(ref.fieldId) ? 'hidden' : 'read_only';
187
+ }
188
+ /** Whether the projection resolves rows for one field, so a row key addresses one of them. */
189
+ function isContainer(projection, fieldId) {
190
+ return projection.rowDefaults?.has(fieldId) === true || projection.rowEntries.has(fieldId);
191
+ }
192
+ /** Whether the reference may be read. */
193
+ export function mayRead(projection, ref, sessionWrites) {
194
+ return permitsReadOf(resolveProjectedAccess(projection, ref, sessionWrites), fieldKey(ref), sessionWrites);
195
+ }
196
+ /** Builds the resolver a binding holds for the life of one access projection. */
197
+ export function createAccessResolver(access, sessionWrites) {
198
+ const projection = projectAccess(access);
199
+ const session = fieldRefKeys(sessionWrites, '$.sessionWrites');
200
+ return {
201
+ field(ref) {
202
+ const state = resolveProjectedAccess(projection, ref, session);
203
+ return {
204
+ access: state,
205
+ readable: mayRead(projection, ref, session),
206
+ writable: permitsUserWrite(state),
207
+ };
208
+ },
209
+ };
210
+ }
211
+ //# sourceMappingURL=projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.js","sourceRoot":"","sources":["../../../src/eval/access/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA2D9C;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAa;IACpC,OAAO,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;AAC9F,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAgC,EAChC,QAA6B,EAC7B,OAAwC;IAExC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC3C,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IACnE,8FAA8F;IAC9F,iGAAiG;IACjG,MAAM,eAAe,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAClD,UAAU,CAAC,GAAG,EAAE,cAAc,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAChD,CAAC;IACF,MAAM,WAAW,GAAG,IAAI,GAAG,CACzB,OAAO,CAAC,GAAG,CAA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AAE,GAAG,EAAE,OAAO,CAAC,CAAC;YAC/D,OAAO;gBACL,MAAM,EAAE,KAAK;gBACb,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC;gBAC3C,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC;aAClC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { AxiomError } from '../../model/errors.js';\nimport type { AccessEntry } from '../../model/access.js';\nimport type { CompiledField, FieldAccess, FieldRef } from '../../model/types.js';\nimport { rowKeyToken, toAccessEntry, toFieldRef } from '../../model/wire.js';\nimport { permitsUserWrite } from './write.js';\n\n/**\n * Access resolution over the host-supplied projection, `spec/semantics/access-v1.md`\n * section 2.\n *\n * The host resolves its overlay into per-field entries and hands the result over; this\n * module answers the only two questions the engine asks of it — may this reference be\n * read, and may it be exported — and does so fail-closed. It validates the entries at\n * the boundary, because a malformed projection would otherwise reach the report and the\n * hash the report carries.\n */\n\n/** One validated per-row entry, kept so a container read can weigh every row it carries. */\ninterface RowAccess {\n /** `fieldId@rowKey`, the key the entry is matched under and the session write is named by. */\n readonly key: string;\n readonly access: FieldAccess;\n}\n\n/** The validated projection: exact `fieldId@rowKey` entries beside field-wide ones. */\nexport interface AccessProjection {\n /** Keyed by `fieldId` or `fieldId@rowKey`. */\n readonly entries: ReadonlyMap<string, FieldAccess>;\n /** Per-row entries grouped by the field they restrict. */\n readonly rowEntries: ReadonlyMap<string, readonly RowAccess[]>;\n /**\n * The state every row of an array inherits when no exact rule names it, from a `template`\n * rule or the levels below it. Absent on a flat projection, where a row no entry names\n * takes the field's own answer.\n */\n readonly rowDefaults?: ReadonlyMap<string, FieldAccess>;\n /**\n * The fields an `exact` rule answers field-wide. A row's fallback must use the field's own\n * answer only when that answer came from the exact level: a default or section rule must\n * not outrank a template rule that states the row.\n */\n readonly exactFields?: ReadonlySet<string>;\n /**\n * The references the host stated an access answer for, keyed as `entries` is.\n *\n * The fail-closed default is `read_only` (`[ACCESS-2.1.2]`), which is the right answer to \"may\n * this device write\" and says nothing about who supplies the value. Recording which\n * references a rule or an entry actually answered is what lets a caller tell the two apart.\n * A flat projection leaves this `undefined`: every entry it holds is a statement.\n */\n readonly stated?: ReadonlySet<string>;\n}\n\n/**\n * The access answer one evaluated snapshot projects with: the projection\n * the report renders, and the session writes it is resolved against. Passing both keeps a\n * projection from resolving a second, possibly different, answer.\n */\nexport interface SnapshotAccess {\n readonly access: AccessProjection;\n readonly sessionWrites: ReadonlySet<string>;\n}\n\n/**\n * The key a reference is matched under: a scalar is its `fieldId`, a row adds its key.\n *\n * The key carries the row key's wire type (`rowKeyToken`), which makes the\n * integer `7` and the text `\"7\"` two different keys. `String(rowKey)` would collapse them, so\n * a session write to one row could unlock a `write_only` entry for the other.\n */\nexport function fieldKey(ref: FieldRef): string {\n return ref.rowKey === undefined ? ref.fieldId : `${ref.fieldId}@${rowKeyToken(ref.rowKey)}`;\n}\n\n/**\n * The redacted references still withheld, given the references this session wrote.\n *\n * Redaction describes the record the host delivered; a reference this session wrote holds the\n * device's own value instead, so it is no longer the server's to withhold. Both sides are read\n * under `redactionKey`, so the comparison is exact and one rule decides what a reference names:\n * a write to a member of a redacted container does not unlock it, one row's key never unlocks\n * another, and a row reference on a declared array resolves to the whole payload, which a row\n * write therefore never unlocks. A write that replaces a named container removes exactly that\n * entry, and the value the device now holds is its own.\n *\n * Called where an input is resolved (the evaluation boundary and the submission projection's\n * policy set), so the derived value, the expression reader, the presentational pass and the\n * report's access projection read one answer about which entries are still redacted.\n */\nexport function stillRedacted(\n fields: readonly CompiledField[],\n redacted: readonly FieldRef[],\n written: readonly FieldRef[] | undefined,\n): readonly FieldRef[] {\n if (redacted.length === 0) return redacted;\n if (written === undefined || written.length === 0) return redacted;\n // Validate before dropping anything: an unlock must never make a malformed redacted reference\n // disappear before the boundary that refuses it. The paths match the access window's own reader.\n const checkedRedacted = redacted.map((ref, index) =>\n toFieldRef(ref, `$.redacted[${String(index)}]`),\n );\n const writtenKeys = new Set(\n written.map((ref, index) => fieldKey(toFieldRef(ref, `$.sessionWrites[${String(index)}]`))),\n );\n const arrays = arrayFieldIds(fields);\n const kept = checkedRedacted.filter((ref) => !writtenKeys.has(redactionKey(arrays, ref)));\n return kept.length === checkedRedacted.length ? redacted : kept;\n}\n\n/**\n * Every declared array field id, nested rows included, cached per artifact.\n *\n * The overlay resolves a row-scoped redaction of one of these as the whole declaration, because a\n * list the server holds part of is not one the device may receive.\n */\nconst ARRAY_FIELD_IDS: WeakMap<readonly CompiledField[], ReadonlySet<string>> = new WeakMap();\n\nexport function arrayFieldIds(fields: readonly CompiledField[]): ReadonlySet<string> {\n const cached = ARRAY_FIELD_IDS.get(fields);\n if (cached !== undefined) return cached;\n const ids = new Set<string>();\n const visit = (members: readonly CompiledField[]): void => {\n for (const member of members) {\n if (member.primitive === 'array') ids.add(member.fieldId);\n visit(member.fields ?? []);\n }\n };\n visit(fields);\n ARRAY_FIELD_IDS.set(fields, ids);\n return ids;\n}\n\n/**\n * The key one redaction entry is resolved under.\n *\n * A row reference on a declared array names the whole payload, so its key is the declaration's\n * own `fieldId`; every other reference keeps its `fieldKey`. The access window and the submission\n * projection both read this one rule, so the reader, the derived value, the report's access\n * projection, and exported submissions agree on what a redaction names.\n */\nexport function redactionKey(arrays: ReadonlySet<string>, ref: FieldRef): string {\n return ref.rowKey !== undefined && arrays.has(ref.fieldId) ? ref.fieldId : fieldKey(ref);\n}\n\n/** Validates and indexes the access entries a caller supplied. */\nexport function projectAccess(entries: readonly AccessEntry[] | undefined): AccessProjection {\n const indexed = new Map<string, FieldAccess>();\n const rowEntries = new Map<string, RowAccess[]>();\n for (const [index, entry] of (entries ?? []).entries()) {\n const checked = toAccessEntry(entry, `$.access[${String(index)}]`);\n const key = fieldKey(checked);\n if (indexed.has(key)) {\n // Two entries for one reference make the effective access depend on lookup order\n // so the projection is refused rather than resolved by position.\n throw new AxiomError(\n 'ENGINE_ERROR',\n `access is projected twice for ${key}`,\n `$.access[${String(index)}]`,\n );\n }\n indexed.set(key, checked.access);\n if (checked.rowKey !== undefined) {\n const rows = rowEntries.get(checked.fieldId);\n if (rows === undefined) rowEntries.set(checked.fieldId, [{ key, access: checked.access }]);\n else rows.push({ key, access: checked.access });\n }\n }\n return { entries: indexed, rowEntries };\n}\n\n/** Validates a caller-supplied reference list into the keys it names. */\nexport function fieldRefKeys(\n refs: readonly FieldRef[] | undefined,\n path: string,\n): ReadonlySet<string> {\n return new Set(\n (refs ?? []).map((ref, index) => fieldKey(toFieldRef(ref, `${path}[${String(index)}]`))),\n );\n}\n\n/**\n * The field ids a reference list names, whatever row each entry also names. A container\n * read carries every row it holds, so a redaction scoped to one row withholds the\n * container, not only the row.\n */\nexport function fieldRefFields(\n refs: readonly FieldRef[] | undefined,\n path: string,\n): ReadonlySet<string> {\n return new Set(\n (refs ?? []).map((ref, index) => toFieldRef(ref, `${path}[${String(index)}]`).fieldId),\n );\n}\n\n/**\n * Whether one resolved access permits reading the value it governs:\n * `write_only` is readable only for a value written in this session, and `masked` and `hidden`\n * never are. Delivery uses this answer; a rule read applies `allowMaskedRead` in the window.\n */\nexport function permitsReadOf(\n access: FieldAccess,\n key: string,\n sessionWrites: ReadonlySet<string>,\n): boolean {\n switch (access) {\n case 'read_write':\n case 'read_only':\n return true;\n case 'write_only':\n return sessionWrites.has(key);\n case 'masked':\n case 'hidden':\n return false;\n }\n}\n\n/**\n * Whether every row of a container field is readable. A container read carries the whole\n * list, so one row whose entry withholds its value makes the container undeliverable: an\n * answer taken from the field-wide entry would hand the caller the row the per-row entry\n * restricts. A per-row entry that withholds only the write — `read_only`\n * — withholds no value, so the container keeps whatever its own entry states.\n */\nfunction rowsPermitRead(\n projection: AccessProjection,\n fieldId: string,\n containerAccess: FieldAccess,\n sessionWrites: ReadonlySet<string>,\n): boolean {\n // A template rule states every row's state, so a container that carries those rows is\n // withheld unless the inherited state delivers a value. When container and rows already\n // have the same state there is no narrower row answer to fold in: in particular, a\n // `write_only` array stays writable and a `masked` array stays visible.\n const inherited = projection.rowDefaults?.get(fieldId);\n if (\n inherited !== undefined &&\n inherited !== containerAccess &&\n inherited !== 'read_write' &&\n inherited !== 'read_only'\n ) {\n return false;\n }\n const rows = projection.rowEntries.get(fieldId);\n if (rows === undefined) return true;\n return rows.every(\n (row) => row.access === containerAccess || permitsReadOf(row.access, row.key, sessionWrites),\n );\n}\n\n/**\n * The effective access for one reference: the exact `fieldId@rowKey` entry, then the\n * entry that governs the whole field, then `read_only` — the fail-closed default of\n * (reads allowed, writes not) — for a reference the projection does not\n * mention. Two closures keep the answer safe rather than open.\n *\n * A container-level reference keys under its own `fieldId`, so its \"exact\" entry *is* the\n * field-wide one. That entry is answered as `hidden` when a per-row entry withholds one of\n * the rows the read would carry: no state delivers a container while withholding a row.\n *\n * A field the host answered *only* per row has no field-wide answer, and the projection\n * cannot derive one — a per-row entry says nothing about the rows it does not name — so the\n * field-level question is denied rather than guessed.\n */\nexport function resolveProjectedAccess(\n projection: AccessProjection,\n ref: FieldRef,\n sessionWrites: ReadonlySet<string>,\n): FieldAccess {\n const exact = projection.entries.get(fieldKey(ref));\n if (ref.rowKey !== undefined && isContainer(projection, ref.fieldId)) {\n // A field-wide answer is the exact level's only when an exact rule stated it. Otherwise\n // the level below (a template rule) owns the row and the field's container/section/default\n // answer must not outrank it.\n const fieldWide =\n projection.exactFields === undefined || projection.exactFields.has(ref.fieldId)\n ? projection.entries.get(ref.fieldId)\n : undefined;\n return exact ?? fieldWide ?? projection.rowDefaults?.get(ref.fieldId) ?? 'read_only';\n }\n // A row key on a field that declares no rows is a reference to the field itself: a member\n // of an array has one value per row of its container, never a row of its own, so the\n // field's own answer governs it.\n const fieldAccess = exact ?? projection.entries.get(ref.fieldId);\n if (fieldAccess !== undefined) {\n return rowsPermitRead(projection, ref.fieldId, fieldAccess, sessionWrites)\n ? fieldAccess\n : 'hidden';\n }\n return projection.rowEntries.has(ref.fieldId) ? 'hidden' : 'read_only';\n}\n\n/** Whether the projection resolves rows for one field, so a row key addresses one of them. */\nfunction isContainer(projection: AccessProjection, fieldId: string): boolean {\n return projection.rowDefaults?.has(fieldId) === true || projection.rowEntries.has(fieldId);\n}\n\n/** Whether the reference may be read. */\nexport function mayRead(\n projection: AccessProjection,\n ref: FieldRef,\n sessionWrites: ReadonlySet<string>,\n): boolean {\n return permitsReadOf(\n resolveProjectedAccess(projection, ref, sessionWrites),\n fieldKey(ref),\n sessionWrites,\n );\n}\n\n/**\n * The access-layer answer for one field under a host projection: the resolved access state,\n * whether the value may be delivered to the device, and whether the access state permits a\n * user write.\n *\n * This is the access layer alone, not fillability. A computed field, a `signature_ref`, an\n * `enabled` rule or visibility can still prevent a user write when `writable` is `true`. To\n * decide whether a control may accept user input, read `FormFieldState.fillable` (from\n * `describeFormState` or `Engine.getField`) or `FieldProps.mayWrite` in `@azx-pbc/axiom-react`.\n *\n * `permitsUserWrite` allows a user write on `read_write` and `write_only` only; a `write_only`\n * value is deliverable only once this session wrote it, and `masked` and `hidden` are never\n * deliverable.\n */\nexport interface FieldAccessState {\n readonly access: FieldAccess;\n readonly readable: boolean;\n /**\n * Whether the resolved access state permits a user write (`read_write` or `write_only`).\n * This checks only the access layer; use `FormFieldState.fillable` or `FieldProps.mayWrite`\n * for the composite fillability answer (which also accounts for computed writers,\n * `signature_ref`, `enabled` rules and visibility).\n */\n readonly writable: boolean;\n}\n\n/**\n * Answers `FieldAccessState` for the references one binding asks about. The projection is\n * validated once when the resolver is built, so a binding that resolves a field on every\n * render neither re-validates the overlay nor drifts from the engine's own resolution.\n */\nexport interface AccessResolver {\n field(ref: FieldRef): FieldAccessState;\n}\n\n/** Builds the resolver a binding holds for the life of one access projection. */\nexport function createAccessResolver(\n access: readonly AccessEntry[] | undefined,\n sessionWrites: readonly FieldRef[] | undefined,\n): AccessResolver {\n const projection = projectAccess(access);\n const session = fieldRefKeys(sessionWrites, '$.sessionWrites');\n return {\n field(ref) {\n const state = resolveProjectedAccess(projection, ref, session);\n return {\n access: state,\n readable: mayRead(projection, ref, session),\n writable: permitsUserWrite(state),\n };\n },\n };\n}\n"]}
@@ -0,0 +1,128 @@
1
+ import type { EvaluationEnv, EvaluationInput } from '../../model/access.js';
2
+ import type { CompiledField, FieldAccess, FieldRef, ReportAccessEntry } from '../../model/types.js';
3
+ import type { FieldAccessState, SnapshotAccess } from './projection.js';
4
+ import type { DeliveryAnswer, TargetAccess } from './delivery.js';
5
+ /**
6
+ * One evaluation's access answer, resolved once.
7
+ *
8
+ * The window is the only place a read asks "may I see this": the reader, a gate's input
9
+ * hash, the submission projection and a UI binding all consume the same resolved overlay,
10
+ * so a report, a delivered control and an exported value cannot answer differently about
11
+ * one field. A caller that supplies both an overlay and a flattened projection is refused
12
+ * here rather than resolved by precedence, because one of the two is then a stale answer.
13
+ *
14
+ * It is also the one delivery projection (`[ACCESS-1.3.4]`): whether a binding's value may be
15
+ * stated, why it may not, whether an alternative may name it and whether a declaration and every
16
+ * declaration with it deliver. Those questions were answered separately in the field derivation,
17
+ * the report's writer path, the target filter of an alternative and the session's identity
18
+ * guard, and separate answers are how a value gets stated by one surface and withheld by another.
19
+ */
20
+ /** The answer every access question of one evaluation is asked of. */
21
+ export interface AccessWindow {
22
+ /** The keys of the values written in this session, so a `write_only` read is decided once. */
23
+ readonly sessionWriteKeys: ReadonlySet<string>;
24
+ /** The version the report states: the overlay's, or the caller's when it supplied none. */
25
+ readonly version: number;
26
+ /** The effective access of one reference, `[ACCESS-2.1.4]`. */
27
+ accessFor(ref: FieldRef): FieldAccess;
28
+ /** Whether a *rule* may read one reference; `allowMaskedRead` applies here and only here. */
29
+ mayRead(ref: FieldRef): boolean;
30
+ /** The delivery answer a UI binding renders: access, readability and writability. */
31
+ field(ref: FieldRef): FieldAccessState;
32
+ /** The projection and session writes a submission reads, so the two cannot disagree. */
33
+ snapshotAccess(): SnapshotAccess;
34
+ /** The report's per-declaration projection over the references an evaluation considered. */
35
+ reportEntries(refs: readonly FieldRef[]): readonly ReportAccessEntry[];
36
+ /**
37
+ * Every redacted declaration and every descendant whose read that redaction refuses.
38
+ *
39
+ * It is the field-wide answer: a declaration named here states `redacted` at every row. A host
40
+ * that names one row asks {@link isRedacted} with that row's reference.
41
+ */
42
+ redactedFields(): ReadonlySet<string>;
43
+ /**
44
+ * Whether one reference is redacted: its declaration, an ancestor of it, or this very row.
45
+ *
46
+ * A row-scoped redaction of an array is read as the whole declaration, because a list the
47
+ * server holds part of is not one this device may receive.
48
+ */
49
+ isRedacted(ref: FieldRef): boolean;
50
+ /**
51
+ * Whether any row of one container is answered `hidden`.
52
+ *
53
+ * A hidden row takes the container's own row set off screen, so the container's folded answer
54
+ * decides its access; a merely `masked` row leaves the control shown with one value withheld.
55
+ */
56
+ hiddenRow(fieldId: string): boolean;
57
+ /**
58
+ * Whether a *rule* may read a declaration's own value, before a per-row entry narrows it.
59
+ *
60
+ * A container's own read is asked this way: a row-exact restriction withholds that row and not
61
+ * the list, and the row walk decides each row against its own entry (`[ACCESS-1.3.1]`).
62
+ */
63
+ mayReadOwn(fieldId: string): boolean;
64
+ /**
65
+ * The delivery answer for one binding's own declaration at its field-wide reference.
66
+ *
67
+ * A per-row entry that withholds one row folds into this answer, so a container carrying a
68
+ * row the device may not read is `hidden` here exactly as `[ACCESS-2.1.4]` resolves it.
69
+ */
70
+ delivery(ref: FieldRef): DeliveryAnswer;
71
+ /**
72
+ * The delivery answer at a declaration's own field-wide level, before a per-row entry narrows
73
+ * it. Row identity is what this separates from the folded answer: a container whose only
74
+ * withheld value is one row's still delivers the rows the device may name, and each row states
75
+ * its own value as withheld (`[ACCESS-1.3.1]`).
76
+ */
77
+ ownDelivery(fieldId: string): DeliveryAnswer;
78
+ /**
79
+ * The effective access at a declaration's own field-wide level, before a per-row entry narrows
80
+ * it. A member of an array is judged per row, so its field-level answer is the one the host
81
+ * stated for the column rather than the fold over its rows.
82
+ */
83
+ ownAccess(fieldId: string): FieldAccess;
84
+ /**
85
+ * The delivery answer for one binding and every declaration enclosing it, `[ACCESS-1.3.4]`.
86
+ *
87
+ * A member is delivered inside its container's payload, so one withheld declaration above it
88
+ * withholds the member with it. The reason is the strongest the chain states, so a caller that
89
+ * must explain a withholding names one reason instead of re-deriving it.
90
+ */
91
+ enclosingDelivery(ref: FieldRef): DeliveryAnswer;
92
+ /** Whether every declaration carrying one binding's value delivers it. */
93
+ enclosingDelivers(ref: FieldRef): boolean;
94
+ /**
95
+ * Whether one declaration and every member it carries deliver, as one payload.
96
+ *
97
+ * A container is delivered as one value, so a member the answer withholds withholds the
98
+ * container with it (`[ACCESS-1.3.4]`).
99
+ */
100
+ subtreeDelivers(fieldId: string): boolean;
101
+ /**
102
+ * Whether an alternative may name one binding, `RULES-6.1.3`, `RULES-7.1.4`.
103
+ *
104
+ * `withheld` is the report's own refusal to offer a stub, so the answer is the meet over the
105
+ * declarations carrying the target and never one declaration alone.
106
+ */
107
+ target(ref: FieldRef): TargetAccess;
108
+ /**
109
+ * Whether a respondent may fill one binding, or the host stated no access answer for it.
110
+ *
111
+ * `read_only` is the fail-closed default (`[ACCESS-2.1.2]`): the right answer to "may this
112
+ * device write" and the wrong answer to "who supplies this value". A host that stated nothing
113
+ * about a binding has not said the backend owns it, so a required gap there is still the
114
+ * respondent's; a *stated* `read_only` says the value can only arrive from the tier that holds
115
+ * it, and a mask or a hide says it is not the respondent's to set at all.
116
+ */
117
+ mayFill(ref: FieldRef): boolean;
118
+ }
119
+ /**
120
+ * Resolves one evaluation's access answer.
121
+ *
122
+ * A call that supplies an overlay and a flattened projection is refused before either is
123
+ * read, and a caller-declared `env.accessVersion` that disagrees with the overlay is refused
124
+ * for the same reason: the overlay is the authority, and a report that stated a version its
125
+ * overlay never had would defeat the server's staleness check.
126
+ */
127
+ export declare function createAccessWindow(fields: readonly CompiledField[], input: EvaluationInput, env: EvaluationEnv, overlayPath?: string): AccessWindow;
128
+ //# sourceMappingURL=window.d.ts.map