chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -4,7 +4,7 @@
|
|||
* Automatically updates indexes when data changes
|
||||
*/
|
||||
|
||||
import { StorageAdapter, resolveEntityField } from '../coreTypes.js'
|
||||
import { StorageAdapter, resolveEntityField, NounMetadata, VerbMetadata } from '../coreTypes.js'
|
||||
import { ColumnStore } from '../indexes/columnStore/ColumnStore.js'
|
||||
import type { MetadataIndexProvider } from '../plugin.js'
|
||||
import { MetadataIndexCache, MetadataIndexCacheConfig } from './metadataIndexCache.js'
|
||||
|
|
@ -1520,13 +1520,13 @@ export class MetadataIndexManager implements MetadataIndexProvider {
|
|||
const allIds = new Set<string>()
|
||||
|
||||
// Storage.getNouns() is the definitive source of all entity IDs
|
||||
if (this.storage && typeof (this.storage as any).getNouns === 'function') {
|
||||
if (this.storage && typeof this.storage.getNouns === 'function') {
|
||||
try {
|
||||
const result = await (this.storage as any).getNouns({
|
||||
const result = await this.storage.getNouns({
|
||||
pagination: { limit: 100000 }
|
||||
})
|
||||
if (result && result.items) {
|
||||
result.items.forEach((item: any) => {
|
||||
result.items.forEach((item) => {
|
||||
if (item.id) allIds.add(item.id)
|
||||
})
|
||||
}
|
||||
|
|
@ -2446,7 +2446,7 @@ export class MetadataIndexManager implements MetadataIndexProvider {
|
|||
noun: 'MetadataFieldIndex',
|
||||
values: fieldIndex.values,
|
||||
lastUpdated: fieldIndex.lastUpdated
|
||||
} as any)
|
||||
})
|
||||
|
||||
// Update unified cache
|
||||
const size = JSON.stringify(fieldIndex).length
|
||||
|
|
@ -2582,8 +2582,11 @@ export class MetadataIndexManager implements MetadataIndexProvider {
|
|||
await this.chunkManager.deleteChunk(field, chunkId)
|
||||
}
|
||||
|
||||
// Delete the sparse index file itself
|
||||
await this.storage.saveMetadata(indexPath, null as any)
|
||||
// Delete the sparse index file itself.
|
||||
// Typed boundary: the storage metadata channel doubles as the delete
|
||||
// path — writing a JSON `null` tombstone clears the entry, but the
|
||||
// adapter signature only models real payloads.
|
||||
await this.storage.saveMetadata(indexPath, null as unknown as NounMetadata)
|
||||
}
|
||||
} catch (error) {
|
||||
// Silent failure - if we can't delete old chunks, rebuild will still work
|
||||
|
|
@ -2612,9 +2615,11 @@ export class MetadataIndexManager implements MetadataIndexProvider {
|
|||
deletedCount++
|
||||
}
|
||||
|
||||
// Delete field registry
|
||||
// Delete field registry.
|
||||
// Typed boundary: writing a JSON `null` tombstone clears the entry, but
|
||||
// the adapter signature only models real payloads.
|
||||
try {
|
||||
await this.storage.saveMetadata('__metadata_field_registry__', null as any)
|
||||
await this.storage.saveMetadata('__metadata_field_registry__', null as unknown as NounMetadata)
|
||||
} catch (error) {
|
||||
prodLog.debug('Could not delete field registry:', error)
|
||||
}
|
||||
|
|
@ -3104,10 +3109,15 @@ export class MetadataIndexManager implements MetadataIndexProvider {
|
|||
prodLog.info(`📦 Loading ${result.items.length} verbs with metadata...`)
|
||||
|
||||
const verbIds = result.items.map(verb => verb.id)
|
||||
let verbMetadataBatch: Map<string, any>
|
||||
let verbMetadataBatch: Map<string, VerbMetadata>
|
||||
|
||||
if ((this.storage as any).getVerbMetadataBatch) {
|
||||
verbMetadataBatch = await (this.storage as any).getVerbMetadataBatch(verbIds)
|
||||
// Optional adapter capability: batched verb-metadata reads. Not part of
|
||||
// the StorageAdapter contract, so it is probed structurally.
|
||||
const batchCapableStorage = this.storage as StorageAdapter & {
|
||||
getVerbMetadataBatch?: (ids: string[]) => Promise<Map<string, VerbMetadata>>
|
||||
}
|
||||
if (batchCapableStorage.getVerbMetadataBatch) {
|
||||
verbMetadataBatch = await batchCapableStorage.getVerbMetadataBatch(verbIds)
|
||||
prodLog.info(`✅ Loaded ${verbMetadataBatch.size}/${verbIds.length} verb metadata objects`)
|
||||
} else {
|
||||
verbMetadataBatch = new Map()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue