CHECKPOINT: Brainy 2.0 API refactor - pre-fixes state
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.
This commit is contained in:
commit
26c7d61185
279 changed files with 177945 additions and 0 deletions
37
src/browserFramework.ts
Normal file
37
src/browserFramework.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue