import { ParseConformance } from './parseConformance' ; import { Bundle } from "./model/bundle" ; import { Validator , ValidatorOptions } from './validator' ; import { ConvertToJs } from './convertToJs' ; import { ConvertToXml } from './convertToXml' ; import { FhirPath } from './fhirPath' ; import { SnapshotGenerator } from './snapshotGenerator' ; export enum Versions { STU3 = 'STU3' , R4 = 'R4' } export class Fhir { readonly parser : ParseConformance ; constructor ( parser ? ) { this . parser = parser || new ParseConformance ( true ) ; } param { string } json returns { string } public jsonToXml ( json ) { const obj = JSON . parse ( json ) ; return this . objToXml ( obj ) ; } param { * } obj returns { string } public objToXml ( obj ) { const convertToXML = new ConvertToXml ( this . parser ) ; const xml = convertToXML . convert ( obj ) ; return xml ; } ; param { string } xml returns { * } public xmlToObj ( xml ) { const convertToJs = new ConvertToJs ( this . parser ) ; const obj = convertToJs . convert ( xml ) ; return obj ; } ; param { string } xml returns { string } public xmlToJson ( xml ) { const convertToJs = new ConvertToJs ( this . parser ) ; const json = convertToJs . convertToJSON ( xml ) ; return json ; } ; param { string | * } input param { ValidatorOptions ? } options returns { ValidatorResponse } public validate ( input , options ? ) { const validator = new Validator ( this . parser , options ) ; return validator . validate ( input ) ; } ; param { Resource | Array < Resource > } resource param { string } fhirPathString returns { obj | Array } see FhirPath example example example public evaluate ( resource , fhirPathString ) { const fhirPath = new FhirPath ( resource , this . parser ) ; fhirPath . resolve = this . resolve ; return fhirPath . evaluate ( fhirPathString ) ; } ; param { string } reference returns event public resolve ( reference ) { return ; } param bundle public generateSnapshot ( bundle ) { const snapshotGenerator = new SnapshotGenerator ( this . parser , bundle ) ; snapshotGenerator . generate ( ) ; } }