@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,1067 @@
|
|
|
1
|
+
import { rowKeyToken } from '../../model/wire.js';
|
|
2
|
+
import { diagnosticDoc } from '../../expr/diagnostics.js';
|
|
3
|
+
import { fieldKey } from '../access/projection.js';
|
|
4
|
+
import { gateOutcome } from '../gate.js';
|
|
5
|
+
import { heldValuesOf, holdsItem, hostOptionCode, hostUnavailableItems, } from './unavailable-options.js';
|
|
6
|
+
function indexDiagnostics(snapshot) {
|
|
7
|
+
const index = new Map();
|
|
8
|
+
for (const diagnostic of snapshot.report.diagnostics ?? []) {
|
|
9
|
+
const ruleId = diagnostic.ruleId;
|
|
10
|
+
if (ruleId === undefined || diagnostic.severity !== 'block')
|
|
11
|
+
continue;
|
|
12
|
+
let entry = index.get(ruleId);
|
|
13
|
+
if (entry === undefined) {
|
|
14
|
+
entry = {
|
|
15
|
+
blockRowless: false,
|
|
16
|
+
engineRowless: false,
|
|
17
|
+
blockRows: new Set(),
|
|
18
|
+
engineRows: new Set(),
|
|
19
|
+
};
|
|
20
|
+
index.set(ruleId, entry);
|
|
21
|
+
}
|
|
22
|
+
const engine = diagnostic.code === 'ENGINE_ERROR';
|
|
23
|
+
if (diagnostic.rowKey === undefined) {
|
|
24
|
+
entry.blockRowless = true;
|
|
25
|
+
if (engine)
|
|
26
|
+
entry.engineRowless = true;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const token = rowKeyToken(diagnostic.rowKey);
|
|
30
|
+
entry.blockRows.add(token);
|
|
31
|
+
if (engine)
|
|
32
|
+
entry.engineRows.add(token);
|
|
33
|
+
}
|
|
34
|
+
return index;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether one result carries a block-severity diagnostic, which makes it a decided refusal.
|
|
38
|
+
*
|
|
39
|
+
* A row-scoped diagnostic names its row, so one row's `ENGINE_ERROR` does not turn another
|
|
40
|
+
* row's undecided answer into a failure. A diagnostic with no row belongs to the whole rule and
|
|
41
|
+
* reaches every result it stated.
|
|
42
|
+
*/
|
|
43
|
+
function engineFailed(diagnostics, ruleId, rowKey) {
|
|
44
|
+
const entry = diagnostics.get(ruleId);
|
|
45
|
+
if (entry === undefined)
|
|
46
|
+
return false;
|
|
47
|
+
if (entry.blockRowless)
|
|
48
|
+
return true;
|
|
49
|
+
return rowKey !== undefined && entry.blockRows.has(rowKeyToken(rowKey));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Whether the engine itself failed on `ruleId`, rather than stating a decided diagnostic such
|
|
53
|
+
* as `ROW_IDENTITY`. A branch rule (`visible`, `required`, `enabled`) that raised decided
|
|
54
|
+
* nothing, so the branch it guards is unknown and the record is not admissible; a branch rule
|
|
55
|
+
* answered with any other block diagnostic is the open question the readiness fold states.
|
|
56
|
+
*/
|
|
57
|
+
function engineErrorFailed(diagnostics, ruleId, rowKey) {
|
|
58
|
+
const entry = diagnostics.get(ruleId);
|
|
59
|
+
if (entry === undefined)
|
|
60
|
+
return false;
|
|
61
|
+
if (entry.engineRowless)
|
|
62
|
+
return true;
|
|
63
|
+
return rowKey !== undefined && entry.engineRows.has(rowKeyToken(rowKey));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Every result one rule stated, in report order: one per addressed row plus a row-less answer
|
|
67
|
+
* when the rule could not address its rows at all.
|
|
68
|
+
*
|
|
69
|
+
* A rule's report is per row, so a question about "the rule" has one answer per row. Reading
|
|
70
|
+
* `firstResult`/`firstUndecided` for an item rule collapsed every row after the first into it: a
|
|
71
|
+
* host painting one line per blocker then left the report's other diagnostics unattached.
|
|
72
|
+
*/
|
|
73
|
+
function resultsOf(rules, ruleId) {
|
|
74
|
+
const results = [...(rules.rowResults.get(ruleId)?.values() ?? [])];
|
|
75
|
+
const rowless = rules.rowlessResults.get(ruleId);
|
|
76
|
+
if (rowless !== undefined)
|
|
77
|
+
results.push(rowless);
|
|
78
|
+
return results;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Derives the gates, screens, blockers and the readiness predicate from one snapshot.
|
|
82
|
+
*
|
|
83
|
+
* `rules` is the derivation's one index of the report, so a rule's own answer is a map hit: the
|
|
84
|
+
* report states one result per rule — and one per row for an item rule — and looking each rule's
|
|
85
|
+
* answer up with a scan of that list, once per compiled rule, made this pass the rules squared.
|
|
86
|
+
*/
|
|
87
|
+
export function deriveReadiness(compiled, snapshot, fields, rules, options) {
|
|
88
|
+
const diagnostics = indexDiagnostics(snapshot);
|
|
89
|
+
const fieldsById = new Map(fields.map((field) => [field.fieldId, field]));
|
|
90
|
+
const addressing = addressingByField(compiled);
|
|
91
|
+
const gates = deriveGates(compiled, snapshot, rules);
|
|
92
|
+
const screens = deriveScreens(compiled, snapshot);
|
|
93
|
+
// A held code's availability is one fact with two answers: an unavailable code blocks, and an
|
|
94
|
+
// undetermined one is an open question. Both are read in one pass so the two lists cannot
|
|
95
|
+
// disagree about what the record holds.
|
|
96
|
+
const availability = heldAvailability(fields, snapshot, options);
|
|
97
|
+
const blockers = deriveBlockers(compiled, fields, fieldsById, gates, screens, rules, diagnostics, addressing, availability.blockers);
|
|
98
|
+
const hasDeferredChecks = rules.hasDeferred ||
|
|
99
|
+
hasDeferredRequirement(fields) ||
|
|
100
|
+
gates.some((gate) =>
|
|
101
|
+
// A settled gate (switched off or approved) contributes nothing. Any `DEFERRED` item on
|
|
102
|
+
// an in-force gate is a handoff, whatever the gate's own severity: a `warn` gate still
|
|
103
|
+
// reports a server check the server must settle, and its items decided the fact.
|
|
104
|
+
gate.outcome !== 'INACTIVE' &&
|
|
105
|
+
gate.outcome !== 'OVERRIDDEN' &&
|
|
106
|
+
gate.items.some((item) => item.status === 'DEFERRED')) ||
|
|
107
|
+
screens.some((screen) => screen.severity === 'block' && screen.outcome === 'DEFERRED');
|
|
108
|
+
const { checks: undeterminedChecks, skipped: skippedChecks } = deriveUndeterminedChecks(compiled, snapshot, fields, fieldsById, gates, rules, diagnostics, availability.checks);
|
|
109
|
+
const undeterminedComputations = deriveUndeterminedComputations(fields);
|
|
110
|
+
// Every cause that makes the verdict `BLOCKED` names itself in `blockers`: a rule failure, a
|
|
111
|
+
// missing requirement, a *decided* gate item, an array bound, a media constraint, a row-count
|
|
112
|
+
// mismatch, a scale violation, a refused or unavailable option value and a failed screen. A
|
|
113
|
+
// gate item that did not decide is
|
|
114
|
+
// not one of those — it is an open question, stated in `undeterminedChecks` — so a host that
|
|
115
|
+
// renders "why can I not submit" never reads an empty list beside `BLOCKED`. (`evaluateGate`
|
|
116
|
+
// still answers `BLOCKED` for the same gate: its surface has no undecided arm by design.)
|
|
117
|
+
const blocked = blockers.length > 0;
|
|
118
|
+
const undetermined = undeterminedChecks.length > 0;
|
|
119
|
+
const ready = !blocked && !undetermined;
|
|
120
|
+
return {
|
|
121
|
+
gates,
|
|
122
|
+
screens,
|
|
123
|
+
blockers,
|
|
124
|
+
ready,
|
|
125
|
+
hasDeferredChecks,
|
|
126
|
+
undeterminedChecks,
|
|
127
|
+
hasUndeterminedChecks: undetermined,
|
|
128
|
+
skippedChecks,
|
|
129
|
+
undeterminedComputations,
|
|
130
|
+
// The one verdict, in precedence order: a decided refusal is what the respondent can act on,
|
|
131
|
+
// so it outranks an open question. A gate that blocks contributes a blocker above, so a
|
|
132
|
+
// record can never be `SUBMIT` with a blocking gate; a deferred check is a handoff, not a
|
|
133
|
+
// block, and `hasDeferredChecks` says so.
|
|
134
|
+
verdict: blocked ? 'BLOCKED' : undetermined ? 'UNDETERMINED' : 'SUBMIT',
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Whether a visible requirement is the server's to settle rather than the respondent's.
|
|
139
|
+
*
|
|
140
|
+
* A field the server redacted states `deferred` at its binding, or in each row that holds the
|
|
141
|
+
* value. It is not a blocker and not an open question: it is a handoff, and the answer leaves
|
|
142
|
+
* local readiness clean while `hasDeferredChecks` says the server still has to settle it.
|
|
143
|
+
*/
|
|
144
|
+
function hasDeferredRequirement(fields) {
|
|
145
|
+
return fields.some((field) => field.visible &&
|
|
146
|
+
(field.missingRequired === 'deferred' ||
|
|
147
|
+
(field.rows ?? []).some((row) => row.missingRequired === 'deferred')));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Every block-severity check this device could not decide, in declaration order.
|
|
151
|
+
*
|
|
152
|
+
* Five sources, one answer:
|
|
153
|
+
*
|
|
154
|
+
* - a `validate` left `UNKNOWN` with no `block` diagnostic is the silent skip `RULES-2.1.1`
|
|
155
|
+
* used to describe. It emits no violation, but it is not a pass either, and a record that
|
|
156
|
+
* could not answer "at least one row" must not submit as though it had. A result whose only
|
|
157
|
+
* undecided cause is a read this device may not perform is skipped instead: no respondent
|
|
158
|
+
* action decides it, so it is not an open question and the verdict stays `SUBMIT`;
|
|
159
|
+
* - a `required` rule that fired whose presence could not be confirmed: the field's
|
|
160
|
+
* `missingRequired` is `undetermined`, which is neither a gap nor a satisfied value (a
|
|
161
|
+
* server-redacted presence is `deferred`, a handoff stated by `hasDeferredChecks`);
|
|
162
|
+
* - a block-severity `screen` whose outcome is `UNKNOWN`, unless only a refused read left it so;
|
|
163
|
+
* - a block-severity gate, or one of its items, that did not decide. The gate's surface verdict
|
|
164
|
+
* stays `BLOCKED` for that status, but readiness states the open question rather than a
|
|
165
|
+
* cause the respondent got wrong;
|
|
166
|
+
* - a held option whose availability is undetermined, naming its field, row, code and cause.
|
|
167
|
+
*
|
|
168
|
+
* An engine error is excluded: the rule raised, so it is a decided refusal with a cause and
|
|
169
|
+
* `undecidedBlockers` (or the row facts) already states it. A hidden field is excluded for the
|
|
170
|
+
* same reason a blocker is: the respondent cannot correct a control that is not on screen.
|
|
171
|
+
* A `DEFERRED` result is a server handoff and is reported by `hasDeferredChecks`, not here.
|
|
172
|
+
*/
|
|
173
|
+
function deriveUndeterminedChecks(compiled, snapshot, fields, fieldsById, gates, rules, diagnostics, availability) {
|
|
174
|
+
const checks = [];
|
|
175
|
+
const skipped = [];
|
|
176
|
+
for (const rule of compiled.rules ?? []) {
|
|
177
|
+
if (rule.kind === 'screen') {
|
|
178
|
+
// A screen with no report section states no decision, exactly as `deriveScreens` reads it.
|
|
179
|
+
const outcome = snapshot.report.screens?.[rule.ruleId]?.outcome ?? 'UNKNOWN';
|
|
180
|
+
if ((rule.severity ?? 'block') !== 'block' || outcome !== 'UNKNOWN')
|
|
181
|
+
continue;
|
|
182
|
+
// A screen whose only undecided cause is a refused read is not an open question for the
|
|
183
|
+
// respondent: `screenStatus` states the rule's verdict, and the cause is the client's.
|
|
184
|
+
const screenResult = rules.firstResult.get(rule.ruleId);
|
|
185
|
+
if (screenResult !== undefined &&
|
|
186
|
+
rules.undecided.dispositionOf(rule.ruleId, screenResult) === 'skipped') {
|
|
187
|
+
skipped.push({ kind: 'screen', screenId: rule.ruleId });
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
checks.push({
|
|
191
|
+
kind: 'screen',
|
|
192
|
+
screenId: rule.ruleId,
|
|
193
|
+
...(rule.messageKey === undefined ? {} : { messageKey: rule.messageKey }),
|
|
194
|
+
});
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (rule.kind !== 'validate')
|
|
198
|
+
continue;
|
|
199
|
+
const fieldId = rule.targetFieldId ?? rule.fieldId;
|
|
200
|
+
if (hiddenField(fieldsById, fieldId))
|
|
201
|
+
continue;
|
|
202
|
+
if (rule.scope === 'item') {
|
|
203
|
+
// One open question per row the rule could not decide. A row whose own engine error
|
|
204
|
+
// already makes it a blocker is not also an undetermined check.
|
|
205
|
+
for (const result of resultsOf(rules, rule.ruleId)) {
|
|
206
|
+
if (result.severity !== 'block' || result.status !== 'UNKNOWN')
|
|
207
|
+
continue;
|
|
208
|
+
if (engineFailed(diagnostics, rule.ruleId, result.rowKey))
|
|
209
|
+
continue;
|
|
210
|
+
if (rules.undecided.dispositionOf(rule.ruleId, result) === 'skipped') {
|
|
211
|
+
skipped.push({
|
|
212
|
+
kind: 'rule',
|
|
213
|
+
ruleId: result.ruleId,
|
|
214
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
215
|
+
...(result.rowKey === undefined ? {} : { rowKey: result.rowKey }),
|
|
216
|
+
});
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
checks.push({
|
|
220
|
+
kind: 'rule',
|
|
221
|
+
ruleId: result.ruleId,
|
|
222
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
223
|
+
...(result.rowKey === undefined ? {} : { rowKey: result.rowKey }),
|
|
224
|
+
...requiredMessage(result.messageKey ?? rule.messageKey, result.params),
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const undecided = rules.firstUndecided.get(rule.ruleId);
|
|
230
|
+
if (undecided === undefined)
|
|
231
|
+
continue;
|
|
232
|
+
if (engineFailed(diagnostics, rule.ruleId, undecided.rowKey))
|
|
233
|
+
continue;
|
|
234
|
+
if (rules.undecided.dispositionOf(rule.ruleId, undecided) === 'skipped') {
|
|
235
|
+
skipped.push({
|
|
236
|
+
kind: 'rule',
|
|
237
|
+
ruleId: undecided.ruleId,
|
|
238
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
239
|
+
...(undecided.rowKey === undefined ? {} : { rowKey: undecided.rowKey }),
|
|
240
|
+
});
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
checks.push({
|
|
244
|
+
kind: 'rule',
|
|
245
|
+
ruleId: undecided.ruleId,
|
|
246
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
247
|
+
...(undecided.rowKey === undefined ? {} : { rowKey: undecided.rowKey }),
|
|
248
|
+
...requiredMessage(undecided.messageKey ?? rule.messageKey, undecided.params),
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const requirementRules = undeterminedRequirementRules(compiled, snapshot, fieldsById, rules, diagnostics);
|
|
252
|
+
checks.push(...requirementRules.checks);
|
|
253
|
+
skipped.push(...requirementRules.skipped);
|
|
254
|
+
checks.push(...undeterminedRequirements(fields));
|
|
255
|
+
const gateChecks = undeterminedGates(gates, rules.undecided);
|
|
256
|
+
checks.push(...gateChecks.checks);
|
|
257
|
+
skipped.push(...gateChecks.skipped);
|
|
258
|
+
checks.push(...availability);
|
|
259
|
+
return { checks, skipped };
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The blockers and open questions the codes this record holds state, `RULES-7.1.6` and
|
|
263
|
+
* `ENGINE-7.1.7`.
|
|
264
|
+
*
|
|
265
|
+
* One pass over every visible binding, so the two lists cannot disagree about what is held. A
|
|
266
|
+
* declared code's answer comes from the evaluation that decided it, and a host page's answer is
|
|
267
|
+
* taken as given and matched by the value the page holds. An unheld unavailable code blocks
|
|
268
|
+
* nothing: it is a fact of the domain, stated on the field's `unavailableOptions`, not a failure
|
|
269
|
+
* of this record.
|
|
270
|
+
*
|
|
271
|
+
* A hidden field contributes nothing, exactly as it contributes no other blocker: the respondent
|
|
272
|
+
* cannot correct a control the page does not paint.
|
|
273
|
+
*/
|
|
274
|
+
function heldAvailability(fields, snapshot, options) {
|
|
275
|
+
const found = { snapshot, options, blockers: [], checks: [] };
|
|
276
|
+
for (const field of fields) {
|
|
277
|
+
if (!field.visible)
|
|
278
|
+
continue;
|
|
279
|
+
// A row member's domain is keyed by its row, including a member whose own value is a
|
|
280
|
+
// multi-select array. A top-level container's domain is keyed by the field instead, so its
|
|
281
|
+
// row lookups find no entry and the field-level read below states its selection once.
|
|
282
|
+
for (const row of field.rows ?? [])
|
|
283
|
+
readHeldBinding(found, field, row.rowKey, row.value);
|
|
284
|
+
readHeldBinding(found, field, undefined, field.value);
|
|
285
|
+
}
|
|
286
|
+
return { blockers: found.blockers, checks: found.checks };
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* The name a row is shown by, when its key is one the reader can see.
|
|
290
|
+
*
|
|
291
|
+
* A natural key is the value of the declaration's key member and a value key is the item itself:
|
|
292
|
+
* both are authored text, so both are the row's name. A key the host minted addresses the row and
|
|
293
|
+
* names nothing a person recognises. This is the one place that decision is made; a sentence
|
|
294
|
+
* receives the answer and never inspects the key's spelling.
|
|
295
|
+
*/
|
|
296
|
+
function rowNameOf(rowKey, addressing) {
|
|
297
|
+
return addressing === 'natural' || addressing === 'value' ? String(rowKey) : undefined;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The addressing every field inherits, walked once from the declarations.
|
|
301
|
+
*
|
|
302
|
+
* An array states how its own rows are named, and each member of that array is a row of it, so a
|
|
303
|
+
* member inherits the array's answer. A nested array addresses nothing in v1, and so do its
|
|
304
|
+
* members. Readiness turns this into a row name once, rather than making every renderer decide
|
|
305
|
+
* whether a key looks generated.
|
|
306
|
+
*/
|
|
307
|
+
function addressingByField(compiled) {
|
|
308
|
+
const addressing = new Map();
|
|
309
|
+
const visit = (fields, enclosing, insideArray) => {
|
|
310
|
+
for (const field of fields) {
|
|
311
|
+
const isArray = field.primitive === 'array';
|
|
312
|
+
const declared = isArray
|
|
313
|
+
? insideArray
|
|
314
|
+
? 'unsupported'
|
|
315
|
+
: (field.rowKey?.mode ?? (field.items === undefined ? undefined : 'value'))
|
|
316
|
+
: enclosing;
|
|
317
|
+
if (declared !== undefined)
|
|
318
|
+
addressing.set(field.fieldId, declared);
|
|
319
|
+
if (field.fields !== undefined) {
|
|
320
|
+
visit(field.fields, isArray ? declared : enclosing, insideArray || isArray);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
visit(compiled.fields, undefined, false);
|
|
325
|
+
return addressing;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* One binding's held codes, as the blocker or the open question each of them states.
|
|
329
|
+
*
|
|
330
|
+
* A declared code's answer is the one the evaluation decided. A host page's answer is taken as
|
|
331
|
+
* given and matched by the value the page holds, because the engine evaluates no declaration for
|
|
332
|
+
* a code it does not know (`RULES-7.1.5`).
|
|
333
|
+
*/
|
|
334
|
+
function readHeldBinding(found, field, rowKey, value) {
|
|
335
|
+
const key = fieldKey(rowKey === undefined ? { fieldId: field.fieldId } : { fieldId: field.fieldId, rowKey });
|
|
336
|
+
const at = rowKey === undefined ? {} : { rowKey };
|
|
337
|
+
for (const answer of found.snapshot.optionAvailability.get(key)?.held ?? []) {
|
|
338
|
+
if (answer.kind === 'undetermined') {
|
|
339
|
+
const labelKey = field.options?.find((option) => option.code === answer.code)?.labelKey;
|
|
340
|
+
found.checks.push({
|
|
341
|
+
kind: 'unavailableOption',
|
|
342
|
+
fieldId: field.fieldId,
|
|
343
|
+
...at,
|
|
344
|
+
code: answer.code,
|
|
345
|
+
...(labelKey === undefined ? {} : { labelKey }),
|
|
346
|
+
cause: answer.cause,
|
|
347
|
+
});
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
found.blockers.push({
|
|
351
|
+
kind: 'unavailableOption',
|
|
352
|
+
fieldId: field.fieldId,
|
|
353
|
+
...at,
|
|
354
|
+
code: answer.code,
|
|
355
|
+
...(answer.messageKey === undefined ? {} : { messageKey: answer.messageKey }),
|
|
356
|
+
...(answer.params === undefined ? {} : { params: answer.params }),
|
|
357
|
+
...(answer.suggestions === undefined ? {} : { suggestions: answer.suggestions }),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
if (field.optionSource?.kind !== 'host')
|
|
361
|
+
return;
|
|
362
|
+
const held = heldValuesOf(value);
|
|
363
|
+
if (held.length === 0)
|
|
364
|
+
return;
|
|
365
|
+
for (const item of hostUnavailableItems(found.options.optionDomains?.get(key))) {
|
|
366
|
+
if (!holdsItem(item, held))
|
|
367
|
+
continue;
|
|
368
|
+
const code = hostOptionCode(item);
|
|
369
|
+
if (code === undefined)
|
|
370
|
+
continue;
|
|
371
|
+
found.blockers.push({
|
|
372
|
+
kind: 'unavailableOption',
|
|
373
|
+
fieldId: field.fieldId,
|
|
374
|
+
...at,
|
|
375
|
+
code,
|
|
376
|
+
...(item.unavailableMessageKey === undefined
|
|
377
|
+
? {}
|
|
378
|
+
: { messageKey: item.unavailableMessageKey }),
|
|
379
|
+
...(item.unavailableParams === undefined ? {} : { params: item.unavailableParams }),
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* The gates and gate items that could not decide, `[RULES-4.1.1]`.
|
|
385
|
+
*
|
|
386
|
+
* An inactive gate requires nothing, a deferred one is the server's handoff and an approved one
|
|
387
|
+
* was settled by its override, so none of those is an open question. An item that could not be
|
|
388
|
+
* decided is the more specific question and is stated per item; a gate whose own expression did
|
|
389
|
+
* not decide, with no undecided item, is stated once without an `itemId`. A gate whose status is
|
|
390
|
+
* `UNKNOWN` is `BLOCKED` on its surface verdict (`gateOutcome`), which is right there and must
|
|
391
|
+
* not be restated here as a failure.
|
|
392
|
+
*/
|
|
393
|
+
function undeterminedGates(gates, causes) {
|
|
394
|
+
const checks = [];
|
|
395
|
+
const skipped = [];
|
|
396
|
+
for (const gate of gates) {
|
|
397
|
+
if (gate.severity !== 'block')
|
|
398
|
+
continue;
|
|
399
|
+
if (gate.outcome === 'INACTIVE' || gate.outcome === 'OVERRIDDEN')
|
|
400
|
+
continue;
|
|
401
|
+
const cause = causes.causeOf(gate.gateId, undefined);
|
|
402
|
+
const failed = cause?.engineError === true;
|
|
403
|
+
// The read-only policy answers only the access part of a mixed outcome. A readable gap or an
|
|
404
|
+
// engine error still leaves its own open question when the policy made the report DEFERRED.
|
|
405
|
+
if (gate.outcome === 'DEFERRED' && !cause?.missingInput && !failed)
|
|
406
|
+
continue;
|
|
407
|
+
const items = gate.items.filter((item) => item.status === 'UNKNOWN');
|
|
408
|
+
const record = () => {
|
|
409
|
+
if (items.length > 0) {
|
|
410
|
+
for (const item of items) {
|
|
411
|
+
checks.push({ kind: 'gate', gateId: gate.gateId, itemId: item.itemId });
|
|
412
|
+
}
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (gate.status === 'UNKNOWN')
|
|
416
|
+
checks.push({ kind: 'gate', gateId: gate.gateId });
|
|
417
|
+
};
|
|
418
|
+
// A gate whose own reads were only refused already answered through its `onReadOnlyError`
|
|
419
|
+
// policy (`[ACCESS-6.1.2]`): the refusal is the client's limitation, not an open question for
|
|
420
|
+
// the respondent, so a `warn` gate opens without leaving a check behind it.
|
|
421
|
+
if (cause?.refused === true && !cause.missingInput && !failed) {
|
|
422
|
+
if (items.length > 0) {
|
|
423
|
+
for (const item of items) {
|
|
424
|
+
skipped.push({ kind: 'gate', gateId: gate.gateId, itemId: item.itemId });
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
else if (gate.status === 'UNKNOWN') {
|
|
428
|
+
skipped.push({ kind: 'gate', gateId: gate.gateId });
|
|
429
|
+
}
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
record();
|
|
433
|
+
}
|
|
434
|
+
return { checks, skipped };
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* The requirements whose own condition never decided, at the field or in one row.
|
|
438
|
+
*
|
|
439
|
+
* `undeterminedRequirements` reads a requirement that *holds* and whose presence is unknown.
|
|
440
|
+
* This states the other open question: a `required` rule left `UNKNOWN`, which means the device
|
|
441
|
+
* cannot say whether the field is required at all (`RULES-2.1.5`). A row that could not be
|
|
442
|
+
* addressed answers once against its member; a duplicate natural key answers once per offending
|
|
443
|
+
* row, carrying the key the record states (`IDENT-2.1.9`). `DEFERRED` is excluded: on the client
|
|
444
|
+
* it is optional, not undecided, and `hasDeferredChecks` already states it.
|
|
445
|
+
*/
|
|
446
|
+
function undeterminedRequirementRules(compiled, snapshot, fieldsById, rules, diagnostics) {
|
|
447
|
+
const checks = [];
|
|
448
|
+
const skipped = [];
|
|
449
|
+
for (const rule of compiled.rules ?? []) {
|
|
450
|
+
if (rule.kind !== 'required')
|
|
451
|
+
continue;
|
|
452
|
+
const fieldId = rule.targetFieldId ?? rule.fieldId;
|
|
453
|
+
if (fieldId === undefined)
|
|
454
|
+
continue;
|
|
455
|
+
if (hiddenField(fieldsById, fieldId))
|
|
456
|
+
continue;
|
|
457
|
+
const stated = new Set();
|
|
458
|
+
const results = [...(rules.rowResults.get(rule.ruleId)?.values() ?? [])];
|
|
459
|
+
const rowless = rules.rowlessResults.get(rule.ruleId);
|
|
460
|
+
if (rowless !== undefined)
|
|
461
|
+
results.push(rowless);
|
|
462
|
+
for (const result of results) {
|
|
463
|
+
// Only a block-severity check refuses a submission; an author who declared a requirement
|
|
464
|
+
// `warn` opted out of that, exactly as `undecidedBlockers` reads a validate (`RULES-1.1.5`).
|
|
465
|
+
if (result.severity !== 'block' || result.status !== 'UNKNOWN')
|
|
466
|
+
continue;
|
|
467
|
+
// A requirement whose own condition raised is a decided refusal, stated by
|
|
468
|
+
// `undecidedBlockers`; it is not an open question the respondent can answer. Any other
|
|
469
|
+
// block diagnostic (`ROW_IDENTITY`) is the open question this fold states.
|
|
470
|
+
if (engineErrorFailed(diagnostics, rule.ruleId, result.rowKey))
|
|
471
|
+
continue;
|
|
472
|
+
// A condition whose only undecided cause is a refused read cannot be settled by any
|
|
473
|
+
// respondent action, so it holds nobody to the requirement (`RULES-2.1.1`). It is still a
|
|
474
|
+
// declared check a result panel must omit, so the readiness projection names it here.
|
|
475
|
+
if (rules.undecided.dispositionOf(rule.ruleId, result) === 'skipped') {
|
|
476
|
+
skipped.push({
|
|
477
|
+
kind: 'rule',
|
|
478
|
+
ruleId: result.ruleId,
|
|
479
|
+
fieldId,
|
|
480
|
+
...(result.rowKey === undefined ? {} : { rowKey: result.rowKey }),
|
|
481
|
+
});
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
// A row key carries its wire type: the integer `1` and the text `"1"` name two rows, and
|
|
485
|
+
// `String` folded them into one. A row-less result keeps a token no row key can produce.
|
|
486
|
+
const token = result.rowKey === undefined ? '' : rowKeyToken(result.rowKey);
|
|
487
|
+
if (stated.has(token))
|
|
488
|
+
continue;
|
|
489
|
+
stated.add(token);
|
|
490
|
+
checks.push({
|
|
491
|
+
kind: 'required',
|
|
492
|
+
fieldId,
|
|
493
|
+
...(result.rowKey === undefined ? {} : { rowKey: result.rowKey }),
|
|
494
|
+
...requiredMessage(result.messageKey ?? rule.messageKey, result.params),
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return { checks, skipped };
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* The visible requirements the device could not decide, at the row or at the field.
|
|
502
|
+
*
|
|
503
|
+
* Only a requirement that *fired* is asked this question: a row's `required` is true when its
|
|
504
|
+
* condition passed, and the field's own requirement holds likewise. A `DEFERRED` condition
|
|
505
|
+
* leaves the requirement optional on this device (`RULES-2.1.5`) and is reported by
|
|
506
|
+
* `hasDeferredChecks`; an `UNKNOWN` condition is the different open question stated above.
|
|
507
|
+
* A requirement whose presence is `undetermined` — a record value its declaration refuses, or a
|
|
508
|
+
* condition that did not decide — is the open question this states. A server-redacted value is
|
|
509
|
+
* `deferred` instead: it is the server's handoff, reported by `hasDeferredChecks`.
|
|
510
|
+
*
|
|
511
|
+
* A row's requirement answers per row, so one undecided row is one open question at that
|
|
512
|
+
* binding; a member's field-level answer is the rows' fold and is therefore not stated twice.
|
|
513
|
+
*/
|
|
514
|
+
function undeterminedRequirements(fields) {
|
|
515
|
+
const checks = [];
|
|
516
|
+
for (const field of fields) {
|
|
517
|
+
if (!field.visible)
|
|
518
|
+
continue;
|
|
519
|
+
let namedRow = false;
|
|
520
|
+
for (const row of field.rows ?? []) {
|
|
521
|
+
if (!row.required || row.missingRequired !== 'undetermined')
|
|
522
|
+
continue;
|
|
523
|
+
if (row.requiredSeverity !== 'block')
|
|
524
|
+
continue;
|
|
525
|
+
namedRow = true;
|
|
526
|
+
checks.push({
|
|
527
|
+
kind: 'required',
|
|
528
|
+
fieldId: field.fieldId,
|
|
529
|
+
rowKey: row.rowKey,
|
|
530
|
+
...requiredMessage(row.requiredMessageKey, row.requiredParams),
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
if (namedRow || !field.required || field.missingRequired !== 'undetermined')
|
|
534
|
+
continue;
|
|
535
|
+
if (field.requiredSeverity !== 'block')
|
|
536
|
+
continue;
|
|
537
|
+
checks.push({
|
|
538
|
+
kind: 'required',
|
|
539
|
+
fieldId: field.fieldId,
|
|
540
|
+
...requiredMessage(field.requiredMessageKey, field.requiredParams),
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
return checks;
|
|
544
|
+
}
|
|
545
|
+
/** Every computed value the engine could not decide, at the field or in one row. */
|
|
546
|
+
function deriveUndeterminedComputations(fields) {
|
|
547
|
+
const computations = [];
|
|
548
|
+
for (const field of fields) {
|
|
549
|
+
if (!field.visible)
|
|
550
|
+
continue;
|
|
551
|
+
if (field.computation.kind === 'undetermined' && field.computation.status === 'UNKNOWN') {
|
|
552
|
+
computations.push({ fieldId: field.fieldId });
|
|
553
|
+
}
|
|
554
|
+
for (const row of field.rows ?? []) {
|
|
555
|
+
if (row.computation.kind === 'undetermined' && row.computation.status === 'UNKNOWN') {
|
|
556
|
+
computations.push({ fieldId: field.fieldId, rowKey: row.rowKey });
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return computations;
|
|
561
|
+
}
|
|
562
|
+
/** Every declared gate, with the verdict its report section and rule status state. */
|
|
563
|
+
function deriveGates(compiled, snapshot, rules) {
|
|
564
|
+
const gates = [];
|
|
565
|
+
for (const rule of compiled.rules ?? []) {
|
|
566
|
+
if (rule.kind !== 'gate')
|
|
567
|
+
continue;
|
|
568
|
+
const report = snapshot.report.gates?.[rule.ruleId];
|
|
569
|
+
const status = rules.firstResult.get(rule.ruleId)?.status;
|
|
570
|
+
const active = report === undefined || !('active' in report) || report.active !== false;
|
|
571
|
+
const items = active && report !== undefined && 'items' in report ? report.items : [];
|
|
572
|
+
const overridden = report !== undefined && 'overrides' in report && (report.overrides?.length ?? 0) > 0;
|
|
573
|
+
gates.push({
|
|
574
|
+
gateId: rule.ruleId,
|
|
575
|
+
hard: rule.gate.hard,
|
|
576
|
+
severity: rule.severity ?? 'block',
|
|
577
|
+
status: status ?? 'UNKNOWN',
|
|
578
|
+
outcome: !active ? 'INACTIVE' : overridden ? 'OVERRIDDEN' : gateOutcome(status ?? 'UNKNOWN'),
|
|
579
|
+
items,
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
return gates;
|
|
583
|
+
}
|
|
584
|
+
/** Every declared screen, with the outcome and reasons its report section states. */
|
|
585
|
+
function deriveScreens(compiled, snapshot) {
|
|
586
|
+
const screens = [];
|
|
587
|
+
for (const rule of compiled.rules ?? []) {
|
|
588
|
+
if (rule.kind !== 'screen')
|
|
589
|
+
continue;
|
|
590
|
+
const report = snapshot.report.screens?.[rule.ruleId];
|
|
591
|
+
screens.push({
|
|
592
|
+
screenId: rule.ruleId,
|
|
593
|
+
severity: rule.severity ?? 'block',
|
|
594
|
+
...(rule.messageKey === undefined ? {} : { messageKey: rule.messageKey }),
|
|
595
|
+
outcome: report?.outcome ?? 'UNKNOWN',
|
|
596
|
+
reasons: report?.reasons ?? [],
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
return screens;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* The decided block failures of visible fields and rows, the items of a blocked gate, the block
|
|
603
|
+
* rules the engine could not decide, the required values no visible control holds, a held value
|
|
604
|
+
* a closed option domain refuses or currently makes unavailable, a value its declaration refuses,
|
|
605
|
+
* and a block screen that decided against the record.
|
|
606
|
+
*/
|
|
607
|
+
function deriveBlockers(compiled, fields, fieldsById, gates, screens, rules, diagnostics, addressing, availability) {
|
|
608
|
+
const blockers = [
|
|
609
|
+
...undecidedBlockers(compiled, fieldsById, rules, diagnostics),
|
|
610
|
+
...availability,
|
|
611
|
+
];
|
|
612
|
+
// A field-, record- or array-scope failure is read from the rule that decided it, so a
|
|
613
|
+
// record-scope `validate` that names no field still blocks a submission.
|
|
614
|
+
for (const rule of compiled.rules ?? []) {
|
|
615
|
+
if (rule.scope === 'item')
|
|
616
|
+
continue;
|
|
617
|
+
if (rule.kind !== 'validate' && rule.kind !== 'compute' && rule.kind !== 'defaultCompute') {
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
const result = rules.firstResult.get(rule.ruleId);
|
|
621
|
+
if (result === undefined || result.severity !== 'block' || result.status !== 'FAIL')
|
|
622
|
+
continue;
|
|
623
|
+
const fieldId = rule.fieldId;
|
|
624
|
+
if (hiddenField(fieldsById, fieldId))
|
|
625
|
+
continue;
|
|
626
|
+
blockers.push({
|
|
627
|
+
kind: 'rule',
|
|
628
|
+
ruleId: result.ruleId,
|
|
629
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
630
|
+
messageKey: result.messageKey ?? rule.messageKey ?? diagnosticDoc('ENGINE_ERROR').messageKey,
|
|
631
|
+
...(result.params === undefined ? {} : { params: result.params }),
|
|
632
|
+
...suggestionsOf(result),
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
// A row-scoped failure attaches its diagnostic to the member (a cell error) or to the array
|
|
636
|
+
// (a row-wide violation), so it is read from the row facts rather than the rule result. The
|
|
637
|
+
// same row walk states a decided missing requirement, so a blocker list is one pass over the
|
|
638
|
+
// visible entries whether it answers a rule or the record's presence.
|
|
639
|
+
for (const field of fields) {
|
|
640
|
+
if (!field.visible)
|
|
641
|
+
continue;
|
|
642
|
+
let namedRow = false;
|
|
643
|
+
for (const row of field.rows ?? []) {
|
|
644
|
+
if (row.required && row.missingRequired === 'missing') {
|
|
645
|
+
namedRow = true;
|
|
646
|
+
// Only a block-severity requirement refuses the submission; a `warn`/`info` rule
|
|
647
|
+
// opted out while still presenting the asterisk (`RULES-1.1.5`).
|
|
648
|
+
if (row.requiredSeverity === 'block') {
|
|
649
|
+
const rowName = rowNameOf(row.rowKey, addressing.get(field.fieldId));
|
|
650
|
+
blockers.push({
|
|
651
|
+
kind: 'required',
|
|
652
|
+
fieldId: field.fieldId,
|
|
653
|
+
rowKey: row.rowKey,
|
|
654
|
+
...(rowName === undefined ? {} : { rowName }),
|
|
655
|
+
...requiredMessage(row.requiredMessageKey, row.requiredParams),
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (row.invalidValue !== undefined) {
|
|
660
|
+
blockers.push({
|
|
661
|
+
kind: 'invalidOption',
|
|
662
|
+
fieldId: field.fieldId,
|
|
663
|
+
value: row.invalidValue,
|
|
664
|
+
rowKey: row.rowKey,
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
if (row.media !== undefined) {
|
|
668
|
+
pushMediaViolations(blockers, field.fieldId, row.media, row.rowKey);
|
|
669
|
+
}
|
|
670
|
+
pushScaleBlocker(blockers, field.fieldId, row.decimalScale, row.rowKey);
|
|
671
|
+
for (const message of row.messages) {
|
|
672
|
+
addMessage(blockers, message, field.fieldId, row.rowKey, rules);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
// A member's field-level requirement is the rows' answer, already stated above. Everything
|
|
676
|
+
// else states its requirement at its own binding.
|
|
677
|
+
if (!namedRow &&
|
|
678
|
+
field.required &&
|
|
679
|
+
field.missingRequired === 'missing' &&
|
|
680
|
+
field.requiredSeverity === 'block') {
|
|
681
|
+
blockers.push({
|
|
682
|
+
kind: 'required',
|
|
683
|
+
fieldId: field.fieldId,
|
|
684
|
+
...requiredMessage(field.requiredMessageKey, field.requiredParams),
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
if (field.invalidValue !== undefined) {
|
|
688
|
+
blockers.push({
|
|
689
|
+
kind: 'invalidOption',
|
|
690
|
+
fieldId: field.fieldId,
|
|
691
|
+
value: field.invalidValue,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
blockers.push(...unaddressedItemFailures(compiled, fieldsById, rules));
|
|
696
|
+
for (const field of fields) {
|
|
697
|
+
if (!field.visible)
|
|
698
|
+
continue;
|
|
699
|
+
const cardinality = field.cardinality;
|
|
700
|
+
if (cardinality?.kind === 'belowMin') {
|
|
701
|
+
blockers.push({
|
|
702
|
+
kind: 'cardinality',
|
|
703
|
+
fieldId: field.fieldId,
|
|
704
|
+
bound: 'minItems',
|
|
705
|
+
count: cardinality.count,
|
|
706
|
+
limit: cardinality.minItems,
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
else if (cardinality?.kind === 'aboveMax') {
|
|
710
|
+
blockers.push({
|
|
711
|
+
kind: 'cardinality',
|
|
712
|
+
fieldId: field.fieldId,
|
|
713
|
+
bound: 'maxItems',
|
|
714
|
+
count: cardinality.count,
|
|
715
|
+
limit: cardinality.maxItems,
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
if (field.media?.kind === 'violated') {
|
|
719
|
+
pushMediaViolations(blockers, field.fieldId, field.media);
|
|
720
|
+
}
|
|
721
|
+
pushScaleBlocker(blockers, field.fieldId, field.decimalScale);
|
|
722
|
+
const rowCount = field.rowCount;
|
|
723
|
+
if (rowCount?.kind === 'mismatch' || rowCount?.kind === 'refused') {
|
|
724
|
+
blockers.push({
|
|
725
|
+
kind: 'rowCount',
|
|
726
|
+
fieldId: field.fieldId,
|
|
727
|
+
expected: rowCount.expected,
|
|
728
|
+
actual: rowCount.actual,
|
|
729
|
+
source: rowCount.source,
|
|
730
|
+
...(rowCount.kind === 'refused' ? { reason: rowCount.reason } : {}),
|
|
731
|
+
...(rowCount.ceiling === undefined ? {} : { ceiling: rowCount.ceiling }),
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
for (const gate of gates) {
|
|
736
|
+
if (gate.severity !== 'block')
|
|
737
|
+
continue;
|
|
738
|
+
if (gate.outcome !== 'BLOCKED')
|
|
739
|
+
continue;
|
|
740
|
+
// A gate item that decided `FAIL` is a cause the respondent can act on. An `UNKNOWN` item
|
|
741
|
+
// is not: it is a block-severity check that did not run, and `undeterminedGates` states it
|
|
742
|
+
// as the open question. Reporting it here accused a respondent who had simply not typed a
|
|
743
|
+
// number yet, and made `BLOCKED` mean "wrong or unfilled" (`ENGINE-7.1.5`).
|
|
744
|
+
const failed = gate.items.filter((item) => item.status === 'FAIL');
|
|
745
|
+
if (failed.length > 0) {
|
|
746
|
+
for (const item of failed) {
|
|
747
|
+
blockers.push({
|
|
748
|
+
kind: 'gate',
|
|
749
|
+
gateId: gate.gateId,
|
|
750
|
+
itemId: item.itemId,
|
|
751
|
+
messageKey: item.messageKey,
|
|
752
|
+
...(item.params === undefined ? {} : { params: item.params }),
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
continue;
|
|
756
|
+
}
|
|
757
|
+
// No item failed, so the gate's own expression is the cause — and only a decided `FAIL` is
|
|
758
|
+
// a cause. An `UNKNOWN` status has none and is an undetermined check instead.
|
|
759
|
+
if (gate.status === 'FAIL')
|
|
760
|
+
blockers.push(gateVerdictBlocker(rules, gate.gateId));
|
|
761
|
+
}
|
|
762
|
+
for (const screen of screens) {
|
|
763
|
+
if (screen.severity !== 'block')
|
|
764
|
+
continue;
|
|
765
|
+
if (screen.outcome !== 'SCREEN_FAIL' && screen.outcome !== 'SCREEN_REFER')
|
|
766
|
+
continue;
|
|
767
|
+
blockers.push({
|
|
768
|
+
kind: 'screen',
|
|
769
|
+
screenId: screen.screenId,
|
|
770
|
+
outcome: screen.outcome,
|
|
771
|
+
...(screen.messageKey === undefined ? {} : { messageKey: screen.messageKey }),
|
|
772
|
+
reasons: screen.reasons,
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
pushRefusalBlockers(blockers, fields);
|
|
776
|
+
return blockers;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Records the values their declaration refuses that no other blocker already names.
|
|
780
|
+
*
|
|
781
|
+
* A rule that reads a refused value already states the failure — the report carries its
|
|
782
|
+
* `ENGINE_ERROR` and the rule blocks — so the derivation's refusal must not add a second cause for
|
|
783
|
+
* one mistake. It is stated only where nothing else blocks that binding, which is the case a host
|
|
784
|
+
* renders when no rule reads the value: the record holds something, the declaration refuses it,
|
|
785
|
+
* and without this the form would look submittable. `path` names the member the reader refused.
|
|
786
|
+
*/
|
|
787
|
+
function pushRefusalBlockers(blockers, fields) {
|
|
788
|
+
for (const field of fields) {
|
|
789
|
+
if (!field.visible)
|
|
790
|
+
continue;
|
|
791
|
+
for (const row of field.rows ?? []) {
|
|
792
|
+
if (row.refusal === undefined)
|
|
793
|
+
continue;
|
|
794
|
+
if (blockedBinding(blockers, field.fieldId, row.rowKey))
|
|
795
|
+
continue;
|
|
796
|
+
blockers.push({
|
|
797
|
+
kind: 'invalidOption',
|
|
798
|
+
fieldId: field.fieldId,
|
|
799
|
+
path: row.refusal.path,
|
|
800
|
+
rowKey: row.rowKey,
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
if (field.refusal === undefined)
|
|
804
|
+
continue;
|
|
805
|
+
if (blockedBinding(blockers, field.fieldId, undefined))
|
|
806
|
+
continue;
|
|
807
|
+
blockers.push({ kind: 'invalidOption', fieldId: field.fieldId, path: field.refusal.path });
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
/** Whether a blocker already names this binding as a decided failure. */
|
|
811
|
+
function blockedBinding(blockers, fieldId, rowKey) {
|
|
812
|
+
return blockers.some((blocker) => 'fieldId' in blocker &&
|
|
813
|
+
blocker.fieldId === fieldId &&
|
|
814
|
+
bindingToken('rowKey' in blocker ? blocker.rowKey : undefined) === bindingToken(rowKey));
|
|
815
|
+
}
|
|
816
|
+
/** A binding's row key as a wire-typed token, so the integer `1` and the text `"1"` differ. */
|
|
817
|
+
function bindingToken(rowKey) {
|
|
818
|
+
return rowKey === undefined ? '' : rowKeyToken(rowKey);
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Item failures whose rows the derivation could not key, so no row entry could carry them.
|
|
822
|
+
*
|
|
823
|
+
* A duplicate natural key is data the record holds rather than a reason to lose a decision
|
|
824
|
+
* (`IDENT-2.1.9`): the report answers per offending row and carries the key, while the derived
|
|
825
|
+
* state addresses no row because two rows share one identity. The same gap opens for an array
|
|
826
|
+
* whose identity does not reconcile (a missing natural key, an unmanifested assigned array).
|
|
827
|
+
* Reading the report's decided failure here keeps the verdict's answer equal to the report's,
|
|
828
|
+
* instead of admitting a record the evaluation refused. A row that *is* addressed already
|
|
829
|
+
* states the message on its entry, so this adds nothing twice.
|
|
830
|
+
*/
|
|
831
|
+
function unaddressedItemFailures(compiled, fieldsById, rules) {
|
|
832
|
+
const blockers = [];
|
|
833
|
+
for (const rule of compiled.rules ?? []) {
|
|
834
|
+
if (rule.kind !== 'validate' || rule.scope !== 'item')
|
|
835
|
+
continue;
|
|
836
|
+
const fieldId = rule.targetFieldId ?? rule.fieldId;
|
|
837
|
+
if (fieldId === undefined)
|
|
838
|
+
continue;
|
|
839
|
+
const field = fieldsById.get(fieldId);
|
|
840
|
+
if (field === undefined || !field.visible)
|
|
841
|
+
continue;
|
|
842
|
+
const carried = (field.rows ?? []).some((row) => row.messages.some((message) => message.ruleId === rule.ruleId &&
|
|
843
|
+
message.severity === 'block' &&
|
|
844
|
+
message.status === 'FAIL'));
|
|
845
|
+
if (carried)
|
|
846
|
+
continue;
|
|
847
|
+
const results = [...(rules.rowResults.get(rule.ruleId)?.values() ?? [])];
|
|
848
|
+
const rowless = rules.rowlessResults.get(rule.ruleId);
|
|
849
|
+
if (rowless !== undefined)
|
|
850
|
+
results.push(rowless);
|
|
851
|
+
for (const result of results) {
|
|
852
|
+
if (result.severity !== 'block' || result.status !== 'FAIL')
|
|
853
|
+
continue;
|
|
854
|
+
blockers.push({
|
|
855
|
+
kind: 'rule',
|
|
856
|
+
ruleId: result.ruleId,
|
|
857
|
+
fieldId,
|
|
858
|
+
...(result.rowKey === undefined ? {} : { rowKey: result.rowKey }),
|
|
859
|
+
messageKey: result.messageKey ?? rule.messageKey ?? diagnosticDoc('ENGINE_ERROR').messageKey,
|
|
860
|
+
...(result.params === undefined ? {} : { params: result.params }),
|
|
861
|
+
...suggestionsOf(result),
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return blockers;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Records every declared media constraint one capture violates.
|
|
869
|
+
*
|
|
870
|
+
* A field's capture states the element `index`; an array member's states the row `rowKey`.
|
|
871
|
+
* Both are stated so a sentence can name the capture without re-reading the record, and a
|
|
872
|
+
* member's violation never repeats the field-level answer its rows already carry, because a
|
|
873
|
+
* member has no field-level capture to answer.
|
|
874
|
+
*/
|
|
875
|
+
function pushMediaViolations(blockers, fieldId, media, rowKey) {
|
|
876
|
+
if (media.kind !== 'violated')
|
|
877
|
+
return;
|
|
878
|
+
for (const violation of media.violations) {
|
|
879
|
+
const at = {
|
|
880
|
+
...(violation.index === undefined ? {} : { index: violation.index }),
|
|
881
|
+
...(rowKey === undefined ? {} : { rowKey }),
|
|
882
|
+
};
|
|
883
|
+
if (violation.kind === 'accept') {
|
|
884
|
+
blockers.push({
|
|
885
|
+
kind: 'media',
|
|
886
|
+
fieldId,
|
|
887
|
+
member: 'accept',
|
|
888
|
+
limit: violation.limit,
|
|
889
|
+
value: violation.mime,
|
|
890
|
+
...at,
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
blockers.push({
|
|
895
|
+
kind: 'media',
|
|
896
|
+
fieldId,
|
|
897
|
+
member: violation.kind,
|
|
898
|
+
limit: violation.limit,
|
|
899
|
+
value: violation.byteSize,
|
|
900
|
+
...at,
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* States the blocker for a `decimal` value above its declared fractional-digit bound.
|
|
907
|
+
*
|
|
908
|
+
* A row member's fact lives once per row, so `rowKey` names the row; a field-level fact names
|
|
909
|
+
* no row. An absent, withheld or undecided value is never a blocker, exactly as an undecided
|
|
910
|
+
* requirement is not.
|
|
911
|
+
*/
|
|
912
|
+
function pushScaleBlocker(blockers, fieldId, scale, rowKey) {
|
|
913
|
+
if (scale?.kind !== 'aboveMax')
|
|
914
|
+
return;
|
|
915
|
+
blockers.push({
|
|
916
|
+
kind: 'scale',
|
|
917
|
+
fieldId,
|
|
918
|
+
member: 'maxScale',
|
|
919
|
+
limit: scale.maxScale,
|
|
920
|
+
scale: scale.scale,
|
|
921
|
+
value: scale.value,
|
|
922
|
+
...(scale.messageKey === undefined ? {} : { messageKey: scale.messageKey }),
|
|
923
|
+
...(rowKey === undefined ? {} : { rowKey }),
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
/** The sentence a `required` rule declared, when the artifact supplied one. */
|
|
927
|
+
function requiredMessage(messageKey, params) {
|
|
928
|
+
return {
|
|
929
|
+
...(messageKey === undefined ? {} : { messageKey }),
|
|
930
|
+
...(params === undefined ? {} : { params }),
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* The blocker a gate's own verdict states when no item does.
|
|
935
|
+
*
|
|
936
|
+
* A gate blocks on its own expression failing, on that expression raising, or on a read-only
|
|
937
|
+
* refusal its policy turns into a failure, and none of those is an item verdict. Reporting an
|
|
938
|
+
* empty blocker list for a gate the engine refuses would let readiness call the record
|
|
939
|
+
* submittable, so the gate's own result answers here.
|
|
940
|
+
*/
|
|
941
|
+
function gateVerdictBlocker(rules, gateId) {
|
|
942
|
+
const rule = rules.ruleById.get(gateId);
|
|
943
|
+
const result = rules.firstResult.get(gateId);
|
|
944
|
+
return {
|
|
945
|
+
kind: 'rule',
|
|
946
|
+
ruleId: gateId,
|
|
947
|
+
messageKey: result?.messageKey ?? rule?.messageKey ?? diagnosticDoc('ENGINE_ERROR').messageKey,
|
|
948
|
+
...(result?.params === undefined ? {} : { params: result.params }),
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* The blockers a block rule the engine could not decide states, `[RULES-2.1.9]`.
|
|
953
|
+
*
|
|
954
|
+
* A block rule whose expression raises reports `UNKNOWN` and carries a block diagnostic, and
|
|
955
|
+
* that blocks exactly as a `FAIL` does. A block-severity diagnostic is what separates it from
|
|
956
|
+
* an answer the rules spec assigns to a device that could not see a value, which is warn or
|
|
957
|
+
* info (`ACCESS_DENIED`, `REQUIRED_UNKNOWN`, `DEFERRED_SERVER_CHECK`). A `validate` left
|
|
958
|
+
* `UNKNOWN` with no such diagnostic is not a decided failure either; `deriveUndeterminedChecks`
|
|
959
|
+
* states it, and the form is undecided rather than submittable.
|
|
960
|
+
*
|
|
961
|
+
* A gate states its own undecided verdict through its outcome, and a screen through the
|
|
962
|
+
* undetermined-check list, so both are excluded here rather than counted twice.
|
|
963
|
+
*/
|
|
964
|
+
function undecidedBlockers(compiled, fieldsById, rules, diagnostics) {
|
|
965
|
+
const blockers = [];
|
|
966
|
+
for (const rule of compiled.rules ?? []) {
|
|
967
|
+
// A block-severity rule the engine could not decide refuses the submission whatever its
|
|
968
|
+
// kind: a `visible`, `required` or `enabled` rule that raised decided nothing, so the
|
|
969
|
+
// branch it guards is unknown and the record is not admissible (`RULES-2.1.9`).
|
|
970
|
+
if (rule.kind !== 'validate' &&
|
|
971
|
+
rule.kind !== 'compute' &&
|
|
972
|
+
rule.kind !== 'defaultCompute' &&
|
|
973
|
+
rule.kind !== 'visible' &&
|
|
974
|
+
rule.kind !== 'required' &&
|
|
975
|
+
rule.kind !== 'enabled') {
|
|
976
|
+
continue;
|
|
977
|
+
}
|
|
978
|
+
const fieldId = rule.targetFieldId ?? rule.fieldId;
|
|
979
|
+
if (hiddenField(fieldsById, fieldId))
|
|
980
|
+
continue;
|
|
981
|
+
// `validate`, `compute` and `defaultCompute` block on any block diagnostic; the branch
|
|
982
|
+
// kinds block only when the engine raised, because every other diagnostic is an open
|
|
983
|
+
// question rather than a refusal.
|
|
984
|
+
const failed = rule.kind === 'visible' || rule.kind === 'required' || rule.kind === 'enabled'
|
|
985
|
+
? engineErrorFailed
|
|
986
|
+
: engineFailed;
|
|
987
|
+
if (rule.scope === 'item') {
|
|
988
|
+
// Every row the engine could not decide is its own blocker, as every row the report
|
|
989
|
+
// states is its own diagnostic. Reading one result per rule attached row `a` and left
|
|
990
|
+
// row `b`'s failure stated only in the report.
|
|
991
|
+
for (const result of resultsOf(rules, rule.ruleId)) {
|
|
992
|
+
if (result.severity !== 'block' || result.status !== 'UNKNOWN')
|
|
993
|
+
continue;
|
|
994
|
+
if (!failed(diagnostics, rule.ruleId, result.rowKey))
|
|
995
|
+
continue;
|
|
996
|
+
blockers.push({
|
|
997
|
+
kind: 'rule',
|
|
998
|
+
ruleId: result.ruleId,
|
|
999
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
1000
|
+
...(result.rowKey === undefined ? {} : { rowKey: result.rowKey }),
|
|
1001
|
+
messageKey: result.messageKey ?? rule.messageKey ?? diagnosticDoc('ENGINE_ERROR').messageKey,
|
|
1002
|
+
...(result.params === undefined ? {} : { params: result.params }),
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
continue;
|
|
1006
|
+
}
|
|
1007
|
+
const undecided = rules.firstUndecided.get(rule.ruleId);
|
|
1008
|
+
if (undecided === undefined)
|
|
1009
|
+
continue;
|
|
1010
|
+
if (!failed(diagnostics, rule.ruleId, undecided.rowKey))
|
|
1011
|
+
continue;
|
|
1012
|
+
blockers.push({
|
|
1013
|
+
kind: 'rule',
|
|
1014
|
+
ruleId: undecided.ruleId,
|
|
1015
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
1016
|
+
...(undecided.rowKey === undefined ? {} : { rowKey: undecided.rowKey }),
|
|
1017
|
+
messageKey: undecided.messageKey ?? rule.messageKey ?? diagnosticDoc('ENGINE_ERROR').messageKey,
|
|
1018
|
+
...(undecided.params === undefined ? {} : { params: undecided.params }),
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
return blockers;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Whether the artifact hides a field, so a failure on it is nothing the caller can fix. A
|
|
1025
|
+
* failure that names no field is about the record and always visible.
|
|
1026
|
+
*/
|
|
1027
|
+
function hiddenField(fieldsById, fieldId) {
|
|
1028
|
+
return fieldId !== undefined && fieldsById.get(fieldId)?.visible === false;
|
|
1029
|
+
}
|
|
1030
|
+
/** Records a block-severity validation failure as a blocker. */
|
|
1031
|
+
function addMessage(blockers, message, fieldId, rowKey, rules) {
|
|
1032
|
+
if (message.severity !== 'block' || message.status !== 'FAIL')
|
|
1033
|
+
return;
|
|
1034
|
+
blockers.push({
|
|
1035
|
+
kind: 'rule',
|
|
1036
|
+
ruleId: message.ruleId,
|
|
1037
|
+
fieldId,
|
|
1038
|
+
...(rowKey === undefined ? {} : { rowKey }),
|
|
1039
|
+
messageKey: message.messageKey,
|
|
1040
|
+
...(message.params === undefined ? {} : { params: message.params }),
|
|
1041
|
+
...suggestionsOfRow(rules, message.ruleId, rowKey),
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* The alternatives a rule result states, for the blocker that result becomes.
|
|
1046
|
+
*
|
|
1047
|
+
* A failing `validate` rule offers alternatives that clear it, and the blocker is where a host
|
|
1048
|
+
* reads them: the report's result and the readiness blocker name the same failure, so they state
|
|
1049
|
+
* the same alternatives. An absent member stays absent, which is what an artifact that declares
|
|
1050
|
+
* none and one whose alternatives the access filter removed look like (`RULES-6.1.3`).
|
|
1051
|
+
*/
|
|
1052
|
+
function suggestionsOf(result) {
|
|
1053
|
+
return result.suggestions === undefined ? {} : { suggestions: result.suggestions };
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* The alternatives one row's own result states, so a row-scoped blocker offers what its rule did.
|
|
1057
|
+
*
|
|
1058
|
+
* An item-scoped rule answers once per row, so the alternatives that belong to this blocker are
|
|
1059
|
+
* the ones that row's result carries: the failing row's `current` reference was resolved there.
|
|
1060
|
+
*/
|
|
1061
|
+
function suggestionsOfRow(rules, ruleId, rowKey) {
|
|
1062
|
+
if (rowKey === undefined)
|
|
1063
|
+
return {};
|
|
1064
|
+
const result = rules.rowResults.get(ruleId)?.get(rowKeyToken(rowKey));
|
|
1065
|
+
return result === undefined ? {} : suggestionsOf(result);
|
|
1066
|
+
}
|
|
1067
|
+
//# sourceMappingURL=readiness.js.map
|