vectra 0.12.2 → 0.14.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/LICENSE +1 -1
- package/README.md +92 -100
- package/bin/vectra.js +3 -0
- package/lib/BrowserWebFetcher.d.ts +75 -0
- package/lib/BrowserWebFetcher.d.ts.map +1 -0
- package/lib/BrowserWebFetcher.js +290 -0
- package/lib/BrowserWebFetcher.js.map +1 -0
- package/lib/FileFetcher.d.ts +5 -0
- package/lib/FileFetcher.d.ts.map +1 -0
- package/lib/FileFetcher.js +89 -0
- package/lib/FileFetcher.js.map +1 -0
- package/lib/FileFetcher.spec.d.ts +2 -0
- package/lib/FileFetcher.spec.d.ts.map +1 -0
- package/lib/FileFetcher.spec.js +244 -0
- package/lib/FileFetcher.spec.js.map +1 -0
- package/lib/FolderWatcher.d.ts +91 -0
- package/lib/FolderWatcher.d.ts.map +1 -0
- package/lib/FolderWatcher.js +304 -0
- package/lib/FolderWatcher.js.map +1 -0
- package/lib/FolderWatcher.spec.d.ts +2 -0
- package/lib/FolderWatcher.spec.d.ts.map +1 -0
- package/lib/FolderWatcher.spec.js +308 -0
- package/lib/FolderWatcher.spec.js.map +1 -0
- package/lib/GPT3Tokenizer.d.ts +9 -0
- package/lib/GPT3Tokenizer.spec.d.ts +2 -0
- package/lib/GPT3Tokenizer.spec.d.ts.map +1 -0
- package/lib/GPT3Tokenizer.spec.js +45 -0
- package/lib/GPT3Tokenizer.spec.js.map +1 -0
- package/lib/ItemSelector.d.ts +41 -0
- package/lib/ItemSelector.d.ts.map +1 -0
- package/lib/ItemSelector.js +179 -0
- package/lib/ItemSelector.js.map +1 -0
- package/lib/ItemSelector.spec.d.ts +2 -0
- package/lib/ItemSelector.spec.d.ts.map +1 -0
- package/lib/ItemSelector.spec.js +204 -0
- package/lib/ItemSelector.spec.js.map +1 -0
- package/lib/LocalDocument.d.ts +54 -0
- package/lib/LocalDocument.d.ts.map +1 -1
- package/lib/LocalDocument.js +116 -0
- package/lib/LocalDocument.js.map +1 -0
- package/lib/LocalDocument.spec.d.ts +2 -0
- package/lib/LocalDocument.spec.d.ts.map +1 -0
- package/lib/LocalDocument.spec.js +214 -0
- package/lib/LocalDocument.spec.js.map +1 -0
- package/lib/LocalDocumentIndex.d.ts +152 -0
- package/lib/LocalDocumentIndex.d.ts.map +1 -1
- package/lib/LocalDocumentIndex.js +420 -0
- package/lib/LocalDocumentIndex.js.map +1 -0
- package/lib/LocalDocumentIndex.spec.d.ts +2 -0
- package/lib/LocalDocumentIndex.spec.d.ts.map +1 -0
- package/lib/LocalDocumentIndex.spec.js +494 -0
- package/lib/LocalDocumentIndex.spec.js.map +1 -0
- package/lib/LocalDocumentResult.d.ts +66 -0
- package/lib/LocalDocumentResult.d.ts.map +1 -1
- package/lib/LocalDocumentResult.js +376 -0
- package/lib/LocalDocumentResult.js.map +1 -0
- package/lib/LocalDocumentResult.spec.d.ts +2 -0
- package/lib/LocalDocumentResult.spec.d.ts.map +1 -0
- package/lib/LocalDocumentResult.spec.js +373 -0
- package/lib/LocalDocumentResult.spec.js.map +1 -0
- package/lib/LocalEmbeddings.d.ts +59 -0
- package/lib/LocalEmbeddings.d.ts.map +1 -0
- package/lib/LocalEmbeddings.js +101 -0
- package/lib/LocalEmbeddings.js.map +1 -0
- package/lib/LocalEmbeddings.spec.d.ts +2 -0
- package/lib/LocalEmbeddings.spec.d.ts.map +1 -0
- package/lib/LocalEmbeddings.spec.js +155 -0
- package/lib/LocalEmbeddings.spec.js.map +1 -0
- package/lib/LocalIndex.d.ts +159 -0
- package/lib/LocalIndex.d.ts.map +1 -1
- package/lib/LocalIndex.js +519 -0
- package/lib/LocalIndex.js.map +1 -0
- package/lib/LocalIndex.spec.d.ts +2 -0
- package/lib/LocalIndex.spec.js +611 -9
- package/lib/LocalIndex.spec.js.map +1 -1
- package/lib/OpenAIEmbeddings.d.ts +124 -0
- package/lib/OpenAIEmbeddings.d.ts.map +1 -0
- package/lib/OpenAIEmbeddings.js +166 -0
- package/lib/OpenAIEmbeddings.js.map +1 -0
- package/lib/OpenAIEmbeddings.spec.d.ts +2 -0
- package/lib/OpenAIEmbeddings.spec.d.ts.map +1 -0
- package/lib/OpenAIEmbeddings.spec.js +298 -0
- package/lib/OpenAIEmbeddings.spec.js.map +1 -0
- package/lib/TextSplitter.d.ts +21 -0
- package/lib/TextSplitter.d.ts.map +1 -1
- package/lib/TextSplitter.js +500 -0
- package/lib/TextSplitter.js.map +1 -0
- package/lib/TextSplitter.spec.d.ts +2 -0
- package/lib/TextSplitter.spec.d.ts.map +1 -0
- package/lib/TextSplitter.spec.js +337 -0
- package/lib/TextSplitter.spec.js.map +1 -0
- package/lib/TransformersEmbeddings.d.ts +121 -0
- package/lib/TransformersEmbeddings.d.ts.map +1 -0
- package/lib/TransformersEmbeddings.js +176 -0
- package/lib/TransformersEmbeddings.js.map +1 -0
- package/lib/TransformersEmbeddings.spec.d.ts +2 -0
- package/lib/TransformersEmbeddings.spec.d.ts.map +1 -0
- package/lib/TransformersEmbeddings.spec.js +198 -0
- package/lib/TransformersEmbeddings.spec.js.map +1 -0
- package/lib/TransformersTokenizer.d.ts +33 -0
- package/lib/TransformersTokenizer.d.ts.map +1 -0
- package/lib/TransformersTokenizer.js +44 -0
- package/lib/TransformersTokenizer.js.map +1 -0
- package/lib/TransformersTokenizer.spec.d.ts +2 -0
- package/lib/TransformersTokenizer.spec.d.ts.map +1 -0
- package/lib/TransformersTokenizer.spec.js +112 -0
- package/lib/TransformersTokenizer.spec.js.map +1 -0
- package/lib/WebFetcher.d.ts +14 -0
- package/lib/WebFetcher.d.ts.map +1 -0
- package/lib/WebFetcher.js +238 -0
- package/lib/WebFetcher.js.map +1 -0
- package/lib/WebFetcher.spec.d.ts +2 -0
- package/lib/WebFetcher.spec.d.ts.map +1 -0
- package/lib/WebFetcher.spec.js +263 -0
- package/lib/WebFetcher.spec.js.map +1 -0
- package/lib/browser.d.ts +30 -0
- package/lib/browser.d.ts.map +1 -0
- package/lib/browser.js +52 -0
- package/lib/browser.js.map +1 -0
- package/lib/codecs/IndexCodec.d.ts +37 -0
- package/lib/codecs/IndexCodec.d.ts.map +1 -0
- package/lib/codecs/IndexCodec.js +3 -0
- package/lib/codecs/IndexCodec.js.map +1 -0
- package/lib/codecs/JsonCodec.d.ts +19 -0
- package/lib/codecs/JsonCodec.d.ts.map +1 -0
- package/lib/codecs/JsonCodec.js +35 -0
- package/lib/codecs/JsonCodec.js.map +1 -0
- package/lib/codecs/JsonCodec.spec.d.ts +2 -0
- package/lib/codecs/JsonCodec.spec.d.ts.map +1 -0
- package/lib/codecs/JsonCodec.spec.js +66 -0
- package/lib/codecs/JsonCodec.spec.js.map +1 -0
- package/lib/codecs/LocalIndex.protobuf.spec.d.ts +2 -0
- package/lib/codecs/LocalIndex.protobuf.spec.d.ts.map +1 -0
- package/lib/codecs/LocalIndex.protobuf.spec.js +108 -0
- package/lib/codecs/LocalIndex.protobuf.spec.js.map +1 -0
- package/lib/codecs/ProtobufCodec.d.ts +20 -0
- package/lib/codecs/ProtobufCodec.d.ts.map +1 -0
- package/lib/codecs/ProtobufCodec.js +225 -0
- package/lib/codecs/ProtobufCodec.js.map +1 -0
- package/lib/codecs/ProtobufCodec.spec.d.ts +2 -0
- package/lib/codecs/ProtobufCodec.spec.d.ts.map +1 -0
- package/lib/codecs/ProtobufCodec.spec.js +155 -0
- package/lib/codecs/ProtobufCodec.spec.js.map +1 -0
- package/lib/codecs/index.d.ts +5 -0
- package/lib/codecs/index.d.ts.map +1 -0
- package/lib/codecs/index.js +21 -0
- package/lib/codecs/index.js.map +1 -0
- package/lib/codecs/migrateIndex.d.ts +24 -0
- package/lib/codecs/migrateIndex.d.ts.map +1 -0
- package/lib/codecs/migrateIndex.js +119 -0
- package/lib/codecs/migrateIndex.js.map +1 -0
- package/lib/codecs/migrateIndex.spec.d.ts +2 -0
- package/lib/codecs/migrateIndex.spec.d.ts.map +1 -0
- package/lib/codecs/migrateIndex.spec.js +151 -0
- package/lib/codecs/migrateIndex.spec.js.map +1 -0
- package/lib/codecs/schemas/index.proto +34 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +36 -0
- package/lib/index.js.map +1 -0
- package/lib/internals/Colorize.d.ts +14 -0
- package/lib/internals/Colorize.d.ts.map +1 -0
- package/lib/internals/Colorize.js +69 -0
- package/lib/internals/Colorize.js.map +1 -0
- package/lib/internals/index.d.ts +3 -0
- package/lib/internals/index.d.ts.map +1 -0
- package/lib/internals/index.js +19 -0
- package/lib/internals/index.js.map +1 -0
- package/lib/internals/types.d.ts +43 -0
- package/lib/internals/types.d.ts.map +1 -0
- package/lib/internals/types.js +3 -0
- package/lib/internals/types.js.map +1 -0
- package/lib/server/IndexManager.d.ts +78 -0
- package/lib/server/IndexManager.d.ts.map +1 -0
- package/lib/server/IndexManager.js +259 -0
- package/lib/server/IndexManager.js.map +1 -0
- package/lib/server/VectraServer.d.ts +40 -0
- package/lib/server/VectraServer.d.ts.map +1 -0
- package/lib/server/VectraServer.js +151 -0
- package/lib/server/VectraServer.js.map +1 -0
- package/lib/server/VectraServer.spec.d.ts +2 -0
- package/lib/server/VectraServer.spec.d.ts.map +1 -0
- package/lib/server/VectraServer.spec.js +322 -0
- package/lib/server/VectraServer.spec.js.map +1 -0
- package/lib/server/handlers/documentHandlers.d.ts +15 -0
- package/lib/server/handlers/documentHandlers.d.ts.map +1 -0
- package/lib/server/handlers/documentHandlers.js +95 -0
- package/lib/server/handlers/documentHandlers.js.map +1 -0
- package/lib/server/handlers/helpers.d.ts +23 -0
- package/lib/server/handlers/helpers.d.ts.map +1 -0
- package/lib/server/handlers/helpers.js +138 -0
- package/lib/server/handlers/helpers.js.map +1 -0
- package/lib/server/handlers/index.d.ts +8 -0
- package/lib/server/handlers/index.d.ts.map +1 -0
- package/lib/server/handlers/index.js +22 -0
- package/lib/server/handlers/index.js.map +1 -0
- package/lib/server/handlers/indexHandlers.d.ts +14 -0
- package/lib/server/handlers/indexHandlers.d.ts.map +1 -0
- package/lib/server/handlers/indexHandlers.js +85 -0
- package/lib/server/handlers/indexHandlers.js.map +1 -0
- package/lib/server/handlers/itemHandlers.d.ts +34 -0
- package/lib/server/handlers/itemHandlers.d.ts.map +1 -0
- package/lib/server/handlers/itemHandlers.js +166 -0
- package/lib/server/handlers/itemHandlers.js.map +1 -0
- package/lib/server/handlers/lifecycleHandlers.d.ts +11 -0
- package/lib/server/handlers/lifecycleHandlers.d.ts.map +1 -0
- package/lib/server/handlers/lifecycleHandlers.js +31 -0
- package/lib/server/handlers/lifecycleHandlers.js.map +1 -0
- package/lib/server/handlers/queryHandlers.d.ts +27 -0
- package/lib/server/handlers/queryHandlers.d.ts.map +1 -0
- package/lib/server/handlers/queryHandlers.js +135 -0
- package/lib/server/handlers/queryHandlers.js.map +1 -0
- package/lib/server/handlers/statsHandlers.d.ts +17 -0
- package/lib/server/handlers/statsHandlers.d.ts.map +1 -0
- package/lib/server/handlers/statsHandlers.js +81 -0
- package/lib/server/handlers/statsHandlers.js.map +1 -0
- package/lib/server/index.d.ts +4 -0
- package/lib/server/index.d.ts.map +1 -0
- package/lib/server/index.js +23 -0
- package/lib/server/index.js.map +1 -0
- package/lib/storage/FileStorage.d.ts +92 -0
- package/lib/storage/FileStorage.d.ts.map +1 -0
- package/lib/storage/FileStorage.js +3 -0
- package/lib/storage/FileStorage.js.map +1 -0
- package/lib/storage/FileStorageUtilities.d.ts +36 -0
- package/lib/storage/FileStorageUtilities.d.ts.map +1 -0
- package/lib/storage/FileStorageUtilities.js +91 -0
- package/lib/storage/FileStorageUtilities.js.map +1 -0
- package/lib/storage/FileStorageUtilities.spec.d.ts +2 -0
- package/lib/storage/FileStorageUtilities.spec.d.ts.map +1 -0
- package/lib/storage/FileStorageUtilities.spec.js +98 -0
- package/lib/storage/FileStorageUtilities.spec.js.map +1 -0
- package/lib/storage/FileType.d.ts +29 -0
- package/lib/storage/FileType.d.ts.map +1 -0
- package/lib/storage/FileType.js +38 -0
- package/lib/storage/FileType.js.map +1 -0
- package/lib/storage/IndexedDBStorage.d.ts +47 -0
- package/lib/storage/IndexedDBStorage.d.ts.map +1 -0
- package/lib/storage/IndexedDBStorage.js +347 -0
- package/lib/storage/IndexedDBStorage.js.map +1 -0
- package/lib/storage/LocalFileStorage.browser.d.ts +19 -0
- package/lib/storage/LocalFileStorage.browser.d.ts.map +1 -0
- package/lib/storage/LocalFileStorage.browser.js +43 -0
- package/lib/storage/LocalFileStorage.browser.js.map +1 -0
- package/lib/storage/LocalFileStorage.d.ts +23 -0
- package/lib/storage/LocalFileStorage.d.ts.map +1 -0
- package/lib/storage/LocalFileStorage.js +152 -0
- package/lib/storage/LocalFileStorage.js.map +1 -0
- package/lib/storage/LocalFileStorage.spec.d.ts +2 -0
- package/lib/storage/LocalFileStorage.spec.d.ts.map +1 -0
- package/lib/storage/LocalFileStorage.spec.js +249 -0
- package/lib/storage/LocalFileStorage.spec.js.map +1 -0
- package/lib/storage/VirtualFileStorage.d.ts +18 -0
- package/lib/storage/VirtualFileStorage.d.ts.map +1 -0
- package/lib/storage/VirtualFileStorage.js +178 -0
- package/lib/storage/VirtualFileStorage.js.map +1 -0
- package/lib/storage/VirtualFileStorage.spec.d.ts +2 -0
- package/lib/storage/VirtualFileStorage.spec.d.ts.map +1 -0
- package/lib/storage/VirtualFileStorage.spec.js +302 -0
- package/lib/storage/VirtualFileStorage.spec.js.map +1 -0
- package/lib/storage/index.d.ts +6 -0
- package/lib/storage/index.d.ts.map +1 -0
- package/lib/storage/index.js +22 -0
- package/lib/storage/index.js.map +1 -0
- package/lib/templates/templates/csharp/README.md +48 -0
- package/lib/templates/templates/csharp/VectraClient.cs +234 -0
- package/lib/templates/templates/go/README.md +71 -0
- package/lib/templates/templates/go/vectra_client.go +322 -0
- package/lib/templates/templates/java/README.md +81 -0
- package/lib/templates/templates/java/VectraClient.java +232 -0
- package/lib/templates/templates/python/README.md +37 -0
- package/lib/templates/templates/python/vectra_client.py +279 -0
- package/lib/templates/templates/rust/Cargo.toml +14 -0
- package/lib/templates/templates/rust/README.md +39 -0
- package/lib/templates/templates/rust/build.rs +4 -0
- package/lib/templates/templates/rust/lib.rs +284 -0
- package/lib/templates/templates/typescript/README.md +96 -0
- package/lib/templates/templates/typescript/VectraClient.ts +374 -0
- package/lib/templates/typescript/VectraClient.d.ts +114 -0
- package/lib/templates/typescript/VectraClient.d.ts.map +1 -0
- package/lib/templates/typescript/VectraClient.js +328 -0
- package/lib/templates/typescript/VectraClient.js.map +1 -0
- package/lib/types.d.ts +153 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +18 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/pathUtils.d.ts +40 -0
- package/lib/utils/pathUtils.d.ts.map +1 -0
- package/lib/utils/pathUtils.js +98 -0
- package/lib/utils/pathUtils.js.map +1 -0
- package/lib/vectra-cli.d.ts +2 -0
- package/lib/vectra-cli.d.ts.map +1 -1
- package/lib/vectra-cli.generate.spec.d.ts +2 -0
- package/lib/vectra-cli.generate.spec.d.ts.map +1 -0
- package/lib/vectra-cli.generate.spec.js +112 -0
- package/lib/vectra-cli.generate.spec.js.map +1 -0
- package/lib/vectra-cli.js +760 -0
- package/lib/vectra-cli.js.map +1 -0
- package/lib/vectra-cli.spec.d.ts +1 -0
- package/lib/vectra-cli.spec.d.ts.map +1 -0
- package/lib/vectra-cli.spec.js +2 -0
- package/lib/vectra-cli.spec.js.map +1 -0
- package/package.json +91 -16
- package/proto/vectra_service.proto +276 -0
- package/src/BrowserWebFetcher.ts +345 -0
- package/src/FileFetcher.spec.ts +234 -0
- package/src/FileFetcher.ts +37 -25
- package/src/FolderWatcher.spec.ts +288 -0
- package/src/FolderWatcher.ts +304 -0
- package/src/GPT3Tokenizer.spec.ts +50 -0
- package/src/ItemSelector.spec.ts +252 -0
- package/src/ItemSelector.ts +163 -150
- package/src/LocalDocument.spec.ts +211 -0
- package/src/LocalDocument.ts +88 -94
- package/src/LocalDocumentIndex.spec.ts +481 -0
- package/src/LocalDocumentIndex.ts +39 -40
- package/src/LocalDocumentResult.spec.ts +373 -0
- package/src/LocalDocumentResult.ts +489 -319
- package/src/LocalEmbeddings.spec.ts +138 -0
- package/src/LocalEmbeddings.ts +120 -0
- package/src/LocalIndex.spec.ts +808 -66
- package/src/LocalIndex.ts +479 -429
- package/src/OpenAIEmbeddings.spec.ts +354 -0
- package/src/OpenAIEmbeddings.ts +26 -27
- package/src/TextSplitter.spec.ts +342 -0
- package/src/TextSplitter.ts +517 -532
- package/src/TransformersEmbeddings.spec.ts +188 -0
- package/src/TransformersEmbeddings.ts +232 -0
- package/src/TransformersTokenizer.spec.ts +143 -0
- package/src/TransformersTokenizer.ts +45 -0
- package/src/WebFetcher.spec.ts +288 -0
- package/src/WebFetcher.ts +184 -186
- package/src/browser.ts +69 -0
- package/src/codecs/IndexCodec.ts +40 -0
- package/src/codecs/JsonCodec.spec.ts +70 -0
- package/src/codecs/JsonCodec.ts +37 -0
- package/src/codecs/LocalIndex.protobuf.spec.ts +115 -0
- package/src/codecs/ProtobufCodec.spec.ts +166 -0
- package/src/codecs/ProtobufCodec.ts +193 -0
- package/src/codecs/index.ts +4 -0
- package/src/codecs/migrateIndex.spec.ts +176 -0
- package/src/codecs/migrateIndex.ts +125 -0
- package/src/codecs/schemas/index.proto +34 -0
- package/src/index.ts +9 -1
- package/src/internals/Colorize.ts +19 -16
- package/src/server/IndexManager.ts +243 -0
- package/src/server/VectraServer.spec.ts +303 -0
- package/src/server/VectraServer.ts +156 -0
- package/src/server/handlers/documentHandlers.ts +59 -0
- package/src/server/handlers/helpers.ts +93 -0
- package/src/server/handlers/index.ts +7 -0
- package/src/server/handlers/indexHandlers.ts +44 -0
- package/src/server/handlers/itemHandlers.ts +140 -0
- package/src/server/handlers/lifecycleHandlers.ts +26 -0
- package/src/server/handlers/queryHandlers.ts +96 -0
- package/src/server/handlers/statsHandlers.ts +38 -0
- package/src/server/index.ts +3 -0
- package/src/storage/FileStorage.ts +105 -0
- package/src/storage/FileStorageUtilities.spec.ts +106 -0
- package/src/storage/FileStorageUtilities.ts +77 -0
- package/src/storage/FileType.ts +61 -0
- package/src/storage/IndexedDBStorage.ts +365 -0
- package/src/storage/LocalFileStorage.browser.ts +52 -0
- package/src/storage/LocalFileStorage.spec.ts +292 -0
- package/src/storage/LocalFileStorage.ts +98 -0
- package/src/storage/VirtualFileStorage.spec.ts +307 -0
- package/src/storage/VirtualFileStorage.ts +169 -0
- package/src/storage/index.ts +5 -0
- package/src/templates/csharp/README.md +48 -0
- package/src/templates/csharp/VectraClient.cs +234 -0
- package/src/templates/go/README.md +71 -0
- package/src/templates/go/vectra_client.go +322 -0
- package/src/templates/java/README.md +81 -0
- package/src/templates/java/VectraClient.java +232 -0
- package/src/templates/python/README.md +37 -0
- package/src/templates/python/vectra_client.py +279 -0
- package/src/templates/rust/Cargo.toml +14 -0
- package/src/templates/rust/README.md +39 -0
- package/src/templates/rust/build.rs +4 -0
- package/src/templates/rust/lib.rs +284 -0
- package/src/templates/typescript/README.md +96 -0
- package/src/templates/typescript/VectraClient.ts +374 -0
- package/src/types.ts +131 -123
- package/src/utils/index.ts +1 -0
- package/src/utils/pathUtils.ts +106 -0
- package/src/vectra-cli.generate.spec.ts +72 -0
- package/src/vectra-cli.spec.ts +0 -0
- package/src/vectra-cli.ts +687 -246
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vectra gRPC client — thin idiomatic wrapper over generated stubs.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* import { VectraClient } from './VectraClient';
|
|
7
|
+
*
|
|
8
|
+
* const client = new VectraClient();
|
|
9
|
+
* const results = await client.queryDocuments('my-index', 'search query');
|
|
10
|
+
* client.close();
|
|
11
|
+
*
|
|
12
|
+
* Generate stubs first:
|
|
13
|
+
* npm install @grpc/grpc-js @grpc/proto-loader
|
|
14
|
+
* // Proto is loaded dynamically — no separate codegen step required.
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
50
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
51
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
52
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
53
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
54
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
55
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.VectraClient = void 0;
|
|
60
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
61
|
+
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
62
|
+
const path = __importStar(require("path"));
|
|
63
|
+
// Load proto definition dynamically
|
|
64
|
+
const PROTO_PATH = path.join(__dirname, 'vectra_service.proto');
|
|
65
|
+
const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
|
|
66
|
+
keepCase: false,
|
|
67
|
+
longs: Number,
|
|
68
|
+
enums: String,
|
|
69
|
+
defaults: true,
|
|
70
|
+
oneofs: true,
|
|
71
|
+
});
|
|
72
|
+
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
|
|
73
|
+
const vectra = protoDescriptor.vectra;
|
|
74
|
+
// ── Client ───────────────────────────────────────────────
|
|
75
|
+
class VectraClient {
|
|
76
|
+
constructor(host = '127.0.0.1', port = 50051) {
|
|
77
|
+
this._client = new vectra.VectraService(`${host}:${port}`, grpc.credentials.createInsecure());
|
|
78
|
+
}
|
|
79
|
+
close() {
|
|
80
|
+
this._client.close();
|
|
81
|
+
}
|
|
82
|
+
// ── Index Management ─────────────────────────────────
|
|
83
|
+
createIndex(name, options) {
|
|
84
|
+
var _a, _b, _c;
|
|
85
|
+
const req = { indexName: name, format: (_a = options === null || options === void 0 ? void 0 : options.format) !== null && _a !== void 0 ? _a : 'json' };
|
|
86
|
+
if (options === null || options === void 0 ? void 0 : options.isDocumentIndex) {
|
|
87
|
+
req.isDocumentIndex = true;
|
|
88
|
+
req.documentConfig = {
|
|
89
|
+
version: 1,
|
|
90
|
+
chunkSize: (_b = options.chunkSize) !== null && _b !== void 0 ? _b : 512,
|
|
91
|
+
chunkOverlap: (_c = options.chunkOverlap) !== null && _c !== void 0 ? _c : 0,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return this._unary('createIndex', req);
|
|
95
|
+
}
|
|
96
|
+
deleteIndex(name) {
|
|
97
|
+
return this._unary('deleteIndex', { indexName: name });
|
|
98
|
+
}
|
|
99
|
+
listIndexes() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
var _a;
|
|
102
|
+
const resp = yield this._unary('listIndexes', {});
|
|
103
|
+
return ((_a = resp.indexes) !== null && _a !== void 0 ? _a : []).map((idx) => ({
|
|
104
|
+
name: idx.name,
|
|
105
|
+
format: idx.format,
|
|
106
|
+
isDocumentIndex: idx.isDocumentIndex,
|
|
107
|
+
}));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// ── Item Operations ──────────────────────────────────
|
|
111
|
+
insertItem(index, options) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
const req = {
|
|
115
|
+
indexName: index,
|
|
116
|
+
text: (_a = options.text) !== null && _a !== void 0 ? _a : '',
|
|
117
|
+
id: (_b = options.id) !== null && _b !== void 0 ? _b : '',
|
|
118
|
+
};
|
|
119
|
+
if (options.vector)
|
|
120
|
+
req.vector = options.vector;
|
|
121
|
+
if (options.metadata)
|
|
122
|
+
req.metadata = toProtoMetadata(options.metadata);
|
|
123
|
+
const resp = yield this._unary('insertItem', req);
|
|
124
|
+
return resp.id;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
upsertItem(index, id, options) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
var _a;
|
|
130
|
+
const req = {
|
|
131
|
+
indexName: index,
|
|
132
|
+
id,
|
|
133
|
+
text: (_a = options.text) !== null && _a !== void 0 ? _a : '',
|
|
134
|
+
};
|
|
135
|
+
if (options.vector)
|
|
136
|
+
req.vector = options.vector;
|
|
137
|
+
if (options.metadata)
|
|
138
|
+
req.metadata = toProtoMetadata(options.metadata);
|
|
139
|
+
const resp = yield this._unary('upsertItem', req);
|
|
140
|
+
return resp.id;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
getItem(index, id) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
const resp = yield this._unary('getItem', { indexName: index, id });
|
|
146
|
+
return resp.item ? itemToResult(resp.item) : null;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
deleteItem(index, id) {
|
|
150
|
+
return this._unary('deleteItem', { indexName: index, id });
|
|
151
|
+
}
|
|
152
|
+
listItems(index, filter) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
var _a;
|
|
155
|
+
const req = { indexName: index };
|
|
156
|
+
if (filter)
|
|
157
|
+
req.filter = { filterJson: JSON.stringify(filter) };
|
|
158
|
+
const resp = yield this._unary('listItems', req);
|
|
159
|
+
return ((_a = resp.items) !== null && _a !== void 0 ? _a : []).map(itemToResult);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// ── Query ────────────────────────────────────────────
|
|
163
|
+
queryItems(index, options) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
var _a, _b, _c;
|
|
166
|
+
const req = {
|
|
167
|
+
indexName: index,
|
|
168
|
+
text: (_a = options.text) !== null && _a !== void 0 ? _a : '',
|
|
169
|
+
topK: (_b = options.topK) !== null && _b !== void 0 ? _b : 10,
|
|
170
|
+
};
|
|
171
|
+
if (options.vector)
|
|
172
|
+
req.vector = options.vector;
|
|
173
|
+
if (options.filter)
|
|
174
|
+
req.filter = { filterJson: JSON.stringify(options.filter) };
|
|
175
|
+
const resp = yield this._unary('queryItems', req);
|
|
176
|
+
return ((_c = resp.results) !== null && _c !== void 0 ? _c : []).map(itemToResult);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
queryDocuments(index, query, options) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
var _a, _b, _c, _d;
|
|
182
|
+
const req = {
|
|
183
|
+
indexName: index,
|
|
184
|
+
query,
|
|
185
|
+
maxDocuments: (_a = options === null || options === void 0 ? void 0 : options.maxDocuments) !== null && _a !== void 0 ? _a : 10,
|
|
186
|
+
maxChunks: (_b = options === null || options === void 0 ? void 0 : options.maxChunks) !== null && _b !== void 0 ? _b : 50,
|
|
187
|
+
useBm25: (_c = options === null || options === void 0 ? void 0 : options.useBm25) !== null && _c !== void 0 ? _c : false,
|
|
188
|
+
};
|
|
189
|
+
if (options === null || options === void 0 ? void 0 : options.filter)
|
|
190
|
+
req.filter = { filterJson: JSON.stringify(options.filter) };
|
|
191
|
+
const resp = yield this._unary('queryDocuments', req);
|
|
192
|
+
return ((_d = resp.results) !== null && _d !== void 0 ? _d : []).map((doc) => {
|
|
193
|
+
var _a;
|
|
194
|
+
return ({
|
|
195
|
+
uri: doc.uri,
|
|
196
|
+
documentId: doc.documentId,
|
|
197
|
+
score: doc.score,
|
|
198
|
+
chunks: ((_a = doc.chunks) !== null && _a !== void 0 ? _a : []).map((c) => ({
|
|
199
|
+
text: c.text,
|
|
200
|
+
score: c.score,
|
|
201
|
+
tokenCount: c.tokenCount,
|
|
202
|
+
})),
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
// ── Document Operations ──────────────────────────────
|
|
208
|
+
upsertDocument(index, uri, text, options) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
var _a;
|
|
211
|
+
const req = {
|
|
212
|
+
indexName: index,
|
|
213
|
+
uri,
|
|
214
|
+
text,
|
|
215
|
+
docType: (_a = options === null || options === void 0 ? void 0 : options.docType) !== null && _a !== void 0 ? _a : '',
|
|
216
|
+
};
|
|
217
|
+
if (options === null || options === void 0 ? void 0 : options.metadata)
|
|
218
|
+
req.metadata = toProtoMetadata(options.metadata);
|
|
219
|
+
const resp = yield this._unary('upsertDocument', req);
|
|
220
|
+
return resp.documentId;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
deleteDocument(index, uri) {
|
|
224
|
+
return this._unary('deleteDocument', { indexName: index, uri });
|
|
225
|
+
}
|
|
226
|
+
listDocuments(index) {
|
|
227
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
var _a;
|
|
229
|
+
const resp = yield this._unary('listDocuments', { indexName: index });
|
|
230
|
+
return ((_a = resp.documents) !== null && _a !== void 0 ? _a : []).map((d) => ({
|
|
231
|
+
uri: d.uri,
|
|
232
|
+
documentId: d.documentId,
|
|
233
|
+
}));
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
// ── Stats ────────────────────────────────────────────
|
|
237
|
+
getIndexStats(index) {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
const resp = yield this._unary('getIndexStats', { indexName: index });
|
|
240
|
+
return {
|
|
241
|
+
version: resp.version,
|
|
242
|
+
format: resp.format,
|
|
243
|
+
itemCount: resp.itemCount,
|
|
244
|
+
metadataConfigCount: resp.metadataConfigCount,
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
getCatalogStats(index) {
|
|
249
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
+
var _a;
|
|
251
|
+
const resp = yield this._unary('getCatalogStats', { indexName: index });
|
|
252
|
+
return {
|
|
253
|
+
version: resp.version,
|
|
254
|
+
documentCount: resp.documentCount,
|
|
255
|
+
chunkCount: resp.chunkCount,
|
|
256
|
+
metadataCounts: (_a = resp.metadataCounts) !== null && _a !== void 0 ? _a : {},
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
// ── Lifecycle ────────────────────────────────────────
|
|
261
|
+
healthcheck() {
|
|
262
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
263
|
+
var _a;
|
|
264
|
+
const resp = yield this._unary('healthcheck', {});
|
|
265
|
+
return {
|
|
266
|
+
status: resp.status,
|
|
267
|
+
uptimeSeconds: resp.uptimeSeconds,
|
|
268
|
+
loadedIndexes: (_a = resp.loadedIndexes) !== null && _a !== void 0 ? _a : [],
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
shutdown() {
|
|
273
|
+
return this._unary('shutdown', {});
|
|
274
|
+
}
|
|
275
|
+
// ── Internals ────────────────────────────────────────
|
|
276
|
+
_unary(method, request) {
|
|
277
|
+
return new Promise((resolve, reject) => {
|
|
278
|
+
this._client[method](request, (err, response) => {
|
|
279
|
+
if (err)
|
|
280
|
+
reject(err);
|
|
281
|
+
else
|
|
282
|
+
resolve(response);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.VectraClient = VectraClient;
|
|
288
|
+
// ── Helpers ──────────────────────────────────────────────
|
|
289
|
+
function toProtoMetadata(metadata) {
|
|
290
|
+
const result = {};
|
|
291
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
292
|
+
if (typeof value === 'boolean') {
|
|
293
|
+
result[key] = { boolValue: value };
|
|
294
|
+
}
|
|
295
|
+
else if (typeof value === 'number') {
|
|
296
|
+
result[key] = { numberValue: value };
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
result[key] = { stringValue: String(value) };
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return result;
|
|
303
|
+
}
|
|
304
|
+
function itemToResult(item) {
|
|
305
|
+
var _a;
|
|
306
|
+
const metadata = {};
|
|
307
|
+
if (item.metadata) {
|
|
308
|
+
for (const [key, val] of Object.entries(item.metadata)) {
|
|
309
|
+
if (val.stringValue !== undefined && val.stringValue !== '') {
|
|
310
|
+
metadata[key] = val.stringValue;
|
|
311
|
+
}
|
|
312
|
+
else if (val.numberValue !== undefined && val.numberValue !== 0) {
|
|
313
|
+
metadata[key] = val.numberValue;
|
|
314
|
+
}
|
|
315
|
+
else if (val.boolValue !== undefined) {
|
|
316
|
+
metadata[key] = val.boolValue;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
id: item.id,
|
|
322
|
+
metadata,
|
|
323
|
+
vector: (_a = item.vector) !== null && _a !== void 0 ? _a : [],
|
|
324
|
+
norm: item.norm,
|
|
325
|
+
score: item.score,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=VectraClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VectraClient.js","sourceRoot":"","sources":["../../../src/templates/typescript/VectraClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AACtC,gEAAkD;AAClD,2CAA6B;AAE7B,oCAAoC;AACpC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;AAChE,MAAM,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC,UAAU,EAAE;IACvD,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;CACf,CAAC,CAAC;AACH,MAAM,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAAQ,CAAC;AAC7E,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;AAiEtC,4DAA4D;AAE5D,MAAa,YAAY;IAGrB,YAAY,OAAe,WAAW,EAAE,OAAe,KAAK;QACxD,IAAI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AChE,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;YACpC,CAAC;iBAAM,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBACrC,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC;YAClC,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO;QACH,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,QAAQ;QACR,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,EAAE;QACzB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;KACpB,CAAC;AACN,CAAC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An AI model that can be used to create embeddings.
|
|
3
|
+
*/
|
|
4
|
+
export interface EmbeddingsModel {
|
|
5
|
+
/**
|
|
6
|
+
* Maximum number of tokens
|
|
7
|
+
*/
|
|
8
|
+
readonly maxTokens: number;
|
|
9
|
+
/**
|
|
10
|
+
* Creates embeddings for the given inputs.
|
|
11
|
+
* @param inputs Text inputs to create embeddings for.
|
|
12
|
+
* @returns A `EmbeddingsResponse` with a status and the generated embeddings or a message when an error occurs.
|
|
13
|
+
*/
|
|
14
|
+
createEmbeddings(inputs: string | string[]): Promise<EmbeddingsResponse>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Status of the embeddings response.
|
|
18
|
+
* @remarks
|
|
19
|
+
* `success` - The embeddings were successfully created.
|
|
20
|
+
* `error` - An error occurred while creating the embeddings.
|
|
21
|
+
* `rate_limited` - The request was rate limited.
|
|
22
|
+
*/
|
|
23
|
+
export type EmbeddingsResponseStatus = 'success' | 'error' | 'rate_limited' | 'cancelled';
|
|
24
|
+
/**
|
|
25
|
+
* Response returned by a `EmbeddingsClient`.
|
|
26
|
+
*/
|
|
27
|
+
export interface EmbeddingsResponse {
|
|
28
|
+
/**
|
|
29
|
+
* Status of the embeddings response.
|
|
30
|
+
*/
|
|
31
|
+
status: EmbeddingsResponseStatus;
|
|
32
|
+
/**
|
|
33
|
+
* Optional. Embeddings for the given inputs.
|
|
34
|
+
*/
|
|
35
|
+
output?: number[][];
|
|
36
|
+
/**
|
|
37
|
+
* Optional. Message when status is not equal to `success`.
|
|
38
|
+
*/
|
|
39
|
+
message?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Optional. Model used to create the embeddings.
|
|
42
|
+
*/
|
|
43
|
+
model?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional. Usage statistics for the request.
|
|
46
|
+
*/
|
|
47
|
+
usage?: Record<string, any>;
|
|
48
|
+
}
|
|
49
|
+
export interface TextChunk {
|
|
50
|
+
text: string;
|
|
51
|
+
tokens: number[];
|
|
52
|
+
startPos: number;
|
|
53
|
+
endPos: number;
|
|
54
|
+
startOverlap: number[];
|
|
55
|
+
endOverlap: number[];
|
|
56
|
+
}
|
|
57
|
+
export interface TextFetcher {
|
|
58
|
+
fetch(uri: string, onDocument: (uri: string, text: string, docType?: string) => Promise<boolean>): Promise<boolean>;
|
|
59
|
+
}
|
|
60
|
+
export interface IndexStats {
|
|
61
|
+
version: number;
|
|
62
|
+
metadata_config: {
|
|
63
|
+
indexed?: string[];
|
|
64
|
+
};
|
|
65
|
+
items: number;
|
|
66
|
+
}
|
|
67
|
+
export interface IndexItem<TMetadata = Record<string, MetadataTypes>> {
|
|
68
|
+
id: string;
|
|
69
|
+
metadata: TMetadata;
|
|
70
|
+
vector: number[];
|
|
71
|
+
norm: number;
|
|
72
|
+
metadataFile?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface MetadataFilter {
|
|
75
|
+
/**
|
|
76
|
+
* Equal to (number, string, boolean)
|
|
77
|
+
*/
|
|
78
|
+
'$eq'?: number | string | boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Not equal to (number, string, boolean)
|
|
81
|
+
*/
|
|
82
|
+
'$ne'?: number | string | boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Greater than (number)
|
|
85
|
+
*/
|
|
86
|
+
'$gt'?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Greater than or equal to (number)
|
|
89
|
+
*/
|
|
90
|
+
'$gte'?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Less than (number)
|
|
93
|
+
*/
|
|
94
|
+
'$lt'?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Less than or equal to (number)
|
|
97
|
+
*/
|
|
98
|
+
'$lte'?: number;
|
|
99
|
+
/**
|
|
100
|
+
* In array (string or number)
|
|
101
|
+
*/
|
|
102
|
+
'$in'?: (number | string)[];
|
|
103
|
+
/**
|
|
104
|
+
* Not in array (string or number)
|
|
105
|
+
*/
|
|
106
|
+
'$nin'?: (number | string)[];
|
|
107
|
+
/**
|
|
108
|
+
* AND (MetadataFilter[])
|
|
109
|
+
*/
|
|
110
|
+
'$and'?: MetadataFilter[];
|
|
111
|
+
/**
|
|
112
|
+
* OR (MetadataFilter[])
|
|
113
|
+
*/
|
|
114
|
+
'$or'?: MetadataFilter[];
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}
|
|
117
|
+
export type MetadataTypes = number | string | boolean;
|
|
118
|
+
export interface QueryResult<TMetadata = Record<string, MetadataTypes>> {
|
|
119
|
+
item: IndexItem<TMetadata>;
|
|
120
|
+
score: number;
|
|
121
|
+
}
|
|
122
|
+
export interface Tokenizer {
|
|
123
|
+
decode(tokens: number[]): string;
|
|
124
|
+
encode(text: string): number[];
|
|
125
|
+
}
|
|
126
|
+
export interface DocumentChunkMetadata {
|
|
127
|
+
documentId: string;
|
|
128
|
+
startPos: number;
|
|
129
|
+
endPos: number;
|
|
130
|
+
[key: string]: MetadataTypes;
|
|
131
|
+
}
|
|
132
|
+
export interface DocumentCatalogStats {
|
|
133
|
+
version: number;
|
|
134
|
+
documents: number;
|
|
135
|
+
chunks: number;
|
|
136
|
+
metadata_config: {
|
|
137
|
+
indexed?: string[];
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export interface DocumentTextSection {
|
|
141
|
+
text: string;
|
|
142
|
+
tokenCount: number;
|
|
143
|
+
score: number;
|
|
144
|
+
isBm25: boolean;
|
|
145
|
+
}
|
|
146
|
+
export interface IndexData {
|
|
147
|
+
version: number;
|
|
148
|
+
metadata_config: {
|
|
149
|
+
indexed?: string[];
|
|
150
|
+
};
|
|
151
|
+
items: IndexItem[];
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC1E;AAED;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,OAAO,GAAG,cAAc,GAAG,WAAW,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,wBAAwB,CAAC;IAEjC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,EAA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@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./pathUtils"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal path utilities that work in Node, Browser, and Electron.
|
|
3
|
+
* Replaces Node's 'path' module for cross-platform compatibility.
|
|
4
|
+
*/
|
|
5
|
+
export declare const pathUtils: {
|
|
6
|
+
/**
|
|
7
|
+
* Path separator. Always '/' for consistency across platforms.
|
|
8
|
+
*/
|
|
9
|
+
sep: "/";
|
|
10
|
+
/**
|
|
11
|
+
* Join path segments together.
|
|
12
|
+
*/
|
|
13
|
+
join(...parts: string[]): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get the last portion of a path.
|
|
16
|
+
*/
|
|
17
|
+
basename(filePath: string, ext?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get the directory name of a path.
|
|
20
|
+
*/
|
|
21
|
+
dirname(filePath: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the extension of the path.
|
|
24
|
+
*/
|
|
25
|
+
extname(filePath: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Normalize a path, resolving '..' and '.' segments.
|
|
28
|
+
*/
|
|
29
|
+
normalize(filePath: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Determine if a path is absolute.
|
|
32
|
+
*/
|
|
33
|
+
isAbsolute(filePath: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Get the relative path from one path to another.
|
|
36
|
+
*/
|
|
37
|
+
relative(from: string, to: string): string;
|
|
38
|
+
};
|
|
39
|
+
export default pathUtils;
|
|
40
|
+
//# sourceMappingURL=pathUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathUtils.d.ts","sourceRoot":"","sources":["../../src/utils/pathUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,SAAS;IAClB;;OAEG;;IAEH;;OAEG;mBACY,MAAM,EAAE,GAAG,MAAM;IAUhC;;OAEG;uBACgB,MAAM,QAAQ,MAAM,GAAG,MAAM;IAQhD;;OAEG;sBACe,MAAM,GAAG,MAAM;IAMjC;;OAEG;sBACe,MAAM,GAAG,MAAM;IAMjC;;OAEG;wBACiB,MAAM,GAAG,MAAM;IAgBnC;;OAEG;yBACkB,MAAM,GAAG,OAAO;IAIrC;;OAEG;mBACY,MAAM,MAAM,MAAM,GAAG,MAAM;CAuB7C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|