@mikro-orm/core 7.0.0-dev.321 → 7.0.0-dev.323
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.
- package/EntityManager.d.ts +2 -15
- package/EntityManager.js +155 -152
- package/MikroORM.d.ts +1 -3
- package/MikroORM.js +20 -20
- package/cache/FileCacheAdapter.d.ts +1 -5
- package/cache/FileCacheAdapter.js +22 -22
- package/cache/GeneratedCacheAdapter.d.ts +1 -1
- package/cache/GeneratedCacheAdapter.js +6 -6
- package/cache/MemoryCacheAdapter.d.ts +1 -2
- package/cache/MemoryCacheAdapter.js +8 -8
- package/entity/Collection.d.ts +2 -10
- package/entity/Collection.js +95 -105
- package/entity/EntityFactory.d.ts +1 -8
- package/entity/EntityFactory.js +48 -48
- package/entity/EntityLoader.d.ts +1 -3
- package/entity/EntityLoader.js +33 -34
- package/entity/Reference.d.ts +1 -2
- package/entity/Reference.js +11 -11
- package/events/EventManager.d.ts +1 -4
- package/events/EventManager.js +21 -21
- package/hydration/ObjectHydrator.d.ts +1 -2
- package/hydration/ObjectHydrator.js +11 -11
- package/metadata/MetadataDiscovery.d.ts +1 -9
- package/metadata/MetadataDiscovery.js +147 -144
- package/metadata/MetadataStorage.d.ts +1 -5
- package/metadata/MetadataStorage.js +36 -36
- package/naming-strategy/EntityCaseNamingStrategy.js +1 -1
- package/package.json +1 -1
- package/serialization/EntitySerializer.js +1 -1
- package/serialization/EntityTransformer.js +4 -1
- package/serialization/SerializationContext.d.ts +3 -7
- package/serialization/SerializationContext.js +20 -15
- package/unit-of-work/ChangeSetComputer.d.ts +1 -6
- package/unit-of-work/ChangeSetComputer.js +21 -21
- package/unit-of-work/ChangeSetPersister.d.ts +1 -9
- package/unit-of-work/ChangeSetPersister.js +51 -51
- package/unit-of-work/CommitOrderCalculator.d.ts +1 -4
- package/unit-of-work/CommitOrderCalculator.js +13 -13
- package/unit-of-work/IdentityMap.d.ts +2 -5
- package/unit-of-work/IdentityMap.js +18 -18
- package/unit-of-work/UnitOfWork.d.ts +5 -19
- package/unit-of-work/UnitOfWork.js +181 -173
- package/utils/AbstractMigrator.d.ts +1 -1
- package/utils/AbstractMigrator.js +6 -6
- package/utils/Configuration.d.ts +1 -6
- package/utils/Configuration.js +78 -78
- package/utils/Cursor.d.ts +1 -1
- package/utils/Cursor.js +3 -3
- package/utils/EntityComparator.d.ts +2 -11
- package/utils/EntityComparator.js +44 -44
- package/utils/TransactionManager.js +1 -2
- package/utils/Utils.js +1 -1
- package/utils/clone.js +1 -1
|
@@ -15,6 +15,7 @@ type MigrateOptions = {
|
|
|
15
15
|
transaction?: Transaction;
|
|
16
16
|
};
|
|
17
17
|
export declare abstract class AbstractMigrator<D extends IDatabaseDriver> implements IMigrator {
|
|
18
|
+
#private;
|
|
18
19
|
protected readonly em: D[typeof EntityManagerType];
|
|
19
20
|
protected runner: IMigrationRunner;
|
|
20
21
|
protected storage: IMigratorStorage;
|
|
@@ -24,7 +25,6 @@ export declare abstract class AbstractMigrator<D extends IDatabaseDriver> implem
|
|
|
24
25
|
protected readonly options: MigrationsOptions;
|
|
25
26
|
protected absolutePath: string;
|
|
26
27
|
protected initialized: boolean;
|
|
27
|
-
private readonly listeners;
|
|
28
28
|
constructor(em: D[typeof EntityManagerType]);
|
|
29
29
|
protected abstract createRunner(): IMigrationRunner;
|
|
30
30
|
protected abstract createStorage(): IMigratorStorage;
|
|
@@ -9,7 +9,7 @@ export class AbstractMigrator {
|
|
|
9
9
|
options;
|
|
10
10
|
absolutePath;
|
|
11
11
|
initialized = false;
|
|
12
|
-
listeners = new Map();
|
|
12
|
+
#listeners = new Map();
|
|
13
13
|
constructor(em) {
|
|
14
14
|
this.em = em;
|
|
15
15
|
this.driver = this.em.getDriver();
|
|
@@ -22,17 +22,17 @@ export class AbstractMigrator {
|
|
|
22
22
|
* @inheritDoc
|
|
23
23
|
*/
|
|
24
24
|
on(eventName, listener) {
|
|
25
|
-
if (!this
|
|
26
|
-
this
|
|
25
|
+
if (!this.#listeners.has(eventName)) {
|
|
26
|
+
this.#listeners.set(eventName, new Set());
|
|
27
27
|
}
|
|
28
|
-
this
|
|
28
|
+
this.#listeners.get(eventName).add(listener);
|
|
29
29
|
return this;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* @inheritDoc
|
|
33
33
|
*/
|
|
34
34
|
off(eventName, listener) {
|
|
35
|
-
this
|
|
35
|
+
this.#listeners.get(eventName)?.delete(listener);
|
|
36
36
|
return this;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -148,7 +148,7 @@ export class AbstractMigrator {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
async emit(event, data) {
|
|
151
|
-
for (const listener of this
|
|
151
|
+
for (const listener of this.#listeners.get(event) ?? []) {
|
|
152
152
|
await listener(data);
|
|
153
153
|
}
|
|
154
154
|
}
|
package/utils/Configuration.d.ts
CHANGED
|
@@ -134,12 +134,7 @@ declare const DEFAULTS: {
|
|
|
134
134
|
readonly dynamicImportProvider: (id: string) => Promise<any>;
|
|
135
135
|
};
|
|
136
136
|
export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>> {
|
|
137
|
-
private
|
|
138
|
-
private readonly logger;
|
|
139
|
-
private readonly driver;
|
|
140
|
-
private readonly platform;
|
|
141
|
-
private readonly cache;
|
|
142
|
-
private readonly extensions;
|
|
137
|
+
#private;
|
|
143
138
|
constructor(options: Options, validate?: boolean);
|
|
144
139
|
getPlatform(): ReturnType<D['getPlatform']>;
|
|
145
140
|
/**
|
package/utils/Configuration.js
CHANGED
|
@@ -128,143 +128,143 @@ 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
|
+
#driver;
|
|
134
|
+
#platform;
|
|
135
|
+
#cache = new Map();
|
|
136
|
+
#extensions = new Map();
|
|
137
137
|
constructor(options, validate = true) {
|
|
138
138
|
if (options.dynamicImportProvider) {
|
|
139
139
|
globalThis.dynamicImportProvider = options.dynamicImportProvider;
|
|
140
140
|
}
|
|
141
|
-
this
|
|
141
|
+
this.#options = Utils.mergeConfig({}, DEFAULTS, options);
|
|
142
142
|
if (validate) {
|
|
143
143
|
this.validateOptions();
|
|
144
144
|
}
|
|
145
|
-
this
|
|
146
|
-
this
|
|
147
|
-
debugMode: this
|
|
148
|
-
ignoreDeprecations: this
|
|
149
|
-
usesReplicas: (this
|
|
150
|
-
highlighter: this
|
|
151
|
-
writer: this
|
|
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,
|
|
152
152
|
});
|
|
153
|
-
const cf = this
|
|
153
|
+
const cf = this.#options.compiledFunctions;
|
|
154
154
|
if (cf && cf.__version !== Utils.getORMVersion()) {
|
|
155
|
-
this
|
|
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
156
|
}
|
|
157
|
-
if (this
|
|
158
|
-
this
|
|
159
|
-
this
|
|
160
|
-
this
|
|
157
|
+
if (this.#options.driver) {
|
|
158
|
+
this.#driver = new this.#options.driver(this);
|
|
159
|
+
this.#platform = this.#driver.getPlatform();
|
|
160
|
+
this.#platform.setConfig(this);
|
|
161
161
|
this.init(validate);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
getPlatform() {
|
|
165
|
-
return this
|
|
165
|
+
return this.#platform;
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* Gets specific configuration option. Falls back to specified `defaultValue` if provided.
|
|
169
169
|
*/
|
|
170
170
|
get(key, defaultValue) {
|
|
171
|
-
if (typeof this
|
|
172
|
-
return this
|
|
171
|
+
if (typeof this.#options[key] !== 'undefined') {
|
|
172
|
+
return this.#options[key];
|
|
173
173
|
}
|
|
174
174
|
return defaultValue;
|
|
175
175
|
}
|
|
176
176
|
getAll() {
|
|
177
|
-
return this
|
|
177
|
+
return this.#options;
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
180
|
* Overrides specified configuration value.
|
|
181
181
|
*/
|
|
182
182
|
set(key, value) {
|
|
183
|
-
this
|
|
183
|
+
this.#options[key] = value;
|
|
184
184
|
this.sync();
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
187
|
* Resets the configuration to its default value
|
|
188
188
|
*/
|
|
189
189
|
reset(key) {
|
|
190
|
-
this
|
|
190
|
+
this.#options[key] = DEFAULTS[key];
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
193
|
* Gets Logger instance.
|
|
194
194
|
*/
|
|
195
195
|
getLogger() {
|
|
196
|
-
return this
|
|
196
|
+
return this.#logger;
|
|
197
197
|
}
|
|
198
198
|
getDataloaderType() {
|
|
199
|
-
if (typeof this
|
|
200
|
-
return this
|
|
199
|
+
if (typeof this.#options.dataloader === 'boolean') {
|
|
200
|
+
return this.#options.dataloader ? DataloaderType.ALL : DataloaderType.NONE;
|
|
201
201
|
}
|
|
202
|
-
return this
|
|
202
|
+
return this.#options.dataloader;
|
|
203
203
|
}
|
|
204
204
|
getSchema(skipDefaultSchema = false) {
|
|
205
|
-
if (skipDefaultSchema && this
|
|
205
|
+
if (skipDefaultSchema && this.#options.schema === this.#platform.getDefaultSchemaName()) {
|
|
206
206
|
return undefined;
|
|
207
207
|
}
|
|
208
|
-
return this
|
|
208
|
+
return this.#options.schema;
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
211
|
* Gets current database driver instance.
|
|
212
212
|
*/
|
|
213
213
|
getDriver() {
|
|
214
|
-
return this
|
|
214
|
+
return this.#driver;
|
|
215
215
|
}
|
|
216
216
|
registerExtension(name, cb) {
|
|
217
|
-
this
|
|
217
|
+
this.#extensions.set(name, cb);
|
|
218
218
|
}
|
|
219
219
|
getExtension(name) {
|
|
220
|
-
if (this
|
|
221
|
-
return this
|
|
220
|
+
if (this.#cache.has(name)) {
|
|
221
|
+
return this.#cache.get(name);
|
|
222
222
|
}
|
|
223
|
-
const ext = this
|
|
223
|
+
const ext = this.#extensions.get(name);
|
|
224
224
|
/* v8 ignore next */
|
|
225
225
|
if (!ext) {
|
|
226
226
|
return undefined;
|
|
227
227
|
}
|
|
228
|
-
this
|
|
229
|
-
return this
|
|
228
|
+
this.#cache.set(name, ext());
|
|
229
|
+
return this.#cache.get(name);
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
232
|
* Gets instance of NamingStrategy. (cached)
|
|
233
233
|
*/
|
|
234
234
|
getNamingStrategy() {
|
|
235
|
-
return this.getCachedService(this
|
|
235
|
+
return this.getCachedService(this.#options.namingStrategy || this.#platform.getNamingStrategy());
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Gets instance of Hydrator. (cached)
|
|
239
239
|
*/
|
|
240
240
|
getHydrator(metadata) {
|
|
241
|
-
return this.getCachedService(this
|
|
241
|
+
return this.getCachedService(this.#options.hydrator, metadata, this.#platform, this);
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* Gets instance of Comparator. (cached)
|
|
245
245
|
*/
|
|
246
246
|
getComparator(metadata) {
|
|
247
|
-
return this.getCachedService(EntityComparator, metadata, this
|
|
247
|
+
return this.getCachedService(EntityComparator, metadata, this.#platform, this);
|
|
248
248
|
}
|
|
249
249
|
/**
|
|
250
250
|
* Gets instance of MetadataProvider. (cached)
|
|
251
251
|
*/
|
|
252
252
|
getMetadataProvider() {
|
|
253
|
-
return this.getCachedService(this
|
|
253
|
+
return this.getCachedService(this.#options.metadataProvider, this);
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
256
|
* Gets instance of metadata CacheAdapter. (cached)
|
|
257
257
|
*/
|
|
258
258
|
getMetadataCacheAdapter() {
|
|
259
|
-
return this.getCachedService(this
|
|
259
|
+
return this.getCachedService(this.#options.metadataCache.adapter, this.#options.metadataCache.options, this.#options.baseDir, this.#options.metadataCache.pretty);
|
|
260
260
|
}
|
|
261
261
|
/**
|
|
262
262
|
* Gets instance of CacheAdapter for result cache. (cached)
|
|
263
263
|
*/
|
|
264
264
|
getResultCacheAdapter() {
|
|
265
|
-
return this.getCachedService(this
|
|
266
|
-
expiration: this
|
|
267
|
-
...this
|
|
265
|
+
return this.getCachedService(this.#options.resultCache.adapter, {
|
|
266
|
+
expiration: this.#options.resultCache.expiration,
|
|
267
|
+
...this.#options.resultCache.options,
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
/**
|
|
@@ -274,86 +274,86 @@ export class Configuration {
|
|
|
274
274
|
if (repository) {
|
|
275
275
|
return repository();
|
|
276
276
|
}
|
|
277
|
-
if (this
|
|
278
|
-
return this
|
|
277
|
+
if (this.#options.entityRepository) {
|
|
278
|
+
return this.#options.entityRepository;
|
|
279
279
|
}
|
|
280
|
-
return this
|
|
280
|
+
return this.#platform.getRepositoryClass();
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
283
|
* Creates instance of given service and caches it.
|
|
284
284
|
*/
|
|
285
285
|
getCachedService(cls, ...args) {
|
|
286
|
-
if (!this
|
|
287
|
-
this
|
|
286
|
+
if (!this.#cache.has(cls.name)) {
|
|
287
|
+
this.#cache.set(cls.name, new cls(...args));
|
|
288
288
|
}
|
|
289
|
-
return this
|
|
289
|
+
return this.#cache.get(cls.name);
|
|
290
290
|
}
|
|
291
291
|
resetServiceCache() {
|
|
292
|
-
this
|
|
292
|
+
this.#cache.clear();
|
|
293
293
|
}
|
|
294
294
|
init(validate) {
|
|
295
295
|
const useCache = this.getMetadataProvider().useCache();
|
|
296
|
-
const metadataCache = this
|
|
296
|
+
const metadataCache = this.#options.metadataCache;
|
|
297
297
|
if (!useCache) {
|
|
298
298
|
metadataCache.adapter = NullCacheAdapter;
|
|
299
299
|
}
|
|
300
300
|
metadataCache.enabled ??= useCache;
|
|
301
|
-
this
|
|
302
|
-
this
|
|
301
|
+
this.#options.clientUrl ??= this.#platform.getDefaultClientUrl();
|
|
302
|
+
this.#options.implicitTransactions ??= this.#platform.usesImplicitTransactions();
|
|
303
303
|
if (validate && metadataCache.enabled && !metadataCache.adapter) {
|
|
304
304
|
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
305
|
}
|
|
306
306
|
try {
|
|
307
|
-
const url = new URL(this
|
|
307
|
+
const url = new URL(this.#options.clientUrl);
|
|
308
308
|
if (url.pathname) {
|
|
309
|
-
this
|
|
309
|
+
this.#options.dbName = this.get('dbName', decodeURIComponent(url.pathname).substring(1));
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
catch {
|
|
313
|
-
const url = /:\/\/.*\/([^?]+)/.exec(this
|
|
313
|
+
const url = /:\/\/.*\/([^?]+)/.exec(this.#options.clientUrl);
|
|
314
314
|
if (url) {
|
|
315
|
-
this
|
|
315
|
+
this.#options.dbName = this.get('dbName', decodeURIComponent(url[1]));
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
if (validate && !this
|
|
318
|
+
if (validate && !this.#options.dbName && this.#options.clientUrl) {
|
|
319
319
|
throw new Error("No database specified, `clientUrl` option provided but it's missing the pathname.");
|
|
320
320
|
}
|
|
321
|
-
this
|
|
322
|
-
this
|
|
323
|
-
Object.keys(this
|
|
324
|
-
this
|
|
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;
|
|
325
325
|
});
|
|
326
|
-
if (!this
|
|
327
|
-
this
|
|
326
|
+
if (!this.#options.filtersOnRelations) {
|
|
327
|
+
this.#options.autoJoinRefsForFilters ??= false;
|
|
328
328
|
}
|
|
329
|
-
this
|
|
329
|
+
this.#options.subscribers = [...this.#options.subscribers].map(subscriber => {
|
|
330
330
|
return subscriber.constructor.name === 'Function' ? new subscriber() : subscriber;
|
|
331
331
|
});
|
|
332
332
|
this.sync();
|
|
333
333
|
if (!colors.enabled()) {
|
|
334
|
-
this
|
|
334
|
+
this.#options.highlighter = new NullHighlighter();
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
sync() {
|
|
338
|
-
setEnv('MIKRO_ORM_COLORS', this
|
|
339
|
-
this
|
|
338
|
+
setEnv('MIKRO_ORM_COLORS', this.#options.colors);
|
|
339
|
+
this.#logger.setDebugMode(this.#options.debug);
|
|
340
340
|
}
|
|
341
341
|
validateOptions() {
|
|
342
342
|
/* v8 ignore next */
|
|
343
|
-
if ('type' in this
|
|
343
|
+
if ('type' in this.#options) {
|
|
344
344
|
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
345
|
}
|
|
346
|
-
if (!this
|
|
346
|
+
if (!this.#options.driver) {
|
|
347
347
|
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
348
|
}
|
|
349
|
-
if (!this
|
|
349
|
+
if (!this.#options.dbName && !this.#options.clientUrl) {
|
|
350
350
|
throw new Error('No database specified, please fill in `dbName` or `clientUrl` option');
|
|
351
351
|
}
|
|
352
|
-
if (this
|
|
352
|
+
if (this.#options.entities.length === 0 && this.#options.discovery.warnWhenNoEntities) {
|
|
353
353
|
throw new Error('No entities found, please use `entities` option');
|
|
354
354
|
}
|
|
355
|
-
if (typeof this
|
|
356
|
-
this
|
|
355
|
+
if (typeof this.#options.driverOptions === 'function' &&
|
|
356
|
+
this.#options.driverOptions.constructor.name === 'AsyncFunction') {
|
|
357
357
|
throw new Error('`driverOptions` callback cannot be async');
|
|
358
358
|
}
|
|
359
359
|
}
|
package/utils/Cursor.d.ts
CHANGED
|
@@ -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;
|
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
|
|
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
|
|
125
|
+
const value = this.#definition.map(([key, direction]) => processEntity(entity, key, direction));
|
|
126
126
|
return Cursor.encode(value);
|
|
127
127
|
}
|
|
128
128
|
*[Symbol.iterator]() {
|
|
@@ -8,17 +8,8 @@ type ResultMapper<T> = (result: EntityData<T>) => EntityData<T> | null;
|
|
|
8
8
|
type SnapshotGenerator<T> = (entity: T) => EntityData<T>;
|
|
9
9
|
type CompositeKeyPart = string | CompositeKeyPart[];
|
|
10
10
|
export declare class EntityComparator {
|
|
11
|
-
private
|
|
12
|
-
|
|
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);
|
|
11
|
+
#private;
|
|
12
|
+
constructor(metadata: IMetadataStorage, platform: Platform, config?: Configuration);
|
|
22
13
|
/**
|
|
23
14
|
* Computes difference between two entities.
|
|
24
15
|
*/
|