@mikro-orm/core 7.0.0-dev.0 → 7.0.0-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.
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
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;
@@ -25,6 +28,7 @@ export type EntityKey<T = unknown, B extends boolean = false> = string & {
25
28
  [K in keyof T]-?: CleanKeys<T, K, B> extends never ? never : K;
26
29
  }[keyof T];
27
30
  export type EntityValue<T> = T[EntityKey<T>];
31
+ export type EntityDataValue<T> = EntityData<T>[EntityKey<T>];
28
32
  export type FilterKey<T> = keyof FilterQuery<T>;
29
33
  export type AsyncFunction<R = any, T = Dictionary> = (args: T) => Promise<T>;
30
34
  export type Compute<T> = {
@@ -173,7 +177,7 @@ export interface IWrappedEntityInternal<Entity extends object> extends IWrappedE
173
177
  __touched: boolean;
174
178
  __originalEntityData?: EntityData<Entity>;
175
179
  __loadedProperties: Set<string>;
176
- __identifier?: EntityIdentifier;
180
+ __identifier?: EntityIdentifier | EntityIdentifier[];
177
181
  __managed: boolean;
178
182
  __processing: boolean;
179
183
  __schema?: string;
@@ -202,7 +206,7 @@ export type EntityName<T> = string | EntityClass<T> | EntitySchema<T, any> | {
202
206
  };
203
207
  export type GetRepository<Entity extends {
204
208
  [k: PropertyKey]: any;
205
- }, Fallback> = Entity[typeof EntityRepositoryType] extends EntityRepository<Entity> | undefined ? NonNullable<Entity[typeof EntityRepositoryType]> : Fallback;
209
+ }, Fallback> = Entity[typeof EntityRepositoryType] extends EntityRepository<any> | undefined ? NonNullable<Entity[typeof EntityRepositoryType]> : Fallback;
206
210
  export type EntityDataPropValue<T> = T | Primary<T>;
207
211
  type ExpandEntityProp<T, C extends boolean = false> = T extends Record<string, any> ? {
208
212
  [K in keyof T as CleanKeys<T, K>]?: EntityDataProp<ExpandProperty<T[K]>, C> | EntityDataPropValue<ExpandProperty<T[K]>> | null;
@@ -237,7 +241,7 @@ type IsOptional<T, K extends keyof T, I> = T[K] extends Collection<any, any> ? t
237
241
  type RequiredKeys<T, K extends keyof T, I> = IsOptional<T, K, I> extends false ? CleanKeys<T, K> : never;
238
242
  type OptionalKeys<T, K extends keyof T, I> = IsOptional<T, K, I> extends false ? never : CleanKeys<T, K>;
239
243
  export type EntityData<T, C extends boolean = false> = {
240
- [K in EntityKey<T>]?: EntityDataItem<T[K], C>;
244
+ [K in EntityKey<T>]?: EntityDataItem<T[K] & {}, C>;
241
245
  };
242
246
  export type RequiredEntityData<T, I = never, C extends boolean = false> = {
243
247
  [K in keyof T as RequiredKeys<T, K, I>]: T[K] | RequiredEntityDataProp<T[K], T, C> | Primary<T[K]>;
@@ -279,7 +283,7 @@ type PrimaryOrObject<T, U, C extends TypeConfig> = PreferExplicitConfig<C, Extra
279
283
  } : Primary<U>;
280
284
  export type EntityDTOProp<E, T, C extends TypeConfig = never> = T extends Scalar ? T : T extends {
281
285
  __serialized?: infer U;
282
- } ? U : T extends LoadedReference<infer U> ? EntityDTO<U, C> : T extends Reference<infer U> ? PrimaryOrObject<E, U, C> : T extends ScalarReference<infer U> ? U : T extends LoadedCollection<infer U> ? EntityDTO<U, C>[] : T extends Collection<infer U> ? PrimaryOrObject<E, U, C>[] : T extends readonly (infer U)[] ? (T extends readonly any[] ? T : U[]) : T extends Relation<T> ? EntityDTO<T, C> : T;
286
+ } ? (IsUnknown<U> extends false ? U : T) : T extends LoadedReference<infer U> ? EntityDTO<U, C> : T extends Reference<infer U> ? PrimaryOrObject<E, U, C> : T extends ScalarReference<infer U> ? U : T extends LoadedCollection<infer U> ? EntityDTO<U, C>[] : T extends Collection<infer U> ? PrimaryOrObject<E, U, C>[] : T extends readonly (infer U)[] ? (T extends readonly any[] ? T : U[]) : T extends Relation<T> ? EntityDTO<T, C> : T;
283
287
  type DTOProbablyOptionalProps<T> = NonNullable<NullableKeys<T, undefined>>;
284
288
  type DTOIsOptional<T, K extends keyof T> = T[K] extends LoadedCollection<any> ? false : K extends PrimaryProperty<T> ? false : K extends DTOProbablyOptionalProps<T> ? true : false;
285
289
  type DTORequiredKeys<T, K extends keyof T> = DTOIsOptional<T, K> extends false ? ExcludeHidden<T, K> & CleanKeys<T, K> : never;
@@ -289,7 +293,9 @@ export type EntityDTO<T, C extends TypeConfig = never> = {
289
293
  } & {
290
294
  [K in keyof T as DTOOptionalKeys<T, K>]?: EntityDTOProp<T, T[K], C> | AddOptional<T[K]>;
291
295
  };
292
- export type CheckCallback<T> = (columns: Record<keyof T, string>) => string;
296
+ type TargetKeys<T> = T extends EntityClass<infer P> ? keyof P : keyof T;
297
+ type CheckKey<T> = IsUnknown<T> extends false ? TargetKeys<T> : string;
298
+ export type CheckCallback<T> = (columns: Record<CheckKey<T>, string>) => string;
293
299
  export type GeneratedColumnCallback<T> = (columns: Record<keyof T, string>) => string;
294
300
  export interface CheckConstraint<T = any> {
295
301
  name?: string;
@@ -413,7 +419,7 @@ export interface EntityMetadata<T = any> {
413
419
  schema?: string;
414
420
  pivotTable?: boolean;
415
421
  virtual?: boolean;
416
- expression?: string | ((em: any, where: FilterQuery<T>, options: FindOptions<T, any, any, any>) => MaybePromise<RawQueryFragment | object | string>);
422
+ expression?: string | ((em: any, where: ObjectQuery<T>, options: FindOptions<T, any, any, any>) => MaybePromise<RawQueryFragment | object | string>);
417
423
  discriminatorColumn?: EntityKey<T> | AnyString;
418
424
  discriminatorValue?: number | string;
419
425
  discriminatorMap?: Dictionary<string>;
@@ -468,7 +474,6 @@ export interface EntityMetadata<T = any> {
468
474
  prototype: T;
469
475
  class: EntityClass<T>;
470
476
  abstract: boolean;
471
- useCache: boolean;
472
477
  filters: Dictionary<FilterDef>;
473
478
  comment?: string;
474
479
  selfReferencing?: boolean;
@@ -679,7 +684,7 @@ export interface MigrationObject {
679
684
  }
680
685
  export type FilterDef = {
681
686
  name: string;
682
- cond: Dictionary | ((args: Dictionary, type: 'read' | 'update' | 'delete', em: any, options?: FindOptions<any, any, any, any> | FindOneOptions<any, any, any, any>) => Dictionary | Promise<Dictionary>);
687
+ cond: Dictionary | ((args: Dictionary, type: 'read' | 'update' | 'delete', em: any, options?: FindOptions<any, any, any, any> | FindOneOptions<any, any, any, any>, entityName?: EntityName<any>) => Dictionary | Promise<Dictionary>);
683
688
  default?: boolean;
684
689
  entity?: string[];
685
690
  args?: boolean;
@@ -724,7 +729,7 @@ export type MergeSelected<T, U, F extends string> = T extends Loaded<infer TT, i
724
729
  type MergeFields<F1 extends string, F2 extends string, P1, P2> = P1 | P2 extends '*' ? '*' : F1 | F2;
725
730
  type MergeExcludes<F extends string, E extends string> = F extends E ? never : Exclude<E, F>;
726
731
  export type MergeLoaded<T, U, P extends string, F extends string, E extends string, R extends boolean = false> = T extends Loaded<U, infer PP, infer FF, infer EE> ? string extends FF ? Loaded<T, P, F, AnyStringToNever<EE> | E> : string extends P ? Loaded<U, never, F | (FF & string), MergeExcludes<F | (FF & string), EE | E>> : Loaded<U, P | AnyStringToNever<PP>, MergeFields<F, AnyStringToNever<FF>, P, PP>, MergeExcludes<MergeFields<F, AnyStringToNever<FF>, P, PP>, (R extends true ? never : EE) | E>> : Loaded<T, P, F>;
727
- type AddOptional<T> = undefined | null extends T ? null | undefined : null extends T ? null : undefined extends T ? undefined : never;
732
+ export type AddOptional<T> = undefined | null extends T ? null | undefined : null extends T ? null : undefined extends T ? undefined : never;
728
733
  type LoadedProp<T, L extends string = never, F extends string = '*', E extends string = never> = LoadedLoadable<T, Loaded<ExtractType<T>, L, F, E>>;
729
734
  export type AddEager<T> = ExtractEagerProps<T> & string;
730
735
  export type ExpandHint<T, L extends string> = L | AddEager<T>;
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,20 @@ 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
+ if (old && old !== entity && prop.kind === ReferenceKind.MANY_TO_ONE && prop.inversedBy && old[prop.inversedBy]) {
127
+ old[prop.inversedBy].removeWithoutPropagation(this);
128
+ }
129
+ wrapped.__data[prop.name] = Reference.wrapReference(val, prop);
130
130
  // when propagation from inside hydration, we set the FK to the entity data immediately
131
131
  if (val && hydrator.isRunning() && wrapped.__originalEntityData && prop.owner) {
132
- wrapped.__originalEntityData[prop.name] = Utils_1.Utils.getPrimaryKeyValues(val, prop.targetMeta.primaryKeys, true);
132
+ wrapped.__originalEntityData[prop.name] = Utils.getPrimaryKeyValues(val, prop.targetMeta.primaryKeys, true);
133
133
  }
134
134
  else {
135
135
  wrapped.__touched = !hydrator.isRunning();
136
136
  }
137
- EntityHelper_1.EntityHelper.propagate(meta, entity, this, prop, Reference_1.Reference.unwrapReference(val), old);
137
+ EntityHelper.propagate(meta, entity, this, prop, Reference.unwrapReference(val), old);
138
138
  },
139
139
  enumerable: true,
140
140
  configurable: true,
@@ -163,14 +163,14 @@ class EntityMetadata {
163
163
  initIndexes(prop) {
164
164
  const simpleIndex = this.indexes.find(index => index.properties === prop.name && !index.options && !index.type && !index.expression);
165
165
  const simpleUnique = this.uniques.find(index => index.properties === prop.name && !index.options);
166
- const owner = prop.kind === enums_1.ReferenceKind.MANY_TO_ONE;
166
+ const owner = prop.kind === ReferenceKind.MANY_TO_ONE;
167
167
  if (!prop.index && simpleIndex) {
168
- Utils_1.Utils.defaultValue(simpleIndex, 'name', true);
168
+ Utils.defaultValue(simpleIndex, 'name', true);
169
169
  prop.index = simpleIndex.name;
170
170
  this.indexes.splice(this.indexes.indexOf(simpleIndex), 1);
171
171
  }
172
172
  if (!prop.unique && simpleUnique) {
173
- Utils_1.Utils.defaultValue(simpleUnique, 'name', true);
173
+ Utils.defaultValue(simpleUnique, 'name', true);
174
174
  prop.unique = simpleUnique.name;
175
175
  this.uniques.splice(this.uniques.indexOf(simpleUnique), 1);
176
176
  }
@@ -178,7 +178,7 @@ class EntityMetadata {
178
178
  this.indexes.push({ properties: prop.name });
179
179
  prop.index = false;
180
180
  }
181
- /* istanbul ignore next */
181
+ /* v8 ignore next 4 */
182
182
  if (owner && prop.fieldNames.length > 1 && prop.unique) {
183
183
  this.uniques.push({ properties: prop.name });
184
184
  prop.unique = false;
@@ -189,4 +189,3 @@ class EntityMetadata {
189
189
  return this;
190
190
  }
191
191
  }
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;