@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,466 @@
|
|
|
1
|
+
import { assertNever } from '../../model/errors.js';
|
|
2
|
+
import { canonicalizeRestricted } from '../../canonical/jcs.js';
|
|
3
|
+
import { isWireArray, sameWireValue } from '../../model/values.js';
|
|
4
|
+
import { rowKeyToken } from '../../model/wire.js';
|
|
5
|
+
import { fieldKey } from '../access/projection.js';
|
|
6
|
+
import { declarationFor, heldValueOf } from './ops.js';
|
|
7
|
+
import { noteBlockerIdentity } from '../state/measurement.js';
|
|
8
|
+
import { rowKeyOfItem } from '../addressing.js';
|
|
9
|
+
import { fieldIndex, rowStateOf } from './snapshot.js';
|
|
10
|
+
/**
|
|
11
|
+
* The identity one blocker is compared by, `[ENGINE-8.2.2]`.
|
|
12
|
+
*
|
|
13
|
+
* Two blockers with the same identity are the same failure of the same binding, so a change set
|
|
14
|
+
* that leaves one standing neither adds nor clears it. The members are the ones the contract
|
|
15
|
+
* names: the kind, the rule, gate or screen that decided it, the field, the row and the message.
|
|
16
|
+
* An `unavailableOption` also carries the held code, so replacing unavailable code A with code B
|
|
17
|
+
* is one cleared blocker and one added one even when the reason is identical or absent; an
|
|
18
|
+
* `invalidOption` carries the refused value or path for the same reason. A message payload
|
|
19
|
+
* (`params`) is not identity: the failure is the same failure when its sentence's arguments move.
|
|
20
|
+
*
|
|
21
|
+
* The canonical text is the key, so an integer row key and its text spelling never collide and a
|
|
22
|
+
* record-shaped refused value compares by its bytes.
|
|
23
|
+
*/
|
|
24
|
+
function blockerIdentity(blocker) {
|
|
25
|
+
noteBlockerIdentity();
|
|
26
|
+
const row = 'rowKey' in blocker ? (blocker.rowKey ?? null) : null;
|
|
27
|
+
switch (blocker.kind) {
|
|
28
|
+
case 'rule':
|
|
29
|
+
return canonicalizeRestricted([
|
|
30
|
+
'rule',
|
|
31
|
+
blocker.ruleId,
|
|
32
|
+
blocker.fieldId ?? null,
|
|
33
|
+
row,
|
|
34
|
+
blocker.messageKey,
|
|
35
|
+
]);
|
|
36
|
+
case 'required':
|
|
37
|
+
return canonicalizeRestricted(['required', blocker.fieldId, row, blocker.messageKey ?? null]);
|
|
38
|
+
case 'gate':
|
|
39
|
+
return canonicalizeRestricted(['gate', blocker.gateId, blocker.itemId, blocker.messageKey]);
|
|
40
|
+
case 'cardinality':
|
|
41
|
+
return canonicalizeRestricted(['cardinality', blocker.fieldId, blocker.bound]);
|
|
42
|
+
case 'scale':
|
|
43
|
+
return canonicalizeRestricted(['scale', blocker.fieldId, row, blocker.member]);
|
|
44
|
+
case 'media':
|
|
45
|
+
return canonicalizeRestricted([
|
|
46
|
+
'media',
|
|
47
|
+
blocker.fieldId,
|
|
48
|
+
row,
|
|
49
|
+
blocker.index ?? null,
|
|
50
|
+
blocker.member,
|
|
51
|
+
]);
|
|
52
|
+
case 'rowCount':
|
|
53
|
+
return canonicalizeRestricted(['rowCount', blocker.fieldId]);
|
|
54
|
+
case 'invalidOption':
|
|
55
|
+
return canonicalizeRestricted([
|
|
56
|
+
'invalidOption',
|
|
57
|
+
blocker.fieldId,
|
|
58
|
+
row,
|
|
59
|
+
blocker.path ?? null,
|
|
60
|
+
blocker.value ?? null,
|
|
61
|
+
]);
|
|
62
|
+
case 'screen':
|
|
63
|
+
return canonicalizeRestricted(['screen', blocker.screenId, blocker.messageKey ?? null]);
|
|
64
|
+
case 'unavailableOption':
|
|
65
|
+
return canonicalizeRestricted([
|
|
66
|
+
'unavailableOption',
|
|
67
|
+
blocker.fieldId,
|
|
68
|
+
row,
|
|
69
|
+
blocker.code,
|
|
70
|
+
blocker.messageKey ?? null,
|
|
71
|
+
]);
|
|
72
|
+
default:
|
|
73
|
+
// A new blocker kind must state the identity it is compared by, not share one silently.
|
|
74
|
+
return assertNever(blocker);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Builds the blocker pair one candidate needs, exactly once.
|
|
79
|
+
*
|
|
80
|
+
* A `propose` reads the added set eagerly and the whole delta lazily, so a second pass here would
|
|
81
|
+
* canonicalise the same blockers again. The pair is the shared answer both read.
|
|
82
|
+
*/
|
|
83
|
+
export function identifyBlockers(base, candidate) {
|
|
84
|
+
const baseEntries = identified(base.form.blockers);
|
|
85
|
+
const candidateEntries = identified(candidate.form.blockers);
|
|
86
|
+
const baseIdentities = identitiesOf(baseEntries);
|
|
87
|
+
const candidateIdentities = identitiesOf(candidateEntries);
|
|
88
|
+
return Object.freeze({
|
|
89
|
+
added: Object.freeze(blockersOnlyIn(candidateEntries, baseIdentities)),
|
|
90
|
+
cleared: Object.freeze(blockersOnlyIn(baseEntries, candidateIdentities)),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Every blocker on one side of a delta, with its identity built once.
|
|
95
|
+
*
|
|
96
|
+
* The added and cleared sets each test the other side, so building the identity inside both
|
|
97
|
+
* filters canonicalised every blocker twice per delta. The pairs make one canonicalisation per
|
|
98
|
+
* blocker the answer of the whole comparison.
|
|
99
|
+
*/
|
|
100
|
+
function identified(blockers) {
|
|
101
|
+
return blockers.map((blocker) => ({ blocker, identity: blockerIdentity(blocker) }));
|
|
102
|
+
}
|
|
103
|
+
/** The blockers one state states that the other does not, in the order its derivation states them. */
|
|
104
|
+
function blockersOnlyIn(from, against) {
|
|
105
|
+
return from.filter((entry) => !against.has(entry.identity)).map((entry) => entry.blocker);
|
|
106
|
+
}
|
|
107
|
+
/** Every blocker identity one derived state states. */
|
|
108
|
+
function identitiesOf(blockers) {
|
|
109
|
+
return new Set(blockers.map((entry) => entry.identity));
|
|
110
|
+
}
|
|
111
|
+
/** The sentinel a binding states when no writer produced a value for it. */
|
|
112
|
+
const NO_COMPUTATION = { kind: 'none' };
|
|
113
|
+
/**
|
|
114
|
+
* One side's computation as the binding's delivery states it.
|
|
115
|
+
*
|
|
116
|
+
* A writer that could not decide answers `undetermined` whatever the binding's delivery is, so an
|
|
117
|
+
* access answer that withholds the value never reaches the computation: masking one row of an
|
|
118
|
+
* array leaves its computed member `undetermined` while its delivered value is `withheld`. The
|
|
119
|
+
* delta's contract is about what this reader may be shown, so a side whose value the delivery
|
|
120
|
+
* withholds is a withheld side, and stating it as one keeps the committed value out of the entry
|
|
121
|
+
* exactly as a side the writer already answered `withheld` does.
|
|
122
|
+
*/
|
|
123
|
+
function deliveredComputation(computation, value) {
|
|
124
|
+
return computation.kind === 'undetermined' && value?.kind === 'withheld'
|
|
125
|
+
? { kind: 'withheld' }
|
|
126
|
+
: computation;
|
|
127
|
+
}
|
|
128
|
+
/** Whether two derived computation answers state the same value. */
|
|
129
|
+
function sameComputation(left, right) {
|
|
130
|
+
if (left.kind === 'value' && right.kind === 'value') {
|
|
131
|
+
return sameWireValue(left.value, right.value);
|
|
132
|
+
}
|
|
133
|
+
if (left.kind === 'undetermined' && right.kind === 'undetermined') {
|
|
134
|
+
return left.status === right.status;
|
|
135
|
+
}
|
|
136
|
+
return left.kind === right.kind;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The semantic value behind a withheld delivery, used only to decide whether it moved.
|
|
140
|
+
*
|
|
141
|
+
* A writer's overlay retains the value its access-filtered report and form entry omit. Neither
|
|
142
|
+
* value leaves this comparison.
|
|
143
|
+
*/
|
|
144
|
+
function computationBehindWithheld(compiled, state, fieldId, rowKey) {
|
|
145
|
+
const computed = rowKey === undefined ? state.computed.get(fieldId) : state.computed.getRow(fieldId, rowKey);
|
|
146
|
+
if (computed?.kind === 'decided')
|
|
147
|
+
return { kind: 'value', value: computed.value };
|
|
148
|
+
if (computed?.kind === 'undetermined') {
|
|
149
|
+
return { kind: 'undetermined', status: computed.sentinel.undetermined };
|
|
150
|
+
}
|
|
151
|
+
// An active `defaultCompute` override deliberately has no overlay entry: the working record
|
|
152
|
+
// is the writer's result then, with an absent current value reported as null by `resolveWriter`.
|
|
153
|
+
const ref = rowKey === undefined ? { fieldId } : { fieldId, rowKey };
|
|
154
|
+
return { kind: 'value', value: heldValueOf(compiled, state.working, ref) ?? null };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* One binding's computation change, or nothing when the derived answer is the same.
|
|
158
|
+
*
|
|
159
|
+
* A `withheld` side states neither value: the access answer keeps it from this reader, and a
|
|
160
|
+
* delta is a view, not a disclosure channel. Two withheld deliveries still compare the semantic
|
|
161
|
+
* values behind them, so a moving secret is a change without becoming a disclosure.
|
|
162
|
+
*/
|
|
163
|
+
function computationChange(compiled, base, candidate, fieldId, rowKey, before, after) {
|
|
164
|
+
const bothWithheld = before.kind === 'withheld' && after.kind === 'withheld';
|
|
165
|
+
const comparableBefore = bothWithheld
|
|
166
|
+
? computationBehindWithheld(compiled, base, fieldId, rowKey)
|
|
167
|
+
: before;
|
|
168
|
+
const comparableAfter = bothWithheld
|
|
169
|
+
? computationBehindWithheld(compiled, candidate, fieldId, rowKey)
|
|
170
|
+
: after;
|
|
171
|
+
if (sameComputation(comparableBefore, comparableAfter))
|
|
172
|
+
return undefined;
|
|
173
|
+
const withheld = before.kind === 'withheld' || after.kind === 'withheld';
|
|
174
|
+
return {
|
|
175
|
+
fieldId,
|
|
176
|
+
...(rowKey === undefined ? {} : { rowKey }),
|
|
177
|
+
...(withheld
|
|
178
|
+
? { withheld: true }
|
|
179
|
+
: {
|
|
180
|
+
...(before.kind === 'value' ? { before: before.value } : {}),
|
|
181
|
+
...(after.kind === 'value' ? { after: after.value } : {}),
|
|
182
|
+
}),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/** The held-row answer for an array whose own delivery states nothing about one row. */
|
|
186
|
+
const NO_HELD_ROWS = new Set();
|
|
187
|
+
function candidateRowHolding(compiled, candidate, fieldId) {
|
|
188
|
+
const arrayFieldId = declarationFor(compiled, fieldId).arrayFieldId ?? fieldId;
|
|
189
|
+
const array = fieldIndex(candidate.form).get(arrayFieldId);
|
|
190
|
+
if (array?.value.kind === 'withheld')
|
|
191
|
+
return { withheld: true, held: NO_HELD_ROWS };
|
|
192
|
+
if (array?.value.kind !== 'value' || !isWireArray(array.value.value)) {
|
|
193
|
+
return { withheld: false, held: NO_HELD_ROWS };
|
|
194
|
+
}
|
|
195
|
+
const items = array.value.value;
|
|
196
|
+
const declaration = declarationFor(compiled, arrayFieldId).field;
|
|
197
|
+
const manifest = candidate.working.identity.manifests.get(arrayFieldId);
|
|
198
|
+
const held = new Set();
|
|
199
|
+
for (const [index] of items.entries()) {
|
|
200
|
+
const key = rowKeyOfItem(declaration, items, index, manifest);
|
|
201
|
+
if (key !== undefined)
|
|
202
|
+
held.add(rowKeyToken(key));
|
|
203
|
+
}
|
|
204
|
+
return { withheld: false, held };
|
|
205
|
+
}
|
|
206
|
+
/** The row changes of one row-scoped writer's member, keyed by the row's own wire key. */
|
|
207
|
+
function rowComputationChanges(compiled, base, candidate, before, after, fieldId) {
|
|
208
|
+
const prior = new Map();
|
|
209
|
+
for (const row of before)
|
|
210
|
+
prior.set(rowKeyToken(row.rowKey), row);
|
|
211
|
+
const changes = [];
|
|
212
|
+
const candidateKeys = new Set();
|
|
213
|
+
for (const row of after) {
|
|
214
|
+
const key = rowKeyToken(row.rowKey);
|
|
215
|
+
candidateKeys.add(key);
|
|
216
|
+
const priorRow = prior.get(key);
|
|
217
|
+
const change = computationChange(compiled, base, candidate, fieldId, row.rowKey, deliveredComputation(priorRow?.computation ?? NO_COMPUTATION, priorRow?.value), deliveredComputation(row.computation, row.value));
|
|
218
|
+
if (change !== undefined)
|
|
219
|
+
changes.push(change);
|
|
220
|
+
}
|
|
221
|
+
// A removed row has no candidate entry to iterate, but its writer still moved from the value
|
|
222
|
+
// committed state produced to no value at all. State that removal in committed row order. A row
|
|
223
|
+
// that remains in the record but is no longer addressable instead has a withheld after side.
|
|
224
|
+
let holding;
|
|
225
|
+
for (const row of before) {
|
|
226
|
+
const token = rowKeyToken(row.rowKey);
|
|
227
|
+
if (candidateKeys.has(token))
|
|
228
|
+
continue;
|
|
229
|
+
holding ??= candidateRowHolding(compiled, candidate, fieldId);
|
|
230
|
+
const after = holding.withheld || holding.held.has(token) ? { kind: 'withheld' } : NO_COMPUTATION;
|
|
231
|
+
const change = computationChange(compiled, base, candidate, fieldId, row.rowKey, deliveredComputation(row.computation, row.value), after);
|
|
232
|
+
if (change !== undefined)
|
|
233
|
+
changes.push(change);
|
|
234
|
+
}
|
|
235
|
+
return changes;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Every system-computed value the change set moved.
|
|
239
|
+
*
|
|
240
|
+
* A writer owns its target, so the derived `computation` is that writer's answer and nothing
|
|
241
|
+
* else: a field nobody computes states `none` on both sides and is skipped, whether the record
|
|
242
|
+
* holds a value at the binding or not.
|
|
243
|
+
*/
|
|
244
|
+
function changedComputations(compiled, base, candidate) {
|
|
245
|
+
const before = fieldIndex(base.form);
|
|
246
|
+
const changes = [];
|
|
247
|
+
for (const field of candidate.form.fields) {
|
|
248
|
+
const prior = before.get(field.fieldId);
|
|
249
|
+
if (prior === undefined)
|
|
250
|
+
continue;
|
|
251
|
+
if (!prior.systemComputed && !field.systemComputed)
|
|
252
|
+
continue;
|
|
253
|
+
// A computed array has its own value as well as row entries. A row member's field-level
|
|
254
|
+
// answer is `none`, so this comparison adds nothing there and the row walk states its cells.
|
|
255
|
+
const change = computationChange(compiled, base, candidate, field.fieldId, undefined, deliveredComputation(prior.computation, prior.value), deliveredComputation(field.computation, field.value));
|
|
256
|
+
if (change !== undefined)
|
|
257
|
+
changes.push(change);
|
|
258
|
+
if (field.rows !== undefined || prior.rows !== undefined) {
|
|
259
|
+
changes.push(...rowComputationChanges(compiled, base, candidate, prior.rows ?? [], field.rows ?? [], field.fieldId));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return changes;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The checks the candidate left undecided that committed state had settled.
|
|
266
|
+
*
|
|
267
|
+
* A check is a rule's answer, and `DEFERRED` and `UNKNOWN` are the two answers that are not one.
|
|
268
|
+
* A rule already stating the same undecided answer is not reported: the change set did not make
|
|
269
|
+
* it undecided. The delta names no row — a rule that answers per row states one entry — because
|
|
270
|
+
* the open question is the check's, and readiness names the row it belongs to.
|
|
271
|
+
*/
|
|
272
|
+
function pendingChecks(base, candidate) {
|
|
273
|
+
const settled = new Set();
|
|
274
|
+
for (const result of base.report.rules)
|
|
275
|
+
settled.add(`${result.ruleId}\u0000${result.status}`);
|
|
276
|
+
const checks = [];
|
|
277
|
+
const stated = new Set();
|
|
278
|
+
for (const result of candidate.report.rules) {
|
|
279
|
+
if (result.status !== 'DEFERRED' && result.status !== 'UNKNOWN')
|
|
280
|
+
continue;
|
|
281
|
+
const key = `${result.ruleId}\u0000${result.status}`;
|
|
282
|
+
if (settled.has(key) || stated.has(key))
|
|
283
|
+
continue;
|
|
284
|
+
stated.add(key);
|
|
285
|
+
checks.push({ ruleId: result.ruleId, status: result.status });
|
|
286
|
+
}
|
|
287
|
+
return checks;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Whether the committed view withholds one target's value from this reader.
|
|
291
|
+
*
|
|
292
|
+
* The derived entry is the delivery answer the write guard is rendered from, and it already
|
|
293
|
+
* weighs every declaration the reference sits under, the row it belongs to, a host redaction and
|
|
294
|
+
* the session's `write_only` unlock. Asking it here is the same question `changedComputations`
|
|
295
|
+
* asks of a writer's answer; neither the raw working record nor the proposed value participates.
|
|
296
|
+
*/
|
|
297
|
+
function committedValueWithheld(base, ref) {
|
|
298
|
+
const field = fieldIndex(base.form).get(ref.fieldId);
|
|
299
|
+
if (field === undefined)
|
|
300
|
+
return false;
|
|
301
|
+
if (ref.rowKey === undefined)
|
|
302
|
+
return field.value.kind === 'withheld';
|
|
303
|
+
// A row the derived view does not address is not a value this reader was given, even when the
|
|
304
|
+
// private record still holds it. Stating the reference would answer which row moved.
|
|
305
|
+
const row = rowStateOf(field, ref.rowKey);
|
|
306
|
+
return row === undefined || row.value.kind === 'withheld';
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Every value, `null` or `remove` target whose committed value the change set replaces.
|
|
310
|
+
*
|
|
311
|
+
* A target the committed record holds no value at is not overwritten: a write that fills a blank
|
|
312
|
+
* control replaces nothing the user had. A write that stores what the record already holds
|
|
313
|
+
* replaces nothing either, and the session already treats it as no change at all.
|
|
314
|
+
*
|
|
315
|
+
* A target whose committed value delivery withholds is omitted without comparing anything. A
|
|
316
|
+
* `system` write may name such a target, so comparing would let a delta answer whether a secret
|
|
317
|
+
* equals a guess; the presence of a reference would be that answer.
|
|
318
|
+
*/
|
|
319
|
+
function overwrittenValues(compiled, base, operations) {
|
|
320
|
+
const overwritten = [];
|
|
321
|
+
const seen = new Set();
|
|
322
|
+
for (const operation of operations) {
|
|
323
|
+
if (operation.kind !== 'value' && operation.kind !== 'null' && operation.kind !== 'remove') {
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
if (committedValueWithheld(base, operation.ref))
|
|
327
|
+
continue;
|
|
328
|
+
const held = heldValueOf(compiled, base.working, operation.ref);
|
|
329
|
+
if (held === undefined)
|
|
330
|
+
continue;
|
|
331
|
+
if (operation.kind === 'value' && sameWireValue(held, operation.value))
|
|
332
|
+
continue;
|
|
333
|
+
if (operation.kind === 'null' && held === null)
|
|
334
|
+
continue;
|
|
335
|
+
const key = fieldKey(operation.ref);
|
|
336
|
+
if (seen.has(key))
|
|
337
|
+
continue;
|
|
338
|
+
seen.add(key);
|
|
339
|
+
overwritten.push(Object.freeze({ ...operation.ref }));
|
|
340
|
+
}
|
|
341
|
+
return overwritten;
|
|
342
|
+
}
|
|
343
|
+
/** Every declared field the change set writes, whatever the operation writes it with. */
|
|
344
|
+
function writtenFields(operations) {
|
|
345
|
+
const written = new Set();
|
|
346
|
+
for (const operation of operations) {
|
|
347
|
+
switch (operation.kind) {
|
|
348
|
+
case 'value':
|
|
349
|
+
case 'null':
|
|
350
|
+
case 'remove':
|
|
351
|
+
written.add(operation.ref.fieldId);
|
|
352
|
+
break;
|
|
353
|
+
case 'append':
|
|
354
|
+
case 'insert':
|
|
355
|
+
case 'removeRow':
|
|
356
|
+
case 'move':
|
|
357
|
+
written.add(operation.fieldId);
|
|
358
|
+
break;
|
|
359
|
+
case 'context':
|
|
360
|
+
case 'env':
|
|
361
|
+
case 'access':
|
|
362
|
+
break;
|
|
363
|
+
default:
|
|
364
|
+
return assertNever(operation);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return written;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Every declared field the change set touches, seen through the declaration tree.
|
|
371
|
+
*
|
|
372
|
+
* A written field reaches its declared ancestors, because a value that lives below a record or
|
|
373
|
+
* array container is part of that container's value: a host page loaded for the container is
|
|
374
|
+
* answering a record the write has moved. It also reaches its declared descendants, because
|
|
375
|
+
* writing a container replaces the members below it: a page loaded for one of those members is
|
|
376
|
+
* answering a value the write has replaced. Names that name neither a container nor a member
|
|
377
|
+
* are kept as they are, so a dependency no declaration resolves still compares by its own name.
|
|
378
|
+
*/
|
|
379
|
+
function touchedFields(compiled, written) {
|
|
380
|
+
const parents = new Map();
|
|
381
|
+
const children = new Map();
|
|
382
|
+
const visit = (fields) => {
|
|
383
|
+
for (const field of fields) {
|
|
384
|
+
const members = field.fields ?? [];
|
|
385
|
+
if (members.length > 0)
|
|
386
|
+
children.set(field.fieldId, members.map((member) => member.fieldId));
|
|
387
|
+
for (const member of members)
|
|
388
|
+
parents.set(member.fieldId, field.fieldId);
|
|
389
|
+
visit(members);
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
visit(compiled.fields);
|
|
393
|
+
const touched = new Set(written);
|
|
394
|
+
for (const fieldId of written) {
|
|
395
|
+
let ancestor = parents.get(fieldId);
|
|
396
|
+
while (ancestor !== undefined && !touched.has(ancestor)) {
|
|
397
|
+
touched.add(ancestor);
|
|
398
|
+
ancestor = parents.get(ancestor);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
for (const fieldId of written) {
|
|
402
|
+
const pending = [...(children.get(fieldId) ?? [])];
|
|
403
|
+
while (pending.length > 0) {
|
|
404
|
+
const memberId = pending.pop();
|
|
405
|
+
if (memberId === undefined)
|
|
406
|
+
continue;
|
|
407
|
+
if (!touched.has(memberId))
|
|
408
|
+
touched.add(memberId);
|
|
409
|
+
pending.push(...(children.get(memberId) ?? []));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return touched;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Every host option source whose domain the change set makes stale.
|
|
416
|
+
*
|
|
417
|
+
* A host page is loaded for the values of the fields it declares in `dependsOn`, so writing one
|
|
418
|
+
* of those fields means the page the host holds answers a record that no longer exists. The
|
|
419
|
+
* `dependsOn` names may be a member or the record or array that holds it; the write is expanded
|
|
420
|
+
* through the declaration tree in both directions, so a member write stales a page loaded for
|
|
421
|
+
* its container and a container write stales a page loaded for a member. The member names the
|
|
422
|
+
* `sourceId` the host loads, which is the only name it can reload by; a domain declared twice
|
|
423
|
+
* shares the one entry.
|
|
424
|
+
*/
|
|
425
|
+
function staleDomains(compiled, written) {
|
|
426
|
+
const stale = [];
|
|
427
|
+
const stated = new Set();
|
|
428
|
+
const touched = touchedFields(compiled, written);
|
|
429
|
+
const visit = (fields) => {
|
|
430
|
+
for (const field of fields) {
|
|
431
|
+
const source = field.optionSource;
|
|
432
|
+
if (source?.kind === 'host') {
|
|
433
|
+
const moved = source.dependsOn?.some((fieldId) => touched.has(fieldId)) ?? false;
|
|
434
|
+
if (moved && !stated.has(source.sourceId)) {
|
|
435
|
+
stated.add(source.sourceId);
|
|
436
|
+
stale.push(source.sourceId);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
visit(field.fields ?? []);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
visit(compiled.fields);
|
|
443
|
+
return stale;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* The delta between committed state and one candidate derived from it.
|
|
447
|
+
*
|
|
448
|
+
* The candidate state is the one `preview` and `propose` both derived, so the delta describes
|
|
449
|
+
* exactly the state `commit(candidate)` installs: the two cannot disagree about a blocker, a
|
|
450
|
+
* computed value or a row the change set touched. `change.blockers` is the pair the caller built
|
|
451
|
+
* once, so reading this delta canonicalises no blocker a second time.
|
|
452
|
+
*/
|
|
453
|
+
export function candidateDelta(compiled, base, candidate, change) {
|
|
454
|
+
return {
|
|
455
|
+
baseReportHash: change.baseReportHash,
|
|
456
|
+
candidateReportHash: change.candidateReportHash,
|
|
457
|
+
addedBlockers: change.blockers.added,
|
|
458
|
+
clearedBlockers: change.blockers.cleared,
|
|
459
|
+
changedComputations: changedComputations(compiled, base, candidate),
|
|
460
|
+
pendingChecks: pendingChecks(base, candidate),
|
|
461
|
+
overwrittenValues: overwrittenValues(compiled, base, change.operations),
|
|
462
|
+
structuralChanges: [...change.structuralWrites],
|
|
463
|
+
staleDomains: staleDomains(compiled, writtenFields(change.operations)),
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
//# sourceMappingURL=delta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delta.js","sourceRoot":"","sources":["../../../src/eval/engine/delta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO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{ assertNever } from '../../model/errors.js';\nimport { canonicalizeRestricted } from '../../canonical/jcs.js';\nimport type { CompiledField, FieldRef, WireValue } from '../../model/types.js';\nimport type { CompiledSchema } from '../../model/schema.js';\nimport { isWireArray, sameWireValue } from '../../model/values.js';\nimport { rowKeyToken } from '../../model/wire.js';\nimport { fieldKey } from '../access/projection.js';\nimport type { FieldComputation, FormRowState } from '../state/field-state.js';\nimport type { ValueState } from '../state/value-state.js';\nimport type { FormBlocker } from '../state/readiness.js';\nimport { declarationFor, heldValueOf } from './ops.js';\nimport type { EngineOperation, StructuralWrite } from './ops.js';\nimport type { SessionState } from './session.js';\nimport { noteBlockerIdentity } from '../state/measurement.js';\nimport { rowKeyOfItem } from '../addressing.js';\nimport { fieldIndex, rowStateOf } from './snapshot.js';\n\n/**\n * What a proposed change set would move, stated as data, `[ENGINE-8.2.1]`.\n *\n * It is a pure fact about two derived states: the committed one the candidate was derived from\n * and the one the candidate shows. Nothing here is a second evaluation — every member is read\n * from those states and the operations the caller proposed — so a host\n * can show a confirmation before applying, and the applying commit is the same one a keystroke\n * performs.\n *\n * The two digest members name the reports the two states decided, so a host can tell a delta\n * that changed nothing from one whose report moved without sealing either report itself.\n */\nexport interface CandidateDelta {\n readonly baseReportHash: string;\n readonly candidateReportHash: string;\n /** Blockers the candidate states that committed state does not. */\n readonly addedBlockers: readonly FormBlocker[];\n /** Blockers committed state states that the candidate does not. */\n readonly clearedBlockers: readonly FormBlocker[];\n /** Every system-computed value the change set moved, or that it left unreadable. */\n readonly changedComputations: readonly ChangedComputation[];\n /** Checks the change set left this device unable to decide. */\n readonly pendingChecks: readonly PendingCheck[];\n /** Every value, `null` or `remove` target whose committed value the change set replaces. */\n readonly overwrittenValues: readonly FieldRef[];\n /** Every row the change set appended or removed, with the identity the array addresses it by. */\n readonly structuralChanges: readonly StructuralWrite[];\n /**\n * Every host option source whose domain the change set makes stale.\n *\n * A written field reaches its declared ancestors and, because writing a container replaces the\n * members below it, its declared descendants. A write of the value committed state already\n * holds stales a dependent page too: the page is answered for the state it was loaded against,\n * and retaining it on a no-op write would be the open direction. The conservative answer is\n * the safe one.\n */\n readonly staleDomains: readonly string[];\n}\n\n/**\n * One system-computed value the change set moved.\n *\n * `withheld` is stated instead of the two sides whenever the access answer keeps either of them\n * from this reader, so a delta never carries a value the device may not show. A side that holds\n * no value at all (a writer that has not decided) is simply absent.\n */\nexport interface ChangedComputation {\n readonly fieldId: string;\n readonly rowKey?: string | number;\n readonly before?: WireValue;\n readonly after?: WireValue;\n readonly withheld?: true;\n}\n\n/** One check a change set left undecided, named by the rule that could not decide it. */\nexport interface PendingCheck {\n readonly ruleId: string;\n readonly status: 'DEFERRED' | 'UNKNOWN';\n}\n\n/** The two derived states a delta describes, the change set between them, and their digests. */\nexport interface DeltaChange {\n readonly operations: readonly EngineOperation[];\n readonly structuralWrites: readonly StructuralWrite[];\n readonly baseReportHash: string;\n readonly candidateReportHash: string;\n /** Both blocker lists, already identified once by the caller that derived the candidate. */\n readonly blockers: IdentifiedBlockers;\n}\n\n/**\n * The identity one blocker is compared by, `[ENGINE-8.2.2]`.\n *\n * Two blockers with the same identity are the same failure of the same binding, so a change set\n * that leaves one standing neither adds nor clears it. The members are the ones the contract\n * names: the kind, the rule, gate or screen that decided it, the field, the row and the message.\n * An `unavailableOption` also carries the held code, so replacing unavailable code A with code B\n * is one cleared blocker and one added one even when the reason is identical or absent; an\n * `invalidOption` carries the refused value or path for the same reason. A message payload\n * (`params`) is not identity: the failure is the same failure when its sentence's arguments move.\n *\n * The canonical text is the key, so an integer row key and its text spelling never collide and a\n * record-shaped refused value compares by its bytes.\n */\nfunction blockerIdentity(blocker: FormBlocker): string {\n noteBlockerIdentity();\n const row = 'rowKey' in blocker ? (blocker.rowKey ?? null) : null;\n switch (blocker.kind) {\n case 'rule':\n return canonicalizeRestricted([\n 'rule',\n blocker.ruleId,\n blocker.fieldId ?? null,\n row,\n blocker.messageKey,\n ]);\n case 'required':\n return canonicalizeRestricted(['required', blocker.fieldId, row, blocker.messageKey ?? null]);\n case 'gate':\n return canonicalizeRestricted(['gate', blocker.gateId, blocker.itemId, blocker.messageKey]);\n case 'cardinality':\n return canonicalizeRestricted(['cardinality', blocker.fieldId, blocker.bound]);\n case 'scale':\n return canonicalizeRestricted(['scale', blocker.fieldId, row, blocker.member]);\n case 'media':\n return canonicalizeRestricted([\n 'media',\n blocker.fieldId,\n row,\n blocker.index ?? null,\n blocker.member,\n ]);\n case 'rowCount':\n return canonicalizeRestricted(['rowCount', blocker.fieldId]);\n case 'invalidOption':\n return canonicalizeRestricted([\n 'invalidOption',\n blocker.fieldId,\n row,\n blocker.path ?? null,\n blocker.value ?? null,\n ]);\n case 'screen':\n return canonicalizeRestricted(['screen', blocker.screenId, blocker.messageKey ?? null]);\n case 'unavailableOption':\n return canonicalizeRestricted([\n 'unavailableOption',\n blocker.fieldId,\n row,\n blocker.code,\n blocker.messageKey ?? null,\n ]);\n default:\n // A new blocker kind must state the identity it is compared by, not share one silently.\n return assertNever(blocker);\n }\n}\n\n/** One blocker beside the canonical identity it is compared by. */\ninterface IdentifiedBlocker {\n readonly blocker: FormBlocker;\n readonly identity: string;\n}\n\n/**\n * Both blocker lists one delta compares, identified once.\n *\n * The added and cleared sets each test the other side, so building the identity inside both\n * filters canonicalised every blocker twice per delta. This pair makes one canonicalisation per\n * blocker the answer of the whole comparison, and the added and cleared answers derived from it\n * are frozen so the eager answer `propose` states and `delta.addedBlockers` can be one instance.\n * Only the two answers are retained: the identity entries themselves are the comparison's\n * working set and are released with `identifyBlockers`.\n */\nexport interface IdentifiedBlockers {\n /** The candidate's blockers committed state does not state, in the candidate's order. */\n readonly added: readonly FormBlocker[];\n /** Committed state's blockers the candidate does not state, in committed state's order. */\n readonly cleared: readonly FormBlocker[];\n}\n\n/**\n * Builds the blocker pair one candidate needs, exactly once.\n *\n * A `propose` reads the added set eagerly and the whole delta lazily, so a second pass here would\n * canonicalise the same blockers again. The pair is the shared answer both read.\n */\nexport function identifyBlockers(base: SessionState, candidate: SessionState): IdentifiedBlockers {\n const baseEntries = identified(base.form.blockers);\n const candidateEntries = identified(candidate.form.blockers);\n const baseIdentities = identitiesOf(baseEntries);\n const candidateIdentities = identitiesOf(candidateEntries);\n return Object.freeze({\n added: Object.freeze(blockersOnlyIn(candidateEntries, baseIdentities)),\n cleared: Object.freeze(blockersOnlyIn(baseEntries, candidateIdentities)),\n });\n}\n\n/**\n * Every blocker on one side of a delta, with its identity built once.\n *\n * The added and cleared sets each test the other side, so building the identity inside both\n * filters canonicalised every blocker twice per delta. The pairs make one canonicalisation per\n * blocker the answer of the whole comparison.\n */\nfunction identified(blockers: readonly FormBlocker[]): readonly IdentifiedBlocker[] {\n return blockers.map((blocker) => ({ blocker, identity: blockerIdentity(blocker) }));\n}\n\n/** The blockers one state states that the other does not, in the order its derivation states them. */\nfunction blockersOnlyIn(\n from: readonly IdentifiedBlocker[],\n against: ReadonlySet<string>,\n): readonly FormBlocker[] {\n return from.filter((entry) => !against.has(entry.identity)).map((entry) => entry.blocker);\n}\n\n/** Every blocker identity one derived state states. */\nfunction identitiesOf(blockers: readonly IdentifiedBlocker[]): ReadonlySet<string> {\n return new Set(blockers.map((entry) => entry.identity));\n}\n\n/** The sentinel a binding states when no writer produced a value for it. */\nconst NO_COMPUTATION: FieldComputation = { kind: 'none' };\n\n/**\n * One side's computation as the binding's delivery states it.\n *\n * A writer that could not decide answers `undetermined` whatever the binding's delivery is, so an\n * access answer that withholds the value never reaches the computation: masking one row of an\n * array leaves its computed member `undetermined` while its delivered value is `withheld`. The\n * delta's contract is about what this reader may be shown, so a side whose value the delivery\n * withholds is a withheld side, and stating it as one keeps the committed value out of the entry\n * exactly as a side the writer already answered `withheld` does.\n */\nfunction deliveredComputation(\n computation: FieldComputation,\n value: ValueState | undefined,\n): FieldComputation {\n return computation.kind === 'undetermined' && value?.kind === 'withheld'\n ? { kind: 'withheld' }\n : computation;\n}\n\n/** Whether two derived computation answers state the same value. */\nfunction sameComputation(left: FieldComputation, right: FieldComputation): boolean {\n if (left.kind === 'value' && right.kind === 'value') {\n return sameWireValue(left.value, right.value);\n }\n if (left.kind === 'undetermined' && right.kind === 'undetermined') {\n return left.status === right.status;\n }\n return left.kind === right.kind;\n}\n\n/**\n * The semantic value behind a withheld delivery, used only to decide whether it moved.\n *\n * A writer's overlay retains the value its access-filtered report and form entry omit. Neither\n * value leaves this comparison.\n */\nfunction computationBehindWithheld(\n compiled: CompiledSchema,\n state: SessionState,\n fieldId: string,\n rowKey: string | number | undefined,\n): FieldComputation {\n const computed =\n rowKey === undefined ? state.computed.get(fieldId) : state.computed.getRow(fieldId, rowKey);\n if (computed?.kind === 'decided') return { kind: 'value', value: computed.value };\n if (computed?.kind === 'undetermined') {\n return { kind: 'undetermined', status: computed.sentinel.undetermined };\n }\n // An active `defaultCompute` override deliberately has no overlay entry: the working record\n // is the writer's result then, with an absent current value reported as null by `resolveWriter`.\n const ref = rowKey === undefined ? { fieldId } : { fieldId, rowKey };\n return { kind: 'value', value: heldValueOf(compiled, state.working, ref) ?? null };\n}\n\n/**\n * One binding's computation change, or nothing when the derived answer is the same.\n *\n * A `withheld` side states neither value: the access answer keeps it from this reader, and a\n * delta is a view, not a disclosure channel. Two withheld deliveries still compare the semantic\n * values behind them, so a moving secret is a change without becoming a disclosure.\n */\nfunction computationChange(\n compiled: CompiledSchema,\n base: SessionState,\n candidate: SessionState,\n fieldId: string,\n rowKey: string | number | undefined,\n before: FieldComputation,\n after: FieldComputation,\n): ChangedComputation | undefined {\n const bothWithheld = before.kind === 'withheld' && after.kind === 'withheld';\n const comparableBefore = bothWithheld\n ? computationBehindWithheld(compiled, base, fieldId, rowKey)\n : before;\n const comparableAfter = bothWithheld\n ? computationBehindWithheld(compiled, candidate, fieldId, rowKey)\n : after;\n if (sameComputation(comparableBefore, comparableAfter)) return undefined;\n const withheld = before.kind === 'withheld' || after.kind === 'withheld';\n return {\n fieldId,\n ...(rowKey === undefined ? {} : { rowKey }),\n ...(withheld\n ? { withheld: true }\n : {\n ...(before.kind === 'value' ? { before: before.value } : {}),\n ...(after.kind === 'value' ? { after: after.value } : {}),\n }),\n };\n}\n\n/** The held-row answer for an array whose own delivery states nothing about one row. */\nconst NO_HELD_ROWS: ReadonlySet<string> = new Set();\n\n/**\n * Which rows a candidate's array still holds, and whether the array itself is withheld.\n *\n * Structural removal and lost addressing both take a row out of the derived view. Only the first\n * is a writer producing no value: an access answer can withhold the array that carries a row's\n * key, and a row can stay in the record while the derived view states no entry for it. The test is\n * therefore the candidate's own delivery: a withheld array, or a readable one that still holds an\n * item this row's key names. That side is withheld, not a printable \"after\" absence. A readable\n * array whose list no longer holds the key is a writer that produces no such row, which is the\n * absence the delta states by leaving the side out.\n *\n * One answer per writer rather than one per removed row. A change set that removes many rows of a\n * large array would otherwise walk the candidate's item list once for each of them, which is\n * quadratic in the row count while the rest of the delta is linear; the set is built on the first\n * removed row, so a change set that removes none pays nothing.\n */\ninterface CandidateRowHolding {\n /** Whether the array's own delivery withholds every row, whatever the item list holds. */\n readonly withheld: boolean;\n /** The wire-typed key of every item the candidate's readable list still addresses. */\n readonly held: ReadonlySet<string>;\n}\n\nfunction candidateRowHolding(\n compiled: CompiledSchema,\n candidate: SessionState,\n fieldId: string,\n): CandidateRowHolding {\n const arrayFieldId = declarationFor(compiled, fieldId).arrayFieldId ?? fieldId;\n const array = fieldIndex(candidate.form).get(arrayFieldId);\n if (array?.value.kind === 'withheld') return { withheld: true, held: NO_HELD_ROWS };\n if (array?.value.kind !== 'value' || !isWireArray(array.value.value)) {\n return { withheld: false, held: NO_HELD_ROWS };\n }\n const items = array.value.value;\n const declaration = declarationFor(compiled, arrayFieldId).field;\n const manifest = candidate.working.identity.manifests.get(arrayFieldId);\n const held = new Set<string>();\n for (const [index] of items.entries()) {\n const key = rowKeyOfItem(declaration, items, index, manifest);\n if (key !== undefined) held.add(rowKeyToken(key));\n }\n return { withheld: false, held };\n}\n\n/** The row changes of one row-scoped writer's member, keyed by the row's own wire key. */\nfunction rowComputationChanges(\n compiled: CompiledSchema,\n base: SessionState,\n candidate: SessionState,\n before: readonly FormRowState[],\n after: readonly FormRowState[],\n fieldId: string,\n): ChangedComputation[] {\n const prior = new Map<string, FormRowState>();\n for (const row of before) prior.set(rowKeyToken(row.rowKey), row);\n const changes: ChangedComputation[] = [];\n const candidateKeys = new Set<string>();\n for (const row of after) {\n const key = rowKeyToken(row.rowKey);\n candidateKeys.add(key);\n const priorRow = prior.get(key);\n const change = computationChange(\n compiled,\n base,\n candidate,\n fieldId,\n row.rowKey,\n deliveredComputation(priorRow?.computation ?? NO_COMPUTATION, priorRow?.value),\n deliveredComputation(row.computation, row.value),\n );\n if (change !== undefined) changes.push(change);\n }\n // A removed row has no candidate entry to iterate, but its writer still moved from the value\n // committed state produced to no value at all. State that removal in committed row order. A row\n // that remains in the record but is no longer addressable instead has a withheld after side.\n let holding: CandidateRowHolding | undefined;\n for (const row of before) {\n const token = rowKeyToken(row.rowKey);\n if (candidateKeys.has(token)) continue;\n holding ??= candidateRowHolding(compiled, candidate, fieldId);\n const after: FieldComputation =\n holding.withheld || holding.held.has(token) ? { kind: 'withheld' } : NO_COMPUTATION;\n const change = computationChange(\n compiled,\n base,\n candidate,\n fieldId,\n row.rowKey,\n deliveredComputation(row.computation, row.value),\n after,\n );\n if (change !== undefined) changes.push(change);\n }\n return changes;\n}\n\n/**\n * Every system-computed value the change set moved.\n *\n * A writer owns its target, so the derived `computation` is that writer's answer and nothing\n * else: a field nobody computes states `none` on both sides and is skipped, whether the record\n * holds a value at the binding or not.\n */\nfunction changedComputations(\n compiled: CompiledSchema,\n base: SessionState,\n candidate: SessionState,\n): ChangedComputation[] {\n const before = fieldIndex(base.form);\n const changes: ChangedComputation[] = [];\n for (const field of candidate.form.fields) {\n const prior = before.get(field.fieldId);\n if (prior === undefined) continue;\n if (!prior.systemComputed && !field.systemComputed) continue;\n // A computed array has its own value as well as row entries. A row member's field-level\n // answer is `none`, so this comparison adds nothing there and the row walk states its cells.\n const change = computationChange(\n compiled,\n base,\n candidate,\n field.fieldId,\n undefined,\n deliveredComputation(prior.computation, prior.value),\n deliveredComputation(field.computation, field.value),\n );\n if (change !== undefined) changes.push(change);\n if (field.rows !== undefined || prior.rows !== undefined) {\n changes.push(\n ...rowComputationChanges(\n compiled,\n base,\n candidate,\n prior.rows ?? [],\n field.rows ?? [],\n field.fieldId,\n ),\n );\n }\n }\n return changes;\n}\n\n/**\n * The checks the candidate left undecided that committed state had settled.\n *\n * A check is a rule's answer, and `DEFERRED` and `UNKNOWN` are the two answers that are not one.\n * A rule already stating the same undecided answer is not reported: the change set did not make\n * it undecided. The delta names no row — a rule that answers per row states one entry — because\n * the open question is the check's, and readiness names the row it belongs to.\n */\nfunction pendingChecks(base: SessionState, candidate: SessionState): PendingCheck[] {\n const settled = new Set<string>();\n for (const result of base.report.rules) settled.add(`${result.ruleId}\\u0000${result.status}`);\n const checks: PendingCheck[] = [];\n const stated = new Set<string>();\n for (const result of candidate.report.rules) {\n if (result.status !== 'DEFERRED' && result.status !== 'UNKNOWN') continue;\n const key = `${result.ruleId}\\u0000${result.status}`;\n if (settled.has(key) || stated.has(key)) continue;\n stated.add(key);\n checks.push({ ruleId: result.ruleId, status: result.status });\n }\n return checks;\n}\n\n/**\n * Whether the committed view withholds one target's value from this reader.\n *\n * The derived entry is the delivery answer the write guard is rendered from, and it already\n * weighs every declaration the reference sits under, the row it belongs to, a host redaction and\n * the session's `write_only` unlock. Asking it here is the same question `changedComputations`\n * asks of a writer's answer; neither the raw working record nor the proposed value participates.\n */\nfunction committedValueWithheld(base: SessionState, ref: FieldRef): boolean {\n const field = fieldIndex(base.form).get(ref.fieldId);\n if (field === undefined) return false;\n if (ref.rowKey === undefined) return field.value.kind === 'withheld';\n // A row the derived view does not address is not a value this reader was given, even when the\n // private record still holds it. Stating the reference would answer which row moved.\n const row = rowStateOf(field, ref.rowKey);\n return row === undefined || row.value.kind === 'withheld';\n}\n\n/**\n * Every value, `null` or `remove` target whose committed value the change set replaces.\n *\n * A target the committed record holds no value at is not overwritten: a write that fills a blank\n * control replaces nothing the user had. A write that stores what the record already holds\n * replaces nothing either, and the session already treats it as no change at all.\n *\n * A target whose committed value delivery withholds is omitted without comparing anything. A\n * `system` write may name such a target, so comparing would let a delta answer whether a secret\n * equals a guess; the presence of a reference would be that answer.\n */\nfunction overwrittenValues(\n compiled: CompiledSchema,\n base: SessionState,\n operations: readonly EngineOperation[],\n): readonly FieldRef[] {\n const overwritten: FieldRef[] = [];\n const seen = new Set<string>();\n for (const operation of operations) {\n if (operation.kind !== 'value' && operation.kind !== 'null' && operation.kind !== 'remove') {\n continue;\n }\n if (committedValueWithheld(base, operation.ref)) continue;\n const held = heldValueOf(compiled, base.working, operation.ref);\n if (held === undefined) continue;\n if (operation.kind === 'value' && sameWireValue(held, operation.value)) continue;\n if (operation.kind === 'null' && held === null) continue;\n const key = fieldKey(operation.ref);\n if (seen.has(key)) continue;\n seen.add(key);\n overwritten.push(Object.freeze({ ...operation.ref }));\n }\n return overwritten;\n}\n\n/** Every declared field the change set writes, whatever the operation writes it with. */\nfunction writtenFields(operations: readonly EngineOperation[]): ReadonlySet<string> {\n const written = new Set<string>();\n for (const operation of operations) {\n switch (operation.kind) {\n case 'value':\n case 'null':\n case 'remove':\n written.add(operation.ref.fieldId);\n break;\n case 'append':\n case 'insert':\n case 'removeRow':\n case 'move':\n written.add(operation.fieldId);\n break;\n case 'context':\n case 'env':\n case 'access':\n break;\n default:\n return assertNever(operation);\n }\n }\n return written;\n}\n\n/**\n * Every declared field the change set touches, seen through the declaration tree.\n *\n * A written field reaches its declared ancestors, because a value that lives below a record or\n * array container is part of that container's value: a host page loaded for the container is\n * answering a record the write has moved. It also reaches its declared descendants, because\n * writing a container replaces the members below it: a page loaded for one of those members is\n * answering a value the write has replaced. Names that name neither a container nor a member\n * are kept as they are, so a dependency no declaration resolves still compares by its own name.\n */\nfunction touchedFields(\n compiled: CompiledSchema,\n written: ReadonlySet<string>,\n): ReadonlySet<string> {\n const parents = new Map<string, string>();\n const children = new Map<string, readonly string[]>();\n const visit = (fields: readonly CompiledField[]): void => {\n for (const field of fields) {\n const members = field.fields ?? [];\n if (members.length > 0)\n children.set(\n field.fieldId,\n members.map((member) => member.fieldId),\n );\n for (const member of members) parents.set(member.fieldId, field.fieldId);\n visit(members);\n }\n };\n visit(compiled.fields);\n const touched = new Set(written);\n for (const fieldId of written) {\n let ancestor = parents.get(fieldId);\n while (ancestor !== undefined && !touched.has(ancestor)) {\n touched.add(ancestor);\n ancestor = parents.get(ancestor);\n }\n }\n for (const fieldId of written) {\n const pending = [...(children.get(fieldId) ?? [])];\n while (pending.length > 0) {\n const memberId = pending.pop();\n if (memberId === undefined) continue;\n if (!touched.has(memberId)) touched.add(memberId);\n pending.push(...(children.get(memberId) ?? []));\n }\n }\n return touched;\n}\n\n/**\n * Every host option source whose domain the change set makes stale.\n *\n * A host page is loaded for the values of the fields it declares in `dependsOn`, so writing one\n * of those fields means the page the host holds answers a record that no longer exists. The\n * `dependsOn` names may be a member or the record or array that holds it; the write is expanded\n * through the declaration tree in both directions, so a member write stales a page loaded for\n * its container and a container write stales a page loaded for a member. The member names the\n * `sourceId` the host loads, which is the only name it can reload by; a domain declared twice\n * shares the one entry.\n */\nfunction staleDomains(compiled: CompiledSchema, written: ReadonlySet<string>): readonly string[] {\n const stale: string[] = [];\n const stated = new Set<string>();\n const touched = touchedFields(compiled, written);\n const visit = (fields: readonly CompiledField[]): void => {\n for (const field of fields) {\n const source = field.optionSource;\n if (source?.kind === 'host') {\n const moved = source.dependsOn?.some((fieldId) => touched.has(fieldId)) ?? false;\n if (moved && !stated.has(source.sourceId)) {\n stated.add(source.sourceId);\n stale.push(source.sourceId);\n }\n }\n visit(field.fields ?? []);\n }\n };\n visit(compiled.fields);\n return stale;\n}\n\n/**\n * The delta between committed state and one candidate derived from it.\n *\n * The candidate state is the one `preview` and `propose` both derived, so the delta describes\n * exactly the state `commit(candidate)` installs: the two cannot disagree about a blocker, a\n * computed value or a row the change set touched. `change.blockers` is the pair the caller built\n * once, so reading this delta canonicalises no blocker a second time.\n */\nexport function candidateDelta(\n compiled: CompiledSchema,\n base: SessionState,\n candidate: SessionState,\n change: DeltaChange,\n): CandidateDelta {\n return {\n baseReportHash: change.baseReportHash,\n candidateReportHash: change.candidateReportHash,\n addedBlockers: change.blockers.added,\n clearedBlockers: change.blockers.cleared,\n changedComputations: changedComputations(compiled, base, candidate),\n pendingChecks: pendingChecks(base, candidate),\n overwrittenValues: overwrittenValues(compiled, base, change.operations),\n structuralChanges: [...change.structuralWrites],\n staleDomains: staleDomains(compiled, writtenFields(change.operations)),\n };\n}\n"]}
|