@mikro-orm/core 7.0.5-dev.5 → 7.0.5-dev.6

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.
@@ -49,8 +49,11 @@ export declare class EntitySchema<Entity = any, Base = never, Class extends Enti
49
49
  /**
50
50
  * When schema links the entity class via `class` option, this registry allows the lookup from opposite side,
51
51
  * so we can use the class in `entities` option just like the EntitySchema instance.
52
+ *
53
+ * Stored on `globalThis` via `Symbol.for` to survive the CJS/ESM dual-package hazard
54
+ * (e.g. when `tsx` loads the same package in both module systems).
52
55
  */
53
- static REGISTRY: Map<AnyEntity, EntitySchema>;
56
+ static get REGISTRY(): Map<AnyEntity, EntitySchema>;
54
57
  /** @internal Type-level marker for fast entity type inference */
55
58
  readonly '~entity': Entity;
56
59
  private readonly _meta;
@@ -9,8 +9,14 @@ export class EntitySchema {
9
9
  /**
10
10
  * When schema links the entity class via `class` option, this registry allows the lookup from opposite side,
11
11
  * so we can use the class in `entities` option just like the EntitySchema instance.
12
+ *
13
+ * Stored on `globalThis` via `Symbol.for` to survive the CJS/ESM dual-package hazard
14
+ * (e.g. when `tsx` loads the same package in both module systems).
12
15
  */
13
- static REGISTRY = new Map();
16
+ static get REGISTRY() {
17
+ const key = Symbol.for('@mikro-orm/core/EntitySchema.REGISTRY');
18
+ return (globalThis[key] ??= new Map());
19
+ }
14
20
  _meta;
15
21
  internal = false;
16
22
  initialized = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.0.5-dev.5",
3
+ "version": "7.0.5-dev.6",
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",
package/utils/Utils.js CHANGED
@@ -129,7 +129,7 @@ export function parseJsonSafe(value) {
129
129
  /** Collection of general-purpose utility methods used throughout the ORM. */
130
130
  export class Utils {
131
131
  static PK_SEPARATOR = '~~~';
132
- static #ORM_VERSION = '7.0.5-dev.5';
132
+ static #ORM_VERSION = '7.0.5-dev.6';
133
133
  /**
134
134
  * Checks if the argument is instance of `Object`. Returns false for arrays.
135
135
  */