@mikro-orm/core 6.3.10-dev.16 → 6.3.10-dev.17
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.
|
@@ -11,15 +11,9 @@ function CreateRequestContext(getContext, respectExistingContext = false) {
|
|
|
11
11
|
return function (target, propertyKey, descriptor) {
|
|
12
12
|
const originalMethod = descriptor.value;
|
|
13
13
|
descriptor.value = async function (...args) {
|
|
14
|
-
// reuse existing context if available
|
|
15
|
-
if (respectExistingContext && RequestContext_1.RequestContext.currentRequestContext()) {
|
|
16
|
-
return originalMethod.apply(this, args);
|
|
17
|
-
}
|
|
18
|
-
// If we are inside explicit transaction context, we need to create another tx context.
|
|
19
14
|
// Otherwise, the outer tx context would be preferred.
|
|
20
15
|
const txContext = TransactionContext_1.TransactionContext.currentTransactionContext();
|
|
21
16
|
const provider = txContext ? TransactionContext_1.TransactionContext : RequestContext_1.RequestContext;
|
|
22
|
-
/* istanbul ignore next */
|
|
23
17
|
let orm;
|
|
24
18
|
let em;
|
|
25
19
|
if (typeof getContext === 'function') {
|
|
@@ -35,6 +29,10 @@ function CreateRequestContext(getContext, respectExistingContext = false) {
|
|
|
35
29
|
em = await this.em;
|
|
36
30
|
}
|
|
37
31
|
const create = async (em) => {
|
|
32
|
+
// reuse existing context if available for given respect `contextName`
|
|
33
|
+
if (respectExistingContext && RequestContext_1.RequestContext.getEntityManager(em.name)) {
|
|
34
|
+
return originalMethod.apply(this, args);
|
|
35
|
+
}
|
|
38
36
|
if (txContext) {
|
|
39
37
|
em = em.fork({ useContext: true });
|
|
40
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.3.10-dev.
|
|
3
|
+
"version": "6.3.10-dev.17",
|
|
4
4
|
"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.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"esprima": "4.0.1",
|
|
65
65
|
"fs-extra": "11.2.0",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.3.10-dev.
|
|
67
|
+
"mikro-orm": "6.3.10-dev.17",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|