gatsby-source-notion-churnotion 1.0.37 → 1.0.38

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,6 +40,17 @@ 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
+ const bookNode = getNode(bookNodeId);
51
+ books.push(bookNode);
52
+ });
53
+ }
43
54
  const categoryNode = {
44
55
  id: nodeId,
45
56
  category_name: title,
@@ -54,7 +65,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
54
65
  .digest(`hex`),
55
66
  },
56
67
  url: `${constants_1.COMMON_URI}/${constants_1.CATEGORY_URI}${categoryUrl}`,
57
- books: [],
68
+ books: books,
58
69
  };
59
70
  await createNode(categoryNode);
60
71
  if (parentCategoryId && categoryNode) {
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.37",
4
+ "version": "1.0.38",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",