Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(notion): add data provider #10

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ The following connectors are currently available:
- ✅ Files (.md, .txt, .pdf, .csv)
- ✅ GitHub (Private and Public repos)
- ✅ Google Drive
- ✅ Notion (pages, [need to grant access](https://github.com/mendableai/data-connectors/issues/8#issuecomment-1917829463))
- ✅ Text
- ✅ Web Scraper (single urls, sitemap)
- ✅ Zendesk
- 🔄 Confluence (In progress)
- 🔄 Jira (In progress)
- 🔄 Notion (In progress)
- 🔄 YouTube (In progress)

We are working hard on transitioning all of our connectors to this repository. If you need a connector that is not available here, please open an issue or submit a PR.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
},
"dependencies": {
"@nangohq/node": "^0.36.100",
"@notionhq/client": "^2.2.14",
"@octokit/auth-oauth-user": "^4.0.1",
"axios": "^1.6.5",
"cheerio": "^1.0.0-rc.12",
Expand Down
20 changes: 20 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions src/__tests__/providers/Notion/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { createDataConnector } from "../../../DataConnector";
import dotenv from "dotenv";
dotenv.config();

test(
"Notion Provider Testing",
async () => {
const notionDataConnector = createDataConnector({
provider: "notion",
});

if (!process.env.NANGO_CONNECTION_ID_TEST) {
throw new Error(
"Please specify the NANGO_CONNECTION_ID_TEST environment variable."
);
}

await notionDataConnector.authorizeNango({
nango_connection_id: process.env.NANGO_CONNECTION_ID_TEST,
});

const pages = await notionDataConnector.getDocuments();
expect(pages.length).toBeGreaterThan(0);
pages.forEach((page) => {
expect(page.provider).toBe("notion");
expect(page.type).toBe("page");
expect(page.content).not.toBe(null);
expect(page.createdAt).not.toBe(undefined);
expect(page.updatedAt).not.toBe(undefined);
expect(page.metadata.sourceURL).not.toBe(null);
});
},
30 * 1000
); // 30 seconds
Loading