Registry / database / daymon

daymon

JSON →
library1.2.27jsnpmunverified

Daymon is an ORM for DynamoDB, currently at version 1.2.27. It provides a simple promise-based API for querying, scanning, saving, and updating items. Key features include automatic timestamp management, empty string conversion, and support for primary and secondary index queries. It is open-source but in early active development, so new versions are continuously published. Compared to other DynamoDB libraries like Dynamoose, Daymon is more lightweight with less abstraction, focusing on direct CRUD operations without schema definitions.

npm install daymon
INSTALL
IMPORT
SIG · DAYMON
D
daymon
databasejavascriptv1.2.27
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.

daymon
✓ import daymon from 'daymon';
✗ const daymon = require('daymon');
Daymon is ESM-friendly but traditionally used with require. The default export is a factory function that takes options.
daymon (factory)
✓ const daymon = require('daymon')(options);
✗ const daymon = require('daymon'); daymon(options);
The require returns a function that must be called immediately with options. This is a common mistake where users try to call daymon as a constructor later.
Model (from factory)
✓ const Model = daymon('users');
✗ const Model = require('daymon')('users');
After calling require('daymon')(options), you get a function that takes a table name and returns a model class. Users often try to call require directly with a table name.

Demonstrates initializing Daymon with AWS config and timestamps, creating a model, saving an item, and handling the response.

const daymon = require('daymon')({ awsConfig: { region: process.env.AWS_REGION ?? 'us-east-1', accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '', secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? '' }, convertEmptyStringToNull: true, timeStamps: { update: 'dateUpdated', create: 'dateCreated' } }); const User = daymon('users'); const user = new User({ name: 'John', email: 'john@example.com' }); user.save().then(item => { console.log('Saved:', item); }).catch(err => { console.error('Save failed:', err); });
Debug
Known issues
gotchaThe options object for queries must include the table's primary hash key or a secondary index hash key; otherwise an error is thrown.
fix
Ensure query options contain a key matching the table's hash key or a defined secondary index.
affects: >=1.0.0
gotchaWhen saving an object that already has a primary hash key, an update is performed instead of an insert. This may overwrite existing attributes.
fix
Use the update() method explicitly if you want to update; or remove the hash key to force an insert.
affects: >=1.0.0
gotchaconvertEmptyStringToNull: true converts empty strings to null. When false, empty string attributes are not updated at all.
fix
Set convertEmptyStringToNull: true if you want empty strings to be stored as null, otherwise they will be skipped on updates.
affects: >=1.0.0
gotchaThe library is in early development; breaking changes may occur without notice.
fix
Pin to a specific version and test upgrades carefully.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: daymon is not a function
Calling require('daymon') without calling it as a factory (missing the invocation with options).
fix
Use require('daymon')(options) instead of just require('daymon').
Error: Missing required parameter: hashKey
The query options object does not contain the primary hash key or a secondary index hash key.
fix
Include the hash key (e.g., { id: 'value' }) in the query options.
ValidationException: The provided key element does not match the schema
Trying to update an item with a hash key that doesn't exist or using the wrong key structure.
fix
Ensure the object passed to update() has the correct hash key matching the table schema.
Upgrade
Version history
1.2.27latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
packagedaymon ↗
daymon — npm install daymon · libregistry