@soulcraft/brainy 0.18.0 → 0.20.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.
Files changed (35) hide show
  1. package/README.md +32 -1
  2. package/dist/brainy.js +4797 -4680
  3. package/dist/brainy.min.js +750 -750
  4. package/dist/brainyData.d.ts +63 -4
  5. package/dist/coreTypes.d.ts +54 -0
  6. package/dist/index.d.ts +2 -2
  7. package/dist/storage/adapters/baseStorageAdapter.d.ts +68 -0
  8. package/dist/storage/adapters/baseStorageAdapter.d.ts.map +1 -0
  9. package/dist/storage/adapters/fileSystemStorage.d.ts +11 -1
  10. package/dist/storage/adapters/fileSystemStorage.d.ts.map +1 -1
  11. package/dist/storage/adapters/memoryStorage.d.ts +12 -1
  12. package/dist/storage/adapters/memoryStorage.d.ts.map +1 -1
  13. package/dist/storage/adapters/opfsStorage.d.ts +12 -1
  14. package/dist/storage/adapters/opfsStorage.d.ts.map +1 -1
  15. package/dist/storage/adapters/s3CompatibleStorage.d.ts +12 -1
  16. package/dist/storage/adapters/s3CompatibleStorage.d.ts.map +1 -1
  17. package/dist/storage/baseStorage.d.ts +16 -2
  18. package/dist/storage/baseStorage.d.ts.map +1 -1
  19. package/dist/storage/fileSystemStorage.d.ts +15 -2
  20. package/dist/storage/fileSystemStorage.d.ts.map +1 -1
  21. package/dist/storage/opfsStorage.d.ts +66 -3
  22. package/dist/storage/opfsStorage.d.ts.map +1 -1
  23. package/dist/storage/s3CompatibleStorage.d.ts +14 -2
  24. package/dist/storage/s3CompatibleStorage.d.ts.map +1 -1
  25. package/dist/unified.js +1200 -541
  26. package/dist/unified.min.js +747 -747
  27. package/dist/utils/index.d.ts +1 -0
  28. package/dist/utils/index.d.ts.map +1 -1
  29. package/dist/utils/statistics.d.ts +28 -0
  30. package/dist/utils/statistics.d.ts.map +1 -0
  31. package/dist/utils/version.d.ts +1 -1
  32. package/package.json +1 -1
  33. package/README.demo.md +0 -65
  34. package/dist/utils/logger.d.ts +0 -99
  35. package/dist/utils/logger.d.ts.map +0 -1
package/README.md CHANGED
@@ -69,15 +69,19 @@ configuration.
69
69
  Brainy offers specialized packages for different use cases:
70
70
 
71
71
  #### CLI Package
72
+
72
73
  ```bash
73
74
  npm install -g @soulcraft/brainy-cli
74
75
  ```
76
+
75
77
  Command-line interface for data management, bulk operations, and database administration.
76
78
 
77
79
  #### Web Service Package
80
+
78
81
  ```bash
79
82
  npm install @soulcraft/brainy-web-service
80
83
  ```
84
+
81
85
  REST API web service wrapper that provides HTTP endpoints for search operations and database queries.
82
86
 
83
87
  ## 🏁 Quick Start
@@ -488,6 +492,33 @@ const backupData = await db.backup()
488
492
  const restoreResult = await db.restore(backupData, {clearExisting: true})
489
493
  ```
490
494
 
495
+ ### Database Statistics
496
+
497
+ Brainy provides a way to get statistics about the current state of the database:
498
+
499
+ ```typescript
500
+ import {BrainyData, getStatistics} from '@soulcraft/brainy'
501
+
502
+ // Create and initialize the database
503
+ const db = new BrainyData()
504
+ await db.init()
505
+
506
+ // Get statistics using the standalone function
507
+ const stats = await getStatistics(db)
508
+ console.log(stats)
509
+ // Output: { nounCount: 0, verbCount: 0, metadataCount: 0, hnswIndexSize: 0 }
510
+
511
+ // Or using the instance method
512
+ const instanceStats = await db.getStatistics()
513
+ ```
514
+
515
+ The statistics include:
516
+
517
+ - `nounCount`: Number of nouns (entities) in the database
518
+ - `verbCount`: Number of verbs (relationships) in the database
519
+ - `metadataCount`: Number of metadata entries
520
+ - `hnswIndexSize`: Size of the HNSW index
521
+
491
522
  ### Working with Nouns (Entities)
492
523
 
493
524
  ```typescript
@@ -1081,7 +1112,7 @@ The repository includes a comprehensive demo that showcases Brainy's main featur
1081
1112
  - **[Try the live demo](https://soulcraft-research.github.io/brainy/demo/index.html)** - Check out the
1082
1113
  interactive demo on
1083
1114
  GitHub Pages
1084
- - Or run it locally with `npm run demo` (see [demo instructions](README.demo.md) for details)
1115
+ - Or run it locally with `npm run demo` (see [demo instructions](demo.md) for details)
1085
1116
  - To deploy your own version to GitHub Pages, use the GitHub Actions workflow in
1086
1117
  `.github/workflows/deploy-demo.yml`,
1087
1118
  which automatically deploys when pushing to the main branch or can be manually triggered