@mikro-orm/core 7.1.5-dev.23 → 7.1.5-dev.25

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": "7.1.5-dev.23",
3
+ "version": "7.1.5-dev.25",
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",
@@ -549,7 +549,13 @@ export class EntityComparator {
549
549
  }
550
550
  getPropertySnapshot(meta, prop, context, dataKey, entityKey, path, level = 1, object) {
551
551
  const unwrap = prop.ref ? '?.unwrap()' : '';
552
- let ret = ` if (${this.getPropertyCondition(path)}`;
552
+ let condition = this.getPropertyCondition(path);
553
+ // a getter may dereference state that only exists once hydrated, so when snapshotting an
554
+ // unhydrated reference we short-circuit the read behind the initialized check
555
+ if (prop.getter && !prop.setter && path.length === 1) {
556
+ condition = `entity.__helper.__initialized && ${condition}`;
557
+ }
558
+ let ret = ` if (${condition}`;
553
559
  if (prop.lazy && prop.ref) {
554
560
  ret += ` && entity${path.map(k => this.wrap(k)).join('')}?.isInitialized()`;
555
561
  }
@@ -1,5 +1,4 @@
1
- import type { EntityManager } from '../EntityManager.js';
2
- import { type LoggingOptions } from '../logging/Logger.js';
1
+ import type { EntityManager, ForkOptions } from '../EntityManager.js';
3
2
  /**
4
3
  * Uses `AsyncLocalStorage` to create async context that holds the current EM fork.
5
4
  */
@@ -35,8 +34,6 @@ export declare class RequestContext {
35
34
  static getEntityManager(name?: string): EntityManager | undefined;
36
35
  private static createContext;
37
36
  }
38
- /** Options for creating a new RequestContext, allowing schema and logger overrides. */
39
- export interface CreateContextOptions {
40
- schema?: string;
41
- loggerContext?: LoggingOptions;
37
+ /** Options for creating a new RequestContext, allowing global overrides. */
38
+ export interface CreateContextOptions extends Omit<ForkOptions, 'useContext' | 'disableContextResolution' | 'keepTransactionContext' | 'clear'> {
42
39
  }
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.1.5-dev.23';
144
+ static #ORM_VERSION = '7.1.5-dev.25';
145
145
  /**
146
146
  * Checks if the argument is instance of `Object`. Returns false for arrays.
147
147
  */