chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase

This commit is contained in:
David Snelling 2026-06-11 14:51:00 -07:00
parent 970e08c466
commit 1f7e365a4e
237 changed files with 1951 additions and 49413 deletions

View file

@ -188,7 +188,7 @@ export interface ConfigUpdateParams {
/**
* API for Triple Intelligence Engine to access Brainy internals
* This provides type-safe access without 'as any' casts
* This provides type-safe access without unchecked casts
*/
export interface TripleIntelligenceAPI {
// Vector operations

View file

@ -86,7 +86,7 @@ export interface Relation<T = any> {
* relationship might have `subtype: 'direct'` vs `'dotted-line'`; a `RelatedTo`
* edge might carry `'spouse'` / `'sibling'` / `'colleague'`). Flat string, no
* hierarchy. Top-level standard field indexed on the fast path and rolled into
* per-VerbType statistics so queries like `getRelations({ verb, subtype })` hit
* per-VerbType statistics so queries like `related({ verb, subtype })` hit
* the column-store directly.
*/
subtype?: string
@ -372,7 +372,7 @@ export interface RelateParams<T = any> {
* relationship might have `subtype: 'direct'` or `'dotted-line'`; a `RelatedTo`
* edge might carry `'spouse'` or `'colleague'`). Flat string, no hierarchy.
* Indexed and rolled up into per-VerbType statistics for fast filtering
* (`getRelations({ verb, subtype })`) and aggregation (`groupBy:['subtype']`).
* (`related({ verb, subtype })`) and aggregation (`groupBy:['subtype']`).
*/
subtype?: string
/** Connection strength (0-1, default: 1.0) */
@ -542,7 +542,7 @@ export interface SimilarParams<T = any> {
}
/**
* Parameters for getting relationships
* Parameters for `brain.related()` / `db.related()`
*
* All parameters are optional. When called without parameters, returns all relationships
* with pagination (default limit: 100).
@ -550,25 +550,25 @@ export interface SimilarParams<T = any> {
* @example
* ```typescript
* // Get all relationships (default limit: 100)
* const all = await brain.getRelations()
* const all = await brain.related()
*
* // Get relationships from a specific entity (string shorthand)
* const fromEntity = await brain.getRelations(entityId)
* const fromEntity = await brain.related(entityId)
*
* // Equivalent to:
* const fromEntity2 = await brain.getRelations({ from: entityId })
* const fromEntity2 = await brain.related({ from: entityId })
*
* // Get relationships to a specific entity
* const toEntity = await brain.getRelations({ to: entityId })
* const toEntity = await brain.related({ to: entityId })
*
* // Filter by relationship type
* const friends = await brain.getRelations({ type: VerbType.FriendOf })
* const friends = await brain.related({ type: VerbType.FriendOf })
*
* // Pagination
* const page2 = await brain.getRelations({ offset: 100, limit: 50 })
* const page2 = await brain.related({ offset: 100, limit: 50 })
*
* // Combined filters
* const filtered = await brain.getRelations({
* const filtered = await brain.related({
* from: entityId,
* type: VerbType.WorksWith,
* limit: 20
@ -578,7 +578,7 @@ export interface SimilarParams<T = any> {
* Fixed bug where calling without parameters returned empty array
* Added string ID shorthand syntax
*/
export interface GetRelationsParams {
export interface RelatedParams {
/**
* Filter by source entity ID
*
@ -668,15 +668,15 @@ export interface UpdateManyParams<T = any> {
}
/**
* Batch delete parameters
* Batch remove parameters
*/
export interface DeleteManyParams {
ids?: string[] // Specific IDs to delete
type?: NounType // Delete all of type
where?: any // Delete by metadata
limit?: number // Max to delete (safety)
export interface RemoveManyParams {
ids?: string[] // Specific IDs to remove
type?: NounType // Remove all of type
where?: any // Remove by metadata
limit?: number // Max to remove (safety)
onProgress?: (done: number, total: number) => void
continueOnError?: boolean // Continue processing if a delete fails
continueOnError?: boolean // Continue processing if a removal fails
}
/**
@ -854,7 +854,7 @@ export interface ImportResult {
* - VFS operations (readFile, stat, readdir) - 100% of cases
* - Existence checks: `if (await brain.get(id))`
* - Metadata inspection: `entity.metadata`, `entity.data`, `entity.type`
* - Relationship traversal: `brain.getRelations({ from: id })`
* - Relationship traversal: `brain.related({ from: id })`
* - Search operations: `brain.find()` generates embeddings automatically
*
* @example
@ -1364,16 +1364,14 @@ export interface BrainyConfig {
*
* - `'writer'` (default): acquires an exclusive lock on the storage directory at
* `init()` and refuses to open if another live writer holds the lock. Required
* for any instance that calls `add`/`update`/`delete`/`relate` or any other
* for any instance that calls `add`/`update`/`remove`/`relate` or any other
* mutation. Released on `close()` and on process exit/SIGINT/SIGTERM.
* - `'reader'`: opens without acquiring the writer lock. Coexists with a live
* writer and with other readers. All mutation methods throw
* `Cannot mutate a read-only Brainy instance`. Use `Brainy.openReadOnly()`
* as a convenience factory.
*
* For cloud storage backends (s3/r2/gcs/azure) the lock is a best-effort
* advisory marker multi-process safety against concurrent writers on
* cloud-backed stores is not yet enforced. See `docs/concepts/multi-process.md`.
* See `docs/concepts/multi-process.md` for the full coordination model.
*/
mode?: 'writer' | 'reader'

View file

@ -3,8 +3,6 @@
*
* Provides unified progress tracking across all long-running operations
* in Brainy (imports, clustering, large searches, etc.)
*
* PRODUCTION-READY - NO MOCKS, NO STUBS, REAL IMPLEMENTATION
*/
/**