refactor(8.0): rename HNSWIndex class → JsHnswVectorIndex (scaffold step 3)

Step 3 of the brainy 8.0 rename scaffolding. The class name now matches
its role: the JS HNSW implementation of the VectorIndexProvider contract.
Per planning § 2.3: this is NOT cosmetic — leaving HNSWIndex when the
public contract is VectorIndexProvider creates a confusing read at the
implementation layer.

CHANGES

Repo-wide mechanical rename: HNSWIndex → JsHnswVectorIndex across 52
references in src/ + 5 references in tests/ via sed. Class declaration,
imports, JSDoc, comments, and identifiers all updated.

src/index.ts
- Primary public export: JsHnswVectorIndex (the new name).
- Backwards-compat alias: `export const HNSWIndex = JsHnswVectorIndex`
  with @deprecated note. Removed in the final 8.0 cleanup commit.

NO-OP scope

No behavioural change. The class is exactly the same; only the name
moved. Tests + build green.

VERIFICATION

- npx tsc --noEmit: clean
- npm test: 1468 / 1468 unit
This commit is contained in:
David Snelling 2026-06-09 13:07:56 -07:00
parent 8f87b35614
commit f39d420cb4
11 changed files with 80 additions and 70 deletions

View file

@ -11,7 +11,7 @@
import { prodLog } from './logger.js'
import { DELETED_FIELD, isDeleted } from './metadataNamespace.js'
import type { StorageAdapter } from '../coreTypes.js'
import type { HNSWIndex } from '../hnsw/hnswIndex.js'
import type { JsHnswVectorIndex } from '../hnsw/hnswIndex.js'
import type { MetadataIndexManager } from './metadataIndex.js'
export interface CleanupConfig {
@ -44,7 +44,7 @@ export interface CleanupStats {
*/
export class PeriodicCleanup {
private storage: StorageAdapter
private hnswIndex: HNSWIndex
private hnswIndex: JsHnswVectorIndex
private metadataIndex: MetadataIndexManager | null
private config: CleanupConfig
private stats: CleanupStats
@ -53,7 +53,7 @@ export class PeriodicCleanup {
constructor(
storage: StorageAdapter,
hnswIndex: HNSWIndex,
hnswIndex: JsHnswVectorIndex,
metadataIndex: MetadataIndexManager | null,
config: Partial<CleanupConfig> = {}
) {