chore(release): 2.14.1

- Fix verb retrieval in FileSystemStorage adapter
- Add safety warnings for large datasets
- Document performance considerations for count methods
This commit is contained in:
David Snelling 2025-09-02 14:56:16 -07:00
parent fa6c22ce4b
commit 04549aec2d
4 changed files with 14 additions and 3 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "@soulcraft/brainy",
"version": "2.14.0",
"version": "2.14.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@soulcraft/brainy",
"version": "2.14.0",
"version": "2.14.1",
"license": "MIT",
"dependencies": {
"@aws-sdk/client-s3": "^3.540.0",

View file

@ -1,6 +1,6 @@
{
"name": "@soulcraft/brainy",
"version": "2.14.0",
"version": "2.14.1",
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
"main": "dist/index.js",
"module": "dist/index.js",

View file

@ -147,6 +147,8 @@ export abstract class BaseStorageAdapter implements StorageAdapter {
/**
* Count total number of nouns (optional)
* WARNING: Implementations should be efficient for large datasets.
* Consider caching counts or using database COUNT operations.
* @param filter Optional filter criteria
* @returns Promise that resolves to the count
*/
@ -154,6 +156,8 @@ export abstract class BaseStorageAdapter implements StorageAdapter {
/**
* Count total number of verbs (optional)
* WARNING: Implementations should be efficient for large datasets.
* Consider caching counts or using database COUNT operations.
* @param filter Optional filter criteria
* @returns Promise that resolves to the count
*/

View file

@ -997,6 +997,8 @@ export class FileSystemStorage extends BaseStorage {
try {
// List all verb files in the verbs directory
// Note: For very large directories (millions of files), this could be memory-intensive
// Future optimization: Use fs.opendir() for streaming directory reads
const files = await fs.promises.readdir(this.verbsDir)
const verbFiles = files.filter((f: string) => f.endsWith('.json'))
@ -1008,6 +1010,11 @@ export class FileSystemStorage extends BaseStorage {
const endIndex = Math.min(startIndex + limit, totalCount)
const hasMore = endIndex < totalCount
// Safety check for large datasets
if (totalCount > 100000) {
console.warn(`Large verb dataset detected (${totalCount} verbs). Consider using a database for better performance.`)
}
// Load the requested page of verbs
const verbs: GraphVerb[] = []