Skip to content

Commit

Permalink
Merge branch 'bugfix/LF-2769/typescript-update' into 'master'
Browse files Browse the repository at this point in the history
Changed TypeScript definitions

See merge request lfor/fhirpath.js!16
  • Loading branch information
yuriy-sedinkin committed Jun 4, 2024
2 parents 5d3e04f + 6753ec7 commit 374a37b
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 100 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
This log documents significant changes for each release. This project follows
[Semantic Versioning](http://semver.org/).

## [3.13.3] - 2024-05-24
### Changed
- Added separate TypeScript type definition files for the main file and each
supported model.

## [3.13.2] - 2024-05-15
### Fixed
- an issue with evaluating an expression for a resource passed through an
Expand Down
8 changes: 8 additions & 0 deletions fhir-context/dstu2/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Model } from "../../src/fhirpath";

export const {
choiceTypePaths,
pathsDefinedElsewhere,
type2Parent,
path2Type
}: Model;
8 changes: 8 additions & 0 deletions fhir-context/r4/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Model } from "../../src/fhirpath";

export const {
choiceTypePaths,
pathsDefinedElsewhere,
type2Parent,
path2Type
}: Model;
8 changes: 8 additions & 0 deletions fhir-context/r5/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Model } from "../../src/fhirpath";

export const {
choiceTypePaths,
pathsDefinedElsewhere,
type2Parent,
path2Type
}: Model;
8 changes: 8 additions & 0 deletions fhir-context/stu3/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Model } from "../../src/fhirpath";

export const {
choiceTypePaths,
pathsDefinedElsewhere,
type2Parent,
path2Type
}: Model;
97 changes: 0 additions & 97 deletions index.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "fhirpath",
"version": "3.13.2",
"version": "3.13.3",
"description": "A FHIRPath engine",
"main": "src/fhirpath.js",
"types": "src/fhirpath.d.ts",
"dependencies": {
"@lhncbc/ucum-lhc": "^5.0.0",
"antlr4": "~4.9.3",
Expand Down
64 changes: 64 additions & 0 deletions src/fhirpath.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
export function compile(
path: string | Path,
model?: Model,
options?: {
resolveInternalTypes?: boolean
traceFn?: (value: any, label: string) => void,
userInvocationTable?: UserInvocationTable
}
): Compile;

export function evaluate(
fhirData: any,
path: string | Path,
context?: Context,
model?: Model,
options?: {
resolveInternalTypes?: boolean,
traceFn?: (value: any, label: string) => void
userInvocationTable?: UserInvocationTable
}
): any[];

export function resolveInternalTypes(value: any): any;

export function types(value: any): string[];

export function parse(expression: string): any;

export const version :string;

interface Path {
base: string;
expression: string;
}

interface Model {
choiceTypePaths: {
[path: string]: string[];
};
pathsDefinedElsewhere: {
[path: string]: string;
};
type2Parent: {
[path: string]: string;
};
path2Type: {
[path: string]: string;
};
}

type Compile = (resource: any, context?: Context) => any[];

type Context = void | Record<string, any>;

type UserInvocationTable = {
[name: string]: {
fn: Function,
arity: {
[numberOfParams: number]: Array<'Expr' | 'AnyAtRoot' | 'Identifier' | 'TypeSpecifier' | 'Any' | 'Integer' | 'Boolean' | 'Number' | 'String'>
},
nullable?: boolean,
internalStructures?: boolean
}
};

0 comments on commit 374a37b

Please sign in to comment.