Registry / database / aerospike-orm

aerospike-orm

JSON →
library1.0.6jsnpmunverified

A TypeScript utility library (v1.0.6) for Aerospike that provides an entity-based ORM pattern using decorators (@Bin) and a base repository (BaseRepository) for CRUD, batch, and query operations. It is designed to simplify mapping class properties to Aerospike bins with support for default values and required fields. The library is ESM-only and depends on the aerospike client package. It is actively maintained with a low release cadence.

npm install aerospike-orm
INSTALL
IMPORT
SIG · AEROSPIKE-ORM
A
aerospike-orm
databasejavascriptv1.0.6
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.

BaseEntity
import { BaseEntity } from 'aerospike-orm'
import BaseEntity from 'aerospike-orm'
BaseEntity is a named export, not a default export
Bin
import { Bin } from 'aerospike-orm'
const Bin = require('aerospike-orm').Bin
ESM-only package; require() will not work
BaseRepository
import { BaseRepository } from 'aerospike-orm'
import { BaseRepository } from 'aerospike'
BaseRepository is from aerospike-orm, not aerospike

Demonstrates creating an entity class with Bin decorators, a custom repository, connecting to Aerospike, and performing a getOrCreate operation.

import { BaseEntity, Bin, BaseRepository } from 'aerospike-orm'; import { Client as AerospikeClient, exp } from 'aerospike'; class User extends BaseEntity { @Bin('username', { required: true }) public name!: string; @Bin() public email?: string; @Bin('age', { default: 18 }) public age?: number; } class UserRepository extends BaseRepository<User> { protected instantiate(bins: any): User { return User.fromRecord(bins); } } const client = new AerospikeClient({ hosts: '127.0.0.1:3000' }); async function main() { await client.connect(); const repo = new UserRepository(client, 'test', 'users'); const user = await repo.getOrCreate('user1', { name: 'Cool Name' }); console.log(user.toRecord()); await client.close(); } main().catch(console.error);
Debug
Known issues
breakingThe package is ESM-only. CommonJS (require) will throw an error.
fix
Use import syntax and ensure your project is configured for ESM (type: 'module' in package.json or .mjs extension).
affects: >=1.0.0
gotchaThe @Bin decorator with 'required: true' does not enforce validation at runtime; it only skips serialization if the value is missing. Database writes may still succeed with undefined values.
fix
Implement manual validation before save for required fields.
affects: >=1.0.0
gotchaBaseEntity.id must be a string or number. Using other types (e.g., object) may cause unexpected serialization errors.
fix
Ensure id is always string or number.
affects: >=1.0.0
deprecatedThe aerospike client package v5+ uses exp module for expressions; older patterns like Client.query are deprecated.
fix
Use exp module for filter expressions as shown in the README.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'aerospike-orm'
Package is ESM-only and project does not have type: 'module' in package.json.
fix
Add 'type': 'module' to your package.json or rename file to .mjs.
TypeError: Class extends value undefined is not a constructor or null
Using require('aerospike-orm') instead of import.
fix
Use ES module import syntax.
Property 'fromRecord' does not exist on type 'typeof BaseEntity'
Incorrect import of BaseEntity (default instead of named).
fix
Use import { BaseEntity } from 'aerospike-orm'.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
aerospikerequiredPeer dependency: the official Aerospike Node.js client is required for database operations
Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
aerospike-orm — npm install aerospike-orm · libregistry