Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@genially/typeorm-mimic
Advanced tools
typeorm-mimic is a small (but powerful) Node.js library to generate test data using only the TypeORM schema
typeorm-mimic is a simple (but powerful) Node.js library to generate test data using only the TypeORM schema.
npm install @genially/typeorm-mimic
Generates a mimetic document from schemaDefinition
schemaDefinition
: TypeORM schema definitionopts
: Generation options, where the options are in the following format: {
ignore: Array,
datesAsString: Boolean,
custom: {
field: {
value: Any,
type: String
}
}
}
Option | Type | Usage |
---|---|---|
ignore | Array | It can contains string paths or RegExp of fields to ignore during generation |
datesAsString | Boolean | Return dates as Date or String |
custom | Object | Special generator for specific fields |
custom.field.value | Any | Predefined value to the given field |
custom.field.type | String | Data type to generate to the given field, in the format: "type.subtype". Examples: "internet.email" or "address.city". See Faker.js methods to know all supported data types |
const { EntitySchema } = require('typeorm');
const mimic = require('@genially/typeorm-mimic');
const schemaDefinition = new EntitySchema({
name: 'Test',
columns: {
name: {
type: String,
default: 'Mimic'
},
address: {
type: String,
nullable: true
},
email: {
type: String
},
phones: {
type: [String]
},
birth_date: {
type: Date
},
role: {
enum: [0, 1, 2]
},
is_student: {
type: Boolean
},
created_at: {
type: Date,
default: Date.now
}
}
});
const randomObject = mimic(schemaDefinition, {
ignore: ['address'],
datesAsString: false,
custom: {
email: {
type: 'internet.email'
},
phones: {
type: 'phone.phoneNumber'
},
birth_date: {
value: () => new Date('December 25, 1995 23:15:30')
}
}
});
console.log(randomObject);
/*
{
name: "Mimic",
email: 'Timmothy_Wuckert@gmail.com',
birth_date: "1995-12-25T22:15:30.000Z",
phones: [
'(857) 375-1663',
'(601) 926-2014',
'(705) 324-8873 x9541',
'(693) 690-3304 x99775',
'1-088-666-8801 x6452',
'1-125-206-1792',
'607.384.4536',
'228.058.0088 x91535'
],
role: 0,
birth_date: 1995-12-25T22:15:30.000Z,
is_student: false,
created_at: 1568388626896
}
*/
To run the test cases use npm test
typeorm-mimic is strongly inspired by mongoose-mimic, which provides similar features to Mongoose ODM.
Licensed under MIT
FAQs
typeorm-mimic is a small (but powerful) Node.js library to generate test data using only the TypeORM schema
The npm package @genially/typeorm-mimic receives a total of 0 weekly downloads. As such, @genially/typeorm-mimic popularity was classified as not popular.
We found that @genially/typeorm-mimic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.