@mikro-orm/core 6.3.3-dev.5 → 6.3.3-dev.7
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/entity/EntityLoader.d.ts +1 -0
- package/entity/EntityLoader.js +17 -2
- package/package.json +2 -2
package/entity/EntityLoader.d.ts
CHANGED
package/entity/EntityLoader.js
CHANGED
|
@@ -493,6 +493,20 @@ class EntityLoader {
|
|
|
493
493
|
}
|
|
494
494
|
return entities.filter(e => Utils_1.Utils.isCollection(e[field]) && !e[field].isInitialized(!ref));
|
|
495
495
|
}
|
|
496
|
+
isPropertyLoaded(entity, field) {
|
|
497
|
+
if (!entity) {
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
const wrapped = (0, wrap_1.helper)(entity);
|
|
501
|
+
if (!field.includes('.')) {
|
|
502
|
+
return wrapped.__loadedProperties.has(field);
|
|
503
|
+
}
|
|
504
|
+
const [f, ...r] = field.split('.');
|
|
505
|
+
if (wrapped.__loadedProperties.has(f) && wrapped.__meta.properties[f]?.targetMeta) {
|
|
506
|
+
return this.isPropertyLoaded(entity[f], r.join('.'));
|
|
507
|
+
}
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
496
510
|
filterReferences(entities, field, options, ref) {
|
|
497
511
|
if (ref) {
|
|
498
512
|
return [];
|
|
@@ -504,11 +518,12 @@ class EntityLoader {
|
|
|
504
518
|
if (options.fields) {
|
|
505
519
|
return children
|
|
506
520
|
.filter(e => {
|
|
507
|
-
const
|
|
521
|
+
const target = e[field];
|
|
522
|
+
const wrapped = (0, wrap_1.helper)(target);
|
|
508
523
|
const childFields = options.fields
|
|
509
524
|
.filter(f => f.startsWith(`${field}.`))
|
|
510
525
|
.map(f => f.substring(field.length + 1));
|
|
511
|
-
return !wrapped.__initialized || !childFields.every(
|
|
526
|
+
return !wrapped.__initialized || !childFields.every(cf => this.isPropertyLoaded(target, cf));
|
|
512
527
|
})
|
|
513
528
|
.map(e => Reference_1.Reference.unwrapReference(e[field]));
|
|
514
529
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.3.3-dev.
|
|
3
|
+
"version": "6.3.3-dev.7",
|
|
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.3-dev.
|
|
67
|
+
"mikro-orm": "6.3.3-dev.7",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|