import { Constructable, Schema, Mapper } from './types'; export interface IMorphismRegistry { /** * Register a mapping schema for a Class. * * @param type Class Type to be registered * @param schema Structure-preserving object from a source data towards a target data. * */ register(type: Constructable): Mapper, Target>; register(type: Constructable, schema?: TSchema): Mapper; /** * Transform any input in the specified Class * * @param {Type} type Class Type of the ouput Data * @param {Object} data Input data to transform * */ map(type: Constructable): Mapper; map(type: Constructable, data: Source[]): Target[]; map(type: Constructable, data: Source): Target; /** * Get a specific mapping function for the provided Class * * @param {Type} type Class Type of the ouput Data * */ getMapper(type: Constructable): Mapper; /** * Set a schema for a specific Class Type * * @param {Type} type Class Type of the ouput Data * @param {Schema} schema Class Type of the ouput Data * */ setMapper>(type: Constructable, schema: TSchema): Mapper; /** * Delete a registered schema associated to a Class * * @param type ES6 Class Type of the ouput Data * */ deleteMapper(type: Constructable): any; /** * Check if a schema has already been registered for this type * * @param {*} type */ exists(type: Target): boolean; /** * Get the list of the mapping functions registered * * @param {Type} type Class Type of the ouput Data * */ mappers: Map; } export declare class MorphismRegistry implements IMorphismRegistry { private _registry; /** *Creates an instance of MorphismRegistry. * @param {Map} cache Cache implementation to store the mapping functions. */ constructor(cache?: Map | WeakMap); /** * Register a mapping schema for a Class. * * @param type Class Type to be registered * @param schema Structure-preserving object from a source data towards a target data. * */ register(type: Constructable, schema?: TSchema): Mapper; /** * Transform any input in the specified Class * * @param {Type} type Class Type of the ouput Data * @param {Object} data Input data to transform * */ map(type: any, data?: any): any; /** * Get a specific mapping function for the provided Class * * @param {Type} type Class Type of the ouput Data * */ getMapper(type: Constructable): any; /** * Set a schema for a specific Class Type * * @param {Type} type Class Type of the ouput Data * @param {Schema} schema Class Type of the ouput Data * */ setMapper(type: Constructable, schema: Schema): Mapper, Target>; /** * Delete a registered schema associated to a Class * * @param type ES6 Class Type of the ouput Data * */ deleteMapper(type: any): any; /** * Check if a schema has already been registered for this type * * @param {*} type */ exists(type: any): any; /** * Get the list of the mapping functions registered * * @param {Type} type Class Type of the ouput Data * */ readonly mappers: Map; }