fix: correct TypeScript types for roaring bitmap API

- Change EntityIdMapper to use StorageAdapter interface instead of BaseStorage
- Use RoaringBitmap32.orMany() for multiple bitmap OR operations
- Use manual reduction for AND operations (no andMany available)
- Fixes TypeScript compilation errors
This commit is contained in:
David Snelling 2025-10-13 16:42:45 -07:00
parent aeffd32fe0
commit f35cfd4f19
2 changed files with 9 additions and 5 deletions

View file

@ -13,10 +13,10 @@
* @module utils/entityIdMapper
*/
import type { BaseStorage } from '../storage/baseStorage.js'
import type { StorageAdapter } from '../coreTypes.js'
export interface EntityIdMapperOptions {
storage: BaseStorage
storage: StorageAdapter
storageKey?: string
}
@ -30,7 +30,7 @@ export interface EntityIdMapperData {
* Maps entity UUIDs to integer IDs for use with Roaring Bitmaps
*/
export class EntityIdMapper {
private storage: BaseStorage
private storage: StorageAdapter
private storageKey: string
// Bidirectional maps

View file

@ -580,7 +580,7 @@ export class MetadataIndexManager {
}
// Combine multiple bitmaps with OR operation
return RoaringBitmap32.or(...bitmaps)
return RoaringBitmap32.orMany(bitmaps)
}
/**
@ -623,7 +623,11 @@ export class MetadataIndexManager {
// Hardware-accelerated intersection using SIMD instructions (AVX2/SSE4.2)
// This is 500-900x faster than JavaScript array filtering
const intersectionBitmap = RoaringBitmap32.and(...bitmaps)
// Note: RoaringBitmap32.and() only takes 2 params, so we reduce manually
let intersectionBitmap = bitmaps[0]
for (let i = 1; i < bitmaps.length; i++) {
intersectionBitmap = RoaringBitmap32.and(intersectionBitmap, bitmaps[i])
}
// Check if empty before converting
if (intersectionBitmap.size === 0) {