@mikro-orm/core 6.6.12-dev.1 → 6.6.12-dev.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.6.12-dev.
|
|
3
|
+
"version": "6.6.12-dev.2",
|
|
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.3.3",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.6.12-dev.
|
|
67
|
+
"mikro-orm": "6.6.12-dev.2",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -436,12 +436,7 @@ class EntityComparator {
|
|
|
436
436
|
}
|
|
437
437
|
else {
|
|
438
438
|
ret += `${padding}if (${nullCond}) {\n`;
|
|
439
|
-
ret +=
|
|
440
|
-
// object for JSON embeddable
|
|
441
|
-
&& (p.object || (p.persist !== false))).map(childProp => {
|
|
442
|
-
const childDataKey = meta.embeddable || prop.object ? dataKey + this.wrap(childProp.embedded[1]) : this.wrap(childProp.name);
|
|
443
|
-
return `${padding} ret${childDataKey} = null;`;
|
|
444
|
-
}).join('\n') + `\n`;
|
|
439
|
+
ret += this.getInlineEmbeddedNullLines(meta, prop.name, padding, dataKey, !!(meta.embeddable || prop.object)).join('\n') + `\n`;
|
|
445
440
|
ret += `${padding}}\n`;
|
|
446
441
|
}
|
|
447
442
|
const cond = `entity${path.map(k => this.wrap(k)).join('')} != null`;
|
|
@@ -485,6 +480,16 @@ class EntityComparator {
|
|
|
485
480
|
}
|
|
486
481
|
return `${ret}${padding}}`;
|
|
487
482
|
}
|
|
483
|
+
getInlineEmbeddedNullLines(meta, parentName, padding, dataKey, useEmbeddedKey) {
|
|
484
|
+
return meta.props.filter(p => p.embedded?.[0] === parentName
|
|
485
|
+
&& (p.object || (p.persist !== false))).flatMap(childProp => {
|
|
486
|
+
const childDataKey = useEmbeddedKey ? dataKey + this.wrap(childProp.embedded[1]) : this.wrap(childProp.name);
|
|
487
|
+
if (childProp.kind === enums_1.ReferenceKind.EMBEDDED && !childProp.object) {
|
|
488
|
+
return this.getInlineEmbeddedNullLines(meta, childProp.name, padding, childDataKey, useEmbeddedKey);
|
|
489
|
+
}
|
|
490
|
+
return [`${padding} ret${childDataKey} = null;`];
|
|
491
|
+
});
|
|
492
|
+
}
|
|
488
493
|
registerCustomType(prop, context) {
|
|
489
494
|
const convertorKey = this.safeKey(prop.name);
|
|
490
495
|
context.set(`convertToDatabaseValue_${convertorKey}`, (val) => {
|