UNPKG

fume-fhir-converter

Version:

FHIR-Utilized Mapping Engine - Community

95 lines 2.93 kB
import type { RequestHandler } from 'express'; import express from 'express'; import { IAppCacheKeys } from './helpers/cache'; import * as conformance from './helpers/conformance'; import type { IAppBinding, ICacheClass, IConfig, IFhirClient, IFumeServer, ILogger } from './types'; export declare class FumeServer<ConfigType extends IConfig> implements IFumeServer<ConfigType> { private readonly app; private server?; /** * FHIR client instance * Used to communicate with FHIR server * Can be overriden by calling */ private fhirClient?; /** * Cache configuration * Allows to register custom cache classes and options */ private cacheConfig; private logger; private appMiddleware; constructor(); shutDown(): Promise<void>; /** * Start the server * Any extensions to the server should be done before calling this method * i.e. registering alternative logger, cache class, fhir client and express routes. * @param serverOptions */ warmUp(serverOptions?: ConfigType | undefined): Promise<void>; /** * @returns express application */ getExpressApp(): express.Application; /** * Register application level middleware to intercept all requests * @param middleware */ registerAppMiddleware(middleware: RequestHandler): void; /** * Register a logger to replace the default logger * @param logger */ registerLogger(logger: ILogger): void; /** * Register a class to replace the default cache class * Cache itself is initialized during warm up * @param CacheClass * @param options */ registerCacheClass(CacheClass: ICacheClass, cacheClassOptions: Record<string, IAppBinding>, applyToCaches: IAppCacheKeys[]): void; /** * Pass a FHIR client instance to be used by the server * @param fhirClient */ registerFhirClient(fhirClient: IFhirClient): void; /** * @returns fhir client */ getFhirClient(): IFhirClient; /** * * @returns cache */ getCache(): import("./helpers/cache").IAppCache; /** * * @returns config */ getConfig(): ConfigType; /** * Register additional bindings for `transform` function * @param key * @param binding */ registerBinding(key: string, binding: IAppBinding): void; /** * * @returns fhir package index */ getFhirPackageIndex(): conformance.IFhirPackageIndex; /** * * @returns fhir packages for the version set in config */ getFhirPackages(): any; /** * Calls transform with any additional bindings passed using `registerBinding` * @param input * @param expression * @returns */ transform(input: any, expression: string, bindings?: Record<string, IAppBinding>): Promise<any>; } //# sourceMappingURL=server.d.ts.map