feat: remove legacy ImportManager, standardize getStats() API

- Removed ImportManager class and exports (use brain.import() instead)
- Fixed all documentation: getStatistics() → getStats()
- Updated 41 files across codebase for consistency
- Removed ImportManager section from API docs
- Added v3.30.0 migration guide to CHANGELOG

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David Snelling 2025-10-09 11:40:31 -07:00
parent 68c989e4f7
commit 58daf09403
31 changed files with 87 additions and 481 deletions

View file

@ -1071,93 +1071,6 @@ console.log(`Types:`, Object.keys(nounTypes))
---
## Import API
### `createImportManager(brain: Brainy): ImportManager`
Creates an import manager for intelligent data import.
**Example:**
```typescript
import { Brainy, createImportManager } from '@soulcraft/brainy'
const brain = new Brainy({ preset: 'memory' })
await brain.init()
const importer = createImportManager(brain)
await importer.init()
```
---
### `async ImportManager.import(source, options?): Promise<ImportResult>`
Import data from various sources with AI-powered entity detection.
**Parameters:**
- `source` - String, Buffer, array, or object to import
- `options.source` - 'data' | 'file' | 'url' | 'auto' (default: 'auto')
- `options.format` - 'json' | 'csv' | 'text' | 'yaml' | 'auto' (default: 'auto')
- `options.batchSize` - Batch size for processing (default: 50)
- `options.autoDetect` - Auto-detect entity types (default: true)
- `options.typeHint` - Suggested entity type
- `options.extractRelationships` - Extract relationships (default: true)
- `options.csvDelimiter` - CSV delimiter character
- `options.csvHeaders` - CSV has headers (default: true)
- `options.parallel` - Process in parallel (default: true)
- `options.maxConcurrency` - Max concurrent operations
**Returns:**
```typescript
{
success: boolean
nouns: string[] // IDs of imported entities
verbs: string[] // IDs of created relationships
errors: string[]
stats: {
total: number
imported: number
failed: number
relationships: number
}
}
```
**Examples:**
```typescript
// Import from CSV file
const result = await importer.importFile('./data.csv', {
format: 'csv',
extractRelationships: true
})
// Import from URL
const result = await importer.importUrl('https://api.example.com/data.json')
// Import array of objects
const data = [
{ name: 'Alice', role: 'Developer' },
{ name: 'Bob', role: 'Designer' }
]
const result = await importer.import(data, {
typeHint: NounType.Person,
extractRelationships: true
})
console.log(`Imported ${result.stats.imported}/${result.stats.total} items`)
console.log(`Created ${result.stats.relationships} relationships`)
```
**Features:**
- 🧠 **AI Entity Detection** - Auto-detect entity types from data
- 🔗 **Relationship Extraction** - Discover connections automatically
- 📊 **Multi-Format Support** - CSV, JSON, YAML, text files
- 🚀 **Batch Processing** - Efficient handling of large datasets
- 💡 **Neural Analysis** - Confidence scoring and insights
- 🎯 **Smart CSV Parsing** - Auto-delimiter detection
- 🌐 **URL Imports** - Direct import from web sources
---
## Query API
Access via: `brain.query`