gatsby-source-notion-churnotion 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/getPages.js +5 -4
- package/package.json +1 -1
package/dist/api/getPages.js
CHANGED
@@ -11,13 +11,13 @@ const imageProcessor_1 = require("../util/imageProcessor");
|
|
11
11
|
const slugify_1 = require("../util/slugify");
|
12
12
|
const connector_1 = require("./connector");
|
13
13
|
const getPages = async ({ databaseId, reporter, getCache, actions, createNode, createNodeId, createParentChildLink, getNode, }) => {
|
14
|
-
let hasMore = true;
|
15
14
|
/**
|
16
15
|
* 데이터베이스 내에 페이지들을 읽어서 재귀적으로 추가하는 서브 메서드드
|
17
16
|
* @param databaseId 데이터베이스 아이디
|
18
17
|
* @param parentCategoryId 부모 데이터베이스 아이디
|
19
18
|
*/
|
20
19
|
const processDatabase = async (databaseId, parentCategoryId = null, categoryPath = [], tagMap = {}, categoryUrl = ``) => {
|
20
|
+
let hasMore = true;
|
21
21
|
try {
|
22
22
|
while (hasMore) {
|
23
23
|
const databaseUrl = `databases/${databaseId}/query`;
|
@@ -39,7 +39,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
39
39
|
reporter.warn(`[WARNING] Category without a title detected: ${categoryJsonData.id}`);
|
40
40
|
}
|
41
41
|
const nodeId = createNodeId(`${categoryJsonData.id}-category`);
|
42
|
-
categoryUrl +=
|
42
|
+
categoryUrl += `/${slug}`;
|
43
43
|
const categoryNode = {
|
44
44
|
id: nodeId,
|
45
45
|
category_name: title,
|
@@ -53,7 +53,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
53
53
|
.update(JSON.stringify(categoryJsonData))
|
54
54
|
.digest(`hex`),
|
55
55
|
},
|
56
|
-
url: `${constants_1.COMMON_URI}/${categoryUrl}`,
|
56
|
+
url: `${constants_1.COMMON_URI}/${constants_1.CATEGORY_URI}${categoryUrl}`,
|
57
57
|
};
|
58
58
|
createNode(categoryNode);
|
59
59
|
if (parentCategoryId && categoryNode) {
|
@@ -149,7 +149,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
149
149
|
},
|
150
150
|
tags: tagIds,
|
151
151
|
parent: null,
|
152
|
-
url: `${constants_1.COMMON_URI}${categoryUrl}/${slug}`,
|
152
|
+
url: `${constants_1.COMMON_URI}/${constants_1.POST_URI}${categoryUrl}/${slug}`,
|
153
153
|
};
|
154
154
|
await createNode(postNode);
|
155
155
|
// book과 post 부모-자식 관계 설정
|
@@ -197,6 +197,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
197
197
|
}
|
198
198
|
catch (error) {
|
199
199
|
reporter.error(`[ERROR] fetching page`);
|
200
|
+
hasMore = false;
|
200
201
|
}
|
201
202
|
};
|
202
203
|
await processDatabase(databaseId);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "gatsby-source-notion-churnotion",
|
3
3
|
"description": "Gatsby plugin that can connect with One Notion Database RECURSIVELY using official API",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.19",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|