@azx-pbc/axiom-compiler 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 +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,476 @@
|
|
|
1
|
+
import { isRecord } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { Validator } from '@cfworker/json-schema';
|
|
3
|
+
import { documentPath, documentSegments } from '../document-path.js';
|
|
4
|
+
import { closestNames } from '../expr/suggest.js';
|
|
5
|
+
import { collapseValidatorErrors } from './collapse.js';
|
|
6
|
+
import { refusedMemberDetail, refusedMembersDetail, refusalOwnerOf } from './member-wording.js';
|
|
7
|
+
import { IDENTIFIER_PATTERN, metaschemaAt, pointerSegments } from './pointer.js';
|
|
8
|
+
import { noteMetaschemaValidation } from './measurement.js';
|
|
9
|
+
import { SCENARIOS_V1, SCHEMA_V1 } from './schema-v1.generated.js';
|
|
10
|
+
/**
|
|
11
|
+
* The metaschema validator. `shortCircuit: false` reports every failing keyword instead of
|
|
12
|
+
* stopping at the first, which is what makes a compile diagnostic list useful to an author.
|
|
13
|
+
*/
|
|
14
|
+
const schemaValidator = new Validator(SCHEMA_V1, '2020-12', false);
|
|
15
|
+
/**
|
|
16
|
+
* The same metaschema, stopped at the first failing keyword. `metaschemaErrors` reaches for
|
|
17
|
+
* it only when the exhaustive walk gives out, and only to name that first keyword.
|
|
18
|
+
*/
|
|
19
|
+
const firstFailureValidator = new Validator(SCHEMA_V1, '2020-12', true);
|
|
20
|
+
/** The scenario-suite contract, read the same way: every reason, then the first as a fallback. */
|
|
21
|
+
const scenarioValidator = new Validator(SCENARIOS_V1, '2020-12', false);
|
|
22
|
+
const firstScenarioValidator = new Validator(SCENARIOS_V1, '2020-12', true);
|
|
23
|
+
/**
|
|
24
|
+
* Every reason the metaschema gives, or none when it accepts the document.
|
|
25
|
+
*
|
|
26
|
+
* The exhaustive walk is the useful one — an author fixes a document in one pass — but the
|
|
27
|
+
* library accumulates each nested result with `errors.push(...result.errors)`, so error
|
|
28
|
+
* volume, not document depth, is what ends it: one member name outside the closed
|
|
29
|
+
* `wireValue` object grammar, restated across every element of a wide vector, fails all
|
|
30
|
+
* eleven branches of that union for each element, and past roughly a hundred thousand
|
|
31
|
+
* reasons the spread reaches V8's argument limit and `validate()` raises `RangeError`
|
|
32
|
+
* instead of returning a verdict. A document like that is walked again with
|
|
33
|
+
* `shortCircuit: true`, which stops at the first failing keyword: the author reads the one
|
|
34
|
+
* reason to fix rather than a run that names none.
|
|
35
|
+
*/
|
|
36
|
+
export function metaschemaErrors(document) {
|
|
37
|
+
return validatorErrors(schemaValidator, firstFailureValidator, SCHEMA_V1, document);
|
|
38
|
+
}
|
|
39
|
+
/** Every reason the scenario-suite metaschema gives, or none when it accepts the document. */
|
|
40
|
+
export function scenarioMetaschemaErrors(document) {
|
|
41
|
+
return validatorErrors(scenarioValidator, firstScenarioValidator, SCENARIOS_V1, document);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Every reason one metaschema gives, from the exhaustive walk, falling back to the first
|
|
45
|
+
* failing keyword when the exhaustive walk runs out of stack on a wide document.
|
|
46
|
+
*/
|
|
47
|
+
function validatorErrors(exhaustive, first, schema, document) {
|
|
48
|
+
noteMetaschemaValidation();
|
|
49
|
+
try {
|
|
50
|
+
const validation = exhaustive.validate(document);
|
|
51
|
+
return validation.valid ? [] : collapseValidatorErrors(validation.errors, schema);
|
|
52
|
+
}
|
|
53
|
+
catch (cause) {
|
|
54
|
+
if (!(cause instanceof RangeError))
|
|
55
|
+
throw cause;
|
|
56
|
+
const stopped = first.validate(document);
|
|
57
|
+
// Two walks of one schema disagreeing about validity is not something to paper over, so
|
|
58
|
+
// the original cause stands and a caller reports that the check could not complete.
|
|
59
|
+
if (stopped.valid)
|
|
60
|
+
throw cause;
|
|
61
|
+
return collapseValidatorErrors(stopped.errors, schema);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** The root members the closed metaschema admits, scored for a "did you mean?" suggestion. */
|
|
65
|
+
const ROOT_MEMBERS = Object.keys(SCHEMA_V1.properties ?? {});
|
|
66
|
+
/**
|
|
67
|
+
* The nearest root members an unknown top-level member probably meant.
|
|
68
|
+
*
|
|
69
|
+
* The closed metaschema refuses an undeclared member as `unevaluatedProperties`, whose message
|
|
70
|
+
* names the property but not the vocabulary it missed. `field` for `fields` is the first typo a
|
|
71
|
+
* document usually has, so the same nearest-name score the identifier checks use is applied to
|
|
72
|
+
* the root's own member names. Only the document root is scored: a member inside a field is not
|
|
73
|
+
* a root member, and offering `context` for `extra` would be a worse hint than none.
|
|
74
|
+
*/
|
|
75
|
+
function rootMemberSuggestions(error) {
|
|
76
|
+
if (error.keyword !== 'unevaluatedProperties')
|
|
77
|
+
return [];
|
|
78
|
+
const segments = pointerSegments(error.instanceLocation);
|
|
79
|
+
if (segments.length !== 1)
|
|
80
|
+
return [];
|
|
81
|
+
const [member] = segments;
|
|
82
|
+
if (member === undefined)
|
|
83
|
+
return [];
|
|
84
|
+
return closestNames(member, ROOT_MEMBERS);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The instance node one validator instance location names, or `undefined` when the location
|
|
88
|
+
* names none. The location is the RFC 6901 pointer the validator reports, so its tokens are
|
|
89
|
+
* literal member names and array indices.
|
|
90
|
+
*/
|
|
91
|
+
function instanceAt(document, location) {
|
|
92
|
+
return valueAt(document, pointerSegments(location));
|
|
93
|
+
}
|
|
94
|
+
/** The node one pointer's segments name, walking the document from its root. */
|
|
95
|
+
function valueAt(document, segments) {
|
|
96
|
+
let current = document;
|
|
97
|
+
for (const segment of segments) {
|
|
98
|
+
if (typeof current !== 'object' || current === null)
|
|
99
|
+
return undefined;
|
|
100
|
+
current = Reflect.get(current, segment);
|
|
101
|
+
}
|
|
102
|
+
return current;
|
|
103
|
+
}
|
|
104
|
+
/** The member names a `required` refusal states, or `[]` when the keyword's schema states none. */
|
|
105
|
+
function requiredNames(error) {
|
|
106
|
+
const required = metaschemaAt(error.keywordLocation);
|
|
107
|
+
return Array.isArray(required)
|
|
108
|
+
? required.filter((name) => typeof name === 'string')
|
|
109
|
+
: [];
|
|
110
|
+
}
|
|
111
|
+
/** The required members of the refused object that the instance does not declare. */
|
|
112
|
+
function missingMembers(error, document) {
|
|
113
|
+
const instance = instanceAt(document, error.instanceLocation);
|
|
114
|
+
if (!isRecord(instance))
|
|
115
|
+
return [];
|
|
116
|
+
return requiredNames(error).filter((name) => !Object.hasOwn(instance, name));
|
|
117
|
+
}
|
|
118
|
+
/** One name as the report spells it: in backticks, so it reads as the member it is. */
|
|
119
|
+
function quoted(name) {
|
|
120
|
+
return `\`${name}\``;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A `required` refusal in the terms an author acts on.
|
|
124
|
+
*
|
|
125
|
+
* The validator says `Instance does not have required property "fields"`, which names the
|
|
126
|
+
* keyword rather than the repair and leaves an author to work out which object was meant. The
|
|
127
|
+
* metaschema states the required member names at the keyword location, and the instance names
|
|
128
|
+
* the members it does have, so the report can say exactly which member is missing and, at the
|
|
129
|
+
* document root, which undeclared member is probably the misspelling: `field` for `fields` is
|
|
130
|
+
* the first mistake a document usually has. A refusal whose members cannot be read that way
|
|
131
|
+
* keeps the validator's own wording rather than guessing.
|
|
132
|
+
*/
|
|
133
|
+
function requiredDetail(error, document) {
|
|
134
|
+
const missing = missingMembers(error, document);
|
|
135
|
+
if (missing.length === 0)
|
|
136
|
+
return `${error.keyword}: ${error.error}`;
|
|
137
|
+
const names = missing.map(quoted).join(' and ');
|
|
138
|
+
const instance = instanceAt(document, error.instanceLocation);
|
|
139
|
+
const atRoot = pointerSegments(error.instanceLocation).length === 0 && isRecord(instance);
|
|
140
|
+
if (!atRoot)
|
|
141
|
+
return `the object must declare the required member ${names}`;
|
|
142
|
+
const undeclared = Object.keys(instance).filter((member) => !ROOT_MEMBERS.includes(member));
|
|
143
|
+
const nearest = [...new Set(missing.flatMap((name) => closestNames(name, undeclared)))];
|
|
144
|
+
if (nearest.length === 0)
|
|
145
|
+
return `the document must declare the required root member ${names}`;
|
|
146
|
+
const spelled = nearest.map(quoted).join(' or ');
|
|
147
|
+
return `the document must declare the required root member ${names}; ${spelled} ${nearest.length === 1 ? 'is not a root member' : 'are not root members'} — probably the spelling meant`;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* An `enum` refusal in the terms an author acts on.
|
|
151
|
+
*
|
|
152
|
+
* The validator says only that the value matched no member of the list, which for a misspelt
|
|
153
|
+
* control (`txt` for `text`) leaves the author to read twenty-odd names. The admitted names
|
|
154
|
+
* come from the metaschema at the keyword location, so the same nearest-name score the
|
|
155
|
+
* identifier checks use names the likely spelling; a value with no near miss keeps the full
|
|
156
|
+
* list, because then the list *is* the fact an author needs.
|
|
157
|
+
*/
|
|
158
|
+
function enumRefusal(error, document) {
|
|
159
|
+
const admitted = metaschemaAt(error.keywordLocation);
|
|
160
|
+
const values = Array.isArray(admitted)
|
|
161
|
+
? admitted.filter((value) => typeof value === 'string')
|
|
162
|
+
: [];
|
|
163
|
+
const value = instanceAt(document, error.instanceLocation);
|
|
164
|
+
if (values.length === 0 || typeof value !== 'string') {
|
|
165
|
+
return { detail: `${error.keyword}: ${error.error}`, suggestions: [] };
|
|
166
|
+
}
|
|
167
|
+
const suggestions = closestNames(value, values);
|
|
168
|
+
if (suggestions.length === 0) {
|
|
169
|
+
return {
|
|
170
|
+
detail: `${quoted(value)} is not one of the values this member admits; it admits ${values.map(quoted).join(', ')}`,
|
|
171
|
+
suggestions,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
detail: `${quoted(value)} is not one of the values this member admits; did you mean ${suggestions.map(quoted).join(' or ')}?`,
|
|
176
|
+
suggestions,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The sentence a member the closed field definition refuses earns.
|
|
181
|
+
*
|
|
182
|
+
* A member is refused by a `false` subschema reported at the member itself, so the declaration
|
|
183
|
+
* is the instance one step above. When the collapse carried the wrapper's keyword location the
|
|
184
|
+
* schema there names the member's `false` subschema; that check keeps an unknown member of a
|
|
185
|
+
* closed object (which the same `properties` keyword reports) from being described as a
|
|
186
|
+
* declaration member. Without a wrapper — the `false` leaf on its own — the declaration and the
|
|
187
|
+
* member still name the refusal, so the sentence is produced all the same.
|
|
188
|
+
*/
|
|
189
|
+
function refusedFalseMember(error, document, requireFalseSubschema) {
|
|
190
|
+
const segments = pointerSegments(error.instanceLocation);
|
|
191
|
+
const member = segments[segments.length - 1];
|
|
192
|
+
if (member === undefined)
|
|
193
|
+
return undefined;
|
|
194
|
+
if (requireFalseSubschema) {
|
|
195
|
+
const properties = metaschemaAt(error.keywordLocation);
|
|
196
|
+
if (!isRecord(properties) || Reflect.get(properties, member) !== false)
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
const owner = refusalOwnerOf(valueAt(document, segments.slice(0, -1)));
|
|
200
|
+
return owner === undefined ? undefined : refusedMemberDetail(member, owner);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* The sentence a `not` clause earns: the members whose presence the clause refuses, named on the
|
|
204
|
+
* declaration that carries them. The clause's own schema states those members, so the message
|
|
205
|
+
* names exactly what the metaschema refused rather than guessing from the document.
|
|
206
|
+
*/
|
|
207
|
+
function refusedNotMembers(error, document) {
|
|
208
|
+
const clause = metaschemaAt(error.keywordLocation);
|
|
209
|
+
if (!isRecord(clause))
|
|
210
|
+
return undefined;
|
|
211
|
+
const required = clause['required'];
|
|
212
|
+
if (!Array.isArray(required))
|
|
213
|
+
return undefined;
|
|
214
|
+
const members = required.filter((member) => typeof member === 'string');
|
|
215
|
+
const owner = refusalOwnerOf(instanceAt(document, error.instanceLocation));
|
|
216
|
+
return owner === undefined ? undefined : refusedMembersDetail(members, owner);
|
|
217
|
+
}
|
|
218
|
+
/** The first double-quoted name in a validator message. */
|
|
219
|
+
function firstQuotedName(error) {
|
|
220
|
+
return /"([^"]*)"/.exec(error.error)?.[1];
|
|
221
|
+
}
|
|
222
|
+
/** The two raw numbers a relation-shaped validator message states, in order. */
|
|
223
|
+
function relationPair(error, relation) {
|
|
224
|
+
const match = new RegExp(`^(.*) ${relation} (.*)\\.$`).exec(error.error);
|
|
225
|
+
const left = match?.[1];
|
|
226
|
+
const right = match?.[2];
|
|
227
|
+
return left === undefined || right === undefined ? undefined : [left, right];
|
|
228
|
+
}
|
|
229
|
+
/** The two raw counts an item or length message states, in order. */
|
|
230
|
+
function countPair(error, relation) {
|
|
231
|
+
const match = new RegExp(`\\((\\d+) ${relation} (\\d+)\\)`).exec(error.error);
|
|
232
|
+
const left = match?.[1];
|
|
233
|
+
const right = match?.[2];
|
|
234
|
+
return left === undefined || right === undefined ? undefined : [left, right];
|
|
235
|
+
}
|
|
236
|
+
/** The member a closed object refused, from the message or the instance path that names it. */
|
|
237
|
+
function refusedMemberName(error) {
|
|
238
|
+
const quoted = firstQuotedName(error);
|
|
239
|
+
if (quoted !== undefined)
|
|
240
|
+
return quoted;
|
|
241
|
+
const segments = pointerSegments(error.instanceLocation);
|
|
242
|
+
return segments[segments.length - 1];
|
|
243
|
+
}
|
|
244
|
+
/** One JSON type name in the prose a form author reads. */
|
|
245
|
+
function typeProse(type) {
|
|
246
|
+
switch (type) {
|
|
247
|
+
case 'string':
|
|
248
|
+
return 'text';
|
|
249
|
+
case 'integer':
|
|
250
|
+
return 'an integer';
|
|
251
|
+
case 'number':
|
|
252
|
+
return 'a number';
|
|
253
|
+
case 'boolean':
|
|
254
|
+
return 'a boolean';
|
|
255
|
+
case 'object':
|
|
256
|
+
return 'an object';
|
|
257
|
+
case 'array':
|
|
258
|
+
return 'a list';
|
|
259
|
+
case 'null':
|
|
260
|
+
return 'null';
|
|
261
|
+
default:
|
|
262
|
+
return `a ${type}`;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/** The plural noun a list count takes. */
|
|
266
|
+
function entryWord(count) {
|
|
267
|
+
return count === '1' ? 'entry' : 'entries';
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The actionable rendering of one validator refusal, and the suggestions the structure carries
|
|
271
|
+
* beside it. The keywords whose validator wording names no member or no repair are restated as
|
|
272
|
+
* the sentence a form author acts on; `keyword` and `path` stay unchanged, so a tool branching
|
|
273
|
+
* on the structured answer is unaffected. A keyword with no plain sentence keeps the
|
|
274
|
+
* validator's wording (`multipleOf`, `format`, `minProperties`, `maxProperties`, `contains`,
|
|
275
|
+
* `allOf`, `if`, `propertyNames` and the item wrappers).
|
|
276
|
+
*/
|
|
277
|
+
function describeRefusal(error, document) {
|
|
278
|
+
switch (error.keyword) {
|
|
279
|
+
case 'required':
|
|
280
|
+
return { detail: requiredDetail(error, document), suggestions: [] };
|
|
281
|
+
case 'enum':
|
|
282
|
+
return enumRefusal(error, document);
|
|
283
|
+
case 'false': {
|
|
284
|
+
const detail = refusedFalseMember(error, document, false);
|
|
285
|
+
return detail === undefined
|
|
286
|
+
? { detail: `${error.keyword}: ${error.error}`, suggestions: [] }
|
|
287
|
+
: { detail, suggestions: [] };
|
|
288
|
+
}
|
|
289
|
+
case 'properties': {
|
|
290
|
+
const detail = refusedFalseMember(error, document, true);
|
|
291
|
+
return detail === undefined
|
|
292
|
+
? { detail: `${error.keyword}: ${error.error}`, suggestions: [] }
|
|
293
|
+
: { detail, suggestions: [] };
|
|
294
|
+
}
|
|
295
|
+
case 'not': {
|
|
296
|
+
const detail = refusedNotMembers(error, document);
|
|
297
|
+
return detail === undefined
|
|
298
|
+
? { detail: `${error.keyword}: ${error.error}`, suggestions: [] }
|
|
299
|
+
: { detail, suggestions: [] };
|
|
300
|
+
}
|
|
301
|
+
case 'unevaluatedProperties':
|
|
302
|
+
case 'additionalProperties': {
|
|
303
|
+
const member = refusedMemberName(error);
|
|
304
|
+
return {
|
|
305
|
+
detail: member === undefined
|
|
306
|
+
? `${error.keyword}: ${error.error}`
|
|
307
|
+
: `${quoted(member)} is not a member of this object; remove it or use an admitted member.`,
|
|
308
|
+
suggestions: rootMemberSuggestions(error),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
case 'minItems': {
|
|
312
|
+
const pair = countPair(error, '<');
|
|
313
|
+
return {
|
|
314
|
+
detail: pair === undefined
|
|
315
|
+
? `${error.keyword}: ${error.error}`
|
|
316
|
+
: `the list needs at least ${pair[1]} ${entryWord(pair[1])}; it holds ${pair[0]}.`,
|
|
317
|
+
suggestions: [],
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
case 'maxItems': {
|
|
321
|
+
const pair = countPair(error, '>');
|
|
322
|
+
return {
|
|
323
|
+
detail: pair === undefined
|
|
324
|
+
? `${error.keyword}: ${error.error}`
|
|
325
|
+
: `the list needs at most ${pair[1]} ${entryWord(pair[1])}; it holds ${pair[0]}.`,
|
|
326
|
+
suggestions: [],
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
case 'minLength': {
|
|
330
|
+
const pair = countPair(error, '<');
|
|
331
|
+
return {
|
|
332
|
+
detail: pair === undefined
|
|
333
|
+
? `${error.keyword}: ${error.error}`
|
|
334
|
+
: `the text has ${pair[0]} characters; the minimum is ${pair[1]}.`,
|
|
335
|
+
suggestions: [],
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
case 'maxLength': {
|
|
339
|
+
const pair = countPair(error, '>');
|
|
340
|
+
return {
|
|
341
|
+
detail: pair === undefined
|
|
342
|
+
? `${error.keyword}: ${error.error}`
|
|
343
|
+
: `the text has ${pair[0]} characters; the maximum is ${pair[1]}.`,
|
|
344
|
+
suggestions: [],
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
case 'minimum': {
|
|
348
|
+
const pair = relationPair(error, 'is less than');
|
|
349
|
+
return {
|
|
350
|
+
detail: pair === undefined
|
|
351
|
+
? `${error.keyword}: ${error.error}`
|
|
352
|
+
: `the value is ${pair[0]}; the smallest admitted value is ${pair[1]}.`,
|
|
353
|
+
suggestions: [],
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
case 'exclusiveMinimum': {
|
|
357
|
+
const pair = relationPair(error, 'is less than');
|
|
358
|
+
return {
|
|
359
|
+
detail: pair === undefined
|
|
360
|
+
? `${error.keyword}: ${error.error}`
|
|
361
|
+
: `the value is ${pair[0]}; it must be greater than ${pair[1]}.`,
|
|
362
|
+
suggestions: [],
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
case 'maximum': {
|
|
366
|
+
const pair = relationPair(error, 'is greater than');
|
|
367
|
+
return {
|
|
368
|
+
detail: pair === undefined
|
|
369
|
+
? `${error.keyword}: ${error.error}`
|
|
370
|
+
: `the value is ${pair[0]}; the largest admitted value is ${pair[1]}.`,
|
|
371
|
+
suggestions: [],
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
case 'exclusiveMaximum': {
|
|
375
|
+
const pair = relationPair(error, 'is greater than or equal to');
|
|
376
|
+
return {
|
|
377
|
+
detail: pair === undefined
|
|
378
|
+
? `${error.keyword}: ${error.error}`
|
|
379
|
+
: `the value is ${pair[0]}; it must be less than ${pair[1]}.`,
|
|
380
|
+
suggestions: [],
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
case 'uniqueItems': {
|
|
384
|
+
const match = /indexes (\d+) and (\d+)/.exec(error.error);
|
|
385
|
+
const first = match?.[1];
|
|
386
|
+
const second = match?.[2];
|
|
387
|
+
return {
|
|
388
|
+
detail: first === undefined || second === undefined
|
|
389
|
+
? `${error.keyword}: ${error.error}`
|
|
390
|
+
: `two entries hold the same value, at positions ${String(Number(first) + 1)} and ${String(Number(second) + 1)}.`,
|
|
391
|
+
suggestions: [],
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
case 'type': {
|
|
395
|
+
const actual = /^Instance type "([^"]*)"/.exec(error.error)?.[1];
|
|
396
|
+
const expectedText = /Expected (".*")\.$/.exec(error.error)?.[1];
|
|
397
|
+
const expected = expectedText?.matchAll(/"([^"]*)"/g) ?? [];
|
|
398
|
+
const admitted = [...expected].flatMap((match) => (match[1] === undefined ? [] : [match[1]]));
|
|
399
|
+
return {
|
|
400
|
+
detail: actual === undefined || admitted.length === 0
|
|
401
|
+
? `${error.keyword}: ${error.error}`
|
|
402
|
+
: `this member holds ${admitted.map(typeProse).join(' or ')}; the document states ${typeProse(actual)}.`,
|
|
403
|
+
suggestions: [],
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
case 'const': {
|
|
407
|
+
const value = /^Instance does not match (.*)\.$/.exec(error.error)?.[1];
|
|
408
|
+
return {
|
|
409
|
+
detail: value === undefined
|
|
410
|
+
? `${error.keyword}: ${error.error}`
|
|
411
|
+
: `this member must be ${value}.`,
|
|
412
|
+
suggestions: [],
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
case 'pattern': {
|
|
416
|
+
const detail = metaschemaAt(error.keywordLocation) === IDENTIFIER_PATTERN
|
|
417
|
+
? `the text must match ${IDENTIFIER_PATTERN} — a lower-case identifier: a letter first, then lower-case letters, digits or underscores`
|
|
418
|
+
: 'the text must match the declared pattern.';
|
|
419
|
+
return { detail, suggestions: [] };
|
|
420
|
+
}
|
|
421
|
+
case 'anyOf':
|
|
422
|
+
return {
|
|
423
|
+
detail: 'this member matches none of the admitted forms; remove it, or write the form the schema names here',
|
|
424
|
+
suggestions: [],
|
|
425
|
+
};
|
|
426
|
+
case 'oneOf': {
|
|
427
|
+
const matches = /\((\d+) matches?\)/.exec(error.error)?.[1];
|
|
428
|
+
return {
|
|
429
|
+
detail: matches === undefined || Number(matches) === 0
|
|
430
|
+
? 'this member matches none of the admitted forms; it must match exactly one.'
|
|
431
|
+
: `this member matches ${matches} admitted forms; it must match exactly one.`,
|
|
432
|
+
suggestions: [],
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
case 'dependentRequired': {
|
|
436
|
+
const match = /^Instance has "([^"]*)" but does not have "([^"]*)"\.$/.exec(error.error);
|
|
437
|
+
const declared = match?.[1];
|
|
438
|
+
const dependent = match?.[2];
|
|
439
|
+
return {
|
|
440
|
+
detail: declared === undefined || dependent === undefined
|
|
441
|
+
? `${error.keyword}: ${error.error}`
|
|
442
|
+
: `the object declares ${quoted(declared)}, so it must also declare ${quoted(dependent)}.`,
|
|
443
|
+
suggestions: [],
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
default:
|
|
447
|
+
return {
|
|
448
|
+
detail: `${error.keyword}: ${error.error}`,
|
|
449
|
+
suggestions: rootMemberSuggestions(error),
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
export function validatorDiagnostic(error, document) {
|
|
454
|
+
const refusal = describeRefusal(error, document);
|
|
455
|
+
return {
|
|
456
|
+
code: 'SCHEMA_INVALID',
|
|
457
|
+
path: documentPath(error.instanceLocation, document),
|
|
458
|
+
detail: refusal.detail,
|
|
459
|
+
keyword: error.keyword,
|
|
460
|
+
schemaPath: pointerSegments(error.keywordLocation).map(numericSegment),
|
|
461
|
+
// The same steps `path` renders, resolved against the document, so an editor and a
|
|
462
|
+
// reader of the prose location never disagree about which member or element is meant.
|
|
463
|
+
instancePath: [...documentSegments(error.instanceLocation, document)],
|
|
464
|
+
// The identifier grammar is the one bound an author can satisfy by rewriting the value,
|
|
465
|
+
// so the required form travels as structure rather than only inside the prose.
|
|
466
|
+
...(error.keyword === 'pattern' && metaschemaAt(error.keywordLocation) === IDENTIFIER_PATTERN
|
|
467
|
+
? { expected: IDENTIFIER_PATTERN }
|
|
468
|
+
: {}),
|
|
469
|
+
...(refusal.suggestions.length === 0 ? {} : { suggestions: refusal.suggestions }),
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
/** A pointer token that is a JavaScript array index, so an index is reported as a number. */
|
|
473
|
+
function numericSegment(segment) {
|
|
474
|
+
return /^\d+$/.test(segment) ? Number(segment) : segment;
|
|
475
|
+
}
|
|
476
|
+
//# sourceMappingURL=metaschema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metaschema.js","sourceRoot":"","sources":["../../src/schema/metaschema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAA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AAE,YAAY,CAAC,KAAK,CAAC,gBAAgB,EAAE,QAAQ,CAAC;QACpD,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC;QACtE,mFAAmF;QACnF,sFAAsF;QACtF,YAAY,EAAE,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACrE,wFAAwF;QACxF,+EAA+E;QAC/E,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,YAAY,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,kBAAkB;YAC3F,CAAC,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE;YAClC,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;KAClF,CAAC;AACJ,CAAC;AAED,6FAA6F;AAC7F,SAAS,cAAc,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC","sourcesContent":["import { isRecord } from '@azx-pbc/axiom-runtime';\nimport { Validator } from '@cfworker/json-schema';\nimport type { OutputUnit, Schema } from '@cfworker/json-schema';\nimport { documentPath, documentSegments } from '../document-path.js';\nimport { closestNames } from '../expr/suggest.js';\nimport { collapseValidatorErrors } from './collapse.js';\nimport type { SchemaDiagnostic } from './diagnostic.js';\nimport { refusedMemberDetail, refusedMembersDetail, refusalOwnerOf } from './member-wording.js';\nimport { IDENTIFIER_PATTERN, metaschemaAt, pointerSegments } from './pointer.js';\nimport { noteMetaschemaValidation } from './measurement.js';\nimport { SCENARIOS_V1, SCHEMA_V1 } from './schema-v1.generated.js';\n\n/**\n * The metaschema validator. `shortCircuit: false` reports every failing keyword instead of\n * stopping at the first, which is what makes a compile diagnostic list useful to an author.\n */\nconst schemaValidator: Validator = new Validator(SCHEMA_V1, '2020-12', false);\n\n/**\n * The same metaschema, stopped at the first failing keyword. `metaschemaErrors` reaches for\n * it only when the exhaustive walk gives out, and only to name that first keyword.\n */\nconst firstFailureValidator: Validator = new Validator(SCHEMA_V1, '2020-12', true);\n\n/** The scenario-suite contract, read the same way: every reason, then the first as a fallback. */\nconst scenarioValidator: Validator = new Validator(SCENARIOS_V1, '2020-12', false);\nconst firstScenarioValidator: Validator = new Validator(SCENARIOS_V1, '2020-12', true);\n\n/**\n * Every reason the metaschema gives, or none when it accepts the document.\n *\n * The exhaustive walk is the useful one — an author fixes a document in one pass — but the\n * library accumulates each nested result with `errors.push(...result.errors)`, so error\n * volume, not document depth, is what ends it: one member name outside the closed\n * `wireValue` object grammar, restated across every element of a wide vector, fails all\n * eleven branches of that union for each element, and past roughly a hundred thousand\n * reasons the spread reaches V8's argument limit and `validate()` raises `RangeError`\n * instead of returning a verdict. A document like that is walked again with\n * `shortCircuit: true`, which stops at the first failing keyword: the author reads the one\n * reason to fix rather than a run that names none.\n */\nexport function metaschemaErrors(document: unknown): readonly OutputUnit[] {\n return validatorErrors(schemaValidator, firstFailureValidator, SCHEMA_V1, document);\n}\n\n/** Every reason the scenario-suite metaschema gives, or none when it accepts the document. */\nexport function scenarioMetaschemaErrors(document: unknown): readonly OutputUnit[] {\n return validatorErrors(scenarioValidator, firstScenarioValidator, SCENARIOS_V1, document);\n}\n\n/**\n * Every reason one metaschema gives, from the exhaustive walk, falling back to the first\n * failing keyword when the exhaustive walk runs out of stack on a wide document.\n */\nfunction validatorErrors(\n exhaustive: Validator,\n first: Validator,\n schema: Schema,\n document: unknown,\n): readonly OutputUnit[] {\n noteMetaschemaValidation();\n try {\n const validation = exhaustive.validate(document);\n return validation.valid ? [] : collapseValidatorErrors(validation.errors, schema);\n } catch (cause) {\n if (!(cause instanceof RangeError)) throw cause;\n const stopped = first.validate(document);\n // Two walks of one schema disagreeing about validity is not something to paper over, so\n // the original cause stands and a caller reports that the check could not complete.\n if (stopped.valid) throw cause;\n return collapseValidatorErrors(stopped.errors, schema);\n }\n}\n\n/** The root members the closed metaschema admits, scored for a \"did you mean?\" suggestion. */\nconst ROOT_MEMBERS: readonly string[] = Object.keys(SCHEMA_V1.properties ?? {});\n\n/**\n * The nearest root members an unknown top-level member probably meant.\n *\n * The closed metaschema refuses an undeclared member as `unevaluatedProperties`, whose message\n * names the property but not the vocabulary it missed. `field` for `fields` is the first typo a\n * document usually has, so the same nearest-name score the identifier checks use is applied to\n * the root's own member names. Only the document root is scored: a member inside a field is not\n * a root member, and offering `context` for `extra` would be a worse hint than none.\n */\nfunction rootMemberSuggestions(error: OutputUnit): readonly string[] {\n if (error.keyword !== 'unevaluatedProperties') return [];\n const segments = pointerSegments(error.instanceLocation);\n if (segments.length !== 1) return [];\n const [member] = segments;\n if (member === undefined) return [];\n return closestNames(member, ROOT_MEMBERS);\n}\n\n/**\n * The instance node one validator instance location names, or `undefined` when the location\n * names none. The location is the RFC 6901 pointer the validator reports, so its tokens are\n * literal member names and array indices.\n */\nfunction instanceAt(document: unknown, location: string): unknown {\n return valueAt(document, pointerSegments(location));\n}\n\n/** The node one pointer's segments name, walking the document from its root. */\nfunction valueAt(document: unknown, segments: readonly string[]): unknown {\n let current: unknown = document;\n for (const segment of segments) {\n if (typeof current !== 'object' || current === null) return undefined;\n current = Reflect.get(current, segment);\n }\n return current;\n}\n\n/** The member names a `required` refusal states, or `[]` when the keyword's schema states none. */\nfunction requiredNames(error: OutputUnit): readonly string[] {\n const required = metaschemaAt(error.keywordLocation);\n return Array.isArray(required)\n ? required.filter((name): name is string => typeof name === 'string')\n : [];\n}\n\n/** The required members of the refused object that the instance does not declare. */\nfunction missingMembers(error: OutputUnit, document: unknown): readonly string[] {\n const instance = instanceAt(document, error.instanceLocation);\n if (!isRecord(instance)) return [];\n return requiredNames(error).filter((name) => !Object.hasOwn(instance, name));\n}\n\n/** One name as the report spells it: in backticks, so it reads as the member it is. */\nfunction quoted(name: string): string {\n return `\\`${name}\\``;\n}\n\n/**\n * A `required` refusal in the terms an author acts on.\n *\n * The validator says `Instance does not have required property \"fields\"`, which names the\n * keyword rather than the repair and leaves an author to work out which object was meant. The\n * metaschema states the required member names at the keyword location, and the instance names\n * the members it does have, so the report can say exactly which member is missing and, at the\n * document root, which undeclared member is probably the misspelling: `field` for `fields` is\n * the first mistake a document usually has. A refusal whose members cannot be read that way\n * keeps the validator's own wording rather than guessing.\n */\nfunction requiredDetail(error: OutputUnit, document: unknown): string {\n const missing = missingMembers(error, document);\n if (missing.length === 0) return `${error.keyword}: ${error.error}`;\n const names = missing.map(quoted).join(' and ');\n const instance = instanceAt(document, error.instanceLocation);\n const atRoot = pointerSegments(error.instanceLocation).length === 0 && isRecord(instance);\n if (!atRoot) return `the object must declare the required member ${names}`;\n const undeclared = Object.keys(instance).filter((member) => !ROOT_MEMBERS.includes(member));\n const nearest = [...new Set(missing.flatMap((name) => closestNames(name, undeclared)))];\n if (nearest.length === 0) return `the document must declare the required root member ${names}`;\n const spelled = nearest.map(quoted).join(' or ');\n return `the document must declare the required root member ${names}; ${spelled} ${\n nearest.length === 1 ? 'is not a root member' : 'are not root members'\n } — probably the spelling meant`;\n}\n\n/**\n * An `enum` refusal in the terms an author acts on.\n *\n * The validator says only that the value matched no member of the list, which for a misspelt\n * control (`txt` for `text`) leaves the author to read twenty-odd names. The admitted names\n * come from the metaschema at the keyword location, so the same nearest-name score the\n * identifier checks use names the likely spelling; a value with no near miss keeps the full\n * list, because then the list *is* the fact an author needs.\n */\nfunction enumRefusal(\n error: OutputUnit,\n document: unknown,\n): { readonly detail: string; readonly suggestions: readonly string[] } {\n const admitted = metaschemaAt(error.keywordLocation);\n const values = Array.isArray(admitted)\n ? admitted.filter((value): value is string => typeof value === 'string')\n : [];\n const value = instanceAt(document, error.instanceLocation);\n if (values.length === 0 || typeof value !== 'string') {\n return { detail: `${error.keyword}: ${error.error}`, suggestions: [] };\n }\n const suggestions = closestNames(value, values);\n if (suggestions.length === 0) {\n return {\n detail: `${quoted(value)} is not one of the values this member admits; it admits ${values.map(quoted).join(', ')}`,\n suggestions,\n };\n }\n return {\n detail: `${quoted(value)} is not one of the values this member admits; did you mean ${suggestions.map(quoted).join(' or ')}?`,\n suggestions,\n };\n}\n\n/**\n * The sentence a member the closed field definition refuses earns.\n *\n * A member is refused by a `false` subschema reported at the member itself, so the declaration\n * is the instance one step above. When the collapse carried the wrapper's keyword location the\n * schema there names the member's `false` subschema; that check keeps an unknown member of a\n * closed object (which the same `properties` keyword reports) from being described as a\n * declaration member. Without a wrapper — the `false` leaf on its own — the declaration and the\n * member still name the refusal, so the sentence is produced all the same.\n */\nfunction refusedFalseMember(\n error: OutputUnit,\n document: unknown,\n requireFalseSubschema: boolean,\n): string | undefined {\n const segments = pointerSegments(error.instanceLocation);\n const member = segments[segments.length - 1];\n if (member === undefined) return undefined;\n if (requireFalseSubschema) {\n const properties = metaschemaAt(error.keywordLocation);\n if (!isRecord(properties) || Reflect.get(properties, member) !== false) return undefined;\n }\n const owner = refusalOwnerOf(valueAt(document, segments.slice(0, -1)));\n return owner === undefined ? undefined : refusedMemberDetail(member, owner);\n}\n\n/**\n * The sentence a `not` clause earns: the members whose presence the clause refuses, named on the\n * declaration that carries them. The clause's own schema states those members, so the message\n * names exactly what the metaschema refused rather than guessing from the document.\n */\nfunction refusedNotMembers(error: OutputUnit, document: unknown): string | undefined {\n const clause = metaschemaAt(error.keywordLocation);\n if (!isRecord(clause)) return undefined;\n const required = clause['required'];\n if (!Array.isArray(required)) return undefined;\n const members = required.filter((member): member is string => typeof member === 'string');\n const owner = refusalOwnerOf(instanceAt(document, error.instanceLocation));\n return owner === undefined ? undefined : refusedMembersDetail(members, owner);\n}\n\n/** The first double-quoted name in a validator message. */\nfunction firstQuotedName(error: OutputUnit): string | undefined {\n return /\"([^\"]*)\"/.exec(error.error)?.[1];\n}\n\n/** The two raw numbers a relation-shaped validator message states, in order. */\nfunction relationPair(error: OutputUnit, relation: string): readonly [string, string] | undefined {\n const match = new RegExp(`^(.*) ${relation} (.*)\\\\.$`).exec(error.error);\n const left = match?.[1];\n const right = match?.[2];\n return left === undefined || right === undefined ? undefined : [left, right];\n}\n\n/** The two raw counts an item or length message states, in order. */\nfunction countPair(error: OutputUnit, relation: '<' | '>'): readonly [string, string] | undefined {\n const match = new RegExp(`\\\\((\\\\d+) ${relation} (\\\\d+)\\\\)`).exec(error.error);\n const left = match?.[1];\n const right = match?.[2];\n return left === undefined || right === undefined ? undefined : [left, right];\n}\n\n/** The member a closed object refused, from the message or the instance path that names it. */\nfunction refusedMemberName(error: OutputUnit): string | undefined {\n const quoted = firstQuotedName(error);\n if (quoted !== undefined) return quoted;\n const segments = pointerSegments(error.instanceLocation);\n return segments[segments.length - 1];\n}\n\n/** One JSON type name in the prose a form author reads. */\nfunction typeProse(type: string): string {\n switch (type) {\n case 'string':\n return 'text';\n case 'integer':\n return 'an integer';\n case 'number':\n return 'a number';\n case 'boolean':\n return 'a boolean';\n case 'object':\n return 'an object';\n case 'array':\n return 'a list';\n case 'null':\n return 'null';\n default:\n return `a ${type}`;\n }\n}\n\n/** The plural noun a list count takes. */\nfunction entryWord(count: string): string {\n return count === '1' ? 'entry' : 'entries';\n}\n\n/**\n * The actionable rendering of one validator refusal, and the suggestions the structure carries\n * beside it. The keywords whose validator wording names no member or no repair are restated as\n * the sentence a form author acts on; `keyword` and `path` stay unchanged, so a tool branching\n * on the structured answer is unaffected. A keyword with no plain sentence keeps the\n * validator's wording (`multipleOf`, `format`, `minProperties`, `maxProperties`, `contains`,\n * `allOf`, `if`, `propertyNames` and the item wrappers).\n */\nfunction describeRefusal(\n error: OutputUnit,\n document: unknown,\n): { readonly detail: string; readonly suggestions: readonly string[] } {\n switch (error.keyword) {\n case 'required':\n return { detail: requiredDetail(error, document), suggestions: [] };\n case 'enum':\n return enumRefusal(error, document);\n case 'false': {\n const detail = refusedFalseMember(error, document, false);\n return detail === undefined\n ? { detail: `${error.keyword}: ${error.error}`, suggestions: [] }\n : { detail, suggestions: [] };\n }\n case 'properties': {\n const detail = refusedFalseMember(error, document, true);\n return detail === undefined\n ? { detail: `${error.keyword}: ${error.error}`, suggestions: [] }\n : { detail, suggestions: [] };\n }\n case 'not': {\n const detail = refusedNotMembers(error, document);\n return detail === undefined\n ? { detail: `${error.keyword}: ${error.error}`, suggestions: [] }\n : { detail, suggestions: [] };\n }\n case 'unevaluatedProperties':\n case 'additionalProperties': {\n const member = refusedMemberName(error);\n return {\n detail:\n member === undefined\n ? `${error.keyword}: ${error.error}`\n : `${quoted(member)} is not a member of this object; remove it or use an admitted member.`,\n suggestions: rootMemberSuggestions(error),\n };\n }\n case 'minItems': {\n const pair = countPair(error, '<');\n return {\n detail:\n pair === undefined\n ? `${error.keyword}: ${error.error}`\n : `the list needs at least ${pair[1]} ${entryWord(pair[1])}; it holds ${pair[0]}.`,\n suggestions: [],\n };\n }\n case 'maxItems': {\n const pair = countPair(error, '>');\n return {\n detail:\n pair === undefined\n ? `${error.keyword}: ${error.error}`\n : `the list needs at most ${pair[1]} ${entryWord(pair[1])}; it holds ${pair[0]}.`,\n suggestions: [],\n };\n }\n case 'minLength': {\n const pair = countPair(error, '<');\n return {\n detail:\n pair === undefined\n ? `${error.keyword}: ${error.error}`\n : `the text has ${pair[0]} characters; the minimum is ${pair[1]}.`,\n suggestions: [],\n };\n }\n case 'maxLength': {\n const pair = countPair(error, '>');\n return {\n detail:\n pair === undefined\n ? `${error.keyword}: ${error.error}`\n : `the text has ${pair[0]} characters; the maximum is ${pair[1]}.`,\n suggestions: [],\n };\n }\n case 'minimum': {\n const pair = relationPair(error, 'is less than');\n return {\n detail:\n pair === undefined\n ? `${error.keyword}: ${error.error}`\n : `the value is ${pair[0]}; the smallest admitted value is ${pair[1]}.`,\n suggestions: [],\n };\n }\n case 'exclusiveMinimum': {\n const pair = relationPair(error, 'is less than');\n return {\n detail:\n pair === undefined\n ? `${error.keyword}: ${error.error}`\n : `the value is ${pair[0]}; it must be greater than ${pair[1]}.`,\n suggestions: [],\n };\n }\n case 'maximum': {\n const pair = relationPair(error, 'is greater than');\n return {\n detail:\n pair === undefined\n ? `${error.keyword}: ${error.error}`\n : `the value is ${pair[0]}; the largest admitted value is ${pair[1]}.`,\n suggestions: [],\n };\n }\n case 'exclusiveMaximum': {\n const pair = relationPair(error, 'is greater than or equal to');\n return {\n detail:\n pair === undefined\n ? `${error.keyword}: ${error.error}`\n : `the value is ${pair[0]}; it must be less than ${pair[1]}.`,\n suggestions: [],\n };\n }\n case 'uniqueItems': {\n const match = /indexes (\\d+) and (\\d+)/.exec(error.error);\n const first = match?.[1];\n const second = match?.[2];\n return {\n detail:\n first === undefined || second === undefined\n ? `${error.keyword}: ${error.error}`\n : `two entries hold the same value, at positions ${String(Number(first) + 1)} and ${String(Number(second) + 1)}.`,\n suggestions: [],\n };\n }\n case 'type': {\n const actual = /^Instance type \"([^\"]*)\"/.exec(error.error)?.[1];\n const expectedText = /Expected (\".*\")\\.$/.exec(error.error)?.[1];\n const expected = expectedText?.matchAll(/\"([^\"]*)\"/g) ?? [];\n const admitted = [...expected].flatMap((match) => (match[1] === undefined ? [] : [match[1]]));\n return {\n detail:\n actual === undefined || admitted.length === 0\n ? `${error.keyword}: ${error.error}`\n : `this member holds ${admitted.map(typeProse).join(' or ')}; the document states ${typeProse(actual)}.`,\n suggestions: [],\n };\n }\n case 'const': {\n const value = /^Instance does not match (.*)\\.$/.exec(error.error)?.[1];\n return {\n detail:\n value === undefined\n ? `${error.keyword}: ${error.error}`\n : `this member must be ${value}.`,\n suggestions: [],\n };\n }\n case 'pattern': {\n const detail =\n metaschemaAt(error.keywordLocation) === IDENTIFIER_PATTERN\n ? `the text must match ${IDENTIFIER_PATTERN} — a lower-case identifier: a letter first, then lower-case letters, digits or underscores`\n : 'the text must match the declared pattern.';\n return { detail, suggestions: [] };\n }\n case 'anyOf':\n return {\n detail:\n 'this member matches none of the admitted forms; remove it, or write the form the schema names here',\n suggestions: [],\n };\n case 'oneOf': {\n const matches = /\\((\\d+) matches?\\)/.exec(error.error)?.[1];\n return {\n detail:\n matches === undefined || Number(matches) === 0\n ? 'this member matches none of the admitted forms; it must match exactly one.'\n : `this member matches ${matches} admitted forms; it must match exactly one.`,\n suggestions: [],\n };\n }\n case 'dependentRequired': {\n const match = /^Instance has \"([^\"]*)\" but does not have \"([^\"]*)\"\\.$/.exec(error.error);\n const declared = match?.[1];\n const dependent = match?.[2];\n return {\n detail:\n declared === undefined || dependent === undefined\n ? `${error.keyword}: ${error.error}`\n : `the object declares ${quoted(declared)}, so it must also declare ${quoted(dependent)}.`,\n suggestions: [],\n };\n }\n default:\n return {\n detail: `${error.keyword}: ${error.error}`,\n suggestions: rootMemberSuggestions(error),\n };\n }\n}\n\nexport function validatorDiagnostic(error: OutputUnit, document: unknown): SchemaDiagnostic {\n const refusal = describeRefusal(error, document);\n return {\n code: 'SCHEMA_INVALID',\n path: documentPath(error.instanceLocation, document),\n detail: refusal.detail,\n keyword: error.keyword,\n schemaPath: pointerSegments(error.keywordLocation).map(numericSegment),\n // The same steps `path` renders, resolved against the document, so an editor and a\n // reader of the prose location never disagree about which member or element is meant.\n instancePath: [...documentSegments(error.instanceLocation, document)],\n // The identifier grammar is the one bound an author can satisfy by rewriting the value,\n // so the required form travels as structure rather than only inside the prose.\n ...(error.keyword === 'pattern' && metaschemaAt(error.keywordLocation) === IDENTIFIER_PATTERN\n ? { expected: IDENTIFIER_PATTERN }\n : {}),\n ...(refusal.suggestions.length === 0 ? {} : { suggestions: refusal.suggestions }),\n };\n}\n\n/** A pointer token that is a JavaScript array index, so an index is reported as a number. */\nfunction numericSegment(segment: string): string | number {\n return /^\\d+$/.test(segment) ? Number(segment) : segment;\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a located metaschema: the pointer grammar the validator reports in, and the
|
|
3
|
+
* metaschema node a pointer names.
|
|
4
|
+
*
|
|
5
|
+
* The compiler's diagnostics need two things from a validator reason: where it happened in the
|
|
6
|
+
* document, and what the metaschema says at the keyword that refused it. Both are pointer
|
|
7
|
+
* walks, so they live together and neither the collapse nor the renderer owns a copy.
|
|
8
|
+
*/
|
|
9
|
+
import type { Schema } from '@cfworker/json-schema';
|
|
10
|
+
/**
|
|
11
|
+
* The JSON Pointer segments of a validator keyword or instance location: RFC 6901 tokens,
|
|
12
|
+
* percent-decoded first and then pointer-unescaped, so a `/` inside a property name stays
|
|
13
|
+
* one step. Numeric tokens stay text here; `documentPath` decides whether one is an index.
|
|
14
|
+
*/
|
|
15
|
+
export declare function pointerSegments(location: string): readonly string[];
|
|
16
|
+
/**
|
|
17
|
+
* The metaschema value one keyword location points at, for reading the keyword's own bound.
|
|
18
|
+
*
|
|
19
|
+
* The document's own schema is a parameter because the compiler reads two published contracts
|
|
20
|
+
* — the schema document and a scenario suite — and a keyword location only means something
|
|
21
|
+
* against the schema that emitted it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function metaschemaAt(keywordLocation: string, schema?: Schema): unknown;
|
|
24
|
+
/**
|
|
25
|
+
* The identifier grammar the metaschema states, read from the metaschema itself so the
|
|
26
|
+
* actionable wording and `expected` field cannot silently stop matching when the contract
|
|
27
|
+
* changes. A hand-typed copy would fail open: the generic `pattern` diagnostic would be the
|
|
28
|
+
* only trace.
|
|
29
|
+
*/
|
|
30
|
+
export declare const IDENTIFIER_PATTERN: string;
|
|
31
|
+
//# sourceMappingURL=pointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointer.d.ts","sourceRoot":"","sources":["../../src/schema/pointer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAOnE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,GAAE,MAAkB,GAAG,OAAO,CAazF;AAsBD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAM7B,CAAC"}
|