Current state: - Unified augmentation system to BrainyAugmentation interface - Changed methods to specific noun/verb naming (addNoun, getNoun, etc) - Made old methods private - Combined getNouns into single unified method - Neural API exists and is complete - Triple Intelligence uses correct Brainy operators (not MongoDB) Issues identified: - Documentation incorrectly shows MongoDB operators (code is correct) - Need to ensure all features are properly exposed - Need to verify nothing was lost in simplification This commit serves as a rollback point before applying fixes.
37 lines
No EOL
1.2 KiB
TypeScript
37 lines
No EOL
1.2 KiB
TypeScript
/**
|
|
* Browser Framework Entry Point for Brainy
|
|
* Optimized for modern frameworks like Angular, React, Vue, etc.
|
|
* Auto-detects environment and uses optimal storage (OPFS in browsers)
|
|
*/
|
|
|
|
import { BrainyData, BrainyDataConfig } from './brainyData.js'
|
|
import { VerbType, NounType } from './types/graphTypes.js'
|
|
|
|
/**
|
|
* Create a BrainyData instance optimized for browser frameworks
|
|
* Auto-detects environment and selects optimal storage and settings
|
|
*/
|
|
export async function createBrowserBrainyData(config: Partial<BrainyDataConfig> = {}): Promise<BrainyData> {
|
|
// BrainyData already has environment detection and will automatically:
|
|
// - Use OPFS storage in browsers with fallback to Memory
|
|
// - Use FileSystem storage in Node.js
|
|
// - Request persistent storage when appropriate
|
|
const browserConfig: BrainyDataConfig = {
|
|
storage: {
|
|
requestPersistentStorage: true // Request persistent storage for better performance
|
|
},
|
|
...config
|
|
}
|
|
|
|
const brainyData = new BrainyData(browserConfig)
|
|
await brainyData.init()
|
|
|
|
return brainyData
|
|
}
|
|
|
|
// Re-export types and constants for framework use
|
|
export { VerbType, NounType, BrainyData }
|
|
export type { BrainyDataConfig }
|
|
|
|
// Default export for easy importing
|
|
export default createBrowserBrainyData |