@azx-pbc/axiom-compiler 0.0.0-stage → 0.0.6
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 +415 -2
- package/dist/article.d.ts +12 -0
- package/dist/article.d.ts.map +1 -0
- package/dist/article.js +16 -0
- package/dist/article.js.map +1 -0
- package/dist/cli/args.d.ts +101 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +158 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/check.d.ts +2 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +33 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/compile.d.ts +2 -0
- package/dist/cli/compile.d.ts.map +1 -0
- package/dist/cli/compile.js +43 -0
- package/dist/cli/compile.js.map +1 -0
- package/dist/cli/count.d.ts +15 -0
- package/dist/cli/count.d.ts.map +1 -0
- package/dist/cli/count.js +21 -0
- package/dist/cli/count.js.map +1 -0
- package/dist/cli/dataset.d.ts +28 -0
- package/dist/cli/dataset.d.ts.map +1 -0
- package/dist/cli/dataset.js +115 -0
- package/dist/cli/dataset.js.map +1 -0
- package/dist/cli/diff.d.ts +2 -0
- package/dist/cli/diff.d.ts.map +1 -0
- package/dist/cli/diff.js +297 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli/explain.d.ts +2 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +95 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/fields.d.ts +11 -0
- package/dist/cli/fields.d.ts.map +1 -0
- package/dist/cli/fields.js +13 -0
- package/dist/cli/fields.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +40 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/read.d.ts +56 -0
- package/dist/cli/read.d.ts.map +1 -0
- package/dist/cli/read.js +179 -0
- package/dist/cli/read.js.map +1 -0
- package/dist/cli/render.d.ts +58 -0
- package/dist/cli/render.d.ts.map +1 -0
- package/dist/cli/render.js +422 -0
- package/dist/cli/render.js.map +1 -0
- package/dist/cli/schema.d.ts +28 -0
- package/dist/cli/schema.d.ts.map +1 -0
- package/dist/cli/schema.js +46 -0
- package/dist/cli/schema.js.map +1 -0
- package/dist/cli/suite-report.d.ts +18 -0
- package/dist/cli/suite-report.d.ts.map +1 -0
- package/dist/cli/suite-report.js +58 -0
- package/dist/cli/suite-report.js.map +1 -0
- package/dist/cli/suites.d.ts +25 -0
- package/dist/cli/suites.d.ts.map +1 -0
- package/dist/cli/suites.js +67 -0
- package/dist/cli/suites.js.map +1 -0
- package/dist/cli/terminal.d.ts +45 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +119 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/test.d.ts +12 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +199 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/cli/usage.d.ts +15 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +95 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +51 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile/artifact-members.d.ts +57 -0
- package/dist/compile/artifact-members.d.ts.map +1 -0
- package/dist/compile/artifact-members.js +130 -0
- package/dist/compile/artifact-members.js.map +1 -0
- package/dist/compile/artifact.d.ts +20 -0
- package/dist/compile/artifact.d.ts.map +1 -0
- package/dist/compile/artifact.js +87 -0
- package/dist/compile/artifact.js.map +1 -0
- package/dist/compile/compilation.d.ts +46 -0
- package/dist/compile/compilation.d.ts.map +1 -0
- package/dist/compile/compilation.js +4 -0
- package/dist/compile/compilation.js.map +1 -0
- package/dist/compile/computed.d.ts +22 -0
- package/dist/compile/computed.d.ts.map +1 -0
- package/dist/compile/computed.js +245 -0
- package/dist/compile/computed.js.map +1 -0
- package/dist/compile/condition-warnings.d.ts +12 -0
- package/dist/compile/condition-warnings.d.ts.map +1 -0
- package/dist/compile/condition-warnings.js +26 -0
- package/dist/compile/condition-warnings.js.map +1 -0
- package/dist/compile/conditions.d.ts +18 -0
- package/dist/compile/conditions.d.ts.map +1 -0
- package/dist/compile/conditions.js +22 -0
- package/dist/compile/conditions.js.map +1 -0
- package/dist/compile/cross-checks.d.ts +67 -0
- package/dist/compile/cross-checks.d.ts.map +1 -0
- package/dist/compile/cross-checks.js +238 -0
- package/dist/compile/cross-checks.js.map +1 -0
- package/dist/compile/datasets.d.ts +52 -0
- package/dist/compile/datasets.d.ts.map +1 -0
- package/dist/compile/datasets.js +183 -0
- package/dist/compile/datasets.js.map +1 -0
- package/dist/compile/dead-weight.d.ts +26 -0
- package/dist/compile/dead-weight.d.ts.map +1 -0
- package/dist/compile/dead-weight.js +244 -0
- package/dist/compile/dead-weight.js.map +1 -0
- package/dist/compile/declaration-rules.d.ts +54 -0
- package/dist/compile/declaration-rules.d.ts.map +1 -0
- package/dist/compile/declaration-rules.js +510 -0
- package/dist/compile/declaration-rules.js.map +1 -0
- package/dist/compile/declarations.d.ts +44 -0
- package/dist/compile/declarations.d.ts.map +1 -0
- package/dist/compile/declarations.js +160 -0
- package/dist/compile/declarations.js.map +1 -0
- package/dist/compile/document.d.ts +4 -0
- package/dist/compile/document.d.ts.map +1 -0
- package/dist/compile/document.js +13 -0
- package/dist/compile/document.js.map +1 -0
- package/dist/compile/expression.d.ts +38 -0
- package/dist/compile/expression.d.ts.map +1 -0
- package/dist/compile/expression.js +288 -0
- package/dist/compile/expression.js.map +1 -0
- package/dist/compile/hashes.d.ts +26 -0
- package/dist/compile/hashes.d.ts.map +1 -0
- package/dist/compile/hashes.js +96 -0
- package/dist/compile/hashes.js.map +1 -0
- package/dist/compile/item-targets.d.ts +12 -0
- package/dist/compile/item-targets.d.ts.map +1 -0
- package/dist/compile/item-targets.js +287 -0
- package/dist/compile/item-targets.js.map +1 -0
- package/dist/compile/messages.d.ts +8 -0
- package/dist/compile/messages.d.ts.map +1 -0
- package/dist/compile/messages.js +62 -0
- package/dist/compile/messages.js.map +1 -0
- package/dist/compile/option-availability.d.ts +51 -0
- package/dist/compile/option-availability.d.ts.map +1 -0
- package/dist/compile/option-availability.js +171 -0
- package/dist/compile/option-availability.js.map +1 -0
- package/dist/compile/option-codes.d.ts +27 -0
- package/dist/compile/option-codes.d.ts.map +1 -0
- package/dist/compile/option-codes.js +212 -0
- package/dist/compile/option-codes.js.map +1 -0
- package/dist/compile/references.d.ts +14 -0
- package/dist/compile/references.d.ts.map +1 -0
- package/dist/compile/references.js +126 -0
- package/dist/compile/references.js.map +1 -0
- package/dist/compile/rows-from.d.ts +27 -0
- package/dist/compile/rows-from.d.ts.map +1 -0
- package/dist/compile/rows-from.js +164 -0
- package/dist/compile/rows-from.js.map +1 -0
- package/dist/compile/rules.d.ts +58 -0
- package/dist/compile/rules.d.ts.map +1 -0
- package/dist/compile/rules.js +327 -0
- package/dist/compile/rules.js.map +1 -0
- package/dist/compile/suggestions.d.ts +52 -0
- package/dist/compile/suggestions.d.ts.map +1 -0
- package/dist/compile/suggestions.js +633 -0
- package/dist/compile/suggestions.js.map +1 -0
- package/dist/compile/targets.d.ts +22 -0
- package/dist/compile/targets.d.ts.map +1 -0
- package/dist/compile/targets.js +125 -0
- package/dist/compile/targets.js.map +1 -0
- package/dist/compile/types.d.ts +84 -0
- package/dist/compile/types.d.ts.map +1 -0
- package/dist/compile/types.js +2 -0
- package/dist/compile/types.js.map +1 -0
- package/dist/compile/warning.d.ts +45 -0
- package/dist/compile/warning.d.ts.map +1 -0
- package/dist/compile/warning.js +2 -0
- package/dist/compile/warning.js.map +1 -0
- package/dist/compile-yaml.d.ts +23 -0
- package/dist/compile-yaml.d.ts.map +1 -0
- package/dist/compile-yaml.js +30 -0
- package/dist/compile-yaml.js.map +1 -0
- package/dist/compile.d.ts +78 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +372 -0
- package/dist/compile.js.map +1 -0
- package/dist/csv/limits.d.ts +43 -0
- package/dist/csv/limits.d.ts.map +1 -0
- package/dist/csv/limits.js +51 -0
- package/dist/csv/limits.js.map +1 -0
- package/dist/csv/scalar.d.ts +33 -0
- package/dist/csv/scalar.d.ts.map +1 -0
- package/dist/csv/scalar.js +77 -0
- package/dist/csv/scalar.js.map +1 -0
- package/dist/datasets/csv.d.ts +46 -0
- package/dist/datasets/csv.d.ts.map +1 -0
- package/dist/datasets/csv.js +293 -0
- package/dist/datasets/csv.js.map +1 -0
- package/dist/datasets/declaration.d.ts +16 -0
- package/dist/datasets/declaration.d.ts.map +1 -0
- package/dist/datasets/declaration.js +104 -0
- package/dist/datasets/declaration.js.map +1 -0
- package/dist/datasets/diagnostics.d.ts +65 -0
- package/dist/datasets/diagnostics.d.ts.map +1 -0
- package/dist/datasets/diagnostics.js +2 -0
- package/dist/datasets/diagnostics.js.map +1 -0
- package/dist/datasets/diff.d.ts +46 -0
- package/dist/datasets/diff.d.ts.map +1 -0
- package/dist/datasets/diff.js +84 -0
- package/dist/datasets/diff.js.map +1 -0
- package/dist/datasets/document.d.ts +12 -0
- package/dist/datasets/document.d.ts.map +1 -0
- package/dist/datasets/document.js +382 -0
- package/dist/datasets/document.js.map +1 -0
- package/dist/datasets/index.d.ts +43 -0
- package/dist/datasets/index.d.ts.map +1 -0
- package/dist/datasets/index.js +68 -0
- package/dist/datasets/index.js.map +1 -0
- package/dist/datasets/repair.d.ts +26 -0
- package/dist/datasets/repair.d.ts.map +1 -0
- package/dist/datasets/repair.js +60 -0
- package/dist/datasets/repair.js.map +1 -0
- package/dist/document-path.d.ts +62 -0
- package/dist/document-path.d.ts.map +1 -0
- package/dist/document-path.js +200 -0
- package/dist/document-path.js.map +1 -0
- package/dist/expr/boundary.d.ts +8 -0
- package/dist/expr/boundary.d.ts.map +1 -0
- package/dist/expr/boundary.js +243 -0
- package/dist/expr/boundary.js.map +1 -0
- package/dist/expr/compile-expr.d.ts +35 -0
- package/dist/expr/compile-expr.d.ts.map +1 -0
- package/dist/expr/compile-expr.js +66 -0
- package/dist/expr/compile-expr.js.map +1 -0
- package/dist/expr/deprecation.d.ts +23 -0
- package/dist/expr/deprecation.d.ts.map +1 -0
- package/dist/expr/deprecation.js +28 -0
- package/dist/expr/deprecation.js.map +1 -0
- package/dist/expr/diagnostics.d.ts +31 -0
- package/dist/expr/diagnostics.d.ts.map +1 -0
- package/dist/expr/diagnostics.js +34 -0
- package/dist/expr/diagnostics.js.map +1 -0
- package/dist/expr/lexer.d.ts +49 -0
- package/dist/expr/lexer.d.ts.map +1 -0
- package/dist/expr/lexer.js +277 -0
- package/dist/expr/lexer.js.map +1 -0
- package/dist/expr/lint-warnings.d.ts +11 -0
- package/dist/expr/lint-warnings.d.ts.map +1 -0
- package/dist/expr/lint-warnings.js +20 -0
- package/dist/expr/lint-warnings.js.map +1 -0
- package/dist/expr/lint.d.ts +41 -0
- package/dist/expr/lint.d.ts.map +1 -0
- package/dist/expr/lint.js +1034 -0
- package/dist/expr/lint.js.map +1 -0
- package/dist/expr/parse/aggregates.d.ts +13 -0
- package/dist/expr/parse/aggregates.d.ts.map +1 -0
- package/dist/expr/parse/aggregates.js +48 -0
- package/dist/expr/parse/aggregates.js.map +1 -0
- package/dist/expr/parse/budget.d.ts +11 -0
- package/dist/expr/parse/budget.d.ts.map +1 -0
- package/dist/expr/parse/budget.js +57 -0
- package/dist/expr/parse/budget.js.map +1 -0
- package/dist/expr/parse/grammar.d.ts +9 -0
- package/dist/expr/parse/grammar.d.ts.map +1 -0
- package/dist/expr/parse/grammar.js +699 -0
- package/dist/expr/parse/grammar.js.map +1 -0
- package/dist/expr/parse/literals.d.ts +20 -0
- package/dist/expr/parse/literals.d.ts.map +1 -0
- package/dist/expr/parse/literals.js +132 -0
- package/dist/expr/parse/literals.js.map +1 -0
- package/dist/expr/parse/stream.d.ts +60 -0
- package/dist/expr/parse/stream.d.ts.map +1 -0
- package/dist/expr/parse/stream.js +151 -0
- package/dist/expr/parse/stream.js.map +1 -0
- package/dist/expr/parser.d.ts +45 -0
- package/dist/expr/parser.d.ts.map +1 -0
- package/dist/expr/parser.js +110 -0
- package/dist/expr/parser.js.map +1 -0
- package/dist/expr/print/spell.d.ts +78 -0
- package/dist/expr/print/spell.d.ts.map +1 -0
- package/dist/expr/print/spell.js +592 -0
- package/dist/expr/print/spell.js.map +1 -0
- package/dist/expr/print.d.ts +20 -0
- package/dist/expr/print.d.ts.map +1 -0
- package/dist/expr/print.js +102 -0
- package/dist/expr/print.js.map +1 -0
- package/dist/expr/suggest.d.ts +26 -0
- package/dist/expr/suggest.d.ts.map +1 -0
- package/dist/expr/suggest.js +77 -0
- package/dist/expr/suggest.js.map +1 -0
- package/dist/expr/typecheck/aggregates.d.ts +8 -0
- package/dist/expr/typecheck/aggregates.d.ts.map +1 -0
- package/dist/expr/typecheck/aggregates.js +334 -0
- package/dist/expr/typecheck/aggregates.js.map +1 -0
- package/dist/expr/typecheck/arithmetic.d.ts +6 -0
- package/dist/expr/typecheck/arithmetic.d.ts.map +1 -0
- package/dist/expr/typecheck/arithmetic.js +258 -0
- package/dist/expr/typecheck/arithmetic.js.map +1 -0
- package/dist/expr/typecheck/arity.d.ts +38 -0
- package/dist/expr/typecheck/arity.d.ts.map +1 -0
- package/dist/expr/typecheck/arity.js +173 -0
- package/dist/expr/typecheck/arity.js.map +1 -0
- package/dist/expr/typecheck/calls.d.ts +6 -0
- package/dist/expr/typecheck/calls.d.ts.map +1 -0
- package/dist/expr/typecheck/calls.js +137 -0
- package/dist/expr/typecheck/calls.js.map +1 -0
- package/dist/expr/typecheck/comparison.d.ts +13 -0
- package/dist/expr/typecheck/comparison.d.ts.map +1 -0
- package/dist/expr/typecheck/comparison.js +200 -0
- package/dist/expr/typecheck/comparison.js.map +1 -0
- package/dist/expr/typecheck/compound.d.ts +24 -0
- package/dist/expr/typecheck/compound.d.ts.map +1 -0
- package/dist/expr/typecheck/compound.js +175 -0
- package/dist/expr/typecheck/compound.js.map +1 -0
- package/dist/expr/typecheck/context.d.ts +44 -0
- package/dist/expr/typecheck/context.d.ts.map +1 -0
- package/dist/expr/typecheck/context.js +2 -0
- package/dist/expr/typecheck/context.js.map +1 -0
- package/dist/expr/typecheck/datasets.d.ts +17 -0
- package/dist/expr/typecheck/datasets.d.ts.map +1 -0
- package/dist/expr/typecheck/datasets.js +136 -0
- package/dist/expr/typecheck/datasets.js.map +1 -0
- package/dist/expr/typecheck/digest.d.ts +7 -0
- package/dist/expr/typecheck/digest.d.ts.map +1 -0
- package/dist/expr/typecheck/digest.js +44 -0
- package/dist/expr/typecheck/digest.js.map +1 -0
- package/dist/expr/typecheck/fold.d.ts +41 -0
- package/dist/expr/typecheck/fold.d.ts.map +1 -0
- package/dist/expr/typecheck/fold.js +71 -0
- package/dist/expr/typecheck/fold.js.map +1 -0
- package/dist/expr/typecheck/gate-folds.d.ts +22 -0
- package/dist/expr/typecheck/gate-folds.d.ts.map +1 -0
- package/dist/expr/typecheck/gate-folds.js +40 -0
- package/dist/expr/typecheck/gate-folds.js.map +1 -0
- package/dist/expr/typecheck/guards.d.ts +6 -0
- package/dist/expr/typecheck/guards.d.ts.map +1 -0
- package/dist/expr/typecheck/guards.js +38 -0
- package/dist/expr/typecheck/guards.js.map +1 -0
- package/dist/expr/typecheck/member.d.ts +17 -0
- package/dist/expr/typecheck/member.d.ts.map +1 -0
- package/dist/expr/typecheck/member.js +46 -0
- package/dist/expr/typecheck/member.js.map +1 -0
- package/dist/expr/typecheck/money.d.ts +8 -0
- package/dist/expr/typecheck/money.d.ts.map +1 -0
- package/dist/expr/typecheck/money.js +49 -0
- package/dist/expr/typecheck/money.js.map +1 -0
- package/dist/expr/typecheck/numeric.d.ts +8 -0
- package/dist/expr/typecheck/numeric.d.ts.map +1 -0
- package/dist/expr/typecheck/numeric.js +84 -0
- package/dist/expr/typecheck/numeric.js.map +1 -0
- package/dist/expr/typecheck/operands.d.ts +27 -0
- package/dist/expr/typecheck/operands.d.ts.map +1 -0
- package/dist/expr/typecheck/operands.js +106 -0
- package/dist/expr/typecheck/operands.js.map +1 -0
- package/dist/expr/typecheck/paths.d.ts +21 -0
- package/dist/expr/typecheck/paths.d.ts.map +1 -0
- package/dist/expr/typecheck/paths.js +321 -0
- package/dist/expr/typecheck/paths.js.map +1 -0
- package/dist/expr/typecheck/records.d.ts +24 -0
- package/dist/expr/typecheck/records.d.ts.map +1 -0
- package/dist/expr/typecheck/records.js +53 -0
- package/dist/expr/typecheck/records.js.map +1 -0
- package/dist/expr/typecheck/sequences.d.ts +15 -0
- package/dist/expr/typecheck/sequences.d.ts.map +1 -0
- package/dist/expr/typecheck/sequences.js +55 -0
- package/dist/expr/typecheck/sequences.js.map +1 -0
- package/dist/expr/typecheck/strings.d.ts +8 -0
- package/dist/expr/typecheck/strings.d.ts.map +1 -0
- package/dist/expr/typecheck/strings.js +188 -0
- package/dist/expr/typecheck/strings.js.map +1 -0
- package/dist/expr/typecheck/temporal.d.ts +7 -0
- package/dist/expr/typecheck/temporal.d.ts.map +1 -0
- package/dist/expr/typecheck/temporal.js +80 -0
- package/dist/expr/typecheck/temporal.js.map +1 -0
- package/dist/expr/typecheck/types.d.ts +163 -0
- package/dist/expr/typecheck/types.d.ts.map +1 -0
- package/dist/expr/typecheck/types.js +404 -0
- package/dist/expr/typecheck/types.js.map +1 -0
- package/dist/expr/typecheck.d.ts +75 -0
- package/dist/expr/typecheck.d.ts.map +1 -0
- package/dist/expr/typecheck.js +242 -0
- package/dist/expr/typecheck.js.map +1 -0
- package/dist/expr/undecided.d.ts +13 -0
- package/dist/expr/undecided.d.ts.map +1 -0
- package/dist/expr/undecided.js +58 -0
- package/dist/expr/undecided.js.map +1 -0
- package/dist/expr/values/code-points.d.ts +13 -0
- package/dist/expr/values/code-points.d.ts.map +1 -0
- package/dist/expr/values/code-points.js +25 -0
- package/dist/expr/values/code-points.js.map +1 -0
- package/dist/expr/values/inline.d.ts +77 -0
- package/dist/expr/values/inline.d.ts.map +1 -0
- package/dist/expr/values/inline.js +404 -0
- package/dist/expr/values/inline.js.map +1 -0
- package/dist/expr/values/interval.d.ts +19 -0
- package/dist/expr/values/interval.d.ts.map +1 -0
- package/dist/expr/values/interval.js +1180 -0
- package/dist/expr/values/interval.js.map +1 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/document.d.ts +58 -0
- package/dist/ingest/document.d.ts.map +1 -0
- package/dist/ingest/document.js +83 -0
- package/dist/ingest/document.js.map +1 -0
- package/dist/ingest/yaml-document.d.ts +15 -0
- package/dist/ingest/yaml-document.d.ts.map +1 -0
- package/dist/ingest/yaml-document.js +42 -0
- package/dist/ingest/yaml-document.js.map +1 -0
- package/dist/ingest/yaml.d.ts +51 -0
- package/dist/ingest/yaml.d.ts.map +1 -0
- package/dist/ingest/yaml.js +340 -0
- package/dist/ingest/yaml.js.map +1 -0
- package/dist/layout/compile.d.ts +6 -0
- package/dist/layout/compile.d.ts.map +1 -0
- package/dist/layout/compile.js +224 -0
- package/dist/layout/compile.js.map +1 -0
- package/dist/layout/context.d.ts +12 -0
- package/dist/layout/context.d.ts.map +1 -0
- package/dist/layout/context.js +26 -0
- package/dist/layout/context.js.map +1 -0
- package/dist/layout/grammar.d.ts +34 -0
- package/dist/layout/grammar.d.ts.map +1 -0
- package/dist/layout/grammar.js +171 -0
- package/dist/layout/grammar.js.map +1 -0
- package/dist/layout/read.d.ts +54 -0
- package/dist/layout/read.d.ts.map +1 -0
- package/dist/layout/read.js +101 -0
- package/dist/layout/read.js.map +1 -0
- package/dist/layout/shape.d.ts +34 -0
- package/dist/layout/shape.d.ts.map +1 -0
- package/dist/layout/shape.js +149 -0
- package/dist/layout/shape.js.map +1 -0
- package/dist/messages/compile.d.ts +47 -0
- package/dist/messages/compile.d.ts.map +1 -0
- package/dist/messages/compile.js +202 -0
- package/dist/messages/compile.js.map +1 -0
- package/dist/messages/locale.d.ts +18 -0
- package/dist/messages/locale.d.ts.map +1 -0
- package/dist/messages/locale.js +33 -0
- package/dist/messages/locale.js.map +1 -0
- package/dist/messages/slots.d.ts +54 -0
- package/dist/messages/slots.d.ts.map +1 -0
- package/dist/messages/slots.js +137 -0
- package/dist/messages/slots.js.map +1 -0
- package/dist/overlay/compile-overlay.d.ts +29 -0
- package/dist/overlay/compile-overlay.d.ts.map +1 -0
- package/dist/overlay/compile-overlay.js +120 -0
- package/dist/overlay/compile-overlay.js.map +1 -0
- package/dist/overlay/compose.d.ts +26 -0
- package/dist/overlay/compose.d.ts.map +1 -0
- package/dist/overlay/compose.js +674 -0
- package/dist/overlay/compose.js.map +1 -0
- package/dist/overlay/types.d.ts +41 -0
- package/dist/overlay/types.d.ts.map +1 -0
- package/dist/overlay/types.js +2 -0
- package/dist/overlay/types.js.map +1 -0
- package/dist/publish/classify.d.ts +50 -0
- package/dist/publish/classify.d.ts.map +1 -0
- package/dist/publish/classify.js +85 -0
- package/dist/publish/classify.js.map +1 -0
- package/dist/publish/environment.d.ts +15 -0
- package/dist/publish/environment.d.ts.map +1 -0
- package/dist/publish/environment.js +2 -0
- package/dist/publish/environment.js.map +1 -0
- package/dist/publish/migrations.d.ts +108 -0
- package/dist/publish/migrations.d.ts.map +1 -0
- package/dist/publish/migrations.js +166 -0
- package/dist/publish/migrations.js.map +1 -0
- package/dist/publish/observation.d.ts +29 -0
- package/dist/publish/observation.d.ts.map +1 -0
- package/dist/publish/observation.js +43 -0
- package/dist/publish/observation.js.map +1 -0
- package/dist/publish/readiness.d.ts +197 -0
- package/dist/publish/readiness.d.ts.map +1 -0
- package/dist/publish/readiness.js +239 -0
- package/dist/publish/readiness.js.map +1 -0
- package/dist/publish/vectors.d.ts +50 -0
- package/dist/publish/vectors.d.ts.map +1 -0
- package/dist/publish/vectors.js +306 -0
- package/dist/publish/vectors.js.map +1 -0
- package/dist/publish/verify.d.ts +146 -0
- package/dist/publish/verify.d.ts.map +1 -0
- package/dist/publish/verify.js +548 -0
- package/dist/publish/verify.js.map +1 -0
- package/dist/scenarios/branch.d.ts +36 -0
- package/dist/scenarios/branch.d.ts.map +1 -0
- package/dist/scenarios/branch.js +30 -0
- package/dist/scenarios/branch.js.map +1 -0
- package/dist/scenarios/capture.d.ts +89 -0
- package/dist/scenarios/capture.d.ts.map +1 -0
- package/dist/scenarios/capture.js +443 -0
- package/dist/scenarios/capture.js.map +1 -0
- package/dist/scenarios/classifier.d.ts +20 -0
- package/dist/scenarios/classifier.d.ts.map +1 -0
- package/dist/scenarios/classifier.js +88 -0
- package/dist/scenarios/classifier.js.map +1 -0
- package/dist/scenarios/credit.d.ts +33 -0
- package/dist/scenarios/credit.d.ts.map +1 -0
- package/dist/scenarios/credit.js +330 -0
- package/dist/scenarios/credit.js.map +1 -0
- package/dist/scenarios/csv.d.ts +34 -0
- package/dist/scenarios/csv.d.ts.map +1 -0
- package/dist/scenarios/csv.js +1047 -0
- package/dist/scenarios/csv.js.map +1 -0
- package/dist/scenarios/data-identity.d.ts +39 -0
- package/dist/scenarios/data-identity.d.ts.map +1 -0
- package/dist/scenarios/data-identity.js +28 -0
- package/dist/scenarios/data-identity.js.map +1 -0
- package/dist/scenarios/document.d.ts +148 -0
- package/dist/scenarios/document.d.ts.map +1 -0
- package/dist/scenarios/document.js +513 -0
- package/dist/scenarios/document.js.map +1 -0
- package/dist/scenarios/environment.d.ts +64 -0
- package/dist/scenarios/environment.d.ts.map +1 -0
- package/dist/scenarios/environment.js +106 -0
- package/dist/scenarios/environment.js.map +1 -0
- package/dist/scenarios/evidence.d.ts +128 -0
- package/dist/scenarios/evidence.d.ts.map +1 -0
- package/dist/scenarios/evidence.js +179 -0
- package/dist/scenarios/evidence.js.map +1 -0
- package/dist/scenarios/expectations.d.ts +63 -0
- package/dist/scenarios/expectations.d.ts.map +1 -0
- package/dist/scenarios/expectations.js +490 -0
- package/dist/scenarios/expectations.js.map +1 -0
- package/dist/scenarios/references.d.ts +15 -0
- package/dist/scenarios/references.d.ts.map +1 -0
- package/dist/scenarios/references.js +239 -0
- package/dist/scenarios/references.js.map +1 -0
- package/dist/scenarios/report.d.ts +216 -0
- package/dist/scenarios/report.d.ts.map +1 -0
- package/dist/scenarios/report.js +54 -0
- package/dist/scenarios/report.js.map +1 -0
- package/dist/scenarios/runner.d.ts +55 -0
- package/dist/scenarios/runner.d.ts.map +1 -0
- package/dist/scenarios/runner.js +205 -0
- package/dist/scenarios/runner.js.map +1 -0
- package/dist/scenarios/vocabulary.d.ts +19 -0
- package/dist/scenarios/vocabulary.d.ts.map +1 -0
- package/dist/scenarios/vocabulary.js +56 -0
- package/dist/scenarios/vocabulary.js.map +1 -0
- package/dist/schema/catalogue.d.ts +54 -0
- package/dist/schema/catalogue.d.ts.map +1 -0
- package/dist/schema/catalogue.js +221 -0
- package/dist/schema/catalogue.js.map +1 -0
- package/dist/schema/check.d.ts +22 -0
- package/dist/schema/check.d.ts.map +1 -0
- package/dist/schema/check.js +30 -0
- package/dist/schema/check.js.map +1 -0
- package/dist/schema/closed.d.ts +19 -0
- package/dist/schema/closed.d.ts.map +1 -0
- package/dist/schema/closed.js +33 -0
- package/dist/schema/closed.js.map +1 -0
- package/dist/schema/collapse.d.ts +27 -0
- package/dist/schema/collapse.d.ts.map +1 -0
- package/dist/schema/collapse.js +143 -0
- package/dist/schema/collapse.js.map +1 -0
- package/dist/schema/controls.d.ts +46 -0
- package/dist/schema/controls.d.ts.map +1 -0
- package/dist/schema/controls.js +75 -0
- package/dist/schema/controls.js.map +1 -0
- package/dist/schema/dataset-declaration.d.ts +11 -0
- package/dist/schema/dataset-declaration.d.ts.map +1 -0
- package/dist/schema/dataset-declaration.js +11 -0
- package/dist/schema/dataset-declaration.js.map +1 -0
- package/dist/schema/declaration-warnings.d.ts +14 -0
- package/dist/schema/declaration-warnings.d.ts.map +1 -0
- package/dist/schema/declaration-warnings.js +77 -0
- package/dist/schema/declaration-warnings.js.map +1 -0
- package/dist/schema/declarations.d.ts +41 -0
- package/dist/schema/declarations.d.ts.map +1 -0
- package/dist/schema/declarations.js +1299 -0
- package/dist/schema/declarations.js.map +1 -0
- package/dist/schema/diagnostic.d.ts +118 -0
- package/dist/schema/diagnostic.d.ts.map +1 -0
- package/dist/schema/diagnostic.js +39 -0
- package/dist/schema/diagnostic.js.map +1 -0
- package/dist/schema/document.d.ts +93 -0
- package/dist/schema/document.d.ts.map +1 -0
- package/dist/schema/document.js +507 -0
- package/dist/schema/document.js.map +1 -0
- package/dist/schema/fields.d.ts +11 -0
- package/dist/schema/fields.d.ts.map +1 -0
- package/dist/schema/fields.js +265 -0
- package/dist/schema/fields.js.map +1 -0
- package/dist/schema/gates.d.ts +4 -0
- package/dist/schema/gates.d.ts.map +1 -0
- package/dist/schema/gates.js +68 -0
- package/dist/schema/gates.js.map +1 -0
- package/dist/schema/located.d.ts +27 -0
- package/dist/schema/located.d.ts.map +1 -0
- package/dist/schema/located.js +56 -0
- package/dist/schema/located.js.map +1 -0
- package/dist/schema/measurement.d.ts +9 -0
- package/dist/schema/measurement.d.ts.map +1 -0
- package/dist/schema/measurement.js +38 -0
- package/dist/schema/measurement.js.map +1 -0
- package/dist/schema/member-wording.d.ts +35 -0
- package/dist/schema/member-wording.d.ts.map +1 -0
- package/dist/schema/member-wording.js +286 -0
- package/dist/schema/member-wording.js.map +1 -0
- package/dist/schema/metaschema.d.ts +20 -0
- package/dist/schema/metaschema.d.ts.map +1 -0
- package/dist/schema/metaschema.js +476 -0
- package/dist/schema/metaschema.js.map +1 -0
- package/dist/schema/pointer.d.ts +31 -0
- package/dist/schema/pointer.d.ts.map +1 -0
- package/dist/schema/pointer.js +73 -0
- package/dist/schema/pointer.js.map +1 -0
- package/dist/schema/primary.d.ts +29 -0
- package/dist/schema/primary.d.ts.map +1 -0
- package/dist/schema/primary.js +48 -0
- package/dist/schema/primary.js.map +1 -0
- package/dist/schema/publish-vector.d.ts +17 -0
- package/dist/schema/publish-vector.d.ts.map +1 -0
- package/dist/schema/publish-vector.js +34 -0
- package/dist/schema/publish-vector.js.map +1 -0
- package/dist/schema/repair.d.ts +34 -0
- package/dist/schema/repair.d.ts.map +1 -0
- package/dist/schema/repair.js +163 -0
- package/dist/schema/repair.js.map +1 -0
- package/dist/schema/schema-v1.generated.d.ts +14 -0
- package/dist/schema/schema-v1.generated.d.ts.map +1 -0
- package/dist/schema/schema-v1.generated.js +7089 -0
- package/dist/schema/schema-v1.generated.js.map +1 -0
- package/dist/schema/screens.d.ts +4 -0
- package/dist/schema/screens.d.ts.map +1 -0
- package/dist/schema/screens.js +28 -0
- package/dist/schema/screens.js.map +1 -0
- package/dist/schema/test-values.d.ts +12 -0
- package/dist/schema/test-values.d.ts.map +1 -0
- package/dist/schema/test-values.js +97 -0
- package/dist/schema/test-values.js.map +1 -0
- package/dist/schema/unions.d.ts +46 -0
- package/dist/schema/unions.d.ts.map +1 -0
- package/dist/schema/unions.js +131 -0
- package/dist/schema/unions.js.map +1 -0
- package/dist/schema/validate-yaml.d.ts +14 -0
- package/dist/schema/validate-yaml.d.ts.map +1 -0
- package/dist/schema/validate-yaml.js +17 -0
- package/dist/schema/validate-yaml.js.map +1 -0
- package/dist/schema/validate.d.ts +46 -0
- package/dist/schema/validate.d.ts.map +1 -0
- package/dist/schema/validate.js +186 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/testing.d.ts +21 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +28 -0
- package/dist/testing.js.map +1 -0
- package/dist/vocabulary.d.ts +6 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +26 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +66 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashes.d.ts","sourceRoot":"","sources":["../../src/compile/hashes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEjE,6FAA6F;AAC7F,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAgBD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,QAAQ,EACd,IAAI,GAAE,cAAc,EAAO,GAC1B,SAAS,cAAc,EAAE,CAiC3B;AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAY3E;AAKD,sEAAsE;AACtE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAG5D;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAEtF;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,CAG/E"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** The signature whose `dataHash` `node` reads, or `undefined` when it reads none. */
|
|
2
|
+
function signatureOf(node) {
|
|
3
|
+
if (node?.kind !== 'path')
|
|
4
|
+
return undefined;
|
|
5
|
+
const segments = node.path.split('.');
|
|
6
|
+
const member = segments[segments.length - 1];
|
|
7
|
+
const owner = segments[segments.length - 2];
|
|
8
|
+
return member === 'dataHash' && owner !== undefined ? { signer: owner } : undefined;
|
|
9
|
+
}
|
|
10
|
+
/** The digest call one side of a comparison is, when it is one. */
|
|
11
|
+
function digestOf(node) {
|
|
12
|
+
return node?.kind === 'call' && node.op === 'digest' ? node : undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Every comparison of a stored signature hash in this slot, with the digest that recomputes it.
|
|
16
|
+
*
|
|
17
|
+
* Only a comparison position is a verification: a digest computed beside one but never compared
|
|
18
|
+
* to a stored hash answers something else. Collecting the pairs — rather than every digest and
|
|
19
|
+
* every signer in the slot — makes the check non-existential, and a comparison that recomputes
|
|
20
|
+
* nothing is itself a defect: nothing then states which targets the value it trusts was computed
|
|
21
|
+
* over, so a digest in another rule could bind anything.
|
|
22
|
+
*/
|
|
23
|
+
export function hashComparisons(node, into = []) {
|
|
24
|
+
switch (node.kind) {
|
|
25
|
+
case 'literal':
|
|
26
|
+
case 'path':
|
|
27
|
+
return into;
|
|
28
|
+
case 'compare': {
|
|
29
|
+
if (node.op === '==') {
|
|
30
|
+
const [left, right] = node.args;
|
|
31
|
+
const signature = signatureOf(right);
|
|
32
|
+
if (signature !== undefined)
|
|
33
|
+
into.push({ digest: digestOf(left), signer: signature.signer });
|
|
34
|
+
else {
|
|
35
|
+
const mirrored = signatureOf(left);
|
|
36
|
+
if (mirrored !== undefined) {
|
|
37
|
+
into.push({ digest: digestOf(right), signer: mirrored.signer });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const arg of node.args)
|
|
42
|
+
hashComparisons(arg, into);
|
|
43
|
+
return into;
|
|
44
|
+
}
|
|
45
|
+
case 'list':
|
|
46
|
+
for (const item of node.items)
|
|
47
|
+
hashComparisons(item, into);
|
|
48
|
+
return into;
|
|
49
|
+
case 'comprehension':
|
|
50
|
+
hashComparisons(node.source, into);
|
|
51
|
+
if (node.valueExpr !== undefined)
|
|
52
|
+
hashComparisons(node.valueExpr, into);
|
|
53
|
+
if (node.predicate !== undefined)
|
|
54
|
+
hashComparisons(node.predicate, into);
|
|
55
|
+
return into;
|
|
56
|
+
default:
|
|
57
|
+
for (const arg of node.args)
|
|
58
|
+
hashComparisons(arg, into);
|
|
59
|
+
return into;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** The `fieldId` each target of a `digest(...)` call binds, in declared order. */
|
|
63
|
+
export function digestTargets(node) {
|
|
64
|
+
const [targets] = node.args;
|
|
65
|
+
if (targets === undefined || targets.kind !== 'list')
|
|
66
|
+
return undefined;
|
|
67
|
+
const fieldIds = [];
|
|
68
|
+
for (const target of targets.items) {
|
|
69
|
+
if (target.kind !== 'path')
|
|
70
|
+
return undefined;
|
|
71
|
+
const segments = target.path.split('.');
|
|
72
|
+
const fieldId = segments[segments.length - 1];
|
|
73
|
+
if (fieldId === undefined)
|
|
74
|
+
return undefined;
|
|
75
|
+
fieldIds.push(fieldId);
|
|
76
|
+
}
|
|
77
|
+
return fieldIds;
|
|
78
|
+
}
|
|
79
|
+
/** The read path that answers this artifact's own schema version. */
|
|
80
|
+
const ARTIFACT_VERSION = 'context.schema_version';
|
|
81
|
+
/** Whether a `digest` binds the artifact's dynamic schema version. */
|
|
82
|
+
export function bindsArtifactVersion(node) {
|
|
83
|
+
const version = node.args[1];
|
|
84
|
+
return version !== undefined && version.kind === 'path' && version.path === ARTIFACT_VERSION;
|
|
85
|
+
}
|
|
86
|
+
/** Whether two coverage lists name the same targets in the same order. */
|
|
87
|
+
export function sameTargets(left, right) {
|
|
88
|
+
return left.length === right.length && left.every((id, index) => id === right[index]);
|
|
89
|
+
}
|
|
90
|
+
/** Every target list one expression's digests bind, rendered for a refusal. */
|
|
91
|
+
export function describeTargets(digests) {
|
|
92
|
+
if (digests.length === 0)
|
|
93
|
+
return 'no declared field';
|
|
94
|
+
return digests.map((targets) => `[${targets.map((id) => `\`${id}\``).join(', ')}]`).join(' and ');
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=hashes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src/compile/hashes.ts"],"names":[],"mappings":"AASA,sFAAsF;AACtF,SAAS,WAAW,CAAC,IAA0B;IAC7C,IAAI,IAAI,EAAE,IAAI,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC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cesContent":["import type { CallNode, ExprNode } from '@azx-pbc/axiom-runtime';\n\n/** An `==` comparison between a recomputed binding and one signature's stored `dataHash`. */\nexport interface HashComparison {\n /** The `digest(...)` call side, when the comparison recomputes one. */\n readonly digest: CallNode | undefined;\n readonly signer: string;\n}\n\n/** The signature whose `dataHash` `node` reads, or `undefined` when it reads none. */\nfunction signatureOf(node: ExprNode | undefined): { readonly signer: string } | undefined {\n if (node?.kind !== 'path') return undefined;\n const segments = node.path.split('.');\n const member = segments[segments.length - 1];\n const owner = segments[segments.length - 2];\n return member === 'dataHash' && owner !== undefined ? { signer: owner } : undefined;\n}\n\n/** The digest call one side of a comparison is, when it is one. */\nfunction digestOf(node: ExprNode | undefined): CallNode | undefined {\n return node?.kind === 'call' && node.op === 'digest' ? node : undefined;\n}\n\n/**\n * Every comparison of a stored signature hash in this slot, with the digest that recomputes it.\n *\n * Only a comparison position is a verification: a digest computed beside one but never compared\n * to a stored hash answers something else. Collecting the pairs — rather than every digest and\n * every signer in the slot — makes the check non-existential, and a comparison that recomputes\n * nothing is itself a defect: nothing then states which targets the value it trusts was computed\n * over, so a digest in another rule could bind anything.\n */\nexport function hashComparisons(\n node: ExprNode,\n into: HashComparison[] = [],\n): readonly HashComparison[] {\n switch (node.kind) {\n case 'literal':\n case 'path':\n return into;\n case 'compare': {\n if (node.op === '==') {\n const [left, right] = node.args;\n const signature = signatureOf(right);\n if (signature !== undefined)\n into.push({ digest: digestOf(left), signer: signature.signer });\n else {\n const mirrored = signatureOf(left);\n if (mirrored !== undefined) {\n into.push({ digest: digestOf(right), signer: mirrored.signer });\n }\n }\n }\n for (const arg of node.args) hashComparisons(arg, into);\n return into;\n }\n case 'list':\n for (const item of node.items) hashComparisons(item, into);\n return into;\n case 'comprehension':\n hashComparisons(node.source, into);\n if (node.valueExpr !== undefined) hashComparisons(node.valueExpr, into);\n if (node.predicate !== undefined) hashComparisons(node.predicate, into);\n return into;\n default:\n for (const arg of node.args) hashComparisons(arg, into);\n return into;\n }\n}\n\n/** The `fieldId` each target of a `digest(...)` call binds, in declared order. */\nexport function digestTargets(node: CallNode): readonly string[] | undefined {\n const [targets] = node.args;\n if (targets === undefined || targets.kind !== 'list') return undefined;\n const fieldIds: string[] = [];\n for (const target of targets.items) {\n if (target.kind !== 'path') return undefined;\n const segments = target.path.split('.');\n const fieldId = segments[segments.length - 1];\n if (fieldId === undefined) return undefined;\n fieldIds.push(fieldId);\n }\n return fieldIds;\n}\n\n/** The read path that answers this artifact's own schema version. */\nconst ARTIFACT_VERSION = 'context.schema_version';\n\n/** Whether a `digest` binds the artifact's dynamic schema version. */\nexport function bindsArtifactVersion(node: CallNode): boolean {\n const version = node.args[1];\n return version !== undefined && version.kind === 'path' && version.path === ARTIFACT_VERSION;\n}\n\n/** Whether two coverage lists name the same targets in the same order. */\nexport function sameTargets(left: readonly string[], right: readonly string[]): boolean {\n return left.length === right.length && left.every((id, index) => id === right[index]);\n}\n\n/** Every target list one expression's digests bind, rendered for a refusal. */\nexport function describeTargets(digests: readonly (readonly string[])[]): string {\n if (digests.length === 0) return 'no declared field';\n return digests.map((targets) => `[${targets.map((id) => `\\`${id}\\``).join(', ')}]`).join(' and ');\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Compilation } from './compilation.js';
|
|
2
|
+
import type { CompiledRuleEntry } from './rules.js';
|
|
3
|
+
/**
|
|
4
|
+
* Refuses a writer, `required` or `enabled` rule whose transitive read set contains its own
|
|
5
|
+
* target, `RULES-5.1.3`.
|
|
6
|
+
*
|
|
7
|
+
* Reads are followed through the other computed fields: one rule's target is another's read,
|
|
8
|
+
* so a cycle can be two rules long or longer, and naming the chain tells an author which
|
|
9
|
+
* declaration to change.
|
|
10
|
+
*/
|
|
11
|
+
export declare function crossCheckItemTargets(compilation: Compilation, entries: readonly CompiledRuleEntry[]): void;
|
|
12
|
+
//# sourceMappingURL=item-targets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-targets.d.ts","sourceRoot":"","sources":["../../src/compile/item-targets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAoOpD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,SAAS,iBAAiB,EAAE,GACpC,IAAI,CA+FN"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { ruleTargets } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { refuse } from './compilation.js';
|
|
3
|
+
/**
|
|
4
|
+
* The self-reference refusal a writer, `required` or `enabled` rule receives,
|
|
5
|
+
* `spec/semantics/rules-v1.md` `RULES-5.1.3`.
|
|
6
|
+
*
|
|
7
|
+
* A writer that reads the member it writes has no first value, a `required` rule satisfied
|
|
8
|
+
* exactly when its target is present can never fail, and an `enabled` rule reading its target
|
|
9
|
+
* self-locks the control. One code covers all three, and the detail states which repair the
|
|
10
|
+
* kind needs. A `validate` rule is exempt: reading the value it judges is its function.
|
|
11
|
+
*
|
|
12
|
+
* The clause names the read shapes it refuses: the target "directly, through a bare `$it`,
|
|
13
|
+
* `$prev` or `$next`, or through another computed value". A member read on `$prev`/`$next` is
|
|
14
|
+
* the *sibling* row's value, so it names no part of this row and cannot be a read of this
|
|
15
|
+
* row's target. A member written by another writer is followed to the reads that produce it,
|
|
16
|
+
* because a writer that reaches its target through another computed member has the same
|
|
17
|
+
* first-value problem.
|
|
18
|
+
*/
|
|
19
|
+
/** The binders an item-scoped rule reads its own row through. */
|
|
20
|
+
const ROW_BINDERS = new Set(['$it', '$prev', '$next']);
|
|
21
|
+
/** The repair the writer and control kinds need, `RULES-5.1.3`. */
|
|
22
|
+
const SELF_READ_REPAIR = {
|
|
23
|
+
compute: { verb: 'written', repair: 'derive the value from other fields' },
|
|
24
|
+
defaultCompute: { verb: 'written', repair: 'derive the value from other fields' },
|
|
25
|
+
enabled: {
|
|
26
|
+
verb: 'enabled',
|
|
27
|
+
repair: 'this can self-lock the control, so base the condition on other fields',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
function isSelfReadingKind(kind) {
|
|
31
|
+
return (kind === 'compute' || kind === 'defaultCompute' || kind === 'required' || kind === 'enabled');
|
|
32
|
+
}
|
|
33
|
+
/** Reports every path one expression slot reads through the enclosing item row's binders. */
|
|
34
|
+
function visitPaths(node, into, itemRowInScope = true) {
|
|
35
|
+
switch (node.kind) {
|
|
36
|
+
case 'path':
|
|
37
|
+
if (itemRowInScope)
|
|
38
|
+
into(node.path);
|
|
39
|
+
return;
|
|
40
|
+
case 'literal':
|
|
41
|
+
return;
|
|
42
|
+
case 'list':
|
|
43
|
+
for (const item of node.items)
|
|
44
|
+
visitPaths(item, into, itemRowInScope);
|
|
45
|
+
return;
|
|
46
|
+
case 'comprehension':
|
|
47
|
+
visitPaths(node.source, into, itemRowInScope);
|
|
48
|
+
// A comprehension rebinds `$it`, `$prev` and `$next` to its own elements. Only its
|
|
49
|
+
// source still reads through the enclosing item rule's row.
|
|
50
|
+
if (node.valueExpr !== undefined)
|
|
51
|
+
visitPaths(node.valueExpr, into, false);
|
|
52
|
+
if (node.predicate !== undefined)
|
|
53
|
+
visitPaths(node.predicate, into, false);
|
|
54
|
+
return;
|
|
55
|
+
default:
|
|
56
|
+
for (const arg of node.args)
|
|
57
|
+
visitPaths(arg, into, itemRowInScope);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Reports every path one expression reads, including those under a comprehension's binders. */
|
|
61
|
+
function visitEveryPath(node, into) {
|
|
62
|
+
switch (node.kind) {
|
|
63
|
+
case 'path':
|
|
64
|
+
into(node.path);
|
|
65
|
+
return;
|
|
66
|
+
case 'literal':
|
|
67
|
+
return;
|
|
68
|
+
case 'list':
|
|
69
|
+
for (const item of node.items)
|
|
70
|
+
visitEveryPath(item, into);
|
|
71
|
+
return;
|
|
72
|
+
case 'comprehension':
|
|
73
|
+
visitEveryPath(node.source, into);
|
|
74
|
+
// A comprehension rebinds `$it`, `$prev` and `$next`, but a path with another head
|
|
75
|
+
// inside its body is still a read of the enclosing slot's declarations.
|
|
76
|
+
if (node.valueExpr !== undefined)
|
|
77
|
+
visitEveryPath(node.valueExpr, into);
|
|
78
|
+
if (node.predicate !== undefined)
|
|
79
|
+
visitEveryPath(node.predicate, into);
|
|
80
|
+
return;
|
|
81
|
+
default:
|
|
82
|
+
for (const arg of node.args)
|
|
83
|
+
visitEveryPath(arg, into);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The first read of `target` reachable from a `required` condition, following the non-item
|
|
88
|
+
* computed fields it names.
|
|
89
|
+
*
|
|
90
|
+
* A condition that reads `f_total`, where `f_total` is computed from `f_target`, still depends
|
|
91
|
+
* on the field it makes required; `RULES-5.1.3` refuses the transitive read, so the chain is
|
|
92
|
+
* followed the same way the item scope follows its computed members.
|
|
93
|
+
*/
|
|
94
|
+
function conditionReadOf(compilation, entry, target, writers) {
|
|
95
|
+
const queue = [
|
|
96
|
+
{ entry, trail: [] },
|
|
97
|
+
];
|
|
98
|
+
const seen = new Set();
|
|
99
|
+
while (queue.length > 0) {
|
|
100
|
+
const hop = queue.shift();
|
|
101
|
+
if (hop === undefined)
|
|
102
|
+
break;
|
|
103
|
+
if (seen.has(hop.entry))
|
|
104
|
+
continue;
|
|
105
|
+
seen.add(hop.entry);
|
|
106
|
+
for (const slot of hop.entry.slots) {
|
|
107
|
+
if (!slot.path.endsWith('.expr'))
|
|
108
|
+
continue;
|
|
109
|
+
let direct;
|
|
110
|
+
visitEveryPath(slot.node, (path) => {
|
|
111
|
+
if (direct !== undefined)
|
|
112
|
+
return;
|
|
113
|
+
if (path === target) {
|
|
114
|
+
direct = path;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const fieldId = compilation.declaredFieldPaths.get(path)?.fieldId;
|
|
118
|
+
const writer = fieldId === undefined ? undefined : writers.get(fieldId);
|
|
119
|
+
if (writer !== undefined && !seen.has(writer)) {
|
|
120
|
+
queue.push({ entry: writer, trail: [...hop.trail, writer.rule.ruleId] });
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
if (direct !== undefined)
|
|
124
|
+
return { read: direct, trail: hop.trail };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
/** The row members an item rule's expression slots read through its own row binders. */
|
|
130
|
+
function rowReads(slots) {
|
|
131
|
+
const wholeRow = [];
|
|
132
|
+
const members = new Map();
|
|
133
|
+
const classify = (path) => {
|
|
134
|
+
const [head, member] = path.split('.');
|
|
135
|
+
if (head === undefined || !ROW_BINDERS.has(head))
|
|
136
|
+
return;
|
|
137
|
+
if (member === undefined) {
|
|
138
|
+
wholeRow.push(path);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// Only `$it` names this rule's own row. `$prev`/`$next` name the sibling row, so a member
|
|
142
|
+
// read on them is that row's value and never this row's target.
|
|
143
|
+
if (head !== '$it')
|
|
144
|
+
return;
|
|
145
|
+
if (!members.has(member))
|
|
146
|
+
members.set(member, path);
|
|
147
|
+
};
|
|
148
|
+
for (const slot of slots)
|
|
149
|
+
visitPaths(slot.node, classify);
|
|
150
|
+
return { wholeRow, members };
|
|
151
|
+
}
|
|
152
|
+
/** The key an `item` writer is found by: the array and the row member it writes. */
|
|
153
|
+
function writerKey(arrayFieldId, targetFieldId) {
|
|
154
|
+
return `${arrayFieldId}\u0000${targetFieldId}`;
|
|
155
|
+
}
|
|
156
|
+
/** The read chain, rendered for the refusal a self-reading rule receives. */
|
|
157
|
+
function describeChain(hop, writerId, writerPath) {
|
|
158
|
+
const followed = hop.trail.length === 0
|
|
159
|
+
? ''
|
|
160
|
+
: ` through ${hop.trail.map((id) => `rule \`${id}\``).join(', then ')}`;
|
|
161
|
+
return `\`${hop.path}\`${followed}, which rule \`${writerId}\` writes from \`${writerPath}\``;
|
|
162
|
+
}
|
|
163
|
+
/** Refuses a `required` rule whose condition reads the field it makes required. */
|
|
164
|
+
function refuseRequiredSelfRead(compilation, entry, targetFieldId, read) {
|
|
165
|
+
refuse(compilation, 'CYCLE_DETECTED', `$.rules[${String(entry.index)}].expr`, `rule \`${entry.rule.ruleId}\` requires \`${targetFieldId}\` under a condition that reads ${read}; a \`required\` rule's \`expr\` is the condition under which the field is required, and the engine decides presence itself, so a condition reading the field can never make it required; write \`true\` for an unconditional requirement, or a condition over sibling fields`);
|
|
166
|
+
}
|
|
167
|
+
/** Refuses one rule whose read set reaches its own target. */
|
|
168
|
+
function refuseSelfRead(compilation, entry, kind, targetFieldId, read) {
|
|
169
|
+
if (kind === 'required') {
|
|
170
|
+
refuseRequiredSelfRead(compilation, entry, targetFieldId, read);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const rule = entry.rule;
|
|
174
|
+
const repair = SELF_READ_REPAIR[kind];
|
|
175
|
+
refuse(compilation, 'CYCLE_DETECTED', `$.rules[${String(entry.index)}].expr`, `rule \`${rule.ruleId}\` reads its ${repair.verb} target \`${targetFieldId}\` through ${read}; a rule that reads what it writes or constrains has no value to start from — ${repair.repair}`);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Refuses a writer, `required` or `enabled` rule whose transitive read set contains its own
|
|
179
|
+
* target, `RULES-5.1.3`.
|
|
180
|
+
*
|
|
181
|
+
* Reads are followed through the other computed fields: one rule's target is another's read,
|
|
182
|
+
* so a cycle can be two rules long or longer, and naming the chain tells an author which
|
|
183
|
+
* declaration to change.
|
|
184
|
+
*/
|
|
185
|
+
export function crossCheckItemTargets(compilation, entries) {
|
|
186
|
+
// A `required` rule's `expr` is the condition under which the field is required, at every
|
|
187
|
+
// scope: the engine decides presence itself (`eval/state/field-state.ts`). A condition that
|
|
188
|
+
// reads its own target therefore never makes the field required, and `true` is the spelling
|
|
189
|
+
// of an unconditional requirement. An `enabled` rule that reads its target is the self-lock
|
|
190
|
+
// `RULES-2.1.6` names. The item scope is handled below through its row binders; here the
|
|
191
|
+
// read chain follows the document's non-item computed fields.
|
|
192
|
+
const fieldWriters = new Map();
|
|
193
|
+
for (const entry of entries) {
|
|
194
|
+
const rule = entry.rule;
|
|
195
|
+
if (rule.scope === 'item')
|
|
196
|
+
continue;
|
|
197
|
+
if (rule.kind !== 'compute' && rule.kind !== 'defaultCompute')
|
|
198
|
+
continue;
|
|
199
|
+
if (rule.fieldId === undefined)
|
|
200
|
+
continue;
|
|
201
|
+
fieldWriters.set(rule.fieldId, entry);
|
|
202
|
+
}
|
|
203
|
+
for (const entry of entries) {
|
|
204
|
+
const rule = entry.rule;
|
|
205
|
+
if (rule.kind !== 'required' && rule.kind !== 'enabled')
|
|
206
|
+
continue;
|
|
207
|
+
if (rule.scope === 'item')
|
|
208
|
+
continue;
|
|
209
|
+
for (const target of ruleTargets(rule)) {
|
|
210
|
+
const chain = conditionReadOf(compilation, entry, target, fieldWriters);
|
|
211
|
+
if (chain === undefined)
|
|
212
|
+
continue;
|
|
213
|
+
const followed = chain.trail.length === 0
|
|
214
|
+
? ''
|
|
215
|
+
: ` through ${chain.trail.map((id) => `rule \`${id}\``).join(', then ')}`;
|
|
216
|
+
if (rule.kind === 'required') {
|
|
217
|
+
refuseRequiredSelfRead(compilation, entry, target, `\`${chain.read}\`${followed}`);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
refuseSelfRead(compilation, entry, 'enabled', target, `\`${chain.read}\`${followed}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// Only a computed member has a writer to follow: a `required`, `enabled` or `validate`
|
|
224
|
+
// member is supplied rather than produced, so a read of it ends the chain.
|
|
225
|
+
const writers = new Map();
|
|
226
|
+
for (const entry of entries) {
|
|
227
|
+
const rule = entry.rule;
|
|
228
|
+
if (rule.scope !== 'item')
|
|
229
|
+
continue;
|
|
230
|
+
if (rule.kind !== 'compute' && rule.kind !== 'defaultCompute')
|
|
231
|
+
continue;
|
|
232
|
+
if (rule.fieldId === undefined || rule.targetFieldId === undefined)
|
|
233
|
+
continue;
|
|
234
|
+
writers.set(writerKey(rule.fieldId, rule.targetFieldId), entry);
|
|
235
|
+
}
|
|
236
|
+
for (const entry of entries) {
|
|
237
|
+
const rule = entry.rule;
|
|
238
|
+
if (rule.scope !== 'item' || rule.fieldId === undefined)
|
|
239
|
+
continue;
|
|
240
|
+
if (!isSelfReadingKind(rule.kind) || rule.targetFieldId === undefined)
|
|
241
|
+
continue;
|
|
242
|
+
const target = rule.targetFieldId;
|
|
243
|
+
const own = rowReads(entry.slots);
|
|
244
|
+
const direct = own.members.get(target);
|
|
245
|
+
if (direct !== undefined) {
|
|
246
|
+
refuseSelfRead(compilation, entry, rule.kind, target, `\`${direct}\``);
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
if (own.wholeRow[0] !== undefined) {
|
|
250
|
+
refuseSelfRead(compilation, entry, rule.kind, target, `\`${own.wholeRow[0]}\``);
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
// Follow computed members breadth first, so the chain named is the shortest one that
|
|
254
|
+
// reaches the target and a member is followed once.
|
|
255
|
+
const queue = [...own.members].map(([member, path]) => ({
|
|
256
|
+
path,
|
|
257
|
+
member,
|
|
258
|
+
trail: [],
|
|
259
|
+
}));
|
|
260
|
+
const seen = new Set();
|
|
261
|
+
let refused = false;
|
|
262
|
+
while (queue.length > 0 && !refused) {
|
|
263
|
+
const hop = queue.shift();
|
|
264
|
+
if (hop === undefined)
|
|
265
|
+
break;
|
|
266
|
+
if (seen.has(hop.member))
|
|
267
|
+
continue;
|
|
268
|
+
seen.add(hop.member);
|
|
269
|
+
const writer = writers.get(writerKey(rule.fieldId, hop.member));
|
|
270
|
+
if (writer === undefined)
|
|
271
|
+
continue;
|
|
272
|
+
const produced = rowReads(writer.slots);
|
|
273
|
+
const writerReadsTarget = produced.members.get(target) ?? produced.wholeRow[0];
|
|
274
|
+
if (writerReadsTarget !== undefined) {
|
|
275
|
+
refuseSelfRead(compilation, entry, rule.kind, target, describeChain(hop, writer.rule.ruleId, writerReadsTarget));
|
|
276
|
+
refused = true;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
for (const [member, path] of produced.members) {
|
|
280
|
+
if (seen.has(member))
|
|
281
|
+
continue;
|
|
282
|
+
queue.push({ path, member, trail: [...hop.trail, writer.rule.ruleId] });
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=item-targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-targets.js","sourceRoot":"","sources":["../../src/compile/item-targets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C;;;;;;;;;;;;;;;GAeG;AAEH,iEAAiE;AACjE,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAK5E,mEAAmE;AACnE,MAAM,gBAAgB,GAAG;IACvB,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,oCAAoC,EAAE;IAC1E,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,oCAAoC,EAAE;IACjF,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,uEAAuE;KAChF;CAIF,CAAC;AAEF,SAAS,iBAAiB,CAAC,IAAc;IACvC,OAAO,CACL,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,gBAAgB,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,SAAS,CAC7F,CAAC;AACJ,CAAC;AAUD,6FAA6F;AAC7F,SAAS,UAAU,CAAC,IAAc,EAAE,IAA4B,EAAE,cA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C,MAAM,CAAC;oBAAE,SAAS;gBAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { ExprNode, RuleKind } from '@azx-pbc/axiom-runtime';\nimport { ruleTargets } from '@azx-pbc/axiom-runtime';\nimport type { Compilation } from './compilation.js';\nimport { refuse } from './compilation.js';\nimport type { CompiledRuleEntry } from './rules.js';\n\n/**\n * The self-reference refusal a writer, `required` or `enabled` rule receives,\n * `spec/semantics/rules-v1.md` `RULES-5.1.3`.\n *\n * A writer that reads the member it writes has no first value, a `required` rule satisfied\n * exactly when its target is present can never fail, and an `enabled` rule reading its target\n * self-locks the control. One code covers all three, and the detail states which repair the\n * kind needs. A `validate` rule is exempt: reading the value it judges is its function.\n *\n * The clause names the read shapes it refuses: the target \"directly, through a bare `$it`,\n * `$prev` or `$next`, or through another computed value\". A member read on `$prev`/`$next` is\n * the *sibling* row's value, so it names no part of this row and cannot be a read of this\n * row's target. A member written by another writer is followed to the reads that produce it,\n * because a writer that reaches its target through another computed member has the same\n * first-value problem.\n */\n\n/** The binders an item-scoped rule reads its own row through. */\nconst ROW_BINDERS: ReadonlySet<string> = new Set(['$it', '$prev', '$next']);\n\n/** The rule kinds `RULES-5.1.3` refuses when their read set reaches their own target. */\ntype SelfReadingKind = 'compute' | 'defaultCompute' | 'required' | 'enabled';\n\n/** The repair the writer and control kinds need, `RULES-5.1.3`. */\nconst SELF_READ_REPAIR = {\n compute: { verb: 'written', repair: 'derive the value from other fields' },\n defaultCompute: { verb: 'written', repair: 'derive the value from other fields' },\n enabled: {\n verb: 'enabled',\n repair: 'this can self-lock the control, so base the condition on other fields',\n },\n} as const satisfies Record<\n Exclude<SelfReadingKind, 'required'>,\n { readonly verb: string; readonly repair: string }\n>;\n\nfunction isSelfReadingKind(kind: RuleKind): kind is SelfReadingKind {\n return (\n kind === 'compute' || kind === 'defaultCompute' || kind === 'required' || kind === 'enabled'\n );\n}\n\n/** The row members one item rule's expressions read, with the path that read each. */\ninterface RowReads {\n /** The paths that read every row member: a bare `$it`, `$prev` or `$next`. */\n readonly wholeRow: readonly string[];\n /** Each direct member the row binders read, with the first path that read it. */\n readonly members: ReadonlyMap<string, string>;\n}\n\n/** Reports every path one expression slot reads through the enclosing item row's binders. */\nfunction visitPaths(node: ExprNode, into: (path: string) => void, itemRowInScope = true): void {\n switch (node.kind) {\n case 'path':\n if (itemRowInScope) into(node.path);\n return;\n case 'literal':\n return;\n case 'list':\n for (const item of node.items) visitPaths(item, into, itemRowInScope);\n return;\n case 'comprehension':\n visitPaths(node.source, into, itemRowInScope);\n // A comprehension rebinds `$it`, `$prev` and `$next` to its own elements. Only its\n // source still reads through the enclosing item rule's row.\n if (node.valueExpr !== undefined) visitPaths(node.valueExpr, into, false);\n if (node.predicate !== undefined) visitPaths(node.predicate, into, false);\n return;\n default:\n for (const arg of node.args) visitPaths(arg, into, itemRowInScope);\n }\n}\n\n/** Reports every path one expression reads, including those under a comprehension's binders. */\nfunction visitEveryPath(node: ExprNode, into: (path: string) => void): void {\n switch (node.kind) {\n case 'path':\n into(node.path);\n return;\n case 'literal':\n return;\n case 'list':\n for (const item of node.items) visitEveryPath(item, into);\n return;\n case 'comprehension':\n visitEveryPath(node.source, into);\n // A comprehension rebinds `$it`, `$prev` and `$next`, but a path with another head\n // inside its body is still a read of the enclosing slot's declarations.\n if (node.valueExpr !== undefined) visitEveryPath(node.valueExpr, into);\n if (node.predicate !== undefined) visitEveryPath(node.predicate, into);\n return;\n default:\n for (const arg of node.args) visitEveryPath(arg, into);\n }\n}\n\n/** One step of a condition's read chain: the path read and the computed rules it followed. */\ninterface ConditionRead {\n readonly read: string;\n /** The computed rules followed to reach the read, oldest first. */\n readonly trail: readonly string[];\n}\n\n/**\n * The first read of `target` reachable from a `required` condition, following the non-item\n * computed fields it names.\n *\n * A condition that reads `f_total`, where `f_total` is computed from `f_target`, still depends\n * on the field it makes required; `RULES-5.1.3` refuses the transitive read, so the chain is\n * followed the same way the item scope follows its computed members.\n */\nfunction conditionReadOf(\n compilation: Compilation,\n entry: CompiledRuleEntry,\n target: string,\n writers: ReadonlyMap<string, CompiledRuleEntry>,\n): ConditionRead | undefined {\n const queue: { readonly entry: CompiledRuleEntry; readonly trail: readonly string[] }[] = [\n { entry, trail: [] },\n ];\n const seen = new Set<CompiledRuleEntry>();\n while (queue.length > 0) {\n const hop = queue.shift();\n if (hop === undefined) break;\n if (seen.has(hop.entry)) continue;\n seen.add(hop.entry);\n for (const slot of hop.entry.slots) {\n if (!slot.path.endsWith('.expr')) continue;\n let direct: string | undefined;\n visitEveryPath(slot.node, (path) => {\n if (direct !== undefined) return;\n if (path === target) {\n direct = path;\n return;\n }\n const fieldId = compilation.declaredFieldPaths.get(path)?.fieldId;\n const writer = fieldId === undefined ? undefined : writers.get(fieldId);\n if (writer !== undefined && !seen.has(writer)) {\n queue.push({ entry: writer, trail: [...hop.trail, writer.rule.ruleId] });\n }\n });\n if (direct !== undefined) return { read: direct, trail: hop.trail };\n }\n }\n return undefined;\n}\n\n/** The row members an item rule's expression slots read through its own row binders. */\nfunction rowReads(slots: CompiledRuleEntry['slots']): RowReads {\n const wholeRow: string[] = [];\n const members = new Map<string, string>();\n const classify = (path: string): void => {\n const [head, member] = path.split('.');\n if (head === undefined || !ROW_BINDERS.has(head)) return;\n if (member === undefined) {\n wholeRow.push(path);\n return;\n }\n // Only `$it` names this rule's own row. `$prev`/`$next` name the sibling row, so a member\n // read on them is that row's value and never this row's target.\n if (head !== '$it') return;\n if (!members.has(member)) members.set(member, path);\n };\n for (const slot of slots) visitPaths(slot.node, classify);\n return { wholeRow, members };\n}\n\n/** The key an `item` writer is found by: the array and the row member it writes. */\nfunction writerKey(arrayFieldId: string, targetFieldId: string): string {\n return `${arrayFieldId}\\u0000${targetFieldId}`;\n}\n\n/** One step of a read chain: the path read and, where a rule writes it, that rule. */\ninterface ReadHop {\n readonly path: string;\n readonly member: string;\n /** The chain of rules already followed to reach this read, oldest first. */\n readonly trail: readonly string[];\n}\n\n/** The read chain, rendered for the refusal a self-reading rule receives. */\nfunction describeChain(hop: ReadHop, writerId: string, writerPath: string): string {\n const followed =\n hop.trail.length === 0\n ? ''\n : ` through ${hop.trail.map((id) => `rule \\`${id}\\``).join(', then ')}`;\n return `\\`${hop.path}\\`${followed}, which rule \\`${writerId}\\` writes from \\`${writerPath}\\``;\n}\n\n/** Refuses a `required` rule whose condition reads the field it makes required. */\nfunction refuseRequiredSelfRead(\n compilation: Compilation,\n entry: CompiledRuleEntry,\n targetFieldId: string,\n read: string,\n): void {\n refuse(\n compilation,\n 'CYCLE_DETECTED',\n `$.rules[${String(entry.index)}].expr`,\n `rule \\`${entry.rule.ruleId}\\` requires \\`${targetFieldId}\\` under a condition that reads ${read}; a \\`required\\` rule's \\`expr\\` is the condition under which the field is required, and the engine decides presence itself, so a condition reading the field can never make it required; write \\`true\\` for an unconditional requirement, or a condition over sibling fields`,\n );\n}\n\n/** Refuses one rule whose read set reaches its own target. */\nfunction refuseSelfRead(\n compilation: Compilation,\n entry: CompiledRuleEntry,\n kind: SelfReadingKind,\n targetFieldId: string,\n read: string,\n): void {\n if (kind === 'required') {\n refuseRequiredSelfRead(compilation, entry, targetFieldId, read);\n return;\n }\n const rule = entry.rule;\n const repair = SELF_READ_REPAIR[kind];\n refuse(\n compilation,\n 'CYCLE_DETECTED',\n `$.rules[${String(entry.index)}].expr`,\n `rule \\`${rule.ruleId}\\` reads its ${repair.verb} target \\`${targetFieldId}\\` through ${read}; a rule that reads what it writes or constrains has no value to start from — ${repair.repair}`,\n );\n}\n\n/**\n * Refuses a writer, `required` or `enabled` rule whose transitive read set contains its own\n * target, `RULES-5.1.3`.\n *\n * Reads are followed through the other computed fields: one rule's target is another's read,\n * so a cycle can be two rules long or longer, and naming the chain tells an author which\n * declaration to change.\n */\nexport function crossCheckItemTargets(\n compilation: Compilation,\n entries: readonly CompiledRuleEntry[],\n): void {\n // A `required` rule's `expr` is the condition under which the field is required, at every\n // scope: the engine decides presence itself (`eval/state/field-state.ts`). A condition that\n // reads its own target therefore never makes the field required, and `true` is the spelling\n // of an unconditional requirement. An `enabled` rule that reads its target is the self-lock\n // `RULES-2.1.6` names. The item scope is handled below through its row binders; here the\n // read chain follows the document's non-item computed fields.\n const fieldWriters = new Map<string, CompiledRuleEntry>();\n for (const entry of entries) {\n const rule = entry.rule;\n if (rule.scope === 'item') continue;\n if (rule.kind !== 'compute' && rule.kind !== 'defaultCompute') continue;\n if (rule.fieldId === undefined) continue;\n fieldWriters.set(rule.fieldId, entry);\n }\n for (const entry of entries) {\n const rule = entry.rule;\n if (rule.kind !== 'required' && rule.kind !== 'enabled') continue;\n if (rule.scope === 'item') continue;\n for (const target of ruleTargets(rule)) {\n const chain = conditionReadOf(compilation, entry, target, fieldWriters);\n if (chain === undefined) continue;\n const followed =\n chain.trail.length === 0\n ? ''\n : ` through ${chain.trail.map((id) => `rule \\`${id}\\``).join(', then ')}`;\n if (rule.kind === 'required') {\n refuseRequiredSelfRead(compilation, entry, target, `\\`${chain.read}\\`${followed}`);\n continue;\n }\n refuseSelfRead(compilation, entry, 'enabled', target, `\\`${chain.read}\\`${followed}`);\n }\n }\n\n // Only a computed member has a writer to follow: a `required`, `enabled` or `validate`\n // member is supplied rather than produced, so a read of it ends the chain.\n const writers = new Map<string, CompiledRuleEntry>();\n for (const entry of entries) {\n const rule = entry.rule;\n if (rule.scope !== 'item') continue;\n if (rule.kind !== 'compute' && rule.kind !== 'defaultCompute') continue;\n if (rule.fieldId === undefined || rule.targetFieldId === undefined) continue;\n writers.set(writerKey(rule.fieldId, rule.targetFieldId), entry);\n }\n\n for (const entry of entries) {\n const rule = entry.rule;\n if (rule.scope !== 'item' || rule.fieldId === undefined) continue;\n if (!isSelfReadingKind(rule.kind) || rule.targetFieldId === undefined) continue;\n const target = rule.targetFieldId;\n const own = rowReads(entry.slots);\n const direct = own.members.get(target);\n if (direct !== undefined) {\n refuseSelfRead(compilation, entry, rule.kind, target, `\\`${direct}\\``);\n continue;\n }\n if (own.wholeRow[0] !== undefined) {\n refuseSelfRead(compilation, entry, rule.kind, target, `\\`${own.wholeRow[0]}\\``);\n continue;\n }\n // Follow computed members breadth first, so the chain named is the shortest one that\n // reaches the target and a member is followed once.\n const queue: ReadHop[] = [...own.members].map(([member, path]) => ({\n path,\n member,\n trail: [],\n }));\n const seen = new Set<string>();\n let refused = false;\n while (queue.length > 0 && !refused) {\n const hop = queue.shift();\n if (hop === undefined) break;\n if (seen.has(hop.member)) continue;\n seen.add(hop.member);\n const writer = writers.get(writerKey(rule.fieldId, hop.member));\n if (writer === undefined) continue;\n const produced = rowReads(writer.slots);\n const writerReadsTarget = produced.members.get(target) ?? produced.wholeRow[0];\n if (writerReadsTarget !== undefined) {\n refuseSelfRead(\n compilation,\n entry,\n rule.kind,\n target,\n describeChain(hop, writer.rule.ruleId, writerReadsTarget),\n );\n refused = true;\n break;\n }\n for (const [member, path] of produced.members) {\n if (seen.has(member)) continue;\n queue.push({ path, member, trail: [...hop.trail, writer.rule.ruleId] });\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Compilation } from './compilation.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compiles the messages catalogue, returning the entries and the arguments each one takes.
|
|
4
|
+
* An authored entry is compiled; an already-compiled entry travels unchanged, so re-compiling
|
|
5
|
+
* an artifact is a no-op rather than a catalogue deletion.
|
|
6
|
+
*/
|
|
7
|
+
export declare function compileMessages(compilation: Compilation, document: Record<string, unknown>): void;
|
|
8
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/compile/messages.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAcpD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAqCjG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { isRecord } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { compileMessage } from '../messages/compile.js';
|
|
3
|
+
import { catalogueLocation } from '../schema/catalogue.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether a catalogue entry is already the compiled form.
|
|
6
|
+
*
|
|
7
|
+
* A document is valid in either state, so compiling a compiled artifact must carry its
|
|
8
|
+
* message ASTs through unchanged; this is the narrowing that tells the two states apart
|
|
9
|
+
* without re-parsing text the runtime would never read.
|
|
10
|
+
*/
|
|
11
|
+
function isCompiledMessage(value) {
|
|
12
|
+
if (!isRecord(value))
|
|
13
|
+
return false;
|
|
14
|
+
return typeof value['source'] === 'string' && Array.isArray(value['nodes']);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Compiles the messages catalogue, returning the entries and the arguments each one takes.
|
|
18
|
+
* An authored entry is compiled; an already-compiled entry travels unchanged, so re-compiling
|
|
19
|
+
* an artifact is a no-op rather than a catalogue deletion.
|
|
20
|
+
*/
|
|
21
|
+
export function compileMessages(compilation, document) {
|
|
22
|
+
const catalogue = document['messages'];
|
|
23
|
+
if (!isRecord(catalogue))
|
|
24
|
+
return;
|
|
25
|
+
for (const [key, locales] of Object.entries(catalogue)) {
|
|
26
|
+
if (!isRecord(locales))
|
|
27
|
+
continue;
|
|
28
|
+
for (const [locale, entry] of Object.entries(locales)) {
|
|
29
|
+
const existing = Object.hasOwn(compilation.messages, key)
|
|
30
|
+
? compilation.messages[key]
|
|
31
|
+
: undefined;
|
|
32
|
+
const entryFor = existing ?? {};
|
|
33
|
+
if (isCompiledMessage(entry)) {
|
|
34
|
+
entryFor[locale] = entry;
|
|
35
|
+
compilation.messages[key] = entryFor;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (typeof entry !== 'string')
|
|
39
|
+
continue;
|
|
40
|
+
// The entry's own location, rendered the way every other diagnostic renders a member: a
|
|
41
|
+
// key such as `option.a` is one member, not two, so it is quoted rather than dotted. The
|
|
42
|
+
// message-internal location (a token path) follows as the relative steps it is.
|
|
43
|
+
const at = catalogueLocation(document, key, locale);
|
|
44
|
+
const compiled = compileMessage(entry, locale, Object.keys(locales));
|
|
45
|
+
if (!compiled.ok) {
|
|
46
|
+
for (const diagnostic of compiled.diagnostics) {
|
|
47
|
+
compilation.diagnostics.push({
|
|
48
|
+
code: 'MESSAGE_COMPILE_ERROR',
|
|
49
|
+
path: diagnostic.path === '' ? at : `${at}.${diagnostic.path}`,
|
|
50
|
+
detail: diagnostic.detail,
|
|
51
|
+
messageKey: key,
|
|
52
|
+
locale,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
entryFor[locale] = compiled.message;
|
|
58
|
+
compilation.messages[key] = entryFor;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/compile/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,KAAc;IACvC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,OAAO,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CA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AC;gBACjB,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;oBAC9C,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC;wBAC3B,IAAI,EAAE,uBAAuB;wBAC7B,IAAI,EAAE,UAAU,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,IAAI,EAAE;wBAC9D,MAAM,EAAE,UAAU,CAAC,MAAM;wBACzB,UAAU,EAAE,GAAG;wBACf,MAAM;qBACP,CAAC,CAAC;gBACL,CAAC;gBACD,SAAS;YACX,CAAC;YACD,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC;YACpC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;QACvC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { isRecord } from '@azx-pbc/axiom-runtime';\nimport type { CompiledMessage } from '@azx-pbc/axiom-runtime';\nimport { compileMessage } from '../messages/compile.js';\nimport { catalogueLocation } from '../schema/catalogue.js';\nimport type { Compilation } from './compilation.js';\n\n/**\n * Whether a catalogue entry is already the compiled form.\n *\n * A document is valid in either state, so compiling a compiled artifact must carry its\n * message ASTs through unchanged; this is the narrowing that tells the two states apart\n * without re-parsing text the runtime would never read.\n */\nfunction isCompiledMessage(value: unknown): value is CompiledMessage {\n if (!isRecord(value)) return false;\n return typeof value['source'] === 'string' && Array.isArray(value['nodes']);\n}\n\n/**\n * Compiles the messages catalogue, returning the entries and the arguments each one takes.\n * An authored entry is compiled; an already-compiled entry travels unchanged, so re-compiling\n * an artifact is a no-op rather than a catalogue deletion.\n */\nexport function compileMessages(compilation: Compilation, document: Record<string, unknown>): void {\n const catalogue = document['messages'];\n if (!isRecord(catalogue)) return;\n for (const [key, locales] of Object.entries(catalogue)) {\n if (!isRecord(locales)) continue;\n for (const [locale, entry] of Object.entries(locales)) {\n const existing = Object.hasOwn(compilation.messages, key)\n ? compilation.messages[key]\n : undefined;\n const entryFor = existing ?? {};\n if (isCompiledMessage(entry)) {\n entryFor[locale] = entry;\n compilation.messages[key] = entryFor;\n continue;\n }\n if (typeof entry !== 'string') continue;\n // The entry's own location, rendered the way every other diagnostic renders a member: a\n // key such as `option.a` is one member, not two, so it is quoted rather than dotted. The\n // message-internal location (a token path) follows as the relative steps it is.\n const at = catalogueLocation(document, key, locale);\n const compiled = compileMessage(entry, locale, Object.keys(locales));\n if (!compiled.ok) {\n for (const diagnostic of compiled.diagnostics) {\n compilation.diagnostics.push({\n code: 'MESSAGE_COMPILE_ERROR',\n path: diagnostic.path === '' ? at : `${at}.${diagnostic.path}`,\n detail: diagnostic.detail,\n messageKey: key,\n locale,\n });\n }\n continue;\n }\n entryFor[locale] = compiled.message;\n compilation.messages[key] = entryFor;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CompiledField, CompiledSuggestion, ExprNode } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { Compilation } from './compilation.js';
|
|
3
|
+
/**
|
|
4
|
+
* The declared members of one option that decide when it may be chosen and what may replace it,
|
|
5
|
+
* `RULES-7.1.1` and `RULES-7.1.4`.
|
|
6
|
+
*
|
|
7
|
+
* Availability is the same kind of slot a rule's condition is: Expr v1 authored in the scope of
|
|
8
|
+
* the field that declares the option, compiled to the tree the runtime evaluates. The members are
|
|
9
|
+
* one declaration, so a document that states none of them states no member at all and keeps the
|
|
10
|
+
* artifact bytes it always had.
|
|
11
|
+
*/
|
|
12
|
+
interface CompiledOptionAvailability {
|
|
13
|
+
readonly availableWhen?: ExprNode;
|
|
14
|
+
readonly unavailableMessageKey?: string;
|
|
15
|
+
readonly unavailableParams?: Readonly<Record<string, ExprNode>>;
|
|
16
|
+
readonly suggests?: readonly CompiledSuggestion[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Every declared option's compiled members, keyed by the field that declares the option and then
|
|
20
|
+
* by the option's position in that field's `options` list.
|
|
21
|
+
*
|
|
22
|
+
* A position a field does not fill is an option that declares no availability, so the artifact
|
|
23
|
+
* carries no member for it rather than an empty declaration.
|
|
24
|
+
*/
|
|
25
|
+
export type CompiledOptionSlots = ReadonlyMap<string, readonly (CompiledOptionAvailability | undefined)[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Compiles every declared option's availability condition, reason message and alternatives.
|
|
28
|
+
*
|
|
29
|
+
* A field whose domain comes from `optionSource` declares no option, so there is no declaration
|
|
30
|
+
* to evaluate: the author's mistake is the pair itself, which the member pass refuses and names.
|
|
31
|
+
* Compiling here would report the same cause twice.
|
|
32
|
+
*/
|
|
33
|
+
export declare function compileOptionAvailability(compilation: Compilation, document: Record<string, unknown>): CompiledOptionSlots;
|
|
34
|
+
/**
|
|
35
|
+
* The declared field tree with each option's compiled slots attached.
|
|
36
|
+
*
|
|
37
|
+
* The artifact is narrowed from this tree, so the members travel in the shape the runtime reads
|
|
38
|
+
* while an option that declares none keeps the bytes it had before availability existed.
|
|
39
|
+
*/
|
|
40
|
+
export declare function withOptionSlots(fields: unknown, compiled: CompiledOptionSlots): unknown;
|
|
41
|
+
/**
|
|
42
|
+
* The narrowed field tree with each option's compiled members attached.
|
|
43
|
+
*
|
|
44
|
+
* The document tree states these members in the authored spelling the metaschema admits, so the
|
|
45
|
+
* narrowing from that tree leaves them out. The compiled slots are already the typed values the
|
|
46
|
+
* runtime reads, produced by this compiler, so they are attached here rather than parsed back out
|
|
47
|
+
* of a tree the compile just wrote.
|
|
48
|
+
*/
|
|
49
|
+
export declare function withCompiledOptions(fields: readonly CompiledField[], compiled: CompiledOptionSlots): readonly CompiledField[];
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=option-availability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-availability.d.ts","sourceRoot":"","sources":["../../src/compile/option-availability.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AASpD;;;;;;;;GAQG;AACH,UAAU,0BAA0B;IAClC,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC;IAClC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACnD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAC3C,MAAM,EACN,SAAS,CAAC,0BAA0B,GAAG,SAAS,CAAC,EAAE,CACpD,CAAC;AAgHF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,mBAAmB,CAgCrB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAqBvF;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,QAAQ,EAAE,mBAAmB,GAC5B,SAAS,aAAa,EAAE,CAmB1B"}
|