@soulcraft/brainy 0.54.3 → 0.54.4
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/dist/brainyData.js +17 -7
- package/dist/brainyData.js.map +1 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +15 -0
- package/dist/storage/adapters/s3CompatibleStorage.js +141 -117
- package/dist/storage/adapters/s3CompatibleStorage.js.map +1 -1
- package/dist/utils/metadataIndex.d.ts +7 -1
- package/dist/utils/metadataIndex.js +82 -20
- package/dist/utils/metadataIndex.js.map +1 -1
- package/package.json +1 -1
package/dist/brainyData.js
CHANGED
|
@@ -803,20 +803,30 @@ export class BrainyData {
|
|
|
803
803
|
try {
|
|
804
804
|
const testResult = await this.storage.getNouns({ pagination: { offset: 0, limit: 1 } });
|
|
805
805
|
if (testResult.items.length > 0) {
|
|
806
|
-
if
|
|
807
|
-
|
|
806
|
+
// Only rebuild metadata index if explicitly requested or if we have very few items
|
|
807
|
+
const shouldRebuild = process.env.BRAINY_REBUILD_INDEX === 'true';
|
|
808
|
+
if (shouldRebuild) {
|
|
809
|
+
if (this.loggingConfig?.verbose) {
|
|
810
|
+
console.log('🔄 Rebuilding metadata index for existing data...');
|
|
811
|
+
}
|
|
812
|
+
await this.metadataIndex.rebuild();
|
|
813
|
+
if (this.loggingConfig?.verbose) {
|
|
814
|
+
const newStats = await this.metadataIndex.getStats();
|
|
815
|
+
console.log(`✅ Metadata index rebuilt: ${newStats.totalEntries} entries, ${newStats.fieldsIndexed.length} fields`);
|
|
816
|
+
}
|
|
808
817
|
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
818
|
+
else {
|
|
819
|
+
if (this.loggingConfig?.verbose) {
|
|
820
|
+
console.log('⏭️ Skipping metadata index rebuild (set BRAINY_REBUILD_INDEX=true to force)');
|
|
821
|
+
}
|
|
822
|
+
// Build index incrementally as items are accessed instead
|
|
813
823
|
}
|
|
814
824
|
}
|
|
815
825
|
}
|
|
816
826
|
catch (error) {
|
|
817
827
|
// If getNouns fails, skip rebuild
|
|
818
828
|
if (this.loggingConfig?.verbose) {
|
|
819
|
-
console.log('Skipping metadata index rebuild:', error);
|
|
829
|
+
console.log('⚠️ Skipping metadata index rebuild due to error:', error);
|
|
820
830
|
}
|
|
821
831
|
}
|
|
822
832
|
}
|