Registry / database / dynatron

dynatron

JSON →
library8.0.1jsnpmunverified

An advanced ORM for AWS DynamoDB (v8.0.1, active development, frequent releases). Provides a high-level abstraction over the AWS SDK v3 DocumentClient, offering strongly-typed models, advanced querying, and built-in support for optimistic locking, transactional operations, and multi-table patterns. Unlike simpler ORMs, Dynatron handles complex DynamoDB concepts like secondary indexes, conditional updates, and batch operations. Latest version adds ESM support and improved TypeScript inference via conditional types. Ships TypeScript declarations.

npm install dynatron
INSTALL
IMPORT
SIG · DYNATRON
D
dynatron
databasejavascriptv8.0.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.

Model
import { Model } from 'dynatron'
const Model = require('dynatron').Model
ESM-only since v8; use named imports. Also avoid importing from 'dynatron/index'.
DynatronClient
import { DynatronClient } from 'dynatron'
import DynatronClient from 'dynatron'
DynatronClient is a named export, not default. Default import is not provided.
Query
import { Query } from 'dynatron'
const { Query } = require('dynatron')
Use ESM import; CJS require only works in Node with package.json type: module.

Shows basic setup of Model with DynamoDBClient, including create, find, conditional update, and secondary index query.

import { Model } from 'dynatron'; import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; import { NodeHttpHandler } from '@aws-sdk/node-http-handler'; const client = new DynamoDBClient({ region: 'us-east-1', requestHandler: new NodeHttpHandler() }); const User = new Model('Users', { schema: { id: { type: 'string', key: 'hash' }, name: { type: 'string' }, email: { type: 'string' }, age: { type: 'number' } }, client }); async function main() { // Create user await User.create({ id: '123', name: 'John Doe', email: 'john@example.com', age: 30 }); // Find user const user = await User.find({ id: '123' }); console.log(user); // Update user conditionally await User.update({ where: { id: '123' }, update: { age: 31 }, condition: 'attribute_exists(id)' }); // Query with secondary index const users = await User.query({ index: 'AgeIndex', keyCondition: { age: { gte: 25 } } }); console.log(users); } main();
Debug
Known issues
breakingESM-only since v8: CJS require() no longer works without package.json 'type': 'module'
fix
Switch to ESM imports or use dynamic import(). For older Node versions, use v7.x.
affects: >=8.0.0
deprecated@aws-sdk/node-http-handler will be replaced by the default NodeHttpHandler in newer SDK versions
fix
Use @aws-sdk/node-http-handler as peer dependency; future versions may remove this requirement.
affects: >=8.0.0
breakingModel() constructor no longer accepts client as second argument; must use options object.
fix
Use new Model('TableName', { schema: ..., client: ... }) instead of new Model('TableName', schema, client).
affects: >=8.0.0
gotchaAttributes named 'type' in schema can conflict with TypeScript property definitions
fix
Rename schema attribute 'type' to something else, e.g., 'attrType'.
affects: >=8.0.0
gotchaQuery on GSI requires explicit index name in 'index' parameter; ambiguous if not provided
fix
Always provide index name when using secondary indexes.
affects: >=7.0.0
Errors
Common errors & fixes
TypeError: Class extends value undefined is not a constructor or null
Missing required peer dependencies @aws-sdk/client-dynamodb or @aws-sdk/node-http-handler
fix
Install peer dependencies: npm install @aws-sdk/client-dynamodb @aws-sdk/node-http-handler
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Using CJS require() with dynatron v8 which is ESM-only
fix
Use import syntax or set 'type': 'module' in package.json
Failed to resolve 'dynatron' in TypeScript
Missing '@types/node' or tsconfig not set for Node.js module resolution
fix
Install @types/node and ensure tsconfig includes 'moduleResolution': 'node'
Upgrade
Version history
8.0.1latest on npm
Audit
Dependencies
@aws-sdk/client-dynamodbrequiredDynamoDB service client required for DynamoDB operations
@aws-sdk/node-http-handlerrequiredHTTP handler for Node.js runtime required for DynamoDB requests
Agent activity
10 hits · last 30 days
node
8
Resources
dynatron — npm install dynatron · libregistry