ruvector/npm/core/native/linux-x64/index.cjs
rUv ff87ffc086 fix: Export new NAPI functions in native wrapper
- Added CollectionManager, getMetrics, getHealth exports to index.cjs
- Fixed VectorDB/VectorDb naming inconsistency in TypeScript
- Added docker test script

All exports now working:
- VectorDB (vector operations)
- CollectionManager (multi-collection support)
- getHealth() (health status)
- getMetrics() (Prometheus metrics)
- version(), hello() (utils)

Tested in Docker container: PASSED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 19:05:00 +00:00

62 lines
1.3 KiB
JavaScript

/**
* Native binding wrapper for linux-x64
*/
const nativeBinding = require('./ruvector.node');
// The native module exports VectorDb (lowercase 'b') but we want VectorDB
// Also need to add the withDimensions static method since it's not exported properly
class VectorDB {
constructor(options) {
// Create internal instance
this._db = new nativeBinding.VectorDb(options);
}
static withDimensions(dimensions) {
// Factory method - create with default options
return new VectorDB({
dimensions: dimensions,
distanceMetric: 'Cosine',
storagePath: './ruvector.db'
});
}
async insert(entry) {
return this._db.insert(entry);
}
async insertBatch(entries) {
return this._db.insertBatch(entries);
}
async search(query) {
return this._db.search(query);
}
async delete(id) {
return this._db.delete(id);
}
async get(id) {
return this._db.get(id);
}
async len() {
return this._db.len();
}
async isEmpty() {
return this._db.isEmpty();
}
}
module.exports = {
VectorDB,
CollectionManager: nativeBinding.CollectionManager,
version: nativeBinding.version,
hello: nativeBinding.hello,
getMetrics: nativeBinding.getMetrics,
getHealth: nativeBinding.getHealth,
DistanceMetric: nativeBinding.JsDistanceMetric
};