Skip to content
Open
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
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": false,
"trailingComma": "es5",
"tabWidth": 2,
"semi": true
}
197 changes: 194 additions & 3 deletions package-lock.json

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

14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "@notionpresso/api-sdk",
"version": "0.0.1",
"version": "0.0.2",
"description": "",
"main": "./package/index.js",
"module": "./package/index.js",
"types": "./package/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"sync": "tsc --build .",
Expand All @@ -23,10 +26,9 @@
"typescript": "^4.9.4"
},
"dependencies": {
"@notionhq/client": "^2.2.3"
"@notionhq/client": "^2.2.3",
"@types/cheerio": "^0.22.35",
"cheerio": "1.0.0-rc.12"
},
"type": "module",
"exports": {
".": "./src/index.ts"
}
"type": "module"
}
17 changes: 17 additions & 0 deletions src/bookmark/fetch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export async function fetchUrl(url: string): Promise<string> {
try {
const response = await fetch(url, {
headers: {
"User-Agent": "Mozilla/5.0 (compatible; NotionDump/1.0)",
},
});

if (!response.ok) {
throw new Error(`Failed to fetch URL: ${response.status}`);
}

return await response.text();
} catch (error) {
throw new Error(`Error fetching URL: ${(error as Error).message}`);
}
}
6 changes: 6 additions & 0 deletions src/bookmark/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from "./preprocessors.js";
export * from "./types.js";
export * from "./metadata.js";
export * from "./fetch.js";
export * from "./transform.js";
export * from "./utils.js";
Loading