import type { Saber } from '.'; export interface RedirecrtRouteConfig { fromPath: string; toPath: string; /** Make it a permanent redirect; defaults to temporary */ redirectInBrowser?: boolean; /** * Redirects are generally for redirecting legacy URLs to their new configuration. If you * can’t update your UI for some reason, set `redirectInBrowser` to `true` and Saber will handle * redirecting in the client as well.` */ isPermanent?: boolean; } export interface FileInfo { relative: string; absolute: string; birthtime: Date; mtime: Date; content: string; } export interface Assets { [k: string]: string; } export interface CreatePageOptions { /** Default to `true` when not specified */ normalize?: boolean; file?: FileInfo; } export interface CreatePageInput { type?: 'page' | 'post'; content?: string; /** * We apply different transformers based on the `contentType` * Built-in types are `default`, `markdown`, `vue` * Default to `default` */ contentType?: string; createdAt?: Date | string; updatedAt?: Date | string; /** * Set one of `permalink` and `slug` * When `permalink` is set we ignore `slug` * Otherwise we use `config.permalinks` option with `slug` to generate a permalink */ permalink?: string; slug?: string; assets?: Assets; /** Internal info is automatically removed from your app runtime for security reasons */ internal: { /** A unique ID for this page */ id: string; /** ID of parent page */ parent?: string; /** * Is this page a local file? * If it is you also need to set `absolute` and `relative` */ isFile?: boolean; absolute?: string; relative?: string; /** * Used by Saber internally for file watcher */ saved?: boolean; }; /** You can also provide additonal data */ [k: string]: any; } export interface Page { type: 'page' | 'post'; content: string; contentType: string; createdAt: Date; updatedAt?: Date; permalink: string; slug?: string; internal: { id: string; parent?: string; isFile?: boolean; absolute?: string; relative?: string; /** @private */ saved?: boolean; }; attributes: Page; assets: Assets; [k: string]: any; } export declare class Pages extends Map { api: Saber; redirectRoutes: Map; constructor(api: Saber); normalizePage(_page: CreatePageInput): Page; fileToPage(file: FileInfo): CreatePageInput; createPage(pageInput: CreatePageInput): void; removePage(id: string): void; removeWhere(getCondition: (page: Page) => boolean): void; getPagePublicFields(page: string | Page): Omit; createRedirect(_configs: RedirecrtRouteConfig | RedirecrtRouteConfig[]): void; getMatchedLocalePath(permalink: string): string; }