@azx-pbc/axiom-runtime 0.0.0-stage → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1210 -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,446 @@
|
|
|
1
|
+
import { NodeLedger, STANDALONE_BUDGET } from './budget.js';
|
|
2
|
+
import { and4, liftOutcome, not4, or4 } from '../expr/logic.js';
|
|
3
|
+
import { toProvenance } from '../lookup/index.js';
|
|
4
|
+
import { memoizeLookup } from '../lookup/pass.js';
|
|
5
|
+
import { AxiomError } from '../model/errors.js';
|
|
6
|
+
import { DEFERRED, isUndetermined, UNKNOWN } from '../model/types.js';
|
|
7
|
+
import { isWireArray } from '../model/values.js';
|
|
8
|
+
import { BinderPaths } from './paths.js';
|
|
9
|
+
import { declarationPathOf as binderDeclarationPath, domainOfPath as binderDomainOfPath, readScoped as binderReadScoped, scopeFor, scopedRefusedFieldId, scopedUndecided, } from './expr/binder.js';
|
|
10
|
+
import { callNode } from './expr/call-dispatch.js';
|
|
11
|
+
import { evalMembership as membershipEval } from './expr/collections.js';
|
|
12
|
+
import { elementDomainsFor } from './expr/domains.js';
|
|
13
|
+
import { compareValues, isDecidedValue, isOrderingOperator, outcomeToValue, resultDomain, undeterminedOperand, } from './expr/operands.js';
|
|
14
|
+
import { ABSENT, valueOf, withheldRowsOf } from './expr/value.js';
|
|
15
|
+
/**
|
|
16
|
+
* Evaluates the closed expression AST against a host reader.
|
|
17
|
+
*
|
|
18
|
+
* The evaluator is the language: node dispatch, the 4×4 lattice, lazy `if` and `??`,
|
|
19
|
+
* comparison and equality, the arithmetic operators and the built-in dispatch all live
|
|
20
|
+
* here. The rule engine and standalone guard evaluation differ only in the host they
|
|
21
|
+
* supply, so no rule-specific concern can change an expression's meaning.
|
|
22
|
+
*/
|
|
23
|
+
export class ExpressionEvaluator {
|
|
24
|
+
host;
|
|
25
|
+
lookups;
|
|
26
|
+
rules;
|
|
27
|
+
ledger;
|
|
28
|
+
/** The comprehension scopes currently in force, innermost last. */
|
|
29
|
+
scopes = [];
|
|
30
|
+
/** Binder reads that returned a value carrying withheld members. */
|
|
31
|
+
binderWithheld = 0;
|
|
32
|
+
/** The path answers a binder scope gives, memoised for this evaluation. */
|
|
33
|
+
paths = new BinderPaths();
|
|
34
|
+
/** The provenance each distinct resolution in this pass stands for. */
|
|
35
|
+
provenanceByResolution = new WeakMap();
|
|
36
|
+
/** The host's declared-domain question, captured once so a per-element call allocates none. */
|
|
37
|
+
declaredDomain;
|
|
38
|
+
constructor(host, lookups, rules, budget = STANDALONE_BUDGET) {
|
|
39
|
+
this.host = host;
|
|
40
|
+
// The memo is the pass's own: one evaluator is one evaluation, so a table read twice
|
|
41
|
+
// resolves once and nothing outlives the input it was resolved from.
|
|
42
|
+
this.lookups =
|
|
43
|
+
lookups.port === undefined ? lookups : { ...lookups, port: memoizeLookup(lookups.port) };
|
|
44
|
+
this.rules = rules;
|
|
45
|
+
this.ledger = new NodeLedger(budget);
|
|
46
|
+
this.declaredDomain = (path) => this.host.domainOf(path);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Starts one rule's allowances, so the rows a later rule addresses are not charged to an
|
|
50
|
+
* earlier rule's spend. Returns the interrupted counters a nested rule must restore.
|
|
51
|
+
*/
|
|
52
|
+
beginRule() {
|
|
53
|
+
return this.ledger.beginRule();
|
|
54
|
+
}
|
|
55
|
+
/** Restores the allowances of the rule that asked about a rule it evaluated. */
|
|
56
|
+
endRule(previous) {
|
|
57
|
+
this.ledger.endRule(previous);
|
|
58
|
+
}
|
|
59
|
+
/** Refuses an item scope over more elements than this evaluation allows. */
|
|
60
|
+
refuseElements(count) {
|
|
61
|
+
this.ledger.refuseElements(count);
|
|
62
|
+
}
|
|
63
|
+
/** Enters one comprehension, returning the nesting depth it interrupted. */
|
|
64
|
+
beginComprehension() {
|
|
65
|
+
return this.ledger.beginComprehension();
|
|
66
|
+
}
|
|
67
|
+
/** Leaves one comprehension, restoring the nesting depth it interrupted. */
|
|
68
|
+
endComprehension(previous) {
|
|
69
|
+
this.ledger.endComprehension(previous);
|
|
70
|
+
}
|
|
71
|
+
/** Counts the elements a nested comprehension materialised against this rule's allowance. */
|
|
72
|
+
chargeElements(count) {
|
|
73
|
+
this.ledger.chargeElements(count);
|
|
74
|
+
}
|
|
75
|
+
/** Refuses a block of report entries before an item rule allocates one per row. */
|
|
76
|
+
ensureDecisionRoom(count, operation) {
|
|
77
|
+
this.ledger.ensureDecisionRoom(count, operation);
|
|
78
|
+
}
|
|
79
|
+
/** Counts the report entries a rule produced against the pass-wide decision ceiling. */
|
|
80
|
+
spendDecisions(count, operation) {
|
|
81
|
+
this.ledger.spendDecisions(count, operation);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Whether a read since `mark` touched a hidden, excluded field. A host that tracks no
|
|
85
|
+
* disclosure answers no, which is the guard-evaluation case where no schema holds a policy.
|
|
86
|
+
*/
|
|
87
|
+
touchedWithheld(mark) {
|
|
88
|
+
return (this.host.taintedSince?.(mark) ?? []).length > 0;
|
|
89
|
+
}
|
|
90
|
+
/** The current disclosure-taint position, or a constant when the host tracks none. */
|
|
91
|
+
taintMark() {
|
|
92
|
+
return this.host.taintMark?.() ?? 0;
|
|
93
|
+
}
|
|
94
|
+
/** The current position in binder reads that carried withheld members. */
|
|
95
|
+
binderTaintMark() {
|
|
96
|
+
return this.binderWithheld;
|
|
97
|
+
}
|
|
98
|
+
/** Whether a binder read since `mark` carried withheld members into this expression. */
|
|
99
|
+
touchedBinderWithheld(mark) {
|
|
100
|
+
return this.binderWithheld !== mark;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Runs `visit` once per item of a declared array with the implicit item scope in force, so
|
|
104
|
+
* an item-scoped rule reads `$it`, `$i`, `$prev` and `$next` exactly as a comprehension
|
|
105
|
+
* does.
|
|
106
|
+
*
|
|
107
|
+
* `withheld` is the read's own statement of which members each row withheld from this device,
|
|
108
|
+
* in array order: the row no longer carries them, and without it `empty`, `present`, `absent`
|
|
109
|
+
* and `??` would read that removal as a genuine absence (`ACCESS-1.3.3`, `EXPR-9.1.5`).
|
|
110
|
+
*
|
|
111
|
+
* `undetermined` is the same statement for a member a writer could not produce, with the
|
|
112
|
+
* sentinel each read states (`RULES-2.1.7`). It stays per row: one row's unproduced member is
|
|
113
|
+
* that row's answer and never widens to the array or its siblings.
|
|
114
|
+
*/
|
|
115
|
+
withItemScope(arrayPath, elements, index, visit, withheld, undetermined) {
|
|
116
|
+
const scope = {
|
|
117
|
+
name: '$it',
|
|
118
|
+
elements,
|
|
119
|
+
origin: arrayPath,
|
|
120
|
+
index,
|
|
121
|
+
...(withheld === undefined ? {} : { withheld }),
|
|
122
|
+
...(undetermined === undefined ? {} : { undetermined }),
|
|
123
|
+
};
|
|
124
|
+
this.scopes.push(scope);
|
|
125
|
+
try {
|
|
126
|
+
return visit();
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
this.scopes.pop();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Runs `visit` under binder scopes that are already in force on another evaluator.
|
|
134
|
+
*
|
|
135
|
+
* A pass that reads an expression on a second host — an alternative or an availability
|
|
136
|
+
* condition evaluated where its reads stay out of the report — is still inside the scope its
|
|
137
|
+
* owner judged: an `item`-scoped rule's `$it` names that rule's row, and the row was bound
|
|
138
|
+
* before the second host existed. The scopes are plain data, so they are shared rather than
|
|
139
|
+
* rebuilt from the rows they were bound to.
|
|
140
|
+
*/
|
|
141
|
+
withBinderScopes(scopes, visit) {
|
|
142
|
+
this.scopes.push(...scopes);
|
|
143
|
+
try {
|
|
144
|
+
return visit();
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
this.scopes.length -= scopes.length;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/** Visits `node` and everything below it, refusing an evaluation over the node budget. */
|
|
151
|
+
evaluate(node) {
|
|
152
|
+
if (typeof node !== 'object' || node === null) {
|
|
153
|
+
throw new AxiomError('ENGINE_ERROR', 'expression node is not an object');
|
|
154
|
+
}
|
|
155
|
+
this.ledger.spend();
|
|
156
|
+
switch (node.kind) {
|
|
157
|
+
case 'literal':
|
|
158
|
+
return valueOf(node.value, node.domain);
|
|
159
|
+
case 'path':
|
|
160
|
+
// A binder is only in scope inside a comprehension or an item scope; with no scope
|
|
161
|
+
// in force the read is the host's, exactly as before, with no path parsing.
|
|
162
|
+
return this.scopes.length === 0 ? this.host.read(node.path) : this.readPath(node.path);
|
|
163
|
+
case 'list': {
|
|
164
|
+
const items = node.items.map((item) => this.evaluate(item));
|
|
165
|
+
// One pass fills both the values and their domains; the withheld sideband is built only
|
|
166
|
+
// when an element actually withholds a member, which is the rare case.
|
|
167
|
+
const values = [];
|
|
168
|
+
const domains = [];
|
|
169
|
+
let withholding = false;
|
|
170
|
+
for (const item of items) {
|
|
171
|
+
values.push(item.kind === 'absent' ? UNKNOWN : item.value);
|
|
172
|
+
// A list value loses its members' domains when it becomes a wire array. Carrying them
|
|
173
|
+
// lets a computed list answer a per-element question as the written list does.
|
|
174
|
+
domains.push(item.kind === 'absent' ? undefined : item.domain);
|
|
175
|
+
if (item.kind === 'value' && item.withheldMembers !== undefined)
|
|
176
|
+
withholding = true;
|
|
177
|
+
}
|
|
178
|
+
const withheldRows = withholding ? withheldRowsOf(items) : undefined;
|
|
179
|
+
return {
|
|
180
|
+
kind: 'value',
|
|
181
|
+
value: values,
|
|
182
|
+
domain: undefined,
|
|
183
|
+
elementDomains: domains,
|
|
184
|
+
// Rebinding a delivered record must not turn its withheld members into absence.
|
|
185
|
+
...(withheldRows === undefined ? {} : { withheldRows }),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
case 'and': {
|
|
189
|
+
let outcome = 'PASS';
|
|
190
|
+
for (const arg of node.args) {
|
|
191
|
+
outcome = and4(outcome, this.statusOf(this.evaluate(arg)));
|
|
192
|
+
// `and` may stop only on a decided FAIL: a later operand may still produce the
|
|
193
|
+
// FAIL an earlier UNKNOWN has not decided yet.
|
|
194
|
+
if (outcome === 'FAIL')
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
return valueOf(outcomeToValue(outcome), 'boolean');
|
|
198
|
+
}
|
|
199
|
+
case 'or': {
|
|
200
|
+
let outcome = 'FAIL';
|
|
201
|
+
for (const arg of node.args) {
|
|
202
|
+
outcome = or4(outcome, this.statusOf(this.evaluate(arg)));
|
|
203
|
+
if (outcome === 'PASS')
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
return valueOf(outcomeToValue(outcome), 'boolean');
|
|
207
|
+
}
|
|
208
|
+
case 'not': {
|
|
209
|
+
const [arg] = node.args;
|
|
210
|
+
if (arg === undefined)
|
|
211
|
+
throw new AxiomError('ENGINE_ERROR', 'not requires one operand');
|
|
212
|
+
return valueOf(outcomeToValue(not4(this.statusOf(this.evaluate(arg)))), 'boolean');
|
|
213
|
+
}
|
|
214
|
+
case 'compare': {
|
|
215
|
+
const [leftNode, rightNode] = node.args;
|
|
216
|
+
if (leftNode === undefined || rightNode === undefined) {
|
|
217
|
+
throw new AxiomError('ENGINE_ERROR', 'comparison requires two operands');
|
|
218
|
+
}
|
|
219
|
+
if (node.op === 'in')
|
|
220
|
+
return this.evalMembership(leftNode, rightNode);
|
|
221
|
+
const left = this.evaluate(leftNode);
|
|
222
|
+
const right = this.evaluate(rightNode);
|
|
223
|
+
const undetermined = undeterminedOperand([left, right]);
|
|
224
|
+
if (undetermined !== undefined)
|
|
225
|
+
return undetermined;
|
|
226
|
+
if (!isDecidedValue(left) || !isDecidedValue(right)) {
|
|
227
|
+
throw new AxiomError('ENGINE_ERROR', 'an undetermined operand escaped the fold');
|
|
228
|
+
}
|
|
229
|
+
// An order between a value and the empty value does not exist, so it is undecided
|
|
230
|
+
// rather than false. Equality is the exception: `null` compares
|
|
231
|
+
// equal only to `null`.
|
|
232
|
+
if (isOrderingOperator(node.op) && (left.value === null || right.value === null)) {
|
|
233
|
+
return valueOf(UNKNOWN);
|
|
234
|
+
}
|
|
235
|
+
return valueOf(compareValues(node.op, this.typed(leftNode, left), this.typed(rightNode, right), operandPath(leftNode, rightNode)), 'boolean');
|
|
236
|
+
}
|
|
237
|
+
case 'if': {
|
|
238
|
+
const [conditionNode, thenNode, elseNode] = node.args;
|
|
239
|
+
if (conditionNode === undefined || thenNode === undefined || elseNode === undefined) {
|
|
240
|
+
throw new AxiomError('ENGINE_ERROR', 'if requires three operands');
|
|
241
|
+
}
|
|
242
|
+
const condition = this.statusOf(this.evaluate(conditionNode));
|
|
243
|
+
if (condition === 'UNKNOWN')
|
|
244
|
+
return valueOf(UNKNOWN);
|
|
245
|
+
if (condition === 'DEFERRED')
|
|
246
|
+
return valueOf(DEFERRED);
|
|
247
|
+
return this.evaluate(condition === 'PASS' ? thenNode : elseNode);
|
|
248
|
+
}
|
|
249
|
+
case 'coalesce': {
|
|
250
|
+
let last = ABSENT;
|
|
251
|
+
for (const arg of node.args) {
|
|
252
|
+
last = this.evaluate(arg);
|
|
253
|
+
// `??` replaces explicit null and absence only: a sentinel, a
|
|
254
|
+
// redacted value, `false`, `0` and `""` all stand.
|
|
255
|
+
if (last.kind === 'value' && (isUndetermined(last.value) || last.value !== null)) {
|
|
256
|
+
return last;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return last;
|
|
260
|
+
}
|
|
261
|
+
case 'call':
|
|
262
|
+
return callNode(this, node);
|
|
263
|
+
case 'comprehension':
|
|
264
|
+
// a comprehension is only an aggregate's operand, and every
|
|
265
|
+
// aggregate reaches one through `aggregateCall`. Reaching this arm means a
|
|
266
|
+
// hand-built artifact placed one elsewhere, so it is refused rather than answered.
|
|
267
|
+
throw new AxiomError('ENGINE_ERROR', 'a comprehension is only an argument of an aggregate built-in');
|
|
268
|
+
default: {
|
|
269
|
+
const malformed = node;
|
|
270
|
+
throw new AxiomError('ENGINE_ERROR', `expression node kind ${JSON.stringify(malformed.kind)} is not part of Expr v1`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/** The outcome a value stands for; a non-boolean has none. */
|
|
275
|
+
statusOf(evaluated) {
|
|
276
|
+
if (evaluated.kind === 'absent')
|
|
277
|
+
return 'UNKNOWN';
|
|
278
|
+
if (isUndetermined(evaluated.value))
|
|
279
|
+
return evaluated.value.undetermined;
|
|
280
|
+
// `null` is the empty value of every domain, so a construct that needs an outcome from
|
|
281
|
+
// it has not been decided rather than refuted.
|
|
282
|
+
if (evaluated.value === null)
|
|
283
|
+
return 'UNKNOWN';
|
|
284
|
+
if (typeof evaluated.value === 'boolean')
|
|
285
|
+
return liftOutcome(evaluated.value);
|
|
286
|
+
throw new AxiomError('ENGINE_ERROR', 'a rule expression must produce a boolean outcome');
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* A path the current binder scope names is resolved here; every other path is a declared
|
|
290
|
+
* field or context root the host resolves. A binder is a lexical binding, so it wins over
|
|
291
|
+
* a declared field of the same name.
|
|
292
|
+
*/
|
|
293
|
+
readPath(path) {
|
|
294
|
+
return this.readScoped(path) ?? this.host.read(path);
|
|
295
|
+
}
|
|
296
|
+
readScoped(path) {
|
|
297
|
+
const evaluated = binderReadScoped(this.scopes, this.paths, path);
|
|
298
|
+
if (evaluated === undefined)
|
|
299
|
+
return undefined;
|
|
300
|
+
if (evaluated.kind === 'absent' || evaluated.value === null) {
|
|
301
|
+
this.host.noteMissingInput?.();
|
|
302
|
+
}
|
|
303
|
+
else if (isUndetermined(evaluated.value)) {
|
|
304
|
+
// A member the container read withheld is a refusal; a row member the server holds is a
|
|
305
|
+
// handoff, and every other undecided answer is an input the row does not carry.
|
|
306
|
+
const cause = scopedUndecided(this.scopes, this.paths, path);
|
|
307
|
+
if (cause === 'withheld') {
|
|
308
|
+
// The container read attributes the member to its source row. Attribute its consumption
|
|
309
|
+
// too: `$prev` and `$next` let a different row's rule instance read the same refusal.
|
|
310
|
+
const fieldId = scopedRefusedFieldId(this.scopes, this.paths, path);
|
|
311
|
+
if (fieldId !== undefined)
|
|
312
|
+
this.host.noteRefusedInput?.(fieldId);
|
|
313
|
+
}
|
|
314
|
+
else if (cause === 'deferred') {
|
|
315
|
+
this.host.noteDeferredInput?.();
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
this.host.noteMissingInput?.();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (evaluated.kind === 'value' &&
|
|
322
|
+
(evaluated.withheldMembers !== undefined || evaluated.withheldRows !== undefined)) {
|
|
323
|
+
// The host's taint stream cannot see a binder read: the row was read before this evaluator
|
|
324
|
+
// received its scope. Remember it here so an output filter can refuse even a scalar or an
|
|
325
|
+
// aggregate that no longer carries the source value's metadata.
|
|
326
|
+
this.binderWithheld += 1;
|
|
327
|
+
}
|
|
328
|
+
return evaluated;
|
|
329
|
+
}
|
|
330
|
+
/** The declared path a binder path names, so a member read through the binder keeps the
|
|
331
|
+
* domain its declaration pins. `undefined` where no declaration backs it:
|
|
332
|
+
* the index, or an element of a list the artifact did not declare.
|
|
333
|
+
*/
|
|
334
|
+
declarationPathOf(path) {
|
|
335
|
+
return binderDeclarationPath(this.scopes, this.paths, path);
|
|
336
|
+
}
|
|
337
|
+
domainOfPath(path) {
|
|
338
|
+
return binderDomainOfPath(this.scopes, this.paths, this.declaredDomain, path);
|
|
339
|
+
}
|
|
340
|
+
/** The declared element domain of a declared array, for the elements an aggregate reads. */
|
|
341
|
+
declaredElementDomainOf(path) {
|
|
342
|
+
return this.host.elementDomainOf(path);
|
|
343
|
+
}
|
|
344
|
+
/** The declared primitive of a declared path, captured for the binder walk. */
|
|
345
|
+
declaredDomainOf(path) {
|
|
346
|
+
return this.declaredDomain(path);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* The declared members of a record path, resolved through the binder scope in force.
|
|
350
|
+
*
|
|
351
|
+
* A member path (`$it.f_rows`) maps to the declaration the row's array states; the binder
|
|
352
|
+
* itself (`$it`, `r`) has no declaration path and is answered from the value's own
|
|
353
|
+
* `closedMembers` sideband instead.
|
|
354
|
+
*/
|
|
355
|
+
recordMembersOf(path) {
|
|
356
|
+
// A binder names an element, not a member path: `$it` in an item rule and `r` over a
|
|
357
|
+
// declared array both bind a closed row, whose members the array's declaration states.
|
|
358
|
+
const segments = this.paths.segmentsOf(path);
|
|
359
|
+
const head = segments[0] ?? '';
|
|
360
|
+
if (segments.length === 1) {
|
|
361
|
+
const scope = scopeFor(this.scopes, head);
|
|
362
|
+
if (scope !== undefined) {
|
|
363
|
+
return scope.origin === undefined ? undefined : this.host.recordItemMembersOf(scope.origin);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
const declaration = this.declarationPathOf(path);
|
|
367
|
+
return declaration === undefined ? undefined : this.host.recordMembersOf(declaration);
|
|
368
|
+
}
|
|
369
|
+
/** The declared members of a record array's rows, through the binder scope in force. */
|
|
370
|
+
recordItemMembersOf(path) {
|
|
371
|
+
const declaration = this.declarationPathOf(path);
|
|
372
|
+
return declaration === undefined ? undefined : this.host.recordItemMembersOf(declaration);
|
|
373
|
+
}
|
|
374
|
+
evalArgs(args) {
|
|
375
|
+
return args.map((arg) => this.evalArgument(arg));
|
|
376
|
+
}
|
|
377
|
+
evalArgument(arg) {
|
|
378
|
+
const evaluated = this.evaluate(arg);
|
|
379
|
+
return evaluated.kind === 'absent' ? UNKNOWN : evaluated.value;
|
|
380
|
+
}
|
|
381
|
+
/** `x in xs` under the equality rule, answered by the membership family. */
|
|
382
|
+
evalMembership(leftNode, rightNode) {
|
|
383
|
+
return membershipEval(this, leftNode, rightNode);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Records the report entry one resolution produces. A resolution that
|
|
387
|
+
* formed no query — `decide` with an input the record does not carry — has no entry to
|
|
388
|
+
* record, because there is no table identity and no key to reproduce.
|
|
389
|
+
*
|
|
390
|
+
* The port memo hands back the same resolution object for a repeated call, so the
|
|
391
|
+
* provenance object is built once per distinct resolution and the report's canonical
|
|
392
|
+
* token is derived once per provenance rather than once per call.
|
|
393
|
+
*/
|
|
394
|
+
recordResolution(resolution) {
|
|
395
|
+
let provenance = this.provenanceByResolution.get(resolution);
|
|
396
|
+
if (provenance === undefined) {
|
|
397
|
+
provenance = toProvenance(resolution) ?? null;
|
|
398
|
+
this.provenanceByResolution.set(resolution, provenance);
|
|
399
|
+
}
|
|
400
|
+
if (provenance !== null)
|
|
401
|
+
this.lookups.recordProvenance(provenance);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Attaches the operand's static domain, so `"1.5"` and the decimal `1.5` are two
|
|
405
|
+
* values of different domains. A literal states its
|
|
406
|
+
* own domain, a path takes the declared primitive, and a built-in with a fixed result
|
|
407
|
+
* type contributes that type; a type-parameterised built-in contributes nothing.
|
|
408
|
+
*/
|
|
409
|
+
typed(node, evaluated) {
|
|
410
|
+
// `null` is the explicitly authored empty value and a domain of its own
|
|
411
|
+
// whichever primitive the field declares.
|
|
412
|
+
if (evaluated.value === null)
|
|
413
|
+
return { ...evaluated, domain: 'null' };
|
|
414
|
+
if (node.kind === 'literal')
|
|
415
|
+
return { ...evaluated, domain: node.domain };
|
|
416
|
+
if (node.kind === 'path') {
|
|
417
|
+
const domain = this.domainOfPath(node.path);
|
|
418
|
+
const withDomain = domain === undefined ? evaluated : { ...evaluated, domain };
|
|
419
|
+
// A declared array states the domain of its elements, not of the list. Attaching it
|
|
420
|
+
// here is what lets `x in f_amounts` and `f_amounts == [1, 2]` compare each member
|
|
421
|
+
// under the declaration the compiler proved (`EXPR-5.1.10`, `EXPR-10.1.1`); a list
|
|
422
|
+
// value that already carries its producer's domains keeps them.
|
|
423
|
+
if (!isWireArray(evaluated.value))
|
|
424
|
+
return withDomain;
|
|
425
|
+
const elementDomains = elementDomainsFor(evaluated.value, evaluated.elementDomains, this.host.elementDomainOf(node.path));
|
|
426
|
+
return elementDomains === undefined ? withDomain : { ...withDomain, elementDomains };
|
|
427
|
+
}
|
|
428
|
+
if (node.kind === 'call') {
|
|
429
|
+
const domain = resultDomain(node.op);
|
|
430
|
+
return domain === undefined ? evaluated : { ...evaluated, domain };
|
|
431
|
+
}
|
|
432
|
+
return evaluated;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* The path a comparison names when it refuses its operands: the first operand that is a path,
|
|
437
|
+
* so an engine error points an author at the read rather than at the whole rule.
|
|
438
|
+
*/
|
|
439
|
+
function operandPath(left, right) {
|
|
440
|
+
if (left.kind === 'path')
|
|
441
|
+
return left.path;
|
|
442
|
+
if (right.kind === 'path')
|
|
443
|
+
return right.path;
|
|
444
|
+
return '';
|
|
445
|
+
}
|
|
446
|
+
//# sourceMappingURL=expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../src/eval/expression.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUhD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;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YACrD,MAAM,cAAc,GAAG,iBAAiB,CACtC,SAAS,CAAC,KAAK,EACf,SAAS,CAAC,cAAc,EACxB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CACrC,CAAC;YACF,OAAO,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,CAAC;QACvF,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACrC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,CAAC;QACrE,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,IAAc,EAAE,KAAe;IAClD,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAC7C,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type { EvaluationBudget, RuleAllowance } from './budget.js';\nimport { NodeLedger, STANDALONE_BUDGET } from './budget.js';\nimport type { RuntimeValue } from '../expr/builtins.js';\nimport { and4, liftOutcome, not4, or4 } from '../expr/logic.js';\nimport { toProvenance } from '../lookup/index.js';\nimport { memoizeLookup } from '../lookup/pass.js';\nimport { AxiomError } from '../model/errors.js';\nimport type {\n ExprNode,\n LiteralDomain,\n LookupProvenance,\n LookupResolution,\n Outcome,\n SetResolution,\n UndeterminedRows,\n} from '../model/types.js';\nimport { DEFERRED, isUndetermined, UNKNOWN } from '../model/types.js';\nimport { isWireArray } from '../model/values.js';\nimport { BinderPaths } from './paths.js';\nimport {\n declarationPathOf as binderDeclarationPath,\n domainOfPath as binderDomainOfPath,\n readScoped as binderReadScoped,\n scopeFor,\n scopedRefusedFieldId,\n scopedUndecided,\n} from './expr/binder.js';\nimport type { BinderScope } from './expr/binder.js';\nimport { callNode } from './expr/call-dispatch.js';\nimport type { CallContext } from './expr/call-dispatch.js';\nimport { evalMembership as membershipEval } from './expr/collections.js';\nimport { elementDomainsFor } from './expr/domains.js';\nimport type { ExpressionHost, LookupHost, RuleHost } from './expr/host.js';\nimport {\n compareValues,\n isDecidedValue,\n isOrderingOperator,\n outcomeToValue,\n resultDomain,\n undeterminedOperand,\n} from './expr/operands.js';\nimport { ABSENT, valueOf, withheldRowsOf } from './expr/value.js';\nimport type { Evaluated, EvaluatedValue } from './expr/value.js';\n\nexport type { Evaluated, EvaluatedValue } from './expr/value.js';\nexport type { ExpressionHost, LookupHost, RuleHost } from './expr/host.js';\n\n/**\n * Evaluates the closed expression AST against a host reader.\n *\n * The evaluator is the language: node dispatch, the 4×4 lattice, lazy `if` and `??`,\n * comparison and equality, the arithmetic operators and the built-in dispatch all live\n * here. The rule engine and standalone guard evaluation differ only in the host they\n * supply, so no rule-specific concern can change an expression's meaning.\n */\nexport class ExpressionEvaluator implements CallContext {\n readonly host: ExpressionHost;\n readonly lookups: LookupHost;\n readonly rules: RuleHost | undefined;\n private readonly ledger: NodeLedger;\n /** The comprehension scopes currently in force, innermost last. */\n readonly scopes: BinderScope[] = [];\n /** Binder reads that returned a value carrying withheld members. */\n private binderWithheld = 0;\n /** The path answers a binder scope gives, memoised for this evaluation. */\n readonly paths: BinderPaths = new BinderPaths();\n /** The provenance each distinct resolution in this pass stands for. */\n private readonly provenanceByResolution = new WeakMap<object, LookupProvenance | null>();\n /** The host's declared-domain question, captured once so a per-element call allocates none. */\n private readonly declaredDomain: (path: string) => LiteralDomain | undefined;\n\n constructor(\n host: ExpressionHost,\n lookups: LookupHost,\n rules?: RuleHost,\n budget: EvaluationBudget = STANDALONE_BUDGET,\n ) {\n this.host = host;\n // The memo is the pass's own: one evaluator is one evaluation, so a table read twice\n // resolves once and nothing outlives the input it was resolved from.\n this.lookups =\n lookups.port === undefined ? lookups : { ...lookups, port: memoizeLookup(lookups.port) };\n this.rules = rules;\n this.ledger = new NodeLedger(budget);\n this.declaredDomain = (path) => this.host.domainOf(path);\n }\n\n /**\n * Starts one rule's allowances, so the rows a later rule addresses are not charged to an\n * earlier rule's spend. Returns the interrupted counters a nested rule must restore.\n */\n beginRule(): RuleAllowance {\n return this.ledger.beginRule();\n }\n\n /** Restores the allowances of the rule that asked about a rule it evaluated. */\n endRule(previous: RuleAllowance): void {\n this.ledger.endRule(previous);\n }\n\n /** Refuses an item scope over more elements than this evaluation allows. */\n refuseElements(count: number): void {\n this.ledger.refuseElements(count);\n }\n\n /** Enters one comprehension, returning the nesting depth it interrupted. */\n beginComprehension(): number {\n return this.ledger.beginComprehension();\n }\n\n /** Leaves one comprehension, restoring the nesting depth it interrupted. */\n endComprehension(previous: number): void {\n this.ledger.endComprehension(previous);\n }\n\n /** Counts the elements a nested comprehension materialised against this rule's allowance. */\n chargeElements(count: number): void {\n this.ledger.chargeElements(count);\n }\n\n /** Refuses a block of report entries before an item rule allocates one per row. */\n ensureDecisionRoom(count: number, operation: string): void {\n this.ledger.ensureDecisionRoom(count, operation);\n }\n\n /** Counts the report entries a rule produced against the pass-wide decision ceiling. */\n spendDecisions(count: number, operation: string): void {\n this.ledger.spendDecisions(count, operation);\n }\n\n /**\n * Whether a read since `mark` touched a hidden, excluded field. A host that tracks no\n * disclosure answers no, which is the guard-evaluation case where no schema holds a policy.\n */\n touchedWithheld(mark: number): boolean {\n return (this.host.taintedSince?.(mark) ?? []).length > 0;\n }\n\n /** The current disclosure-taint position, or a constant when the host tracks none. */\n taintMark(): number {\n return this.host.taintMark?.() ?? 0;\n }\n\n /** The current position in binder reads that carried withheld members. */\n binderTaintMark(): number {\n return this.binderWithheld;\n }\n\n /** Whether a binder read since `mark` carried withheld members into this expression. */\n touchedBinderWithheld(mark: number): boolean {\n return this.binderWithheld !== mark;\n }\n\n /**\n * Runs `visit` once per item of a declared array with the implicit item scope in force, so\n * an item-scoped rule reads `$it`, `$i`, `$prev` and `$next` exactly as a comprehension\n * does.\n *\n * `withheld` is the read's own statement of which members each row withheld from this device,\n * in array order: the row no longer carries them, and without it `empty`, `present`, `absent`\n * and `??` would read that removal as a genuine absence (`ACCESS-1.3.3`, `EXPR-9.1.5`).\n *\n * `undetermined` is the same statement for a member a writer could not produce, with the\n * sentinel each read states (`RULES-2.1.7`). It stays per row: one row's unproduced member is\n * that row's answer and never widens to the array or its siblings.\n */\n withItemScope<T>(\n arrayPath: string,\n elements: readonly EvaluatedValue[],\n index: number,\n visit: () => T,\n withheld?: readonly (readonly string[])[],\n undetermined?: UndeterminedRows,\n ): T {\n const scope: BinderScope = {\n name: '$it',\n elements,\n origin: arrayPath,\n index,\n ...(withheld === undefined ? {} : { withheld }),\n ...(undetermined === undefined ? {} : { undetermined }),\n };\n this.scopes.push(scope);\n try {\n return visit();\n } finally {\n this.scopes.pop();\n }\n }\n\n /**\n * Runs `visit` under binder scopes that are already in force on another evaluator.\n *\n * A pass that reads an expression on a second host — an alternative or an availability\n * condition evaluated where its reads stay out of the report — is still inside the scope its\n * owner judged: an `item`-scoped rule's `$it` names that rule's row, and the row was bound\n * before the second host existed. The scopes are plain data, so they are shared rather than\n * rebuilt from the rows they were bound to.\n */\n withBinderScopes<T>(scopes: readonly BinderScope[], visit: () => T): T {\n this.scopes.push(...scopes);\n try {\n return visit();\n } finally {\n this.scopes.length -= scopes.length;\n }\n }\n\n /** Visits `node` and everything below it, refusing an evaluation over the node budget. */\n evaluate(node: ExprNode): Evaluated {\n if (typeof node !== 'object' || node === null) {\n throw new AxiomError('ENGINE_ERROR', 'expression node is not an object');\n }\n this.ledger.spend();\n switch (node.kind) {\n case 'literal':\n return valueOf(node.value, node.domain);\n case 'path':\n // A binder is only in scope inside a comprehension or an item scope; with no scope\n // in force the read is the host's, exactly as before, with no path parsing.\n return this.scopes.length === 0 ? this.host.read(node.path) : this.readPath(node.path);\n case 'list': {\n const items = node.items.map((item) => this.evaluate(item));\n // One pass fills both the values and their domains; the withheld sideband is built only\n // when an element actually withholds a member, which is the rare case.\n const values: RuntimeValue[] = [];\n const domains: (LiteralDomain | undefined)[] = [];\n let withholding = false;\n for (const item of items) {\n values.push(item.kind === 'absent' ? UNKNOWN : item.value);\n // A list value loses its members' domains when it becomes a wire array. Carrying them\n // lets a computed list answer a per-element question as the written list does.\n domains.push(item.kind === 'absent' ? undefined : item.domain);\n if (item.kind === 'value' && item.withheldMembers !== undefined) withholding = true;\n }\n const withheldRows = withholding ? withheldRowsOf(items) : undefined;\n return {\n kind: 'value',\n value: values,\n domain: undefined,\n elementDomains: domains,\n // Rebinding a delivered record must not turn its withheld members into absence.\n ...(withheldRows === undefined ? {} : { withheldRows }),\n };\n }\n case 'and': {\n let outcome: Outcome = 'PASS';\n for (const arg of node.args) {\n outcome = and4(outcome, this.statusOf(this.evaluate(arg)));\n // `and` may stop only on a decided FAIL: a later operand may still produce the\n // FAIL an earlier UNKNOWN has not decided yet.\n if (outcome === 'FAIL') break;\n }\n return valueOf(outcomeToValue(outcome), 'boolean');\n }\n case 'or': {\n let outcome: Outcome = 'FAIL';\n for (const arg of node.args) {\n outcome = or4(outcome, this.statusOf(this.evaluate(arg)));\n if (outcome === 'PASS') break;\n }\n return valueOf(outcomeToValue(outcome), 'boolean');\n }\n case 'not': {\n const [arg] = node.args;\n if (arg === undefined) throw new AxiomError('ENGINE_ERROR', 'not requires one operand');\n return valueOf(outcomeToValue(not4(this.statusOf(this.evaluate(arg)))), 'boolean');\n }\n case 'compare': {\n const [leftNode, rightNode] = node.args;\n if (leftNode === undefined || rightNode === undefined) {\n throw new AxiomError('ENGINE_ERROR', 'comparison requires two operands');\n }\n if (node.op === 'in') return this.evalMembership(leftNode, rightNode);\n const left = this.evaluate(leftNode);\n const right = this.evaluate(rightNode);\n const undetermined = undeterminedOperand([left, right]);\n if (undetermined !== undefined) return undetermined;\n if (!isDecidedValue(left) || !isDecidedValue(right)) {\n throw new AxiomError('ENGINE_ERROR', 'an undetermined operand escaped the fold');\n }\n // An order between a value and the empty value does not exist, so it is undecided\n // rather than false. Equality is the exception: `null` compares\n // equal only to `null`.\n if (isOrderingOperator(node.op) && (left.value === null || right.value === null)) {\n return valueOf(UNKNOWN);\n }\n return valueOf(\n compareValues(\n node.op,\n this.typed(leftNode, left),\n this.typed(rightNode, right),\n operandPath(leftNode, rightNode),\n ),\n 'boolean',\n );\n }\n case 'if': {\n const [conditionNode, thenNode, elseNode] = node.args;\n if (conditionNode === undefined || thenNode === undefined || elseNode === undefined) {\n throw new AxiomError('ENGINE_ERROR', 'if requires three operands');\n }\n const condition = this.statusOf(this.evaluate(conditionNode));\n if (condition === 'UNKNOWN') return valueOf(UNKNOWN);\n if (condition === 'DEFERRED') return valueOf(DEFERRED);\n return this.evaluate(condition === 'PASS' ? thenNode : elseNode);\n }\n case 'coalesce': {\n let last: Evaluated = ABSENT;\n for (const arg of node.args) {\n last = this.evaluate(arg);\n // `??` replaces explicit null and absence only: a sentinel, a\n // redacted value, `false`, `0` and `\"\"` all stand.\n if (last.kind === 'value' && (isUndetermined(last.value) || last.value !== null)) {\n return last;\n }\n }\n return last;\n }\n case 'call':\n return callNode(this, node);\n case 'comprehension':\n // a comprehension is only an aggregate's operand, and every\n // aggregate reaches one through `aggregateCall`. Reaching this arm means a\n // hand-built artifact placed one elsewhere, so it is refused rather than answered.\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'a comprehension is only an argument of an aggregate built-in',\n );\n default: {\n const malformed: { readonly kind?: unknown } = node;\n throw new AxiomError(\n 'ENGINE_ERROR',\n `expression node kind ${JSON.stringify(malformed.kind)} is not part of Expr v1`,\n );\n }\n }\n }\n\n /** The outcome a value stands for; a non-boolean has none. */\n statusOf(evaluated: Evaluated): Outcome {\n if (evaluated.kind === 'absent') return 'UNKNOWN';\n if (isUndetermined(evaluated.value)) return evaluated.value.undetermined;\n // `null` is the empty value of every domain, so a construct that needs an outcome from\n // it has not been decided rather than refuted.\n if (evaluated.value === null) return 'UNKNOWN';\n if (typeof evaluated.value === 'boolean') return liftOutcome(evaluated.value);\n throw new AxiomError('ENGINE_ERROR', 'a rule expression must produce a boolean outcome');\n }\n\n /**\n * A path the current binder scope names is resolved here; every other path is a declared\n * field or context root the host resolves. A binder is a lexical binding, so it wins over\n * a declared field of the same name.\n */\n private readPath(path: string): Evaluated {\n return this.readScoped(path) ?? this.host.read(path);\n }\n\n private readScoped(path: string): Evaluated | undefined {\n const evaluated = binderReadScoped(this.scopes, this.paths, path);\n if (evaluated === undefined) return undefined;\n if (evaluated.kind === 'absent' || evaluated.value === null) {\n this.host.noteMissingInput?.();\n } else if (isUndetermined(evaluated.value)) {\n // A member the container read withheld is a refusal; a row member the server holds is a\n // handoff, and every other undecided answer is an input the row does not carry.\n const cause = scopedUndecided(this.scopes, this.paths, path);\n if (cause === 'withheld') {\n // The container read attributes the member to its source row. Attribute its consumption\n // too: `$prev` and `$next` let a different row's rule instance read the same refusal.\n const fieldId = scopedRefusedFieldId(this.scopes, this.paths, path);\n if (fieldId !== undefined) this.host.noteRefusedInput?.(fieldId);\n } else if (cause === 'deferred') {\n this.host.noteDeferredInput?.();\n } else {\n this.host.noteMissingInput?.();\n }\n }\n if (\n evaluated.kind === 'value' &&\n (evaluated.withheldMembers !== undefined || evaluated.withheldRows !== undefined)\n ) {\n // The host's taint stream cannot see a binder read: the row was read before this evaluator\n // received its scope. Remember it here so an output filter can refuse even a scalar or an\n // aggregate that no longer carries the source value's metadata.\n this.binderWithheld += 1;\n }\n return evaluated;\n }\n\n /** The declared path a binder path names, so a member read through the binder keeps the\n * domain its declaration pins. `undefined` where no declaration backs it:\n * the index, or an element of a list the artifact did not declare.\n */\n declarationPathOf(path: string): string | undefined {\n return binderDeclarationPath(this.scopes, this.paths, path);\n }\n\n private domainOfPath(path: string): LiteralDomain | undefined {\n return binderDomainOfPath(this.scopes, this.paths, this.declaredDomain, path);\n }\n\n /** The declared element domain of a declared array, for the elements an aggregate reads. */\n declaredElementDomainOf(path: string): LiteralDomain | undefined {\n return this.host.elementDomainOf(path);\n }\n\n /** The declared primitive of a declared path, captured for the binder walk. */\n declaredDomainOf(path: string): LiteralDomain | undefined {\n return this.declaredDomain(path);\n }\n\n /**\n * The declared members of a record path, resolved through the binder scope in force.\n *\n * A member path (`$it.f_rows`) maps to the declaration the row's array states; the binder\n * itself (`$it`, `r`) has no declaration path and is answered from the value's own\n * `closedMembers` sideband instead.\n */\n recordMembersOf(path: string): Readonly<Record<string, LiteralDomain>> | undefined {\n // A binder names an element, not a member path: `$it` in an item rule and `r` over a\n // declared array both bind a closed row, whose members the array's declaration states.\n const segments = this.paths.segmentsOf(path);\n const head = segments[0] ?? '';\n if (segments.length === 1) {\n const scope = scopeFor(this.scopes, head);\n if (scope !== undefined) {\n return scope.origin === undefined ? undefined : this.host.recordItemMembersOf(scope.origin);\n }\n }\n const declaration = this.declarationPathOf(path);\n return declaration === undefined ? undefined : this.host.recordMembersOf(declaration);\n }\n\n /** The declared members of a record array's rows, through the binder scope in force. */\n recordItemMembersOf(path: string): Readonly<Record<string, LiteralDomain>> | undefined {\n const declaration = this.declarationPathOf(path);\n return declaration === undefined ? undefined : this.host.recordItemMembersOf(declaration);\n }\n\n evalArgs(args: readonly ExprNode[]): readonly RuntimeValue[] {\n return args.map((arg) => this.evalArgument(arg));\n }\n\n evalArgument(arg: ExprNode): RuntimeValue {\n const evaluated = this.evaluate(arg);\n return evaluated.kind === 'absent' ? UNKNOWN : evaluated.value;\n }\n\n /** `x in xs` under the equality rule, answered by the membership family. */\n private evalMembership(leftNode: ExprNode, rightNode: ExprNode): Evaluated {\n return membershipEval(this, leftNode, rightNode);\n }\n\n /**\n * Records the report entry one resolution produces. A resolution that\n * formed no query — `decide` with an input the record does not carry — has no entry to\n * record, because there is no table identity and no key to reproduce.\n *\n * The port memo hands back the same resolution object for a repeated call, so the\n * provenance object is built once per distinct resolution and the report's canonical\n * token is derived once per provenance rather than once per call.\n */\n recordResolution(resolution: SetResolution | LookupResolution): void {\n let provenance = this.provenanceByResolution.get(resolution);\n if (provenance === undefined) {\n provenance = toProvenance(resolution) ?? null;\n this.provenanceByResolution.set(resolution, provenance);\n }\n if (provenance !== null) this.lookups.recordProvenance(provenance);\n }\n\n /**\n * Attaches the operand's static domain, so `\"1.5\"` and the decimal `1.5` are two\n * values of different domains. A literal states its\n * own domain, a path takes the declared primitive, and a built-in with a fixed result\n * type contributes that type; a type-parameterised built-in contributes nothing.\n */\n typed(node: ExprNode, evaluated: EvaluatedValue): EvaluatedValue {\n // `null` is the explicitly authored empty value and a domain of its own\n // whichever primitive the field declares.\n if (evaluated.value === null) return { ...evaluated, domain: 'null' };\n if (node.kind === 'literal') return { ...evaluated, domain: node.domain };\n if (node.kind === 'path') {\n const domain = this.domainOfPath(node.path);\n const withDomain = domain === undefined ? evaluated : { ...evaluated, domain };\n // A declared array states the domain of its elements, not of the list. Attaching it\n // here is what lets `x in f_amounts` and `f_amounts == [1, 2]` compare each member\n // under the declaration the compiler proved (`EXPR-5.1.10`, `EXPR-10.1.1`); a list\n // value that already carries its producer's domains keeps them.\n if (!isWireArray(evaluated.value)) return withDomain;\n const elementDomains = elementDomainsFor(\n evaluated.value,\n evaluated.elementDomains,\n this.host.elementDomainOf(node.path),\n );\n return elementDomains === undefined ? withDomain : { ...withDomain, elementDomains };\n }\n if (node.kind === 'call') {\n const domain = resultDomain(node.op);\n return domain === undefined ? evaluated : { ...evaluated, domain };\n }\n return evaluated;\n }\n}\n\n/**\n * The path a comparison names when it refuses its operands: the first operand that is a path,\n * so an engine error points an author at the read rather than at the whole rule.\n */\nfunction operandPath(left: ExprNode, right: ExprNode): string {\n if (left.kind === 'path') return left.path;\n if (right.kind === 'path') return right.path;\n return '';\n}\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { CompiledRule, Outcome, RuleKind, ScreenOutcome, WireValue } from '../model/types.js';
|
|
2
|
+
/** Whether a text names one of the rule kinds the contract declares. */
|
|
3
|
+
export declare function isRuleKind(value: string): value is RuleKind;
|
|
4
|
+
/**
|
|
5
|
+
* What an evaluation observed about one rule.
|
|
6
|
+
*
|
|
7
|
+
* The union is tagged because the three observations are not one scale: an outcome is the
|
|
8
|
+
* four-state fold a rule result carries, a screen states its own `SCREEN_PASS`/`SCREEN_FAIL`/
|
|
9
|
+
* `SCREEN_REFER` so a referral is distinguishable from a refusal, and a writer states the
|
|
10
|
+
* value it produced — `null` included, which is a produced value rather than an absence.
|
|
11
|
+
*/
|
|
12
|
+
export type Observation = {
|
|
13
|
+
readonly kind: 'outcome';
|
|
14
|
+
readonly outcome: Outcome;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'screen';
|
|
17
|
+
readonly outcome: ScreenOutcome;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: 'value';
|
|
20
|
+
readonly value: WireValue | null;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Which branch of its firing table one observation proves, `spec/semantics/rules-v1.md`.
|
|
24
|
+
*
|
|
25
|
+
* `true` is the firing branch, `false` the non-firing branch, and `undefined` an observation
|
|
26
|
+
* that proves neither: a rule that deferred did not run, and an `UNKNOWN` result decided
|
|
27
|
+
* nothing. The table is one answer shared by the compiler's publish-readiness check, the CLI's
|
|
28
|
+
* vector verdict and every downstream scenario runner: a `visible`/`required`/`enabled` rule
|
|
29
|
+
* is doing its work when it passes, a writer is doing its work when it produces a value, and a
|
|
30
|
+
* `validate`, `gate` or `screen` rule is doing its work when it refuses. A second copy of this
|
|
31
|
+
* table is how a rule's vectors could be counted as firing for publishing while the same case
|
|
32
|
+
* counted as non-firing in a runner.
|
|
33
|
+
*
|
|
34
|
+
* The non-firing branch is the kind's own answer rather than "any observation that is not
|
|
35
|
+
* firing": `UNKNOWN` beside a `validate` rule is a case that decided nothing, while `UNKNOWN`
|
|
36
|
+
* is exactly a writer's non-firing branch (`RULES-3.1.2`), and a `screen` states its branch
|
|
37
|
+
* through its own outcome.
|
|
38
|
+
*
|
|
39
|
+
* A screen fires on a referral as well as a refusal, and a writer's `PASS` is the same fact as
|
|
40
|
+
* a produced value, so both spellings of one observation answer alike.
|
|
41
|
+
*/
|
|
42
|
+
export declare function firingBranch(kind: RuleKind, observation: Observation): boolean | undefined;
|
|
43
|
+
/** Whether a rule kind fires at one observation; an observation that decides neither is not firing. */
|
|
44
|
+
export declare function isFiring(kind: RuleKind, observation: Observation): boolean;
|
|
45
|
+
/** The branch of its firing table a rule's expression can never take. */
|
|
46
|
+
export type UnreachableBranch = 'firing' | 'non_firing';
|
|
47
|
+
/**
|
|
48
|
+
* The branch of its firing table a rule's expression can never take, when it fixes that answer.
|
|
49
|
+
*
|
|
50
|
+
* A `validate`, `visible`, `required` or `enabled` rule's outcome is its expression's answer, so
|
|
51
|
+
* an expression that folds to a constant boolean fixes that answer for every record: `true`
|
|
52
|
+
* passes and can never fail, and `false` fails and can never pass. A writer's result is a value
|
|
53
|
+
* or `UNKNOWN`, so an expression that folds to a constant produces a value on every record and
|
|
54
|
+
* can never report the non-firing case. Publishing asks for a case on each branch a rule can
|
|
55
|
+
* take (`spec/semantics/rules-v1.md` `RULES-3.1.2`), and no record can state the branch this
|
|
56
|
+
* rule can never reach — so stating one is the requirement being unmet rather than a case
|
|
57
|
+
* being missing.
|
|
58
|
+
*
|
|
59
|
+
* The fold is the tree's own answer, not a search for a literal: `not(false)` and
|
|
60
|
+
* `true and true` state one branch as plainly as the literal does. A `gate` or `screen` decides
|
|
61
|
+
* through composition as well — a gate's items, a screen's `referWhen` — so neither states a
|
|
62
|
+
* fixed branch from its expression alone.
|
|
63
|
+
*
|
|
64
|
+
* Kind and expression together decide it, so this is the one answer a publisher and a diff read
|
|
65
|
+
* rather than each re-reading the rule's tree.
|
|
66
|
+
*/
|
|
67
|
+
export declare function unreachableBranchOf(rule: CompiledRule): UnreachableBranch | undefined;
|
|
68
|
+
//# sourceMappingURL=firing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firing.d.ts","sourceRoot":"","sources":["../../src/eval/firing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EAEZ,OAAO,EACP,QAAQ,EACR,aAAa,EACb,SAAS,EACV,MAAM,mBAAmB,CAAC;AAK3B,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAE3D;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;CAAE,GAC5D;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAA;CAAE,CAAC;AAyCjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,GAAG,SAAS,CAiB1F;AAED,uGAAuG;AACvG,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAE1E;AA4DD,yEAAyE;AACzE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,YAAY,CAAC;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,iBAAiB,GAAG,SAAS,CAuBrF"}
|