@soulcraft/brainy 0.25.0 → 0.27.0
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/README.md +31 -0
- package/dist/brainy.js +8791 -6385
- package/dist/brainy.min.js +747 -747
- package/dist/brainyData.d.ts +80 -0
- package/dist/coreTypes.d.ts +20 -0
- package/dist/errors/brainyError.d.ts +45 -0
- package/dist/hnsw/hnswIndexOptimized.d.ts +13 -1
- package/dist/hnsw/hnswIndexOptimized.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/statistics/statisticsManager.d.ts +121 -0
- package/dist/storage/adapters/fileSystemStorage.d.ts +21 -1
- package/dist/storage/adapters/fileSystemStorage.d.ts.map +1 -1
- package/dist/storage/adapters/memoryStorage.d.ts.map +1 -1
- package/dist/storage/adapters/opfsStorage.d.ts +21 -1
- package/dist/storage/adapters/opfsStorage.d.ts.map +1 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +58 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts.map +1 -1
- package/dist/storage/storageFactory.d.ts +6 -1
- package/dist/storage/storageFactory.d.ts.map +1 -1
- package/dist/types/graphTypes.d.ts +269 -18
- package/dist/types/graphTypes.d.ts.map +1 -1
- package/dist/unified.js +2871 -1435
- package/dist/unified.min.js +747 -747
- package/dist/utils/environmentDetection.d.ts +47 -0
- package/dist/utils/environmentDetection.d.ts.map +1 -0
- package/dist/utils/operationUtils.d.ts +58 -0
- package/dist/utils/operationUtils.d.ts.map +1 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -598,6 +598,37 @@ await db.deleteVerb(verbId)
|
|
|
598
598
|
|
|
599
599
|
## Advanced Configuration
|
|
600
600
|
|
|
601
|
+
### Database Modes
|
|
602
|
+
|
|
603
|
+
Brainy supports special operational modes that restrict certain operations:
|
|
604
|
+
|
|
605
|
+
```typescript
|
|
606
|
+
import { BrainyData } from '@soulcraft/brainy'
|
|
607
|
+
|
|
608
|
+
// Create and initialize the database
|
|
609
|
+
const db = new BrainyData()
|
|
610
|
+
await db.init()
|
|
611
|
+
|
|
612
|
+
// Set the database to read-only mode (prevents write operations)
|
|
613
|
+
db.setReadOnly(true)
|
|
614
|
+
|
|
615
|
+
// Check if the database is in read-only mode
|
|
616
|
+
const isReadOnly = db.isReadOnly() // Returns true
|
|
617
|
+
|
|
618
|
+
// Set the database to write-only mode (prevents search operations)
|
|
619
|
+
db.setWriteOnly(true)
|
|
620
|
+
|
|
621
|
+
// Check if the database is in write-only mode
|
|
622
|
+
const isWriteOnly = db.isWriteOnly() // Returns true
|
|
623
|
+
|
|
624
|
+
// Reset to normal mode (allows both read and write operations)
|
|
625
|
+
db.setReadOnly(false)
|
|
626
|
+
db.setWriteOnly(false)
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
- **Read-Only Mode**: When enabled, prevents all write operations (add, update, delete). Useful for deployment scenarios where you want to prevent modifications to the database.
|
|
630
|
+
- **Write-Only Mode**: When enabled, prevents all search operations. Useful for initial data loading or when you want to optimize for write performance.
|
|
631
|
+
|
|
601
632
|
### Embedding
|
|
602
633
|
|
|
603
634
|
```typescript
|