fhirpath-ts 0.0.0-bootstrap.0
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 +201 -0
- package/README.md +391 -0
- package/THIRD-PARTY-NOTICES.md +296 -0
- package/dist/analyzer/analyze-dto.d.ts +45 -0
- package/dist/analyzer/analyze-dto.d.ts.map +1 -0
- package/dist/analyzer/analyze-dto.js +147 -0
- package/dist/analyzer/analyze-dto.js.map +1 -0
- package/dist/analyzer/analyze.d.ts +98 -0
- package/dist/analyzer/analyze.d.ts.map +1 -0
- package/dist/analyzer/analyze.js +925 -0
- package/dist/analyzer/analyze.js.map +1 -0
- package/dist/analyzer/expression-policy.d.ts +210 -0
- package/dist/analyzer/expression-policy.d.ts.map +1 -0
- package/dist/analyzer/expression-policy.js +254 -0
- package/dist/analyzer/expression-policy.js.map +1 -0
- package/dist/analyzer/index.d.ts +3 -0
- package/dist/analyzer/index.d.ts.map +1 -0
- package/dist/analyzer/index.js +6 -0
- package/dist/analyzer/index.js.map +1 -0
- package/dist/analyzer/regex-safety.d.ts +10 -0
- package/dist/analyzer/regex-safety.d.ts.map +1 -0
- package/dist/analyzer/regex-safety.js +84 -0
- package/dist/analyzer/regex-safety.js.map +1 -0
- package/dist/analyzer/signatures.d.ts +72 -0
- package/dist/analyzer/signatures.d.ts.map +1 -0
- package/dist/analyzer/signatures.js +195 -0
- package/dist/analyzer/signatures.js.map +1 -0
- package/dist/api/bundle.d.ts +29 -0
- package/dist/api/bundle.d.ts.map +1 -0
- package/dist/api/bundle.js +108 -0
- package/dist/api/bundle.js.map +1 -0
- package/dist/api/cache.d.ts +10 -0
- package/dist/api/cache.d.ts.map +1 -0
- package/dist/api/cache.js +38 -0
- package/dist/api/cache.js.map +1 -0
- package/dist/api/column-signature.d.ts +53 -0
- package/dist/api/column-signature.d.ts.map +1 -0
- package/dist/api/column-signature.js +43 -0
- package/dist/api/column-signature.js.map +1 -0
- package/dist/api/compile.d.ts +120 -0
- package/dist/api/compile.d.ts.map +1 -0
- package/dist/api/compile.js +167 -0
- package/dist/api/compile.js.map +1 -0
- package/dist/api/constraints.d.ts +48 -0
- package/dist/api/constraints.d.ts.map +1 -0
- package/dist/api/constraints.js +52 -0
- package/dist/api/constraints.js.map +1 -0
- package/dist/api/dto.d.ts +134 -0
- package/dist/api/dto.d.ts.map +1 -0
- package/dist/api/dto.js +295 -0
- package/dist/api/dto.js.map +1 -0
- package/dist/api/engine.d.ts +136 -0
- package/dist/api/engine.d.ts.map +1 -0
- package/dist/api/engine.js +183 -0
- package/dist/api/engine.js.map +1 -0
- package/dist/api/evaluate.d.ts +7 -0
- package/dist/api/evaluate.d.ts.map +1 -0
- package/dist/api/evaluate.js +10 -0
- package/dist/api/evaluate.js.map +1 -0
- package/dist/api/project.d.ts +89 -0
- package/dist/api/project.d.ts.map +1 -0
- package/dist/api/project.js +150 -0
- package/dist/api/project.js.map +1 -0
- package/dist/api/tagged.d.ts +14 -0
- package/dist/api/tagged.d.ts.map +1 -0
- package/dist/api/tagged.js +13 -0
- package/dist/api/tagged.js.map +1 -0
- package/dist/cli/dto-check.d.ts +25 -0
- package/dist/cli/dto-check.d.ts.map +1 -0
- package/dist/cli/dto-check.js +77 -0
- package/dist/cli/dto-check.js.map +1 -0
- package/dist/cli/fhirpath-check.d.ts +3 -0
- package/dist/cli/fhirpath-check.d.ts.map +1 -0
- package/dist/cli/fhirpath-check.js +149 -0
- package/dist/cli/fhirpath-check.js.map +1 -0
- package/dist/cli/ts-loader.d.mts +3 -0
- package/dist/cli/ts-loader.d.mts.map +1 -0
- package/dist/cli/ts-loader.mjs +48 -0
- package/dist/cli/ts-loader.mjs.map +1 -0
- package/dist/engine/context.d.ts +173 -0
- package/dist/engine/context.d.ts.map +1 -0
- package/dist/engine/context.js +118 -0
- package/dist/engine/context.js.map +1 -0
- package/dist/engine/evaluator.d.ts +7 -0
- package/dist/engine/evaluator.d.ts.map +1 -0
- package/dist/engine/evaluator.js +196 -0
- package/dist/engine/evaluator.js.map +1 -0
- package/dist/engine/navigation.d.ts +11 -0
- package/dist/engine/navigation.d.ts.map +1 -0
- package/dist/engine/navigation.js +102 -0
- package/dist/engine/navigation.js.map +1 -0
- package/dist/engine/operators/collections.d.ts +12 -0
- package/dist/engine/operators/collections.d.ts.map +1 -0
- package/dist/engine/operators/collections.js +31 -0
- package/dist/engine/operators/collections.js.map +1 -0
- package/dist/engine/operators/comparison.d.ts +13 -0
- package/dist/engine/operators/comparison.d.ts.map +1 -0
- package/dist/engine/operators/comparison.js +77 -0
- package/dist/engine/operators/comparison.js.map +1 -0
- package/dist/engine/operators/equality.d.ts +19 -0
- package/dist/engine/operators/equality.d.ts.map +1 -0
- package/dist/engine/operators/equality.js +203 -0
- package/dist/engine/operators/equality.js.map +1 -0
- package/dist/engine/operators/index.d.ts +18 -0
- package/dist/engine/operators/index.d.ts.map +1 -0
- package/dist/engine/operators/index.js +30 -0
- package/dist/engine/operators/index.js.map +1 -0
- package/dist/engine/operators/logic.d.ts +8 -0
- package/dist/engine/operators/logic.d.ts.map +1 -0
- package/dist/engine/operators/logic.js +38 -0
- package/dist/engine/operators/logic.js.map +1 -0
- package/dist/engine/operators/math.d.ts +13 -0
- package/dist/engine/operators/math.d.ts.map +1 -0
- package/dist/engine/operators/math.js +198 -0
- package/dist/engine/operators/math.js.map +1 -0
- package/dist/engine/operators/strings.d.ts +8 -0
- package/dist/engine/operators/strings.d.ts.map +1 -0
- package/dist/engine/operators/strings.js +22 -0
- package/dist/engine/operators/strings.js.map +1 -0
- package/dist/engine/operators/types.d.ts +3 -0
- package/dist/engine/operators/types.d.ts.map +1 -0
- package/dist/engine/operators/types.js +15 -0
- package/dist/engine/operators/types.js.map +1 -0
- package/dist/engine/type-matching.d.ts +20 -0
- package/dist/engine/type-matching.d.ts.map +1 -0
- package/dist/engine/type-matching.js +122 -0
- package/dist/engine/type-matching.js.map +1 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +21 -0
- package/dist/errors.js.map +1 -0
- package/dist/eslint/index.d.ts +12 -0
- package/dist/eslint/index.d.ts.map +1 -0
- package/dist/eslint/index.js +316 -0
- package/dist/eslint/index.js.map +1 -0
- package/dist/fhir/html-checks.d.ts +7 -0
- package/dist/fhir/html-checks.d.ts.map +1 -0
- package/dist/fhir/html-checks.js +256 -0
- package/dist/fhir/html-checks.js.map +1 -0
- package/dist/fhir/model-navigation.d.ts +11 -0
- package/dist/fhir/model-navigation.d.ts.map +1 -0
- package/dist/fhir/model-navigation.js +142 -0
- package/dist/fhir/model-navigation.js.map +1 -0
- package/dist/functions/aggregate.d.ts +2 -0
- package/dist/functions/aggregate.d.ts.map +1 -0
- package/dist/functions/aggregate.js +127 -0
- package/dist/functions/aggregate.js.map +1 -0
- package/dist/functions/boundary.d.ts +2 -0
- package/dist/functions/boundary.d.ts.map +1 -0
- package/dist/functions/boundary.js +189 -0
- package/dist/functions/boundary.js.map +1 -0
- package/dist/functions/combining.d.ts +2 -0
- package/dist/functions/combining.d.ts.map +1 -0
- package/dist/functions/combining.js +13 -0
- package/dist/functions/combining.js.map +1 -0
- package/dist/functions/control.d.ts +2 -0
- package/dist/functions/control.d.ts.map +1 -0
- package/dist/functions/control.js +25 -0
- package/dist/functions/control.js.map +1 -0
- package/dist/functions/conversion.d.ts +3 -0
- package/dist/functions/conversion.d.ts.map +1 -0
- package/dist/functions/conversion.js +316 -0
- package/dist/functions/conversion.js.map +1 -0
- package/dist/functions/date-components.d.ts +2 -0
- package/dist/functions/date-components.d.ts.map +1 -0
- package/dist/functions/date-components.js +81 -0
- package/dist/functions/date-components.js.map +1 -0
- package/dist/functions/existence.d.ts +4 -0
- package/dist/functions/existence.d.ts.map +1 -0
- package/dist/functions/existence.js +97 -0
- package/dist/functions/existence.js.map +1 -0
- package/dist/functions/fhir.d.ts +2 -0
- package/dist/functions/fhir.d.ts.map +1 -0
- package/dist/functions/fhir.js +222 -0
- package/dist/functions/fhir.js.map +1 -0
- package/dist/functions/filtering.d.ts +2 -0
- package/dist/functions/filtering.d.ts.map +1 -0
- package/dist/functions/filtering.js +112 -0
- package/dist/functions/filtering.js.map +1 -0
- package/dist/functions/install.d.ts +18 -0
- package/dist/functions/install.d.ts.map +1 -0
- package/dist/functions/install.js +20 -0
- package/dist/functions/install.js.map +1 -0
- package/dist/functions/iteration.d.ts +7 -0
- package/dist/functions/iteration.d.ts.map +1 -0
- package/dist/functions/iteration.js +9 -0
- package/dist/functions/iteration.js.map +1 -0
- package/dist/functions/math.d.ts +2 -0
- package/dist/functions/math.d.ts.map +1 -0
- package/dist/functions/math.js +152 -0
- package/dist/functions/math.js.map +1 -0
- package/dist/functions/reflection.d.ts +2 -0
- package/dist/functions/reflection.d.ts.map +1 -0
- package/dist/functions/reflection.js +23 -0
- package/dist/functions/reflection.js.map +1 -0
- package/dist/functions/registry.d.ts +28 -0
- package/dist/functions/registry.d.ts.map +1 -0
- package/dist/functions/registry.js +46 -0
- package/dist/functions/registry.js.map +1 -0
- package/dist/functions/sort.d.ts +2 -0
- package/dist/functions/sort.d.ts.map +1 -0
- package/dist/functions/sort.js +48 -0
- package/dist/functions/sort.js.map +1 -0
- package/dist/functions/string.d.ts +2 -0
- package/dist/functions/string.d.ts.map +1 -0
- package/dist/functions/string.js +353 -0
- package/dist/functions/string.js.map +1 -0
- package/dist/functions/subsetting.d.ts +2 -0
- package/dist/functions/subsetting.d.ts.map +1 -0
- package/dist/functions/subsetting.js +72 -0
- package/dist/functions/subsetting.js.map +1 -0
- package/dist/functions/tree.d.ts +8 -0
- package/dist/functions/tree.d.ts.map +1 -0
- package/dist/functions/tree.js +109 -0
- package/dist/functions/tree.js.map +1 -0
- package/dist/functions/type-specifier.d.ts +8 -0
- package/dist/functions/type-specifier.d.ts.map +1 -0
- package/dist/functions/type-specifier.js +27 -0
- package/dist/functions/type-specifier.js.map +1 -0
- package/dist/functions/utility.d.ts +2 -0
- package/dist/functions/utility.d.ts.map +1 -0
- package/dist/functions/utility.js +76 -0
- package/dist/functions/utility.js.map +1 -0
- package/dist/functions/variables.d.ts +2 -0
- package/dist/functions/variables.d.ts.map +1 -0
- package/dist/functions/variables.js +35 -0
- package/dist/functions/variables.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/lexer/lexer.d.ts +4 -0
- package/dist/lexer/lexer.d.ts.map +1 -0
- package/dist/lexer/lexer.js +318 -0
- package/dist/lexer/lexer.js.map +1 -0
- package/dist/lexer/tokens.d.ts +23 -0
- package/dist/lexer/tokens.d.ts.map +1 -0
- package/dist/lexer/tokens.js +40 -0
- package/dist/lexer/tokens.js.map +1 -0
- package/dist/model/provider.d.ts +36 -0
- package/dist/model/provider.d.ts.map +1 -0
- package/dist/model/provider.js +2 -0
- package/dist/model/provider.js.map +1 -0
- package/dist/parser/ast.d.ts +104 -0
- package/dist/parser/ast.d.ts.map +1 -0
- package/dist/parser/ast.js +2 -0
- package/dist/parser/ast.js.map +1 -0
- package/dist/parser/parser.d.ts +4 -0
- package/dist/parser/parser.d.ts.map +1 -0
- package/dist/parser/parser.js +299 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/precedence.d.ts +24 -0
- package/dist/parser/precedence.d.ts.map +1 -0
- package/dist/parser/precedence.js +52 -0
- package/dist/parser/precedence.js.map +1 -0
- package/dist/parser/printer.d.ts +4 -0
- package/dist/parser/printer.d.ts.map +1 -0
- package/dist/parser/printer.js +112 -0
- package/dist/parser/printer.js.map +1 -0
- package/dist/r4/generated/resources-data.d.ts +3 -0
- package/dist/r4/generated/resources-data.d.ts.map +1 -0
- package/dist/r4/generated/resources-data.js +28628 -0
- package/dist/r4/generated/resources-data.js.map +1 -0
- package/dist/r4/generated/type-maps.d.ts +43153 -0
- package/dist/r4/generated/type-maps.d.ts.map +1 -0
- package/dist/r4/generated/type-maps.js +4 -0
- package/dist/r4/generated/type-maps.js.map +1 -0
- package/dist/r4/generated/types-data.d.ts +3 -0
- package/dist/r4/generated/types-data.d.ts.map +1 -0
- package/dist/r4/generated/types-data.js +2205 -0
- package/dist/r4/generated/types-data.js.map +1 -0
- package/dist/r4/index.d.ts +9 -0
- package/dist/r4/index.d.ts.map +1 -0
- package/dist/r4/index.js +94 -0
- package/dist/r4/index.js.map +1 -0
- package/dist/r4/model-data.d.ts +17 -0
- package/dist/r4/model-data.d.ts.map +1 -0
- package/dist/r4/model-data.js +2 -0
- package/dist/r4/model-data.js.map +1 -0
- package/dist/sites/index.d.ts +31 -0
- package/dist/sites/index.d.ts.map +1 -0
- package/dist/sites/index.js +205 -0
- package/dist/sites/index.js.map +1 -0
- package/dist/typed/infer.d.ts +234 -0
- package/dist/typed/infer.d.ts.map +1 -0
- package/dist/typed/infer.js +85 -0
- package/dist/typed/infer.js.map +1 -0
- package/dist/typed/perf-fixture.types.d.ts +136 -0
- package/dist/typed/perf-fixture.types.d.ts.map +1 -0
- package/dist/typed/perf-fixture.types.js +2 -0
- package/dist/typed/perf-fixture.types.js.map +1 -0
- package/dist/values/collection.d.ts +24 -0
- package/dist/values/collection.d.ts.map +1 -0
- package/dist/values/collection.js +51 -0
- package/dist/values/collection.js.map +1 -0
- package/dist/values/datetime.d.ts +54 -0
- package/dist/values/datetime.d.ts.map +1 -0
- package/dist/values/datetime.js +226 -0
- package/dist/values/datetime.js.map +1 -0
- package/dist/values/decimal.d.ts +48 -0
- package/dist/values/decimal.d.ts.map +1 -0
- package/dist/values/decimal.js +188 -0
- package/dist/values/decimal.js.map +1 -0
- package/dist/values/numeric.d.ts +24 -0
- package/dist/values/numeric.d.ts.map +1 -0
- package/dist/values/numeric.js +53 -0
- package/dist/values/numeric.js.map +1 -0
- package/dist/values/quantity.d.ts +49 -0
- package/dist/values/quantity.d.ts.map +1 -0
- package/dist/values/quantity.js +297 -0
- package/dist/values/quantity.js.map +1 -0
- package/dist/values/temporal-arithmetic.d.ts +17 -0
- package/dist/values/temporal-arithmetic.d.ts.map +1 -0
- package/dist/values/temporal-arithmetic.js +183 -0
- package/dist/values/temporal-arithmetic.js.map +1 -0
- package/dist/values/temporal-compare.d.ts +9 -0
- package/dist/values/temporal-compare.d.ts.map +1 -0
- package/dist/values/temporal-compare.js +59 -0
- package/dist/values/temporal-compare.js.map +1 -0
- package/dist/values/type-compat.d.ts +47 -0
- package/dist/values/type-compat.d.ts.map +1 -0
- package/dist/values/type-compat.js +100 -0
- package/dist/values/type-compat.js.map +1 -0
- package/dist/values/typed-value.d.ts +48 -0
- package/dist/values/typed-value.d.ts.map +1 -0
- package/dist/values/typed-value.js +117 -0
- package/dist/values/typed-value.js.map +1 -0
- package/dist/values/ucum.d.ts +14 -0
- package/dist/values/ucum.d.ts.map +1 -0
- package/dist/values/ucum.js +146 -0
- package/dist/values/ucum.js.map +1 -0
- package/package.json +137 -0
- package/src/analyzer/analyze-dto.ts +195 -0
- package/src/analyzer/analyze.ts +1181 -0
- package/src/analyzer/expression-policy.ts +434 -0
- package/src/analyzer/index.ts +23 -0
- package/src/analyzer/regex-safety.ts +85 -0
- package/src/analyzer/signatures.ts +260 -0
- package/src/api/bundle.ts +132 -0
- package/src/api/cache.ts +40 -0
- package/src/api/column-signature.ts +71 -0
- package/src/api/compile.ts +308 -0
- package/src/api/constraints.ts +104 -0
- package/src/api/dto.ts +445 -0
- package/src/api/engine.ts +328 -0
- package/src/api/evaluate.ts +11 -0
- package/src/api/project.ts +255 -0
- package/src/api/tagged.ts +35 -0
- package/src/cli/dto-check.ts +94 -0
- package/src/cli/fhirpath-check.ts +168 -0
- package/src/cli/ts-loader.mjs +49 -0
- package/src/engine/context.ts +282 -0
- package/src/engine/evaluator.ts +246 -0
- package/src/engine/navigation.ts +106 -0
- package/src/engine/operators/collections.ts +34 -0
- package/src/engine/operators/comparison.ts +82 -0
- package/src/engine/operators/equality.ts +232 -0
- package/src/engine/operators/index.ts +65 -0
- package/src/engine/operators/logic.ts +53 -0
- package/src/engine/operators/math.ts +225 -0
- package/src/engine/operators/strings.ts +25 -0
- package/src/engine/operators/types.ts +16 -0
- package/src/engine/type-matching.ts +148 -0
- package/src/errors.ts +33 -0
- package/src/eslint/index.ts +388 -0
- package/src/fhir/html-checks.ts +266 -0
- package/src/fhir/model-navigation.ts +148 -0
- package/src/functions/aggregate.ts +136 -0
- package/src/functions/boundary.ts +209 -0
- package/src/functions/combining.ts +15 -0
- package/src/functions/control.ts +25 -0
- package/src/functions/conversion.ts +349 -0
- package/src/functions/date-components.ts +88 -0
- package/src/functions/existence.ts +107 -0
- package/src/functions/fhir.ts +247 -0
- package/src/functions/filtering.ts +120 -0
- package/src/functions/install.ts +19 -0
- package/src/functions/iteration.ts +21 -0
- package/src/functions/math.ts +167 -0
- package/src/functions/reflection.ts +24 -0
- package/src/functions/registry.ts +72 -0
- package/src/functions/sort.ts +68 -0
- package/src/functions/string.ts +413 -0
- package/src/functions/subsetting.ts +89 -0
- package/src/functions/tree.ts +112 -0
- package/src/functions/type-specifier.ts +29 -0
- package/src/functions/utility.ts +82 -0
- package/src/functions/variables.ts +36 -0
- package/src/index.ts +30 -0
- package/src/lexer/lexer.ts +341 -0
- package/src/lexer/tokens.ts +69 -0
- package/src/model/provider.ts +36 -0
- package/src/parser/ast.ts +164 -0
- package/src/parser/parser.ts +321 -0
- package/src/parser/precedence.ts +52 -0
- package/src/parser/printer.ts +114 -0
- package/src/r4/generated/resources-data.ts +28631 -0
- package/src/r4/generated/type-maps.ts +22145 -0
- package/src/r4/generated/types-data.ts +2208 -0
- package/src/r4/index.ts +107 -0
- package/src/r4/model-data.ts +17 -0
- package/src/sites/index.ts +285 -0
- package/src/typed/infer.ts +433 -0
- package/src/typed/perf-fixture.types.ts +143 -0
- package/src/values/collection.ts +57 -0
- package/src/values/datetime.ts +285 -0
- package/src/values/decimal.ts +213 -0
- package/src/values/numeric.ts +63 -0
- package/src/values/quantity.ts +358 -0
- package/src/values/temporal-arithmetic.ts +231 -0
- package/src/values/temporal-compare.ts +65 -0
- package/src/values/type-compat.ts +133 -0
- package/src/values/typed-value.ts +151 -0
- package/src/values/ucum.ts +181 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
This package (`fhirpath-ts`) has **zero runtime dependencies**, but it
|
|
4
|
+
contains material adapted from, or vendored out of, the projects below. This
|
|
5
|
+
file consolidates their notices so any future redistribution of the package
|
|
6
|
+
(npm publication, OSS extraction) carries them along. Today the package is
|
|
7
|
+
consumed privately inside this repository.
|
|
8
|
+
|
|
9
|
+
## Medplum — Apache License 2.0
|
|
10
|
+
|
|
11
|
+
The Pratt-parser structure (prefix/infix parselets driven by a precedence
|
|
12
|
+
table) in `src/parser/parser.ts` is adapted from Medplum's FHIRPath parser:
|
|
13
|
+
<https://github.com/medplum/medplum> (`packages/core/src/fhirlexer/parse.ts`).
|
|
14
|
+
A handful of evaluator spot-check expressions in
|
|
15
|
+
`src/reference-crosschecks.test.ts` come from its test suite. Licensed under
|
|
16
|
+
the Apache License 2.0 — full text in the appendix below.
|
|
17
|
+
|
|
18
|
+
## octofhir/fhirpath-rs — Apache License 2.0
|
|
19
|
+
|
|
20
|
+
Custom test cases in `src/reference-crosschecks.test.ts` are ported from
|
|
21
|
+
<https://github.com/octofhir/fhirpath-rs> (`test-cases/groups/other/`),
|
|
22
|
+
copyright (c) 2024 OctoFHIR Team. The project is dual-licensed MIT OR
|
|
23
|
+
Apache-2.0; this package takes it under the Apache License 2.0 — full text in
|
|
24
|
+
the appendix below.
|
|
25
|
+
|
|
26
|
+
## FHIR/fhir-test-cases — Apache License 2.0
|
|
27
|
+
|
|
28
|
+
The official FHIRPath conformance suites and their fixtures in
|
|
29
|
+
`test-data/official/` are vendored (converted from XML to JSON) from
|
|
30
|
+
<https://github.com/FHIR/fhir-test-cases>, licensed under the Apache License
|
|
31
|
+
2.0 (also vendored alongside as `test-data/official/LICENSE.txt`). The FHIR®
|
|
32
|
+
specification content they embed is offered by HL7 under CC0 terms.
|
|
33
|
+
|
|
34
|
+
## HL7/fhirpath.js — NLM/Health Samurai license (BSD-style)
|
|
35
|
+
|
|
36
|
+
The reference test corpus in `test-data/fhirpathjs/cases.json` and the
|
|
37
|
+
fixtures in `test-data/fhirpathjs/resources/` are vendored (converted from
|
|
38
|
+
YAML to JSON) from <https://github.com/HL7/fhirpath.js>. Some fixtures in
|
|
39
|
+
`test-data/official/fixtures/` derive from the same project (see
|
|
40
|
+
`test-data/official/FIXTURES-LICENSE.md`). Its license in full:
|
|
41
|
+
|
|
42
|
+
> # LICENSE
|
|
43
|
+
>
|
|
44
|
+
> The software, fhirpath.js, was jointly developed by the Lister Hill National
|
|
45
|
+
> Center for Biomedical Communications (LHNCBC), a research and development
|
|
46
|
+
> division of the U.S. National Library of Medicine (NLM), and niquola@gmail.com
|
|
47
|
+
> (Health Samurai).
|
|
48
|
+
>
|
|
49
|
+
> The following terms and conditions are based on the BSD open-source license.
|
|
50
|
+
>
|
|
51
|
+
> If publishing research that used this software, please include a citation that
|
|
52
|
+
> acknowledges it.
|
|
53
|
+
>
|
|
54
|
+
> Redistribution and use in source and binary forms, with or without modification,
|
|
55
|
+
> are permitted for commercial and non-commercial purposes and products alike,
|
|
56
|
+
> provided that the following conditions are met:
|
|
57
|
+
>
|
|
58
|
+
> * Redistributions of source code shall retain this license file, including the
|
|
59
|
+
> list of contributing developers and organizations, this list of conditions and
|
|
60
|
+
> the following disclaimer.
|
|
61
|
+
> * Redistributions in binary form shall include this license file, including the
|
|
62
|
+
> list of contributing developers and organizations, this list of conditions and
|
|
63
|
+
> the following disclaimer, in the documentation and/or other materials provided
|
|
64
|
+
> with the distribution.
|
|
65
|
+
> * Neither the names of the National Library of Medicine (NLM), the Lister Hill
|
|
66
|
+
> National Center for Biomedical Communications (LHNCBC), the National
|
|
67
|
+
> Institutes of Health (NIH), nor the names of any of the software contributors
|
|
68
|
+
> may be used to endorse or promote products derived from this software without
|
|
69
|
+
> specific prior written permission.
|
|
70
|
+
>
|
|
71
|
+
> THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
|
72
|
+
> OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
73
|
+
> MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
|
74
|
+
> SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
75
|
+
> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
76
|
+
> PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
77
|
+
> BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
78
|
+
> CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
79
|
+
> IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
|
80
|
+
> OF SUCH DAMAGE.
|
|
81
|
+
|
|
82
|
+
## beda-software/fhirpath-py — MIT License
|
|
83
|
+
|
|
84
|
+
The extra test cases in `test-data/fhirpathjs/cases-py-extras.json` are
|
|
85
|
+
vendored (converted from YAML to JSON) from
|
|
86
|
+
<https://github.com/beda-software/fhirpath-py>. Its license in full:
|
|
87
|
+
|
|
88
|
+
> MIT License
|
|
89
|
+
>
|
|
90
|
+
> Copyright (c) 2020 beda.software
|
|
91
|
+
>
|
|
92
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
93
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
94
|
+
> in the Software without restriction, including without limitation the rights
|
|
95
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
96
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
97
|
+
> furnished to do so, subject to the following conditions:
|
|
98
|
+
>
|
|
99
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
100
|
+
> copies or substantial portions of the Software.
|
|
101
|
+
>
|
|
102
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
103
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
104
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
105
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
106
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
107
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
108
|
+
> SOFTWARE.
|
|
109
|
+
|
|
110
|
+
## HL7 FHIR® definitions — CC0
|
|
111
|
+
|
|
112
|
+
The generated R4 model in `src/r4/generated/` is produced by
|
|
113
|
+
`scripts/generate-r4-model.ts` from the HL7 FHIR R4 StructureDefinitions
|
|
114
|
+
(shipped in `@medplum/definitions`). HL7 provides the FHIR specification
|
|
115
|
+
content under Creative Commons "No Rights Reserved" (CC0). HL7®, FHIR® and
|
|
116
|
+
the FHIR flame design are registered trademarks of Health Level Seven
|
|
117
|
+
International; their use here is descriptive and implies no endorsement.
|
|
118
|
+
|
|
119
|
+
## Appendix: Apache License 2.0
|
|
120
|
+
|
|
121
|
+
Apache License
|
|
122
|
+
Version 2.0, January 2004
|
|
123
|
+
http://www.apache.org/licenses/
|
|
124
|
+
|
|
125
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
126
|
+
|
|
127
|
+
1. Definitions.
|
|
128
|
+
|
|
129
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
130
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
131
|
+
|
|
132
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
133
|
+
the copyright owner that is granting the License.
|
|
134
|
+
|
|
135
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
136
|
+
other entities that control, are controlled by, or are under common
|
|
137
|
+
control with that entity. For the purposes of this definition,
|
|
138
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
139
|
+
direction or management of such entity, whether by contract or
|
|
140
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
141
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
142
|
+
|
|
143
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
144
|
+
exercising permissions granted by this License.
|
|
145
|
+
|
|
146
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
147
|
+
including but not limited to software source code, documentation
|
|
148
|
+
source, and configuration files.
|
|
149
|
+
|
|
150
|
+
"Object" form shall mean any form resulting from mechanical
|
|
151
|
+
transformation or translation of a Source form, including but
|
|
152
|
+
not limited to compiled object code, generated documentation,
|
|
153
|
+
and conversions to other media types.
|
|
154
|
+
|
|
155
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
156
|
+
Object form, made available under the License, as indicated by a
|
|
157
|
+
copyright notice that is included in or attached to the work
|
|
158
|
+
(an example is provided in the Appendix below).
|
|
159
|
+
|
|
160
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
161
|
+
form, that is based on (or derived from) the Work and for which the
|
|
162
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
163
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
164
|
+
of this License, Derivative Works shall not include works that remain
|
|
165
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
166
|
+
the Work and Derivative Works thereof.
|
|
167
|
+
|
|
168
|
+
"Contribution" shall mean any work of authorship, including
|
|
169
|
+
the original version of the Work and any modifications or additions
|
|
170
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
171
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
172
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
173
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
174
|
+
means any form of electronic, verbal, or written communication sent
|
|
175
|
+
to the Licensor or its representatives, including but not limited to
|
|
176
|
+
communication on electronic mailing lists, source code control systems,
|
|
177
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
178
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
179
|
+
excluding communication that is conspicuously marked or otherwise
|
|
180
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
181
|
+
|
|
182
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
183
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
184
|
+
subsequently incorporated within the Work.
|
|
185
|
+
|
|
186
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
187
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
188
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
189
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
190
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
191
|
+
Work and such Derivative Works in Source or Object form.
|
|
192
|
+
|
|
193
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
194
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
195
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
196
|
+
(except as stated in this section) patent license to make, have made,
|
|
197
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
198
|
+
where such license applies only to those patent claims licensable
|
|
199
|
+
by such Contributor that are necessarily infringed by their
|
|
200
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
201
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
202
|
+
institute patent litigation against any entity (including a
|
|
203
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
204
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
205
|
+
or contributory patent infringement, then any patent licenses
|
|
206
|
+
granted to You under this License for that Work shall terminate
|
|
207
|
+
as of the date such litigation is filed.
|
|
208
|
+
|
|
209
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
210
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
211
|
+
modifications, and in Source or Object form, provided that You
|
|
212
|
+
meet the following conditions:
|
|
213
|
+
|
|
214
|
+
(a) You must give any other recipients of the Work or
|
|
215
|
+
Derivative Works a copy of this License; and
|
|
216
|
+
|
|
217
|
+
(b) You must cause any modified files to carry prominent notices
|
|
218
|
+
stating that You changed the files; and
|
|
219
|
+
|
|
220
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
221
|
+
that You distribute, all copyright, patent, trademark, and
|
|
222
|
+
attribution notices from the Source form of the Work,
|
|
223
|
+
excluding those notices that do not pertain to any part of
|
|
224
|
+
the Derivative Works; and
|
|
225
|
+
|
|
226
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
227
|
+
distribution, then any Derivative Works that You distribute must
|
|
228
|
+
include a readable copy of the attribution notices contained
|
|
229
|
+
within such NOTICE file, excluding those notices that do not
|
|
230
|
+
pertain to any part of the Derivative Works, in at least one
|
|
231
|
+
of the following places: within a NOTICE text file distributed
|
|
232
|
+
as part of the Derivative Works; within the Source form or
|
|
233
|
+
documentation, if provided along with the Derivative Works; or,
|
|
234
|
+
within a display generated by the Derivative Works, if and
|
|
235
|
+
wherever such third-party notices normally appear. The contents
|
|
236
|
+
of the NOTICE file are for informational purposes only and
|
|
237
|
+
do not modify the License. You may add Your own attribution
|
|
238
|
+
notices within Derivative Works that You distribute, alongside
|
|
239
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
240
|
+
that such additional attribution notices cannot be construed
|
|
241
|
+
as modifying the License.
|
|
242
|
+
|
|
243
|
+
You may add Your own copyright statement to Your modifications and
|
|
244
|
+
may provide additional or different license terms and conditions
|
|
245
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
246
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
247
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
248
|
+
the conditions stated in this License.
|
|
249
|
+
|
|
250
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
251
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
252
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
253
|
+
this License, without any additional terms or conditions.
|
|
254
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
255
|
+
the terms of any separate license agreement you may have executed
|
|
256
|
+
with Licensor regarding such Contributions.
|
|
257
|
+
|
|
258
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
259
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
260
|
+
except as required for reasonable and customary use in describing the
|
|
261
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
262
|
+
|
|
263
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
264
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
265
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
266
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
267
|
+
implied, including, without limitation, any warranties or conditions
|
|
268
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
269
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
270
|
+
appropriateness of using or redistributing the Work and assume any
|
|
271
|
+
risks associated with Your exercise of permissions under this License.
|
|
272
|
+
|
|
273
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
274
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
275
|
+
unless required by applicable law (such as deliberate and grossly
|
|
276
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
277
|
+
liable to You for damages, including any direct, indirect, special,
|
|
278
|
+
incidental, or consequential damages of any character arising as a
|
|
279
|
+
result of this License or out of the use or inability to use the
|
|
280
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
281
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
282
|
+
other commercial damages or losses), even if such Contributor
|
|
283
|
+
has been advised of the possibility of such damages.
|
|
284
|
+
|
|
285
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
286
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
287
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
288
|
+
or other liability obligations and/or rights consistent with this
|
|
289
|
+
License. However, in accepting such obligations, You may act only
|
|
290
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
291
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
292
|
+
defend, and hold each Contributor harmless for any liability
|
|
293
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
294
|
+
of your accepting any such warranty or additional liability.
|
|
295
|
+
|
|
296
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type DtoClass } from '../api/dto.ts';
|
|
2
|
+
import type { ModelProvider } from '../model/provider.ts';
|
|
3
|
+
import { type AnalyzeOptions, type AnalyzerDiagnostic, type DeclaredFunction } from './analyze.ts';
|
|
4
|
+
/** One `analyzeDto` finding: an analyzer diagnostic plus the class member it came from. */
|
|
5
|
+
export interface DtoDiagnostic extends AnalyzerDiagnostic {
|
|
6
|
+
/** The column field name, or `vars.<name>` for a DTO var. */
|
|
7
|
+
member: string;
|
|
8
|
+
/** The expression that produced the finding, so a reporter can locate it in source. */
|
|
9
|
+
expression: string;
|
|
10
|
+
}
|
|
11
|
+
/** Engine context read by the analyzer without importing the engine implementation. */
|
|
12
|
+
export interface AnalyzedContext {
|
|
13
|
+
readonly defaults: {
|
|
14
|
+
model?: ModelProvider;
|
|
15
|
+
functions?: Record<string, DeclaredFunction>;
|
|
16
|
+
env?: object;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** A context that also knows which DTOs it registered, which is what a sweep needs. */
|
|
20
|
+
export interface AnalyzedEngine extends AnalyzedContext {
|
|
21
|
+
readonly dtos: readonly DtoClass[];
|
|
22
|
+
}
|
|
23
|
+
/** `analyzeDto` options, with the engine the DTO belongs to as a shortcut for its context. */
|
|
24
|
+
export interface AnalyzeDtoOptions extends AnalyzeOptions {
|
|
25
|
+
/** Engine model, functions, and environment names used while checking the DTO. */
|
|
26
|
+
engine?: AnalyzedContext;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Every DTO an engine registered, checked against that engine's own context —
|
|
30
|
+
* the sweep a project's checker runs, with no list to maintain: the engine
|
|
31
|
+
* already knows its `resourceDtos`. Each finding names the class it came from.
|
|
32
|
+
* DTOs the engine does not register (row shapes you only ever project) are not
|
|
33
|
+
* reachable from here; pass those to `analyzeDto` yourself, or list them.
|
|
34
|
+
*/
|
|
35
|
+
export declare function analyzeEngineDtos(engine: AnalyzedEngine, options?: AnalyzeOptions): (DtoDiagnostic & {
|
|
36
|
+
dto: string;
|
|
37
|
+
})[];
|
|
38
|
+
/**
|
|
39
|
+
* Checks a DTO's columns, criteria, and variables. The DTO type is the input
|
|
40
|
+
* context. DTO environment names, caller environment names, and row variables
|
|
41
|
+
* are declared automatically. Variables are checked in order. Declared column
|
|
42
|
+
* types and enums are compared with the analyzer result.
|
|
43
|
+
*/
|
|
44
|
+
export declare function analyzeDto(dto: DtoClass, options?: AnalyzeDtoOptions): DtoDiagnostic[];
|
|
45
|
+
//# sourceMappingURL=analyze-dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-dto.d.ts","sourceRoot":"","sources":["../../src/analyzer/analyze-dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,QAAQ,EAAiB,MAAM,eAAe,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAEtB,MAAM,cAAc,CAAA;AAErB,2FAA2F;AAC3F,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,uFAAuF;IACvF,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE;QAAE,KAAK,CAAC,EAAE,aAAa,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACzG;AAED,uFAAuF;AACvF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,QAAQ,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,CAAA;CACnC;AAED,8FAA8F;AAC9F,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,kFAAkF;IAClF,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB;AAgCD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,CAAC,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,CAIrC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa,EAAE,CA+CtF"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { columnResultType } from "../api/column-signature.js";
|
|
2
|
+
import { dtoDefinition } from "../api/dto.js";
|
|
3
|
+
import { valueKindOfTypeName } from "../values/type-compat.js";
|
|
4
|
+
import { analyzeExpressionDetailed, } from "./analyze.js";
|
|
5
|
+
/**
|
|
6
|
+
* The analyzer context for a DTO: what its engine supplies, with the caller's
|
|
7
|
+
* own options layered on top *per name* — one function or variable a host
|
|
8
|
+
* declares must not displace the engine's whole table, or a valid column call
|
|
9
|
+
* would be reported as unresolved. `model` and `inputType` are single values, so
|
|
10
|
+
* there the caller simply wins.
|
|
11
|
+
*/
|
|
12
|
+
function contextOf(options) {
|
|
13
|
+
const { engine, ...caller } = options ?? {};
|
|
14
|
+
if (engine === undefined) {
|
|
15
|
+
return caller;
|
|
16
|
+
}
|
|
17
|
+
const { model, functions, env } = engine.defaults;
|
|
18
|
+
return {
|
|
19
|
+
...(model !== undefined && { model }),
|
|
20
|
+
...caller,
|
|
21
|
+
functions: { ...functions, ...caller.functions },
|
|
22
|
+
variables: { ...envVariables(env), ...caller.variables },
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** An engine's env names, declared as variables the expressions may read. */
|
|
26
|
+
function envVariables(env) {
|
|
27
|
+
const variables = {};
|
|
28
|
+
for (const name of Object.keys(env ?? {})) {
|
|
29
|
+
variables[bare(name)] = {};
|
|
30
|
+
}
|
|
31
|
+
return variables;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every DTO an engine registered, checked against that engine's own context —
|
|
35
|
+
* the sweep a project's checker runs, with no list to maintain: the engine
|
|
36
|
+
* already knows its `resourceDtos`. Each finding names the class it came from.
|
|
37
|
+
* DTOs the engine does not register (row shapes you only ever project) are not
|
|
38
|
+
* reachable from here; pass those to `analyzeDto` yourself, or list them.
|
|
39
|
+
*/
|
|
40
|
+
export function analyzeEngineDtos(engine, options) {
|
|
41
|
+
return engine.dtos.flatMap(dto => analyzeDto(dto, { ...options, engine }).map(finding => ({ ...finding, dto: dto.name })));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Checks a DTO's columns, criteria, and variables. The DTO type is the input
|
|
45
|
+
* context. DTO environment names, caller environment names, and row variables
|
|
46
|
+
* are declared automatically. Variables are checked in order. Declared column
|
|
47
|
+
* types and enums are compared with the analyzer result.
|
|
48
|
+
*/
|
|
49
|
+
export function analyzeDto(dto, options) {
|
|
50
|
+
const definition = dtoDefinition(dto);
|
|
51
|
+
const context = contextOf(options);
|
|
52
|
+
const inputType = context.inputType ?? definition.fhirType;
|
|
53
|
+
const declared = {
|
|
54
|
+
rowIndex: { types: ['System.Integer'], single: true },
|
|
55
|
+
rowTotal: { types: ['System.Integer'], single: true },
|
|
56
|
+
};
|
|
57
|
+
for (const name of [...Object.keys(definition.env ?? {}), ...(definition.callerEnv ?? [])]) {
|
|
58
|
+
declared[bare(name)] = {};
|
|
59
|
+
}
|
|
60
|
+
const diagnostics = [];
|
|
61
|
+
const analyze = (member, expression, column) => {
|
|
62
|
+
const perExpression = {
|
|
63
|
+
...context,
|
|
64
|
+
...(inputType !== undefined && { inputType }),
|
|
65
|
+
variables: { ...declared, ...context.variables },
|
|
66
|
+
};
|
|
67
|
+
const { diagnostics: found, result } = analyzeExpressionDetailed(expression, perExpression);
|
|
68
|
+
for (const diagnostic of found) {
|
|
69
|
+
diagnostics.push({ member, expression, ...diagnostic });
|
|
70
|
+
}
|
|
71
|
+
const mismatch = column === undefined ? undefined : declaredTypeMismatch(column, result.types, context);
|
|
72
|
+
if (mismatch !== undefined) {
|
|
73
|
+
// The conflicting field declaration is outside the expression, so mark the whole expression.
|
|
74
|
+
diagnostics.push({
|
|
75
|
+
member,
|
|
76
|
+
expression,
|
|
77
|
+
severity: 'error',
|
|
78
|
+
code: 'column-type',
|
|
79
|
+
message: mismatch,
|
|
80
|
+
span: { start: 0, end: expression.length, line: 1, column: 1 },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
for (const [name, value] of Object.entries(definition.vars ?? {})) {
|
|
85
|
+
const source = typeof value === 'string' ? value : sourceOf(value);
|
|
86
|
+
if (source !== undefined) {
|
|
87
|
+
// A var declares no type, so there is nothing to cross-check against.
|
|
88
|
+
analyze(`vars.${bare(name)}`, source);
|
|
89
|
+
}
|
|
90
|
+
declared[bare(name)] = {};
|
|
91
|
+
}
|
|
92
|
+
for (const [name, spec] of Object.entries(definition.columns)) {
|
|
93
|
+
analyze(name, expressionOf(spec), spec);
|
|
94
|
+
}
|
|
95
|
+
return diagnostics;
|
|
96
|
+
}
|
|
97
|
+
/** The expression a column reads: a criteria's `test`, else its path. */
|
|
98
|
+
function expressionOf(column) {
|
|
99
|
+
return 'test' in column ? column.test : column.path;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The type a column claims its expression yields — `columnSignature`'s rule, the
|
|
103
|
+
* one the engine registers and the walkers declare, so a cross-check can never
|
|
104
|
+
* contradict a claim that was never made.
|
|
105
|
+
*
|
|
106
|
+
* A criteria claims nothing here, even though its function declares a Boolean
|
|
107
|
+
* result. The Boolean comes from the criteria rule applied to the result, not
|
|
108
|
+
* from the expression itself. `@criteria('name.given')` validly returns
|
|
109
|
+
* HumanName.given, which then reads as true.
|
|
110
|
+
*/
|
|
111
|
+
function claimedType(column) {
|
|
112
|
+
return 'test' in column ? undefined : columnResultType(column);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Compares a declared column type with analyzer results. Primitive types compare
|
|
116
|
+
* by value kind; complex types use the model hierarchy. Unknown results pass.
|
|
117
|
+
*/
|
|
118
|
+
function declaredTypeMismatch(column, yielded, options) {
|
|
119
|
+
const claimed = claimedType(column);
|
|
120
|
+
if (claimed === undefined || yielded === undefined || yielded.length === 0) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
const canonical = options?.model?.resolveType(claimed) ?? claimed;
|
|
124
|
+
const claimedKind = valueKindOfTypeName(canonical);
|
|
125
|
+
const fits = yielded.some(type => {
|
|
126
|
+
if (valueKindOfTypeName(type) !== claimedKind) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
if (claimedKind !== 'Complex') {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
const model = options?.model;
|
|
133
|
+
/* v8 ignore next -- without a model the analyzer never reaches a complex FHIR type, so the model-less half cannot be exercised */
|
|
134
|
+
return model === undefined || model.isSubtypeOf(type, canonical) || model.isSubtypeOf(canonical, type);
|
|
135
|
+
});
|
|
136
|
+
return fits ? undefined : `Column declares type '${claimed}', but the expression yields ${yielded.join(' | ')}`;
|
|
137
|
+
}
|
|
138
|
+
const bare = (name) => (name.startsWith('%') ? name.slice(1) : name);
|
|
139
|
+
/** A pre-compiled var's source text; a pre-bound TypedValue[] has nothing to analyze. */
|
|
140
|
+
function sourceOf(value) {
|
|
141
|
+
if (Array.isArray(value)) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const source = value.source;
|
|
145
|
+
return typeof source === 'string' ? source : undefined;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=analyze-dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-dto.js","sourceRoot":"","sources":["../../src/analyzer/analyze-dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAkC,aAAa,EAAE,MAAM,eAAe,CAAA;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EACL,yBAAyB,GAK1B,MAAM,cAAc,CAAA;AA0BrB;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,OAAsC;IACvD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;IAC3C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,MAAM,CAAA;IACf,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAA;IACjD,OAAO;QACL,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;QACrC,GAAG,MAAM;QACT,SAAS,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE;QAChD,SAAS,EAAE,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE;KACzD,CAAA;AACH,CAAC;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AK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;AACxD,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import '../functions/install.ts';
|
|
2
|
+
import { type SourceSpan } from '../errors.ts';
|
|
3
|
+
import type { ModelProvider } from '../model/provider.ts';
|
|
4
|
+
import { type CustomFunctionSignature } from './signatures.ts';
|
|
5
|
+
export interface AnalyzerDiagnostic {
|
|
6
|
+
severity: 'error' | 'warning';
|
|
7
|
+
/** Unresolved element, function, or variable name, when the diagnostic has one. */
|
|
8
|
+
name?: string;
|
|
9
|
+
/** Stable rule identifier, e.g. `unknown-element` or `singleton-required`. */
|
|
10
|
+
code: string;
|
|
11
|
+
message: string;
|
|
12
|
+
span: SourceSpan;
|
|
13
|
+
}
|
|
14
|
+
/** A host variable known to the analyzer. Omit its types to keep the value unknown. */
|
|
15
|
+
export interface DeclaredVariable {
|
|
16
|
+
/** Candidate type names ('Patient', 'System.String'); omit to leave the type unknown. */
|
|
17
|
+
types?: string[];
|
|
18
|
+
/** True when the variable always holds at most one item. */
|
|
19
|
+
single?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** A host function declaration. Arity resolves the call; an optional signature checks it. */
|
|
22
|
+
export type SingleDeclaredFunction = {
|
|
23
|
+
minArity?: number;
|
|
24
|
+
maxArity?: number;
|
|
25
|
+
expression?: never;
|
|
26
|
+
signature?: CustomFunctionSignature;
|
|
27
|
+
} | {
|
|
28
|
+
/** The body of an expression-defined CustomFunction; its presence pins the arity to 0. */
|
|
29
|
+
expression: unknown;
|
|
30
|
+
minArity?: never;
|
|
31
|
+
maxArity?: never;
|
|
32
|
+
signature?: CustomFunctionSignature;
|
|
33
|
+
};
|
|
34
|
+
/** Same-name functions selected by the call focus. Unknown focus keeps only their shared claims. */
|
|
35
|
+
export interface OverloadedDeclaredFunction {
|
|
36
|
+
overloads: readonly SingleDeclaredFunction[];
|
|
37
|
+
expression?: never;
|
|
38
|
+
minArity?: never;
|
|
39
|
+
maxArity?: never;
|
|
40
|
+
signature?: never;
|
|
41
|
+
}
|
|
42
|
+
export type DeclaredFunction = SingleDeclaredFunction | OverloadedDeclaredFunction;
|
|
43
|
+
export interface AnalyzeOptions {
|
|
44
|
+
model?: ModelProvider;
|
|
45
|
+
/** Canonical type of the input the expression will run against, e.g. `FHIR.Patient` or `Patient`. */
|
|
46
|
+
inputType?: string;
|
|
47
|
+
/** Host-supplied functions by name — EvaluateOptions.functions can be passed as-is. */
|
|
48
|
+
functions?: Record<string, DeclaredFunction>;
|
|
49
|
+
/** Host-supplied environment variables by name (with or without the leading `%`). */
|
|
50
|
+
variables?: Record<string, DeclaredVariable>;
|
|
51
|
+
}
|
|
52
|
+
export interface AnalysisDetails {
|
|
53
|
+
diagnostics: AnalyzerDiagnostic[];
|
|
54
|
+
/**
|
|
55
|
+
* The expression's inferred result: canonical type names and cardinality, the
|
|
56
|
+
* same StaticState the checks run on. `types: undefined` means the analyzer
|
|
57
|
+
* cannot see through the expression (an unknown region), and `single`
|
|
58
|
+
* undefined means the cardinality is unknown — neither is an error. Lets a
|
|
59
|
+
* caller cross-check a declared type against what the expression really
|
|
60
|
+
* yields (see `analyzeDto`).
|
|
61
|
+
*/
|
|
62
|
+
result: {
|
|
63
|
+
types: string[] | undefined;
|
|
64
|
+
single: boolean | undefined;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* `Type.element` paths the expression reads (local type names), deduped in
|
|
68
|
+
* first-visit order — HAPI's `elementDependencies`. Lets callers know which
|
|
69
|
+
* elements an expression depends on, e.g. for change tracking or editors.
|
|
70
|
+
*/
|
|
71
|
+
elementDependencies: string[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Statically check one expression against the model: spec §11's strict-mode rules
|
|
75
|
+
* (singleton misuse, wrong operand and argument types, incomparable equality)
|
|
76
|
+
* plus unknown elements, functions, arities, type names, and variables.
|
|
77
|
+
* See: https://hl7.org/fhirpath/en/index.html#type-safety-and-strict-evaluation
|
|
78
|
+
*/
|
|
79
|
+
export declare function analyzeExpression(expression: string, options?: AnalyzeOptions): AnalyzerDiagnostic[];
|
|
80
|
+
/**
|
|
81
|
+
* Analyzes one source site with only facts visible in that file. A declared root
|
|
82
|
+
* does not prove which variables the later call provides. DTO sites may also
|
|
83
|
+
* receive variables and functions from base classes, other modules, or
|
|
84
|
+
* `project()`. Such sites omit unknown-variable diagnostics and report an
|
|
85
|
+
* unknown function only when it resembles a local column. A DTO without a known
|
|
86
|
+
* root receives syntax checks only. Use `analyzeDto` when the class and engine
|
|
87
|
+
* are loaded.
|
|
88
|
+
*/
|
|
89
|
+
export declare function analyzeSite(site: {
|
|
90
|
+
expression: string;
|
|
91
|
+
inputType?: string;
|
|
92
|
+
dto?: true;
|
|
93
|
+
/** Functions the site's file declares — a DTO's `@column` fields (see `columnFunctionDeclaration`). */
|
|
94
|
+
functions?: Readonly<Record<string, DeclaredFunction>>;
|
|
95
|
+
}, options?: AnalyzeOptions): AnalyzerDiagnostic[];
|
|
96
|
+
/** `analyzeExpression` plus the element paths the expression touches and its inferred result type. */
|
|
97
|
+
export declare function analyzeExpressionDetailed(expression: string, options?: AnalyzeOptions): AnalysisDetails;
|
|
98
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/analyzer/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAGhC,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAEnE,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAMtE,OAAO,EACL,KAAK,uBAAuB,EAO7B,MAAM,iBAAiB,CAAA;AAExB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8EAA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