///
import type { Plugin } from 'esbuild';
import type { JSONIndex, SearchDocument, SearchData, GlobalData, SearchDataWithLocales, PageStaticData } from '../shared/types';
import type { ApiRouteDetails, CustomSsoProviderDetails, PageRouteDetails, RouteDetails } from './plugins/types.js';
import type { ContentProvider } from './content/content-provider';
import type { LicenseInfo } from './plugins/config-parser/license/license-info';
import type { RedoclyConfig, RedirectConfig, SsoConfig } from './config/schema';
import type { MarkdocDeps, MarkdocRawContent } from './plugins/markdown/compiler.js';
export declare const MARKDOC_PARTIALS_DATA_KEY = "markdown/partials";
export type StoreOptions = {
contentDir: string;
outdir: string;
serverOutDir: string;
renderMode?: 'thread_worker' | 'main';
serverMode?: boolean;
};
export interface ComputedRedoclyConfig {
configFilePath: string;
license?: LicenseInfo;
[key: string]: unknown;
}
export declare class Store {
routesBySlug: Map;
contentProvider: ContentProvider | undefined;
routesByFsPath: Map;
apiRoutesBySlug: Map;
routesSharedData: Map>;
sharedDataDeps: Map>;
sharedDataMarkdocComponents: Map>;
routesDynamicComponents: Map>;
ssr: {
preBodyTags: string[];
postBodyTags: string[];
headTags: string[];
};
searchDocuments: Record;
searchIndex: Record;
searchIndexReady: Promise | undefined;
templates: Map;
browserPlugins: Set;
loginUrls: Record;
apiRequestHandlers: Map;
serverPropsGetters: Map;
esbuildPlugins: Plugin[];
listeners: Map>;
globalData: GlobalData;
cliOptions: Record;
private _markdocOptions;
config: RedoclyConfig & ComputedRedoclyConfig;
sso: SsoConfig | undefined;
_contentDir: string;
serverMode: boolean;
serverOutDir: string;
outdir: string;
renderMode: string;
buildRevision: number;
contentRevision: number;
hasSitemap: boolean;
private _resolveSearchIndex;
private _resolveUserCodeReady;
userCodeReady: Promise;
constructor({ outdir, renderMode, contentDir, serverMode, serverOutDir, }: StoreOptions);
on(type: 'routes-updated', cb: () => void): void;
on(type: 'template-updated', cb: () => void): void;
on(type: 'build-updated', cb: () => void): void;
on(type: 'build-started', cb: () => void): void;
on(type: 'shared-data-updated', cb: (id: string, data: unknown) => void): void;
on(type: 'search-data-updated', cb: ({ data, locale }: {
data: SearchData;
locale: string;
}) => void): void;
on(type: 'global-data-updated', cb: (pathname: string, data: Record) => void): void;
runListeners: (type: 'template-updated' | 'global-data-updated' | 'shared-data-updated' | 'search-data-updated' | 'routes-updated' | 'build-updated' | 'build-started', ...args: T) => void;
get contentDir(): string;
get license(): LicenseInfo;
loadEnvConfig(replaceEnv?: boolean): void;
addEsbuildPlugin(plugin: Plugin): void;
markUserCodeReady(): void;
reloadMarkdocOptions(): Promise;
get markdocOptions(): {
partials: any;
themeConfig: {
frontMatterKeysToResolve?: string[] | undefined;
partialsFolders?: string[] | undefined;
lastUpdatedBlock?: {
format?: "timeago" | "iso" | "long" | "short" | undefined;
hide?: boolean | undefined;
locale?: string | undefined;
} | undefined;
toc?: {
hide?: boolean | undefined;
header?: string | undefined;
depth?: number | undefined;
} | undefined;
editPage?: {
hide?: boolean | undefined;
baseUrl?: string | undefined;
} | undefined;
} | undefined;
tags?: any;
nodes?: any;
variables?: Record | undefined;
functions?: Record | undefined;
validation?: {
parents?: import("@markdoc/markdoc").Node[] | undefined;
validateFunctions?: boolean | undefined;
environment?: string | undefined;
} | undefined;
};
setGlobalData: (data: GlobalData) => void;
parseMarkdoc: (contentRecord: MarkdocRawContent, deps?: MarkdocDeps) => {
info: {
sharedDataDeps: Set | undefined;
dynamicMarkdocComponents: string[];
};
ast: import("@markdoc/markdoc").Node;
};
loadOpenApiDefinitions(): Promise;
setSearchDataWithLocales(data: SearchDataWithLocales): void;
setSearchData(data: SearchData, locale?: string): void;
setSearchIndexReady(): void;
setCliOptions(data: Record): void;
setGlobalConfig: (data: Partial) => void;
getConfig: () => RedoclyConfig;
getGlobalConfig: (key: string) => T;
addRedirect(from: string, to: RedirectConfig): void;
createSharedData: (id: string, data: unknown) => Promise;
addRouteSharedData: (routeSlug: string, dataKey: string, dataId: string) => void;
addRoute: (route: PageRouteDetails) => void;
addRouteToAllLocales: (route: PageRouteDetails, contentProvider: ContentProvider) => void;
addRouteSharedDataToAllLocales: (slug: string, dataKey: string, dataId: string, contentProvider: ContentProvider) => void;
addApiRoute: (route: ApiRouteDetails) => void;
addCustomSsoProvider: (providerDetails: CustomSsoProviderDetails) => void;
getLoginUrls: () => Record;
getRouteByFsPath: (relativePath: string) => PageRouteDetails | undefined;
getRouteBySlug: (slug: string, opts?: {
followRedirect?: boolean;
}) => PageRouteDetails | undefined;
getAllRoutesForLocale: (locale?: string, nonDefaultLocales?: string[]) => PageRouteDetails[];
getAllRoutes: () => PageRouteDetails[];
getApiRouteBySlug: (slug: string) => ApiRouteDetails | undefined;
getAllApiRoutes: () => ApiRouteDetails[];
getTemplate: (id: string) => string | undefined;
getRequestHandler: (id: string) => string | undefined;
createTemplate: (id: string, importPath: string) => string;
addBrowserPlugin: (importPath: string) => void;
createRequestHandler: (id: string, importPath: string) => string;
registerServerPropsGetter: (id: string, importPath: string) => string;
writeRouteStaticData(route: RouteDetails, contentProvider: ContentProvider): Promise;
resolveRouteStaticData(route: RouteDetails, contentProvider: ContentProvider, skipLastModified?: boolean): Promise;
addSsrComponents(components: JSX.Element[] | string[], position: 'head' | 'preBody' | 'postBody'): void;
clear: () => void;
toJson(): {
[k: string]: any;
};
static fromJson(json: Record, options: StoreOptions): Store;
}
//# sourceMappingURL=store.d.ts.map