Registry / database / dulcimer

dulcimer

JSON →
library2.8.4jsnpmunverified

An ORM for embedded keystores in Node.js, providing a consistent API for developing with LevelDB and deploying with Riak. Version 2.8.4 is stable but development has largely halted; last updated in 2017. Notable features include models, indexes, foreign keys, derived fields, validation, and pagination. Unlike traditional SQL ORMs, Dulcimer is designed for key-value stores with limited querying capabilities. Backends: LevelDB (default) and Riak; Redis support was planned but never completed.

npm install dulcimer
INSTALL
IMPORT
SIG · DULCIMER
D
dulcimer
databasejavascriptv2.8.4
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.

dulcimer
✓ const dulcimer = require('dulcimer')
✗ import dulcimer from 'dulcimer'
Dulcimer does not support ESM imports; use CommonJS require.
Model
✓ const Person = new dulcimer.Model({...}, {name: 'person'})
✗ const Person = dulcimer.Model.create({...})
Model is a constructor, not a factory. Use 'new dulcimer.Model()'.
connect
✓ dulcimer.connect('./test.db')
✗ dulcimer.connect({type: 'level', path: './test.db'})
For LevelDB, a string path is accepted; object form is also valid but string is simpler.

Initialize a LevelDB store, define a Person model with a derived field, create and save an instance, then retrieve all records.

const dulcimer = require('dulcimer'); dulcimer.connect('./test.db'); const Person = new dulcimer.Model({ firstName: {}, lastName: {}, fullName: { derive: function () { return this.firstName + ' ' + this.lastName; } } }, {name: 'person'}); const nathan = Person.create({ firstName: 'Nathan', lastName: 'Fritz' }); nathan.save(function (err) { if (err) console.error(err); Person.all(function (err, persons) { if (err) console.error(err); persons.forEach(function (person) { console.log(person.toJSON()); }); }); });
Debug
Known issues
gotchaconnect() must be called before using any model methods; otherwise operations will fail silently.
fix
Call dulcimer.connect() immediately after require.
affects: >=0.0.0
gotchaModel keys are strings by default; if you use numeric keys, set keyType to 'number' in model options.
fix
Specify keyType: 'number' in model options or ensure keys are strings.
affects: >=1.0.0
deprecatedThe 'offset' option in queries is deprecated; use 'continuation' for pagination instead.
fix
Replace offset with continuation parameter in query options.
affects: >=2.0.0
gotchaForeign keys (foreignKey) do not automatically load related objects unless depth is set.
fix
Use {depth: 1} option in queries or manually call the foreign key getter.
affects: >=0.0.0
gotchaall() without options returns all objects; for large datasets use limit and continuation.
fix
Always specify a limit and use continuation for pagination.
affects: >=0.0.0
gotchaThe Riak backend requires riak-js version 0.9.x; newer versions are not compatible.
fix
Install riak-js@0.9.x explicitly.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: dulcimer.connect is not a function
Importing dulcimer incorrectly (e.g., using ESM import) or require() from a relative path that points to a different export.
fix
Use const dulcimer = require('dulcimer'); after npm install dulcimer.
Error: Model must have a name
Model definition missing the 'name' option in the second argument.
fix
Add {name: 'modelname'} as second parameter to new dulcimer.Model().
Error: No database connected
dulcimer.connect() was not called before performing database operations.
fix
Call dulcimer.connect() immediately after requiring the module.
Error: Key not found
Trying to get or delete a model instance that hasn't been saved or has a different key.
fix
Ensure the object is saved first and the key matches exactly (case-sensitive).
Upgrade
Version history
2.8.4latest on npm
Audit
Dependencies
leveloptionalDefault backend for development and testing
riak-jsoptionalOptional Riak backend for production
verymodelrequiredUnderlying model definition library
Agent activity
10 hits · last 30 days
node
10
Resources
dulcimer — npm install dulcimer · libregistry