@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,653 @@
|
|
|
1
|
+
import { AxiomError } from '../../model/errors.js';
|
|
2
|
+
import { isRecord } from '../../model/values.js';
|
|
3
|
+
import { toAccessOverlay } from '../../model/access.js';
|
|
4
|
+
import { evaluationInputOf, parsedAccessOf } from '../../model/input.js';
|
|
5
|
+
import { ruleTargets } from '../../model/types.js';
|
|
6
|
+
import { compareCodePoints } from '../../expr/strings.js';
|
|
7
|
+
import { toAccessEntry, toFieldRef, toSessionWireValue, toHostWireValue, wireDeclarationOf, } from '../../model/wire.js';
|
|
8
|
+
import { conditionedAvailabilityFields, Evaluation } from '../rule/runner.js';
|
|
9
|
+
import { freezeTree } from '../seal.js';
|
|
10
|
+
import { createAccessWindow } from '../access/window.js';
|
|
11
|
+
import { fieldKey } from '../access/projection.js';
|
|
12
|
+
import { computedOverlay } from '../computed.js';
|
|
13
|
+
import { deriveFormState } from '../state/derive.js';
|
|
14
|
+
import { noteAvailabilityMapCopy } from '../state/measurement.js';
|
|
15
|
+
import { factoryRefusal, identityOptions, hydrateIdentity, openIdentity } from './identity.js';
|
|
16
|
+
import { closureOf, NO_CHANGES } from './deps.js';
|
|
17
|
+
import { engineGraph } from './deps.js';
|
|
18
|
+
import { optionDomainDiagnostics } from '../options-boundary.js';
|
|
19
|
+
import { applyOperation, copyEnvironment, identityRefusalOf, sessionRefusalRepair } from './ops.js';
|
|
20
|
+
import { patchesBetween } from './patches.js';
|
|
21
|
+
import { bindingKeyOf, differingBindings, sameData, refOfBindingKey } from './snapshot.js';
|
|
22
|
+
import { EMPTY_PASS } from './trace.js';
|
|
23
|
+
/** The refusal a session's open or hydrate raises, carrying the structured code. */
|
|
24
|
+
export class SessionRefusedError extends Error {
|
|
25
|
+
refusal;
|
|
26
|
+
constructor(refusal) {
|
|
27
|
+
super(`the session was refused with ${refusal.code}${named(refusal)}; ${sessionRefusalRepair(refusal.code)}`);
|
|
28
|
+
this.name = 'SessionRefusedError';
|
|
29
|
+
this.refusal = refusal;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** The field or row a refusal named, for its message and never for its value. */
|
|
33
|
+
function named(refusal) {
|
|
34
|
+
if (refusal.fieldId !== undefined) {
|
|
35
|
+
return refusal.rowKey === undefined
|
|
36
|
+
? ` at ${refusal.fieldId}`
|
|
37
|
+
: ` at ${refusal.fieldId}@${String(refusal.rowKey)}`;
|
|
38
|
+
}
|
|
39
|
+
return refusal.root === undefined ? '' : ` at context.${refusal.root}`;
|
|
40
|
+
}
|
|
41
|
+
/** Whether the declaration supplying a row identity may deliver its value to this caller. */
|
|
42
|
+
function identityFieldReadable(compiled, input, env, fieldId, rowKey) {
|
|
43
|
+
return createAccessWindow(compiled.fields, input, env).enclosingDelivers({ fieldId, rowKey });
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The references the caller states this session already wrote.
|
|
47
|
+
*
|
|
48
|
+
* The input contract carries them beside the record (`EvaluationInput.sessionWrites`), and a
|
|
49
|
+
* `write_only` value they name is readable for the session exactly as one the session writes
|
|
50
|
+
* later is. A session that dropped them would answer a different record than the same input
|
|
51
|
+
* evaluated with `evaluateForm`, so the two entry points would disagree about a stored value
|
|
52
|
+
* the host said is already the user's.
|
|
53
|
+
*/
|
|
54
|
+
function openedSessionWrites(input) {
|
|
55
|
+
const writes = new Map();
|
|
56
|
+
for (const [index, raw] of (input.sessionWrites ?? []).entries()) {
|
|
57
|
+
const ref = toFieldRef(raw, `$.sessionWrites[${String(index)}]`);
|
|
58
|
+
const key = fieldKey(ref);
|
|
59
|
+
if (!writes.has(key))
|
|
60
|
+
writes.set(key, ref);
|
|
61
|
+
}
|
|
62
|
+
return writes;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The record a caller supplied, validated against the artifact's declarations.
|
|
66
|
+
*
|
|
67
|
+
* A record is untrusted input at both boundaries — open and hydrate — so a payload that is not
|
|
68
|
+
* an object at all is the runtime's own refusal with a path, never a `TypeError` from reading
|
|
69
|
+
* `Object.keys` of `null`.
|
|
70
|
+
*/
|
|
71
|
+
function validateRecord(compiled, values) {
|
|
72
|
+
if (!isRecord(values)) {
|
|
73
|
+
throw new AxiomError('ENGINE_ERROR', 'the record must be an object', '$.values');
|
|
74
|
+
}
|
|
75
|
+
const declared = new Set(compiled.fields.map((field) => field.fieldId));
|
|
76
|
+
for (const key of Object.keys(values)) {
|
|
77
|
+
if (declared.has(key))
|
|
78
|
+
continue;
|
|
79
|
+
throw new AxiomError('ENGINE_ERROR', `the record holds undeclared field ${key}`, `$.values.${key}`);
|
|
80
|
+
}
|
|
81
|
+
const validated = {};
|
|
82
|
+
for (const field of compiled.fields) {
|
|
83
|
+
if (!Object.hasOwn(values, field.fieldId))
|
|
84
|
+
continue;
|
|
85
|
+
const raw = values[field.fieldId];
|
|
86
|
+
// Shape validation and identity admission have different owners, including through record
|
|
87
|
+
// containers. SessionIdentity names the duplicate key rather than a generic wire error.
|
|
88
|
+
validated[field.fieldId] = toSessionWireValue(raw, `$.values.${field.fieldId}`, wireDeclarationOf(field));
|
|
89
|
+
}
|
|
90
|
+
return validated;
|
|
91
|
+
}
|
|
92
|
+
/** The context a caller opened the session with, validated against the declared roots. */
|
|
93
|
+
function validateContext(compiled, context) {
|
|
94
|
+
if (context === undefined)
|
|
95
|
+
return {};
|
|
96
|
+
const roots = new Map((compiled.context?.roots ?? []).map((root) => [root.path.replace(/^context\./, ''), root]));
|
|
97
|
+
const validated = {};
|
|
98
|
+
for (const [key, raw] of Object.entries(context)) {
|
|
99
|
+
const root = roots.get(key);
|
|
100
|
+
if (root === undefined) {
|
|
101
|
+
throw new AxiomError('ENGINE_ERROR', `undeclared context root ${key}`, `$.context.${key}`);
|
|
102
|
+
}
|
|
103
|
+
validated[key] = toHostWireValue(raw, `$.context.${key}`, {
|
|
104
|
+
primitive: root.primitive,
|
|
105
|
+
...(root.items === undefined ? {} : { items: root.items }),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return validated;
|
|
109
|
+
}
|
|
110
|
+
/** The evaluation inputs one working state reads, `spec/semantics/context-v1.md`. */
|
|
111
|
+
function inputOf(working) {
|
|
112
|
+
return evaluationInputOf({
|
|
113
|
+
values: working.values,
|
|
114
|
+
context: working.context,
|
|
115
|
+
...(working.redacted === undefined ? {} : { redacted: working.redacted }),
|
|
116
|
+
sessionWrites: [...working.sessionWrites.values()],
|
|
117
|
+
}, parsedAccessOf(working.overlay, working.access));
|
|
118
|
+
}
|
|
119
|
+
/** Files one pass's change set into the set a closure reads. */
|
|
120
|
+
function mergeChanges(into, effect) {
|
|
121
|
+
for (const field of effect.fields)
|
|
122
|
+
into.fields.add(field);
|
|
123
|
+
for (const array of effect.membership)
|
|
124
|
+
into.membership.add(array);
|
|
125
|
+
for (const root of effect.contextRoots)
|
|
126
|
+
into.contextRoots.add(root);
|
|
127
|
+
if (effect.everything)
|
|
128
|
+
into.everything = true;
|
|
129
|
+
}
|
|
130
|
+
/** A change set that has not been consumed by a pass yet. */
|
|
131
|
+
function freshChanges() {
|
|
132
|
+
return { fields: new Set(), membership: new Set(), contextRoots: new Set(), everything: false };
|
|
133
|
+
}
|
|
134
|
+
/** The frozen change set a closure reads. */
|
|
135
|
+
function changesOf(changes) {
|
|
136
|
+
return {
|
|
137
|
+
fields: changes.fields,
|
|
138
|
+
membership: changes.membership,
|
|
139
|
+
contextRoots: changes.contextRoots,
|
|
140
|
+
everything: changes.everything,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** The fields whose derived entry the pass may have changed. */
|
|
144
|
+
const ROW_IDENTITY_TARGETS = new WeakMap();
|
|
145
|
+
/** Every array field and natural-key member whose writer can change derived row membership. */
|
|
146
|
+
function rowIdentityTargetsOf(compiled) {
|
|
147
|
+
const cached = ROW_IDENTITY_TARGETS.get(compiled);
|
|
148
|
+
if (cached !== undefined)
|
|
149
|
+
return cached;
|
|
150
|
+
const targets = new Set();
|
|
151
|
+
const visit = (fields) => {
|
|
152
|
+
for (const field of fields) {
|
|
153
|
+
if (field.primitive === 'array') {
|
|
154
|
+
targets.add(field.fieldId);
|
|
155
|
+
if (field.rowKey?.mode === 'natural' && field.rowKey.fieldId !== undefined) {
|
|
156
|
+
targets.add(field.rowKey.fieldId);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (field.fields !== undefined)
|
|
160
|
+
visit(field.fields);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
visit(compiled.fields);
|
|
164
|
+
ROW_IDENTITY_TARGETS.set(compiled, targets);
|
|
165
|
+
return targets;
|
|
166
|
+
}
|
|
167
|
+
/** Whether any evaluated writer in this pass targets an array or natural-key member. */
|
|
168
|
+
function evaluatedArrayOrKeyWriter(compiled, graph, evaluated) {
|
|
169
|
+
let targets;
|
|
170
|
+
for (const contribution of evaluated) {
|
|
171
|
+
const rule = graph.ruleById.get(contribution.ruleId);
|
|
172
|
+
if (rule === undefined || (rule.kind !== 'compute' && rule.kind !== 'defaultCompute'))
|
|
173
|
+
continue;
|
|
174
|
+
targets ??= rowIdentityTargetsOf(compiled);
|
|
175
|
+
for (const fieldId of ruleTargets(rule)) {
|
|
176
|
+
if (targets.has(fieldId))
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
if (rule.targetFieldId !== undefined && targets.has(rule.targetFieldId))
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
function affectedFields(graph, changes, closure) {
|
|
185
|
+
if (changes.everything)
|
|
186
|
+
return 'all';
|
|
187
|
+
const affected = new Set();
|
|
188
|
+
const addSubtree = (fieldId) => {
|
|
189
|
+
affected.add(fieldId);
|
|
190
|
+
for (const descendant of graph.descendants.get(fieldId) ?? [])
|
|
191
|
+
affected.add(descendant);
|
|
192
|
+
for (const ancestor of graph.ancestors.get(fieldId) ?? []) {
|
|
193
|
+
affected.add(ancestor);
|
|
194
|
+
// Re-keying one member changes the row identity of every sibling member. Re-deriving the
|
|
195
|
+
// container's whole subtree keeps no row list attached to the key it held before the write;
|
|
196
|
+
// structural equality below still reuses every sibling whose actual facts did not change.
|
|
197
|
+
for (const descendant of graph.descendants.get(ancestor) ?? [])
|
|
198
|
+
affected.add(descendant);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
for (const fieldId of changes.fields)
|
|
202
|
+
addSubtree(fieldId);
|
|
203
|
+
for (const ruleId of closure) {
|
|
204
|
+
const rule = graph.ruleById.get(ruleId);
|
|
205
|
+
if (rule === undefined)
|
|
206
|
+
continue;
|
|
207
|
+
// A rule changes the entries of the fields it decides: its target list, the field it
|
|
208
|
+
// names, and for an item rule its target member inside the array it addresses.
|
|
209
|
+
for (const fieldId of ruleTargets(rule))
|
|
210
|
+
addSubtree(fieldId);
|
|
211
|
+
if (rule.targetFieldId !== undefined)
|
|
212
|
+
addSubtree(rule.targetFieldId);
|
|
213
|
+
}
|
|
214
|
+
// A `field` option domain is another field's derived array, an edge no rule expression names.
|
|
215
|
+
// A reader whose source moved must re-derive its eligibility even when no rule reached it; a
|
|
216
|
+
// chain of sources reaches its readers in turn.
|
|
217
|
+
//
|
|
218
|
+
// A declared field's own expressions are the same kind of edge: a `rowsFrom` count and an
|
|
219
|
+
// option's availability condition read the record outside any rule, so a pass that reused
|
|
220
|
+
// their entry would state an answer the record has already moved.
|
|
221
|
+
let propagated = graph.optionSources.size > 0 || graph.fieldExpressionReads.size > 0;
|
|
222
|
+
while (propagated) {
|
|
223
|
+
propagated = false;
|
|
224
|
+
for (const [reader, source] of graph.optionSources) {
|
|
225
|
+
if (affected.has(reader) || !affected.has(source))
|
|
226
|
+
continue;
|
|
227
|
+
addSubtree(reader);
|
|
228
|
+
propagated = true;
|
|
229
|
+
}
|
|
230
|
+
for (const [reader, sources] of graph.fieldExpressionReads) {
|
|
231
|
+
const contextMoved = sources.contextRoots.some((root) => changes.contextRoots.has(root));
|
|
232
|
+
if (affected.has(reader) ||
|
|
233
|
+
(!contextMoved && !sources.fields.some((source) => affected.has(source)))) {
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
addSubtree(reader);
|
|
237
|
+
propagated = true;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return affected;
|
|
241
|
+
}
|
|
242
|
+
/** Sorts one pass's rule counts into a code-point-ordered record. */
|
|
243
|
+
function countsRecord(counts) {
|
|
244
|
+
const record = {};
|
|
245
|
+
for (const ruleId of [...counts.keys()].sort(compareCodePoints)) {
|
|
246
|
+
const count = counts.get(ruleId);
|
|
247
|
+
if (count !== undefined)
|
|
248
|
+
record[ruleId] = count;
|
|
249
|
+
}
|
|
250
|
+
return record;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Runs one four-phase pass, `[ENGINE-3.1.1]`–`[ENGINE-3.1.3]`.
|
|
254
|
+
*
|
|
255
|
+
* Rebuild is the writer subset the closure reaches, produced in the graph's order over the
|
|
256
|
+
* overlay the session retains. Recalculate evaluates the rest of the closure and no other
|
|
257
|
+
* rule. Revalidate is the derivation's fold. Refresh derives the frozen per-binding entries,
|
|
258
|
+
* the patches and the trace, and is the only phase that emits.
|
|
259
|
+
*/
|
|
260
|
+
function runPass(compiled, graph, base, working, computed, changes, ports,
|
|
261
|
+
// The form state committed state had before this commit. A batch stages one pass per
|
|
262
|
+
// operation, so the last of them sees only its own delta; patches and notifications describe
|
|
263
|
+
// the whole commit and are therefore stated against what a subscriber last observed.
|
|
264
|
+
committed, mayRevokePrior = false) {
|
|
265
|
+
const counts = new Map();
|
|
266
|
+
const evaluation = new Evaluation(compiled, inputOf(working), working.env, {
|
|
267
|
+
computed,
|
|
268
|
+
assignedRowKeys: (fieldId) => working.identity.manifests.get(fieldId),
|
|
269
|
+
onRuleEvaluated: (ruleId) => {
|
|
270
|
+
counts.set(ruleId, (counts.get(ruleId) ?? 0) + 1);
|
|
271
|
+
ports.observer?.onRuleEvaluated(ruleId);
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
const closure = closureOf(graph, changes);
|
|
275
|
+
const rules = graph.rules.filter((rule) => closure.has(rule.ruleId));
|
|
276
|
+
const evaluated = evaluation.evaluateRules(rules);
|
|
277
|
+
const contributions = new Map(base?.contributions ?? []);
|
|
278
|
+
for (const contribution of evaluated)
|
|
279
|
+
contributions.set(contribution.ruleId, contribution);
|
|
280
|
+
// A host-loaded option domain is input, not a rule operand. A value it offers that the
|
|
281
|
+
// field's declaration does not admit is the same late-bound host bug a context root earns,
|
|
282
|
+
// and the report must carry it whether or not a rule's closure moved this pass.
|
|
283
|
+
const optionDiagnostics = optionDomainDiagnostics(compiled.fields, ports.optionDomains);
|
|
284
|
+
const report = base === undefined ||
|
|
285
|
+
closure.size > 0 ||
|
|
286
|
+
changes.everything ||
|
|
287
|
+
wroteSession(working, base) ||
|
|
288
|
+
optionDiagnostics.length > 0
|
|
289
|
+
? evaluation.assembleBody([...contributions.values()], optionDiagnostics)
|
|
290
|
+
: base.report;
|
|
291
|
+
const access = evaluation.accessWindow();
|
|
292
|
+
const freshUndecided = evaluation.undecidedCauses();
|
|
293
|
+
const undecided = base === undefined
|
|
294
|
+
? freshUndecided
|
|
295
|
+
: carryUndecided(base.undecided, freshUndecided, evaluated.map((contribution) => contribution.ruleId));
|
|
296
|
+
const previous = base?.form;
|
|
297
|
+
const observed = committed ?? previous;
|
|
298
|
+
// What the pass may have moved decides which derived entries survive. A pass with no base
|
|
299
|
+
// states the opening view and derives every declaration.
|
|
300
|
+
const affected = previous === undefined ? 'all' : affectedFields(graph, changes, closure);
|
|
301
|
+
// Availability is a declared condition rather than a rule, so it is not in the closure: it is
|
|
302
|
+
// scoped by the same set of bindings the change can move. A declaration outside that set keeps
|
|
303
|
+
// the answer committed state already holds; an access or environment change, an open and a
|
|
304
|
+
// hydrate state `all` and evaluate every condition.
|
|
305
|
+
const availabilityScope = affected === 'all' ? undefined : affected;
|
|
306
|
+
const evaluatedAvailability = evaluation.optionAvailability(availabilityScope);
|
|
307
|
+
const optionAvailability = availabilityScope === undefined || base === undefined
|
|
308
|
+
? evaluatedAvailability
|
|
309
|
+
: carryAvailability(base.optionAvailability, evaluatedAvailability, availabilityScope, conditionedAvailabilityFields(compiled));
|
|
310
|
+
const derived = deriveFormState(compiled, {
|
|
311
|
+
report,
|
|
312
|
+
access,
|
|
313
|
+
computed: evaluation.computedValues(),
|
|
314
|
+
input: inputOf(working),
|
|
315
|
+
rowCounts: evaluation.rowCounts(),
|
|
316
|
+
optionAvailability,
|
|
317
|
+
undecided,
|
|
318
|
+
layoutHidden: evaluation.layoutHidden(),
|
|
319
|
+
}, {
|
|
320
|
+
...identityOptions(working.identity),
|
|
321
|
+
...(ports.optionDomains === undefined ? {} : { optionDomains: ports.optionDomains }),
|
|
322
|
+
}, previous === undefined ? undefined : { previous: previous.fields, affected });
|
|
323
|
+
const previousFields = new Map(previous?.fields.map((field) => [field.fieldId, field]));
|
|
324
|
+
const observedFields = new Map(observed?.fields.map((field) => [field.fieldId, field]));
|
|
325
|
+
const fields = [];
|
|
326
|
+
const notified = [];
|
|
327
|
+
for (const field of derived.fields) {
|
|
328
|
+
const before = previousFields.get(field.fieldId);
|
|
329
|
+
const untouched = affected !== 'all' && !affected.has(field.fieldId);
|
|
330
|
+
// A `field` option source reads another field's array without a rule expression naming it,
|
|
331
|
+
// so the closure cannot say the entry survived: it is reused only when its facts are equal.
|
|
332
|
+
const derivesOptionDomain = graph.optionSourceReaders.has(field.fieldId);
|
|
333
|
+
// Entry reuse keeps one binding's snapshot identical across a pass its facts survived.
|
|
334
|
+
const carried = before !== undefined && ((untouched && !derivesOptionDomain) || sameData(before, field));
|
|
335
|
+
const settled = carried ? before : Object.freeze(field);
|
|
336
|
+
fields.push(settled);
|
|
337
|
+
const seen = observedFields.get(field.fieldId);
|
|
338
|
+
// A binding already holds the object this pass commits, so none of its facts moved. An array
|
|
339
|
+
// a pass did not change would otherwise walk every row to prove it once per comparison.
|
|
340
|
+
if (seen !== undefined && seen !== settled) {
|
|
341
|
+
for (const ref of differingBindings(seen, settled))
|
|
342
|
+
notified.push(bindingKeyOf(ref));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const form = freezeTree({ ...derived, fields });
|
|
346
|
+
const patches = observed === undefined ? [] : patchesBetween(observed, form);
|
|
347
|
+
const trace = freezeTree({
|
|
348
|
+
ruleEvaluations: countsRecord(counts),
|
|
349
|
+
consideredReads: evaluation.considered(),
|
|
350
|
+
consideredContextReads: [
|
|
351
|
+
...new Set([...closure].flatMap((ruleId) => graph.depsById.get(ruleId)?.watchedContextRoots ?? [])),
|
|
352
|
+
].sort(compareCodePoints),
|
|
353
|
+
patches,
|
|
354
|
+
notified,
|
|
355
|
+
dropped: [],
|
|
356
|
+
accessVersion: access.version,
|
|
357
|
+
});
|
|
358
|
+
const mayRevokeBindings = mayRevokePrior ||
|
|
359
|
+
changes.everything ||
|
|
360
|
+
changes.membership.size > 0 ||
|
|
361
|
+
evaluatedArrayOrKeyWriter(compiled, graph, evaluated);
|
|
362
|
+
return {
|
|
363
|
+
report,
|
|
364
|
+
form,
|
|
365
|
+
access,
|
|
366
|
+
contributions,
|
|
367
|
+
computed,
|
|
368
|
+
working,
|
|
369
|
+
trace,
|
|
370
|
+
optionAvailability,
|
|
371
|
+
undecided,
|
|
372
|
+
mayRevokeBindings,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* The unread causes this pass's derived state reads, over the ones it did not evaluate.
|
|
377
|
+
*
|
|
378
|
+
* A pass evaluates only the rules a change reaches and replays the rest, so a replayed rule's
|
|
379
|
+
* cause is the one committed state stated: without carrying it, a rule nobody re-ran would read
|
|
380
|
+
* as decided by inputs this pass never saw. A rule the pass did evaluate states its own answer
|
|
381
|
+
* whole, so the stale one is dropped before the fresh bindings are written.
|
|
382
|
+
*/
|
|
383
|
+
function carryUndecided(previous, scoped, evaluated) {
|
|
384
|
+
const carried = new Map(previous);
|
|
385
|
+
for (const ruleId of evaluated)
|
|
386
|
+
carried.delete(ruleId);
|
|
387
|
+
for (const [ruleId, bindings] of scoped)
|
|
388
|
+
carried.set(ruleId, bindings);
|
|
389
|
+
return carried;
|
|
390
|
+
}
|
|
391
|
+
/** Whether this commit unlocked a session-written `write_only` reference, which the report states. */
|
|
392
|
+
function wroteSession(working, base) {
|
|
393
|
+
return working.sessionWrites.size !== base.working.sessionWrites.size;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* One pass's availability answers over the ones it did not evaluate.
|
|
397
|
+
*
|
|
398
|
+
* `scoped` states the declarations this pass evaluated; every binding of another declaration is
|
|
399
|
+
* the answer committed state already held. A declaration's field-level binding and each of its
|
|
400
|
+
* row bindings share one field id, so the old entries are dropped by the id the key names before
|
|
401
|
+
* the fresh answer is written.
|
|
402
|
+
*/
|
|
403
|
+
function carryAvailability(previous, scoped, scope, conditioned) {
|
|
404
|
+
// A pass evaluates a declared condition only when its field is in the scope, so a scope naming
|
|
405
|
+
// no conditioned field cannot add, change or remove an answer. The committed map is returned by
|
|
406
|
+
// identity, which is what keeps an unrelated write from allocating a map of every binding on a
|
|
407
|
+
// form with thousands of conditioned rows. A scope that does name one merges even when the
|
|
408
|
+
// scoped answer is empty, because a condition that became true removes the binding it held.
|
|
409
|
+
let touched = false;
|
|
410
|
+
for (const fieldId of scope) {
|
|
411
|
+
if (conditioned.has(fieldId)) {
|
|
412
|
+
touched = true;
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (!touched)
|
|
417
|
+
return previous;
|
|
418
|
+
noteAvailabilityMapCopy();
|
|
419
|
+
const merged = new Map(previous);
|
|
420
|
+
for (const key of previous.keys()) {
|
|
421
|
+
if (scope.has(refOfBindingKey(key).fieldId))
|
|
422
|
+
merged.delete(key);
|
|
423
|
+
}
|
|
424
|
+
for (const [key, binding] of scoped)
|
|
425
|
+
merged.set(key, binding);
|
|
426
|
+
return merged;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* The identity an open states: minted for a new session, or reconciled against the manifest the
|
|
430
|
+
* payload carries.
|
|
431
|
+
*
|
|
432
|
+
* A manifest is read by the same walk `hydrate` uses, so a repeated id, a count the record does
|
|
433
|
+
* not hold and an assigned array the manifest omits get the answer they get mid-session
|
|
434
|
+
* (`IDENTITY_UNSUPPORTED`, left `unsupported`), never a positional pairing. The factory is still
|
|
435
|
+
* required: a later append mints through it.
|
|
436
|
+
*/
|
|
437
|
+
function openedIdentity(compiled, values, idFactory, manifest) {
|
|
438
|
+
if (manifest === undefined)
|
|
439
|
+
return openIdentity(compiled, values, idFactory);
|
|
440
|
+
const missingFactory = factoryRefusal(compiled, idFactory);
|
|
441
|
+
return missingFactory ?? hydrateIdentity(compiled, values, manifest);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Opens one session, `[ENGINE-1.1.2]`, `[ENGINE-1.1.3]`.
|
|
445
|
+
*
|
|
446
|
+
* The record and the context are validated against the artifact before any rule reads them,
|
|
447
|
+
* and row identity is minted by the host's factory — or reconciled against the manifest a
|
|
448
|
+
* resumed payload carries. A malformed value raises the runtime's own boundary refusal with its
|
|
449
|
+
* path; an identity the artifact cannot support raises `SessionRefusedError` with the structured
|
|
450
|
+
* code, so no report is ever produced for it.
|
|
451
|
+
*/
|
|
452
|
+
export function openSession(compiled, input, env, ports, manifest) {
|
|
453
|
+
const graph = engineGraph(compiled);
|
|
454
|
+
const values = validateRecord(compiled, input.values);
|
|
455
|
+
const context = validateContext(compiled, input.context);
|
|
456
|
+
const opened = openedIdentity(compiled, values, ports.idFactory, manifest);
|
|
457
|
+
if (opened.outcome === 'refused') {
|
|
458
|
+
throw new SessionRefusedError(identityRefusalOf(compiled, opened, (fieldId, rowKey) => identityFieldReadable(compiled, input, env, fieldId, rowKey)));
|
|
459
|
+
}
|
|
460
|
+
const working = {
|
|
461
|
+
values: opened.values,
|
|
462
|
+
context,
|
|
463
|
+
// The session owns its inputs. Retaining a caller's overlay, projection, redaction list or
|
|
464
|
+
// capability array would let a later mutation change one pass's access without the explicit
|
|
465
|
+
// setAccess/setEnv operation that invalidates the retained contributions.
|
|
466
|
+
overlay: input.overlay === undefined ? undefined : toAccessOverlay(input.overlay),
|
|
467
|
+
access: input.access?.map((entry, index) => toAccessEntry(entry, `$.access[${String(index)}]`)),
|
|
468
|
+
redacted: input.redacted?.map((ref, index) => toFieldRef(ref, `$.redacted[${String(index)}]`)),
|
|
469
|
+
env: copyEnvironment(env),
|
|
470
|
+
identity: opened.identity,
|
|
471
|
+
idFactory: ports.idFactory,
|
|
472
|
+
sessionWrites: openedSessionWrites(input),
|
|
473
|
+
};
|
|
474
|
+
const computed = computedOverlay(
|
|
475
|
+
// Every writer the artifact declares owns its field from the start, so a read of an
|
|
476
|
+
// untouched computed field in the first pass cannot fall through to a submission.
|
|
477
|
+
new Set(graph.rules.flatMap((rule) => {
|
|
478
|
+
if (rule.kind !== 'compute' && rule.kind !== 'defaultCompute')
|
|
479
|
+
return [];
|
|
480
|
+
if (rule.fieldId === undefined)
|
|
481
|
+
return [];
|
|
482
|
+
return [rule.scope === 'item' ? (rule.targetFieldId ?? rule.fieldId) : rule.fieldId];
|
|
483
|
+
})));
|
|
484
|
+
const state = runPass(compiled, graph, undefined, working, computed, {
|
|
485
|
+
...NO_CHANGES,
|
|
486
|
+
everything: true,
|
|
487
|
+
}, ports);
|
|
488
|
+
// The first pass is the session's opening view, not a commit: it emits no patch and notifies
|
|
489
|
+
// nobody, because no listener exists yet and nothing has changed since the caller opened it.
|
|
490
|
+
return {
|
|
491
|
+
graph,
|
|
492
|
+
state: {
|
|
493
|
+
...state,
|
|
494
|
+
trace: freezeTree({ ...EMPTY_PASS, accessVersion: state.access.version }),
|
|
495
|
+
mayRevokeBindings: false,
|
|
496
|
+
},
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* The `INVALID_VALUE` refusal a hydrated payload returns when the record boundary refuses it,
|
|
501
|
+
* `[ENGINE-2.1.10]`.
|
|
502
|
+
*
|
|
503
|
+
* A stored draft is host data, not a programmer error: an undeclared field, a wrong primitive
|
|
504
|
+
* or a payload that is not an object at all is a refusal the caller branches on and a form shows,
|
|
505
|
+
* so it carries its code and path instead of escaping as an exception.
|
|
506
|
+
*/
|
|
507
|
+
function invalidPayload(error) {
|
|
508
|
+
return {
|
|
509
|
+
outcome: 'refused',
|
|
510
|
+
code: 'INVALID_VALUE',
|
|
511
|
+
...(error instanceof AxiomError ? { path: error.path } : {}),
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Replaces one session's record from a hydrated payload, `[IDENT-3.1.1]`.
|
|
516
|
+
*
|
|
517
|
+
* The payload's values are validated before anything is read, and its identity is reconciled
|
|
518
|
+
* from the manifest the caller supplies: an assigned array without one stays unsupported, so
|
|
519
|
+
* the session never infers identity from position or value equality. A hydrated payload is
|
|
520
|
+
* stored data, not this session's writes, so the write-only unlock set is cleared.
|
|
521
|
+
*/
|
|
522
|
+
export function hydrateSession(compiled, graph, base, values, manifest, ports) {
|
|
523
|
+
let validated;
|
|
524
|
+
try {
|
|
525
|
+
validated = validateRecord(compiled, values);
|
|
526
|
+
}
|
|
527
|
+
catch (error) {
|
|
528
|
+
return { outcome: 'refused', refusal: invalidPayload(error), index: 0 };
|
|
529
|
+
}
|
|
530
|
+
const opened = hydrateIdentity(compiled, validated, manifest);
|
|
531
|
+
if (opened.outcome === 'refused') {
|
|
532
|
+
// Hydrated values are not this session's writes, so an old write_only unlock must not make
|
|
533
|
+
// their identity deliverable while the refusal is being formed.
|
|
534
|
+
const input = {
|
|
535
|
+
...inputOf(base.working),
|
|
536
|
+
values: validated,
|
|
537
|
+
sessionWrites: [],
|
|
538
|
+
};
|
|
539
|
+
return {
|
|
540
|
+
outcome: 'refused',
|
|
541
|
+
refusal: identityRefusalOf(compiled, opened, (fieldId, rowKey) => identityFieldReadable(compiled, input, base.working.env, fieldId, rowKey)),
|
|
542
|
+
index: 0,
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
const working = {
|
|
546
|
+
...base.working,
|
|
547
|
+
values: opened.values,
|
|
548
|
+
identity: opened.identity,
|
|
549
|
+
idFactory: ports.idFactory,
|
|
550
|
+
sessionWrites: new Map(),
|
|
551
|
+
};
|
|
552
|
+
const next = runPass(compiled, graph, base, working, base.computed.fork(), changesOf({
|
|
553
|
+
fields: new Set(),
|
|
554
|
+
membership: new Set(),
|
|
555
|
+
contextRoots: new Set(),
|
|
556
|
+
everything: true,
|
|
557
|
+
}), ports, undefined, true);
|
|
558
|
+
return {
|
|
559
|
+
outcome: 'ok',
|
|
560
|
+
state: next,
|
|
561
|
+
patches: next.trace.patches,
|
|
562
|
+
structuralWrites: [],
|
|
563
|
+
operations: [],
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Whether one pass's change set states that nothing moved.
|
|
568
|
+
*
|
|
569
|
+
* A no-op operation returns an empty effect — no field, membership, context root or access
|
|
570
|
+
* change — and `[ENGINE-4.1.2]` says such a write evaluates nothing. The report, the derived
|
|
571
|
+
* form and the access answer are therefore the committed ones, and the only fact the commit
|
|
572
|
+
* moves is the working state it retains (a newly recorded session write for a readable value,
|
|
573
|
+
* or the host's id factory).
|
|
574
|
+
*/
|
|
575
|
+
function emptyChanges(changes) {
|
|
576
|
+
return (!changes.everything &&
|
|
577
|
+
changes.fields.size === 0 &&
|
|
578
|
+
changes.membership.size === 0 &&
|
|
579
|
+
changes.contextRoots.size === 0);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Derives the next committed state from a list of operations, `[ENGINE-2.1.3]`.
|
|
583
|
+
*
|
|
584
|
+
* Every operation is staged in issue order against the state the previous ones produced, and
|
|
585
|
+
* a refusal returns before anything is assigned: the caller's committed state is untouched.
|
|
586
|
+
* The final pass is the only one that emits, so an abandoned candidate leaves the committed
|
|
587
|
+
* report, patches and trace byte-identical.
|
|
588
|
+
*/
|
|
589
|
+
export function deriveSession(compiled, graph, base, operations, ports) {
|
|
590
|
+
let working = { ...base.working, idFactory: ports.idFactory };
|
|
591
|
+
let view = base;
|
|
592
|
+
let computed = base.computed.fork();
|
|
593
|
+
let pending = freshChanges();
|
|
594
|
+
let mayRevoke = false;
|
|
595
|
+
const structuralWrites = [];
|
|
596
|
+
const normalizedOperations = [];
|
|
597
|
+
for (const [index, operation] of operations.entries()) {
|
|
598
|
+
const applied = applyOperation(compiled, working, view.form, view.access, operation);
|
|
599
|
+
if (applied.outcome === 'refused')
|
|
600
|
+
return { outcome: 'refused', refusal: applied, index };
|
|
601
|
+
working = applied.working;
|
|
602
|
+
normalizedOperations.push(applied.operation);
|
|
603
|
+
if (applied.structuralWrite !== undefined)
|
|
604
|
+
structuralWrites.push(applied.structuralWrite);
|
|
605
|
+
if (applied.everything || applied.membership.length > 0)
|
|
606
|
+
mayRevoke = true;
|
|
607
|
+
mergeChanges(pending, applied);
|
|
608
|
+
if (index < operations.length - 1) {
|
|
609
|
+
const changes = changesOf(pending);
|
|
610
|
+
// A no-op staged before the tail changes no fact a pass could derive, so there is no
|
|
611
|
+
// intermediate view to publish.
|
|
612
|
+
if (!emptyChanges(changes)) {
|
|
613
|
+
view = runPass(compiled, graph, view, working, computed, changes, ports, undefined, mayRevoke);
|
|
614
|
+
if (view.mayRevokeBindings)
|
|
615
|
+
mayRevoke = true;
|
|
616
|
+
pending = freshChanges();
|
|
617
|
+
computed = view.computed;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
const changes = changesOf(pending);
|
|
622
|
+
// No operation in the batch stated an effect, and no intermediate pass has run: the committed
|
|
623
|
+
// report and form are still the answer, so committing must not re-index the report or
|
|
624
|
+
// re-derive readiness. The pass is still recorded (with no work) and the working state is
|
|
625
|
+
// adopted, because a session write or the id factory may have moved.
|
|
626
|
+
if (view === base && emptyChanges(changes)) {
|
|
627
|
+
const trace = freezeTree({ ...EMPTY_PASS, accessVersion: base.access.version });
|
|
628
|
+
return {
|
|
629
|
+
outcome: 'ok',
|
|
630
|
+
state: {
|
|
631
|
+
...base,
|
|
632
|
+
working,
|
|
633
|
+
trace,
|
|
634
|
+
mayRevokeBindings: false,
|
|
635
|
+
},
|
|
636
|
+
patches: trace.patches,
|
|
637
|
+
structuralWrites,
|
|
638
|
+
operations: normalizedOperations,
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
const next = runPass(compiled, graph, view, working, computed, changes, ports,
|
|
642
|
+
// One commit, one patch list: the operations staged before the last one changed committed
|
|
643
|
+
// state too, and a subscriber applies the whole list to the state it last observed.
|
|
644
|
+
base.form, mayRevoke);
|
|
645
|
+
return {
|
|
646
|
+
outcome: 'ok',
|
|
647
|
+
state: next,
|
|
648
|
+
patches: next.trace.patches,
|
|
649
|
+
structuralWrites,
|
|
650
|
+
operations: normalizedOperations,
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
//# sourceMappingURL=session.js.map
|