import { CommonContentClientConfig } from '../../config/CommonContentClientConfig'; /** * @hidden * Function that converts a fragment of content into a hydrated model class. * This function should return nothing if the fragment cannot be hydrated * by this function. */ export type ContentMapperFn = (fragment: any) => any; /** * @hidden * ContentMapper provides functionality to convert simple JSON content into hydrated model classes * with helper functions. If a mapper is not defined for a schema it will remain as plain JSON. */ export declare class ContentMapper { private readonly config; protected mappers: ContentMapperFn[]; constructor(config: CommonContentClientConfig); /** * Registers a custom model / fn to hydrate a specific schema * @param schema JSON schema ID or Regex that matches against the JSON schema ID * @param fn Model Class or Function that can convert the schema */ addSchema(schema: string | RegExp, fn: ContentMapperFn): void; /** * Registers a custom function to hydrate content fragments * @param fn Mapper function */ addCustomMapper(fn: ContentMapperFn): void; /** * Converts the provided content into hydrated model classes * @param content Content to convert */ toMappedContent(content: any): any; /** * Converts a single fragment using the registered mappers * @param fragment Fragment to convert */ protected mapFragment(fragment: any): any; /** * Registers built in mappers */ protected registerBuiltInMappers(): void; /** * Converts _meta inside Content Items into a ContentMeta instance * @param fragment */ protected convertContentMeta(fragment: any): any; /** * Converts content-link into an Content reference class instance * @param fragment */ protected convertContentReference(fragment: any): any; /** * Converts image-link into an Image class instance * @param fragment */ protected convertImage(fragment: any): any; /** * Converts image-link into an Image class instance * @param fragment */ protected convertVideo(fragment: any): any; }