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

@ -3,7 +3,7 @@
*
* Comprehensive testing of batch operations including:
* - addMany: Bulk entity creation
* - deleteMany: Bulk deletion
* - removeMany: Bulk deletion
* - Performance validation at scale
* - Memory efficiency testing
* - Error recovery scenarios
@ -353,7 +353,7 @@ describe('Batch Operations - Public API Testing', () => {
})
})
describe('deleteMany - Bulk Deletion', () => {
describe('removeMany - Bulk Deletion', () => {
let testIds: string[] = []
beforeEach(async () => {
@ -374,14 +374,14 @@ describe('Batch Operations - Public API Testing', () => {
const startMemory = process.memoryUsage().heapUsed
const startTime = performance.now()
// Use deleteMany if available, otherwise individual deletes
// Use removeMany if available, otherwise individual deletes
let results: any[]
if ('deleteMany' in brainy && typeof brainy.deleteMany === 'function') {
const result = await brainy.deleteMany({ ids: toDelete })
if ('removeMany' in brainy && typeof brainy.removeMany === 'function') {
const result = await brainy.removeMany({ ids: toDelete })
results = result.successful
} else {
results = await Promise.all(
toDelete.map(id => brainy.delete(id))
toDelete.map(id => brainy.remove(id))
)
}
@ -389,7 +389,7 @@ describe('Batch Operations - Public API Testing', () => {
const memoryUsed = process.memoryUsage().heapUsed - startMemory
metricsCollector.recordBatch(
'deleteMany-100',
'removeMany-100',
toDelete.length,
results,
duration,
@ -426,13 +426,13 @@ describe('Batch Operations - Public API Testing', () => {
const batchSize = 100
for (let i = 0; i < idsToDelete.length; i += batchSize) {
const batch = idsToDelete.slice(i, i + batchSize)
await Promise.all(batch.map(id => brainy.delete(id)))
await Promise.all(batch.map(id => brainy.remove(id)))
}
const duration = performance.now() - startTime
metricsCollector.recordBatch(
'deleteMany-1k',
'removeMany-1k',
idsToDelete.length,
idsToDelete.map(() => true),
duration,
@ -553,7 +553,7 @@ describe('Batch Operations - Public API Testing', () => {
Promise.all(updateIds.map(id =>
brainy.update({ id, metadata: { updated: true } })
)),
Promise.all(deleteIds.map(id => brainy.delete(id)))
Promise.all(deleteIds.map(id => brainy.remove(id)))
])
const duration = performance.now() - startTime