@mikro-orm/core 7.0.0-dev.0 → 7.0.0-dev.2

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 +18 -13
  2. package/EntityManager.js +202 -202
  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 +1 -1
  21. package/decorators/Check.js +5 -8
  22. package/decorators/CreateRequestContext.d.ts +1 -1
  23. package/decorators/CreateRequestContext.js +9 -13
  24. package/decorators/Embeddable.d.ts +1 -1
  25. package/decorators/Embeddable.js +3 -6
  26. package/decorators/Embedded.d.ts +1 -1
  27. package/decorators/Embedded.js +10 -12
  28. package/decorators/Entity.d.ts +2 -2
  29. package/decorators/Entity.js +5 -8
  30. package/decorators/Enum.d.ts +2 -2
  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 -2
  35. package/decorators/Formula.js +7 -10
  36. package/decorators/Indexed.d.ts +2 -2
  37. package/decorators/Indexed.js +6 -10
  38. package/decorators/ManyToMany.d.ts +3 -3
  39. package/decorators/ManyToMany.js +10 -12
  40. package/decorators/ManyToOne.d.ts +3 -3
  41. package/decorators/ManyToOne.js +10 -12
  42. package/decorators/OneToMany.d.ts +3 -3
  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 +2 -2
  47. package/decorators/PrimaryKey.js +10 -13
  48. package/decorators/Property.d.ts +5 -5
  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 +12 -12
  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 +2 -2
  62. package/entity/ArrayCollection.js +29 -33
  63. package/entity/BaseEntity.d.ts +6 -6
  64. package/entity/BaseEntity.js +17 -21
  65. package/entity/Collection.d.ts +6 -6
  66. package/entity/Collection.js +40 -44
  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 +58 -62
  71. package/entity/EntityHelper.d.ts +2 -2
  72. package/entity/EntityHelper.js +41 -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 +92 -96
  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 +2 -2
  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 +5 -4
  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 +25 -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 +12 -4
  122. package/metadata/EntitySchema.js +41 -45
  123. package/metadata/MetadataDiscovery.d.ts +7 -7
  124. package/metadata/MetadataDiscovery.js +174 -177
  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 +49 -53
  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 +5 -14
  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 +3 -3
  165. package/types/BigIntType.js +3 -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 +22 -20
  215. package/typings.js +34 -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 +44 -47
  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 +171 -172
  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 +7 -11
  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 +3 -3
  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 +48 -52
  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 +16 -24
  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 +89 -93
  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
package/types/index.js CHANGED
@@ -1,80 +1,53 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.t = exports.types = exports.CharacterType = exports.IntervalType = exports.UnknownType = exports.TextType = exports.UuidType = exports.StringType = exports.DecimalType = exports.BooleanType = exports.DoubleType = exports.FloatType = exports.MediumIntType = exports.TinyIntType = exports.SmallIntType = exports.IntegerType = exports.JsonType = exports.EnumType = exports.EnumArrayType = exports.ArrayType = exports.Uint8ArrayType = exports.BlobType = exports.BigIntType = exports.DateTimeType = exports.TimeType = exports.DateType = exports.Type = void 0;
4
- const ArrayType_1 = require("./ArrayType");
5
- Object.defineProperty(exports, "ArrayType", { enumerable: true, get: function () { return ArrayType_1.ArrayType; } });
6
- const BigIntType_1 = require("./BigIntType");
7
- Object.defineProperty(exports, "BigIntType", { enumerable: true, get: function () { return BigIntType_1.BigIntType; } });
8
- const BlobType_1 = require("./BlobType");
9
- Object.defineProperty(exports, "BlobType", { enumerable: true, get: function () { return BlobType_1.BlobType; } });
10
- const BooleanType_1 = require("./BooleanType");
11
- Object.defineProperty(exports, "BooleanType", { enumerable: true, get: function () { return BooleanType_1.BooleanType; } });
12
- const DateTimeType_1 = require("./DateTimeType");
13
- Object.defineProperty(exports, "DateTimeType", { enumerable: true, get: function () { return DateTimeType_1.DateTimeType; } });
14
- const DateType_1 = require("./DateType");
15
- Object.defineProperty(exports, "DateType", { enumerable: true, get: function () { return DateType_1.DateType; } });
16
- const DecimalType_1 = require("./DecimalType");
17
- Object.defineProperty(exports, "DecimalType", { enumerable: true, get: function () { return DecimalType_1.DecimalType; } });
18
- const DoubleType_1 = require("./DoubleType");
19
- Object.defineProperty(exports, "DoubleType", { enumerable: true, get: function () { return DoubleType_1.DoubleType; } });
20
- const EnumArrayType_1 = require("./EnumArrayType");
21
- Object.defineProperty(exports, "EnumArrayType", { enumerable: true, get: function () { return EnumArrayType_1.EnumArrayType; } });
22
- const EnumType_1 = require("./EnumType");
23
- Object.defineProperty(exports, "EnumType", { enumerable: true, get: function () { return EnumType_1.EnumType; } });
24
- const CharacterType_1 = require("./CharacterType");
25
- Object.defineProperty(exports, "CharacterType", { enumerable: true, get: function () { return CharacterType_1.CharacterType; } });
26
- const FloatType_1 = require("./FloatType");
27
- Object.defineProperty(exports, "FloatType", { enumerable: true, get: function () { return FloatType_1.FloatType; } });
28
- const IntegerType_1 = require("./IntegerType");
29
- Object.defineProperty(exports, "IntegerType", { enumerable: true, get: function () { return IntegerType_1.IntegerType; } });
30
- const IntervalType_1 = require("./IntervalType");
31
- Object.defineProperty(exports, "IntervalType", { enumerable: true, get: function () { return IntervalType_1.IntervalType; } });
32
- const JsonType_1 = require("./JsonType");
33
- Object.defineProperty(exports, "JsonType", { enumerable: true, get: function () { return JsonType_1.JsonType; } });
34
- const MediumIntType_1 = require("./MediumIntType");
35
- Object.defineProperty(exports, "MediumIntType", { enumerable: true, get: function () { return MediumIntType_1.MediumIntType; } });
36
- const SmallIntType_1 = require("./SmallIntType");
37
- Object.defineProperty(exports, "SmallIntType", { enumerable: true, get: function () { return SmallIntType_1.SmallIntType; } });
38
- const StringType_1 = require("./StringType");
39
- Object.defineProperty(exports, "StringType", { enumerable: true, get: function () { return StringType_1.StringType; } });
40
- const TextType_1 = require("./TextType");
41
- Object.defineProperty(exports, "TextType", { enumerable: true, get: function () { return TextType_1.TextType; } });
42
- const TimeType_1 = require("./TimeType");
43
- Object.defineProperty(exports, "TimeType", { enumerable: true, get: function () { return TimeType_1.TimeType; } });
44
- const TinyIntType_1 = require("./TinyIntType");
45
- Object.defineProperty(exports, "TinyIntType", { enumerable: true, get: function () { return TinyIntType_1.TinyIntType; } });
46
- const Type_1 = require("./Type");
47
- Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return Type_1.Type; } });
48
- const Uint8ArrayType_1 = require("./Uint8ArrayType");
49
- Object.defineProperty(exports, "Uint8ArrayType", { enumerable: true, get: function () { return Uint8ArrayType_1.Uint8ArrayType; } });
50
- const UnknownType_1 = require("./UnknownType");
51
- Object.defineProperty(exports, "UnknownType", { enumerable: true, get: function () { return UnknownType_1.UnknownType; } });
52
- const UuidType_1 = require("./UuidType");
53
- Object.defineProperty(exports, "UuidType", { enumerable: true, get: function () { return UuidType_1.UuidType; } });
54
- exports.types = {
55
- date: DateType_1.DateType,
56
- time: TimeType_1.TimeType,
57
- datetime: DateTimeType_1.DateTimeType,
58
- bigint: BigIntType_1.BigIntType,
59
- blob: BlobType_1.BlobType,
60
- uint8array: Uint8ArrayType_1.Uint8ArrayType,
61
- array: ArrayType_1.ArrayType,
62
- enumArray: EnumArrayType_1.EnumArrayType,
63
- enum: EnumType_1.EnumType,
64
- json: JsonType_1.JsonType,
65
- integer: IntegerType_1.IntegerType,
66
- smallint: SmallIntType_1.SmallIntType,
67
- tinyint: TinyIntType_1.TinyIntType,
68
- mediumint: MediumIntType_1.MediumIntType,
69
- float: FloatType_1.FloatType,
70
- double: DoubleType_1.DoubleType,
71
- boolean: BooleanType_1.BooleanType,
72
- decimal: DecimalType_1.DecimalType,
73
- character: CharacterType_1.CharacterType,
74
- string: StringType_1.StringType,
75
- uuid: UuidType_1.UuidType,
76
- text: TextType_1.TextType,
77
- interval: IntervalType_1.IntervalType,
78
- unknown: UnknownType_1.UnknownType,
1
+ import { ArrayType } from './ArrayType.js';
2
+ import { BigIntType } from './BigIntType.js';
3
+ import { BlobType } from './BlobType.js';
4
+ import { BooleanType } from './BooleanType.js';
5
+ import { DateTimeType } from './DateTimeType.js';
6
+ import { DateType } from './DateType.js';
7
+ import { DecimalType } from './DecimalType.js';
8
+ import { DoubleType } from './DoubleType.js';
9
+ import { EnumArrayType } from './EnumArrayType.js';
10
+ import { EnumType } from './EnumType.js';
11
+ import { CharacterType } from './CharacterType.js';
12
+ import { FloatType } from './FloatType.js';
13
+ import { IntegerType } from './IntegerType.js';
14
+ import { IntervalType } from './IntervalType.js';
15
+ import { JsonType } from './JsonType.js';
16
+ import { MediumIntType } from './MediumIntType.js';
17
+ import { SmallIntType } from './SmallIntType.js';
18
+ import { StringType } from './StringType.js';
19
+ import { TextType } from './TextType.js';
20
+ import { TimeType } from './TimeType.js';
21
+ import { TinyIntType } from './TinyIntType.js';
22
+ import { Type } from './Type.js';
23
+ import { Uint8ArrayType } from './Uint8ArrayType.js';
24
+ import { UnknownType } from './UnknownType.js';
25
+ import { UuidType } from './UuidType.js';
26
+ export { Type, DateType, TimeType, DateTimeType, BigIntType, BlobType, Uint8ArrayType, ArrayType, EnumArrayType, EnumType, JsonType, IntegerType, SmallIntType, TinyIntType, MediumIntType, FloatType, DoubleType, BooleanType, DecimalType, StringType, UuidType, TextType, UnknownType, IntervalType, CharacterType, };
27
+ export const types = {
28
+ date: DateType,
29
+ time: TimeType,
30
+ datetime: DateTimeType,
31
+ bigint: BigIntType,
32
+ blob: BlobType,
33
+ uint8array: Uint8ArrayType,
34
+ array: ArrayType,
35
+ enumArray: EnumArrayType,
36
+ enum: EnumType,
37
+ json: JsonType,
38
+ integer: IntegerType,
39
+ smallint: SmallIntType,
40
+ tinyint: TinyIntType,
41
+ mediumint: MediumIntType,
42
+ float: FloatType,
43
+ double: DoubleType,
44
+ boolean: BooleanType,
45
+ decimal: DecimalType,
46
+ character: CharacterType,
47
+ string: StringType,
48
+ uuid: UuidType,
49
+ text: TextType,
50
+ interval: IntervalType,
51
+ unknown: UnknownType,
79
52
  };
80
- exports.t = exports.types;
53
+ export const t = types;
package/typings.d.ts CHANGED
@@ -1,22 +1,25 @@
1
- import type { Transaction } from './connections';
2
- import { type Cascade, type DeferMode, type EventType, type LoadStrategy, type PopulatePath, type QueryOrderMap, ReferenceKind } from './enums';
3
- import { type AssignOptions } from './entity/EntityAssigner';
4
- import { type EntityIdentifier } from './entity/EntityIdentifier';
5
- import { type EntityLoaderOptions } from './entity/EntityLoader';
6
- import { type Collection } from './entity/Collection';
7
- import { type EntityFactory } from './entity/EntityFactory';
8
- import { type EntityRepository } from './entity/EntityRepository';
9
- import { Reference, type ScalarReference } from './entity/Reference';
10
- import type { MikroORM } from './MikroORM';
11
- import type { SerializationContext, SerializeOptions } from './serialization';
12
- import type { EntitySchema, MetadataStorage } from './metadata';
13
- import type { Type, types } from './types';
14
- import type { Platform } from './platforms';
15
- import type { Configuration, RawQueryFragment } from './utils';
16
- import type { EntityManager } from './EntityManager';
17
- import type { EmbeddedPrefixMode } from './decorators/Embedded';
18
- import type { EventSubscriber } from './events';
19
- import type { FindOneOptions, FindOptions, LoadHint } from './drivers';
1
+ import type { Transaction } from './connections/Connection.js';
2
+ import { type Cascade, type DeferMode, type EventType, type LoadStrategy, type PopulatePath, type QueryOrderMap, ReferenceKind } from './enums.js';
3
+ import { type AssignOptions } from './entity/EntityAssigner.js';
4
+ import { type EntityIdentifier } from './entity/EntityIdentifier.js';
5
+ import { type EntityLoaderOptions } from './entity/EntityLoader.js';
6
+ import { type Collection } from './entity/Collection.js';
7
+ import { type EntityFactory } from './entity/EntityFactory.js';
8
+ import { type EntityRepository } from './entity/EntityRepository.js';
9
+ import { Reference, type ScalarReference } from './entity/Reference.js';
10
+ import type { MikroORM } from './MikroORM.js';
11
+ import type { SerializationContext } from './serialization/SerializationContext.js';
12
+ import type { SerializeOptions } from './serialization/EntitySerializer.js';
13
+ import type { MetadataStorage } from './metadata/MetadataStorage.js';
14
+ import type { EntitySchema } from './metadata/EntitySchema.js';
15
+ import type { Type, types } from './types/index.js';
16
+ import type { Platform } from './platforms/Platform.js';
17
+ import type { Configuration } from './utils/Configuration.js';
18
+ import type { RawQueryFragment } from './utils/RawQueryFragment.js';
19
+ import type { EntityManager } from './EntityManager.js';
20
+ import type { EmbeddedPrefixMode } from './decorators/Embedded.js';
21
+ import type { EventSubscriber } from './events/EventSubscriber.js';
22
+ import type { FindOneOptions, FindOptions, LoadHint } from './drivers/IDatabaseDriver.js';
20
23
  export type Constructor<T = unknown> = new (...args: any[]) => T;
21
24
  export type Dictionary<T = any> = {
22
25
  [k: string]: T;
@@ -468,7 +471,6 @@ export interface EntityMetadata<T = any> {
468
471
  prototype: T;
469
472
  class: EntityClass<T>;
470
473
  abstract: boolean;
471
- useCache: boolean;
472
474
  filters: Dictionary<FilterDef>;
473
475
  comment?: string;
474
476
  selfReferencing?: boolean;
package/typings.js CHANGED
@@ -1,18 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityMetadata = exports.Config = exports.HiddenProps = exports.EagerProps = exports.OptionalProps = exports.PrimaryKeyProp = exports.EntityRepositoryType = void 0;
4
- const enums_1 = require("./enums");
5
- const Reference_1 = require("./entity/Reference");
6
- const EntityHelper_1 = require("./entity/EntityHelper");
7
- const Utils_1 = require("./utils/Utils");
8
- const EntityComparator_1 = require("./utils/EntityComparator");
9
- exports.EntityRepositoryType = Symbol('EntityRepositoryType');
10
- exports.PrimaryKeyProp = Symbol('PrimaryKeyProp');
11
- exports.OptionalProps = Symbol('OptionalProps');
12
- exports.EagerProps = Symbol('EagerProps');
13
- exports.HiddenProps = Symbol('HiddenProps');
14
- exports.Config = Symbol('Config');
15
- class EntityMetadata {
1
+ import { ReferenceKind, } from './enums.js';
2
+ import { Reference } from './entity/Reference.js';
3
+ import { EntityHelper } from './entity/EntityHelper.js';
4
+ import { Utils } from './utils/Utils.js';
5
+ import { EntityComparator } from './utils/EntityComparator.js';
6
+ export const EntityRepositoryType = Symbol('EntityRepositoryType');
7
+ export const PrimaryKeyProp = Symbol('PrimaryKeyProp');
8
+ export const OptionalProps = Symbol('OptionalProps');
9
+ export const EagerProps = Symbol('EagerProps');
10
+ export const HiddenProps = Symbol('HiddenProps');
11
+ export const Config = Symbol('Config');
12
+ export class EntityMetadata {
16
13
  static counter = 0;
17
14
  _id = 1000 * EntityMetadata.counter++; // keep the id >= 1000 to allow computing cache keys by simple addition
18
15
  propertyOrder = new Map();
@@ -35,7 +32,7 @@ class EntityMetadata {
35
32
  }
36
33
  this.properties[prop.name] = prop;
37
34
  this.propertyOrder.set(prop.name, this.props.length);
38
- /* istanbul ignore next */
35
+ /* v8 ignore next 3 */
39
36
  if (sync) {
40
37
  this.sync();
41
38
  }
@@ -43,7 +40,7 @@ class EntityMetadata {
43
40
  removeProperty(name, sync = true) {
44
41
  delete this.properties[name];
45
42
  this.propertyOrder.delete(name);
46
- /* istanbul ignore next */
43
+ /* v8 ignore next 3 */
47
44
  if (sync) {
48
45
  this.sync();
49
46
  }
@@ -64,11 +61,11 @@ class EntityMetadata {
64
61
  this.root ??= this;
65
62
  const props = Object.values(this.properties).sort((a, b) => this.propertyOrder.get(a.name) - this.propertyOrder.get(b.name));
66
63
  this.props = [...props.filter(p => p.primary), ...props.filter(p => !p.primary)];
67
- this.relations = this.props.filter(prop => typeof prop.kind !== 'undefined' && prop.kind !== enums_1.ReferenceKind.SCALAR && prop.kind !== enums_1.ReferenceKind.EMBEDDED);
64
+ this.relations = this.props.filter(prop => typeof prop.kind !== 'undefined' && prop.kind !== ReferenceKind.SCALAR && prop.kind !== ReferenceKind.EMBEDDED);
68
65
  this.bidirectionalRelations = this.relations.filter(prop => prop.mappedBy || prop.inversedBy);
69
66
  this.uniqueProps = this.props.filter(prop => prop.unique);
70
67
  this.getterProps = this.props.filter(prop => prop.getter);
71
- this.comparableProps = this.props.filter(prop => EntityComparator_1.EntityComparator.isComparable(prop, this));
68
+ this.comparableProps = this.props.filter(prop => EntityComparator.isComparable(prop, this));
72
69
  this.hydrateProps = this.props.filter(prop => {
73
70
  // `prop.userDefined` is either `undefined` or `false`
74
71
  const discriminator = this.root.discriminatorColumn === prop.name && prop.userDefined === false;
@@ -78,14 +75,14 @@ class EntityMetadata {
78
75
  });
79
76
  this.trackingProps = this.hydrateProps
80
77
  .filter(prop => !prop.getter && !prop.setter && prop.trackChanges !== false)
81
- .filter(prop => ![enums_1.ReferenceKind.ONE_TO_MANY, enums_1.ReferenceKind.MANY_TO_MANY].includes(prop.kind))
78
+ .filter(prop => ![ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(prop.kind))
82
79
  .filter(prop => !prop.serializedPrimaryKey);
83
80
  this.selfReferencing = this.relations.some(prop => [this.className, this.root.className].includes(prop.targetMeta?.root.className ?? prop.type));
84
81
  this.hasUniqueProps = this.uniques.length + this.uniqueProps.length > 0;
85
82
  this.virtual = !!this.expression;
86
83
  if (config) {
87
84
  for (const prop of this.props) {
88
- if (prop.enum && !prop.nativeEnumName && prop.items?.every(item => Utils_1.Utils.isString(item))) {
85
+ if (prop.enum && !prop.nativeEnumName && prop.items?.every(item => Utils.isString(item))) {
89
86
  const name = config.getNamingStrategy().indexName(this.tableName, prop.fieldNames, 'check');
90
87
  const exists = this.checks.findIndex(check => check.name === name);
91
88
  if (exists !== -1) {
@@ -99,11 +96,11 @@ class EntityMetadata {
99
96
  }
100
97
  }
101
98
  }
102
- this.checks = Utils_1.Utils.removeDuplicates(this.checks);
103
- this.indexes = Utils_1.Utils.removeDuplicates(this.indexes);
104
- this.uniques = Utils_1.Utils.removeDuplicates(this.uniques);
105
- for (const hook of Utils_1.Utils.keys(this.hooks)) {
106
- this.hooks[hook] = Utils_1.Utils.removeDuplicates(this.hooks[hook]);
99
+ this.checks = Utils.removeDuplicates(this.checks);
100
+ this.indexes = Utils.removeDuplicates(this.indexes);
101
+ this.uniques = Utils.removeDuplicates(this.uniques);
102
+ for (const hook of Utils.keys(this.hooks)) {
103
+ this.hooks[hook] = Utils.removeDuplicates(this.hooks[hook]);
107
104
  }
108
105
  if (this.virtual) {
109
106
  this.readonly = true;
@@ -112,8 +109,8 @@ class EntityMetadata {
112
109
  this.props.forEach(prop => this.initIndexes(prop));
113
110
  }
114
111
  this.definedProperties = this.trackingProps.reduce((o, prop) => {
115
- const isCollection = [enums_1.ReferenceKind.ONE_TO_MANY, enums_1.ReferenceKind.MANY_TO_MANY].includes(prop.kind);
116
- const isReference = [enums_1.ReferenceKind.ONE_TO_ONE, enums_1.ReferenceKind.MANY_TO_ONE].includes(prop.kind) && (prop.inversedBy || prop.mappedBy) && !prop.mapToPk;
112
+ const isCollection = [ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(prop.kind);
113
+ const isReference = [ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(prop.kind) && (prop.inversedBy || prop.mappedBy) && !prop.mapToPk;
117
114
  if (isReference) {
118
115
  // eslint-disable-next-line @typescript-eslint/no-this-alias
119
116
  const meta = this;
@@ -124,17 +121,17 @@ class EntityMetadata {
124
121
  set(val) {
125
122
  const wrapped = this.__helper;
126
123
  const hydrator = wrapped.hydrator;
127
- const entity = Reference_1.Reference.unwrapReference(val ?? wrapped.__data[prop.name]);
128
- const old = Reference_1.Reference.unwrapReference(wrapped.__data[prop.name]);
129
- wrapped.__data[prop.name] = Reference_1.Reference.wrapReference(val, prop);
124
+ const entity = Reference.unwrapReference(val ?? wrapped.__data[prop.name]);
125
+ const old = Reference.unwrapReference(wrapped.__data[prop.name]);
126
+ wrapped.__data[prop.name] = Reference.wrapReference(val, prop);
130
127
  // when propagation from inside hydration, we set the FK to the entity data immediately
131
128
  if (val && hydrator.isRunning() && wrapped.__originalEntityData && prop.owner) {
132
- wrapped.__originalEntityData[prop.name] = Utils_1.Utils.getPrimaryKeyValues(val, prop.targetMeta.primaryKeys, true);
129
+ wrapped.__originalEntityData[prop.name] = Utils.getPrimaryKeyValues(val, prop.targetMeta.primaryKeys, true);
133
130
  }
134
131
  else {
135
132
  wrapped.__touched = !hydrator.isRunning();
136
133
  }
137
- EntityHelper_1.EntityHelper.propagate(meta, entity, this, prop, Reference_1.Reference.unwrapReference(val), old);
134
+ EntityHelper.propagate(meta, entity, this, prop, Reference.unwrapReference(val), old);
138
135
  },
139
136
  enumerable: true,
140
137
  configurable: true,
@@ -163,14 +160,14 @@ class EntityMetadata {
163
160
  initIndexes(prop) {
164
161
  const simpleIndex = this.indexes.find(index => index.properties === prop.name && !index.options && !index.type && !index.expression);
165
162
  const simpleUnique = this.uniques.find(index => index.properties === prop.name && !index.options);
166
- const owner = prop.kind === enums_1.ReferenceKind.MANY_TO_ONE;
163
+ const owner = prop.kind === ReferenceKind.MANY_TO_ONE;
167
164
  if (!prop.index && simpleIndex) {
168
- Utils_1.Utils.defaultValue(simpleIndex, 'name', true);
165
+ Utils.defaultValue(simpleIndex, 'name', true);
169
166
  prop.index = simpleIndex.name;
170
167
  this.indexes.splice(this.indexes.indexOf(simpleIndex), 1);
171
168
  }
172
169
  if (!prop.unique && simpleUnique) {
173
- Utils_1.Utils.defaultValue(simpleUnique, 'name', true);
170
+ Utils.defaultValue(simpleUnique, 'name', true);
174
171
  prop.unique = simpleUnique.name;
175
172
  this.uniques.splice(this.uniques.indexOf(simpleUnique), 1);
176
173
  }
@@ -178,7 +175,7 @@ class EntityMetadata {
178
175
  this.indexes.push({ properties: prop.name });
179
176
  prop.index = false;
180
177
  }
181
- /* istanbul ignore next */
178
+ /* v8 ignore next 4 */
182
179
  if (owner && prop.fieldNames.length > 1 && prop.unique) {
183
180
  this.uniques.push({ properties: prop.name });
184
181
  prop.unique = false;
@@ -189,4 +186,3 @@ class EntityMetadata {
189
186
  return this;
190
187
  }
191
188
  }
192
- exports.EntityMetadata = EntityMetadata;
@@ -1,5 +1,5 @@
1
1
  import { inspect } from 'node:util';
2
- import type { EntityData, EntityMetadata, EntityDictionary, Primary } from '../typings';
2
+ import type { EntityData, EntityMetadata, EntityDictionary, Primary } from '../typings.js';
3
3
  export declare class ChangeSet<T extends object> {
4
4
  entity: T;
5
5
  type: ChangeSetType;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChangeSetType = exports.ChangeSet = void 0;
4
- const node_util_1 = require("node:util");
5
- const wrap_1 = require("../entity/wrap");
6
- const Utils_1 = require("../utils/Utils");
7
- class ChangeSet {
1
+ import { inspect } from 'node:util';
2
+ import { helper } from '../entity/wrap.js';
3
+ import { Utils } from '../utils/Utils.js';
4
+ export class ChangeSet {
8
5
  entity;
9
6
  type;
10
7
  payload;
@@ -19,11 +16,11 @@ class ChangeSet {
19
16
  this.name = meta.className;
20
17
  this.rootName = meta.root.className;
21
18
  this.collection = meta.root.collection;
22
- this.schema = (0, wrap_1.helper)(entity).__schema ?? meta.root.schema;
19
+ this.schema = helper(entity).__schema ?? meta.root.schema;
23
20
  }
24
21
  getPrimaryKey(object = false) {
25
22
  if (!this.originalEntity) {
26
- this.primaryKey ??= (0, wrap_1.helper)(this.entity).getPrimaryKey(true);
23
+ this.primaryKey ??= helper(this.entity).getPrimaryKey(true);
27
24
  }
28
25
  else if (this.meta.compositePK) {
29
26
  this.primaryKey = this.meta.primaryKeys.map(pk => this.originalEntity[pk]);
@@ -40,31 +37,30 @@ class ChangeSet {
40
37
  });
41
38
  }
42
39
  if (object && this.primaryKey != null) {
43
- return Utils_1.Utils.primaryKeyToObject(this.meta, this.primaryKey);
40
+ return Utils.primaryKeyToObject(this.meta, this.primaryKey);
44
41
  }
45
42
  return this.primaryKey ?? null;
46
43
  }
47
44
  getSerializedPrimaryKey() {
48
- this.serializedPrimaryKey ??= (0, wrap_1.helper)(this.entity).getSerializedPrimaryKey();
45
+ this.serializedPrimaryKey ??= helper(this.entity).getSerializedPrimaryKey();
49
46
  return this.serializedPrimaryKey;
50
47
  }
51
48
  /** @ignore */
52
- [node_util_1.inspect.custom](depth = 2) {
49
+ [inspect.custom](depth = 2) {
53
50
  const object = { ...this };
54
51
  const hidden = ['meta', 'serializedPrimaryKey'];
55
52
  hidden.forEach(k => delete object[k]);
56
- const ret = (0, node_util_1.inspect)(object, { depth });
53
+ const ret = inspect(object, { depth });
57
54
  const name = `${this.constructor.name}<${this.meta.className}>`;
58
- /* istanbul ignore next */
55
+ /* v8 ignore next */
59
56
  return ret === '[Object]' ? `[${name}]` : name + ' ' + ret;
60
57
  }
61
58
  }
62
- exports.ChangeSet = ChangeSet;
63
- var ChangeSetType;
59
+ export var ChangeSetType;
64
60
  (function (ChangeSetType) {
65
61
  ChangeSetType["CREATE"] = "create";
66
62
  ChangeSetType["UPDATE"] = "update";
67
63
  ChangeSetType["DELETE"] = "delete";
68
64
  ChangeSetType["UPDATE_EARLY"] = "update_early";
69
65
  ChangeSetType["DELETE_EARLY"] = "delete_early";
70
- })(ChangeSetType || (exports.ChangeSetType = ChangeSetType = {}));
66
+ })(ChangeSetType || (ChangeSetType = {}));
@@ -1,10 +1,11 @@
1
- import { type Configuration } from '../utils/Configuration';
2
- import type { MetadataStorage } from '../metadata';
3
- import type { AnyEntity } from '../typings';
4
- import { ChangeSet } from './ChangeSet';
5
- import { type Collection, type EntityValidator } from '../entity';
6
- import type { Platform } from '../platforms';
7
- import type { EntityManager } from '../EntityManager';
1
+ import { type Configuration } from '../utils/Configuration.js';
2
+ import type { MetadataStorage } from '../metadata/MetadataStorage.js';
3
+ import type { AnyEntity } from '../typings.js';
4
+ import { ChangeSet } from './ChangeSet.js';
5
+ import { type EntityValidator } from '../entity/EntityValidator.js';
6
+ import { type Collection } from '../entity/Collection.js';
7
+ import type { Platform } from '../platforms/Platform.js';
8
+ import type { EntityManager } from '../EntityManager.js';
8
9
  export declare class ChangeSetComputer {
9
10
  private readonly validator;
10
11
  private readonly collectionUpdates;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChangeSetComputer = void 0;
4
- const Utils_1 = require("../utils/Utils");
5
- const ChangeSet_1 = require("./ChangeSet");
6
- const entity_1 = require("../entity");
7
- const enums_1 = require("../enums");
8
- class ChangeSetComputer {
1
+ import { Utils } from '../utils/Utils.js';
2
+ import { ChangeSet, ChangeSetType } from './ChangeSet.js';
3
+ import { helper } from '../entity/wrap.js';
4
+ import { ReferenceKind } from '../enums.js';
5
+ export class ChangeSetComputer {
9
6
  validator;
10
7
  collectionUpdates;
11
8
  metadata;
@@ -27,20 +24,20 @@ class ChangeSetComputer {
27
24
  if (meta.readonly) {
28
25
  return null;
29
26
  }
30
- const wrapped = (0, entity_1.helper)(entity);
31
- const type = wrapped.__originalEntityData ? ChangeSet_1.ChangeSetType.UPDATE : ChangeSet_1.ChangeSetType.CREATE;
27
+ const wrapped = helper(entity);
28
+ const type = wrapped.__originalEntityData ? ChangeSetType.UPDATE : ChangeSetType.CREATE;
32
29
  const map = new Map();
33
30
  // Execute `onCreate` and `onUpdate` on properties recursively, saves `onUpdate` results
34
31
  // to the `map` as we want to apply those only if something else changed.
35
- if (type === ChangeSet_1.ChangeSetType.CREATE) { // run update hooks only after we know there are other changes
32
+ if (type === ChangeSetType.CREATE) { // run update hooks only after we know there are other changes
36
33
  for (const prop of meta.hydrateProps) {
37
34
  this.processPropertyInitializers(entity, prop, type, map);
38
35
  }
39
36
  }
40
- if (type === ChangeSet_1.ChangeSetType.UPDATE && !wrapped.__initialized && !wrapped.isTouched()) {
37
+ if (type === ChangeSetType.UPDATE && !wrapped.__initialized && !wrapped.isTouched()) {
41
38
  return null;
42
39
  }
43
- const changeSet = new ChangeSet_1.ChangeSet(entity, type, this.computePayload(entity), meta);
40
+ const changeSet = new ChangeSet(entity, type, this.computePayload(entity), meta);
44
41
  changeSet.originalEntity = wrapped.__originalEntityData;
45
42
  if (this.config.get('validate')) {
46
43
  this.validator.validate(changeSet.entity, changeSet.payload, meta);
@@ -48,12 +45,12 @@ class ChangeSetComputer {
48
45
  for (const prop of meta.relations.filter(prop => prop.persist !== false || prop.userDefined === false)) {
49
46
  this.processProperty(changeSet, prop);
50
47
  }
51
- if (changeSet.type === ChangeSet_1.ChangeSetType.UPDATE && !Utils_1.Utils.hasObjectKeys(changeSet.payload)) {
48
+ if (changeSet.type === ChangeSetType.UPDATE && !Utils.hasObjectKeys(changeSet.payload)) {
52
49
  return null;
53
50
  }
54
51
  // Execute `onCreate` and `onUpdate` on properties recursively, saves `onUpdate` results
55
52
  // to the `map` as we want to apply those only if something else changed.
56
- if (type === ChangeSet_1.ChangeSetType.UPDATE) {
53
+ if (type === ChangeSetType.UPDATE) {
57
54
  for (const prop of meta.hydrateProps) {
58
55
  this.processPropertyInitializers(entity, prop, type, map);
59
56
  }
@@ -66,7 +63,7 @@ class ChangeSetComputer {
66
63
  }
67
64
  // Recompute the changeset, we need to merge this as here we ignore relations.
68
65
  const diff = this.computePayload(entity, true);
69
- Utils_1.Utils.merge(changeSet.payload, diff);
66
+ Utils.merge(changeSet.payload, diff);
70
67
  }
71
68
  return changeSet;
72
69
  }
@@ -75,17 +72,17 @@ class ChangeSetComputer {
75
72
  */
76
73
  processPropertyInitializers(entity, prop, type, map, nested) {
77
74
  if (prop.onCreate
78
- && type === ChangeSet_1.ChangeSetType.CREATE
75
+ && type === ChangeSetType.CREATE
79
76
  && (entity[prop.name] == null
80
- || (Utils_1.Utils.isScalarReference(entity[prop.name]) && entity[prop.name].unwrap() == null))) {
77
+ || (Utils.isScalarReference(entity[prop.name]) && entity[prop.name].unwrap() == null))) {
81
78
  entity[prop.name] = prop.onCreate(entity, this.em);
82
79
  }
83
- if (prop.onUpdate && type === ChangeSet_1.ChangeSetType.UPDATE) {
80
+ if (prop.onUpdate && type === ChangeSetType.UPDATE) {
84
81
  const pairs = map.get(entity) ?? [];
85
82
  pairs.push([prop.name, prop.onUpdate(entity, this.em)]);
86
83
  map.set(entity, pairs);
87
84
  }
88
- if (prop.kind === enums_1.ReferenceKind.EMBEDDED && entity[prop.name]) {
85
+ if (prop.kind === ReferenceKind.EMBEDDED && entity[prop.name]) {
89
86
  for (const embeddedProp of prop.targetMeta.hydrateProps) {
90
87
  this.processPropertyInitializers(entity[prop.name], embeddedProp, type, map, nested || prop.object);
91
88
  }
@@ -93,7 +90,7 @@ class ChangeSetComputer {
93
90
  }
94
91
  computePayload(entity, ignoreUndefined = false) {
95
92
  const data = this.comparator.prepareEntity(entity);
96
- const wrapped = (0, entity_1.helper)(entity);
93
+ const wrapped = helper(entity);
97
94
  const entityName = wrapped.__meta.className;
98
95
  const originalEntityData = wrapped.__originalEntityData;
99
96
  if (!wrapped.__initialized) {
@@ -106,7 +103,7 @@ class ChangeSetComputer {
106
103
  const comparator = this.comparator.getEntityComparator(entityName);
107
104
  const diff = comparator(originalEntityData, data);
108
105
  if (ignoreUndefined) {
109
- Utils_1.Utils.keys(diff)
106
+ Utils.keys(diff)
110
107
  .filter(k => diff[k] === undefined)
111
108
  .forEach(k => delete diff[k]);
112
109
  }
@@ -116,32 +113,32 @@ class ChangeSetComputer {
116
113
  }
117
114
  processProperty(changeSet, prop, target) {
118
115
  if (!target) {
119
- const targets = Utils_1.Utils.unwrapProperty(changeSet.entity, changeSet.meta, prop);
116
+ const targets = Utils.unwrapProperty(changeSet.entity, changeSet.meta, prop);
120
117
  targets.forEach(([t]) => this.processProperty(changeSet, prop, t));
121
118
  return;
122
119
  }
123
- if (Utils_1.Utils.isCollection(target)) { // m:n or 1:m
120
+ if (Utils.isCollection(target)) { // m:n or 1:m
124
121
  this.processToMany(prop, changeSet);
125
122
  }
126
- if ([enums_1.ReferenceKind.MANY_TO_ONE, enums_1.ReferenceKind.ONE_TO_ONE].includes(prop.kind)) {
123
+ if ([ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop.kind)) {
127
124
  this.processToOne(prop, changeSet);
128
125
  }
129
126
  }
130
127
  processToOne(prop, changeSet) {
131
- const isToOneOwner = prop.kind === enums_1.ReferenceKind.MANY_TO_ONE || (prop.kind === enums_1.ReferenceKind.ONE_TO_ONE && prop.owner);
128
+ const isToOneOwner = prop.kind === ReferenceKind.MANY_TO_ONE || (prop.kind === ReferenceKind.ONE_TO_ONE && prop.owner);
132
129
  if (!isToOneOwner || prop.mapToPk) {
133
130
  return;
134
131
  }
135
- const targets = Utils_1.Utils.unwrapProperty(changeSet.entity, changeSet.meta, prop);
132
+ const targets = Utils.unwrapProperty(changeSet.entity, changeSet.meta, prop);
136
133
  targets.forEach(([target, idx]) => {
137
134
  if (!target.__helper.hasPrimaryKey()) {
138
- Utils_1.Utils.setPayloadProperty(changeSet.payload, this.metadata.find(changeSet.name), prop, target.__helper.__identifier, idx);
135
+ Utils.setPayloadProperty(changeSet.payload, this.metadata.find(changeSet.name), prop, target.__helper.__identifier, idx);
139
136
  }
140
137
  });
141
138
  }
142
139
  processToMany(prop, changeSet) {
143
140
  const target = changeSet.entity[prop.name];
144
- if (!target.isDirty() && changeSet.type !== ChangeSet_1.ChangeSetType.CREATE) {
141
+ if (!target.isDirty() && changeSet.type !== ChangeSetType.CREATE) {
145
142
  return;
146
143
  }
147
144
  this.collectionUpdates.add(target);
@@ -150,4 +147,3 @@ class ChangeSetComputer {
150
147
  }
151
148
  }
152
149
  }
153
- exports.ChangeSetComputer = ChangeSetComputer;
@@ -1,9 +1,10 @@
1
- import type { MetadataStorage } from '../metadata';
2
- import type { Dictionary, EntityDictionary, EntityMetadata, IHydrator } from '../typings';
3
- import { type EntityFactory, type EntityValidator } from '../entity';
4
- import { type ChangeSet } from './ChangeSet';
5
- import { type Configuration } from '../utils/Configuration';
6
- import type { DriverMethodOptions, IDatabaseDriver } from '../drivers';
1
+ import type { MetadataStorage } from '../metadata/MetadataStorage.js';
2
+ import type { Dictionary, EntityDictionary, EntityMetadata, IHydrator } from '../typings.js';
3
+ import { type EntityFactory } from '../entity/EntityFactory.js';
4
+ import { type EntityValidator } from '../entity/EntityValidator.js';
5
+ import { type ChangeSet } from './ChangeSet.js';
6
+ import { type Configuration } from '../utils/Configuration.js';
7
+ import type { DriverMethodOptions, IDatabaseDriver } from '../drivers/IDatabaseDriver.js';
7
8
  export declare class ChangeSetPersister {
8
9
  private readonly driver;
9
10
  private readonly metadata;