@mikro-orm/core 7.0.8-dev.7 → 7.0.8-dev.8
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 +1 -1
- package/utils/EntityComparator.d.ts +1 -0
- package/utils/EntityComparator.js +12 -9
- package/utils/Utils.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.0.8-dev.
|
|
3
|
+
"version": "7.0.8-dev.8",
|
|
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",
|
|
@@ -457,15 +457,7 @@ export class EntityComparator {
|
|
|
457
457
|
else {
|
|
458
458
|
ret += `${padding}if (${nullCond}) {\n`;
|
|
459
459
|
ret +=
|
|
460
|
-
meta.
|
|
461
|
-
.filter(p => p.embedded?.[0] === prop.name &&
|
|
462
|
-
// object for JSON embeddable
|
|
463
|
-
(p.object || p.persist !== false))
|
|
464
|
-
.map(childProp => {
|
|
465
|
-
const childDataKey = meta.embeddable || prop.object ? dataKey + this.wrap(childProp.embedded[1]) : this.wrap(childProp.name);
|
|
466
|
-
return `${padding} ret${childDataKey} = null;`;
|
|
467
|
-
})
|
|
468
|
-
.join('\n') + `\n`;
|
|
460
|
+
this.getInlineEmbeddedNullLines(meta, prop.name, padding, dataKey, !!(meta.embeddable || prop.object)).join('\n') + `\n`;
|
|
469
461
|
ret += `${padding}}\n`;
|
|
470
462
|
}
|
|
471
463
|
const cond = `entity${path.map(k => this.wrap(k)).join('')} != null`;
|
|
@@ -515,6 +507,17 @@ export class EntityComparator {
|
|
|
515
507
|
}
|
|
516
508
|
return `${ret}${padding}}`;
|
|
517
509
|
}
|
|
510
|
+
getInlineEmbeddedNullLines(meta, parentName, padding, dataKey, useEmbeddedKey) {
|
|
511
|
+
return meta.props
|
|
512
|
+
.filter(p => p.embedded?.[0] === parentName && (p.object || p.persist !== false))
|
|
513
|
+
.flatMap(childProp => {
|
|
514
|
+
const childDataKey = useEmbeddedKey ? dataKey + this.wrap(childProp.embedded[1]) : this.wrap(childProp.name);
|
|
515
|
+
if (childProp.kind === ReferenceKind.EMBEDDED && !childProp.object) {
|
|
516
|
+
return this.getInlineEmbeddedNullLines(meta, childProp.name, padding, childDataKey, useEmbeddedKey);
|
|
517
|
+
}
|
|
518
|
+
return [`${padding} ret${childDataKey} = null;`];
|
|
519
|
+
});
|
|
520
|
+
}
|
|
518
521
|
registerCustomType(prop, context) {
|
|
519
522
|
const convertorKey = this.safeKey(prop.name);
|
|
520
523
|
context.set(`convertToDatabaseValue_${convertorKey}`, (val) => {
|
package/utils/Utils.js
CHANGED
|
@@ -132,7 +132,7 @@ export function parseJsonSafe(value) {
|
|
|
132
132
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
133
133
|
export class Utils {
|
|
134
134
|
static PK_SEPARATOR = '~~~';
|
|
135
|
-
static #ORM_VERSION = '7.0.8-dev.
|
|
135
|
+
static #ORM_VERSION = '7.0.8-dev.8';
|
|
136
136
|
/**
|
|
137
137
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
138
138
|
*/
|