gatsby-source-notion-churnotion 1.0.40 → 1.0.43
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/getBooks.js
CHANGED
@@ -19,7 +19,10 @@ const getBooks = async ({ bookDatabaseId, reporter, createNode, createNodeId, ge
|
|
19
19
|
const nodeId = createNodeId(`${page.id}-book`);
|
20
20
|
const slug = page.properties?.slug?.rich_text?.[0]?.plain_text || `unnamed-slug`;
|
21
21
|
const categoryId = page.properties?.category?.relation?.[0]?.id || null;
|
22
|
-
|
22
|
+
let book_category = null;
|
23
|
+
if (categoryId) {
|
24
|
+
book_category = createNodeId(`${categoryId}-category`);
|
25
|
+
}
|
23
26
|
const bookNode = {
|
24
27
|
id: nodeId,
|
25
28
|
book_name: page.properties?.[`이름`]?.title?.[0]?.plain_text || `Unnamed`,
|
package/dist/api/getPages.js
CHANGED
@@ -40,16 +40,6 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
40
40
|
}
|
41
41
|
const nodeId = createNodeId(`${categoryJsonData.id}-category`);
|
42
42
|
const categoryUrl = `${parentCategoryUrl}/${slug}`;
|
43
|
-
// Find Book
|
44
|
-
const bookRelations = page.properties?.books?.relation || null;
|
45
|
-
const books = [];
|
46
|
-
if (bookRelations) {
|
47
|
-
bookRelations.forEach((relation) => {
|
48
|
-
const bookId = relation.id;
|
49
|
-
const bookNodeId = createNodeId(`${bookId}-book`);
|
50
|
-
books.push(bookNodeId);
|
51
|
-
});
|
52
|
-
}
|
53
43
|
const categoryNode = {
|
54
44
|
id: nodeId,
|
55
45
|
category_name: title,
|
@@ -64,9 +54,25 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
64
54
|
.digest(`hex`),
|
65
55
|
},
|
66
56
|
url: `${constants_1.COMMON_URI}/${constants_1.CATEGORY_URI}${categoryUrl}`,
|
67
|
-
books:
|
57
|
+
books: [],
|
68
58
|
};
|
69
59
|
await createNode(categoryNode);
|
60
|
+
// Find Book
|
61
|
+
const bookRelations = page.properties?.books?.relation || null;
|
62
|
+
if (bookRelations) {
|
63
|
+
bookRelations.forEach((relation) => {
|
64
|
+
const bookId = relation.id;
|
65
|
+
const bookNodeId = createNodeId(`${bookId}-book`);
|
66
|
+
const bookNode = getNode(bookNodeId);
|
67
|
+
if (bookNode) {
|
68
|
+
createParentChildLink({
|
69
|
+
parent: categoryNode,
|
70
|
+
child: bookNode,
|
71
|
+
});
|
72
|
+
reporter.info(`[SUCCESS] Linked Category-Book: ${categoryNode.category_name} -> child: ${bookNode.book_name}`);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
70
76
|
if (parentCategoryId && categoryNode) {
|
71
77
|
const parentNode = getNode(parentCategoryId); // Gatsby에서 노드를 검색
|
72
78
|
if (parentNode) {
|
@@ -40,7 +40,7 @@ const createSchemaCustomization = ({ actions }) => {
|
|
40
40
|
children: [${constants_1.NODE_TYPE.Category}!]! @link(by: "parent")
|
41
41
|
churnotions: [${constants_1.NODE_TYPE.Post}] @link(by: "category", from: "id")
|
42
42
|
url: String!
|
43
|
-
books: [${constants_1.NODE_TYPE.Book}] @link(by: "id")
|
43
|
+
books: [${constants_1.NODE_TYPE.Book}] @link(by: "id", from: "books")
|
44
44
|
}
|
45
45
|
|
46
46
|
type ${constants_1.NODE_TYPE.Book} implements Node {
|
@@ -50,7 +50,7 @@ const createSchemaCustomization = ({ actions }) => {
|
|
50
50
|
update_date: Date! @dateformat
|
51
51
|
children: [${constants_1.NODE_TYPE.Post}] @link(by: "book", from: "id")
|
52
52
|
url: String!
|
53
|
-
book_category: ${constants_1.NODE_TYPE.Category}
|
53
|
+
book_category: ${constants_1.NODE_TYPE.Category} @link(by: "id")
|
54
54
|
}
|
55
55
|
`);
|
56
56
|
};
|
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.43",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|