gatsby-source-notion-churnotion 1.0.77 → 1.0.78

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, getNode, cache, }: IGetBooksParams) => Promise<void>;
2
+ export declare const getBooks: ({ bookDatabaseId, reporter, getCache, createNode, createNodeId, getNode, cache, }: IGetBooksParams) => Promise<void>;
@@ -7,7 +7,8 @@ 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, getNode, cache, }) => {
10
+ const gatsby_source_filesystem_1 = require("gatsby-source-filesystem");
11
+ const getBooks = async ({ bookDatabaseId, reporter, getCache, createNode, createNodeId, getNode, cache, }) => {
11
12
  const databaseUrl = `databases/${bookDatabaseId}/query`;
12
13
  const cacheKey = `booksDatabase-${bookDatabaseId}`;
13
14
  let result = await cache.get(cacheKey);
@@ -33,6 +34,14 @@ const getBooks = async ({ bookDatabaseId, reporter, createNode, createNodeId, ge
33
34
  if (categoryId) {
34
35
  book_category = createNodeId(`${categoryId}-category`);
35
36
  }
37
+ const bookImage = page.properties?.bookImage?.files?.[0]?.file.url;
38
+ const bookImageNode = await (0, gatsby_source_filesystem_1.createRemoteFileNode)({
39
+ url: bookImage,
40
+ parentNodeId: page.id,
41
+ getCache,
42
+ createNode,
43
+ createNodeId,
44
+ });
36
45
  const bookNode = {
37
46
  id: nodeId,
38
47
  book_name: page.properties?.[`이름`]?.title?.[0]?.plain_text || `Unnamed`,
@@ -50,6 +59,7 @@ const getBooks = async ({ bookDatabaseId, reporter, createNode, createNodeId, ge
50
59
  update_date: page.last_edited_time,
51
60
  url: `${constants_1.COMMON_URI}/${constants_1.BOOK_URI}/${slug}`,
52
61
  book_category: book_category,
62
+ book_image: bookImageNode,
53
63
  };
54
64
  reporter.info(`[DEBUG] Book ${bookNode.book_name} has book_category: ${bookNode.book_category}`);
55
65
  createNode(bookNode);
@@ -16,6 +16,7 @@ const sourceNodes = async (gatsbyApi, options) => {
16
16
  await (0, getBooks_1.getBooks)({
17
17
  bookDatabaseId,
18
18
  reporter,
19
+ getCache,
19
20
  createNode,
20
21
  createNodeId,
21
22
  getNode,
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.77",
4
+ "version": "1.0.78",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",