@mikro-orm/core 7.0.0-dev.1 → 7.0.0-dev.11

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.
Files changed (261) hide show
  1. package/EntityManager.d.ts +25 -16
  2. package/EntityManager.js +219 -209
  3. package/MikroORM.d.ts +7 -6
  4. package/MikroORM.js +33 -45
  5. package/cache/CacheAdapter.js +1 -2
  6. package/cache/FileCacheAdapter.d.ts +1 -1
  7. package/cache/FileCacheAdapter.js +18 -26
  8. package/cache/GeneratedCacheAdapter.d.ts +2 -2
  9. package/cache/GeneratedCacheAdapter.js +1 -5
  10. package/cache/MemoryCacheAdapter.d.ts +1 -1
  11. package/cache/MemoryCacheAdapter.js +1 -5
  12. package/cache/NullCacheAdapter.d.ts +1 -1
  13. package/cache/NullCacheAdapter.js +1 -5
  14. package/cache/index.d.ts +5 -5
  15. package/cache/index.js +5 -21
  16. package/connections/Connection.d.ts +7 -7
  17. package/connections/Connection.js +8 -12
  18. package/connections/index.d.ts +1 -1
  19. package/connections/index.js +1 -17
  20. package/decorators/Check.d.ts +2 -2
  21. package/decorators/Check.js +5 -8
  22. package/decorators/CreateRequestContext.d.ts +1 -1
  23. package/decorators/CreateRequestContext.js +13 -14
  24. package/decorators/Embeddable.d.ts +5 -5
  25. package/decorators/Embeddable.js +4 -7
  26. package/decorators/Embedded.d.ts +3 -3
  27. package/decorators/Embedded.js +10 -12
  28. package/decorators/Entity.d.ts +6 -6
  29. package/decorators/Entity.js +5 -9
  30. package/decorators/Enum.d.ts +3 -3
  31. package/decorators/Enum.js +7 -10
  32. package/decorators/Filter.d.ts +1 -1
  33. package/decorators/Filter.js +3 -6
  34. package/decorators/Formula.d.ts +2 -3
  35. package/decorators/Formula.js +7 -10
  36. package/decorators/Indexed.d.ts +10 -8
  37. package/decorators/Indexed.js +7 -11
  38. package/decorators/ManyToMany.d.ts +4 -4
  39. package/decorators/ManyToMany.js +10 -12
  40. package/decorators/ManyToOne.d.ts +4 -4
  41. package/decorators/ManyToOne.js +10 -12
  42. package/decorators/OneToMany.d.ts +6 -6
  43. package/decorators/OneToMany.js +11 -14
  44. package/decorators/OneToOne.d.ts +4 -4
  45. package/decorators/OneToOne.js +4 -7
  46. package/decorators/PrimaryKey.d.ts +3 -4
  47. package/decorators/PrimaryKey.js +10 -13
  48. package/decorators/Property.d.ts +6 -6
  49. package/decorators/Property.js +10 -12
  50. package/decorators/Transactional.d.ts +2 -2
  51. package/decorators/Transactional.js +7 -10
  52. package/decorators/hooks.js +23 -35
  53. package/decorators/index.d.ts +17 -17
  54. package/decorators/index.js +17 -36
  55. package/drivers/DatabaseDriver.d.ts +13 -12
  56. package/drivers/DatabaseDriver.js +60 -64
  57. package/drivers/IDatabaseDriver.d.ts +16 -13
  58. package/drivers/IDatabaseDriver.js +1 -4
  59. package/drivers/index.d.ts +2 -2
  60. package/drivers/index.js +2 -18
  61. package/entity/ArrayCollection.d.ts +3 -3
  62. package/entity/ArrayCollection.js +38 -35
  63. package/entity/BaseEntity.d.ts +6 -6
  64. package/entity/BaseEntity.js +17 -21
  65. package/entity/Collection.d.ts +6 -7
  66. package/entity/Collection.js +47 -51
  67. package/entity/EntityAssigner.d.ts +2 -2
  68. package/entity/EntityAssigner.js +58 -63
  69. package/entity/EntityFactory.d.ts +3 -3
  70. package/entity/EntityFactory.js +62 -63
  71. package/entity/EntityHelper.d.ts +2 -2
  72. package/entity/EntityHelper.js +44 -45
  73. package/entity/EntityIdentifier.d.ts +1 -1
  74. package/entity/EntityIdentifier.js +1 -5
  75. package/entity/EntityLoader.d.ts +5 -5
  76. package/entity/EntityLoader.js +106 -98
  77. package/entity/EntityRepository.d.ts +7 -7
  78. package/entity/EntityRepository.js +7 -11
  79. package/entity/EntityValidator.d.ts +1 -1
  80. package/entity/EntityValidator.js +25 -29
  81. package/entity/Reference.d.ts +4 -8
  82. package/entity/Reference.js +35 -42
  83. package/entity/WrappedEntity.d.ts +12 -12
  84. package/entity/WrappedEntity.js +23 -27
  85. package/entity/index.d.ts +13 -13
  86. package/entity/index.js +13 -29
  87. package/entity/utils.d.ts +1 -1
  88. package/entity/utils.js +9 -12
  89. package/entity/wrap.d.ts +1 -1
  90. package/entity/wrap.js +2 -6
  91. package/enums.d.ts +3 -3
  92. package/enums.js +37 -41
  93. package/errors.d.ts +1 -1
  94. package/errors.js +15 -24
  95. package/events/EventManager.d.ts +3 -3
  96. package/events/EventManager.js +8 -12
  97. package/events/EventSubscriber.d.ts +8 -5
  98. package/events/EventSubscriber.js +1 -2
  99. package/events/TransactionEventBroadcaster.d.ts +3 -3
  100. package/events/TransactionEventBroadcaster.js +1 -5
  101. package/events/index.d.ts +3 -3
  102. package/events/index.js +3 -19
  103. package/exceptions.js +18 -39
  104. package/hydration/Hydrator.d.ts +5 -5
  105. package/hydration/Hydrator.js +3 -6
  106. package/hydration/ObjectHydrator.d.ts +3 -3
  107. package/hydration/ObjectHydrator.js +26 -28
  108. package/hydration/index.d.ts +2 -2
  109. package/hydration/index.js +2 -18
  110. package/index.d.ts +21 -21
  111. package/index.js +21 -46
  112. package/logging/DefaultLogger.d.ts +1 -1
  113. package/logging/DefaultLogger.js +9 -13
  114. package/logging/Logger.d.ts +1 -1
  115. package/logging/Logger.js +1 -2
  116. package/logging/SimpleLogger.d.ts +2 -2
  117. package/logging/SimpleLogger.js +2 -6
  118. package/logging/colors.js +1 -5
  119. package/logging/index.d.ts +4 -4
  120. package/logging/index.js +4 -20
  121. package/metadata/EntitySchema.d.ts +14 -6
  122. package/metadata/EntitySchema.js +41 -45
  123. package/metadata/MetadataDiscovery.d.ts +7 -7
  124. package/metadata/MetadataDiscovery.js +181 -180
  125. package/metadata/MetadataProvider.d.ts +2 -2
  126. package/metadata/MetadataProvider.js +4 -7
  127. package/metadata/MetadataStorage.d.ts +2 -2
  128. package/metadata/MetadataStorage.js +15 -19
  129. package/metadata/MetadataValidator.d.ts +4 -4
  130. package/metadata/MetadataValidator.js +52 -55
  131. package/metadata/ReflectMetadataProvider.d.ts +2 -2
  132. package/metadata/ReflectMetadataProvider.js +8 -12
  133. package/metadata/index.d.ts +6 -6
  134. package/metadata/index.js +6 -22
  135. package/naming-strategy/AbstractNamingStrategy.d.ts +2 -2
  136. package/naming-strategy/AbstractNamingStrategy.js +4 -8
  137. package/naming-strategy/EntityCaseNamingStrategy.d.ts +1 -1
  138. package/naming-strategy/EntityCaseNamingStrategy.js +2 -6
  139. package/naming-strategy/MongoNamingStrategy.d.ts +1 -1
  140. package/naming-strategy/MongoNamingStrategy.js +2 -6
  141. package/naming-strategy/NamingStrategy.d.ts +1 -1
  142. package/naming-strategy/NamingStrategy.js +1 -2
  143. package/naming-strategy/UnderscoreNamingStrategy.d.ts +1 -1
  144. package/naming-strategy/UnderscoreNamingStrategy.js +2 -6
  145. package/naming-strategy/index.d.ts +5 -5
  146. package/naming-strategy/index.js +5 -21
  147. package/package.json +6 -15
  148. package/platforms/ExceptionConverter.d.ts +2 -2
  149. package/platforms/ExceptionConverter.js +4 -8
  150. package/platforms/Platform.d.ts +10 -10
  151. package/platforms/Platform.js +57 -61
  152. package/platforms/index.d.ts +2 -2
  153. package/platforms/index.js +2 -18
  154. package/serialization/EntitySerializer.d.ts +2 -2
  155. package/serialization/EntitySerializer.js +36 -41
  156. package/serialization/EntityTransformer.d.ts +1 -1
  157. package/serialization/EntityTransformer.js +27 -31
  158. package/serialization/SerializationContext.d.ts +2 -2
  159. package/serialization/SerializationContext.js +10 -14
  160. package/serialization/index.d.ts +3 -3
  161. package/serialization/index.js +3 -19
  162. package/types/ArrayType.d.ts +3 -3
  163. package/types/ArrayType.js +7 -11
  164. package/types/BigIntType.d.ts +4 -3
  165. package/types/BigIntType.js +6 -6
  166. package/types/BlobType.d.ts +3 -3
  167. package/types/BlobType.js +2 -8
  168. package/types/BooleanType.d.ts +3 -3
  169. package/types/BooleanType.js +2 -6
  170. package/types/CharacterType.d.ts +3 -3
  171. package/types/CharacterType.js +2 -6
  172. package/types/DateTimeType.d.ts +3 -3
  173. package/types/DateTimeType.js +2 -6
  174. package/types/DateType.d.ts +3 -3
  175. package/types/DateType.js +2 -6
  176. package/types/DecimalType.d.ts +3 -3
  177. package/types/DecimalType.js +4 -7
  178. package/types/DoubleType.d.ts +3 -3
  179. package/types/DoubleType.js +3 -6
  180. package/types/EnumArrayType.d.ts +4 -4
  181. package/types/EnumArrayType.js +5 -10
  182. package/types/EnumType.d.ts +3 -3
  183. package/types/EnumType.js +2 -6
  184. package/types/FloatType.d.ts +3 -3
  185. package/types/FloatType.js +2 -6
  186. package/types/IntegerType.d.ts +3 -3
  187. package/types/IntegerType.js +2 -6
  188. package/types/IntervalType.d.ts +3 -3
  189. package/types/IntervalType.js +2 -6
  190. package/types/JsonType.d.ts +3 -3
  191. package/types/JsonType.js +2 -6
  192. package/types/MediumIntType.d.ts +3 -3
  193. package/types/MediumIntType.js +2 -6
  194. package/types/SmallIntType.d.ts +3 -3
  195. package/types/SmallIntType.js +2 -6
  196. package/types/StringType.d.ts +3 -3
  197. package/types/StringType.js +2 -6
  198. package/types/TextType.d.ts +3 -3
  199. package/types/TextType.js +2 -6
  200. package/types/TimeType.d.ts +3 -3
  201. package/types/TimeType.js +4 -8
  202. package/types/TinyIntType.d.ts +3 -3
  203. package/types/TinyIntType.js +3 -6
  204. package/types/Type.d.ts +2 -2
  205. package/types/Type.js +5 -9
  206. package/types/Uint8ArrayType.d.ts +3 -3
  207. package/types/Uint8ArrayType.js +3 -9
  208. package/types/UnknownType.d.ts +3 -3
  209. package/types/UnknownType.js +2 -6
  210. package/types/UuidType.d.ts +3 -3
  211. package/types/UuidType.js +2 -6
  212. package/types/index.d.ts +25 -25
  213. package/types/index.js +52 -79
  214. package/typings.d.ts +33 -28
  215. package/typings.js +37 -38
  216. package/unit-of-work/ChangeSet.d.ts +1 -1
  217. package/unit-of-work/ChangeSet.js +13 -17
  218. package/unit-of-work/ChangeSetComputer.d.ts +8 -7
  219. package/unit-of-work/ChangeSetComputer.js +26 -30
  220. package/unit-of-work/ChangeSetPersister.d.ts +7 -6
  221. package/unit-of-work/ChangeSetPersister.js +51 -48
  222. package/unit-of-work/CommitOrderCalculator.d.ts +1 -1
  223. package/unit-of-work/CommitOrderCalculator.js +6 -10
  224. package/unit-of-work/IdentityMap.d.ts +1 -1
  225. package/unit-of-work/IdentityMap.js +1 -5
  226. package/unit-of-work/UnitOfWork.d.ts +8 -7
  227. package/unit-of-work/UnitOfWork.js +193 -178
  228. package/unit-of-work/index.d.ts +6 -6
  229. package/unit-of-work/index.js +6 -22
  230. package/utils/AbstractSchemaGenerator.d.ts +6 -6
  231. package/utils/AbstractSchemaGenerator.js +12 -13
  232. package/utils/Configuration.d.ts +26 -27
  233. package/utils/Configuration.js +50 -55
  234. package/utils/ConfigurationLoader.d.ts +9 -8
  235. package/utils/ConfigurationLoader.js +71 -86
  236. package/utils/Cursor.d.ts +6 -6
  237. package/utils/Cursor.js +22 -25
  238. package/utils/DataloaderUtils.d.ts +4 -4
  239. package/utils/DataloaderUtils.js +12 -16
  240. package/utils/EntityComparator.d.ts +2 -2
  241. package/utils/EntityComparator.js +109 -97
  242. package/utils/NullHighlighter.d.ts +1 -1
  243. package/utils/NullHighlighter.js +1 -5
  244. package/utils/QueryHelper.d.ts +3 -3
  245. package/utils/QueryHelper.js +47 -51
  246. package/utils/RawQueryFragment.d.ts +1 -1
  247. package/utils/RawQueryFragment.js +22 -25
  248. package/utils/RequestContext.d.ts +2 -2
  249. package/utils/RequestContext.js +3 -7
  250. package/utils/TransactionContext.d.ts +1 -1
  251. package/utils/TransactionContext.js +4 -8
  252. package/utils/Utils.d.ts +16 -12
  253. package/utils/Utils.js +96 -95
  254. package/utils/clone.js +8 -11
  255. package/utils/index.d.ts +13 -13
  256. package/utils/index.js +13 -29
  257. package/utils/resolveContextProvider.d.ts +3 -3
  258. package/utils/resolveContextProvider.js +9 -12
  259. package/utils/upsert-utils.d.ts +3 -3
  260. package/utils/upsert-utils.js +5 -9
  261. package/index.mjs +0 -199
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityLoader = void 0;
4
- const QueryHelper_1 = require("../utils/QueryHelper");
5
- const Utils_1 = require("../utils/Utils");
6
- const errors_1 = require("../errors");
7
- const enums_1 = require("../enums");
8
- const Reference_1 = require("./Reference");
9
- const wrap_1 = require("./wrap");
10
- const RawQueryFragment_1 = require("../utils/RawQueryFragment");
11
- const utils_1 = require("./utils");
12
- class EntityLoader {
1
+ import { QueryHelper } from '../utils/QueryHelper.js';
2
+ import { Utils } from '../utils/Utils.js';
3
+ import { ValidationError } from '../errors.js';
4
+ import { LoadStrategy, PopulatePath, ReferenceKind, } from '../enums.js';
5
+ import { Reference } from './Reference.js';
6
+ import { helper } from './wrap.js';
7
+ import { raw, RawQueryFragment } from '../utils/RawQueryFragment.js';
8
+ import { expandDotPaths } from './utils.js';
9
+ export class EntityLoader {
13
10
  em;
14
11
  metadata;
15
12
  driver;
@@ -23,15 +20,15 @@ class EntityLoader {
23
20
  * This will execute one query for each relation, that will populate it on all the specified entities.
24
21
  */
25
22
  async populate(entityName, entities, populate, options) {
26
- if (entities.length === 0 || Utils_1.Utils.isEmpty(populate)) {
23
+ if (entities.length === 0 || Utils.isEmpty(populate)) {
27
24
  return this.setSerializationContext(entities, populate, options);
28
25
  }
29
26
  const meta = this.metadata.find(entityName);
30
27
  if (entities.some(e => !e.__helper)) {
31
- const entity = entities.find(e => !Utils_1.Utils.isEntity(e));
32
- throw errors_1.ValidationError.notDiscoveredEntity(entity, meta, 'populate');
28
+ const entity = entities.find(e => !Utils.isEntity(e));
29
+ throw ValidationError.notDiscoveredEntity(entity, meta, 'populate');
33
30
  }
34
- const references = entities.filter(e => !(0, wrap_1.helper)(e).isInitialized());
31
+ const references = entities.filter(e => !helper(e).isInitialized());
35
32
  const visited = options.visited ??= new Set();
36
33
  options.where ??= {};
37
34
  options.orderBy ??= {};
@@ -45,9 +42,9 @@ class EntityLoader {
45
42
  }
46
43
  populate = this.normalizePopulate(entityName, populate, options.strategy, options.lookup);
47
44
  const invalid = populate.find(({ field }) => !this.em.canPopulate(entityName, field));
48
- /* istanbul ignore next */
45
+ /* v8 ignore next 3 */
49
46
  if (options.validate && invalid) {
50
- throw errors_1.ValidationError.invalidPropertyName(entityName, invalid.field);
47
+ throw ValidationError.invalidPropertyName(entityName, invalid.field);
51
48
  }
52
49
  this.setSerializationContext(entities, populate, options);
53
50
  for (const entity of entities) {
@@ -62,25 +59,25 @@ class EntityLoader {
62
59
  }
63
60
  normalizePopulate(entityName, populate, strategy, lookup = true) {
64
61
  const meta = this.metadata.find(entityName);
65
- let normalized = Utils_1.Utils.asArray(populate).map(field => {
66
- return typeof field === 'boolean' || field.field === enums_1.PopulatePath.ALL ? { all: !!field, field: meta.primaryKeys[0] } : field;
62
+ let normalized = Utils.asArray(populate).map(field => {
63
+ return typeof field === 'boolean' || field.field === PopulatePath.ALL ? { all: !!field, field: meta.primaryKeys[0] } : field;
67
64
  });
68
65
  if (normalized.some(p => p.all)) {
69
66
  normalized = this.lookupAllRelationships(entityName);
70
67
  }
71
68
  // convert nested `field` with dot syntax to PopulateOptions with `children` array
72
- (0, utils_1.expandDotPaths)(meta, normalized, true);
69
+ expandDotPaths(meta, normalized, true);
73
70
  if (lookup && populate !== false) {
74
71
  normalized = this.lookupEagerLoadedRelationships(entityName, normalized, strategy);
75
72
  // convert nested `field` with dot syntax produced by eager relations
76
- (0, utils_1.expandDotPaths)(meta, normalized, true);
73
+ expandDotPaths(meta, normalized, true);
77
74
  }
78
75
  // merge same fields
79
76
  return this.mergeNestedPopulate(normalized);
80
77
  }
81
78
  setSerializationContext(entities, populate, options) {
82
79
  for (const entity of entities) {
83
- (0, wrap_1.helper)(entity).setSerializationContext({
80
+ helper(entity).setSerializationContext({
84
81
  populate,
85
82
  fields: options.fields,
86
83
  exclude: options.exclude,
@@ -93,7 +90,7 @@ class EntityLoader {
93
90
  */
94
91
  mergeNestedPopulate(populate) {
95
92
  const tmp = populate.reduce((ret, item) => {
96
- if (item.field === enums_1.PopulatePath.ALL) {
93
+ if (item.field === PopulatePath.ALL) {
97
94
  return ret;
98
95
  }
99
96
  if (!ret[item.field]) {
@@ -122,13 +119,13 @@ class EntityLoader {
122
119
  const [field, ref] = populate.field.split(':', 2);
123
120
  const meta = this.metadata.find(entityName);
124
121
  const prop = meta.properties[field];
125
- if (prop.kind === enums_1.ReferenceKind.MANY_TO_MANY && prop.owner && !this.driver.getPlatform().usesPivotTable()) {
122
+ if (prop.kind === ReferenceKind.MANY_TO_MANY && prop.owner && !this.driver.getPlatform().usesPivotTable()) {
126
123
  const filtered = entities.filter(e => !e[prop.name]?.isInitialized());
127
124
  if (filtered.length > 0) {
128
125
  await this.populateScalar(meta, filtered, { ...options, fields: [prop.name] });
129
126
  }
130
127
  }
131
- if (prop.kind === enums_1.ReferenceKind.SCALAR && prop.lazy) {
128
+ if (prop.kind === ReferenceKind.SCALAR && prop.lazy) {
132
129
  const filtered = entities.filter(e => options.refresh || (prop.ref ? !e[prop.name]?.isInitialized() : e[prop.name] === undefined));
133
130
  if (options.ignoreLazyScalarProperties || filtered.length === 0) {
134
131
  return entities;
@@ -136,14 +133,14 @@ class EntityLoader {
136
133
  await this.populateScalar(meta, filtered, { ...options, fields: [prop.name] });
137
134
  return entities;
138
135
  }
139
- if (prop.kind === enums_1.ReferenceKind.EMBEDDED) {
136
+ if (prop.kind === ReferenceKind.EMBEDDED) {
140
137
  return [];
141
138
  }
142
139
  const filtered = this.filterCollections(entities, field, options, ref);
143
- const innerOrderBy = Utils_1.Utils.asArray(options.orderBy)
144
- .filter(orderBy => (Array.isArray(orderBy[prop.name]) && orderBy[prop.name].length > 0) || Utils_1.Utils.isObject(orderBy[prop.name]))
140
+ const innerOrderBy = Utils.asArray(options.orderBy)
141
+ .filter(orderBy => (Array.isArray(orderBy[prop.name]) && orderBy[prop.name].length > 0) || Utils.isObject(orderBy[prop.name]))
145
142
  .flatMap(orderBy => orderBy[prop.name]);
146
- if (prop.kind === enums_1.ReferenceKind.MANY_TO_MANY && this.driver.getPlatform().usesPivotTable()) {
143
+ if (prop.kind === ReferenceKind.MANY_TO_MANY && this.driver.getPlatform().usesPivotTable()) {
147
144
  return this.findChildrenFromPivotTable(filtered, prop, options, innerOrderBy, populate, !!ref);
148
145
  }
149
146
  const where = await this.extractChildCondition(options, prop);
@@ -152,8 +149,8 @@ class EntityLoader {
152
149
  return data;
153
150
  }
154
151
  async populateScalar(meta, filtered, options) {
155
- const pk = Utils_1.Utils.getPrimaryKeyHash(meta.primaryKeys);
156
- const ids = Utils_1.Utils.unique(filtered.map(e => Utils_1.Utils.getPrimaryKeyValues(e, meta.primaryKeys, true)));
152
+ const pk = Utils.getPrimaryKeyHash(meta.primaryKeys);
153
+ const ids = Utils.unique(filtered.map(e => Utils.getPrimaryKeyValues(e, meta.primaryKeys, true)));
157
154
  const where = this.mergePrimaryCondition(ids, pk, options, meta, this.metadata, this.driver.getPlatform());
158
155
  const { filters, convertCustomTypes, lockMode, strategy, populateWhere, connectionType, logging, fields } = options;
159
156
  await this.em.find(meta.className, where, {
@@ -163,10 +160,10 @@ class EntityLoader {
163
160
  });
164
161
  }
165
162
  initializeCollections(filtered, prop, field, children, customOrder) {
166
- if (prop.kind === enums_1.ReferenceKind.ONE_TO_MANY) {
163
+ if (prop.kind === ReferenceKind.ONE_TO_MANY) {
167
164
  this.initializeOneToMany(filtered, children, prop, field);
168
165
  }
169
- if (prop.kind === enums_1.ReferenceKind.MANY_TO_MANY && !this.driver.getPlatform().usesPivotTable()) {
166
+ if (prop.kind === ReferenceKind.MANY_TO_MANY && !this.driver.getPlatform().usesPivotTable()) {
170
167
  this.initializeManyToMany(filtered, children, prop, field, customOrder);
171
168
  }
172
169
  }
@@ -174,18 +171,18 @@ class EntityLoader {
174
171
  const mapToPk = prop.targetMeta.properties[prop.mappedBy].mapToPk;
175
172
  const map = {};
176
173
  for (const entity of filtered) {
177
- const key = (0, wrap_1.helper)(entity).getSerializedPrimaryKey();
174
+ const key = helper(entity).getSerializedPrimaryKey();
178
175
  map[key] = [];
179
176
  }
180
177
  for (const child of children) {
181
178
  const pk = child.__helper.__data[prop.mappedBy] ?? child[prop.mappedBy];
182
179
  if (pk) {
183
- const key = (0, wrap_1.helper)(mapToPk ? this.em.getReference(prop.type, pk) : pk).getSerializedPrimaryKey();
180
+ const key = helper(mapToPk ? this.em.getReference(prop.type, pk) : pk).getSerializedPrimaryKey();
184
181
  map[key]?.push(child);
185
182
  }
186
183
  }
187
184
  for (const entity of filtered) {
188
- const key = (0, wrap_1.helper)(entity).getSerializedPrimaryKey();
185
+ const key = helper(entity).getSerializedPrimaryKey();
189
186
  entity[field].hydrate(map[key]);
190
187
  }
191
188
  }
@@ -210,12 +207,12 @@ class EntityLoader {
210
207
  async findChildren(entities, prop, populate, options, ref) {
211
208
  const children = this.getChildReferences(entities, prop, options, ref);
212
209
  const meta = prop.targetMeta;
213
- let fk = Utils_1.Utils.getPrimaryKeyHash(meta.primaryKeys);
210
+ let fk = Utils.getPrimaryKeyHash(meta.primaryKeys);
214
211
  let schema = options.schema;
215
- if (prop.kind === enums_1.ReferenceKind.ONE_TO_MANY || (prop.kind === enums_1.ReferenceKind.MANY_TO_MANY && !prop.owner)) {
212
+ if (prop.kind === ReferenceKind.ONE_TO_MANY || (prop.kind === ReferenceKind.MANY_TO_MANY && !prop.owner)) {
216
213
  fk = meta.properties[prop.mappedBy].name;
217
214
  }
218
- if (prop.kind === enums_1.ReferenceKind.ONE_TO_ONE && !prop.owner && !ref) {
215
+ if (prop.kind === ReferenceKind.ONE_TO_ONE && !prop.owner && !ref) {
219
216
  children.length = 0;
220
217
  fk = meta.properties[prop.mappedBy].name;
221
218
  children.push(...this.filterByReferences(entities, prop.name, options.refresh));
@@ -223,10 +220,10 @@ class EntityLoader {
223
220
  if (children.length === 0) {
224
221
  return [];
225
222
  }
226
- if (!schema && [enums_1.ReferenceKind.ONE_TO_ONE, enums_1.ReferenceKind.MANY_TO_ONE].includes(prop.kind)) {
223
+ if (!schema && [ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind)) {
227
224
  schema = children.find(e => e.__helper.__schema)?.__helper.__schema;
228
225
  }
229
- const ids = Utils_1.Utils.unique(children.map(e => e.__helper.getPrimaryKey()));
226
+ const ids = Utils.unique(children.map(e => e.__helper.getPrimaryKey()));
230
227
  let where = this.mergePrimaryCondition(ids, fk, options, meta, this.metadata, this.driver.getPlatform());
231
228
  const fields = this.buildFields(options.fields, prop, ref);
232
229
  /* eslint-disable prefer-const */
@@ -235,16 +232,16 @@ class EntityLoader {
235
232
  if (typeof populateWhere === 'object') {
236
233
  populateWhere = await this.extractChildCondition({ where: populateWhere }, prop);
237
234
  }
238
- if (!Utils_1.Utils.isEmpty(prop.where)) {
235
+ if (!Utils.isEmpty(prop.where)) {
239
236
  where = { $and: [where, prop.where] };
240
237
  }
241
238
  const propOrderBy = [];
242
239
  if (prop.orderBy) {
243
- for (const item of Utils_1.Utils.asArray(prop.orderBy)) {
244
- for (const field of Utils_1.Utils.keys(item)) {
245
- const rawField = RawQueryFragment_1.RawQueryFragment.getKnownFragment(field, false);
240
+ for (const item of Utils.asArray(prop.orderBy)) {
241
+ for (const field of Utils.keys(item)) {
242
+ const rawField = RawQueryFragment.getKnownFragment(field, false);
246
243
  if (rawField) {
247
- const raw2 = (0, RawQueryFragment_1.raw)(rawField.sql, rawField.params);
244
+ const raw2 = raw(rawField.sql, rawField.params);
248
245
  propOrderBy.push({ [raw2.toString()]: item[field] });
249
246
  continue;
250
247
  }
@@ -252,11 +249,15 @@ class EntityLoader {
252
249
  }
253
250
  }
254
251
  }
252
+ const orderBy = [...Utils.asArray(options.orderBy), ...propOrderBy].filter((order, idx, array) => {
253
+ // skip consecutive ordering with the same key to get around mongo issues
254
+ return idx === 0 || !Utils.equals(Object.keys(array[idx - 1]), Object.keys(order));
255
+ });
255
256
  const items = await this.em.find(prop.type, where, {
256
257
  filters, convertCustomTypes, lockMode, populateWhere, logging,
257
- orderBy: [...Utils_1.Utils.asArray(options.orderBy), ...propOrderBy],
258
+ orderBy,
258
259
  populate: populate.children ?? populate.all ?? [],
259
- exclude: Array.isArray(options.exclude) ? Utils_1.Utils.extractChildElements(options.exclude, prop.name) : options.exclude,
260
+ exclude: Array.isArray(options.exclude) ? Utils.extractChildElements(options.exclude, prop.name) : options.exclude,
260
261
  strategy, fields, schema, connectionType,
261
262
  // @ts-ignore not a public option, will be propagated to the populate call
262
263
  refresh: refresh && !children.every(item => options.visited.has(item)),
@@ -264,8 +265,8 @@ class EntityLoader {
264
265
  visited: options.visited,
265
266
  });
266
267
  for (const item of items) {
267
- if (ref && !(0, wrap_1.helper)(item).__onLoadFired) {
268
- (0, wrap_1.helper)(item).__initialized = false;
268
+ if (ref && !helper(item).__onLoadFired) {
269
+ helper(item).__initialized = false;
269
270
  // eslint-disable-next-line dot-notation
270
271
  this.em.getUnitOfWork()['loadedEntities'].delete(item);
271
272
  }
@@ -273,9 +274,9 @@ class EntityLoader {
273
274
  return items;
274
275
  }
275
276
  mergePrimaryCondition(ids, pk, options, meta, metadata, platform) {
276
- const cond1 = QueryHelper_1.QueryHelper.processWhere({ where: { [pk]: { $in: ids } }, entityName: meta.className, metadata, platform, convertCustomTypes: !options.convertCustomTypes });
277
+ const cond1 = QueryHelper.processWhere({ where: { [pk]: { $in: ids } }, entityName: meta.className, metadata, platform, convertCustomTypes: !options.convertCustomTypes });
277
278
  const where = { ...options.where };
278
- Utils_1.Utils.dropUndefinedProperties(where);
279
+ Utils.dropUndefinedProperties(where);
279
280
  return where[pk]
280
281
  ? { $and: [cond1, where] }
281
282
  : { ...cond1, ...where };
@@ -283,7 +284,7 @@ class EntityLoader {
283
284
  async populateField(entityName, entities, populate, options) {
284
285
  const field = populate.field.split(':')[0];
285
286
  const prop = this.metadata.find(entityName).properties[field];
286
- if (prop.kind === enums_1.ReferenceKind.SCALAR && !prop.lazy) {
287
+ if (prop.kind === ReferenceKind.SCALAR && !prop.lazy) {
287
288
  return;
288
289
  }
289
290
  const populated = await this.populateMany(entityName, entities, populate, options);
@@ -293,29 +294,36 @@ class EntityLoader {
293
294
  const children = [];
294
295
  for (const entity of entities) {
295
296
  const ref = entity[field];
296
- if (Utils_1.Utils.isEntity(ref)) {
297
+ if (Utils.isEntity(ref)) {
297
298
  children.push(ref);
298
299
  }
299
- else if (Reference_1.Reference.isReference(ref)) {
300
+ else if (Reference.isReference(ref)) {
300
301
  children.push(ref.unwrap());
301
302
  }
302
- else if (Utils_1.Utils.isCollection(ref)) {
303
+ else if (Utils.isCollection(ref)) {
303
304
  children.push(...ref.getItems());
304
305
  }
305
- else if (ref && prop.kind === enums_1.ReferenceKind.EMBEDDED) {
306
- children.push(...Utils_1.Utils.asArray(ref));
306
+ else if (ref && prop.kind === ReferenceKind.EMBEDDED) {
307
+ children.push(...Utils.asArray(ref));
307
308
  }
308
309
  }
309
310
  if (populated.length === 0 && !populate.children) {
310
311
  return;
311
312
  }
312
313
  const fields = this.buildFields(options.fields, prop);
313
- const innerOrderBy = Utils_1.Utils.asArray(options.orderBy)
314
- .filter(orderBy => Utils_1.Utils.isObject(orderBy[prop.name]))
314
+ const innerOrderBy = Utils.asArray(options.orderBy)
315
+ .filter(orderBy => Utils.isObject(orderBy[prop.name]))
315
316
  .map(orderBy => orderBy[prop.name]);
316
- const { refresh, filters, ignoreLazyScalarProperties, populateWhere, connectionType, logging } = options;
317
- const exclude = Array.isArray(options.exclude) ? Utils_1.Utils.extractChildElements(options.exclude, prop.name) : options.exclude;
318
- const filtered = Utils_1.Utils.unique(children.filter(e => !options.visited.has(e)));
317
+ const { refresh, filters, ignoreLazyScalarProperties, populateWhere, connectionType, logging, schema } = options;
318
+ const exclude = Array.isArray(options.exclude) ? Utils.extractChildElements(options.exclude, prop.name) : options.exclude;
319
+ const visited = options.visited;
320
+ for (const entity of entities) {
321
+ visited.delete(entity);
322
+ }
323
+ const filtered = Utils.unique(children.filter(e => !visited.has(e)));
324
+ for (const entity of entities) {
325
+ visited.add(entity);
326
+ }
319
327
  await this.populate(prop.type, filtered, populate.children ?? populate.all, {
320
328
  where: await this.extractChildCondition(options, prop, false),
321
329
  orderBy: innerOrderBy,
@@ -328,6 +336,7 @@ class EntityLoader {
328
336
  populateWhere,
329
337
  connectionType,
330
338
  logging,
339
+ schema,
331
340
  // @ts-ignore not a public option, will be propagated to the populate call
332
341
  refresh: refresh && !filtered.every(item => options.visited.has(item)),
333
342
  // @ts-ignore not a public option, will be propagated to the populate call
@@ -339,7 +348,7 @@ class EntityLoader {
339
348
  const refresh = options.refresh;
340
349
  let where = await this.extractChildCondition(options, prop, true);
341
350
  const fields = this.buildFields(options.fields, prop);
342
- const exclude = Array.isArray(options.exclude) ? Utils_1.Utils.extractChildElements(options.exclude, prop.name) : options.exclude;
351
+ const exclude = Array.isArray(options.exclude) ? Utils.extractChildElements(options.exclude, prop.name) : options.exclude;
343
352
  const options2 = { ...options };
344
353
  delete options2.limit;
345
354
  delete options2.offset;
@@ -347,9 +356,9 @@ class EntityLoader {
347
356
  options2.exclude = exclude;
348
357
  options2.populate = (populate?.children ?? []);
349
358
  if (prop.customType) {
350
- ids.forEach((id, idx) => ids[idx] = QueryHelper_1.QueryHelper.processCustomType(prop, id, this.driver.getPlatform()));
359
+ ids.forEach((id, idx) => ids[idx] = QueryHelper.processCustomType(prop, id, this.driver.getPlatform()));
351
360
  }
352
- if (!Utils_1.Utils.isEmpty(prop.where)) {
361
+ if (!Utils.isEmpty(prop.where)) {
353
362
  where = { $and: [where, prop.where] };
354
363
  }
355
364
  const map = await this.driver.loadFromPivotTable(prop, ids, where, orderBy, this.em.getTransactionContext(), options2, pivotJoin);
@@ -377,19 +386,19 @@ class EntityLoader {
377
386
  }
378
387
  async extractChildCondition(options, prop, filters = false) {
379
388
  const where = options.where;
380
- const subCond = Utils_1.Utils.isPlainObject(where[prop.name]) ? where[prop.name] : {};
389
+ const subCond = Utils.isPlainObject(where[prop.name]) ? where[prop.name] : {};
381
390
  const meta2 = this.metadata.find(prop.type);
382
391
  if (!meta2) {
383
392
  return {};
384
393
  }
385
- const pk = Utils_1.Utils.getPrimaryKeyHash(meta2.primaryKeys);
394
+ const pk = Utils.getPrimaryKeyHash(meta2.primaryKeys);
386
395
  ['$and', '$or'].forEach(op => {
387
396
  if (where[op]) {
388
397
  const child = where[op]
389
398
  .map((cond) => cond[prop.name])
390
- .filter((sub) => sub != null && !(Utils_1.Utils.isPlainObject(sub) && Object.keys(sub).every(key => Utils_1.Utils.isOperator(key, false))))
399
+ .filter((sub) => sub != null && !(Utils.isPlainObject(sub) && Object.keys(sub).every(key => Utils.isOperator(key, false))))
391
400
  .map((cond) => {
392
- if (Utils_1.Utils.isPrimaryKey(cond)) {
401
+ if (Utils.isPrimaryKey(cond)) {
393
402
  return { [pk]: cond };
394
403
  }
395
404
  return cond;
@@ -399,7 +408,7 @@ class EntityLoader {
399
408
  }
400
409
  }
401
410
  });
402
- const operators = Object.keys(subCond).filter(key => Utils_1.Utils.isOperator(key, false));
411
+ const operators = Object.keys(subCond).filter(key => Utils.isOperator(key, false));
403
412
  if (operators.length > 0) {
404
413
  operators.forEach(op => {
405
414
  subCond[pk] ??= {};
@@ -417,8 +426,8 @@ class EntityLoader {
417
426
  fields = prop.targetMeta.primaryKeys.map(targetPkName => `${prop.name}.${targetPkName}`);
418
427
  }
419
428
  const ret = fields.reduce((ret, f) => {
420
- if (Utils_1.Utils.isPlainObject(f)) {
421
- Utils_1.Utils.keys(f)
429
+ if (Utils.isPlainObject(f)) {
430
+ Utils.keys(f)
422
431
  .filter(ff => ff === prop.name)
423
432
  .forEach(ff => ret.push(...f[ff]));
424
433
  }
@@ -426,7 +435,7 @@ class EntityLoader {
426
435
  const parts = f.toString().split('.');
427
436
  const propName = parts.shift();
428
437
  const childPropName = parts.join('.');
429
- /* istanbul ignore else */
438
+ /* v8 ignore next 3 */
430
439
  if (propName === prop.name) {
431
440
  ret.push(childPropName);
432
441
  }
@@ -437,7 +446,7 @@ class EntityLoader {
437
446
  return undefined;
438
447
  }
439
448
  // we need to automatically select the FKs too, e.g. for 1:m relations to be able to wire them with the items
440
- if (prop.kind === enums_1.ReferenceKind.ONE_TO_MANY || prop.kind === enums_1.ReferenceKind.MANY_TO_MANY) {
449
+ if (prop.kind === ReferenceKind.ONE_TO_MANY || prop.kind === ReferenceKind.MANY_TO_MANY) {
441
450
  const owner = prop.targetMeta.properties[prop.mappedBy];
442
451
  if (owner && !ret.includes(owner.name)) {
443
452
  ret.push(owner.name);
@@ -448,16 +457,16 @@ class EntityLoader {
448
457
  getChildReferences(entities, prop, options, ref) {
449
458
  const filtered = this.filterCollections(entities, prop.name, options, ref);
450
459
  const children = [];
451
- if (prop.kind === enums_1.ReferenceKind.ONE_TO_MANY) {
460
+ if (prop.kind === ReferenceKind.ONE_TO_MANY) {
452
461
  children.push(...filtered.map(e => e[prop.name].owner));
453
462
  }
454
- else if (prop.kind === enums_1.ReferenceKind.MANY_TO_MANY && prop.owner) {
463
+ else if (prop.kind === ReferenceKind.MANY_TO_MANY && prop.owner) {
455
464
  children.push(...filtered.reduce((a, b) => {
456
465
  a.push(...b[prop.name].getItems());
457
466
  return a;
458
467
  }, []));
459
468
  }
460
- else if (prop.kind === enums_1.ReferenceKind.MANY_TO_MANY) { // inverse side
469
+ else if (prop.kind === ReferenceKind.MANY_TO_MANY) { // inverse side
461
470
  children.push(...filtered);
462
471
  }
463
472
  else { // MANY_TO_ONE or ONE_TO_ONE
@@ -469,39 +478,39 @@ class EntityLoader {
469
478
  if (options.refresh) {
470
479
  return entities.filter(e => e[field]);
471
480
  }
472
- return entities.filter(e => Utils_1.Utils.isCollection(e[field]) && !e[field].isInitialized(!ref));
481
+ return entities.filter(e => Utils.isCollection(e[field]) && !e[field].isInitialized(!ref));
473
482
  }
474
483
  isPropertyLoaded(entity, field) {
475
484
  if (!entity || field === '*') {
476
485
  return true;
477
486
  }
478
- const wrapped = (0, wrap_1.helper)(entity);
487
+ const wrapped = helper(entity);
479
488
  if (!field.includes('.')) {
480
489
  return wrapped.__loadedProperties.has(field);
481
490
  }
482
491
  const [f, ...r] = field.split('.');
483
- if (wrapped.__loadedProperties.has(f) && wrapped.__meta.properties[f]?.targetMeta) {
484
- if ([enums_1.ReferenceKind.ONE_TO_MANY, enums_1.ReferenceKind.MANY_TO_MANY].includes(wrapped.__meta.properties[f].kind)) {
485
- return entity[f].getItems(false).every((item) => this.isPropertyLoaded(item, r.join('.')));
486
- }
487
- return this.isPropertyLoaded(entity[f], r.join('.'));
492
+ /* v8 ignore next 3 */
493
+ if (!wrapped.__loadedProperties.has(f) || !wrapped.__meta.properties[f]?.targetMeta) {
494
+ return false;
495
+ }
496
+ if ([ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(wrapped.__meta.properties[f].kind)) {
497
+ return entity[f].getItems(false).every((item) => this.isPropertyLoaded(item, r.join('.')));
488
498
  }
489
- /* istanbul ignore next */
490
- return false;
499
+ return this.isPropertyLoaded(entity[f], r.join('.'));
491
500
  }
492
501
  filterReferences(entities, field, options, ref) {
493
502
  if (ref) {
494
503
  return [];
495
504
  }
496
- const children = entities.filter(e => Utils_1.Utils.isEntity(e[field], true));
505
+ const children = entities.filter(e => Utils.isEntity(e[field], true));
497
506
  if (options.refresh) {
498
- return children.map(e => Reference_1.Reference.unwrapReference(e[field]));
507
+ return children.map(e => Reference.unwrapReference(e[field]));
499
508
  }
500
509
  if (options.fields) {
501
510
  return children
502
- .map(e => Reference_1.Reference.unwrapReference(e[field]))
511
+ .map(e => Reference.unwrapReference(e[field]))
503
512
  .filter(target => {
504
- const wrapped = (0, wrap_1.helper)(target);
513
+ const wrapped = helper(target);
505
514
  const childFields = options.fields
506
515
  .filter(f => f.startsWith(`${field}.`))
507
516
  .map(f => f.substring(field.length + 1));
@@ -510,14 +519,14 @@ class EntityLoader {
510
519
  }
511
520
  return children
512
521
  .filter(e => !e[field].__helper.__initialized)
513
- .map(e => Reference_1.Reference.unwrapReference(e[field]));
522
+ .map(e => Reference.unwrapReference(e[field]));
514
523
  }
515
524
  filterByReferences(entities, field, refresh) {
516
- /* istanbul ignore next */
525
+ /* v8 ignore next 3 */
517
526
  if (refresh) {
518
527
  return entities;
519
528
  }
520
- return entities.filter(e => !e[field]?.__helper?.__initialized);
529
+ return entities.filter(e => e[field] !== null && !e[field]?.__helper?.__initialized);
521
530
  }
522
531
  lookupAllRelationships(entityName) {
523
532
  const ret = [];
@@ -526,7 +535,7 @@ class EntityLoader {
526
535
  ret.push({
527
536
  field: this.getRelationName(meta, prop),
528
537
  // force select-in strategy when populating all relations as otherwise we could cause infinite loops when self-referencing
529
- strategy: enums_1.LoadStrategy.SELECT_IN,
538
+ strategy: LoadStrategy.SELECT_IN,
530
539
  // no need to look up populate children recursively as we just pass `all: true` here
531
540
  all: true,
532
541
  });
@@ -569,11 +578,10 @@ class EntityLoader {
569
578
  ret.push({
570
579
  field: prefixed,
571
580
  // enforce select-in strategy for self-referencing relations
572
- strategy: selfReferencing ? enums_1.LoadStrategy.SELECT_IN : strategy ?? prop.strategy,
581
+ strategy: selfReferencing ? LoadStrategy.SELECT_IN : strategy ?? prop.strategy,
573
582
  });
574
583
  }
575
584
  });
576
585
  return ret;
577
586
  }
578
587
  }
579
- exports.EntityLoader = EntityLoader;
@@ -1,10 +1,10 @@
1
- import type { PopulatePath } from '../enums';
2
- import type { CreateOptions, EntityManager, MergeOptions } from '../EntityManager';
3
- import type { AssignOptions } from './EntityAssigner';
4
- import type { EntityData, EntityName, Primary, Loaded, FilterQuery, EntityDictionary, AutoPath, RequiredEntityData, Ref, EntityType, EntityDTO, MergeSelected, FromEntityType, IsSubset, MergeLoaded, ArrayElement } from '../typings';
5
- import type { CountOptions, DeleteOptions, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, GetReferenceOptions, NativeInsertUpdateOptions, UpdateOptions, UpsertManyOptions, UpsertOptions } from '../drivers/IDatabaseDriver';
6
- import type { EntityLoaderOptions } from './EntityLoader';
7
- import type { Cursor } from '../utils/Cursor';
1
+ import type { PopulatePath } from '../enums.js';
2
+ import type { CreateOptions, EntityManager, MergeOptions } from '../EntityManager.js';
3
+ import type { AssignOptions } from './EntityAssigner.js';
4
+ import type { EntityData, EntityName, Primary, Loaded, FilterQuery, EntityDictionary, AutoPath, RequiredEntityData, Ref, EntityType, EntityDTO, MergeSelected, FromEntityType, IsSubset, MergeLoaded, ArrayElement } from '../typings.js';
5
+ import type { CountOptions, DeleteOptions, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, GetReferenceOptions, NativeInsertUpdateOptions, UpdateOptions, UpsertManyOptions, UpsertOptions } from '../drivers/IDatabaseDriver.js';
6
+ import type { EntityLoaderOptions } from './EntityLoader.js';
7
+ import type { Cursor } from '../utils/Cursor.js';
8
8
  export declare class EntityRepository<Entity extends object> {
9
9
  protected readonly em: EntityManager;
10
10
  protected readonly entityName: EntityName<Entity>;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityRepository = void 0;
4
- const errors_1 = require("../errors");
5
- const Utils_1 = require("../utils/Utils");
6
- class EntityRepository {
1
+ import { ValidationError } from '../errors.js';
2
+ import { Utils } from '../utils/Utils.js';
3
+ export class EntityRepository {
7
4
  em;
8
5
  entityName;
9
6
  constructor(em, entityName) {
@@ -191,7 +188,7 @@ class EntityRepository {
191
188
  return this.getEntityManager().count(this.entityName, where, options);
192
189
  }
193
190
  getEntityName() {
194
- return Utils_1.Utils.className(this.entityName);
191
+ return Utils.className(this.entityName);
195
192
  }
196
193
  /**
197
194
  * Returns the underlying EntityManager instance
@@ -200,15 +197,14 @@ class EntityRepository {
200
197
  return this.em;
201
198
  }
202
199
  validateRepositoryType(entities, method) {
203
- entities = Utils_1.Utils.asArray(entities);
200
+ entities = Utils.asArray(entities);
204
201
  if (entities.length === 0) {
205
202
  return;
206
203
  }
207
204
  const entityName = entities[0].constructor.name;
208
- const repoType = Utils_1.Utils.className(this.entityName);
205
+ const repoType = Utils.className(this.entityName);
209
206
  if (entityName && repoType !== entityName) {
210
- throw errors_1.ValidationError.fromWrongRepositoryType(entityName, repoType, method);
207
+ throw ValidationError.fromWrongRepositoryType(entityName, repoType, method);
211
208
  }
212
209
  }
213
210
  }
214
- exports.EntityRepository = EntityRepository;
@@ -1,4 +1,4 @@
1
- import type { EntityData, EntityMetadata, EntityProperty, FilterQuery } from '../typings';
1
+ import type { EntityData, EntityMetadata, EntityProperty, FilterQuery } from '../typings.js';
2
2
  export declare class EntityValidator {
3
3
  private strict;
4
4
  KNOWN_TYPES: Set<string>;