fumadocs-core
Version:
The React.js library for building a documentation website
92 lines • 2.38 kB
TypeScript
import "../index-DuwVLhPl.js";
import { n as StructuredData } from "../remark-structure-CV606E7e.js";
import { D as LoaderOutput, T as LoaderConfig } from "../index-Dyo_baWl.js";
import { t as Awaitable } from "../types-Dvkw0Kd0.js";
import { OramaCloud, Transaction } from "@orama/core";
export interface SyncOptions {
/**
* Index name to sync
*/
index: string;
documents: OramaDocument[];
/**
* Commit the transaction, which replaces the live index. When `false`, commit or roll back the transaction that `sync()` returns.
*
* @defaultValue true
*/
autoDeploy?: boolean;
}
export interface I18nSyncOptions extends Omit<SyncOptions, 'index' | 'documents'> {
/**
* Indexes to sync.
*
* Pairs of `locale`-`index`.
**/
indexes: Record<string, string>;
documents: {
locale: string;
items: OramaDocument[];
}[];
}
export interface OramaDocument {
/**
* The ID of document, must be unique
*/
id: string;
title: string;
description?: string;
/**
* URL to the page
*/
url: string;
structured: StructuredData;
/**
* Tag to filter results
*/
tag?: string;
/**
* Data to be added to each section index
*/
extra_data?: object;
breadcrumbs?: string[];
}
export interface OramaIndex {
id: string;
title: string;
url: string;
tag?: string;
/**
* The id of page, used for `group by`
*/
page_id: string;
/**
* Heading content
*/
section?: string;
breadcrumbs?: string[];
/**
* Heading (anchor) id
*/
section_id?: string;
content: string;
table?: string;
}
/**
* Build the search indexes of every page in a source.
*/
export declare function toDocuments<C extends LoaderConfig>(source: LoaderOutput<C> | (() => Awaitable<LoaderOutput<C>>), options?: {
/** Tag to filter results by. */
tag?: (page: C['page']) => string;
}): Promise<OramaDocument[]>;
/**
* Replace the documents of an index in a transaction.
*
* @returns the transaction, commit it to deploy the documents when `autoDeploy` is `false`
*/
export declare function sync(orama: OramaCloud, options: SyncOptions): Promise<Transaction>;
/**
* Like `sync()`, for the index of each locale.
*
* @returns the transaction of each locale
*/
export declare function syncI18n(orama: OramaCloud, { indexes, documents, ...options }: I18nSyncOptions): Promise<Record<string, Transaction>>;