@danielsimonjr/memoryjs 1.0.0 → 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/README.md +385 -113
- package/README.md.backup-1768084780988 +266 -0
- package/dist/index.cjs +24156 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +16967 -0
- package/dist/index.d.ts +16963 -11
- package/dist/index.js +23887 -19
- package/dist/index.js.map +1 -1
- package/dist/workers/levenshteinWorker.cjs +102 -0
- package/dist/workers/levenshteinWorker.cjs.map +1 -0
- package/dist/workers/levenshteinWorker.js +57 -91
- package/dist/workers/levenshteinWorker.js.map +1 -1
- package/package.json +75 -69
- package/dist/core/EntityManager.d.ts +0 -268
- package/dist/core/EntityManager.d.ts.map +0 -1
- package/dist/core/EntityManager.js +0 -512
- package/dist/core/EntityManager.js.map +0 -1
- package/dist/core/GraphEventEmitter.d.ts +0 -202
- package/dist/core/GraphEventEmitter.d.ts.map +0 -1
- package/dist/core/GraphEventEmitter.js +0 -347
- package/dist/core/GraphEventEmitter.js.map +0 -1
- package/dist/core/GraphStorage.d.ts +0 -395
- package/dist/core/GraphStorage.d.ts.map +0 -1
- package/dist/core/GraphStorage.js +0 -786
- package/dist/core/GraphStorage.js.map +0 -1
- package/dist/core/GraphTraversal.d.ts +0 -141
- package/dist/core/GraphTraversal.d.ts.map +0 -1
- package/dist/core/GraphTraversal.js +0 -574
- package/dist/core/GraphTraversal.js.map +0 -1
- package/dist/core/HierarchyManager.d.ts +0 -111
- package/dist/core/HierarchyManager.d.ts.map +0 -1
- package/dist/core/HierarchyManager.js +0 -225
- package/dist/core/HierarchyManager.js.map +0 -1
- package/dist/core/ManagerContext.d.ts +0 -76
- package/dist/core/ManagerContext.d.ts.map +0 -1
- package/dist/core/ManagerContext.js +0 -129
- package/dist/core/ManagerContext.js.map +0 -1
- package/dist/core/ObservationManager.d.ts +0 -85
- package/dist/core/ObservationManager.d.ts.map +0 -1
- package/dist/core/ObservationManager.js +0 -124
- package/dist/core/ObservationManager.js.map +0 -1
- package/dist/core/RelationManager.d.ts +0 -131
- package/dist/core/RelationManager.d.ts.map +0 -1
- package/dist/core/RelationManager.js +0 -212
- package/dist/core/RelationManager.js.map +0 -1
- package/dist/core/SQLiteStorage.d.ts +0 -354
- package/dist/core/SQLiteStorage.d.ts.map +0 -1
- package/dist/core/SQLiteStorage.js +0 -919
- package/dist/core/SQLiteStorage.js.map +0 -1
- package/dist/core/StorageFactory.d.ts +0 -45
- package/dist/core/StorageFactory.d.ts.map +0 -1
- package/dist/core/StorageFactory.js +0 -65
- package/dist/core/StorageFactory.js.map +0 -1
- package/dist/core/TransactionManager.d.ts +0 -464
- package/dist/core/TransactionManager.d.ts.map +0 -1
- package/dist/core/TransactionManager.js +0 -869
- package/dist/core/TransactionManager.js.map +0 -1
- package/dist/core/index.d.ts +0 -17
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -20
- package/dist/core/index.js.map +0 -1
- package/dist/features/AnalyticsManager.d.ts +0 -44
- package/dist/features/AnalyticsManager.d.ts.map +0 -1
- package/dist/features/AnalyticsManager.js +0 -224
- package/dist/features/AnalyticsManager.js.map +0 -1
- package/dist/features/ArchiveManager.d.ts +0 -133
- package/dist/features/ArchiveManager.d.ts.map +0 -1
- package/dist/features/ArchiveManager.js +0 -282
- package/dist/features/ArchiveManager.js.map +0 -1
- package/dist/features/CompressionManager.d.ts +0 -119
- package/dist/features/CompressionManager.d.ts.map +0 -1
- package/dist/features/CompressionManager.js +0 -470
- package/dist/features/CompressionManager.js.map +0 -1
- package/dist/features/IOManager.d.ts +0 -225
- package/dist/features/IOManager.d.ts.map +0 -1
- package/dist/features/IOManager.js +0 -1093
- package/dist/features/IOManager.js.map +0 -1
- package/dist/features/KeywordExtractor.d.ts +0 -61
- package/dist/features/KeywordExtractor.d.ts.map +0 -1
- package/dist/features/KeywordExtractor.js +0 -127
- package/dist/features/KeywordExtractor.js.map +0 -1
- package/dist/features/ObservationNormalizer.d.ts +0 -90
- package/dist/features/ObservationNormalizer.d.ts.map +0 -1
- package/dist/features/ObservationNormalizer.js +0 -194
- package/dist/features/ObservationNormalizer.js.map +0 -1
- package/dist/features/StreamingExporter.d.ts +0 -128
- package/dist/features/StreamingExporter.d.ts.map +0 -1
- package/dist/features/StreamingExporter.js +0 -212
- package/dist/features/StreamingExporter.js.map +0 -1
- package/dist/features/TagManager.d.ts +0 -147
- package/dist/features/TagManager.d.ts.map +0 -1
- package/dist/features/TagManager.js +0 -211
- package/dist/features/TagManager.js.map +0 -1
- package/dist/features/index.d.ts +0 -14
- package/dist/features/index.d.ts.map +0 -1
- package/dist/features/index.js +0 -15
- package/dist/features/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/search/BM25Search.d.ts +0 -148
- package/dist/search/BM25Search.d.ts.map +0 -1
- package/dist/search/BM25Search.js +0 -340
- package/dist/search/BM25Search.js.map +0 -1
- package/dist/search/BasicSearch.d.ts +0 -51
- package/dist/search/BasicSearch.d.ts.map +0 -1
- package/dist/search/BasicSearch.js +0 -138
- package/dist/search/BasicSearch.js.map +0 -1
- package/dist/search/BooleanSearch.d.ts +0 -98
- package/dist/search/BooleanSearch.d.ts.map +0 -1
- package/dist/search/BooleanSearch.js +0 -431
- package/dist/search/BooleanSearch.js.map +0 -1
- package/dist/search/EarlyTerminationManager.d.ts +0 -140
- package/dist/search/EarlyTerminationManager.d.ts.map +0 -1
- package/dist/search/EarlyTerminationManager.js +0 -280
- package/dist/search/EarlyTerminationManager.js.map +0 -1
- package/dist/search/EmbeddingCache.d.ts +0 -175
- package/dist/search/EmbeddingCache.d.ts.map +0 -1
- package/dist/search/EmbeddingCache.js +0 -247
- package/dist/search/EmbeddingCache.js.map +0 -1
- package/dist/search/EmbeddingService.d.ts +0 -277
- package/dist/search/EmbeddingService.d.ts.map +0 -1
- package/dist/search/EmbeddingService.js +0 -531
- package/dist/search/EmbeddingService.js.map +0 -1
- package/dist/search/FuzzySearch.d.ts +0 -118
- package/dist/search/FuzzySearch.d.ts.map +0 -1
- package/dist/search/FuzzySearch.js +0 -313
- package/dist/search/FuzzySearch.js.map +0 -1
- package/dist/search/HybridScorer.d.ts +0 -181
- package/dist/search/HybridScorer.d.ts.map +0 -1
- package/dist/search/HybridScorer.js +0 -258
- package/dist/search/HybridScorer.js.map +0 -1
- package/dist/search/HybridSearchManager.d.ts +0 -80
- package/dist/search/HybridSearchManager.d.ts.map +0 -1
- package/dist/search/HybridSearchManager.js +0 -188
- package/dist/search/HybridSearchManager.js.map +0 -1
- package/dist/search/IncrementalIndexer.d.ts +0 -201
- package/dist/search/IncrementalIndexer.d.ts.map +0 -1
- package/dist/search/IncrementalIndexer.js +0 -343
- package/dist/search/IncrementalIndexer.js.map +0 -1
- package/dist/search/OptimizedInvertedIndex.d.ts +0 -163
- package/dist/search/OptimizedInvertedIndex.d.ts.map +0 -1
- package/dist/search/OptimizedInvertedIndex.js +0 -359
- package/dist/search/OptimizedInvertedIndex.js.map +0 -1
- package/dist/search/ParallelSearchExecutor.d.ts +0 -172
- package/dist/search/ParallelSearchExecutor.d.ts.map +0 -1
- package/dist/search/ParallelSearchExecutor.js +0 -310
- package/dist/search/ParallelSearchExecutor.js.map +0 -1
- package/dist/search/QuantizedVectorStore.d.ts +0 -171
- package/dist/search/QuantizedVectorStore.d.ts.map +0 -1
- package/dist/search/QuantizedVectorStore.js +0 -308
- package/dist/search/QuantizedVectorStore.js.map +0 -1
- package/dist/search/QueryAnalyzer.d.ts +0 -76
- package/dist/search/QueryAnalyzer.d.ts.map +0 -1
- package/dist/search/QueryAnalyzer.js +0 -228
- package/dist/search/QueryAnalyzer.js.map +0 -1
- package/dist/search/QueryCostEstimator.d.ts +0 -244
- package/dist/search/QueryCostEstimator.d.ts.map +0 -1
- package/dist/search/QueryCostEstimator.js +0 -653
- package/dist/search/QueryCostEstimator.js.map +0 -1
- package/dist/search/QueryPlanCache.d.ts +0 -220
- package/dist/search/QueryPlanCache.d.ts.map +0 -1
- package/dist/search/QueryPlanCache.js +0 -380
- package/dist/search/QueryPlanCache.js.map +0 -1
- package/dist/search/QueryPlanner.d.ts +0 -58
- package/dist/search/QueryPlanner.d.ts.map +0 -1
- package/dist/search/QueryPlanner.js +0 -138
- package/dist/search/QueryPlanner.js.map +0 -1
- package/dist/search/RankedSearch.d.ts +0 -71
- package/dist/search/RankedSearch.d.ts.map +0 -1
- package/dist/search/RankedSearch.js +0 -239
- package/dist/search/RankedSearch.js.map +0 -1
- package/dist/search/ReflectionManager.d.ts +0 -120
- package/dist/search/ReflectionManager.d.ts.map +0 -1
- package/dist/search/ReflectionManager.js +0 -232
- package/dist/search/ReflectionManager.js.map +0 -1
- package/dist/search/SavedSearchManager.d.ts +0 -79
- package/dist/search/SavedSearchManager.d.ts.map +0 -1
- package/dist/search/SavedSearchManager.js +0 -147
- package/dist/search/SavedSearchManager.js.map +0 -1
- package/dist/search/SearchFilterChain.d.ts +0 -120
- package/dist/search/SearchFilterChain.d.ts.map +0 -1
- package/dist/search/SearchFilterChain.js +0 -186
- package/dist/search/SearchFilterChain.js.map +0 -1
- package/dist/search/SearchManager.d.ts +0 -326
- package/dist/search/SearchManager.d.ts.map +0 -1
- package/dist/search/SearchManager.js +0 -454
- package/dist/search/SearchManager.js.map +0 -1
- package/dist/search/SearchSuggestions.d.ts +0 -27
- package/dist/search/SearchSuggestions.d.ts.map +0 -1
- package/dist/search/SearchSuggestions.js +0 -58
- package/dist/search/SearchSuggestions.js.map +0 -1
- package/dist/search/SemanticSearch.d.ts +0 -149
- package/dist/search/SemanticSearch.d.ts.map +0 -1
- package/dist/search/SemanticSearch.js +0 -324
- package/dist/search/SemanticSearch.js.map +0 -1
- package/dist/search/SymbolicSearch.d.ts +0 -61
- package/dist/search/SymbolicSearch.d.ts.map +0 -1
- package/dist/search/SymbolicSearch.js +0 -164
- package/dist/search/SymbolicSearch.js.map +0 -1
- package/dist/search/TFIDFEventSync.d.ts +0 -85
- package/dist/search/TFIDFEventSync.d.ts.map +0 -1
- package/dist/search/TFIDFEventSync.js +0 -134
- package/dist/search/TFIDFEventSync.js.map +0 -1
- package/dist/search/TFIDFIndexManager.d.ts +0 -151
- package/dist/search/TFIDFIndexManager.d.ts.map +0 -1
- package/dist/search/TFIDFIndexManager.js +0 -433
- package/dist/search/TFIDFIndexManager.js.map +0 -1
- package/dist/search/VectorStore.d.ts +0 -235
- package/dist/search/VectorStore.d.ts.map +0 -1
- package/dist/search/VectorStore.js +0 -312
- package/dist/search/VectorStore.js.map +0 -1
- package/dist/search/index.d.ts +0 -35
- package/dist/search/index.d.ts.map +0 -1
- package/dist/search/index.js +0 -53
- package/dist/search/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -13
- package/dist/types/index.js.map +0 -1
- package/dist/types/types.d.ts +0 -1811
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -10
- package/dist/types/types.js.map +0 -1
- package/dist/utils/BatchProcessor.d.ts +0 -271
- package/dist/utils/BatchProcessor.d.ts.map +0 -1
- package/dist/utils/BatchProcessor.js +0 -377
- package/dist/utils/BatchProcessor.js.map +0 -1
- package/dist/utils/MemoryMonitor.d.ts +0 -176
- package/dist/utils/MemoryMonitor.d.ts.map +0 -1
- package/dist/utils/MemoryMonitor.js +0 -306
- package/dist/utils/MemoryMonitor.js.map +0 -1
- package/dist/utils/WorkerPoolManager.d.ts +0 -233
- package/dist/utils/WorkerPoolManager.d.ts.map +0 -1
- package/dist/utils/WorkerPoolManager.js +0 -421
- package/dist/utils/WorkerPoolManager.js.map +0 -1
- package/dist/utils/compressedCache.d.ts +0 -221
- package/dist/utils/compressedCache.d.ts.map +0 -1
- package/dist/utils/compressedCache.js +0 -349
- package/dist/utils/compressedCache.js.map +0 -1
- package/dist/utils/compressionUtil.d.ts +0 -214
- package/dist/utils/compressionUtil.d.ts.map +0 -1
- package/dist/utils/compressionUtil.js +0 -248
- package/dist/utils/compressionUtil.js.map +0 -1
- package/dist/utils/constants.d.ts +0 -245
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/constants.js +0 -253
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/entityUtils.d.ts +0 -379
- package/dist/utils/entityUtils.d.ts.map +0 -1
- package/dist/utils/entityUtils.js +0 -649
- package/dist/utils/entityUtils.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -95
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -146
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/formatters.d.ts +0 -145
- package/dist/utils/formatters.d.ts.map +0 -1
- package/dist/utils/formatters.js +0 -133
- package/dist/utils/formatters.js.map +0 -1
- package/dist/utils/index.d.ts +0 -26
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -88
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/indexes.d.ts +0 -270
- package/dist/utils/indexes.d.ts.map +0 -1
- package/dist/utils/indexes.js +0 -527
- package/dist/utils/indexes.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -31
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -41
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/operationUtils.d.ts +0 -124
- package/dist/utils/operationUtils.d.ts.map +0 -1
- package/dist/utils/operationUtils.js +0 -176
- package/dist/utils/operationUtils.js.map +0 -1
- package/dist/utils/parallelUtils.d.ts +0 -76
- package/dist/utils/parallelUtils.d.ts.map +0 -1
- package/dist/utils/parallelUtils.js +0 -192
- package/dist/utils/parallelUtils.js.map +0 -1
- package/dist/utils/schemas.d.ts +0 -556
- package/dist/utils/schemas.d.ts.map +0 -1
- package/dist/utils/schemas.js +0 -485
- package/dist/utils/schemas.js.map +0 -1
- package/dist/utils/searchAlgorithms.d.ts +0 -99
- package/dist/utils/searchAlgorithms.d.ts.map +0 -1
- package/dist/utils/searchAlgorithms.js +0 -168
- package/dist/utils/searchAlgorithms.js.map +0 -1
- package/dist/utils/searchCache.d.ts +0 -108
- package/dist/utils/searchCache.d.ts.map +0 -1
- package/dist/utils/searchCache.js +0 -210
- package/dist/utils/searchCache.js.map +0 -1
- package/dist/utils/taskScheduler.d.ts +0 -294
- package/dist/utils/taskScheduler.d.ts.map +0 -1
- package/dist/utils/taskScheduler.js +0 -487
- package/dist/utils/taskScheduler.js.map +0 -1
- package/dist/workers/index.d.ts +0 -12
- package/dist/workers/index.d.ts.map +0 -1
- package/dist/workers/index.js +0 -10
- package/dist/workers/index.js.map +0 -1
- package/dist/workers/levenshteinWorker.d.ts +0 -60
- package/dist/workers/levenshteinWorker.d.ts.map +0 -1
package/dist/utils/errors.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom Error Types
|
|
3
|
-
*
|
|
4
|
-
* Defines custom error classes for better error handling and debugging.
|
|
5
|
-
*
|
|
6
|
-
* @module utils/errors
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Base error class for all knowledge graph errors.
|
|
10
|
-
* Extends the native Error class with additional context.
|
|
11
|
-
*/
|
|
12
|
-
export declare class KnowledgeGraphError extends Error {
|
|
13
|
-
readonly code?: string | undefined;
|
|
14
|
-
constructor(message: string, code?: string | undefined);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Error thrown when an entity is not found.
|
|
18
|
-
*/
|
|
19
|
-
export declare class EntityNotFoundError extends KnowledgeGraphError {
|
|
20
|
-
constructor(entityName: string);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Error thrown when a relation is not found.
|
|
24
|
-
*/
|
|
25
|
-
export declare class RelationNotFoundError extends KnowledgeGraphError {
|
|
26
|
-
constructor(from: string, to: string, relationType?: string);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Error thrown when attempting to create a duplicate entity.
|
|
30
|
-
*/
|
|
31
|
-
export declare class DuplicateEntityError extends KnowledgeGraphError {
|
|
32
|
-
constructor(entityName: string);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Error thrown when validation fails.
|
|
36
|
-
*/
|
|
37
|
-
export declare class ValidationError extends KnowledgeGraphError {
|
|
38
|
-
readonly errors: string[];
|
|
39
|
-
constructor(message: string, errors: string[]);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Error thrown when a cycle is detected in hierarchies.
|
|
43
|
-
*/
|
|
44
|
-
export declare class CycleDetectedError extends KnowledgeGraphError {
|
|
45
|
-
constructor(entityName: string, parentName: string);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Error thrown when an invalid importance value is provided.
|
|
49
|
-
*/
|
|
50
|
-
export declare class InvalidImportanceError extends KnowledgeGraphError {
|
|
51
|
-
constructor(value: number, min?: number, max?: number);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Error thrown when a file operation fails.
|
|
55
|
-
*/
|
|
56
|
-
export declare class FileOperationError extends KnowledgeGraphError {
|
|
57
|
-
constructor(operation: string, filePath: string, cause?: Error);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Error thrown when an import operation fails.
|
|
61
|
-
*/
|
|
62
|
-
export declare class ImportError extends KnowledgeGraphError {
|
|
63
|
-
constructor(format: string, message: string);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Error thrown when an export operation fails.
|
|
67
|
-
*/
|
|
68
|
-
export declare class ExportError extends KnowledgeGraphError {
|
|
69
|
-
constructor(format: string, message: string);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Error thrown when insufficient entities are provided for an operation.
|
|
73
|
-
*/
|
|
74
|
-
export declare class InsufficientEntitiesError extends KnowledgeGraphError {
|
|
75
|
-
constructor(operation: string, required: number, provided: number);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Phase 9B: Error thrown when an operation is cancelled via AbortSignal.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* const controller = new AbortController();
|
|
83
|
-
* try {
|
|
84
|
-
* await manager.createEntities(entities, { signal: controller.signal });
|
|
85
|
-
* } catch (error) {
|
|
86
|
-
* if (error instanceof OperationCancelledError) {
|
|
87
|
-
* console.log('Operation was cancelled');
|
|
88
|
-
* }
|
|
89
|
-
* }
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
export declare class OperationCancelledError extends KnowledgeGraphError {
|
|
93
|
-
constructor(operation?: string);
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;aACC,IAAI,CAAC,EAAE,MAAM;gBAA9C,OAAO,EAAE,MAAM,EAAkB,IAAI,CAAC,EAAE,MAAM,YAAA;CAQ3D;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB;gBAC9C,UAAU,EAAE,MAAM;CAI/B;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,mBAAmB;gBAChD,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;CAO5D;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,mBAAmB;gBAC/C,UAAU,EAAE,MAAM;CAI/B;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,mBAAmB;aAGpC,MAAM,EAAE,MAAM,EAAE;gBADhC,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,MAAM,EAAE;CAKnC;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,mBAAmB;gBAC7C,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAOnD;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,mBAAmB;gBACjD,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,MAAU,EAAE,GAAG,GAAE,MAAW;CAO7D;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,mBAAmB;gBAEvD,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,KAAK;CAWhB;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,mBAAmB;gBACtC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI5C;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,mBAAmB;gBACtC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI5C;AAED;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,mBAAmB;gBACpD,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAOlE;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,uBAAwB,SAAQ,mBAAmB;gBAClD,SAAS,CAAC,EAAE,MAAM;CAO/B"}
|
package/dist/utils/errors.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom Error Types
|
|
3
|
-
*
|
|
4
|
-
* Defines custom error classes for better error handling and debugging.
|
|
5
|
-
*
|
|
6
|
-
* @module utils/errors
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Base error class for all knowledge graph errors.
|
|
10
|
-
* Extends the native Error class with additional context.
|
|
11
|
-
*/
|
|
12
|
-
export class KnowledgeGraphError extends Error {
|
|
13
|
-
code;
|
|
14
|
-
constructor(message, code) {
|
|
15
|
-
super(message);
|
|
16
|
-
this.code = code;
|
|
17
|
-
this.name = 'KnowledgeGraphError';
|
|
18
|
-
// Maintains proper stack trace in V8 engines
|
|
19
|
-
if (Error.captureStackTrace) {
|
|
20
|
-
Error.captureStackTrace(this, this.constructor);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Error thrown when an entity is not found.
|
|
26
|
-
*/
|
|
27
|
-
export class EntityNotFoundError extends KnowledgeGraphError {
|
|
28
|
-
constructor(entityName) {
|
|
29
|
-
super(`Entity "${entityName}" not found`, 'ENTITY_NOT_FOUND');
|
|
30
|
-
this.name = 'EntityNotFoundError';
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Error thrown when a relation is not found.
|
|
35
|
-
*/
|
|
36
|
-
export class RelationNotFoundError extends KnowledgeGraphError {
|
|
37
|
-
constructor(from, to, relationType) {
|
|
38
|
-
const desc = relationType
|
|
39
|
-
? `Relation "${from}" --[${relationType}]--> "${to}"`
|
|
40
|
-
: `Relation from "${from}" to "${to}"`;
|
|
41
|
-
super(`${desc} not found`, 'RELATION_NOT_FOUND');
|
|
42
|
-
this.name = 'RelationNotFoundError';
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Error thrown when attempting to create a duplicate entity.
|
|
47
|
-
*/
|
|
48
|
-
export class DuplicateEntityError extends KnowledgeGraphError {
|
|
49
|
-
constructor(entityName) {
|
|
50
|
-
super(`Entity "${entityName}" already exists`, 'DUPLICATE_ENTITY');
|
|
51
|
-
this.name = 'DuplicateEntityError';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Error thrown when validation fails.
|
|
56
|
-
*/
|
|
57
|
-
export class ValidationError extends KnowledgeGraphError {
|
|
58
|
-
errors;
|
|
59
|
-
constructor(message, errors) {
|
|
60
|
-
super(message, 'VALIDATION_ERROR');
|
|
61
|
-
this.errors = errors;
|
|
62
|
-
this.name = 'ValidationError';
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Error thrown when a cycle is detected in hierarchies.
|
|
67
|
-
*/
|
|
68
|
-
export class CycleDetectedError extends KnowledgeGraphError {
|
|
69
|
-
constructor(entityName, parentName) {
|
|
70
|
-
super(`Setting parent "${parentName}" for entity "${entityName}" would create a cycle`, 'CYCLE_DETECTED');
|
|
71
|
-
this.name = 'CycleDetectedError';
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Error thrown when an invalid importance value is provided.
|
|
76
|
-
*/
|
|
77
|
-
export class InvalidImportanceError extends KnowledgeGraphError {
|
|
78
|
-
constructor(value, min = 0, max = 10) {
|
|
79
|
-
super(`Importance must be between ${min} and ${max}, got ${value}`, 'INVALID_IMPORTANCE');
|
|
80
|
-
this.name = 'InvalidImportanceError';
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Error thrown when a file operation fails.
|
|
85
|
-
*/
|
|
86
|
-
export class FileOperationError extends KnowledgeGraphError {
|
|
87
|
-
constructor(operation, filePath, cause) {
|
|
88
|
-
super(`Failed to ${operation} file: ${filePath}${cause ? ` - ${cause.message}` : ''}`, 'FILE_OPERATION_ERROR');
|
|
89
|
-
this.name = 'FileOperationError';
|
|
90
|
-
if (cause) {
|
|
91
|
-
this.cause = cause;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Error thrown when an import operation fails.
|
|
97
|
-
*/
|
|
98
|
-
export class ImportError extends KnowledgeGraphError {
|
|
99
|
-
constructor(format, message) {
|
|
100
|
-
super(`Import failed (${format}): ${message}`, 'IMPORT_ERROR');
|
|
101
|
-
this.name = 'ImportError';
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Error thrown when an export operation fails.
|
|
106
|
-
*/
|
|
107
|
-
export class ExportError extends KnowledgeGraphError {
|
|
108
|
-
constructor(format, message) {
|
|
109
|
-
super(`Export failed (${format}): ${message}`, 'EXPORT_ERROR');
|
|
110
|
-
this.name = 'ExportError';
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Error thrown when insufficient entities are provided for an operation.
|
|
115
|
-
*/
|
|
116
|
-
export class InsufficientEntitiesError extends KnowledgeGraphError {
|
|
117
|
-
constructor(operation, required, provided) {
|
|
118
|
-
super(`${operation} requires at least ${required} entities, got ${provided}`, 'INSUFFICIENT_ENTITIES');
|
|
119
|
-
this.name = 'InsufficientEntitiesError';
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Phase 9B: Error thrown when an operation is cancelled via AbortSignal.
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```typescript
|
|
127
|
-
* const controller = new AbortController();
|
|
128
|
-
* try {
|
|
129
|
-
* await manager.createEntities(entities, { signal: controller.signal });
|
|
130
|
-
* } catch (error) {
|
|
131
|
-
* if (error instanceof OperationCancelledError) {
|
|
132
|
-
* console.log('Operation was cancelled');
|
|
133
|
-
* }
|
|
134
|
-
* }
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
export class OperationCancelledError extends KnowledgeGraphError {
|
|
138
|
-
constructor(operation) {
|
|
139
|
-
const message = operation
|
|
140
|
-
? `Operation '${operation}' was cancelled`
|
|
141
|
-
: 'Operation was cancelled';
|
|
142
|
-
super(message, 'OPERATION_CANCELLED');
|
|
143
|
-
this.name = 'OperationCancelledError';
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/utils/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACC;IAA7C,YAAY,OAAe,EAAkB,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,SAAI,GAAJ,IAAI,CAAS;QAExD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,6CAA6C;QAC7C,IAAI,KAAK,CAAC,iBAA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OAAO,yBAA0B,SAAQ,mBAAmB;IAChE,YAAY,SAAiB,EAAE,QAAgB,EAAE,QAAgB;QAC/D,KAAK,CACH,GAAG,SAAS,sBAAsB,QAAQ,kBAAkB,QAAQ,EAAE,EACtE,uBAAuB,CACxB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,uBAAwB,SAAQ,mBAAmB;IAC9D,YAAY,SAAkB;QAC5B,MAAM,OAAO,GAAG,SAAS;YACvB,CAAC,CAAC,cAAc,SAAS,iBAAiB;YAC1C,CAAC,CAAC,yBAAyB,CAAC;QAC9B,KAAK,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Response and Pagination Formatters
|
|
3
|
-
*
|
|
4
|
-
* Consolidated module for MCP tool response formatting and pagination utilities.
|
|
5
|
-
* Centralizes response formatting for MCP tool calls to eliminate redundant patterns.
|
|
6
|
-
*
|
|
7
|
-
* @module utils/formatters
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* MCP Tool Response type - uses the exact shape expected by the SDK.
|
|
11
|
-
* The 'as const' assertion ensures the type literal is preserved.
|
|
12
|
-
*/
|
|
13
|
-
export type ToolResponse = {
|
|
14
|
-
content: Array<{
|
|
15
|
-
type: 'text';
|
|
16
|
-
text: string;
|
|
17
|
-
}>;
|
|
18
|
-
isError?: boolean;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Formats data as an MCP tool response with JSON content.
|
|
22
|
-
* Centralizes the response format to ensure consistency and reduce duplication.
|
|
23
|
-
*
|
|
24
|
-
* @param data - Any data to be JSON stringified
|
|
25
|
-
* @returns Formatted MCP tool response
|
|
26
|
-
*/
|
|
27
|
-
export declare function formatToolResponse(data: unknown): {
|
|
28
|
-
content: {
|
|
29
|
-
type: "text";
|
|
30
|
-
text: string;
|
|
31
|
-
}[];
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Formats a simple text message as an MCP tool response.
|
|
35
|
-
* Use for success messages that don't need JSON formatting.
|
|
36
|
-
*
|
|
37
|
-
* @param message - Plain text message
|
|
38
|
-
* @returns Formatted MCP tool response
|
|
39
|
-
*/
|
|
40
|
-
export declare function formatTextResponse(message: string): {
|
|
41
|
-
content: {
|
|
42
|
-
type: "text";
|
|
43
|
-
text: string;
|
|
44
|
-
}[];
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Formats raw string content as an MCP tool response.
|
|
48
|
-
* Use for export formats that return pre-formatted strings (markdown, CSV, etc.)
|
|
49
|
-
*
|
|
50
|
-
* @param content - Raw string content
|
|
51
|
-
* @returns Formatted MCP tool response
|
|
52
|
-
*/
|
|
53
|
-
export declare function formatRawResponse(content: string): {
|
|
54
|
-
content: {
|
|
55
|
-
type: "text";
|
|
56
|
-
text: string;
|
|
57
|
-
}[];
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Formats an error as an MCP tool response with isError flag.
|
|
61
|
-
*
|
|
62
|
-
* @param error - Error object or message string
|
|
63
|
-
* @returns Formatted MCP tool error response
|
|
64
|
-
*/
|
|
65
|
-
export declare function formatErrorResponse(error: Error | string): {
|
|
66
|
-
content: {
|
|
67
|
-
type: "text";
|
|
68
|
-
text: string;
|
|
69
|
-
}[];
|
|
70
|
-
isError: boolean;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Validated pagination parameters with helper methods.
|
|
74
|
-
*/
|
|
75
|
-
export interface ValidatedPagination {
|
|
76
|
-
/** Validated offset (guaranteed >= 0) */
|
|
77
|
-
offset: number;
|
|
78
|
-
/** Validated limit (guaranteed within SEARCH_LIMITS.MIN to SEARCH_LIMITS.MAX) */
|
|
79
|
-
limit: number;
|
|
80
|
-
/**
|
|
81
|
-
* Check if there are more results beyond the current page.
|
|
82
|
-
* @param totalCount - Total number of items
|
|
83
|
-
* @returns true if there are more items after this page
|
|
84
|
-
*/
|
|
85
|
-
hasMore: (totalCount: number) => boolean;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Validates and normalizes pagination parameters.
|
|
89
|
-
* Ensures offset is non-negative and limit is within configured bounds.
|
|
90
|
-
*
|
|
91
|
-
* @param offset - Starting position (default: 0)
|
|
92
|
-
* @param limit - Maximum results to return (default: SEARCH_LIMITS.DEFAULT)
|
|
93
|
-
* @returns Validated pagination parameters with helper methods
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* const pagination = validatePagination(10, 50);
|
|
98
|
-
* const results = items.slice(pagination.offset, pagination.offset + pagination.limit);
|
|
99
|
-
* if (pagination.hasMore(items.length)) {
|
|
100
|
-
* console.log('More results available');
|
|
101
|
-
* }
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
export declare function validatePagination(offset?: number, limit?: number): ValidatedPagination;
|
|
105
|
-
/**
|
|
106
|
-
* Applies pagination to an array of items.
|
|
107
|
-
*
|
|
108
|
-
* @param items - Array to paginate
|
|
109
|
-
* @param pagination - Validated pagination parameters
|
|
110
|
-
* @returns Paginated slice of the array
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* const pagination = validatePagination(offset, limit);
|
|
115
|
-
* const pageResults = applyPagination(allResults, pagination);
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
export declare function applyPagination<T>(items: T[], pagination: ValidatedPagination): T[];
|
|
119
|
-
/**
|
|
120
|
-
* Applies pagination using raw offset and limit values.
|
|
121
|
-
* Combines validation and application in one call.
|
|
122
|
-
*
|
|
123
|
-
* @param items - Array to paginate
|
|
124
|
-
* @param offset - Starting position
|
|
125
|
-
* @param limit - Maximum results
|
|
126
|
-
* @returns Paginated slice of the array
|
|
127
|
-
*/
|
|
128
|
-
export declare function paginateArray<T>(items: T[], offset?: number, limit?: number): T[];
|
|
129
|
-
/**
|
|
130
|
-
* Calculates pagination metadata for a result set.
|
|
131
|
-
*
|
|
132
|
-
* @param totalCount - Total number of items
|
|
133
|
-
* @param offset - Current offset
|
|
134
|
-
* @param limit - Current limit
|
|
135
|
-
* @returns Pagination metadata
|
|
136
|
-
*/
|
|
137
|
-
export declare function getPaginationMeta(totalCount: number, offset?: number, limit?: number): {
|
|
138
|
-
totalCount: number;
|
|
139
|
-
offset: number;
|
|
140
|
-
limit: number;
|
|
141
|
-
hasMore: boolean;
|
|
142
|
-
pageNumber: number;
|
|
143
|
-
totalPages: number;
|
|
144
|
-
};
|
|
145
|
-
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO;;;;;EAI/C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM;;;;;EAIjD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM;;;;;EAIhD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;;;;;;EAMxD;AAID;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAA8B,GACpC,mBAAmB,CAYrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,KAAK,EAAE,CAAC,EAAE,EACV,UAAU,EAAE,mBAAmB,GAC9B,CAAC,EAAE,CAEL;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,EAAE,EACV,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAA8B,GACpC,CAAC,EAAE,CAGL;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAA8B,GACpC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAWA"}
|
package/dist/utils/formatters.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Response and Pagination Formatters
|
|
3
|
-
*
|
|
4
|
-
* Consolidated module for MCP tool response formatting and pagination utilities.
|
|
5
|
-
* Centralizes response formatting for MCP tool calls to eliminate redundant patterns.
|
|
6
|
-
*
|
|
7
|
-
* @module utils/formatters
|
|
8
|
-
*/
|
|
9
|
-
import { SEARCH_LIMITS } from './constants.js';
|
|
10
|
-
/**
|
|
11
|
-
* Formats data as an MCP tool response with JSON content.
|
|
12
|
-
* Centralizes the response format to ensure consistency and reduce duplication.
|
|
13
|
-
*
|
|
14
|
-
* @param data - Any data to be JSON stringified
|
|
15
|
-
* @returns Formatted MCP tool response
|
|
16
|
-
*/
|
|
17
|
-
export function formatToolResponse(data) {
|
|
18
|
-
return {
|
|
19
|
-
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Formats a simple text message as an MCP tool response.
|
|
24
|
-
* Use for success messages that don't need JSON formatting.
|
|
25
|
-
*
|
|
26
|
-
* @param message - Plain text message
|
|
27
|
-
* @returns Formatted MCP tool response
|
|
28
|
-
*/
|
|
29
|
-
export function formatTextResponse(message) {
|
|
30
|
-
return {
|
|
31
|
-
content: [{ type: 'text', text: message }],
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Formats raw string content as an MCP tool response.
|
|
36
|
-
* Use for export formats that return pre-formatted strings (markdown, CSV, etc.)
|
|
37
|
-
*
|
|
38
|
-
* @param content - Raw string content
|
|
39
|
-
* @returns Formatted MCP tool response
|
|
40
|
-
*/
|
|
41
|
-
export function formatRawResponse(content) {
|
|
42
|
-
return {
|
|
43
|
-
content: [{ type: 'text', text: content }],
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Formats an error as an MCP tool response with isError flag.
|
|
48
|
-
*
|
|
49
|
-
* @param error - Error object or message string
|
|
50
|
-
* @returns Formatted MCP tool error response
|
|
51
|
-
*/
|
|
52
|
-
export function formatErrorResponse(error) {
|
|
53
|
-
const message = error instanceof Error ? error.message : error;
|
|
54
|
-
return {
|
|
55
|
-
content: [{ type: 'text', text: message }],
|
|
56
|
-
isError: true,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Validates and normalizes pagination parameters.
|
|
61
|
-
* Ensures offset is non-negative and limit is within configured bounds.
|
|
62
|
-
*
|
|
63
|
-
* @param offset - Starting position (default: 0)
|
|
64
|
-
* @param limit - Maximum results to return (default: SEARCH_LIMITS.DEFAULT)
|
|
65
|
-
* @returns Validated pagination parameters with helper methods
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* const pagination = validatePagination(10, 50);
|
|
70
|
-
* const results = items.slice(pagination.offset, pagination.offset + pagination.limit);
|
|
71
|
-
* if (pagination.hasMore(items.length)) {
|
|
72
|
-
* console.log('More results available');
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
export function validatePagination(offset = 0, limit = SEARCH_LIMITS.DEFAULT) {
|
|
77
|
-
const validatedOffset = Math.max(0, offset);
|
|
78
|
-
const validatedLimit = Math.min(Math.max(SEARCH_LIMITS.MIN, limit), SEARCH_LIMITS.MAX);
|
|
79
|
-
return {
|
|
80
|
-
offset: validatedOffset,
|
|
81
|
-
limit: validatedLimit,
|
|
82
|
-
hasMore: (totalCount) => validatedOffset + validatedLimit < totalCount,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Applies pagination to an array of items.
|
|
87
|
-
*
|
|
88
|
-
* @param items - Array to paginate
|
|
89
|
-
* @param pagination - Validated pagination parameters
|
|
90
|
-
* @returns Paginated slice of the array
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* const pagination = validatePagination(offset, limit);
|
|
95
|
-
* const pageResults = applyPagination(allResults, pagination);
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
export function applyPagination(items, pagination) {
|
|
99
|
-
return items.slice(pagination.offset, pagination.offset + pagination.limit);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Applies pagination using raw offset and limit values.
|
|
103
|
-
* Combines validation and application in one call.
|
|
104
|
-
*
|
|
105
|
-
* @param items - Array to paginate
|
|
106
|
-
* @param offset - Starting position
|
|
107
|
-
* @param limit - Maximum results
|
|
108
|
-
* @returns Paginated slice of the array
|
|
109
|
-
*/
|
|
110
|
-
export function paginateArray(items, offset = 0, limit = SEARCH_LIMITS.DEFAULT) {
|
|
111
|
-
const pagination = validatePagination(offset, limit);
|
|
112
|
-
return applyPagination(items, pagination);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Calculates pagination metadata for a result set.
|
|
116
|
-
*
|
|
117
|
-
* @param totalCount - Total number of items
|
|
118
|
-
* @param offset - Current offset
|
|
119
|
-
* @param limit - Current limit
|
|
120
|
-
* @returns Pagination metadata
|
|
121
|
-
*/
|
|
122
|
-
export function getPaginationMeta(totalCount, offset = 0, limit = SEARCH_LIMITS.DEFAULT) {
|
|
123
|
-
const pagination = validatePagination(offset, limit);
|
|
124
|
-
return {
|
|
125
|
-
totalCount,
|
|
126
|
-
offset: pagination.offset,
|
|
127
|
-
limit: pagination.limit,
|
|
128
|
-
hasMore: pagination.hasMore(totalCount),
|
|
129
|
-
pageNumber: Math.floor(pagination.offset / pagination.limit) + 1,
|
|
130
|
-
totalPages: Math.ceil(totalCount / pagination.limit),
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAa/C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAa;IAC9C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,OAAO,EAAE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,MAAM,UAAU,aAAa,CAC3B,KAAU,EACV,SAAiB,CAAC,EAClB,QAAgB,aAAa,CAAC,OAAO;IAErC,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrD,OAAO,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAkB,EAClB,SAAiB,CAAC,EAClB,QAAgB,aAAa,CAAC,OAAO;IASrC,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAErD,OAAO;QACL,UAAU;QACV,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC;QACvC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;QAChE,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;KACrD,CAAC;AACJ,CAAC"}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities Module Barrel Export
|
|
3
|
-
*
|
|
4
|
-
* Centralizes all utility exports for convenient importing.
|
|
5
|
-
* Consolidated from 17 files to 9 focused modules (Phase 5 cleanup).
|
|
6
|
-
*
|
|
7
|
-
* @module utils
|
|
8
|
-
*/
|
|
9
|
-
export { KnowledgeGraphError, EntityNotFoundError, RelationNotFoundError, DuplicateEntityError, ValidationError, CycleDetectedError, InvalidImportanceError, FileOperationError, ImportError, ExportError, InsufficientEntitiesError, OperationCancelledError, } from './errors.js';
|
|
10
|
-
export { FILE_EXTENSIONS, FILE_SUFFIXES, DEFAULT_FILE_NAMES, ENV_VARS, DEFAULT_BASE_DIR, LOG_PREFIXES, SIMILARITY_WEIGHTS, DEFAULT_DUPLICATE_THRESHOLD, SEARCH_LIMITS, IMPORTANCE_RANGE, GRAPH_LIMITS, QUERY_LIMITS, COMPRESSION_CONFIG, STREAMING_CONFIG, type CompressionQuality, } from './constants.js';
|
|
11
|
-
export { compress, decompress, compressFile, decompressFile, compressToBase64, decompressFromBase64, hasBrotliExtension, getCompressionRatio, createMetadata, createUncompressedMetadata, type CompressionOptions, type CompressionResult, type CompressionMetadata, } from './compressionUtil.js';
|
|
12
|
-
export { CompressedCache, type CompressedCacheOptions, type CompressedCacheStats, } from './compressedCache.js';
|
|
13
|
-
export { logger } from './logger.js';
|
|
14
|
-
export { levenshteinDistance, calculateTF, calculateIDF, calculateIDFFromTokenSets, calculateTFIDF, tokenize, } from './searchAlgorithms.js';
|
|
15
|
-
export { NameIndex, TypeIndex, LowercaseCache, RelationIndex, } from './indexes.js';
|
|
16
|
-
export { SearchCache, searchCaches, clearAllSearchCaches, getAllCacheStats, cleanupAllCaches, type CacheStats, } from './searchCache.js';
|
|
17
|
-
export { EntitySchema, CreateEntitySchema, UpdateEntitySchema, RelationSchema, CreateRelationSchema, SearchQuerySchema, DateRangeSchema, TagAliasSchema, ExportFormatSchema, BatchCreateEntitiesSchema, BatchCreateRelationsSchema, EntityNamesSchema, DeleteRelationsSchema, AddObservationInputSchema, AddObservationsInputSchema, DeleteObservationInputSchema, DeleteObservationsInputSchema, ArchiveCriteriaSchema, SavedSearchInputSchema, SavedSearchUpdateSchema, ImportFormatSchema, ExtendedExportFormatSchema, MergeStrategySchema, ExportFilterSchema, OptionalTagsSchema, OptionalEntityNamesSchema, type EntityInput, type CreateEntityInput, type UpdateEntityInput, type RelationInput, type CreateRelationInput, type SearchQuery, type DateRange, type TagAliasInput, type AddObservationInput, type DeleteObservationInput, type ArchiveCriteriaInput, type SavedSearchInput, type SavedSearchUpdateInput, type ImportFormatInput, type ExtendedExportFormatInput, type MergeStrategyInput, type ExportFilterInput, type ValidationResult, formatZodErrors, validateWithSchema, validateSafe, validateArrayWithSchema, validateEntity, validateRelation, validateImportance, validateTags, } from './schemas.js';
|
|
18
|
-
export { formatToolResponse, formatTextResponse, formatRawResponse, formatErrorResponse, type ToolResponse, validatePagination, applyPagination, paginateArray, getPaginationMeta, type ValidatedPagination, } from './formatters.js';
|
|
19
|
-
export { fnv1aHash, findEntityByName, findEntitiesByNames, entityExists, getEntityIndex, removeEntityByName, getEntityNameSet, groupEntitiesByType, touchEntity, normalizeTag, normalizeTags, hasMatchingTag, hasAllTags, filterByTags, addUniqueTags, removeTags, isWithinDateRange, parseDateRange, isValidISODate, getCurrentTimestamp, isWithinImportanceRange, filterByImportance, filterByCreatedDate, filterByModifiedDate, filterByEntityType, entityPassesFilters, type CommonSearchFilters, validateFilePath, defaultMemoryPath, ensureMemoryFilePath, sanitizeObject, escapeCsvFormula, } from './entityUtils.js';
|
|
20
|
-
export { parallelMap, parallelFilter, getPoolStats, shutdownParallelUtils, } from './parallelUtils.js';
|
|
21
|
-
export { TaskPriority, TaskStatus, type Task, type TaskResult, type ProgressCallback, type TaskBatchOptions, type QueueStats, TaskQueue, batchProcess, rateLimitedProcess, withRetry, debounce, throttle, } from './taskScheduler.js';
|
|
22
|
-
export { checkCancellation, createProgressReporter, createProgress, executeWithPhases, processBatchesWithProgress, type PhaseDefinition, } from './operationUtils.js';
|
|
23
|
-
export { WorkerPoolManager, getWorkerPoolManager, type WorkerPoolConfig, type ExtendedPoolStats, type PoolEventCallback, } from './WorkerPoolManager.js';
|
|
24
|
-
export { BatchProcessor, processBatch, processWithRetry, chunkArray, parallelLimit, mapParallel, filterParallel, type BatchProgress, type BatchProgressCallback, type BatchItemResult, type BatchProcessResult, type BatchProcessorOptions, } from './BatchProcessor.js';
|
|
25
|
-
export { MemoryMonitor, globalMemoryMonitor, type ComponentMemoryUsage, type MemoryUsageStats, type MemoryThresholds, type MemoryAlert, type MemoryChangeCallback, } from './MemoryMonitor.js';
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,EAC3B,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,cAAc,EACd,QAAQ,GACT,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,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B,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC"}
|
package/dist/utils/index.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities Module Barrel Export
|
|
3
|
-
*
|
|
4
|
-
* Centralizes all utility exports for convenient importing.
|
|
5
|
-
* Consolidated from 17 files to 9 focused modules (Phase 5 cleanup).
|
|
6
|
-
*
|
|
7
|
-
* @module utils
|
|
8
|
-
*/
|
|
9
|
-
// ==================== Error Types ====================
|
|
10
|
-
export { KnowledgeGraphError, EntityNotFoundError, RelationNotFoundError, DuplicateEntityError, ValidationError, CycleDetectedError, InvalidImportanceError, FileOperationError, ImportError, ExportError, InsufficientEntitiesError, OperationCancelledError, } from './errors.js';
|
|
11
|
-
// ==================== Constants ====================
|
|
12
|
-
export { FILE_EXTENSIONS, FILE_SUFFIXES, DEFAULT_FILE_NAMES, ENV_VARS, DEFAULT_BASE_DIR, LOG_PREFIXES, SIMILARITY_WEIGHTS, DEFAULT_DUPLICATE_THRESHOLD, SEARCH_LIMITS, IMPORTANCE_RANGE, GRAPH_LIMITS, QUERY_LIMITS, COMPRESSION_CONFIG, STREAMING_CONFIG, } from './constants.js';
|
|
13
|
-
// ==================== Compression Utilities ====================
|
|
14
|
-
export { compress, decompress, compressFile, decompressFile, compressToBase64, decompressFromBase64, hasBrotliExtension, getCompressionRatio, createMetadata, createUncompressedMetadata, } from './compressionUtil.js';
|
|
15
|
-
// ==================== Compressed Cache ====================
|
|
16
|
-
export { CompressedCache, } from './compressedCache.js';
|
|
17
|
-
// ==================== Logger ====================
|
|
18
|
-
export { logger } from './logger.js';
|
|
19
|
-
// ==================== Search Algorithms ====================
|
|
20
|
-
export { levenshteinDistance, calculateTF, calculateIDF, calculateIDFFromTokenSets, calculateTFIDF, tokenize, } from './searchAlgorithms.js';
|
|
21
|
-
// ==================== Indexes ====================
|
|
22
|
-
export { NameIndex, TypeIndex, LowercaseCache, RelationIndex, } from './indexes.js';
|
|
23
|
-
// ==================== Search Cache ====================
|
|
24
|
-
export { SearchCache, searchCaches, clearAllSearchCaches, getAllCacheStats, cleanupAllCaches, } from './searchCache.js';
|
|
25
|
-
// ==================== Schemas and Validation ====================
|
|
26
|
-
// Consolidated from: schemas.ts, validationHelper.ts, validationUtils.ts
|
|
27
|
-
export {
|
|
28
|
-
// Zod schemas - Entity/Relation
|
|
29
|
-
EntitySchema, CreateEntitySchema, UpdateEntitySchema, RelationSchema, CreateRelationSchema, SearchQuerySchema, DateRangeSchema, TagAliasSchema, ExportFormatSchema, BatchCreateEntitiesSchema, BatchCreateRelationsSchema, EntityNamesSchema, DeleteRelationsSchema,
|
|
30
|
-
// Zod schemas - Observations
|
|
31
|
-
AddObservationInputSchema, AddObservationsInputSchema, DeleteObservationInputSchema, DeleteObservationsInputSchema,
|
|
32
|
-
// Zod schemas - Archive
|
|
33
|
-
ArchiveCriteriaSchema,
|
|
34
|
-
// Zod schemas - Saved Search
|
|
35
|
-
SavedSearchInputSchema, SavedSearchUpdateSchema,
|
|
36
|
-
// Zod schemas - Import/Export
|
|
37
|
-
ImportFormatSchema, ExtendedExportFormatSchema, MergeStrategySchema, ExportFilterSchema,
|
|
38
|
-
// Zod schemas - Search
|
|
39
|
-
OptionalTagsSchema, OptionalEntityNamesSchema,
|
|
40
|
-
// Zod helpers
|
|
41
|
-
formatZodErrors, validateWithSchema, validateSafe, validateArrayWithSchema,
|
|
42
|
-
// Manual validation functions
|
|
43
|
-
validateEntity, validateRelation, validateImportance, validateTags, } from './schemas.js';
|
|
44
|
-
// ==================== Formatters ====================
|
|
45
|
-
// Consolidated from: responseFormatter.ts, paginationUtils.ts
|
|
46
|
-
export {
|
|
47
|
-
// Response formatting
|
|
48
|
-
formatToolResponse, formatTextResponse, formatRawResponse, formatErrorResponse,
|
|
49
|
-
// Pagination utilities
|
|
50
|
-
validatePagination, applyPagination, paginateArray, getPaginationMeta, } from './formatters.js';
|
|
51
|
-
// ==================== Entity Utilities ====================
|
|
52
|
-
// Consolidated from: entityUtils.ts, tagUtils.ts, dateUtils.ts, filterUtils.ts, pathUtils.ts
|
|
53
|
-
export {
|
|
54
|
-
// Hash functions (Phase 12 Sprint 1)
|
|
55
|
-
fnv1aHash,
|
|
56
|
-
// Entity lookup
|
|
57
|
-
findEntityByName, findEntitiesByNames, entityExists, getEntityIndex, removeEntityByName, getEntityNameSet, groupEntitiesByType, touchEntity,
|
|
58
|
-
// Tag utilities
|
|
59
|
-
normalizeTag, normalizeTags, hasMatchingTag, hasAllTags, filterByTags, addUniqueTags, removeTags,
|
|
60
|
-
// Date utilities
|
|
61
|
-
isWithinDateRange, parseDateRange, isValidISODate, getCurrentTimestamp,
|
|
62
|
-
// Filter utilities
|
|
63
|
-
isWithinImportanceRange, filterByImportance, filterByCreatedDate, filterByModifiedDate, filterByEntityType, entityPassesFilters,
|
|
64
|
-
// Path utilities
|
|
65
|
-
validateFilePath, defaultMemoryPath, ensureMemoryFilePath,
|
|
66
|
-
// Security utilities
|
|
67
|
-
sanitizeObject, escapeCsvFormula, } from './entityUtils.js';
|
|
68
|
-
// ==================== Parallel Utilities ====================
|
|
69
|
-
export { parallelMap, parallelFilter, getPoolStats, shutdownParallelUtils, } from './parallelUtils.js';
|
|
70
|
-
// ==================== Task Scheduler ====================
|
|
71
|
-
export {
|
|
72
|
-
// Types and Enums
|
|
73
|
-
TaskPriority, TaskStatus,
|
|
74
|
-
// Task Queue
|
|
75
|
-
TaskQueue,
|
|
76
|
-
// Batch Processing
|
|
77
|
-
batchProcess, rateLimitedProcess, withRetry,
|
|
78
|
-
// Rate Limiting
|
|
79
|
-
debounce, throttle, } from './taskScheduler.js';
|
|
80
|
-
// ==================== Operation Utilities (Phase 9B) ====================
|
|
81
|
-
export { checkCancellation, createProgressReporter, createProgress, executeWithPhases, processBatchesWithProgress, } from './operationUtils.js';
|
|
82
|
-
// ==================== Worker Pool Manager (Phase 12 Sprint 2) ====================
|
|
83
|
-
export { WorkerPoolManager, getWorkerPoolManager, } from './WorkerPoolManager.js';
|
|
84
|
-
// ==================== Batch Processor (Phase 12 Sprint 2) ====================
|
|
85
|
-
export { BatchProcessor, processBatch, processWithRetry, chunkArray, parallelLimit, mapParallel, filterParallel, } from './BatchProcessor.js';
|
|
86
|
-
// ==================== Memory Monitor (Phase 12 Sprint 6) ====================
|
|
87
|
-
export { MemoryMonitor, globalMemoryMonitor, } from './MemoryMonitor.js';
|
|
88
|
-
//# sourceMappingURL=index.js.map
|