@mikro-orm/core 7.0.0-dev.2 → 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/EntityManager.js +1 -1
- package/MikroORM.js +2 -2
- package/decorators/CreateRequestContext.js +4 -1
- package/package.json +2 -2
package/EntityManager.js
CHANGED
|
@@ -250,7 +250,7 @@ export class EntityManager {
|
|
|
250
250
|
aliased: type === 'read',
|
|
251
251
|
});
|
|
252
252
|
where = (await this.applyFilters(entityName, where, options.filters ?? {}, type, options));
|
|
253
|
-
where =
|
|
253
|
+
where = this.applyDiscriminatorCondition(entityName, where);
|
|
254
254
|
return where;
|
|
255
255
|
}
|
|
256
256
|
// this method only handles the problem for mongo driver, SQL drivers have their implementation inside QueryBuilder
|
package/MikroORM.js
CHANGED
|
@@ -24,7 +24,7 @@ export class MikroORM {
|
|
|
24
24
|
*/
|
|
25
25
|
static async init(options) {
|
|
26
26
|
ConfigurationLoader.registerDotenv(options);
|
|
27
|
-
const coreVersion =
|
|
27
|
+
const coreVersion = ConfigurationLoader.checkPackageVersion();
|
|
28
28
|
const env = await ConfigurationLoader.loadEnvironmentVars();
|
|
29
29
|
if (!options) {
|
|
30
30
|
const configPathFromArg = ConfigurationLoader.configPathsFromArg();
|
|
@@ -35,7 +35,7 @@ export class MikroORM {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
options = Utils.mergeConfig(options, env);
|
|
38
|
-
|
|
38
|
+
ConfigurationLoader.commonJSCompat(options);
|
|
39
39
|
if ('DRIVER' in this && !options.driver) {
|
|
40
40
|
options.driver = this.DRIVER;
|
|
41
41
|
}
|
|
@@ -4,10 +4,13 @@ import { TransactionContext } from '../utils/TransactionContext.js';
|
|
|
4
4
|
export function CreateRequestContext(context, respectExistingContext = false) {
|
|
5
5
|
return function (target, propertyKey, descriptor) {
|
|
6
6
|
const originalMethod = descriptor.value;
|
|
7
|
+
const name = respectExistingContext ? 'EnsureRequestContext' : 'CreateRequestContext';
|
|
8
|
+
if (originalMethod.constructor.name !== 'AsyncFunction') {
|
|
9
|
+
throw new Error(`@${name}() should be use with async functions`);
|
|
10
|
+
}
|
|
7
11
|
descriptor.value = async function (...args) {
|
|
8
12
|
const em = await resolveContextProvider(this, context);
|
|
9
13
|
if (!em) {
|
|
10
|
-
const name = respectExistingContext ? 'EnsureRequestContext' : 'CreateRequestContext';
|
|
11
14
|
throw new Error(`@${name}() decorator can only be applied to methods of classes with \`orm: MikroORM\` property, \`em: EntityManager\` property, or with a callback parameter like \`@${name}(() => orm)\` that returns one of those types. The parameter will contain a reference to current \`this\`. Returning an EntityRepository from it is also supported.`);
|
|
12
15
|
}
|
|
13
16
|
// reuse existing context if available for given respect `contextName`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
4
|
+
"version": "7.0.0-dev.3",
|
|
5
5
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dotenv": "16.4.7",
|
|
56
56
|
"esprima": "4.0.1",
|
|
57
57
|
"globby": "11.1.0",
|
|
58
|
-
"mikro-orm": "7.0.0-dev.
|
|
58
|
+
"mikro-orm": "7.0.0-dev.3",
|
|
59
59
|
"reflect-metadata": "0.2.2"
|
|
60
60
|
}
|
|
61
61
|
}
|