@mikro-orm/core 7.0.4-dev.13 → 7.0.4-dev.14
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.
|
@@ -122,7 +122,7 @@ export class ObjectHydrator extends Hydrator {
|
|
|
122
122
|
ret.push(` entity${entityKey} = data${dataKey};`);
|
|
123
123
|
}
|
|
124
124
|
if (prop.ref) {
|
|
125
|
-
ret.push(` const value = entity${entityKey};`);
|
|
125
|
+
ret.push(` const value = entity${entityKey}?.__scalarReference ? entity${entityKey}.unwrap() : entity${entityKey};`);
|
|
126
126
|
ret.push(` entity${entityKey} = oldValue_${idx} ?? new ScalarReference(value);`);
|
|
127
127
|
ret.push(` entity${entityKey}.bind(entity, '${prop.name}');`);
|
|
128
128
|
ret.push(` entity${entityKey}.set(value);`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.0.4-dev.
|
|
3
|
+
"version": "7.0.4-dev.14",
|
|
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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -525,7 +525,11 @@ export class EntityComparator {
|
|
|
525
525
|
}
|
|
526
526
|
getPropertySnapshot(meta, prop, context, dataKey, entityKey, path, level = 1, object) {
|
|
527
527
|
const unwrap = prop.ref ? '?.unwrap()' : '';
|
|
528
|
-
let ret = ` if (${this.getPropertyCondition(path)}
|
|
528
|
+
let ret = ` if (${this.getPropertyCondition(path)}`;
|
|
529
|
+
if (prop.lazy && prop.ref) {
|
|
530
|
+
ret += ` && entity${path.map(k => this.wrap(k)).join('')}?.isInitialized()`;
|
|
531
|
+
}
|
|
532
|
+
ret += `) {\n`;
|
|
529
533
|
if (['number', 'string', 'boolean'].includes(prop.type.toLowerCase())) {
|
|
530
534
|
return ret + ` ret${dataKey} = entity${entityKey}${unwrap};\n }\n`;
|
|
531
535
|
}
|
package/utils/Utils.js
CHANGED
|
@@ -129,7 +129,7 @@ export function parseJsonSafe(value) {
|
|
|
129
129
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
130
130
|
export class Utils {
|
|
131
131
|
static PK_SEPARATOR = '~~~';
|
|
132
|
-
static #ORM_VERSION = '7.0.4-dev.
|
|
132
|
+
static #ORM_VERSION = '7.0.4-dev.14';
|
|
133
133
|
/**
|
|
134
134
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
135
135
|
*/
|