@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
@@ -1,36 +1,17 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.OneToMany = void 0;
18
- /* istanbul ignore file */
19
- __exportStar(require("./PrimaryKey"), exports);
20
- __exportStar(require("./Entity"), exports);
21
- __exportStar(require("./OneToOne"), exports);
22
- __exportStar(require("./ManyToOne"), exports);
23
- __exportStar(require("./ManyToMany"), exports);
24
- var OneToMany_1 = require("./OneToMany");
25
- Object.defineProperty(exports, "OneToMany", { enumerable: true, get: function () { return OneToMany_1.OneToMany; } });
26
- __exportStar(require("./Property"), exports);
27
- __exportStar(require("./Check"), exports);
28
- __exportStar(require("./Enum"), exports);
29
- __exportStar(require("./Formula"), exports);
30
- __exportStar(require("./Indexed"), exports);
31
- __exportStar(require("./Embeddable"), exports);
32
- __exportStar(require("./Embedded"), exports);
33
- __exportStar(require("./Filter"), exports);
34
- __exportStar(require("./CreateRequestContext"), exports);
35
- __exportStar(require("./hooks"), exports);
36
- __exportStar(require("./Transactional"), exports);
1
+ export * from './PrimaryKey.js';
2
+ export * from './Entity.js';
3
+ export * from './OneToOne.js';
4
+ export * from './ManyToOne.js';
5
+ export * from './ManyToMany.js';
6
+ export { OneToMany } from './OneToMany.js';
7
+ export * from './Property.js';
8
+ export * from './Check.js';
9
+ export * from './Enum.js';
10
+ export * from './Formula.js';
11
+ export * from './Indexed.js';
12
+ export * from './Embeddable.js';
13
+ export * from './Embedded.js';
14
+ export * from './Filter.js';
15
+ export * from './CreateRequestContext.js';
16
+ export * from './hooks.js';
17
+ export * from './Transactional.js';
@@ -1,14 +1,15 @@
1
- import { type CountOptions, type DeleteOptions, type DriverMethodOptions, EntityManagerType, type FindOneOptions, type FindOptions, type IDatabaseDriver, type LockOptions, type NativeInsertUpdateManyOptions, type NativeInsertUpdateOptions, type OrderDefinition } from './IDatabaseDriver';
2
- import type { ConnectionType, Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityProperty, FilterQuery, PopulateOptions, Primary } from '../typings';
3
- import type { MetadataStorage } from '../metadata';
4
- import type { Connection, QueryResult, Transaction } from '../connections';
5
- import { type Configuration, type ConnectionOptions, EntityComparator } from '../utils';
6
- import { type QueryOrder } from '../enums';
7
- import type { Platform } from '../platforms';
8
- import type { Collection } from '../entity/Collection';
9
- import { EntityManager } from '../EntityManager';
10
- import { DriverException } from '../exceptions';
11
- import type { Logger } from '../logging/Logger';
1
+ import { type CountOptions, type DeleteOptions, type DriverMethodOptions, EntityManagerType, type FindOneOptions, type FindOptions, type IDatabaseDriver, type LockOptions, type NativeInsertUpdateManyOptions, type NativeInsertUpdateOptions, type OrderDefinition } from './IDatabaseDriver.js';
2
+ import type { ConnectionType, Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityProperty, FilterQuery, PopulateOptions, Primary } from '../typings.js';
3
+ import type { MetadataStorage } from '../metadata/MetadataStorage.js';
4
+ import type { Connection, QueryResult, Transaction } from '../connections/Connection.js';
5
+ import { type Configuration, type ConnectionOptions } from '../utils/Configuration.js';
6
+ import { EntityComparator } from '../utils/EntityComparator.js';
7
+ import { type QueryOrder } from '../enums.js';
8
+ import type { Platform } from '../platforms/Platform.js';
9
+ import type { Collection } from '../entity/Collection.js';
10
+ import { EntityManager } from '../EntityManager.js';
11
+ import { DriverException } from '../exceptions.js';
12
+ import type { Logger } from '../logging/Logger.js';
12
13
  export declare abstract class DatabaseDriver<C extends Connection> implements IDatabaseDriver<C> {
13
14
  readonly config: Configuration;
14
15
  protected readonly dependencies: string[];
@@ -28,7 +29,7 @@ export declare abstract class DatabaseDriver<C extends Connection> implements ID
28
29
  nativeUpdateMany<T extends object>(entityName: string, where: FilterQuery<T>[], data: EntityDictionary<T>[], options?: NativeInsertUpdateManyOptions<T>): Promise<QueryResult<T>>;
29
30
  abstract nativeDelete<T extends object>(entityName: string, where: FilterQuery<T>, options?: DeleteOptions<T>): Promise<QueryResult<T>>;
30
31
  abstract count<T extends object, P extends string = never>(entityName: string, where: FilterQuery<T>, options?: CountOptions<T, P>): Promise<number>;
31
- createEntityManager<D extends IDatabaseDriver = IDatabaseDriver>(useContext?: boolean): D[typeof EntityManagerType];
32
+ createEntityManager(useContext?: boolean): this[typeof EntityManagerType];
32
33
  findVirtual<T extends object>(entityName: string, where: FilterQuery<T>, options: FindOptions<T, any, any, any>): Promise<EntityData<T>[]>;
33
34
  countVirtual<T extends object>(entityName: string, where: FilterQuery<T>, options: CountOptions<T, any>): Promise<number>;
34
35
  aggregate(entityName: string, pipeline: any[]): Promise<any[]>;
@@ -1,18 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DatabaseDriver = void 0;
4
- const IDatabaseDriver_1 = require("./IDatabaseDriver");
5
- const utils_1 = require("../utils");
6
- const enums_1 = require("../enums");
7
- const EntityManager_1 = require("../EntityManager");
8
- const errors_1 = require("../errors");
9
- const exceptions_1 = require("../exceptions");
10
- const wrap_1 = require("../entity/wrap");
11
- const JsonType_1 = require("../types/JsonType");
12
- class DatabaseDriver {
1
+ import { EntityManagerType, } from './IDatabaseDriver.js';
2
+ import { Utils } from '../utils/Utils.js';
3
+ import { Cursor } from '../utils/Cursor.js';
4
+ import { EntityComparator } from '../utils/EntityComparator.js';
5
+ import { isRaw, raw } from '../utils/RawQueryFragment.js';
6
+ import { QueryOrderNumeric, ReferenceKind } from '../enums.js';
7
+ import { EntityManager } from '../EntityManager.js';
8
+ import { CursorError, ValidationError } from '../errors.js';
9
+ import { DriverException } from '../exceptions.js';
10
+ import { helper } from '../entity/wrap.js';
11
+ import { JsonType } from '../types/JsonType.js';
12
+ export class DatabaseDriver {
13
13
  config;
14
14
  dependencies;
15
- [IDatabaseDriver_1.EntityManagerType];
15
+ [EntityManagerType];
16
16
  connection;
17
17
  replicas = [];
18
18
  platform;
@@ -28,14 +28,14 @@ class DatabaseDriver {
28
28
  throw new Error(`Batch updates are not supported by ${this.constructor.name} driver`);
29
29
  }
30
30
  createEntityManager(useContext) {
31
- const EntityManagerClass = this.config.get('entityManager', EntityManager_1.EntityManager);
31
+ const EntityManagerClass = this.config.get('entityManager', EntityManager);
32
32
  return new EntityManagerClass(this.config, this, this.metadata, useContext);
33
33
  }
34
- /* istanbul ignore next */
34
+ /* v8 ignore next 3 */
35
35
  async findVirtual(entityName, where, options) {
36
36
  throw new Error(`Virtual entities are not supported by ${this.constructor.name} driver.`);
37
37
  }
38
- /* istanbul ignore next */
38
+ /* v8 ignore next 3 */
39
39
  async countVirtual(entityName, where, options) {
40
40
  throw new Error(`Counting virtual entities is not supported by ${this.constructor.name} driver.`);
41
41
  }
@@ -49,16 +49,14 @@ class DatabaseDriver {
49
49
  for (const coll of collections) {
50
50
  if (!coll.property.owner) {
51
51
  if (coll.getSnapshot() === undefined) {
52
- throw errors_1.ValidationError.cannotModifyInverseCollection(coll.owner, coll.property);
52
+ throw ValidationError.cannotModifyInverseCollection(coll.owner, coll.property);
53
53
  }
54
54
  continue;
55
55
  }
56
- /* istanbul ignore next */
57
- {
58
- const pk = coll.property.targetMeta.primaryKeys[0];
59
- const data = { [coll.property.name]: coll.getIdentifiers(pk) };
60
- await this.nativeUpdate(coll.owner.constructor.name, (0, wrap_1.helper)(coll.owner).getPrimaryKey(), data, options);
61
- }
56
+ /* v8 ignore next 3 */
57
+ const pk = coll.property.targetMeta.primaryKeys[0];
58
+ const data = { [coll.property.name]: coll.getIdentifiers(pk) };
59
+ await this.nativeUpdate(coll.owner.constructor.name, helper(coll.owner).getPrimaryKey(), data, options);
62
60
  }
63
61
  }
64
62
  mapResult(result, meta, populate = []) {
@@ -81,7 +79,7 @@ class DatabaseDriver {
81
79
  if (type === 'write' || this.replicas.length === 0) {
82
80
  return this.connection;
83
81
  }
84
- const rand = utils_1.Utils.randomInt(0, this.replicas.length - 1);
82
+ const rand = Utils.randomInt(0, this.replicas.length - 1);
85
83
  return this.replicas[rand];
86
84
  }
87
85
  async close(force) {
@@ -93,7 +91,7 @@ class DatabaseDriver {
93
91
  }
94
92
  setMetadata(metadata) {
95
93
  this.metadata = metadata;
96
- this.comparator = new utils_1.EntityComparator(this.metadata, this.platform);
94
+ this.comparator = new EntityComparator(this.metadata, this.platform);
97
95
  this.connection.setMetadata(metadata);
98
96
  this.connection.setPlatform(this.platform);
99
97
  this.replicas.forEach(replica => {
@@ -111,7 +109,7 @@ class DatabaseDriver {
111
109
  const { first, last, before, after, overfetch } = options;
112
110
  const limit = first ?? last;
113
111
  const isLast = !first && !!last;
114
- const definition = utils_1.Cursor.getDefinition(meta, orderBy);
112
+ const definition = Cursor.getDefinition(meta, orderBy);
115
113
  const $and = [];
116
114
  // allow POJO as well, we care only about the correct key being present
117
115
  const isCursor = (val, key) => {
@@ -119,15 +117,15 @@ class DatabaseDriver {
119
117
  };
120
118
  const createCursor = (val, key, inverse = false) => {
121
119
  let def = isCursor(val, key) ? val[key] : val;
122
- if (utils_1.Utils.isPlainObject(def)) {
123
- def = utils_1.Cursor.for(meta, def, orderBy);
120
+ if (Utils.isPlainObject(def)) {
121
+ def = Cursor.for(meta, def, orderBy);
124
122
  }
125
- /* istanbul ignore next */
126
- const offsets = def ? utils_1.Cursor.decode(def) : [];
123
+ /* v8 ignore next */
124
+ const offsets = def ? Cursor.decode(def) : [];
127
125
  if (definition.length === offsets.length) {
128
126
  return this.createCursorCondition(definition, offsets, inverse, meta);
129
127
  }
130
- /* istanbul ignore next */
128
+ /* v8 ignore next */
131
129
  return {};
132
130
  };
133
131
  if (after) {
@@ -140,15 +138,15 @@ class DatabaseDriver {
140
138
  options.limit = limit + (overfetch ? 1 : 0);
141
139
  }
142
140
  const createOrderBy = (prop, direction) => {
143
- if (utils_1.Utils.isPlainObject(direction)) {
144
- const value = utils_1.Utils.keys(direction).reduce((o, key) => {
141
+ if (Utils.isPlainObject(direction)) {
142
+ const value = Utils.keys(direction).reduce((o, key) => {
145
143
  Object.assign(o, createOrderBy(key, direction[key]));
146
144
  return o;
147
145
  }, {});
148
146
  return ({ [prop]: value });
149
147
  }
150
- const desc = direction === enums_1.QueryOrderNumeric.DESC || direction.toString().toLowerCase() === 'desc';
151
- const dir = utils_1.Utils.xor(desc, isLast) ? 'desc' : 'asc';
148
+ const desc = direction === QueryOrderNumeric.DESC || direction.toString().toLowerCase() === 'desc';
149
+ const dir = Utils.xor(desc, isLast) ? 'desc' : 'asc';
152
150
  return ({ [prop]: dir });
153
151
  };
154
152
  return {
@@ -156,24 +154,23 @@ class DatabaseDriver {
156
154
  where: ($and.length > 1 ? { $and } : { ...$and[0] }),
157
155
  };
158
156
  }
159
- /* istanbul ignore next */
160
157
  createCursorCondition(definition, offsets, inverse, meta) {
161
158
  const createCondition = (prop, direction, offset, eq = false) => {
162
159
  if (offset === null) {
163
- throw errors_1.CursorError.missingValue(meta.className, prop);
160
+ throw CursorError.missingValue(meta.className, prop);
164
161
  }
165
- if (utils_1.Utils.isPlainObject(direction)) {
166
- const value = utils_1.Utils.keys(direction).reduce((o, key) => {
167
- if (utils_1.Utils.isEmpty(offset[key])) {
168
- throw errors_1.CursorError.missingValue(meta.className, `${prop}.${key}`);
162
+ if (Utils.isPlainObject(direction)) {
163
+ const value = Utils.keys(direction).reduce((o, key) => {
164
+ if (Utils.isEmpty(offset[key])) {
165
+ throw CursorError.missingValue(meta.className, `${prop}.${key}`);
169
166
  }
170
167
  Object.assign(o, createCondition(key, direction[key], offset[key], eq));
171
168
  return o;
172
169
  }, {});
173
170
  return ({ [prop]: value });
174
171
  }
175
- const desc = direction === enums_1.QueryOrderNumeric.DESC || direction.toString().toLowerCase() === 'desc';
176
- const operator = utils_1.Utils.xor(desc, inverse) ? '$lt' : '$gt';
172
+ const desc = direction === QueryOrderNumeric.DESC || direction.toString().toLowerCase() === 'desc';
173
+ const operator = Utils.xor(desc, inverse) ? '$lt' : '$gt';
177
174
  return { [prop]: { [operator + (eq ? 'e' : '')]: offset } };
178
175
  };
179
176
  const [order, ...otherOrders] = definition;
@@ -222,7 +219,7 @@ class DatabaseDriver {
222
219
  return;
223
220
  }
224
221
  if (prop.joinColumns && Array.isArray(data[k])) {
225
- const copy = utils_1.Utils.flatten(data[k]);
222
+ const copy = Utils.flatten(data[k]);
226
223
  delete data[k];
227
224
  prop.joinColumns.forEach((joinColumn, idx) => data[joinColumn] = copy[idx]);
228
225
  return;
@@ -232,49 +229,49 @@ class DatabaseDriver {
232
229
  prop.ownColumns.forEach(joinColumn => data[joinColumn] = null);
233
230
  return;
234
231
  }
235
- if (prop.customType && convertCustomTypes && !(prop.customType instanceof JsonType_1.JsonType && object) && !(0, utils_1.isRaw)(data[k])) {
232
+ if (prop.customType && convertCustomTypes && !(prop.customType instanceof JsonType && object) && !isRaw(data[k])) {
236
233
  data[k] = prop.customType.convertToDatabaseValue(data[k], this.platform, { fromQuery: true, key: k, mode: 'query-data' });
237
234
  }
238
- if (prop.hasConvertToDatabaseValueSQL && !prop.object && !(0, utils_1.isRaw)(data[k])) {
235
+ if (prop.hasConvertToDatabaseValueSQL && !prop.object && !isRaw(data[k])) {
239
236
  const quoted = this.platform.quoteValue(data[k]);
240
237
  const sql = prop.customType.convertToDatabaseValueSQL(quoted, this.platform);
241
- data[k] = (0, utils_1.raw)(sql.replace(/\?/g, '\\?'));
238
+ data[k] = raw(sql.replace(/\?/g, '\\?'));
242
239
  }
243
240
  if (prop.fieldNames) {
244
- utils_1.Utils.renameKey(data, k, prop.fieldNames[0]);
241
+ Utils.renameKey(data, k, prop.fieldNames[0]);
245
242
  }
246
243
  });
247
244
  return data;
248
245
  }
249
246
  inlineEmbeddables(meta, data, where) {
250
- /* istanbul ignore next */
247
+ /* v8 ignore next 3 */
251
248
  if (data == null) {
252
249
  return;
253
250
  }
254
- utils_1.Utils.keys(data).forEach(k => {
255
- if (utils_1.Utils.isOperator(k)) {
256
- utils_1.Utils.asArray(data[k]).forEach(payload => this.inlineEmbeddables(meta, payload, where));
251
+ Utils.keys(data).forEach(k => {
252
+ if (Utils.isOperator(k)) {
253
+ Utils.asArray(data[k]).forEach(payload => this.inlineEmbeddables(meta, payload, where));
257
254
  }
258
255
  });
259
256
  meta.props.forEach(prop => {
260
- if (prop.kind === enums_1.ReferenceKind.EMBEDDED && prop.object && !where && utils_1.Utils.isObject(data[prop.name])) {
257
+ if (prop.kind === ReferenceKind.EMBEDDED && prop.object && !where && Utils.isObject(data[prop.name])) {
261
258
  return;
262
259
  }
263
- if (prop.kind === enums_1.ReferenceKind.EMBEDDED && utils_1.Utils.isObject(data[prop.name])) {
260
+ if (prop.kind === ReferenceKind.EMBEDDED && Utils.isObject(data[prop.name])) {
264
261
  const props = prop.embeddedProps;
265
262
  let unknownProp = false;
266
263
  Object.keys(data[prop.name]).forEach(kk => {
267
264
  // explicitly allow `$exists`, `$eq` and `$ne` operators here as they can't be misused this way
268
- const operator = Object.keys(data[prop.name]).some(f => utils_1.Utils.isOperator(f) && !['$exists', '$ne', '$eq'].includes(f));
265
+ const operator = Object.keys(data[prop.name]).some(f => Utils.isOperator(f) && !['$exists', '$ne', '$eq'].includes(f));
269
266
  if (operator) {
270
- throw errors_1.ValidationError.cannotUseOperatorsInsideEmbeddables(meta.className, prop.name, data);
267
+ throw ValidationError.cannotUseOperatorsInsideEmbeddables(meta.className, prop.name, data);
271
268
  }
272
269
  if (prop.object && where) {
273
270
  const inline = (payload, sub, path) => {
274
- if (sub.kind === enums_1.ReferenceKind.EMBEDDED && utils_1.Utils.isObject(payload[sub.embedded[1]])) {
271
+ if (sub.kind === ReferenceKind.EMBEDDED && Utils.isObject(payload[sub.embedded[1]])) {
275
272
  return Object.keys(payload[sub.embedded[1]]).forEach(kkk => {
276
273
  if (!sub.embeddedProps[kkk]) {
277
- throw errors_1.ValidationError.invalidEmbeddableQuery(meta.className, kkk, sub.type);
274
+ throw ValidationError.invalidEmbeddableQuery(meta.className, kkk, sub.type);
278
275
  }
279
276
  inline(payload[sub.embedded[1]], sub.embeddedProps[kkk], [...path, sub.embedded[1]]);
280
277
  });
@@ -284,7 +281,7 @@ class DatabaseDriver {
284
281
  const parentPropName = kk.substring(0, kk.indexOf('.'));
285
282
  // we might be using some native JSON operator, e.g. with mongodb's `$geoWithin` or `$exists`
286
283
  if (props[kk]) {
287
- /* istanbul ignore next */
284
+ /* v8 ignore next */
288
285
  inline(data[prop.name], props[kk] || props[parentPropName], [prop.name]);
289
286
  }
290
287
  else if (props[parentPropName]) {
@@ -298,7 +295,7 @@ class DatabaseDriver {
298
295
  data[props[kk].name] = data[prop.name][props[kk].embedded[1]];
299
296
  }
300
297
  else {
301
- throw errors_1.ValidationError.invalidEmbeddableQuery(meta.className, kk, prop.type);
298
+ throw ValidationError.invalidEmbeddableQuery(meta.className, kk, prop.type);
302
299
  }
303
300
  });
304
301
  if (!unknownProp) {
@@ -309,14 +306,14 @@ class DatabaseDriver {
309
306
  }
310
307
  getPrimaryKeyFields(entityName) {
311
308
  const meta = this.metadata.find(entityName);
312
- return meta ? utils_1.Utils.flatten(meta.getPrimaryProps().map(pk => pk.fieldNames)) : [this.config.getNamingStrategy().referenceColumnName()];
309
+ return meta ? Utils.flatten(meta.getPrimaryProps().map(pk => pk.fieldNames)) : [this.config.getNamingStrategy().referenceColumnName()];
313
310
  }
314
311
  createReplicas(cb) {
315
312
  const replicas = this.config.get('replicas', []);
316
313
  const ret = [];
317
314
  const props = ['dbName', 'clientUrl', 'host', 'port', 'user', 'password', 'multipleStatements', 'pool', 'name', 'driverOptions'];
318
315
  for (const conf of replicas) {
319
- const replicaConfig = utils_1.Utils.copy(conf);
316
+ const replicaConfig = Utils.copy(conf);
320
317
  for (const prop of props) {
321
318
  if (conf[prop]) {
322
319
  continue;
@@ -341,7 +338,7 @@ class DatabaseDriver {
341
338
  * @inheritDoc
342
339
  */
343
340
  convertException(exception) {
344
- if (exception instanceof exceptions_1.DriverException) {
341
+ if (exception instanceof DriverException) {
345
342
  return exception;
346
343
  }
347
344
  return this.platform.getExceptionConverter().convertException(exception);
@@ -376,4 +373,3 @@ class DatabaseDriver {
376
373
  return options?.schema ?? options?.parentSchema ?? schemaName ?? this.config.getSchema();
377
374
  }
378
375
  }
379
- exports.DatabaseDriver = DatabaseDriver;
@@ -1,19 +1,19 @@
1
- import type { ConnectionType, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, QBFilterQuery, IPrimaryKey, PopulateOptions, EntityDictionary, AutoPath, ObjectQuery, FilterObject, Populate } from '../typings';
2
- import type { Connection, QueryResult, Transaction } from '../connections';
3
- import type { FlushMode, LockMode, QueryOrderMap, QueryFlag, LoadStrategy, PopulateHint, PopulatePath } from '../enums';
4
- import type { Platform } from '../platforms';
5
- import type { MetadataStorage } from '../metadata';
6
- import type { Collection } from '../entity/Collection';
7
- import type { EntityManager } from '../EntityManager';
8
- import type { DriverException } from '../exceptions';
9
- import type { Configuration } from '../utils/Configuration';
10
- import type { LoggingOptions, LogContext } from '../logging';
11
- import type { RawQueryFragment } from '../utils/RawQueryFragment';
1
+ import type { ConnectionType, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, QBFilterQuery, IPrimaryKey, PopulateOptions, EntityDictionary, AutoPath, ObjectQuery, FilterObject, Populate } from '../typings.js';
2
+ import type { Connection, QueryResult, Transaction } from '../connections/Connection.js';
3
+ import type { FlushMode, LockMode, QueryOrderMap, QueryFlag, LoadStrategy, PopulateHint, PopulatePath } from '../enums.js';
4
+ import type { Platform } from '../platforms/Platform.js';
5
+ import type { MetadataStorage } from '../metadata/MetadataStorage.js';
6
+ import type { Collection } from '../entity/Collection.js';
7
+ import type { EntityManager } from '../EntityManager.js';
8
+ import type { DriverException } from '../exceptions.js';
9
+ import type { Configuration } from '../utils/Configuration.js';
10
+ import type { LoggingOptions, LogContext } from '../logging/Logger.js';
11
+ import type { RawQueryFragment } from '../utils/RawQueryFragment.js';
12
12
  export declare const EntityManagerType: unique symbol;
13
13
  export interface IDatabaseDriver<C extends Connection = Connection> {
14
14
  [EntityManagerType]: EntityManager<this>;
15
15
  readonly config: Configuration;
16
- createEntityManager<D extends IDatabaseDriver = IDatabaseDriver>(useContext?: boolean): D[typeof EntityManagerType];
16
+ createEntityManager(useContext?: boolean): this[typeof EntityManagerType];
17
17
  connect(): Promise<C>;
18
18
  close(force?: boolean): Promise<void>;
19
19
  reconnect(): Promise<C>;
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityManagerType = void 0;
4
- exports.EntityManagerType = Symbol('EntityManagerType');
1
+ export const EntityManagerType = Symbol('EntityManagerType');
@@ -1,2 +1,2 @@
1
- export * from './IDatabaseDriver';
2
- export * from './DatabaseDriver';
1
+ export * from './IDatabaseDriver.js';
2
+ export * from './DatabaseDriver.js';
package/drivers/index.js CHANGED
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./IDatabaseDriver"), exports);
18
- __exportStar(require("./DatabaseDriver"), exports);
1
+ export * from './IDatabaseDriver.js';
2
+ export * from './DatabaseDriver.js';
@@ -1,6 +1,6 @@
1
1
  import { inspect } from 'node:util';
2
- import type { EntityDTO, EntityProperty, IPrimaryKey, Primary } from '../typings';
3
- import { Reference } from './Reference';
2
+ import type { EntityDTO, EntityProperty, IPrimaryKey, Primary } from '../typings.js';
3
+ import { Reference } from './Reference.js';
4
4
  export declare class ArrayCollection<T extends object, O extends object> {
5
5
  readonly owner: O;
6
6
  protected readonly items: Set<T>;
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ArrayCollection = void 0;
4
- const node_util_1 = require("node:util");
5
- const Reference_1 = require("./Reference");
6
- const wrap_1 = require("./wrap");
7
- const errors_1 = require("../errors");
8
- const enums_1 = require("../enums");
9
- const Utils_1 = require("../utils/Utils");
10
- class ArrayCollection {
1
+ import { inspect } from 'node:util';
2
+ import { Reference } from './Reference.js';
3
+ import { helper, wrap } from './wrap.js';
4
+ import { MetadataError, ValidationError } from '../errors.js';
5
+ import { ReferenceKind } from '../enums.js';
6
+ import { Utils } from '../utils/Utils.js';
7
+ export class ArrayCollection {
11
8
  owner;
12
9
  items = new Set();
13
10
  initialized = true;
@@ -17,7 +14,7 @@ class ArrayCollection {
17
14
  _property;
18
15
  constructor(owner, items) {
19
16
  this.owner = owner;
20
- /* istanbul ignore next */
17
+ /* v8 ignore next 5 */
21
18
  if (items) {
22
19
  let i = 0;
23
20
  this.items = new Set(items);
@@ -36,7 +33,7 @@ class ArrayCollection {
36
33
  }
37
34
  const meta = this.property.targetMeta;
38
35
  const args = meta.toJsonParams.map(() => undefined);
39
- return this.map(item => (0, wrap_1.wrap)(item).toJSON(...args));
36
+ return this.map(item => wrap(item).toJSON(...args));
40
37
  }
41
38
  toJSON() {
42
39
  return this.toArray();
@@ -48,16 +45,16 @@ class ArrayCollection {
48
45
  }
49
46
  field ??= this.property.targetMeta.serializedPrimaryKey;
50
47
  return items.map(i => {
51
- if (Utils_1.Utils.isEntity(i[field], true)) {
52
- return (0, wrap_1.wrap)(i[field], true).getPrimaryKey();
48
+ if (Utils.isEntity(i[field], true)) {
49
+ return wrap(i[field], true).getPrimaryKey();
53
50
  }
54
51
  return i[field];
55
52
  });
56
53
  }
57
54
  add(entity, ...entities) {
58
- entities = Utils_1.Utils.asArray(entity).concat(entities);
55
+ entities = Utils.asArray(entity).concat(entities);
59
56
  for (const item of entities) {
60
- const entity = Reference_1.Reference.unwrapReference(item);
57
+ const entity = Reference.unwrapReference(item);
61
58
  if (!this.contains(entity, false)) {
62
59
  this.incrementCount(1);
63
60
  this[this.items.size] = entity;
@@ -82,7 +79,7 @@ class ArrayCollection {
82
79
  this.initialized = true;
83
80
  this.snapshot = undefined;
84
81
  }
85
- if (this.compare(Utils_1.Utils.asArray(items).map(item => Reference_1.Reference.unwrapReference(item)))) {
82
+ if (this.compare(Utils.asArray(items).map(item => Reference.unwrapReference(item)))) {
86
83
  return;
87
84
  }
88
85
  this.remove(this.items);
@@ -120,13 +117,13 @@ class ArrayCollection {
120
117
  * which tells the ORM we don't want orphaned entities to exist, so we know those should be removed.
121
118
  */
122
119
  remove(entity, ...entities) {
123
- entities = Utils_1.Utils.asArray(entity).concat(entities);
120
+ entities = Utils.asArray(entity).concat(entities);
124
121
  let modified = false;
125
122
  for (const item of entities) {
126
123
  if (!item) {
127
124
  continue;
128
125
  }
129
- const entity = Reference_1.Reference.unwrapReference(item);
126
+ const entity = Reference.unwrapReference(item);
130
127
  if (this.items.delete(entity)) {
131
128
  this.incrementCount(-1);
132
129
  delete this[this.items.size]; // remove last item
@@ -164,7 +161,7 @@ class ArrayCollection {
164
161
  this.dirty = true;
165
162
  }
166
163
  contains(item, check) {
167
- const entity = Reference_1.Reference.unwrapReference(item);
164
+ const entity = Reference.unwrapReference(item);
168
165
  return this.items.has(entity);
169
166
  }
170
167
  /**
@@ -261,7 +258,7 @@ class ArrayCollection {
261
258
  return this.initialized;
262
259
  }
263
260
  for (const item of this.items) {
264
- if (!(0, wrap_1.helper)(item).__initialized) {
261
+ if (!helper(item).__initialized) {
265
262
  return false;
266
263
  }
267
264
  }
@@ -307,10 +304,10 @@ class ArrayCollection {
307
304
  */
308
305
  get property() {
309
306
  if (!this._property) {
310
- const meta = (0, wrap_1.wrap)(this.owner, true).__meta;
311
- /* istanbul ignore if */
307
+ const meta = wrap(this.owner, true).__meta;
308
+ /* v8 ignore next 3 */
312
309
  if (!meta) {
313
- throw errors_1.MetadataError.fromUnknownEntity(this.owner.constructor.name, 'Collection.property getter, maybe you just forgot to initialize the ORM?');
310
+ throw MetadataError.fromUnknownEntity(this.owner.constructor.name, 'Collection.property getter, maybe you just forgot to initialize the ORM?');
314
311
  }
315
312
  this._property = meta.relations.find(prop => this.owner[prop.name] === this);
316
313
  }
@@ -340,27 +337,27 @@ class ArrayCollection {
340
337
  propagateToOwningSide(item, method) {
341
338
  const mappedBy = this.property.mappedBy;
342
339
  const collection = item[mappedBy];
343
- if (this.property.kind === enums_1.ReferenceKind.MANY_TO_MANY) {
340
+ if (this.property.kind === ReferenceKind.MANY_TO_MANY) {
344
341
  if (this.shouldPropagateToCollection(collection, method)) {
345
342
  collection[method](this.owner);
346
343
  }
347
344
  }
348
- else if (this.property.kind === enums_1.ReferenceKind.ONE_TO_MANY && method !== 'takeSnapshot') {
345
+ else if (this.property.kind === ReferenceKind.ONE_TO_MANY && method !== 'takeSnapshot') {
349
346
  const prop2 = this.property.targetMeta.properties[mappedBy];
350
- const owner = prop2.mapToPk ? (0, wrap_1.helper)(this.owner).getPrimaryKey() : this.owner;
347
+ const owner = prop2.mapToPk ? helper(this.owner).getPrimaryKey() : this.owner;
351
348
  const value = method === 'add' ? owner : null;
352
349
  if (this.property.orphanRemoval && method === 'remove') {
353
350
  // cache the PK before we propagate, as its value might be needed when flushing
354
- (0, wrap_1.helper)(item).__pk = (0, wrap_1.helper)(item).getPrimaryKey();
351
+ helper(item).__pk = helper(item).getPrimaryKey();
355
352
  }
356
353
  if (!prop2.nullable && prop2.deleteRule !== 'cascade' && method === 'remove') {
357
354
  if (!this.property.orphanRemoval) {
358
- throw errors_1.ValidationError.cannotRemoveFromCollectionWithoutOrphanRemoval(this.owner, this.property);
355
+ throw ValidationError.cannotRemoveFromCollectionWithoutOrphanRemoval(this.owner, this.property);
359
356
  }
360
357
  return;
361
358
  }
362
359
  // skip if already propagated
363
- if (Reference_1.Reference.unwrapReference(item[mappedBy]) !== value) {
360
+ if (Reference.unwrapReference(item[mappedBy]) !== value) {
364
361
  item[mappedBy] = value;
365
362
  }
366
363
  }
@@ -384,16 +381,15 @@ class ArrayCollection {
384
381
  }
385
382
  }
386
383
  /** @ignore */
387
- [node_util_1.inspect.custom](depth = 2) {
384
+ [inspect.custom](depth = 2) {
388
385
  const object = { ...this };
389
386
  const hidden = ['items', 'owner', '_property', '_count', 'snapshot', '_populated', '_snapshot', '_lazyInitialized', '_em', 'readonly'];
390
387
  hidden.forEach(k => delete object[k]);
391
- const ret = (0, node_util_1.inspect)(object, { depth });
388
+ const ret = inspect(object, { depth });
392
389
  const name = `${this.constructor.name}<${this.property?.type ?? 'unknown'}>`;
393
390
  return ret === '[Object]' ? `[${name}]` : name + ' ' + ret;
394
391
  }
395
392
  }
396
- exports.ArrayCollection = ArrayCollection;
397
393
  Object.defineProperties(ArrayCollection.prototype, {
398
394
  __collection: { value: true, enumerable: false, writable: false },
399
395
  });