fhir-package-explorer
Version:
Explore and resolve FHIR conformance resources across package contexts
42 lines (41 loc) • 2.21 kB
TypeScript
import { FhirPackageInstaller, PackageIdentifier } from 'fhir-package-installer';
import { FileIndexEntryWithPkg, LookupFilter } from './types';
/**
* Sorts an array of PackageIdentifier objects by their id and version.
* @param arr - The array of PackageIdentifier objects to sort.
* @returns
*/
export declare const sortPackages: (arr: PackageIdentifier[]) => PackageIdentifier[];
/**
* Normalizes the filter by splitting the version from the URL, id or name - if piped (e.g. `bp|4.0.1`).
* If none of these keys are piped, the filter is returned as is.
* @param filter - The filter to normalize.
* @return - The normalized filter.
*/
export declare const normalizePipedFilter: (filter: LookupFilter) => LookupFilter;
/**
* Checks if the entry matches the filter by comparing each key-value pair.
* If the key is 'package', it is ignored, since package filtering is transitive and handled separately.
* @param entry - The entry to check.
* @param filter - The filter to check against.
* @returns - True if the entry matches the filter (ignoring `package`), false otherwise.
*/
export declare const matchesFilter: (entry: FileIndexEntryWithPkg, filter: LookupFilter) => boolean;
/**
* Default prethrow function does nothing since the regular throw prints to console.log, which is the default logger
*/
export declare const prethrow: (msg: Error | any) => Error;
/**
* When multiple matches are found, this function tries to resolve the duplicates by checking if the results come from different versions of the same package.
* If so, it returns the match from the latest version of the package. Otherwise, it returns an empty array.
* @param matches
* @returns
*/
export declare const tryResolveDuplicates: (matches: FileIndexEntryWithPkg[], filter: LookupFilter, fpi: FhirPackageInstaller) => Promise<FileIndexEntryWithPkg[]>;
export declare const loadJson: (filePath: string) => Promise<any>;
/**
* Takes an entry and returns an array of key combinations used to index the entry for fast lookups.
* @param entry - The entry to get the keys for.
* @returns - An array of keys for the entry.
*/
export declare const getAllFastIndexKeys: (entry: FileIndexEntryWithPkg) => string[];