UNPKG

@botonic/plugin-contentful

Version:

Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet

52 lines (51 loc) 2.16 kB
import { CMS, Context, MessageContent, ResourceId, TopContent } from '../cms'; export declare class ContentsValidator { readonly cms: CMS; readonly report: DefaultContentsValidatorReports; readonly onlyValidateReachable: boolean; readonly initialContentIds: string[]; /** * * @param onlyValidateReachable only validate searchable contents (with keywords) or * which are linked from other contents * @param initialContentIds contents to be validated even if they're not * reachable */ constructor(cms: CMS, report?: DefaultContentsValidatorReports, onlyValidateReachable?: boolean, initialContentIds?: string[]); /** * Deliver all TopContent's to validate that they won't fail in production. * A content delivery might fail if: * - It has a link to a deleted content * - There are infinite loops * - There's a bug on the CMS plugin * - An URL has empty URL empty */ validateAllTopContents(context: Context): Promise<void>; private cacheMessageContents; private processException; private getMultiError; protected reachableContents(allContents: MessageContent[], context: Context): Promise<Iterable<MessageContent>>; protected validate(content: TopContent): void; private addInitialContents; } export interface ContentsValidatorReports { deliveryError(resourceId: ResourceId, exception: Error): void; validationError(resourceId: ResourceId, error: string): void; successfulValidation(resourceId: ResourceId): void; } type ResourceError = { resourceId: ResourceId; msg: string; critical: boolean; }; export declare class DefaultContentsValidatorReports implements ContentsValidatorReports { readonly logErrors: boolean; errors: ResourceError[]; successContents: ResourceId[]; constructor(logErrors?: boolean); successfulValidation(resourceId: ResourceId): void; deliveryError(resourceId: ResourceId, exception: Error): void; validationError(resourceId: ResourceId, error: string): void; protected processError(resourceId: ResourceId, msg: string, critical: boolean): void; } export {};