@mikro-orm/core 7.0.10-dev.15 → 7.0.10-dev.17

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.
@@ -5,7 +5,9 @@ import { Reference } from './Reference.js';
5
5
  import { helper, wrap } from './wrap.js';
6
6
  import { QueryHelper } from '../utils/QueryHelper.js';
7
7
  import { inspect } from '../logging/inspect.js';
8
- const collectionSymbol = Symbol('Collection');
8
+ // Globally registered so the marker survives the CJS/ESM dual-package hazard
9
+ // (see entitySymbol rationale in EntityHelper.ts and #7515/#7534).
10
+ const collectionSymbol = Symbol.for('@mikro-orm/core/Collection');
9
11
  /** Represents a to-many relation (1:m or m:n) as an iterable, managed collection of entities. */
10
12
  export class Collection {
11
13
  owner;
@@ -4,8 +4,10 @@ import { Utils } from '../utils/Utils.js';
4
4
  import { QueryHelper } from '../utils/QueryHelper.js';
5
5
  import { NotFoundError } from '../errors.js';
6
6
  import { inspect } from '../logging/inspect.js';
7
- const referenceSymbol = Symbol('Reference');
8
- const scalarReferenceSymbol = Symbol('ScalarReference');
7
+ // Globally registered so the markers survive the CJS/ESM dual-package hazard
8
+ // (see entitySymbol rationale in EntityHelper.ts and #7515/#7534).
9
+ const referenceSymbol = Symbol.for('@mikro-orm/core/Reference');
10
+ const scalarReferenceSymbol = Symbol.for('@mikro-orm/core/ScalarReference');
9
11
  /** Wrapper around an entity that provides lazy loading capabilities and identity-preserving reference semantics. */
10
12
  export class Reference {
11
13
  entity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.0.10-dev.15",
3
+ "version": "7.0.10-dev.17",
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",
@@ -163,6 +163,10 @@ export class TransactionManager {
163
163
  const parentEntity = parentUoW.getById(meta.class, wrapped.getPrimaryKey(), parent.schema, true);
164
164
  if (parentEntity && parentEntity !== entity) {
165
165
  const parentWrapped = helper(parentEntity);
166
+ // Don't overwrite a fully-loaded entity with an uninitialized reference
167
+ if (!wrapped.__initialized && parentWrapped.__initialized) {
168
+ continue;
169
+ }
166
170
  parentWrapped.__data = wrapped.__data;
167
171
  parentWrapped.__originalEntityData = wrapped.__originalEntityData;
168
172
  for (const prop of meta.hydrateProps) {
package/utils/Utils.js CHANGED
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
141
141
  /** Collection of general-purpose utility methods used throughout the ORM. */
142
142
  export class Utils {
143
143
  static PK_SEPARATOR = '~~~';
144
- static #ORM_VERSION = '7.0.10-dev.15';
144
+ static #ORM_VERSION = '7.0.10-dev.17';
145
145
  /**
146
146
  * Checks if the argument is instance of `Object`. Returns false for arrays.
147
147
  */