///
import { CreateFetchQueueOptions } from './fetcher';
import { type Entity, type FlatEntity, type RequestParameters } from './types';
import type lunr from 'lunr';
export interface NotionPageTreeParameters {
private_file_path?: string;
createFetchQueueOptions?: CreateFetchQueueOptions;
searchIndexing?: boolean;
}
export interface NotionPageTreeDataSet {
page_collection: Record | undefined;
root: Entity | undefined;
search_index: lunr.Index | undefined;
search_suggestion: string[] | undefined;
}
export default class NotionPageTree {
data_set: NotionPageTreeDataSet;
private_file_path: string;
requestParameters: RequestParameters;
createFetchQueueOptions: CreateFetchQueueOptions;
searchIndexing: boolean;
fetchLoopTimer?: NodeJS.Timeout;
constructor(options?: NotionPageTreeParameters);
/**
* Find cached documents to serve immediately.
*/
parseCachedDocument(): Promise;
/**
* Look for environment variables that are needed to fetch page tree.
* If they don't exist, ask for it.
*/
/**
* Look for environment variables that are needed to fetch page tree.
* @param prompt If variables are missing, prompt user with interactive CLI.
* @param forceRewrite Prompt user with interactive CLI even if variables exist.
* @returns
* client: Notion API client instance.
*
* entry_id: Root entry's id (any block is allowed).
*
* entry_key: Root entry's integration key. Create one here (https://www.notion.so/my-integrations). ⚠️ Must be added to the entry block's "share" settings.
*
* entry_type: 'page' | 'database' | 'block'(all the others)
*/
setRequestParameters({ prompt, forceRewrite }: {
prompt?: boolean | undefined;
forceRewrite?: boolean | undefined;
}): Promise;
/**
* Fetch pages asynchronously, and then assign results to variables.
*/
fetchOnce(): Promise;
/**
* Create asynchronouse fetch loop, which waits for `fetchIntervalMinutes` after each fetch is completed.
*/
startFetchLoop(fetchInterval: number): Promise;
/**
* Stop the fetch loop after current fetch is resolved.
*/
stopFetchLoop(): void;
/**
* Setup servers that serves fetched pages and its search indexes. See details in readme.
*/
setupServer({ port }: {
port: number;
}): import("http").Server;
}