gatsby-source-notion-churnotion 1.0.35 → 1.0.37

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
1
  import { IGetBooksParams } from "../types";
2
- export declare const getBooks: ({ bookDatabaseId, reporter, createNode, createNodeId, }: IGetBooksParams) => Promise<void>;
2
+ export declare const getBooks: ({ bookDatabaseId, reporter, createNode, createNodeId, getNode, }: IGetBooksParams) => Promise<void>;
@@ -7,7 +7,7 @@ exports.getBooks = void 0;
7
7
  const crypto_1 = __importDefault(require("crypto"));
8
8
  const constants_1 = require("../constants");
9
9
  const fetchData_1 = require("../util/fetchData");
10
- const getBooks = async ({ bookDatabaseId, reporter, createNode, createNodeId, }) => {
10
+ const getBooks = async ({ bookDatabaseId, reporter, createNode, createNodeId, getNode, }) => {
11
11
  const databaseUrl = `databases/${bookDatabaseId}/query`;
12
12
  const body = {};
13
13
  const result = await (0, fetchData_1.fetchPostWithRetry)(databaseUrl, body);
@@ -18,7 +18,8 @@ const getBooks = async ({ bookDatabaseId, reporter, createNode, createNodeId, })
18
18
  reporter.info(`[CHECK] BOOK page: ${page.id}`);
19
19
  const nodeId = createNodeId(`${page.id}-book`);
20
20
  const slug = page.properties?.slug?.rich_text?.[0]?.plain_text || `unnamed-slug`;
21
- const bookCategoryId = page.properties?.category?.relation?.[0]?.id || null;
21
+ const categoryId = page.properties?.category?.relation?.[0]?.id || null;
22
+ const book_category = createNodeId(`${categoryId}-category`);
22
23
  const bookNode = {
23
24
  id: nodeId,
24
25
  book_name: page.properties?.[`이름`]?.title?.[0]?.plain_text || `Unnamed`,
@@ -35,7 +36,7 @@ const getBooks = async ({ bookDatabaseId, reporter, createNode, createNodeId, })
35
36
  create_date: page.created_time,
36
37
  update_date: page.last_edited_time,
37
38
  url: `${constants_1.COMMON_URI}/${constants_1.BOOK_URI}/${slug}`,
38
- book_category: bookCategoryId,
39
+ book_category: book_category,
39
40
  };
40
41
  reporter.info(`[DEBUG] Book ${bookNode.book_name} has book_category: ${bookNode.book_category}`);
41
42
  createNode(bookNode);
@@ -18,6 +18,7 @@ const sourceNodes = async (gatsbyApi, options) => {
18
18
  reporter,
19
19
  createNode,
20
20
  createNodeId,
21
+ getNode,
21
22
  });
22
23
  await (0, getPages_1.getPages)({
23
24
  token,
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.35",
4
+ "version": "1.0.37",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",