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,134 @@
|
|
|
1
|
+
import '../functions/install.ts';
|
|
2
|
+
import type { FhirTypeName } from '../typed/infer.ts';
|
|
3
|
+
import type { TypedValue } from '../values/typed-value.ts';
|
|
4
|
+
import type { AnyExpression, Compiler, EvaluateOptions } from './compile.ts';
|
|
5
|
+
import type { ColumnOptions, ColumnResult, ProjectionColumn } from './project.ts';
|
|
6
|
+
/** The object forms of ProjectionColumn — what a `@column`/`@criteria` decorator records. */
|
|
7
|
+
export type ColumnSpec = Exclude<ProjectionColumn, string>;
|
|
8
|
+
/**
|
|
9
|
+
* Ties `pick` to the table's row keys: with a table `choices`, `pick` must name
|
|
10
|
+
* a row field; without one, `pick` is rejected outright. Applied as a validation
|
|
11
|
+
* intersection on the options parameter, so a `pick` typo is a compile error at
|
|
12
|
+
* the decorator.
|
|
13
|
+
*/
|
|
14
|
+
type PickConstraint<Options> = Options extends {
|
|
15
|
+
choices: readonly (infer Row extends {
|
|
16
|
+
code: string;
|
|
17
|
+
})[];
|
|
18
|
+
} ? {
|
|
19
|
+
pick?: keyof Row & string;
|
|
20
|
+
} : {
|
|
21
|
+
pick?: never;
|
|
22
|
+
};
|
|
23
|
+
/** TypeScript error data for a DTO field that cannot hold its column result. */
|
|
24
|
+
export interface ColumnTypeMismatch<Declared, Inferred> {
|
|
25
|
+
readonly __brand: 'fhirpath-ts: the declared field type cannot hold what this column yields';
|
|
26
|
+
readonly declared: Declared;
|
|
27
|
+
readonly inferred: Inferred;
|
|
28
|
+
}
|
|
29
|
+
/** Accepts unknown inference; `analyzeDto` checks an explicit column `type`. */
|
|
30
|
+
type Checked<Inferred, Declared> = unknown extends Inferred ? (initial: Declared) => Declared : [Inferred] extends [Declared] ? (initial: Declared) => Declared : ColumnTypeMismatch<Declared, Inferred>;
|
|
31
|
+
/** Every DTO instance carries the type its columns read, which is also their inference root. */
|
|
32
|
+
export interface DtoInstance {
|
|
33
|
+
readonly fhirType: string;
|
|
34
|
+
}
|
|
35
|
+
/** The inference root for a DTO's columns: the `fhirType` of the class they are declared on. */
|
|
36
|
+
type RootOf<This> = This extends {
|
|
37
|
+
readonly fhirType: infer Root extends string;
|
|
38
|
+
} ? Root : 'opaque';
|
|
39
|
+
/** A checked field decorator for a column whose value type is already fixed (a criteria). */
|
|
40
|
+
type ColumnDecorator<Value> = <This extends DtoInstance, Declared>(target: undefined, context: ClassFieldDecoratorContext<This, Declared>) => Checked<Value, Declared>;
|
|
41
|
+
/** A checked field decorator whose column value depends on the root it lands on. */
|
|
42
|
+
type PathDecorator<Column extends {
|
|
43
|
+
path: string;
|
|
44
|
+
}> = <This extends DtoInstance, Declared>(target: undefined, context: ClassFieldDecoratorContext<This, Declared>) => Checked<ColumnResult<Column, RootOf<This>>, Declared>;
|
|
45
|
+
/**
|
|
46
|
+
* Environment values owned by a DTO. Declare them as `static env`, with keys
|
|
47
|
+
* written with or without `%`. They apply only to that DTO's column bodies.
|
|
48
|
+
* Subclasses merge values by key; annotate a base field as `DtoEnv` when a
|
|
49
|
+
* subclass should override only part of the record.
|
|
50
|
+
*/
|
|
51
|
+
export type DtoEnv = Record<string, unknown>;
|
|
52
|
+
/** Base class returned by `defineDto()`, with the FHIR type used for column inference. */
|
|
53
|
+
export type DtoBase<Root extends string> = (new () => {
|
|
54
|
+
readonly fhirType: Root;
|
|
55
|
+
}) & {
|
|
56
|
+
readonly fhirType: Root;
|
|
57
|
+
};
|
|
58
|
+
/** A DTO class: a `defineDto()` base, or any class extending one. */
|
|
59
|
+
export type DtoClass = (new () => DtoInstance) & {
|
|
60
|
+
readonly fhirType: string;
|
|
61
|
+
};
|
|
62
|
+
/** The DTO instance type returned by projection, including getters and methods. */
|
|
63
|
+
export type DtoRow<C extends DtoClass> = InstanceType<C>;
|
|
64
|
+
/** Data a DTO reads in addition to the projected resource. DTO-owned values use `static env`. */
|
|
65
|
+
export interface DtoOptions {
|
|
66
|
+
/** Per-row bindings the columns read (EvaluateOptions.vars semantics; may reference per-call env). */
|
|
67
|
+
vars?: Record<string, AnyExpression | readonly TypedValue[]>;
|
|
68
|
+
/** Environment names supplied by `project()`, declared so DTO checks can resolve them. */
|
|
69
|
+
callerEnv?: readonly string[];
|
|
70
|
+
}
|
|
71
|
+
/** Everything a DTO class was declared with; `project()`, the engine, and `analyzeDto` all read it from here. */
|
|
72
|
+
export interface DtoDefinition {
|
|
73
|
+
readonly fhirType: string;
|
|
74
|
+
/** A decorator always records an object form, so a consumer never has to handle the plain-string column. */
|
|
75
|
+
readonly columns: Readonly<Record<string, ColumnSpec>>;
|
|
76
|
+
/** The `static env` fields down the class chain, merged per name with the most derived winning. */
|
|
77
|
+
readonly env: Record<string, unknown> | undefined;
|
|
78
|
+
readonly vars: Record<string, AnyExpression | readonly TypedValue[]> | undefined;
|
|
79
|
+
/** Env names the projecting call supplies (see DtoOptions.callerEnv). */
|
|
80
|
+
readonly callerEnv: readonly string[] | undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Creates a DTO base for one FHIR resource or datatype. The type becomes the
|
|
84
|
+
* context for relative column paths. Subclasses may add decorated fields,
|
|
85
|
+
* getters, methods, and shared base columns.
|
|
86
|
+
*/
|
|
87
|
+
export declare function defineDto<const Root extends FhirTypeName>(fhirType: Root, options?: DtoOptions): DtoBase<Root>;
|
|
88
|
+
/**
|
|
89
|
+
* Declares one column of a DTO: the expression it reads, relative to the
|
|
90
|
+
* class's `fhirType`, plus the same options a `project()` column takes —
|
|
91
|
+
* `type`, `as`, `choices`/`pick`, `enum`, `default`, `collection`. The field's
|
|
92
|
+
* declared type is checked against what the expression yields, and is the type
|
|
93
|
+
* a projected row holds there.
|
|
94
|
+
*/
|
|
95
|
+
export declare function column<const Expr extends string>(path: Expr): PathDecorator<{
|
|
96
|
+
path: Expr;
|
|
97
|
+
}>;
|
|
98
|
+
export declare function column<const Expr extends string, const Options extends ColumnOptions>(path: Expr, options: Options & PickConstraint<Options>): PathDecorator<{
|
|
99
|
+
path: Expr;
|
|
100
|
+
} & Options>;
|
|
101
|
+
/**
|
|
102
|
+
* Declares a Boolean criteria column. It uses `FhirPathEngine.test()` rules: one
|
|
103
|
+
* Boolean returns itself, empty returns `false`, and several values are an
|
|
104
|
+
* error. A registered criteria function keeps the same behavior.
|
|
105
|
+
*/
|
|
106
|
+
export declare function criteria<const Expr extends string>(expr: Expr): ColumnDecorator<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Whether a value is a DTO class — one `defineDto()` produced, or a subclass of
|
|
109
|
+
* one. Lets tooling pick the DTOs out of a module's exports (see the
|
|
110
|
+
* `fhirpath-check` CLI) without instantiating anything that is not one.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isDtoClass(value: unknown): value is DtoClass;
|
|
113
|
+
/** Collects and caches a DTO's type, columns, environment, variables, and caller environment names. */
|
|
114
|
+
export declare function dtoDefinition(cls: DtoClass): DtoDefinition;
|
|
115
|
+
/**
|
|
116
|
+
* Adds DTO columns to the engine's function table. Each function keeps its DTO
|
|
117
|
+
* input type and environment. Same-name functions become overloads when their
|
|
118
|
+
* input types do not overlap.
|
|
119
|
+
*/
|
|
120
|
+
export declare function withDtos(defaults: EvaluateOptions, dtos: readonly DtoClass[], compile: Compiler): EvaluateOptions;
|
|
121
|
+
/**
|
|
122
|
+
* Checks each resource against the DTO type before projection. Without this
|
|
123
|
+
* check, a wrong resource could produce a typed row filled with defaults.
|
|
124
|
+
* Datatype inputs have no `resourceType` to check.
|
|
125
|
+
*/
|
|
126
|
+
export declare function assertInputMatchesDto(input: unknown, dto: DtoClass): void;
|
|
127
|
+
/**
|
|
128
|
+
* Merges DTO options with call options. DTO environment values win so projected
|
|
129
|
+
* and registered columns read the same value. Call variables win because they
|
|
130
|
+
* may replace a DTO's row binding.
|
|
131
|
+
*/
|
|
132
|
+
export declare function dtoCallOptions(dto: DtoClass, options: EvaluateOptions | undefined): EvaluateOptions | undefined;
|
|
133
|
+
export {};
|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,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,OAAO,SAAS,aAAa,EACnF,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,GACzC,aAAa,CAAC;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG,OAAO,CAAC,CAAA;AAK1C;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;AA+DzF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa,CAuC1D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,GAAG,eAAe,CAiCjH;AA6ED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI,CAUzE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAa/G"}
|
package/dist/api/dto.js
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import "../functions/install.js";
|
|
2
|
+
import { mergeEnvKeys, normalizeEnvKeys } from "../engine/context.js";
|
|
3
|
+
import { FhirPathTypeError } from "../errors.js";
|
|
4
|
+
import { functions as builtinFunctions } from "../functions/registry.js";
|
|
5
|
+
import { canonicalFocusType, typesOverlap } from "../values/type-compat.js";
|
|
6
|
+
import { toSubjects } from "./bundle.js";
|
|
7
|
+
import { columnSignature, criteriaSignature } from "./column-signature.js";
|
|
8
|
+
/** The `fhirType`/`vars` a `defineDto()` base was created with, by that base class. */
|
|
9
|
+
const bases = new WeakMap();
|
|
10
|
+
/**
|
|
11
|
+
* Columns by the class that declared them. A field decorator runs before its
|
|
12
|
+
* class exists, so it records through the initializer it returns, where `this`
|
|
13
|
+
* is the instance being built and `this.constructor` the class — `dtoDefinition`
|
|
14
|
+
* instantiates each DTO once to collect them.
|
|
15
|
+
*/
|
|
16
|
+
const declaredColumns = new WeakMap();
|
|
17
|
+
/** Definitions already collected, keyed by the DTO class. */
|
|
18
|
+
const definitions = new WeakMap();
|
|
19
|
+
/** The DTO class whose field initializers may record columns during definition collection. */
|
|
20
|
+
let collecting;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a DTO base for one FHIR resource or datatype. The type becomes the
|
|
23
|
+
* context for relative column paths. Subclasses may add decorated fields,
|
|
24
|
+
* getters, methods, and shared base columns.
|
|
25
|
+
*/
|
|
26
|
+
export function defineDto(fhirType, options = {}) {
|
|
27
|
+
const base = class {
|
|
28
|
+
/** On the prototype, so it stays out of a projected row's own keys. */
|
|
29
|
+
get fhirType() {
|
|
30
|
+
return fhirType;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
// A readable name for project()/registration errors; a subclass replaces it.
|
|
34
|
+
Object.defineProperty(base, 'name', { value: `${fhirType}Dto` });
|
|
35
|
+
Object.defineProperty(base, 'fhirType', { value: fhirType, enumerable: true });
|
|
36
|
+
bases.set(base, { fhirType, ...options });
|
|
37
|
+
return base;
|
|
38
|
+
}
|
|
39
|
+
/** Records one column against the class being collected, and does nothing at any other time. */
|
|
40
|
+
function recordColumn(instance, name, spec) {
|
|
41
|
+
const cls = instance.constructor;
|
|
42
|
+
if (cls !== collecting) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const own = declaredColumns.get(cls) ?? {};
|
|
46
|
+
own[name] = spec;
|
|
47
|
+
declaredColumns.set(cls, own);
|
|
48
|
+
}
|
|
49
|
+
/** The decorator both `column()` and `criteria()` return: record on construction, leave the field empty. */
|
|
50
|
+
function fieldDecorator(spec) {
|
|
51
|
+
return (_target, context) => {
|
|
52
|
+
if (context.static || context.private) {
|
|
53
|
+
throw new FhirPathTypeError(`Column '${String(context.name)}' must be a public instance field`);
|
|
54
|
+
}
|
|
55
|
+
const name = String(context.name);
|
|
56
|
+
return function () {
|
|
57
|
+
recordColumn(this, name, spec);
|
|
58
|
+
return undefined;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function column(path, options) {
|
|
63
|
+
return fieldDecorator({ path, ...options });
|
|
64
|
+
}
|
|
65
|
+
export function criteria(expr) {
|
|
66
|
+
return fieldDecorator({ test: expr });
|
|
67
|
+
}
|
|
68
|
+
/** A class and the classes it extends, most derived first. */
|
|
69
|
+
function* classChain(cls) {
|
|
70
|
+
for (let current = cls; typeof current === 'function'; current = Object.getPrototypeOf(current)) {
|
|
71
|
+
yield current;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** The `defineDto()` base a class descends from, with the fhirType/vars it fixed. */
|
|
75
|
+
function baseOf(cls) {
|
|
76
|
+
for (const current of classChain(cls)) {
|
|
77
|
+
const base = bases.get(current);
|
|
78
|
+
if (base !== undefined) {
|
|
79
|
+
return base;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Merges each class's own `static env`, from the base to the most derived class.
|
|
86
|
+
* A getter is read once while the definition is collected. An empty result has
|
|
87
|
+
* no environment overlay.
|
|
88
|
+
*/
|
|
89
|
+
function declaredEnv(cls) {
|
|
90
|
+
const declared = [];
|
|
91
|
+
for (const current of classChain(cls)) {
|
|
92
|
+
const own = staticEnv(current);
|
|
93
|
+
if (own !== undefined) {
|
|
94
|
+
declared.unshift(own);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const merged = Object.assign({}, ...declared.map(normalizeEnvKeys));
|
|
98
|
+
return Object.keys(merged).length === 0 ? undefined : merged;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* One class's own `static env`, as a field or a getter, checked for the shape
|
|
102
|
+
* the engine can bind. Names the class that declared it, which is the one to
|
|
103
|
+
* edit even when the projected DTO is several subclasses below.
|
|
104
|
+
*/
|
|
105
|
+
function staticEnv(cls) {
|
|
106
|
+
const declared = Object.getOwnPropertyDescriptor(cls, 'env');
|
|
107
|
+
if (declared === undefined) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const own = declared.get === undefined ? declared.value : declared.get.call(cls);
|
|
111
|
+
if (own === undefined) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
if (typeof own !== 'object' || own === null || Array.isArray(own)) {
|
|
115
|
+
throw new FhirPathTypeError(`DTO ${cls.name} declares a static 'env' that is not a record of variables; ` +
|
|
116
|
+
'write it as { name: value }, the same shape as EvaluateOptions.env');
|
|
117
|
+
}
|
|
118
|
+
return own;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Whether a value is a DTO class — one `defineDto()` produced, or a subclass of
|
|
122
|
+
* one. Lets tooling pick the DTOs out of a module's exports (see the
|
|
123
|
+
* `fhirpath-check` CLI) without instantiating anything that is not one.
|
|
124
|
+
*/
|
|
125
|
+
export function isDtoClass(value) {
|
|
126
|
+
return typeof value === 'function' && baseOf(value) !== undefined;
|
|
127
|
+
}
|
|
128
|
+
/** Collects and caches a DTO's type, columns, environment, variables, and caller environment names. */
|
|
129
|
+
export function dtoDefinition(cls) {
|
|
130
|
+
const cached = definitions.get(cls);
|
|
131
|
+
if (cached !== undefined) {
|
|
132
|
+
return cached;
|
|
133
|
+
}
|
|
134
|
+
const base = baseOf(cls);
|
|
135
|
+
if (base === undefined) {
|
|
136
|
+
throw new FhirPathTypeError(`${cls.name || 'The class'} is not a DTO class; extend defineDto('<fhirType>') to declare one`);
|
|
137
|
+
}
|
|
138
|
+
// A field initializer may collect another DTO. Restore the outer class so its
|
|
139
|
+
// remaining fields are still recorded.
|
|
140
|
+
const outer = collecting;
|
|
141
|
+
collecting = cls;
|
|
142
|
+
try {
|
|
143
|
+
new cls();
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
collecting = outer;
|
|
147
|
+
}
|
|
148
|
+
// Copied, so the definition cannot be reached through the collection map.
|
|
149
|
+
const columns = { ...declaredColumns.get(cls) };
|
|
150
|
+
if (Object.keys(columns).length === 0) {
|
|
151
|
+
throw new FhirPathTypeError(`DTO ${cls.name} declares no columns; add a @column field`);
|
|
152
|
+
}
|
|
153
|
+
/* v8 ignore start -- TypeScript rejects a field that shadows the base's fhirType; this only fires for an untyped host (the demo playground runs transpile-only code) */
|
|
154
|
+
if ('fhirType' in columns) {
|
|
155
|
+
throw new FhirPathTypeError(`DTO ${cls.name} declares a column named 'fhirType', which every row already carries`);
|
|
156
|
+
}
|
|
157
|
+
/* v8 ignore stop */
|
|
158
|
+
const definition = {
|
|
159
|
+
fhirType: base.fhirType,
|
|
160
|
+
columns,
|
|
161
|
+
env: declaredEnv(cls),
|
|
162
|
+
vars: base.vars,
|
|
163
|
+
callerEnv: base.callerEnv,
|
|
164
|
+
};
|
|
165
|
+
definitions.set(cls, definition);
|
|
166
|
+
return definition;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Adds DTO columns to the engine's function table. Each function keeps its DTO
|
|
170
|
+
* input type and environment. Same-name functions become overloads when their
|
|
171
|
+
* input types do not overlap.
|
|
172
|
+
*/
|
|
173
|
+
export function withDtos(defaults, dtos, compile) {
|
|
174
|
+
if (dtos.length === 0) {
|
|
175
|
+
return defaults;
|
|
176
|
+
}
|
|
177
|
+
const { model } = defaults;
|
|
178
|
+
if (model === undefined) {
|
|
179
|
+
// The model selects a column from the call focus and separates same-name columns.
|
|
180
|
+
throw new FhirPathTypeError(`Registering DTOs (${dtos.map(dto => dto.name).join(', ')}) needs a model; ` +
|
|
181
|
+
'a column is written for one type, and without a model the engine cannot check a call against it. ' +
|
|
182
|
+
'Pass model to the engine, or project the DTO without registering it.');
|
|
183
|
+
}
|
|
184
|
+
const functions = { ...defaults.functions };
|
|
185
|
+
for (const dto of dtos) {
|
|
186
|
+
const definition = dtoDefinition(dto);
|
|
187
|
+
for (const [name, spec] of Object.entries(definition.columns)) {
|
|
188
|
+
// Without this, createContext fails later and names the function rather
|
|
189
|
+
// than the field that caused it.
|
|
190
|
+
if (builtinFunctions.has(name)) {
|
|
191
|
+
throw new FhirPathTypeError(`DTO ${dto.name} declares a column named '${name}', which is a built-in function; rename the field`);
|
|
192
|
+
}
|
|
193
|
+
functions[name] = declaredWith(functions[name], columnFunction(spec, compile, definition), model, () => `DTO ${dto.name} redefines the function '${name}'`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return { ...defaults, functions };
|
|
197
|
+
}
|
|
198
|
+
/** Adds a column declaration when its focus type distinguishes it from every existing declaration. */
|
|
199
|
+
function declaredWith(existing, column, model, blamed) {
|
|
200
|
+
if (existing === undefined) {
|
|
201
|
+
return column;
|
|
202
|
+
}
|
|
203
|
+
const declared = 'overloads' in existing ? existing.overloads : [existing];
|
|
204
|
+
for (const other of declared) {
|
|
205
|
+
const reason = indistinguishable(model, other, column);
|
|
206
|
+
if (reason !== undefined) {
|
|
207
|
+
throw new FhirPathTypeError(`${blamed()}: ${reason}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return { overloads: [...declared, column] };
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Explains why focus-only dispatch cannot separate two declarations. Each side
|
|
214
|
+
* must declare input types, and those types must not overlap.
|
|
215
|
+
*/
|
|
216
|
+
function indistinguishable(model, a, b) {
|
|
217
|
+
const wanted = canonicalTypes(model, a.signature?.input?.types);
|
|
218
|
+
const claimed = canonicalTypes(model, b.signature?.input?.types);
|
|
219
|
+
if (wanted === undefined || claimed === undefined) {
|
|
220
|
+
return 'a declaration that names no input type answers every call, so nothing else may share its name';
|
|
221
|
+
}
|
|
222
|
+
const overlap = wanted.flatMap(one => claimed.filter(other => typesOverlap(model, one, other)).map(other => [one, other]));
|
|
223
|
+
const pair = overlap[0];
|
|
224
|
+
if (pair === undefined) {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
// Equal types make the field name ambiguous, even though the type itself is clear.
|
|
228
|
+
return pair[0] === pair[1] ? `both are written for ${pair[0]}` : `a focus can be both ${pair[0]} and ${pair[1]}`;
|
|
229
|
+
}
|
|
230
|
+
/** Declared input types as the model names them, or undefined when the name declares none the model knows. */
|
|
231
|
+
function canonicalTypes(model, types) {
|
|
232
|
+
if (types === undefined) {
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
const canonical = types
|
|
236
|
+
.map(type => canonicalFocusType(model, type))
|
|
237
|
+
.filter((type) => type !== undefined);
|
|
238
|
+
return canonical.length === 0 ? undefined : canonical;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Converts a DTO column into a typed expression function with the DTO's local
|
|
242
|
+
* environment. Criteria functions also carry the criteria Boolean rule. DTO
|
|
243
|
+
* variables remain projection-only because function calls have no row.
|
|
244
|
+
*/
|
|
245
|
+
function columnFunction(spec, compile, dto) {
|
|
246
|
+
const { fhirType, env } = dto;
|
|
247
|
+
if ('test' in spec) {
|
|
248
|
+
return {
|
|
249
|
+
expression: compile(spec.test),
|
|
250
|
+
criteria: true,
|
|
251
|
+
signature: criteriaSignature(fhirType),
|
|
252
|
+
...(env !== undefined && { env }),
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const signature = columnSignature(spec, fhirType);
|
|
256
|
+
return {
|
|
257
|
+
expression: compile(spec.path),
|
|
258
|
+
...(signature !== undefined && { signature }),
|
|
259
|
+
...(env !== undefined && { env }),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Checks each resource against the DTO type before projection. Without this
|
|
264
|
+
* check, a wrong resource could produce a typed row filled with defaults.
|
|
265
|
+
* Datatype inputs have no `resourceType` to check.
|
|
266
|
+
*/
|
|
267
|
+
export function assertInputMatchesDto(input, dto) {
|
|
268
|
+
const { fhirType } = dtoDefinition(dto);
|
|
269
|
+
toSubjects(input).forEach((subject, index) => {
|
|
270
|
+
const resourceType = subject.value?.resourceType;
|
|
271
|
+
if (typeof resourceType === 'string' && resourceType !== fhirType) {
|
|
272
|
+
throw new FhirPathTypeError(`project(): row ${index} is a ${resourceType}, but ${dto.name} declares fhirType '${fhirType}'`);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Merges DTO options with call options. DTO environment values win so projected
|
|
278
|
+
* and registered columns read the same value. Call variables win because they
|
|
279
|
+
* may replace a DTO's row binding.
|
|
280
|
+
*/
|
|
281
|
+
export function dtoCallOptions(dto, options) {
|
|
282
|
+
const { env, vars } = dtoDefinition(dto);
|
|
283
|
+
if (env === undefined && vars === undefined) {
|
|
284
|
+
return options;
|
|
285
|
+
}
|
|
286
|
+
const merged = { ...options };
|
|
287
|
+
if (env !== undefined) {
|
|
288
|
+
merged.env = mergeEnvKeys(options?.env, env);
|
|
289
|
+
}
|
|
290
|
+
if (vars !== undefined) {
|
|
291
|
+
merged.vars = mergeEnvKeys(vars, options?.vars);
|
|
292
|
+
}
|
|
293
|
+
return merged;
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto.js","sourceRoot":"","sources":["../../src/api/dto.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAGxE,OAAO,EAAE,kBAAkB,EAAE,YAA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AuB,QAAQ,GAAG,CAChG,CAAA;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAa,EAAE,OAAoC;IAChF,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;IACxC,IAAI,GAAG,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5C,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,MAAM,MAAM,GAAoB,EAAE,GAAG,OAAO,EAAE,CAAA;IAC9C,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IAC9C,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { R4TypeOf } from '../r4/generated/type-maps.ts';
|
|
2
|
+
import type { FhirpathInput, FhirpathResult } from '../typed/infer.ts';
|
|
3
|
+
import type { TypedValue } from '../values/typed-value.ts';
|
|
4
|
+
import { type BundleLike } from './bundle.ts';
|
|
5
|
+
import { type AnyExpression, CompiledExpression, type EvaluateOptions } from './compile.ts';
|
|
6
|
+
import { type ConstraintCheckResult, type FhirConstraint } from './constraints.ts';
|
|
7
|
+
import { type DtoClass } from './dto.ts';
|
|
8
|
+
import { type Projection, type ProjectionColumns } from './project.ts';
|
|
9
|
+
/**
|
|
10
|
+
* What engine methods accept as input: one resource, an array of resources, or a
|
|
11
|
+
* Bundle — a Bundle behaves as its entry resources unless the expression
|
|
12
|
+
* references `Bundle` in root position (then it addresses the bundle itself).
|
|
13
|
+
* An expression that starts at a bare Bundle element (`entry.count()`, `type`)
|
|
14
|
+
* is ambiguous and throws. Wrap a Bundle in an array (`[bundle]`) to force
|
|
15
|
+
* treating it as one resource.
|
|
16
|
+
*/
|
|
17
|
+
export type EngineInput<Expr extends string = string> = FhirpathInput<Expr> | readonly unknown[] | BundleLike;
|
|
18
|
+
/** Per-call options that declare a result type when inference returns `unknown`. Runtime code ignores `type`. */
|
|
19
|
+
export type TypedEvaluateOptions<T extends keyof R4TypeOf> = EvaluateOptions & {
|
|
20
|
+
type: T;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Records engines created while project modules are imported. Call the returned
|
|
24
|
+
* function to close the session and read its engines. Only one session is active
|
|
25
|
+
* at a time, and closing it releases the recorded engine references.
|
|
26
|
+
*/
|
|
27
|
+
export declare function recordEngines(): () => readonly FhirPathEngine[];
|
|
28
|
+
/**
|
|
29
|
+
* What a `FhirPathEngine` takes at construction: the `EvaluateOptions` it binds
|
|
30
|
+
* as per-call defaults, plus settings that belong to the engine itself.
|
|
31
|
+
*/
|
|
32
|
+
export interface EngineOptions extends EvaluateOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Max number of distinct expression texts this engine keeps parsed, in its own
|
|
35
|
+
* LRU (not shared with other engines or the free `evaluate()`). Defaults to 500;
|
|
36
|
+
* 0 disables reuse. Expressions passed via `compile()` bypass it.
|
|
37
|
+
*
|
|
38
|
+
* Read once, at construction: unlike the `EvaluateOptions` fields, this is not
|
|
39
|
+
* part of `defaults` and a per-call `options` argument cannot change it.
|
|
40
|
+
*/
|
|
41
|
+
cacheSize?: number;
|
|
42
|
+
/**
|
|
43
|
+
* DTOs whose columns become typed FHIRPath functions. Registration requires a
|
|
44
|
+
* model and publishes every column name, but it does not publish DTO `env` or
|
|
45
|
+
* `vars`. Same-name columns are allowed only when their input types do not
|
|
46
|
+
* overlap. See `docs/api.md#registering-dto-columns-as-functions`.
|
|
47
|
+
*/
|
|
48
|
+
resourceDtos?: readonly DtoClass[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A FHIRPath engine with shared model and evaluation defaults. Per-call values
|
|
52
|
+
* replace defaults, while `env`, `vars`, and `functions` merge by name. Keep an
|
|
53
|
+
* engine for reuse because its parse cache is private to that instance.
|
|
54
|
+
*/
|
|
55
|
+
export declare class FhirPathEngine {
|
|
56
|
+
/** The per-call options bound at construction; engine-only settings are not part of them. */
|
|
57
|
+
readonly defaults: EvaluateOptions;
|
|
58
|
+
/**
|
|
59
|
+
* The DTO classes registered at construction (EngineOptions.resourceDtos), in
|
|
60
|
+
* order. Kept so tooling can check them against this engine's own model,
|
|
61
|
+
* functions and env — see `analyzeEngineDtos` in `fhirpath-ts/analyzer`.
|
|
62
|
+
*/
|
|
63
|
+
readonly dtos: readonly DtoClass[];
|
|
64
|
+
private readonly compileCached;
|
|
65
|
+
constructor({ cacheSize, resourceDtos, ...defaults }?: EngineOptions);
|
|
66
|
+
/** Compile (LRU-cached by expression text) and evaluate in one call; typed like `compile().evaluate()`. */
|
|
67
|
+
evaluate<const Expr extends string, T extends keyof R4TypeOf>(expression: Expr | CompiledExpression<Expr>, input: EngineInput<Expr> | undefined, options: TypedEvaluateOptions<T>): R4TypeOf[T][];
|
|
68
|
+
evaluate<const Expr extends string>(expression: Expr | CompiledExpression<Expr>, input?: EngineInput<Expr>, options?: EvaluateOptions): FhirpathResult<Expr>;
|
|
69
|
+
/** Like `evaluate()`, keeping the internal typed representation (types, Decimal, Temporal). */
|
|
70
|
+
evaluateTyped(expression: AnyExpression, input?: unknown, options?: EvaluateOptions): TypedValue[];
|
|
71
|
+
/** Parse once for reuse, with this engine's defaults bound. Does not touch the parse cache. */
|
|
72
|
+
compile<const Expr extends string>(expression: Expr): BoundExpression<Expr>;
|
|
73
|
+
/** The first result, or undefined when the expression comes up empty. */
|
|
74
|
+
first<const Expr extends string, T extends keyof R4TypeOf>(expression: Expr | CompiledExpression<Expr>, input: EngineInput<Expr> | undefined, options: TypedEvaluateOptions<T>): R4TypeOf[T] | undefined;
|
|
75
|
+
first<const Expr extends string>(expression: Expr | CompiledExpression<Expr>, input?: EngineInput<Expr>, options?: EvaluateOptions): FhirpathResult<Expr>[number] | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Boolean criteria evaluation, the semantics FHIR invariants, Subscription
|
|
78
|
+
* criteria, and `enableWhen` share. A single boolean returns itself, a single
|
|
79
|
+
* non-boolean item returns true, and more than one item is an error, which is
|
|
80
|
+
* spec §4.5 singleton evaluation. Empty returns false, which is the criteria
|
|
81
|
+
* convention layered on top of it; see `criteriaBoolean`.
|
|
82
|
+
*/
|
|
83
|
+
test(input: unknown, expression: AnyExpression, options?: EvaluateOptions): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The items (or Bundle entry resources) whose criteria hold, by `test()`
|
|
86
|
+
* semantics. Criteria run against each item directly — not via `test()` — so
|
|
87
|
+
* an item that is itself a Bundle is not unwrapped again.
|
|
88
|
+
*/
|
|
89
|
+
filter<T>(input: readonly T[], expression: AnyExpression, options?: EvaluateOptions): T[];
|
|
90
|
+
filter(input: BundleLike, expression: AnyExpression, options?: EvaluateOptions): unknown[];
|
|
91
|
+
/**
|
|
92
|
+
* Projects each resource into a flat row. Columns return one optional value
|
|
93
|
+
* unless `collection: true` is set. `%rowIndex` and `%rowTotal` are available
|
|
94
|
+
* in every column. All columns compile before any row is read.
|
|
95
|
+
*/
|
|
96
|
+
project<C extends DtoClass>(input: readonly unknown[] | BundleLike, dto: C, options?: EvaluateOptions): InstanceType<C>[];
|
|
97
|
+
project<C extends DtoClass>(input: unknown, dto: C, options?: EvaluateOptions): InstanceType<C>;
|
|
98
|
+
project<const Columns extends ProjectionColumns>(input: readonly unknown[] | BundleLike, columns: Columns, options?: EvaluateOptions): Projection<Columns>[];
|
|
99
|
+
project<const Columns extends ProjectionColumns>(input: unknown, columns: Columns, options?: EvaluateOptions): Projection<Columns>;
|
|
100
|
+
/**
|
|
101
|
+
* Evaluates FHIR constraint expressions. Arrays and Bundles add the resource
|
|
102
|
+
* index to each issue. Expression errors become failed issues. This is not full
|
|
103
|
+
* profile validation.
|
|
104
|
+
*/
|
|
105
|
+
checkConstraints(input: unknown, constraints: readonly FhirConstraint[], options?: EvaluateOptions): ConstraintCheckResult;
|
|
106
|
+
/**
|
|
107
|
+
* Replaces scalar defaults and merges `env`, `vars`, and `functions` by name.
|
|
108
|
+
* Per-call entries win. Environment keys are normalized with or without `%`.
|
|
109
|
+
*/
|
|
110
|
+
private merged;
|
|
111
|
+
/**
|
|
112
|
+
* `vars` expressions and expression-function bodies given as strings parse
|
|
113
|
+
* through this engine's LRU here, once per call at most — so per-row
|
|
114
|
+
* evaluation inside project() never re-parses them.
|
|
115
|
+
*/
|
|
116
|
+
private precompiled;
|
|
117
|
+
/** One entry of `functions`, with any string body parsed — reaching into an overload set for each member. */
|
|
118
|
+
private precompiledFunction;
|
|
119
|
+
private precompiledBody;
|
|
120
|
+
}
|
|
121
|
+
/** A compiled expression carrying an engine's defaults, so `evaluate(input)` needs nothing else. */
|
|
122
|
+
export declare class BoundExpression<Expr extends string = string> {
|
|
123
|
+
readonly expression: CompiledExpression<Expr>;
|
|
124
|
+
private readonly engine;
|
|
125
|
+
constructor(engine: FhirPathEngine, expression: CompiledExpression<Expr>);
|
|
126
|
+
get source(): string;
|
|
127
|
+
evaluate<T extends keyof R4TypeOf>(input: EngineInput<Expr> | undefined, options: TypedEvaluateOptions<T>): R4TypeOf[T][];
|
|
128
|
+
evaluate(input?: EngineInput<Expr>, options?: EvaluateOptions): FhirpathResult<Expr>;
|
|
129
|
+
evaluateTyped(input?: unknown, options?: EvaluateOptions): TypedValue[];
|
|
130
|
+
first<T extends keyof R4TypeOf>(input: EngineInput<Expr> | undefined, options: TypedEvaluateOptions<T>): R4TypeOf[T] | undefined;
|
|
131
|
+
first(input?: EngineInput<Expr>, options?: EvaluateOptions): FhirpathResult<Expr>[number] | undefined;
|
|
132
|
+
test(input: unknown, options?: EvaluateOptions): boolean;
|
|
133
|
+
/** The canonical form of the expression. */
|
|
134
|
+
toString(): string;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/api/engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,KAAK,UAAU,EAAwC,MAAM,aAAa,CAAA;AACnF,OAAO,EACL,KAAK,aAAa,EAClB,kBAAkB,EAIlB,KAAK,eAAe,EAErB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,KAAK,qBAAqB,EAAuB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACvG,OAAO,EAAyC,KAAK,QAAQ,EAA2B,MAAM,UAAU,CAAA;AACxG,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAe,MAAM,cAAc,CAAA;AAEnF;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,SAAS,OAAO,EAAE,GAAG,UAAU,CAAA;AAE7G,iHAAiH;AACjH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,QAAQ,IAAI,eAAe,GAAG;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAA;AAK1F;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,SAAS,cAAc,EAAE,CAS/D;AAMD;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SA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