@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,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runtime boundary of a CSV declaration.
|
|
3
|
+
*
|
|
4
|
+
* `CsvDatasetDeclaration` names the members the CSV front-end reads before the assembled
|
|
5
|
+
* document reaches the closed dataset metaschema. A declaration is authored as JSON, so it
|
|
6
|
+
* arrives as `unknown`; this is the one place that turns it into the type, and it checks only
|
|
7
|
+
* the members the front-end dereferences. Every semantic rule — the identifier grammar, a
|
|
8
|
+
* window on a `data` table only, `collectLimit` under COLLECT, a non-empty key — belongs to
|
|
9
|
+
* the metaschema, which reports it with the same path.
|
|
10
|
+
*
|
|
11
|
+
* The checked object is handed on as it arrived: rebuilding it would drop an undeclared
|
|
12
|
+
* member the closed metaschema still has to refuse.
|
|
13
|
+
*/
|
|
14
|
+
import { DATASET_SCALAR_PRIMITIVES, isRecord, isScalarPrimitive } from '@azx-pbc/axiom-runtime';
|
|
15
|
+
/** How a refusal lists the primitives, derived from the runtime's one registry. */
|
|
16
|
+
const SCALAR_PRIMITIVE_LIST = DATASET_SCALAR_PRIMITIVES.join(', ');
|
|
17
|
+
/** Walks the members in declaration order and names the first one of the wrong shape. */
|
|
18
|
+
function declarationDefect(value) {
|
|
19
|
+
if (!isRecord(value))
|
|
20
|
+
return { path: '$', detail: 'a declaration is a JSON object' };
|
|
21
|
+
if (typeof value['tableId'] !== 'string') {
|
|
22
|
+
return { path: '$.tableId', detail: 'tableId must be text' };
|
|
23
|
+
}
|
|
24
|
+
if (typeof value['tableVersion'] !== 'number') {
|
|
25
|
+
return { path: '$.tableVersion', detail: 'tableVersion is a number' };
|
|
26
|
+
}
|
|
27
|
+
const binding = value['binding'];
|
|
28
|
+
if (binding !== 'behavior' && binding !== 'data') {
|
|
29
|
+
return { path: '$.binding', detail: 'binding is `behavior` or `data`' };
|
|
30
|
+
}
|
|
31
|
+
const kind = value['kind'];
|
|
32
|
+
if (kind !== 'lookup' && kind !== 'decision_table') {
|
|
33
|
+
return {
|
|
34
|
+
path: '$.kind',
|
|
35
|
+
detail: 'a CSV declaration compiles `lookup` or `decision_table`',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const hitPolicy = value['hitPolicy'];
|
|
39
|
+
if (hitPolicy !== 'UNIQUE' && hitPolicy !== 'FIRST' && hitPolicy !== 'COLLECT') {
|
|
40
|
+
return { path: '$.hitPolicy', detail: 'hitPolicy is `UNIQUE`, `FIRST` or `COLLECT`' };
|
|
41
|
+
}
|
|
42
|
+
const collectLimit = value['collectLimit'];
|
|
43
|
+
if (collectLimit !== undefined && typeof collectLimit !== 'number') {
|
|
44
|
+
return { path: '$.collectLimit', detail: 'collectLimit is a number' };
|
|
45
|
+
}
|
|
46
|
+
const effectiveFrom = value['effectiveFrom'];
|
|
47
|
+
if (effectiveFrom !== undefined && typeof effectiveFrom !== 'string') {
|
|
48
|
+
return { path: '$.effectiveFrom', detail: 'effectiveFrom is a date string' };
|
|
49
|
+
}
|
|
50
|
+
const effectiveTo = value['effectiveTo'];
|
|
51
|
+
if (effectiveTo !== undefined && typeof effectiveTo !== 'string') {
|
|
52
|
+
return { path: '$.effectiveTo', detail: 'effectiveTo is a date string' };
|
|
53
|
+
}
|
|
54
|
+
const columns = value['columns'];
|
|
55
|
+
if (!Array.isArray(columns)) {
|
|
56
|
+
return { path: '$.columns', detail: 'columns is an array of column declarations' };
|
|
57
|
+
}
|
|
58
|
+
for (const [index, column] of columns.entries()) {
|
|
59
|
+
const at = `$.columns[${String(index)}]`;
|
|
60
|
+
if (!isRecord(column))
|
|
61
|
+
return { path: at, detail: 'a column is a JSON object' };
|
|
62
|
+
if (typeof column['columnId'] !== 'string') {
|
|
63
|
+
return { path: `${at}.columnId`, detail: 'columnId is a string' };
|
|
64
|
+
}
|
|
65
|
+
const primitive = column['primitive'];
|
|
66
|
+
if (!isScalarPrimitive(primitive)) {
|
|
67
|
+
return {
|
|
68
|
+
path: `${at}.primitive`,
|
|
69
|
+
detail: `primitive is one of ${SCALAR_PRIMITIVE_LIST}`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const role = column['role'];
|
|
73
|
+
if (role !== 'key' && role !== 'output') {
|
|
74
|
+
return { path: `${at}.role`, detail: 'role is `key` or `output`' };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether `value` is a CSV declaration.
|
|
81
|
+
*
|
|
82
|
+
* The predicate is the only unchecked step in the module, and it delegates to the walk above
|
|
83
|
+
* so the two cannot disagree; its purpose is to hand the original object on with every member
|
|
84
|
+
* it arrived with.
|
|
85
|
+
*/
|
|
86
|
+
function isCsvDatasetDeclaration(value) {
|
|
87
|
+
return declarationDefect(value) === undefined;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Reads one declaration from untrusted JSON, naming the member that is not the shape the CSV
|
|
91
|
+
* front-end requires. The defect's `path` is a document path, so an author can go to it.
|
|
92
|
+
*/
|
|
93
|
+
export function narrowCsvDatasetDeclaration(value) {
|
|
94
|
+
if (isCsvDatasetDeclaration(value))
|
|
95
|
+
return { ok: true, declaration: value };
|
|
96
|
+
// A refusal here is a defect: the predicate above is this same walk, so the fallback exists
|
|
97
|
+
// only to keep the return total without asserting the fact the predicate already proved.
|
|
98
|
+
const defect = declarationDefect(value) ?? {
|
|
99
|
+
path: '$',
|
|
100
|
+
detail: 'a declaration is a JSON object',
|
|
101
|
+
};
|
|
102
|
+
return { ok: false, path: defect.path, detail: defect.detail };
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../src/datasets/declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,yBAAyB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhG,mFAAmF;AACnF,MAAM,qBAAqB,GAAW,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAa3E,yFAAyF;AACzF,SAAS,iBAAiB,CAAC,KAAc;IACvC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MA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BAAuB,qBAAqB,EAAE;aACvD,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5B,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACxC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,2BAA2B,EAAE,CAAC;QACrE,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,uBAAuB,CAAC,KAAc;IAC7C,OAAO,iBAAiB,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAAc;IACxD,IAAI,uBAAuB,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAC5E,4FAA4F;IAC5F,yFAAyF;IACzF,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI;QACzC,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,gCAAgC;KACzC,CAAC;IACF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AACjE,CAAC","sourcesContent":["/**\n * The runtime boundary of a CSV declaration.\n *\n * `CsvDatasetDeclaration` names the members the CSV front-end reads before the assembled\n * document reaches the closed dataset metaschema. A declaration is authored as JSON, so it\n * arrives as `unknown`; this is the one place that turns it into the type, and it checks only\n * the members the front-end dereferences. Every semantic rule — the identifier grammar, a\n * window on a `data` table only, `collectLimit` under COLLECT, a non-empty key — belongs to\n * the metaschema, which reports it with the same path.\n *\n * The checked object is handed on as it arrived: rebuilding it would drop an undeclared\n * member the closed metaschema still has to refuse.\n */\nimport { DATASET_SCALAR_PRIMITIVES, isRecord, isScalarPrimitive } from '@azx-pbc/axiom-runtime';\nimport type { CsvDatasetDeclaration } from './csv.js';\n\n/** How a refusal lists the primitives, derived from the runtime's one registry. */\nconst SCALAR_PRIMITIVE_LIST: string = DATASET_SCALAR_PRIMITIVES.join(', ');\n\n/** The first member that is not the shape the declaration type states. */\ninterface DeclarationDefect {\n readonly path: string;\n readonly detail: string;\n}\n\n/** A declaration read from untrusted JSON, or the member that is not the shape it declares. */\nexport type DeclarationNarrowing =\n | { readonly ok: true; readonly declaration: CsvDatasetDeclaration }\n | { readonly ok: false; readonly path: string; readonly detail: string };\n\n/** Walks the members in declaration order and names the first one of the wrong shape. */\nfunction declarationDefect(value: unknown): DeclarationDefect | undefined {\n if (!isRecord(value)) return { path: '$', detail: 'a declaration is a JSON object' };\n if (typeof value['tableId'] !== 'string') {\n return { path: '$.tableId', detail: 'tableId must be text' };\n }\n if (typeof value['tableVersion'] !== 'number') {\n return { path: '$.tableVersion', detail: 'tableVersion is a number' };\n }\n const binding = value['binding'];\n if (binding !== 'behavior' && binding !== 'data') {\n return { path: '$.binding', detail: 'binding is `behavior` or `data`' };\n }\n const kind = value['kind'];\n if (kind !== 'lookup' && kind !== 'decision_table') {\n return {\n path: '$.kind',\n detail: 'a CSV declaration compiles `lookup` or `decision_table`',\n };\n }\n const hitPolicy = value['hitPolicy'];\n if (hitPolicy !== 'UNIQUE' && hitPolicy !== 'FIRST' && hitPolicy !== 'COLLECT') {\n return { path: '$.hitPolicy', detail: 'hitPolicy is `UNIQUE`, `FIRST` or `COLLECT`' };\n }\n const collectLimit = value['collectLimit'];\n if (collectLimit !== undefined && typeof collectLimit !== 'number') {\n return { path: '$.collectLimit', detail: 'collectLimit is a number' };\n }\n const effectiveFrom = value['effectiveFrom'];\n if (effectiveFrom !== undefined && typeof effectiveFrom !== 'string') {\n return { path: '$.effectiveFrom', detail: 'effectiveFrom is a date string' };\n }\n const effectiveTo = value['effectiveTo'];\n if (effectiveTo !== undefined && typeof effectiveTo !== 'string') {\n return { path: '$.effectiveTo', detail: 'effectiveTo is a date string' };\n }\n const columns = value['columns'];\n if (!Array.isArray(columns)) {\n return { path: '$.columns', detail: 'columns is an array of column declarations' };\n }\n for (const [index, column] of columns.entries()) {\n const at = `$.columns[${String(index)}]`;\n if (!isRecord(column)) return { path: at, detail: 'a column is a JSON object' };\n if (typeof column['columnId'] !== 'string') {\n return { path: `${at}.columnId`, detail: 'columnId is a string' };\n }\n const primitive = column['primitive'];\n if (!isScalarPrimitive(primitive)) {\n return {\n path: `${at}.primitive`,\n detail: `primitive is one of ${SCALAR_PRIMITIVE_LIST}`,\n };\n }\n const role = column['role'];\n if (role !== 'key' && role !== 'output') {\n return { path: `${at}.role`, detail: 'role is `key` or `output`' };\n }\n }\n return undefined;\n}\n\n/**\n * Whether `value` is a CSV declaration.\n *\n * The predicate is the only unchecked step in the module, and it delegates to the walk above\n * so the two cannot disagree; its purpose is to hand the original object on with every member\n * it arrived with.\n */\nfunction isCsvDatasetDeclaration(value: unknown): value is CsvDatasetDeclaration {\n return declarationDefect(value) === undefined;\n}\n\n/**\n * Reads one declaration from untrusted JSON, naming the member that is not the shape the CSV\n * front-end requires. The defect's `path` is a document path, so an author can go to it.\n */\nexport function narrowCsvDatasetDeclaration(value: unknown): DeclarationNarrowing {\n if (isCsvDatasetDeclaration(value)) return { ok: true, declaration: value };\n // A refusal here is a defect: the predicate above is this same walk, so the fallback exists\n // only to keep the return total without asserting the fact the predicate already proved.\n const defect = declarationDefect(value) ?? {\n path: '$',\n detail: 'a declaration is a JSON object',\n };\n return { ok: false, path: defect.path, detail: defect.detail };\n}\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { DatasetDeclaration, LookupTableDocument } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* The dataset compiler's verdicts, `spec/semantics/datasets-v1.md` §1–3.
|
|
4
|
+
*
|
|
5
|
+
* A dataset problem is located the way an author debugs it: the table row and the column
|
|
6
|
+
* that disagree, plus the document path every compiler diagnostic already uses. A row is
|
|
7
|
+
* the table's own 1-based row number — for a CSV that is the first line after the header
|
|
8
|
+
* — so a JSON row and a CSV row report the same way.
|
|
9
|
+
*
|
|
10
|
+
* `CSV_BOUNDS` is the one a JSON document cannot produce: a CSV file that exceeds the
|
|
11
|
+
* byte, row, column or cell limits declared in `csv/limits.ts` is refused before its rows
|
|
12
|
+
* are typed, and the diagnostic names the row and column — or, for the file's own size, the
|
|
13
|
+
* byte offset — where the limit was crossed.
|
|
14
|
+
*/
|
|
15
|
+
export type DatasetDiagnosticCode = 'JSON_INGEST_ERROR' | 'DATASET_INVALID' | 'INVALID_HEADER' | 'INVALID_CELL' | 'INVALID_ROW' | 'CSV_BOUNDS' | 'DUPLICATE_IDENTIFIER' | 'DUPLICATE_KEY' | 'OVERLAPPING_WINDOW';
|
|
16
|
+
export interface DatasetDiagnostic {
|
|
17
|
+
readonly code: DatasetDiagnosticCode;
|
|
18
|
+
/** The 1-based table row the problem is in; absent for a table-level problem. */
|
|
19
|
+
readonly row?: number;
|
|
20
|
+
/** The declared column the problem is in, or the header cell that should hold one. */
|
|
21
|
+
readonly column?: string;
|
|
22
|
+
/** Where in the document, as `$.rows[0].key[1]`; `$` for the whole table. */
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly detail: string;
|
|
25
|
+
}
|
|
26
|
+
/** A table that passed every check, with the declared shape an expression is typed against. */
|
|
27
|
+
export interface CompiledDataset {
|
|
28
|
+
readonly document: LookupTableDocument;
|
|
29
|
+
readonly declaration: CompiledDatasetDeclaration;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A compiled declaration, carrying the version of the table it describes.
|
|
33
|
+
*
|
|
34
|
+
* The expression-facing shape (`DatasetDeclaration`) is deliberately version-free: a declaration
|
|
35
|
+
* types a table's kind, binding, columns and hit policy, none of which a version changes. The
|
|
36
|
+
* compile still has to compare the document's `datasetRef` pin with the table the caller supplied,
|
|
37
|
+
* and the pin is a version, so the version travels beside the shape rather than being dropped.
|
|
38
|
+
*/
|
|
39
|
+
export interface CompiledDatasetDeclaration extends DatasetDeclaration {
|
|
40
|
+
readonly tableVersion: number;
|
|
41
|
+
/**
|
|
42
|
+
* The restricted-JCS SHA-256 of the document this declaration was compiled from, which is the
|
|
43
|
+
* digest the artifact pins and the store records as a resolution's `tableSha256` (`DATA-4.1.2`).
|
|
44
|
+
* It is computed here, where the rows are, because the expression-facing shape deliberately
|
|
45
|
+
* carries no rows and a declaration built without them cannot bind the table's bytes.
|
|
46
|
+
*/
|
|
47
|
+
readonly sha256: string;
|
|
48
|
+
}
|
|
49
|
+
/** One dataset's verdict. */
|
|
50
|
+
export type DatasetCompileResult = {
|
|
51
|
+
readonly ok: true;
|
|
52
|
+
readonly dataset: CompiledDataset;
|
|
53
|
+
} | {
|
|
54
|
+
readonly ok: false;
|
|
55
|
+
readonly diagnostics: readonly DatasetDiagnostic[];
|
|
56
|
+
};
|
|
57
|
+
/** Every version of every table a schema ships with, or the reasons it cannot. */
|
|
58
|
+
export type DatasetInstallationResult = {
|
|
59
|
+
readonly ok: true;
|
|
60
|
+
readonly datasets: readonly CompiledDataset[];
|
|
61
|
+
} | {
|
|
62
|
+
readonly ok: false;
|
|
63
|
+
readonly diagnostics: readonly DatasetDiagnostic[];
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/datasets/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEtF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qBAAqB,GAC7B,mBAAmB,GACnB,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,YAAY,GACZ,sBAAsB,GACtB,eAAe,GACf,oBAAoB,CAAC;AAEzB,MAAM,WAAW,iB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mappings":"","sourcesContent":["import type { DatasetDeclaration, LookupTableDocument } from '@azx-pbc/axiom-runtime';\n\n/**\n * The dataset compiler's verdicts, `spec/semantics/datasets-v1.md` §1–3.\n *\n * A dataset problem is located the way an author debugs it: the table row and the column\n * that disagree, plus the document path every compiler diagnostic already uses. A row is\n * the table's own 1-based row number — for a CSV that is the first line after the header\n * — so a JSON row and a CSV row report the same way.\n *\n * `CSV_BOUNDS` is the one a JSON document cannot produce: a CSV file that exceeds the\n * byte, row, column or cell limits declared in `csv/limits.ts` is refused before its rows\n * are typed, and the diagnostic names the row and column — or, for the file's own size, the\n * byte offset — where the limit was crossed.\n */\nexport type DatasetDiagnosticCode =\n | 'JSON_INGEST_ERROR'\n | 'DATASET_INVALID'\n | 'INVALID_HEADER'\n | 'INVALID_CELL'\n | 'INVALID_ROW'\n | 'CSV_BOUNDS'\n | 'DUPLICATE_IDENTIFIER'\n | 'DUPLICATE_KEY'\n | 'OVERLAPPING_WINDOW';\n\nexport interface DatasetDiagnostic {\n readonly code: DatasetDiagnosticCode;\n /** The 1-based table row the problem is in; absent for a table-level problem. */\n readonly row?: number;\n /** The declared column the problem is in, or the header cell that should hold one. */\n readonly column?: string;\n /** Where in the document, as `$.rows[0].key[1]`; `$` for the whole table. */\n readonly path: string;\n readonly detail: string;\n}\n\n/** A table that passed every check, with the declared shape an expression is typed against. */\nexport interface CompiledDataset {\n readonly document: LookupTableDocument;\n readonly declaration: CompiledDatasetDeclaration;\n}\n\n/**\n * A compiled declaration, carrying the version of the table it describes.\n *\n * The expression-facing shape (`DatasetDeclaration`) is deliberately version-free: a declaration\n * types a table's kind, binding, columns and hit policy, none of which a version changes. The\n * compile still has to compare the document's `datasetRef` pin with the table the caller supplied,\n * and the pin is a version, so the version travels beside the shape rather than being dropped.\n */\nexport interface CompiledDatasetDeclaration extends DatasetDeclaration {\n readonly tableVersion: number;\n /**\n * The restricted-JCS SHA-256 of the document this declaration was compiled from, which is the\n * digest the artifact pins and the store records as a resolution's `tableSha256` (`DATA-4.1.2`).\n * It is computed here, where the rows are, because the expression-facing shape deliberately\n * carries no rows and a declaration built without them cannot bind the table's bytes.\n */\n readonly sha256: string;\n}\n\n/** One dataset's verdict. */\nexport type DatasetCompileResult =\n | { readonly ok: true; readonly dataset: CompiledDataset }\n | { readonly ok: false; readonly diagnostics: readonly DatasetDiagnostic[] };\n\n/** Every version of every table a schema ships with, or the reasons it cannot. */\nexport type DatasetInstallationResult =\n | { readonly ok: true; readonly datasets: readonly CompiledDataset[] }\n | { readonly ok: false; readonly diagnostics: readonly DatasetDiagnostic[] };\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { LookupTableDocument } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { DatasetDiagnostic } from './diagnostics.js';
|
|
3
|
+
/**
|
|
4
|
+
* A deterministic summary of what changed between two versions of one table.
|
|
5
|
+
*
|
|
6
|
+
* The summary names identities, not positions: a row is added or removed by `rowId`, a
|
|
7
|
+
* column by `columnId`, and a set value by its canonical text. Two runs over the same pair
|
|
8
|
+
* of documents therefore produce the same summary, byte for byte, which is what lets a CI
|
|
9
|
+
* lane report a dataset change without a stored state to diff against.
|
|
10
|
+
*/
|
|
11
|
+
export interface DatasetDiff {
|
|
12
|
+
readonly tableId: string;
|
|
13
|
+
readonly fromVersion: number;
|
|
14
|
+
readonly toVersion: number;
|
|
15
|
+
readonly addedColumns: readonly string[];
|
|
16
|
+
readonly removedColumns: readonly string[];
|
|
17
|
+
readonly changedColumns: readonly string[];
|
|
18
|
+
readonly addedRows: readonly string[];
|
|
19
|
+
readonly removedRows: readonly string[];
|
|
20
|
+
readonly changedRows: readonly string[];
|
|
21
|
+
readonly addedValues: readonly string[];
|
|
22
|
+
readonly removedValues: readonly string[];
|
|
23
|
+
readonly hitPolicyChanged: boolean;
|
|
24
|
+
/** The cap on rows a `COLLECT` hit returns, which bounds a real result. */
|
|
25
|
+
readonly collectLimitChanged: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* `set`, `lookup` or `decision_table`. A kind change usually moves the rows too, but an
|
|
28
|
+
* empty table moves only this member.
|
|
29
|
+
*/
|
|
30
|
+
readonly kindChanged: boolean;
|
|
31
|
+
readonly windowChanged: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** A diff, or the reason the two documents are not two versions of one table. */
|
|
34
|
+
export type DatasetDiffResult = {
|
|
35
|
+
readonly kind: 'diff';
|
|
36
|
+
readonly diff: DatasetDiff;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'refused';
|
|
39
|
+
readonly diagnostics: readonly DatasetDiagnostic[];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Compares two versions of one table. A pair that names different tables is refused rather
|
|
43
|
+
* than reported as a diff of nothing in common.
|
|
44
|
+
*/
|
|
45
|
+
export declare function diffDatasets(previous: LookupTableDocument, next: LookupTableDocument): DatasetDiffResult;
|
|
46
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/datasets/diff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,iFAAiF;AACjF,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAA;CAAE,CAAC;AAkCrF;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,EAAE,mBAAmB,GACxB,iBAAiB,CAgEnB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { canonicalizeRestricted, compareCodePoints } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Names in the canonical code-point order (`CANON-1.1.8`).
|
|
4
|
+
*
|
|
5
|
+
* A set value's canonical text can carry an astral character, and there the order of UTF-16
|
|
6
|
+
* code units is not the order of code points: the two disagree for a value above `U+FFFF` beside
|
|
7
|
+
* one in `U+E000`–`U+FFFF`. Sorting with `<` would make this summary's order an artefact of the
|
|
8
|
+
* host's string representation rather than the ordering the runtime hashes by.
|
|
9
|
+
*/
|
|
10
|
+
function sorted(names) {
|
|
11
|
+
return [...names].sort(compareCodePoints);
|
|
12
|
+
}
|
|
13
|
+
/** A row's meaning as canonical text, so a reordered member is not a change. */
|
|
14
|
+
function rowText(row) {
|
|
15
|
+
return canonicalizeRestricted({
|
|
16
|
+
key: row.key,
|
|
17
|
+
...(row.outcome === undefined ? {} : { outcome: row.outcome }),
|
|
18
|
+
...(row.output === undefined ? {} : { output: row.output }),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function columnText(document, columnId) {
|
|
22
|
+
const column = (document.columns ?? []).find((entry) => entry.columnId === columnId);
|
|
23
|
+
return column === undefined ? undefined : `${column.role}:${column.primitive}`;
|
|
24
|
+
}
|
|
25
|
+
function byId(entries) {
|
|
26
|
+
return new Map(entries.map((entry) => [entry.columnId, entry]));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Compares two versions of one table. A pair that names different tables is refused rather
|
|
30
|
+
* than reported as a diff of nothing in common.
|
|
31
|
+
*/
|
|
32
|
+
export function diffDatasets(previous, next) {
|
|
33
|
+
if (previous.tableId !== next.tableId) {
|
|
34
|
+
return {
|
|
35
|
+
kind: 'refused',
|
|
36
|
+
diagnostics: [
|
|
37
|
+
{
|
|
38
|
+
code: 'DATASET_INVALID',
|
|
39
|
+
path: '$',
|
|
40
|
+
detail: `a diff compares one table with itself, but these name ${previous.tableId} and ${next.tableId}`,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const previousColumns = byId(previous.columns ?? []);
|
|
46
|
+
const nextColumns = byId(next.columns ?? []);
|
|
47
|
+
const addedColumns = sorted([...nextColumns.keys()].filter((id) => !previousColumns.has(id)));
|
|
48
|
+
const removedColumns = sorted([...previousColumns.keys()].filter((id) => !nextColumns.has(id)));
|
|
49
|
+
const changedColumns = sorted([...nextColumns.keys()].filter((id) => previousColumns.has(id) && columnText(previous, id) !== columnText(next, id)));
|
|
50
|
+
const previousRows = new Map((previous.rows ?? []).map((row) => [row.rowId, row]));
|
|
51
|
+
const nextRows = new Map((next.rows ?? []).map((row) => [row.rowId, row]));
|
|
52
|
+
const addedRows = sorted([...nextRows.keys()].filter((id) => !previousRows.has(id)));
|
|
53
|
+
const removedRows = sorted([...previousRows.keys()].filter((id) => !nextRows.has(id)));
|
|
54
|
+
const changedRows = sorted([...nextRows.keys()].filter((id) => {
|
|
55
|
+
const before = previousRows.get(id);
|
|
56
|
+
const after = nextRows.get(id);
|
|
57
|
+
return before !== undefined && after !== undefined && rowText(before) !== rowText(after);
|
|
58
|
+
}));
|
|
59
|
+
const previousValues = new Set((previous.values ?? []).map((value) => canonicalizeRestricted(value)));
|
|
60
|
+
const nextValues = new Set((next.values ?? []).map((value) => canonicalizeRestricted(value)));
|
|
61
|
+
const addedValues = sorted([...nextValues].filter((value) => !previousValues.has(value)));
|
|
62
|
+
const removedValues = sorted([...previousValues].filter((value) => !nextValues.has(value)));
|
|
63
|
+
return {
|
|
64
|
+
kind: 'diff',
|
|
65
|
+
diff: {
|
|
66
|
+
tableId: previous.tableId,
|
|
67
|
+
fromVersion: previous.tableVersion,
|
|
68
|
+
toVersion: next.tableVersion,
|
|
69
|
+
addedColumns,
|
|
70
|
+
removedColumns,
|
|
71
|
+
changedColumns,
|
|
72
|
+
addedRows,
|
|
73
|
+
removedRows,
|
|
74
|
+
changedRows,
|
|
75
|
+
addedValues,
|
|
76
|
+
removedValues,
|
|
77
|
+
hitPolicyChanged: previous.hitPolicy !== next.hitPolicy,
|
|
78
|
+
collectLimitChanged: previous.collectLimit !== next.collectLimit,
|
|
79
|
+
kindChanged: previous.kind !== next.kind,
|
|
80
|
+
windowChanged: previous.effectiveFrom !== next.effectiveFrom || previous.effectiveTo !== next.effectiveTo,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/datasets/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAs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MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9F,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1F,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE5F,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE;YACJ,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,WAAW,EAAE,QAAQ,CAAC,YAAY;YAClC,SAAS,EAAE,IAAI,CAAC,YAAY;YAC5B,YAAY;YACZ,cAAc;YACd,cAAc;YACd,SAAS;YACT,WAAW;YACX,WAAW;YACX,WAAW;YACX,aAAa;YACb,gBAAgB,EAAE,QAAQ,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS;YACvD,mBAAmB,EAAE,QAAQ,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY;YAChE,WAAW,EAAE,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;YACxC,aAAa,EACX,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,aAAa,IAAI,QAAQ,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW;SAC7F;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { canonicalizeRestricted, compareCodePoints } from '@azx-pbc/axiom-runtime';\nimport type { LookupRow, LookupTableDocument } from '@azx-pbc/axiom-runtime';\nimport type { DatasetDiagnostic } from './diagnostics.js';\n\n/**\n * A deterministic summary of what changed between two versions of one table.\n *\n * The summary names identities, not positions: a row is added or removed by `rowId`, a\n * column by `columnId`, and a set value by its canonical text. Two runs over the same pair\n * of documents therefore produce the same summary, byte for byte, which is what lets a CI\n * lane report a dataset change without a stored state to diff against.\n */\nexport interface DatasetDiff {\n readonly tableId: string;\n readonly fromVersion: number;\n readonly toVersion: number;\n readonly addedColumns: readonly string[];\n readonly removedColumns: readonly string[];\n readonly changedColumns: readonly string[];\n readonly addedRows: readonly string[];\n readonly removedRows: readonly string[];\n readonly changedRows: readonly string[];\n readonly addedValues: readonly string[];\n readonly removedValues: readonly string[];\n readonly hitPolicyChanged: boolean;\n /** The cap on rows a `COLLECT` hit returns, which bounds a real result. */\n readonly collectLimitChanged: boolean;\n /**\n * `set`, `lookup` or `decision_table`. A kind change usually moves the rows too, but an\n * empty table moves only this member.\n */\n readonly kindChanged: boolean;\n readonly windowChanged: boolean;\n}\n\n/** A diff, or the reason the two documents are not two versions of one table. */\nexport type DatasetDiffResult =\n | { readonly kind: 'diff'; readonly diff: DatasetDiff }\n | { readonly kind: 'refused'; readonly diagnostics: readonly DatasetDiagnostic[] };\n\n/**\n * Names in the canonical code-point order (`CANON-1.1.8`).\n *\n * A set value's canonical text can carry an astral character, and there the order of UTF-16\n * code units is not the order of code points: the two disagree for a value above `U+FFFF` beside\n * one in `U+E000`–`U+FFFF`. Sorting with `<` would make this summary's order an artefact of the\n * host's string representation rather than the ordering the runtime hashes by.\n */\nfunction sorted(names: Iterable<string>): readonly string[] {\n return [...names].sort(compareCodePoints);\n}\n\n/** A row's meaning as canonical text, so a reordered member is not a change. */\nfunction rowText(row: LookupRow): string {\n return canonicalizeRestricted({\n key: row.key,\n ...(row.outcome === undefined ? {} : { outcome: row.outcome }),\n ...(row.output === undefined ? {} : { output: row.output }),\n });\n}\n\nfunction columnText(document: LookupTableDocument, columnId: string): string | undefined {\n const column = (document.columns ?? []).find((entry) => entry.columnId === columnId);\n return column === undefined ? undefined : `${column.role}:${column.primitive}`;\n}\n\nfunction byId<T extends { readonly columnId: string }>(\n entries: readonly T[],\n): ReadonlyMap<string, T> {\n return new Map(entries.map((entry) => [entry.columnId, entry]));\n}\n\n/**\n * Compares two versions of one table. A pair that names different tables is refused rather\n * than reported as a diff of nothing in common.\n */\nexport function diffDatasets(\n previous: LookupTableDocument,\n next: LookupTableDocument,\n): DatasetDiffResult {\n if (previous.tableId !== next.tableId) {\n return {\n kind: 'refused',\n diagnostics: [\n {\n code: 'DATASET_INVALID',\n path: '$',\n detail: `a diff compares one table with itself, but these name ${previous.tableId} and ${next.tableId}`,\n },\n ],\n };\n }\n\n const previousColumns = byId(previous.columns ?? []);\n const nextColumns = byId(next.columns ?? []);\n const addedColumns = sorted([...nextColumns.keys()].filter((id) => !previousColumns.has(id)));\n const removedColumns = sorted([...previousColumns.keys()].filter((id) => !nextColumns.has(id)));\n const changedColumns = sorted(\n [...nextColumns.keys()].filter(\n (id) => previousColumns.has(id) && columnText(previous, id) !== columnText(next, id),\n ),\n );\n\n const previousRows = new Map((previous.rows ?? []).map((row) => [row.rowId, row]));\n const nextRows = new Map((next.rows ?? []).map((row) => [row.rowId, row]));\n const addedRows = sorted([...nextRows.keys()].filter((id) => !previousRows.has(id)));\n const removedRows = sorted([...previousRows.keys()].filter((id) => !nextRows.has(id)));\n const changedRows = sorted(\n [...nextRows.keys()].filter((id) => {\n const before = previousRows.get(id);\n const after = nextRows.get(id);\n return before !== undefined && after !== undefined && rowText(before) !== rowText(after);\n }),\n );\n\n const previousValues = new Set(\n (previous.values ?? []).map((value) => canonicalizeRestricted(value)),\n );\n const nextValues = new Set((next.values ?? []).map((value) => canonicalizeRestricted(value)));\n const addedValues = sorted([...nextValues].filter((value) => !previousValues.has(value)));\n const removedValues = sorted([...previousValues].filter((value) => !nextValues.has(value)));\n\n return {\n kind: 'diff',\n diff: {\n tableId: previous.tableId,\n fromVersion: previous.tableVersion,\n toVersion: next.tableVersion,\n addedColumns,\n removedColumns,\n changedColumns,\n addedRows,\n removedRows,\n changedRows,\n addedValues,\n removedValues,\n hitPolicyChanged: previous.hitPolicy !== next.hitPolicy,\n collectLimitChanged: previous.collectLimit !== next.collectLimit,\n kindChanged: previous.kind !== next.kind,\n windowChanged:\n previous.effectiveFrom !== next.effectiveFrom || previous.effectiveTo !== next.effectiveTo,\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LookupTableDocument } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { DatasetCompileResult, DatasetDiagnostic } from './diagnostics.js';
|
|
3
|
+
/**
|
|
4
|
+
* Ingests and checks one dataset document that is already a value: the path the CSV
|
|
5
|
+
* front-end joins, so both formats pass through one set of semantic checks.
|
|
6
|
+
*/
|
|
7
|
+
export declare function inspectDatasetDocument(value: unknown): DatasetCompileResult;
|
|
8
|
+
/** Ingests and checks one dataset document written as JSON text. */
|
|
9
|
+
export declare function inspectDatasetText(source: string): DatasetCompileResult;
|
|
10
|
+
/** Maps one installation invariant onto the diagnostic that names it. */
|
|
11
|
+
export declare function installationDiagnostics(documents: readonly LookupTableDocument[]): readonly DatasetDiagnostic[];
|
|
12
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/datasets/document.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAGV,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,KAAK,EAEV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAub1B;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CA0B3E;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAsBvE;AAED,yEAAyE;AACzE,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,mBAAmB,EAAE,GACxC,SAAS,iBAAiB,EAAE,CAQ9B"}
|