@azx-pbc/axiom-runtime 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +714 -2
- package/dist/cache/index.d.ts +191 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +361 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/canonical/jcs.d.ts +78 -0
- package/dist/canonical/jcs.d.ts.map +1 -0
- package/dist/canonical/jcs.js +500 -0
- package/dist/canonical/jcs.js.map +1 -0
- package/dist/canonical/restricted-json.d.ts +7 -0
- package/dist/canonical/restricted-json.d.ts.map +1 -0
- package/dist/canonical/restricted-json.js +318 -0
- package/dist/canonical/restricted-json.js.map +1 -0
- package/dist/canonical/restricted-value.d.ts +59 -0
- package/dist/canonical/restricted-value.d.ts.map +1 -0
- package/dist/canonical/restricted-value.js +156 -0
- package/dist/canonical/restricted-value.js.map +1 -0
- package/dist/canonical/restricted.d.ts +85 -0
- package/dist/canonical/restricted.d.ts.map +1 -0
- package/dist/canonical/restricted.js +163 -0
- package/dist/canonical/restricted.js.map +1 -0
- package/dist/canonical/signature.d.ts +38 -0
- package/dist/canonical/signature.d.ts.map +1 -0
- package/dist/canonical/signature.js +47 -0
- package/dist/canonical/signature.js.map +1 -0
- package/dist/eval/access/delivery.d.ts +63 -0
- package/dist/eval/access/delivery.d.ts.map +1 -0
- package/dist/eval/access/delivery.js +98 -0
- package/dist/eval/access/delivery.js.map +1 -0
- package/dist/eval/access/overlay.d.ts +72 -0
- package/dist/eval/access/overlay.d.ts.map +1 -0
- package/dist/eval/access/overlay.js +402 -0
- package/dist/eval/access/overlay.js.map +1 -0
- package/dist/eval/access/projection.d.ts +159 -0
- package/dist/eval/access/projection.d.ts.map +1 -0
- package/dist/eval/access/projection.js +211 -0
- package/dist/eval/access/projection.js.map +1 -0
- package/dist/eval/access/window.d.ts +128 -0
- package/dist/eval/access/window.d.ts.map +1 -0
- package/dist/eval/access/window.js +254 -0
- package/dist/eval/access/window.js.map +1 -0
- package/dist/eval/access/write.d.ts +113 -0
- package/dist/eval/access/write.d.ts.map +1 -0
- package/dist/eval/access/write.js +119 -0
- package/dist/eval/access/write.js.map +1 -0
- package/dist/eval/addressing.d.ts +131 -0
- package/dist/eval/addressing.d.ts.map +1 -0
- package/dist/eval/addressing.js +270 -0
- package/dist/eval/addressing.js.map +1 -0
- package/dist/eval/budget.d.ts +143 -0
- package/dist/eval/budget.d.ts.map +1 -0
- package/dist/eval/budget.js +387 -0
- package/dist/eval/budget.js.map +1 -0
- package/dist/eval/computed.d.ts +46 -0
- package/dist/eval/computed.d.ts.map +1 -0
- package/dist/eval/computed.js +89 -0
- package/dist/eval/computed.js.map +1 -0
- package/dist/eval/denials.d.ts +64 -0
- package/dist/eval/denials.d.ts.map +1 -0
- package/dist/eval/denials.js +87 -0
- package/dist/eval/denials.js.map +1 -0
- package/dist/eval/engine/cancellation.d.ts +12 -0
- package/dist/eval/engine/cancellation.d.ts.map +1 -0
- package/dist/eval/engine/cancellation.js +56 -0
- package/dist/eval/engine/cancellation.js.map +1 -0
- package/dist/eval/engine/delta.d.ts +104 -0
- package/dist/eval/engine/delta.d.ts.map +1 -0
- package/dist/eval/engine/delta.js +466 -0
- package/dist/eval/engine/delta.js.map +1 -0
- package/dist/eval/engine/deps.d.ts +136 -0
- package/dist/eval/engine/deps.d.ts.map +1 -0
- package/dist/eval/engine/deps.js +345 -0
- package/dist/eval/engine/deps.js.map +1 -0
- package/dist/eval/engine/identity.d.ts +128 -0
- package/dist/eval/engine/identity.d.ts.map +1 -0
- package/dist/eval/engine/identity.js +398 -0
- package/dist/eval/engine/identity.js.map +1 -0
- package/dist/eval/engine/index.d.ts +200 -0
- package/dist/eval/engine/index.d.ts.map +1 -0
- package/dist/eval/engine/index.js +1242 -0
- package/dist/eval/engine/index.js.map +1 -0
- package/dist/eval/engine/measurement.d.ts +23 -0
- package/dist/eval/engine/measurement.d.ts.map +1 -0
- package/dist/eval/engine/measurement.js +42 -0
- package/dist/eval/engine/measurement.js.map +1 -0
- package/dist/eval/engine/naive.d.ts +19 -0
- package/dist/eval/engine/naive.d.ts.map +1 -0
- package/dist/eval/engine/naive.js +59 -0
- package/dist/eval/engine/naive.js.map +1 -0
- package/dist/eval/engine/ops.d.ts +214 -0
- package/dist/eval/engine/ops.d.ts.map +1 -0
- package/dist/eval/engine/ops.js +1422 -0
- package/dist/eval/engine/ops.js.map +1 -0
- package/dist/eval/engine/patches.d.ts +40 -0
- package/dist/eval/engine/patches.d.ts.map +1 -0
- package/dist/eval/engine/patches.js +125 -0
- package/dist/eval/engine/patches.js.map +1 -0
- package/dist/eval/engine/ports.d.ts +71 -0
- package/dist/eval/engine/ports.d.ts.map +1 -0
- package/dist/eval/engine/ports.js +2 -0
- package/dist/eval/engine/ports.js.map +1 -0
- package/dist/eval/engine/session.d.ts +116 -0
- package/dist/eval/engine/session.d.ts.map +1 -0
- package/dist/eval/engine/session.js +653 -0
- package/dist/eval/engine/session.js.map +1 -0
- package/dist/eval/engine/snapshot.d.ts +97 -0
- package/dist/eval/engine/snapshot.d.ts.map +1 -0
- package/dist/eval/engine/snapshot.js +221 -0
- package/dist/eval/engine/snapshot.js.map +1 -0
- package/dist/eval/engine/subscriptions.d.ts +47 -0
- package/dist/eval/engine/subscriptions.d.ts.map +1 -0
- package/dist/eval/engine/subscriptions.js +103 -0
- package/dist/eval/engine/subscriptions.js.map +1 -0
- package/dist/eval/engine/trace.d.ts +77 -0
- package/dist/eval/engine/trace.d.ts.map +1 -0
- package/dist/eval/engine/trace.js +140 -0
- package/dist/eval/engine/trace.js.map +1 -0
- package/dist/eval/error-diagnostic.d.ts +26 -0
- package/dist/eval/error-diagnostic.d.ts.map +1 -0
- package/dist/eval/error-diagnostic.js +63 -0
- package/dist/eval/error-diagnostic.js.map +1 -0
- package/dist/eval/evaluate-expr.d.ts +44 -0
- package/dist/eval/evaluate-expr.d.ts.map +1 -0
- package/dist/eval/evaluate-expr.js +149 -0
- package/dist/eval/evaluate-expr.js.map +1 -0
- package/dist/eval/evaluate.d.ts +282 -0
- package/dist/eval/evaluate.d.ts.map +1 -0
- package/dist/eval/evaluate.js +391 -0
- package/dist/eval/evaluate.js.map +1 -0
- package/dist/eval/evolution/relocate.d.ts +72 -0
- package/dist/eval/evolution/relocate.d.ts.map +1 -0
- package/dist/eval/evolution/relocate.js +427 -0
- package/dist/eval/evolution/relocate.js.map +1 -0
- package/dist/eval/evolution/select.d.ts +11 -0
- package/dist/eval/evolution/select.d.ts.map +1 -0
- package/dist/eval/evolution/select.js +53 -0
- package/dist/eval/evolution/select.js.map +1 -0
- package/dist/eval/evolution/upcast.d.ts +13 -0
- package/dist/eval/evolution/upcast.d.ts.map +1 -0
- package/dist/eval/evolution/upcast.js +88 -0
- package/dist/eval/evolution/upcast.js.map +1 -0
- package/dist/eval/expr/aggregates.d.ts +75 -0
- package/dist/eval/expr/aggregates.d.ts.map +1 -0
- package/dist/eval/expr/aggregates.js +991 -0
- package/dist/eval/expr/aggregates.js.map +1 -0
- package/dist/eval/expr/arithmetic.d.ts +26 -0
- package/dist/eval/expr/arithmetic.d.ts.map +1 -0
- package/dist/eval/expr/arithmetic.js +387 -0
- package/dist/eval/expr/arithmetic.js.map +1 -0
- package/dist/eval/expr/between.d.ts +17 -0
- package/dist/eval/expr/between.d.ts.map +1 -0
- package/dist/eval/expr/between.js +46 -0
- package/dist/eval/expr/between.js.map +1 -0
- package/dist/eval/expr/binder.d.ts +96 -0
- package/dist/eval/expr/binder.d.ts.map +1 -0
- package/dist/eval/expr/binder.js +253 -0
- package/dist/eval/expr/binder.js.map +1 -0
- package/dist/eval/expr/call-dispatch.d.ts +28 -0
- package/dist/eval/expr/call-dispatch.d.ts.map +1 -0
- package/dist/eval/expr/call-dispatch.js +114 -0
- package/dist/eval/expr/call-dispatch.js.map +1 -0
- package/dist/eval/expr/collections.d.ts +20 -0
- package/dist/eval/expr/collections.d.ts.map +1 -0
- package/dist/eval/expr/collections.js +66 -0
- package/dist/eval/expr/collections.js.map +1 -0
- package/dist/eval/expr/compare.d.ts +36 -0
- package/dist/eval/expr/compare.d.ts.map +1 -0
- package/dist/eval/expr/compare.js +115 -0
- package/dist/eval/expr/compare.js.map +1 -0
- package/dist/eval/expr/datasets.d.ts +28 -0
- package/dist/eval/expr/datasets.d.ts.map +1 -0
- package/dist/eval/expr/datasets.js +304 -0
- package/dist/eval/expr/datasets.js.map +1 -0
- package/dist/eval/expr/digest.d.ts +23 -0
- package/dist/eval/expr/digest.d.ts.map +1 -0
- package/dist/eval/expr/digest.js +89 -0
- package/dist/eval/expr/digest.js.map +1 -0
- package/dist/eval/expr/domains.d.ts +19 -0
- package/dist/eval/expr/domains.d.ts.map +1 -0
- package/dist/eval/expr/domains.js +18 -0
- package/dist/eval/expr/domains.js.map +1 -0
- package/dist/eval/expr/host.d.ts +152 -0
- package/dist/eval/expr/host.d.ts.map +1 -0
- package/dist/eval/expr/host.js +36 -0
- package/dist/eval/expr/host.js.map +1 -0
- package/dist/eval/expr/lists.d.ts +24 -0
- package/dist/eval/expr/lists.d.ts.map +1 -0
- package/dist/eval/expr/lists.js +155 -0
- package/dist/eval/expr/lists.js.map +1 -0
- package/dist/eval/expr/member.d.ts +15 -0
- package/dist/eval/expr/member.d.ts.map +1 -0
- package/dist/eval/expr/member.js +32 -0
- package/dist/eval/expr/member.js.map +1 -0
- package/dist/eval/expr/money-ops.d.ts +10 -0
- package/dist/eval/expr/money-ops.d.ts.map +1 -0
- package/dist/eval/expr/money-ops.js +17 -0
- package/dist/eval/expr/money-ops.js.map +1 -0
- package/dist/eval/expr/operands.d.ts +27 -0
- package/dist/eval/expr/operands.d.ts.map +1 -0
- package/dist/eval/expr/operands.js +167 -0
- package/dist/eval/expr/operands.js.map +1 -0
- package/dist/eval/expr/presence.d.ts +27 -0
- package/dist/eval/expr/presence.d.ts.map +1 -0
- package/dist/eval/expr/presence.js +140 -0
- package/dist/eval/expr/presence.js.map +1 -0
- package/dist/eval/expr/records.d.ts +22 -0
- package/dist/eval/expr/records.d.ts.map +1 -0
- package/dist/eval/expr/records.js +101 -0
- package/dist/eval/expr/records.js.map +1 -0
- package/dist/eval/expr/rule-refs.d.ts +25 -0
- package/dist/eval/expr/rule-refs.d.ts.map +1 -0
- package/dist/eval/expr/rule-refs.js +60 -0
- package/dist/eval/expr/rule-refs.js.map +1 -0
- package/dist/eval/expr/sequences.d.ts +26 -0
- package/dist/eval/expr/sequences.d.ts.map +1 -0
- package/dist/eval/expr/sequences.js +151 -0
- package/dist/eval/expr/sequences.js.map +1 -0
- package/dist/eval/expr/value.d.ts +99 -0
- package/dist/eval/expr/value.d.ts.map +1 -0
- package/dist/eval/expr/value.js +14 -0
- package/dist/eval/expr/value.js.map +1 -0
- package/dist/eval/expression.d.ts +142 -0
- package/dist/eval/expression.d.ts.map +1 -0
- package/dist/eval/expression.js +446 -0
- package/dist/eval/expression.js.map +1 -0
- package/dist/eval/firing.d.ts +68 -0
- package/dist/eval/firing.d.ts.map +1 -0
- package/dist/eval/firing.js +222 -0
- package/dist/eval/firing.js.map +1 -0
- package/dist/eval/gate.d.ts +110 -0
- package/dist/eval/gate.d.ts.map +1 -0
- package/dist/eval/gate.js +278 -0
- package/dist/eval/gate.js.map +1 -0
- package/dist/eval/layout-visibility.d.ts +18 -0
- package/dist/eval/layout-visibility.d.ts.map +1 -0
- package/dist/eval/layout-visibility.js +61 -0
- package/dist/eval/layout-visibility.js.map +1 -0
- package/dist/eval/option-availability.d.ts +26 -0
- package/dist/eval/option-availability.d.ts.map +1 -0
- package/dist/eval/option-availability.js +580 -0
- package/dist/eval/option-availability.js.map +1 -0
- package/dist/eval/options-boundary.d.ts +15 -0
- package/dist/eval/options-boundary.d.ts.map +1 -0
- package/dist/eval/options-boundary.js +40 -0
- package/dist/eval/options-boundary.js.map +1 -0
- package/dist/eval/options.d.ts +99 -0
- package/dist/eval/options.d.ts.map +1 -0
- package/dist/eval/options.js +96 -0
- package/dist/eval/options.js.map +1 -0
- package/dist/eval/overrides.d.ts +116 -0
- package/dist/eval/overrides.d.ts.map +1 -0
- package/dist/eval/overrides.js +176 -0
- package/dist/eval/overrides.js.map +1 -0
- package/dist/eval/paths.d.ts +25 -0
- package/dist/eval/paths.d.ts.map +1 -0
- package/dist/eval/paths.js +47 -0
- package/dist/eval/paths.js.map +1 -0
- package/dist/eval/presentation-reads.d.ts +20 -0
- package/dist/eval/presentation-reads.d.ts.map +1 -0
- package/dist/eval/presentation-reads.js +2 -0
- package/dist/eval/presentation-reads.js.map +1 -0
- package/dist/eval/presentation.d.ts +122 -0
- package/dist/eval/presentation.d.ts.map +1 -0
- package/dist/eval/presentation.js +255 -0
- package/dist/eval/presentation.js.map +1 -0
- package/dist/eval/reader/context-value.d.ts +41 -0
- package/dist/eval/reader/context-value.d.ts.map +1 -0
- package/dist/eval/reader/context-value.js +129 -0
- package/dist/eval/reader/context-value.js.map +1 -0
- package/dist/eval/reader/covered.d.ts +53 -0
- package/dist/eval/reader/covered.d.ts.map +1 -0
- package/dist/eval/reader/covered.js +139 -0
- package/dist/eval/reader/covered.js.map +1 -0
- package/dist/eval/reader/declarations.d.ts +182 -0
- package/dist/eval/reader/declarations.d.ts.map +1 -0
- package/dist/eval/reader/declarations.js +153 -0
- package/dist/eval/reader/declarations.js.map +1 -0
- package/dist/eval/reader/member-access.d.ts +87 -0
- package/dist/eval/reader/member-access.d.ts.map +1 -0
- package/dist/eval/reader/member-access.js +212 -0
- package/dist/eval/reader/member-access.js.map +1 -0
- package/dist/eval/reader/memo.d.ts +34 -0
- package/dist/eval/reader/memo.d.ts.map +1 -0
- package/dist/eval/reader/memo.js +67 -0
- package/dist/eval/reader/memo.js.map +1 -0
- package/dist/eval/reader/overlay.d.ts +74 -0
- package/dist/eval/reader/overlay.d.ts.map +1 -0
- package/dist/eval/reader/overlay.js +365 -0
- package/dist/eval/reader/overlay.js.map +1 -0
- package/dist/eval/reader/questions.d.ts +37 -0
- package/dist/eval/reader/questions.d.ts.map +1 -0
- package/dist/eval/reader/questions.js +78 -0
- package/dist/eval/reader/questions.js.map +1 -0
- package/dist/eval/reader/resolve.d.ts +84 -0
- package/dist/eval/reader/resolve.d.ts.map +1 -0
- package/dist/eval/reader/resolve.js +310 -0
- package/dist/eval/reader/resolve.js.map +1 -0
- package/dist/eval/reader/value-read.d.ts +50 -0
- package/dist/eval/reader/value-read.d.ts.map +1 -0
- package/dist/eval/reader/value-read.js +133 -0
- package/dist/eval/reader/value-read.js.map +1 -0
- package/dist/eval/reader/withheld.d.ts +48 -0
- package/dist/eval/reader/withheld.d.ts.map +1 -0
- package/dist/eval/reader/withheld.js +108 -0
- package/dist/eval/reader/withheld.js.map +1 -0
- package/dist/eval/reader-paths.d.ts +24 -0
- package/dist/eval/reader-paths.d.ts.map +1 -0
- package/dist/eval/reader-paths.js +23 -0
- package/dist/eval/reader-paths.js.map +1 -0
- package/dist/eval/reader.d.ts +281 -0
- package/dist/eval/reader.d.ts.map +1 -0
- package/dist/eval/reader.js +560 -0
- package/dist/eval/reader.js.map +1 -0
- package/dist/eval/receipt.d.ts +37 -0
- package/dist/eval/receipt.d.ts.map +1 -0
- package/dist/eval/receipt.js +222 -0
- package/dist/eval/receipt.js.map +1 -0
- package/dist/eval/report/assemble.d.ts +84 -0
- package/dist/eval/report/assemble.d.ts.map +1 -0
- package/dist/eval/report/assemble.js +277 -0
- package/dist/eval/report/assemble.js.map +1 -0
- package/dist/eval/report/fold.d.ts +18 -0
- package/dist/eval/report/fold.d.ts.map +1 -0
- package/dist/eval/report/fold.js +58 -0
- package/dist/eval/report/fold.js.map +1 -0
- package/dist/eval/rule/alternatives.d.ts +23 -0
- package/dist/eval/rule/alternatives.d.ts.map +1 -0
- package/dist/eval/rule/alternatives.js +46 -0
- package/dist/eval/rule/alternatives.js.map +1 -0
- package/dist/eval/rule/behaviour.d.ts +47 -0
- package/dist/eval/rule/behaviour.d.ts.map +1 -0
- package/dist/eval/rule/behaviour.js +249 -0
- package/dist/eval/rule/behaviour.js.map +1 -0
- package/dist/eval/rule/compute.d.ts +46 -0
- package/dist/eval/rule/compute.d.ts.map +1 -0
- package/dist/eval/rule/compute.js +158 -0
- package/dist/eval/rule/compute.js.map +1 -0
- package/dist/eval/rule/create-state.d.ts +42 -0
- package/dist/eval/rule/create-state.d.ts.map +1 -0
- package/dist/eval/rule/create-state.js +134 -0
- package/dist/eval/rule/create-state.js.map +1 -0
- package/dist/eval/rule/diagnostics.d.ts +24 -0
- package/dist/eval/rule/diagnostics.d.ts.map +1 -0
- package/dist/eval/rule/diagnostics.js +45 -0
- package/dist/eval/rule/diagnostics.js.map +1 -0
- package/dist/eval/rule/execution.d.ts +24 -0
- package/dist/eval/rule/execution.d.ts.map +1 -0
- package/dist/eval/rule/execution.js +495 -0
- package/dist/eval/rule/execution.js.map +1 -0
- package/dist/eval/rule/gate.d.ts +12 -0
- package/dist/eval/rule/gate.d.ts.map +1 -0
- package/dist/eval/rule/gate.js +34 -0
- package/dist/eval/rule/gate.js.map +1 -0
- package/dist/eval/rule/item.d.ts +11 -0
- package/dist/eval/rule/item.d.ts.map +1 -0
- package/dist/eval/rule/item.js +265 -0
- package/dist/eval/rule/item.js.map +1 -0
- package/dist/eval/rule/prepare.d.ts +64 -0
- package/dist/eval/rule/prepare.d.ts.map +1 -0
- package/dist/eval/rule/prepare.js +131 -0
- package/dist/eval/rule/prepare.js.map +1 -0
- package/dist/eval/rule/result.d.ts +97 -0
- package/dist/eval/rule/result.d.ts.map +1 -0
- package/dist/eval/rule/result.js +347 -0
- package/dist/eval/rule/result.js.map +1 -0
- package/dist/eval/rule/runner.d.ts +128 -0
- package/dist/eval/rule/runner.d.ts.map +1 -0
- package/dist/eval/rule/runner.js +296 -0
- package/dist/eval/rule/runner.js.map +1 -0
- package/dist/eval/rule/screen.d.ts +32 -0
- package/dist/eval/rule/screen.d.ts.map +1 -0
- package/dist/eval/rule/screen.js +73 -0
- package/dist/eval/rule/screen.js.map +1 -0
- package/dist/eval/rule/state.d.ts +137 -0
- package/dist/eval/rule/state.d.ts.map +1 -0
- package/dist/eval/rule/state.js +2 -0
- package/dist/eval/rule/state.js.map +1 -0
- package/dist/eval/rule/steps.d.ts +44 -0
- package/dist/eval/rule/steps.d.ts.map +1 -0
- package/dist/eval/rule/steps.js +367 -0
- package/dist/eval/rule/steps.js.map +1 -0
- package/dist/eval/rule/visibility.d.ts +18 -0
- package/dist/eval/rule/visibility.d.ts.map +1 -0
- package/dist/eval/rule/visibility.js +79 -0
- package/dist/eval/rule/visibility.js.map +1 -0
- package/dist/eval/seal.d.ts +74 -0
- package/dist/eval/seal.d.ts.map +1 -0
- package/dist/eval/seal.js +154 -0
- package/dist/eval/seal.js.map +1 -0
- package/dist/eval/signature-coverage.d.ts +19 -0
- package/dist/eval/signature-coverage.d.ts.map +1 -0
- package/dist/eval/signature-coverage.js +160 -0
- package/dist/eval/signature-coverage.js.map +1 -0
- package/dist/eval/state/derive.d.ts +72 -0
- package/dist/eval/state/derive.d.ts.map +1 -0
- package/dist/eval/state/derive.js +61 -0
- package/dist/eval/state/derive.js.map +1 -0
- package/dist/eval/state/describe.d.ts +18 -0
- package/dist/eval/state/describe.d.ts.map +1 -0
- package/dist/eval/state/describe.js +19 -0
- package/dist/eval/state/describe.js.map +1 -0
- package/dist/eval/state/field-state.d.ts +471 -0
- package/dist/eval/state/field-state.d.ts.map +1 -0
- package/dist/eval/state/field-state.js +1604 -0
- package/dist/eval/state/field-state.js.map +1 -0
- package/dist/eval/state/measurement.d.ts +136 -0
- package/dist/eval/state/measurement.d.ts.map +1 -0
- package/dist/eval/state/measurement.js +209 -0
- package/dist/eval/state/measurement.js.map +1 -0
- package/dist/eval/state/options.d.ts +21 -0
- package/dist/eval/state/options.d.ts.map +1 -0
- package/dist/eval/state/options.js +3 -0
- package/dist/eval/state/options.js.map +1 -0
- package/dist/eval/state/readiness.d.ts +400 -0
- package/dist/eval/state/readiness.d.ts.map +1 -0
- package/dist/eval/state/readiness.js +1067 -0
- package/dist/eval/state/readiness.js.map +1 -0
- package/dist/eval/state/snapshot.d.ts +130 -0
- package/dist/eval/state/snapshot.d.ts.map +1 -0
- package/dist/eval/state/snapshot.js +35 -0
- package/dist/eval/state/snapshot.js.map +1 -0
- package/dist/eval/state/unavailable-options.d.ts +54 -0
- package/dist/eval/state/unavailable-options.d.ts.map +1 -0
- package/dist/eval/state/unavailable-options.js +82 -0
- package/dist/eval/state/unavailable-options.js.map +1 -0
- package/dist/eval/state/value-state.d.ts +38 -0
- package/dist/eval/state/value-state.d.ts.map +1 -0
- package/dist/eval/state/value-state.js +52 -0
- package/dist/eval/state/value-state.js.map +1 -0
- package/dist/eval/submission/admission.d.ts +50 -0
- package/dist/eval/submission/admission.d.ts.map +1 -0
- package/dist/eval/submission/admission.js +174 -0
- package/dist/eval/submission/admission.js.map +1 -0
- package/dist/eval/submission/authority.d.ts +71 -0
- package/dist/eval/submission/authority.d.ts.map +1 -0
- package/dist/eval/submission/authority.js +118 -0
- package/dist/eval/submission/authority.js.map +1 -0
- package/dist/eval/submission/datasets.d.ts +28 -0
- package/dist/eval/submission/datasets.d.ts.map +1 -0
- package/dist/eval/submission/datasets.js +109 -0
- package/dist/eval/submission/datasets.js.map +1 -0
- package/dist/eval/submission/index.d.ts +15 -0
- package/dist/eval/submission/index.d.ts.map +1 -0
- package/dist/eval/submission/index.js +13 -0
- package/dist/eval/submission/index.js.map +1 -0
- package/dist/eval/submission/refusals.d.ts +103 -0
- package/dist/eval/submission/refusals.d.ts.map +1 -0
- package/dist/eval/submission/refusals.js +15 -0
- package/dist/eval/submission/refusals.js.map +1 -0
- package/dist/eval/submission/signatures.d.ts +7 -0
- package/dist/eval/submission/signatures.d.ts.map +1 -0
- package/dist/eval/submission/signatures.js +215 -0
- package/dist/eval/submission/signatures.js.map +1 -0
- package/dist/eval/submission/writes.d.ts +51 -0
- package/dist/eval/submission/writes.d.ts.map +1 -0
- package/dist/eval/submission/writes.js +203 -0
- package/dist/eval/submission/writes.js.map +1 -0
- package/dist/eval/submission.d.ts +53 -0
- package/dist/eval/submission.d.ts.map +1 -0
- package/dist/eval/submission.js +521 -0
- package/dist/eval/submission.js.map +1 -0
- package/dist/eval/suggestions-to-engine.d.ts +18 -0
- package/dist/eval/suggestions-to-engine.d.ts.map +1 -0
- package/dist/eval/suggestions-to-engine.js +40 -0
- package/dist/eval/suggestions-to-engine.js.map +1 -0
- package/dist/eval/suggestions.d.ts +17 -0
- package/dist/eval/suggestions.d.ts.map +1 -0
- package/dist/eval/suggestions.js +314 -0
- package/dist/eval/suggestions.js.map +1 -0
- package/dist/eval/undecided.d.ts +64 -0
- package/dist/eval/undecided.d.ts.map +1 -0
- package/dist/eval/undecided.js +101 -0
- package/dist/eval/undecided.js.map +1 -0
- package/dist/eval/verdict.d.ts +66 -0
- package/dist/eval/verdict.d.ts.map +1 -0
- package/dist/eval/verdict.js +106 -0
- package/dist/eval/verdict.js.map +1 -0
- package/dist/eval/verify-signature.d.ts +78 -0
- package/dist/eval/verify-signature.d.ts.map +1 -0
- package/dist/eval/verify-signature.js +185 -0
- package/dist/eval/verify-signature.js.map +1 -0
- package/dist/eval/version-dispatch.d.ts +38 -0
- package/dist/eval/version-dispatch.d.ts.map +1 -0
- package/dist/eval/version-dispatch.js +61 -0
- package/dist/eval/version-dispatch.js.map +1 -0
- package/dist/eval/visibility.d.ts +33 -0
- package/dist/eval/visibility.d.ts.map +1 -0
- package/dist/eval/visibility.js +83 -0
- package/dist/eval/visibility.js.map +1 -0
- package/dist/evaluate.d.ts +24 -0
- package/dist/evaluate.d.ts.map +1 -0
- package/dist/evaluate.js +18 -0
- package/dist/evaluate.js.map +1 -0
- package/dist/expr/builtin-docs.d.ts +51 -0
- package/dist/expr/builtin-docs.d.ts.map +1 -0
- package/dist/expr/builtin-docs.js +874 -0
- package/dist/expr/builtin-docs.js.map +1 -0
- package/dist/expr/builtins.d.ts +50 -0
- package/dist/expr/builtins.d.ts.map +1 -0
- package/dist/expr/builtins.js +966 -0
- package/dist/expr/builtins.js.map +1 -0
- package/dist/expr/decimal-precision.d.ts +39 -0
- package/dist/expr/decimal-precision.d.ts.map +1 -0
- package/dist/expr/decimal-precision.js +62 -0
- package/dist/expr/decimal-precision.js.map +1 -0
- package/dist/expr/decimal.d.ts +172 -0
- package/dist/expr/decimal.d.ts.map +1 -0
- package/dist/expr/decimal.js +782 -0
- package/dist/expr/decimal.js.map +1 -0
- package/dist/expr/deprecations.d.ts +34 -0
- package/dist/expr/deprecations.d.ts.map +1 -0
- package/dist/expr/deprecations.js +17 -0
- package/dist/expr/deprecations.js.map +1 -0
- package/dist/expr/diagnostics.d.ts +21 -0
- package/dist/expr/diagnostics.d.ts.map +1 -0
- package/dist/expr/diagnostics.js +231 -0
- package/dist/expr/diagnostics.js.map +1 -0
- package/dist/expr/direction.d.ts +30 -0
- package/dist/expr/direction.d.ts.map +1 -0
- package/dist/expr/direction.js +77 -0
- package/dist/expr/direction.js.map +1 -0
- package/dist/expr/example-expression.d.ts +62 -0
- package/dist/expr/example-expression.d.ts.map +1 -0
- package/dist/expr/example-expression.js +670 -0
- package/dist/expr/example-expression.js.map +1 -0
- package/dist/expr/instant.d.ts +49 -0
- package/dist/expr/instant.d.ts.map +1 -0
- package/dist/expr/instant.js +111 -0
- package/dist/expr/instant.js.map +1 -0
- package/dist/expr/logic.d.ts +17 -0
- package/dist/expr/logic.d.ts.map +1 -0
- package/dist/expr/logic.js +65 -0
- package/dist/expr/logic.js.map +1 -0
- package/dist/expr/messages.d.ts +45 -0
- package/dist/expr/messages.d.ts.map +1 -0
- package/dist/expr/messages.js +280 -0
- package/dist/expr/messages.js.map +1 -0
- package/dist/expr/money.d.ts +38 -0
- package/dist/expr/money.d.ts.map +1 -0
- package/dist/expr/money.js +127 -0
- package/dist/expr/money.js.map +1 -0
- package/dist/expr/ordering.d.ts +56 -0
- package/dist/expr/ordering.d.ts.map +1 -0
- package/dist/expr/ordering.js +167 -0
- package/dist/expr/ordering.js.map +1 -0
- package/dist/expr/pattern.d.ts +44 -0
- package/dist/expr/pattern.d.ts.map +1 -0
- package/dist/expr/pattern.js +458 -0
- package/dist/expr/pattern.js.map +1 -0
- package/dist/expr/plain-date.d.ts +90 -0
- package/dist/expr/plain-date.d.ts.map +1 -0
- package/dist/expr/plain-date.js +230 -0
- package/dist/expr/plain-date.js.map +1 -0
- package/dist/expr/plural-categories.d.ts +8 -0
- package/dist/expr/plural-categories.d.ts.map +1 -0
- package/dist/expr/plural-categories.js +15 -0
- package/dist/expr/plural-categories.js.map +1 -0
- package/dist/expr/plural-keys.d.ts +39 -0
- package/dist/expr/plural-keys.d.ts.map +1 -0
- package/dist/expr/plural-keys.js +46 -0
- package/dist/expr/plural-keys.js.map +1 -0
- package/dist/expr/plural.d.ts +33 -0
- package/dist/expr/plural.d.ts.map +1 -0
- package/dist/expr/plural.js +50 -0
- package/dist/expr/plural.js.map +1 -0
- package/dist/expr/quantity.d.ts +31 -0
- package/dist/expr/quantity.d.ts.map +1 -0
- package/dist/expr/quantity.js +83 -0
- package/dist/expr/quantity.js.map +1 -0
- package/dist/expr/reduce.d.ts +50 -0
- package/dist/expr/reduce.d.ts.map +1 -0
- package/dist/expr/reduce.js +236 -0
- package/dist/expr/reduce.js.map +1 -0
- package/dist/expr/regex.d.ts +108 -0
- package/dist/expr/regex.d.ts.map +1 -0
- package/dist/expr/regex.js +1207 -0
- package/dist/expr/regex.js.map +1 -0
- package/dist/expr/select-locale.d.ts +67 -0
- package/dist/expr/select-locale.d.ts.map +1 -0
- package/dist/expr/select-locale.js +219 -0
- package/dist/expr/select-locale.js.map +1 -0
- package/dist/expr/sequences.d.ts +123 -0
- package/dist/expr/sequences.d.ts.map +1 -0
- package/dist/expr/sequences.js +234 -0
- package/dist/expr/sequences.js.map +1 -0
- package/dist/expr/strings.d.ts +50 -0
- package/dist/expr/strings.d.ts.map +1 -0
- package/dist/expr/strings.js +184 -0
- package/dist/expr/strings.js.map +1 -0
- package/dist/expr/validation.d.ts +32 -0
- package/dist/expr/validation.d.ts.map +1 -0
- package/dist/expr/validation.js +182 -0
- package/dist/expr/validation.js.map +1 -0
- package/dist/graph/freeze.d.ts +4 -0
- package/dist/graph/freeze.d.ts.map +1 -0
- package/dist/graph/freeze.js +52 -0
- package/dist/graph/freeze.js.map +1 -0
- package/dist/graph/index.d.ts +15 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/inspect.d.ts +76 -0
- package/dist/graph/inspect.d.ts.map +1 -0
- package/dist/graph/inspect.js +263 -0
- package/dist/graph/inspect.js.map +1 -0
- package/dist/graph/read-walk.d.ts +101 -0
- package/dist/graph/read-walk.d.ts.map +1 -0
- package/dist/graph/read-walk.js +358 -0
- package/dist/graph/read-walk.js.map +1 -0
- package/dist/graph/record-index.d.ts +24 -0
- package/dist/graph/record-index.d.ts.map +1 -0
- package/dist/graph/record-index.js +35 -0
- package/dist/graph/record-index.js.map +1 -0
- package/dist/index.d.ts +104 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/lookup/digest.d.ts +51 -0
- package/dist/lookup/digest.d.ts.map +1 -0
- package/dist/lookup/digest.js +46 -0
- package/dist/lookup/digest.js.map +1 -0
- package/dist/lookup/index.d.ts +28 -0
- package/dist/lookup/index.d.ts.map +1 -0
- package/dist/lookup/index.js +27 -0
- package/dist/lookup/index.js.map +1 -0
- package/dist/lookup/install.d.ts +48 -0
- package/dist/lookup/install.d.ts.map +1 -0
- package/dist/lookup/install.js +315 -0
- package/dist/lookup/install.js.map +1 -0
- package/dist/lookup/pass.d.ts +55 -0
- package/dist/lookup/pass.d.ts.map +1 -0
- package/dist/lookup/pass.js +212 -0
- package/dist/lookup/pass.js.map +1 -0
- package/dist/lookup/pins.d.ts +34 -0
- package/dist/lookup/pins.d.ts.map +1 -0
- package/dist/lookup/pins.js +39 -0
- package/dist/lookup/pins.js.map +1 -0
- package/dist/lookup/provenance.d.ts +23 -0
- package/dist/lookup/provenance.d.ts.map +1 -0
- package/dist/lookup/provenance.js +78 -0
- package/dist/lookup/provenance.js.map +1 -0
- package/dist/lookup/readiness.d.ts +13 -0
- package/dist/lookup/readiness.d.ts.map +1 -0
- package/dist/lookup/readiness.js +57 -0
- package/dist/lookup/readiness.js.map +1 -0
- package/dist/lookup/resolve.d.ts +24 -0
- package/dist/lookup/resolve.d.ts.map +1 -0
- package/dist/lookup/resolve.js +201 -0
- package/dist/lookup/resolve.js.map +1 -0
- package/dist/lookup/store.d.ts +41 -0
- package/dist/lookup/store.d.ts.map +1 -0
- package/dist/lookup/store.js +74 -0
- package/dist/lookup/store.js.map +1 -0
- package/dist/model/access.d.ts +200 -0
- package/dist/model/access.d.ts.map +1 -0
- package/dist/model/access.js +125 -0
- package/dist/model/access.js.map +1 -0
- package/dist/model/artifact-members.d.ts +3 -0
- package/dist/model/artifact-members.d.ts.map +1 -0
- package/dist/model/artifact-members.js +38 -0
- package/dist/model/artifact-members.js.map +1 -0
- package/dist/model/composition.d.ts +47 -0
- package/dist/model/composition.d.ts.map +1 -0
- package/dist/model/composition.js +66 -0
- package/dist/model/composition.js.map +1 -0
- package/dist/model/domain.d.ts +51 -0
- package/dist/model/domain.d.ts.map +1 -0
- package/dist/model/domain.js +75 -0
- package/dist/model/domain.js.map +1 -0
- package/dist/model/duration.d.ts +31 -0
- package/dist/model/duration.d.ts.map +1 -0
- package/dist/model/duration.js +136 -0
- package/dist/model/duration.js.map +1 -0
- package/dist/model/errors.d.ts +58 -0
- package/dist/model/errors.d.ts.map +1 -0
- package/dist/model/errors.js +81 -0
- package/dist/model/errors.js.map +1 -0
- package/dist/model/evolution.d.ts +177 -0
- package/dist/model/evolution.d.ts.map +1 -0
- package/dist/model/evolution.js +5 -0
- package/dist/model/evolution.js.map +1 -0
- package/dist/model/expr-children.d.ts +15 -0
- package/dist/model/expr-children.d.ts.map +1 -0
- package/dist/model/expr-children.js +45 -0
- package/dist/model/expr-children.js.map +1 -0
- package/dist/model/guards.d.ts +9 -0
- package/dist/model/guards.d.ts.map +1 -0
- package/dist/model/guards.js +11 -0
- package/dist/model/guards.js.map +1 -0
- package/dist/model/input.d.ts +42 -0
- package/dist/model/input.d.ts.map +1 -0
- package/dist/model/input.js +26 -0
- package/dist/model/input.js.map +1 -0
- package/dist/model/integer.d.ts +14 -0
- package/dist/model/integer.d.ts.map +1 -0
- package/dist/model/integer.js +16 -0
- package/dist/model/integer.js.map +1 -0
- package/dist/model/intrinsic.d.ts +18 -0
- package/dist/model/intrinsic.d.ts.map +1 -0
- package/dist/model/intrinsic.js +21 -0
- package/dist/model/intrinsic.js.map +1 -0
- package/dist/model/layout.d.ts +129 -0
- package/dist/model/layout.d.ts.map +1 -0
- package/dist/model/layout.js +2 -0
- package/dist/model/layout.js.map +1 -0
- package/dist/model/media.d.ts +33 -0
- package/dist/model/media.d.ts.map +1 -0
- package/dist/model/media.js +86 -0
- package/dist/model/media.js.map +1 -0
- package/dist/model/members.generated.d.ts +11 -0
- package/dist/model/members.generated.d.ts.map +1 -0
- package/dist/model/members.generated.js +71 -0
- package/dist/model/members.generated.js.map +1 -0
- package/dist/model/row-address.d.ts +27 -0
- package/dist/model/row-address.d.ts.map +1 -0
- package/dist/model/row-address.js +146 -0
- package/dist/model/row-address.js.map +1 -0
- package/dist/model/schema.d.ts +108 -0
- package/dist/model/schema.d.ts.map +1 -0
- package/dist/model/schema.js +2 -0
- package/dist/model/schema.js.map +1 -0
- package/dist/model/shape.d.ts +193 -0
- package/dist/model/shape.d.ts.map +1 -0
- package/dist/model/shape.js +2 -0
- package/dist/model/shape.js.map +1 -0
- package/dist/model/time.d.ts +61 -0
- package/dist/model/time.d.ts.map +1 -0
- package/dist/model/time.js +110 -0
- package/dist/model/time.js.map +1 -0
- package/dist/model/types.d.ts +1329 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +424 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/values.d.ts +91 -0
- package/dist/model/values.d.ts.map +1 -0
- package/dist/model/values.js +195 -0
- package/dist/model/values.js.map +1 -0
- package/dist/model/wire.d.ts +356 -0
- package/dist/model/wire.d.ts.map +1 -0
- package/dist/model/wire.js +1504 -0
- package/dist/model/wire.js.map +1 -0
- package/dist/offline/index.d.ts +374 -0
- package/dist/offline/index.d.ts.map +1 -0
- package/dist/offline/index.js +422 -0
- package/dist/offline/index.js.map +1 -0
- package/dist/testing.d.ts +30 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +42 -0
- package/dist/testing.js.map +1 -0
- package/dist/version.d.ts +30 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +116 -0
- package/dist/version.js.map +1 -0
- package/package.json +98 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantity.js","sourceRoot":"","sources":["../../src/expr/quantity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAWtB;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,KAAc,EAAE,IAAY,EAAE,WAA0B;IAC5E,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,4BAA4B,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,YAAY,EAAE,CAAC;QACrE,MAAM,I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;AACrD,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,EAAE,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,cAAc,CAAC,QAAsB,EAAE,IAAI,GAAG,EAAE;IAC9D,OAAO,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC;AAC/C,CAAC","sourcesContent":["import { AxiomError } from '../model/errors.js';\nimport { isRecord } from '../model/guards.js';\nimport type { DecimalString } from '../model/types.js';\nimport { UNIT_CODE_PATTERN } from '../model/types.js';\nimport {\n asDecimalString,\n asWireDecimalString,\n compareDecimalTexts,\n subtractDecimalTexts,\n sumDecimalTexts,\n} from './decimal.js';\n\n/** A measured quantity: canonical decimal text and the unit it is measured in, `MODEL-2.1.21`. */\nexport interface QuantityLike {\n readonly value: DecimalString;\n readonly unit: string;\n}\n\n/** The one decimal reader a quantity shape uses, so the authoring and wire doors differ only there. */\ntype DecimalReader = (text: string, path: string) => DecimalString;\n\n/**\n * The quantity shape, read once for both doors.\n *\n * The member set, the unit code and the canonical-decimal rule are one implementation: the\n * engine's reader reaches it with the authoring decimal constructor and the wire reader with the\n * value-free one, so the two cannot disagree about a shape while only one of them echoes a\n * submitted value.\n */\nfunction readQuantity(value: unknown, path: string, readDecimal: DecimalReader): QuantityLike {\n if (!isRecord(value)) {\n throw new AxiomError('ENGINE_ERROR', 'quantity must be an object', path);\n }\n const memberKeys = Object.keys(value).sort();\n if (memberKeys.length !== 2 || memberKeys.join(',') !== 'unit,value') {\n throw new AxiomError('ENGINE_ERROR', 'quantity must declare exactly value and unit', path);\n }\n const amount = value['value'];\n const unit = value['unit'];\n if (typeof amount !== 'string') {\n throw new AxiomError('ENGINE_ERROR', 'quantity value must be canonical decimal text', path);\n }\n if (typeof unit !== 'string' || !UNIT_CODE_PATTERN.test(unit)) {\n throw new AxiomError('ENGINE_ERROR', 'quantity unit must be a lower-case unit code', path);\n }\n return { value: readDecimal(amount, path), unit };\n}\n\n/**\n * Reads a quantity value from a value the engine produced.\n *\n * The wire reader has already checked a captured value against its declaration; this reads the\n * shape and the canonical spelling, so an operation on two quantities never compares a float or\n * a spelling that is not canonical. It does not enforce a field's scale: a computed quantity is\n * exact, and `round(q.value, …)` is the author's explicit reduction.\n */\nexport function toQuantityValue(value: unknown, path = ''): QuantityLike {\n return readQuantity(value, path, asDecimalString);\n}\n\n/**\n * Reads a quantity value from untrusted input, with the value-free refusal `asWireDecimalString`\n * gives. The shape rules are `readQuantity`'s, so the wire check is not a second implementation.\n */\nexport function toWireQuantityValue(value: unknown, path: string): QuantityLike {\n return readQuantity(value, path, asWireDecimalString);\n}\n\nfunction assertSameUnit(left: QuantityLike, right: QuantityLike, path: string): void {\n if (left.unit !== right.unit) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `quantity operands differ in unit: ${left.unit} and ${right.unit}; v1 defines no unit conversion`,\n path,\n );\n }\n}\n\n/** The exact sum of two quantities of one unit. */\nexport function quantityAdd(left: QuantityLike, right: QuantityLike, path = ''): QuantityLike {\n const a = toQuantityValue(left, path);\n const b = toQuantityValue(right, path);\n assertSameUnit(a, b, path);\n return { value: sumDecimalTexts([a.value, b.value], path), unit: a.unit };\n}\n\n/** The exact difference of two quantities of one unit. */\nexport function quantitySub(left: QuantityLike, right: QuantityLike, path = ''): QuantityLike {\n const a = toQuantityValue(left, path);\n const b = toQuantityValue(right, path);\n assertSameUnit(a, b, path);\n return { value: subtractDecimalTexts(a.value, b.value, path), unit: a.unit };\n}\n\n/** The order of two quantities of one unit; a mixed pair is refused rather than compared. */\nexport function compareQuantities(left: unknown, right: unknown, path = ''): number {\n const a = toQuantityValue(left, path);\n const b = toQuantityValue(right, path);\n assertSameUnit(a, b, path);\n return compareDecimalTexts(a.value, b.value, path);\n}\n\n/** The zero of one unit, for `sum` over a single-unit quantity list. */\nexport function quantityZero(unit: string): QuantityLike {\n return { value: asDecimalString('0'), unit };\n}\n\n/** The amount as canonical decimal text: `q.value` is the decimal and this is the same read. */\nexport function quantityAmount(quantity: QuantityLike, path = ''): DecimalString {\n return toQuantityValue(quantity, path).value;\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { LiteralDomain } from '../model/types.js';
|
|
2
|
+
import type { RuntimeValue } from './builtins.js';
|
|
3
|
+
/** `avg(xs)`: the exact mean, or `UNKNOWN` when no finite decimal spells it. */
|
|
4
|
+
export declare function averageValue(values: readonly RuntimeValue[], path?: string): RuntimeValue;
|
|
5
|
+
/** `median(xs)`: the middle of the canonical decimal order, an exact midpoint for an even count. */
|
|
6
|
+
export declare function medianValue(values: readonly RuntimeValue[], path?: string): RuntimeValue;
|
|
7
|
+
/** `first(xs)`: the first element, or `null` for an empty list (`EXPR-10.1.2`). */
|
|
8
|
+
export declare function firstValue(values: readonly RuntimeValue[]): RuntimeValue;
|
|
9
|
+
/** `last(xs)`: the last element under `EXPR-10.2.10`, or `null` for an empty list. */
|
|
10
|
+
export declare function lastValue(values: readonly RuntimeValue[]): RuntimeValue;
|
|
11
|
+
/**
|
|
12
|
+
* `last(xs)` when the elements may carry the sentinels, `EXPR-10.2.10`.
|
|
13
|
+
*
|
|
14
|
+
* `last` reads every element, because an undetermined element could be the last: an `UNKNOWN`
|
|
15
|
+
* anywhere makes the answer `UNKNOWN` (it beats `DEFERRED`), and `null` is a decided value —
|
|
16
|
+
* the empty value of every domain — so `last([1, null])` is `null` rather than a sentinel.
|
|
17
|
+
* The compiled evaluator already folds this way; the value-only door reaches the same fold
|
|
18
|
+
* here instead of returning an element it cannot prove is last.
|
|
19
|
+
*/
|
|
20
|
+
export declare function lastDecided(values: readonly RuntimeValue[]): RuntimeValue;
|
|
21
|
+
/**
|
|
22
|
+
* `join(xs, separator)` over elements that may carry the sentinels.
|
|
23
|
+
*
|
|
24
|
+
* A `null` element is the same "no reading" a `null` operand is everywhere else, so it
|
|
25
|
+
* lifts to `UNKNOWN`; an `UNKNOWN` element beats a `DEFERRED` one and no partial string is
|
|
26
|
+
* returned. A non-text element is still a value-stated refusal, because the list's declared
|
|
27
|
+
* element type is text and the store produced something else.
|
|
28
|
+
*/
|
|
29
|
+
export declare function joinDecided(values: readonly RuntimeValue[], separator: string, path?: string): RuntimeValue;
|
|
30
|
+
/**
|
|
31
|
+
* `mode(xs)`: the most frequent value, with ties broken by the smallest value under the
|
|
32
|
+
* canonical order, `EXPR-10.2.13`.
|
|
33
|
+
*
|
|
34
|
+
* Grouping uses the equality rule the rest of the language uses: two numeric values of the
|
|
35
|
+
* same domain are one class whatever their spelling, and a text value is its own class. The
|
|
36
|
+
* token therefore keeps the declared domain, so `"1"` in a `list<string>` is not the number
|
|
37
|
+
* `1`. The tie-break order is the canonical order the domain already has — exact decimal
|
|
38
|
+
* comparison for numerics, code-point comparison for text, and `false` before `true` for
|
|
39
|
+
* booleans — so the answer is deterministic and does not depend on the order the classes were
|
|
40
|
+
* first seen in.
|
|
41
|
+
*
|
|
42
|
+
* `domain` is the fold's agreed domain (`integer`/`decimal` widen to `decimal`), so a mixed
|
|
43
|
+
* numeric list renders its winner as canonical decimal text rather than leaving the JSON
|
|
44
|
+
* number an integer element arrived as.
|
|
45
|
+
*
|
|
46
|
+
* An empty list is the empty value `null`, like `first`/`last`; `mode` returns an element, not
|
|
47
|
+
* a derived number, so it needs no `UNKNOWN` case of its own.
|
|
48
|
+
*/
|
|
49
|
+
export declare function modeValue(values: readonly RuntimeValue[], domain: LiteralDomain | undefined, path?: string): RuntimeValue;
|
|
50
|
+
//# sourceMappingURL=reduce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduce.d.ts","sourceRoot":"","sources":["../../src/expr/reduce.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAGpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA0DlD,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,IAAI,SAAK,GAAG,YAAY,CAIrF;AAED,oGAAoG;AACpG,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,IAAI,SAAK,GAAG,YAAY,CAIpF;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,CAExE;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,CAEvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,CASzE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,SAAS,EAAE,MAAM,EACjB,IAAI,SAAK,GACR,YAAY,CAiBd;AAuBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,IAAI,SAAK,GACR,YAAY,CA+Bd"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { AxiomError, assertNever } from '../model/errors.js';
|
|
2
|
+
import { DEFERRED, isUndetermined, UNKNOWN } from '../model/types.js';
|
|
3
|
+
import { isRecord, isSafeInteger } from '../model/values.js';
|
|
4
|
+
import { asDecimalString, compareDecimalTexts, exactAverageDecimalTexts, medianDecimalTexts, } from './decimal.js';
|
|
5
|
+
import { compareCodePoints } from './strings.js';
|
|
6
|
+
/**
|
|
7
|
+
* The value folds the list aggregates share between the two evaluation doors.
|
|
8
|
+
*
|
|
9
|
+
* A compiled artifact reaches `avg`, `median`, `first` and `last` through the evaluator, which
|
|
10
|
+
* knows each element's declared domain; a documentation example reaches the same operators
|
|
11
|
+
* through `applyBuiltin`, which holds only the values. Both hand the decided elements here, so
|
|
12
|
+
* the arithmetic, the ordering and the empty-list answer are written once (`EXPR-10.2.7` to
|
|
13
|
+
* `EXPR-10.2.10`). The sentinel fold stays with each caller: the evaluator folds a whole
|
|
14
|
+
* sequence, while the example notation folds one list argument.
|
|
15
|
+
*/
|
|
16
|
+
/** The name a non-numeric element reports, so a refusal says what arrived rather than "not a number". */
|
|
17
|
+
function elementSpelling(value) {
|
|
18
|
+
if (typeof value === 'boolean')
|
|
19
|
+
return 'boolean';
|
|
20
|
+
if (typeof value === 'number')
|
|
21
|
+
return 'integer';
|
|
22
|
+
if (typeof value === 'string')
|
|
23
|
+
return 'text';
|
|
24
|
+
if (isRecord(value)) {
|
|
25
|
+
if ('minor' in value || 'currency' in value || 'scale' in value)
|
|
26
|
+
return 'money';
|
|
27
|
+
if ('value' in value && 'unit' in value)
|
|
28
|
+
return 'quantity';
|
|
29
|
+
return 'record';
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(value))
|
|
32
|
+
return 'list';
|
|
33
|
+
return 'null';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The exact decimal one decided element states.
|
|
37
|
+
*
|
|
38
|
+
* `avg` and `median` are typed over a numeric list, so an element of another domain is a
|
|
39
|
+
* value-stated mismatch: the artifact declared numeric elements and the record produced money,
|
|
40
|
+
* a record or a boolean. It is refused with `ENGINE_ERROR` naming the operator rather than
|
|
41
|
+
* coerced from its spelling, because `"1050"` as a minor unit and `"1050"` as a count are two
|
|
42
|
+
* different readings of the same text.
|
|
43
|
+
*/
|
|
44
|
+
function numericElement(value, op, path) {
|
|
45
|
+
if (typeof value === 'number') {
|
|
46
|
+
if (!isSafeInteger(value)) {
|
|
47
|
+
throw new AxiomError('ENGINE_ERROR', `${op} requires an exact decimal operand`, path);
|
|
48
|
+
}
|
|
49
|
+
return asDecimalString(String(value), path);
|
|
50
|
+
}
|
|
51
|
+
if (typeof value === 'string')
|
|
52
|
+
return asDecimalString(value, path);
|
|
53
|
+
throw new AxiomError('ENGINE_ERROR', `${op} requires numeric elements, got ${elementSpelling(value)}`, path);
|
|
54
|
+
}
|
|
55
|
+
/** `avg(xs)`: the exact mean, or `UNKNOWN` when no finite decimal spells it. */
|
|
56
|
+
export function averageValue(values, path = '') {
|
|
57
|
+
if (values.length === 0)
|
|
58
|
+
return UNKNOWN;
|
|
59
|
+
const texts = values.map((value) => numericElement(value, 'avg', path));
|
|
60
|
+
return exactAverageDecimalTexts(texts, path) ?? UNKNOWN;
|
|
61
|
+
}
|
|
62
|
+
/** `median(xs)`: the middle of the canonical decimal order, an exact midpoint for an even count. */
|
|
63
|
+
export function medianValue(values, path = '') {
|
|
64
|
+
if (values.length === 0)
|
|
65
|
+
return UNKNOWN;
|
|
66
|
+
const texts = values.map((value) => numericElement(value, 'median', path));
|
|
67
|
+
return medianDecimalTexts(texts, path) ?? UNKNOWN;
|
|
68
|
+
}
|
|
69
|
+
/** `first(xs)`: the first element, or `null` for an empty list (`EXPR-10.1.2`). */
|
|
70
|
+
export function firstValue(values) {
|
|
71
|
+
return values[0] ?? null;
|
|
72
|
+
}
|
|
73
|
+
/** `last(xs)`: the last element under `EXPR-10.2.10`, or `null` for an empty list. */
|
|
74
|
+
export function lastValue(values) {
|
|
75
|
+
return lastDecided(values);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* `last(xs)` when the elements may carry the sentinels, `EXPR-10.2.10`.
|
|
79
|
+
*
|
|
80
|
+
* `last` reads every element, because an undetermined element could be the last: an `UNKNOWN`
|
|
81
|
+
* anywhere makes the answer `UNKNOWN` (it beats `DEFERRED`), and `null` is a decided value —
|
|
82
|
+
* the empty value of every domain — so `last([1, null])` is `null` rather than a sentinel.
|
|
83
|
+
* The compiled evaluator already folds this way; the value-only door reaches the same fold
|
|
84
|
+
* here instead of returning an element it cannot prove is last.
|
|
85
|
+
*/
|
|
86
|
+
export function lastDecided(values) {
|
|
87
|
+
let pending;
|
|
88
|
+
for (const value of values) {
|
|
89
|
+
if (!isUndetermined(value))
|
|
90
|
+
continue;
|
|
91
|
+
if (value.undetermined === 'UNKNOWN')
|
|
92
|
+
pending = UNKNOWN;
|
|
93
|
+
else
|
|
94
|
+
pending ??= DEFERRED;
|
|
95
|
+
}
|
|
96
|
+
if (pending !== undefined)
|
|
97
|
+
return pending;
|
|
98
|
+
return values[values.length - 1] ?? null;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* `join(xs, separator)` over elements that may carry the sentinels.
|
|
102
|
+
*
|
|
103
|
+
* A `null` element is the same "no reading" a `null` operand is everywhere else, so it
|
|
104
|
+
* lifts to `UNKNOWN`; an `UNKNOWN` element beats a `DEFERRED` one and no partial string is
|
|
105
|
+
* returned. A non-text element is still a value-stated refusal, because the list's declared
|
|
106
|
+
* element type is text and the store produced something else.
|
|
107
|
+
*/
|
|
108
|
+
export function joinDecided(values, separator, path = '') {
|
|
109
|
+
const parts = [];
|
|
110
|
+
let deferred;
|
|
111
|
+
for (const value of values) {
|
|
112
|
+
if (value === null)
|
|
113
|
+
return UNKNOWN;
|
|
114
|
+
if (isUndetermined(value)) {
|
|
115
|
+
if (value.undetermined === 'UNKNOWN')
|
|
116
|
+
return UNKNOWN;
|
|
117
|
+
deferred ??= value;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (typeof value !== 'string') {
|
|
121
|
+
throw new AxiomError('ENGINE_ERROR', 'join requires a list of text', path);
|
|
122
|
+
}
|
|
123
|
+
parts.push(value);
|
|
124
|
+
}
|
|
125
|
+
if (deferred !== undefined)
|
|
126
|
+
return deferred;
|
|
127
|
+
return parts.join(separator);
|
|
128
|
+
}
|
|
129
|
+
/** The numeric domains `mode` groups numerically. */
|
|
130
|
+
const MODE_NUMERIC = new Set(['integer', 'decimal']);
|
|
131
|
+
/**
|
|
132
|
+
* `mode(xs)`: the most frequent value, with ties broken by the smallest value under the
|
|
133
|
+
* canonical order, `EXPR-10.2.13`.
|
|
134
|
+
*
|
|
135
|
+
* Grouping uses the equality rule the rest of the language uses: two numeric values of the
|
|
136
|
+
* same domain are one class whatever their spelling, and a text value is its own class. The
|
|
137
|
+
* token therefore keeps the declared domain, so `"1"` in a `list<string>` is not the number
|
|
138
|
+
* `1`. The tie-break order is the canonical order the domain already has — exact decimal
|
|
139
|
+
* comparison for numerics, code-point comparison for text, and `false` before `true` for
|
|
140
|
+
* booleans — so the answer is deterministic and does not depend on the order the classes were
|
|
141
|
+
* first seen in.
|
|
142
|
+
*
|
|
143
|
+
* `domain` is the fold's agreed domain (`integer`/`decimal` widen to `decimal`), so a mixed
|
|
144
|
+
* numeric list renders its winner as canonical decimal text rather than leaving the JSON
|
|
145
|
+
* number an integer element arrived as.
|
|
146
|
+
*
|
|
147
|
+
* An empty list is the empty value `null`, like `first`/`last`; `mode` returns an element, not
|
|
148
|
+
* a derived number, so it needs no `UNKNOWN` case of its own.
|
|
149
|
+
*/
|
|
150
|
+
export function modeValue(values, domain, path = '') {
|
|
151
|
+
if (values.length === 0)
|
|
152
|
+
return null;
|
|
153
|
+
const classes = new Map();
|
|
154
|
+
for (const value of values) {
|
|
155
|
+
const { token, order, representative } = modeClassOf(value, domain, path);
|
|
156
|
+
const found = classes.get(token);
|
|
157
|
+
if (found === undefined) {
|
|
158
|
+
classes.set(token, { value: representative, order, count: 1 });
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
found.count += 1;
|
|
162
|
+
}
|
|
163
|
+
let best;
|
|
164
|
+
for (const candidate of classes.values()) {
|
|
165
|
+
if (best === undefined) {
|
|
166
|
+
best = candidate;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (candidate.count > best.count) {
|
|
170
|
+
best = candidate;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (candidate.count === best.count && compareModeOrder(candidate.order, best.order, path) < 0) {
|
|
174
|
+
best = candidate;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const winner = best?.value ?? null;
|
|
178
|
+
// A mixed integer/decimal list is typed `decimal`, and a decimal result must be canonical
|
|
179
|
+
// text on the wire rather than the JSON number an integer element arrived as.
|
|
180
|
+
if (domain === 'decimal' && typeof winner === 'number')
|
|
181
|
+
return String(winner);
|
|
182
|
+
return winner;
|
|
183
|
+
}
|
|
184
|
+
/** An order key that does not match the class it is compared with is a contract violation. */
|
|
185
|
+
function orderMismatch(left, right, path) {
|
|
186
|
+
return new AxiomError('ENGINE_ERROR', `mode requires one canonical order across its values, got ${left.kind} and ${right.kind}`, path);
|
|
187
|
+
}
|
|
188
|
+
/** The canonical-order comparison `mode` breaks a tie with. */
|
|
189
|
+
function compareModeOrder(left, right, path) {
|
|
190
|
+
switch (left.kind) {
|
|
191
|
+
case 'numeric':
|
|
192
|
+
if (right.kind !== 'numeric')
|
|
193
|
+
throw orderMismatch(left, right, path);
|
|
194
|
+
return compareDecimalTexts(left.text, right.text, path);
|
|
195
|
+
case 'text':
|
|
196
|
+
if (right.kind !== 'text')
|
|
197
|
+
throw orderMismatch(left, right, path);
|
|
198
|
+
return compareCodePoints(left.value, right.value);
|
|
199
|
+
case 'boolean':
|
|
200
|
+
if (right.kind !== 'boolean')
|
|
201
|
+
throw orderMismatch(left, right, path);
|
|
202
|
+
if (left.value === right.value)
|
|
203
|
+
return 0;
|
|
204
|
+
return left.value ? 1 : -1;
|
|
205
|
+
default:
|
|
206
|
+
return assertNever(left);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** The domains whose values order by code point, all spelled as text. */
|
|
210
|
+
const MODE_TEXT = new Set(['string', 'date', 'instant']);
|
|
211
|
+
/** The equality token, comparison order and representative value for one element. */
|
|
212
|
+
function modeClassOf(value, domain, path) {
|
|
213
|
+
const numeric = domain === undefined ? typeof value === 'number' : MODE_NUMERIC.has(domain);
|
|
214
|
+
if (numeric) {
|
|
215
|
+
const text = numericElement(value, 'mode', path);
|
|
216
|
+
return { token: `n:${text}`, order: { kind: 'numeric', text }, representative: value };
|
|
217
|
+
}
|
|
218
|
+
if (domain === undefined ? typeof value === 'string' : MODE_TEXT.has(domain)) {
|
|
219
|
+
if (typeof value !== 'string') {
|
|
220
|
+
throw new AxiomError('ENGINE_ERROR', `mode requires text elements for the ${domain ?? 'text'} domain, got ${elementSpelling(value)}`, path);
|
|
221
|
+
}
|
|
222
|
+
return { token: `t:${value}`, order: { kind: 'text', value }, representative: value };
|
|
223
|
+
}
|
|
224
|
+
if (domain === undefined ? typeof value === 'boolean' : domain === 'boolean') {
|
|
225
|
+
if (typeof value !== 'boolean') {
|
|
226
|
+
throw new AxiomError('ENGINE_ERROR', `mode requires boolean elements, got ${elementSpelling(value)}`, path);
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
token: `b:${String(value)}`,
|
|
230
|
+
order: { kind: 'boolean', value },
|
|
231
|
+
representative: value,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
throw new AxiomError('ENGINE_ERROR', `mode requires scalar elements, got ${elementSpelling(value)}`, path);
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=reduce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduce.js","sourceRoot":"","sources":["../../src/expr/reduce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;;;GASG;AAEH,yGAAyG;AACzG,SAAS,eAAe,CAAC,KAAmB;IAC1C,IAAI,OAAO,KAAK,KAAK,SA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,EAAE;YACjC,cAAc,EAAE,KAAK;SACtB,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,UAAU,CAClB,cAAc,EACd,sCAAsC,eAAe,CAAC,KAAK,CAAC,EAAE,EAC9D,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["import { AxiomError, assertNever } from '../model/errors.js';\nimport type { DecimalString, LiteralDomain, Undetermined } from '../model/types.js';\nimport { DEFERRED, isUndetermined, UNKNOWN } from '../model/types.js';\nimport { isRecord, isSafeInteger } from '../model/values.js';\nimport type { RuntimeValue } from './builtins.js';\nimport {\n asDecimalString,\n compareDecimalTexts,\n exactAverageDecimalTexts,\n medianDecimalTexts,\n} from './decimal.js';\nimport { compareCodePoints } from './strings.js';\n\n/**\n * The value folds the list aggregates share between the two evaluation doors.\n *\n * A compiled artifact reaches `avg`, `median`, `first` and `last` through the evaluator, which\n * knows each element's declared domain; a documentation example reaches the same operators\n * through `applyBuiltin`, which holds only the values. Both hand the decided elements here, so\n * the arithmetic, the ordering and the empty-list answer are written once (`EXPR-10.2.7` to\n * `EXPR-10.2.10`). The sentinel fold stays with each caller: the evaluator folds a whole\n * sequence, while the example notation folds one list argument.\n */\n\n/** The name a non-numeric element reports, so a refusal says what arrived rather than \"not a number\". */\nfunction elementSpelling(value: RuntimeValue): string {\n if (typeof value === 'boolean') return 'boolean';\n if (typeof value === 'number') return 'integer';\n if (typeof value === 'string') return 'text';\n if (isRecord(value)) {\n if ('minor' in value || 'currency' in value || 'scale' in value) return 'money';\n if ('value' in value && 'unit' in value) return 'quantity';\n return 'record';\n }\n if (Array.isArray(value)) return 'list';\n return 'null';\n}\n\n/**\n * The exact decimal one decided element states.\n *\n * `avg` and `median` are typed over a numeric list, so an element of another domain is a\n * value-stated mismatch: the artifact declared numeric elements and the record produced money,\n * a record or a boolean. It is refused with `ENGINE_ERROR` naming the operator rather than\n * coerced from its spelling, because `\"1050\"` as a minor unit and `\"1050\"` as a count are two\n * different readings of the same text.\n */\nfunction numericElement(value: RuntimeValue, op: string, path: string): DecimalString {\n if (typeof value === 'number') {\n if (!isSafeInteger(value)) {\n throw new AxiomError('ENGINE_ERROR', `${op} requires an exact decimal operand`, path);\n }\n return asDecimalString(String(value), path);\n }\n if (typeof value === 'string') return asDecimalString(value, path);\n throw new AxiomError(\n 'ENGINE_ERROR',\n `${op} requires numeric elements, got ${elementSpelling(value)}`,\n path,\n );\n}\n\n/** `avg(xs)`: the exact mean, or `UNKNOWN` when no finite decimal spells it. */\nexport function averageValue(values: readonly RuntimeValue[], path = ''): RuntimeValue {\n if (values.length === 0) return UNKNOWN;\n const texts = values.map((value) => numericElement(value, 'avg', path));\n return exactAverageDecimalTexts(texts, path) ?? UNKNOWN;\n}\n\n/** `median(xs)`: the middle of the canonical decimal order, an exact midpoint for an even count. */\nexport function medianValue(values: readonly RuntimeValue[], path = ''): RuntimeValue {\n if (values.length === 0) return UNKNOWN;\n const texts = values.map((value) => numericElement(value, 'median', path));\n return medianDecimalTexts(texts, path) ?? UNKNOWN;\n}\n\n/** `first(xs)`: the first element, or `null` for an empty list (`EXPR-10.1.2`). */\nexport function firstValue(values: readonly RuntimeValue[]): RuntimeValue {\n return values[0] ?? null;\n}\n\n/** `last(xs)`: the last element under `EXPR-10.2.10`, or `null` for an empty list. */\nexport function lastValue(values: readonly RuntimeValue[]): RuntimeValue {\n return lastDecided(values);\n}\n\n/**\n * `last(xs)` when the elements may carry the sentinels, `EXPR-10.2.10`.\n *\n * `last` reads every element, because an undetermined element could be the last: an `UNKNOWN`\n * anywhere makes the answer `UNKNOWN` (it beats `DEFERRED`), and `null` is a decided value —\n * the empty value of every domain — so `last([1, null])` is `null` rather than a sentinel.\n * The compiled evaluator already folds this way; the value-only door reaches the same fold\n * here instead of returning an element it cannot prove is last.\n */\nexport function lastDecided(values: readonly RuntimeValue[]): RuntimeValue {\n let pending: Undetermined | undefined;\n for (const value of values) {\n if (!isUndetermined(value)) continue;\n if (value.undetermined === 'UNKNOWN') pending = UNKNOWN;\n else pending ??= DEFERRED;\n }\n if (pending !== undefined) return pending;\n return values[values.length - 1] ?? null;\n}\n\n/**\n * `join(xs, separator)` over elements that may carry the sentinels.\n *\n * A `null` element is the same \"no reading\" a `null` operand is everywhere else, so it\n * lifts to `UNKNOWN`; an `UNKNOWN` element beats a `DEFERRED` one and no partial string is\n * returned. A non-text element is still a value-stated refusal, because the list's declared\n * element type is text and the store produced something else.\n */\nexport function joinDecided(\n values: readonly RuntimeValue[],\n separator: string,\n path = '',\n): RuntimeValue {\n const parts: string[] = [];\n let deferred: Undetermined | undefined;\n for (const value of values) {\n if (value === null) return UNKNOWN;\n if (isUndetermined(value)) {\n if (value.undetermined === 'UNKNOWN') return UNKNOWN;\n deferred ??= value;\n continue;\n }\n if (typeof value !== 'string') {\n throw new AxiomError('ENGINE_ERROR', 'join requires a list of text', path);\n }\n parts.push(value);\n }\n if (deferred !== undefined) return deferred;\n return parts.join(separator);\n}\n\n/** The numeric domains `mode` groups numerically. */\nconst MODE_NUMERIC: ReadonlySet<LiteralDomain> = new Set(['integer', 'decimal']);\n\n/**\n * The canonical order a `mode` tie compares under: exact decimal value for numerics, code\n * point for text, and `false` before `true` for booleans (`EXPR-10.2.13`). It is a tagged\n * union rather than one text key, because `\"n:10\" < \"n:9\"` is exactly the bug the text key\n * caused.\n */\ntype ModeOrder =\n | { readonly kind: 'numeric'; readonly text: DecimalString }\n | { readonly kind: 'text'; readonly value: string }\n | { readonly kind: 'boolean'; readonly value: boolean };\n\n/** One equality class `mode` is counting. */\ninterface ModeClass {\n readonly value: RuntimeValue;\n readonly order: ModeOrder;\n count: number;\n}\n\n/**\n * `mode(xs)`: the most frequent value, with ties broken by the smallest value under the\n * canonical order, `EXPR-10.2.13`.\n *\n * Grouping uses the equality rule the rest of the language uses: two numeric values of the\n * same domain are one class whatever their spelling, and a text value is its own class. The\n * token therefore keeps the declared domain, so `\"1\"` in a `list<string>` is not the number\n * `1`. The tie-break order is the canonical order the domain already has — exact decimal\n * comparison for numerics, code-point comparison for text, and `false` before `true` for\n * booleans — so the answer is deterministic and does not depend on the order the classes were\n * first seen in.\n *\n * `domain` is the fold's agreed domain (`integer`/`decimal` widen to `decimal`), so a mixed\n * numeric list renders its winner as canonical decimal text rather than leaving the JSON\n * number an integer element arrived as.\n *\n * An empty list is the empty value `null`, like `first`/`last`; `mode` returns an element, not\n * a derived number, so it needs no `UNKNOWN` case of its own.\n */\nexport function modeValue(\n values: readonly RuntimeValue[],\n domain: LiteralDomain | undefined,\n path = '',\n): RuntimeValue {\n if (values.length === 0) return null;\n const classes = new Map<string, ModeClass>();\n for (const value of values) {\n const { token, order, representative } = modeClassOf(value, domain, path);\n const found = classes.get(token);\n if (found === undefined) {\n classes.set(token, { value: representative, order, count: 1 });\n continue;\n }\n found.count += 1;\n }\n let best: ModeClass | undefined;\n for (const candidate of classes.values()) {\n if (best === undefined) {\n best = candidate;\n continue;\n }\n if (candidate.count > best.count) {\n best = candidate;\n continue;\n }\n if (candidate.count === best.count && compareModeOrder(candidate.order, best.order, path) < 0) {\n best = candidate;\n }\n }\n const winner = best?.value ?? null;\n // A mixed integer/decimal list is typed `decimal`, and a decimal result must be canonical\n // text on the wire rather than the JSON number an integer element arrived as.\n if (domain === 'decimal' && typeof winner === 'number') return String(winner);\n return winner;\n}\n\n/** An order key that does not match the class it is compared with is a contract violation. */\nfunction orderMismatch(left: ModeOrder, right: ModeOrder, path: string): AxiomError {\n return new AxiomError(\n 'ENGINE_ERROR',\n `mode requires one canonical order across its values, got ${left.kind} and ${right.kind}`,\n path,\n );\n}\n\n/** The canonical-order comparison `mode` breaks a tie with. */\nfunction compareModeOrder(left: ModeOrder, right: ModeOrder, path: string): number {\n switch (left.kind) {\n case 'numeric':\n if (right.kind !== 'numeric') throw orderMismatch(left, right, path);\n return compareDecimalTexts(left.text, right.text, path);\n case 'text':\n if (right.kind !== 'text') throw orderMismatch(left, right, path);\n return compareCodePoints(left.value, right.value);\n case 'boolean':\n if (right.kind !== 'boolean') throw orderMismatch(left, right, path);\n if (left.value === right.value) return 0;\n return left.value ? 1 : -1;\n default:\n return assertNever(left);\n }\n}\n\n/** The domains whose values order by code point, all spelled as text. */\nconst MODE_TEXT: ReadonlySet<LiteralDomain> = new Set(['string', 'date', 'instant']);\n\n/** The equality token, comparison order and representative value for one element. */\nfunction modeClassOf(\n value: RuntimeValue,\n domain: LiteralDomain | undefined,\n path: string,\n): { readonly token: string; readonly order: ModeOrder; readonly representative: RuntimeValue } {\n const numeric = domain === undefined ? typeof value === 'number' : MODE_NUMERIC.has(domain);\n if (numeric) {\n const text = numericElement(value, 'mode', path);\n return { token: `n:${text}`, order: { kind: 'numeric', text }, representative: value };\n }\n if (domain === undefined ? typeof value === 'string' : MODE_TEXT.has(domain)) {\n if (typeof value !== 'string') {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `mode requires text elements for the ${domain ?? 'text'} domain, got ${elementSpelling(value)}`,\n path,\n );\n }\n return { token: `t:${value}`, order: { kind: 'text', value }, representative: value };\n }\n if (domain === undefined ? typeof value === 'boolean' : domain === 'boolean') {\n if (typeof value !== 'boolean') {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `mode requires boolean elements, got ${elementSpelling(value)}`,\n path,\n );\n }\n return {\n token: `b:${String(value)}`,\n order: { kind: 'boolean', value },\n representative: value,\n };\n }\n throw new AxiomError(\n 'ENGINE_ERROR',\n `mode requires scalar elements, got ${elementSpelling(value)}`,\n path,\n );\n}\n"]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { AxiomError } from '../model/errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* `matches(s, pattern, flags?)`: JavaScript regular-expression search with Unicode semantics,
|
|
4
|
+
* `spec/semantics/expr-v1.md` `EXPR-14.1.12` to `EXPR-14.1.14`.
|
|
5
|
+
*
|
|
6
|
+
* Four properties make this operator defensible to ship:
|
|
7
|
+
*
|
|
8
|
+
* 1. **One dialect.** The pattern is an ECMAScript regular expression with the `u` flag always
|
|
9
|
+
* set, so `\p{L}`, `\p{Script=Han}` and an astral character are one expression each and the
|
|
10
|
+
* answer never depends on the host locale. `i`, `m` and `s` are the only other flags the
|
|
11
|
+
* language admits; `g`, `y` and `d` describe state or indices a boolean test has no use for.
|
|
12
|
+
* 2. **A bounded subject.** A subject longer than {@link REGEX_SUBJECT_LIMIT} code points is
|
|
13
|
+
* refused before the engine runs, so no authored pattern can be used to scan a document
|
|
14
|
+
* field of unbounded size.
|
|
15
|
+
* 3. **The classic exponential shapes are refused.** {@link unsafePattern} refuses a repeated
|
|
16
|
+
* group whose body is variable or whose alternation overlaps, and a run of adjacent variable
|
|
17
|
+
* quantifiers whose operands can match the same text (`a?a?…`, `\d*\d*…`). A pattern that
|
|
18
|
+
* arrives as a value is analysed by the same scan before the engine runs.
|
|
19
|
+
* 4. **Every call has a work ceiling.** A family scan can always be beaten by a shape it does
|
|
20
|
+
* not name, so the engine is never handed a pattern whose conservative backtracking bound at
|
|
21
|
+
* this subject length exceeds {@link REGEX_MATCH_WORK_LIMIT}. The bound is computed from the
|
|
22
|
+
* parsed source and the subject length, not measured after the fact, so a hostile computed
|
|
23
|
+
* pattern is refused with `unsafe-pattern` instead of spending a request's latency.
|
|
24
|
+
*
|
|
25
|
+
* The compiled `RegExp` is cached per `(pattern, flags)`, so an item-scoped rule over a
|
|
26
|
+
* thousand rows compiles one pattern and tests a thousand subjects.
|
|
27
|
+
*/
|
|
28
|
+
/** The subject cap in code points: a longer input is refused, never scanned and never `false`. */
|
|
29
|
+
export declare const REGEX_SUBJECT_LIMIT = 4096;
|
|
30
|
+
/** The optional flags an author may write, in the canonical order the cache keys on. */
|
|
31
|
+
export declare const REGEX_FLAGS: readonly ['i', 'm', 's'];
|
|
32
|
+
export type RegexFlag = (typeof REGEX_FLAGS)[number];
|
|
33
|
+
/** The flag string every compiled pattern carries: `u` is not optional. */
|
|
34
|
+
export declare const BASE_REGEX_FLAGS = "u";
|
|
35
|
+
/** Why a pattern or subject was refused, as data rather than a thrown error. */
|
|
36
|
+
export type RegexRefusal = {
|
|
37
|
+
readonly kind: 'invalid-flags';
|
|
38
|
+
readonly detail: string;
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: 'invalid-pattern';
|
|
41
|
+
readonly detail: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'unsafe-pattern';
|
|
44
|
+
readonly detail: string;
|
|
45
|
+
} | {
|
|
46
|
+
readonly kind: 'subject-too-long';
|
|
47
|
+
readonly detail: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The canonical flag string for one authored `flags` operand, or the refusal naming the
|
|
51
|
+
* offending flag.
|
|
52
|
+
*
|
|
53
|
+
* The author writes a subset of `ims`; `u` is added here rather than accepted, so a document
|
|
54
|
+
* cannot opt out of Unicode semantics by writing `g` or by writing nothing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function canonicalFlags(flags: string): {
|
|
57
|
+
readonly kind: 'ok';
|
|
58
|
+
readonly flags: string;
|
|
59
|
+
} | RegexRefusal;
|
|
60
|
+
/**
|
|
61
|
+
* The classic catastrophic-backtracking shapes, as a structural scan of the source text.
|
|
62
|
+
*
|
|
63
|
+
* The three families are the ones an author can write by accident and an engine cannot escape:
|
|
64
|
+
*
|
|
65
|
+
* - **A repeated group whose body is itself variable** (`(a+)+`, `(\w*)*`, `(a?)+`): the inner
|
|
66
|
+
* repetition is free to re-partition the same text, so the outer one explores an exponential
|
|
67
|
+
* number of partitions.
|
|
68
|
+
* - **A repeated group whose alternation has branches that can match the same prefix**
|
|
69
|
+
* (`(a|ab)+`, `(?:(?:a|aa))*`): the same text is reachable two ways, which is the same
|
|
70
|
+
* exponential multiplicity written differently.
|
|
71
|
+
* - **A run of adjacent variable quantifiers over overlapping operands** (`a?a?…a{n}b`,
|
|
72
|
+
* `\d*\d*…`): each quantifier partitions the same text again, which is the first family with
|
|
73
|
+
* no group to hang it on.
|
|
74
|
+
*
|
|
75
|
+
* This is a conservative analysis of a literal pattern, not a proof: it walks groups, escapes
|
|
76
|
+
* and character classes so that `[{]` is not read as a group, and it refuses only constructs it
|
|
77
|
+
* can name. A pattern it passes is still bounded by the per-call work ceiling. It runs at compile
|
|
78
|
+
* time for a literal and, for a computed pattern, before every call.
|
|
79
|
+
*/
|
|
80
|
+
export declare function unsafePattern(pattern: string, flags?: string): string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Compiles one pattern, or states why it cannot be compiled.
|
|
83
|
+
*
|
|
84
|
+
* A `SyntaxError` from the engine is data: a computed pattern that does not parse is a
|
|
85
|
+
* value-stated refusal the report can name, not an exception a host sees. The cache is bounded
|
|
86
|
+
* because a document can write an unbounded number of distinct computed patterns, and a
|
|
87
|
+
* process-global map an input can grow is a leak.
|
|
88
|
+
*/
|
|
89
|
+
export declare function compileRegex(pattern: string, canonical: string): {
|
|
90
|
+
readonly kind: 'ok';
|
|
91
|
+
readonly regex: RegExp;
|
|
92
|
+
} | RegexRefusal;
|
|
93
|
+
/** A refusal as the `ENGINE_ERROR` the evaluator reports at the call's path. */
|
|
94
|
+
export declare function regexRefusalError(refusal: RegexRefusal, path: string): AxiomError;
|
|
95
|
+
/**
|
|
96
|
+
* `matches(s, pattern, flags?)`: an unanchored Unicode search, or the refusal that stops it.
|
|
97
|
+
*
|
|
98
|
+
* The subject cap is checked before compilation, so an oversized input is refused whether or
|
|
99
|
+
* not the pattern would have matched, and the answer is never a silent `false`. The work ceiling
|
|
100
|
+
* is checked at this call's subject length, so a pattern that is ordinary over a short value is
|
|
101
|
+
* not refused for it, and a shape the structural scan did not name still cannot outlast the
|
|
102
|
+
* budget.
|
|
103
|
+
*/
|
|
104
|
+
export declare function matchRegex(subject: string, pattern: string, flags: string): {
|
|
105
|
+
readonly kind: 'tested';
|
|
106
|
+
readonly matched: boolean;
|
|
107
|
+
} | RegexRefusal;
|
|
108
|
+
//# sourceMappingURL=regex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../src/expr/regex.ts"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