fhirpath-ts 0.0.0-bootstrap.0 → 0.2.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.
Files changed (120) hide show
  1. package/README.md +50 -18
  2. package/dist/analyzer/analyze-dto.d.ts +4 -0
  3. package/dist/analyzer/analyze-dto.d.ts.map +1 -1
  4. package/dist/analyzer/analyze-dto.js +12 -14
  5. package/dist/analyzer/analyze-dto.js.map +1 -1
  6. package/dist/analyzer/analyze.d.ts +22 -6
  7. package/dist/analyzer/analyze.d.ts.map +1 -1
  8. package/dist/analyzer/analyze.js +242 -98
  9. package/dist/analyzer/analyze.js.map +1 -1
  10. package/dist/analyzer/declarations.d.ts +26 -0
  11. package/dist/analyzer/declarations.d.ts.map +1 -0
  12. package/dist/analyzer/declarations.js +68 -0
  13. package/dist/analyzer/declarations.js.map +1 -0
  14. package/dist/analyzer/operator-rules.d.ts +127 -0
  15. package/dist/analyzer/operator-rules.d.ts.map +1 -0
  16. package/dist/analyzer/operator-rules.js +70 -0
  17. package/dist/analyzer/operator-rules.js.map +1 -0
  18. package/dist/analyzer/signatures.d.ts +1097 -10
  19. package/dist/analyzer/signatures.d.ts.map +1 -1
  20. package/dist/analyzer/signatures.js +70 -29
  21. package/dist/analyzer/signatures.js.map +1 -1
  22. package/dist/api/compile.d.ts +32 -8
  23. package/dist/api/compile.d.ts.map +1 -1
  24. package/dist/api/compile.js +2 -0
  25. package/dist/api/compile.js.map +1 -1
  26. package/dist/api/engine.d.ts +42 -16
  27. package/dist/api/engine.d.ts.map +1 -1
  28. package/dist/api/engine.js +2 -1
  29. package/dist/api/engine.js.map +1 -1
  30. package/dist/api/project.d.ts +8 -8
  31. package/dist/api/project.d.ts.map +1 -1
  32. package/dist/api/project.js +31 -19
  33. package/dist/api/project.js.map +1 -1
  34. package/dist/api/strict.d.ts +6 -0
  35. package/dist/api/strict.d.ts.map +1 -0
  36. package/dist/api/strict.js +71 -0
  37. package/dist/api/strict.js.map +1 -0
  38. package/dist/api/tagged.d.ts +4 -4
  39. package/dist/api/tagged.d.ts.map +1 -1
  40. package/dist/api/tagged.js.map +1 -1
  41. package/dist/cli/dto-check.js +7 -3
  42. package/dist/cli/dto-check.js.map +1 -1
  43. package/dist/engine/context.d.ts +3 -1
  44. package/dist/engine/context.d.ts.map +1 -1
  45. package/dist/engine/context.js +5 -1
  46. package/dist/engine/context.js.map +1 -1
  47. package/dist/engine/navigation.d.ts.map +1 -1
  48. package/dist/engine/navigation.js +7 -48
  49. package/dist/engine/navigation.js.map +1 -1
  50. package/dist/engine/type-matching.d.ts.map +1 -1
  51. package/dist/engine/type-matching.js +6 -16
  52. package/dist/engine/type-matching.js.map +1 -1
  53. package/dist/index.d.ts +4 -3
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js.map +1 -1
  56. package/dist/parser/parser.d.ts.map +1 -1
  57. package/dist/parser/parser.js +102 -73
  58. package/dist/parser/parser.js.map +1 -1
  59. package/dist/parser/precedence.d.ts +368 -4
  60. package/dist/parser/precedence.d.ts.map +1 -1
  61. package/dist/parser/precedence.js +146 -32
  62. package/dist/parser/precedence.js.map +1 -1
  63. package/dist/r4/generated/type-maps.d.ts +1367 -0
  64. package/dist/r4/generated/type-maps.d.ts.map +1 -1
  65. package/dist/r4/index.d.ts +3 -1
  66. package/dist/r4/index.d.ts.map +1 -1
  67. package/dist/typed/context-maps.d.ts +23 -0
  68. package/dist/typed/context-maps.d.ts.map +1 -0
  69. package/dist/typed/context-maps.js +2 -0
  70. package/dist/typed/context-maps.js.map +1 -0
  71. package/dist/typed/infer.d.ts +99 -229
  72. package/dist/typed/infer.d.ts.map +1 -1
  73. package/dist/typed/infer.js +1 -84
  74. package/dist/typed/infer.js.map +1 -1
  75. package/dist/typed/inference-limits.d.ts +7 -0
  76. package/dist/typed/inference-limits.d.ts.map +1 -0
  77. package/dist/typed/inference-limits.js +6 -0
  78. package/dist/typed/inference-limits.js.map +1 -0
  79. package/dist/typed/metadata-compact.d.ts +189 -0
  80. package/dist/typed/metadata-compact.d.ts.map +1 -0
  81. package/dist/typed/metadata-compact.js +3 -0
  82. package/dist/typed/metadata-compact.js.map +1 -0
  83. package/dist/typed/parser.d.ts +515 -0
  84. package/dist/typed/parser.d.ts.map +1 -0
  85. package/dist/typed/parser.js +2 -0
  86. package/dist/typed/parser.js.map +1 -0
  87. package/dist/values/type-compat.d.ts +8 -0
  88. package/dist/values/type-compat.d.ts.map +1 -1
  89. package/dist/values/type-compat.js +44 -1
  90. package/dist/values/type-compat.js.map +1 -1
  91. package/package.json +20 -1
  92. package/src/analyzer/analyze-dto.ts +21 -17
  93. package/src/analyzer/analyze.ts +335 -109
  94. package/src/analyzer/declarations.ts +120 -0
  95. package/src/analyzer/operator-rules.ts +88 -0
  96. package/src/analyzer/signatures.ts +99 -41
  97. package/src/api/compile.ts +66 -11
  98. package/src/api/engine.ts +97 -33
  99. package/src/api/project.ts +54 -30
  100. package/src/api/strict.ts +112 -0
  101. package/src/api/tagged.ts +5 -5
  102. package/src/cli/dto-check.ts +7 -3
  103. package/src/engine/context.ts +7 -2
  104. package/src/engine/navigation.ts +7 -52
  105. package/src/engine/type-matching.ts +11 -17
  106. package/src/index.ts +25 -2
  107. package/src/parser/parser.ts +106 -74
  108. package/src/parser/precedence.ts +250 -33
  109. package/src/r4/generated/type-maps.ts +1557 -0
  110. package/src/typed/context-maps.ts +41 -0
  111. package/src/typed/infer.ts +157 -425
  112. package/src/typed/inference-limits.ts +9 -0
  113. package/src/typed/metadata-compact.ts +307 -0
  114. package/src/typed/parser.ts +2277 -0
  115. package/src/values/type-compat.ts +48 -1
  116. package/dist/typed/perf-fixture.types.d.ts +0 -136
  117. package/dist/typed/perf-fixture.types.d.ts.map +0 -1
  118. package/dist/typed/perf-fixture.types.js +0 -2
  119. package/dist/typed/perf-fixture.types.js.map +0 -1
  120. package/src/typed/perf-fixture.types.ts +0 -143
@@ -5,5 +5,7 @@ export type { GeneratedElement, GeneratedType } from './model-data.ts';
5
5
  /** The generated R4 model: type resolution, element lookup, and the type hierarchy. */
6
6
  export declare const r4Model: ModelProvider;
7
7
  /** A ready-made engine with the R4 model bound: `r4.evaluate('Patient.name.given', patient)`. */
8
- export declare const r4: FhirPathEngine;
8
+ export declare const r4: FhirPathEngine<{
9
+ readonly model: ModelProvider;
10
+ }>;
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/r4/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAOtE,OAAO,EAAE,wBAAwB,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC1F,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAmCtE,uFAAuF;AACvF,eAAO,MAAM,OAAO,EAAE,aA0DrB,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,EAAE,gBAAyC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/r4/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAOtE,OAAO,EAAE,wBAAwB,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC1F,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAmCtE,uFAAuF;AACvF,eAAO,MAAM,OAAO,EAAE,aA0DrB,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,EAAE;;EAAyC,CAAA"}
@@ -0,0 +1,23 @@
1
+ /** An empty host context that contributes no known keys. */
2
+ export type EmptyContextMap = Record<never, never>;
3
+ /** Preserve host values for best-effort type inference without exposing them as declarations. */
4
+ export type HostValueDeclarations<Values> = Values extends Readonly<Record<PropertyKey, unknown>> ? {
5
+ readonly [Name in keyof Values]: {
6
+ readonly __value: Values[Name];
7
+ };
8
+ } : EmptyContextMap;
9
+ /** Environment names are stored without the optional leading `%`. */
10
+ export type BareContextName<Name extends PropertyKey> = Name extends string ? Name extends `%${infer Bare}` ? Bare : Name : Name;
11
+ /** Normalize both accepted environment-key spellings into one type-level map. */
12
+ export type NormalizeContextMap<Map> = Map extends Readonly<Record<PropertyKey, unknown>> ? {
13
+ readonly [Name in keyof Map as BareContextName<Name>]: Map[Name];
14
+ } : EmptyContextMap;
15
+ /** Merge normalized maps by name, with the overlay taking precedence. */
16
+ export type MergeContextMaps<Base, Overlay> = Omit<NormalizeContextMap<Base>, keyof NormalizeContextMap<Overlay>> & NormalizeContextMap<Overlay>;
17
+ /** Infer undeclared host values while letting explicit declarations replace them. */
18
+ export type InferredHostValueDeclarations<Values, Declarations> = keyof NormalizeContextMap<Values> extends keyof NormalizeContextMap<Declarations> ? NormalizeContextMap<Declarations> : MergeContextMaps<HostValueDeclarations<Values>, Declarations>;
19
+ /** Read an optional context field without distributing undefined into its map. */
20
+ export type ContextProperty<Context, Name extends PropertyKey> = Name extends keyof Context ? Exclude<Context[Name], undefined> : EmptyContextMap;
21
+ /** Look up one normalized name, returning never when it is undeclared. */
22
+ export type LookupContextMap<Map, Name extends string> = Name extends keyof NormalizeContextMap<Map> ? NormalizeContextMap<Map>[Name] : never;
23
+ //# sourceMappingURL=context-maps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-maps.d.ts","sourceRoot":"","sources":["../../src/typed/context-maps.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAElD,iGAAiG;AACjG,MAAM,MAAM,qBAAqB,CAAC,MAAM,IACtC,MAAM,SAAS,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,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,MAAM,MAAM,gBAAgB,CAAC,GAAG,EAAE,IAAI,SAAS,MAAM,IAAI,IAAI,SAAS,MAAM,mBAAmB,CAAC,GAAG,CAAC,GAChG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAC9B,KAAK,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=context-maps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-maps.js","sourceRoot":"","sources":["../../src/typed/context-maps.ts"],"names":[],"mappings":""}
@@ -1,234 +1,104 @@
1
- import type { R4Bases, R4Elements, R4Resources, R4TypeOf } from '../r4/generated/type-maps.ts';
2
- /**
3
- * Type-level inference for common literal expressions: paths, indexes, choice
4
- * stems, selected collection functions, `select`, `ofType`, `as`, fixed-result
5
- * functions, unions, groups, and variable roots. Other expressions return
6
- * `unknown[]`. The runtime and analyzer support the full language.
7
- */
8
- /**
9
- * A type name the bound model knows — a resource or a datatype. What a DTO's
10
- * `fhirType` must be, and what `fhirpath`/`compile` accept as the type an
11
- * expression runs against. Lives here, with the rest of the inference vocabulary,
12
- * so every layer above spells it one way.
13
- */
1
+ import type { R4Resources, R4TypeOf } from '../r4/generated/type-maps.ts';
2
+ import type { BareContextName, ContextProperty, EmptyContextMap, InferredHostValueDeclarations, MergeContextMaps, NormalizeContextMap } from './context-maps.ts';
3
+ import type { InferTypeExpression } from './parser.ts';
4
+ /** A type name known by the generated R4 model. */
14
5
  export type FhirTypeName = keyof R4TypeOf & string;
15
- /** Element lookup by name, walking base types. */
16
- type ElementInfo<T extends string, E extends string> = T extends keyof R4Elements ? E extends keyof R4Elements[T] ? R4Elements[T][E] : T extends keyof R4Bases ? R4Bases[T] extends string ? ElementInfo<R4Bases[T], E> : never : never : never;
17
- /**
18
- * Characters that never appear in an element or variable name: their presence
19
- * in a segment means an operator or literal got glued on (`name and x`,
20
- * `gender=gender`), and the runtime evaluates something entirely different
21
- * from a navigation. Such segments must degrade to 'opaque' — the broad state
22
- * would let a later fixed-return call claim a concrete type for what is
23
- * really a comparison.
24
- */
25
- type GluedName<E extends string> = E extends `${string} ${string}` | `${string}'${string}` | `${string}"${string}` | `${string}=${string}` | `${string}!${string}` | `${string}<${string}` | `${string}>${string}` | `${string}+${string}` | `${string}-${string}` | `${string}*${string}` | `${string}/${string}` | `${string}&${string}` | `${string}~${string}` | `${string},${string}` | `${string}|${string}` | `${string}%${string}` | `${string}$${string}` | `${string}@${string}` | `${string}(${string}` | `${string})${string}` | `${string}[${string}` | `${string}]${string}` | `${string}{${string}` | `${string}}${string}` | `${string}\\${string}` | `${string}\`${string}` ? true : false;
26
- /**
27
- * Navigates one element. A missing normal name widens the state because the
28
- * runtime returns empty and a later fixed-result function still has a known
29
- * type. A segment containing expression syntax becomes `opaque` instead.
30
- */
31
- type Navigate<S extends string, E extends string> = string extends S ? MissedElement<E, S> : ElementInfo<S, E> extends {
32
- t: infer N extends string;
33
- } ? string extends N ? MissedElement<E, string> : N : 'opaque';
34
- /**
35
- * An element lookup that found nothing: glued segments are misparses and go
36
- * 'opaque'; a sane-looking name widens to (or stays) the broad state. Only
37
- * misses pay the GluedName scan — real elements are never glued.
38
- */
39
- type MissedElement<E extends string, Broad extends string> = GluedName<E> extends true ? 'opaque' : Broad;
40
- /**
41
- * Checks that a matched call ends at its final `)`. Quotes are removed before
42
- * balancing parentheses. Backslashes and backticks fall outside this subset.
43
- */
44
- type CleanArg<A extends string> = A extends `${string}\\${string}` | `${string}\`${string}` ? false : Balanced<StripQuoted<A>>;
45
- /** Removes `'…'` spans so parens inside string literals don't disturb Balanced. */
46
- type StripQuoted<A extends string> = A extends `${infer L}'${string}'${infer R}` ? `${L}${StripQuoted<R>}` : A;
47
- /** Every `(` opens before its `)` closes; one nesting level per pair. */
48
- type Balanced<A extends string> = A extends `${infer L}(${infer M})${infer R}` ? L extends `${string})${string}` ? false : M extends `${string}(${string}` ? false : Balanced<R> : A extends `${string})${string}` ? false : true;
49
- /** Push one stack entry per `(` of A (quoted spans already stripped). */
50
- type PushOpens<A extends string, Acc extends unknown[]> = A extends `${string}(${infer R}` ? PushOpens<R, [...Acc, 0]> : Acc;
51
- /** Checks full parenthesis balance after quoted spans have been removed. */
52
- type BalancedDeep<A extends string, Open extends unknown[] = []> = A extends `${infer Head})${infer Rest}` ? PushOpens<Head, Open> extends [unknown, ...infer Remaining] ? BalancedDeep<Rest, Remaining> : false : PushOpens<A, Open> extends [] ? true : false;
53
- /**
54
- * Whether a fragment is a complete sub-expression, so a `|` (or a group's `)`)
55
- * right after it is really at the top level: quotes pair up, and what remains
56
- * after stripping them balances with nothing left open. Backslashes and
57
- * backticks are declined outright, like CleanArg.
58
- */
59
- type CompleteFragment<A extends string> = A extends `${string}\\${string}` | `${string}\`${string}` ? false : StripQuoted<A> extends infer Q extends string ? Q extends `${string}'${string}` ? false : BalancedDeep<Q> : false;
60
- /** Strip the leading/trailing spaces a union split leaves around its terms. */
61
- type Trim<S extends string> = S extends ` ${infer R}` ? Trim<R> : S extends `${infer L} ` ? Trim<L> : S;
62
- /**
63
- * Functions with input-independent result types. A test compares this table
64
- * with analyzer signatures. Functions whose result depends on input stay out.
65
- */
66
- export declare const FIXED_RETURNS: {
67
- readonly exists: "boolean";
68
- readonly empty: "boolean";
69
- readonly not: "boolean";
70
- readonly hasValue: "boolean";
71
- readonly count: "integer";
72
- readonly length: "integer";
73
- readonly toBoolean: "boolean";
74
- readonly convertsToBoolean: "boolean";
75
- readonly convertsToInteger: "boolean";
76
- readonly convertsToDecimal: "boolean";
77
- readonly convertsToString: "boolean";
78
- readonly convertsToDate: "boolean";
79
- readonly convertsToDateTime: "boolean";
80
- readonly convertsToTime: "boolean";
81
- readonly convertsToQuantity: "boolean";
82
- readonly toInteger: "integer";
83
- readonly toDecimal: "decimal";
84
- readonly toString: "string";
85
- readonly toDate: "date";
86
- readonly toDateTime: "dateTime";
87
- readonly toTime: "time";
88
- readonly toQuantity: "Quantity";
89
- readonly toChars: "string";
90
- readonly join: "string";
91
- readonly trim: "string";
92
- readonly upper: "string";
93
- readonly lower: "string";
94
- readonly replace: "string";
95
- readonly replaceMatches: "string";
96
- readonly substring: "string";
97
- readonly encode: "string";
98
- readonly decode: "string";
99
- readonly escape: "string";
100
- readonly unescape: "string";
101
- readonly split: "string";
102
- readonly matches: "boolean";
103
- readonly matchesFull: "boolean";
104
- readonly startsWith: "boolean";
105
- readonly endsWith: "boolean";
106
- readonly contains: "boolean";
107
- readonly subsetOf: "boolean";
108
- readonly supersetOf: "boolean";
109
- readonly isDistinct: "boolean";
110
- readonly allTrue: "boolean";
111
- readonly anyTrue: "boolean";
112
- readonly allFalse: "boolean";
113
- readonly anyFalse: "boolean";
114
- readonly all: "boolean";
115
- readonly indexOf: "integer";
116
- readonly lastIndexOf: "integer";
117
- readonly ceiling: "integer";
118
- readonly floor: "integer";
119
- readonly truncate: "integer";
120
- readonly round: "decimal";
121
- readonly sqrt: "decimal";
122
- readonly exp: "decimal";
123
- readonly ln: "decimal";
124
- readonly log: "decimal";
6
+ export type EmptyFhirpathTypeContext = EmptyContextMap;
7
+ /** A host declaration that the type-level evaluator can use without reading a runtime value. */
8
+ export interface FhirpathTypeDeclaration<Type extends FhirTypeName = FhirTypeName, Collection extends boolean = boolean> {
9
+ /** One candidate type, or every candidate a value may hold. */
10
+ type: Type | readonly Type[];
11
+ /** Omitted means at most one item; true means the value may contain many. */
12
+ collection?: Collection;
13
+ /** Resource targets when `type` includes Reference. */
14
+ targets?: FhirTypeName | readonly FhirTypeName[];
15
+ }
16
+ export type FhirpathTypeDeclarations = Readonly<Record<string, FhirpathTypeDeclaration>>;
17
+ /** The static fields of a native, expression-defined, or overloaded custom function. */
18
+ export type FhirpathFunctionDeclaration = {
19
+ readonly signature?: {
20
+ readonly input?: {
21
+ readonly types?: readonly string[];
22
+ };
23
+ readonly args?: readonly string[];
24
+ readonly result?: {
25
+ readonly types?: readonly string[];
26
+ readonly single?: boolean;
27
+ };
28
+ };
29
+ readonly expression?: string | {
30
+ readonly source: string;
31
+ };
32
+ readonly criteria?: boolean;
33
+ readonly env?: Readonly<Record<string, unknown>>;
34
+ readonly envTypes?: FhirpathTypeDeclarations;
35
+ } | {
36
+ readonly overloads: readonly FhirpathFunctionDeclaration[];
125
37
  };
126
- type FixedReturns = typeof FIXED_RETURNS;
127
- /**
128
- * Functions that yield a subset or reordering of their input, so the input's
129
- * type carries through. Cross-checked against the analyzer the same way as
130
- * FIXED_RETURNS (their signatures preserve the input's types). `abs` is
131
- * excluded deliberately: it preserves the numeric kind at runtime, but the
132
- * analyzer declares its result unknown, and the table must not outrun it.
133
- */
134
- export declare const IDENTITY_RETURNS: readonly ["where", "first", "last", "single", "distinct", "tail", "skip", "take", "exclude", "intersect", "trace"];
135
- type IdentityFn = (typeof IDENTITY_RETURNS)[number];
136
- /** One call segment, dispatched on the function name. */
137
- type Call<S extends string, Fn extends string, Arg extends string> = Fn extends IdentityFn ? S : Fn extends 'ofType' | 'as' ? Arg extends FhirTypeName ? Arg : 'opaque' : Fn extends keyof FixedReturns ? FixedReturns[Fn] : 'opaque';
138
- /** One `.`-separated segment: a call the subset knows, an indexer, or an element. */
139
- type Step<S extends string, Seg extends string> = [S] extends ['opaque'] ? 'opaque' : Seg extends `${infer Fn}(${infer Arg})` ? Fn extends 'select' ? ParseExpr<Arg, S> : CleanArg<Arg> extends true ? Call<S, Fn, Arg> : 'opaque' : Seg extends `${infer N}[${infer I}]` ? I extends `${string}]${string}` | `${string}[${string}` ? 'opaque' : Navigate<S, N> : Navigate<S, Seg>;
140
- /** Walk the remaining `.`-separated segments. */
141
- type ParseSegments<Expr extends string, S extends string> = Expr extends '' ? S : Expr extends `${infer Head}.${infer Rest}` ? Head extends `${string}(` | `${string}(${string}` ? StepAcrossParen<Expr, S> : ParseSegments<Rest, Step<S, Head>> : Step<S, Expr>;
142
- /**
143
- * A segment whose parentheses contain dots (e.g. `select(name.given)`) runs
144
- * to the `)` that completes its argument; the `.` after that starts the next
145
- * segment. Scanned `).` by `).`: a candidate close inside a string literal,
146
- * or with parens still open, is not the close — CompleteFragment decides.
147
- * With no valid `).` split, the whole rest is one segment ending at its
148
- * final `)`.
149
- */
150
- type StepAcrossParen<Expr extends string, S extends string> = ScanSegmentEnd<Expr, '', S>;
151
- type ScanSegmentEnd<Expr extends string, Acc extends string, S extends string> = Expr extends `${infer Head}).${infer Rest}` ? SegmentComplete<`${Acc}${Head}`> extends true ? ParseSegments<Rest, Step<S, `${Acc}${Head})`>> : ScanSegmentEnd<Rest, `${Acc}${Head}).`, S> : WholeParenSegment<`${Acc}${Expr}`, S>;
152
- /** Whether `Body)` is one complete call segment: its argument closes exactly there. */
153
- type SegmentComplete<Body extends string> = `${Body})` extends `${infer _Fn}(${infer Arg})` ? CompleteFragment<Arg> : false;
154
- /** The rest of the expression is a single paren segment ending at its final `)`. */
155
- type WholeParenSegment<Expr extends string, S extends string> = Expr extends `${infer Head})${''}` ? Step<S, `${Head})`> : 'opaque';
156
- /**
157
- * One expression in a context state `S`: a `|`-union of terms, or a single
158
- * term. Plain dotted paths take two cheap checks: one skips the union scanner,
159
- * and the next skips trimming and group or `%var` handling.
160
- */
161
- type ParseExpr<Expr extends string, S extends string> = Expr extends `${string}|${string}` | `(${string}` | `%${string}` ? ParseUnion<Expr, S> : Expr extends `${infer Root}.${infer Rest}` ? Root extends keyof R4Resources & string ? ParseSegments<Rest, Root> : ParseSegments<Expr, S> : Expr extends keyof R4Resources & string ? Expr : ParseSegments<Expr, S>;
162
- /**
163
- * Split off the leftmost top-level `|`. A candidate fragment whose quotes or
164
- * parens are cut mid-way (the `|` sat inside a literal or a group) is not a
165
- * split point: the fragment absorbs the `|` and the scan continues. With no
166
- * top-level `|` at all, the whole expression is one term — its own parse is
167
- * the validation, so this branch needs no separate completeness check.
168
- */
169
- type SplitUnion<Expr extends string, Acc extends string = ''> = Expr extends `${infer L}|${infer R}` ? CompleteFragment<`${Acc}${L}`> extends true ? {
170
- term: `${Acc}${L}`;
171
- rest: R;
172
- } : SplitUnion<R, `${Acc}${L}|`> : {
173
- whole: `${Acc}${Expr}`;
38
+ /** Type information supplied by a host around a literal FHIRPath expression. */
39
+ export interface FhirpathTypeContext {
40
+ env?: FhirpathTypeDeclarations;
41
+ vars?: FhirpathTypeDeclarations;
42
+ /** The same declarations accepted by `EvaluateOptions.functions`. */
43
+ functions?: Readonly<Record<string, FhirpathFunctionDeclaration>>;
44
+ }
45
+ /** The inferred result of evaluating a literal FHIRPath expression. */
46
+ export type FhirpathResult<Expression extends string, Context extends FhirpathTypeContext = EmptyFhirpathTypeContext> = FhirpathResultIn<Expression, 'opaque', Context>;
47
+ /**
48
+ * The inferred result with an explicit FHIR input type. Non-literal,
49
+ * malformed, over-budget, or unsupported expressions safely become
50
+ * `unknown[]`.
51
+ */
52
+ export type FhirpathResultIn<Expression extends string, Input extends string, Context extends FhirpathTypeContext = EmptyFhirpathTypeContext> = FhirpathResultForContext<Expression, Input, Context>;
53
+ /** Internal inference entry point for contexts assembled from generic API options. */
54
+ export type FhirpathResultForContext<Expression extends string, Input extends string, Context extends object = EmptyFhirpathTypeContext> = string extends Expression ? unknown[] : InferTypeExpression<Expression, Input, Context>;
55
+ /** Merge contexts by normalized name. The later context wins, matching per-call runtime options. */
56
+ export type MergeFhirpathTypeContexts<Base extends object, Overlay extends object> = {
57
+ env: MergeContextMaps<ContextProperty<Base, 'env'>, ContextProperty<Overlay, 'env'>>;
58
+ vars: MergeContextMaps<ContextProperty<Base, 'vars'>, ContextProperty<Overlay, 'vars'>>;
59
+ functions: MergeContextMaps<ContextProperty<Base, 'functions'>, ContextProperty<Overlay, 'functions'>>;
174
60
  };
175
- /** Fold the split terms into one union state. */
176
- type ParseUnion<Expr extends string, S extends string> = SplitUnion<Expr> extends {
177
- term: infer T extends string;
178
- rest: infer R extends string;
179
- } ? UnionStates<ParseTerm<Trim<T>, S>, ParseUnion<R, S>> : SplitUnion<Expr> extends {
180
- whole: infer W extends string;
181
- } ? ParseTerm<Trim<W>, S> : 'opaque';
182
- /**
183
- * The union of two term states. If EITHER side failed to parse, the whole
184
- * union is 'opaque' — a known name must never absorb a failed parse. A broad
185
- * member needs no special case: `string` swallows the other names, and
186
- * unknowable-joined-with-anything is unknowable.
187
- */
188
- type UnionStates<A extends string, B extends string> = [A] extends ['opaque'] ? 'opaque' : [B] extends ['opaque'] ? 'opaque' : A | B;
189
- /**
190
- * One union term (or a whole single-term expression): a parenthesized group,
191
- * a `%var` root, a resource-rooted path, or a path relative to the context
192
- * state `S`. The top level passes S = 'opaque', so relative terms degrade
193
- * there; select() passes its input state, so its sub-paths resolve.
194
- */
195
- type ParseTerm<Term extends string, S extends string> = Term extends `(${infer Body}` ? ExtractGroup<Body, '', S> : Term extends `%${infer Var}` ? ParseVarTerm<Var> : Term extends `${infer Root}.${infer Rest}` ? Root extends keyof R4Resources & string ? ParseSegments<Rest, Root> : ParseSegments<Term, S> : Term extends keyof R4Resources & string ? Term : ParseSegments<Term, S>;
196
- /**
197
- * A `%var` root enters the broad state: the variable's value is unknowable
198
- * here, and broad is exactly "unknowable" — plain navigation stays
199
- * `unknown[]`, while a fixed-return call (`%rowIndex.toString()`) keeps its
200
- * input-independent type. The name must look like a name: a glued operator
201
- * (`%a = b`) would make the runtime evaluate a comparison, not a variable.
202
- */
203
- type ParseVarTerm<Var extends string> = Var extends `${infer Name}.${infer Rest}` ? GluedName<Name> extends true ? 'opaque' : ParseSegments<Rest, string> : GluedName<Var> extends true ? 'opaque' : string;
204
- /**
205
- * Find the `)` closing a group's opening paren: scan `)` by `)`, and the
206
- * first one whose interior is a complete fragment closes the group. What
207
- * follows must be nothing or a `.`-chain — anything else (`(A | B) = (C)`)
208
- * is a glued operator.
209
- */
210
- type ExtractGroup<Body extends string, Acc extends string, S extends string> = Body extends `${infer L})${infer R}` ? CompleteFragment<`${Acc}${L}`> extends true ? GroupTail<ParseExpr<`${Acc}${L}`, S>, R> : ExtractGroup<R, `${Acc}${L})`, S> : 'opaque';
211
- /** Continue after a group: `(…)` ends the term, `(…).rest` walks on from the group's state. */
212
- type GroupTail<G extends string, Tail extends string> = Tail extends '' ? G : Tail extends `.${infer Rest}` ? ParseSegments<Rest, G> : 'opaque';
213
- /** The unwrapped result element type for a state; `[…]` keeps unions whole. */
214
- type ResultOf<S extends string> = [S] extends [keyof R4TypeOf] ? R4TypeOf[S][] : unknown[];
215
- /**
216
- * The inferred result of evaluating `Expr` against its root resource.
217
- * `string` (a non-literal expression) and anything outside the subset give
218
- * `unknown[]`. The context is 'opaque': terms must be resource-rooted,
219
- * `%var`-rooted, or parenthesized groups of those — a relative term
220
- * (`id | …`) has no root to resolve against here and degrades.
221
- */
222
- export type FhirpathResult<Expr extends string> = FhirpathResultIn<Expr, 'opaque'>;
223
- /**
224
- * The inferred result of evaluating `Expr` with `Input` as the context type —
225
- * what a DTO's `fhirType` gives its columns, so their paths can stay relative
226
- * (`clinicalStatus.coding.first().code`). A resource-rooted term still resolves
227
- * against its own root, and a type name outside the model degrades like any
228
- * other out-of-subset expression.
229
- */
230
- export type FhirpathResultIn<Expr extends string, Input extends string> = string extends Expr ? unknown[] : ResultOf<ParseExpr<Expr, Input>>;
231
- /** The expected input resource for `Expr` (`Patient.name` wants a Patient). */
232
- export type FhirpathInput<Expr extends string> = string extends Expr ? unknown : Expr extends `${infer Root}.${string}` ? Root extends keyof R4Resources ? R4Resources[Root] : unknown : Expr extends keyof R4Resources ? R4Resources[Expr] : unknown;
61
+ type LiteralVarDeclaration<Value> = Value extends string ? string extends Value ? FhirpathTypeDeclaration : FhirpathTypeDeclaration & {
62
+ readonly __expression: Value;
63
+ } : Value extends {
64
+ readonly source: infer Source extends string;
65
+ } ? string extends Source ? FhirpathTypeDeclaration : FhirpathTypeDeclaration & {
66
+ readonly __expression: Source;
67
+ } : FhirpathTypeDeclaration;
68
+ type LiteralVarDeclarations<Values> = Values extends Readonly<Record<PropertyKey, unknown>> ? {
69
+ readonly [Name in keyof Values]: LiteralVarDeclaration<Values[Name]>;
70
+ } : EmptyFhirpathTypeContext;
71
+ type OptionEnvironmentContext<Options> = Options extends {
72
+ readonly env?: infer Env;
73
+ } ? InferredHostValueDeclarations<Exclude<Env, undefined>, ContextProperty<Options, 'envTypes'>> : NormalizeContextMap<ContextProperty<Options, 'envTypes'>>;
74
+ /** The inference context retained from one literal engine or per-call options object. */
75
+ export type FhirpathTypeContextOf<Options> = {
76
+ env: OptionEnvironmentContext<Options>;
77
+ vars: MergeContextMaps<LiteralVarDeclarations<ContextProperty<Options, 'vars'>>, ContextProperty<Options, 'varTypes'>>;
78
+ functions: NormalizeContextMap<ContextProperty<Options, 'functions'>>;
79
+ };
80
+ type DeclarationElement<Declaration> = Declaration extends {
81
+ readonly type: infer Type;
82
+ } ? Type extends readonly FhirTypeName[] ? R4TypeOf[Type[number]] : Type extends FhirTypeName ? R4TypeOf[Type] : unknown : unknown;
83
+ type DeclaredHostValue<Declaration> = Declaration extends {
84
+ readonly collection: true;
85
+ } ? DeclarationElement<Declaration> | readonly DeclarationElement<Declaration>[] | undefined : DeclarationElement<Declaration> | readonly [] | readonly [DeclarationElement<Declaration>] | undefined;
86
+ type ConstrainedDeclaredValues<Values, Declarations> = Values extends Readonly<Record<PropertyKey, unknown>> ? {
87
+ [Name in keyof Values]: LookupNormalizedDeclaration<Declarations, Name> extends infer Declaration ? [Declaration] extends [never] ? Values[Name] : Values[Name] extends DeclaredHostValue<Declaration> ? Values[Name] : never : Values[Name];
88
+ } : Values;
89
+ type LookupNormalizedDeclaration<Declarations, Name extends PropertyKey> = BareContextName<Name> extends keyof NormalizeContextMap<Declarations> ? NormalizeContextMap<Declarations>[BareContextName<Name>] : never;
90
+ /** Cross-check declarations and values when both remain visible in one literal options object. */
91
+ export type CheckedFhirpathOptionValues<Options> = Options extends {
92
+ readonly env: infer Env;
93
+ readonly envTypes: infer EnvTypes;
94
+ } ? {
95
+ readonly env: ConstrainedDeclaredValues<Env, EnvTypes>;
96
+ } : unknown;
97
+ /** A model root known from a resource-shaped input; ambiguous and structural inputs stay opaque. */
98
+ export type FhirpathRootOf<Input> = Input extends readonly (infer Item)[] ? FhirpathRootOf<Item> : Input extends {
99
+ readonly resourceType: infer Root extends FhirTypeName;
100
+ } ? Root : 'opaque';
101
+ /** The expected input resource for a resource-rooted literal expression. */
102
+ export type FhirpathInput<Expression extends string> = string extends Expression ? unknown : Expression extends `${infer Root}.${string}` ? Root extends keyof R4Resources ? R4Resources[Root] : unknown : Expression extends keyof R4Resources ? R4Resources[Expression] : unknown;
233
103
  export {};
234
104
  //# sourceMappingURL=infer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"infer.d.ts","sourceRoot":"","sources":["../../src/typed/infer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAE9F;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,QAAQ,GAAG,MAAM,CAAA;AAElD,kDAAkD;AAClD,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,UAAU,GAC7E,CAAC,SAAS,MAAM,UAAU,CAAC,CAAC,CAAC,GAC3B,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAChB,CAAC,SAAS,MAAM,OAAO,GACrB,OAAO,CAAC,CAAC,CAAC,SAAS,MAAM,GACvB,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,KAAK,GACP,KAAK,GACT,KAAK,CAAA;AAET;;;;;;;GAOG;AACH,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAChC,GAAG,MAAM,IAAI,MAAM,EAAE,GACrB,GAAG,MAAM,IAAI,MAAM,EAAE,GACrB,GAAG,MAAM,IAAI,MAAM,EAAE,GACrB,GAAG,MAAM,IAAI,MAAM,EAAE,GACrB,GAAG,MAAM,IAAI,MAAM,EAAE,GACrB,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,MAAM,IAAI,IAAI,MAAM,EAAE,GAC1C,IAAI,SAAS,MAAM,WAAW,GAC5B,WAAW,CAAC,IAAI,CAAC,GACjB,OAAO,GACT,UAAU,SAAS,MAAM,WAAW,GAClC,WAAW,CAAC,UAAU,CAAC,GACvB,OAAO,CAAA"}
@@ -1,85 +1,2 @@
1
- /**
2
- * Functions with input-independent result types. A test compares this table
3
- * with analyzer signatures. Functions whose result depends on input stay out.
4
- */
5
- export const FIXED_RETURNS = {
6
- exists: 'boolean',
7
- empty: 'boolean',
8
- not: 'boolean',
9
- hasValue: 'boolean',
10
- count: 'integer',
11
- length: 'integer',
12
- toBoolean: 'boolean',
13
- convertsToBoolean: 'boolean',
14
- convertsToInteger: 'boolean',
15
- convertsToDecimal: 'boolean',
16
- convertsToString: 'boolean',
17
- convertsToDate: 'boolean',
18
- convertsToDateTime: 'boolean',
19
- convertsToTime: 'boolean',
20
- convertsToQuantity: 'boolean',
21
- toInteger: 'integer',
22
- toDecimal: 'decimal',
23
- toString: 'string',
24
- toDate: 'date',
25
- toDateTime: 'dateTime',
26
- toTime: 'time',
27
- toQuantity: 'Quantity',
28
- toChars: 'string',
29
- join: 'string',
30
- trim: 'string',
31
- upper: 'string',
32
- lower: 'string',
33
- replace: 'string',
34
- replaceMatches: 'string',
35
- substring: 'string',
36
- encode: 'string',
37
- decode: 'string',
38
- escape: 'string',
39
- unescape: 'string',
40
- split: 'string',
41
- matches: 'boolean',
42
- matchesFull: 'boolean',
43
- startsWith: 'boolean',
44
- endsWith: 'boolean',
45
- contains: 'boolean',
46
- subsetOf: 'boolean',
47
- supersetOf: 'boolean',
48
- isDistinct: 'boolean',
49
- allTrue: 'boolean',
50
- anyTrue: 'boolean',
51
- allFalse: 'boolean',
52
- anyFalse: 'boolean',
53
- all: 'boolean',
54
- indexOf: 'integer',
55
- lastIndexOf: 'integer',
56
- ceiling: 'integer',
57
- floor: 'integer',
58
- truncate: 'integer',
59
- round: 'decimal',
60
- sqrt: 'decimal',
61
- exp: 'decimal',
62
- ln: 'decimal',
63
- log: 'decimal',
64
- };
65
- /**
66
- * Functions that yield a subset or reordering of their input, so the input's
67
- * type carries through. Cross-checked against the analyzer the same way as
68
- * FIXED_RETURNS (their signatures preserve the input's types). `abs` is
69
- * excluded deliberately: it preserves the numeric kind at runtime, but the
70
- * analyzer declares its result unknown, and the table must not outrun it.
71
- */
72
- export const IDENTITY_RETURNS = [
73
- 'where',
74
- 'first',
75
- 'last',
76
- 'single',
77
- 'distinct',
78
- 'tail',
79
- 'skip',
80
- 'take',
81
- 'exclude',
82
- 'intersect',
83
- 'trace',
84
- ];
1
+ export {};
85
2
  //# sourceMappingURL=infer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"infer.js","sourceRoot":"","sources":["../../src/typed/infer.ts"],"names":[],"mappings":"AA6IA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,SAAS;IACpB,iBAAiB,EAAE,SAAS;IAC5B,iBAAiB,EAAE,SAAS;IAC5B,iBAAiB,EAAE,SAAS;IAC5B,gBAAgB,EAAE,SAAS;IAC3B,cAAc,EAAE,SAAS;IACzB,kBAAkB,EAAE,SAAS;IAC7B,cAAc,EAAE,SAAS;IACzB,kBAAkB,EAAE,SAAS;IAC7B,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,QAAQ;IACjB,cAAc,EAAE,QAAQ;IACxB,SAAS,EAAE,QAAQ;IACnB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,SAAS;IACd,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,SAAS;CACiC,CAAA;AAIjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;IACR,UAAU;IACV,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;IACT,WAAW;IACX,OAAO;CACC,CAAA"}
1
+ {"version":3,"file":"infer.js","sourceRoot":"","sources":["../../src/typed/infer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ /** Maximum tokens the type-level scanner emits for one literal expression. */
2
+ export declare const INFERENCE_TOKEN_LIMIT = 64;
3
+ /** Maximum source characters the type-level scanner visits for one literal expression. */
4
+ export declare const INFERENCE_SOURCE_STEP_LIMIT = 256;
5
+ export type InferenceTokenLimit = typeof INFERENCE_TOKEN_LIMIT;
6
+ export type InferenceSourceStepLimit = typeof INFERENCE_SOURCE_STEP_LIMIT;
7
+ //# sourceMappingURL=inference-limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inference-limits.d.ts","sourceRoot":"","sources":["../../src/typed/inference-limits.ts"],"names":[],"mappings":"AACA,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,KAAK,CAAA;AAEvC,0FAA0F;AAC1F,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAE9C,MAAM,MAAM,mBAAmB,GAAG,OAAO,qBAAqB,CAAA;AAC9D,MAAM,MAAM,wBAAwB,GAAG,OAAO,2BAA2B,CAAA"}
@@ -0,0 +1,6 @@
1
+ /* v8 ignore file -- build-time constants consumed by the type parser and generation scripts */
2
+ /** Maximum tokens the type-level scanner emits for one literal expression. */
3
+ export const INFERENCE_TOKEN_LIMIT = 64;
4
+ /** Maximum source characters the type-level scanner visits for one literal expression. */
5
+ export const INFERENCE_SOURCE_STEP_LIMIT = 256;
6
+ //# sourceMappingURL=inference-limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inference-limits.js","sourceRoot":"","sources":["../../src/typed/inference-limits.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,8EAA8E;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAA;AAEvC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA"}