@mikro-orm/core 7.0.0-dev.67 → 7.0.0-dev.68

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/MikroORM.d.ts CHANGED
@@ -63,8 +63,6 @@ export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver,
63
63
  * Gets the `EntityMetadata` instance when provided with the `entityName` parameter.
64
64
  */
65
65
  getMetadata<Entity extends object>(entityName: EntityName<Entity>): EntityMetadata<Entity>;
66
- discoverEntities(): Promise<void>;
67
- discoverEntitiesSync(): void;
68
66
  private createEntityManager;
69
67
  /**
70
68
  * Allows dynamically discovering new entity by reference, handy for testing schema diffing.
package/MikroORM.js CHANGED
@@ -27,7 +27,9 @@ export class MikroORM {
27
27
  options.discovery ??= {};
28
28
  options.discovery.skipSyncDiscovery ??= true;
29
29
  const orm = new this(options);
30
- await orm.discoverEntities();
30
+ const preferTs = orm.config.get('preferTs', Utils.detectTypeScriptSupport());
31
+ orm.metadata = await orm.discovery.discover(preferTs);
32
+ orm.createEntityManager();
31
33
  return orm;
32
34
  }
33
35
  /**
@@ -51,7 +53,8 @@ export class MikroORM {
51
53
  extension.register(this);
52
54
  }
53
55
  if (!discovery.skipSyncDiscovery) {
54
- this.discoverEntitiesSync();
56
+ this.metadata = this.discovery.discoverSync();
57
+ this.createEntityManager();
55
58
  }
56
59
  }
57
60
  /**
@@ -105,23 +108,6 @@ export class MikroORM {
105
108
  }
106
109
  return this.metadata;
107
110
  }
108
- async discoverEntities() {
109
- // we need to allow global context here as we are not in a scope of requests yet
110
- const allowGlobalContext = this.config.get('allowGlobalContext');
111
- this.config.set('allowGlobalContext', true);
112
- const preferTs = this.config.get('preferTs', Utils.detectTypeScriptSupport());
113
- this.metadata = await this.discovery.discover(preferTs);
114
- this.createEntityManager();
115
- this.config.set('allowGlobalContext', allowGlobalContext);
116
- }
117
- discoverEntitiesSync() {
118
- // we need to allow global context here as we are not in a scope of requests yet
119
- const allowGlobalContext = this.config.get('allowGlobalContext');
120
- this.config.set('allowGlobalContext', true);
121
- this.metadata = this.discovery.discoverSync();
122
- this.createEntityManager();
123
- this.config.set('allowGlobalContext', allowGlobalContext);
124
- }
125
111
  createEntityManager() {
126
112
  this.driver.setMetadata(this.metadata);
127
113
  this.em = this.driver.createEntityManager();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.67",
4
+ "version": "7.0.0-dev.68",
5
5
  "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.",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
@@ -52,7 +52,7 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "mikro-orm": "7.0.0-dev.67"
55
+ "mikro-orm": "7.0.0-dev.68"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "dataloader": "2.2.3"