gatsby-source-notion-churnotion 1.0.89 → 1.0.91
Sign up to get free protection for your applications and to get access to all the features.
package/dist/api/getBooks.js
CHANGED
@@ -41,6 +41,7 @@ const getBooks = async ({ bookDatabaseId, reporter, getCache, createNode, create
|
|
41
41
|
bookCategoryMap_1.default.get(bookCategoryId).push(nodeId);
|
42
42
|
}
|
43
43
|
const bookImage = page.properties?.bookImage?.files?.[0]?.file.url;
|
44
|
+
const description = page.properties?.description?.rich_text?.[0]?.plain_text;
|
44
45
|
const bookImageNode = await (0, gatsby_source_filesystem_1.createRemoteFileNode)({
|
45
46
|
url: bookImage,
|
46
47
|
parentNodeId: page.id,
|
@@ -66,6 +67,7 @@ const getBooks = async ({ bookDatabaseId, reporter, getCache, createNode, create
|
|
66
67
|
url: `${constants_1.COMMON_URI}/${constants_1.BOOK_URI}/${slug}`,
|
67
68
|
book_category: book_category,
|
68
69
|
book_image: bookImageNode.id,
|
70
|
+
description: description,
|
69
71
|
};
|
70
72
|
reporter.info(`[DEBUG] Book ${bookNode.book_name} has book_category: ${bookNode.book_category}`);
|
71
73
|
createNode(bookNode);
|
@@ -54,6 +54,7 @@ const createSchemaCustomization = ({ actions }) => {
|
|
54
54
|
url: String!
|
55
55
|
book_category: ${constants_1.NODE_TYPE.Category} @link(by: "id", from: "book_category")
|
56
56
|
book_image: File @link(by: "id", from: "book_image")
|
57
|
+
description: String!
|
57
58
|
}
|
58
59
|
|
59
60
|
type ${constants_1.NODE_TYPE.Metadata} implements Node {
|
package/dist/gatsby-node.d.ts
CHANGED
package/dist/gatsby-node.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.createSchemaCustomization = exports.sourceNodes = exports.onPluginInit = void 0;
|
3
|
+
exports.onPostBootstrap = exports.createSchemaCustomization = exports.sourceNodes = exports.onPluginInit = void 0;
|
4
4
|
var onPluginInit_1 = require("./onPluginInit");
|
5
5
|
Object.defineProperty(exports, "onPluginInit", { enumerable: true, get: function () { return onPluginInit_1.onPluginInit; } });
|
6
6
|
var source_nodes_1 = require("./source-nodes");
|
7
7
|
Object.defineProperty(exports, "sourceNodes", { enumerable: true, get: function () { return source_nodes_1.sourceNodes; } });
|
8
8
|
var createSchemaCustomization_1 = require("./createSchemaCustomization");
|
9
9
|
Object.defineProperty(exports, "createSchemaCustomization", { enumerable: true, get: function () { return createSchemaCustomization_1.createSchemaCustomization; } });
|
10
|
-
|
10
|
+
var onPostBootstrap_1 = require("./onPostBootstrap");
|
11
|
+
Object.defineProperty(exports, "onPostBootstrap", { enumerable: true, get: function () { return onPostBootstrap_1.onPostBootstrap; } });
|
package/dist/onPostBootstrap.js
CHANGED
@@ -8,6 +8,12 @@ const crypto_1 = __importDefault(require("crypto"));
|
|
8
8
|
const natural_1 = require("natural");
|
9
9
|
const constants_1 = require("./constants");
|
10
10
|
const compute_cosine_similarity_1 = __importDefault(require("compute-cosine-similarity"));
|
11
|
+
const node_nlp_typescript_1 = require("node-nlp-typescript");
|
12
|
+
const manager = new node_nlp_typescript_1.NlpManager({ languages: ["ko"] }); // 한국어 설정
|
13
|
+
const getTokens = async (doc) => {
|
14
|
+
const result = await manager.process("ko", doc);
|
15
|
+
return result.tokens.filter((token) => token.length > 1); // 길이 1 이상의 토큰만 반환
|
16
|
+
};
|
11
17
|
const vector_similarity_memo = new Map();
|
12
18
|
const md5 = (str) => {
|
13
19
|
const md5 = crypto_1.default.createHash("md5");
|
@@ -36,6 +42,7 @@ const getRelatedPosts = (id, bow_vectors) => {
|
|
36
42
|
vector,
|
37
43
|
};
|
38
44
|
return Array.from(bow_vectors.entries())
|
45
|
+
.filter(([otherId]) => otherId !== id)
|
39
46
|
.sort((x, y) => {
|
40
47
|
const vector_x = {
|
41
48
|
id: x[0],
|
@@ -48,7 +55,8 @@ const getRelatedPosts = (id, bow_vectors) => {
|
|
48
55
|
return (getMemorizedVectorSimilarity(vector_y, vector_node) -
|
49
56
|
getMemorizedVectorSimilarity(vector_x, vector_node));
|
50
57
|
})
|
51
|
-
.map((x) => x[0])
|
58
|
+
.map((x) => x[0])
|
59
|
+
.slice(0, 5);
|
52
60
|
};
|
53
61
|
const getTextFromRawText = async (doc) => {
|
54
62
|
return doc
|
@@ -56,7 +64,8 @@ const getTextFromRawText = async (doc) => {
|
|
56
64
|
.replace(/[\#\!\(\)\*\_\[\]\|\=\>\+\`\:\-]/g, "");
|
57
65
|
};
|
58
66
|
const getSpaceSeparatedDoc = async (doc) => {
|
59
|
-
|
67
|
+
const tokens = await getTokens(doc);
|
68
|
+
return tokens.join(" ");
|
60
69
|
};
|
61
70
|
const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId, reporter, cache }, options) => {
|
62
71
|
const { etriToken } = options;
|
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.
|
4
|
+
"version": "1.0.91",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|
@@ -48,6 +48,8 @@
|
|
48
48
|
"metascraper-url": "^5.45.25",
|
49
49
|
"natural": "^8.0.1",
|
50
50
|
"node-fetch": "^3.3.2",
|
51
|
+
"node-nlp": "^5.0.0-alpha.4",
|
52
|
+
"node-nlp-typescript": "^1.0.3",
|
51
53
|
"notion-to-md": "^3.1.1",
|
52
54
|
"notion-types": "^7.1.5",
|
53
55
|
"typescript": "^5.7.2"
|