@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,304 @@
|
|
|
1
|
+
import { AxiomError } from '../../model/errors.js';
|
|
2
|
+
import { DEFERRED, isUndetermined, UNKNOWN } from '../../model/types.js';
|
|
3
|
+
import { isScalarWireValue, isWireArray } from '../../model/values.js';
|
|
4
|
+
import { foldUndetermined } from './operands.js';
|
|
5
|
+
import { valueOf } from './value.js';
|
|
6
|
+
/**
|
|
7
|
+
* The declared domain of each output member of one table, as the store states them.
|
|
8
|
+
*
|
|
9
|
+
* A table read hands back canonical wire values: the store's `output` record carries no
|
|
10
|
+
* declaration, so `"200"` is indistinguishable from a string the author meant as text. The
|
|
11
|
+
* store that resolved the table is the one place that knows its columns, and `LookupHost`
|
|
12
|
+
* carries that statement into the expression. A host with no columns capability leaves the
|
|
13
|
+
* members domainless, which the strict comparator and the domain-driven aggregates then
|
|
14
|
+
* answer as undecided rather than comparing a spelling.
|
|
15
|
+
*/
|
|
16
|
+
function outputMemberDomains(context, tableId) {
|
|
17
|
+
const columns = context.lookups.columnsOf?.(tableId);
|
|
18
|
+
if (columns === undefined)
|
|
19
|
+
return undefined;
|
|
20
|
+
const domains = {};
|
|
21
|
+
for (const column of columns) {
|
|
22
|
+
if (column.role !== 'output')
|
|
23
|
+
continue;
|
|
24
|
+
domains[column.columnId] = column.primitive;
|
|
25
|
+
}
|
|
26
|
+
return Object.keys(domains).length === 0 ? undefined : domains;
|
|
27
|
+
}
|
|
28
|
+
/** The output record a decided row returns: a `PASS` row always carries one. */
|
|
29
|
+
function rowOutput(row, tableId) {
|
|
30
|
+
if (row.output === undefined) {
|
|
31
|
+
throw new AxiomError('ENGINE_ERROR', `table ${tableId} row ${row.rowId} produced a hit with no output`, tableId);
|
|
32
|
+
}
|
|
33
|
+
return row.output;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `in_set(table, v, asOf?)`, `lookup(table, keys, asOf?)` and
|
|
37
|
+
* `decide_keys(table, keys, asOf?)`, `spec/semantics/expr-v1.md` section 15 and
|
|
38
|
+
* `spec/semantics/datasets-v1.md` section 4.
|
|
39
|
+
*
|
|
40
|
+
* The first argument is a table name rather than a read, so it is never evaluated as a
|
|
41
|
+
* path. The other operands are evaluated first, so an expression the engine cannot decide
|
|
42
|
+
* still reports its own cause; only then does a table the store does not hold answer as a
|
|
43
|
+
* required version that is missing — `UNKNOWN` with `STALE_DATA`, never an empty answer
|
|
44
|
+
* Every resolution records the provenance a report keeps, hit or miss
|
|
45
|
+
* ().
|
|
46
|
+
*/
|
|
47
|
+
export function datasetCall(context, op, args) {
|
|
48
|
+
const tableId = tableName(op, args[0]);
|
|
49
|
+
const port = context.lookups.port;
|
|
50
|
+
switch (op) {
|
|
51
|
+
case 'in_set':
|
|
52
|
+
return setMembership(context, port, tableId, args[1], args[2]);
|
|
53
|
+
case 'lookup':
|
|
54
|
+
return lookupKeys(context, port, tableId, args[1], args[2]);
|
|
55
|
+
case 'decide_keys':
|
|
56
|
+
return decideKeyVector(context, port, tableId, args[1], args[2]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A table the call cannot resolve: `UNKNOWN` plus `STALE_DATA`, never an empty answer, with
|
|
61
|
+
* the same stale provenance a store that holds no such table would record.
|
|
62
|
+
*/
|
|
63
|
+
function missingTable(context, tableId) {
|
|
64
|
+
context.lookups.recordStaleData(tableId, 'missing_table');
|
|
65
|
+
context.recordResolution({ outcome: 'STALE', tableId, reason: 'missing_table' });
|
|
66
|
+
return valueOf(UNKNOWN);
|
|
67
|
+
}
|
|
68
|
+
/** The table a dataset built-in names. */
|
|
69
|
+
function tableName(op, node) {
|
|
70
|
+
if (node === undefined || node.kind !== 'path') {
|
|
71
|
+
throw new AxiomError('ENGINE_ERROR', `${op} requires a table name as its first argument`);
|
|
72
|
+
}
|
|
73
|
+
return node.path;
|
|
74
|
+
}
|
|
75
|
+
function setMembership(context, port, tableId, valueNode, asOfNode) {
|
|
76
|
+
if (valueNode === undefined)
|
|
77
|
+
throw new AxiomError('ENGINE_ERROR', 'in_set takes two operands');
|
|
78
|
+
const valueMark = context.taintMark();
|
|
79
|
+
const operand = context.evaluate(valueNode);
|
|
80
|
+
// The membership value becomes `lookups[].key`, so a value the report must withhold — hidden
|
|
81
|
+
// and excluded, or withheld from delivery by access — is not a key it can state: the question
|
|
82
|
+
// goes undecided and no provenance is recorded.
|
|
83
|
+
if (context.touchedWithheld(valueMark))
|
|
84
|
+
return valueOf(UNKNOWN);
|
|
85
|
+
if (operand.kind === 'absent')
|
|
86
|
+
return valueOf(UNKNOWN);
|
|
87
|
+
if (isUndetermined(operand.value))
|
|
88
|
+
return operand;
|
|
89
|
+
// A table the store cannot reach is `STALE_DATA` whichever shape the operand has: the
|
|
90
|
+
// record could not be checked against it, and that outranks a shape complaint. An operand
|
|
91
|
+
// the engine cannot decide was settled above, and a broken one threw before this point.
|
|
92
|
+
if (port === undefined)
|
|
93
|
+
return missingTable(context, tableId);
|
|
94
|
+
// A set holds dataset scalars, so an empty or structured value is not a
|
|
95
|
+
// member and is not the empty answer either: it is an operand the membership question
|
|
96
|
+
// cannot be asked of, and asking would record a key the report contract
|
|
97
|
+
// does not admit.
|
|
98
|
+
if (!isScalarWireValue(operand.value))
|
|
99
|
+
return valueOf(UNKNOWN);
|
|
100
|
+
const asOf = asOfValue(context, asOfNode);
|
|
101
|
+
if (asOf.kind === 'undetermined')
|
|
102
|
+
return asOf.value;
|
|
103
|
+
// An explicit `asOf` overrides the host's record date for this call; with neither, a
|
|
104
|
+
// data-bound set is stale and a behavior-bound one answers regardless.
|
|
105
|
+
const resolution = port.contains(tableId, operand.value, asOf.value ?? context.lookups.recordDate);
|
|
106
|
+
context.recordResolution(resolution);
|
|
107
|
+
switch (resolution.outcome) {
|
|
108
|
+
case 'MEMBER':
|
|
109
|
+
return valueOf(true, 'boolean');
|
|
110
|
+
case 'ABSENT':
|
|
111
|
+
return valueOf(false, 'boolean');
|
|
112
|
+
case 'STALE':
|
|
113
|
+
context.lookups.recordStaleData(tableId, resolution.reason);
|
|
114
|
+
return valueOf(UNKNOWN);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function decideKeyVector(context, port, tableId, keysNode, asOfNode) {
|
|
118
|
+
const keys = keyValues(context, keysNode);
|
|
119
|
+
if (keys.kind === 'undetermined')
|
|
120
|
+
return keys.value;
|
|
121
|
+
const asOf = asOfValue(context, asOfNode);
|
|
122
|
+
if (asOf.kind === 'undetermined')
|
|
123
|
+
return asOf.value;
|
|
124
|
+
if (port === undefined)
|
|
125
|
+
return missingTable(context, tableId);
|
|
126
|
+
return datasetResult(context, port.decideKeys(tableId, keys.values, asOf.value), tableId);
|
|
127
|
+
}
|
|
128
|
+
function lookupKeys(context, port, tableId, keysNode, asOfNode) {
|
|
129
|
+
const keys = keyValues(context, keysNode);
|
|
130
|
+
if (keys.kind === 'undetermined')
|
|
131
|
+
return keys.value;
|
|
132
|
+
const asOf = asOfValue(context, asOfNode);
|
|
133
|
+
if (asOf.kind === 'undetermined')
|
|
134
|
+
return asOf.value;
|
|
135
|
+
if (port === undefined)
|
|
136
|
+
return missingTable(context, tableId);
|
|
137
|
+
return datasetResult(context, port.resolve(tableId, keys.values, asOf.value), tableId);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The composite key a `lookup` resolves with: one value per key column, in
|
|
141
|
+
* declaration order. A member this device cannot read makes the result undetermined, with
|
|
142
|
+
* `UNKNOWN` beating `DEFERRED`, because a key it does not hold could
|
|
143
|
+
* still match.
|
|
144
|
+
*/
|
|
145
|
+
function keyValues(context, node) {
|
|
146
|
+
if (node === undefined)
|
|
147
|
+
throw new AxiomError('ENGINE_ERROR', 'lookup requires a key list');
|
|
148
|
+
if (node.kind === 'list') {
|
|
149
|
+
const values = [];
|
|
150
|
+
let undetermined;
|
|
151
|
+
for (const item of node.items) {
|
|
152
|
+
const mark = context.taintMark();
|
|
153
|
+
const evaluated = context.evaluate(item);
|
|
154
|
+
// A key member the report must withhold is a key it cannot state: the lookup is
|
|
155
|
+
// undecided and records no provenance, rather than resolving on a withheld value.
|
|
156
|
+
if (context.touchedWithheld(mark)) {
|
|
157
|
+
undetermined = foldUndetermined(undetermined, UNKNOWN);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
// A key member this device does not hold — absent, empty or undetermined — could
|
|
161
|
+
// still match a row, so the lookup is undecided rather than a miss
|
|
162
|
+
//
|
|
163
|
+
if (evaluated.kind === 'absent') {
|
|
164
|
+
undetermined = foldUndetermined(undetermined, UNKNOWN);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (isUndetermined(evaluated.value)) {
|
|
168
|
+
undetermined = foldUndetermined(undetermined, evaluated.value);
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
// A key is a dataset scalar: no column holds a record, a list or
|
|
172
|
+
// the empty value, so one of them cannot decide the query either way.
|
|
173
|
+
if (!isScalarWireValue(evaluated.value)) {
|
|
174
|
+
undetermined = foldUndetermined(undetermined, UNKNOWN);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
values.push(evaluated.value);
|
|
178
|
+
}
|
|
179
|
+
return undetermined === undefined
|
|
180
|
+
? { kind: 'values', values }
|
|
181
|
+
: { kind: 'undetermined', value: valueOf(undetermined) };
|
|
182
|
+
}
|
|
183
|
+
const mark = context.taintMark();
|
|
184
|
+
const evaluated = context.evaluate(node);
|
|
185
|
+
if (context.touchedWithheld(mark)) {
|
|
186
|
+
return { kind: 'undetermined', value: valueOf(UNKNOWN) };
|
|
187
|
+
}
|
|
188
|
+
if (evaluated.kind === 'absent') {
|
|
189
|
+
return { kind: 'undetermined', value: valueOf(UNKNOWN) };
|
|
190
|
+
}
|
|
191
|
+
if (isUndetermined(evaluated.value))
|
|
192
|
+
return { kind: 'undetermined', value: evaluated };
|
|
193
|
+
if (!isWireArray(evaluated.value)) {
|
|
194
|
+
throw new AxiomError('ENGINE_ERROR', 'lookup requires a list of key values');
|
|
195
|
+
}
|
|
196
|
+
const keys = [];
|
|
197
|
+
for (const key of evaluated.value) {
|
|
198
|
+
if (!isScalarWireValue(key))
|
|
199
|
+
return { kind: 'undetermined', value: valueOf(UNKNOWN) };
|
|
200
|
+
keys.push(key);
|
|
201
|
+
}
|
|
202
|
+
return { kind: 'values', values: keys };
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The record date a `data`-bound table resolves against.
|
|
206
|
+
*
|
|
207
|
+
* It is read from the expression and never from a clock, and a behavior-bound table is
|
|
208
|
+
* refused by the store when one is supplied.
|
|
209
|
+
*/
|
|
210
|
+
function asOfValue(context, node) {
|
|
211
|
+
if (node === undefined)
|
|
212
|
+
return { kind: 'values', value: undefined };
|
|
213
|
+
const mark = context.taintMark();
|
|
214
|
+
const evaluated = context.evaluate(node);
|
|
215
|
+
// An as-of date travels in the provenance, so a withheld value for it makes the call
|
|
216
|
+
// undecided rather than quoting what the report must withhold.
|
|
217
|
+
if (context.touchedWithheld(mark)) {
|
|
218
|
+
return { kind: 'undetermined', value: valueOf(UNKNOWN) };
|
|
219
|
+
}
|
|
220
|
+
if (evaluated.kind === 'absent' || evaluated.value === null) {
|
|
221
|
+
return { kind: 'undetermined', value: valueOf(UNKNOWN) };
|
|
222
|
+
}
|
|
223
|
+
if (isUndetermined(evaluated.value))
|
|
224
|
+
return { kind: 'undetermined', value: evaluated };
|
|
225
|
+
if (typeof evaluated.value !== 'string') {
|
|
226
|
+
throw new AxiomError('ENGINE_ERROR', 'an as-of value must be a date');
|
|
227
|
+
}
|
|
228
|
+
return { kind: 'values', value: evaluated.value };
|
|
229
|
+
}
|
|
230
|
+
/** One resolution as the value the expression sees. */
|
|
231
|
+
function datasetResult(context, resolution, tableId) {
|
|
232
|
+
// Every resolution that reached a table records where it resolved, hit or miss
|
|
233
|
+
// (), so a report reproduces the question as well as the
|
|
234
|
+
// answer.
|
|
235
|
+
context.recordResolution(resolution);
|
|
236
|
+
switch (resolution.outcome) {
|
|
237
|
+
case 'HIT': {
|
|
238
|
+
// The table's declared output columns travel beside the values the store handed back,
|
|
239
|
+
// so a member read through a comprehension is the decimal the column declares.
|
|
240
|
+
const memberDomains = outputMemberDomains(context, tableId);
|
|
241
|
+
// The output record is closed by the table's columns: its members are known even where a
|
|
242
|
+
// store implements no `columns` capability, because the row itself states them. Attaching
|
|
243
|
+
// the ordered names is what lets `keys`/`values` read a dataset row deterministically
|
|
244
|
+
// instead of inferring a type from whatever a store chose to emit in one call.
|
|
245
|
+
const closedMembers = memberDomains === undefined ? undefined : Object.keys(memberDomains);
|
|
246
|
+
if (resolution.hitPolicy === 'COLLECT') {
|
|
247
|
+
const outputs = resolution.rows.map((row) => rowOutput(row, tableId));
|
|
248
|
+
const list = valueOf(outputs);
|
|
249
|
+
return {
|
|
250
|
+
...list,
|
|
251
|
+
...(memberDomains === undefined
|
|
252
|
+
? {}
|
|
253
|
+
: { elementMemberDomains: outputs.map(() => memberDomains) }),
|
|
254
|
+
...(closedMembers === undefined
|
|
255
|
+
? { elementClosedMembers: outputs.map((output) => Object.keys(output)) }
|
|
256
|
+
: { elementClosedMembers: outputs.map(() => closedMembers) }),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const [row, ...rest] = resolution.rows;
|
|
260
|
+
if (row === undefined) {
|
|
261
|
+
throw new AxiomError('ENGINE_ERROR', `table ${tableId} hit with no row`, tableId);
|
|
262
|
+
}
|
|
263
|
+
// One key resolves one row under `UNIQUE` and `FIRST`: a resolution that hands back two
|
|
264
|
+
// is a table the policy cannot honour, and answering the first would let a store's row
|
|
265
|
+
// order decide the result ( `DATA-3.1.1`). The store that holds the table refuses such a
|
|
266
|
+
// document when it installs it; a store the caller wrote is refused here.
|
|
267
|
+
if (rest.length > 0) {
|
|
268
|
+
throw new AxiomError('ENGINE_ERROR', `table ${tableId} returned ${String(resolution.rows.length)} rows for one key under ${resolution.hitPolicy}`, tableId);
|
|
269
|
+
}
|
|
270
|
+
const output = rowOutput(row, tableId);
|
|
271
|
+
return {
|
|
272
|
+
...valueOf(output),
|
|
273
|
+
...(memberDomains === undefined ? {} : { memberDomains }),
|
|
274
|
+
...(closedMembers === undefined
|
|
275
|
+
? { closedMembers: Object.keys(output) }
|
|
276
|
+
: { closedMembers }),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
case 'MISS':
|
|
280
|
+
// An empty collection is a decided empty list; a missed single hit is a reading this
|
|
281
|
+
// device does not hold, so it answers `UNKNOWN` rather than a fabricated row.
|
|
282
|
+
return resolution.hitPolicy === 'COLLECT' ? valueOf([]) : valueOf(UNKNOWN);
|
|
283
|
+
case 'UNDETERMINED': {
|
|
284
|
+
// A store cannot hide two decided UNIQUE matches behind an undetermined verdict. One
|
|
285
|
+
// decided match beside an undetermined row is valid; a second decided match is the
|
|
286
|
+
// duplicate the policy refuses wherever it is applied (`DATA-3.1.1`, `DATA-3.1.2`).
|
|
287
|
+
//
|
|
288
|
+
// A decided match is a row whose own `outcome` is `PASS`. A row that states none states no
|
|
289
|
+
// verdict — a `lookup` row declares no outcome at all (`DATA-1.2.4`) — so the guard does
|
|
290
|
+
// not credit it as a decision the store never stated; the port contract is that a
|
|
291
|
+
// `decision_table` row always carries one, and a store that leaves it out is answered as
|
|
292
|
+
// undetermined rather than refused for a duplicate it did not report.
|
|
293
|
+
const decided = resolution.rows?.filter((row) => row.outcome === 'PASS').length ?? 0;
|
|
294
|
+
if (resolution.hitPolicy === 'UNIQUE' && decided > 1) {
|
|
295
|
+
throw new AxiomError('ENGINE_ERROR', `table ${tableId} returned ${String(decided)} decided matches for one key under UNIQUE`, tableId);
|
|
296
|
+
}
|
|
297
|
+
return valueOf(resolution.value === 'UNKNOWN' ? UNKNOWN : DEFERRED);
|
|
298
|
+
}
|
|
299
|
+
case 'STALE':
|
|
300
|
+
context.lookups.recordStaleData(tableId, resolution.reason);
|
|
301
|
+
return valueOf(UNKNOWN);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=datasets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../../src/eval/expr/datasets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAYnD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAMrC;;;;;;;;;GASG;AACH,SAAS,mBAAmB,CAC1B,OAAuB,EACvB,OAAe;IAEf,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;IACrD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,OAAO,GAAkC,EAAE,CAAC;IAClD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ;YAAE,SAAS;QACvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC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OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACtE,CAAC;QACD,KAAK,OAAO;YACV,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;YAC5D,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC","sourcesContent":["import { AxiomError } from '../../model/errors.js';\nimport type {\n ExprNode,\n LiteralDomain,\n LookupPort,\n LookupResolution,\n LookupRow,\n ScalarWireValue,\n SetResolution,\n Undetermined,\n WireRecord,\n} from '../../model/types.js';\nimport { DEFERRED, isUndetermined, UNKNOWN } from '../../model/types.js';\nimport { isScalarWireValue, isWireArray } from '../../model/values.js';\nimport type { LookupHost } from './host.js';\nimport { foldUndetermined } from './operands.js';\nimport { valueOf } from './value.js';\nimport type { Evaluated } from './value.js';\n\n/** The dataset built-ins that answer from a store rather than the record. */\ntype DatasetOperator = 'in_set' | 'lookup' | 'decide_keys';\n\n/**\n * The declared domain of each output member of one table, as the store states them.\n *\n * A table read hands back canonical wire values: the store's `output` record carries no\n * declaration, so `\"200\"` is indistinguishable from a string the author meant as text. The\n * store that resolved the table is the one place that knows its columns, and `LookupHost`\n * carries that statement into the expression. A host with no columns capability leaves the\n * members domainless, which the strict comparator and the domain-driven aggregates then\n * answer as undecided rather than comparing a spelling.\n */\nfunction outputMemberDomains(\n context: DatasetContext,\n tableId: string,\n): Readonly<Record<string, LiteralDomain>> | undefined {\n const columns = context.lookups.columnsOf?.(tableId);\n if (columns === undefined) return undefined;\n const domains: Record<string, LiteralDomain> = {};\n for (const column of columns) {\n if (column.role !== 'output') continue;\n domains[column.columnId] = column.primitive;\n }\n return Object.keys(domains).length === 0 ? undefined : domains;\n}\n\n/** The evaluator operations the dataset built-ins need. */\nexport interface DatasetContext {\n evaluate(node: ExprNode): Evaluated;\n taintMark(): number;\n touchedWithheld(mark: number): boolean;\n readonly lookups: LookupHost;\n recordResolution(resolution: SetResolution | LookupResolution): void;\n}\n\n/** The output record a decided row returns: a `PASS` row always carries one. */\nfunction rowOutput(row: LookupRow, tableId: string): WireRecord {\n if (row.output === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `table ${tableId} row ${row.rowId} produced a hit with no output`,\n tableId,\n );\n }\n return row.output;\n}\n\n/**\n * `in_set(table, v, asOf?)`, `lookup(table, keys, asOf?)` and\n * `decide_keys(table, keys, asOf?)`, `spec/semantics/expr-v1.md` section 15 and\n * `spec/semantics/datasets-v1.md` section 4.\n *\n * The first argument is a table name rather than a read, so it is never evaluated as a\n * path. The other operands are evaluated first, so an expression the engine cannot decide\n * still reports its own cause; only then does a table the store does not hold answer as a\n * required version that is missing — `UNKNOWN` with `STALE_DATA`, never an empty answer\n * Every resolution records the provenance a report keeps, hit or miss\n * ().\n */\nexport function datasetCall(\n context: DatasetContext,\n op: DatasetOperator,\n args: readonly ExprNode[],\n): Evaluated {\n const tableId = tableName(op, args[0]);\n const port = context.lookups.port;\n switch (op) {\n case 'in_set':\n return setMembership(context, port, tableId, args[1], args[2]);\n case 'lookup':\n return lookupKeys(context, port, tableId, args[1], args[2]);\n case 'decide_keys':\n return decideKeyVector(context, port, tableId, args[1], args[2]);\n }\n}\n\n/**\n * A table the call cannot resolve: `UNKNOWN` plus `STALE_DATA`, never an empty answer, with\n * the same stale provenance a store that holds no such table would record.\n */\nfunction missingTable(context: DatasetContext, tableId: string): Evaluated {\n context.lookups.recordStaleData(tableId, 'missing_table');\n context.recordResolution({ outcome: 'STALE', tableId, reason: 'missing_table' });\n return valueOf(UNKNOWN);\n}\n\n/** The table a dataset built-in names. */\nfunction tableName(op: string, node: ExprNode | undefined): string {\n if (node === undefined || node.kind !== 'path') {\n throw new AxiomError('ENGINE_ERROR', `${op} requires a table name as its first argument`);\n }\n return node.path;\n}\n\nfunction setMembership(\n context: DatasetContext,\n port: LookupPort | undefined,\n tableId: string,\n valueNode: ExprNode | undefined,\n asOfNode: ExprNode | undefined,\n): Evaluated {\n if (valueNode === undefined) throw new AxiomError('ENGINE_ERROR', 'in_set takes two operands');\n const valueMark = context.taintMark();\n const operand = context.evaluate(valueNode);\n // The membership value becomes `lookups[].key`, so a value the report must withhold — hidden\n // and excluded, or withheld from delivery by access — is not a key it can state: the question\n // goes undecided and no provenance is recorded.\n if (context.touchedWithheld(valueMark)) return valueOf(UNKNOWN);\n if (operand.kind === 'absent') return valueOf(UNKNOWN);\n if (isUndetermined(operand.value)) return operand;\n // A table the store cannot reach is `STALE_DATA` whichever shape the operand has: the\n // record could not be checked against it, and that outranks a shape complaint. An operand\n // the engine cannot decide was settled above, and a broken one threw before this point.\n if (port === undefined) return missingTable(context, tableId);\n // A set holds dataset scalars, so an empty or structured value is not a\n // member and is not the empty answer either: it is an operand the membership question\n // cannot be asked of, and asking would record a key the report contract\n // does not admit.\n if (!isScalarWireValue(operand.value)) return valueOf(UNKNOWN);\n const asOf = asOfValue(context, asOfNode);\n if (asOf.kind === 'undetermined') return asOf.value;\n // An explicit `asOf` overrides the host's record date for this call; with neither, a\n // data-bound set is stale and a behavior-bound one answers regardless.\n const resolution = port.contains(\n tableId,\n operand.value,\n asOf.value ?? context.lookups.recordDate,\n );\n context.recordResolution(resolution);\n switch (resolution.outcome) {\n case 'MEMBER':\n return valueOf(true, 'boolean');\n case 'ABSENT':\n return valueOf(false, 'boolean');\n case 'STALE':\n context.lookups.recordStaleData(tableId, resolution.reason);\n return valueOf(UNKNOWN);\n }\n}\n\nfunction decideKeyVector(\n context: DatasetContext,\n port: LookupPort | undefined,\n tableId: string,\n keysNode: ExprNode | undefined,\n asOfNode: ExprNode | undefined,\n): Evaluated {\n const keys = keyValues(context, keysNode);\n if (keys.kind === 'undetermined') return keys.value;\n const asOf = asOfValue(context, asOfNode);\n if (asOf.kind === 'undetermined') return asOf.value;\n if (port === undefined) return missingTable(context, tableId);\n return datasetResult(context, port.decideKeys(tableId, keys.values, asOf.value), tableId);\n}\n\nfunction lookupKeys(\n context: DatasetContext,\n port: LookupPort | undefined,\n tableId: string,\n keysNode: ExprNode | undefined,\n asOfNode: ExprNode | undefined,\n): Evaluated {\n const keys = keyValues(context, keysNode);\n if (keys.kind === 'undetermined') return keys.value;\n const asOf = asOfValue(context, asOfNode);\n if (asOf.kind === 'undetermined') return asOf.value;\n if (port === undefined) return missingTable(context, tableId);\n return datasetResult(context, port.resolve(tableId, keys.values, asOf.value), tableId);\n}\n\n/**\n * The composite key a `lookup` resolves with: one value per key column, in\n * declaration order. A member this device cannot read makes the result undetermined, with\n * `UNKNOWN` beating `DEFERRED`, because a key it does not hold could\n * still match.\n */\nfunction keyValues(\n context: DatasetContext,\n node: ExprNode | undefined,\n):\n | { readonly kind: 'values'; readonly values: readonly ScalarWireValue[] }\n | {\n readonly kind: 'undetermined';\n readonly value: Evaluated;\n } {\n if (node === undefined) throw new AxiomError('ENGINE_ERROR', 'lookup requires a key list');\n if (node.kind === 'list') {\n const values: ScalarWireValue[] = [];\n let undetermined: Undetermined | undefined;\n for (const item of node.items) {\n const mark = context.taintMark();\n const evaluated = context.evaluate(item);\n // A key member the report must withhold is a key it cannot state: the lookup is\n // undecided and records no provenance, rather than resolving on a withheld value.\n if (context.touchedWithheld(mark)) {\n undetermined = foldUndetermined(undetermined, UNKNOWN);\n continue;\n }\n // A key member this device does not hold — absent, empty or undetermined — could\n // still match a row, so the lookup is undecided rather than a miss\n //\n if (evaluated.kind === 'absent') {\n undetermined = foldUndetermined(undetermined, UNKNOWN);\n continue;\n }\n if (isUndetermined(evaluated.value)) {\n undetermined = foldUndetermined(undetermined, evaluated.value);\n continue;\n }\n // A key is a dataset scalar: no column holds a record, a list or\n // the empty value, so one of them cannot decide the query either way.\n if (!isScalarWireValue(evaluated.value)) {\n undetermined = foldUndetermined(undetermined, UNKNOWN);\n continue;\n }\n values.push(evaluated.value);\n }\n return undetermined === undefined\n ? { kind: 'values', values }\n : { kind: 'undetermined', value: valueOf(undetermined) };\n }\n const mark = context.taintMark();\n const evaluated = context.evaluate(node);\n if (context.touchedWithheld(mark)) {\n return { kind: 'undetermined', value: valueOf(UNKNOWN) };\n }\n if (evaluated.kind === 'absent') {\n return { kind: 'undetermined', value: valueOf(UNKNOWN) };\n }\n if (isUndetermined(evaluated.value)) return { kind: 'undetermined', value: evaluated };\n if (!isWireArray(evaluated.value)) {\n throw new AxiomError('ENGINE_ERROR', 'lookup requires a list of key values');\n }\n const keys: ScalarWireValue[] = [];\n for (const key of evaluated.value) {\n if (!isScalarWireValue(key)) return { kind: 'undetermined', value: valueOf(UNKNOWN) };\n keys.push(key);\n }\n return { kind: 'values', values: keys };\n}\n\n/**\n * The record date a `data`-bound table resolves against.\n *\n * It is read from the expression and never from a clock, and a behavior-bound table is\n * refused by the store when one is supplied.\n */\nfunction asOfValue(\n context: DatasetContext,\n node: ExprNode | undefined,\n):\n | { readonly kind: 'values'; readonly value: string | undefined }\n | {\n readonly kind: 'undetermined';\n readonly value: Evaluated;\n } {\n if (node === undefined) return { kind: 'values', value: undefined };\n const mark = context.taintMark();\n const evaluated = context.evaluate(node);\n // An as-of date travels in the provenance, so a withheld value for it makes the call\n // undecided rather than quoting what the report must withhold.\n if (context.touchedWithheld(mark)) {\n return { kind: 'undetermined', value: valueOf(UNKNOWN) };\n }\n if (evaluated.kind === 'absent' || evaluated.value === null) {\n return { kind: 'undetermined', value: valueOf(UNKNOWN) };\n }\n if (isUndetermined(evaluated.value)) return { kind: 'undetermined', value: evaluated };\n if (typeof evaluated.value !== 'string') {\n throw new AxiomError('ENGINE_ERROR', 'an as-of value must be a date');\n }\n return { kind: 'values', value: evaluated.value };\n}\n\n/** One resolution as the value the expression sees. */\nfunction datasetResult(\n context: DatasetContext,\n resolution: LookupResolution,\n tableId: string,\n): Evaluated {\n // Every resolution that reached a table records where it resolved, hit or miss\n // (), so a report reproduces the question as well as the\n // answer.\n context.recordResolution(resolution);\n switch (resolution.outcome) {\n case 'HIT': {\n // The table's declared output columns travel beside the values the store handed back,\n // so a member read through a comprehension is the decimal the column declares.\n const memberDomains = outputMemberDomains(context, tableId);\n // The output record is closed by the table's columns: its members are known even where a\n // store implements no `columns` capability, because the row itself states them. Attaching\n // the ordered names is what lets `keys`/`values` read a dataset row deterministically\n // instead of inferring a type from whatever a store chose to emit in one call.\n const closedMembers = memberDomains === undefined ? undefined : Object.keys(memberDomains);\n if (resolution.hitPolicy === 'COLLECT') {\n const outputs = resolution.rows.map((row) => rowOutput(row, tableId));\n const list = valueOf(outputs);\n return {\n ...list,\n ...(memberDomains === undefined\n ? {}\n : { elementMemberDomains: outputs.map(() => memberDomains) }),\n ...(closedMembers === undefined\n ? { elementClosedMembers: outputs.map((output) => Object.keys(output)) }\n : { elementClosedMembers: outputs.map(() => closedMembers) }),\n };\n }\n const [row, ...rest] = resolution.rows;\n if (row === undefined) {\n throw new AxiomError('ENGINE_ERROR', `table ${tableId} hit with no row`, tableId);\n }\n // One key resolves one row under `UNIQUE` and `FIRST`: a resolution that hands back two\n // is a table the policy cannot honour, and answering the first would let a store's row\n // order decide the result ( `DATA-3.1.1`). The store that holds the table refuses such a\n // document when it installs it; a store the caller wrote is refused here.\n if (rest.length > 0) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `table ${tableId} returned ${String(resolution.rows.length)} rows for one key under ${resolution.hitPolicy}`,\n tableId,\n );\n }\n const output = rowOutput(row, tableId);\n return {\n ...valueOf(output),\n ...(memberDomains === undefined ? {} : { memberDomains }),\n ...(closedMembers === undefined\n ? { closedMembers: Object.keys(output) }\n : { closedMembers }),\n };\n }\n case 'MISS':\n // An empty collection is a decided empty list; a missed single hit is a reading this\n // device does not hold, so it answers `UNKNOWN` rather than a fabricated row.\n return resolution.hitPolicy === 'COLLECT' ? valueOf([]) : valueOf(UNKNOWN);\n case 'UNDETERMINED': {\n // A store cannot hide two decided UNIQUE matches behind an undetermined verdict. One\n // decided match beside an undetermined row is valid; a second decided match is the\n // duplicate the policy refuses wherever it is applied (`DATA-3.1.1`, `DATA-3.1.2`).\n //\n // A decided match is a row whose own `outcome` is `PASS`. A row that states none states no\n // verdict — a `lookup` row declares no outcome at all (`DATA-1.2.4`) — so the guard does\n // not credit it as a decision the store never stated; the port contract is that a\n // `decision_table` row always carries one, and a store that leaves it out is answered as\n // undetermined rather than refused for a duplicate it did not report.\n const decided = resolution.rows?.filter((row) => row.outcome === 'PASS').length ?? 0;\n if (resolution.hitPolicy === 'UNIQUE' && decided > 1) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `table ${tableId} returned ${String(decided)} decided matches for one key under UNIQUE`,\n tableId,\n );\n }\n return valueOf(resolution.value === 'UNKNOWN' ? UNKNOWN : DEFERRED);\n }\n case 'STALE':\n context.lookups.recordStaleData(tableId, resolution.reason);\n return valueOf(UNKNOWN);\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ExprNode } from '../../model/types.js';
|
|
2
|
+
import type { BinderPaths } from '../paths.js';
|
|
3
|
+
import type { BinderScope } from './binder.js';
|
|
4
|
+
import type { ExpressionHost } from './host.js';
|
|
5
|
+
import type { Evaluated } from './value.js';
|
|
6
|
+
/** The evaluator operations `digest` needs. */
|
|
7
|
+
export interface DigestContext {
|
|
8
|
+
evaluate(node: ExprNode): Evaluated;
|
|
9
|
+
readonly scopes: BinderScope[];
|
|
10
|
+
readonly paths: BinderPaths;
|
|
11
|
+
readonly host: ExpressionHost;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `digest(coveredTargets, schemaVersion)`.
|
|
15
|
+
*
|
|
16
|
+
* The targets are the paths the list literal names, in the order it names them, so the
|
|
17
|
+
* binding covers `(fieldId, rowKey?)` identities and the current canonical value behind
|
|
18
|
+
* each one. A target this device cannot read makes the digest
|
|
19
|
+
* undetermined, and a target whose row identity cannot be resolved is refused: neither
|
|
20
|
+
* may answer a digest that a verifier could mistake for a valid one.
|
|
21
|
+
*/
|
|
22
|
+
export declare function digestCall(context: DigestContext, args: readonly ExprNode[]): Evaluated;
|
|
23
|
+
//# sourceMappingURL=digest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../../src/eval/expr/digest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAG/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AAE5D,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,CAyCvF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { signatureBinding } from '../../canonical/signature.js';
|
|
2
|
+
import { AxiomError } from '../../model/errors.js';
|
|
3
|
+
import { isUndetermined, UNKNOWN } from '../../model/types.js';
|
|
4
|
+
import { isSafeInteger } from '../../model/values.js';
|
|
5
|
+
import { scopeFor } from './binder.js';
|
|
6
|
+
import { valueOf } from './value.js';
|
|
7
|
+
/**
|
|
8
|
+
* `digest(coveredTargets, schemaVersion)`.
|
|
9
|
+
*
|
|
10
|
+
* The targets are the paths the list literal names, in the order it names them, so the
|
|
11
|
+
* binding covers `(fieldId, rowKey?)` identities and the current canonical value behind
|
|
12
|
+
* each one. A target this device cannot read makes the digest
|
|
13
|
+
* undetermined, and a target whose row identity cannot be resolved is refused: neither
|
|
14
|
+
* may answer a digest that a verifier could mistake for a valid one.
|
|
15
|
+
*/
|
|
16
|
+
export function digestCall(context, args) {
|
|
17
|
+
const [targets, versionNode] = args;
|
|
18
|
+
if (args.length !== 2 || targets === undefined || versionNode === undefined) {
|
|
19
|
+
throw new AxiomError('ENGINE_ERROR', 'digest takes a target list and a schema version');
|
|
20
|
+
}
|
|
21
|
+
if (targets.kind !== 'list') {
|
|
22
|
+
throw new AxiomError('ENGINE_ERROR', 'digest requires a list of covered targets', 'digest');
|
|
23
|
+
}
|
|
24
|
+
// A signature binds the values it covers, and `signature_ref` requires at least one
|
|
25
|
+
// target: an empty coverage can never be verified, so it is refused
|
|
26
|
+
// rather than answered with a digest nothing can declare.
|
|
27
|
+
if (targets.items.length === 0) {
|
|
28
|
+
throw new AxiomError('ENGINE_ERROR', 'digest requires at least one covered target', 'digest');
|
|
29
|
+
}
|
|
30
|
+
const version = context.evaluate(versionNode);
|
|
31
|
+
if (version.kind === 'absent' || version.value === null)
|
|
32
|
+
return valueOf(UNKNOWN);
|
|
33
|
+
if (isUndetermined(version.value))
|
|
34
|
+
return version;
|
|
35
|
+
if (typeof version.value !== 'number' || !isSafeInteger(version.value) || version.value < 1) {
|
|
36
|
+
throw new AxiomError('ENGINE_ERROR', 'digest requires a positive integer schemaVersion', 'digest');
|
|
37
|
+
}
|
|
38
|
+
const covered = [];
|
|
39
|
+
let deferred;
|
|
40
|
+
for (const target of targets.items) {
|
|
41
|
+
if (target.kind !== 'path') {
|
|
42
|
+
throw new AxiomError('ENGINE_ERROR', 'each covered target names one field', 'digest');
|
|
43
|
+
}
|
|
44
|
+
const evaluated = context.evaluate(target);
|
|
45
|
+
if (evaluated.kind === 'absent')
|
|
46
|
+
return valueOf(UNKNOWN);
|
|
47
|
+
if (isUndetermined(evaluated.value)) {
|
|
48
|
+
if (evaluated.value.undetermined === 'UNKNOWN')
|
|
49
|
+
return evaluated;
|
|
50
|
+
deferred ??= evaluated;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
covered.push({ target: coveredRef(context, target.path), value: evaluated.value });
|
|
54
|
+
}
|
|
55
|
+
if (deferred !== undefined)
|
|
56
|
+
return deferred;
|
|
57
|
+
return valueOf(signatureBinding(covered, version.value), 'string');
|
|
58
|
+
}
|
|
59
|
+
/** The immutable reference one covered target path names. */
|
|
60
|
+
function coveredRef(context, path) {
|
|
61
|
+
const segments = context.paths.segmentsOf(path);
|
|
62
|
+
const head = segments[0] ?? '';
|
|
63
|
+
const fieldId = segments[segments.length - 1];
|
|
64
|
+
if (fieldId === undefined) {
|
|
65
|
+
throw new AxiomError('ENGINE_ERROR', 'a covered target names a field', path);
|
|
66
|
+
}
|
|
67
|
+
const scope = scopeFor(context.scopes, head);
|
|
68
|
+
if (scope === undefined)
|
|
69
|
+
return { fieldId };
|
|
70
|
+
// Only the current element's binders name the row the scope addresses: `$prev`/`$next`
|
|
71
|
+
// read a neighbour's value, and binding it under this row's key would be a coverage
|
|
72
|
+
// target that names one row and binds another.
|
|
73
|
+
if (head !== '$it' && head !== scope.name) {
|
|
74
|
+
throw new AxiomError('ENGINE_ERROR', 'a covered target names the row its scope addresses, never a neighbour', path);
|
|
75
|
+
}
|
|
76
|
+
// A binder alone names a whole element, not a field of one.
|
|
77
|
+
if (segments.length < 2) {
|
|
78
|
+
throw new AxiomError('ENGINE_ERROR', 'a covered target names a field', path);
|
|
79
|
+
}
|
|
80
|
+
if (scope.origin === undefined) {
|
|
81
|
+
throw new AxiomError('ENGINE_ERROR', 'the row this covered target belongs to cannot be identified', path);
|
|
82
|
+
}
|
|
83
|
+
const rowKey = context.host.rowKeyOf(scope.origin, scope.index);
|
|
84
|
+
if (rowKey === undefined) {
|
|
85
|
+
throw new AxiomError('ENGINE_ERROR', 'the covered target rowKey cannot be resolved', scope.origin);
|
|
86
|
+
}
|
|
87
|
+
return { fieldId, rowKey };
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=digest.js.map
|
|
@@ -0,0 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M,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,UAAU,CAClB,cAAc,EACd,8CAA8C,EAC9C,KAAK,CAAC,MAAM,CACb,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["import type { CoveredValue } from '../../canonical/signature.js';\nimport { signatureBinding } from '../../canonical/signature.js';\nimport { AxiomError } from '../../model/errors.js';\nimport type { ExprNode, FieldRef } from '../../model/types.js';\nimport { isUndetermined, UNKNOWN } from '../../model/types.js';\nimport { isSafeInteger } from '../../model/values.js';\nimport type { BinderPaths } from '../paths.js';\nimport type { BinderScope } from './binder.js';\nimport { scopeFor } from './binder.js';\nimport type { ExpressionHost } from './host.js';\nimport { valueOf } from './value.js';\nimport type { Evaluated, EvaluatedValue } from './value.js';\n\n/** The evaluator operations `digest` needs. */\nexport interface DigestContext {\n evaluate(node: ExprNode): Evaluated;\n readonly scopes: BinderScope[];\n readonly paths: BinderPaths;\n readonly host: ExpressionHost;\n}\n\n/**\n * `digest(coveredTargets, schemaVersion)`.\n *\n * The targets are the paths the list literal names, in the order it names them, so the\n * binding covers `(fieldId, rowKey?)` identities and the current canonical value behind\n * each one. A target this device cannot read makes the digest\n * undetermined, and a target whose row identity cannot be resolved is refused: neither\n * may answer a digest that a verifier could mistake for a valid one.\n */\nexport function digestCall(context: DigestContext, args: readonly ExprNode[]): Evaluated {\n const [targets, versionNode] = args;\n if (args.length !== 2 || targets === undefined || versionNode === undefined) {\n throw new AxiomError('ENGINE_ERROR', 'digest takes a target list and a schema version');\n }\n if (targets.kind !== 'list') {\n throw new AxiomError('ENGINE_ERROR', 'digest requires a list of covered targets', 'digest');\n }\n // A signature binds the values it covers, and `signature_ref` requires at least one\n // target: an empty coverage can never be verified, so it is refused\n // rather than answered with a digest nothing can declare.\n if (targets.items.length === 0) {\n throw new AxiomError('ENGINE_ERROR', 'digest requires at least one covered target', 'digest');\n }\n const version = context.evaluate(versionNode);\n if (version.kind === 'absent' || version.value === null) return valueOf(UNKNOWN);\n if (isUndetermined(version.value)) return version;\n if (typeof version.value !== 'number' || !isSafeInteger(version.value) || version.value < 1) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'digest requires a positive integer schemaVersion',\n 'digest',\n );\n }\n const covered: CoveredValue[] = [];\n let deferred: EvaluatedValue | undefined;\n for (const target of targets.items) {\n if (target.kind !== 'path') {\n throw new AxiomError('ENGINE_ERROR', 'each covered target names one field', 'digest');\n }\n const evaluated = context.evaluate(target);\n if (evaluated.kind === 'absent') return valueOf(UNKNOWN);\n if (isUndetermined(evaluated.value)) {\n if (evaluated.value.undetermined === 'UNKNOWN') return evaluated;\n deferred ??= evaluated;\n continue;\n }\n covered.push({ target: coveredRef(context, target.path), value: evaluated.value });\n }\n if (deferred !== undefined) return deferred;\n return valueOf(signatureBinding(covered, version.value), 'string');\n}\n\n/** The immutable reference one covered target path names. */\nfunction coveredRef(context: DigestContext, path: string): FieldRef {\n const segments = context.paths.segmentsOf(path);\n const head = segments[0] ?? '';\n const fieldId = segments[segments.length - 1];\n if (fieldId === undefined) {\n throw new AxiomError('ENGINE_ERROR', 'a covered target names a field', path);\n }\n const scope = scopeFor(context.scopes, head);\n if (scope === undefined) return { fieldId };\n // Only the current element's binders name the row the scope addresses: `$prev`/`$next`\n // read a neighbour's value, and binding it under this row's key would be a coverage\n // target that names one row and binds another.\n if (head !== '$it' && head !== scope.name) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'a covered target names the row its scope addresses, never a neighbour',\n path,\n );\n }\n // A binder alone names a whole element, not a field of one.\n if (segments.length < 2) {\n throw new AxiomError('ENGINE_ERROR', 'a covered target names a field', path);\n }\n if (scope.origin === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'the row this covered target belongs to cannot be identified',\n path,\n );\n }\n const rowKey = context.host.rowKeyOf(scope.origin, scope.index);\n if (rowKey === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'the covered target rowKey cannot be resolved',\n scope.origin,\n );\n }\n return { fieldId, rowKey };\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LiteralDomain, WireValue } from '../../model/types.js';
|
|
2
|
+
/** One evaluated list member, as far as its domain is concerned. */
|
|
3
|
+
interface DomainCarrier {
|
|
4
|
+
readonly kind: string;
|
|
5
|
+
readonly domain?: LiteralDomain | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The domain of every element a list literal produced, in element order. An absent element
|
|
9
|
+
* states none. The list node attaches this so a list that later becomes a plain wire array
|
|
10
|
+
* (through `if` or `??`) still answers per-element domain questions from its declaration.
|
|
11
|
+
*/
|
|
12
|
+
export declare function elementDomainsOf(items: readonly DomainCarrier[]): readonly (LiteralDomain | undefined)[];
|
|
13
|
+
/**
|
|
14
|
+
* The element domains of a list value: the ones its producer attached, or the declared
|
|
15
|
+
* element domain of the array it was read from, or none for an open list.
|
|
16
|
+
*/
|
|
17
|
+
export declare function elementDomainsFor(items: readonly WireValue[], attached: readonly (LiteralDomain | undefined)[] | undefined, declared: LiteralDomain | undefined): readonly (LiteralDomain | undefined)[] | undefined;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=domains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/eval/expr/domains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAErE,oEAAoE;AACpE,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,aAAa,EAAE,GAC9B,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,EAAE,CAExC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,QAAQ,EAAE,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,EAAE,GAAG,SAAS,EAC5D,QAAQ,EAAE,aAAa,GAAG,SAAS,GAClC,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,EAAE,GAAG,SAAS,CAGpD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The domain of every element a list literal produced, in element order. An absent element
|
|
3
|
+
* states none. The list node attaches this so a list that later becomes a plain wire array
|
|
4
|
+
* (through `if` or `??`) still answers per-element domain questions from its declaration.
|
|
5
|
+
*/
|
|
6
|
+
export function elementDomainsOf(items) {
|
|
7
|
+
return items.map((item) => (item.kind === 'absent' ? undefined : item.domain));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The element domains of a list value: the ones its producer attached, or the declared
|
|
11
|
+
* element domain of the array it was read from, or none for an open list.
|
|
12
|
+
*/
|
|
13
|
+
export function elementDomainsFor(items, attached, declared) {
|
|
14
|
+
if (attached !== undefined)
|
|
15
|
+
return attached;
|
|
16
|
+
return declared === undefined ? undefined : items.map(() => declared);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=domains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../../../src/eval/expr/domains.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAA+B;IAE/B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAA2B,EAC3B,QAA4D,EAC5D,QAAmC;IAEnC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC5C,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import type { LiteralDomain, WireValue } from '../../model/types.js';\n\n/** One evaluated list member, as far as its domain is concerned. */\ninterface DomainCarrier {\n readonly kind: string;\n readonly domain?: LiteralDomain | undefined;\n}\n\n/**\n * The domain of every element a list literal produced, in element order. An absent element\n * states none. The list node attaches this so a list that later becomes a plain wire array\n * (through `if` or `??`) still answers per-element domain questions from its declaration.\n */\nexport function elementDomainsOf(\n items: readonly DomainCarrier[],\n): readonly (LiteralDomain | undefined)[] {\n return items.map((item) => (item.kind === 'absent' ? undefined : item.domain));\n}\n\n/**\n * The element domains of a list value: the ones its producer attached, or the declared\n * element domain of the array it was read from, or none for an open list.\n */\nexport function elementDomainsFor(\n items: readonly WireValue[],\n attached: readonly (LiteralDomain | undefined)[] | undefined,\n declared: LiteralDomain | undefined,\n): readonly (LiteralDomain | undefined)[] | undefined {\n if (attached !== undefined) return attached;\n return declared === undefined ? undefined : items.map(() => declared);\n}\n"]}
|