import { CaaSApi_Body, CaaSApi_CMSImageMap, CaaSApi_Content2Section, CaaSApi_DataEntries, CaaSApi_DataEntry, CaaSApi_Dataset, CaaSApi_GCAPage, CaaSApi_ImageMapArea, CaasApi_Item, CaaSApi_Media, CaaSApi_Media_File, CaaSApi_Media_Picture, CaaSApi_PageRef, CaaSAPI_PermissionGroup, CaaSApi_ProjectProperties, CaaSApi_Section, CaaSApi_SectionReference, CaaSApiMediaPictureResolutions, CustomMapper, DataEntries, DataEntry, Dataset, File, GCAPage, Image, ImageMap, ImageMapArea, MappedCaasItem, NestedPath, Page, PageBody, PageBodyContent, PermissionGroup, ProjectProperties, RemoteProjectConfigurationEntry, RichTextElement, Section } from '../types'; import XMLParser from './XMLParser'; import { Logger } from './Logger'; import { FSXARemoteApi } from './FSXARemoteApi'; export declare enum CaaSMapperErrors { UNKNOWN_BODY_CONTENT = "Unknown BodyContent could not be mapped.", UNKNOWN_FSTYPE = "Unknown fsType could not be mapped" } export declare const DEFAULT_MAX_REFERENCE_DEPTH = 2; export interface ReferencedItemsInfo { [identifier: string]: NestedPath[]; } export interface ResolvedReferencesInfo { [id: string]: MappedCaasItem | CaasApi_Item; } export interface MapResponse { resolvedReferences: ResolvedReferencesInfo; mappedItems: (MappedCaasItem | CaasApi_Item)[]; referenceMap: ReferencedItemsInfo; } export declare class CaaSMapper { logger: Logger; api: FSXARemoteApi; locale: string | undefined; xmlParser: XMLParser; customMapper?: CustomMapper; referenceDepth: number; maxReferenceDepth: number; resolvedReferences: ResolvedReferencesInfo; _referencedItems: ReferencedItemsInfo; _remoteReferences: { [projectId: string]: ReferencedItemsInfo; }; _processedItems: Record; constructor(api: FSXARemoteApi, locale: string | undefined, utils: { customMapper?: CustomMapper; referenceDepth?: number; maxReferenceDepth?: number; }, logger: Logger); addToResolvedReferences(item: MappedCaasItem | CaasApi_Item, remoteProjectId?: string): void; /** * unifies the two different id formats {id}.{locale} and {id} to {id}.{locale} * if remoteProjectConfiguration is passed, prefix with project id to avoid uuid clashes * * @param id uuid, may be of form {id}.{locale} or {id} * @param remoteProjectConfiguration remoteProjectConfig * @returns uuid of form {id}.{locale} or {remoteProjectId}#{id}.{locale} */ unifyId(id: string, remoteProjectConfiguration?: RemoteProjectConfigurationEntry): string; /** * registers a referenced Item to be fetched later. If a remoteProjectId is passed, * the item will be fetched from the remote Project. * @param identifier item identifier * @param path after fetch, items are inserted at all registered paths * @param remoteProjectId optional. If passed, the item will be fetched from the specified project * @returns placeholder string */ registerReferencedItem(identifier: string, path: NestedPath, remoteProjectId?: string, imageMapResolution?: string): string; buildPreviewId(identifier: string, remoteProjectLocale?: string): string; buildMediaUrl(url: string, rev?: number): string; mapDataEntry(entry: CaaSApi_DataEntry, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapLinksInRichTextElements(richTextElements: RichTextElement[], path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; _mapPermissionGroup(group: CaaSAPI_PermissionGroup): PermissionGroup; mapDataEntries(entries: CaaSApi_DataEntries, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapSection(section: CaaSApi_Section | CaaSApi_SectionReference, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise
; mapContent2Section(content2Section: CaaSApi_Content2Section, remoteProjectLocale?: string): Promise
; mapBodyContent(content: CaaSApi_Content2Section | CaaSApi_Section | CaaSApi_SectionReference, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapPageBody(body: CaaSApi_Body, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapPageRef(pageRef: CaaSApi_PageRef, path?: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapProjectProperties(properties: CaaSApi_ProjectProperties, path?: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapImageMapArea(area: CaaSApi_ImageMapArea, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapImageMap(imageMap: CaaSApi_CMSImageMap, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapGCAPage(gcaPage: CaaSApi_GCAPage, path?: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapDataset(dataset: CaaSApi_Dataset, path?: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapMediaPicture(item: CaaSApi_Media_Picture, path?: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapMediaPictureResolutionUrls(resolutions: CaaSApiMediaPictureResolutions, rev?: number): CaaSApiMediaPictureResolutions; mapMediaFile(item: CaaSApi_Media_File, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; mapMedia(item: CaaSApi_Media, path: NestedPath, remoteProjectLocale?: string, remoteProjectId?: string): Promise; private setLocaleFromCaasItem; mapFilterResponse(unmappedItems: (CaasApi_Item | any)[], additionalParams?: Record, filterContext?: unknown, remoteProjectLocale?: string, remoteProjectId?: string): Promise; /** * Calls ResolveReferences for currentProject and each RemoteProject * * @param data * @returns data */ resolveAllReferences(filterContext?: unknown): Promise; /** * This method will create a filter for all referenced items that are registered inside of the referencedItems * and fetch them in a single CaaS-Request. If remoteProjectId is set, referenced Items from the remoteProject are fetched * After a successful fetch all references in the json structure will be replaced with the fetched and mapped item */ resolveReferencesPerProject(remoteProjectId?: string, filterContext?: unknown): Promise; private getRemoteConfigForProject; }