@mikro-orm/core 6.6.12-dev.1 → 6.6.12

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.1",
3
+ "version": "6.6.12",
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.1",
67
+ "mikro-orm": "6.6.12",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -73,6 +73,7 @@ export declare class EntityComparator {
73
73
  */
74
74
  private shouldSerialize;
75
75
  private getEmbeddedPropertySnapshot;
76
+ private getInlineEmbeddedNullLines;
76
77
  private registerCustomType;
77
78
  private getPropertySnapshot;
78
79
  /**
@@ -436,12 +436,7 @@ class EntityComparator {
436
436
  }
437
437
  else {
438
438
  ret += `${padding}if (${nullCond}) {\n`;
439
- ret += meta.props.filter(p => p.embedded?.[0] === prop.name
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) => {