gatsby-source-notion-churnotion 1.0.27 → 1.0.29

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,6 +34,7 @@ const getBooks = async ({ bookDatabaseId, reporter, createNode, createNodeId, })
34
34
  create_date: page.created_time,
35
35
  update_date: page.last_edited_time,
36
36
  url: `${constants_1.COMMON_URI}/${constants_1.BOOK_URI}/${slug}`,
37
+ book_category: page.properties?.category?.relation?.[0]?.id || `Etc`,
37
38
  };
38
39
  createNode(bookNode);
39
40
  }
@@ -54,8 +54,25 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
54
54
  .digest(`hex`),
55
55
  },
56
56
  url: `${constants_1.COMMON_URI}/${constants_1.CATEGORY_URI}${categoryUrl}`,
57
+ books: null,
57
58
  };
58
59
  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
+ }
59
76
  if (parentCategoryId && categoryNode) {
60
77
  const parentNode = getNode(parentCategoryId); // Gatsby에서 노드를 검색
61
78
  if (parentNode) {
@@ -38,8 +38,9 @@ const createSchemaCustomization = ({ actions }) => {
38
38
  category_name: String!
39
39
  slug: String!
40
40
  children: [${constants_1.NODE_TYPE.Category}!]! @link(by: "parent")
41
- churnotions: [${constants_1.NODE_TYPE.Post}] @link(by: "book", from: "id")
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: "book", from: "id")
43
44
  }
44
45
 
45
46
  type ${constants_1.NODE_TYPE.Book} implements Node {
@@ -49,6 +50,7 @@ const createSchemaCustomization = ({ actions }) => {
49
50
  update_date: Date! @dateformat
50
51
  children: [${constants_1.NODE_TYPE.Post}] @link(by: "book", from: "id")
51
52
  url: String!
53
+ book_category: ${constants_1.NODE_TYPE.Category} @link(by: "id")
52
54
  }
53
55
  `);
54
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.27",
4
+ "version": "1.0.29",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",
@@ -36,10 +36,10 @@
36
36
  "@notionhq/client": "^2.2.15",
37
37
  "@types/node": "^22.10.2",
38
38
  "axios": "^1.7.9",
39
+ "gatsby-plugin-sharp": "^5.14.0",
39
40
  "gatsby-source-filesystem": "^5.14.0",
40
41
  "gatsby-transformer-json": "^5.14.0",
41
42
  "gatsby-transformer-sharp": "^5.14.0",
42
- "gatsby-plugin-sharp": "^5.14.0",
43
43
  "node-fetch": "^3.3.2",
44
44
  "notion-to-md": "^3.1.1",
45
45
  "typescript": "^5.7.2"
@@ -51,5 +51,6 @@
51
51
  "gatsby": "^5.14.0",
52
52
  "react": "^18.0.0",
53
53
  "react-dom": "^18.0.0"
54
- }
54
+ },
55
+ "packageManager": "yarn@4.5.3+sha512.3003a14012e2987072d244c720506549c1aab73ee728208f1b2580a9fd67b92d61ba6b08fe93f6dce68fd771e3af1e59a0afa28dd242dd0940d73b95fedd4e90"
55
56
  }