@mikro-orm/core 6.4.16-dev.1 → 6.4.16-dev.10

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.
@@ -13,6 +13,7 @@ export type EntityOptions<T, E = T extends EntityClass<infer P> ? P : T> = {
13
13
  abstract?: boolean;
14
14
  readonly?: boolean;
15
15
  virtual?: boolean;
16
+ hasTriggers?: boolean;
16
17
  expression?: string | ((em: any, where: ObjectQuery<E>, options: FindOptions<E, any, any, any>) => object);
17
18
  repository?: () => Constructor;
18
19
  };
@@ -213,6 +213,7 @@ class EntityHelper {
213
213
  }
214
214
  if (old?.[prop2.name] != null) {
215
215
  delete (0, wrap_1.helper)(old).__data[prop2.name];
216
+ old[prop2.name] = null;
216
217
  }
217
218
  }
218
219
  static ensurePropagation(entity) {
@@ -231,7 +231,7 @@ class EntityLoader {
231
231
  let where = this.mergePrimaryCondition(ids, fk, options, meta, this.metadata, this.driver.getPlatform());
232
232
  const fields = this.buildFields(options.fields, prop, ref);
233
233
  /* eslint-disable prefer-const */
234
- let { refresh, filters, convertCustomTypes, lockMode, strategy, populateWhere, connectionType, logging, } = options;
234
+ let { refresh, filters, convertCustomTypes, lockMode, strategy, populateWhere = 'infer', connectionType, logging, } = options;
235
235
  /* eslint-enable prefer-const */
236
236
  if (typeof populateWhere === 'object') {
237
237
  populateWhere = await this.extractChildCondition({ where: populateWhere }, prop);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.4.16-dev.1",
3
+ "version": "6.4.16-dev.10",
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.0",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.4.16-dev.1",
67
+ "mikro-orm": "6.4.16-dev.10",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -76,18 +76,21 @@ class SerializationContext {
76
76
  }
77
77
  }
78
78
  isMarkedAsPopulated(entityName, prop) {
79
- let populate = this.populate;
79
+ let populate = this.populate ?? [];
80
80
  for (const segment of this.path) {
81
- if (!populate) {
82
- return false;
83
- }
84
- const exists = populate.find(p => p.field === segment[1]);
85
- if (exists) {
86
- // we need to check for cycles here too, as we could fall into endless loops for bidirectional relations
87
- if (exists.all) {
88
- return !this.path.find(([cls, item]) => entityName === cls && prop === item);
81
+ const hints = populate.filter(p => p.field === segment[1]);
82
+ if (hints.length > 0) {
83
+ const childHints = [];
84
+ for (const hint of hints) {
85
+ // we need to check for cycles here too, as we could fall into endless loops for bidirectional relations
86
+ if (hint.all) {
87
+ return !this.path.find(([cls, item]) => entityName === cls && prop === item);
88
+ }
89
+ if (hint.children) {
90
+ childHints.push(...hint.children);
91
+ }
89
92
  }
90
- populate = exists.children;
93
+ populate = childHints;
91
94
  }
92
95
  }
93
96
  return !!populate?.some(p => p.field === prop);
package/typings.d.ts CHANGED
@@ -477,6 +477,7 @@ export interface EntityMetadata<T = any> {
477
477
  polymorphs?: EntityMetadata[];
478
478
  root: EntityMetadata<T>;
479
479
  definedProperties: Dictionary;
480
+ hasTriggers?: boolean;
480
481
  /** @internal can be used for computed numeric cache keys */
481
482
  readonly _id: number;
482
483
  }