UNPKG

@botonic/plugin-contentful

Version:

## What Does This Plugin Do?

49 lines (48 loc) 2.37 kB
import { CMS, Content, ContentId, ContentType, Context, MessageContentType, TopContent } from '../'; import { CmsInfo } from '../cms-info'; import { Button, MessageContent } from '../contents'; export declare function getButtons(content: MessageContent): Button[]; export interface MessageContentTraverserOptions { /** default is 1 */ depth: number; /** true to ignore button references */ ignoreButtons: boolean; /** true to ignore followUp references */ ignoreFollowUps: boolean; } /** * Goes through a content's buttons and followups * TODO add cache */ export declare class MessageContentTraverser { readonly cms: CMS; readonly visitor: (content: MessageContent) => void; options: MessageContentTraverserOptions; /** * It does not take care of circular loops */ constructor(cms: CMS, visitor: (content: MessageContent) => void, options?: Partial<MessageContentTraverserOptions>); traverse(content: MessageContent, context: Context): Promise<void>; traverseButtons(content: MessageContent, context: Context): Promise<void>; traverseFollowUps(content: MessageContent): void; } export declare function reachableFrom(cms: CMS, fromContents: MessageContent[], context: Context, options?: Partial<MessageContentTraverserOptions>): Promise<Set<MessageContent>>; /** * To obtain which contents have references (eg. buttons) to a given * content */ export declare class MessageContentInverseTraverser { readonly cms: CMS; readonly info: CmsInfo; readonly context: Context; readonly options: Partial<MessageContentTraverserOptions>; private readonly referencesTo; constructor(cms: CMS, info: CmsInfo, context: Context, options?: Partial<MessageContentTraverserOptions>); isLoaded(): boolean; messageContentTypes(): Promise<MessageContentType[]>; load(fromContents?: MessageContent[]): Promise<void>; getReferencesTo(contentId: ContentId): Set<MessageContent>; } export declare function allContents<T extends Content>(cms: CMS, context: Context, contentTypes: ContentType[]): Promise<T[]>; export declare function allTopContents(cms: CMS, context: Context, contentTypes?: import("../cms").TopContentType[]): Promise<TopContent[]>; export declare function allMessageContents(cms: CMS, context: Context, contentTypes?: MessageContentType[]): Promise<MessageContent[]>;