@mikro-orm/core 7.0.0-rc.3 → 7.0.1-dev.0

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 (94) hide show
  1. package/EntityManager.d.ts +2 -15
  2. package/EntityManager.js +155 -152
  3. package/MikroORM.d.ts +4 -6
  4. package/MikroORM.js +20 -20
  5. package/README.md +5 -4
  6. package/cache/FileCacheAdapter.d.ts +1 -5
  7. package/cache/FileCacheAdapter.js +22 -22
  8. package/cache/GeneratedCacheAdapter.d.ts +1 -1
  9. package/cache/GeneratedCacheAdapter.js +6 -6
  10. package/cache/MemoryCacheAdapter.d.ts +1 -2
  11. package/cache/MemoryCacheAdapter.js +8 -8
  12. package/cache/index.d.ts +1 -1
  13. package/cache/index.js +0 -1
  14. package/connections/Connection.d.ts +1 -0
  15. package/connections/Connection.js +27 -11
  16. package/drivers/DatabaseDriver.d.ts +0 -2
  17. package/drivers/DatabaseDriver.js +2 -4
  18. package/entity/Collection.d.ts +1 -9
  19. package/entity/Collection.js +95 -105
  20. package/entity/EntityFactory.d.ts +1 -8
  21. package/entity/EntityFactory.js +48 -48
  22. package/entity/EntityLoader.d.ts +1 -3
  23. package/entity/EntityLoader.js +36 -39
  24. package/entity/Reference.d.ts +1 -2
  25. package/entity/Reference.js +11 -11
  26. package/entity/WrappedEntity.d.ts +4 -2
  27. package/entity/defineEntity.d.ts +18 -73
  28. package/enums.d.ts +2 -1
  29. package/enums.js +1 -0
  30. package/errors.d.ts +11 -11
  31. package/errors.js +3 -13
  32. package/events/EventManager.d.ts +1 -4
  33. package/events/EventManager.js +25 -22
  34. package/events/index.d.ts +1 -1
  35. package/events/index.js +0 -1
  36. package/exceptions.js +8 -6
  37. package/hydration/ObjectHydrator.d.ts +1 -2
  38. package/hydration/ObjectHydrator.js +16 -16
  39. package/logging/DefaultLogger.js +3 -2
  40. package/logging/Logger.d.ts +2 -1
  41. package/logging/colors.js +1 -1
  42. package/logging/index.d.ts +1 -1
  43. package/logging/index.js +0 -1
  44. package/metadata/EntitySchema.d.ts +1 -1
  45. package/metadata/MetadataDiscovery.d.ts +1 -9
  46. package/metadata/MetadataDiscovery.js +162 -149
  47. package/metadata/MetadataStorage.d.ts +1 -5
  48. package/metadata/MetadataStorage.js +36 -36
  49. package/metadata/discover-entities.js +1 -1
  50. package/metadata/index.d.ts +1 -1
  51. package/metadata/index.js +0 -1
  52. package/naming-strategy/AbstractNamingStrategy.js +1 -1
  53. package/naming-strategy/EntityCaseNamingStrategy.js +1 -1
  54. package/naming-strategy/index.d.ts +1 -1
  55. package/naming-strategy/index.js +0 -1
  56. package/package.json +1 -1
  57. package/platforms/Platform.d.ts +23 -1
  58. package/platforms/Platform.js +57 -4
  59. package/serialization/EntitySerializer.js +1 -1
  60. package/serialization/EntityTransformer.js +4 -1
  61. package/serialization/SerializationContext.d.ts +4 -8
  62. package/serialization/SerializationContext.js +20 -15
  63. package/types/UuidType.d.ts +2 -0
  64. package/types/UuidType.js +14 -2
  65. package/types/index.d.ts +2 -1
  66. package/typings.d.ts +12 -1
  67. package/unit-of-work/ChangeSetComputer.d.ts +1 -6
  68. package/unit-of-work/ChangeSetComputer.js +21 -21
  69. package/unit-of-work/ChangeSetPersister.d.ts +1 -9
  70. package/unit-of-work/ChangeSetPersister.js +52 -52
  71. package/unit-of-work/CommitOrderCalculator.d.ts +1 -4
  72. package/unit-of-work/CommitOrderCalculator.js +13 -13
  73. package/unit-of-work/IdentityMap.d.ts +2 -5
  74. package/unit-of-work/IdentityMap.js +18 -18
  75. package/unit-of-work/UnitOfWork.d.ts +5 -19
  76. package/unit-of-work/UnitOfWork.js +182 -174
  77. package/utils/AbstractMigrator.d.ts +1 -1
  78. package/utils/AbstractMigrator.js +7 -7
  79. package/utils/Configuration.d.ts +90 -189
  80. package/utils/Configuration.js +94 -78
  81. package/utils/Cursor.d.ts +3 -3
  82. package/utils/Cursor.js +4 -4
  83. package/utils/EntityComparator.d.ts +8 -15
  84. package/utils/EntityComparator.js +49 -49
  85. package/utils/QueryHelper.d.ts +16 -1
  86. package/utils/QueryHelper.js +70 -24
  87. package/utils/RawQueryFragment.d.ts +4 -4
  88. package/utils/TransactionManager.js +1 -2
  89. package/utils/Utils.d.ts +1 -1
  90. package/utils/Utils.js +5 -4
  91. package/utils/clone.js +5 -0
  92. package/utils/fs-utils.d.ts +3 -17
  93. package/utils/fs-utils.js +1 -1
  94. package/utils/upsert-utils.js +1 -1
@@ -128,143 +128,158 @@ const DEFAULTS = {
128
128
  dynamicImportProvider: /* v8 ignore next */ (id) => import(id),
129
129
  };
130
130
  export class Configuration {
131
- options;
132
- logger;
133
- driver;
134
- platform;
135
- cache = new Map();
136
- extensions = new Map();
131
+ #options;
132
+ #logger;
133
+ #slowQueryLogger;
134
+ #driver;
135
+ #platform;
136
+ #cache = new Map();
137
+ #extensions = new Map();
137
138
  constructor(options, validate = true) {
138
139
  if (options.dynamicImportProvider) {
139
140
  globalThis.dynamicImportProvider = options.dynamicImportProvider;
140
141
  }
141
- this.options = Utils.mergeConfig({}, DEFAULTS, options);
142
+ this.#options = Utils.mergeConfig({}, DEFAULTS, options);
142
143
  if (validate) {
143
144
  this.validateOptions();
144
145
  }
145
- this.options.loggerFactory ??= DefaultLogger.create;
146
- this.logger = this.options.loggerFactory({
147
- debugMode: this.options.debug,
148
- ignoreDeprecations: this.options.ignoreDeprecations,
149
- usesReplicas: (this.options.replicas?.length ?? 0) > 0,
150
- highlighter: this.options.highlighter,
151
- writer: this.options.logger,
146
+ this.#options.loggerFactory ??= DefaultLogger.create;
147
+ this.#logger = this.#options.loggerFactory({
148
+ debugMode: this.#options.debug,
149
+ ignoreDeprecations: this.#options.ignoreDeprecations,
150
+ usesReplicas: (this.#options.replicas?.length ?? 0) > 0,
151
+ highlighter: this.#options.highlighter,
152
+ writer: this.#options.logger,
152
153
  });
153
- const cf = this.options.compiledFunctions;
154
+ const cf = this.#options.compiledFunctions;
154
155
  if (cf && cf.__version !== Utils.getORMVersion()) {
155
- this.logger.warn('discovery', `Compiled functions were generated with MikroORM v${cf.__version ?? 'unknown'}, but the current version is v${Utils.getORMVersion()}. Please regenerate with \`npx mikro-orm compile\`.`);
156
+ this.#logger.warn('discovery', `Compiled functions were generated with MikroORM v${cf.__version ?? 'unknown'}, but the current version is v${Utils.getORMVersion()}. Please regenerate with \`npx mikro-orm compile\`.`);
156
157
  }
157
- if (this.options.driver) {
158
- this.driver = new this.options.driver(this);
159
- this.platform = this.driver.getPlatform();
160
- this.platform.setConfig(this);
158
+ if (this.#options.driver) {
159
+ this.#driver = new this.#options.driver(this);
160
+ this.#platform = this.#driver.getPlatform();
161
+ this.#platform.setConfig(this);
161
162
  this.init(validate);
162
163
  }
163
164
  }
164
165
  getPlatform() {
165
- return this.platform;
166
+ return this.#platform;
166
167
  }
167
168
  /**
168
169
  * Gets specific configuration option. Falls back to specified `defaultValue` if provided.
169
170
  */
170
171
  get(key, defaultValue) {
171
- if (typeof this.options[key] !== 'undefined') {
172
- return this.options[key];
172
+ if (typeof this.#options[key] !== 'undefined') {
173
+ return this.#options[key];
173
174
  }
174
175
  return defaultValue;
175
176
  }
176
177
  getAll() {
177
- return this.options;
178
+ return this.#options;
178
179
  }
179
180
  /**
180
181
  * Overrides specified configuration value.
181
182
  */
182
183
  set(key, value) {
183
- this.options[key] = value;
184
+ this.#options[key] = value;
184
185
  this.sync();
185
186
  }
186
187
  /**
187
188
  * Resets the configuration to its default value
188
189
  */
189
190
  reset(key) {
190
- this.options[key] = DEFAULTS[key];
191
+ this.#options[key] = DEFAULTS[key];
191
192
  }
192
193
  /**
193
194
  * Gets Logger instance.
194
195
  */
195
196
  getLogger() {
196
- return this.logger;
197
+ return this.#logger;
198
+ }
199
+ /**
200
+ * Gets the logger instance for slow queries.
201
+ * Falls back to the main logger if no custom slow query logger factory is configured.
202
+ */
203
+ getSlowQueryLogger() {
204
+ this.#slowQueryLogger ??=
205
+ this.#options.slowQueryLoggerFactory?.({
206
+ debugMode: this.#options.debug,
207
+ writer: this.#options.logger,
208
+ highlighter: this.#options.highlighter,
209
+ usesReplicas: (this.#options.replicas?.length ?? 0) > 0,
210
+ }) ?? this.#logger;
211
+ return this.#slowQueryLogger;
197
212
  }
198
213
  getDataloaderType() {
199
- if (typeof this.options.dataloader === 'boolean') {
200
- return this.options.dataloader ? DataloaderType.ALL : DataloaderType.NONE;
214
+ if (typeof this.#options.dataloader === 'boolean') {
215
+ return this.#options.dataloader ? DataloaderType.ALL : DataloaderType.NONE;
201
216
  }
202
- return this.options.dataloader;
217
+ return this.#options.dataloader;
203
218
  }
204
219
  getSchema(skipDefaultSchema = false) {
205
- if (skipDefaultSchema && this.options.schema === this.platform.getDefaultSchemaName()) {
220
+ if (skipDefaultSchema && this.#options.schema === this.#platform.getDefaultSchemaName()) {
206
221
  return undefined;
207
222
  }
208
- return this.options.schema;
223
+ return this.#options.schema;
209
224
  }
210
225
  /**
211
226
  * Gets current database driver instance.
212
227
  */
213
228
  getDriver() {
214
- return this.driver;
229
+ return this.#driver;
215
230
  }
216
231
  registerExtension(name, cb) {
217
- this.extensions.set(name, cb);
232
+ this.#extensions.set(name, cb);
218
233
  }
219
234
  getExtension(name) {
220
- if (this.cache.has(name)) {
221
- return this.cache.get(name);
235
+ if (this.#cache.has(name)) {
236
+ return this.#cache.get(name);
222
237
  }
223
- const ext = this.extensions.get(name);
238
+ const ext = this.#extensions.get(name);
224
239
  /* v8 ignore next */
225
240
  if (!ext) {
226
241
  return undefined;
227
242
  }
228
- this.cache.set(name, ext());
229
- return this.cache.get(name);
243
+ this.#cache.set(name, ext());
244
+ return this.#cache.get(name);
230
245
  }
231
246
  /**
232
247
  * Gets instance of NamingStrategy. (cached)
233
248
  */
234
249
  getNamingStrategy() {
235
- return this.getCachedService(this.options.namingStrategy || this.platform.getNamingStrategy());
250
+ return this.getCachedService(this.#options.namingStrategy || this.#platform.getNamingStrategy());
236
251
  }
237
252
  /**
238
253
  * Gets instance of Hydrator. (cached)
239
254
  */
240
255
  getHydrator(metadata) {
241
- return this.getCachedService(this.options.hydrator, metadata, this.platform, this);
256
+ return this.getCachedService(this.#options.hydrator, metadata, this.#platform, this);
242
257
  }
243
258
  /**
244
259
  * Gets instance of Comparator. (cached)
245
260
  */
246
261
  getComparator(metadata) {
247
- return this.getCachedService(EntityComparator, metadata, this.platform, this);
262
+ return this.getCachedService(EntityComparator, metadata, this.#platform, this);
248
263
  }
249
264
  /**
250
265
  * Gets instance of MetadataProvider. (cached)
251
266
  */
252
267
  getMetadataProvider() {
253
- return this.getCachedService(this.options.metadataProvider, this);
268
+ return this.getCachedService(this.#options.metadataProvider, this);
254
269
  }
255
270
  /**
256
271
  * Gets instance of metadata CacheAdapter. (cached)
257
272
  */
258
273
  getMetadataCacheAdapter() {
259
- return this.getCachedService(this.options.metadataCache.adapter, this.options.metadataCache.options, this.options.baseDir, this.options.metadataCache.pretty);
274
+ return this.getCachedService(this.#options.metadataCache.adapter, this.#options.metadataCache.options, this.#options.baseDir, this.#options.metadataCache.pretty);
260
275
  }
261
276
  /**
262
277
  * Gets instance of CacheAdapter for result cache. (cached)
263
278
  */
264
279
  getResultCacheAdapter() {
265
- return this.getCachedService(this.options.resultCache.adapter, {
266
- expiration: this.options.resultCache.expiration,
267
- ...this.options.resultCache.options,
280
+ return this.getCachedService(this.#options.resultCache.adapter, {
281
+ expiration: this.#options.resultCache.expiration,
282
+ ...this.#options.resultCache.options,
268
283
  });
269
284
  }
270
285
  /**
@@ -274,86 +289,87 @@ export class Configuration {
274
289
  if (repository) {
275
290
  return repository();
276
291
  }
277
- if (this.options.entityRepository) {
278
- return this.options.entityRepository;
292
+ if (this.#options.entityRepository) {
293
+ return this.#options.entityRepository;
279
294
  }
280
- return this.platform.getRepositoryClass();
295
+ return this.#platform.getRepositoryClass();
281
296
  }
282
297
  /**
283
298
  * Creates instance of given service and caches it.
284
299
  */
285
300
  getCachedService(cls, ...args) {
286
- if (!this.cache.has(cls.name)) {
287
- this.cache.set(cls.name, new cls(...args));
301
+ if (!this.#cache.has(cls.name)) {
302
+ this.#cache.set(cls.name, new cls(...args));
288
303
  }
289
- return this.cache.get(cls.name);
304
+ return this.#cache.get(cls.name);
290
305
  }
291
306
  resetServiceCache() {
292
- this.cache.clear();
307
+ this.#cache.clear();
293
308
  }
294
309
  init(validate) {
295
310
  const useCache = this.getMetadataProvider().useCache();
296
- const metadataCache = this.options.metadataCache;
311
+ const metadataCache = this.#options.metadataCache;
297
312
  if (!useCache) {
298
313
  metadataCache.adapter = NullCacheAdapter;
299
314
  }
300
315
  metadataCache.enabled ??= useCache;
301
- this.options.clientUrl ??= this.platform.getDefaultClientUrl();
302
- this.options.implicitTransactions ??= this.platform.usesImplicitTransactions();
316
+ this.#options.clientUrl ??= this.#platform.getDefaultClientUrl();
317
+ this.#options.implicitTransactions ??= this.#platform.usesImplicitTransactions();
303
318
  if (validate && metadataCache.enabled && !metadataCache.adapter) {
304
319
  throw new Error('No metadata cache adapter specified, please fill in `metadataCache.adapter` option or use the async MikroORM.init() method which can autoload it.');
305
320
  }
306
321
  try {
307
- const url = new URL(this.options.clientUrl);
322
+ const url = new URL(this.#options.clientUrl);
308
323
  if (url.pathname) {
309
- this.options.dbName = this.get('dbName', decodeURIComponent(url.pathname).substring(1));
324
+ this.#options.dbName = this.get('dbName', decodeURIComponent(url.pathname).substring(1));
310
325
  }
311
326
  }
312
327
  catch {
313
- const url = this.options.clientUrl.match(/:\/\/.*\/([^?]+)/);
328
+ const url = /:\/\/.*\/([^?]+)/.exec(this.#options.clientUrl);
314
329
  if (url) {
315
- this.options.dbName = this.get('dbName', decodeURIComponent(url[1]));
330
+ this.#options.dbName = this.get('dbName', decodeURIComponent(url[1]));
316
331
  }
317
332
  }
318
- if (validate && !this.options.dbName && this.options.clientUrl) {
333
+ if (validate && !this.#options.dbName && this.#options.clientUrl) {
319
334
  throw new Error("No database specified, `clientUrl` option provided but it's missing the pathname.");
320
335
  }
321
- this.options.schema ??= this.platform.getDefaultSchemaName();
322
- this.options.charset ??= this.platform.getDefaultCharset();
323
- Object.keys(this.options.filters).forEach(key => {
324
- this.options.filters[key].default ??= true;
336
+ this.#options.schema ??= this.#platform.getDefaultSchemaName();
337
+ this.#options.charset ??= this.#platform.getDefaultCharset();
338
+ Object.keys(this.#options.filters).forEach(key => {
339
+ this.#options.filters[key].default ??= true;
325
340
  });
326
- if (!this.options.filtersOnRelations) {
327
- this.options.autoJoinRefsForFilters ??= false;
341
+ if (!this.#options.filtersOnRelations) {
342
+ this.#options.autoJoinRefsForFilters ??= false;
328
343
  }
329
- this.options.subscribers = [...this.options.subscribers].map(subscriber => {
344
+ this.#options.subscribers = [...this.#options.subscribers].map(subscriber => {
330
345
  return subscriber.constructor.name === 'Function' ? new subscriber() : subscriber;
331
346
  });
332
347
  this.sync();
333
348
  if (!colors.enabled()) {
334
- this.options.highlighter = new NullHighlighter();
349
+ this.#options.highlighter = new NullHighlighter();
335
350
  }
336
351
  }
337
352
  sync() {
338
- setEnv('MIKRO_ORM_COLORS', this.options.colors);
339
- this.logger.setDebugMode(this.options.debug);
353
+ setEnv('MIKRO_ORM_COLORS', this.#options.colors);
354
+ this.#logger.setDebugMode(this.#options.debug);
355
+ this.#slowQueryLogger = undefined;
340
356
  }
341
357
  validateOptions() {
342
358
  /* v8 ignore next */
343
- if ('type' in this.options) {
359
+ if ('type' in this.#options) {
344
360
  throw new Error("The `type` option has been removed in v6, please fill in the `driver` option instead or use `defineConfig` helper (to define your ORM config) or `MikroORM` class (to call the `init` method) exported from the driver package (e.g. `import { defineConfig } from '@mikro-orm/mysql'; export default defineConfig({ ... })`).");
345
361
  }
346
- if (!this.options.driver) {
362
+ if (!this.#options.driver) {
347
363
  throw new Error("No driver specified, please fill in the `driver` option or use `defineConfig` helper (to define your ORM config) or `MikroORM` class (to call the `init` method) exported from the driver package (e.g. `import { defineConfig } from '@mikro-orm/mysql'; export defineConfig({ ... })`).");
348
364
  }
349
- if (!this.options.dbName && !this.options.clientUrl) {
365
+ if (!this.#options.dbName && !this.#options.clientUrl) {
350
366
  throw new Error('No database specified, please fill in `dbName` or `clientUrl` option');
351
367
  }
352
- if (this.options.entities.length === 0 && this.options.discovery.warnWhenNoEntities) {
368
+ if (this.#options.entities.length === 0 && this.#options.discovery.warnWhenNoEntities) {
353
369
  throw new Error('No entities found, please use `entities` option');
354
370
  }
355
- if (typeof this.options.driverOptions === 'function' &&
356
- this.options.driverOptions.constructor.name === 'AsyncFunction') {
371
+ if (typeof this.#options.driverOptions === 'function' &&
372
+ this.#options.driverOptions.constructor.name === 'AsyncFunction') {
357
373
  throw new Error('`driverOptions` callback cannot be async');
358
374
  }
359
375
  }
package/utils/Cursor.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { EntityMetadata, FilterObject, Loaded } from '../typings.js';
1
+ import type { EntityKey, EntityMetadata, FilterObject, Loaded } from '../typings.js';
2
2
  import type { FindByCursorOptions, OrderDefinition } from '../drivers/IDatabaseDriver.js';
3
3
  import { type QueryOrder } from '../enums.js';
4
4
  /**
@@ -49,11 +49,11 @@ import { type QueryOrder } from '../enums.js';
49
49
  * ```
50
50
  */
51
51
  export declare class Cursor<Entity extends object, Hint extends string = never, Fields extends string = '*', Excludes extends string = never, IncludeCount extends boolean = true> {
52
+ #private;
52
53
  readonly items: Loaded<Entity, Hint, Fields, Excludes>[];
53
54
  readonly totalCount: IncludeCount extends true ? number : undefined;
54
55
  readonly hasPrevPage: boolean;
55
56
  readonly hasNextPage: boolean;
56
- private readonly definition;
57
57
  constructor(items: Loaded<Entity, Hint, Fields, Excludes>[], totalCount: IncludeCount extends true ? number : undefined, options: FindByCursorOptions<Entity, Hint, Fields, Excludes, IncludeCount>, meta: EntityMetadata<Entity>);
58
58
  get startCursor(): string | null;
59
59
  get endCursor(): string | null;
@@ -69,5 +69,5 @@ export declare class Cursor<Entity extends object, Hint extends string = never,
69
69
  static for<Entity extends object>(meta: EntityMetadata<Entity>, entity: FilterObject<Entity>, orderBy: OrderDefinition<Entity>): string;
70
70
  static encode(value: unknown[]): string;
71
71
  static decode(value: string): unknown[];
72
- static getDefinition<Entity extends object>(meta: EntityMetadata<Entity>, orderBy: OrderDefinition<Entity>): [never, QueryOrder][];
72
+ static getDefinition<Entity extends object>(meta: EntityMetadata<Entity>, orderBy: OrderDefinition<Entity>): [EntityKey, QueryOrder][];
73
73
  }
package/utils/Cursor.js CHANGED
@@ -57,7 +57,7 @@ export class Cursor {
57
57
  totalCount;
58
58
  hasPrevPage;
59
59
  hasNextPage;
60
- definition;
60
+ #definition;
61
61
  constructor(items, totalCount, options, meta) {
62
62
  this.items = items;
63
63
  this.totalCount = totalCount;
@@ -75,7 +75,7 @@ export class Cursor {
75
75
  items.pop();
76
76
  }
77
77
  }
78
- this.definition = Cursor.getDefinition(meta, orderBy);
78
+ this.#definition = Cursor.getDefinition(meta, orderBy);
79
79
  }
80
80
  get startCursor() {
81
81
  if (this.items.length === 0) {
@@ -122,7 +122,7 @@ export class Cursor {
122
122
  }
123
123
  return value;
124
124
  };
125
- const value = this.definition.map(([key, direction]) => processEntity(entity, key, direction));
125
+ const value = this.#definition.map(([key, direction]) => processEntity(entity, key, direction));
126
126
  return Cursor.encode(value);
127
127
  }
128
128
  *[Symbol.iterator]() {
@@ -151,7 +151,7 @@ export class Cursor {
151
151
  }
152
152
  static decode(value) {
153
153
  return JSON.parse(Buffer.from(value, 'base64url').toString('utf8')).map((value) => {
154
- if (typeof value === 'string' && value.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}/)) {
154
+ if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}/.exec(value)) {
155
155
  return new Date(value);
156
156
  }
157
157
  return value;
@@ -1,4 +1,4 @@
1
- import type { EntityData, EntityDictionary, EntityMetadata, EntityName, EntityProperty, IMetadataStorage } from '../typings.js';
1
+ import type { EntityData, EntityDictionary, EntityMetadata, EntityName, EntityProperty, IMetadataStorage, Primary } from '../typings.js';
2
2
  import type { Platform } from '../platforms/Platform.js';
3
3
  import type { Configuration } from './Configuration.js';
4
4
  type Comparator<T> = (a: T, b: T, options?: {
@@ -6,19 +6,12 @@ type Comparator<T> = (a: T, b: T, options?: {
6
6
  }) => EntityData<T>;
7
7
  type ResultMapper<T> = (result: EntityData<T>) => EntityData<T> | null;
8
8
  type SnapshotGenerator<T> = (entity: T) => EntityData<T>;
9
+ type PkGetter<T> = (entity: T) => Primary<T>;
10
+ type PkSerializer<T> = (entity: T) => string;
9
11
  type CompositeKeyPart = string | CompositeKeyPart[];
10
12
  export declare class EntityComparator {
11
- private readonly metadata;
12
- private readonly platform;
13
- private readonly config?;
14
- private readonly comparators;
15
- private readonly mappers;
16
- private readonly snapshotGenerators;
17
- private readonly pkGetters;
18
- private readonly pkGettersConverted;
19
- private readonly pkSerializers;
20
- private tmpIndex;
21
- constructor(metadata: IMetadataStorage, platform: Platform, config?: Configuration | undefined);
13
+ #private;
14
+ constructor(metadata: IMetadataStorage, platform: Platform, config?: Configuration);
22
15
  /**
23
16
  * Computes difference between two entities.
24
17
  */
@@ -38,15 +31,15 @@ export declare class EntityComparator {
38
31
  /**
39
32
  * @internal Highly performance-sensitive method.
40
33
  */
41
- getPkGetter<T>(meta: EntityMetadata<T>): any;
34
+ getPkGetter<T>(meta: EntityMetadata<T>): PkGetter<T>;
42
35
  /**
43
36
  * @internal Highly performance-sensitive method.
44
37
  */
45
- getPkGetterConverted<T>(meta: EntityMetadata<T>): any;
38
+ getPkGetterConverted<T>(meta: EntityMetadata<T>): PkGetter<T>;
46
39
  /**
47
40
  * @internal Highly performance-sensitive method.
48
41
  */
49
- getPkSerializer<T>(meta: EntityMetadata<T>): any;
42
+ getPkSerializer<T>(meta: EntityMetadata<T>): PkSerializer<T>;
50
43
  /**
51
44
  * @internal Highly performance-sensitive method.
52
45
  */