@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,41 @@
|
|
|
1
|
+
import type { DatasetColumn, LookupPort, LookupResolution, LookupTableDocument, ScalarWireValue, SetResolution, WireRecord } from '../model/types.js';
|
|
2
|
+
import type { DigestBearingPort } from './digest.js';
|
|
3
|
+
/**
|
|
4
|
+
* A columnar in-memory store. It owns set membership, composite-key
|
|
5
|
+
* resolution and decision-row selection for every kind of table; a larger backing store
|
|
6
|
+
* implements `LookupPort` instead, and Expr never learns which one answered.
|
|
7
|
+
*
|
|
8
|
+
* Keys and membership are indexed by canonical text, so a resolution is one map hit and a
|
|
9
|
+
* date selection is one binary search, whatever the table's size.
|
|
10
|
+
*
|
|
11
|
+
* The store retains exactly the catalog it was constructed with — one prepared index per
|
|
12
|
+
* installed document — and nothing per call: a resolution builds its answer and returns it, so
|
|
13
|
+
* a long-lived store's footprint is the tables it holds, not the queries made against them.
|
|
14
|
+
*/
|
|
15
|
+
export declare class MemoryLookupStore implements LookupPort, DigestBearingPort {
|
|
16
|
+
private readonly tables;
|
|
17
|
+
constructor(tables: readonly LookupTableDocument[]);
|
|
18
|
+
/**
|
|
19
|
+
* The canonical digest this store installed for one table version, or `undefined` when it
|
|
20
|
+
* holds no such version.
|
|
21
|
+
*
|
|
22
|
+
* This is what lets the evaluation path verify an artifact's pins at pairing: the store
|
|
23
|
+
* holds the document, so it can state the digest the document hashes to without the caller
|
|
24
|
+
* re-canonicalising it. A custom port may answer the same question to receive the same check.
|
|
25
|
+
*/
|
|
26
|
+
tableDigest(tableId: string, tableVersion: number): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The primitives this store can answer for a table's columns.
|
|
29
|
+
*
|
|
30
|
+
* Answered only when every retained version declares the same columns with the same primitives,
|
|
31
|
+
* so a member's domain never comes from a version the evaluation did not resolve. A table whose
|
|
32
|
+
* versions disagree is `undefined`, which leaves the value domainless and the aggregate
|
|
33
|
+
* undecided rather than typed by a guess.
|
|
34
|
+
*/
|
|
35
|
+
columns(tableId: string): readonly DatasetColumn[] | undefined;
|
|
36
|
+
contains(tableId: string, value: ScalarWireValue, recordDate?: string): SetResolution;
|
|
37
|
+
resolve(tableId: string, keys: readonly ScalarWireValue[], asOf?: string): LookupResolution;
|
|
38
|
+
decide(tableId: string, inputs: WireRecord, asOf?: string): LookupResolution;
|
|
39
|
+
decideKeys(tableId: string, keys: readonly ScalarWireValue[], asOf?: string): LookupResolution;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/lookup/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKrD;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAkB,YAAW,UAAU,EAAE,iBAAiB;IACrE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAE5D,YAAY,MAAM,EAAE,SAAS,mBAAmB,EAAE,EAEjD;IAED;;;;;;;OAOG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIrE;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,aAAa,EAAE,GAAG,SAAS,CAgB7D;IAED,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,CAEpF;IAED,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,eAAe,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAE1F;IAED,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAE3E;IAED,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,eAAe,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAE7F;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { prepareInstallation } from './install.js';
|
|
2
|
+
import { containsMember, decideInputs, decideKeyVector, resolveKeyed } from './resolve.js';
|
|
3
|
+
/**
|
|
4
|
+
* A columnar in-memory store. It owns set membership, composite-key
|
|
5
|
+
* resolution and decision-row selection for every kind of table; a larger backing store
|
|
6
|
+
* implements `LookupPort` instead, and Expr never learns which one answered.
|
|
7
|
+
*
|
|
8
|
+
* Keys and membership are indexed by canonical text, so a resolution is one map hit and a
|
|
9
|
+
* date selection is one binary search, whatever the table's size.
|
|
10
|
+
*
|
|
11
|
+
* The store retains exactly the catalog it was constructed with — one prepared index per
|
|
12
|
+
* installed document — and nothing per call: a resolution builds its answer and returns it, so
|
|
13
|
+
* a long-lived store's footprint is the tables it holds, not the queries made against them.
|
|
14
|
+
*/
|
|
15
|
+
export class MemoryLookupStore {
|
|
16
|
+
tables;
|
|
17
|
+
constructor(tables) {
|
|
18
|
+
this.tables = prepareInstallation(tables);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The canonical digest this store installed for one table version, or `undefined` when it
|
|
22
|
+
* holds no such version.
|
|
23
|
+
*
|
|
24
|
+
* This is what lets the evaluation path verify an artifact's pins at pairing: the store
|
|
25
|
+
* holds the document, so it can state the digest the document hashes to without the caller
|
|
26
|
+
* re-canonicalising it. A custom port may answer the same question to receive the same check.
|
|
27
|
+
*/
|
|
28
|
+
tableDigest(tableId, tableVersion) {
|
|
29
|
+
return this.tables
|
|
30
|
+
.get(tableId)
|
|
31
|
+
?.versions.find((version) => version.document.tableVersion === tableVersion)?.digest;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The primitives this store can answer for a table's columns.
|
|
35
|
+
*
|
|
36
|
+
* Answered only when every retained version declares the same columns with the same primitives,
|
|
37
|
+
* so a member's domain never comes from a version the evaluation did not resolve. A table whose
|
|
38
|
+
* versions disagree is `undefined`, which leaves the value domainless and the aggregate
|
|
39
|
+
* undecided rather than typed by a guess.
|
|
40
|
+
*/
|
|
41
|
+
columns(tableId) {
|
|
42
|
+
const versions = this.tables.get(tableId)?.versions;
|
|
43
|
+
const first = versions?.[0]?.document.columns;
|
|
44
|
+
if (versions === undefined || first === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
for (const version of versions) {
|
|
47
|
+
const columns = version.document.columns;
|
|
48
|
+
if (columns === undefined || columns.length !== first.length)
|
|
49
|
+
return undefined;
|
|
50
|
+
for (const [index, column] of columns.entries()) {
|
|
51
|
+
const declared = first[index];
|
|
52
|
+
if (declared === undefined)
|
|
53
|
+
return undefined;
|
|
54
|
+
if (column.columnId !== declared.columnId || column.primitive !== declared.primitive) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return first;
|
|
60
|
+
}
|
|
61
|
+
contains(tableId, value, recordDate) {
|
|
62
|
+
return containsMember(this.tables, tableId, value, recordDate);
|
|
63
|
+
}
|
|
64
|
+
resolve(tableId, keys, asOf) {
|
|
65
|
+
return resolveKeyed(this.tables, tableId, keys, asOf);
|
|
66
|
+
}
|
|
67
|
+
decide(tableId, inputs, asOf) {
|
|
68
|
+
return decideInputs(this.tables, tableId, inputs, asOf);
|
|
69
|
+
}
|
|
70
|
+
decideKeys(tableId, keys, asOf) {
|
|
71
|
+
return decideKeyVector(this.tables, tableId, keys, asOf);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/lookup/store.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE3F;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,iBAAiB;IACX,MAAM,CAAqC;IAE5D,YAAY,MAAsC;QAChD,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACH,WAAW,CAAC,OAAe,EAAE,YAAoB;QAC/C,OAAO,IAAI,CAAC,MAAM;aACf,GAAG,CAAC,OAAO,CAAC;YACb,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,KAAK,YAAY,CAAC,EAAE,MAAM,CAAC;IACzF,CAAC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,OAAe;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC;QACpD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;QAC9C,IAAI,QAA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I,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["import type {\n DatasetColumn,\n LookupPort,\n LookupResolution,\n LookupTableDocument,\n ScalarWireValue,\n SetResolution,\n WireRecord,\n} from '../model/types.js';\nimport type { DigestBearingPort } from './digest.js';\nimport type { PreparedTable } from './install.js';\nimport { prepareInstallation } from './install.js';\nimport { containsMember, decideInputs, decideKeyVector, resolveKeyed } from './resolve.js';\n\n/**\n * A columnar in-memory store. It owns set membership, composite-key\n * resolution and decision-row selection for every kind of table; a larger backing store\n * implements `LookupPort` instead, and Expr never learns which one answered.\n *\n * Keys and membership are indexed by canonical text, so a resolution is one map hit and a\n * date selection is one binary search, whatever the table's size.\n *\n * The store retains exactly the catalog it was constructed with — one prepared index per\n * installed document — and nothing per call: a resolution builds its answer and returns it, so\n * a long-lived store's footprint is the tables it holds, not the queries made against them.\n */\nexport class MemoryLookupStore implements LookupPort, DigestBearingPort {\n private readonly tables: ReadonlyMap<string, PreparedTable>;\n\n constructor(tables: readonly LookupTableDocument[]) {\n this.tables = prepareInstallation(tables);\n }\n\n /**\n * The canonical digest this store installed for one table version, or `undefined` when it\n * holds no such version.\n *\n * This is what lets the evaluation path verify an artifact's pins at pairing: the store\n * holds the document, so it can state the digest the document hashes to without the caller\n * re-canonicalising it. A custom port may answer the same question to receive the same check.\n */\n tableDigest(tableId: string, tableVersion: number): string | undefined {\n return this.tables\n .get(tableId)\n ?.versions.find((version) => version.document.tableVersion === tableVersion)?.digest;\n }\n\n /**\n * The primitives this store can answer for a table's columns.\n *\n * Answered only when every retained version declares the same columns with the same primitives,\n * so a member's domain never comes from a version the evaluation did not resolve. A table whose\n * versions disagree is `undefined`, which leaves the value domainless and the aggregate\n * undecided rather than typed by a guess.\n */\n columns(tableId: string): readonly DatasetColumn[] | undefined {\n const versions = this.tables.get(tableId)?.versions;\n const first = versions?.[0]?.document.columns;\n if (versions === undefined || first === undefined) return undefined;\n for (const version of versions) {\n const columns = version.document.columns;\n if (columns === undefined || columns.length !== first.length) return undefined;\n for (const [index, column] of columns.entries()) {\n const declared = first[index];\n if (declared === undefined) return undefined;\n if (column.columnId !== declared.columnId || column.primitive !== declared.primitive) {\n return undefined;\n }\n }\n }\n return first;\n }\n\n contains(tableId: string, value: ScalarWireValue, recordDate?: string): SetResolution {\n return containsMember(this.tables, tableId, value, recordDate);\n }\n\n resolve(tableId: string, keys: readonly ScalarWireValue[], asOf?: string): LookupResolution {\n return resolveKeyed(this.tables, tableId, keys, asOf);\n }\n\n decide(tableId: string, inputs: WireRecord, asOf?: string): LookupResolution {\n return decideInputs(this.tables, tableId, inputs, asOf);\n }\n\n decideKeys(tableId: string, keys: readonly ScalarWireValue[], asOf?: string): LookupResolution {\n return decideKeyVector(this.tables, tableId, keys, asOf);\n }\n}\n"]}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { FieldAccess, FieldRef, LookupPort, Tier } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The host-supplied access vocabulary, `spec/semantics/access-v1.md` section 2.
|
|
4
|
+
*
|
|
5
|
+
* RBAC stays outside the schema: the host owns roles and hands the engine an overlay, and
|
|
6
|
+
* the engine resolves it. This module is the only home of the overlay's shape and its only
|
|
7
|
+
* boundary parser, so a malformed overlay is refused before it can decide a read, reach a
|
|
8
|
+
* report or move a report hash.
|
|
9
|
+
*/
|
|
10
|
+
/** The four specificity levels of one overlay rule, `[ACCESS-2.1.1]`. */
|
|
11
|
+
export type AccessOverlayKind = 'exact' | 'template' | 'container' | 'section';
|
|
12
|
+
/**
|
|
13
|
+
* One overlay rule: a specificity level, the immutable identifier it matches and the state
|
|
14
|
+
* it grants. Matches are never display paths (`[ACCESS-2.1.4]`): an `exact` rule names a
|
|
15
|
+
* `fieldId` or `fieldId@rowKey`, a `template` names `fieldId@*`, a `container` names a
|
|
16
|
+
* record `fieldId` (the `fieldId.*` spelling `[ACCESS-2.1.3]` states names the same record)
|
|
17
|
+
* and a `section` names the `sectionId` a field's annotations carry.
|
|
18
|
+
*/
|
|
19
|
+
export interface AccessOverlayRule {
|
|
20
|
+
readonly kind: AccessOverlayKind;
|
|
21
|
+
readonly match: string;
|
|
22
|
+
readonly access: FieldAccess;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The 5-state 4-level overlay a host resolves its roles into.
|
|
26
|
+
*
|
|
27
|
+
* The overlay is the authority for `accessVersion`: the report derives its version from the
|
|
28
|
+
* resolved overlay, and the environment may only assert the same version. An absent
|
|
29
|
+
* `defaultAccess` resolves to the fail-closed `read_only` (`[ACCESS-2.1.2]`).
|
|
30
|
+
*
|
|
31
|
+
* The overlay is presentation and consistency, never authorisation: the client is untrusted,
|
|
32
|
+
* so the host API redacts on read and authorises on write (`[ACCESS-7.1.1]`).
|
|
33
|
+
*/
|
|
34
|
+
export interface AccessOverlay {
|
|
35
|
+
readonly accessVersion: number;
|
|
36
|
+
readonly defaultAccess: FieldAccess;
|
|
37
|
+
/**
|
|
38
|
+
* Fields whose `masked` or `hidden` state is lifted for expression reads only. A
|
|
39
|
+
* `write_only` value is never lifted, and delivery to a device is never widened
|
|
40
|
+
* (`[ACCESS-1.3.2]`, `[ACCESS-1.3.3]`).
|
|
41
|
+
*/
|
|
42
|
+
readonly allowMaskedRead?: readonly string[];
|
|
43
|
+
readonly rules: readonly AccessOverlayRule[];
|
|
44
|
+
}
|
|
45
|
+
/** One reference in a host-resolved access projection. */
|
|
46
|
+
export interface AccessEntry extends FieldRef {
|
|
47
|
+
readonly access: FieldAccess;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The one access source an evaluation may state.
|
|
51
|
+
*
|
|
52
|
+
* A host resolves access once, either into the runtime's 4-level `overlay` or into the flattened
|
|
53
|
+
* per-reference `access` projection, and both answer the same question. Stating both leaves two
|
|
54
|
+
* answers that cannot be reconciled, so this is a union rather than two optional members: a
|
|
55
|
+
* TypeScript host that supplies both is refused by the compiler, and the readers
|
|
56
|
+
* (`toEvaluationInput`, `toSubmissionInput`) refuse the same call from JavaScript. A host that
|
|
57
|
+
* states neither keeps the fail-closed default in which every field resolves to `read_only`.
|
|
58
|
+
*
|
|
59
|
+
* The absent member is spelled `?: undefined`, not `?: never`: an explicitly-undefined member is
|
|
60
|
+
* the same absence to every reader, and JavaScript callers write it (a spread of an optional
|
|
61
|
+
* prop, a rebuilt literal). `undefined` still refuses the other source's value, so the pair a
|
|
62
|
+
* caller cannot mean remains unrepresentable.
|
|
63
|
+
*
|
|
64
|
+
* One declaration serves both doors — `EvaluationInput` and `SubmissionAuthority` — and
|
|
65
|
+
* `FormProviderAccess` in `@azx-pbc/axiom-react` is the same shape for the provider's props, so
|
|
66
|
+
* the rule cannot be spelled three ways.
|
|
67
|
+
*/
|
|
68
|
+
export type AccessSource = {
|
|
69
|
+
readonly overlay: AccessOverlay;
|
|
70
|
+
readonly access?: undefined;
|
|
71
|
+
} | {
|
|
72
|
+
readonly access: readonly AccessEntry[];
|
|
73
|
+
readonly overlay?: undefined;
|
|
74
|
+
} | {
|
|
75
|
+
readonly overlay?: undefined;
|
|
76
|
+
readonly access?: undefined;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* What a caller supplies for one evaluation, per `spec/semantics/context-v1.md`.
|
|
80
|
+
*
|
|
81
|
+
* `values` is the record; `context` is the roots the caller hydrated; `redacted` and
|
|
82
|
+
* `sessionWrites` are the references the host handled. The access answer is `AccessSource`, so
|
|
83
|
+
* the overlay model and the flattened-projection model are alternatives rather than two
|
|
84
|
+
* independent members — the pair a caller cannot mean is not a value TypeScript admits.
|
|
85
|
+
*/
|
|
86
|
+
export type EvaluationInput = {
|
|
87
|
+
/** Submitted values keyed by `fieldId`. Canonical wire values only. */
|
|
88
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
89
|
+
/** Declared context roots keyed without the `context.` prefix. */
|
|
90
|
+
readonly context?: Readonly<Record<string, unknown>>;
|
|
91
|
+
/** Values the server withheld from this device. */
|
|
92
|
+
readonly redacted?: readonly FieldRef[];
|
|
93
|
+
/**
|
|
94
|
+
* Values written in the current session.
|
|
95
|
+
*
|
|
96
|
+
* A reference this session wrote holds the device's own value: a `write_only` value reads back
|
|
97
|
+
* through it, and a reference the host also listed in `redacted` is no longer the server's to
|
|
98
|
+
* withhold. The match is per reference, so a write to one row or one field never unlocks a
|
|
99
|
+
* sibling the server still holds.
|
|
100
|
+
*/
|
|
101
|
+
readonly sessionWrites?: readonly FieldRef[];
|
|
102
|
+
} & AccessSource;
|
|
103
|
+
/**
|
|
104
|
+
* What only the host may state about one untrusted submission.
|
|
105
|
+
*
|
|
106
|
+
* A submission body is the record and nothing else. The access overlay, the context the host
|
|
107
|
+
* hydrated, the fields it withheld and the values this session wrote are the host's answers
|
|
108
|
+
* about the request — reading them from the body would let the client decide the question it
|
|
109
|
+
* is being judged by — so `toSubmissionInput` takes them here instead, as the typed value the
|
|
110
|
+
* host already holds. `lookup` is the same seam one level out: a resolution port is a
|
|
111
|
+
* behaviour, not JSON, and `toEvaluationEnv` carries it into the environment untouched.
|
|
112
|
+
*/
|
|
113
|
+
export type SubmissionAuthority = {
|
|
114
|
+
/** Declared context roots the host hydrated, keyed without the `context.` prefix. */
|
|
115
|
+
readonly context?: Readonly<Record<string, unknown>>;
|
|
116
|
+
/** Values the host withheld from the device that sent the body. */
|
|
117
|
+
readonly redacted?: readonly FieldRef[];
|
|
118
|
+
/** Values written in the session that sent the body. */
|
|
119
|
+
readonly sessionWrites?: readonly FieldRef[];
|
|
120
|
+
/**
|
|
121
|
+
* The record the server already holds, keyed by declared `fieldId`.
|
|
122
|
+
*
|
|
123
|
+
* A submission body carries the principal's answers only; a binding the principal may not
|
|
124
|
+
* write is the server's record, not the client's claim. The door evaluates the merged record
|
|
125
|
+
* (`heldValues` beneath the body's writable answers), so a rule that reads a `read_only`
|
|
126
|
+
* binding reads the server's value and a forged body cannot flip a verdict. It is read only
|
|
127
|
+
* under a `kind: 'access'` stance, which is what names the bindings the principal may write;
|
|
128
|
+
* the body's value for a binding that stance refuses is a refusal, never an override.
|
|
129
|
+
*/
|
|
130
|
+
readonly heldValues?: Readonly<Record<string, unknown>>;
|
|
131
|
+
/** The table store the host resolves declared datasets from. */
|
|
132
|
+
readonly lookup?: LookupPort;
|
|
133
|
+
/**
|
|
134
|
+
* The authority is what only the host states, and the record is not part of it: `toSubmissionInput`
|
|
135
|
+
* reads `values` from the body alone, so a `values` admitted here would be inert. The type
|
|
136
|
+
* refuses it because it is the member a value that merges the two (a stored projection, a
|
|
137
|
+
* request the host folded its authority into) carries — and admitting it would claim this door
|
|
138
|
+
* reads a record it never reads. `toSubmissionInput` refuses the same member at
|
|
139
|
+
* `authority.values` for a JavaScript caller, rather than silently answering from the body's
|
|
140
|
+
* record.
|
|
141
|
+
*/
|
|
142
|
+
readonly values?: never;
|
|
143
|
+
} & AccessSource;
|
|
144
|
+
/** Everything about the call that is not the record: tier, overlay version and capabilities. */
|
|
145
|
+
export interface EvaluationEnv {
|
|
146
|
+
/**
|
|
147
|
+
* The tier being evaluated. Absent means `DEFAULT_EVALUATION_TIER` (`client`), the fail-closed
|
|
148
|
+
* local door: a server rule defers rather than running on a host that never claimed server
|
|
149
|
+
* authority. A server host that decides those rules names `server` explicitly.
|
|
150
|
+
*/
|
|
151
|
+
readonly tier?: Tier;
|
|
152
|
+
/**
|
|
153
|
+
* The access version the caller believes it is evaluating under. It is not an authority:
|
|
154
|
+
* a call that also supplies an overlay is refused when the two disagree, so a report
|
|
155
|
+
* cannot state a version its overlay never had (`[ACCESS-5.1.1]`).
|
|
156
|
+
*/
|
|
157
|
+
readonly accessVersion?: number;
|
|
158
|
+
/**
|
|
159
|
+
* The local record date the host supplies: what `context.record_date` reads
|
|
160
|
+
* and the date an `in_set` call resolves a `data`-bound set against when
|
|
161
|
+
* the call names no `asOf` of its own. Absent, such a call stays stale
|
|
162
|
+
* (`missing_as_of`) rather than falling back to a clock.
|
|
163
|
+
*/
|
|
164
|
+
readonly recordDate?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Non-authorisation capability flags the host environment supplies.
|
|
167
|
+
* `has_cap` reports membership only: nothing in Expr infers access from a capability.
|
|
168
|
+
*/
|
|
169
|
+
readonly capabilities?: readonly string[];
|
|
170
|
+
/**
|
|
171
|
+
* The lookup store this evaluation resolves declared datasets from.
|
|
172
|
+
* Storage is a host decision, so the engine holds only this port; a store that keeps no
|
|
173
|
+
* table for a name an expression requires leaves that table missing.
|
|
174
|
+
*/
|
|
175
|
+
readonly lookup?: LookupPort;
|
|
176
|
+
}
|
|
177
|
+
/** The tier a local evaluation runs at: the caller's explicit value, or the fail-closed default. */
|
|
178
|
+
export declare function effectiveTier(env: Pick<EvaluationEnv, 'tier'>): Tier;
|
|
179
|
+
/**
|
|
180
|
+
* The overlay version a report can carry: a non-negative safe integer, spelled canonically.
|
|
181
|
+
*
|
|
182
|
+
* `accessVersion` is the one host-supplied leaf of a report body. It is stated by the overlay,
|
|
183
|
+
* by the environment of a call that supplies no overlay, and by the report the evaluator seals;
|
|
184
|
+
* one function decides it for all three, so a version the report could not carry is refused at
|
|
185
|
+
* its boundary rather than inside the hash that cannot represent it. `-0` is refused with the
|
|
186
|
+
* other non-integers: it serialises as `0`, so accepting it would let two in-memory values
|
|
187
|
+
* produce one report hash while a consumer sees two versions.
|
|
188
|
+
*/
|
|
189
|
+
export declare function asAccessVersion(value: unknown, path?: string): number;
|
|
190
|
+
/**
|
|
191
|
+
* Reads an untrusted overlay into the closed overlay shape.
|
|
192
|
+
*
|
|
193
|
+
* Every member is checked before it can decide a read: the version is a non-negative safe
|
|
194
|
+
* integer, the default is one of the five states, `allowMaskedRead` names declared fields,
|
|
195
|
+
* and every rule states a known kind, a non-empty match and a known access. A member outside
|
|
196
|
+
* the contract is refused with its path rather than ignored, because ignoring one would let
|
|
197
|
+
* an overlay mean something other than what its host wrote.
|
|
198
|
+
*/
|
|
199
|
+
export declare function toAccessOverlay(value: unknown, path?: string): AccessOverlay;
|
|
200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IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED,oGAAoG;AACpG,wBAAgB,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,IAAI,CAEpE;AA2CD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAoB,GAAG,MAAM,CAMhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAc,GAAG,aAAa,CAqBjF"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { AxiomError } from './errors.js';
|
|
2
|
+
import { isSafeInteger } from './integer.js';
|
|
3
|
+
import { DEFAULT_EVALUATION_TIER } from './types.js';
|
|
4
|
+
/** The tier a local evaluation runs at: the caller's explicit value, or the fail-closed default. */
|
|
5
|
+
export function effectiveTier(env) {
|
|
6
|
+
return env.tier ?? DEFAULT_EVALUATION_TIER;
|
|
7
|
+
}
|
|
8
|
+
const ACCESS_STATES = new Set([
|
|
9
|
+
'read_write',
|
|
10
|
+
'read_only',
|
|
11
|
+
'write_only',
|
|
12
|
+
'masked',
|
|
13
|
+
'hidden',
|
|
14
|
+
]);
|
|
15
|
+
const OVERLAY_KINDS = new Set(['exact', 'template', 'container', 'section']);
|
|
16
|
+
function refuse(path, message) {
|
|
17
|
+
throw new AxiomError('ENGINE_ERROR', message, path);
|
|
18
|
+
}
|
|
19
|
+
function expectRecord(value, path) {
|
|
20
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
21
|
+
refuse(path, 'must be an object');
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
function memberRecord(source, path, admitted, optional = []) {
|
|
26
|
+
const known = new Set([...admitted, ...optional]);
|
|
27
|
+
for (const key of Object.keys(source)) {
|
|
28
|
+
if (!known.has(key))
|
|
29
|
+
refuse(path, `unknown member ${JSON.stringify(key)}`);
|
|
30
|
+
}
|
|
31
|
+
return source;
|
|
32
|
+
}
|
|
33
|
+
function accessAt(value, path) {
|
|
34
|
+
if (typeof value !== 'string' || !ACCESS_STATES.has(value)) {
|
|
35
|
+
refuse(path, 'access must be one of read_write, read_only, write_only, masked, hidden');
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The overlay version a report can carry: a non-negative safe integer, spelled canonically.
|
|
41
|
+
*
|
|
42
|
+
* `accessVersion` is the one host-supplied leaf of a report body. It is stated by the overlay,
|
|
43
|
+
* by the environment of a call that supplies no overlay, and by the report the evaluator seals;
|
|
44
|
+
* one function decides it for all three, so a version the report could not carry is refused at
|
|
45
|
+
* its boundary rather than inside the hash that cannot represent it. `-0` is refused with the
|
|
46
|
+
* other non-integers: it serialises as `0`, so accepting it would let two in-memory values
|
|
47
|
+
* produce one report hash while a consumer sees two versions.
|
|
48
|
+
*/
|
|
49
|
+
export function asAccessVersion(value, path = '$.accessVersion') {
|
|
50
|
+
if (typeof value !== 'number' || !isSafeInteger(value)) {
|
|
51
|
+
refuse(path, 'accessVersion must be a safe integer');
|
|
52
|
+
}
|
|
53
|
+
if (value < 0)
|
|
54
|
+
refuse(path, 'accessVersion must not be negative');
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Reads an untrusted overlay into the closed overlay shape.
|
|
59
|
+
*
|
|
60
|
+
* Every member is checked before it can decide a read: the version is a non-negative safe
|
|
61
|
+
* integer, the default is one of the five states, `allowMaskedRead` names declared fields,
|
|
62
|
+
* and every rule states a known kind, a non-empty match and a known access. A member outside
|
|
63
|
+
* the contract is refused with its path rather than ignored, because ignoring one would let
|
|
64
|
+
* an overlay mean something other than what its host wrote.
|
|
65
|
+
*/
|
|
66
|
+
export function toAccessOverlay(value, path = '$.overlay') {
|
|
67
|
+
const source = expectRecord(value, path);
|
|
68
|
+
memberRecord(source, path, ['accessVersion', 'rules'], ['defaultAccess', 'allowMaskedRead']);
|
|
69
|
+
const accessVersion = asAccessVersion(source['accessVersion'], `${path}.accessVersion`);
|
|
70
|
+
// A host that does not state a default gets the fail-closed one, never an inferred grant.
|
|
71
|
+
const defaultAccess = source['defaultAccess'] === undefined
|
|
72
|
+
? 'read_only'
|
|
73
|
+
: accessAt(source['defaultAccess'], `${path}.defaultAccess`);
|
|
74
|
+
const allowMaskedRead = readAllowMaskedRead(source['allowMaskedRead'], `${path}.allowMaskedRead`);
|
|
75
|
+
const rules = source['rules'];
|
|
76
|
+
if (!Array.isArray(rules))
|
|
77
|
+
refuse(`${path}.rules`, 'rules must be an array');
|
|
78
|
+
const parsed = rules.map((rule, index) => readOverlayRule(rule, `${path}.rules[${String(index)}]`));
|
|
79
|
+
return {
|
|
80
|
+
accessVersion,
|
|
81
|
+
defaultAccess,
|
|
82
|
+
...(allowMaskedRead === undefined ? {} : { allowMaskedRead }),
|
|
83
|
+
rules: parsed,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function readAllowMaskedRead(value, path) {
|
|
87
|
+
if (value === undefined)
|
|
88
|
+
return undefined;
|
|
89
|
+
if (!Array.isArray(value))
|
|
90
|
+
refuse(path, 'allowMaskedRead must be an array');
|
|
91
|
+
return value.map((fieldId, index) => {
|
|
92
|
+
if (typeof fieldId !== 'string' || fieldId === '') {
|
|
93
|
+
refuse(`${path}[${String(index)}]`, 'allowMaskedRead names a fieldId');
|
|
94
|
+
}
|
|
95
|
+
return fieldId;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function readOverlayRule(value, path) {
|
|
99
|
+
const source = expectRecord(value, path);
|
|
100
|
+
memberRecord(source, path, ['kind', 'match', 'access']);
|
|
101
|
+
const kind = source['kind'];
|
|
102
|
+
if (typeof kind !== 'string' || !OVERLAY_KINDS.has(kind)) {
|
|
103
|
+
refuse(`${path}.kind`, 'kind must be one of exact, template, container, section');
|
|
104
|
+
}
|
|
105
|
+
const match = source['match'];
|
|
106
|
+
if (typeof match !== 'string' || match === '')
|
|
107
|
+
refuse(`${path}.match`, 'match must name an identifier');
|
|
108
|
+
// The level owns the spelling of its match: a template that is not `fieldId@*`, and an `@*`
|
|
109
|
+
// on any other level, are refused here rather than resolved by a guess. An `exact` rule's
|
|
110
|
+
// `fieldId@<rowKeyToken>` spelling is read by `parseRowMatch` in `eval/access/overlay.ts`,
|
|
111
|
+
// which owns the row-token grammar.
|
|
112
|
+
if (kind === 'template' &&
|
|
113
|
+
(match.length < 3 || !match.endsWith('@*') || match.indexOf('@') !== match.length - 2)) {
|
|
114
|
+
refuse(`${path}.match`, 'a template match is `fieldId@*`');
|
|
115
|
+
}
|
|
116
|
+
if (kind !== 'template' && match.includes('@*')) {
|
|
117
|
+
refuse(`${path}.match`, 'only a template match may use `@*`');
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
kind: kind,
|
|
121
|
+
match,
|
|
122
|
+
access: accessAt(source['access'], `${path}.access`),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/model/access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAqLrD,oGAAoG;AACpG,MAAM,UAAU,aAAa,CAAC,GAAgC;IAC5D,OAAO,GAAG,CAAC,IAAI,IAAI,uBAAuB,CAAC;AAC7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AAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,CAAC,GAAG,IAAI,OAAO,EAAE,yDAAyD,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE;QAC3C,MAAM,CAAC,GAAG,IAAI,QAAQ,EAAE,+BAA+B,CAAC,CAAC;IAC3D,4FAA4F;IAC5F,0FAA0F;IAC1F,2FAA2F;IAC3F,oCAAoC;IACpC,IACE,IAAI,KAAK,UAAU;QACnB,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EACtF,CAAC;QACD,MAAM,CAAC,GAAG,IAAI,QAAQ,EAAE,iCAAiC,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,CAAC,GAAG,IAAI,QAAQ,EAAE,oCAAoC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO;QACL,IAAI,EAAE,IAAyB;QAC/B,KAAK;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,IAAI,SAAS,CAAC;KACrD,CAAC;AACJ,CAAC","sourcesContent":["import { AxiomError } from './errors.js';\nimport { isSafeInteger } from './integer.js';\nimport { DEFAULT_EVALUATION_TIER } from './types.js';\nimport type { FieldAccess, FieldRef, LookupPort, Tier } from './types.js';\n\n/**\n * The host-supplied access vocabulary, `spec/semantics/access-v1.md` section 2.\n *\n * RBAC stays outside the schema: the host owns roles and hands the engine an overlay, and\n * the engine resolves it. This module is the only home of the overlay's shape and its only\n * boundary parser, so a malformed overlay is refused before it can decide a read, reach a\n * report or move a report hash.\n */\n\n/** The four specificity levels of one overlay rule, `[ACCESS-2.1.1]`. */\nexport type AccessOverlayKind = 'exact' | 'template' | 'container' | 'section';\n\n/**\n * One overlay rule: a specificity level, the immutable identifier it matches and the state\n * it grants. Matches are never display paths (`[ACCESS-2.1.4]`): an `exact` rule names a\n * `fieldId` or `fieldId@rowKey`, a `template` names `fieldId@*`, a `container` names a\n * record `fieldId` (the `fieldId.*` spelling `[ACCESS-2.1.3]` states names the same record)\n * and a `section` names the `sectionId` a field's annotations carry.\n */\nexport interface AccessOverlayRule {\n readonly kind: AccessOverlayKind;\n readonly match: string;\n readonly access: FieldAccess;\n}\n\n/**\n * The 5-state 4-level overlay a host resolves its roles into.\n *\n * The overlay is the authority for `accessVersion`: the report derives its version from the\n * resolved overlay, and the environment may only assert the same version. An absent\n * `defaultAccess` resolves to the fail-closed `read_only` (`[ACCESS-2.1.2]`).\n *\n * The overlay is presentation and consistency, never authorisation: the client is untrusted,\n * so the host API redacts on read and authorises on write (`[ACCESS-7.1.1]`).\n */\nexport interface AccessOverlay {\n readonly accessVersion: number;\n readonly defaultAccess: FieldAccess;\n /**\n * Fields whose `masked` or `hidden` state is lifted for expression reads only. A\n * `write_only` value is never lifted, and delivery to a device is never widened\n * (`[ACCESS-1.3.2]`, `[ACCESS-1.3.3]`).\n */\n readonly allowMaskedRead?: readonly string[];\n readonly rules: readonly AccessOverlayRule[];\n}\n\n/** One reference in a host-resolved access projection. */\nexport interface AccessEntry extends FieldRef {\n readonly access: FieldAccess;\n}\n\n/**\n * The one access source an evaluation may state.\n *\n * A host resolves access once, either into the runtime's 4-level `overlay` or into the flattened\n * per-reference `access` projection, and both answer the same question. Stating both leaves two\n * answers that cannot be reconciled, so this is a union rather than two optional members: a\n * TypeScript host that supplies both is refused by the compiler, and the readers\n * (`toEvaluationInput`, `toSubmissionInput`) refuse the same call from JavaScript. A host that\n * states neither keeps the fail-closed default in which every field resolves to `read_only`.\n *\n * The absent member is spelled `?: undefined`, not `?: never`: an explicitly-undefined member is\n * the same absence to every reader, and JavaScript callers write it (a spread of an optional\n * prop, a rebuilt literal). `undefined` still refuses the other source's value, so the pair a\n * caller cannot mean remains unrepresentable.\n *\n * One declaration serves both doors — `EvaluationInput` and `SubmissionAuthority` — and\n * `FormProviderAccess` in `@azx-pbc/axiom-react` is the same shape for the provider's props, so\n * the rule cannot be spelled three ways.\n */\nexport type AccessSource =\n | { readonly overlay: AccessOverlay; readonly access?: undefined }\n | { readonly access: readonly AccessEntry[]; readonly overlay?: undefined }\n | { readonly overlay?: undefined; readonly access?: undefined };\n\n/**\n * What a caller supplies for one evaluation, per `spec/semantics/context-v1.md`.\n *\n * `values` is the record; `context` is the roots the caller hydrated; `redacted` and\n * `sessionWrites` are the references the host handled. The access answer is `AccessSource`, so\n * the overlay model and the flattened-projection model are alternatives rather than two\n * independent members — the pair a caller cannot mean is not a value TypeScript admits.\n */\nexport type EvaluationInput = {\n /** Submitted values keyed by `fieldId`. Canonical wire values only. */\n readonly values: Readonly<Record<string, unknown>>;\n /** Declared context roots keyed without the `context.` prefix. */\n readonly context?: Readonly<Record<string, unknown>>;\n /** Values the server withheld from this device. */\n readonly redacted?: readonly FieldRef[];\n /**\n * Values written in the current session.\n *\n * A reference this session wrote holds the device's own value: a `write_only` value reads back\n * through it, and a reference the host also listed in `redacted` is no longer the server's to\n * withhold. The match is per reference, so a write to one row or one field never unlocks a\n * sibling the server still holds.\n */\n readonly sessionWrites?: readonly FieldRef[];\n} & AccessSource;\n\n/**\n * What only the host may state about one untrusted submission.\n *\n * A submission body is the record and nothing else. The access overlay, the context the host\n * hydrated, the fields it withheld and the values this session wrote are the host's answers\n * about the request — reading them from the body would let the client decide the question it\n * is being judged by — so `toSubmissionInput` takes them here instead, as the typed value the\n * host already holds. `lookup` is the same seam one level out: a resolution port is a\n * behaviour, not JSON, and `toEvaluationEnv` carries it into the environment untouched.\n */\nexport type SubmissionAuthority = {\n /** Declared context roots the host hydrated, keyed without the `context.` prefix. */\n readonly context?: Readonly<Record<string, unknown>>;\n /** Values the host withheld from the device that sent the body. */\n readonly redacted?: readonly FieldRef[];\n /** Values written in the session that sent the body. */\n readonly sessionWrites?: readonly FieldRef[];\n /**\n * The record the server already holds, keyed by declared `fieldId`.\n *\n * A submission body carries the principal's answers only; a binding the principal may not\n * write is the server's record, not the client's claim. The door evaluates the merged record\n * (`heldValues` beneath the body's writable answers), so a rule that reads a `read_only`\n * binding reads the server's value and a forged body cannot flip a verdict. It is read only\n * under a `kind: 'access'` stance, which is what names the bindings the principal may write;\n * the body's value for a binding that stance refuses is a refusal, never an override.\n */\n readonly heldValues?: Readonly<Record<string, unknown>>;\n /** The table store the host resolves declared datasets from. */\n readonly lookup?: LookupPort;\n /**\n * The authority is what only the host states, and the record is not part of it: `toSubmissionInput`\n * reads `values` from the body alone, so a `values` admitted here would be inert. The type\n * refuses it because it is the member a value that merges the two (a stored projection, a\n * request the host folded its authority into) carries — and admitting it would claim this door\n * reads a record it never reads. `toSubmissionInput` refuses the same member at\n * `authority.values` for a JavaScript caller, rather than silently answering from the body's\n * record.\n */\n readonly values?: never;\n} & AccessSource;\n\n/** Everything about the call that is not the record: tier, overlay version and capabilities. */\nexport interface EvaluationEnv {\n /**\n * The tier being evaluated. Absent means `DEFAULT_EVALUATION_TIER` (`client`), the fail-closed\n * local door: a server rule defers rather than running on a host that never claimed server\n * authority. A server host that decides those rules names `server` explicitly.\n */\n readonly tier?: Tier;\n /**\n * The access version the caller believes it is evaluating under. It is not an authority:\n * a call that also supplies an overlay is refused when the two disagree, so a report\n * cannot state a version its overlay never had (`[ACCESS-5.1.1]`).\n */\n readonly accessVersion?: number;\n /**\n * The local record date the host supplies: what `context.record_date` reads\n * and the date an `in_set` call resolves a `data`-bound set against when\n * the call names no `asOf` of its own. Absent, such a call stays stale\n * (`missing_as_of`) rather than falling back to a clock.\n */\n readonly recordDate?: string;\n /**\n * Non-authorisation capability flags the host environment supplies.\n * `has_cap` reports membership only: nothing in Expr infers access from a capability.\n */\n readonly capabilities?: readonly string[];\n /**\n * The lookup store this evaluation resolves declared datasets from.\n * Storage is a host decision, so the engine holds only this port; a store that keeps no\n * table for a name an expression requires leaves that table missing.\n */\n readonly lookup?: LookupPort;\n}\n\n/** The tier a local evaluation runs at: the caller's explicit value, or the fail-closed default. */\nexport function effectiveTier(env: Pick<EvaluationEnv, 'tier'>): Tier {\n return env.tier ?? DEFAULT_EVALUATION_TIER;\n}\n\nconst ACCESS_STATES: ReadonlySet<string> = new Set([\n 'read_write',\n 'read_only',\n 'write_only',\n 'masked',\n 'hidden',\n]);\n\nconst OVERLAY_KINDS: ReadonlySet<string> = new Set(['exact', 'template', 'container', 'section']);\n\nfunction refuse(path: string, message: string): never {\n throw new AxiomError('ENGINE_ERROR', message, path);\n}\n\nfunction expectRecord(value: unknown, path: string): Readonly<Record<string, unknown>> {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n refuse(path, 'must be an object');\n }\n return value as Readonly<Record<string, unknown>>;\n}\n\nfunction memberRecord(\n source: Readonly<Record<string, unknown>>,\n path: string,\n admitted: readonly string[],\n optional: readonly string[] = [],\n): Readonly<Record<string, unknown>> {\n const known = new Set([...admitted, ...optional]);\n for (const key of Object.keys(source)) {\n if (!known.has(key)) refuse(path, `unknown member ${JSON.stringify(key)}`);\n }\n return source;\n}\n\nfunction accessAt(value: unknown, path: string): FieldAccess {\n if (typeof value !== 'string' || !ACCESS_STATES.has(value)) {\n refuse(path, 'access must be one of read_write, read_only, write_only, masked, hidden');\n }\n return value as FieldAccess;\n}\n\n/**\n * The overlay version a report can carry: a non-negative safe integer, spelled canonically.\n *\n * `accessVersion` is the one host-supplied leaf of a report body. It is stated by the overlay,\n * by the environment of a call that supplies no overlay, and by the report the evaluator seals;\n * one function decides it for all three, so a version the report could not carry is refused at\n * its boundary rather than inside the hash that cannot represent it. `-0` is refused with the\n * other non-integers: it serialises as `0`, so accepting it would let two in-memory values\n * produce one report hash while a consumer sees two versions.\n */\nexport function asAccessVersion(value: unknown, path = '$.accessVersion'): number {\n if (typeof value !== 'number' || !isSafeInteger(value)) {\n refuse(path, 'accessVersion must be a safe integer');\n }\n if (value < 0) refuse(path, 'accessVersion must not be negative');\n return value;\n}\n\n/**\n * Reads an untrusted overlay into the closed overlay shape.\n *\n * Every member is checked before it can decide a read: the version is a non-negative safe\n * integer, the default is one of the five states, `allowMaskedRead` names declared fields,\n * and every rule states a known kind, a non-empty match and a known access. A member outside\n * the contract is refused with its path rather than ignored, because ignoring one would let\n * an overlay mean something other than what its host wrote.\n */\nexport function toAccessOverlay(value: unknown, path = '$.overlay'): AccessOverlay {\n const source = expectRecord(value, path);\n memberRecord(source, path, ['accessVersion', 'rules'], ['defaultAccess', 'allowMaskedRead']);\n const accessVersion = asAccessVersion(source['accessVersion'], `${path}.accessVersion`);\n // A host that does not state a default gets the fail-closed one, never an inferred grant.\n const defaultAccess =\n source['defaultAccess'] === undefined\n ? 'read_only'\n : accessAt(source['defaultAccess'], `${path}.defaultAccess`);\n const allowMaskedRead = readAllowMaskedRead(source['allowMaskedRead'], `${path}.allowMaskedRead`);\n const rules = source['rules'];\n if (!Array.isArray(rules)) refuse(`${path}.rules`, 'rules must be an array');\n const parsed = rules.map((rule, index) =>\n readOverlayRule(rule, `${path}.rules[${String(index)}]`),\n );\n return {\n accessVersion,\n defaultAccess,\n ...(allowMaskedRead === undefined ? {} : { allowMaskedRead }),\n rules: parsed,\n };\n}\n\nfunction readAllowMaskedRead(value: unknown, path: string): readonly string[] | undefined {\n if (value === undefined) return undefined;\n if (!Array.isArray(value)) refuse(path, 'allowMaskedRead must be an array');\n return value.map((fieldId, index) => {\n if (typeof fieldId !== 'string' || fieldId === '') {\n refuse(`${path}[${String(index)}]`, 'allowMaskedRead names a fieldId');\n }\n return fieldId;\n });\n}\n\nfunction readOverlayRule(value: unknown, path: string): AccessOverlayRule {\n const source = expectRecord(value, path);\n memberRecord(source, path, ['kind', 'match', 'access']);\n const kind = source['kind'];\n if (typeof kind !== 'string' || !OVERLAY_KINDS.has(kind)) {\n refuse(`${path}.kind`, 'kind must be one of exact, template, container, section');\n }\n const match = source['match'];\n if (typeof match !== 'string' || match === '')\n refuse(`${path}.match`, 'match must name an identifier');\n // The level owns the spelling of its match: a template that is not `fieldId@*`, and an `@*`\n // on any other level, are refused here rather than resolved by a guess. An `exact` rule's\n // `fieldId@<rowKeyToken>` spelling is read by `parseRowMatch` in `eval/access/overlay.ts`,\n // which owns the row-token grammar.\n if (\n kind === 'template' &&\n (match.length < 3 || !match.endsWith('@*') || match.indexOf('@') !== match.length - 2)\n ) {\n refuse(`${path}.match`, 'a template match is `fieldId@*`');\n }\n if (kind !== 'template' && match.includes('@*')) {\n refuse(`${path}.match`, 'only a template match may use `@*`');\n }\n return {\n kind: kind as AccessOverlayKind,\n match,\n access: accessAt(source['access'], `${path}.access`),\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-members.d.ts","sourceRoot":"","sources":["../../src/model/artifact-members.ts"],"names":[],"mappings":"AAsCA,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAA4C,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The root members this runtime's v1 artifact contract understands.
|
|
3
|
+
*
|
|
4
|
+
* A compiled artifact is a closed document: the compiler's metaschema refuses an unknown root
|
|
5
|
+
* member, and the runtime must refuse one too. The type is erased at run time, so without a
|
|
6
|
+
* runtime list a host that rehydrated an artifact from storage compiled by a later release would
|
|
7
|
+
* see the members this build knows and silently ignore the rest — including a member that changes
|
|
8
|
+
* what a rule decides. That is the "partially evaluate and mis-report" failure the receipt exists
|
|
9
|
+
* to stop.
|
|
10
|
+
*
|
|
11
|
+
* The index is typed as `Record<keyof CompiledSchema, true>` so this list and the interface cannot
|
|
12
|
+
* drift: a member added to `CompiledSchema` without a line here fails typecheck, and a name here
|
|
13
|
+
* that the interface does not declare fails it too. `Object.keys` then gives the runtime the same
|
|
14
|
+
* set in declaration order.
|
|
15
|
+
*/
|
|
16
|
+
const ARTIFACT_ROOT_MEMBER_INDEX = {
|
|
17
|
+
schemaId: true,
|
|
18
|
+
schemaVersion: true,
|
|
19
|
+
exprVersion: true,
|
|
20
|
+
producerVersion: true,
|
|
21
|
+
target: true,
|
|
22
|
+
fields: true,
|
|
23
|
+
locales: true,
|
|
24
|
+
defaultLocale: true,
|
|
25
|
+
titleKey: true,
|
|
26
|
+
layout: true,
|
|
27
|
+
context: true,
|
|
28
|
+
rules: true,
|
|
29
|
+
messages: true,
|
|
30
|
+
datasets: true,
|
|
31
|
+
primaryGateId: true,
|
|
32
|
+
primaryScreenId: true,
|
|
33
|
+
onHide: true,
|
|
34
|
+
composition: true,
|
|
35
|
+
};
|
|
36
|
+
/** The root members a v1 artifact may state, as the runtime receipt reads them. */
|
|
37
|
+
export const ARTIFACT_ROOT_MEMBERS = Object.keys(ARTIFACT_ROOT_MEMBER_INDEX);
|
|
38
|
+
//# sourceMappingURL=artifact-members.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-members.js","sourceRoot":"","sources":["../../src/model/artifact-members.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,0BAA0B,GAAG;IACjC,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,IAAI;IACZ,WAAW,EAAE,IAAI;CAC8C,CAAC;AAElE,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAsB,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC","sourcesContent":["import type { CompiledSchema } from './schema.js';\n\n/**\n * The root members this runtime's v1 artifact contract understands.\n *\n * A compiled artifact is a closed document: the compiler's metaschema refuses an unknown root\n * member, and the runtime must refuse one too. The type is erased at run time, so without a\n * runtime list a host that rehydrated an artifact from storage compiled by a later release would\n * see the members this build knows and silently ignore the rest — including a member that changes\n * what a rule decides. That is the \"partially evaluate and mis-report\" failure the receipt exists\n * to stop.\n *\n * The index is typed as `Record<keyof CompiledSchema, true>` so this list and the interface cannot\n * drift: a member added to `CompiledSchema` without a line here fails typecheck, and a name here\n * that the interface does not declare fails it too. `Object.keys` then gives the runtime the same\n * set in declaration order.\n */\nconst ARTIFACT_ROOT_MEMBER_INDEX = {\n schemaId: true,\n schemaVersion: true,\n exprVersion: true,\n producerVersion: true,\n target: true,\n fields: true,\n locales: true,\n defaultLocale: true,\n titleKey: true,\n layout: true,\n context: true,\n rules: true,\n messages: true,\n datasets: true,\n primaryGateId: true,\n primaryScreenId: true,\n onHide: true,\n composition: true,\n} as const satisfies Readonly<Record<keyof CompiledSchema, true>>;\n\n/** The root members a v1 artifact may state, as the runtime receipt reads them. */\nexport const ARTIFACT_ROOT_MEMBERS: readonly string[] = Object.keys(ARTIFACT_ROOT_MEMBER_INDEX);\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The composition identity of a compiled artifact, `spec/semantics/evolution-v1.md`
|
|
3
|
+
* `[EVOL-4.1.4]`.
|
|
4
|
+
*
|
|
5
|
+
* A layered configuration is one base document plus an ordered set of overlays. The artifact
|
|
6
|
+
* that results names the base edition and every overlay edition it applied, in the order it
|
|
7
|
+
* applied them, so a dispute can name exactly which configuration produced a report. The
|
|
8
|
+
* member is behaviour rather than presentation: two artifacts that decide the same record but
|
|
9
|
+
* were composed from different editions state different configurations, and a report's
|
|
10
|
+
* `behaviorHash` and `reportHash` must distinguish them.
|
|
11
|
+
*
|
|
12
|
+
* The version is the overlay document's own `schemaVersion`; `overlayId` is the host's name for
|
|
13
|
+
* the layer (for example `tenant` or `process`), which is not part of any schema document.
|
|
14
|
+
*/
|
|
15
|
+
export interface AppliedOverlay {
|
|
16
|
+
/** The host's name for this layer, as it supplied it to `compileOverlay`. */
|
|
17
|
+
readonly overlayId: string;
|
|
18
|
+
/** The overlay document's own `schemaVersion`. */
|
|
19
|
+
readonly schemaVersion: number;
|
|
20
|
+
}
|
|
21
|
+
/** The base edition and every overlay edition a compiled artifact applied, in order. */
|
|
22
|
+
export interface CompositionReport {
|
|
23
|
+
/** The base document's `schemaVersion`; equal to the artifact's own `schemaVersion`. */
|
|
24
|
+
readonly baseVersion: number;
|
|
25
|
+
/** Every applied overlay, in application order. Never empty on a member that is present. */
|
|
26
|
+
readonly overlays: readonly AppliedOverlay[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The own member a composition report states beyond the two the contract carries, or `undefined`.
|
|
30
|
+
*
|
|
31
|
+
* Exported from this module for the wire receipt's refusal detail, which names the offending
|
|
32
|
+
* member; it is not on the package's host door, which re-exports `isCompositionReport` and the
|
|
33
|
+
* two types by name. `Object.keys` reads names without invoking an accessor, and the report
|
|
34
|
+
* contract is closed over the enumerable members JSON can carry.
|
|
35
|
+
*/
|
|
36
|
+
export declare function compositionMemberOutside(value: object): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Whether `value` is the composition report the artifact and report contracts admit.
|
|
39
|
+
*
|
|
40
|
+
* This is the boundary parser for a member a host can rehydrate from storage. It is not a
|
|
41
|
+
* general JSON Schema check: it asks exactly the questions the runtime's report assembly and a
|
|
42
|
+
* reader of the version report depend on — a positive base edition and a non-empty ordered list
|
|
43
|
+
* of named editions — so a malformed value is refused where it enters rather than travelling
|
|
44
|
+
* into a sealed report.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isCompositionReport(value: unknown): value is CompositionReport;
|
|
47
|
+
//# sourceMappingURL=composition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../src/model/composition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,kDAAkD;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;CAC9C;AAaD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK1E;AAOD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAoB9E"}
|