///
import type { Node } from '@markdoc/markdoc';
import type { ProductConfig, ThemeConfig } from '@redocly/theme';
import type { PageProps, PageStaticData, ResolvedNavItem, Version, SearchData, SearchDocument, GlobalData, NavItem } from '../../shared/types';
import type { REDOCLY_TEAMS_RBAC } from '../../shared/constants.js';
import type { ContentProvider } from '../content/content-provider.js';
import type { MdOptions } from './markdown/types.js';
import type { LicenseInfo } from './config-parser/license/license-info';
import type { RbacScopeItems, RedirectConfig, RedoclyConfig } from '../config/schema';
import type { MarkdocDeps, MarkdocRawContent } from './markdown/compiler';
import type { BundledDefinition } from './openapi-docs/load-definition';
export type ResolveItemsOptions = {
groupCustomSidebars?: boolean;
locale?: string;
ignoredRoutes?: Set;
ref?: string;
ignoreCustomSidebar?: boolean;
};
export type GetStaticDataContext = {
getRouteByFsPath: (relativePath: string) => PageRouteDetails | undefined;
getRouteBySlug: (relativePath: string, opts?: {
followRedirect: boolean;
}) => PageRouteDetails | undefined;
getGlobalConfig(key: string): T | undefined;
getConfig: () => RedoclyConfig;
getAllRoutes: () => PageRouteDetails[];
getAllApiRoutes: () => ApiRouteDetails[];
getLoginUrls: () => Record;
parseMarkdoc: (content: MarkdocRawContent, deps?: MarkdocDeps) => {
ast: Node;
info: any;
};
getAllRoutesForLocale: (locale?: string, nonDefaultLocales?: string[]) => PageRouteDetails[];
contentDir: string;
outdir: string;
};
export type GetStaticDataFn = (route: TRoute, contentProvider: ContentProvider, context: GetStaticDataContext) => Promise;
export type GetServerPropsContext = {
getGlobalConfig(key: string): T | undefined;
serverOutDir: string;
};
export type GetServerPropsFn = (route: PageRouteDetails, data: TData, mdOptions: MdOptions, serverOutDir?: string) => Promise;
export interface RouteDetails {
slug: string;
basePath?: string;
fsPath?: string;
[REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
getStaticData?: GetStaticDataFn;
metadata?: Record;
getNavText?: () => Promise | string;
}
export interface PageRouteDetails extends RouteDetails, TData> {
childRoutes?: PageRouteDetails[];
fsPath: string;
templateId: string;
hasClientRoutes?: boolean;
versions?: Version[];
product?: ProductConfig;
httpVerb?: string;
path?: string;
getNavText?: () => Promise | string;
getSidebar?(item?: NavItem): ResolvedNavItem[];
getSearchDocuments?(staticData?: TData): Promise;
serverPropsGetterIds?: string[];
excludeFromSidebar?: boolean;
[REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
}
export interface ApiRouteDetails extends RouteDetails, TData> {
isWildcard?: boolean;
requestHandlerId: string;
}
export type CustomSsoProviderDetails = {
type: string;
loginUrl: string;
apiRoutes: {
handlerImportPath: string;
route: RouteDetails;
}[];
};
export interface PathVersionInfo {
version: string;
isDefault: boolean;
versionFolderId: string;
}
export interface ProcessContentActions {
createSharedData(id: string, data: unknown): Promise;
addRouteSharedData(slug: string, dataKey: string, dataId: string): void;
addRouteSharedDataToAllLocales(slug: string, dataKey: string, dataId: string, contentProvider: ContentProvider): void;
loadOpenApiDefinitions(): Promise;
addCustomSsoProvider(providerDetails: CustomSsoProviderDetails): void;
setGlobalConfig: (data: Record) => void;
setGlobalData: (data: GlobalData) => void;
getConfig: () => RedoclyConfig;
addRoute: (route: PageRouteDetails) => void;
addRouteToAllLocales: (route: PageRouteDetails, contentProvider: ContentProvider) => void;
addRedirect: (from: string, to: RedirectConfig) => void;
createTemplate: (id: string, importPath: string) => string;
addBrowserPlugin: (importPath: string) => void;
registerServerPropsGetter: (id: string, importPath: string) => string;
addSsrComponents: (components: JSX.Element[] | string[], position: 'head' | 'preBody' | 'postBody') => void;
license: LicenseInfo;
contentDir: string;
outdir: string;
}
export interface AfterRoutesCreatedActions {
createSharedData(id: string, data: unknown): Promise;
addRouteSharedData(routeSlug: string, dataKey: string, dataId: string): void;
getRouteByFsPath: (relativePath: string) => PageRouteDetails | undefined;
getRouteBySlug: (relativePath: string, opts?: {
followRedirect: boolean;
}) => PageRouteDetails | undefined;
getConfig: () => RedoclyConfig;
getGlobalConfig(key: string): T | undefined;
getAllRoutes: () => PageRouteDetails[];
getAllRoutesForLocale: (locale?: string, nonDefaultLocales?: string[]) => PageRouteDetails[];
getAllApiRoutes: () => ApiRouteDetails[];
getLoginUrls: () => Record;
setGlobalData: (data: GlobalData) => void;
setGlobalConfig: (data: Record) => void;
parseMarkdoc: (content: MarkdocRawContent, deps?: MarkdocDeps) => {
ast: Node;
info: any;
};
setSearchData: (data: SearchData, locale?: string) => void;
addRedirect: (from: string, to: RedirectConfig) => void;
contentDir: string;
outdir: string;
serverOutDir: string;
license: LicenseInfo;
hasSitemap: boolean;
setSearchIndexReady: () => void;
}
export interface PluginInstance {
name?: string;
watch?: RegExp;
processContent?: (content: ContentProvider, actions: ProcessContentActions) => Promise | void;
afterRoutesCreated?: (content: ContentProvider, actions: AfterRoutesCreatedActions) => Promise | void;
}
export interface PluginDefaultOptions {
contentDir: string;
outdir: string;
serverOutDir?: string;
setGlobalConfig: (data: Record) => void;
}
export type PluginOptions = PluginDefaultOptions & {
[k: string]: unknown;
};
export type Plugin = (opts: PluginOptions, contentProvider: ContentProvider) => Promise;
export declare enum SearchIndexKeys {
TEXT = "text",
TITLE = "title",
PATH_NAME = "pathName",
PARAMETERS_NAME = "parameters.name",
PARAMETERS_DESCRIPTION = "parameters.description"
}
//# sourceMappingURL=types.d.ts.map