@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,427 @@
|
|
|
1
|
+
import { setOwn } from '../../canonical/restricted.js';
|
|
2
|
+
import { compareCodePoints } from '../../expr/strings.js';
|
|
3
|
+
import { isRecord } from '../../model/guards.js';
|
|
4
|
+
import { valueDomainOf } from '../../model/domain.js';
|
|
5
|
+
/** The container a declaration introduces, by primitive: an array iterates rows, a record does not. */
|
|
6
|
+
function stepOf(field) {
|
|
7
|
+
return field.primitive === 'array'
|
|
8
|
+
? { kind: 'array', fieldId: field.fieldId }
|
|
9
|
+
: { kind: 'record', fieldId: field.fieldId };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Every declaration that holds a value of its own — no declared members — in declaration
|
|
13
|
+
* order. A record container and a record array are rebuilt from their leaves, so a moved member
|
|
14
|
+
* never leaves a stale copy behind at the container's old path.
|
|
15
|
+
*/
|
|
16
|
+
function declaredLeaves(compiled) {
|
|
17
|
+
const leaves = [];
|
|
18
|
+
const visit = (members, containers) => {
|
|
19
|
+
for (const member of members) {
|
|
20
|
+
if (member.fields === undefined) {
|
|
21
|
+
leaves.push({ field: member, location: { containers, fieldId: member.fieldId } });
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
visit(member.fields, [...containers, stepOf(member)]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
visit(compiled.fields, []);
|
|
29
|
+
return leaves;
|
|
30
|
+
}
|
|
31
|
+
/** The array containers whose rows address a value, in container order. */
|
|
32
|
+
function rowContainers(location) {
|
|
33
|
+
const rows = [];
|
|
34
|
+
for (const step of location.containers) {
|
|
35
|
+
if (step.kind === 'array')
|
|
36
|
+
rows.push(step.fieldId);
|
|
37
|
+
}
|
|
38
|
+
return rows;
|
|
39
|
+
}
|
|
40
|
+
/** Whether two locations pair their values row for row, so a value can move between them. */
|
|
41
|
+
function sameRows(left, right) {
|
|
42
|
+
const leftRows = rowContainers(left);
|
|
43
|
+
const rightRows = rowContainers(right);
|
|
44
|
+
return (leftRows.length === rightRows.length &&
|
|
45
|
+
leftRows.every((fieldId, index) => fieldId === rightRows[index]));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Every declaration both revisions carry whose recorded rows cannot be paired between them.
|
|
49
|
+
*
|
|
50
|
+
* A value is carried row for row within the array containers its declaration sits under, and a row
|
|
51
|
+
* is never an upcaster key (`[EVOL-2.1.6]`), so a declaration that changes which array scope holds
|
|
52
|
+
* it — out of an array into the record root, or between arrays — has no pairing a transform could
|
|
53
|
+
* express. Exported for the revision diff, which must not call such a transition publishable when
|
|
54
|
+
* the upcast refuses it: the host re-establishes where the value belongs. A declaration the target
|
|
55
|
+
* no longer carries is a different refusal and is not reported here.
|
|
56
|
+
*/
|
|
57
|
+
export function unpairableRows(source, target) {
|
|
58
|
+
const destinations = new Map();
|
|
59
|
+
for (const leaf of declaredLeaves(target)) {
|
|
60
|
+
destinations.set(leaf.field.fieldId, leaf.location);
|
|
61
|
+
}
|
|
62
|
+
const unpairable = [];
|
|
63
|
+
for (const leaf of declaredLeaves(source)) {
|
|
64
|
+
const destination = destinations.get(leaf.field.fieldId);
|
|
65
|
+
if (destination === undefined)
|
|
66
|
+
continue;
|
|
67
|
+
if (!sameRows(leaf.location, destination))
|
|
68
|
+
unpairable.push(leaf.field.fieldId);
|
|
69
|
+
}
|
|
70
|
+
return unpairable.sort(compareCodePoints);
|
|
71
|
+
}
|
|
72
|
+
/** Every position one declaration reaches in a stored record. */
|
|
73
|
+
function readLocated(values, from, to) {
|
|
74
|
+
const located = [];
|
|
75
|
+
readNode(values, from, to, 0, [], [], located);
|
|
76
|
+
return located;
|
|
77
|
+
}
|
|
78
|
+
function readNode(node, from, to, depth, rows, extents, located) {
|
|
79
|
+
const step = from.containers[depth];
|
|
80
|
+
if (step === undefined) {
|
|
81
|
+
if (!isRecord(node))
|
|
82
|
+
return;
|
|
83
|
+
const recorded = Object.hasOwn(node, from.fieldId);
|
|
84
|
+
located.push({
|
|
85
|
+
rows,
|
|
86
|
+
extents,
|
|
87
|
+
depth: targetDepthOf(to, from, from.containers.length),
|
|
88
|
+
nullAt: undefined,
|
|
89
|
+
recorded,
|
|
90
|
+
value: recorded ? node[from.fieldId] : undefined,
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!isRecord(node) || !Object.hasOwn(node, step.fieldId)) {
|
|
95
|
+
stopAt(to, from, depth, rows, extents, located);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const child = node[step.fieldId];
|
|
99
|
+
if (child === null) {
|
|
100
|
+
// The authored `null` belongs to this container wherever the target puts it, so it is looked
|
|
101
|
+
// up by `fieldId`; a container the target no longer declares has nowhere to carry it.
|
|
102
|
+
const nullAt = containerDepthOf(to, step.fieldId);
|
|
103
|
+
if (nullAt !== undefined)
|
|
104
|
+
located.push(withoutValue(nullAt + 1, rows, extents, nullAt));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (step.kind === 'record') {
|
|
108
|
+
readNode(child, from, to, depth + 1, rows, extents, located);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (!Array.isArray(child)) {
|
|
112
|
+
stopAt(to, from, depth, rows, extents, located);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (child.length === 0) {
|
|
116
|
+
// An array the record holds is kept even with no rows in it: `[]` and an absent list are
|
|
117
|
+
// different records, and a present `[]` is one the user emptied.
|
|
118
|
+
const arrayAt = containerDepthOf(to, step.fieldId);
|
|
119
|
+
if (arrayAt !== undefined) {
|
|
120
|
+
located.push(withoutValue(arrayAt + 1, rows, [...extents, 0], undefined));
|
|
121
|
+
}
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
child.forEach((row, index) => {
|
|
125
|
+
readNode(row, from, to, depth + 1, [...rows, index], [...extents, child.length], located);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** The target depth of the container a `fieldId` names, or `undefined` when the target has none. */
|
|
129
|
+
function containerDepthOf(to, fieldId) {
|
|
130
|
+
const index = to.containers.findIndex((step) => step.fieldId === fieldId);
|
|
131
|
+
return index < 0 ? undefined : index;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* How deep into the target's containers the ones the record reaches go.
|
|
135
|
+
*
|
|
136
|
+
* The two chains are not the same length — a container can move under a new parent, and the
|
|
137
|
+
* target can insert one above it — so `reached` source containers are matched to the target by
|
|
138
|
+
* `fieldId`, and the deepest match is the last target container a positional writer must build.
|
|
139
|
+
*/
|
|
140
|
+
function targetDepthOf(to, from, reached) {
|
|
141
|
+
let deepest = 0;
|
|
142
|
+
for (let depth = 0; depth < reached; depth += 1) {
|
|
143
|
+
const step = from.containers[depth];
|
|
144
|
+
if (step === undefined)
|
|
145
|
+
continue;
|
|
146
|
+
const target = containerDepthOf(to, step.fieldId);
|
|
147
|
+
if (target !== undefined && target + 1 > deepest)
|
|
148
|
+
deepest = target + 1;
|
|
149
|
+
}
|
|
150
|
+
return deepest;
|
|
151
|
+
}
|
|
152
|
+
/** A position that carries the containers above a leaf and no value of its own. */
|
|
153
|
+
function withoutValue(depth, rows, extents, nullAt) {
|
|
154
|
+
return { rows, extents, depth, nullAt, recorded: false, value: undefined };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Reports where a descent stopped because the record omits the next container.
|
|
158
|
+
*
|
|
159
|
+
* The containers above the omission are what the record does hold, so they are reported and the
|
|
160
|
+
* writer materializes them; nothing below an omitted container is invented. A stop at the root
|
|
161
|
+
* has no container above it, so it says nothing.
|
|
162
|
+
*/
|
|
163
|
+
function stopAt(to, from, depth, rows, extents, located) {
|
|
164
|
+
const reached = targetDepthOf(to, from, depth);
|
|
165
|
+
if (reached > 0)
|
|
166
|
+
located.push(withoutValue(reached, rows, extents, undefined));
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Writes one declaration's position into a draft the caller owns.
|
|
170
|
+
*
|
|
171
|
+
* The draft is a fresh tree the upcast is building; `upcastRecord` owns it and never hands it
|
|
172
|
+
* back shared with the caller's record, so the stored record is not mutated. Writing into the
|
|
173
|
+
* draft in place keeps a ten-thousand-field record's relocation linear instead of copying the
|
|
174
|
+
* whole tree once per field.
|
|
175
|
+
*/
|
|
176
|
+
function writeLocated(draft, location, located, write) {
|
|
177
|
+
writeNode(draft, location, 0, located, 0, write);
|
|
178
|
+
}
|
|
179
|
+
function writeNode(node, location, depth, located, used, write) {
|
|
180
|
+
const step = location.containers[depth];
|
|
181
|
+
if (step === undefined) {
|
|
182
|
+
if (write.kind === 'value')
|
|
183
|
+
node[location.fieldId] = write.value;
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const existing = node[step.fieldId];
|
|
187
|
+
if (located.nullAt === depth) {
|
|
188
|
+
// A recorded `null` fills the slot only when nothing else claims it: a value or an empty
|
|
189
|
+
// container another declaration carried keeps the slot, because a recorded value is never
|
|
190
|
+
// dropped for a marker.
|
|
191
|
+
if (existing === undefined)
|
|
192
|
+
node[step.fieldId] = null;
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (step.kind === 'record') {
|
|
196
|
+
// Structure the record never held is not invented, but a value still needs the container
|
|
197
|
+
// it moved into, so a value is materialized whatever depth the record reached.
|
|
198
|
+
if (write.kind === 'structure' && depth >= located.depth)
|
|
199
|
+
return;
|
|
200
|
+
const container = isRecord(existing) ? existing : {};
|
|
201
|
+
node[step.fieldId] = container;
|
|
202
|
+
writeNode(container, location, depth + 1, located, used, write);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const extent = located.extents[used];
|
|
206
|
+
if (extent === undefined)
|
|
207
|
+
return;
|
|
208
|
+
const list = Array.isArray(existing) ? existing : [];
|
|
209
|
+
node[step.fieldId] = list;
|
|
210
|
+
// Every row the record holds keeps its place, including a row whose declared values are all
|
|
211
|
+
// absent: the row is the record's, and shortening the list would drop it silently.
|
|
212
|
+
while (list.length < extent)
|
|
213
|
+
list.push({});
|
|
214
|
+
const index = located.rows[used];
|
|
215
|
+
if (index === undefined)
|
|
216
|
+
return;
|
|
217
|
+
const row = list[index];
|
|
218
|
+
const container = isRecord(row) ? row : {};
|
|
219
|
+
list[index] = container;
|
|
220
|
+
writeNode(container, location, depth + 1, located, used + 1, write);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* A deep copy of a stored value.
|
|
224
|
+
*
|
|
225
|
+
* The draft must not share mutable structure with the caller's record: an upcaster receives the
|
|
226
|
+
* copy it may read, and the caller keeps the record it passed in exactly as it was. The copy
|
|
227
|
+
* takes the stored members as they are — a legacy value the current profile would refuse is
|
|
228
|
+
* exactly what an upcaster may be here to transform — so it copies rather than validating.
|
|
229
|
+
*/
|
|
230
|
+
function copyStored(value) {
|
|
231
|
+
if (Array.isArray(value))
|
|
232
|
+
return value.map((item) => copyStored(item));
|
|
233
|
+
if (!isRecord(value))
|
|
234
|
+
return value;
|
|
235
|
+
const copy = {};
|
|
236
|
+
for (const [key, member] of Object.entries(value))
|
|
237
|
+
setOwn(copy, key, copyStored(member));
|
|
238
|
+
return copy;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The text a value domain is named by in a refusal, from the runtime's one derivation.
|
|
242
|
+
*
|
|
243
|
+
* `valueDomainOf` applies the reader's defaults, so a quantity's absent scale is the `0` the
|
|
244
|
+
* reader uses and a duration's absent unit is `minutes`; the members that decide how a value
|
|
245
|
+
* parses — money `(currency, scale)`, quantity `(units, scale)` and duration `unit` — are all
|
|
246
|
+
* part of the domain, because carrying a recorded value across a change to any of them would
|
|
247
|
+
* present the new declaration with a value it never admitted (`[EVOL-2.1.4]`). The unit list is
|
|
248
|
+
* sorted so two declarations that admit the same set in a different order are one domain.
|
|
249
|
+
*/
|
|
250
|
+
function domainText(domain) {
|
|
251
|
+
switch (domain.primitive) {
|
|
252
|
+
case 'money':
|
|
253
|
+
return `money:${domain.currency ?? '?'}/${String(domain.scale ?? '?')}`;
|
|
254
|
+
case 'quantity':
|
|
255
|
+
return `quantity:${domain.units === undefined ? '?' : [...domain.units].sort(compareCodePoints).join(',')}@${String(domain.scale ?? 0)}`;
|
|
256
|
+
case 'duration':
|
|
257
|
+
return `duration:${domain.unit ?? 'minutes'}`;
|
|
258
|
+
case 'array':
|
|
259
|
+
return 'items' in domain && domain.items !== undefined
|
|
260
|
+
? `array:${domainText(domain.items)}`
|
|
261
|
+
: 'array';
|
|
262
|
+
default:
|
|
263
|
+
return domain.primitive;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/** The value domain a declaration admits, as the text a refusal names it by. */
|
|
267
|
+
function domainOf(declaration) {
|
|
268
|
+
return domainText(valueDomainOf(declaration));
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Whether two declarations of one name admit the same value domain.
|
|
272
|
+
*
|
|
273
|
+
* Exported because two callers answer the same question from different evidence: the upcast
|
|
274
|
+
* refuses a recorded value carried across a domain change it has no transform for, and the
|
|
275
|
+
* revision diff classifies the change as one recorded values need a transform for
|
|
276
|
+
* (`[EVOL-2.1.4]`), without upcasting anything. They read one definition, so they cannot
|
|
277
|
+
* disagree about which changes are a domain change.
|
|
278
|
+
*/
|
|
279
|
+
export function sameValueDomain(left, right) {
|
|
280
|
+
return domainOf(left) === domainOf(right);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* The first raw member a record holds that its declarations do not name.
|
|
284
|
+
*
|
|
285
|
+
* A stored record's shape is the artifact's claim about it; a member no declaration names is a
|
|
286
|
+
* value the upcast has nowhere to put, so it is refused rather than dropped. Only record
|
|
287
|
+
* containers are inspected: a leaf's value is opaque here and validated where it is read.
|
|
288
|
+
*/
|
|
289
|
+
export function unresolvedMembers(compiled, values) {
|
|
290
|
+
return checkMembers(compiled.fields, values, compiled.schemaVersion, compiled.schemaId);
|
|
291
|
+
}
|
|
292
|
+
function checkMembers(members, node, version, container) {
|
|
293
|
+
if (!isRecord(node)) {
|
|
294
|
+
return {
|
|
295
|
+
kind: 'field_unresolved',
|
|
296
|
+
fieldId: container,
|
|
297
|
+
detail: `\`${container}\` is declared to hold members, but version ${String(version)} holds a non-object value there`,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
// A container's declaration is looked up once per member it holds, so a record with ten
|
|
301
|
+
// thousand values is checked in one pass rather than ten thousand scans.
|
|
302
|
+
const declarations = new Map();
|
|
303
|
+
for (const member of members)
|
|
304
|
+
declarations.set(member.fieldId, member);
|
|
305
|
+
for (const [key, value] of Object.entries(node)) {
|
|
306
|
+
const member = declarations.get(key);
|
|
307
|
+
if (member === undefined) {
|
|
308
|
+
return {
|
|
309
|
+
kind: 'field_unresolved',
|
|
310
|
+
fieldId: key,
|
|
311
|
+
detail: `version ${String(version)} declares no member \`${key}\` under \`${container}\`, so its value has no declaration to carry`,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (value === null || value === undefined || member.fields === undefined)
|
|
315
|
+
continue;
|
|
316
|
+
if (member.primitive === 'array') {
|
|
317
|
+
if (!Array.isArray(value)) {
|
|
318
|
+
return {
|
|
319
|
+
kind: 'field_unresolved',
|
|
320
|
+
fieldId: key,
|
|
321
|
+
detail: `\`${key}\` is declared as an array, but version ${String(version)} holds a non-list value there`,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
for (const row of value) {
|
|
325
|
+
const refusal = checkMembers(member.fields, row, version, key);
|
|
326
|
+
if (refusal !== undefined)
|
|
327
|
+
return refusal;
|
|
328
|
+
}
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
const refusal = checkMembers(member.fields, value, version, key);
|
|
332
|
+
if (refusal !== undefined)
|
|
333
|
+
return refusal;
|
|
334
|
+
}
|
|
335
|
+
return undefined;
|
|
336
|
+
}
|
|
337
|
+
/** A hop with no upcaster map: the version validates differently but changes no value. */
|
|
338
|
+
const NO_UPCASTERS = new Map();
|
|
339
|
+
/** Transform ids that are not value-bearing declarations on both sides of one hop. */
|
|
340
|
+
function unresolvedUpcasterIds(sources, targets, upcasters) {
|
|
341
|
+
return [...upcasters.keys()].filter((fieldId) => !sources.has(fieldId) || !targets.has(fieldId));
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Transform ids a hop cannot apply because one version does not carry that value-bearing field.
|
|
345
|
+
*
|
|
346
|
+
* The revision diff reads the same predicate as the upcast, so a stale catalogue entry cannot be
|
|
347
|
+
* ignored by the publish answer and then refused only when a recorded value is migrated.
|
|
348
|
+
*/
|
|
349
|
+
export function unresolvedUpcasters(source, target, upcasters = NO_UPCASTERS) {
|
|
350
|
+
const sources = new Set(declaredLeaves(source).map((leaf) => leaf.field.fieldId));
|
|
351
|
+
const targets = new Set(declaredLeaves(target).map((leaf) => leaf.field.fieldId));
|
|
352
|
+
return [...unresolvedUpcasterIds(sources, targets, upcasters)].sort(compareCodePoints);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Carries a record's values from one version's declarations to the next's, by `fieldId`.
|
|
356
|
+
*
|
|
357
|
+
* A declaration the target does not carry, a value whose row structure cannot be paired, and a
|
|
358
|
+
* value domain that changed without an upcaster are all refusals: the upcast never drops a
|
|
359
|
+
* recorded value, never invents one, and never converts one silently. Every structural refusal is
|
|
360
|
+
* decided before the draft is written, so none of them depends on the order declarations are
|
|
361
|
+
* visited; an upcaster's own refusal is raised at the value that declined.
|
|
362
|
+
*/
|
|
363
|
+
export function relocateRecord(source, target, values, hop) {
|
|
364
|
+
const targets = new Map();
|
|
365
|
+
for (const leaf of declaredLeaves(target))
|
|
366
|
+
targets.set(leaf.field.fieldId, leaf);
|
|
367
|
+
const upcasters = hop.upcasters ?? NO_UPCASTERS;
|
|
368
|
+
const moves = [];
|
|
369
|
+
const sources = new Set();
|
|
370
|
+
for (const leaf of declaredLeaves(source)) {
|
|
371
|
+
sources.add(leaf.field.fieldId);
|
|
372
|
+
const destination = targets.get(leaf.field.fieldId);
|
|
373
|
+
if (destination === undefined) {
|
|
374
|
+
return {
|
|
375
|
+
kind: 'field_unresolved',
|
|
376
|
+
fieldId: leaf.field.fieldId,
|
|
377
|
+
detail: `version ${String(target.schemaVersion)} declares no field \`${leaf.field.fieldId}\`, so its recorded value has nowhere to go`,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
if (!sameRows(leaf.location, destination.location)) {
|
|
381
|
+
return {
|
|
382
|
+
kind: 'field_unresolved',
|
|
383
|
+
fieldId: leaf.field.fieldId,
|
|
384
|
+
detail: `\`${leaf.field.fieldId}\` moves between array containers that do not pair row for row, and a row is never an upcaster key`,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
if (!upcasters.has(leaf.field.fieldId) && !sameValueDomain(leaf.field, destination.field)) {
|
|
388
|
+
return {
|
|
389
|
+
kind: 'field_unresolved',
|
|
390
|
+
fieldId: leaf.field.fieldId,
|
|
391
|
+
detail: `\`${leaf.field.fieldId}\` changes from ${domainOf(leaf.field)} to ${domainOf(destination.field)} without an upcaster; a value domain change needs an explicit conversion`,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
moves.push({ from: leaf.location, to: destination.location });
|
|
395
|
+
}
|
|
396
|
+
const unresolved = unresolvedUpcasterIds(sources, new Set(targets.keys()), upcasters)[0];
|
|
397
|
+
if (unresolved !== undefined) {
|
|
398
|
+
return {
|
|
399
|
+
kind: 'field_unresolved',
|
|
400
|
+
fieldId: unresolved,
|
|
401
|
+
detail: `the upcaster names \`${unresolved}\`, which is not a value-bearing field of both versions ${String(source.schemaVersion)} and ${String(target.schemaVersion)}`,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
const draft = {};
|
|
405
|
+
for (const move of moves) {
|
|
406
|
+
const upcaster = upcasters.get(move.from.fieldId);
|
|
407
|
+
for (const located of readLocated(values, move.from, move.to)) {
|
|
408
|
+
// A position the record reaches but holds no value at still carries the containers above
|
|
409
|
+
// it: an emptied list or an unfilled container is recorded structure, not absence.
|
|
410
|
+
if (!located.recorded) {
|
|
411
|
+
writeLocated(draft, move.to, located, { kind: 'structure' });
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
if (upcaster === undefined) {
|
|
415
|
+
writeLocated(draft, move.to, located, { kind: 'value', value: copyStored(located.value) });
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
const decision = upcaster(copyStored(located.value), hop.context);
|
|
419
|
+
if (decision.kind === 'refused') {
|
|
420
|
+
return { kind: 'value_refused', fieldId: move.from.fieldId, detail: decision.detail };
|
|
421
|
+
}
|
|
422
|
+
writeLocated(draft, move.to, located, { kind: 'value', value: decision.value });
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return { kind: 'relocated', values: draft };
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=relocate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relocate.js","sourceRoot":"","sources":["../../../src/eval/evolution/relocate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAgFtD,uGAAu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E,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;YACxF,CAAC;YACD,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["import { setOwn } from '../../canonical/restricted.js';\nimport { compareCodePoints } from '../../expr/strings.js';\nimport { isRecord } from '../../model/guards.js';\nimport type { ItemValueDomain, ValueDomain, ValueDomainDeclaration } from '../../model/domain.js';\nimport { valueDomainOf } from '../../model/domain.js';\nimport type { UpcastContext, UpcastDecision, Upcaster } from '../../model/evolution.js';\nimport type { CompiledSchema } from '../../model/schema.js';\nimport type { CompiledField } from '../../model/types.js';\n\n/**\n * Where a declaration holds its values, and the pure movement of one value between versions.\n *\n * An upcaster is keyed by `fieldId` and must never see a path (`[EVOL-2.1.1]`), so the mapping\n * from an identifier to the place its value sits lives here and only here. A field can move\n * between record containers, and the declaration can sit inside an array, without the value\n * or the upcaster noticing: the array row is a position the writer applies to every row, never\n * a key an upcaster carries.\n *\n * Evaluation locates a value through the record reader, which applies access, redaction and\n * canonical wire reading. Upcasting relocates a *stored* record before any of that runs, so it\n * reads the raw tree directly; the two look similar and answer different questions.\n */\n\n/** One declared container a field lives under, root first. */\ntype LocationStep =\n | { readonly kind: 'record'; readonly fieldId: string }\n | { readonly kind: 'array'; readonly fieldId: string };\n\n/** Where one declared field holds its values. */\ninterface FieldLocation {\n /** The containers above the field, outermost first; empty for a root-level field. */\n readonly containers: readonly LocationStep[];\n readonly fieldId: string;\n}\n\n/** One position a declaration reaches in a stored record, and the containers on the way. */\ninterface LocatedValue {\n /** The row index for each array container on the way to the value, in container order. */\n readonly rows: readonly number[];\n /** The row count of each array container on the way down, in the same order. */\n readonly extents: readonly number[];\n /**\n * How many of the declaration's containers the stored record reaches. The writer materializes\n * the containers up to here and invents none below: a record that omits a container keeps\n * omitting it, and one that holds an empty container keeps holding it.\n */\n readonly depth: number;\n /**\n * The container depth whose recorded member is the authored `null`, when one is.\n *\n * `null` is a recorded value, not an omission — `absent()` distinguishes it from a member the\n * record does not hold — so the container it fills is carried as `null` and the descent stops\n * there.\n */\n readonly nullAt: number | undefined;\n /** Whether the record at the leaf's own level holds the leaf. */\n readonly recorded: boolean;\n readonly value: unknown;\n}\n\n/** Why one declaration could not be carried into the target version. */\nexport type RelocationRefusal =\n | { readonly kind: 'field_unresolved'; readonly fieldId: string; readonly detail: string }\n | { readonly kind: 'value_refused'; readonly fieldId: string; readonly detail: string };\n\n/** What one version hop does to a record now that its values are located by `fieldId`. */\nexport interface RelocationHop {\n /** The upcasters this hop declares, keyed by `fieldId`; absent is an identity hop. */\n readonly upcasters: ReadonlyMap<string, Upcaster> | undefined;\n /** The hop, and the host conversion input, an upcaster runs in. */\n readonly context: UpcastContext;\n}\n\n/** The result of relocating a record across one hop. */\nexport type RelocationOutcome =\n | { readonly kind: 'relocated'; readonly values: Readonly<Record<string, unknown>> }\n | RelocationRefusal;\n\n/** A declared field together with the location its values occupy. */\ninterface DeclaredLeaf {\n readonly field: CompiledField;\n readonly location: FieldLocation;\n}\n\n/** The container a declaration introduces, by primitive: an array iterates rows, a record does not. */\nfunction stepOf(field: CompiledField): LocationStep {\n return field.primitive === 'array'\n ? { kind: 'array', fieldId: field.fieldId }\n : { kind: 'record', fieldId: field.fieldId };\n}\n\n/**\n * Every declaration that holds a value of its own — no declared members — in declaration\n * order. A record container and a record array are rebuilt from their leaves, so a moved member\n * never leaves a stale copy behind at the container's old path.\n */\nfunction declaredLeaves(compiled: CompiledSchema): readonly DeclaredLeaf[] {\n const leaves: DeclaredLeaf[] = [];\n const visit = (members: readonly CompiledField[], containers: readonly LocationStep[]): void => {\n for (const member of members) {\n if (member.fields === undefined) {\n leaves.push({ field: member, location: { containers, fieldId: member.fieldId } });\n } else {\n visit(member.fields, [...containers, stepOf(member)]);\n }\n }\n };\n visit(compiled.fields, []);\n return leaves;\n}\n\n/** The array containers whose rows address a value, in container order. */\nfunction rowContainers(location: FieldLocation): readonly string[] {\n const rows: string[] = [];\n for (const step of location.containers) {\n if (step.kind === 'array') rows.push(step.fieldId);\n }\n return rows;\n}\n\n/** Whether two locations pair their values row for row, so a value can move between them. */\nfunction sameRows(left: FieldLocation, right: FieldLocation): boolean {\n const leftRows = rowContainers(left);\n const rightRows = rowContainers(right);\n return (\n leftRows.length === rightRows.length &&\n leftRows.every((fieldId, index) => fieldId === rightRows[index])\n );\n}\n\n/**\n * Every declaration both revisions carry whose recorded rows cannot be paired between them.\n *\n * A value is carried row for row within the array containers its declaration sits under, and a row\n * is never an upcaster key (`[EVOL-2.1.6]`), so a declaration that changes which array scope holds\n * it — out of an array into the record root, or between arrays — has no pairing a transform could\n * express. Exported for the revision diff, which must not call such a transition publishable when\n * the upcast refuses it: the host re-establishes where the value belongs. A declaration the target\n * no longer carries is a different refusal and is not reported here.\n */\nexport function unpairableRows(source: CompiledSchema, target: CompiledSchema): readonly string[] {\n const destinations = new Map<string, FieldLocation>();\n for (const leaf of declaredLeaves(target)) {\n destinations.set(leaf.field.fieldId, leaf.location);\n }\n const unpairable: string[] = [];\n for (const leaf of declaredLeaves(source)) {\n const destination = destinations.get(leaf.field.fieldId);\n if (destination === undefined) continue;\n if (!sameRows(leaf.location, destination)) unpairable.push(leaf.field.fieldId);\n }\n return unpairable.sort(compareCodePoints);\n}\n\n/** Every position one declaration reaches in a stored record. */\nfunction readLocated(\n values: Readonly<Record<string, unknown>>,\n from: FieldLocation,\n to: FieldLocation,\n): readonly LocatedValue[] {\n const located: LocatedValue[] = [];\n readNode(values, from, to, 0, [], [], located);\n return located;\n}\n\nfunction readNode(\n node: unknown,\n from: FieldLocation,\n to: FieldLocation,\n depth: number,\n rows: readonly number[],\n extents: readonly number[],\n located: LocatedValue[],\n): void {\n const step = from.containers[depth];\n if (step === undefined) {\n if (!isRecord(node)) return;\n const recorded = Object.hasOwn(node, from.fieldId);\n located.push({\n rows,\n extents,\n depth: targetDepthOf(to, from, from.containers.length),\n nullAt: undefined,\n recorded,\n value: recorded ? node[from.fieldId] : undefined,\n });\n return;\n }\n if (!isRecord(node) || !Object.hasOwn(node, step.fieldId)) {\n stopAt(to, from, depth, rows, extents, located);\n return;\n }\n const child = node[step.fieldId];\n if (child === null) {\n // The authored `null` belongs to this container wherever the target puts it, so it is looked\n // up by `fieldId`; a container the target no longer declares has nowhere to carry it.\n const nullAt = containerDepthOf(to, step.fieldId);\n if (nullAt !== undefined) located.push(withoutValue(nullAt + 1, rows, extents, nullAt));\n return;\n }\n if (step.kind === 'record') {\n readNode(child, from, to, depth + 1, rows, extents, located);\n return;\n }\n if (!Array.isArray(child)) {\n stopAt(to, from, depth, rows, extents, located);\n return;\n }\n if (child.length === 0) {\n // An array the record holds is kept even with no rows in it: `[]` and an absent list are\n // different records, and a present `[]` is one the user emptied.\n const arrayAt = containerDepthOf(to, step.fieldId);\n if (arrayAt !== undefined) {\n located.push(withoutValue(arrayAt + 1, rows, [...extents, 0], undefined));\n }\n return;\n }\n child.forEach((row, index) => {\n readNode(row, from, to, depth + 1, [...rows, index], [...extents, child.length], located);\n });\n}\n\n/** The target depth of the container a `fieldId` names, or `undefined` when the target has none. */\nfunction containerDepthOf(to: FieldLocation, fieldId: string): number | undefined {\n const index = to.containers.findIndex((step) => step.fieldId === fieldId);\n return index < 0 ? undefined : index;\n}\n\n/**\n * How deep into the target's containers the ones the record reaches go.\n *\n * The two chains are not the same length — a container can move under a new parent, and the\n * target can insert one above it — so `reached` source containers are matched to the target by\n * `fieldId`, and the deepest match is the last target container a positional writer must build.\n */\nfunction targetDepthOf(to: FieldLocation, from: FieldLocation, reached: number): number {\n let deepest = 0;\n for (let depth = 0; depth < reached; depth += 1) {\n const step = from.containers[depth];\n if (step === undefined) continue;\n const target = containerDepthOf(to, step.fieldId);\n if (target !== undefined && target + 1 > deepest) deepest = target + 1;\n }\n return deepest;\n}\n\n/** A position that carries the containers above a leaf and no value of its own. */\nfunction withoutValue(\n depth: number,\n rows: readonly number[],\n extents: readonly number[],\n nullAt: number | undefined,\n): LocatedValue {\n return { rows, extents, depth, nullAt, recorded: false, value: undefined };\n}\n\n/**\n * Reports where a descent stopped because the record omits the next container.\n *\n * The containers above the omission are what the record does hold, so they are reported and the\n * writer materializes them; nothing below an omitted container is invented. A stop at the root\n * has no container above it, so it says nothing.\n */\nfunction stopAt(\n to: FieldLocation,\n from: FieldLocation,\n depth: number,\n rows: readonly number[],\n extents: readonly number[],\n located: LocatedValue[],\n): void {\n const reached = targetDepthOf(to, from, depth);\n if (reached > 0) located.push(withoutValue(reached, rows, extents, undefined));\n}\n\n/** What a relocation writes once its containers are in place: a value, or structure alone. */\ntype LeafWrite =\n | { readonly kind: 'value'; readonly value: unknown }\n | { readonly kind: 'structure' };\n\n/**\n * Writes one declaration's position into a draft the caller owns.\n *\n * The draft is a fresh tree the upcast is building; `upcastRecord` owns it and never hands it\n * back shared with the caller's record, so the stored record is not mutated. Writing into the\n * draft in place keeps a ten-thousand-field record's relocation linear instead of copying the\n * whole tree once per field.\n */\nfunction writeLocated(\n draft: Record<string, unknown>,\n location: FieldLocation,\n located: LocatedValue,\n write: LeafWrite,\n): void {\n writeNode(draft, location, 0, located, 0, write);\n}\n\nfunction writeNode(\n node: Record<string, unknown>,\n location: FieldLocation,\n depth: number,\n located: LocatedValue,\n used: number,\n write: LeafWrite,\n): void {\n const step = location.containers[depth];\n if (step === undefined) {\n if (write.kind === 'value') node[location.fieldId] = write.value;\n return;\n }\n const existing = node[step.fieldId];\n if (located.nullAt === depth) {\n // A recorded `null` fills the slot only when nothing else claims it: a value or an empty\n // container another declaration carried keeps the slot, because a recorded value is never\n // dropped for a marker.\n if (existing === undefined) node[step.fieldId] = null;\n return;\n }\n if (step.kind === 'record') {\n // Structure the record never held is not invented, but a value still needs the container\n // it moved into, so a value is materialized whatever depth the record reached.\n if (write.kind === 'structure' && depth >= located.depth) return;\n const container = isRecord(existing) ? existing : {};\n node[step.fieldId] = container;\n writeNode(container, location, depth + 1, located, used, write);\n return;\n }\n const extent = located.extents[used];\n if (extent === undefined) return;\n const list: unknown[] = Array.isArray(existing) ? existing : [];\n node[step.fieldId] = list;\n // Every row the record holds keeps its place, including a row whose declared values are all\n // absent: the row is the record's, and shortening the list would drop it silently.\n while (list.length < extent) list.push({});\n const index = located.rows[used];\n if (index === undefined) return;\n const row = list[index];\n const container = isRecord(row) ? row : {};\n list[index] = container;\n writeNode(container, location, depth + 1, located, used + 1, write);\n}\n\n/**\n * A deep copy of a stored value.\n *\n * The draft must not share mutable structure with the caller's record: an upcaster receives the\n * copy it may read, and the caller keeps the record it passed in exactly as it was. The copy\n * takes the stored members as they are — a legacy value the current profile would refuse is\n * exactly what an upcaster may be here to transform — so it copies rather than validating.\n */\nfunction copyStored(value: unknown): unknown {\n if (Array.isArray(value)) return value.map((item) => copyStored(item));\n if (!isRecord(value)) return value;\n const copy: Record<string, unknown> = {};\n for (const [key, member] of Object.entries(value)) setOwn(copy, key, copyStored(member));\n return copy;\n}\n\n/**\n * The text a value domain is named by in a refusal, from the runtime's one derivation.\n *\n * `valueDomainOf` applies the reader's defaults, so a quantity's absent scale is the `0` the\n * reader uses and a duration's absent unit is `minutes`; the members that decide how a value\n * parses — money `(currency, scale)`, quantity `(units, scale)` and duration `unit` — are all\n * part of the domain, because carrying a recorded value across a change to any of them would\n * present the new declaration with a value it never admitted (`[EVOL-2.1.4]`). The unit list is\n * sorted so two declarations that admit the same set in a different order are one domain.\n */\nfunction domainText(domain: ValueDomain | ItemValueDomain): string {\n switch (domain.primitive) {\n case 'money':\n return `money:${domain.currency ?? '?'}/${String(domain.scale ?? '?')}`;\n case 'quantity':\n return `quantity:${domain.units === undefined ? '?' : [...domain.units].sort(compareCodePoints).join(',')}@${String(domain.scale ?? 0)}`;\n case 'duration':\n return `duration:${domain.unit ?? 'minutes'}`;\n case 'array':\n return 'items' in domain && domain.items !== undefined\n ? `array:${domainText(domain.items)}`\n : 'array';\n default:\n return domain.primitive;\n }\n}\n\n/** The value domain a declaration admits, as the text a refusal names it by. */\nfunction domainOf(declaration: ValueDomainDeclaration): string {\n return domainText(valueDomainOf(declaration));\n}\n\n/**\n * Whether two declarations of one name admit the same value domain.\n *\n * Exported because two callers answer the same question from different evidence: the upcast\n * refuses a recorded value carried across a domain change it has no transform for, and the\n * revision diff classifies the change as one recorded values need a transform for\n * (`[EVOL-2.1.4]`), without upcasting anything. They read one definition, so they cannot\n * disagree about which changes are a domain change.\n */\nexport function sameValueDomain(\n left: ValueDomainDeclaration,\n right: ValueDomainDeclaration,\n): boolean {\n return domainOf(left) === domainOf(right);\n}\n\n/**\n * The first raw member a record holds that its declarations do not name.\n *\n * A stored record's shape is the artifact's claim about it; a member no declaration names is a\n * value the upcast has nowhere to put, so it is refused rather than dropped. Only record\n * containers are inspected: a leaf's value is opaque here and validated where it is read.\n */\nexport function unresolvedMembers(\n compiled: CompiledSchema,\n values: Readonly<Record<string, unknown>>,\n): RelocationRefusal | undefined {\n return checkMembers(compiled.fields, values, compiled.schemaVersion, compiled.schemaId);\n}\n\nfunction checkMembers(\n members: readonly CompiledField[],\n node: unknown,\n version: number,\n container: string,\n): RelocationRefusal | undefined {\n if (!isRecord(node)) {\n return {\n kind: 'field_unresolved',\n fieldId: container,\n detail: `\\`${container}\\` is declared to hold members, but version ${String(version)} holds a non-object value there`,\n };\n }\n // A container's declaration is looked up once per member it holds, so a record with ten\n // thousand values is checked in one pass rather than ten thousand scans.\n const declarations = new Map<string, CompiledField>();\n for (const member of members) declarations.set(member.fieldId, member);\n for (const [key, value] of Object.entries(node)) {\n const member = declarations.get(key);\n if (member === undefined) {\n return {\n kind: 'field_unresolved',\n fieldId: key,\n detail: `version ${String(version)} declares no member \\`${key}\\` under \\`${container}\\`, so its value has no declaration to carry`,\n };\n }\n if (value === null || value === undefined || member.fields === undefined) continue;\n if (member.primitive === 'array') {\n if (!Array.isArray(value)) {\n return {\n kind: 'field_unresolved',\n fieldId: key,\n detail: `\\`${key}\\` is declared as an array, but version ${String(version)} holds a non-list value there`,\n };\n }\n for (const row of value) {\n const refusal = checkMembers(member.fields, row, version, key);\n if (refusal !== undefined) return refusal;\n }\n continue;\n }\n const refusal = checkMembers(member.fields, value, version, key);\n if (refusal !== undefined) return refusal;\n }\n return undefined;\n}\n\n/** A hop with no upcaster map: the version validates differently but changes no value. */\nconst NO_UPCASTERS: ReadonlyMap<string, Upcaster> = new Map();\n\n/** Transform ids that are not value-bearing declarations on both sides of one hop. */\nfunction unresolvedUpcasterIds(\n sources: ReadonlySet<string>,\n targets: ReadonlySet<string>,\n upcasters: ReadonlyMap<string, Upcaster>,\n): readonly string[] {\n return [...upcasters.keys()].filter((fieldId) => !sources.has(fieldId) || !targets.has(fieldId));\n}\n\n/**\n * Transform ids a hop cannot apply because one version does not carry that value-bearing field.\n *\n * The revision diff reads the same predicate as the upcast, so a stale catalogue entry cannot be\n * ignored by the publish answer and then refused only when a recorded value is migrated.\n */\nexport function unresolvedUpcasters(\n source: CompiledSchema,\n target: CompiledSchema,\n upcasters: ReadonlyMap<string, Upcaster> = NO_UPCASTERS,\n): readonly string[] {\n const sources = new Set(declaredLeaves(source).map((leaf) => leaf.field.fieldId));\n const targets = new Set(declaredLeaves(target).map((leaf) => leaf.field.fieldId));\n return [...unresolvedUpcasterIds(sources, targets, upcasters)].sort(compareCodePoints);\n}\n\n/**\n * Carries a record's values from one version's declarations to the next's, by `fieldId`.\n *\n * A declaration the target does not carry, a value whose row structure cannot be paired, and a\n * value domain that changed without an upcaster are all refusals: the upcast never drops a\n * recorded value, never invents one, and never converts one silently. Every structural refusal is\n * decided before the draft is written, so none of them depends on the order declarations are\n * visited; an upcaster's own refusal is raised at the value that declined.\n */\nexport function relocateRecord(\n source: CompiledSchema,\n target: CompiledSchema,\n values: Readonly<Record<string, unknown>>,\n hop: RelocationHop,\n): RelocationOutcome {\n const targets = new Map<string, DeclaredLeaf>();\n for (const leaf of declaredLeaves(target)) targets.set(leaf.field.fieldId, leaf);\n const upcasters = hop.upcasters ?? NO_UPCASTERS;\n const moves: { readonly from: FieldLocation; readonly to: FieldLocation }[] = [];\n const sources = new Set<string>();\n for (const leaf of declaredLeaves(source)) {\n sources.add(leaf.field.fieldId);\n const destination = targets.get(leaf.field.fieldId);\n if (destination === undefined) {\n return {\n kind: 'field_unresolved',\n fieldId: leaf.field.fieldId,\n detail: `version ${String(target.schemaVersion)} declares no field \\`${leaf.field.fieldId}\\`, so its recorded value has nowhere to go`,\n };\n }\n if (!sameRows(leaf.location, destination.location)) {\n return {\n kind: 'field_unresolved',\n fieldId: leaf.field.fieldId,\n detail: `\\`${leaf.field.fieldId}\\` moves between array containers that do not pair row for row, and a row is never an upcaster key`,\n };\n }\n if (!upcasters.has(leaf.field.fieldId) && !sameValueDomain(leaf.field, destination.field)) {\n return {\n kind: 'field_unresolved',\n fieldId: leaf.field.fieldId,\n detail: `\\`${leaf.field.fieldId}\\` changes from ${domainOf(leaf.field)} to ${domainOf(destination.field)} without an upcaster; a value domain change needs an explicit conversion`,\n };\n }\n moves.push({ from: leaf.location, to: destination.location });\n }\n const unresolved = unresolvedUpcasterIds(sources, new Set(targets.keys()), upcasters)[0];\n if (unresolved !== undefined) {\n return {\n kind: 'field_unresolved',\n fieldId: unresolved,\n detail: `the upcaster names \\`${unresolved}\\`, which is not a value-bearing field of both versions ${String(source.schemaVersion)} and ${String(target.schemaVersion)}`,\n };\n }\n\n const draft: Record<string, unknown> = {};\n for (const move of moves) {\n const upcaster = upcasters.get(move.from.fieldId);\n for (const located of readLocated(values, move.from, move.to)) {\n // A position the record reaches but holds no value at still carries the containers above\n // it: an emptied list or an unfilled container is recorded structure, not absence.\n if (!located.recorded) {\n writeLocated(draft, move.to, located, { kind: 'structure' });\n continue;\n }\n if (upcaster === undefined) {\n writeLocated(draft, move.to, located, { kind: 'value', value: copyStored(located.value) });\n continue;\n }\n const decision: UpcastDecision = upcaster(copyStored(located.value), hop.context);\n if (decision.kind === 'refused') {\n return { kind: 'value_refused', fieldId: move.from.fieldId, detail: decision.detail };\n }\n writeLocated(draft, move.to, located, { kind: 'value', value: decision.value });\n }\n }\n return { kind: 'relocated', values: draft };\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SchemaCatalogue, SchemaSelection, SelectEffectiveSchemaRequest } from '../../model/evolution.js';
|
|
2
|
+
/**
|
|
3
|
+
* The versions a record evaluates under: the recorded one, and — only when the host adopts a
|
|
4
|
+
* newer retained version for in-flight drafts — the newest one the catalogue holds.
|
|
5
|
+
*
|
|
6
|
+
* A version the catalogue does not retain is a tagged refusal rather than a throw, because a
|
|
7
|
+
* host that has not kept an old artifact is an expected answer to "which version does this
|
|
8
|
+
* record evaluate under", not a violated invariant.
|
|
9
|
+
*/
|
|
10
|
+
export declare function selectEffectiveSchema(catalogue: SchemaCatalogue, request: SelectEffectiveSchemaRequest): SchemaSelection;
|
|
11
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/eval/evolution/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AAgClC;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,4BAA4B,GACpC,eAAe,CAejB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isSafeInteger } from '../../model/values.js';
|
|
2
|
+
/**
|
|
3
|
+
* Which published version a record or a draft is evaluated under,
|
|
4
|
+
* `spec/semantics/evolution-v1.md` section 5.
|
|
5
|
+
*
|
|
6
|
+
* The recorded version always comes first: a draft is judged against the version it was
|
|
7
|
+
* completed under before a host decides anything else, because a rule added since would
|
|
8
|
+
* otherwise change the result of work the user already finished (`[EVOL-5.1.2]`). A second
|
|
9
|
+
* version appears only when the host says it adopts a later one for in-flight drafts, and it is
|
|
10
|
+
* reported beside the first rather than replacing it, so the transition is auditable
|
|
11
|
+
* (`[EVOL-5.1.3]`).
|
|
12
|
+
*
|
|
13
|
+
* Adoption is *data*: the answer is a function of the catalogue and the two inputs, never of a
|
|
14
|
+
* clock or of the record date. The record date selects dataset rows; it never selects a schema
|
|
15
|
+
* version.
|
|
16
|
+
*/
|
|
17
|
+
/** The newest retained artifact, by version. */
|
|
18
|
+
function newestRetained(catalogue) {
|
|
19
|
+
let newest;
|
|
20
|
+
for (const [version, schema] of catalogue) {
|
|
21
|
+
if (!isSafeInteger(version) || version < 1)
|
|
22
|
+
continue;
|
|
23
|
+
if (newest === undefined || version > newest.version)
|
|
24
|
+
newest = { version, schema };
|
|
25
|
+
}
|
|
26
|
+
return newest;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The versions a record evaluates under: the recorded one, and — only when the host adopts a
|
|
30
|
+
* newer retained version for in-flight drafts — the newest one the catalogue holds.
|
|
31
|
+
*
|
|
32
|
+
* A version the catalogue does not retain is a tagged refusal rather than a throw, because a
|
|
33
|
+
* host that has not kept an old artifact is an expected answer to "which version does this
|
|
34
|
+
* record evaluate under", not a violated invariant.
|
|
35
|
+
*/
|
|
36
|
+
export function selectEffectiveSchema(catalogue, request) {
|
|
37
|
+
const { recordedVersion, adoptInFlight } = request;
|
|
38
|
+
const first = isSafeInteger(recordedVersion) && recordedVersion >= 1
|
|
39
|
+
? catalogue.get(recordedVersion)
|
|
40
|
+
: undefined;
|
|
41
|
+
if (first === undefined)
|
|
42
|
+
return { kind: 'version_not_retained', from: recordedVersion };
|
|
43
|
+
if (!adoptInFlight)
|
|
44
|
+
return { kind: 'selected', first };
|
|
45
|
+
const newest = newestRetained(catalogue);
|
|
46
|
+
// Adopting the version a draft already records changes nothing; reporting a second artifact
|
|
47
|
+
// identical to the first would suggest a transition that did not happen.
|
|
48
|
+
if (newest === undefined || newest.version <= recordedVersion) {
|
|
49
|
+
return { kind: 'selected', first };
|
|
50
|
+
}
|
|
51
|
+
return { kind: 'selected', first, second: newest.schema };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/eval/evolution/select.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;;;;;;;;;;GAcG;AAEH,gDAAgD;AAChD,SAAS,cAAc,CACrB,SAA0B;IAE1B,IAAI,MAAiF,CAAC;IACtF,KAAK,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC1C,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC;YAAE,SAAS;QACrD,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO;YAAE,MAAM,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,SAA0B,EAC1B,OAAqC;IAErC,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,KAAK,GACT,aAAa,CAAC,eAAe,CAAC,IAAI,eAAe,IAAI,CAAC;QACpD,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC;QAChC,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IACxF,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IACvD,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IACzC,4FAA4F;IAC5F,yEAAyE;IACzE,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC;QAC9D,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["import type {\n SchemaCatalogue,\n SchemaSelection,\n SelectEffectiveSchemaRequest,\n} from '../../model/evolution.js';\nimport type { CompiledSchema } from '../../model/schema.js';\nimport { isSafeInteger } from '../../model/values.js';\n\n/**\n * Which published version a record or a draft is evaluated under,\n * `spec/semantics/evolution-v1.md` section 5.\n *\n * The recorded version always comes first: a draft is judged against the version it was\n * completed under before a host decides anything else, because a rule added since would\n * otherwise change the result of work the user already finished (`[EVOL-5.1.2]`). A second\n * version appears only when the host says it adopts a later one for in-flight drafts, and it is\n * reported beside the first rather than replacing it, so the transition is auditable\n * (`[EVOL-5.1.3]`).\n *\n * Adoption is *data*: the answer is a function of the catalogue and the two inputs, never of a\n * clock or of the record date. The record date selects dataset rows; it never selects a schema\n * version.\n */\n\n/** The newest retained artifact, by version. */\nfunction newestRetained(\n catalogue: SchemaCatalogue,\n): { readonly version: number; readonly schema: CompiledSchema } | undefined {\n let newest: { readonly version: number; readonly schema: CompiledSchema } | undefined;\n for (const [version, schema] of catalogue) {\n if (!isSafeInteger(version) || version < 1) continue;\n if (newest === undefined || version > newest.version) newest = { version, schema };\n }\n return newest;\n}\n\n/**\n * The versions a record evaluates under: the recorded one, and — only when the host adopts a\n * newer retained version for in-flight drafts — the newest one the catalogue holds.\n *\n * A version the catalogue does not retain is a tagged refusal rather than a throw, because a\n * host that has not kept an old artifact is an expected answer to \"which version does this\n * record evaluate under\", not a violated invariant.\n */\nexport function selectEffectiveSchema(\n catalogue: SchemaCatalogue,\n request: SelectEffectiveSchemaRequest,\n): SchemaSelection {\n const { recordedVersion, adoptInFlight } = request;\n const first =\n isSafeInteger(recordedVersion) && recordedVersion >= 1\n ? catalogue.get(recordedVersion)\n : undefined;\n if (first === undefined) return { kind: 'version_not_retained', from: recordedVersion };\n if (!adoptInFlight) return { kind: 'selected', first };\n const newest = newestRetained(catalogue);\n // Adopting the version a draft already records changes nothing; reporting a second artifact\n // identical to the first would suggest a transition that did not happen.\n if (newest === undefined || newest.version <= recordedVersion) {\n return { kind: 'selected', first };\n }\n return { kind: 'selected', first, second: newest.schema };\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UpcastOutcome, UpcastRequest } from '../../model/evolution.js';
|
|
2
|
+
/**
|
|
3
|
+
* Moves a stored record from the version it was recorded at to a later one.
|
|
4
|
+
*
|
|
5
|
+
* Values are located by `fieldId`, so a field that moved between containers is read where the
|
|
6
|
+
* old declaration put it and written where the new one puts it, and a field inside an array is
|
|
7
|
+
* carried row for row. The record passed in is never mutated: a same-version request is the
|
|
8
|
+
* identity result, and a hop builds a fresh tree. An absent field stays absent, a deprecated one
|
|
9
|
+
* stays declared, and a value whose domain changed without an upcaster is refused instead of
|
|
10
|
+
* being carried into a declaration that never admitted it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function upcastRecord(request: UpcastRequest): UpcastOutcome;
|
|
13
|
+
//# sourceMappingURL=upcast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upcast.d.ts","sourceRoot":"","sources":["../../../src/eval/evolution/upcast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AA2C5F;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAuClE"}
|