alinea
Version:
Headless git-based CMS
47 lines (46 loc) • 2.13 kB
TypeScript
import type { Preview } from 'alinea/core/Preview';
import type { Auth } from './Auth.js';
import { Root } from './Root.js';
import { Schema } from './Schema.js';
import { Type } from './Type.js';
import { Workspace, type WorkspaceInternal } from './Workspace.js';
/** Configuration options */
export interface Config {
/** A schema describing the types of entries */
schema: Schema;
/** A record containing workspace configurations */
workspaces: Record<string, Workspace>;
/** A url which will be embedded in the dashboard for live previews */
preview?: Preview;
/** Every edit will pass through a draft status before being published */
enableDrafts?: boolean;
/** The interval in seconds at which the frontend will poll for updates */
syncInterval?: number;
/** The base url of the application */
baseUrl?: string | {
development?: string;
production?: string;
};
/** The url of the handler endpoint */
handlerUrl?: string;
/** The folder where public assets are stored, defaults to /public */
publicDir?: string;
/** Filename of the generated dashboard */
dashboardFile?: string;
auth?: Auth.View;
}
export declare namespace Config {
function baseUrl(config: Config, env?: string): string | undefined;
function mainWorkspace(config: Config): WorkspaceInternal;
function type(config: Config, name: string): Type | undefined;
function rootContains(config: Config, root: Root, childType: Type): boolean;
function typeContains(config: Config, parentType: Type, childType: Type): boolean;
function hasAuth(config: Config): boolean;
function multipleWorkspaces(config: Config): boolean;
function contentDir(config: Config): string;
function filePath(config: Config, workspace: string, root: string, locale: string | null, ...rest: Array<string>): string;
function validate(config: Config): void;
function referencedViews(config: Config): Array<string>;
}
/** Create a new config instance */
export declare function createConfig<Definition extends Config>(definition: Definition): Definition;