Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Jan 11, 2025
1 parent 4a89050 commit bdb8f42
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions libs/langchain-community/src/document_loaders/web/notionapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export type NotionAPILoaderOptions = {
* });
* const pageDocs = await pageLoader.load();
* const splitDocs = await splitter.splitDocuments(pageDocs);
*
*
* const dbLoader = new NotionAPILoader({
* clientOptions: { auth: "<NOTION_INTEGRATION_TOKEN>" },
* id: "<DATABASE_ID>",
Expand Down Expand Up @@ -132,7 +132,7 @@ export class NotionAPILoader extends BaseDocumentLoader {
...options.callerOptions,
});
this.notionClient = new Client({
logger: () => { }, // Suppress Notion SDK logger
logger: () => {}, // Suppress Notion SDK logger
...options.clientOptions,
});
this.n2mClient = new NotionToMarkdown({
Expand All @@ -145,7 +145,7 @@ export class NotionAPILoader extends BaseDocumentLoader {
this.pageQueueTotal = 0;
this.documents = [];
this.rootTitle = "";
this.onDocumentLoaded = options.onDocumentLoaded ?? ((_ti, _cu) => { });
this.onDocumentLoaded = options.onDocumentLoaded ?? ((_ti, _cu) => {});
this.propertiesAsHeader = options.propertiesAsHeader || false;
}

Expand Down Expand Up @@ -202,8 +202,9 @@ export class NotionAPILoader extends BaseDocumentLoader {
case "status":
return prop[prop.type]?.name ?? "";
case "date":
return `${prop[prop.type]?.start ?? ""}${prop[prop.type]?.end ? ` - ${prop[prop.type]?.end}` : ""
}`;
return `${prop[prop.type]?.start ?? ""}${
prop[prop.type]?.end ? ` - ${prop[prop.type]?.end}` : ""
}`;
case "email":
return prop[prop.type] || "";
case "phone_number":
Expand Down Expand Up @@ -291,7 +292,7 @@ export class NotionAPILoader extends BaseDocumentLoader {
if (block.has_children) {
const block_id =
block.type === "synced_block" &&
block.synced_block?.synced_from?.block_id
block.synced_block?.synced_from?.block_id
? block.synced_block.synced_from.block_id
: block.id;

Expand Down Expand Up @@ -350,11 +351,11 @@ export class NotionAPILoader extends BaseDocumentLoader {
const [pageData, pageId] =
typeof page === "string"
? [
this.caller.call(() =>
this.notionClient.pages.retrieve({ page_id: page })
),
page,
]
this.caller.call(() =>
this.notionClient.pages.retrieve({ page_id: page })
),
page,
]
: [page, page.id];

const [pageDetails, pageBlocks] = await Promise.all([
Expand Down

0 comments on commit bdb8f42

Please sign in to comment.