
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ts-data-mapper
Advanced tools
A typescript mapping tool supports mutual transforming between domain model and orm entity. In most case, domain model is not fully compatible with orm entity. you may need a mapping tool to convert model to entity when persisting and convert it back when
A typescript mapping tool supports mutual transforming between domain model and orm entity. In most case, domain model is not fully compatible with orm entity. you may need a mapping tool to convert model to entity when persisting and convert it back when accessing data.
npm i ts-data-mapper
class Model {
name: string
otherInfo: OtherType
}
@Entity()
class Entity {
@Column()
name: string
@Column()
otherInfo: string
}
import { Mapper } from 'ts-data-mapper'
const mapper = new Mapper(Model, Entity)
mapper.directMap('name').map('otherInfo', (model) => JSON.stringify(model.otherInfo));
if it has a bunch of property to map directly, you can also do below.
mapper.directMap(['name', 'gender'])
const model = new Model();
const entity = mapper.exec(model);
class Model {
//...
toEntity(): Entity {
const mapper = new Mapper(Model, Entity).directMap('name').map('otherInfo', (model) => JSON.stringify(model.otherInfo));
return mapper.exec(this);
}
}
class Entity {
//...
toModel(): Model {
const mapper = new Mapper(Entity, Model).directMap('name').map('otherInfo', (model) => JSON.parse(model.otherInfo));
return mapper.exec(this);
}
}
FAQs
A typescript mapping tool supports mutual transforming between domain model and orm entity. In most case, domain model is not fully compatible with orm entity. you may need a mapping tool to convert model to entity when persisting and convert it back when
The npm package ts-data-mapper receives a total of 0 weekly downloads. As such, ts-data-mapper popularity was classified as not popular.
We found that ts-data-mapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.