diff --git a/packages/cli/src/pull.ts b/packages/cli/src/pull.ts index 2a341a4..b461f9f 100644 --- a/packages/cli/src/pull.ts +++ b/packages/cli/src/pull.ts @@ -39,7 +39,6 @@ export type DocuNotionOptions = { let layoutStrategy: LayoutStrategy let notionToMarkdown: NotionToMarkdown -const pages = new Array<NotionPage>() const counts = { output_normally: 0, @@ -149,6 +148,7 @@ export async function notionPull(options: DocuNotionOptions): Promise<void> { info(`PULL: Fetched entire page tree`) + const pages = new Array<NotionPage>() // ---- Markdown conversion and writing to files ---- await getPagesRecursively( options, @@ -156,7 +156,8 @@ export async function notionPull(options: DocuNotionOptions): Promise<void> { rootPageUUID, 0, true, - cachedNotionClient + cachedNotionClient, + pages ) await saveDataToJson(objectsTree, CACHE_DIR + "object_tree.json") @@ -251,7 +252,8 @@ async function getPagesRecursively( pageIdOfThisParent: string, orderOfThisParent: number, rootLevel: boolean, - client: Client + client: Client, + pages: Array<NotionPage> ) { const pageInTheOutline = await fromPageId( incomingContext, @@ -314,7 +316,8 @@ async function getPagesRecursively( childPageInfo.id, childPageInfo.order, false, - client + client, + pages ) } diff --git a/packages/notion-downloader/src/fetch-notion-object-tree.ts b/packages/notion-downloader/src/fetch-notion-object-tree.ts index 1299eb9..96165f3 100644 --- a/packages/notion-downloader/src/fetch-notion-object-tree.ts +++ b/packages/notion-downloader/src/fetch-notion-object-tree.ts @@ -48,6 +48,7 @@ export async function downloadObjectTree({ }) await client.saveCache() + return objectsTree } export async function fetchNotionObjectTree({