gatsby-source-notion-churnotion 1.0.61 → 1.0.63

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,10 +7,8 @@ exports.getPages = 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 imageProcessor_1 = require("../util/imageProcessor");
11
10
  const slugify_1 = require("../util/slugify");
12
- const tableOfContent_1 = require("../util/tableOfContent");
13
- const metadataProcessor_1 = require("../util/metadataProcessor");
11
+ const processor_1 = require("../util/processor");
14
12
  const getPages = async ({ databaseId, reporter, getCache, actions, createNode, createNodeId, createParentChildLink, getNode, }) => {
15
13
  /**
16
14
  * 데이터베이스 내에 페이지들을 읽어서 재귀적으로 추가하는 서브 메서드드
@@ -141,9 +139,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
141
139
  });
142
140
  }
143
141
  const bookId = page.properties?.book?.relation?.[0]?.id || null;
144
- const imageNode = await (0, imageProcessor_1.processBlocks)(pageData.results, actions, getCache, createNodeId, reporter);
145
- const tableOfContents = await (0, tableOfContent_1.processTableOfContents)(pageData.results, actions, getCache, createNodeId, reporter);
146
- const blocksWithMetadata = await (0, metadataProcessor_1.processMetadata)(pageData.results, actions, createNodeId, reporter);
142
+ const [imageNode, tableOfContents] = await (0, processor_1.processor)(pageData.results, actions, getCache, createNodeId, reporter);
147
143
  const postNode = {
148
144
  id: nodeId,
149
145
  category: parentCategoryId,
@@ -154,7 +150,8 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
154
150
  create_date: page.created_time,
155
151
  update_date: page.last_edited_time,
156
152
  version: page.properties?.version?.number || null,
157
- description: null,
153
+ description: page.properties?.description?.rich_text?.[0]?.plain_text ||
154
+ null,
158
155
  slug: slug,
159
156
  category_list: categoryPath,
160
157
  children: [],
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processBlocks = void 0;
4
4
  const gatsby_source_filesystem_1 = require("gatsby-source-filesystem");
5
- // Type Guard
6
5
  function isImageBlock(block) {
7
6
  return block.type === "image" && "image" in block;
8
7
  }
@@ -0,0 +1,7 @@
1
+ import { Actions, GatsbyCache, Reporter } from "gatsby";
2
+ import { BaseContentBlock } from "notion-types";
3
+ export declare const processor: (blocks: BaseContentBlock[], actions: Actions, getCache: (this: void, id: string) => GatsbyCache, createNodeId: (this: void, input: string) => string, reporter: Reporter) => Promise<(string | {
4
+ type: string;
5
+ hash: string;
6
+ title: string;
7
+ }[] | null)[]>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processor = void 0;
4
+ const imageProcessor_1 = require("./imageProcessor");
5
+ const tableOfContent_1 = require("./tableOfContent");
6
+ const metadataProcessor_1 = require("./metadataProcessor");
7
+ const processor = async (blocks, actions, getCache, createNodeId, reporter) => {
8
+ const imageNode = await (0, imageProcessor_1.processBlocks)(blocks, actions, getCache, createNodeId, reporter);
9
+ const tableOfContents = await (0, tableOfContent_1.processTableOfContents)(blocks, actions, getCache, createNodeId, reporter);
10
+ await (0, metadataProcessor_1.processMetadata)(blocks, actions, createNodeId, reporter);
11
+ return [imageNode, tableOfContents];
12
+ };
13
+ exports.processor = processor;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
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.61",
4
+ "version": "1.0.63",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",