gatsby-source-notion-churnotion 1.1.30 → 1.1.32
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.
package/README.md
CHANGED
@@ -6,7 +6,22 @@ This plugin recursively collects categories from a single Notion database, which
|
|
6
6
|
|
7
7
|
If you're considering Notion as your CMS for Gatsby, this plugin could be a great choice as it supports recursive category collection.
|
8
8
|
|
9
|
-
## What's New in v1.1.
|
9
|
+
## What's New in v1.1.32
|
10
|
+
|
11
|
+
- **Fixed Gatsby Schema Relationship Bug**:
|
12
|
+
- Fixed `childrenChurnotion` field relationship in NBook nodes
|
13
|
+
- Properly defined relationship between Book and Post nodes
|
14
|
+
- Fixed "Field 'childrenChurnotion' is not defined" error during Gatsby build
|
15
|
+
|
16
|
+
## What's New in v1.1.31
|
17
|
+
|
18
|
+
- **Fixed ES Module compatibility issues**:
|
19
|
+
- Removed dependency on external p-limit library
|
20
|
+
- Implemented custom parallel processing queue
|
21
|
+
- Fixed Gatsby build errors related to ESM imports
|
22
|
+
- Improved CommonJS compatibility
|
23
|
+
|
24
|
+
## What's New in v1.1.30
|
10
25
|
|
11
26
|
- **Added support for more Notion block types**:
|
12
27
|
- bookmark, breadcrumb, callout, code, column, column_list, divider, embed, equation, file, link_preview, pdf, table, table_of_contents, toggle, to_do, video, audio
|
@@ -19,7 +34,6 @@ If you're considering Notion as your CMS for Gatsby, this plugin could be a grea
|
|
19
34
|
- Modular block processor architecture
|
20
35
|
- Better error handling
|
21
36
|
- Improved type safety
|
22
|
-
- Fixed ES Module import issue with p-limit
|
23
37
|
|
24
38
|
## Install
|
25
39
|
|
@@ -12,8 +12,6 @@ export declare class NotionService {
|
|
12
12
|
private cache;
|
13
13
|
private limiter;
|
14
14
|
constructor(options: NotionServiceOptions);
|
15
|
-
private initLimiter;
|
16
|
-
private createSimpleLimiter;
|
17
15
|
/**
|
18
16
|
* 데이터베이스 쿼리
|
19
17
|
*/
|
@@ -35,5 +33,5 @@ export declare class NotionService {
|
|
35
33
|
/**
|
36
34
|
* 병렬 처리 제한 설정
|
37
35
|
*/
|
38
|
-
setParallelLimit(limit: number):
|
36
|
+
setParallelLimit(limit: number): void;
|
39
37
|
}
|
@@ -1,40 +1,52 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
19
|
-
var ownKeys = function(o) {
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
-
var ar = [];
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
-
return ar;
|
24
|
-
};
|
25
|
-
return ownKeys(o);
|
26
|
-
};
|
27
|
-
return function (mod) {
|
28
|
-
if (mod && mod.__esModule) return mod;
|
29
|
-
var result = {};
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
-
__setModuleDefault(result, mod);
|
32
|
-
return result;
|
33
|
-
};
|
34
|
-
})();
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36
3
|
exports.NotionService = void 0;
|
37
4
|
const fetchData_1 = require("../../util/fetchData");
|
5
|
+
/**
|
6
|
+
* 간단한 병렬 제한 큐
|
7
|
+
*/
|
8
|
+
class ParallelLimiter {
|
9
|
+
running = 0;
|
10
|
+
queue = [];
|
11
|
+
limit;
|
12
|
+
constructor(limit) {
|
13
|
+
this.limit = limit;
|
14
|
+
}
|
15
|
+
async add(fn) {
|
16
|
+
return new Promise((resolve, reject) => {
|
17
|
+
const run = () => {
|
18
|
+
this.running++;
|
19
|
+
fn()
|
20
|
+
.then(resolve)
|
21
|
+
.catch(reject)
|
22
|
+
.finally(() => {
|
23
|
+
this.running--;
|
24
|
+
this.next();
|
25
|
+
});
|
26
|
+
};
|
27
|
+
if (this.running < this.limit) {
|
28
|
+
run();
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
this.queue.push(run);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
next() {
|
36
|
+
if (this.queue.length > 0 && this.running < this.limit) {
|
37
|
+
const run = this.queue.shift();
|
38
|
+
if (run)
|
39
|
+
run();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
setLimit(limit) {
|
43
|
+
this.limit = limit;
|
44
|
+
// 새 제한 설정 후 큐에서 가능한 작업 실행
|
45
|
+
while (this.running < this.limit && this.queue.length > 0) {
|
46
|
+
this.next();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
38
50
|
class NotionService {
|
39
51
|
reporter;
|
40
52
|
parallelLimit;
|
@@ -46,44 +58,7 @@ class NotionService {
|
|
46
58
|
this.parallelLimit = options.parallelLimit || 5; // 기본 동시 요청 수
|
47
59
|
this.enableCaching = options.enableCaching !== false; // 기본값은 캐싱 활성화
|
48
60
|
this.cache = new Map();
|
49
|
-
this.
|
50
|
-
}
|
51
|
-
async initLimiter() {
|
52
|
-
try {
|
53
|
-
const pLimitModule = await Promise.resolve().then(() => __importStar(require("p-limit")));
|
54
|
-
const pLimit = pLimitModule.default;
|
55
|
-
this.limiter = pLimit(this.parallelLimit);
|
56
|
-
}
|
57
|
-
catch (error) {
|
58
|
-
this.reporter.error(`Failed to initialize p-limit: ${error}`);
|
59
|
-
this.limiter = this.createSimpleLimiter(this.parallelLimit);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
createSimpleLimiter(limit) {
|
63
|
-
let running = 0;
|
64
|
-
const queue = [];
|
65
|
-
const next = () => {
|
66
|
-
running--;
|
67
|
-
if (queue.length > 0) {
|
68
|
-
const run = queue.shift();
|
69
|
-
if (run)
|
70
|
-
run();
|
71
|
-
}
|
72
|
-
};
|
73
|
-
return (fn) => {
|
74
|
-
return new Promise((resolve, reject) => {
|
75
|
-
const run = () => {
|
76
|
-
running++;
|
77
|
-
fn().then(resolve).catch(reject).finally(next);
|
78
|
-
};
|
79
|
-
if (running < limit) {
|
80
|
-
run();
|
81
|
-
}
|
82
|
-
else {
|
83
|
-
queue.push(run);
|
84
|
-
}
|
85
|
-
});
|
86
|
-
};
|
61
|
+
this.limiter = new ParallelLimiter(this.parallelLimit);
|
87
62
|
}
|
88
63
|
/**
|
89
64
|
* 데이터베이스 쿼리
|
@@ -135,11 +110,8 @@ class NotionService {
|
|
135
110
|
* 여러 페이지의 블록 병렬 처리
|
136
111
|
*/
|
137
112
|
async getMultiplePagesBlocks(pageIds) {
|
138
|
-
if (!this.limiter) {
|
139
|
-
await this.initLimiter();
|
140
|
-
}
|
141
113
|
this.reporter.info(`[NOTION] Fetching blocks for ${pageIds.length} pages in parallel (limit: ${this.parallelLimit})`);
|
142
|
-
const tasks = pageIds.map((pageId) => this.limiter(async () => {
|
114
|
+
const tasks = pageIds.map((pageId) => this.limiter.add(async () => {
|
143
115
|
try {
|
144
116
|
const blocks = await this.getPageBlocks(pageId);
|
145
117
|
return { pageId, blocks };
|
@@ -165,10 +137,10 @@ class NotionService {
|
|
165
137
|
/**
|
166
138
|
* 병렬 처리 제한 설정
|
167
139
|
*/
|
168
|
-
|
169
|
-
this.parallelLimit = limit;
|
170
|
-
await this.initLimiter();
|
140
|
+
setParallelLimit(limit) {
|
171
141
|
this.reporter.info(`[NOTION] Updated parallel request limit to ${limit}`);
|
142
|
+
this.parallelLimit = limit;
|
143
|
+
this.limiter.setLimit(limit);
|
172
144
|
}
|
173
145
|
}
|
174
146
|
exports.NotionService = NotionService;
|
@@ -52,7 +52,7 @@ const createSchemaCustomization = ({ actions }) => {
|
|
52
52
|
create_date: Date! @dateformat
|
53
53
|
update_date: Date! @dateformat
|
54
54
|
children: [${constants_1.NODE_TYPE.Post}] @link(by: "book", from: "id")
|
55
|
-
childrenChurnotion: [${constants_1.NODE_TYPE.Post}]
|
55
|
+
childrenChurnotion: [${constants_1.NODE_TYPE.Post}] @link(by: "book", from: "id")
|
56
56
|
url: String!
|
57
57
|
book_category: ${constants_1.NODE_TYPE.Category} @link(by: "id", from: "book_category")
|
58
58
|
book_image: File @link(by: "id", from: "book_image")
|
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.
|
4
|
+
"version": "1.1.32",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|
@@ -51,7 +51,6 @@
|
|
51
51
|
"natural": "^8.0.1",
|
52
52
|
"notion-to-md": "^3.1.1",
|
53
53
|
"notion-types": "^7.1.5",
|
54
|
-
"p-limit": "^6.2.0",
|
55
54
|
"typescript": "^5.7.2"
|
56
55
|
},
|
57
56
|
"devDependencies": {
|