@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,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summarising what a run's scenario suites decided.
|
|
3
|
+
*
|
|
4
|
+
* An executed suite is evidence, so it is reported like the embedded vectors are: one summary
|
|
5
|
+
* line per suite and one line per assertion that did not hold, named by its scenario and target.
|
|
6
|
+
* The lines are built here and printed by the command, which owns the diagnostic cap and the
|
|
7
|
+
* choice of stream.
|
|
8
|
+
*/
|
|
9
|
+
import { describeTarget } from '../scenarios/report.js';
|
|
10
|
+
import { counted } from './count.js';
|
|
11
|
+
/** The assertion counts one suite's report states. */
|
|
12
|
+
function counts(report) {
|
|
13
|
+
if (report.status === 'invalid')
|
|
14
|
+
return { total: 0, passed: 0 };
|
|
15
|
+
const assertions = report.scenarios.flatMap((scenario) => scenario.assertions);
|
|
16
|
+
return {
|
|
17
|
+
total: assertions.length,
|
|
18
|
+
passed: assertions.filter((assertion) => assertion.passed).length,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** One suite's failure lines: every assertion that did not hold, named by scenario and target. */
|
|
22
|
+
function failureLines(source, report) {
|
|
23
|
+
if (report.status === 'invalid') {
|
|
24
|
+
return report.diagnostics.map((diagnostic) => `${source}: ${diagnostic.path}: ${diagnostic.code}: ${diagnostic.detail}`);
|
|
25
|
+
}
|
|
26
|
+
return report.scenarios.flatMap((scenario) => scenario.assertions.flatMap((assertion) => assertion.passed
|
|
27
|
+
? []
|
|
28
|
+
: [
|
|
29
|
+
`${source}: scenario \`${scenario.scenarioId}\`: ${describeTarget(assertion.target)}: ${assertion.detail}`,
|
|
30
|
+
]));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Builds the lines a run prints for the suites it executed.
|
|
34
|
+
*
|
|
35
|
+
* A suite the run named but could not execute is stated with the reason the run refused before
|
|
36
|
+
* executing it. A missing report with no reason is a caller defect — the command must say why —
|
|
37
|
+
* so it throws instead of dropping the suite from the transcript.
|
|
38
|
+
*/
|
|
39
|
+
export function suiteReport(suites, reports, notRun) {
|
|
40
|
+
const summaries = [];
|
|
41
|
+
const failures = [];
|
|
42
|
+
suites.forEach((suite, index) => {
|
|
43
|
+
const report = reports[index];
|
|
44
|
+
if (report === undefined) {
|
|
45
|
+
if (notRun === undefined) {
|
|
46
|
+
throw new Error(`internal error: suite ${suite.source} has no report and no reason; the caller must state why it did not run`);
|
|
47
|
+
}
|
|
48
|
+
summaries.push(`${suite.source}: not run: ${notRun}`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const { total, passed } = counts(report);
|
|
52
|
+
const status = report.status === 'invalid' ? 'refused' : report.status;
|
|
53
|
+
summaries.push(`${suite.source}: ${counted(total, 'assertion')}, ${String(passed)} passed, ${String(total - passed)} failed (suite ${status})`);
|
|
54
|
+
failures.push(...failureLines(suite.source, report));
|
|
55
|
+
});
|
|
56
|
+
return { summaries, failures };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=suite-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite-report.js","sourceRoot":"","sources":["../../src/cli/suite-report.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Summarising what a run's scenario suites decided.\n *\n * An executed suite is evidence, so it is reported like the embedded vectors are: one summary\n * line per suite and one line per assertion that did not hold, named by its scenario and target.\n * The lines are built here and printed by the command, which owns the diagnostic cap and the\n * choice of stream.\n */\nimport { describeTarget } from '../scenarios/report.js';\nimport type { ScenarioSuiteReport } from '../scenarios/report.js';\nimport { counted } from './count.js';\nimport type { LoadedSuite } from './suites.js';\n\n/** One run's suite lines, split into what always prints and what the cap bounds. */\nexport interface SuiteReport {\n /** One line per suite: assertions run, passed, failed, and the suite's own verdict. */\n readonly summaries: readonly string[];\n /** One line per assertion that did not hold, in suite then document order. */\n readonly failures: readonly string[];\n}\n\n/** The assertion counts one suite's report states. */\nfunction counts(report: ScenarioSuiteReport): { readonly total: number; readonly passed: number } {\n if (report.status === 'invalid') return { total: 0, passed: 0 };\n const assertions = report.scenarios.flatMap((scenario) => scenario.assertions);\n return {\n total: assertions.length,\n passed: assertions.filter((assertion) => assertion.passed).length,\n };\n}\n\n/** One suite's failure lines: every assertion that did not hold, named by scenario and target. */\nfunction failureLines(source: string, report: ScenarioSuiteReport): readonly string[] {\n if (report.status === 'invalid') {\n return report.diagnostics.map(\n (diagnostic) => `${source}: ${diagnostic.path}: ${diagnostic.code}: ${diagnostic.detail}`,\n );\n }\n return report.scenarios.flatMap((scenario) =>\n scenario.assertions.flatMap((assertion) =>\n assertion.passed\n ? []\n : [\n `${source}: scenario \\`${scenario.scenarioId}\\`: ${describeTarget(assertion.target)}: ${assertion.detail}`,\n ],\n ),\n );\n}\n\n/**\n * Builds the lines a run prints for the suites it executed.\n *\n * A suite the run named but could not execute is stated with the reason the run refused before\n * executing it. A missing report with no reason is a caller defect — the command must say why —\n * so it throws instead of dropping the suite from the transcript.\n */\nexport function suiteReport(\n suites: readonly LoadedSuite[],\n reports: readonly ScenarioSuiteReport[],\n notRun?: string,\n): SuiteReport {\n const summaries: string[] = [];\n const failures: string[] = [];\n suites.forEach((suite, index) => {\n const report = reports[index];\n if (report === undefined) {\n if (notRun === undefined) {\n throw new Error(\n `internal error: suite ${suite.source} has no report and no reason; the caller must state why it did not run`,\n );\n }\n summaries.push(`${suite.source}: not run: ${notRun}`);\n return;\n }\n const { total, passed } = counts(report);\n const status = report.status === 'invalid' ? 'refused' : report.status;\n summaries.push(\n `${suite.source}: ${counted(total, 'assertion')}, ${String(passed)} passed, ${String(total - passed)} failed (suite ${status})`,\n );\n failures.push(...failureLines(suite.source, report));\n });\n return { summaries, failures };\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ScenarioSuiteDocument } from '../scenarios/document.js';
|
|
2
|
+
import type { CompiledSchema } from '@azx-pbc/axiom-runtime';
|
|
3
|
+
import type { DiagnosticCap } from './args.js';
|
|
4
|
+
/** One suite document, named by the file it was read from. */
|
|
5
|
+
export interface LoadedSuite {
|
|
6
|
+
readonly source: string;
|
|
7
|
+
readonly suite: ScenarioSuiteDocument;
|
|
8
|
+
}
|
|
9
|
+
/** Every suite a run named, or the exit code of the file that stopped it. */
|
|
10
|
+
export type SuiteRead = {
|
|
11
|
+
readonly ok: true;
|
|
12
|
+
readonly suites: readonly LoadedSuite[];
|
|
13
|
+
} | {
|
|
14
|
+
readonly ok: false;
|
|
15
|
+
readonly exitCode: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Reads every suite the operator named, in the order given.
|
|
19
|
+
*
|
|
20
|
+
* A file that cannot be read keeps the read's own exit code, because a missing file is a misuse
|
|
21
|
+
* rather than a document defect. A file that reads but is not a suite document is a failed run
|
|
22
|
+
* (`EXIT_FAILED`): it declares assertions this run was asked to execute, and it did not.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readSuites(targets: readonly string[], cap: DiagnosticCap, compiled: CompiledSchema): Promise<SuiteRead>;
|
|
25
|
+
//# sourceMappingURL=suites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suites.d.ts","sourceRoot":"","sources":["../../src/cli/suites.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAM/C,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;CACvC;AAED,6EAA6E;AAC7E,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;CAAE,GAC9D;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AA4BtD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,CAmBpB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the scenario suites a `test` run names.
|
|
3
|
+
*
|
|
4
|
+
* This is the one place the suite file dialect is decided: a caller names files and gets parsed
|
|
5
|
+
* `ScenarioSuiteDocument`s or the reasons they are not. The reader holds no runner, no coverage
|
|
6
|
+
* logic and no report: a suite that reads is handed to `verifyPublishReadiness`, and one that does
|
|
7
|
+
* not is refused with the parser's own code, path and detail.
|
|
8
|
+
*
|
|
9
|
+
* A `.csv` file is a flat scenario matrix: it is read against the compiled artifact the run will
|
|
10
|
+
* judge it with, because a cell's primitive is the field's declaration, and it becomes the same
|
|
11
|
+
* `ScenarioSuiteDocument` a JSON file does. Nothing downstream knows which dialect the bytes
|
|
12
|
+
* arrived in.
|
|
13
|
+
*/
|
|
14
|
+
import { parseScenarioSuite } from '../scenarios/document.js';
|
|
15
|
+
import { parseScenarioCsv } from '../scenarios/csv.js';
|
|
16
|
+
import { MAX_INPUT_BYTES } from '../csv/limits.js';
|
|
17
|
+
import { noun } from './count.js';
|
|
18
|
+
import { displayPath, readText } from './read.js';
|
|
19
|
+
import { printErrorLine } from './terminal.js';
|
|
20
|
+
import { EXIT_FAILED } from './usage.js';
|
|
21
|
+
/** One scenario diagnostic as a terminal line: the document, the location and the reason. */
|
|
22
|
+
function diagnosticLine(diagnostic) {
|
|
23
|
+
return `${diagnostic.path}: ${diagnostic.code}: ${diagnostic.detail}`;
|
|
24
|
+
}
|
|
25
|
+
/** Prints a refused suite's diagnostics, bounded by the cap the operator named. */
|
|
26
|
+
function reportSuiteDiagnostics(source, diagnostics, cap) {
|
|
27
|
+
const shown = cap === 'all' ? diagnostics : diagnostics.slice(0, cap);
|
|
28
|
+
for (const diagnostic of shown)
|
|
29
|
+
printErrorLine(`${source}: ${diagnosticLine(diagnostic)}`);
|
|
30
|
+
const withheld = diagnostics.length - shown.length;
|
|
31
|
+
if (withheld > 0) {
|
|
32
|
+
printErrorLine(`${source}: … and ${String(withheld)} more ${noun(withheld, 'diagnostic')} withheld; run again with --max-diagnostics=all to see them`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Whether a suite file is a flat scenario matrix rather than a JSON suite document. */
|
|
36
|
+
function isCsvTarget(target) {
|
|
37
|
+
return target.toLowerCase().endsWith('.csv');
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reads every suite the operator named, in the order given.
|
|
41
|
+
*
|
|
42
|
+
* A file that cannot be read keeps the read's own exit code, because a missing file is a misuse
|
|
43
|
+
* rather than a document defect. A file that reads but is not a suite document is a failed run
|
|
44
|
+
* (`EXIT_FAILED`): it declares assertions this run was asked to execute, and it did not.
|
|
45
|
+
*/
|
|
46
|
+
export async function readSuites(targets, cap, compiled) {
|
|
47
|
+
const suites = [];
|
|
48
|
+
for (const target of targets) {
|
|
49
|
+
const source = displayPath(target);
|
|
50
|
+
const csv = isCsvTarget(target);
|
|
51
|
+
// A scenario matrix carries the CSV front-end's declared input-byte bound, so it is refused
|
|
52
|
+
// by the reader before a large file is buffered. A JSON suite declares no bound.
|
|
53
|
+
const read = csv
|
|
54
|
+
? await readText(target, { maxBytes: MAX_INPUT_BYTES })
|
|
55
|
+
: await readText(target);
|
|
56
|
+
if (!read.ok)
|
|
57
|
+
return { ok: false, exitCode: read.exitCode };
|
|
58
|
+
const parsed = csv ? parseScenarioCsv(read.text, compiled) : parseScenarioSuite(read.text);
|
|
59
|
+
if (!parsed.ok) {
|
|
60
|
+
reportSuiteDiagnostics(source, parsed.diagnostics, cap);
|
|
61
|
+
return { ok: false, exitCode: EXIT_FAILED };
|
|
62
|
+
}
|
|
63
|
+
suites.push({ source, suite: parsed.suite });
|
|
64
|
+
}
|
|
65
|
+
return { ok: true, suites };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=suites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suites.js","sourceRoot":"","sources":["../../src/cli/suites.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Reading the scenario suites a `test` run names.\n *\n * This is the one place the suite file dialect is decided: a caller names files and gets parsed\n * `ScenarioSuiteDocument`s or the reasons they are not. The reader holds no runner, no coverage\n * logic and no report: a suite that reads is handed to `verifyPublishReadiness`, and one that does\n * not is refused with the parser's own code, path and detail.\n *\n * A `.csv` file is a flat scenario matrix: it is read against the compiled artifact the run will\n * judge it with, because a cell's primitive is the field's declaration, and it becomes the same\n * `ScenarioSuiteDocument` a JSON file does. Nothing downstream knows which dialect the bytes\n * arrived in.\n */\nimport { parseScenarioSuite } from '../scenarios/document.js';\nimport type { ScenarioSuiteDocument } from '../scenarios/document.js';\nimport { parseScenarioCsv } from '../scenarios/csv.js';\nimport type { ScenarioDiagnostic } from '../scenarios/report.js';\nimport type { CompiledSchema } from '@azx-pbc/axiom-runtime';\nimport { MAX_INPUT_BYTES } from '../csv/limits.js';\nimport type { DiagnosticCap } from './args.js';\nimport { noun } from './count.js';\nimport { displayPath, readText } from './read.js';\nimport { printErrorLine } from './terminal.js';\nimport { EXIT_FAILED } from './usage.js';\n\n/** One suite document, named by the file it was read from. */\nexport interface LoadedSuite {\n readonly source: string;\n readonly suite: ScenarioSuiteDocument;\n}\n\n/** Every suite a run named, or the exit code of the file that stopped it. */\nexport type SuiteRead =\n | { readonly ok: true; readonly suites: readonly LoadedSuite[] }\n | { readonly ok: false; readonly exitCode: number };\n\n/** One scenario diagnostic as a terminal line: the document, the location and the reason. */\nfunction diagnosticLine(diagnostic: ScenarioDiagnostic): string {\n return `${diagnostic.path}: ${diagnostic.code}: ${diagnostic.detail}`;\n}\n\n/** Prints a refused suite's diagnostics, bounded by the cap the operator named. */\nfunction reportSuiteDiagnostics(\n source: string,\n diagnostics: readonly ScenarioDiagnostic[],\n cap: DiagnosticCap,\n): void {\n const shown = cap === 'all' ? diagnostics : diagnostics.slice(0, cap);\n for (const diagnostic of shown) printErrorLine(`${source}: ${diagnosticLine(diagnostic)}`);\n const withheld = diagnostics.length - shown.length;\n if (withheld > 0) {\n printErrorLine(\n `${source}: … and ${String(withheld)} more ${noun(withheld, 'diagnostic')} withheld; run again with --max-diagnostics=all to see them`,\n );\n }\n}\n\n/** Whether a suite file is a flat scenario matrix rather than a JSON suite document. */\nfunction isCsvTarget(target: string): boolean {\n return target.toLowerCase().endsWith('.csv');\n}\n\n/**\n * Reads every suite the operator named, in the order given.\n *\n * A file that cannot be read keeps the read's own exit code, because a missing file is a misuse\n * rather than a document defect. A file that reads but is not a suite document is a failed run\n * (`EXIT_FAILED`): it declares assertions this run was asked to execute, and it did not.\n */\nexport async function readSuites(\n targets: readonly string[],\n cap: DiagnosticCap,\n compiled: CompiledSchema,\n): Promise<SuiteRead> {\n const suites: LoadedSuite[] = [];\n for (const target of targets) {\n const source = displayPath(target);\n const csv = isCsvTarget(target);\n // A scenario matrix carries the CSV front-end's declared input-byte bound, so it is refused\n // by the reader before a large file is buffered. A JSON suite declares no bound.\n const read = csv\n ? await readText(target, { maxBytes: MAX_INPUT_BYTES })\n : await readText(target);\n if (!read.ok) return { ok: false, exitCode: read.exitCode };\n const parsed = csv ? parseScenarioCsv(read.text, compiled) : parseScenarioSuite(read.text);\n if (!parsed.ok) {\n reportSuiteDiagnostics(source, parsed.diagnostics, cap);\n return { ok: false, exitCode: EXIT_FAILED };\n }\n suites.push({ source, suite: parsed.suite });\n }\n return { ok: true, suites };\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A document serialized as JSON text a terminal can be shown.
|
|
3
|
+
*
|
|
4
|
+
* An emitted artifact carries message catalogues, which are free text, so the bytes go to
|
|
5
|
+
* stdout through the same boundary as a diagnostic: each code point a terminal acts on
|
|
6
|
+
* becomes its JSON `\uXXXX` escape. That is a legal spelling of the same string, so what a
|
|
7
|
+
* caller pipes onward still parses back to the document that was compiled.
|
|
8
|
+
*/
|
|
9
|
+
export declare function jsonText(value: unknown): string;
|
|
10
|
+
/**
|
|
11
|
+
* Already-serialized JSON text, spelled for a terminal.
|
|
12
|
+
*
|
|
13
|
+
* A command that writes its own canonical bytes rather than a pretty document still crosses the
|
|
14
|
+
* same boundary when it writes them to a stream: RFC 8785 spells a C0 control as an escape, but
|
|
15
|
+
* DEL, the C1 range and the bidi controls stay literal, and a document those bytes came from
|
|
16
|
+
* declared them. Each becomes its JSON escape, which parses back to the same string.
|
|
17
|
+
*/
|
|
18
|
+
export declare function jsonTerminalText(text: string): string;
|
|
19
|
+
/** One escaped line of a command's own output. */
|
|
20
|
+
export declare function printLine(text: string): void;
|
|
21
|
+
/** One escaped line of a command's diagnostics. */
|
|
22
|
+
export declare function printErrorLine(text: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* This module's own constant text — help and usage — written verbatim.
|
|
25
|
+
* Nothing an untrusted document declared may reach this function: it is not escaped, which
|
|
26
|
+
* is why the only callers pass a member of `USAGE` or `HELP`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function printStaticText(text: string): void;
|
|
29
|
+
/** The same constant text on the diagnostics stream, for a command that cannot run. */
|
|
30
|
+
export declare function printStaticError(text: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* A reader that stops reading is not a document failure.
|
|
33
|
+
*
|
|
34
|
+
* `compile` and `compile-dataset` emit artifacts that can be megabytes long, so
|
|
35
|
+
* `axiom-cli compile … | head` closes the pipe while the document is still being written. An
|
|
36
|
+
* unhandled `EPIPE` ends the run with a Node stack trace and exit code 1 — the code this
|
|
37
|
+
* program's own contract reserves for a document that failed to compile — so the rest of the
|
|
38
|
+
* document is dropped instead and the command's own verdict stands. Every other write failure
|
|
39
|
+
* is still thrown: this handler knows how to ignore one condition, not how to report all of
|
|
40
|
+
* them, and a stream that failed for another reason must stay as loud as it was.
|
|
41
|
+
*/
|
|
42
|
+
export declare function ignoreClosedPipe(stream: NodeJS.WriteStream): void;
|
|
43
|
+
/** The underlying cause of a failure, so the operator sees what the system actually said. */
|
|
44
|
+
export declare function causeText(cause: unknown): string;
|
|
45
|
+
//# sourceMappingURL=terminal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/cli/terminal.ts"],"names":[],"mappings":"AAwDA;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/C;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED,kDAAkD;AAClD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,mDAAmD;AACnD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnD;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,IAAI,CAKjE;AAED,6FAA6F;AAC7F,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEhD"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The terminal boundary.
|
|
3
|
+
*
|
|
4
|
+
* Nothing that reaches a terminal is trusted. Every line the command line writes
|
|
5
|
+
* interpolates text an untrusted document declared — a field name, an option code, a CSV
|
|
6
|
+
* cell, a file path — so the last step before a byte leaves is `terminalText`, which spells
|
|
7
|
+
* out every code point a terminal acts on. An emitted JSON document goes through `jsonText`
|
|
8
|
+
* instead, which spells those code points as JSON escapes and so stays parseable.
|
|
9
|
+
*/
|
|
10
|
+
import process from 'node:process';
|
|
11
|
+
/** Whether a terminal acts on this code point, or a bidi control reorders the line with it. */
|
|
12
|
+
function isTerminalControl(code) {
|
|
13
|
+
return (code <= 0x1f ||
|
|
14
|
+
(code >= 0x7f && code <= 0x9f) ||
|
|
15
|
+
code === 0x061c ||
|
|
16
|
+
code === 0x200e ||
|
|
17
|
+
code === 0x200f ||
|
|
18
|
+
(code >= 0x202a && code <= 0x202e) ||
|
|
19
|
+
(code >= 0x2066 && code <= 0x2069));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Text safe to write to an operator's terminal.
|
|
23
|
+
*
|
|
24
|
+
* A diagnostic interpolates what an untrusted document declared, and not all of it is
|
|
25
|
+
* constrained: the validator quotes an offending property name back in its message, a
|
|
26
|
+
* message catalogue carries free text, and `option.code` is any non-empty string. Emitting
|
|
27
|
+
* those bytes raw would let the document drive the terminal — rewriting the screen, setting
|
|
28
|
+
* a title, writing the clipboard, or injecting a clickable OSC 8 link into an operator's
|
|
29
|
+
* terminal and a CI log — and a newline inside one would forge extra diagnostic lines.
|
|
30
|
+
* Unicode bidirectional controls are spelled out for the same reason: they reorder the rest
|
|
31
|
+
* of the line, so a document could disguise which path a refusal names. Every C0, C1, DEL
|
|
32
|
+
* code point and every code point with the Unicode `Bidi_Control` property — U+061C,
|
|
33
|
+
* U+200E, U+200F, U+202A-U+202E and U+2066-U+2069 — is spelled as `<hex>` instead of
|
|
34
|
+
* emitted; the terminal is the boundary, and nothing crosses it unencoded.
|
|
35
|
+
*/
|
|
36
|
+
function terminalText(text) {
|
|
37
|
+
let encoded = '';
|
|
38
|
+
for (const character of text) {
|
|
39
|
+
const code = character.codePointAt(0) ?? 0;
|
|
40
|
+
encoded += isTerminalControl(code) ? `<${code.toString(16).padStart(2, '0')}>` : character;
|
|
41
|
+
}
|
|
42
|
+
return encoded;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The code points that reach a terminal hostile through JSON text: DEL, the C1 range and
|
|
46
|
+
* every bidi control. C0 is absent because `JSON.stringify` already spells those inside a
|
|
47
|
+
* string literal, and the structural characters a pretty-printed document contains are
|
|
48
|
+
* ASCII, so neither can be hit by this replacement.
|
|
49
|
+
*/
|
|
50
|
+
const JSON_TERMINAL_CONTROL = /[\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
51
|
+
/**
|
|
52
|
+
* A document serialized as JSON text a terminal can be shown.
|
|
53
|
+
*
|
|
54
|
+
* An emitted artifact carries message catalogues, which are free text, so the bytes go to
|
|
55
|
+
* stdout through the same boundary as a diagnostic: each code point a terminal acts on
|
|
56
|
+
* becomes its JSON `\uXXXX` escape. That is a legal spelling of the same string, so what a
|
|
57
|
+
* caller pipes onward still parses back to the document that was compiled.
|
|
58
|
+
*/
|
|
59
|
+
export function jsonText(value) {
|
|
60
|
+
return jsonTerminalText(JSON.stringify(value, null, 2));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Already-serialized JSON text, spelled for a terminal.
|
|
64
|
+
*
|
|
65
|
+
* A command that writes its own canonical bytes rather than a pretty document still crosses the
|
|
66
|
+
* same boundary when it writes them to a stream: RFC 8785 spells a C0 control as an escape, but
|
|
67
|
+
* DEL, the C1 range and the bidi controls stay literal, and a document those bytes came from
|
|
68
|
+
* declared them. Each becomes its JSON escape, which parses back to the same string.
|
|
69
|
+
*/
|
|
70
|
+
export function jsonTerminalText(text) {
|
|
71
|
+
return text.replace(JSON_TERMINAL_CONTROL, (character) => `\\u${(character.codePointAt(0) ?? 0).toString(16).padStart(4, '0')}`);
|
|
72
|
+
}
|
|
73
|
+
/** One escaped line of a command's own output. */
|
|
74
|
+
export function printLine(text) {
|
|
75
|
+
process.stdout.write(`${terminalText(text)}\n`);
|
|
76
|
+
}
|
|
77
|
+
/** One escaped line of a command's diagnostics. */
|
|
78
|
+
export function printErrorLine(text) {
|
|
79
|
+
process.stderr.write(`${terminalText(text)}\n`);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* This module's own constant text — help and usage — written verbatim.
|
|
83
|
+
* Nothing an untrusted document declared may reach this function: it is not escaped, which
|
|
84
|
+
* is why the only callers pass a member of `USAGE` or `HELP`.
|
|
85
|
+
*/
|
|
86
|
+
export function printStaticText(text) {
|
|
87
|
+
process.stdout.write(text);
|
|
88
|
+
}
|
|
89
|
+
/** The same constant text on the diagnostics stream, for a command that cannot run. */
|
|
90
|
+
export function printStaticError(text) {
|
|
91
|
+
process.stderr.write(text);
|
|
92
|
+
}
|
|
93
|
+
/** Whether a write failed because the reader closed the pipe it was reading from. */
|
|
94
|
+
function isClosedPipe(cause) {
|
|
95
|
+
return cause instanceof Error && 'code' in cause && cause.code === 'EPIPE';
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A reader that stops reading is not a document failure.
|
|
99
|
+
*
|
|
100
|
+
* `compile` and `compile-dataset` emit artifacts that can be megabytes long, so
|
|
101
|
+
* `axiom-cli compile … | head` closes the pipe while the document is still being written. An
|
|
102
|
+
* unhandled `EPIPE` ends the run with a Node stack trace and exit code 1 — the code this
|
|
103
|
+
* program's own contract reserves for a document that failed to compile — so the rest of the
|
|
104
|
+
* document is dropped instead and the command's own verdict stands. Every other write failure
|
|
105
|
+
* is still thrown: this handler knows how to ignore one condition, not how to report all of
|
|
106
|
+
* them, and a stream that failed for another reason must stay as loud as it was.
|
|
107
|
+
*/
|
|
108
|
+
export function ignoreClosedPipe(stream) {
|
|
109
|
+
stream.on('error', (cause) => {
|
|
110
|
+
if (isClosedPipe(cause))
|
|
111
|
+
return;
|
|
112
|
+
throw cause;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** The underlying cause of a failure, so the operator sees what the system actually said. */
|
|
116
|
+
export function causeText(cause) {
|
|
117
|
+
return cause instanceof Error ? cause.message : String(cause);
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.js","sourceRoot":"","sources":["../../src/cli/terminal.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * The terminal boundary.\n *\n * Nothing that reaches a terminal is trusted. Every line the command line writes\n * interpolates text an untrusted document declared — a field name, an option code, a CSV\n * cell, a file path — so the last step before a byte leaves is `terminalText`, which spells\n * out every code point a terminal acts on. An emitted JSON document goes through `jsonText`\n * instead, which spells those code points as JSON escapes and so stays parseable.\n */\nimport process from 'node:process';\n\n/** Whether a terminal acts on this code point, or a bidi control reorders the line with it. */\nfunction isTerminalControl(code: number): boolean {\n return (\n code <= 0x1f ||\n (code >= 0x7f && code <= 0x9f) ||\n code === 0x061c ||\n code === 0x200e ||\n code === 0x200f ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069)\n );\n}\n\n/**\n * Text safe to write to an operator's terminal.\n *\n * A diagnostic interpolates what an untrusted document declared, and not all of it is\n * constrained: the validator quotes an offending property name back in its message, a\n * message catalogue carries free text, and `option.code` is any non-empty string. Emitting\n * those bytes raw would let the document drive the terminal — rewriting the screen, setting\n * a title, writing the clipboard, or injecting a clickable OSC 8 link into an operator's\n * terminal and a CI log — and a newline inside one would forge extra diagnostic lines.\n * Unicode bidirectional controls are spelled out for the same reason: they reorder the rest\n * of the line, so a document could disguise which path a refusal names. Every C0, C1, DEL\n * code point and every code point with the Unicode `Bidi_Control` property — U+061C,\n * U+200E, U+200F, U+202A-U+202E and U+2066-U+2069 — is spelled as `<hex>` instead of\n * emitted; the terminal is the boundary, and nothing crosses it unencoded.\n */\nfunction terminalText(text: string): string {\n let encoded = '';\n for (const character of text) {\n const code = character.codePointAt(0) ?? 0;\n encoded += isTerminalControl(code) ? `<${code.toString(16).padStart(2, '0')}>` : character;\n }\n return encoded;\n}\n\n/**\n * The code points that reach a terminal hostile through JSON text: DEL, the C1 range and\n * every bidi control. C0 is absent because `JSON.stringify` already spells those inside a\n * string literal, and the structural characters a pretty-printed document contains are\n * ASCII, so neither can be hit by this replacement.\n */\nconst JSON_TERMINAL_CONTROL = /[\\u007f-\\u009f\\u061c\\u200e\\u200f\\u202a-\\u202e\\u2066-\\u2069]/g;\n\n/**\n * A document serialized as JSON text a terminal can be shown.\n *\n * An emitted artifact carries message catalogues, which are free text, so the bytes go to\n * stdout through the same boundary as a diagnostic: each code point a terminal acts on\n * becomes its JSON `\\uXXXX` escape. That is a legal spelling of the same string, so what a\n * caller pipes onward still parses back to the document that was compiled.\n */\nexport function jsonText(value: unknown): string {\n return jsonTerminalText(JSON.stringify(value, null, 2));\n}\n\n/**\n * Already-serialized JSON text, spelled for a terminal.\n *\n * A command that writes its own canonical bytes rather than a pretty document still crosses the\n * same boundary when it writes them to a stream: RFC 8785 spells a C0 control as an escape, but\n * DEL, the C1 range and the bidi controls stay literal, and a document those bytes came from\n * declared them. Each becomes its JSON escape, which parses back to the same string.\n */\nexport function jsonTerminalText(text: string): string {\n return text.replace(\n JSON_TERMINAL_CONTROL,\n (character) => `\\\\u${(character.codePointAt(0) ?? 0).toString(16).padStart(4, '0')}`,\n );\n}\n\n/** One escaped line of a command's own output. */\nexport function printLine(text: string): void {\n process.stdout.write(`${terminalText(text)}\\n`);\n}\n\n/** One escaped line of a command's diagnostics. */\nexport function printErrorLine(text: string): void {\n process.stderr.write(`${terminalText(text)}\\n`);\n}\n\n/**\n * This module's own constant text — help and usage — written verbatim.\n * Nothing an untrusted document declared may reach this function: it is not escaped, which\n * is why the only callers pass a member of `USAGE` or `HELP`.\n */\nexport function printStaticText(text: string): void {\n process.stdout.write(text);\n}\n\n/** The same constant text on the diagnostics stream, for a command that cannot run. */\nexport function printStaticError(text: string): void {\n process.stderr.write(text);\n}\n\n/** Whether a write failed because the reader closed the pipe it was reading from. */\nfunction isClosedPipe(cause: unknown): boolean {\n return cause instanceof Error && 'code' in cause && cause.code === 'EPIPE';\n}\n\n/**\n * A reader that stops reading is not a document failure.\n *\n * `compile` and `compile-dataset` emit artifacts that can be megabytes long, so\n * `axiom-cli compile … | head` closes the pipe while the document is still being written. An\n * unhandled `EPIPE` ends the run with a Node stack trace and exit code 1 — the code this\n * program's own contract reserves for a document that failed to compile — so the rest of the\n * document is dropped instead and the command's own verdict stands. Every other write failure\n * is still thrown: this handler knows how to ignore one condition, not how to report all of\n * them, and a stream that failed for another reason must stay as loud as it was.\n */\nexport function ignoreClosedPipe(stream: NodeJS.WriteStream): void {\n stream.on('error', (cause: unknown) => {\n if (isClosedPipe(cause)) return;\n throw cause;\n });\n}\n\n/** The underlying cause of a failure, so the operator sees what the system actually said. */\nexport function causeText(cause: unknown): string {\n return cause instanceof Error ? cause.message : String(cause);\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PublishGap } from '../publish/readiness.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a gap is a claim the run executed and that did not hold.
|
|
4
|
+
*
|
|
5
|
+
* `--coverage=report` reports missing coverage but refuses a run whose evidence failed: reading a
|
|
6
|
+
* gap about a branch nobody asserted is a coverage decision, while a failed assertion, an
|
|
7
|
+
* unreadable embedded expectation, a refused suite, an unbound table or a device artifact the run
|
|
8
|
+
* cannot execute is a run that could not do what it was asked.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isFailedClaim(gap: PublishGap): boolean;
|
|
11
|
+
export declare function runTest(args: readonly string[]): Promise<number>;
|
|
12
|
+
//# sourceMappingURL=test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/cli/test.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AA2G1D;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAkBtD;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwHtE"}
|
package/dist/cli/test.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/** `axiom-cli test`: execute a schema's evidence and enforce publish readiness. */
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { assertNever, DEFAULT_EVIDENCE_TIER } from '@azx-pbc/axiom-runtime';
|
|
4
|
+
import { publishReport, verifyPublishReadiness } from '../publish/verify.js';
|
|
5
|
+
import { describeTarget } from '../scenarios/report.js';
|
|
6
|
+
import { COMMAND_PARSE, DATASET_OPTIONS, HELP_OPTION, MAX_DIAGNOSTICS_OPTION, handleUniversalOptions, parsedOrUsage, readCoverage, readDiagnosticCap, singlePositional, } from './args.js';
|
|
7
|
+
import { agrees, counted, noun } from './count.js';
|
|
8
|
+
import { displayPath, STDIO_PATH } from './read.js';
|
|
9
|
+
import { emitCanonicalJson } from './render.js';
|
|
10
|
+
import { loadSchema } from './schema.js';
|
|
11
|
+
import { suiteReport } from './suite-report.js';
|
|
12
|
+
import { readSuites } from './suites.js';
|
|
13
|
+
import { printErrorLine, printLine } from './terminal.js';
|
|
14
|
+
import { USAGE, EXIT_FAILED, EXIT_OK, EXIT_USAGE } from './usage.js';
|
|
15
|
+
const TEST_OPTIONS = {
|
|
16
|
+
...DATASET_OPTIONS,
|
|
17
|
+
...MAX_DIAGNOSTICS_OPTION,
|
|
18
|
+
...HELP_OPTION,
|
|
19
|
+
suite: { type: 'string', multiple: true },
|
|
20
|
+
coverage: { type: 'string' },
|
|
21
|
+
out: { type: 'string' },
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Prints the failed vectors within the diagnostic budget the operator named.
|
|
25
|
+
*
|
|
26
|
+
* A case is one line plus the explanation lines that name its repair, so the budget is spent in
|
|
27
|
+
* that order: the first cases are explained whole and a matrix larger than the cap ends by
|
|
28
|
+
* counting what it withheld, exactly like a suite's failure lines. A vector matrix is authored
|
|
29
|
+
* evidence like a suite, and neither may outgrow the interface that reports it.
|
|
30
|
+
*/
|
|
31
|
+
function reportVectorFailures(label, vectors, cap) {
|
|
32
|
+
const failed = vectors.filter(isFailedVector);
|
|
33
|
+
let remaining = cap === 'all' ? Number.POSITIVE_INFINITY : cap;
|
|
34
|
+
let shown = 0;
|
|
35
|
+
let withheldLines = 0;
|
|
36
|
+
for (const vector of failed) {
|
|
37
|
+
if (remaining === 0)
|
|
38
|
+
break;
|
|
39
|
+
const verdict = vector.verdict;
|
|
40
|
+
// A vector that could not be read at all states that in its detail; every other failure names
|
|
41
|
+
// the case the author wrote.
|
|
42
|
+
const subject = vector.caseId === undefined
|
|
43
|
+
? `rule ${vector.ruleId}`
|
|
44
|
+
: `rule ${vector.ruleId} case ${vector.caseId}`;
|
|
45
|
+
printErrorLine(`${label}: ${subject}: ${verdict.detail}`);
|
|
46
|
+
remaining -= 1;
|
|
47
|
+
shown += 1;
|
|
48
|
+
for (const line of verdict.explanation) {
|
|
49
|
+
if (remaining === 0) {
|
|
50
|
+
withheldLines += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
printErrorLine(`${label}: ${subject}:${line}`);
|
|
54
|
+
remaining -= 1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const withheldCases = failed.length - shown;
|
|
58
|
+
if (withheldCases > 0) {
|
|
59
|
+
printErrorLine(`${label}: … and ${String(withheldCases)} more ${noun(withheldCases, 'failing case')} withheld; run again with --max-diagnostics=all to see them`);
|
|
60
|
+
}
|
|
61
|
+
if (withheldLines > 0) {
|
|
62
|
+
printErrorLine(`${label}: … and ${String(withheldLines)} more ${noun(withheldLines, 'explanation line')} withheld; run again with --max-diagnostics=all to see them`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Whether a vector's verdict is a claim the run executed and that did not hold. */
|
|
66
|
+
function isFailedVector(vector) {
|
|
67
|
+
return !vector.verdict.ok;
|
|
68
|
+
}
|
|
69
|
+
/** Prints a report line list, bounded by the cap, with one line counting what was withheld. */
|
|
70
|
+
function printBounded(label, lines, cap, singular) {
|
|
71
|
+
const shown = cap === 'all' ? lines : lines.slice(0, cap);
|
|
72
|
+
for (const line of shown)
|
|
73
|
+
printErrorLine(line);
|
|
74
|
+
const withheld = lines.length - shown.length;
|
|
75
|
+
if (withheld > 0) {
|
|
76
|
+
printErrorLine(`${label}: … and ${String(withheld)} more ${noun(withheld, singular)} withheld; run again with --max-diagnostics=all to see them`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether a gap is a claim the run executed and that did not hold.
|
|
81
|
+
*
|
|
82
|
+
* `--coverage=report` reports missing coverage but refuses a run whose evidence failed: reading a
|
|
83
|
+
* gap about a branch nobody asserted is a coverage decision, while a failed assertion, an
|
|
84
|
+
* unreadable embedded expectation, a refused suite, an unbound table or a device artifact the run
|
|
85
|
+
* cannot execute is a run that could not do what it was asked.
|
|
86
|
+
*/
|
|
87
|
+
export function isFailedClaim(gap) {
|
|
88
|
+
switch (gap.kind) {
|
|
89
|
+
case 'failed_vector':
|
|
90
|
+
case 'failed_scenario':
|
|
91
|
+
case 'unreadable_expectation':
|
|
92
|
+
case 'invalid_suite':
|
|
93
|
+
case 'stale_behavior':
|
|
94
|
+
case 'stale_dataset':
|
|
95
|
+
case 'client_artifact':
|
|
96
|
+
case 'conflicting_environment':
|
|
97
|
+
return true;
|
|
98
|
+
case 'no_evidence':
|
|
99
|
+
case 'no_firing':
|
|
100
|
+
case 'no_non_firing':
|
|
101
|
+
return false;
|
|
102
|
+
default:
|
|
103
|
+
return assertNever(gap.kind);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export async function runTest(args) {
|
|
107
|
+
const parsed = parsedOrUsage(() => parseArgs({ args, options: TEST_OPTIONS, ...COMMAND_PARSE }), USAGE.test, TEST_OPTIONS);
|
|
108
|
+
if (parsed === undefined)
|
|
109
|
+
return EXIT_USAGE;
|
|
110
|
+
const handled = handleUniversalOptions(parsed, TEST_OPTIONS, USAGE.test);
|
|
111
|
+
if (handled !== undefined)
|
|
112
|
+
return handled;
|
|
113
|
+
const target = singlePositional(parsed.positionals, USAGE.test);
|
|
114
|
+
if (target === undefined)
|
|
115
|
+
return EXIT_USAGE;
|
|
116
|
+
const cap = readDiagnosticCap(parsed.values['max-diagnostics'], USAGE.test);
|
|
117
|
+
if (cap === undefined)
|
|
118
|
+
return EXIT_USAGE;
|
|
119
|
+
const mode = readCoverage(parsed.values.coverage, USAGE.test);
|
|
120
|
+
if (mode === undefined)
|
|
121
|
+
return EXIT_USAGE;
|
|
122
|
+
// A vector states what the artifact does, so it runs on the evidence default tier: a client
|
|
123
|
+
// artifact replaces server rules with stubs, and their vectors would report the stub's verdict.
|
|
124
|
+
// A case may name its own tier, capabilities and record date.
|
|
125
|
+
const loaded = await loadSchema(target, parsed.values.dataset ?? [], parsed.values.declaration ?? [], USAGE.test, cap, DEFAULT_EVIDENCE_TIER);
|
|
126
|
+
if (!loaded.ok)
|
|
127
|
+
return loaded.exitCode;
|
|
128
|
+
const suites = await readSuites(parsed.values.suite ?? [], cap, loaded.compiled.schema);
|
|
129
|
+
if (!suites.ok)
|
|
130
|
+
return suites.exitCode;
|
|
131
|
+
const label = displayPath(target);
|
|
132
|
+
const verification = verifyPublishReadiness(loaded.compiled.schema, {
|
|
133
|
+
...(loaded.datasets.length === 0
|
|
134
|
+
? {}
|
|
135
|
+
: { datasets: loaded.datasets.map((dataset) => dataset.document) }),
|
|
136
|
+
...(suites.suites.length === 0 ? {} : { suites: suites.suites.map((suite) => suite.suite) }),
|
|
137
|
+
// A rule a declaration compiled to is part of the gate, but its id is not the author's
|
|
138
|
+
// spelling; the compile reports where each one came from so the gap names the member.
|
|
139
|
+
...(loaded.compiled.declarationOrigins.length === 0
|
|
140
|
+
? {}
|
|
141
|
+
: { declarations: loaded.compiled.declarationOrigins }),
|
|
142
|
+
});
|
|
143
|
+
// `--out -` makes stdout the report, so every human line moves to the diagnostics stream and a
|
|
144
|
+
// caller piping the report reads only the report.
|
|
145
|
+
const written = parsed.values.out;
|
|
146
|
+
const summary = written === STDIO_PATH ? printErrorLine : printLine;
|
|
147
|
+
reportVectorFailures(label, verification.vectors, cap);
|
|
148
|
+
// A suite the run could not execute (its data identity could not be stated) is named with the
|
|
149
|
+
// reason rather than dropped: silence would read as "nothing ran", which is a different fact.
|
|
150
|
+
const refusal = verification.ready ? undefined : verification.gaps[0]?.detail;
|
|
151
|
+
const notRun = suites.suites.length > verification.suites.length ? refusal : undefined;
|
|
152
|
+
const suiteLines = suiteReport(suites.suites, verification.suites, notRun);
|
|
153
|
+
for (const line of suiteLines.summaries)
|
|
154
|
+
summary(line);
|
|
155
|
+
printBounded(label, suiteLines.failures, cap, 'assertion failure');
|
|
156
|
+
// A hint names a target, and a row-scoped target is one per row of the record the suite carried,
|
|
157
|
+
// so this channel grows with the run's data rather than with the artifact: it is bounded by the
|
|
158
|
+
// same cap, and the whole list stays in the `--out` report's `observedOnly`.
|
|
159
|
+
// A hint says "this observation proves nothing, assert one that does". A ready run has no gap
|
|
160
|
+
// left to act on, so the terminal stays quiet about hints it cannot fix; the `--out` report
|
|
161
|
+
// still carries every one of them for a later reader.
|
|
162
|
+
if (!verification.ready) {
|
|
163
|
+
printBounded(label, verification.observedOnly.map((hint) => `${label}: not credited: ${describeTarget(hint.target)}: observed, but proves nothing (${hint.refusal})`), cap, 'uncredited observation');
|
|
164
|
+
}
|
|
165
|
+
const total = verification.vectors.length;
|
|
166
|
+
const failed = verification.vectors.filter((vector) => !vector.verdict.ok).length;
|
|
167
|
+
summary(`${label}: ${counted(total, 'case')}, ${String(total - failed)} passed, ${String(failed)} failed`);
|
|
168
|
+
const gaps = verification.ready ? [] : verification.gaps;
|
|
169
|
+
if (mode === 'report') {
|
|
170
|
+
// A gap names a rule whose evidence is still owed or did not hold, so the rules without one
|
|
171
|
+
// are the rules the run covered. Counting that way keeps the summary tied to the same gaps
|
|
172
|
+
// the line below prints, and a constant rule's one reachable branch is the requirement it is
|
|
173
|
+
// measured against.
|
|
174
|
+
const unproven = new Set(gaps.flatMap((gap) => (gap.ruleId === undefined ? [] : [gap.ruleId])));
|
|
175
|
+
const satisfied = verification.coverage.filter((entry) => entry.attempts > 0 && !unproven.has(entry.ruleId)).length;
|
|
176
|
+
summary(`${label}: coverage: ${String(satisfied)} of ${counted(verification.coverage.length, 'rule')} ${agrees(satisfied, 'has', 'have')} the evidence publishing requires`);
|
|
177
|
+
}
|
|
178
|
+
// The gaps are a diagnostics channel like the vector and suite failures, and a run over a
|
|
179
|
+
// large artifact earns one per rule. The cap bounds the terminal, never the verdict: the
|
|
180
|
+
// `--out` report keeps every gap, which is the count a later reader acts on.
|
|
181
|
+
printBounded(label, gaps.map((gap) => mode === 'require'
|
|
182
|
+
? `${label}: ${gap.path}: not ready to publish: ${gap.detail}`
|
|
183
|
+
: `${label}: ${gap.path}: publish gap (${gap.kind}): ${gap.detail}`), cap, 'publish gap');
|
|
184
|
+
const refused = mode === 'require' ? gaps.length > 0 : gaps.some(isFailedClaim);
|
|
185
|
+
if (written !== undefined) {
|
|
186
|
+
// Every document this run read is an input, so `--out` cannot replace the schema, a suite or
|
|
187
|
+
// the table a run judged its evidence against.
|
|
188
|
+
const emitted = await emitCanonicalJson(written, publishReport(verification), [
|
|
189
|
+
target,
|
|
190
|
+
...(parsed.values.suite ?? []),
|
|
191
|
+
...(parsed.values.dataset ?? []),
|
|
192
|
+
...(parsed.values.declaration ?? []),
|
|
193
|
+
]);
|
|
194
|
+
if (emitted !== EXIT_OK)
|
|
195
|
+
return emitted;
|
|
196
|
+
}
|
|
197
|
+
return refused ? EXIT_FAILED : EXIT_OK;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=test.js.map
|