gatsby-source-notion-churnotion 1.1.28 → 1.1.29

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.
@@ -3,3 +3,11 @@
3
3
  * @param {number} ms - Milliseconds to sleep
4
4
  */
5
5
  export declare const sleep: (ms: number) => Promise<unknown>;
6
+ /**
7
+ * Promise에 타임아웃을 적용하는 도우미 함수
8
+ * @param promise 제한할 Promise
9
+ * @param ms 시간 제한 (밀리초)
10
+ * @param errorMessage 타임아웃 오류 메시지
11
+ * @returns 원래 Promise 또는 타임아웃 오류가 발생한 Promise
12
+ */
13
+ export declare const timeLimit: <T>(promise: Promise<T>, ms: number, errorMessage?: string) => Promise<T>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sleep = void 0;
3
+ exports.timeLimit = exports.sleep = void 0;
4
4
  /**
5
5
  * Sleep for a given number of milliseconds
6
6
  * @param {number} ms - Milliseconds to sleep
@@ -9,3 +9,27 @@ const sleep = (ms) => {
9
9
  return new Promise((resolve) => setTimeout(resolve, ms));
10
10
  };
11
11
  exports.sleep = sleep;
12
+ /**
13
+ * Promise에 타임아웃을 적용하는 도우미 함수
14
+ * @param promise 제한할 Promise
15
+ * @param ms 시간 제한 (밀리초)
16
+ * @param errorMessage 타임아웃 오류 메시지
17
+ * @returns 원래 Promise 또는 타임아웃 오류가 발생한 Promise
18
+ */
19
+ const timeLimit = (promise, ms, errorMessage = "Operation timed out") => {
20
+ return new Promise((resolve, reject) => {
21
+ const timeoutId = setTimeout(() => {
22
+ reject(new Error(errorMessage));
23
+ }, ms);
24
+ promise
25
+ .then((result) => {
26
+ clearTimeout(timeoutId);
27
+ resolve(result);
28
+ })
29
+ .catch((error) => {
30
+ clearTimeout(timeoutId);
31
+ reject(error);
32
+ });
33
+ });
34
+ };
35
+ exports.timeLimit = timeLimit;
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.28",
4
+ "version": "1.1.29",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",
@@ -51,6 +51,7 @@
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",
54
55
  "typescript": "^5.7.2"
55
56
  },
56
57
  "devDependencies": {