@atomic-ehr/fhirpath 0.0.1 → 0.0.2-canary.2fee5d9.20250808110507

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 (101) hide show
  1. package/README.md +2 -0
  2. package/dist/index.d.ts +195 -77
  3. package/dist/index.js +2541 -981
  4. package/dist/index.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/analyzer.ts +536 -64
  7. package/src/boxing.ts +124 -0
  8. package/src/errors.ts +246 -0
  9. package/src/index.ts +57 -9
  10. package/src/inspect.ts +307 -174
  11. package/src/interpreter.ts +299 -48
  12. package/src/model-provider.ts +110 -8
  13. package/src/operations/abs-function.ts +19 -10
  14. package/src/operations/aggregate-function.ts +11 -3
  15. package/src/operations/all-function.ts +18 -8
  16. package/src/operations/allFalse-function.ts +9 -6
  17. package/src/operations/allTrue-function.ts +9 -6
  18. package/src/operations/and-operator.ts +20 -11
  19. package/src/operations/anyFalse-function.ts +6 -4
  20. package/src/operations/anyTrue-function.ts +6 -4
  21. package/src/operations/as-operator.ts +1 -0
  22. package/src/operations/ceiling-function.ts +9 -5
  23. package/src/operations/children-function.ts +94 -0
  24. package/src/operations/combine-function.ts +4 -2
  25. package/src/operations/combine-operator.ts +18 -4
  26. package/src/operations/contains-function.ts +20 -8
  27. package/src/operations/contains-operator.ts +14 -6
  28. package/src/operations/count-function.ts +2 -1
  29. package/src/operations/defineVariable-function.ts +5 -3
  30. package/src/operations/descendants-function.ts +62 -0
  31. package/src/operations/distinct-function.ts +16 -4
  32. package/src/operations/div-operator.ts +15 -2
  33. package/src/operations/divide-operator.ts +10 -5
  34. package/src/operations/dot-operator.ts +3 -1
  35. package/src/operations/empty-function.ts +2 -1
  36. package/src/operations/endsWith-function.ts +22 -10
  37. package/src/operations/equal-operator.ts +18 -6
  38. package/src/operations/equivalent-operator.ts +15 -10
  39. package/src/operations/exclude-function.ts +12 -10
  40. package/src/operations/exists-function.ts +14 -7
  41. package/src/operations/first-function.ts +7 -4
  42. package/src/operations/floor-function.ts +9 -5
  43. package/src/operations/greater-operator.ts +9 -4
  44. package/src/operations/greater-or-equal-operator.ts +9 -4
  45. package/src/operations/iif-function.ts +18 -16
  46. package/src/operations/implies-operator.ts +22 -7
  47. package/src/operations/in-operator.ts +17 -7
  48. package/src/operations/index.ts +3 -0
  49. package/src/operations/indexOf-function.ts +22 -10
  50. package/src/operations/intersect-function.ts +17 -20
  51. package/src/operations/is-operator.ts +63 -14
  52. package/src/operations/isDistinct-function.ts +12 -6
  53. package/src/operations/join-function.ts +15 -4
  54. package/src/operations/last-function.ts +7 -4
  55. package/src/operations/length-function.ts +12 -5
  56. package/src/operations/less-operator.ts +9 -4
  57. package/src/operations/less-or-equal-operator.ts +9 -4
  58. package/src/operations/less-than.ts +25 -1
  59. package/src/operations/lower-function.ts +12 -5
  60. package/src/operations/minus-operator.ts +9 -4
  61. package/src/operations/mod-operator.ts +19 -2
  62. package/src/operations/multiply-operator.ts +11 -6
  63. package/src/operations/not-equal-operator.ts +15 -6
  64. package/src/operations/not-equivalent-operator.ts +15 -10
  65. package/src/operations/not-function.ts +12 -4
  66. package/src/operations/ofType-function.ts +135 -0
  67. package/src/operations/or-operator.ts +20 -11
  68. package/src/operations/plus-operator.ts +18 -6
  69. package/src/operations/power-function.ts +21 -9
  70. package/src/operations/replace-function.ts +26 -9
  71. package/src/operations/round-function.ts +23 -8
  72. package/src/operations/select-function.ts +12 -6
  73. package/src/operations/single-function.ts +5 -3
  74. package/src/operations/skip-function.ts +12 -5
  75. package/src/operations/split-function.ts +24 -9
  76. package/src/operations/sqrt-function.ts +9 -5
  77. package/src/operations/startsWith-function.ts +20 -8
  78. package/src/operations/subsetOf-function.ts +14 -11
  79. package/src/operations/substring-function.ts +36 -19
  80. package/src/operations/supersetOf-function.ts +14 -11
  81. package/src/operations/tail-function.ts +3 -1
  82. package/src/operations/take-function.ts +12 -5
  83. package/src/operations/toBoolean-function.ts +18 -11
  84. package/src/operations/toDecimal-function.ts +13 -6
  85. package/src/operations/toInteger-function.ts +13 -6
  86. package/src/operations/toString-function.ts +17 -10
  87. package/src/operations/trace-function.ts +12 -5
  88. package/src/operations/trim-function.ts +11 -4
  89. package/src/operations/truncate-function.ts +9 -5
  90. package/src/operations/unary-minus-operator.ts +22 -12
  91. package/src/operations/unary-plus-operator.ts +1 -0
  92. package/src/operations/union-function.ts +19 -24
  93. package/src/operations/union-operator.ts +1 -0
  94. package/src/operations/upper-function.ts +12 -5
  95. package/src/operations/where-function.ts +15 -8
  96. package/src/operations/xor-operator.ts +8 -3
  97. package/src/parser.ts +391 -8
  98. package/src/quantity-value.ts +4 -8
  99. package/src/registry.ts +3 -3
  100. package/src/types.ts +10 -6
  101. package/src/parser-base.ts +0 -400
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @atomic-ehr/fhirpath
2
2
 
3
+ [![npm version](https://badge.fury.io/js/@atomic-ehr%2Ffhirpath.svg)](https://www.npmjs.com/package/@atomic-ehr/fhirpath)
4
+
3
5
  A TypeScript implementation of FHIRPath, the path-based navigation and extraction language for FHIR (Fast Healthcare Interoperability Resources).
4
6
 
5
7
  ## Installation
package/dist/index.d.ts CHANGED
@@ -1,5 +1,37 @@
1
1
  import { FHIRSchema } from '@atomic-ehr/fhirschema';
2
2
 
3
+ /**
4
+ * Symbol to mark boxed values
5
+ */
6
+ declare const BOXED_SYMBOL: unique symbol;
7
+ /**
8
+ * Extension structure for FHIR primitive elements
9
+ */
10
+ interface Extension {
11
+ url: string;
12
+ [key: string]: any;
13
+ }
14
+ /**
15
+ * Metadata for FHIR primitive elements (e.g., _gender for gender property)
16
+ */
17
+ interface PrimitiveElement {
18
+ id?: string;
19
+ extension?: Extension[];
20
+ }
21
+ /**
22
+ * Boxed FHIRPath value with metadata
23
+ */
24
+ interface FHIRPathValue<T = any> {
25
+ /** The actual value */
26
+ value: T;
27
+ /** Type information from ModelProvider */
28
+ typeInfo?: TypeInfo;
29
+ /** Primitive element extension (for primitives only) */
30
+ primitiveElement?: PrimitiveElement;
31
+ /** Internal marker to identify boxed values */
32
+ [BOXED_SYMBOL]: true;
33
+ }
34
+
3
35
  /**
4
36
  * Simplified FHIRPath Lexer
5
37
  *
@@ -139,6 +171,7 @@ interface ModelProvider<TypeContext = unknown> {
139
171
  getElementType(parentType: TypeInfo<TypeContext>, propertyName: string): TypeInfo<TypeContext> | undefined;
140
172
  ofType(type: TypeInfo<TypeContext>, typeName: TypeName): TypeInfo<TypeContext> | undefined;
141
173
  getElementNames(parentType: TypeInfo<TypeContext>): string[];
174
+ getChildrenType(parentType: TypeInfo<TypeContext>): TypeInfo<TypeContext> | undefined;
142
175
  }
143
176
  interface OperatorSignature {
144
177
  name: string;
@@ -301,9 +334,11 @@ interface RuntimeContext {
301
334
  input: any[];
302
335
  focus: any[];
303
336
  variables: Record<string, any>;
337
+ currentNode?: ASTNode;
338
+ modelProvider?: ModelProvider;
304
339
  }
305
340
  interface EvaluationResult {
306
- value: any[];
341
+ value: FHIRPathValue[];
307
342
  context: RuntimeContext;
308
343
  }
309
344
  declare enum DiagnosticSeverity {
@@ -346,51 +381,8 @@ interface ParseResult {
346
381
  availableCompletions: string[];
347
382
  };
348
383
  }
349
- type OperationEvaluator = (input: any[], context: RuntimeContext, ...args: any[]) => EvaluationResult;
350
- type FunctionEvaluator = (input: any[], context: RuntimeContext, args: ASTNode[], evaluator: (node: ASTNode, input: any[], context: RuntimeContext) => EvaluationResult) => EvaluationResult;
351
-
352
- /**
353
- * Abstract base parser with shared parsing logic
354
- * Subclasses must implement node creation and error handling
355
- */
356
- declare abstract class BaseParser<TNode extends BaseASTNode = BaseASTNode> {
357
- protected lexer: Lexer;
358
- protected tokens: Token[];
359
- protected current: number;
360
- constructor(input: string, lexerOptions?: LexerOptions);
361
- protected abstract createIdentifierNode(name: string, token: Token): TNode;
362
- protected abstract createLiteralNode(value: any, valueType: 'string' | 'number' | 'boolean' | 'date' | 'time' | 'datetime' | 'null', token: Token): TNode;
363
- protected abstract createBinaryNode(token: Token, left: TNode, right: TNode): TNode;
364
- protected abstract createUnaryNode(token: Token, operand: TNode): TNode;
365
- protected abstract createFunctionNode(name: TNode, args: TNode[], startToken: Token): TNode;
366
- protected abstract createVariableNode(name: string, token: Token): TNode;
367
- protected abstract createIndexNode(expression: TNode, index: TNode, startToken: Token): TNode;
368
- protected abstract createMembershipTestNode(expression: TNode, targetType: string, startToken: Token): TNode;
369
- protected abstract createTypeCastNode(expression: TNode, targetType: string, startToken: Token): TNode;
370
- protected abstract createCollectionNode(elements: TNode[], startToken: Token): TNode;
371
- protected abstract createQuantityNode(value: number, unit: string, isCalendarUnit: boolean, startToken: Token, endToken: Token): TNode;
372
- protected abstract handleError(message: string, token?: Token): never | TNode;
373
- protected expression(): TNode;
374
- protected parseExpressionWithPrecedence(minPrecedence: number): TNode;
375
- protected parsePrimary(): TNode;
376
- protected parseInvocation(): TNode;
377
- protected parseArgumentList(): TNode[];
378
- protected parseCollectionElements(): TNode[];
379
- protected parseTypeName(): string;
380
- protected parseStringValue(raw: string): string;
381
- protected parseIdentifierValue(raw: string): string;
382
- protected isFunctionCall(node: TNode): boolean;
383
- protected isBinaryOperatorToken(token: Token): boolean;
384
- protected isKeywordAllowedAsMember(token: Token): boolean;
385
- protected isKeywordAllowedAsIdentifier(token: Token): boolean;
386
- protected peek(): Token;
387
- protected previous(): Token;
388
- protected isAtEnd(): boolean;
389
- protected advance(): Token;
390
- protected check(type: TokenType): boolean;
391
- protected match(...types: TokenType[]): boolean;
392
- protected consume(type: TokenType, message: string): Token;
393
- }
384
+ type OperationEvaluator = (input: FHIRPathValue[], context: RuntimeContext, ...args: any[]) => EvaluationResult;
385
+ type FunctionEvaluator = (input: FHIRPathValue[], context: RuntimeContext, args: ASTNode[], evaluator: (node: ASTNode, input: FHIRPathValue[], context: RuntimeContext) => EvaluationResult) => EvaluationResult;
394
386
 
395
387
  interface ParserOptions {
396
388
  mode?: 'simple' | 'lsp';
@@ -401,7 +393,10 @@ interface ParserOptions {
401
393
  cursorPosition: number;
402
394
  };
403
395
  }
404
- declare class Parser extends BaseParser<ASTNode> {
396
+ declare class Parser {
397
+ protected lexer: Lexer;
398
+ protected tokens: Token[];
399
+ protected current: number;
405
400
  private mode;
406
401
  private options;
407
402
  private errors?;
@@ -419,6 +414,26 @@ declare class Parser extends BaseParser<ASTNode> {
419
414
  parse(): ParseResult;
420
415
  private parseSimple;
421
416
  private parseLSP;
417
+ protected expression(): ASTNode;
418
+ protected parseExpressionWithPrecedence(minPrecedence: number): ASTNode;
419
+ protected parsePrimary(): ASTNode;
420
+ protected parseInvocation(): ASTNode;
421
+ protected parseArgumentList(): ASTNode[];
422
+ protected parseCollectionElements(): ASTNode[];
423
+ protected parseTypeName(): string;
424
+ protected parseStringValue(raw: string): string;
425
+ protected parseIdentifierValue(raw: string): string;
426
+ protected isFunctionCall(node: ASTNode): boolean;
427
+ protected isBinaryOperatorToken(token: Token): boolean;
428
+ protected isKeywordAllowedAsMember(token: Token): boolean;
429
+ protected isKeywordAllowedAsIdentifier(token: Token): boolean;
430
+ protected peek(): Token;
431
+ protected previous(): Token;
432
+ protected isAtEnd(): boolean;
433
+ protected advance(): Token;
434
+ protected check(type: TokenType): boolean;
435
+ protected match(...types: TokenType[]): boolean;
436
+ protected consume(type: TokenType, message: string): Token;
422
437
  protected createIdentifierNode(name: string, token: Token): ASTNode;
423
438
  protected createLiteralNode(value: any, valueType: LiteralNode['valueType'], token: Token): LiteralNode;
424
439
  protected createBinaryNode(token: Token, left: ASTNode, right: ASTNode): BinaryNode;
@@ -473,7 +488,8 @@ declare class Interpreter {
473
488
  private nodeEvaluators;
474
489
  private operationEvaluators;
475
490
  private functionEvaluators;
476
- constructor(registry?: Registry);
491
+ private modelProvider?;
492
+ constructor(registry?: Registry, modelProvider?: ModelProvider<any>);
477
493
  private registerOperationEvaluators;
478
494
  evaluate(node: ASTNode, input?: any[], context?: RuntimeContext): EvaluationResult;
479
495
  private createInitialContext;
@@ -496,14 +512,18 @@ declare class Analyzer {
496
512
  private variables;
497
513
  private modelProvider?;
498
514
  private userVariableTypes;
515
+ private systemVariableTypes;
499
516
  constructor(modelProvider?: ModelProvider);
500
517
  analyze(ast: ASTNode, userVariables?: Record<string, any>, inputType?: TypeInfo): AnalysisResult;
501
518
  private visitNode;
502
519
  private visitBinaryOperator;
503
520
  private visitIdentifier;
504
521
  private visitFunctionCall;
522
+ private visitMembershipTest;
523
+ private visitTypeCast;
505
524
  private validateVariable;
506
- private addDiagnostic;
525
+ private collectDefinedVariables;
526
+ private collectDefinedVariablesWithTypes;
507
527
  private inferType;
508
528
  private inferErrorNodeType;
509
529
  private inferLiteralType;
@@ -567,7 +587,7 @@ declare class FHIRModelProvider implements ModelProvider<FHIRModelContext> {
567
587
  private initialized;
568
588
  private readonly typeMapping;
569
589
  private readonly commonTypes;
570
- constructor(config: FHIRModelProviderConfig);
590
+ constructor(config?: FHIRModelProviderConfig);
571
591
  initialize(): Promise<void>;
572
592
  private buildCanonicalUrl;
573
593
  private loadSchemaAsync;
@@ -581,45 +601,143 @@ declare class FHIRModelProvider implements ModelProvider<FHIRModelContext> {
581
601
  getElementType(parentType: TypeInfo<FHIRModelContext>, propertyName: string): TypeInfo<FHIRModelContext> | undefined;
582
602
  ofType(type: TypeInfo<FHIRModelContext>, typeName: TypeName): TypeInfo<FHIRModelContext> | undefined;
583
603
  getElementNames(parentType: TypeInfo<FHIRModelContext>): string[];
604
+ getChildrenType(parentType: TypeInfo<FHIRModelContext>): TypeInfo<FHIRModelContext> | undefined;
584
605
  loadType(typeName: string): Promise<TypeInfo<FHIRModelContext> | undefined>;
585
606
  }
586
607
 
587
- interface TraceEntry {
588
- name: string;
589
- values: any[];
608
+ interface ASTMetadata {
609
+ complexity: number;
590
610
  depth: number;
591
- timestamp: number;
592
- projection?: any[];
593
- }
594
- interface InspectOptions {
595
- input?: unknown;
596
- variables?: Record<string, unknown>;
597
- maxTraces?: number;
611
+ operationCount: Map<string, number>;
598
612
  }
599
613
  interface InspectResult {
600
- expression: string;
601
- result: any[];
602
- ast: ASTNode;
603
- traces: TraceEntry[];
604
- executionTime: number;
605
- errors?: Array<{
606
- type: string;
607
- message: string;
608
- location?: {
609
- line: number;
610
- column: number;
611
- };
612
- }>;
613
- warnings?: Array<{
614
- code: string;
615
- message: string;
614
+ result: FHIRPathValue[];
615
+ ast: {
616
+ node: ASTNode;
617
+ metadata: ASTMetadata;
618
+ };
619
+ diagnostics: {
620
+ warnings: Diagnostic[];
621
+ hints: Array<{
622
+ message: string;
623
+ suggestion?: string;
624
+ }>;
625
+ };
626
+ performance: {
627
+ parseTime: number;
628
+ analyzeTime: number;
629
+ evalTime: number;
630
+ totalTime: number;
631
+ operationTimings: Map<string, number>;
632
+ };
633
+ traces?: Array<{
634
+ label: string;
635
+ value: FHIRPathValue[];
636
+ timestamp: number;
616
637
  }>;
617
638
  }
639
+ interface InspectOptions {
640
+ input?: any;
641
+ variables?: Record<string, any>;
642
+ includeTraces?: boolean;
643
+ maxDepth?: number;
644
+ }
618
645
  declare function inspect(expression: string, options?: InspectOptions): InspectResult;
619
646
 
647
+ /**
648
+ * Base error class for all FHIRPath errors
649
+ */
650
+ declare class FHIRPathError extends Error {
651
+ code: string;
652
+ location?: Range | undefined;
653
+ constructor(code: string, message: string, location?: Range | undefined);
654
+ }
655
+ /**
656
+ * Error factory with specialized constructors
657
+ */
658
+ declare const Errors: {
659
+ unknownOperator(operator: string, location?: Range): FHIRPathError;
660
+ unknownFunction(name: string, location?: Range): FHIRPathError;
661
+ unknownVariable(name: string, location?: Range): FHIRPathError;
662
+ unknownUserVariable(name: string, location?: Range): FHIRPathError;
663
+ unknownProperty(property: string, type: string, location?: Range): FHIRPathError;
664
+ unknownNodeType(nodeType: string, location?: Range): FHIRPathError;
665
+ noEvaluatorFound(evaluatorType: string, name: string, location?: Range): FHIRPathError;
666
+ variableNotDefined(name: string, location?: Range): FHIRPathError;
667
+ wrongArgumentCount(funcName: string, expected: number, actual: number, location?: Range): FHIRPathError;
668
+ wrongArgumentCountRange(funcName: string, min: number, max: number, actual: number, location?: Range): FHIRPathError;
669
+ singletonRequired(funcName: string, actualCount: number, location?: Range): FHIRPathError;
670
+ stringSingletonRequired(funcName: string, actualCount: number, location?: Range): FHIRPathError;
671
+ emptyNotAllowed(funcName: string, location?: Range): FHIRPathError;
672
+ argumentRequired(funcName: string, argumentName: string, location?: Range): FHIRPathError;
673
+ typeNotAssignable(sourceType: string, targetType: string, location?: Range): FHIRPathError;
674
+ operatorTypeMismatch(operator: string, leftType: string, rightType: string, location?: Range): FHIRPathError;
675
+ argumentTypeMismatch(argIndex: number, funcName: string, expected: string, actual: string, location?: Range): FHIRPathError;
676
+ conversionFailed(value: string, targetType: string, location?: Range): FHIRPathError;
677
+ invalidValueType(expected: string, actual: string, location?: Range): FHIRPathError;
678
+ invalidOperandType(operation: string, type: string, location?: Range): FHIRPathError;
679
+ stringOperationOnNonString(operation: string, location?: Range): FHIRPathError;
680
+ numericOperationOnNonNumeric(operation: string, location?: Range): FHIRPathError;
681
+ booleanOperationOnNonBoolean(operation: string, index: number, actualType: string, location?: Range): FHIRPathError;
682
+ modelProviderRequired(operation: string, location?: Range): FHIRPathError;
683
+ unexpectedToken(token: string, location?: Range): FHIRPathError;
684
+ expectedToken(expected: string, actual: string, location?: Range): FHIRPathError;
685
+ invalidSyntax(details: string, location?: Range): FHIRPathError;
686
+ expectedIdentifier(after: string, actual: string, location?: Range): FHIRPathError;
687
+ expectedTypeName(actual: string, location?: Range): FHIRPathError;
688
+ divisionByZero(location?: Range): FHIRPathError;
689
+ invalidDateTimeFormat(format: string, location?: Range): FHIRPathError;
690
+ incompatibleUnits(unit1: string, unit2: string, location?: Range): FHIRPathError;
691
+ indexOutOfBounds(index: number, size: number, location?: Range): FHIRPathError;
692
+ invalidOperation(details: string, location?: Range): FHIRPathError;
693
+ invalidPrecision(operation: string, location?: Range): FHIRPathError;
694
+ invalidStringOperation(operation: string, paramName: string, location?: Range): FHIRPathError;
695
+ invalidNumericOperation(operation: string, paramName: string, expectedType: string, location?: Range): FHIRPathError;
696
+ };
697
+ declare enum ErrorCodes {
698
+ UNKNOWN_OPERATOR = "FP1001",
699
+ UNKNOWN_FUNCTION = "FP1002",
700
+ UNKNOWN_VARIABLE = "FP1003",
701
+ UNKNOWN_USER_VARIABLE = "FP1004",
702
+ UNKNOWN_PROPERTY = "FP1005",
703
+ UNKNOWN_NODE_TYPE = "FP1006",
704
+ NO_EVALUATOR_FOUND = "FP1007",
705
+ VARIABLE_NOT_DEFINED = "FP1008",
706
+ WRONG_ARGUMENT_COUNT = "FP2001",
707
+ WRONG_ARGUMENT_COUNT_RANGE = "FP2002",
708
+ SINGLETON_REQUIRED = "FP2003",
709
+ EMPTY_NOT_ALLOWED = "FP2004",
710
+ ARGUMENT_REQUIRED = "FP2005",
711
+ TYPE_NOT_ASSIGNABLE = "FP3001",
712
+ OPERATOR_TYPE_MISMATCH = "FP3002",
713
+ ARGUMENT_TYPE_MISMATCH = "FP3003",
714
+ CONVERSION_FAILED = "FP3004",
715
+ INVALID_VALUE_TYPE = "FP3005",
716
+ INVALID_OPERAND_TYPE = "FP3006",
717
+ STRING_OPERATION_ON_NON_STRING = "FP3007",
718
+ NUMERIC_OPERATION_ON_NON_NUMERIC = "FP3008",
719
+ BOOLEAN_OPERATION_ON_NON_BOOLEAN = "FP3009",
720
+ MODEL_PROVIDER_REQUIRED = "FP4001",
721
+ UNEXPECTED_TOKEN = "FP5001",
722
+ EXPECTED_TOKEN = "FP5002",
723
+ INVALID_SYNTAX = "FP5003",
724
+ EXPECTED_IDENTIFIER = "FP5004",
725
+ EXPECTED_TYPE_NAME = "FP5005",
726
+ DIVISION_BY_ZERO = "FP6001",
727
+ INVALID_DATE_TIME_FORMAT = "FP6002",
728
+ INCOMPATIBLE_UNITS = "FP6003",
729
+ INDEX_OUT_OF_BOUNDS = "FP6004",
730
+ INVALID_OPERATION = "FP6005",
731
+ INVALID_PRECISION = "FP6006",
732
+ INVALID_STRING_OPERATION = "FP6007",
733
+ INVALID_NUMERIC_OPERATION = "FP6008"
734
+ }
735
+
620
736
  interface EvaluateOptions {
621
737
  input?: unknown;
622
738
  variables?: Record<string, unknown>;
739
+ modelProvider?: ModelProvider;
740
+ inputType?: TypeInfo;
623
741
  }
624
742
  declare function evaluate(expression: string, options?: EvaluateOptions): any[];
625
743
  declare function analyze(expression: string, options?: {
@@ -629,4 +747,4 @@ declare function analyze(expression: string, options?: {
629
747
  errorRecovery?: boolean;
630
748
  }): AnalysisResult;
631
749
 
632
- export { type ASTNode, type AnalysisResult, Analyzer, type Diagnostic, DiagnosticSeverity, type EvaluateOptions, type FHIRModelContext, FHIRModelProvider, type FHIRModelProviderConfig, type FunctionDefinition, type InspectOptions, type InspectResult, Interpreter, type ModelProvider as ModelTypeProvider, type OperatorDefinition, type ParseResult, Parser, Registry, type TraceEntry, type TypeInfo, type TypeName, analyze, evaluate, inspect, parse, registry };
750
+ export { type ASTMetadata, type ASTNode, type AnalysisResult, Analyzer, type Diagnostic, DiagnosticSeverity, ErrorCodes, Errors, type EvaluateOptions, type FHIRModelContext, FHIRModelProvider, type FHIRModelProviderConfig, FHIRPathError, type FunctionDefinition, type InspectOptions, type InspectResult, Interpreter, type ModelProvider as ModelTypeProvider, type OperatorDefinition, type ParseResult, Parser, Registry, type TypeInfo, type TypeName, analyze, evaluate, inspect, parse, registry };