@soulcraft/brainy 4.8.2 → 4.8.3
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.
|
@@ -1969,34 +1969,67 @@ export class FileSystemStorage extends BaseStorage {
|
|
|
1969
1969
|
* Traverses all shard subdirectories (00-ff)
|
|
1970
1970
|
*/
|
|
1971
1971
|
async getAllShardedFiles(baseDir) {
|
|
1972
|
+
console.log(`[DEBUG] getAllShardedFiles called with baseDir: ${baseDir}`);
|
|
1973
|
+
console.log(`[DEBUG] Current working directory: ${process.cwd()}`);
|
|
1974
|
+
console.log(`[DEBUG] Resolved absolute path: ${path.resolve(baseDir)}`);
|
|
1972
1975
|
const allFiles = [];
|
|
1973
1976
|
try {
|
|
1977
|
+
// Check if directory exists
|
|
1978
|
+
try {
|
|
1979
|
+
const baseStat = await fs.promises.stat(baseDir);
|
|
1980
|
+
console.log(`[DEBUG] baseDir exists: ${baseStat.isDirectory() ? 'is directory' : 'is NOT directory'}`);
|
|
1981
|
+
}
|
|
1982
|
+
catch (statError) {
|
|
1983
|
+
console.log(`[DEBUG] baseDir stat failed: ${statError.message}`);
|
|
1984
|
+
if (statError.code === 'ENOENT') {
|
|
1985
|
+
console.log(`[DEBUG] baseDir does not exist, returning empty array`);
|
|
1986
|
+
return [];
|
|
1987
|
+
}
|
|
1988
|
+
throw statError;
|
|
1989
|
+
}
|
|
1974
1990
|
const shardDirs = await fs.promises.readdir(baseDir);
|
|
1991
|
+
console.log(`[DEBUG] Found ${shardDirs.length} entries in baseDir: ${JSON.stringify(shardDirs.slice(0, 10))}${shardDirs.length > 10 ? '...' : ''}`);
|
|
1992
|
+
let dirsProcessed = 0;
|
|
1993
|
+
let filesFound = 0;
|
|
1975
1994
|
for (const shardDir of shardDirs) {
|
|
1976
1995
|
const shardPath = path.join(baseDir, shardDir);
|
|
1977
1996
|
try {
|
|
1978
1997
|
const stat = await fs.promises.stat(shardPath);
|
|
1979
1998
|
if (stat.isDirectory()) {
|
|
1999
|
+
dirsProcessed++;
|
|
2000
|
+
console.log(`[DEBUG] Processing shard directory ${dirsProcessed}: ${shardDir}`);
|
|
1980
2001
|
const shardFiles = await fs.promises.readdir(shardPath);
|
|
2002
|
+
console.log(`[DEBUG] Found ${shardFiles.length} entries in ${shardDir}`);
|
|
2003
|
+
let jsonCount = 0;
|
|
1981
2004
|
for (const file of shardFiles) {
|
|
1982
2005
|
if (file.endsWith('.json')) {
|
|
1983
2006
|
allFiles.push(file);
|
|
2007
|
+
jsonCount++;
|
|
2008
|
+
filesFound++;
|
|
1984
2009
|
}
|
|
1985
2010
|
}
|
|
2011
|
+
console.log(`[DEBUG] Added ${jsonCount} .json files from ${shardDir} (total so far: ${filesFound})`);
|
|
2012
|
+
}
|
|
2013
|
+
else {
|
|
2014
|
+
console.log(`[DEBUG] Skipping non-directory entry: ${shardDir}`);
|
|
1986
2015
|
}
|
|
1987
2016
|
}
|
|
1988
2017
|
catch (shardError) {
|
|
1989
2018
|
// Skip inaccessible shard directories
|
|
2019
|
+
console.log(`[DEBUG] Error accessing shard ${shardDir}: ${shardError.message}`);
|
|
1990
2020
|
continue;
|
|
1991
2021
|
}
|
|
1992
2022
|
}
|
|
2023
|
+
console.log(`[DEBUG] getAllShardedFiles complete: processed ${dirsProcessed} directories, found ${allFiles.length} total .json files`);
|
|
1993
2024
|
// Sort for consistent ordering
|
|
1994
2025
|
allFiles.sort();
|
|
1995
2026
|
return allFiles;
|
|
1996
2027
|
}
|
|
1997
2028
|
catch (error) {
|
|
2029
|
+
console.log(`[DEBUG] getAllShardedFiles error: ${error.message}, code: ${error.code}`);
|
|
1998
2030
|
if (error.code === 'ENOENT') {
|
|
1999
2031
|
// Directory doesn't exist yet
|
|
2032
|
+
console.log(`[DEBUG] Directory does not exist, returning empty array`);
|
|
2000
2033
|
return [];
|
|
2001
2034
|
}
|
|
2002
2035
|
throw error;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.3",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|