メインコンテンツまでスキップ

Class: NotionReader

Notion pages are retrieved recursively and converted to Document objects. Notion Database can also be loaded, and the serialization method can be customized.

[Note] To use this reader, must be created the Notion integration must be created in advance Please refer to this document for details.

Implements

Constructors

constructor

new NotionReader(options): NotionReader

Constructor for the NotionReader class

Parameters

NameTypeDescription
optionsNotionReaderOptionsConfiguration options for the reader

Returns

NotionReader

Defined in

packages/core/src/readers/NotionReader.ts:22

Properties

crawl

Private Readonly crawl: (rootPageId: string) => AsyncGenerator<CrawlingResult<{}>, any, unknown>

Type declaration

▸ (rootPageId): AsyncGenerator<CrawlingResult<{}>, any, unknown>

Parameters
NameType
rootPageIdstring
Returns

AsyncGenerator<CrawlingResult<{}>, any, unknown>

Defined in

packages/core/src/readers/NotionReader.ts:16

Methods

loadData

loadData(rootPageId): Promise<Document<Metadata>[]>

Loads recursively Notion pages and converts them to an array of Document objects

Parameters

NameTypeDescription
rootPageIdstringThe root Notion page ID

Returns

Promise<Document<Metadata>[]>

A Promise that resolves to an array of Document objects

Implementation of

BaseReader.loadData

Defined in

packages/core/src/readers/NotionReader.ts:67


loadPages

loadPages(rootPageId): Promise<Page[]>

Loads recursively the Notion page with the specified root page ID.

Parameters

NameTypeDescription
rootPageIdstringThe root Notion page ID

Returns

Promise<Page[]>

A Promise that resolves to a Pages object(Convertible with the toDocuments method)

Defined in

packages/core/src/readers/NotionReader.ts:47


toDocuments

toDocuments(pages): Document<Metadata>[]

Converts Pages to an array of Document objects

Parameters

NameTypeDescription
pagesPage[]The Notion pages to convert (Return value of loadPages)

Returns

Document<Metadata>[]

An array of Document objects

Defined in

packages/core/src/readers/NotionReader.ts:31