gatsby-source-notion-churnotion 1.0.71 → 1.0.74

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.
@@ -2,4 +2,3 @@ export type { IPluginOptions } from "./types";
2
2
  export { onPluginInit } from "./onPluginInit";
3
3
  export { sourceNodes } from "./source-nodes";
4
4
  export { createSchemaCustomization } from "./createSchemaCustomization";
5
- export { onPostBootstrap } from "./onPostBootstrap";
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onPostBootstrap = exports.createSchemaCustomization = exports.sourceNodes = exports.onPluginInit = void 0;
3
+ 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
- var onPostBootstrap_1 = require("./onPostBootstrap");
11
- Object.defineProperty(exports, "onPostBootstrap", { enumerable: true, get: function () { return onPostBootstrap_1.onPostBootstrap; } });
10
+ // export { onPostBootstrap } from "./onPostBootstrap";
@@ -1,37 +1,4 @@
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
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
@@ -88,24 +55,15 @@ const getTextFromRawText = async (doc) => {
88
55
  .replace(/http[^ ]+/g, "")
89
56
  .replace(/[\#\!\(\)\*\_\[\]\|\=\>\+\`\:\-]/g, "");
90
57
  };
91
- const getSpaceSeparatedDoc = async (doc, kiwi) => {
92
- return kiwi.tokenize(doc).map((tokenInfo) => tokenInfo.str);
58
+ const getSpaceSeparatedDoc = async (doc) => {
59
+ return "";
93
60
  };
94
- const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId, reporter, cache, }) => {
95
- const { KiwiBuilder } = await Promise.resolve().then(() => __importStar(require("kiwi-nlp")));
96
- const builder = await KiwiBuilder.create("/dist/kiwi-wasm.wasm");
97
- const kiwi = await builder.build({
98
- modelFiles: {
99
- "combiningRule.txt": "/dist/model/combiningRule.txt",
100
- "default.dict": "/dist/model/default.dict",
101
- "extract.mdl": "/dist/model/extract.mdl",
102
- "multi.dict": "/dist/model/multi.dict",
103
- "sj.knlm": "/dist/model/sj.knlm",
104
- "sj.morph": "/dist/model/sj.morph",
105
- "skipbigram.mdl": "/dist/model/skipbigram.mdl",
106
- "typo.dict": "/dist/model/typo.dict",
107
- },
108
- });
61
+ const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId, reporter, cache }, options) => {
62
+ const { etriToken } = options;
63
+ if (etriToken === "") {
64
+ reporter.info("[Related Post] Skip getting related post logic.");
65
+ return;
66
+ }
109
67
  const nodes = getNodesByType(constants_1.NODE_TYPE.Post);
110
68
  const docs = nodes.map((node) => ({
111
69
  id: node.id,
@@ -121,7 +79,7 @@ const onPostBootstrap = async ({ actions, getNode, getNodesByType, createNodeId,
121
79
  tfidf.addDocument(cached_ssd);
122
80
  }
123
81
  else {
124
- const ssd = await getSpaceSeparatedDoc(await getTextFromRawText(doc.text), kiwi);
82
+ const ssd = await getSpaceSeparatedDoc(await getTextFromRawText(doc.text));
125
83
  tfidf.addDocument(ssd);
126
84
  await cache.set(key, ssd);
127
85
  }
@@ -0,0 +1 @@
1
+ export declare const etriApi: (apiKey: string, text: string, analysisCode?: string) => Promise<any>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.etriApi = void 0;
4
+ const etriApi = async (apiKey, text, analysisCode = "morp") => {
5
+ try {
6
+ const response = await fetch("http://aiopen.etri.re.kr:8000/WiseNLU", {
7
+ method: "POST",
8
+ headers: {
9
+ Authorization: apiKey,
10
+ "Content-Type": "application/json",
11
+ },
12
+ body: JSON.stringify({
13
+ request_id: "reserved field",
14
+ argument: {
15
+ analysis_code: analysisCode,
16
+ text: text,
17
+ },
18
+ }),
19
+ });
20
+ if (!response.ok) {
21
+ throw new Error(`HTTP error! status: ${response.status}`);
22
+ }
23
+ const result = await response.json();
24
+ return result;
25
+ }
26
+ catch (error) {
27
+ console.error("Error calling ETRI API:", error);
28
+ throw error;
29
+ }
30
+ };
31
+ exports.etriApi = etriApi;
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.71",
4
+ "version": "1.0.74",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",
@@ -41,7 +41,7 @@
41
41
  "gatsby-source-filesystem": "^5.14.0",
42
42
  "gatsby-transformer-json": "^5.14.0",
43
43
  "gatsby-transformer-sharp": "^5.14.0",
44
- "kiwi-nlp": "^0.20.3",
44
+ "mecab-ya": "^0.1.1",
45
45
  "metascraper": "^5.45.25",
46
46
  "metascraper-description": "^5.45.25",
47
47
  "metascraper-image": "^5.45.27",