gatsby-source-notion-churnotion 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
package/dist/onPostBootstrap.js
CHANGED
@@ -75,21 +75,17 @@ const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId,
|
|
75
75
|
docs.map(async (doc) => {
|
76
76
|
if (doc.text) {
|
77
77
|
const key = `${md5(doc.text)}-doc`;
|
78
|
-
reporter.info(`[TEST1] ${doc.text}`);
|
79
|
-
reporter.info(`[TEST2] ${await getTextFromRawText(doc.text)}`);
|
80
78
|
const cached_ssd = await cache.get(key);
|
81
79
|
if (cached_ssd !== undefined) {
|
82
80
|
tfidf.addDocument(cached_ssd);
|
83
81
|
}
|
84
82
|
else {
|
85
83
|
const ssd = await getSpaceSeparatedDoc(await getTextFromRawText(doc.text));
|
86
|
-
reporter.info(`[TEST3] ${ssd}`);
|
87
84
|
tfidf.addDocument(ssd);
|
88
85
|
await cache.set(key, ssd);
|
89
86
|
}
|
90
87
|
}
|
91
88
|
});
|
92
|
-
//
|
93
89
|
const doc_terms = docs.map((_, i) => tfidf.listTerms(i)
|
94
90
|
.map((x) => ({ ...x, tfidf: x.tf * x.idf }))
|
95
91
|
.sort((x, y) => y.tfidf - x.tfidf));
|
@@ -110,7 +106,6 @@ const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId,
|
|
110
106
|
.map((x) => tfidf_map_for_each_doc[i].get(x))
|
111
107
|
.map((x) => (x === undefined ? 0 : x)));
|
112
108
|
});
|
113
|
-
reporter.info(`[related-posts] bow vectors generated, dimention: ${all_keywords.size}`);
|
114
109
|
nodes.forEach((node) => {
|
115
110
|
const related_nodes = getRelatedPosts(node.id, bow_vectors)
|
116
111
|
.slice(1)
|
@@ -120,7 +115,7 @@ const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId,
|
|
120
115
|
id: createNodeId(digest),
|
121
116
|
parent: node.id,
|
122
117
|
internal: {
|
123
|
-
type:
|
118
|
+
type: constants_1.NODE_TYPE.RelatedPost,
|
124
119
|
contentDigest: digest,
|
125
120
|
},
|
126
121
|
posts: related_nodes,
|
@@ -31,18 +31,15 @@ const processMetadata = async (blocks, actions, createNodeId, reporter, cache) =
|
|
31
31
|
const href = text.href;
|
32
32
|
if (href) {
|
33
33
|
try {
|
34
|
-
reporter.info(`[INFO] Processing metadata for URL: ${href}`);
|
35
34
|
const cacheKey = `metadata-${crypto_1.default
|
36
35
|
.createHash("md5")
|
37
36
|
.update(href)
|
38
37
|
.digest("hex")}`;
|
39
38
|
const cachedMetadata = await cache.get(cacheKey);
|
40
39
|
if (cachedMetadata) {
|
41
|
-
reporter.info(`[INFO] Using cached metadata for URL: ${href}`);
|
42
40
|
text.href = cachedMetadata.nodeId;
|
43
41
|
continue;
|
44
42
|
}
|
45
|
-
reporter.info(`[INFO] Fetching metadata for URL: ${href}`);
|
46
43
|
const response = await fetch(href, {
|
47
44
|
headers: { "User-Agent": "Mozilla/5.0" },
|
48
45
|
});
|
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.2",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|