@mikro-orm/nestjs 7.0.0-dev.1 → 7.0.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mikro-orm-core.module.js
CHANGED
|
@@ -105,15 +105,15 @@ let MikroOrmCoreModule = MikroOrmCoreModule_1 = class MikroOrmCoreModule {
|
|
|
105
105
|
}
|
|
106
106
|
try {
|
|
107
107
|
let config;
|
|
108
|
-
if ('
|
|
108
|
+
if (typeof options === 'object' && options && 'driver' in options) {
|
|
109
|
+
config = new Configuration(options, false);
|
|
110
|
+
}
|
|
111
|
+
if (!config && 'useFactory' in options) {
|
|
109
112
|
config = new Configuration(await options.useFactory(), false);
|
|
110
113
|
}
|
|
111
114
|
if (!config && options instanceof Configuration) {
|
|
112
115
|
config = options;
|
|
113
116
|
}
|
|
114
|
-
if (!config && typeof options === 'object' && options && 'driver' in options) {
|
|
115
|
-
config = new Configuration(options, false);
|
|
116
|
-
}
|
|
117
117
|
return config?.getDriver().createEntityManager();
|
|
118
118
|
}
|
|
119
119
|
catch {
|
package/mikro-orm.providers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityManager, MetadataStorage, MikroORM } from '@mikro-orm/core';
|
|
1
|
+
import { EntityManager, EntitySchema, MetadataStorage, MikroORM } from '@mikro-orm/core';
|
|
2
2
|
import { Scope } from '@nestjs/common';
|
|
3
3
|
import { MIKRO_ORM_MODULE_OPTIONS, getEntityManagerToken, getMikroORMToken, getRepositoryToken, logger, } from './mikro-orm.common.js';
|
|
4
4
|
import { MikroOrmEntitiesStorage } from './mikro-orm.entities.storage.js';
|
|
@@ -81,7 +81,7 @@ export function createMikroOrmRepositoryProviders(entities, contextName) {
|
|
|
81
81
|
const providers = [];
|
|
82
82
|
const inject = contextName ? getEntityManagerToken(contextName) : EntityManager;
|
|
83
83
|
(entities || []).forEach(entity => {
|
|
84
|
-
const meta = metadata.find(meta => meta.class === entity);
|
|
84
|
+
const meta = entity instanceof EntitySchema ? entity.meta : metadata.find(meta => meta.class === entity);
|
|
85
85
|
const repository = meta?.repository;
|
|
86
86
|
if (repository) {
|
|
87
87
|
providers.push({
|