CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB Recovery Status: - Successfully recovered brainy.ts from compiled JavaScript - All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.) - Neural subsystem intact (562KB embedded patterns, NLP working) - Augmentation pipeline operational (20+ augmentations) - HNSW clustering system complete - Triple Intelligence compiled (needs constructor fix) - Test suite validates functionality Changes preserved: - 898 files with changes from last 3 days - 144,475 insertions - All augmentation improvements - All test coverage enhancements - Complete v3.0 feature set This is a LOCAL checkpoint only - contains recovered work after corruption incident. Created backup in .backups/brainy-full-20250910-151314.tar.gz Branch: recovery-checkpoint-20250910-151433 Date: Wed Sep 10 03:18:04 PM PDT 2025
79 lines
2.1 KiB
TypeScript
79 lines
2.1 KiB
TypeScript
/**
|
|
* Optimized S3 Search and Pagination
|
|
* Provides efficient search and pagination capabilities for S3-compatible storage
|
|
*/
|
|
import { HNSWNoun, GraphVerb } from '../../coreTypes.js';
|
|
/**
|
|
* Pagination result interface
|
|
*/
|
|
export interface PaginationResult<T> {
|
|
items: T[];
|
|
totalCount?: number;
|
|
hasMore: boolean;
|
|
nextCursor?: string;
|
|
}
|
|
/**
|
|
* Filter interface for nouns
|
|
*/
|
|
export interface NounFilter {
|
|
nounType?: string | string[];
|
|
service?: string | string[];
|
|
metadata?: Record<string, any>;
|
|
}
|
|
/**
|
|
* Filter interface for verbs
|
|
*/
|
|
export interface VerbFilter {
|
|
verbType?: string | string[];
|
|
sourceId?: string | string[];
|
|
targetId?: string | string[];
|
|
service?: string | string[];
|
|
metadata?: Record<string, any>;
|
|
}
|
|
/**
|
|
* Interface for storage operations needed by optimized search
|
|
*/
|
|
export interface StorageOperations {
|
|
listObjectKeys(prefix: string, limit: number, cursor?: string): Promise<{
|
|
keys: string[];
|
|
hasMore: boolean;
|
|
nextCursor?: string;
|
|
}>;
|
|
getObject<T>(key: string): Promise<T | null>;
|
|
getMetadata(id: string, type: 'noun' | 'verb'): Promise<any | null>;
|
|
}
|
|
/**
|
|
* Optimized search implementation for S3-compatible storage
|
|
*/
|
|
export declare class OptimizedS3Search {
|
|
private storage;
|
|
constructor(storage: StorageOperations);
|
|
/**
|
|
* Get nouns with optimized pagination and filtering
|
|
*/
|
|
getNounsWithPagination(options?: {
|
|
limit?: number;
|
|
cursor?: string;
|
|
filter?: NounFilter;
|
|
}): Promise<PaginationResult<HNSWNoun>>;
|
|
/**
|
|
* Get verbs with optimized pagination and filtering
|
|
*/
|
|
getVerbsWithPagination(options?: {
|
|
limit?: number;
|
|
cursor?: string;
|
|
filter?: VerbFilter;
|
|
}): Promise<PaginationResult<GraphVerb>>;
|
|
/**
|
|
* Check if a noun matches the filter criteria
|
|
*/
|
|
private matchesNounFilter;
|
|
/**
|
|
* Check if a verb matches the filter criteria
|
|
*/
|
|
private matchesVerbFilter;
|
|
/**
|
|
* Combine HNSWVerb data with metadata to create GraphVerb
|
|
*/
|
|
private combineVerbWithMetadata;
|
|
}
|