gatsby-source-notion-churnotion 1.0.37 → 1.0.39

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