
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
typeorm-seed
Advanced tools
TypeORM Seed Utils is an opinionated library to write and run database seeds.
Run npm install typeorm-seed
typeorm-seed <command> <...files>
uptypeorm-seed up roles users
This will execute sequentially the files dist/data/seeds/roles.js and dist/data/seeds/users.js. Base directory (dist/data/seeds) is not configurable at the moment.
downtypeorm-seed down users roles
This command will revert seed files users.js and roles.js.
cleartypeorm-seed clear
Clear all data from all models registered in configured connection (ormconfig.json).
--helptypeorm-seed --help
Seed files should be added at src/data/seeds/<seedFile>.ts. Base path will be configurable in the future.
Examples of seed files will be added later.
Allows generating data and seeding it to database from the provided factories and models.
Code example:
import * as faker from 'faker';
import { SeedFactoryManager } from 'typeorm-seed';
import { SampleModel, OtherModel } from 'data/models';
const createSampleModel = () => ({
uuid: faker.random.uuid(),
name: faker.name.firstName(),
});
const createOtherModel = () => ({
uuid: faker.random.uuid(),
name: faker.name.firstName(),
});
export const modelsFactories: SeedFactoryManager = new SeedFactoryManager()
.register(SampleModel, createSampleModel)
.register(OtherModel, createOtherModel);
Using model factories:
modelsFactories.makeOne(SampleModel); // create a Sample object from random data (using faker factory)
modelsFactories.makeOne(SampleModel, data); // create a Sample object from provided (partial) data
modelsFactories.makeMany(SampleModel, data, 10); // create 10 Sample objects
await modelsFactories.seedOne(SampleModel); // create and save to database one Sample object
await modelsFactories.seedOne(SampleModel, data, 10); // create and save to database 10 Sample objects
await modelsFactories.seedAll(SampleModel, data); // create and save Sample objects from an array of partial entities
Providing custom connection to an instance of SeedFactoryManager:
modelsFactories.setConnection(customConnection);
Clearing the database:
import { clearEntities, clearDatabase } from 'typeorm-seed';
clearEntities([SampleModel, OtherModel]); // deletes data from specified entities
clearDatabase(customConnection); // deletes data from all entities registered connection (ormconfig.json)
FAQs
typeorm seed
The npm package typeorm-seed receives a total of 115 weekly downloads. As such, typeorm-seed popularity was classified as not popular.
We found that typeorm-seed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.