@soulcraft/brainy 0.24.0 → 0.26.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 +22 -16
- package/dist/brainy.js +4553 -2264
- package/dist/brainy.min.js +750 -750
- package/dist/brainyData.d.ts +141 -0
- package/dist/coreTypes.d.ts +31 -0
- package/dist/errors/brainyError.d.ts +45 -0
- package/dist/hnsw/hnswIndexOptimized.d.ts +13 -1
- package/dist/hnsw/hnswIndexOptimized.d.ts.map +1 -1
- package/dist/statistics/statisticsManager.d.ts +121 -0
- package/dist/storage/adapters/fileSystemStorage.d.ts +99 -30
- package/dist/storage/adapters/fileSystemStorage.d.ts.map +1 -1
- package/dist/storage/adapters/memoryStorage.d.ts.map +1 -1
- package/dist/storage/adapters/opfsStorage.d.ts +21 -1
- package/dist/storage/adapters/opfsStorage.d.ts.map +1 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +58 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts.map +1 -1
- package/dist/storage/fileSystemStorage.d.ts +2 -15
- package/dist/storage/fileSystemStorage.d.ts.map +1 -1
- package/dist/storage/opfsStorage.d.ts +3 -66
- package/dist/storage/opfsStorage.d.ts.map +1 -1
- package/dist/storage/s3CompatibleStorage.d.ts +2 -14
- package/dist/storage/s3CompatibleStorage.d.ts.map +1 -1
- package/dist/storage/storageFactory.d.ts +6 -1
- package/dist/storage/storageFactory.d.ts.map +1 -1
- package/dist/testing/prettyReporter.d.ts +23 -0
- package/dist/testing/prettySummaryReporter.d.ts +22 -0
- package/dist/types/tensorflowTypes.d.ts +0 -8
- package/dist/types/tensorflowTypes.d.ts.map +1 -1
- package/dist/unified.d.ts +4 -0
- package/dist/unified.js +3170 -1464
- package/dist/unified.min.js +750 -750
- package/dist/utils/embedding.d.ts +7 -0
- package/dist/utils/embedding.d.ts.map +1 -1
- package/dist/utils/environmentDetection.d.ts +47 -0
- package/dist/utils/environmentDetection.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +99 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/operationUtils.d.ts +58 -0
- package/dist/utils/operationUtils.d.ts.map +1 -0
- package/dist/utils/textEncoding.d.ts +0 -7
- package/dist/utils/textEncoding.d.ts.map +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/package.json +14 -3
- package/dist/augmentations/conduitAugmentations.js +0 -1158
- package/dist/augmentations/conduitAugmentations.js.map +0 -1
- package/dist/augmentations/memoryAugmentations.js +0 -255
- package/dist/augmentations/memoryAugmentations.js.map +0 -1
- package/dist/augmentations/serverSearchAugmentations.js +0 -531
- package/dist/augmentations/serverSearchAugmentations.js.map +0 -1
- package/dist/examples/basicUsage.js +0 -128
- package/dist/examples/basicUsage.js.map +0 -1
- package/dist/hnsw/hnswIndex.js +0 -550
- package/dist/hnsw/hnswIndex.js.map +0 -1
- package/dist/hnsw/hnswIndexOptimized.js +0 -441
- package/dist/hnsw/hnswIndexOptimized.js.map +0 -1
- package/dist/mcp/brainyMCPAdapter.js +0 -142
- package/dist/mcp/brainyMCPAdapter.js.map +0 -1
- package/dist/mcp/brainyMCPService.js +0 -248
- package/dist/mcp/brainyMCPService.js.map +0 -1
- package/dist/mcp/index.js +0 -17
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/mcpAugmentationToolset.js +0 -180
- package/dist/mcp/mcpAugmentationToolset.js.map +0 -1
- package/dist/storage/adapters/baseStorageAdapter.js +0 -233
- package/dist/storage/adapters/baseStorageAdapter.js.map +0 -1
- package/dist/storage/adapters/fileSystemStorage.js +0 -568
- package/dist/storage/adapters/fileSystemStorage.js.map +0 -1
- package/dist/storage/adapters/memoryStorage.js +0 -300
- package/dist/storage/adapters/memoryStorage.js.map +0 -1
- package/dist/storage/adapters/opfsStorage.js +0 -778
- package/dist/storage/adapters/opfsStorage.js.map +0 -1
- package/dist/storage/adapters/s3CompatibleStorage.js +0 -1021
- package/dist/storage/adapters/s3CompatibleStorage.js.map +0 -1
- package/dist/storage/baseStorage.js +0 -126
- package/dist/storage/baseStorage.js.map +0 -1
- package/dist/storage/storageFactory.js +0 -183
- package/dist/storage/storageFactory.js.map +0 -1
- package/dist/types/augmentations.js +0 -16
- package/dist/types/augmentations.js.map +0 -1
- package/dist/types/brainyDataInterface.js +0 -8
- package/dist/types/brainyDataInterface.js.map +0 -1
- package/dist/types/fileSystemTypes.js +0 -8
- package/dist/types/fileSystemTypes.js.map +0 -1
- package/dist/types/graphTypes.js +0 -36
- package/dist/types/graphTypes.js.map +0 -1
- package/dist/types/mcpTypes.js +0 -22
- package/dist/types/mcpTypes.js.map +0 -1
- package/dist/types/pipelineTypes.js +0 -7
- package/dist/types/pipelineTypes.js.map +0 -1
- package/dist/types/tensorflowTypes.js +0 -6
- package/dist/types/tensorflowTypes.js.map +0 -1
- package/dist/utils/distance.js +0 -239
- package/dist/utils/distance.js.map +0 -1
- package/dist/utils/embedding.js +0 -622
- package/dist/utils/embedding.js.map +0 -1
- package/dist/utils/environment.js +0 -75
- package/dist/utils/environment.js.map +0 -1
- package/dist/utils/index.js +0 -5
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/statistics.js +0 -25
- package/dist/utils/statistics.js.map +0 -1
- package/dist/utils/tensorflowUtils.js +0 -25
- package/dist/utils/tensorflowUtils.js.map +0 -1
- package/dist/utils/textEncoding.js +0 -281
- package/dist/utils/textEncoding.js.map +0 -1
- package/dist/utils/workerUtils.js +0 -458
- package/dist/utils/workerUtils.js.map +0 -1
|
@@ -59,6 +59,13 @@ export declare class UniversalSentenceEncoder implements EmbeddingModel {
|
|
|
59
59
|
* Embed text into a vector using Universal Sentence Encoder
|
|
60
60
|
* @param data Text to embed
|
|
61
61
|
*/
|
|
62
|
+
/**
|
|
63
|
+
* Generate a deterministic vector from a string
|
|
64
|
+
* This is used as a fallback when the Universal Sentence Encoder is not available
|
|
65
|
+
* @param text Input text
|
|
66
|
+
* @returns A 512-dimensional vector derived from the text
|
|
67
|
+
*/
|
|
68
|
+
private generateFallbackVector;
|
|
62
69
|
embed(data: string | string[]): Promise<Vector>;
|
|
63
70
|
/**
|
|
64
71
|
* Embed multiple texts into vectors using Universal Sentence Encoder
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/utils/embedding.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/utils/embedding.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAI3E;;;;;;;GAOG;AACH,qBAAa,wBAAyB,YAAW,cAAc;IAC7D,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,EAAE,CAAY;IACtB,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;OAGG;gBACS,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO;IAI/C;;;;;;;;OAQG;IACH,OAAO,CAAC,+BAA+B;IA4CvC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;IACH,OAAO,CAAC,MAAM;IAWd;;;;;;OAMG;YACW,kBAAkB;IAkIhC;;OAEG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgKlC;;;OAGG;IACH;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IA0CjB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAyG5D;;;;;OAKG;IACU,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAoH/D;;OAEG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAiBtC;AAsID;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,CAAC,EAAE,cAAc,GACrB,iBAAiB,CASnB;AAcD,wBAAgB,iCAAiC,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,iBAAiB,CAiCxG;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,iBAAiB,CAElG;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBAAiD,CAAA;AAexF,wBAAgB,4BAA4B,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,CACjF,SAAS,EAAE,MAAM,EAAE,KAChB,OAAO,CAAC,MAAM,EAAE,CAAC,CA2BrB;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,CACrF,SAAS,EAAE,MAAM,EAAE,KAChB,OAAO,CAAC,MAAM,EAAE,CAAC,CAErB;AAED;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,cAX7B,MAAM,EAAE,KAChB,OAAO,CAAC,MAAM,EAAE,CAU0D,CAAA;AAE/E;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,cAAc,GACpB,iBAAiB,CAUnB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Detection Utilities
|
|
3
|
+
* Detects environment characteristics to determine if statistics synchronization is needed
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Environment detection result
|
|
7
|
+
*/
|
|
8
|
+
export interface EnvironmentInfo {
|
|
9
|
+
/** Whether the environment supports multi-instance scenarios */
|
|
10
|
+
supportsMultiInstance: boolean;
|
|
11
|
+
/** Whether statistics synchronization should be enabled by default */
|
|
12
|
+
needsStatisticsSynchronization: boolean;
|
|
13
|
+
/** The detected environment type */
|
|
14
|
+
environmentType: 'browser' | 'node' | 'worker' | 'unknown';
|
|
15
|
+
/** Whether the environment is likely to be used in production */
|
|
16
|
+
isProduction: boolean;
|
|
17
|
+
/** Additional environment details */
|
|
18
|
+
details: {
|
|
19
|
+
hasProcess: boolean;
|
|
20
|
+
hasWindow: boolean;
|
|
21
|
+
hasWorker: boolean;
|
|
22
|
+
nodeVersion?: string;
|
|
23
|
+
userAgent?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Detect the current environment and determine if statistics synchronization is needed
|
|
28
|
+
* @returns Environment information including synchronization requirements
|
|
29
|
+
*/
|
|
30
|
+
export declare function detectEnvironment(): EnvironmentInfo;
|
|
31
|
+
/**
|
|
32
|
+
* Check if statistics synchronization should be enabled for a given storage type
|
|
33
|
+
* @param storageType The type of storage being used
|
|
34
|
+
* @param environmentInfo Optional environment info (will be detected if not provided)
|
|
35
|
+
* @returns Whether statistics synchronization should be enabled
|
|
36
|
+
*/
|
|
37
|
+
export declare function shouldEnableStatisticsSynchronization(storageType: string, environmentInfo?: EnvironmentInfo): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get recommended storage configuration based on environment
|
|
40
|
+
* @param environmentInfo Optional environment info (will be detected if not provided)
|
|
41
|
+
* @returns Recommended storage configuration
|
|
42
|
+
*/
|
|
43
|
+
export declare function getRecommendedStorageConfig(environmentInfo?: EnvironmentInfo): {
|
|
44
|
+
type: string;
|
|
45
|
+
enableStatisticsSynchronization: boolean;
|
|
46
|
+
reason: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environmentDetection.d.ts","sourceRoot":"","sources":["../../src/utils/environmentDetection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,qBAAqB,EAAE,OAAO,CAAA;IAC9B,sEAAsE;IACtE,8BAA8B,EAAE,OAAO,CAAA;IACvC,oCAAoC;IACpC,eAAe,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;IAC1D,iEAAiE;IACjE,YAAY,EAAE,OAAO,CAAA;IACrB,qCAAqC;IACrC,OAAO,EAAE;QACP,UAAU,EAAE,OAAO,CAAA;QACnB,SAAS,EAAE,OAAO,CAAA;QAClB,SAAS,EAAE,OAAO,CAAA;QAClB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,eAAe,CAkDnD;AAED;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,WAAW,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,eAAe,GAChC,OAAO,CA2BT;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG;IAC9E,IAAI,EAAE,MAAM,CAAA;IACZ,+BAA+B,EAAE,OAAO,CAAA;IACxC,MAAM,EAAE,MAAM,CAAA;CACf,CAoCA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized logging utility for Brainy
|
|
3
|
+
*
|
|
4
|
+
* This utility provides controlled logging that can be enabled/disabled
|
|
5
|
+
* based on debug mode configuration. By default, all logging is disabled
|
|
6
|
+
* unless explicitly enabled via environment variables or configuration.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Logger configuration interface
|
|
10
|
+
*/
|
|
11
|
+
export interface LoggerConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Whether debug logging is enabled
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
debug?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to show log prefixes
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
showPrefix?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Custom prefix for log messages
|
|
24
|
+
* @default 'Brainy'
|
|
25
|
+
*/
|
|
26
|
+
prefix?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Configure the global logger
|
|
30
|
+
*/
|
|
31
|
+
export declare function configureLogger(config: LoggerConfig): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get current logger configuration
|
|
34
|
+
*/
|
|
35
|
+
export declare function getLoggerConfig(): Required<LoggerConfig>;
|
|
36
|
+
/**
|
|
37
|
+
* Check if debug mode is enabled
|
|
38
|
+
*/
|
|
39
|
+
export declare function isDebugEnabled(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Controlled logging methods
|
|
42
|
+
*/
|
|
43
|
+
export declare const logger: {
|
|
44
|
+
/**
|
|
45
|
+
* Log debug information (only shown when debug mode is enabled)
|
|
46
|
+
*/
|
|
47
|
+
debug: (message: string, ...args: any[]) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Log informational messages (only shown when debug mode is enabled)
|
|
50
|
+
*/
|
|
51
|
+
info: (message: string, ...args: any[]) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Log warning messages (always shown, but can be controlled)
|
|
54
|
+
*/
|
|
55
|
+
warn: (message: string, ...args: any[]) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Log error messages (always shown)
|
|
58
|
+
*/
|
|
59
|
+
error: (message: string, ...args: any[]) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Log with custom prefix (only shown when debug mode is enabled)
|
|
62
|
+
*/
|
|
63
|
+
debugWithPrefix: (prefix: string, message: string, ...args: any[]) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Log info with custom prefix (only shown when debug mode is enabled)
|
|
66
|
+
*/
|
|
67
|
+
infoWithPrefix: (prefix: string, message: string, ...args: any[]) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Log warning with custom prefix (controlled by debug mode)
|
|
70
|
+
*/
|
|
71
|
+
warnWithPrefix: (prefix: string, message: string, ...args: any[]) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Log error with custom prefix (always shown)
|
|
74
|
+
*/
|
|
75
|
+
errorWithPrefix: (prefix: string, message: string, ...args: any[]) => void;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Legacy console methods for backward compatibility
|
|
79
|
+
* These will respect the debug mode setting
|
|
80
|
+
*/
|
|
81
|
+
export declare const debugConsole: {
|
|
82
|
+
log: (message: string, ...args: any[]) => void;
|
|
83
|
+
debug: (message: string, ...args: any[]) => void;
|
|
84
|
+
info: (message: string, ...args: any[]) => void;
|
|
85
|
+
warn: (message: string, ...args: any[]) => void;
|
|
86
|
+
error: (message: string, ...args: any[]) => void;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Enable debug mode programmatically
|
|
90
|
+
*/
|
|
91
|
+
export declare function enableDebugMode(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Disable debug mode programmatically
|
|
94
|
+
*/
|
|
95
|
+
export declare function disableDebugMode(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Create a scoped logger with a specific prefix
|
|
98
|
+
*/
|
|
99
|
+
export declare function createScopedLogger(prefix: string): typeof logger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAqDD;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED;;GAEG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
|
4
|
+
*/
|
|
5
|
+
export interface TimeoutConfig {
|
|
6
|
+
get?: number;
|
|
7
|
+
add?: number;
|
|
8
|
+
delete?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RetryConfig {
|
|
11
|
+
maxRetries?: number;
|
|
12
|
+
initialDelay?: number;
|
|
13
|
+
maxDelay?: number;
|
|
14
|
+
backoffMultiplier?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface OperationConfig {
|
|
17
|
+
timeouts?: TimeoutConfig;
|
|
18
|
+
retryPolicy?: RetryConfig;
|
|
19
|
+
}
|
|
20
|
+
export declare const DEFAULT_TIMEOUTS: Required<TimeoutConfig>;
|
|
21
|
+
export declare const DEFAULT_RETRY_POLICY: Required<RetryConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* Wraps a promise with a timeout
|
|
24
|
+
*/
|
|
25
|
+
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, operation: string): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Executes an operation with retry logic and exponential backoff
|
|
28
|
+
*/
|
|
29
|
+
export declare function withRetry<T>(operation: () => Promise<T>, operationName: string, config?: RetryConfig): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Executes an operation with both timeout and retry logic
|
|
32
|
+
*/
|
|
33
|
+
export declare function withTimeoutAndRetry<T>(operation: () => Promise<T>, operationName: string, timeoutMs: number, retryConfig?: RetryConfig): Promise<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a configured operation executor for a specific operation type
|
|
36
|
+
*/
|
|
37
|
+
export declare function createOperationExecutor(operationType: keyof TimeoutConfig, config?: OperationConfig): <T>(operation: () => Promise<T>, operationName: string) => Promise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Storage operation executors for different operation types
|
|
40
|
+
*/
|
|
41
|
+
export declare class StorageOperationExecutors {
|
|
42
|
+
private getExecutor;
|
|
43
|
+
private addExecutor;
|
|
44
|
+
private deleteExecutor;
|
|
45
|
+
constructor(config?: OperationConfig);
|
|
46
|
+
/**
|
|
47
|
+
* Execute a get operation with timeout and retry
|
|
48
|
+
*/
|
|
49
|
+
executeGet<T>(operation: () => Promise<T>, operationName: string): Promise<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Execute an add operation with timeout and retry
|
|
52
|
+
*/
|
|
53
|
+
executeAdd<T>(operation: () => Promise<T>, operationName: string): Promise<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Execute a delete operation with timeout and retry
|
|
56
|
+
*/
|
|
57
|
+
executeDelete<T>(operation: () => Promise<T>, operationName: string): Promise<T>;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationUtils.d.ts","sourceRoot":"","sources":["../../src/utils/operationUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,aAAa;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,EAAE,aAAa,CAAA;IACxB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC5B;AAGD,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,aAAa,CAIpD,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAKtD,CAAA;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EACzB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,CAAC,CAAC,CAgBZ;AAsBD;;GAEG;A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
|
-
let __TextEncoder__: typeof TextEncoder;
|
|
4
|
-
let __TextDecoder__: typeof TextDecoder;
|
|
5
|
-
let __brainy_util__: any;
|
|
6
|
-
let __utilShim: any;
|
|
7
|
-
}
|
|
8
1
|
/**
|
|
9
2
|
* Apply the TensorFlow.js platform patch if it hasn't been applied already
|
|
10
3
|
* This is a safety measure in case the module-level patch didn't run
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textEncoding.d.ts","sourceRoot":"","sources":["../../src/utils/textEncoding.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"textEncoding.d.ts","sourceRoot":"","sources":["../../src/utils/textEncoding.ts"],"names":[],"mappings":"AA4QA;;;;GAIG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAqE1D;AAED,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
package/dist/utils/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "A vector graph database using HNSW indexing with Origin Private File System storage",
|
|
5
5
|
"main": "dist/unified.js",
|
|
6
6
|
"module": "dist/unified.js",
|
|
@@ -74,7 +74,15 @@
|
|
|
74
74
|
"test:core": "vitest run tests/core.test.ts",
|
|
75
75
|
"test:coverage": "vitest run --coverage",
|
|
76
76
|
"test:size": "vitest run tests/package-size-limit.test.ts",
|
|
77
|
-
"test:all": "npm run build && vitest run"
|
|
77
|
+
"test:all": "npm run build && vitest run",
|
|
78
|
+
"test:report:json": "vitest run --reporter json",
|
|
79
|
+
"test:error-handling": "vitest run tests/error-handling.test.ts",
|
|
80
|
+
"test:edge-cases": "vitest run tests/edge-cases.test.ts",
|
|
81
|
+
"test:storage": "vitest run tests/storage-adapter-coverage.test.ts",
|
|
82
|
+
"test:environments": "vitest run tests/multi-environment.test.ts",
|
|
83
|
+
"test:specialized": "vitest run tests/specialized-scenarios.test.ts",
|
|
84
|
+
"test:performance": "vitest run tests/performance.test.ts",
|
|
85
|
+
"test:comprehensive": "npm run test:error-handling && npm run test:edge-cases && npm run test:storage && npm run test:environments && npm run test:specialized"
|
|
78
86
|
},
|
|
79
87
|
"keywords": [
|
|
80
88
|
"vector-database",
|
|
@@ -122,6 +130,7 @@
|
|
|
122
130
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
123
131
|
"@rollup/plugin-replace": "^5.0.5",
|
|
124
132
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
133
|
+
"@types/express": "^5.0.3",
|
|
125
134
|
"@types/jsdom": "^21.1.7",
|
|
126
135
|
"@types/node": "^20.11.30",
|
|
127
136
|
"@types/uuid": "^10.0.0",
|
|
@@ -129,10 +138,11 @@
|
|
|
129
138
|
"@typescript-eslint/parser": "^7.4.0",
|
|
130
139
|
"@vitest/coverage-v8": "^3.2.4",
|
|
131
140
|
"@vitest/ui": "^3.2.4",
|
|
132
|
-
"dotenv": "^17.2.1",
|
|
133
141
|
"eslint": "^8.57.0",
|
|
142
|
+
"express": "^5.1.0",
|
|
134
143
|
"happy-dom": "^18.0.1",
|
|
135
144
|
"jsdom": "^26.1.0",
|
|
145
|
+
"node-fetch": "^3.3.2",
|
|
136
146
|
"puppeteer": "^22.5.0",
|
|
137
147
|
"rollup": "^4.13.0",
|
|
138
148
|
"rollup-plugin-terser": "^7.0.2",
|
|
@@ -149,6 +159,7 @@
|
|
|
149
159
|
"@tensorflow/tfjs-converter": "^4.22.0",
|
|
150
160
|
"@tensorflow/tfjs-core": "^4.22.0",
|
|
151
161
|
"buffer": "^6.0.3",
|
|
162
|
+
"dotenv": "^16.4.5",
|
|
152
163
|
"uuid": "^9.0.1"
|
|
153
164
|
},
|
|
154
165
|
"prettier": {
|