doc2vec 1.1.1 → 1.2.0

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/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/utils.js ADDED
@@ -0,0 +1,118 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Utils = void 0;
40
+ const crypto_1 = __importDefault(require("crypto"));
41
+ const path = __importStar(require("path"));
42
+ class Utils {
43
+ static generateHash(content) {
44
+ return crypto_1.default.createHash("sha256").update(content).digest("hex");
45
+ }
46
+ static generateMetadataUUID(repo) {
47
+ // Simple deterministic approach - hash the repo name and convert to UUID format
48
+ const hash = crypto_1.default.createHash('md5').update(`metadata_${repo}`).digest('hex');
49
+ // Format as UUID with version bits set correctly (version 4)
50
+ return `${hash.substr(0, 8)}-${hash.substr(8, 4)}-4${hash.substr(13, 3)}-${hash.substr(16, 4)}-${hash.substr(20, 12)}`;
51
+ }
52
+ static getUrlPrefix(url) {
53
+ try {
54
+ const parsedUrl = new URL(url);
55
+ return parsedUrl.origin + parsedUrl.pathname;
56
+ }
57
+ catch (error) {
58
+ return url;
59
+ }
60
+ }
61
+ static normalizeUrl(url) {
62
+ try {
63
+ const urlObj = new URL(url);
64
+ urlObj.hash = '';
65
+ urlObj.search = '';
66
+ return urlObj.toString();
67
+ }
68
+ catch (error) {
69
+ return url;
70
+ }
71
+ }
72
+ static buildUrl(href, currentUrl) {
73
+ try {
74
+ return new URL(href, currentUrl).toString();
75
+ }
76
+ catch (error) {
77
+ console.warn(`Invalid URL found: ${href}`);
78
+ return '';
79
+ }
80
+ }
81
+ static shouldProcessUrl(url) {
82
+ const parsedUrl = new URL(url);
83
+ const pathname = parsedUrl.pathname;
84
+ const ext = path.extname(pathname);
85
+ if (!ext)
86
+ return true;
87
+ return ['.html', '.htm', '.pdf'].includes(ext.toLowerCase());
88
+ }
89
+ static isPdfUrl(url) {
90
+ try {
91
+ const parsedUrl = new URL(url);
92
+ const pathname = parsedUrl.pathname;
93
+ const ext = path.extname(pathname);
94
+ return ext.toLowerCase() === '.pdf';
95
+ }
96
+ catch (error) {
97
+ return false;
98
+ }
99
+ }
100
+ static isValidUuid(str) {
101
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
102
+ return uuidRegex.test(str);
103
+ }
104
+ static hashToUuid(hash) {
105
+ const truncatedHash = hash.substring(0, 32);
106
+ return [
107
+ truncatedHash.substring(0, 8),
108
+ truncatedHash.substring(8, 12),
109
+ '5' + truncatedHash.substring(13, 16),
110
+ '8' + truncatedHash.substring(17, 20),
111
+ truncatedHash.substring(20, 32)
112
+ ].join('-');
113
+ }
114
+ static tokenize(text) {
115
+ return text.split(/(\s+)/).filter(token => token.length > 0);
116
+ }
117
+ }
118
+ exports.Utils = Utils;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "doc2vec",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "type": "commonjs",
5
5
  "description": "",
6
- "main": "doc2vec.ts",
6
+ "main": "dist/doc2vec.js",
7
7
  "private": false,
8
8
  "publishConfig": {
9
9
  "access": "public"
@@ -11,6 +11,11 @@
11
11
  "bin": {
12
12
  "doc2vec": "dist/doc2vec.js"
13
13
  },
14
+ "files": [
15
+ "dist/",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
14
19
  "scripts": {
15
20
  "build": "tsc && chmod 755 dist/doc2vec.js",
16
21
  "start": "node dist/doc2vec.js",
@@ -32,6 +37,7 @@
32
37
  "js-yaml": "^4.1.0",
33
38
  "jsdom": "^26.0.0",
34
39
  "openai": "^4.20.1",
40
+ "pdfjs-dist": "^5.3.31",
35
41
  "puppeteer": "^24.1.1",
36
42
  "sanitize-html": "^2.11.0",
37
43
  "sqlite-vec": "0.1.7-alpha.2",
package/Dockerfile DELETED
@@ -1,29 +0,0 @@
1
- FROM node:20-slim
2
-
3
- WORKDIR /app
4
-
5
- RUN apt-get update && apt-get install -y \
6
- git \
7
- python3 \
8
- make \
9
- g++ \
10
- sqlite3 \
11
- libsqlite3-dev \
12
- curl \
13
- ca-certificates \
14
- chromium \
15
- fonts-freefont-ttf \
16
- fonts-ipafont-gothic \
17
- fonts-kacst \
18
- fonts-liberation \
19
- fonts-noto-color-emoji \
20
- fonts-thai-tlwg \
21
- libx11-xcb1 \
22
- libxcb-dri3-0 \
23
- libxcomposite1 \
24
- libxdamage1 \
25
- libxi6 \
26
- libxrandr2 \
27
- libxshmfence1 \
28
- libxtst6 \
29
- && apt-get clean
package/config.yaml DELETED
@@ -1,167 +0,0 @@
1
- # Doc2Vec Configuration
2
- sources:
3
- # GitHub Sources
4
- - type: github
5
- product_name: 'istio'
6
- version: 'latest'
7
- repo: 'istio/istio'
8
- start_date: '2025-01-01'
9
- max_size: 1048576
10
- database_config:
11
- type: 'sqlite'
12
- params:
13
- db_path: './istio-issues.db'
14
-
15
- # Website Sources
16
- - type: website
17
- product_name: 'ambient'
18
- version: 'latest'
19
- url: 'https://ambientmesh.io/docs/'
20
- max_size: 1048576
21
- database_config:
22
- type: 'sqlite'
23
- params:
24
- db_path: './ambient.db'
25
-
26
- - type: website
27
- product_name: 'argo'
28
- version: 'latest'
29
- url: 'https://argo-cd.readthedocs.io/en/stable/'
30
- max_size: 1048576
31
- database_config:
32
- type: 'sqlite'
33
- params:
34
- db_path: './argo.db'
35
-
36
- - type: website
37
- product_name: 'argo-rollouts'
38
- version: 'latest'
39
- url: 'https://argoproj.github.io/argo-rollouts/installation/'
40
- max_size: 1048576
41
- database_config:
42
- type: 'sqlite'
43
- params:
44
- db_path: './argo-rollouts.db'
45
-
46
- - type: website
47
- product_name: 'argo-rollouts'
48
- version: 'latest'
49
- url: 'https://rollouts-plugin-trafficrouter-gatewayapi.readthedocs.io/en/latest/'
50
- max_size: 1048576
51
- database_config:
52
- type: 'sqlite'
53
- params:
54
- db_path: './argo-rollouts.db'
55
-
56
- - type: website
57
- product_name: 'cilium'
58
- version: 'latest'
59
- url: 'https://docs.cilium.io/en/stable/'
60
- max_size: 1048576
61
- database_config:
62
- type: 'sqlite'
63
- params:
64
- db_path: './cilium.db'
65
-
66
- - type: website
67
- product_name: 'gateway-api'
68
- version: 'latest'
69
- url: 'https://gateway-api.sigs.k8s.io/'
70
- max_size: 1048576
71
- database_config:
72
- type: 'sqlite'
73
- params:
74
- db_path: './gateway-api.db'
75
-
76
- - type: website
77
- product_name: 'gloo-mesh-core'
78
- version: 'latest'
79
- url: 'https://docs.solo.io/gloo-mesh/latest/'
80
- sitemap_url: 'https://docs.solo.io/gloo-mesh/sitemap.xml'
81
- max_size: 1048576
82
- database_config:
83
- type: 'sqlite'
84
- params:
85
- db_path: './gloo-mesh-core.db'
86
-
87
- - type: website
88
- product_name: 'gloo-mesh-enterprise'
89
- version: 'latest'
90
- url: 'https://docs.solo.io/gloo-mesh-enterprise/latest/'
91
- sitemap_url: 'https://docs.solo.io/gloo-mesh-enterprise/sitemap.xml'
92
- max_size: 1048576
93
- database_config:
94
- type: 'sqlite'
95
- params:
96
- db_path: './gloo-mesh-enterprise.db'
97
-
98
- - type: website
99
- product_name: 'gloo-edge'
100
- version: 'latest'
101
- url: 'https://docs.solo.io/gloo-edge/latest/'
102
- max_size: 1048576
103
- database_config:
104
- type: 'sqlite'
105
- params:
106
- db_path: './gloo-edge.db'
107
-
108
- - type: website
109
- product_name: 'gloo-gateway'
110
- version: 'latest'
111
- url: 'https://docs.solo.io/gateway/latest/'
112
- sitemap_url: 'https://docs.solo.io/gateway/sitemap.xml'
113
- max_size: 1048576
114
- database_config:
115
- type: 'sqlite'
116
- params:
117
- db_path: './gloo-gateway.db'
118
-
119
- - type: website
120
- product_name: 'helm'
121
- version: 'latest'
122
- url: 'https://helm.sh/docs/'
123
- max_size: 1048576
124
- database_config:
125
- type: 'sqlite'
126
- params:
127
- db_path: './helm.db'
128
-
129
- - type: website
130
- product_name: 'istio'
131
- version: 'latest'
132
- url: 'https://istio.io/latest/docs/'
133
- max_size: 1048576
134
- database_config:
135
- type: 'sqlite'
136
- params:
137
- db_path: './istio.db'
138
-
139
- - type: website
140
- product_name: 'kubernetes'
141
- version: 'latest'
142
- url: 'https://kubernetes.io/docs/'
143
- max_size: 1048576
144
- database_config:
145
- type: 'sqlite'
146
- params:
147
- db_path: './kubernetes.db'
148
-
149
- - type: website
150
- product_name: 'otel'
151
- version: 'latest'
152
- url: 'https://opentelemetry.io/docs/'
153
- max_size: 1048576
154
- database_config:
155
- type: 'sqlite'
156
- params:
157
- db_path: './otel.db'
158
-
159
- - type: website
160
- product_name: 'prometheus'
161
- version: 'latest'
162
- url: 'https://prometheus.io/docs/'
163
- max_size: 1048576
164
- database_config:
165
- type: 'sqlite'
166
- params:
167
- db_path: './prometheus.db'