@soulcraft/brainy 0.28.0 → 0.30.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 +71 -0
- package/dist/brainy.js +90220 -0
- package/dist/brainy.min.js +12511 -0
- package/dist/brainyData.d.ts +53 -0
- package/dist/coreTypes.d.ts +75 -0
- package/dist/hnsw/hnswIndex.d.ts +15 -0
- package/dist/hnsw/hnswIndex.d.ts.map +1 -1
- package/dist/statistics/statisticsManager.d.ts +121 -0
- package/dist/storage/adapters/baseStorageAdapter.d.ts +46 -0
- package/dist/storage/adapters/baseStorageAdapter.d.ts.map +1 -1
- package/dist/storage/adapters/memoryStorage.d.ts +41 -0
- package/dist/storage/adapters/memoryStorage.d.ts.map +1 -1
- package/dist/storage/baseStorage.d.ts +46 -0
- package/dist/storage/baseStorage.d.ts.map +1 -1
- package/dist/storage/fileSystemStorage.d.ts +73 -0
- package/dist/storage/fileSystemStorage.d.ts.map +1 -0
- package/dist/storage/opfsStorage.d.ts +236 -0
- package/dist/storage/opfsStorage.d.ts.map +1 -0
- package/dist/storage/s3CompatibleStorage.d.ts +157 -0
- package/dist/storage/s3CompatibleStorage.d.ts.map +1 -0
- package/dist/types/paginationTypes.d.ts +111 -0
- package/dist/types/paginationTypes.d.ts.map +1 -0
- package/dist/unified.js +782 -86
- package/dist/unified.min.js +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/version.d.ts +5 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/package.json +15 -8
|
@@ -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,CA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ourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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",
|
|
@@ -54,19 +54,25 @@
|
|
|
54
54
|
"build:browser": "BUILD_TYPE=browser rollup -c rollup.config.js",
|
|
55
55
|
"start": "node dist/unified.js",
|
|
56
56
|
"demo": "npm run build && npm run build:browser && npx http-server -o /demo/index.html",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
57
|
+
"release": "standard-version",
|
|
58
|
+
"release:patch": "standard-version --release-as patch",
|
|
59
|
+
"release:minor": "standard-version --release-as minor",
|
|
60
|
+
"release:major": "standard-version --release-as major",
|
|
61
|
+
"release:dry-run": "standard-version --dry-run",
|
|
62
|
+
"github-release": "node scripts/create-github-release.js",
|
|
63
|
+
"changelog:check": "echo 'Changelog is now automatically generated from commit messages'",
|
|
63
64
|
"lint": "eslint --ext .ts,.js src/",
|
|
64
65
|
"lint:fix": "eslint --ext .ts,.js src/ --fix",
|
|
65
66
|
"format": "prettier --write \"src/**/*.{ts,js}\"",
|
|
66
67
|
"check:format": "prettier --check \"src/**/*.{ts,js}\"",
|
|
67
68
|
"check:style": "node scripts/check-code-style.js",
|
|
68
69
|
"prepare": "npm run build",
|
|
69
|
-
"deploy": "npm run build && npm publish
|
|
70
|
+
"deploy": "npm run build && npm publish",
|
|
71
|
+
"workflow": "node scripts/release-workflow.js",
|
|
72
|
+
"workflow:patch": "node scripts/release-workflow.js patch",
|
|
73
|
+
"workflow:minor": "node scripts/release-workflow.js minor",
|
|
74
|
+
"workflow:major": "node scripts/release-workflow.js major",
|
|
75
|
+
"workflow:dry-run": "npm run build && npm test && npm run release:dry-run",
|
|
70
76
|
"dry-run": "npm pack --dry-run",
|
|
71
77
|
"test": "vitest run",
|
|
72
78
|
"test:watch": "vitest",
|
|
@@ -148,6 +154,7 @@
|
|
|
148
154
|
"puppeteer": "^22.5.0",
|
|
149
155
|
"rollup": "^4.13.0",
|
|
150
156
|
"rollup-plugin-terser": "^7.0.2",
|
|
157
|
+
"standard-version": "^9.5.0",
|
|
151
158
|
"tslib": "^2.6.2",
|
|
152
159
|
"typescript": "^5.4.5",
|
|
153
160
|
"vitest": "^3.2.4"
|