Registry / database / bare-sqlite-vector

bare-sqlite-vector

JSON →
library0.1.1jsnpmunverified

SQLite Vector bindings for Bare that statically embed the sqlite-vector extension for vector encoding, nearest-neighbour search, and quantization-based ANN search. Version 0.1.1 is the current stable release, with no active release cadence. Key differentiators: tight integration with bare-sqlite, idempotent per-connection registration, and support for FLOAT32 vectors with L2 distance. No npm download statistics available; it is targeted at Bare runtime environments.

npm install bare-sqlite-vector
INSTALL
IMPORT
SIG · BARE-SQLITE-VECTOR
B
bare-sqlite-vector
databasejavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

register
✓ import { register } from 'bare-sqlite-vector'
✗ const register = require('bare-sqlite-vector').register
Package is ESM-only; named export for register function.
default (require)
✓ const vector = require('bare-sqlite-vector')
✗ const { register } = require('bare-sqlite-vector')
CommonJS require works but returns the whole module; use vector.register(). Named export destructuring from require fails.
TypeScript type imports
✓ import type { SQLiteVector } from 'bare-sqlite-vector'
TypeScript types are shipped; import type for type-only usage.

Shows import, registration, table creation, vector initialization, and nearest-neighbour query using bare-sqlite-vector.

import { DatabaseSync } from 'bare-sqlite'; import { register } from 'bare-sqlite-vector'; const db = new DatabaseSync(':memory:'); register(db); db.exec(` CREATE TABLE points (id INTEGER PRIMARY KEY, v BLOB); INSERT INTO points (v) VALUES (vector_as_f32('[1.0, 0.0, 0.0, 0.0]')); INSERT INTO points (v) VALUES (vector_as_f32('[0.0, 1.0, 0.0, 0.0]')); `); db.prepare("SELECT vector_init('points', 'v', 'type=FLOAT32,dimension=4,distance=L2')").get(); const rows = db .prepare( "SELECT rowid, distance FROM vector_full_scan('points', 'v', vector_as_f32('[0.9, 0.1, 0.0, 0.0]'), 2)" ) .all(); console.log(rows);
Debug
Known issues
gotchaVector extension must be registered per-connection; each new DatabaseSync instance requires a separate register() call.
fix
Call `register(db)` for every new database connection.
affects: >=0.0.0
gotchaIf the database connection is closed, register() throws 'DATABASE_NOT_OPEN'. Trying to use vector functions on a closed connection will fail.
fix
Ensure the database is open before calling register() and before any vector operations.
affects: >=0.0.0
gotchaImport style: Named export `register` is only available via ESM `import { register }`. CommonJS `require('bare-sqlite-vector')` returns the whole module object, and destructuring (`const { register } = require(...)`) will be `undefined` if the module uses ESM interop incorrectly.
fix
Use ESM `import { register }` or CommonJS `const vector = require('bare-sqlite-vector')` and call `vector.register(db)`.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: register is not a function
Using destructured require when the module does not support named require destructuring.
fix
Use `const vector = require('bare-sqlite-vector')` then call `vector.register(db)`.
Error: DATABASE_NOT_OPEN
Calling register() on a closed DatabaseSync instance.
fix
Create a new DatabaseSync or reopen the database before calling register().
RangeError: Invalid vector dimension
Passing a vector with mismatched dimensions or unsupported type.
fix
Ensure vectors match the dimension and type specified in vector_init (e.g., FLOAT32 dimension=4).
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
bare-sqliterequiredRequired for database connections; the vector extension registers against a bare-sqlite DatabaseSync instance.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
bare-sqlite-vector — npm install bare-sqlite-vector · libregistry