@becklyn/contentful-adapter
Version:
[](https://github.com/Becklyn-Studios/contentful-adapter/actions/workflows/ci.yml)
18 lines (17 loc) • 1.27 kB
TypeScript
import { ContentfulClientApi } from "contentful";
import { ContentfulComponentConfig, ContentfulAdapterConfig } from "../config/types";
import { PageCache } from "../contentful/cache";
export interface ContentfulNormalizerService {
client: ContentfulClientApi;
locale: string;
pageCache: PageCache;
allUiComponents: ContentfulComponentConfig[];
resolveInternalReferencePath: (data: any) => Promise<string | null>;
getThemeValue: (contentfulValue: string) => string;
getVersionValue: (contentfulValue: string) => string;
registerNormalizerType: (dataType: string, normalizer: DataTypeNormalizer) => void;
getCustomNormalizer: (dataType: string) => DataTypeNormalizer | null;
}
export type DataTypeNormalizer = (data: any, service: ContentfulNormalizerService, parentData?: any) => Promise<any>;
export type InternalReferenceResolver = (data: any, pageCache: PageCache) => Promise<string | null>;
export declare const getContentfulNormalizerService: (config: ContentfulAdapterConfig, locale: string, themeValueMapping?: Record<string, string>, versionValueMapping?: Record<string, string>, referenceResolvers?: Record<string, InternalReferenceResolver>, preview?: boolean, pageContentType?: string) => Promise<ContentfulNormalizerService>;