mikro-orm
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -115,6 +115,8 @@ "use strict"; | ||
const files = fs_1.readdirSync(this.options.baseDir + '/' + basePath); | ||
this.logger(`- processing ${files.length} files from directory ${basePath}`); | ||
files.forEach(file => { | ||
if (file.lastIndexOf('.ts') === -1 || file.startsWith('.')) { | ||
if (!file.match(/\.[jt]s$/) || file.lastIndexOf('.js.map') !== -1 || file.startsWith('.')) { | ||
return; | ||
} | ||
this.logger(`- processing entity ${file.replace(/\.[jt]s$/, '')}`); | ||
this.logger(`- processing entity ${file}`); | ||
@@ -121,0 +123,0 @@ const name = file.split('.')[0]; |
@@ -78,2 +78,8 @@ "use strict"; | ||
} | ||
// strip default values | ||
for (let i = 0; i < result.length; i++) { | ||
if (result[i] === '=') { | ||
result.splice(i, 2); | ||
} | ||
} | ||
return result; | ||
@@ -80,0 +86,0 @@ } |
@@ -139,8 +139,10 @@ import { readdirSync } from 'fs'; | ||
const files = readdirSync(this.options.baseDir + '/' + basePath); | ||
this.logger(`- processing ${files.length} files from directory ${basePath}`); | ||
files.forEach(file => { | ||
if (file.lastIndexOf('.ts') === -1 || file.startsWith('.')) { | ||
if (!file.match(/\.[jt]s$/) || file.lastIndexOf('.js.map') !== -1 || file.startsWith('.')) { | ||
return; | ||
} | ||
this.logger(`- processing entity ${file.replace(/\.[jt]s$/, '')}`); | ||
this.logger(`- processing entity ${file}`); | ||
@@ -147,0 +149,0 @@ const name = file.split('.')[0]; |
@@ -100,2 +100,9 @@ import * as fastEqual from 'fast-deep-equal'; | ||
// strip default values | ||
for (let i = 0; i < result.length; i++) { | ||
if (result[i] === '=') { | ||
result.splice(i, 2); | ||
} | ||
} | ||
return result; | ||
@@ -102,0 +109,0 @@ } |
{ | ||
"name": "mikro-orm", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Simple typescript mongo ORM for node.js based on data-mapper, unit-of-work and identity-map patterns", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -13,7 +13,16 @@ import { BaseEntity, Collection, Entity, OneToMany, Property } from '../../lib'; | ||
constructor(name: string) { | ||
@Property() | ||
type: PublisherType = PublisherType.LOCAL; | ||
constructor(name: string = 'asd', type: PublisherType = PublisherType.LOCAL) { | ||
super(); | ||
this.name = name; | ||
this.type = type; | ||
} | ||
} | ||
export enum PublisherType { | ||
LOCAL = 'local', | ||
GLOBAL = 'global', | ||
} |
import { ObjectID } from 'bson'; | ||
import { MikroORM, EntityManager, Collection } from '../lib'; | ||
import { Collection, EntityManager, MikroORM } from '../lib'; | ||
import { Author } from './entities/Author'; | ||
import { Publisher } from './entities/Publisher'; | ||
import { Publisher, PublisherType } from './entities/Publisher'; | ||
import { Book } from './entities/Book'; | ||
@@ -44,3 +44,3 @@ import { AuthorRepository } from './repositories/AuthorRepository'; | ||
const publisher = new Publisher('7K publisher'); | ||
const publisher = new Publisher('7K publisher', PublisherType.GLOBAL); | ||
@@ -62,4 +62,6 @@ const book1 = new Book('My Life on The Wall, part 1', author); | ||
await repo.flush(); | ||
orm.em.clear(); | ||
// clear EM so we do not have author and publisher loaded in identity map | ||
const publisher7k = await orm.em.getRepository<Publisher>(Publisher.name).findOne({ name: '7K publisher' }); | ||
expect(publisher7k).not.toBeNull(); | ||
orm.em.clear(); | ||
@@ -66,0 +68,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118412
2971