@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.
- package/LICENSE +21 -0
- package/README.md +714 -2
- package/dist/cache/index.d.ts +191 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +361 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/canonical/jcs.d.ts +78 -0
- package/dist/canonical/jcs.d.ts.map +1 -0
- package/dist/canonical/jcs.js +500 -0
- package/dist/canonical/jcs.js.map +1 -0
- package/dist/canonical/restricted-json.d.ts +7 -0
- package/dist/canonical/restricted-json.d.ts.map +1 -0
- package/dist/canonical/restricted-json.js +318 -0
- package/dist/canonical/restricted-json.js.map +1 -0
- package/dist/canonical/restricted-value.d.ts +59 -0
- package/dist/canonical/restricted-value.d.ts.map +1 -0
- package/dist/canonical/restricted-value.js +156 -0
- package/dist/canonical/restricted-value.js.map +1 -0
- package/dist/canonical/restricted.d.ts +85 -0
- package/dist/canonical/restricted.d.ts.map +1 -0
- package/dist/canonical/restricted.js +163 -0
- package/dist/canonical/restricted.js.map +1 -0
- package/dist/canonical/signature.d.ts +38 -0
- package/dist/canonical/signature.d.ts.map +1 -0
- package/dist/canonical/signature.js +47 -0
- package/dist/canonical/signature.js.map +1 -0
- package/dist/eval/access/delivery.d.ts +63 -0
- package/dist/eval/access/delivery.d.ts.map +1 -0
- package/dist/eval/access/delivery.js +98 -0
- package/dist/eval/access/delivery.js.map +1 -0
- package/dist/eval/access/overlay.d.ts +72 -0
- package/dist/eval/access/overlay.d.ts.map +1 -0
- package/dist/eval/access/overlay.js +402 -0
- package/dist/eval/access/overlay.js.map +1 -0
- package/dist/eval/access/projection.d.ts +159 -0
- package/dist/eval/access/projection.d.ts.map +1 -0
- package/dist/eval/access/projection.js +211 -0
- package/dist/eval/access/projection.js.map +1 -0
- package/dist/eval/access/window.d.ts +128 -0
- package/dist/eval/access/window.d.ts.map +1 -0
- package/dist/eval/access/window.js +254 -0
- package/dist/eval/access/window.js.map +1 -0
- package/dist/eval/access/write.d.ts +113 -0
- package/dist/eval/access/write.d.ts.map +1 -0
- package/dist/eval/access/write.js +119 -0
- package/dist/eval/access/write.js.map +1 -0
- package/dist/eval/addressing.d.ts +131 -0
- package/dist/eval/addressing.d.ts.map +1 -0
- package/dist/eval/addressing.js +270 -0
- package/dist/eval/addressing.js.map +1 -0
- package/dist/eval/budget.d.ts +143 -0
- package/dist/eval/budget.d.ts.map +1 -0
- package/dist/eval/budget.js +387 -0
- package/dist/eval/budget.js.map +1 -0
- package/dist/eval/computed.d.ts +46 -0
- package/dist/eval/computed.d.ts.map +1 -0
- package/dist/eval/computed.js +89 -0
- package/dist/eval/computed.js.map +1 -0
- package/dist/eval/denials.d.ts +64 -0
- package/dist/eval/denials.d.ts.map +1 -0
- package/dist/eval/denials.js +87 -0
- package/dist/eval/denials.js.map +1 -0
- package/dist/eval/engine/cancellation.d.ts +12 -0
- package/dist/eval/engine/cancellation.d.ts.map +1 -0
- package/dist/eval/engine/cancellation.js +56 -0
- package/dist/eval/engine/cancellation.js.map +1 -0
- package/dist/eval/engine/delta.d.ts +104 -0
- package/dist/eval/engine/delta.d.ts.map +1 -0
- package/dist/eval/engine/delta.js +466 -0
- package/dist/eval/engine/delta.js.map +1 -0
- package/dist/eval/engine/deps.d.ts +136 -0
- package/dist/eval/engine/deps.d.ts.map +1 -0
- package/dist/eval/engine/deps.js +345 -0
- package/dist/eval/engine/deps.js.map +1 -0
- package/dist/eval/engine/identity.d.ts +128 -0
- package/dist/eval/engine/identity.d.ts.map +1 -0
- package/dist/eval/engine/identity.js +398 -0
- package/dist/eval/engine/identity.js.map +1 -0
- package/dist/eval/engine/index.d.ts +200 -0
- package/dist/eval/engine/index.d.ts.map +1 -0
- package/dist/eval/engine/index.js +1242 -0
- package/dist/eval/engine/index.js.map +1 -0
- package/dist/eval/engine/measurement.d.ts +23 -0
- package/dist/eval/engine/measurement.d.ts.map +1 -0
- package/dist/eval/engine/measurement.js +42 -0
- package/dist/eval/engine/measurement.js.map +1 -0
- package/dist/eval/engine/naive.d.ts +19 -0
- package/dist/eval/engine/naive.d.ts.map +1 -0
- package/dist/eval/engine/naive.js +59 -0
- package/dist/eval/engine/naive.js.map +1 -0
- package/dist/eval/engine/ops.d.ts +214 -0
- package/dist/eval/engine/ops.d.ts.map +1 -0
- package/dist/eval/engine/ops.js +1422 -0
- package/dist/eval/engine/ops.js.map +1 -0
- package/dist/eval/engine/patches.d.ts +40 -0
- package/dist/eval/engine/patches.d.ts.map +1 -0
- package/dist/eval/engine/patches.js +125 -0
- package/dist/eval/engine/patches.js.map +1 -0
- package/dist/eval/engine/ports.d.ts +71 -0
- package/dist/eval/engine/ports.d.ts.map +1 -0
- package/dist/eval/engine/ports.js +2 -0
- package/dist/eval/engine/ports.js.map +1 -0
- package/dist/eval/engine/session.d.ts +116 -0
- package/dist/eval/engine/session.d.ts.map +1 -0
- package/dist/eval/engine/session.js +653 -0
- package/dist/eval/engine/session.js.map +1 -0
- package/dist/eval/engine/snapshot.d.ts +97 -0
- package/dist/eval/engine/snapshot.d.ts.map +1 -0
- package/dist/eval/engine/snapshot.js +221 -0
- package/dist/eval/engine/snapshot.js.map +1 -0
- package/dist/eval/engine/subscriptions.d.ts +47 -0
- package/dist/eval/engine/subscriptions.d.ts.map +1 -0
- package/dist/eval/engine/subscriptions.js +103 -0
- package/dist/eval/engine/subscriptions.js.map +1 -0
- package/dist/eval/engine/trace.d.ts +77 -0
- package/dist/eval/engine/trace.d.ts.map +1 -0
- package/dist/eval/engine/trace.js +140 -0
- package/dist/eval/engine/trace.js.map +1 -0
- package/dist/eval/error-diagnostic.d.ts +26 -0
- package/dist/eval/error-diagnostic.d.ts.map +1 -0
- package/dist/eval/error-diagnostic.js +63 -0
- package/dist/eval/error-diagnostic.js.map +1 -0
- package/dist/eval/evaluate-expr.d.ts +44 -0
- package/dist/eval/evaluate-expr.d.ts.map +1 -0
- package/dist/eval/evaluate-expr.js +149 -0
- package/dist/eval/evaluate-expr.js.map +1 -0
- package/dist/eval/evaluate.d.ts +282 -0
- package/dist/eval/evaluate.d.ts.map +1 -0
- package/dist/eval/evaluate.js +391 -0
- package/dist/eval/evaluate.js.map +1 -0
- package/dist/eval/evolution/relocate.d.ts +72 -0
- package/dist/eval/evolution/relocate.d.ts.map +1 -0
- package/dist/eval/evolution/relocate.js +427 -0
- package/dist/eval/evolution/relocate.js.map +1 -0
- package/dist/eval/evolution/select.d.ts +11 -0
- package/dist/eval/evolution/select.d.ts.map +1 -0
- package/dist/eval/evolution/select.js +53 -0
- package/dist/eval/evolution/select.js.map +1 -0
- package/dist/eval/evolution/upcast.d.ts +13 -0
- package/dist/eval/evolution/upcast.d.ts.map +1 -0
- package/dist/eval/evolution/upcast.js +88 -0
- package/dist/eval/evolution/upcast.js.map +1 -0
- package/dist/eval/expr/aggregates.d.ts +75 -0
- package/dist/eval/expr/aggregates.d.ts.map +1 -0
- package/dist/eval/expr/aggregates.js +991 -0
- package/dist/eval/expr/aggregates.js.map +1 -0
- package/dist/eval/expr/arithmetic.d.ts +26 -0
- package/dist/eval/expr/arithmetic.d.ts.map +1 -0
- package/dist/eval/expr/arithmetic.js +387 -0
- package/dist/eval/expr/arithmetic.js.map +1 -0
- package/dist/eval/expr/between.d.ts +17 -0
- package/dist/eval/expr/between.d.ts.map +1 -0
- package/dist/eval/expr/between.js +46 -0
- package/dist/eval/expr/between.js.map +1 -0
- package/dist/eval/expr/binder.d.ts +96 -0
- package/dist/eval/expr/binder.d.ts.map +1 -0
- package/dist/eval/expr/binder.js +253 -0
- package/dist/eval/expr/binder.js.map +1 -0
- package/dist/eval/expr/call-dispatch.d.ts +28 -0
- package/dist/eval/expr/call-dispatch.d.ts.map +1 -0
- package/dist/eval/expr/call-dispatch.js +114 -0
- package/dist/eval/expr/call-dispatch.js.map +1 -0
- package/dist/eval/expr/collections.d.ts +20 -0
- package/dist/eval/expr/collections.d.ts.map +1 -0
- package/dist/eval/expr/collections.js +66 -0
- package/dist/eval/expr/collections.js.map +1 -0
- package/dist/eval/expr/compare.d.ts +36 -0
- package/dist/eval/expr/compare.d.ts.map +1 -0
- package/dist/eval/expr/compare.js +115 -0
- package/dist/eval/expr/compare.js.map +1 -0
- package/dist/eval/expr/datasets.d.ts +28 -0
- package/dist/eval/expr/datasets.d.ts.map +1 -0
- package/dist/eval/expr/datasets.js +304 -0
- package/dist/eval/expr/datasets.js.map +1 -0
- package/dist/eval/expr/digest.d.ts +23 -0
- package/dist/eval/expr/digest.d.ts.map +1 -0
- package/dist/eval/expr/digest.js +89 -0
- package/dist/eval/expr/digest.js.map +1 -0
- package/dist/eval/expr/domains.d.ts +19 -0
- package/dist/eval/expr/domains.d.ts.map +1 -0
- package/dist/eval/expr/domains.js +18 -0
- package/dist/eval/expr/domains.js.map +1 -0
- package/dist/eval/expr/host.d.ts +152 -0
- package/dist/eval/expr/host.d.ts.map +1 -0
- package/dist/eval/expr/host.js +36 -0
- package/dist/eval/expr/host.js.map +1 -0
- package/dist/eval/expr/lists.d.ts +24 -0
- package/dist/eval/expr/lists.d.ts.map +1 -0
- package/dist/eval/expr/lists.js +155 -0
- package/dist/eval/expr/lists.js.map +1 -0
- package/dist/eval/expr/member.d.ts +15 -0
- package/dist/eval/expr/member.d.ts.map +1 -0
- package/dist/eval/expr/member.js +32 -0
- package/dist/eval/expr/member.js.map +1 -0
- package/dist/eval/expr/money-ops.d.ts +10 -0
- package/dist/eval/expr/money-ops.d.ts.map +1 -0
- package/dist/eval/expr/money-ops.js +17 -0
- package/dist/eval/expr/money-ops.js.map +1 -0
- package/dist/eval/expr/operands.d.ts +27 -0
- package/dist/eval/expr/operands.d.ts.map +1 -0
- package/dist/eval/expr/operands.js +167 -0
- package/dist/eval/expr/operands.js.map +1 -0
- package/dist/eval/expr/presence.d.ts +27 -0
- package/dist/eval/expr/presence.d.ts.map +1 -0
- package/dist/eval/expr/presence.js +140 -0
- package/dist/eval/expr/presence.js.map +1 -0
- package/dist/eval/expr/records.d.ts +22 -0
- package/dist/eval/expr/records.d.ts.map +1 -0
- package/dist/eval/expr/records.js +101 -0
- package/dist/eval/expr/records.js.map +1 -0
- package/dist/eval/expr/rule-refs.d.ts +25 -0
- package/dist/eval/expr/rule-refs.d.ts.map +1 -0
- package/dist/eval/expr/rule-refs.js +60 -0
- package/dist/eval/expr/rule-refs.js.map +1 -0
- package/dist/eval/expr/sequences.d.ts +26 -0
- package/dist/eval/expr/sequences.d.ts.map +1 -0
- package/dist/eval/expr/sequences.js +151 -0
- package/dist/eval/expr/sequences.js.map +1 -0
- package/dist/eval/expr/value.d.ts +99 -0
- package/dist/eval/expr/value.d.ts.map +1 -0
- package/dist/eval/expr/value.js +14 -0
- package/dist/eval/expr/value.js.map +1 -0
- package/dist/eval/expression.d.ts +142 -0
- package/dist/eval/expression.d.ts.map +1 -0
- package/dist/eval/expression.js +446 -0
- package/dist/eval/expression.js.map +1 -0
- package/dist/eval/firing.d.ts +68 -0
- package/dist/eval/firing.d.ts.map +1 -0
- package/dist/eval/firing.js +222 -0
- package/dist/eval/firing.js.map +1 -0
- package/dist/eval/gate.d.ts +110 -0
- package/dist/eval/gate.d.ts.map +1 -0
- package/dist/eval/gate.js +278 -0
- package/dist/eval/gate.js.map +1 -0
- package/dist/eval/layout-visibility.d.ts +18 -0
- package/dist/eval/layout-visibility.d.ts.map +1 -0
- package/dist/eval/layout-visibility.js +61 -0
- package/dist/eval/layout-visibility.js.map +1 -0
- package/dist/eval/option-availability.d.ts +26 -0
- package/dist/eval/option-availability.d.ts.map +1 -0
- package/dist/eval/option-availability.js +580 -0
- package/dist/eval/option-availability.js.map +1 -0
- package/dist/eval/options-boundary.d.ts +15 -0
- package/dist/eval/options-boundary.d.ts.map +1 -0
- package/dist/eval/options-boundary.js +40 -0
- package/dist/eval/options-boundary.js.map +1 -0
- package/dist/eval/options.d.ts +99 -0
- package/dist/eval/options.d.ts.map +1 -0
- package/dist/eval/options.js +96 -0
- package/dist/eval/options.js.map +1 -0
- package/dist/eval/overrides.d.ts +116 -0
- package/dist/eval/overrides.d.ts.map +1 -0
- package/dist/eval/overrides.js +176 -0
- package/dist/eval/overrides.js.map +1 -0
- package/dist/eval/paths.d.ts +25 -0
- package/dist/eval/paths.d.ts.map +1 -0
- package/dist/eval/paths.js +47 -0
- package/dist/eval/paths.js.map +1 -0
- package/dist/eval/presentation-reads.d.ts +20 -0
- package/dist/eval/presentation-reads.d.ts.map +1 -0
- package/dist/eval/presentation-reads.js +2 -0
- package/dist/eval/presentation-reads.js.map +1 -0
- package/dist/eval/presentation.d.ts +122 -0
- package/dist/eval/presentation.d.ts.map +1 -0
- package/dist/eval/presentation.js +255 -0
- package/dist/eval/presentation.js.map +1 -0
- package/dist/eval/reader/context-value.d.ts +41 -0
- package/dist/eval/reader/context-value.d.ts.map +1 -0
- package/dist/eval/reader/context-value.js +129 -0
- package/dist/eval/reader/context-value.js.map +1 -0
- package/dist/eval/reader/covered.d.ts +53 -0
- package/dist/eval/reader/covered.d.ts.map +1 -0
- package/dist/eval/reader/covered.js +139 -0
- package/dist/eval/reader/covered.js.map +1 -0
- package/dist/eval/reader/declarations.d.ts +182 -0
- package/dist/eval/reader/declarations.d.ts.map +1 -0
- package/dist/eval/reader/declarations.js +153 -0
- package/dist/eval/reader/declarations.js.map +1 -0
- package/dist/eval/reader/member-access.d.ts +87 -0
- package/dist/eval/reader/member-access.d.ts.map +1 -0
- package/dist/eval/reader/member-access.js +212 -0
- package/dist/eval/reader/member-access.js.map +1 -0
- package/dist/eval/reader/memo.d.ts +34 -0
- package/dist/eval/reader/memo.d.ts.map +1 -0
- package/dist/eval/reader/memo.js +67 -0
- package/dist/eval/reader/memo.js.map +1 -0
- package/dist/eval/reader/overlay.d.ts +74 -0
- package/dist/eval/reader/overlay.d.ts.map +1 -0
- package/dist/eval/reader/overlay.js +365 -0
- package/dist/eval/reader/overlay.js.map +1 -0
- package/dist/eval/reader/questions.d.ts +37 -0
- package/dist/eval/reader/questions.d.ts.map +1 -0
- package/dist/eval/reader/questions.js +78 -0
- package/dist/eval/reader/questions.js.map +1 -0
- package/dist/eval/reader/resolve.d.ts +84 -0
- package/dist/eval/reader/resolve.d.ts.map +1 -0
- package/dist/eval/reader/resolve.js +310 -0
- package/dist/eval/reader/resolve.js.map +1 -0
- package/dist/eval/reader/value-read.d.ts +50 -0
- package/dist/eval/reader/value-read.d.ts.map +1 -0
- package/dist/eval/reader/value-read.js +133 -0
- package/dist/eval/reader/value-read.js.map +1 -0
- package/dist/eval/reader/withheld.d.ts +48 -0
- package/dist/eval/reader/withheld.d.ts.map +1 -0
- package/dist/eval/reader/withheld.js +108 -0
- package/dist/eval/reader/withheld.js.map +1 -0
- package/dist/eval/reader-paths.d.ts +24 -0
- package/dist/eval/reader-paths.d.ts.map +1 -0
- package/dist/eval/reader-paths.js +23 -0
- package/dist/eval/reader-paths.js.map +1 -0
- package/dist/eval/reader.d.ts +281 -0
- package/dist/eval/reader.d.ts.map +1 -0
- package/dist/eval/reader.js +560 -0
- package/dist/eval/reader.js.map +1 -0
- package/dist/eval/receipt.d.ts +37 -0
- package/dist/eval/receipt.d.ts.map +1 -0
- package/dist/eval/receipt.js +222 -0
- package/dist/eval/receipt.js.map +1 -0
- package/dist/eval/report/assemble.d.ts +84 -0
- package/dist/eval/report/assemble.d.ts.map +1 -0
- package/dist/eval/report/assemble.js +277 -0
- package/dist/eval/report/assemble.js.map +1 -0
- package/dist/eval/report/fold.d.ts +18 -0
- package/dist/eval/report/fold.d.ts.map +1 -0
- package/dist/eval/report/fold.js +58 -0
- package/dist/eval/report/fold.js.map +1 -0
- package/dist/eval/rule/alternatives.d.ts +23 -0
- package/dist/eval/rule/alternatives.d.ts.map +1 -0
- package/dist/eval/rule/alternatives.js +46 -0
- package/dist/eval/rule/alternatives.js.map +1 -0
- package/dist/eval/rule/behaviour.d.ts +47 -0
- package/dist/eval/rule/behaviour.d.ts.map +1 -0
- package/dist/eval/rule/behaviour.js +249 -0
- package/dist/eval/rule/behaviour.js.map +1 -0
- package/dist/eval/rule/compute.d.ts +46 -0
- package/dist/eval/rule/compute.d.ts.map +1 -0
- package/dist/eval/rule/compute.js +158 -0
- package/dist/eval/rule/compute.js.map +1 -0
- package/dist/eval/rule/create-state.d.ts +42 -0
- package/dist/eval/rule/create-state.d.ts.map +1 -0
- package/dist/eval/rule/create-state.js +134 -0
- package/dist/eval/rule/create-state.js.map +1 -0
- package/dist/eval/rule/diagnostics.d.ts +24 -0
- package/dist/eval/rule/diagnostics.d.ts.map +1 -0
- package/dist/eval/rule/diagnostics.js +45 -0
- package/dist/eval/rule/diagnostics.js.map +1 -0
- package/dist/eval/rule/execution.d.ts +24 -0
- package/dist/eval/rule/execution.d.ts.map +1 -0
- package/dist/eval/rule/execution.js +495 -0
- package/dist/eval/rule/execution.js.map +1 -0
- package/dist/eval/rule/gate.d.ts +12 -0
- package/dist/eval/rule/gate.d.ts.map +1 -0
- package/dist/eval/rule/gate.js +34 -0
- package/dist/eval/rule/gate.js.map +1 -0
- package/dist/eval/rule/item.d.ts +11 -0
- package/dist/eval/rule/item.d.ts.map +1 -0
- package/dist/eval/rule/item.js +265 -0
- package/dist/eval/rule/item.js.map +1 -0
- package/dist/eval/rule/prepare.d.ts +64 -0
- package/dist/eval/rule/prepare.d.ts.map +1 -0
- package/dist/eval/rule/prepare.js +131 -0
- package/dist/eval/rule/prepare.js.map +1 -0
- package/dist/eval/rule/result.d.ts +97 -0
- package/dist/eval/rule/result.d.ts.map +1 -0
- package/dist/eval/rule/result.js +347 -0
- package/dist/eval/rule/result.js.map +1 -0
- package/dist/eval/rule/runner.d.ts +128 -0
- package/dist/eval/rule/runner.d.ts.map +1 -0
- package/dist/eval/rule/runner.js +296 -0
- package/dist/eval/rule/runner.js.map +1 -0
- package/dist/eval/rule/screen.d.ts +32 -0
- package/dist/eval/rule/screen.d.ts.map +1 -0
- package/dist/eval/rule/screen.js +73 -0
- package/dist/eval/rule/screen.js.map +1 -0
- package/dist/eval/rule/state.d.ts +137 -0
- package/dist/eval/rule/state.d.ts.map +1 -0
- package/dist/eval/rule/state.js +2 -0
- package/dist/eval/rule/state.js.map +1 -0
- package/dist/eval/rule/steps.d.ts +44 -0
- package/dist/eval/rule/steps.d.ts.map +1 -0
- package/dist/eval/rule/steps.js +367 -0
- package/dist/eval/rule/steps.js.map +1 -0
- package/dist/eval/rule/visibility.d.ts +18 -0
- package/dist/eval/rule/visibility.d.ts.map +1 -0
- package/dist/eval/rule/visibility.js +79 -0
- package/dist/eval/rule/visibility.js.map +1 -0
- package/dist/eval/seal.d.ts +74 -0
- package/dist/eval/seal.d.ts.map +1 -0
- package/dist/eval/seal.js +154 -0
- package/dist/eval/seal.js.map +1 -0
- package/dist/eval/signature-coverage.d.ts +19 -0
- package/dist/eval/signature-coverage.d.ts.map +1 -0
- package/dist/eval/signature-coverage.js +160 -0
- package/dist/eval/signature-coverage.js.map +1 -0
- package/dist/eval/state/derive.d.ts +72 -0
- package/dist/eval/state/derive.d.ts.map +1 -0
- package/dist/eval/state/derive.js +61 -0
- package/dist/eval/state/derive.js.map +1 -0
- package/dist/eval/state/describe.d.ts +18 -0
- package/dist/eval/state/describe.d.ts.map +1 -0
- package/dist/eval/state/describe.js +19 -0
- package/dist/eval/state/describe.js.map +1 -0
- package/dist/eval/state/field-state.d.ts +471 -0
- package/dist/eval/state/field-state.d.ts.map +1 -0
- package/dist/eval/state/field-state.js +1604 -0
- package/dist/eval/state/field-state.js.map +1 -0
- package/dist/eval/state/measurement.d.ts +136 -0
- package/dist/eval/state/measurement.d.ts.map +1 -0
- package/dist/eval/state/measurement.js +209 -0
- package/dist/eval/state/measurement.js.map +1 -0
- package/dist/eval/state/options.d.ts +21 -0
- package/dist/eval/state/options.d.ts.map +1 -0
- package/dist/eval/state/options.js +3 -0
- package/dist/eval/state/options.js.map +1 -0
- package/dist/eval/state/readiness.d.ts +400 -0
- package/dist/eval/state/readiness.d.ts.map +1 -0
- package/dist/eval/state/readiness.js +1067 -0
- package/dist/eval/state/readiness.js.map +1 -0
- package/dist/eval/state/snapshot.d.ts +130 -0
- package/dist/eval/state/snapshot.d.ts.map +1 -0
- package/dist/eval/state/snapshot.js +35 -0
- package/dist/eval/state/snapshot.js.map +1 -0
- package/dist/eval/state/unavailable-options.d.ts +54 -0
- package/dist/eval/state/unavailable-options.d.ts.map +1 -0
- package/dist/eval/state/unavailable-options.js +82 -0
- package/dist/eval/state/unavailable-options.js.map +1 -0
- package/dist/eval/state/value-state.d.ts +38 -0
- package/dist/eval/state/value-state.d.ts.map +1 -0
- package/dist/eval/state/value-state.js +52 -0
- package/dist/eval/state/value-state.js.map +1 -0
- package/dist/eval/submission/admission.d.ts +50 -0
- package/dist/eval/submission/admission.d.ts.map +1 -0
- package/dist/eval/submission/admission.js +174 -0
- package/dist/eval/submission/admission.js.map +1 -0
- package/dist/eval/submission/authority.d.ts +71 -0
- package/dist/eval/submission/authority.d.ts.map +1 -0
- package/dist/eval/submission/authority.js +118 -0
- package/dist/eval/submission/authority.js.map +1 -0
- package/dist/eval/submission/datasets.d.ts +28 -0
- package/dist/eval/submission/datasets.d.ts.map +1 -0
- package/dist/eval/submission/datasets.js +109 -0
- package/dist/eval/submission/datasets.js.map +1 -0
- package/dist/eval/submission/index.d.ts +15 -0
- package/dist/eval/submission/index.d.ts.map +1 -0
- package/dist/eval/submission/index.js +13 -0
- package/dist/eval/submission/index.js.map +1 -0
- package/dist/eval/submission/refusals.d.ts +103 -0
- package/dist/eval/submission/refusals.d.ts.map +1 -0
- package/dist/eval/submission/refusals.js +15 -0
- package/dist/eval/submission/refusals.js.map +1 -0
- package/dist/eval/submission/signatures.d.ts +7 -0
- package/dist/eval/submission/signatures.d.ts.map +1 -0
- package/dist/eval/submission/signatures.js +215 -0
- package/dist/eval/submission/signatures.js.map +1 -0
- package/dist/eval/submission/writes.d.ts +51 -0
- package/dist/eval/submission/writes.d.ts.map +1 -0
- package/dist/eval/submission/writes.js +203 -0
- package/dist/eval/submission/writes.js.map +1 -0
- package/dist/eval/submission.d.ts +53 -0
- package/dist/eval/submission.d.ts.map +1 -0
- package/dist/eval/submission.js +521 -0
- package/dist/eval/submission.js.map +1 -0
- package/dist/eval/suggestions-to-engine.d.ts +18 -0
- package/dist/eval/suggestions-to-engine.d.ts.map +1 -0
- package/dist/eval/suggestions-to-engine.js +40 -0
- package/dist/eval/suggestions-to-engine.js.map +1 -0
- package/dist/eval/suggestions.d.ts +17 -0
- package/dist/eval/suggestions.d.ts.map +1 -0
- package/dist/eval/suggestions.js +314 -0
- package/dist/eval/suggestions.js.map +1 -0
- package/dist/eval/undecided.d.ts +64 -0
- package/dist/eval/undecided.d.ts.map +1 -0
- package/dist/eval/undecided.js +101 -0
- package/dist/eval/undecided.js.map +1 -0
- package/dist/eval/verdict.d.ts +66 -0
- package/dist/eval/verdict.d.ts.map +1 -0
- package/dist/eval/verdict.js +106 -0
- package/dist/eval/verdict.js.map +1 -0
- package/dist/eval/verify-signature.d.ts +78 -0
- package/dist/eval/verify-signature.d.ts.map +1 -0
- package/dist/eval/verify-signature.js +185 -0
- package/dist/eval/verify-signature.js.map +1 -0
- package/dist/eval/version-dispatch.d.ts +38 -0
- package/dist/eval/version-dispatch.d.ts.map +1 -0
- package/dist/eval/version-dispatch.js +61 -0
- package/dist/eval/version-dispatch.js.map +1 -0
- package/dist/eval/visibility.d.ts +33 -0
- package/dist/eval/visibility.d.ts.map +1 -0
- package/dist/eval/visibility.js +83 -0
- package/dist/eval/visibility.js.map +1 -0
- package/dist/evaluate.d.ts +24 -0
- package/dist/evaluate.d.ts.map +1 -0
- package/dist/evaluate.js +18 -0
- package/dist/evaluate.js.map +1 -0
- package/dist/expr/builtin-docs.d.ts +51 -0
- package/dist/expr/builtin-docs.d.ts.map +1 -0
- package/dist/expr/builtin-docs.js +874 -0
- package/dist/expr/builtin-docs.js.map +1 -0
- package/dist/expr/builtins.d.ts +50 -0
- package/dist/expr/builtins.d.ts.map +1 -0
- package/dist/expr/builtins.js +966 -0
- package/dist/expr/builtins.js.map +1 -0
- package/dist/expr/decimal-precision.d.ts +39 -0
- package/dist/expr/decimal-precision.d.ts.map +1 -0
- package/dist/expr/decimal-precision.js +62 -0
- package/dist/expr/decimal-precision.js.map +1 -0
- package/dist/expr/decimal.d.ts +172 -0
- package/dist/expr/decimal.d.ts.map +1 -0
- package/dist/expr/decimal.js +782 -0
- package/dist/expr/decimal.js.map +1 -0
- package/dist/expr/deprecations.d.ts +34 -0
- package/dist/expr/deprecations.d.ts.map +1 -0
- package/dist/expr/deprecations.js +17 -0
- package/dist/expr/deprecations.js.map +1 -0
- package/dist/expr/diagnostics.d.ts +21 -0
- package/dist/expr/diagnostics.d.ts.map +1 -0
- package/dist/expr/diagnostics.js +231 -0
- package/dist/expr/diagnostics.js.map +1 -0
- package/dist/expr/direction.d.ts +30 -0
- package/dist/expr/direction.d.ts.map +1 -0
- package/dist/expr/direction.js +77 -0
- package/dist/expr/direction.js.map +1 -0
- package/dist/expr/example-expression.d.ts +62 -0
- package/dist/expr/example-expression.d.ts.map +1 -0
- package/dist/expr/example-expression.js +670 -0
- package/dist/expr/example-expression.js.map +1 -0
- package/dist/expr/instant.d.ts +49 -0
- package/dist/expr/instant.d.ts.map +1 -0
- package/dist/expr/instant.js +111 -0
- package/dist/expr/instant.js.map +1 -0
- package/dist/expr/logic.d.ts +17 -0
- package/dist/expr/logic.d.ts.map +1 -0
- package/dist/expr/logic.js +65 -0
- package/dist/expr/logic.js.map +1 -0
- package/dist/expr/messages.d.ts +45 -0
- package/dist/expr/messages.d.ts.map +1 -0
- package/dist/expr/messages.js +280 -0
- package/dist/expr/messages.js.map +1 -0
- package/dist/expr/money.d.ts +38 -0
- package/dist/expr/money.d.ts.map +1 -0
- package/dist/expr/money.js +127 -0
- package/dist/expr/money.js.map +1 -0
- package/dist/expr/ordering.d.ts +56 -0
- package/dist/expr/ordering.d.ts.map +1 -0
- package/dist/expr/ordering.js +167 -0
- package/dist/expr/ordering.js.map +1 -0
- package/dist/expr/pattern.d.ts +44 -0
- package/dist/expr/pattern.d.ts.map +1 -0
- package/dist/expr/pattern.js +458 -0
- package/dist/expr/pattern.js.map +1 -0
- package/dist/expr/plain-date.d.ts +90 -0
- package/dist/expr/plain-date.d.ts.map +1 -0
- package/dist/expr/plain-date.js +230 -0
- package/dist/expr/plain-date.js.map +1 -0
- package/dist/expr/plural-categories.d.ts +8 -0
- package/dist/expr/plural-categories.d.ts.map +1 -0
- package/dist/expr/plural-categories.js +15 -0
- package/dist/expr/plural-categories.js.map +1 -0
- package/dist/expr/plural-keys.d.ts +39 -0
- package/dist/expr/plural-keys.d.ts.map +1 -0
- package/dist/expr/plural-keys.js +46 -0
- package/dist/expr/plural-keys.js.map +1 -0
- package/dist/expr/plural.d.ts +33 -0
- package/dist/expr/plural.d.ts.map +1 -0
- package/dist/expr/plural.js +50 -0
- package/dist/expr/plural.js.map +1 -0
- package/dist/expr/quantity.d.ts +31 -0
- package/dist/expr/quantity.d.ts.map +1 -0
- package/dist/expr/quantity.js +83 -0
- package/dist/expr/quantity.js.map +1 -0
- package/dist/expr/reduce.d.ts +50 -0
- package/dist/expr/reduce.d.ts.map +1 -0
- package/dist/expr/reduce.js +236 -0
- package/dist/expr/reduce.js.map +1 -0
- package/dist/expr/regex.d.ts +108 -0
- package/dist/expr/regex.d.ts.map +1 -0
- package/dist/expr/regex.js +1207 -0
- package/dist/expr/regex.js.map +1 -0
- package/dist/expr/select-locale.d.ts +67 -0
- package/dist/expr/select-locale.d.ts.map +1 -0
- package/dist/expr/select-locale.js +219 -0
- package/dist/expr/select-locale.js.map +1 -0
- package/dist/expr/sequences.d.ts +123 -0
- package/dist/expr/sequences.d.ts.map +1 -0
- package/dist/expr/sequences.js +234 -0
- package/dist/expr/sequences.js.map +1 -0
- package/dist/expr/strings.d.ts +50 -0
- package/dist/expr/strings.d.ts.map +1 -0
- package/dist/expr/strings.js +184 -0
- package/dist/expr/strings.js.map +1 -0
- package/dist/expr/validation.d.ts +32 -0
- package/dist/expr/validation.d.ts.map +1 -0
- package/dist/expr/validation.js +182 -0
- package/dist/expr/validation.js.map +1 -0
- package/dist/graph/freeze.d.ts +4 -0
- package/dist/graph/freeze.d.ts.map +1 -0
- package/dist/graph/freeze.js +52 -0
- package/dist/graph/freeze.js.map +1 -0
- package/dist/graph/index.d.ts +15 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/inspect.d.ts +76 -0
- package/dist/graph/inspect.d.ts.map +1 -0
- package/dist/graph/inspect.js +263 -0
- package/dist/graph/inspect.js.map +1 -0
- package/dist/graph/read-walk.d.ts +101 -0
- package/dist/graph/read-walk.d.ts.map +1 -0
- package/dist/graph/read-walk.js +358 -0
- package/dist/graph/read-walk.js.map +1 -0
- package/dist/graph/record-index.d.ts +24 -0
- package/dist/graph/record-index.d.ts.map +1 -0
- package/dist/graph/record-index.js +35 -0
- package/dist/graph/record-index.js.map +1 -0
- package/dist/index.d.ts +104 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/lookup/digest.d.ts +51 -0
- package/dist/lookup/digest.d.ts.map +1 -0
- package/dist/lookup/digest.js +46 -0
- package/dist/lookup/digest.js.map +1 -0
- package/dist/lookup/index.d.ts +28 -0
- package/dist/lookup/index.d.ts.map +1 -0
- package/dist/lookup/index.js +27 -0
- package/dist/lookup/index.js.map +1 -0
- package/dist/lookup/install.d.ts +48 -0
- package/dist/lookup/install.d.ts.map +1 -0
- package/dist/lookup/install.js +315 -0
- package/dist/lookup/install.js.map +1 -0
- package/dist/lookup/pass.d.ts +55 -0
- package/dist/lookup/pass.d.ts.map +1 -0
- package/dist/lookup/pass.js +212 -0
- package/dist/lookup/pass.js.map +1 -0
- package/dist/lookup/pins.d.ts +34 -0
- package/dist/lookup/pins.d.ts.map +1 -0
- package/dist/lookup/pins.js +39 -0
- package/dist/lookup/pins.js.map +1 -0
- package/dist/lookup/provenance.d.ts +23 -0
- package/dist/lookup/provenance.d.ts.map +1 -0
- package/dist/lookup/provenance.js +78 -0
- package/dist/lookup/provenance.js.map +1 -0
- package/dist/lookup/readiness.d.ts +13 -0
- package/dist/lookup/readiness.d.ts.map +1 -0
- package/dist/lookup/readiness.js +57 -0
- package/dist/lookup/readiness.js.map +1 -0
- package/dist/lookup/resolve.d.ts +24 -0
- package/dist/lookup/resolve.d.ts.map +1 -0
- package/dist/lookup/resolve.js +201 -0
- package/dist/lookup/resolve.js.map +1 -0
- package/dist/lookup/store.d.ts +41 -0
- package/dist/lookup/store.d.ts.map +1 -0
- package/dist/lookup/store.js +74 -0
- package/dist/lookup/store.js.map +1 -0
- package/dist/model/access.d.ts +200 -0
- package/dist/model/access.d.ts.map +1 -0
- package/dist/model/access.js +125 -0
- package/dist/model/access.js.map +1 -0
- package/dist/model/artifact-members.d.ts +3 -0
- package/dist/model/artifact-members.d.ts.map +1 -0
- package/dist/model/artifact-members.js +38 -0
- package/dist/model/artifact-members.js.map +1 -0
- package/dist/model/composition.d.ts +47 -0
- package/dist/model/composition.d.ts.map +1 -0
- package/dist/model/composition.js +66 -0
- package/dist/model/composition.js.map +1 -0
- package/dist/model/domain.d.ts +51 -0
- package/dist/model/domain.d.ts.map +1 -0
- package/dist/model/domain.js +75 -0
- package/dist/model/domain.js.map +1 -0
- package/dist/model/duration.d.ts +31 -0
- package/dist/model/duration.d.ts.map +1 -0
- package/dist/model/duration.js +136 -0
- package/dist/model/duration.js.map +1 -0
- package/dist/model/errors.d.ts +58 -0
- package/dist/model/errors.d.ts.map +1 -0
- package/dist/model/errors.js +81 -0
- package/dist/model/errors.js.map +1 -0
- package/dist/model/evolution.d.ts +177 -0
- package/dist/model/evolution.d.ts.map +1 -0
- package/dist/model/evolution.js +5 -0
- package/dist/model/evolution.js.map +1 -0
- package/dist/model/expr-children.d.ts +15 -0
- package/dist/model/expr-children.d.ts.map +1 -0
- package/dist/model/expr-children.js +45 -0
- package/dist/model/expr-children.js.map +1 -0
- package/dist/model/guards.d.ts +9 -0
- package/dist/model/guards.d.ts.map +1 -0
- package/dist/model/guards.js +11 -0
- package/dist/model/guards.js.map +1 -0
- package/dist/model/input.d.ts +42 -0
- package/dist/model/input.d.ts.map +1 -0
- package/dist/model/input.js +26 -0
- package/dist/model/input.js.map +1 -0
- package/dist/model/integer.d.ts +14 -0
- package/dist/model/integer.d.ts.map +1 -0
- package/dist/model/integer.js +16 -0
- package/dist/model/integer.js.map +1 -0
- package/dist/model/intrinsic.d.ts +18 -0
- package/dist/model/intrinsic.d.ts.map +1 -0
- package/dist/model/intrinsic.js +21 -0
- package/dist/model/intrinsic.js.map +1 -0
- package/dist/model/layout.d.ts +129 -0
- package/dist/model/layout.d.ts.map +1 -0
- package/dist/model/layout.js +2 -0
- package/dist/model/layout.js.map +1 -0
- package/dist/model/media.d.ts +33 -0
- package/dist/model/media.d.ts.map +1 -0
- package/dist/model/media.js +86 -0
- package/dist/model/media.js.map +1 -0
- package/dist/model/members.generated.d.ts +11 -0
- package/dist/model/members.generated.d.ts.map +1 -0
- package/dist/model/members.generated.js +71 -0
- package/dist/model/members.generated.js.map +1 -0
- package/dist/model/row-address.d.ts +27 -0
- package/dist/model/row-address.d.ts.map +1 -0
- package/dist/model/row-address.js +146 -0
- package/dist/model/row-address.js.map +1 -0
- package/dist/model/schema.d.ts +108 -0
- package/dist/model/schema.d.ts.map +1 -0
- package/dist/model/schema.js +2 -0
- package/dist/model/schema.js.map +1 -0
- package/dist/model/shape.d.ts +193 -0
- package/dist/model/shape.d.ts.map +1 -0
- package/dist/model/shape.js +2 -0
- package/dist/model/shape.js.map +1 -0
- package/dist/model/time.d.ts +61 -0
- package/dist/model/time.d.ts.map +1 -0
- package/dist/model/time.js +110 -0
- package/dist/model/time.js.map +1 -0
- package/dist/model/types.d.ts +1329 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +424 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/values.d.ts +91 -0
- package/dist/model/values.d.ts.map +1 -0
- package/dist/model/values.js +195 -0
- package/dist/model/values.js.map +1 -0
- package/dist/model/wire.d.ts +356 -0
- package/dist/model/wire.d.ts.map +1 -0
- package/dist/model/wire.js +1504 -0
- package/dist/model/wire.js.map +1 -0
- package/dist/offline/index.d.ts +374 -0
- package/dist/offline/index.d.ts.map +1 -0
- package/dist/offline/index.js +422 -0
- package/dist/offline/index.js.map +1 -0
- package/dist/testing.d.ts +30 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +42 -0
- package/dist/testing.js.map +1 -0
- package/dist/version.d.ts +30 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +116 -0
- package/dist/version.js.map +1 -0
- package/package.json +98 -3
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { fieldKey } from './projection.js';
|
|
2
|
+
import { meetAccess } from './overlay.js';
|
|
3
|
+
/** The delivery answer one resolved access state states, with the two inputs access does not own. */
|
|
4
|
+
export function deliveryOf(access, redacted, sessionWritten) {
|
|
5
|
+
const reason = reasonOf(access, redacted, sessionWritten);
|
|
6
|
+
return {
|
|
7
|
+
reason,
|
|
8
|
+
deliverable: reason === 'read_write' || reason === 'read_only' || reason === 'written',
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** The one reason a binding's answer names, most specific first. */
|
|
12
|
+
function reasonOf(access, redacted, sessionWritten) {
|
|
13
|
+
if (redacted)
|
|
14
|
+
return 'redacted';
|
|
15
|
+
if (access === 'write_only')
|
|
16
|
+
return sessionWritten ? 'written' : 'write_only';
|
|
17
|
+
return access;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Whether the host stated an access answer for one reference, rather than the fail-closed default.
|
|
21
|
+
*
|
|
22
|
+
* The default is `read_only` (`[ACCESS-2.1.2]`), which answers "may this device write" and says
|
|
23
|
+
* nothing about who supplies the value. A flat projection states exactly the entries it holds; an
|
|
24
|
+
* overlay states a reference when a rule matched it, and a template states every row of the array
|
|
25
|
+
* it names.
|
|
26
|
+
*/
|
|
27
|
+
export function statedAccess(projection, ref) {
|
|
28
|
+
const stated = projection.stated;
|
|
29
|
+
if (stated === undefined) {
|
|
30
|
+
return (projection.entries.has(fieldKey(ref)) ||
|
|
31
|
+
(ref.rowKey !== undefined && projection.entries.has(ref.fieldId)));
|
|
32
|
+
}
|
|
33
|
+
if (stated.has(fieldKey(ref)) || stated.has(ref.fieldId))
|
|
34
|
+
return true;
|
|
35
|
+
return ref.rowKey !== undefined && stated.has(`${ref.fieldId}@*`);
|
|
36
|
+
}
|
|
37
|
+
/** The answer for one target, or `undefined` when the answer cannot name its declarations. */
|
|
38
|
+
export function targetAccessOf(ref, enclosing, accessFor, redacted) {
|
|
39
|
+
if (enclosing === undefined || enclosing.length === 0)
|
|
40
|
+
return undefined;
|
|
41
|
+
let met = 'read_write';
|
|
42
|
+
for (const fieldId of enclosing) {
|
|
43
|
+
const at = ref.rowKey === undefined ? { fieldId } : { fieldId, rowKey: ref.rowKey };
|
|
44
|
+
if (redacted(at))
|
|
45
|
+
return 'withheld';
|
|
46
|
+
met = meetAccess(met, accessFor(at));
|
|
47
|
+
if (met === 'hidden' || met === 'masked')
|
|
48
|
+
return 'withheld';
|
|
49
|
+
}
|
|
50
|
+
return met === 'read_only' ? 'read_only' : 'writable';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The delivery answer for one binding and every declaration enclosing it, `[ACCESS-1.3.4]`.
|
|
54
|
+
*
|
|
55
|
+
* Delivery is per reference, and a read of a member is refused when any declaration carrying its
|
|
56
|
+
* value withholds it: a member of a record is delivered inside that record's payload, so one
|
|
57
|
+
* withheld ancestor withholds the member with it. The answer states the strongest reason the chain
|
|
58
|
+
* gives, because a caller that must explain a withholding needs the one that outranks the rest.
|
|
59
|
+
*
|
|
60
|
+
* The conjunction is deliberate where the write answer above is the meet: a stored `write_only`
|
|
61
|
+
* value this session wrote reads back even beneath a `read_only` record, because the session's own
|
|
62
|
+
* write is what made it readable.
|
|
63
|
+
*/
|
|
64
|
+
export function enclosingDelivery(ref, enclosing, answerFor) {
|
|
65
|
+
if (enclosing === undefined || enclosing.length === 0) {
|
|
66
|
+
return { reason: 'hidden', deliverable: false };
|
|
67
|
+
}
|
|
68
|
+
let strongest = 'read_write';
|
|
69
|
+
for (const fieldId of enclosing) {
|
|
70
|
+
const at = ref.rowKey === undefined ? { fieldId } : { fieldId, rowKey: ref.rowKey };
|
|
71
|
+
const answer = answerFor(at);
|
|
72
|
+
if (!answer.deliverable && rankOf(answer.reason) > rankOf(strongest)) {
|
|
73
|
+
strongest = answer.reason;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return { reason: strongest, deliverable: rankOf(strongest) === 0 };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* How strongly one reason withholds a value.
|
|
80
|
+
*
|
|
81
|
+
* A redaction is the server holding the value, a hide removes the control, a mask withholds what
|
|
82
|
+
* the control shows, and a stored `write_only` value is the record's own secret. A caller that can
|
|
83
|
+
* state only one of them names the strongest, so the order is stated once here rather than at each
|
|
84
|
+
* consumer. The record is total over the reason, so a new reason fails the typecheck.
|
|
85
|
+
*/
|
|
86
|
+
const REASON_RANK = {
|
|
87
|
+
read_write: 0,
|
|
88
|
+
read_only: 0,
|
|
89
|
+
written: 0,
|
|
90
|
+
write_only: 1,
|
|
91
|
+
masked: 2,
|
|
92
|
+
hidden: 3,
|
|
93
|
+
redacted: 4,
|
|
94
|
+
};
|
|
95
|
+
function rankOf(reason) {
|
|
96
|
+
return REASON_RANK[reason];
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=delivery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../../src/eval/access/delivery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+B1C,qGAAqG;AACrG,MAAM,UAAU,UAAU,CACxB,MAAmB,EACnB,QAAiB,EACjB,cAAuB;IAEvB,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC1D,OAAO;QACL,MAAM;QACN,WAAW,EAAE,MAAM,KAAK,YAAY,IAAI,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,SAAS;KACvF,CAAC;AACJ,CAAC;AAED,oEAAoE;AACpE,SAAS,QAAQ,CAAC,MAAmB,EAAE,QAAiB,EAAE,cAAuB;IAC/E,IAAI,QAAQ;QAAE,OAAO,UAAU,CAAC;IAChC,IAAI,MAAM,KAAK,YAAY;QAAE,OAAO,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC;IAC9E,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,UAA4B,EAAE,GAAa;IACtE,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACjC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,CACL,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACrC,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAClE,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACtE,OAAO,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC;AACpE,CAAC;AAgBD,8FAA8F;AAC9F,MAAM,UAAU,cAAc,CAC5B,GAAa,EACb,SAAwC,EACxC,SAAyC,EACzC,QAAoC;IAEpC,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACxE,IAAI,GAAG,GAAgB,YAAY,CAAC;IACpC,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;QAChC,MAAM,EAAE,GAAa,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;QAC9F,IAAI,QAAQ,CAAC,EAAE,CAAC;YAAE,OAAO,UAAU,CAAC;QACpC,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACrC,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,QAAQ;YAAE,OAAO,UAAU,CAAC;IAC9D,CAAC;IACD,OAAO,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAa,EACb,SAAwC,EACxC,SAA4C;IAE5C,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAClD,CAAC;IACD,IAAI,SAAS,GAAmB,YAAY,CAAC;IAC7C,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;QAChC,MAAM,EAAE,GAAa,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;QAC9F,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACrE,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,GAA6C;IAC5D,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,CAAC;IACZ,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF,SAAS,MAAM,CAAC,MAAsB;IACpC,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import type { FieldAccess, FieldRef } from '../../model/types.js';\nimport type { AccessProjection } from './projection.js';\nimport { fieldKey } from './projection.js';\nimport { meetAccess } from './overlay.js';\n\n/**\n * One binding's delivery answer: whether its value may be stated, and the one reason it may not.\n *\n * Every consumer that used to classify access for itself asks this instead — a report stating a\n * writer's value, a derived field's value state, an alternative's target and the derived\n * requirements a respondent is held to. The reason is a single closed set so those consumers\n * cannot each invent a different reading of the same overlay (`[ACCESS-1.3.4]`).\n *\n * `masked` is the one state two readers disagree about, and legitimately: `allowMaskedRead` lifts\n * it for an expression and never for delivery (`[ACCESS-1.3.3]`). `written` is the `write_only`\n * value this session wrote, which reads back as a value while a stored one never does\n * (`[ACCESS-1.3.1]`).\n */\ntype DeliveryReason =\n | 'read_write'\n | 'read_only'\n | 'write_only'\n | 'written'\n | 'masked'\n | 'hidden'\n | 'redacted';\n\n/** What one binding's access answer permits, and the reason it permits or withholds it. */\nexport interface DeliveryAnswer {\n readonly reason: DeliveryReason;\n /** Whether the value may be stated to this device: a report, a painted control, a payload. */\n readonly deliverable: boolean;\n}\n\n/** The delivery answer one resolved access state states, with the two inputs access does not own. */\nexport function deliveryOf(\n access: FieldAccess,\n redacted: boolean,\n sessionWritten: boolean,\n): DeliveryAnswer {\n const reason = reasonOf(access, redacted, sessionWritten);\n return {\n reason,\n deliverable: reason === 'read_write' || reason === 'read_only' || reason === 'written',\n };\n}\n\n/** The one reason a binding's answer names, most specific first. */\nfunction reasonOf(access: FieldAccess, redacted: boolean, sessionWritten: boolean): DeliveryReason {\n if (redacted) return 'redacted';\n if (access === 'write_only') return sessionWritten ? 'written' : 'write_only';\n return access;\n}\n\n/**\n * Whether the host stated an access answer for one reference, rather than the fail-closed default.\n *\n * The default is `read_only` (`[ACCESS-2.1.2]`), which answers \"may this device write\" and says\n * nothing about who supplies the value. A flat projection states exactly the entries it holds; an\n * overlay states a reference when a rule matched it, and a template states every row of the array\n * it names.\n */\nexport function statedAccess(projection: AccessProjection, ref: FieldRef): boolean {\n const stated = projection.stated;\n if (stated === undefined) {\n return (\n projection.entries.has(fieldKey(ref)) ||\n (ref.rowKey !== undefined && projection.entries.has(ref.fieldId))\n );\n }\n if (stated.has(fieldKey(ref)) || stated.has(ref.fieldId)) return true;\n return ref.rowKey !== undefined && stated.has(`${ref.fieldId}@*`);\n}\n\n/**\n * Whether an alternative may name one binding, `RULES-6.1.3`, `RULES-7.1.4`.\n *\n * The access of every declaration enclosing the target meets, so a member of a record the answer\n * hides is not writable because its own entry says `read_write`. A target the artifact does not\n * declare, or one no single declaration path answers, is withheld rather than offered against a\n * binding no host can address: the refusal is a report policy, and the write guard stays\n * authoritative at apply.\n *\n * `read_only` and `write_only` meet to `hidden`, which is why the answer is the meet and never\n * each declaration alone: a disabled stub for that pair would cross the same boundary.\n */\nexport type TargetAccess = 'writable' | 'read_only' | 'withheld';\n\n/** The answer for one target, or `undefined` when the answer cannot name its declarations. */\nexport function targetAccessOf(\n ref: FieldRef,\n enclosing: readonly string[] | undefined,\n accessFor: (ref: FieldRef) => FieldAccess,\n redacted: (ref: FieldRef) => boolean,\n): TargetAccess | undefined {\n if (enclosing === undefined || enclosing.length === 0) return undefined;\n let met: FieldAccess = 'read_write';\n for (const fieldId of enclosing) {\n const at: FieldRef = ref.rowKey === undefined ? { fieldId } : { fieldId, rowKey: ref.rowKey };\n if (redacted(at)) return 'withheld';\n met = meetAccess(met, accessFor(at));\n if (met === 'hidden' || met === 'masked') return 'withheld';\n }\n return met === 'read_only' ? 'read_only' : 'writable';\n}\n\n/**\n * The delivery answer for one binding and every declaration enclosing it, `[ACCESS-1.3.4]`.\n *\n * Delivery is per reference, and a read of a member is refused when any declaration carrying its\n * value withholds it: a member of a record is delivered inside that record's payload, so one\n * withheld ancestor withholds the member with it. The answer states the strongest reason the chain\n * gives, because a caller that must explain a withholding needs the one that outranks the rest.\n *\n * The conjunction is deliberate where the write answer above is the meet: a stored `write_only`\n * value this session wrote reads back even beneath a `read_only` record, because the session's own\n * write is what made it readable.\n */\nexport function enclosingDelivery(\n ref: FieldRef,\n enclosing: readonly string[] | undefined,\n answerFor: (ref: FieldRef) => DeliveryAnswer,\n): DeliveryAnswer {\n if (enclosing === undefined || enclosing.length === 0) {\n return { reason: 'hidden', deliverable: false };\n }\n let strongest: DeliveryReason = 'read_write';\n for (const fieldId of enclosing) {\n const at: FieldRef = ref.rowKey === undefined ? { fieldId } : { fieldId, rowKey: ref.rowKey };\n const answer = answerFor(at);\n if (!answer.deliverable && rankOf(answer.reason) > rankOf(strongest)) {\n strongest = answer.reason;\n }\n }\n return { reason: strongest, deliverable: rankOf(strongest) === 0 };\n}\n\n/**\n * How strongly one reason withholds a value.\n *\n * A redaction is the server holding the value, a hide removes the control, a mask withholds what\n * the control shows, and a stored `write_only` value is the record's own secret. A caller that can\n * state only one of them names the strongest, so the order is stated once here rather than at each\n * consumer. The record is total over the reason, so a new reason fails the typecheck.\n */\nconst REASON_RANK: Readonly<Record<DeliveryReason, number>> = {\n read_write: 0,\n read_only: 0,\n written: 0,\n write_only: 1,\n masked: 2,\n hidden: 3,\n redacted: 4,\n};\n\nfunction rankOf(reason: DeliveryReason): number {\n return REASON_RANK[reason];\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { AccessOverlay } from '../../model/access.js';
|
|
2
|
+
import type { CompiledField, FieldAccess, FieldRef } from '../../model/types.js';
|
|
3
|
+
import type { AccessProjection } from './projection.js';
|
|
4
|
+
/**
|
|
5
|
+
* The 4-level overlay resolver, `spec/semantics/access-v1.md` section 2.
|
|
6
|
+
*
|
|
7
|
+
* One authority owns the specificity order, the 5×5 meet table and the resolution of a host
|
|
8
|
+
* overlay into the projection every read consults. A read is then a map lookup rather than a
|
|
9
|
+
* second walk of the rules, and the report's projection, the reader's answer and the UI
|
|
10
|
+
* binding cannot disagree about which level won.
|
|
11
|
+
*
|
|
12
|
+
* The resolution is fail-closed: an absent overlay grants the caller nothing it did not
|
|
13
|
+
* state, `defaultAccess` falls back to `read_only` rather than an inferred grant, and a rule
|
|
14
|
+
* that matches no declaration grants nothing.
|
|
15
|
+
*/
|
|
16
|
+
/** A resolved overlay: the version it carries, the fields whose masks rule reads lift, and the projection. */
|
|
17
|
+
export interface ResolvedAccess {
|
|
18
|
+
readonly version: number;
|
|
19
|
+
readonly allowMaskedRead: ReadonlySet<string>;
|
|
20
|
+
readonly entries: AccessProjection;
|
|
21
|
+
}
|
|
22
|
+
/** The access two states of the same specificity intersect to. */
|
|
23
|
+
export declare function meetAccess(left: FieldAccess, right: FieldAccess): FieldAccess;
|
|
24
|
+
/** The exact-row rule comparisons since the process started. */
|
|
25
|
+
export declare function overlayRowRuleComparisons(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves an overlay into the projection every read consults, `[ACCESS-2.1.3]`.
|
|
28
|
+
*
|
|
29
|
+
* Each declaration's field-level state comes from the most specific level that matches it:
|
|
30
|
+
* an exact rule on the field, then a `container` rule on one of its record ancestors, then a
|
|
31
|
+
* `section` rule on the section its annotations name, then `defaultAccess`. A `template`
|
|
32
|
+
* rule never governs a container's own structural state, and never governs a scalar field:
|
|
33
|
+
* it states the state of every row of one array, so it is resolved into the row default and
|
|
34
|
+
* is weighed whenever a container read would carry those rows.
|
|
35
|
+
*
|
|
36
|
+
* An exact `fieldId@rowKey` rule is resolved at the exact level beside an exact field-wide
|
|
37
|
+
* rule, so a row rule may narrow but never re-open the field's own answer.
|
|
38
|
+
*
|
|
39
|
+
* `path` names where the caller supplied the overlay, so a rule a JavaScript caller wrote is
|
|
40
|
+
* refused at the path the caller used — `$.overlay.rules[0].match` for a direct evaluation,
|
|
41
|
+
* `authority.overlay.rules[0].match` for a submission's host facts.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveOverlay(fields: readonly CompiledField[], overlay: AccessOverlay, path?: string): ResolvedAccess;
|
|
44
|
+
/**
|
|
45
|
+
* The effective access of one reference, `[ACCESS-2.1.4]`.
|
|
46
|
+
*
|
|
47
|
+
* The session writes are part of the question: a stored `write_only` value is readable only
|
|
48
|
+
* once this session wrote it, and a container that carries such a row is withdrawn as a
|
|
49
|
+
* whole rather than delivered around its own entry.
|
|
50
|
+
*/
|
|
51
|
+
export declare function accessFor(resolved: ResolvedAccess, ref: FieldRef, sessionWrites: ReadonlySet<string>): FieldAccess;
|
|
52
|
+
/**
|
|
53
|
+
* Whether a rule may read one reference, `[ACCESS-1.3.2]`, `[ACCESS-1.3.3]`.
|
|
54
|
+
*
|
|
55
|
+
* `allowMaskedRead` lifts a `masked` or `hidden` answer for expression reads only. It never
|
|
56
|
+
* lifts `write_only`: a stored write-only value stays unreadable until this session writes
|
|
57
|
+
* it, because the host's list is about masks and not about secrets.
|
|
58
|
+
*/
|
|
59
|
+
export declare function ruleReadFor(resolved: ResolvedAccess, ref: FieldRef, sessionWrites: ReadonlySet<string>): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The report's access projection for the references an evaluation considered.
|
|
62
|
+
*
|
|
63
|
+
* The answer is per declaration, never per row (`[ACCESS-5.1.1]`): a container read carries
|
|
64
|
+
* every row it holds, so the container's own answer already states what a row key would
|
|
65
|
+
* restate. Entries are deduplicated by `fieldId` and sorted in code-point order
|
|
66
|
+
* (`[ACCESS-5.1.4]`).
|
|
67
|
+
*/
|
|
68
|
+
export declare function projectAccessEntries(resolved: ResolvedAccess, refs: readonly FieldRef[], sessionWrites: ReadonlySet<string>): readonly {
|
|
69
|
+
readonly fieldId: string;
|
|
70
|
+
readonly access: FieldAccess;
|
|
71
|
+
}[];
|
|
72
|
+
//# sourceMappingURL=overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/eval/access/overlay.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAqB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD;;;;;;;;;;;GAWG;AAEH,8GAA8G;AAC9G,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC;AAwDD,kEAAkE;AAClE,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,WAAW,CAE7E;AA4BD,gEAAgE;AAChE,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AA2ND;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,OAAO,EAAE,aAAa,EACtB,IAAI,SAAc,GACjB,cAAc,CAoFhB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,QAAQ,EACb,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,WAAW,CAEb;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,QAAQ,EACb,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,OAAO,CAMT;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,SAAS;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE,EAAE,CAQvE"}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { AxiomError } from '../../model/errors.js';
|
|
2
|
+
import { isSafeInteger } from '../../model/integer.js';
|
|
3
|
+
import { compareCodePoints } from '../../expr/strings.js';
|
|
4
|
+
import { rowKeyToken } from '../../model/wire.js';
|
|
5
|
+
import { fieldKey, permitsReadOf, resolveProjectedAccess } from './projection.js';
|
|
6
|
+
/**
|
|
7
|
+
* The 5×5 orthogonal meet table, `[ACCESS-2.1.5]`.
|
|
8
|
+
*
|
|
9
|
+
* `canRead` meets by taking the more restrictive of the pair (`none` beats `masked` beats
|
|
10
|
+
* `full`) and `canWrite` meets by AND. The table is written once here and nowhere else, so a
|
|
11
|
+
* resolver, a report and a UI binding cannot each carry their own copy that drifts.
|
|
12
|
+
*/
|
|
13
|
+
const MEET = {
|
|
14
|
+
read_write: {
|
|
15
|
+
read_write: 'read_write',
|
|
16
|
+
read_only: 'read_only',
|
|
17
|
+
write_only: 'write_only',
|
|
18
|
+
masked: 'masked',
|
|
19
|
+
hidden: 'hidden',
|
|
20
|
+
},
|
|
21
|
+
read_only: {
|
|
22
|
+
read_write: 'read_only',
|
|
23
|
+
read_only: 'read_only',
|
|
24
|
+
write_only: 'hidden',
|
|
25
|
+
masked: 'masked',
|
|
26
|
+
hidden: 'hidden',
|
|
27
|
+
},
|
|
28
|
+
write_only: {
|
|
29
|
+
read_write: 'write_only',
|
|
30
|
+
read_only: 'hidden',
|
|
31
|
+
write_only: 'write_only',
|
|
32
|
+
masked: 'hidden',
|
|
33
|
+
hidden: 'hidden',
|
|
34
|
+
},
|
|
35
|
+
masked: {
|
|
36
|
+
read_write: 'masked',
|
|
37
|
+
read_only: 'masked',
|
|
38
|
+
write_only: 'hidden',
|
|
39
|
+
masked: 'masked',
|
|
40
|
+
hidden: 'hidden',
|
|
41
|
+
},
|
|
42
|
+
hidden: {
|
|
43
|
+
read_write: 'hidden',
|
|
44
|
+
read_only: 'hidden',
|
|
45
|
+
write_only: 'hidden',
|
|
46
|
+
masked: 'hidden',
|
|
47
|
+
hidden: 'hidden',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
/** The access two states of the same specificity intersect to. */
|
|
51
|
+
export function meetAccess(left, right) {
|
|
52
|
+
return MEET[left][right];
|
|
53
|
+
}
|
|
54
|
+
/** The access a set of states intersects to, or `undefined` for none. */
|
|
55
|
+
function meetAccesses(accesses) {
|
|
56
|
+
let met;
|
|
57
|
+
for (const access of accesses)
|
|
58
|
+
met = met === undefined ? access : meetAccess(met, access);
|
|
59
|
+
return met;
|
|
60
|
+
}
|
|
61
|
+
/** The access a set of rules at one specificity level intersects to, or `undefined` for none. */
|
|
62
|
+
function meetRules(rules) {
|
|
63
|
+
return meetAccesses(rules.map((rule) => rule.access));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The exact-row rules this process has compared while resolving an overlay.
|
|
67
|
+
*
|
|
68
|
+
* A measurement hook, never an input: no decision reads it. A host that grants one row at a
|
|
69
|
+
* time declares one rule per row, and the resolver must meet each of those rules once. A count
|
|
70
|
+
* of the rules visited — not a stopwatch — is what shows the resolve is linear in them rather
|
|
71
|
+
* than intersecting every rule with every rule for the same row, which was the rows squared.
|
|
72
|
+
*/
|
|
73
|
+
let rowRuleComparisons = 0;
|
|
74
|
+
function noteRowRuleComparison() {
|
|
75
|
+
rowRuleComparisons += 1;
|
|
76
|
+
}
|
|
77
|
+
/** The exact-row rule comparisons since the process started. */
|
|
78
|
+
export function overlayRowRuleComparisons() {
|
|
79
|
+
return rowRuleComparisons;
|
|
80
|
+
}
|
|
81
|
+
/** The identifier a `template` rule names: the field every one of its rows belongs to. */
|
|
82
|
+
function templateFieldOf(match) {
|
|
83
|
+
const at = match.indexOf('@');
|
|
84
|
+
return at < 0 ? match : match.slice(0, at);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The record a `container` rule names, `[ACCESS-2.1.3]`.
|
|
88
|
+
*
|
|
89
|
+
* The clause states the level as `container` (`recordFieldId.*`) while the field id alone is
|
|
90
|
+
* the same record, so both spellings name one rule. A match that names no record is refused
|
|
91
|
+
* here for the same reason a malformed exact match is: a host that wrote a rule the resolver
|
|
92
|
+
* could only ignore would believe it had granted the subtree.
|
|
93
|
+
*/
|
|
94
|
+
function containerFieldOf(match, rulePath) {
|
|
95
|
+
const fieldId = match.endsWith('.*') ? match.slice(0, -2) : match;
|
|
96
|
+
if (fieldId === '') {
|
|
97
|
+
throw new AxiomError('ENGINE_ERROR', `a container access match names a record fieldId; ${JSON.stringify(match)} does not`, rulePath);
|
|
98
|
+
}
|
|
99
|
+
return fieldId;
|
|
100
|
+
}
|
|
101
|
+
/** The field and row key an `exact` match names, or `undefined` when it names a whole field. */
|
|
102
|
+
function parseRowMatch(match, rulePath) {
|
|
103
|
+
const at = match.indexOf('@');
|
|
104
|
+
if (at < 0)
|
|
105
|
+
return undefined;
|
|
106
|
+
const fieldId = match.slice(0, at);
|
|
107
|
+
const token = match.slice(at + 1);
|
|
108
|
+
const rowKey = parseRowToken(token);
|
|
109
|
+
if (fieldId === '' || rowKey === undefined) {
|
|
110
|
+
throw new AxiomError('ENGINE_ERROR', `an exact access match states \`fieldId@<rowKeyToken>\`; ${JSON.stringify(match)} does not`, rulePath);
|
|
111
|
+
}
|
|
112
|
+
return { fieldId, rowKey };
|
|
113
|
+
}
|
|
114
|
+
/** Reads the wire-typed row token an exact match carries, refusing a spelling that is not one. */
|
|
115
|
+
function parseRowToken(token) {
|
|
116
|
+
const separator = token.indexOf(':');
|
|
117
|
+
if (separator < 0)
|
|
118
|
+
return undefined;
|
|
119
|
+
const kind = token.slice(0, separator);
|
|
120
|
+
const text = token.slice(separator + 1);
|
|
121
|
+
if (kind === 'string')
|
|
122
|
+
return text === '' ? undefined : text;
|
|
123
|
+
if (kind !== 'number')
|
|
124
|
+
return undefined;
|
|
125
|
+
const parsed = Number(text);
|
|
126
|
+
if (!isSafeInteger(parsed))
|
|
127
|
+
return undefined;
|
|
128
|
+
return rowKeyToken(parsed) === token ? parsed : undefined;
|
|
129
|
+
}
|
|
130
|
+
/** The `sectionId` a field's annotations name, never a layout anchor. */
|
|
131
|
+
function sectionOf(field) {
|
|
132
|
+
const value = field.annotations?.['sectionId'];
|
|
133
|
+
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
134
|
+
}
|
|
135
|
+
/** Every declared field, with the containers whose ids a `container` rule may match. */
|
|
136
|
+
function declarationsOf(fields) {
|
|
137
|
+
const declared = [];
|
|
138
|
+
const walk = (members, ancestors, inheritedSection) => {
|
|
139
|
+
for (const field of members) {
|
|
140
|
+
const sectionId = sectionOf(field) ?? inheritedSection;
|
|
141
|
+
declared.push({
|
|
142
|
+
field,
|
|
143
|
+
containerIds: field.primitive === 'record' ? [field.fieldId, ...ancestors] : ancestors,
|
|
144
|
+
sectionId,
|
|
145
|
+
});
|
|
146
|
+
const nextAncestors = field.primitive === 'record' ? [...ancestors, field.fieldId] : ancestors;
|
|
147
|
+
if (field.fields !== undefined && field.fields.length > 0) {
|
|
148
|
+
walk(field.fields, nextAncestors, sectionId);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
walk(fields, [], undefined);
|
|
153
|
+
return declared;
|
|
154
|
+
}
|
|
155
|
+
function group(rules, keyOf) {
|
|
156
|
+
const grouped = new Map();
|
|
157
|
+
for (const rule of rules) {
|
|
158
|
+
const key = keyOf(rule);
|
|
159
|
+
if (key === undefined)
|
|
160
|
+
continue;
|
|
161
|
+
const group = grouped.get(key);
|
|
162
|
+
if (group === undefined)
|
|
163
|
+
grouped.set(key, [rule]);
|
|
164
|
+
else
|
|
165
|
+
group.push(rule);
|
|
166
|
+
}
|
|
167
|
+
return grouped;
|
|
168
|
+
}
|
|
169
|
+
/** Indexes an overlay's rules by the level and identifier each one matches under. */
|
|
170
|
+
function indexRules(overlay, path) {
|
|
171
|
+
const exactField = [];
|
|
172
|
+
const exactRow = [];
|
|
173
|
+
const template = [];
|
|
174
|
+
const container = new Map();
|
|
175
|
+
const section = [];
|
|
176
|
+
for (const [index, rule] of overlay.rules.entries()) {
|
|
177
|
+
const rulePath = `${path}.rules[${String(index)}].match`;
|
|
178
|
+
switch (rule.kind) {
|
|
179
|
+
case 'exact': {
|
|
180
|
+
const row = parseRowMatch(rule.match, rulePath);
|
|
181
|
+
if (row === undefined)
|
|
182
|
+
exactField.push(rule);
|
|
183
|
+
else
|
|
184
|
+
exactRow.push({ ...row, access: rule.access });
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
case 'template':
|
|
188
|
+
template.push(rule);
|
|
189
|
+
break;
|
|
190
|
+
case 'container': {
|
|
191
|
+
const fieldId = containerFieldOf(rule.match, rulePath);
|
|
192
|
+
const grouped = container.get(fieldId);
|
|
193
|
+
if (grouped === undefined)
|
|
194
|
+
container.set(fieldId, [rule]);
|
|
195
|
+
else
|
|
196
|
+
grouped.push(rule);
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case 'section':
|
|
200
|
+
section.push(rule);
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const rows = new Map();
|
|
205
|
+
for (const row of exactRow) {
|
|
206
|
+
const grouped = rows.get(row.fieldId);
|
|
207
|
+
if (grouped === undefined)
|
|
208
|
+
rows.set(row.fieldId, [row]);
|
|
209
|
+
else
|
|
210
|
+
grouped.push(row);
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
exactField: group(exactField, (rule) => rule.match),
|
|
214
|
+
exactRow: rows,
|
|
215
|
+
template: group(template, (rule) => templateFieldOf(rule.match)),
|
|
216
|
+
container,
|
|
217
|
+
section: group(section, (rule) => rule.match),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/** Whether one rule's match names a row rather than a whole field. */
|
|
221
|
+
function rowMatchFieldOf(rule) {
|
|
222
|
+
if (rule.kind === 'template')
|
|
223
|
+
return templateFieldOf(rule.match);
|
|
224
|
+
if (rule.kind !== 'exact')
|
|
225
|
+
return undefined;
|
|
226
|
+
const at = rule.match.indexOf('@');
|
|
227
|
+
return at < 0 ? undefined : rule.match.slice(0, at);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Refuses rules whose match contradicts the declared primitive of the field they name.
|
|
231
|
+
*
|
|
232
|
+
* `template` states every row of one array and an exact `fieldId@rowKey` names one item of
|
|
233
|
+
* one array, `[ACCESS-2.1.4]`. `container` names a record subtree, `[ACCESS-2.1.3]`. Naming a
|
|
234
|
+
* declaration with the wrong primitive would either silently match nothing or split a container's
|
|
235
|
+
* own answer from its descendants, so each mismatch is refused at the rule's own match path.
|
|
236
|
+
*/
|
|
237
|
+
function refuseMismatchedDeclarationMatches(rules, primitives, path) {
|
|
238
|
+
for (const [index, rule] of rules.entries()) {
|
|
239
|
+
const rulePath = `${path}.rules[${String(index)}].match`;
|
|
240
|
+
if (rule.kind === 'container') {
|
|
241
|
+
const fieldId = containerFieldOf(rule.match, rulePath);
|
|
242
|
+
const primitive = primitives.get(fieldId);
|
|
243
|
+
// A rule naming no declaration is already inert: it grants nothing, and `[ACCESS-2.1.2]`
|
|
244
|
+
// is what answers the reference. Only a declaration that exists can be contradicted.
|
|
245
|
+
if (primitive === undefined || primitive === 'record')
|
|
246
|
+
continue;
|
|
247
|
+
throw new AxiomError('ENGINE_ERROR', `a container access match names a record; ${fieldId} is ${primitive}`, rulePath);
|
|
248
|
+
}
|
|
249
|
+
const fieldId = rowMatchFieldOf(rule);
|
|
250
|
+
if (fieldId === undefined)
|
|
251
|
+
continue;
|
|
252
|
+
const primitive = primitives.get(fieldId);
|
|
253
|
+
// A rule naming no declaration is already inert: it grants nothing, and `[ACCESS-2.1.2]`
|
|
254
|
+
// is what answers the reference. Only a declaration that exists can be contradicted.
|
|
255
|
+
if (primitive === undefined || primitive === 'array')
|
|
256
|
+
continue;
|
|
257
|
+
throw new AxiomError('ENGINE_ERROR', `a ${rule.kind} access match names rows of ${fieldId}, which is not an array`, rulePath);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Resolves an overlay into the projection every read consults, `[ACCESS-2.1.3]`.
|
|
262
|
+
*
|
|
263
|
+
* Each declaration's field-level state comes from the most specific level that matches it:
|
|
264
|
+
* an exact rule on the field, then a `container` rule on one of its record ancestors, then a
|
|
265
|
+
* `section` rule on the section its annotations name, then `defaultAccess`. A `template`
|
|
266
|
+
* rule never governs a container's own structural state, and never governs a scalar field:
|
|
267
|
+
* it states the state of every row of one array, so it is resolved into the row default and
|
|
268
|
+
* is weighed whenever a container read would carry those rows.
|
|
269
|
+
*
|
|
270
|
+
* An exact `fieldId@rowKey` rule is resolved at the exact level beside an exact field-wide
|
|
271
|
+
* rule, so a row rule may narrow but never re-open the field's own answer.
|
|
272
|
+
*
|
|
273
|
+
* `path` names where the caller supplied the overlay, so a rule a JavaScript caller wrote is
|
|
274
|
+
* refused at the path the caller used — `$.overlay.rules[0].match` for a direct evaluation,
|
|
275
|
+
* `authority.overlay.rules[0].match` for a submission's host facts.
|
|
276
|
+
*/
|
|
277
|
+
export function resolveOverlay(fields, overlay, path = '$.overlay') {
|
|
278
|
+
const index = indexRules(overlay, path);
|
|
279
|
+
const declared = declarationsOf(fields);
|
|
280
|
+
refuseMismatchedDeclarationMatches(overlay.rules, new Map(declared.map(({ field }) => [field.fieldId, field.primitive])), path);
|
|
281
|
+
const entries = new Map();
|
|
282
|
+
const stated = new Set();
|
|
283
|
+
const rowEntries = new Map();
|
|
284
|
+
const rowDefaults = new Map();
|
|
285
|
+
const exactFields = new Set();
|
|
286
|
+
for (const { field, containerIds, sectionId } of declared) {
|
|
287
|
+
const exact = index.exactField.get(field.fieldId) ?? [];
|
|
288
|
+
if (exact.length > 0)
|
|
289
|
+
exactFields.add(field.fieldId);
|
|
290
|
+
// The exact level's answer is the same for every row of this field, so it is met once
|
|
291
|
+
// rather than rebuilt per row the host addressed.
|
|
292
|
+
const exactMet = meetRules(exact);
|
|
293
|
+
// A `container` rule names a record, and the subtree it governs includes the record
|
|
294
|
+
// itself: a member is never delivered around its container's own answer. The ancestry
|
|
295
|
+
// list already carries the record itself for a record declaration.
|
|
296
|
+
const containers = containerIds.flatMap((id) => index.container.get(id) ?? []);
|
|
297
|
+
const sections = sectionId === undefined ? [] : (index.section.get(sectionId) ?? []);
|
|
298
|
+
const fieldAccess = exactMet ?? meetRules(containers) ?? meetRules(sections) ?? overlay.defaultAccess;
|
|
299
|
+
entries.set(fieldKey({ fieldId: field.fieldId }), fieldAccess);
|
|
300
|
+
// A level that matched answered this declaration; `defaultAccess` is the host declining to.
|
|
301
|
+
if (exactMet !== undefined || containers.length > 0 || sections.length > 0) {
|
|
302
|
+
stated.add(field.fieldId);
|
|
303
|
+
}
|
|
304
|
+
if (field.primitive !== 'array')
|
|
305
|
+
continue;
|
|
306
|
+
// A row is a member of the array's declaration subtree, so it inherits the container and
|
|
307
|
+
// section rules that reach the array, but it is addressed by the template level rather
|
|
308
|
+
// than by the array's own structural rule.
|
|
309
|
+
const templates = index.template.get(field.fieldId) ?? [];
|
|
310
|
+
// A template states every row of the array, which is the level a row's own answer comes
|
|
311
|
+
// from; the row reference below reads it as `fieldId@*`.
|
|
312
|
+
if (templates.length > 0)
|
|
313
|
+
stated.add(`${field.fieldId}@*`);
|
|
314
|
+
rowDefaults.set(field.fieldId, exactMet ??
|
|
315
|
+
meetRules(templates) ??
|
|
316
|
+
meetRules(containers) ??
|
|
317
|
+
meetRules(sections) ??
|
|
318
|
+
overlay.defaultAccess);
|
|
319
|
+
const rowsAtField = index.exactRow.get(field.fieldId) ?? [];
|
|
320
|
+
if (rowsAtField.length === 0)
|
|
321
|
+
continue;
|
|
322
|
+
// The exact level holds the field-wide rules beside the rules for one row, so a row rule
|
|
323
|
+
// can narrow the field's own answer but never widen it. Folding each rule into its own
|
|
324
|
+
// row as it is read makes that one intersect per row: intersecting the field's rules with
|
|
325
|
+
// every rule for the same row, once per rule, was the rows times the rows.
|
|
326
|
+
const byRow = new Map();
|
|
327
|
+
for (const rule of rowsAtField) {
|
|
328
|
+
noteRowRuleComparison();
|
|
329
|
+
const token = rowKeyToken(rule.rowKey);
|
|
330
|
+
const known = byRow.get(token);
|
|
331
|
+
if (known === undefined) {
|
|
332
|
+
byRow.set(token, {
|
|
333
|
+
rowKey: rule.rowKey,
|
|
334
|
+
access: exactMet === undefined ? rule.access : meetAccess(exactMet, rule.access),
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
known.access = meetAccess(known.access, rule.access);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
for (const { rowKey, access } of byRow.values()) {
|
|
342
|
+
const key = fieldKey({ fieldId: field.fieldId, rowKey });
|
|
343
|
+
// The flat map holds the row entry beside the field-wide one, so a row read is one
|
|
344
|
+
// lookup rather than a second walk over the rules.
|
|
345
|
+
entries.set(key, access);
|
|
346
|
+
stated.add(key);
|
|
347
|
+
const existing = rowEntries.get(field.fieldId);
|
|
348
|
+
const entry = { key, access };
|
|
349
|
+
if (existing === undefined)
|
|
350
|
+
rowEntries.set(field.fieldId, [entry]);
|
|
351
|
+
else
|
|
352
|
+
existing.push(entry);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
version: overlay.accessVersion,
|
|
357
|
+
allowMaskedRead: new Set(overlay.allowMaskedRead ?? []),
|
|
358
|
+
entries: { entries, rowEntries, rowDefaults, exactFields, stated },
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* The effective access of one reference, `[ACCESS-2.1.4]`.
|
|
363
|
+
*
|
|
364
|
+
* The session writes are part of the question: a stored `write_only` value is readable only
|
|
365
|
+
* once this session wrote it, and a container that carries such a row is withdrawn as a
|
|
366
|
+
* whole rather than delivered around its own entry.
|
|
367
|
+
*/
|
|
368
|
+
export function accessFor(resolved, ref, sessionWrites) {
|
|
369
|
+
return resolveProjectedAccess(resolved.entries, ref, sessionWrites);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Whether a rule may read one reference, `[ACCESS-1.3.2]`, `[ACCESS-1.3.3]`.
|
|
373
|
+
*
|
|
374
|
+
* `allowMaskedRead` lifts a `masked` or `hidden` answer for expression reads only. It never
|
|
375
|
+
* lifts `write_only`: a stored write-only value stays unreadable until this session writes
|
|
376
|
+
* it, because the host's list is about masks and not about secrets.
|
|
377
|
+
*/
|
|
378
|
+
export function ruleReadFor(resolved, ref, sessionWrites) {
|
|
379
|
+
const access = accessFor(resolved, ref, sessionWrites);
|
|
380
|
+
if (access === 'masked' || access === 'hidden') {
|
|
381
|
+
return resolved.allowMaskedRead.has(ref.fieldId);
|
|
382
|
+
}
|
|
383
|
+
return permitsReadOf(access, fieldKey(ref), sessionWrites);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* The report's access projection for the references an evaluation considered.
|
|
387
|
+
*
|
|
388
|
+
* The answer is per declaration, never per row (`[ACCESS-5.1.1]`): a container read carries
|
|
389
|
+
* every row it holds, so the container's own answer already states what a row key would
|
|
390
|
+
* restate. Entries are deduplicated by `fieldId` and sorted in code-point order
|
|
391
|
+
* (`[ACCESS-5.1.4]`).
|
|
392
|
+
*/
|
|
393
|
+
export function projectAccessEntries(resolved, refs, sessionWrites) {
|
|
394
|
+
const byField = new Map();
|
|
395
|
+
for (const ref of refs) {
|
|
396
|
+
byField.set(ref.fieldId, accessFor(resolved, { fieldId: ref.fieldId }, sessionWrites));
|
|
397
|
+
}
|
|
398
|
+
return [...byField.entries()]
|
|
399
|
+
.sort((left, right) => compareCodePoints(left[0], right[0]))
|
|
400
|
+
.map(([fieldId, access]) => ({ fieldId, access }));
|
|
401
|
+
}
|
|
402
|
+
//# sourceMappingURL=overlay.js.map
|