Skip to content
Snippets Groups Projects
Unverified Commit 12c079b7 authored by Alex Yang's avatar Alex Yang Committed by GitHub
Browse files

refactor: remove unused deps (#303)

parent c835f78d
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
"@xenova/transformers": "^2.10.0", "@xenova/transformers": "^2.10.0",
"assemblyai": "^4.0.0", "assemblyai": "^4.0.0",
"compromise": "^14.10.1", "compromise": "^14.10.1",
"crypto-js": "^4.2.0",
"file-type": "^18.7.0", "file-type": "^18.7.0",
"js-tiktoken": "^1.0.8", "js-tiktoken": "^1.0.8",
"lodash": "^4.17.21", "lodash": "^4.17.21",
...@@ -32,7 +31,6 @@ ...@@ -32,7 +31,6 @@
"wink-nlp": "^1.14.3" "wink-nlp": "^1.14.3"
}, },
"devDependencies": { "devDependencies": {
"@types/crypto-js": "^4.2.1",
"@types/jest": "^29.5.11", "@types/jest": "^29.5.11",
"@types/lodash": "^4.14.202", "@types/lodash": "^4.14.202",
"@types/node": "^18.19.2", "@types/node": "^18.19.2",
......
import CryptoJS from "crypto-js"; import { createHash } from "node:crypto";
import path from "path"; import path from "path";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
...@@ -177,13 +177,13 @@ export class TextNode<T extends Metadata = Metadata> extends BaseNode<T> { ...@@ -177,13 +177,13 @@ export class TextNode<T extends Metadata = Metadata> extends BaseNode<T> {
* @returns * @returns
*/ */
generateHash() { generateHash() {
const hashFunction = CryptoJS.algo.SHA256.create(); const hashFunction = createHash("sha256");
hashFunction.update(`type=${this.getType()}`); hashFunction.update(`type=${this.getType()}`);
hashFunction.update( hashFunction.update(
`startCharIdx=${this.startCharIdx} endCharIdx=${this.endCharIdx}`, `startCharIdx=${this.startCharIdx} endCharIdx=${this.endCharIdx}`,
); );
hashFunction.update(this.getContent(MetadataMode.ALL)); hashFunction.update(this.getContent(MetadataMode.ALL));
return hashFunction.finalize().toString(CryptoJS.enc.Base64); return hashFunction.digest("base64");
} }
getType(): ObjectType { getType(): ObjectType {
......
...@@ -161,9 +161,6 @@ importers: ...@@ -161,9 +161,6 @@ importers:
compromise: compromise:
specifier: ^14.10.1 specifier: ^14.10.1
version: 14.10.1 version: 14.10.1
crypto-js:
specifier: ^4.2.0
version: 4.2.0
file-type: file-type:
specifier: ^18.7.0 specifier: ^18.7.0
version: 18.7.0 version: 18.7.0
...@@ -219,9 +216,6 @@ importers: ...@@ -219,9 +216,6 @@ importers:
specifier: ^1.14.3 specifier: ^1.14.3
version: 1.14.3 version: 1.14.3
devDependencies: devDependencies:
'@types/crypto-js':
specifier: ^4.2.1
version: 4.2.1
'@types/jest': '@types/jest':
specifier: ^29.5.11 specifier: ^29.5.11
version: 29.5.11 version: 29.5.11
...@@ -4441,10 +4435,6 @@ packages: ...@@ -4441,10 +4435,6 @@ packages:
'@types/node': 20.9.0 '@types/node': 20.9.0
dev: true dev: true
   
/@types/crypto-js@4.2.1:
resolution: {integrity: sha512-FSPGd9+OcSok3RsM0UZ/9fcvMOXJ1ENE/ZbLfOPlBWj7BgXtEAM8VYfTtT760GiLbQIMoVozwVuisjvsVwqYWw==}
dev: true
/@types/eslint-scope@3.7.5: /@types/eslint-scope@3.7.5:
resolution: {integrity: sha512-JNvhIEyxVW6EoMIFIvj93ZOywYFatlpu9deeH6eSx6PE3WHYvHaQtmHmQeNw7aA81bYGBPPQqdtBm6b1SsQMmA==} resolution: {integrity: sha512-JNvhIEyxVW6EoMIFIvj93ZOywYFatlpu9deeH6eSx6PE3WHYvHaQtmHmQeNw7aA81bYGBPPQqdtBm6b1SsQMmA==}
dependencies: dependencies:
...@@ -6820,10 +6810,6 @@ packages: ...@@ -6820,10 +6810,6 @@ packages:
randomfill: 1.0.4 randomfill: 1.0.4
dev: true dev: true
   
/crypto-js@4.2.0:
resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==}
dev: false
/crypto-random-string@2.0.0: /crypto-random-string@2.0.0:
resolution: {integrity: sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==} resolution: {integrity: sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==}
engines: {node: '>=8'} engines: {node: '>=8'}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment