gatsby-source-notion-churnotion 1.1.24 → 1.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,11 +6,6 @@
6
6
  export declare const fetchAllBlocks: (pageId: string) => Promise<any[]>;
7
7
  /**
8
8
  * Notion API에서 GET 요청을 수행하는 함수 (재시도 로직 포함)
9
- * @param {string} url - API endpoint URL
10
- * @param {any} options - Axios 요청 옵션
11
- * @param {number} tryCount - 현재 재시도 횟수
12
- * @param {number} maxRetries - 최대 재시도 횟수
13
- * @returns {Promise<any>} API 응답 데이터
14
9
  */
15
10
  export declare const fetchGetWithRetry: (url: string, options?: any, tryCount?: number, maxRetries?: number) => Promise<any>;
16
11
  /**
@@ -27,22 +27,18 @@ const fetchAllBlocks = async (pageId) => {
27
27
  exports.fetchAllBlocks = fetchAllBlocks;
28
28
  /**
29
29
  * Notion API에서 GET 요청을 수행하는 함수 (재시도 로직 포함)
30
- * @param {string} url - API endpoint URL
31
- * @param {any} options - Axios 요청 옵션
32
- * @param {number} tryCount - 현재 재시도 횟수
33
- * @param {number} maxRetries - 최대 재시도 횟수
34
- * @returns {Promise<any>} API 응답 데이터
35
30
  */
36
31
  const fetchGetWithRetry = async (url, options = {}, tryCount = 0, maxRetries = 5) => {
32
+ console.dir("get :" + url);
37
33
  try {
38
34
  const response = await connector_1.instance.get(url);
39
- const results = response.data.results;
40
- // Notion API 응답에 has_more가 있으면 fetchAllBlocks 호출
35
+ let results = response.data.results;
36
+ // Notion API 응답에 has_more가 있으면 추가 블록을 가져와 병합
41
37
  if (response.data.has_more) {
42
38
  const additionalResults = await (0, exports.fetchAllBlocks)(url.split("/")[1]); // pageId 추출
43
- results.push(...additionalResults);
39
+ results = [...results, ...additionalResults]; // 기존 results에 추가 데이터 병합
44
40
  }
45
- return { ...response.data, results }; // 전체 데이터 반환
41
+ return { ...response.data, results }; // 병합된 전체 데이터 반환
46
42
  }
47
43
  catch (error) {
48
44
  const status = error.response?.status;
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.1.24",
4
+ "version": "1.1.26",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",