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:
parent
fa6c22ce4b
commit
04549aec2d
4 changed files with 14 additions and 3 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraft/brainy",
|
||||||
"version": "2.14.0",
|
"version": "2.14.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraft/brainy",
|
||||||
"version": "2.14.0",
|
"version": "2.14.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.540.0",
|
"@aws-sdk/client-s3": "^3.540.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@soulcraft/brainy",
|
"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.",
|
"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",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,8 @@ export abstract class BaseStorageAdapter implements StorageAdapter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count total number of nouns (optional)
|
* 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
|
* @param filter Optional filter criteria
|
||||||
* @returns Promise that resolves to the count
|
* @returns Promise that resolves to the count
|
||||||
*/
|
*/
|
||||||
|
|
@ -154,6 +156,8 @@ export abstract class BaseStorageAdapter implements StorageAdapter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count total number of verbs (optional)
|
* 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
|
* @param filter Optional filter criteria
|
||||||
* @returns Promise that resolves to the count
|
* @returns Promise that resolves to the count
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -997,6 +997,8 @@ export class FileSystemStorage extends BaseStorage {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// List all verb files in the verbs directory
|
// 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 files = await fs.promises.readdir(this.verbsDir)
|
||||||
const verbFiles = files.filter((f: string) => f.endsWith('.json'))
|
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 endIndex = Math.min(startIndex + limit, totalCount)
|
||||||
const hasMore = endIndex < 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
|
// Load the requested page of verbs
|
||||||
const verbs: GraphVerb[] = []
|
const verbs: GraphVerb[] = []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue