Registry / database / typeorm-dm

typeorm-dm

JSON →
library1.0.43524jsnpmunverified

typeorm-dm is a database dialect package that enables TypeORM to connect and interact with Dameng (DMDB) databases. It acts as an adapter layer between TypeORM and the `dmdb` npm package, which is the official Node.js driver for Dameng. The current stable version is 1.0.43524. The project appears to have a fairly active release cadence, with multiple updates in 2024 and 2025, often driven by changes in the underlying `dmdb` driver. A key differentiator is its explicit requirement to use `DmdbDataSource` rather than relying on TypeORM's automatic driver loading, and its handling of features like `simple-enum` columns by converting them to `varchar` with check constraints. It specifically dropped runtime dependency on `oracledb` in v1.0.26038, highlighting its focus solely on Dameng.

npm install typeorm-dm
INSTALL
IMPORT
SIG · TYPEORM-DM
T
typeorm-dm
databasejavascriptv1.0.43524
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

DmdbDataSource
import { DmdbDataSource } from 'typeorm-dm'
const DmdbDataSource = require('typeorm-dm').DmdbDataSource
Primarily designed for ESM usage, as indicated by TypeScript examples. CommonJS usage is possible but less common.
DataSourceOptions for Dm
import { DataSourceOptions } from 'typeorm'; const config: DataSourceOptions = { type: 'oracle', innerType: 'dmdb', ... }
While `DmdbDataSource` is imported from `typeorm-dm`, the configuration object adheres to TypeORM's `DataSourceOptions` interface, with specific `type` and `innerType` fields.
reflect-metadata
import 'reflect-metadata'
A required polyfill for TypeORM's entity decorators to function correctly. This import should be at the very top of your application entry file.

This quickstart demonstrates how to initialize `DmdbDataSource`, define a TypeORM entity, save a new record, and retrieve all records from a Dameng database.

import "reflect-metadata"; import { DmdbDataSource } from "typeorm-dm"; import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"; @Entity() export class Photo { @PrimaryGeneratedColumn() id: number; @Column() name: string; @Column('text') description: string; @Column() filename: string; @Column() views: number; @Column() isPublished: boolean; } // Ensure Dameng is running and accessible, e.g., via Docker or a local installation. // Replace connection details with your actual Dameng server information. const AppDataSource = new DmdbDataSource({ type: "oracle", // TypeORM's internal type for Oracle/DMDB compatibility innerType: "dmdb", // Specific inner type for Dameng url: process.env.DM_DATABASE_URL ?? "dm://SYSDBA:SYSDBA@localhost:5236?schema=SYSDBA", // Recommended to use URL host: "localhost", port: 5236, username: process.env.DM_USERNAME ?? "SYSDBA", password: process.env.DM_PASSWORD ?? "SYSDBA", schema: process.env.DM_SCHEMA ?? "SYSDBA", entities: [Photo], synchronize: true, logging: false, }); AppDataSource.initialize() .then(async () => { console.log("Data Source has been initialized!"); const photoRepository = AppDataSource.getRepository(Photo); const newPhoto = new Photo(); newPhoto.name = "My First Photo"; newPhoto.description = "Just a test photo"; newPhoto.filename = "photo.jpg"; newPhoto.views = 1; newPhoto.isPublished = true; await photoRepository.save(newPhoto); console.log("Photo saved successfully."); const allPhotos = await photoRepository.find(); console.log("All photos:", allPhotos); await AppDataSource.destroy(); console.log("Data Source has been destroyed!"); }) .catch((error) => console.error("Error during Data Source initialization:", error));
Debug
Known issues
breakingThe underlying `dmdb` driver's parameter binding strategy changed, requiring a synchronous update to `typeorm-dm`.
fix
Ensure you are using `typeorm-dm` version 1.0.43524 or newer with the corresponding compatible `dmdb` version to avoid binding issues.
affects: >=1.0.43524
breakingThe `dmdb` driver's auto-commit configuration policy changed, necessitating updates in `typeorm-dm`.
fix
Upgrade to `typeorm-dm` version 1.0.34946 or later. Review your transaction management if explicit `dmdb` driver options were previously used.
affects: >=1.0.34946
gotchaThe package specifically handles `enum` and `simple-enum` column types by converting them to `varchar` with `CHECK` constraints in the database. This differs from native enum support in some other database systems.
fix
Be aware of this conversion when inspecting your database schema or migrating between database types. Ensure your enum values conform to the `varchar` length limits and the `CHECK` constraint.
affects: >=1.0.25820
gotchaUnlike TypeORM's automatic driver loading based on the `type` field, `DmdbDataSource` must be explicitly imported and used. Setting `type: "dmdb"` in a standard `DataSource` config will not work.
fix
Always import and instantiate `DmdbDataSource` directly: `import { DmdbDataSource } from "typeorm-dm"; const AppDataSource = new DmdbDataSource({ ... });`
affects: >=0.0.1
gotchaOlder versions might have issues with mixed `?` and `:` parameter placeholders in queries.
fix
Upgrade to `typeorm-dm` version 1.0.25580 or newer to fix potential issues with mixed parameter placeholder styles.
affects: <1.0.25580
deprecatedRuntime dependency on the `oracledb` module was removed.
fix
If you were implicitly relying on `typeorm-dm` to provide `oracledb` functionality, note that this is no longer the case. `typeorm-dm` is now exclusively for Dameng databases and does not support Oracle connections.
affects: <1.0.26038
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'initialize')
Attempting to use `new DataSource(...)` with `type: 'dmdb'` instead of explicitly importing `DmdbDataSource`.
fix
Import `DmdbDataSource` directly and instantiate it: `import { DmdbDataSource } from 'typeorm-dm'; const AppDataSource = new DmdbDataSource({ /* ... */ });`
Error: "dmdb" is not a valid database type. Please specify one of the following: "mysql", "mariadb", "postgres", "sqlite", "oracle", "mssql", "sap", "cockroachdb", "cordova", "react-native", "nativescript", "sqljs", "mongodb", "aurora-data-api", "aurora-data-api-pg", "expo", "capacitor", "spanner".
TypeORM's core `DataSource` does not natively recognize `dmdb` as a `type` option.
fix
When using `DmdbDataSource`, set `type: "oracle"` and `innerType: "dmdb"` in your configuration object. The `type` field uses TypeORM's internal `oracle` driver compatibility layer.
Upgrade
Version history
1.0.43524latest on npm
Audit
Dependencies
typeormrequiredPeer dependency, this package provides a dialect for TypeORM.
dmdbrequiredRuntime dependency, the underlying Dameng database driver.
Agent activity
45 hits · last 30 days
node
42
Meta
2
OpenAI (training)
1
Resources
typeorm-dm — npm install typeorm-dm · libregistry