diff --git a/package.json b/package.json index 4c696f8c0720..8027c011ff9a 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "sql-formatter": "8.0.2", "ts-jest": "28.0.8", "ts-node": "10.9.1", - "typescript": "4.7.4", + "typescript": "4.8.2", "uuid": "8.3.2" } } diff --git a/packages/better-sqlite/src/BetterSqliteDriver.ts b/packages/better-sqlite/src/BetterSqliteDriver.ts index 353d92b67925..d96ae7717ccb 100644 --- a/packages/better-sqlite/src/BetterSqliteDriver.ts +++ b/packages/better-sqlite/src/BetterSqliteDriver.ts @@ -1,4 +1,4 @@ -import type { AnyEntity, Configuration, EntityDictionary, NativeInsertUpdateManyOptions, QueryResult } from '@mikro-orm/core'; +import type { Configuration, EntityDictionary, NativeInsertUpdateManyOptions, QueryResult } from '@mikro-orm/core'; import { AbstractSqlDriver } from '@mikro-orm/knex'; import { BetterSqliteConnection } from './BetterSqliteConnection'; import { BetterSqlitePlatform } from './BetterSqlitePlatform'; @@ -9,7 +9,7 @@ export class BetterSqliteDriver extends AbstractSqlDriver>(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { + async nativeInsertMany(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { options.processCollections ??= true; const res = await super.nativeInsertMany(entityName, data, options); const pks = this.getPrimaryKeyFields(entityName); diff --git a/packages/cli/src/commands/CreateSeederCommand.ts b/packages/cli/src/commands/CreateSeederCommand.ts index 151c53c6139c..8935a666a7af 100644 --- a/packages/cli/src/commands/CreateSeederCommand.ts +++ b/packages/cli/src/commands/CreateSeederCommand.ts @@ -6,7 +6,7 @@ export class CreateSeederCommand implements CommandModule { + builder = (args: Argv) => { args.positional('seeder', { describe: 'Name for the seeder class. (e.g. "test" will generate "TestSeeder" or "TestSeeder" will generate "TestSeeder")', }); diff --git a/packages/cli/src/commands/DatabaseSeedCommand.ts b/packages/cli/src/commands/DatabaseSeedCommand.ts index 8073e2204364..04b22c5a9d24 100644 --- a/packages/cli/src/commands/DatabaseSeedCommand.ts +++ b/packages/cli/src/commands/DatabaseSeedCommand.ts @@ -6,7 +6,7 @@ export class DatabaseSeedCommand implements CommandModule { + builder = (args: Argv) => { args.option('c', { alias: 'class', type: 'string', diff --git a/packages/core/src/EntityManager.ts b/packages/core/src/EntityManager.ts index 2876ed3941c1..474fbb80f83e 100644 --- a/packages/core/src/EntityManager.ts +++ b/packages/core/src/EntityManager.ts @@ -2,7 +2,7 @@ import { inspect } from 'util'; import type { Configuration } from './utils'; import { QueryHelper, TransactionContext, Utils } from './utils'; import type { AssignOptions, EntityLoaderOptions, EntityRepository, IdentifiedReference } from './entity'; -import { EntityAssigner, EntityFactory, EntityLoader, EntityValidator, Reference } from './entity'; +import { EntityAssigner, EntityFactory, EntityLoader, EntityValidator, helper, Reference } from './entity'; import { ChangeSetType, UnitOfWork } from './unit-of-work'; import type { CountOptions, DeleteOptions, EntityManagerType, FindOneOptions, FindOneOrFailOptions, FindOptions, IDatabaseDriver, LockOptions, NativeInsertUpdateOptions, UpdateOptions, GetReferenceOptions, EntityField } from './drivers'; import type { AnyEntity, AutoPath, ConnectionType, Dictionary, EntityData, EntityDictionary, EntityDTO, EntityMetadata, EntityName, FilterDef, FilterQuery, GetRepository, Loaded, Populate, PopulateOptions, Primary, RequiredEntityData } from './typings'; @@ -72,7 +72,7 @@ export class EntityManager { /** * Gets repository for given entity. You can pass either string name or entity class reference. */ - getRepository, U extends EntityRepository = EntityRepository>(entityName: EntityName): GetRepository { + getRepository = EntityRepository>(entityName: EntityName): GetRepository { entityName = Utils.className(entityName); if (!this.repositoryMap[entityName]) { @@ -94,7 +94,7 @@ export class EntityManager { /** * Finds all entities matching your `where` query. You can pass additional options via the `options` parameter. */ - async find, P extends string = never>(entityName: EntityName, where: FilterQuery, options: FindOptions = {}): Promise[]> { + async find(entityName: EntityName, where: FilterQuery, options: FindOptions = {}): Promise[]> { if (options.disableIdentityMap) { const em = this.getContext(false); const fork = em.fork(); @@ -153,7 +153,7 @@ export class EntityManager { if (meta.virtual) { await em.unitOfWork.dispatchOnLoadEvent(); - await em.storeCache(options.cache, cached!, () => ret.map(e => e.__helper!.toPOJO())); + await em.storeCache(options.cache, cached!, () => ret.map(e => helper(e).toPOJO())); return ret as Loaded[]; } @@ -167,12 +167,12 @@ export class EntityManager { lookup: false, }); await em.unitOfWork.dispatchOnLoadEvent(); - await em.storeCache(options.cache, cached!, () => unique.map(e => e.__helper!.toPOJO())); + await em.storeCache(options.cache, cached!, () => unique.map(e => helper(e).toPOJO())); return unique as Loaded[]; } - private getPopulateWhere(where: FilterQuery, options: Pick, 'populateWhere'>): { where: FilterQuery; populateWhere?: PopulateHint } { + private getPopulateWhere(where: FilterQuery, options: Pick, 'populateWhere'>): { where: FilterQuery; populateWhere?: PopulateHint } { if (options.populateWhere === undefined) { options.populateWhere = this.config.get('populateWhere'); } @@ -191,17 +191,17 @@ export class EntityManager { /** * Registers global filter to this entity manager. Global filters are enabled by default (unless disabled via last parameter). */ - addFilter>(name: string, cond: FilterQuery | ((args: Dictionary) => FilterQuery), entityName?: EntityName | [EntityName], enabled?: boolean): void; + addFilter(name: string, cond: FilterQuery | ((args: Dictionary) => FilterQuery), entityName?: EntityName | [EntityName], enabled?: boolean): void; /** * Registers global filter to this entity manager. Global filters are enabled by default (unless disabled via last parameter). */ - addFilter, T2 extends AnyEntity>(name: string, cond: FilterQuery | ((args: Dictionary) => FilterQuery), entityName?: [EntityName, EntityName], enabled?: boolean): void; + addFilter(name: string, cond: FilterQuery | ((args: Dictionary) => FilterQuery), entityName?: [EntityName, EntityName], enabled?: boolean): void; /** * Registers global filter to this entity manager. Global filters are enabled by default (unless disabled via last parameter). */ - addFilter, T2 extends AnyEntity, T3 extends AnyEntity>(name: string, cond: FilterQuery | ((args: Dictionary) => FilterQuery), entityName?: [EntityName, EntityName, EntityName], enabled?: boolean): void; + addFilter(name: string, cond: FilterQuery | ((args: Dictionary) => FilterQuery), entityName?: [EntityName, EntityName, EntityName], enabled?: boolean): void; /** * Registers global filter to this entity manager. Global filters are enabled by default (unless disabled via last parameter). @@ -235,7 +235,7 @@ export class EntityManager { this.getContext(false).flushMode = flushMode; } - protected async processWhere, P extends string = never>(entityName: string, where: FilterQuery, options: FindOptions | FindOneOptions, type: 'read' | 'update' | 'delete'): Promise> { + protected async processWhere(entityName: string, where: FilterQuery, options: FindOptions | FindOneOptions, type: 'read' | 'update' | 'delete'): Promise> { where = QueryHelper.processWhere({ where: where as FilterQuery, entityName, @@ -250,7 +250,7 @@ export class EntityManager { return where; } - protected applyDiscriminatorCondition>(entityName: string, where: FilterQuery): FilterQuery { + protected applyDiscriminatorCondition(entityName: string, where: FilterQuery): FilterQuery { const meta = this.metadata.find(entityName); if (!meta || !meta.discriminatorValue) { @@ -275,7 +275,7 @@ export class EntityManager { /** * @internal */ - async applyFilters>(entityName: string, where: FilterQuery, options: Dictionary | string[] | boolean, type: 'read' | 'update' | 'delete'): Promise> { + async applyFilters(entityName: string, where: FilterQuery, options: Dictionary | string[] | boolean, type: 'read' | 'update' | 'delete'): Promise> { const meta = this.metadata.find(entityName); const filters: FilterDef[] = []; const ret: Dictionary[] = []; @@ -333,7 +333,7 @@ export class EntityManager { * Calls `em.find()` and `em.count()` with the same arguments (where applicable) and returns the results as tuple * where first element is the array of entities and the second is the count. */ - async findAndCount, P extends string = never>(entityName: EntityName, where: FilterQuery, options: FindOptions = {}): Promise<[Loaded[], number]> { + async findAndCount(entityName: EntityName, where: FilterQuery, options: FindOptions = {}): Promise<[Loaded[], number]> { const [entities, count] = await Promise.all([ this.find(entityName, where, options), this.count(entityName, where, options), @@ -345,7 +345,7 @@ export class EntityManager { /** * Finds first entity matching your `where` query. */ - async findOne, P extends string = never>(entityName: EntityName, where: FilterQuery, options: FindOneOptions = {}): Promise | null> { + async findOne(entityName: EntityName, where: FilterQuery, options: FindOneOptions = {}): Promise | null> { if (options.disableIdentityMap) { const em = this.getContext(false); const fork = em.fork(); @@ -405,7 +405,7 @@ export class EntityManager { } await em.unitOfWork.dispatchOnLoadEvent(); - await em.storeCache(options.cache, cached!, () => entity!.__helper!.toPOJO()); + await em.storeCache(options.cache, cached!, () => helper(entity).toPOJO()); return entity as Loaded; } @@ -416,7 +416,7 @@ export class EntityManager { * You can override the factory for creating this method via `options.failHandler` locally * or via `Configuration.findOneOrFailHandler` (`findExactlyOneOrFailHandler` when specifying `strict`) globally. */ - async findOneOrFail, P extends string = never>(entityName: EntityName, where: FilterQuery, options: FindOneOrFailOptions = {}): Promise> { + async findOneOrFail(entityName: EntityName, where: FilterQuery, options: FindOneOrFailOptions = {}): Promise> { let entity: Loaded | null; let isStrictViolation = false; @@ -515,7 +515,7 @@ export class EntityManager { /** * Runs your callback wrapped inside a database transaction. */ - async lock(entity: T, lockMode: LockMode, options: LockOptions | number | Date = {}): Promise { + async lock(entity: T, lockMode: LockMode, options: LockOptions | number | Date = {}): Promise { options = Utils.isPlainObject(options) ? options as LockOptions : { lockVersion: options }; await this.getUnitOfWork().lock(entity, { lockMode, ...options }); } @@ -523,13 +523,13 @@ export class EntityManager { /** * Fires native insert query. Calling this has no side effects on the context (identity map). */ - async nativeInsert>(entityNameOrEntity: EntityName | T, data?: EntityData | T, options: NativeInsertUpdateOptions = {}): Promise> { + async nativeInsert(entityNameOrEntity: EntityName | T, data?: EntityData | T, options: NativeInsertUpdateOptions = {}): Promise> { const em = this.getContext(false); let entityName; if (data === undefined) { - entityName = entityNameOrEntity.constructor.name; + entityName = (entityNameOrEntity as Dictionary).constructor.name; data = entityNameOrEntity as T; } else { entityName = Utils.className(entityNameOrEntity as EntityName); @@ -549,7 +549,7 @@ export class EntityManager { /** * Fires native update query. Calling this has no side effects on the context (identity map). */ - async nativeUpdate>(entityName: EntityName, where: FilterQuery, data: EntityData, options: UpdateOptions = {}): Promise { + async nativeUpdate(entityName: EntityName, where: FilterQuery, data: EntityData, options: UpdateOptions = {}): Promise { const em = this.getContext(false); entityName = Utils.className(entityName); @@ -565,7 +565,7 @@ export class EntityManager { /** * Fires native delete query. Calling this has no side effects on the context (identity map). */ - async nativeDelete>(entityName: EntityName, where: FilterQuery, options: DeleteOptions = {}): Promise { + async nativeDelete(entityName: EntityName, where: FilterQuery, options: DeleteOptions = {}): Promise { const em = this.getContext(false); entityName = Utils.className(entityName); @@ -579,7 +579,7 @@ export class EntityManager { /** * Maps raw database result to an entity and merges it to this EntityManager. */ - map>(entityName: EntityName, result: EntityDictionary, options: { schema?: string } = {}): T { + map(entityName: EntityName, result: EntityDictionary, options: { schema?: string } = {}): T { entityName = Utils.className(entityName); const meta = this.metadata.get(entityName); const data = this.driver.mapResult(result, meta) as Dictionary; @@ -599,30 +599,30 @@ export class EntityManager { * Merges given entity to this EntityManager so it becomes managed. You can force refreshing of existing entities * via second parameter. By default, it will return already loaded entities without modifying them. */ - merge>(entity: T, options?: MergeOptions): T; + merge(entity: T, options?: MergeOptions): T; /** * Merges given entity to this EntityManager so it becomes managed. You can force refreshing of existing entities * via second parameter. By default, it will return already loaded entities without modifying them. */ - merge>(entityName: EntityName, data: EntityData | EntityDTO, options?: MergeOptions): T; + merge(entityName: EntityName, data: EntityData | EntityDTO, options?: MergeOptions): T; /** * Merges given entity to this EntityManager so it becomes managed. You can force refreshing of existing entities * via second parameter. By default, it will return already loaded entities without modifying them. */ - merge>(entityName: EntityName | T, data?: EntityData | EntityDTO | MergeOptions, options: MergeOptions = {}): T { + merge(entityName: EntityName | T, data?: EntityData | EntityDTO | MergeOptions, options: MergeOptions = {}): T { const em = this.getContext(); if (Utils.isEntity(entityName)) { - return em.merge(entityName.constructor.name, entityName as unknown as EntityData, data as MergeOptions); + return em.merge((entityName as Dictionary).constructor.name, entityName as unknown as EntityData, data as MergeOptions); } entityName = Utils.className(entityName as string); em.validator.validatePrimaryKey(data as EntityData, em.metadata.get(entityName)); let entity = em.unitOfWork.tryGetById(entityName, data as FilterQuery, options.schema, false); - if (entity && entity.__helper!.__initialized && !options.refresh) { + if (entity && helper(entity).__initialized && !options.refresh) { return entity; } @@ -633,7 +633,7 @@ export class EntityManager { em.validator.validate(entity, data, childMeta ?? meta); em.unitOfWork.merge(entity); - return entity; + return entity!; } /** @@ -644,7 +644,7 @@ export class EntityManager { * the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial)` and * `em.create()` will pass the data into it (unless we have a property named `data` too). */ - create>(entityName: EntityName, data: RequiredEntityData, options: CreateOptions = {}): T { + create(entityName: EntityName, data: RequiredEntityData, options: CreateOptions = {}): T { const em = this.getContext(); const entity = em.entityFactory.create(entityName, data, { ...options, newEntity: !options.managed }); options.persist ??= em.config.get('persistOnCreate'); @@ -659,34 +659,34 @@ export class EntityManager { /** * Shortcut for `wrap(entity).assign(data, { em })` */ - assign>(entity: T, data: EntityData | Partial>, options: AssignOptions = {}): T { + assign(entity: T, data: EntityData | Partial>, options: AssignOptions = {}): T { return EntityAssigner.assign(entity, data, { em: this.getContext(), ...options }); } /** * Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded */ - getReference, PK extends keyof T>(entityName: EntityName, id: Primary, options: Omit & { wrapped: true }): IdentifiedReference; + getReference(entityName: EntityName, id: Primary, options: Omit & { wrapped: true }): IdentifiedReference; /** * Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded */ - getReference>(entityName: EntityName, id: Primary | Primary[]): T; + getReference(entityName: EntityName, id: Primary | Primary[]): T; /** * Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded */ - getReference>(entityName: EntityName, id: Primary, options: Omit & { wrapped: false }): T; + getReference(entityName: EntityName, id: Primary, options: Omit & { wrapped: false }): T; /** * Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded */ - getReference>(entityName: EntityName, id: Primary, options?: GetReferenceOptions): T | Reference; + getReference(entityName: EntityName, id: Primary, options?: GetReferenceOptions): T | Reference; /** * Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded */ - getReference>(entityName: EntityName, id: Primary, options: GetReferenceOptions = {}): T | Reference { + getReference(entityName: EntityName, id: Primary, options: GetReferenceOptions = {}): T | Reference { options.convertCustomTypes ??= false; const meta = this.metadata.get(Utils.className(entityName)); @@ -710,7 +710,7 @@ export class EntityManager { /** * Returns total number of entities matching your `where` query. */ - async count(entityName: EntityName, where: FilterQuery = {} as FilterQuery, options: CountOptions = {}): Promise { + async count(entityName: EntityName, where: FilterQuery = {} as FilterQuery, options: CountOptions = {}): Promise { const em = this.getContext(false); entityName = Utils.className(entityName); where = await em.processWhere(entityName, where, options as FindOptions, 'read'); @@ -733,7 +733,7 @@ export class EntityManager { * Tells the EntityManager to make an instance managed and persistent. * The entity will be entered into the database at or before transaction commit or as a result of the flush operation. */ - persist(entity: AnyEntity | Reference | (AnyEntity | Reference)[]): this { + persist(entity: T | Reference | (T | Reference)[]): this { const em = this.getContext(); if (Utils.isEntity(entity)) { @@ -747,7 +747,7 @@ export class EntityManager { for (const ent of entities) { if (!Utils.isEntity(ent, true)) { /* istanbul ignore next */ - const meta = typeof ent === 'object' ? em.metadata.find(ent.constructor.name) : undefined; + const meta = typeof ent === 'object' ? em.metadata.find((ent as Dictionary).constructor.name) : undefined; throw ValidationError.notDiscoveredEntity(ent, meta); } @@ -782,7 +782,7 @@ export class EntityManager { * * To remove entities by condition, use `em.nativeDelete()`. */ - remove>(entity: T | Reference | (T | Reference)[]): this { + remove(entity: T | Reference | (T | Reference)[]): this { const em = this.getContext(); if (Utils.isEntity(entity)) { @@ -834,7 +834,7 @@ export class EntityManager { /** * @internal */ - async tryFlush(entityName: EntityName, options: { flushMode?: FlushMode }): Promise { + async tryFlush(entityName: EntityName, options: { flushMode?: FlushMode }): Promise { const em = this.getContext(); const flushMode = options.flushMode ?? em.flushMode ?? em.config.get('flushMode'); entityName = Utils.className(entityName); @@ -859,7 +859,7 @@ export class EntityManager { /** * Checks whether given property can be populated on the entity. */ - canPopulate>(entityName: EntityName, property: string): boolean { + canPopulate(entityName: EntityName, property: string): boolean { entityName = Utils.className(entityName); const [p, ...parts] = property.split('.'); const props = this.metadata.get(entityName).properties; @@ -879,7 +879,7 @@ export class EntityManager { /** * Loads specified relations in batch. This will execute one query for each relation, that will populate it on all of the specified entities. */ - async populate, P extends string = never>(entities: T | T[], populate: AutoPath[] | boolean, options: EntityLoaderOptions = {}): Promise[]> { + async populate(entities: T | T[], populate: AutoPath[] | boolean, options: EntityLoaderOptions = {}): Promise[]> { entities = Utils.asArray(entities); if (entities.length === 0) { @@ -887,7 +887,7 @@ export class EntityManager { } const em = this.getContext(); - const entityName = entities[0].constructor.name; + const entityName = (entities[0] as Dictionary).constructor.name; const preparedPopulate = em.preparePopulate(entityName, { populate: populate as true }); await em.entityLoader.populate(entityName, entities, preparedPopulate, options); @@ -1030,7 +1030,7 @@ export class EntityManager { } } - private async lockAndPopulate, P extends string = never>(entityName: string, entity: T, where: FilterQuery, options: FindOneOptions): Promise> { + private async lockAndPopulate(entityName: string, entity: T, where: FilterQuery, options: FindOneOptions): Promise> { if (options.lockMode === LockMode.OPTIMISTIC) { await this.lock(entity, options.lockMode, { lockVersion: options.lockVersion, @@ -1050,7 +1050,7 @@ export class EntityManager { return entity as Loaded; } - private buildFields(fields: readonly EntityField[]): readonly AutoPath[] { + private buildFields(fields: readonly EntityField[]): readonly AutoPath[] { return fields.reduce((ret, f) => { if (Utils.isPlainObject(f)) { Object.keys(f).forEach(ff => ret.push(...this.buildFields(f[ff]).map(field => `${ff}.${field}` as never))); @@ -1062,7 +1062,7 @@ export class EntityManager { }, [] as AutoPath[]); } - private preparePopulate, P extends string = never>(entityName: string, options: Pick, 'populate' | 'strategy' | 'fields'>): PopulateOptions[] { + private preparePopulate(entityName: string, options: Pick, 'populate' | 'strategy' | 'fields'>): PopulateOptions[] { // infer populate hint if only `fields` are available if (!options.populate && options.fields) { options.populate = this.buildFields(options.fields); @@ -1100,17 +1100,17 @@ export class EntityManager { * when the entity is found in identity map, we check if it was partially loaded or we are trying to populate * some additional lazy properties, if so, we reload and merge the data from database */ - protected shouldRefresh, P extends string = never>(meta: EntityMetadata, entity: T, options: FindOneOptions) { - if (!entity.__helper!.__initialized || options.refresh) { + protected shouldRefresh(meta: EntityMetadata, entity: T, options: FindOneOptions) { + if (!helper(entity).__initialized || options.refresh) { return true; } let autoRefresh: boolean; if (options.fields) { - autoRefresh = options.fields.some(field => !entity!.__helper!.__loadedProperties.has(field as string)); + autoRefresh = options.fields.some(field => !helper(entity).__loadedProperties.has(field as string)); } else { - autoRefresh = meta.comparableProps.some(prop => !prop.lazy && !entity!.__helper!.__loadedProperties.has(prop.name)); + autoRefresh = meta.comparableProps.some(prop => !prop.lazy && !helper(entity).__loadedProperties.has(prop.name)); } if (autoRefresh) { @@ -1118,7 +1118,7 @@ export class EntityManager { } if (Array.isArray(options.populate)) { - return options.populate.some(field => !entity!.__helper!.__loadedProperties.has(field as string)); + return options.populate.some(field => !helper(entity).__loadedProperties.has(field as string)); } return !!options.populate; @@ -1127,7 +1127,7 @@ export class EntityManager { /** * @internal */ - async tryCache(entityName: string, config: boolean | number | [string, number] | undefined, key: unknown, refresh?: boolean, merge?: boolean): Promise<{ data?: R; key: string } | undefined> { + async tryCache(entityName: string, config: boolean | number | [string, number] | undefined, key: unknown, refresh?: boolean, merge?: boolean): Promise<{ data?: R; key: string } | undefined> { if (!config) { return undefined; } diff --git a/packages/core/src/MikroORM.ts b/packages/core/src/MikroORM.ts index f1d156a11114..826a747c7ab8 100644 --- a/packages/core/src/MikroORM.ts +++ b/packages/core/src/MikroORM.ts @@ -5,7 +5,7 @@ import type { Logger } from './logging'; import { Configuration, ConfigurationLoader, Utils } from './utils'; import { NullCacheAdapter } from './cache'; import type { EntityManager } from './EntityManager'; -import type { AnyEntity, Constructor, IEntityGenerator, IMigrator, ISeedManager } from './typings'; +import type { Constructor, IEntityGenerator, IMigrator, ISeedManager } from './typings'; import { colors } from './logging'; /** @@ -124,7 +124,7 @@ export class MikroORM { /** * Allows dynamically discovering new entity by reference, handy for testing schema diffing. */ - async discoverEntity(entities: Constructor | Constructor[]): Promise { + async discoverEntity(entities: Constructor | Constructor[]): Promise { entities = Utils.asArray(entities); const tmp = await this.discovery.discoverReferences(entities); new MetadataValidator().validateDiscovered([...Object.values(this.metadata.getAll()), ...tmp], this.config.get('discovery').warnWhenNoEntities!); diff --git a/packages/core/src/connections/Connection.ts b/packages/core/src/connections/Connection.ts index fa234d7af21a..0408010b82e1 100644 --- a/packages/core/src/connections/Connection.ts +++ b/packages/core/src/connections/Connection.ts @@ -2,7 +2,7 @@ import { URL } from 'url'; import type { Configuration, ConnectionOptions, DynamicPassword } from '../utils'; import type { LogContext } from '../logging'; import type { MetadataStorage } from '../metadata'; -import type { AnyEntity, ConnectionType, Dictionary, MaybePromise, Primary } from '../typings'; +import type { ConnectionType, Dictionary, MaybePromise, Primary } from '../typings'; import type { Platform } from '../platforms/Platform'; import type { TransactionEventBroadcaster } from '../events/TransactionEventBroadcaster'; import type { IsolationLevel } from '../enums'; @@ -130,7 +130,7 @@ export abstract class Connection { } -export interface QueryResult = { id: number }> { +export interface QueryResult { affectedRows: number; insertId: Primary; row?: Dictionary; diff --git a/packages/core/src/decorators/Indexed.ts b/packages/core/src/decorators/Indexed.ts index b9d22357c1f1..498084812e64 100644 --- a/packages/core/src/decorators/Indexed.ts +++ b/packages/core/src/decorators/Indexed.ts @@ -2,7 +2,7 @@ import { MetadataStorage } from '../metadata'; import type { AnyEntity, Dictionary } from '../typings'; import { Utils } from '../utils/Utils'; -function createDecorator>(options: IndexOptions | UniqueOptions, unique: boolean) { +function createDecorator(options: IndexOptions | UniqueOptions, unique: boolean) { return function (target: AnyEntity, propertyName?: string) { const meta = MetadataStorage.getMetadataFromDecorator(propertyName ? target.constructor : target); options.properties = options.properties || propertyName as keyof T; @@ -25,13 +25,13 @@ export function Unique(options: UniqueOptions = {}) { return createDecorator(options, true); } -export interface UniqueOptions> { +export interface UniqueOptions { name?: string; properties?: keyof T | (keyof T)[]; options?: Dictionary; } -export interface IndexOptions> extends UniqueOptions { +export interface IndexOptions extends UniqueOptions { type?: string; expression?: string; } diff --git a/packages/core/src/drivers/DatabaseDriver.ts b/packages/core/src/drivers/DatabaseDriver.ts index 1be42c5120c8..80af3d734994 100644 --- a/packages/core/src/drivers/DatabaseDriver.ts +++ b/packages/core/src/drivers/DatabaseDriver.ts @@ -1,6 +1,6 @@ import type { CountOptions, LockOptions, DeleteOptions, FindOneOptions, FindOptions, IDatabaseDriver, NativeInsertUpdateManyOptions, NativeInsertUpdateOptions, DriverMethodOptions } from './IDatabaseDriver'; import { EntityManagerType } from './IDatabaseDriver'; -import type { AnyEntity, ConnectionType, Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityProperty, FilterQuery, PopulateOptions, Primary } from '../typings'; +import type { ConnectionType, Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityProperty, FilterQuery, PopulateOptions, Primary } from '../typings'; import type { MetadataStorage } from '../metadata'; import type { Connection, QueryResult, Transaction } from '../connections'; import type { Configuration, ConnectionOptions } from '../utils'; @@ -8,10 +8,11 @@ import { EntityComparator, Utils } from '../utils'; import type { QueryOrderMap } from '../enums'; import { QueryOrder, ReferenceType } from '../enums'; import type { Platform } from '../platforms'; -import type { Collection } from '../entity'; +import type { Collection } from '../entity/Collection'; import { EntityManager } from '../EntityManager'; import { ValidationError } from '../errors'; import { DriverException } from '../exceptions'; +import { helper } from '../entity/wrap'; export abstract class DatabaseDriver implements IDatabaseDriver { @@ -27,30 +28,30 @@ export abstract class DatabaseDriver implements IDatabaseD protected constructor(readonly config: Configuration, protected readonly dependencies: string[]) { } - abstract find(entityName: string, where: FilterQuery, options?: FindOptions): Promise[]>; + abstract find(entityName: string, where: FilterQuery, options?: FindOptions): Promise[]>; - abstract findOne(entityName: string, where: FilterQuery, options?: FindOneOptions): Promise | null>; + abstract findOne(entityName: string, where: FilterQuery, options?: FindOneOptions): Promise | null>; - abstract nativeInsert(entityName: string, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; + abstract nativeInsert(entityName: string, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; - abstract nativeInsertMany(entityName: string, data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise>; + abstract nativeInsertMany(entityName: string, data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise>; - abstract nativeUpdate(entityName: string, where: FilterQuery, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; + abstract nativeUpdate(entityName: string, where: FilterQuery, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; - async nativeUpdateMany(entityName: string, where: FilterQuery[], data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise> { + async nativeUpdateMany(entityName: string, where: FilterQuery[], data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise> { throw new Error(`Batch updates are not supported by ${this.constructor.name} driver`); } - abstract nativeDelete(entityName: string, where: FilterQuery, options?: DeleteOptions): Promise>; + abstract nativeDelete(entityName: string, where: FilterQuery, options?: DeleteOptions): Promise>; - abstract count, P extends string = never>(entityName: string, where: FilterQuery, options?: CountOptions): Promise; + abstract count(entityName: string, where: FilterQuery, options?: CountOptions): Promise; createEntityManager(useContext?: boolean): D[typeof EntityManagerType] { return new EntityManager(this.config, this, this.metadata, useContext) as unknown as EntityManager; } /* istanbul ignore next */ - async findVirtual(entityName: string, where: FilterQuery, options: FindOptions): Promise[]> { + async findVirtual(entityName: string, where: FilterQuery, options: FindOptions): Promise[]> { throw new Error(`Virtual entities are not supported by ${this.constructor.name} driver.`); } @@ -58,22 +59,22 @@ export abstract class DatabaseDriver implements IDatabaseD throw new Error(`Aggregations are not supported by ${this.constructor.name} driver`); } - async loadFromPivotTable(prop: EntityProperty, owners: Primary[][], where?: FilterQuery, orderBy?: QueryOrderMap[], ctx?: Transaction, options?: FindOptions): Promise> { + async loadFromPivotTable(prop: EntityProperty, owners: Primary[][], where?: FilterQuery, orderBy?: QueryOrderMap[], ctx?: Transaction, options?: FindOptions): Promise> { throw new Error(`${this.constructor.name} does not use pivot tables`); } - async syncCollection(coll: Collection, options?: DriverMethodOptions): Promise { + async syncCollection(coll: Collection, options?: DriverMethodOptions): Promise { const pk = coll.property.targetMeta!.primaryKeys[0]; const data = { [coll.property.name]: coll.getIdentifiers(pk) } as EntityData; - await this.nativeUpdate(coll.owner.constructor.name, coll.owner.__helper!.getPrimaryKey() as FilterQuery, data, options); + await this.nativeUpdate(coll.owner.constructor.name, helper(coll.owner).getPrimaryKey() as FilterQuery, data, options); } - mapResult(result: EntityDictionary, meta?: EntityMetadata, populate: PopulateOptions[] = []): EntityData | null { + mapResult(result: EntityDictionary, meta?: EntityMetadata, populate: PopulateOptions[] = []): EntityData | null { if (!result || !meta) { return result ?? null; } - return this.comparator.mapResult(meta.className, result); + return this.comparator.mapResult(meta.className, result); } async connect(): Promise { @@ -139,7 +140,7 @@ export abstract class DatabaseDriver implements IDatabaseD } protected inlineEmbeddables(meta: EntityMetadata, data: T, where?: boolean): void { - Object.keys(data).forEach(k => { + Object.keys(data as Dictionary).forEach(k => { if (Utils.isOperator(k)) { Utils.asArray(data[k]).forEach(payload => this.inlineEmbeddables(meta, payload, where)); } @@ -154,9 +155,9 @@ export abstract class DatabaseDriver implements IDatabaseD const props = prop.embeddedProps; let unknownProp = false; - Object.keys(data[prop.name]).forEach(kk => { + Object.keys(data[prop.name] as Dictionary).forEach(kk => { // explicitly allow `$exists` operator here as it cant be misused this way - const operator = Object.keys(data[prop.name]).some(f => Utils.isOperator(f) && f !== '$exists'); + const operator = Object.keys(data[prop.name] as Dictionary).some(f => Utils.isOperator(f) && f !== '$exists'); if (operator) { throw ValidationError.cannotUseOperatorsInsideEmbeddables(meta.name!, prop.name, data); @@ -241,7 +242,7 @@ export abstract class DatabaseDriver implements IDatabaseD return ret; } - async lockPessimistic>(entity: T, options: LockOptions): Promise { + async lockPessimistic(entity: T, options: LockOptions): Promise { throw new Error(`Pessimistic locks are not supported by ${this.constructor.name} driver`); } diff --git a/packages/core/src/drivers/IDatabaseDriver.ts b/packages/core/src/drivers/IDatabaseDriver.ts index f6633369eeff..e457291d67be 100644 --- a/packages/core/src/drivers/IDatabaseDriver.ts +++ b/packages/core/src/drivers/IDatabaseDriver.ts @@ -1,12 +1,12 @@ import type { - ConnectionType, EntityData, EntityMetadata, EntityProperty, AnyEntity, FilterQuery, Primary, Dictionary, QBFilterQuery, + ConnectionType, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, QBFilterQuery, IPrimaryKey, PopulateOptions, EntityDictionary, ExpandProperty, AutoPath, ObjectQuery, } from '../typings'; import type { Connection, QueryResult, Transaction } from '../connections'; import type { FlushMode, LockMode, QueryOrderMap, QueryFlag, LoadStrategy, PopulateHint } from '../enums'; import type { Platform } from '../platforms'; import type { MetadataStorage } from '../metadata'; -import type { Collection } from '../entity'; +import type { Collection } from '../entity/Collection'; import type { EntityManager } from '../EntityManager'; import type { DriverException } from '../exceptions'; import type { Configuration } from '../utils/Configuration'; @@ -31,37 +31,37 @@ export interface IDatabaseDriver { /** * Finds selection of entities */ - find, P extends string = never>(entityName: string, where: FilterQuery, options?: FindOptions): Promise[]>; + find(entityName: string, where: FilterQuery, options?: FindOptions): Promise[]>; /** * Finds single entity (table row, document) */ - findOne, P extends string = never>(entityName: string, where: FilterQuery, options?: FindOneOptions): Promise | null>; + findOne(entityName: string, where: FilterQuery, options?: FindOneOptions): Promise | null>; - findVirtual(entityName: string, where: FilterQuery, options: FindOptions): Promise[]>; + findVirtual(entityName: string, where: FilterQuery, options: FindOptions): Promise[]>; - nativeInsert>(entityName: string, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; + nativeInsert(entityName: string, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; - nativeInsertMany>(entityName: string, data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise>; + nativeInsertMany(entityName: string, data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise>; - nativeUpdate>(entityName: string, where: FilterQuery, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; + nativeUpdate(entityName: string, where: FilterQuery, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; - nativeUpdateMany>(entityName: string, where: FilterQuery[], data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise>; + nativeUpdateMany(entityName: string, where: FilterQuery[], data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise>; - nativeDelete>(entityName: string, where: FilterQuery, options?: NativeDeleteOptions): Promise>; + nativeDelete(entityName: string, where: FilterQuery, options?: NativeDeleteOptions): Promise>; - syncCollection(collection: Collection, options?: DriverMethodOptions): Promise; + syncCollection(collection: Collection, options?: DriverMethodOptions): Promise; - count, P extends string = never>(entityName: string, where: FilterQuery, options?: CountOptions): Promise; + count(entityName: string, where: FilterQuery, options?: CountOptions): Promise; aggregate(entityName: string, pipeline: any[]): Promise; - mapResult(result: EntityDictionary, meta: EntityMetadata, populate?: PopulateOptions[]): EntityData | null; + mapResult(result: EntityDictionary, meta: EntityMetadata, populate?: PopulateOptions[]): EntityData | null; /** * When driver uses pivot tables for M:N, this method will load identifiers for given collections from them */ - loadFromPivotTable, O extends AnyEntity>(prop: EntityProperty, owners: Primary[][], where?: FilterQuery, orderBy?: QueryOrderMap[], ctx?: Transaction, options?: FindOptions): Promise>; + loadFromPivotTable(prop: EntityProperty, owners: Primary[][], where?: FilterQuery, orderBy?: QueryOrderMap[], ctx?: Transaction, options?: FindOptions): Promise>; getPlatform(): Platform; @@ -77,7 +77,7 @@ export interface IDatabaseDriver { */ getDependencies(): string[]; - lockPessimistic>(entity: T, options: LockOptions): Promise; + lockPessimistic(entity: T, options: LockOptions): Promise; /** * Converts native db errors to standardized driver exceptions @@ -118,12 +118,12 @@ export interface FindOptions { connectionType?: ConnectionType; } -export interface FindOneOptions extends Omit, 'limit' | 'offset' | 'lockMode'> { +export interface FindOneOptions extends Omit, 'limit' | 'offset' | 'lockMode'> { lockMode?: LockMode; lockVersion?: number | Date; } -export interface FindOneOrFailOptions extends FindOneOptions { +export interface FindOneOrFailOptions extends FindOneOptions { failHandler?: (entityName: string, where: Dictionary | IPrimaryKey | any) => Error; strict?: boolean; } @@ -138,7 +138,7 @@ export interface NativeInsertUpdateManyOptions extends NativeInsertUpdateOpti processCollections?: boolean; } -export interface CountOptions { +export interface CountOptions { filters?: Dictionary | string[] | boolean; schema?: string; groupBy?: string | readonly string[]; diff --git a/packages/core/src/entity/ArrayCollection.ts b/packages/core/src/entity/ArrayCollection.ts index 6b76bced7853..c55f8014be9a 100644 --- a/packages/core/src/entity/ArrayCollection.ts +++ b/packages/core/src/entity/ArrayCollection.ts @@ -1,12 +1,12 @@ import { inspect } from 'util'; -import type { AnyEntity, EntityDTO, EntityProperty, IPrimaryKey, Primary } from '../typings'; +import type { EntityDTO, EntityProperty, IPrimaryKey, Primary } from '../typings'; import { Reference } from './Reference'; -import { wrap } from './wrap'; +import { helper, wrap } from './wrap'; import { ReferenceType } from '../enums'; import { MetadataError } from '../errors'; import { Utils } from '../utils/Utils'; -export class ArrayCollection { +export class ArrayCollection { protected readonly items = new Set(); protected initialized = true; @@ -14,7 +14,7 @@ export class ArrayCollection { protected _count?: number; private _property?: EntityProperty; - constructor(readonly owner: O & AnyEntity, items?: T[]) { + constructor(readonly owner: O, items?: T[]) { /* istanbul ignore next */ if (items) { let i = 0; @@ -66,7 +66,7 @@ export class ArrayCollection { add(...items: (T | Reference)[]): void { for (const item of items) { - const entity = Reference.unwrapReference(item); + const entity = Reference.unwrapReference(item) as T; if (!this.contains(entity, false)) { this.incrementCount(1); @@ -107,7 +107,7 @@ export class ArrayCollection { continue; } - const entity = Reference.unwrapReference(item); + const entity = Reference.unwrapReference(item) as T; if (this.items.delete(entity)) { this.incrementCount(-1); @@ -142,7 +142,7 @@ export class ArrayCollection { } contains(item: T | Reference, check?: boolean): boolean { - const entity = Reference.unwrapReference(item); + const entity = Reference.unwrapReference(item) as T; return this.items.has(entity); } @@ -152,7 +152,7 @@ export class ArrayCollection { isInitialized(fully = false): boolean { if (fully) { - return this.initialized && [...this.items].every((item: AnyEntity) => item.__helper!.__initialized); + return this.initialized && [...this.items].every((item: T) => helper(item).__initialized); } return this.initialized; @@ -181,11 +181,11 @@ export class ArrayCollection { */ get property(): EntityProperty { if (!this._property) { - const meta = this.owner.__meta; + const meta = helper(this.owner).__meta; /* istanbul ignore if */ if (!meta) { - throw MetadataError.missingMetadata(this.owner.constructor.name); + throw MetadataError.fromUnknownEntity((this.owner as object).constructor.name, 'Collection.property getter, maybe you just forgot to initialize the ORM?'); } const field = Object.keys(meta.properties).find(k => this.owner[k] === this); @@ -220,7 +220,7 @@ export class ArrayCollection { } } else if (this.property.reference === ReferenceType.ONE_TO_MANY && method !== 'takeSnapshot' && !(this.property.orphanRemoval && method === 'remove')) { const prop2 = this.property.targetMeta!.properties[this.property.mappedBy]; - const owner = prop2.mapToPk ? this.owner.__helper!.getPrimaryKey() : this.owner; + const owner = prop2.mapToPk ? helper(this.owner).getPrimaryKey() : this.owner; const value = method === 'add' ? owner : null; // skip if already propagated diff --git a/packages/core/src/entity/BaseEntity.ts b/packages/core/src/entity/BaseEntity.ts index c52eeeacb1cd..0646cbe4a605 100644 --- a/packages/core/src/entity/BaseEntity.ts +++ b/packages/core/src/entity/BaseEntity.ts @@ -1,20 +1,21 @@ import { Reference } from './Reference'; -import type { AnyEntity, EntityData, EntityDTO, IWrappedEntity, Loaded } from '../typings'; +import type { EntityData, EntityDTO, IWrappedEntity, Loaded } from '../typings'; import type { AssignOptions } from './EntityAssigner'; import { EntityAssigner } from './EntityAssigner'; +import { helper } from './wrap'; -export abstract class BaseEntity implements IWrappedEntity { +export abstract class BaseEntity implements IWrappedEntity { isInitialized(): boolean { - return (this as unknown as AnyEntity).__helper!.__initialized; + return helper(this as unknown as T).__initialized; } isTouched(): boolean { - return (this as unknown as AnyEntity).__helper!.__touched; + return helper(this as unknown as T).__touched; } populated(populated = true): void { - (this as unknown as AnyEntity).__helper!.populated(populated); + helper(this as unknown as T).populated(populated); } toReference() { @@ -22,7 +23,7 @@ export abstract class BaseEntity { - return (this as unknown as AnyEntity).__helper!.toObject(ignoreFields); + return helper(this as unknown as T).toObject(ignoreFields); } toJSON(...args: any[]): EntityDTO { @@ -30,7 +31,7 @@ export abstract class BaseEntity { - return (this as unknown as AnyEntity).__helper!.toPOJO(); + return helper(this as unknown as T).toPOJO(); } assign(data: EntityData, options?: AssignOptions): T { @@ -38,15 +39,15 @@ export abstract class BaseEntity(populated = true): Promise> { - return (this as unknown as AnyEntity).__helper!.init

(populated); + return helper(this as unknown as T).init

(populated); } getSchema(): string | undefined { - return (this as unknown as AnyEntity).__helper!.getSchema(); + return helper(this as unknown as T).getSchema(); } setSchema(schema?: string): void { - (this as unknown as AnyEntity).__helper!.setSchema(schema); + helper(this as unknown as T).setSchema(schema); } } diff --git a/packages/core/src/entity/Collection.ts b/packages/core/src/entity/Collection.ts index 306441ec6555..fee0c1dd2763 100644 --- a/packages/core/src/entity/Collection.ts +++ b/packages/core/src/entity/Collection.ts @@ -7,14 +7,15 @@ import { QueryOrder, ReferenceType } from '../enums'; import { Reference } from './Reference'; import type { Transaction } from '../connections/Connection'; import type { FindOptions } from '../drivers/IDatabaseDriver'; +import { helper } from './wrap'; -export interface MatchingOptions extends FindOptions { +export interface MatchingOptions extends FindOptions { where?: FilterQuery; store?: boolean; ctx?: Transaction; } -export class Collection extends ArrayCollection { +export class Collection extends ArrayCollection { private snapshot: T[] | undefined = []; // used to create a diff of the collection at commit time, undefined marks overridden values so we need to wipe when flushing private readonly?: boolean; @@ -23,14 +24,14 @@ export class Collection extends ArrayCollection { private _em?: unknown; constructor(owner: O, items?: T[], initialized = true) { - super(owner, items); + super(owner as unknown as O & AnyEntity, items); this.initialized = !!items || initialized; } /** * Creates new Collection instance, assigns it to the owning entity and sets the items to it (propagating them to their inverse sides) */ - static create(owner: O, prop: keyof O, items: undefined | T[], initialized: boolean): Collection { + static create(owner: O, prop: keyof O, items: undefined | T[], initialized: boolean): Collection { const coll = new Collection(owner, undefined, initialized); owner[prop] = coll as unknown as O[keyof O]; @@ -82,8 +83,8 @@ export class Collection extends ArrayCollection { let items: Loaded[]; if (this.property.reference === ReferenceType.MANY_TO_MANY && em.getPlatform().usesPivotTable()) { - const map = await em.getDriver().loadFromPivotTable(this.property, [this.owner.__helper!.__primaryKeys], where, opts.orderBy, ctx, options); - items = map[this.owner.__helper!.getSerializedPrimaryKey()].map((item: EntityData) => em.merge(this.property.type, item, { convertCustomTypes: true })); + const map = await em.getDriver().loadFromPivotTable(this.property, [helper(this.owner).__primaryKeys], where, opts.orderBy, ctx, options); + items = map[helper(this.owner).getSerializedPrimaryKey()].map((item: EntityData) => em.merge(this.property.type, item, { convertCustomTypes: true })); } else { items = await em.find(this.property.type, this.createCondition(where), opts); } @@ -116,14 +117,14 @@ export class Collection extends ArrayCollection { return super.toJSON(); } - add(...items: (T | Reference)[]): void { - const unwrapped = items.map(i => Reference.unwrapReference(i)); + add(...items: (T | Reference)[]): void { + const unwrapped = items.map(i => Reference.unwrapReference(i as AnyEntity)) as T[]; unwrapped.forEach(item => this.validateItemType(item)); this.modify('add', unwrapped); this.cancelOrphanRemoval(unwrapped); } - set(items: (T | Reference)[]): void { + set(items: (T | Reference)[]): void { if (!this.initialized) { this.initialized = true; this.snapshot = undefined; @@ -144,7 +145,7 @@ export class Collection extends ArrayCollection { /** * @inheritDoc */ - remove(...items: (T | Reference | ((item: T) => boolean))[]): void { + remove(...items: (T | Reference | ((item: T) => boolean))[]): void { if (items[0] instanceof Function) { for (const item of this.items) { if (items[0](item)) { @@ -155,7 +156,7 @@ export class Collection extends ArrayCollection { return; } - const unwrapped = items.map(i => Reference.unwrapReference(i as T)); + const unwrapped = items.map(i => Reference.unwrapReference(i as AnyEntity)) as T[]; this.modify('remove', unwrapped); const em = this.getEntityManager(unwrapped, false); @@ -166,7 +167,7 @@ export class Collection extends ArrayCollection { } } - contains(item: (T | Reference), check = true): boolean { + contains(item: (T | Reference), check = true): boolean { if (check) { this.checkInitialized(); } @@ -201,8 +202,8 @@ export class Collection extends ArrayCollection { const em = this.getEntityManager(); if (!this.initialized && this.property.reference === ReferenceType.MANY_TO_MANY && em.getPlatform().usesPivotTable()) { - const map = await em.getDriver().loadFromPivotTable(this.property, [this.owner.__helper!.__primaryKeys], options.where, options.orderBy, undefined, options); - this.hydrate(map[this.owner.__helper!.getSerializedPrimaryKey()].map((item: EntityData) => em.merge(this.property.type, item, { convertCustomTypes: true })), true); + const map = await em.getDriver().loadFromPivotTable(this.property, [helper(this.owner).__primaryKeys], options.where, options.orderBy, undefined, options); + this.hydrate(map[helper(this.owner).getSerializedPrimaryKey()].map((item: EntityData) => em.merge(this.property.type, item, { convertCustomTypes: true })), true); this._lazyInitialized = true; return this as unknown as LoadedCollection>; @@ -226,7 +227,7 @@ export class Collection extends ArrayCollection { orderBy: this.createOrderBy(options.orderBy), connectionType: options.connectionType, schema: this.property.targetMeta!.schema === '*' - ? this.owner.__helper!.__schema + ? helper(this.owner).__schema : this.property.targetMeta!.schema, }); @@ -270,10 +271,10 @@ export class Collection extends ArrayCollection { } private getEntityManager(items: T[] = [], required = true) { - let em = this._em ?? this.owner.__helper!.__em; + let em = this._em ?? helper(this.owner).__em; if (!em) { - for (const i of items as AnyEntity[]) { + for (const i of items as AnyEntity[]) { if (i?.__helper!.__em) { em = i?.__helper!.__em; break; @@ -294,7 +295,7 @@ export class Collection extends ArrayCollection { private createCondition(cond: FilterQuery = {} as FilterQuery): FilterQuery { if (this.property.reference === ReferenceType.ONE_TO_MANY) { - cond[this.property.mappedBy] = this.owner.__helper!.getPrimaryKey(); + cond[this.property.mappedBy] = helper(this.owner).getPrimaryKey(); } else { // MANY_TO_MANY this.createManyToManyCondition(cond); } @@ -307,7 +308,7 @@ export class Collection extends ArrayCollection { const defaultOrder = this.property.referencedColumnNames.map(name => { return { [name]: QueryOrder.ASC }; }); - orderBy = this.property.orderBy || defaultOrder; + orderBy = this.property.orderBy as QueryOrderMap || defaultOrder; } return Utils.asArray(orderBy); @@ -318,14 +319,15 @@ export class Collection extends ArrayCollection { // we know there is at least one item as it was checked in load method const pk = this.property.targetMeta!.primaryKeys[0]; cond[pk] = { $in: [] }; - this.items.forEach((item: AnyEntity) => cond[pk].$in.push(item.__helper!.getPrimaryKey())); + this.items.forEach(item => cond[pk].$in.push((item as AnyEntity).__helper!.getPrimaryKey())); } else { - cond[this.property.mappedBy] = this.owner.__helper!.getPrimaryKey(); + cond[this.property.mappedBy] = helper(this.owner).getPrimaryKey(); } } private createLoadCountCondition(cond: FilterQuery, pivotMeta?: EntityMetadata) { - const val = this.owner.__meta!.compositePK ? { $in: this.owner.__helper!.__primaryKeys } : this.owner.__helper!.getPrimaryKey(); + const wrapped = helper(this.owner); + const val = wrapped.__meta.compositePK ? { $in: wrapped.__primaryKeys } : wrapped.getPrimaryKey(); if (this.property.reference === ReferenceType.ONE_TO_MANY) { cond[this.property.mappedBy] = val; @@ -352,7 +354,7 @@ export class Collection extends ArrayCollection { private checkInitialized(): void { if (!this.isInitialized()) { - throw new Error(`Collection<${this.property.type}> of entity ${this.owner.constructor.name}[${this.owner.__helper!.getPrimaryKey()}] not initialized`); + throw new Error(`Collection<${this.property.type}> of entity ${this.owner.constructor.name}[${helper(this.owner).getPrimaryKey()}] not initialized`); } } @@ -393,8 +395,8 @@ export class Collection extends ArrayCollection { return; } - const check = (item: T & AnyEntity) => { - if (!item || item.__helper!.__initialized) { + const check = (item: AnyEntity) => { + if (!item || helper(item).__initialized) { return false; } @@ -402,7 +404,7 @@ export class Collection extends ArrayCollection { }; // throw if we are modifying inverse side of M:N collection when owning side is initialized (would be ignored when persisting) - if (items.find(item => check(item))) { + if (items.find(item => check(item as AnyEntity))) { throw ValidationError.cannotModifyInverseCollection(this.owner, this.property); } } diff --git a/packages/core/src/entity/EntityAssigner.ts b/packages/core/src/entity/EntityAssigner.ts index 34fa76730b85..8d71ef90b24a 100644 --- a/packages/core/src/entity/EntityAssigner.ts +++ b/packages/core/src/entity/EntityAssigner.ts @@ -1,25 +1,25 @@ import { inspect } from 'util'; import type { Collection } from './Collection'; import type { EntityManager } from '../EntityManager'; -import type { AnyEntity, EntityData, EntityDTO, EntityMetadata, EntityProperty, Primary, RequiredEntityData } from '../typings'; +import type { AnyEntity, Dictionary, EntityData, EntityDTO, EntityMetadata, EntityProperty, Primary, RequiredEntityData } from '../typings'; import { Utils } from '../utils/Utils'; import { Reference } from './Reference'; import { ReferenceType, SCALAR_TYPES } from '../enums'; import { EntityValidator } from './EntityValidator'; -import { wrap } from './wrap'; +import { helper, wrap } from './wrap'; const validator = new EntityValidator(false); export class EntityAssigner { - static assign>(entity: T, data: EntityData | Partial>, options: AssignOptions = {}): T { + static assign(entity: T, data: EntityData | Partial>, options: AssignOptions = {}): T { if (options.visited?.has(entity)) { return entity; } options.visited ??= new Set(); options.visited.add(entity); - const wrapped = entity.__helper!; + const wrapped = helper(entity); options = { updateNestedEntities: true, updateByPrimaryKey: true, @@ -27,7 +27,7 @@ export class EntityAssigner { schema: wrapped.__schema, ...options, // allow overriding the defaults }; - const meta = entity.__meta!; + const meta = wrapped.__meta; const em = options.em || wrapped.__em; const props = meta.properties; @@ -39,7 +39,7 @@ export class EntityAssigner { let value = data[prop]; if (props[prop] && !props[prop].nullable && value == null) { - throw new Error(`You must pass a non-${value} value to the property ${prop} of entity ${entity.constructor.name}.`); + throw new Error(`You must pass a non-${value} value to the property ${prop} of entity ${(entity as Dictionary).constructor.name}.`); } if (props[prop] && Utils.isCollection(entity[prop as keyof T]) && Array.isArray(value) && EntityAssigner.validateEM(em)) { @@ -49,12 +49,12 @@ export class EntityAssigner { const customType = props[prop]?.customType; if (options.convertCustomTypes && customType && props[prop].reference === ReferenceType.SCALAR && !Utils.isEntity(data)) { - value = props[prop].customType.convertToJSValue(value, entity.__platform); + value = props[prop].customType.convertToJSValue(value, wrapped.__platform); } if ([ReferenceType.MANY_TO_ONE, ReferenceType.ONE_TO_ONE].includes(props[prop]?.reference) && value != null && EntityAssigner.validateEM(em)) { // eslint-disable-next-line no-prototype-builtins - if (options.updateNestedEntities && entity.hasOwnProperty(prop) && Utils.isEntity(entity[prop], true) && Utils.isPlainObject(value)) { + if (options.updateNestedEntities && (entity as object).hasOwnProperty(prop) && Utils.isEntity(entity[prop], true) && Utils.isPlainObject(value)) { const unwrappedEntity = Reference.unwrapReference(entity[prop]); if (options.updateByPrimaryKey) { @@ -105,7 +105,7 @@ export class EntityAssigner { * also makes sure the link is bidirectional when creating new entities from nested structures * @internal */ - static autoWireOneToOne>(prop: EntityProperty, entity: T): void { + static autoWireOneToOne(prop: EntityProperty, entity: T): void { if (prop.reference !== ReferenceType.ONE_TO_ONE || !Utils.isEntity(entity[prop.name])) { return; } @@ -131,7 +131,7 @@ export class EntityAssigner { return true; } - private static assignReference>(entity: T, value: any, prop: EntityProperty, em: EntityManager, options: AssignOptions): void { + private static assignReference(entity: T, value: any, prop: EntityProperty, em: EntityManager, options: AssignOptions): void { if (Utils.isEntity(value, true)) { entity[prop.name] = Reference.wrapReference(value, prop); } else if (Utils.isPrimaryKey(value, true)) { @@ -141,14 +141,14 @@ export class EntityAssigner { } else if (Utils.isPlainObject(value)) { entity[prop.name] = Reference.wrapReference(em.create(prop.type, value, options), prop); } else { - const name = entity.constructor.name; + const name = (entity as object).constructor.name; throw new Error(`Invalid reference value provided for '${name}.${prop.name}' in ${name}.assign(): ${JSON.stringify(value)}`); } EntityAssigner.autoWireOneToOne(prop, entity); } - private static assignCollection, U extends AnyEntity = AnyEntity>(entity: T, collection: Collection, value: any[], prop: EntityProperty, em: EntityManager, options: AssignOptions): void { + private static assignCollection(entity: T, collection: Collection, value: any[], prop: EntityProperty, em: EntityManager, options: AssignOptions): void { const invalid: any[] = []; const items = value.map((item: any, idx) => { if (options.updateNestedEntities && options.updateByPrimaryKey && Utils.isPlainObject(item)) { @@ -158,7 +158,7 @@ export class EntityAssigner { const ref = em.getReference(prop.type, pk as Primary, options) as U; /* istanbul ignore else */ - if (ref.__helper!.isInitialized()) { + if (helper(ref).isInitialized()) { return EntityAssigner.assign(ref, item as U, options); } } @@ -167,7 +167,7 @@ export class EntityAssigner { } /* istanbul ignore next */ - if (options.updateNestedEntities && !options.updateByPrimaryKey && collection[idx]?.__helper!.isInitialized()) { + if (options.updateNestedEntities && !options.updateByPrimaryKey && helper(collection[idx])?.isInitialized()) { return EntityAssigner.assign(collection[idx], item, options); } @@ -175,14 +175,14 @@ export class EntityAssigner { }); if (invalid.length > 0) { - const name = entity.constructor.name; + const name = (entity as object).constructor.name; throw new Error(`Invalid collection values provided for '${name}.${prop.name}' in ${name}.assign(): ${inspect(invalid)}`); } collection.set(items); } - private static assignEmbeddable>(entity: T, value: any, prop: EntityProperty, em: EntityManager | undefined, options: AssignOptions): void { + private static assignEmbeddable(entity: T, value: any, prop: EntityProperty, em: EntityManager | undefined, options: AssignOptions): void { const propName = prop.embedded ? prop.embedded[1] : prop.name; if (!value) { @@ -220,7 +220,7 @@ export class EntityAssigner { }); } - private static createCollectionItem>(item: any, em: EntityManager, prop: EntityProperty, invalid: any[], options: AssignOptions): T { + private static createCollectionItem(item: any, em: EntityManager, prop: EntityProperty, invalid: any[], options: AssignOptions): T { if (Utils.isEntity(item)) { return item; } diff --git a/packages/core/src/entity/EntityFactory.ts b/packages/core/src/entity/EntityFactory.ts index f1c990c2fa11..9284fd8ca372 100644 --- a/packages/core/src/entity/EntityFactory.ts +++ b/packages/core/src/entity/EntityFactory.ts @@ -1,8 +1,9 @@ import { Utils } from '../utils/Utils'; -import type { AnyEntity, Dictionary, EntityData, EntityMetadata, EntityName, EntityProperty, New, Primary } from '../typings'; +import type { Dictionary, EntityData, EntityMetadata, EntityName, EntityProperty, New, Primary } from '../typings'; import type { EntityManager } from '../EntityManager'; import { EventType, ReferenceType } from '../enums'; import { Reference } from './Reference'; +import { helper } from './wrap'; export interface FactoryOptions { initialized?: boolean; @@ -25,7 +26,7 @@ export class EntityFactory { constructor(private readonly em: EntityManager) { } - create, P extends string = string>(entityName: EntityName, data: EntityData, options: FactoryOptions = {}): New { + create(entityName: EntityName, data: EntityData, options: FactoryOptions = {}): New { data = Reference.unwrapReference(data); options.initialized ??= true; @@ -51,27 +52,27 @@ export class EntityFactory { const meta2 = this.processDiscriminatorColumn(meta, data); const exists = this.findEntity(data, meta2, options); - if (exists && exists.__helper!.__initialized && !options.refresh) { - exists.__helper!.__processing = true; - exists.__helper!.__initialized = options.initialized; + if (exists && helper(exists).__initialized && !options.refresh) { + helper(exists).__processing = true; + helper(exists).__initialized = options.initialized; this.mergeData(meta2, exists, data, options); - exists.__helper!.__processing = false; + helper(exists).__processing = false; return exists as New; } data = { ...data }; const entity = exists ?? this.createEntity(data, meta2, options); - entity.__helper!.__processing = true; - entity.__helper!.__initialized = options.initialized; + helper(entity).__processing = true; + helper(entity).__initialized = options.initialized; this.hydrate(entity, meta2, data, options); - entity.__helper!.__touched = false; + helper(entity).__touched = false; if (exists && meta.discriminatorColumn && !(entity instanceof meta2.class)) { - Object.setPrototypeOf(entity, meta2.prototype); + Object.setPrototypeOf(entity, meta2.prototype as object); } - if (options.merge && entity.__helper!.hasPrimaryKey()) { + if (options.merge && helper(entity).hasPrimaryKey()) { this.unitOfWork.registerManaged(entity, data, { refresh: options.refresh && options.initialized, newEntity: options.newEntity, @@ -83,16 +84,16 @@ export class EntityFactory { this.eventManager.dispatchEvent(EventType.onInit, { entity, em: this.em }); } - entity.__helper!.__processing = false; + helper(entity).__processing = false; return entity as New; } - mergeData>(meta: EntityMetadata, entity: T, data: EntityData, options: FactoryOptions): void { + mergeData(meta: EntityMetadata, entity: T, data: EntityData, options: FactoryOptions): void { // merge unchanged properties automatically data = { ...data }; const existsData = this.comparator.prepareEntity(entity); - const originalEntityData = entity.__helper!.__originalEntityData ?? {} as EntityData; + const originalEntityData = helper(entity).__originalEntityData ?? {} as EntityData; const diff = this.comparator.diffEntities(meta.className, originalEntityData, existsData); // version properties are not part of entity snapshots @@ -112,11 +113,11 @@ export class EntityFactory { const prop = meta.properties[key]; if ([ReferenceType.MANY_TO_ONE, ReferenceType.ONE_TO_ONE].includes(prop.reference) && Utils.isPlainObject(data[prop.name])) { - diff2[key] = (entity[prop.name] as AnyEntity).__helper!.getPrimaryKey(options.convertCustomTypes); + diff2[key] = helper(entity[prop.name]).getPrimaryKey(options.convertCustomTypes); } originalEntityData[key] = diff2[key]; - entity.__helper!.__loadedProperties.add(key); + helper(entity).__loadedProperties.add(key); }); // in case of joined loading strategy, we need to cascade the merging to possibly loaded relations manually @@ -131,15 +132,15 @@ export class EntityFactory { return; } - if ([ReferenceType.MANY_TO_ONE, ReferenceType.ONE_TO_ONE].includes(prop.reference) && Utils.isPlainObject(data[prop.name as string]) && entity[prop.name] && (entity[prop.name] as AnyEntity).__helper!.__initialized) { + if ([ReferenceType.MANY_TO_ONE, ReferenceType.ONE_TO_ONE].includes(prop.reference) && Utils.isPlainObject(data[prop.name as string]) && entity[prop.name] && helper(entity[prop.name]).__initialized) { this.create(prop.type, data[prop.name as string] as EntityData, options); // we can ignore the value, we just care about the `mergeData` call } }); - entity.__helper!.__touched = false; + helper(entity).__touched = false; } - createReference(entityName: EntityName, id: Primary | Primary[] | Record>, options: Pick = {}): T { + createReference(entityName: EntityName, id: Primary | Primary[] | Record>, options: Pick = {}): T { options.convertCustomTypes ??= true; entityName = Utils.className(entityName); const meta = this.metadata.get(entityName); @@ -164,7 +165,7 @@ export class EntityFactory { return this.create(entityName, id as EntityData, { ...options, initialized: false }) as T; } - createEmbeddable(entityName: EntityName, data: EntityData, options: Pick = {}): T { + createEmbeddable(entityName: EntityName, data: EntityData, options: Pick = {}): T { entityName = Utils.className(entityName); data = { ...data }; const meta = this.metadata.get(entityName); @@ -173,7 +174,7 @@ export class EntityFactory { return this.createEntity(data, meta2, options); } - private createEntity>(data: EntityData, meta: EntityMetadata, options: FactoryOptions): T { + private createEntity(data: EntityData, meta: EntityMetadata, options: FactoryOptions): T { if (options.newEntity || meta.forceConstructor || meta.virtual) { if (!meta.class) { throw new Error(`Cannot create entity ${meta.className}, class prototype is unknown`); @@ -191,7 +192,7 @@ export class EntityFactory { return entity; } - entity.__helper!.__schema = this.driver.getSchemaName(meta, options); + helper(entity).__schema = this.driver.getSchemaName(meta, options); if (!options.newEntity) { meta.relations @@ -208,9 +209,9 @@ export class EntityFactory { // creates new entity instance, bypassing constructor call as its already persisted entity const entity = Object.create(meta.class.prototype) as T; - entity.__helper!.__managed = true; - entity.__helper!.__processing = !meta.embeddable && !meta.virtual; - entity.__helper!.__schema = this.driver.getSchemaName(meta, options); + helper(entity).__managed = true; + helper(entity).__processing = !meta.embeddable && !meta.virtual; + helper(entity).__schema = this.driver.getSchemaName(meta, options); if (options.merge && !options.newEntity) { this.hydrator.hydrateReference(entity, meta, data, this, options.convertCustomTypes, this.driver.getSchemaName(meta, options)); @@ -224,16 +225,16 @@ export class EntityFactory { return entity; } - private hydrate>(entity: T, meta: EntityMetadata, data: EntityData, options: FactoryOptions): void { + private hydrate(entity: T, meta: EntityMetadata, data: EntityData, options: FactoryOptions): void { if (options.initialized) { this.hydrator.hydrate(entity, meta, data, this, 'full', options.newEntity, options.convertCustomTypes, this.driver.getSchemaName(meta, options)); } else { this.hydrator.hydrateReference(entity, meta, data, this, options.convertCustomTypes, this.driver.getSchemaName(meta, options)); } - Object.keys(data).forEach(key => entity.__helper?.__loadedProperties.add(key)); + Object.keys(data).forEach(key => helper(entity)?.__loadedProperties.add(key)); } - private findEntity(data: EntityData, meta: EntityMetadata, options: FactoryOptions): T | undefined { + private findEntity(data: EntityData, meta: EntityMetadata, options: FactoryOptions): T | undefined { const schema = this.driver.getSchemaName(meta, options); if (!meta.compositePK && !meta.getPrimaryProps()[0]?.customType) { @@ -249,7 +250,7 @@ export class EntityFactory { return this.unitOfWork.getById(meta.name!, pks, schema); } - private processDiscriminatorColumn(meta: EntityMetadata, data: EntityData): EntityMetadata { + private processDiscriminatorColumn(meta: EntityMetadata, data: EntityData): EntityMetadata { if (!meta.root.discriminatorColumn) { return meta; } diff --git a/packages/core/src/entity/EntityHelper.ts b/packages/core/src/entity/EntityHelper.ts index 243bf3d02a48..5e2953702fea 100644 --- a/packages/core/src/entity/EntityHelper.ts +++ b/packages/core/src/entity/EntityHelper.ts @@ -8,12 +8,13 @@ import type { Platform } from '../platforms'; import { Utils } from '../utils/Utils'; import { WrappedEntity } from './WrappedEntity'; import { ReferenceType } from '../enums'; +import { helper } from './wrap'; const entityHelperSymbol = Symbol('helper'); export class EntityHelper { - static decorate>(meta: EntityMetadata, em: EntityManager): void { + static decorate(meta: EntityMetadata, em: EntityManager): void { const fork = em.fork(); // use fork so we can access `EntityFactory` if (meta.embeddable) { @@ -41,7 +42,7 @@ export class EntityHelper { /** * defines magic id property getter/setter if PK property is `_id` and there is no `id` property defined */ - private static defineIdProperty>(meta: EntityMetadata, platform: Platform): void { + private static defineIdProperty(meta: EntityMetadata, platform: Platform): void { Object.defineProperty(meta.prototype, 'id', { get(): string | null { return this._id ? platform.normalizePrimaryKey(this._id) : null; @@ -58,7 +59,7 @@ export class EntityHelper { * prototype, that will be executed exactly once per entity instance. There we redefine given * property on the entity instance, so shadowing the prototype setter. */ - private static defineBaseProperties>(meta: EntityMetadata, prototype: T, em: EntityManager) { + private static defineBaseProperties(meta: EntityMetadata, prototype: T, em: EntityManager) { const helperParams = meta.embeddable ? [] : [em.getComparator().getPkGetter(meta), em.getComparator().getPkSerializer(meta), em.getComparator().getPkGetterConverted(meta)]; Object.defineProperties(prototype, { __entity: { value: !meta.embeddable }, @@ -89,9 +90,9 @@ export class EntityHelper { * First defines a setter on the prototype, once called, actual get/set handlers are registered on the instance rather * than on its prototype. Thanks to this we still have those properties enumerable (e.g. part of `Object.keys(entity)`). */ - private static defineProperties>(meta: EntityMetadata): void { + private static defineProperties(meta: EntityMetadata): void { Object - .values(meta.properties) + .values>(meta.properties) .forEach(prop => { const isCollection = [ReferenceType.ONE_TO_MANY, ReferenceType.MANY_TO_MANY].includes(prop.reference); const isReference = [ReferenceType.ONE_TO_ONE, ReferenceType.MANY_TO_ONE].includes(prop.reference) && (prop.inversedBy || prop.mappedBy) && !prop.mapToPk; @@ -131,10 +132,10 @@ export class EntityHelper { meta.prototype[inspect.custom] ??= function (this: T, depth: number) { const object = { ...this }; const ret = inspect(object, { depth }); - let name = this.constructor.name; + let name = (this as object).constructor.name; // distinguish not initialized entities - if (!this.__helper!.__initialized) { + if (!helper(this).__initialized) { name = `Ref<${name}>`; } @@ -142,7 +143,7 @@ export class EntityHelper { }; } - static defineReferenceProperty>(meta: EntityMetadata, prop: EntityProperty, ref: T): void { + static defineReferenceProperty(meta: EntityMetadata, prop: EntityProperty, ref: T): void { Object.defineProperty(ref, prop.name, { get() { return this.__helper.__data[prop.name]; @@ -158,7 +159,7 @@ export class EntityHelper { }); } - private static propagate, O extends AnyEntity>(meta: EntityMetadata, entity: T, owner: O, prop: EntityProperty, value?: O[keyof O]): void { + private static propagate(meta: EntityMetadata, entity: T, owner: O, prop: EntityProperty, value?: O[keyof O]): void { const inverseProps = prop.targetMeta!.relations.filter(prop2 => (prop2.inversedBy || prop2.mappedBy) === prop.name && prop2.targetMeta!.root.className === meta.root.className); for (const prop2 of inverseProps) { @@ -168,20 +169,20 @@ export class EntityHelper { inverse.add(owner); } - if (prop.reference === ReferenceType.ONE_TO_ONE && entity && entity.__helper!.__initialized && Reference.unwrapReference(inverse) !== owner && value != null) { + if (prop.reference === ReferenceType.ONE_TO_ONE && entity && helper(entity).__initialized && Reference.unwrapReference(inverse) !== owner && value != null) { EntityHelper.propagateOneToOne(entity, owner, prop, prop2); } - if (prop.reference === ReferenceType.ONE_TO_ONE && entity && entity.__helper!.__initialized && entity[prop2.name] != null && value == null) { + if (prop.reference === ReferenceType.ONE_TO_ONE && entity && helper(entity).__initialized && entity[prop2.name] != null && value == null) { entity[prop2.name] = value; if (prop.orphanRemoval) { - entity.__helper!.__em?.getUnitOfWork().scheduleOrphanRemoval(entity); + helper(entity).__em?.getUnitOfWork().scheduleOrphanRemoval(entity); } } } } - private static propagateOneToOne(entity: T, owner: O, prop: EntityProperty, prop2: EntityProperty): void { + private static propagateOneToOne(entity: T, owner: O, prop: EntityProperty, prop2: EntityProperty): void { const inverse = entity[prop2.name]; if (Reference.isReference(inverse)) { diff --git a/packages/core/src/entity/EntityLoader.ts b/packages/core/src/entity/EntityLoader.ts index 4a184abb18ab..13fc78e3c84a 100644 --- a/packages/core/src/entity/EntityLoader.ts +++ b/packages/core/src/entity/EntityLoader.ts @@ -38,12 +38,12 @@ export class EntityLoader { /** * Loads specified relations in batch. This will execute one query for each relation, that will populate it on all of the specified entities. */ - async populate, P extends string = never>(entityName: string, entities: T[], populate: PopulateOptions[] | boolean, options: EntityLoaderOptions): Promise { + async populate(entityName: string, entities: T[], populate: PopulateOptions[] | boolean, options: EntityLoaderOptions): Promise { if (entities.length === 0 || populate === false) { return; } - if (entities.some(e => !e.__helper)) { + if ((entities as AnyEntity[]).some(e => !e.__helper)) { const entity = entities.find(e => !Utils.isEntity(e)); const meta = this.metadata.find(entityName)!; throw ValidationError.notDiscoveredEntity(entity, meta, 'populate'); @@ -64,7 +64,7 @@ export class EntityLoader { throw ValidationError.invalidPropertyName(entityName, invalid.field); } - entities.forEach(e => e.__helper!.__serializationContext.populate = e.__helper!.__serializationContext.populate ?? populate as PopulateOptions[]); + (entities as AnyEntity[]).forEach(e => e.__helper!.__serializationContext.populate = e.__helper!.__serializationContext.populate ?? populate as PopulateOptions[]); for (const pop of populate) { await this.populateField(entityName, entities, pop, options as Required>); @@ -147,7 +147,7 @@ export class EntityLoader { /** * preload everything in one call (this will update already existing references in IM) */ - private async populateMany>(entityName: string, entities: T[], populate: PopulateOptions, options: Required>): Promise { + private async populateMany(entityName: string, entities: T[], populate: PopulateOptions, options: Required>): Promise { const field = populate.field as keyof T; const meta = this.metadata.find(entityName)!; const prop = meta.properties[field as string] as EntityProperty; @@ -156,7 +156,7 @@ export class EntityLoader { const filtered = entities.filter(e => options.refresh || e[prop.name] === undefined); if (options.ignoreLazyScalarProperties || filtered.length === 0) { - return entities; + return entities as AnyEntity[]; } const pk = Utils.getPrimaryKeyHash(meta.primaryKeys); @@ -170,7 +170,7 @@ export class EntityLoader { populate: [], }); - return entities; + return entities as AnyEntity[]; } if (prop.reference === ReferenceType.EMBEDDED) { @@ -184,7 +184,7 @@ export class EntityLoader { if (Utils.isEntity(value, true)) { (value as AnyEntity).__helper!.populated(); } else if (Utils.isCollection(value)) { - value.populated(); + (value as Collection).populated(); } }); @@ -204,7 +204,7 @@ export class EntityLoader { return data; } - private initializeCollections>(filtered: T[], prop: EntityProperty, field: keyof T, children: AnyEntity[]): void { + private initializeCollections(filtered: T[], prop: EntityProperty, field: keyof T, children: AnyEntity[]): void { if (prop.reference === ReferenceType.ONE_TO_MANY) { this.initializeOneToMany(filtered, children, prop, field); } @@ -214,8 +214,8 @@ export class EntityLoader { } } - private initializeOneToMany>(filtered: T[], children: AnyEntity[], prop: EntityProperty, field: keyof T): void { - for (const entity of filtered) { + private initializeOneToMany(filtered: T[], children: AnyEntity[], prop: EntityProperty, field: keyof T): void { + for (const entity of (filtered as (T & AnyEntity)[])) { const items = children.filter(child => { if (prop.targetMeta!.properties[prop.mappedBy].mapToPk) { return child[prop.mappedBy] as unknown === entity.__helper!.getPrimaryKey(); @@ -228,14 +228,14 @@ export class EntityLoader { } } - private initializeManyToMany>(filtered: T[], children: AnyEntity[], prop: EntityProperty, field: keyof T): void { - for (const entity of filtered) { + private initializeManyToMany(filtered: T[], children: AnyEntity[], prop: EntityProperty, field: keyof T): void { + for (const entity of (filtered as (T & AnyEntity)[])) { const items = children.filter(child => (child[prop.mappedBy] as unknown as Collection).contains(entity)); (entity[field] as unknown as Collection).hydrate(items, true); } } - private async findChildren>(entities: T[], prop: EntityProperty, populate: PopulateOptions, options: Required>): Promise { + private async findChildren(entities: T[], prop: EntityProperty, populate: PopulateOptions, options: Required>): Promise { const children = this.getChildReferences(entities, prop, options.refresh); const meta = this.metadata.find(prop.type)!; let fk = Utils.getPrimaryKeyHash(meta.primaryKeys); @@ -248,7 +248,7 @@ export class EntityLoader { if (prop.reference === ReferenceType.ONE_TO_ONE && !prop.owner && populate.strategy !== LoadStrategy.JOINED && !this.em.config.get('autoJoinOneToOneOwner')) { children.length = 0; fk = meta.properties[prop.mappedBy].name; - children.push(...this.filterByReferences(entities, prop.name, options.refresh)); + children.push(...this.filterByReferences(entities, prop.name, options.refresh) as AnyEntity[]); } if (children.length === 0) { @@ -280,7 +280,7 @@ export class EntityLoader { : { ...cond1, ...(options.where as Dictionary) }; } - private async populateField>(entityName: string, entities: T[], populate: PopulateOptions, options: Required>): Promise { + private async populateField(entityName: string, entities: T[], populate: PopulateOptions, options: Required>): Promise { const prop = this.metadata.find(entityName)!.properties[populate.field] as EntityProperty; if (prop.reference === ReferenceType.SCALAR && !prop.lazy) { @@ -327,12 +327,12 @@ export class EntityLoader { }); } - private async findChildrenFromPivotTable>(filtered: T[], prop: EntityProperty, options: Required>, orderBy?: QueryOrderMap[], populate?: PopulateOptions): Promise { - const ids = filtered.map((e: AnyEntity) => e.__helper!.__primaryKeys); + private async findChildrenFromPivotTable(filtered: T[], prop: EntityProperty, options: Required>, orderBy?: QueryOrderMap[], populate?: PopulateOptions): Promise { + const ids = (filtered as AnyEntity[]).map(e => e.__helper!.__primaryKeys); const refresh = options.refresh; const where = await this.extractChildCondition(options, prop, true); const fields = this.buildFields(options.fields, prop); - const options2 = { ...options } as FindOptions; + const options2 = { ...options } as FindOptions; delete options2.limit; delete options2.offset; options2.fields = fields; @@ -342,20 +342,20 @@ export class EntityLoader { ids.forEach((id, idx) => ids[idx] = QueryHelper.processCustomType(prop, id as FilterQuery, this.driver.getPlatform()) as Primary[]); } - const map = await this.driver.loadFromPivotTable(prop, ids, where, orderBy, this.em.getTransactionContext(), options2); + const map = await this.driver.loadFromPivotTable(prop, ids, where, orderBy, this.em.getTransactionContext(), options2); const children: AnyEntity[] = []; - for (const entity of filtered) { + for (const entity of (filtered as AnyEntity[])) { const items = map[entity.__helper!.getSerializedPrimaryKey()].map(item => { - const entity = this.em.getEntityFactory().create(prop.type, item, { + const entity = this.em.getEntityFactory().create(prop.type, item, { refresh, merge: true, convertCustomTypes: true, schema: options.schema ?? this.em.config.get('schema'), }); - return this.em.getUnitOfWork().registerManaged(entity, item, { refresh, loaded: true }); + return this.em.getUnitOfWork().registerManaged(entity as AnyEntity, item, { refresh, loaded: true }); }); - (entity[prop.name] as unknown as Collection).hydrate(items, true); + (entity[prop.name as string] as unknown as Collection).hydrate(items, true); children.push(...items); } @@ -439,24 +439,24 @@ export class EntityLoader { return ret; } - private getChildReferences>(entities: T[], prop: EntityProperty, refresh: boolean): AnyEntity[] { + private getChildReferences(entities: T[], prop: EntityProperty, refresh: boolean): AnyEntity[] { const filtered = this.filterCollections(entities, prop.name, refresh); const children: AnyEntity[] = []; if (prop.reference === ReferenceType.ONE_TO_MANY) { - children.push(...filtered.map(e => (e[prop.name] as unknown as Collection).owner)); + children.push(...filtered.map(e => (e[prop.name] as unknown as Collection).owner)); } else if (prop.reference === ReferenceType.MANY_TO_MANY && prop.owner) { children.push(...filtered.reduce((a, b) => [...a, ...(b[prop.name] as unknown as Collection).getItems()], [] as AnyEntity[])); } else if (prop.reference === ReferenceType.MANY_TO_MANY) { // inverse side - children.push(...filtered); + children.push(...filtered as AnyEntity[]); } else { // MANY_TO_ONE or ONE_TO_ONE - children.push(...this.filterReferences(entities, prop.name, refresh)); + children.push(...this.filterReferences(entities, prop.name, refresh) as AnyEntity[]); } return children; } - private filterCollections>(entities: T[], field: keyof T, refresh: boolean): T[] { + private filterCollections(entities: T[], field: keyof T, refresh: boolean): T[] { if (refresh) { return entities.filter(e => e[field]); } @@ -464,17 +464,17 @@ export class EntityLoader { return entities.filter(e => Utils.isCollection(e[field]) && !(e[field] as unknown as Collection).isInitialized(true)); } - private filterReferences>(entities: T[], field: keyof T, refresh: boolean): T[keyof T][] { + private filterReferences(entities: T[], field: keyof T, refresh: boolean): T[keyof T][] { const children = entities.filter(e => Utils.isEntity(e[field], true)); if (refresh) { - return children.map(e => Reference.unwrapReference(e[field])); + return children.map(e => Reference.unwrapReference(e[field] as AnyEntity)) as T[keyof T][]; } - return children.filter(e => !(e[field] as AnyEntity).__helper!.__initialized).map(e => Reference.unwrapReference(e[field])); + return children.filter(e => !(e[field] as AnyEntity).__helper!.__initialized).map(e => Reference.unwrapReference(e[field] as AnyEntity)) as T[keyof T][]; } - private filterByReferences>(entities: T[], field: keyof T, refresh: boolean): T[] { + private filterByReferences(entities: T[], field: keyof T, refresh: boolean): T[] { /* istanbul ignore next */ if (refresh) { return entities; diff --git a/packages/core/src/entity/EntityRepository.ts b/packages/core/src/entity/EntityRepository.ts index 5c2993d74752..72f85469e32d 100644 --- a/packages/core/src/entity/EntityRepository.ts +++ b/packages/core/src/entity/EntityRepository.ts @@ -4,7 +4,7 @@ import type { CountOptions, DeleteOptions, FindOneOptions, FindOneOrFailOptions, import type { IdentifiedReference, Reference } from './Reference'; import type { EntityLoaderOptions } from './EntityLoader'; -export class EntityRepository> { +export class EntityRepository { constructor(protected readonly _em: EntityManager, protected readonly entityName: EntityName) { } @@ -206,7 +206,7 @@ export class EntityRepository> { * Returns total number of entities matching your `where` query. */ async count

(where: FilterQuery = {} as FilterQuery, options: CountOptions = {}): Promise { - return this.em.count(this.entityName, where, options); + return this.em.count(this.entityName, where, options); } protected get em(): EntityManager { diff --git a/packages/core/src/entity/EntityTransformer.ts b/packages/core/src/entity/EntityTransformer.ts index 5fd66ec73691..04ca38e10394 100644 --- a/packages/core/src/entity/EntityTransformer.ts +++ b/packages/core/src/entity/EntityTransformer.ts @@ -1,7 +1,7 @@ import type { Collection } from './Collection'; import type { AnyEntity, EntityData, EntityMetadata, IPrimaryKey, PopulateOptions } from '../typings'; import type { Reference } from './Reference'; -import { wrap } from './wrap'; +import { helper, wrap } from './wrap'; import type { Platform } from '../platforms'; import { Utils } from '../utils/Utils'; @@ -10,7 +10,7 @@ import { Utils } from '../utils/Utils'; * Before we process a property, we call `visit` that checks if it is not a cycle path (but allows to pass cycles that * are defined in populate hint). If not, we proceed and call `leave` afterwards. */ -export class SerializationContext> { +export class SerializationContext { readonly path: [string, string][] = []; readonly visited = new Set(); @@ -44,7 +44,7 @@ export class SerializationContext> { close() { this.entities.forEach(entity => { - delete entity.__helper!.__serializationContext.root; + delete helper(entity).__serializationContext.root; }); } @@ -87,7 +87,7 @@ export class SerializationContext> { } private register(entity: AnyEntity) { - entity.__helper!.__serializationContext.root = this; + helper(entity).__serializationContext.root = this; this.entities.add(entity); } @@ -95,12 +95,12 @@ export class SerializationContext> { export class EntityTransformer { - static toObject>(entity: T, ignoreFields: string[] = [], raw = false): EntityData { + static toObject(entity: T, ignoreFields: string[] = [], raw = false): EntityData { if (!Array.isArray(ignoreFields)) { ignoreFields = []; } - const wrapped = entity.__helper!; + const wrapped = helper(entity); let contextCreated = false; if (!wrapped.__serializationContext.root) { @@ -110,7 +110,7 @@ export class EntityTransformer { } const root = wrapped.__serializationContext.root!; - const meta = entity.__meta!; + const meta = wrapped.__meta; const ret = {} as EntityData; const keys = new Set(); @@ -121,7 +121,7 @@ export class EntityTransformer { } if (wrapped.isInitialized() || !wrapped.hasPrimaryKey()) { - Object.keys(entity).forEach(prop => keys.add(prop)); + Object.keys(entity as object).forEach(prop => keys.add(prop)); } const visited = root.visited.has(entity); @@ -148,7 +148,7 @@ export class EntityTransformer { return [prop, val]; }) .filter(([, value]) => typeof value !== 'undefined') - .forEach(([prop, value]) => ret[this.propertyName(meta, prop as keyof T & string, entity.__platform)] = value as T[keyof T & string]); + .forEach(([prop, value]) => ret[this.propertyName(meta, prop as keyof T & string, wrapped.__platform)] = value as T[keyof T & string]); if (!visited) { root.visited.delete(entity); @@ -161,12 +161,12 @@ export class EntityTransformer { // decorated getters meta.props .filter(prop => prop.getter && !prop.hidden && typeof entity[prop.name] !== 'undefined') - .forEach(prop => ret[this.propertyName(meta, prop.name, entity.__platform)] = entity[prop.name]); + .forEach(prop => ret[this.propertyName(meta, prop.name, wrapped.__platform)] = entity[prop.name]); // decorated get methods meta.props .filter(prop => prop.getterName && !prop.hidden && entity[prop.getterName] as unknown instanceof Function) - .forEach(prop => ret[this.propertyName(meta, prop.name, entity.__platform)] = (entity[prop.getterName!] as unknown as () => T[keyof T & string])()); + .forEach(prop => ret[this.propertyName(meta, prop.name, wrapped.__platform)] = (entity[prop.getterName!] as unknown as () => T[keyof T & string])()); if (contextCreated) { root.close(); @@ -175,7 +175,7 @@ export class EntityTransformer { return ret; } - private static isVisible>(meta: EntityMetadata, propName: string, ignoreFields: string[]): boolean { + private static isVisible(meta: EntityMetadata, propName: string, ignoreFields: string[]): boolean { const prop = meta.properties[propName]; const visible = prop && !prop.hidden; const prefixed = prop && !prop.primary && propName.startsWith('_'); // ignore prefixed properties, if it's not a PK @@ -183,7 +183,7 @@ export class EntityTransformer { return visible && !prefixed && !ignoreFields.includes(propName); } - private static propertyName>(meta: EntityMetadata, prop: keyof T & string, platform?: Platform): string { + private static propertyName(meta: EntityMetadata, prop: keyof T & string, platform?: Platform): string { if (meta.properties[prop].serializedName) { return meta.properties[prop].serializedName as keyof T & string; } @@ -195,8 +195,9 @@ export class EntityTransformer { return prop; } - private static processProperty>(prop: keyof T & string, entity: T, raw: boolean): T[keyof T] | undefined { - const property = entity.__meta!.properties[prop]; + private static processProperty(prop: keyof T & string, entity: T, raw: boolean): T[keyof T] | undefined { + const wrapped = helper(entity); + const property = wrapped.__meta.properties[prop]; const serializer = property?.serializer; if (serializer) { @@ -208,21 +209,21 @@ export class EntityTransformer { } if (Utils.isEntity(entity[prop], true)) { - return EntityTransformer.processEntity(prop, entity, entity.__platform!, raw); + return EntityTransformer.processEntity(prop, entity, wrapped.__platform, raw); } const customType = property?.customType; if (customType) { - return customType.toJSON(entity[prop], entity.__platform!); + return customType.toJSON(entity[prop], wrapped.__platform); } - return entity.__platform!.normalizePrimaryKey(entity[prop] as unknown as IPrimaryKey) as unknown as T[keyof T]; + return wrapped.__platform.normalizePrimaryKey(entity[prop] as unknown as IPrimaryKey) as unknown as T[keyof T]; } - private static processEntity>(prop: keyof T, entity: T, platform: Platform, raw: boolean): T[keyof T] | undefined { + private static processEntity(prop: keyof T, entity: T, platform: Platform, raw: boolean): T[keyof T] | undefined { const child = entity[prop] as unknown as T | Reference; - const wrapped = (child as T).__helper!; + const wrapped = helper(child); if (raw && wrapped.isInitialized() && child !== entity) { return wrapped.toPOJO() as unknown as T[keyof T]; @@ -236,7 +237,7 @@ export class EntityTransformer { return platform.normalizePrimaryKey(wrapped.getPrimaryKey() as IPrimaryKey) as unknown as T[keyof T]; } - private static processCollection>(prop: keyof T, entity: T, raw: boolean): T[keyof T] | undefined { + private static processCollection(prop: keyof T, entity: T, raw: boolean): T[keyof T] | undefined { const col = entity[prop] as unknown as Collection; if (raw && col.isInitialized(true)) { diff --git a/packages/core/src/entity/EntityValidator.ts b/packages/core/src/entity/EntityValidator.ts index ff8a22c53a1f..a228deaaad0b 100644 --- a/packages/core/src/entity/EntityValidator.ts +++ b/packages/core/src/entity/EntityValidator.ts @@ -1,13 +1,14 @@ -import type { AnyEntity, Dictionary, EntityData, EntityMetadata, EntityProperty, FilterQuery } from '../typings'; +import type { Dictionary, EntityData, EntityMetadata, EntityProperty, FilterQuery } from '../typings'; import { ReferenceType } from '../enums'; import { Utils } from '../utils/Utils'; import { ValidationError } from '../errors'; +import { helper } from './wrap'; export class EntityValidator { constructor(private strict: boolean) { } - validate>(entity: T, payload: any, meta: EntityMetadata): void { + validate(entity: T, payload: any, meta: EntityMetadata): void { meta.props.forEach(prop => { if (prop.inherited) { return; @@ -38,8 +39,10 @@ export class EntityValidator { }); } - validateRequired>(entity: T): void { - for (const prop of entity.__meta!.props) { + validateRequired(entity: T): void { + const wrapped = helper(entity); + + for (const prop of wrapped.__meta.props) { if ( !prop.nullable && !prop.autoincrement && @@ -47,7 +50,7 @@ export class EntityValidator { !prop.defaultRaw && !prop.onCreate && !prop.embedded && - prop.name !== entity.__meta!.root.discriminatorColumn && + prop.name !== wrapped.__meta.root.discriminatorColumn && prop.type.toLowerCase() !== 'objectid' && prop.persist !== false && entity[prop.name] == null @@ -57,7 +60,7 @@ export class EntityValidator { } } - validateProperty>(prop: EntityProperty, givenValue: any, entity: T) { + validateProperty(prop: EntityProperty, givenValue: any, entity: T) { if (givenValue === null || givenValue === undefined) { return givenValue; } @@ -84,7 +87,7 @@ export class EntityValidator { } if (Array.isArray(params)) { - return params.forEach((item: any) => this.validateParams(item, type, field)); + return (params as unknown[]).forEach(item => this.validateParams(item, type, field)); } if (Utils.isPlainObject(params)) { @@ -94,7 +97,7 @@ export class EntityValidator { } } - validatePrimaryKey>(entity: EntityData, meta: EntityMetadata): void { + validatePrimaryKey(entity: EntityData, meta: EntityMetadata): void { const pkExists = meta.primaryKeys.every(pk => entity[pk] != null) || entity[meta.serializedPrimaryKey] != null; if (!entity || !pkExists) { @@ -102,7 +105,7 @@ export class EntityValidator { } } - validateEmptyWhere>(where: FilterQuery): void { + validateEmptyWhere(where: FilterQuery): void { if (Utils.isEmpty(where)) { throw new Error(`You cannot call 'EntityManager.findOne()' with empty 'where' parameter`); } @@ -125,8 +128,8 @@ export class EntityValidator { o[prop.name] = v; } - private validateCollection>(entity: T, prop: EntityProperty): void { - if (entity.__helper!.__initialized && !entity[prop.name as keyof T]) { + private validateCollection(entity: T, prop: EntityProperty): void { + if (helper(entity).__initialized && !entity[prop.name as keyof T]) { throw ValidationError.fromCollectionNotInitialized(entity, prop); } } diff --git a/packages/core/src/entity/Reference.ts b/packages/core/src/entity/Reference.ts index a6b8a8ecd0a7..cb28e649cbf6 100644 --- a/packages/core/src/entity/Reference.ts +++ b/packages/core/src/entity/Reference.ts @@ -1,18 +1,18 @@ import type { - Populate, AnyEntity, Cast, Constructor, Dictionary, EntityProperty, IsUnknown, Primary, + Populate, Cast, Constructor, Dictionary, EntityProperty, IsUnknown, Primary, PrimaryProperty, ConnectionType, } from '../typings'; import type { EntityFactory } from './EntityFactory'; import type { LockMode } from '../enums'; -import { wrap } from './wrap'; +import { helper, wrap } from './wrap'; -export type IdentifiedReference, PK extends keyof T | unknown = PrimaryProperty> = true extends IsUnknown ? Reference : ({ [K in Cast]: T[K] } & Reference); +export type IdentifiedReference> = true extends IsUnknown ? Reference : ({ [K in Cast]: T[K] } & Reference); -export class Reference> { +export class Reference { constructor(private entity: T) { this.set(entity); - const meta = this.entity.__meta!; + const meta = helper(this.entity).__meta; meta.primaryKeys.forEach(primaryKey => { Object.defineProperty(this, primaryKey, { @@ -25,13 +25,13 @@ export class Reference> { if (meta.serializedPrimaryKey && meta.primaryKeys[0] !== meta.serializedPrimaryKey) { Object.defineProperty(this, meta.serializedPrimaryKey, { get() { - return this.entity.__helper!.getSerializedPrimaryKey(); + return helper(this.entity).getSerializedPrimaryKey(); }, }); } } - static create, PK extends keyof T | unknown = PrimaryProperty>(entity: T | IdentifiedReference): IdentifiedReference { + static create>(entity: T | IdentifiedReference): IdentifiedReference { if (Reference.isReference(entity)) { return entity as IdentifiedReference; } @@ -39,12 +39,12 @@ export class Reference> { return new Reference(entity as T) as IdentifiedReference; } - static createFromPK, PK extends keyof T | unknown = PrimaryProperty>(entityType: Constructor, pk: Primary): IdentifiedReference { + static createFromPK>(entityType: Constructor, pk: Primary): IdentifiedReference { const ref = this.createNakedFromPK(entityType, pk); return new Reference(ref) as IdentifiedReference; } - static createNakedFromPK, PK extends keyof T | unknown = PrimaryProperty>(entityType: Constructor, pk: Primary): T { + static createNakedFromPK>(entityType: Constructor, pk: Primary): T { const factory = entityType.prototype.__factory as EntityFactory; return factory.createReference(entityType, pk, { merge: false }); } @@ -52,14 +52,14 @@ export class Reference> { /** * Checks whether the argument is instance of `Reference` wrapper. */ - static isReference>(data: any): data is Reference { + static isReference(data: any): data is Reference { return data && !!data.__reference; } /** * Wraps the entity in a `Reference` wrapper if the property is defined as `wrappedReference`. */ - static wrapReference>(entity: T | Reference, prop: EntityProperty): Reference | T { + static wrapReference(entity: T | Reference, prop: EntityProperty): Reference | T { if (entity && prop.wrappedReference && !Reference.isReference(entity)) { return Reference.create(entity as T); } @@ -70,7 +70,7 @@ export class Reference> { /** * Returns wrapped entity. */ - static unwrapReference(ref: T | Reference): T { + static unwrapReference(ref: T | Reference): T { return Reference.isReference(ref) ? (ref as Reference).unwrap() : ref; } @@ -94,7 +94,7 @@ export class Reference> { const opts: Dictionary = typeof options === 'object' ? options : { prop: options }; if (!this.isInitialized()) { - await this.entity.__helper!.init(undefined, opts?.populate, opts?.lockMode, opts?.connectionType); + await helper(this.entity).init(undefined, opts?.populate, opts?.lockMode, opts?.connectionType); } if (opts.prop) { @@ -118,7 +118,7 @@ export class Reference> { getEntity(): T { if (!this.isInitialized()) { - throw new Error(`Reference<${this.entity.__meta!.name}> ${this.entity.__helper!.getPrimaryKey()} not initialized`); + throw new Error(`Reference<${helper(this.entity).__meta.name}> ${helper(this.entity).getPrimaryKey()} not initialized`); } return this.entity; @@ -129,11 +129,11 @@ export class Reference> { } isInitialized(): boolean { - return this.entity.__helper!.__initialized; + return helper(this.entity).__initialized; } populated(populated?: boolean): void { - this.entity.__helper!.populated!(populated); + helper(this.entity).populated(populated); } toJSON(...args: any[]): Dictionary { @@ -151,7 +151,7 @@ Object.defineProperties(Reference.prototype, { get: { get() { return () => this.entity; } }, }); -export interface LoadReferenceOptions { +export interface LoadReferenceOptions { populate?: Populate; lockMode?: Exclude; connectionType?: ConnectionType; diff --git a/packages/core/src/entity/WrappedEntity.ts b/packages/core/src/entity/WrappedEntity.ts index bf788f413994..0847de30a14a 100644 --- a/packages/core/src/entity/WrappedEntity.ts +++ b/packages/core/src/entity/WrappedEntity.ts @@ -1,6 +1,9 @@ import { inspect } from 'util'; import type { EntityManager } from '../EntityManager'; -import type { AnyEntity, ConnectionType, Dictionary, EntityData, EntityDictionary, EntityMetadata, Populate, PopulateOptions, Primary } from '../typings'; +import type { + AnyEntity, ConnectionType, Dictionary, EntityData, EntityDictionary, EntityMetadata, + IWrappedEntityInternal, Populate, PopulateOptions, Primary, +} from '../typings'; import type { IdentifiedReference } from './Reference'; import { Reference } from './Reference'; import type { SerializationContext } from './EntityTransformer'; @@ -12,7 +15,7 @@ import type { LockMode } from '../enums'; import { ValidationError } from '../errors'; import type { EntityIdentifier } from './EntityIdentifier'; -export class WrappedEntity, PK extends keyof T> { +export class WrappedEntity { __initialized = true; __touched = false; @@ -81,7 +84,7 @@ export class WrappedEntity, PK extends keyof T> { throw ValidationError.entityNotManaged(this.entity); } - await this.__em.findOne(this.entity.constructor.name, this.entity, { refresh: true, lockMode, populate, connectionType, schema: this.__schema }); + await this.__em.findOne((this.entity as object).constructor.name, this.entity, { refresh: true, lockMode, populate, connectionType, schema: this.__schema }); this.populated(populated); this.__lazyInitialized = true; @@ -113,7 +116,7 @@ export class WrappedEntity, PK extends keyof T> { const child = this.entity[pk] as AnyEntity | Primary; if (Utils.isEntity(child, true)) { - const childPk = child.__helper!.getPrimaryKeys(convertCustomTypes); + const childPk = (child as AnyEntity).getPrimaryKeys(convertCustomTypes); ret.push(...childPk!); } else { ret.push(child as Primary); @@ -135,7 +138,7 @@ export class WrappedEntity, PK extends keyof T> { } setPrimaryKey(id: Primary | null) { - this.entity[this.entity.__meta!.primaryKeys[0] as string] = id; + this.entity[this.__meta!.primaryKeys[0] as string] = id; } getSerializedPrimaryKey(): string { @@ -143,19 +146,19 @@ export class WrappedEntity, PK extends keyof T> { } get __meta(): EntityMetadata { - return this.entity.__meta!; + return (this.entity as IWrappedEntityInternal).__meta!; } get __platform() { - return this.entity.__platform!; + return (this.entity as IWrappedEntityInternal).__platform!; } get __primaryKeys(): Primary[] { - return Utils.getPrimaryKeyValues(this.entity, this.entity.__meta!.primaryKeys); + return Utils.getPrimaryKeyValues(this.entity, this.__meta!.primaryKeys); } [inspect.custom]() { - return `[WrappedEntity<${this.entity.__meta!.className}>]`; + return `[WrappedEntity<${this.__meta!.className}>]`; } } diff --git a/packages/core/src/entity/wrap.ts b/packages/core/src/entity/wrap.ts index 7d0a788968d6..54979d1af56f 100644 --- a/packages/core/src/entity/wrap.ts +++ b/packages/core/src/entity/wrap.ts @@ -1,27 +1,36 @@ -import type { AnyEntity, Dictionary, IWrappedEntity, IWrappedEntityInternal, PrimaryProperty } from '../typings'; +import type { Dictionary, IWrappedEntity, IWrappedEntityInternal, PrimaryProperty } from '../typings'; /** * returns WrappedEntity instance associated with this entity. This includes all the internal properties like `__meta` or `__em`. */ -export function wrap>(entity: T, preferHelper: true): IWrappedEntityInternal; +export function wrap>(entity: T, preferHelper: true): IWrappedEntityInternal; /** * wraps entity type with WrappedEntity internal properties and helpers like init/isInitialized/populated/toJSON */ -export function wrap>(entity: T, preferHelper?: false): IWrappedEntity; +export function wrap>(entity: T, preferHelper?: false): IWrappedEntity; /** * wraps entity type with WrappedEntity internal properties and helpers like init/isInitialized/populated/toJSON * use `preferHelper = true` to have access to the internal `__` properties like `__meta` or `__em` */ -export function wrap, PK extends keyof T | unknown = PrimaryProperty>(entity: T & Dictionary, preferHelper = false): IWrappedEntity | IWrappedEntityInternal { +export function wrap>(entity: T & Dictionary, preferHelper = false): IWrappedEntity | IWrappedEntityInternal { if (entity?.__baseEntity && !preferHelper) { - return entity as unknown as IWrappedEntity; + return entity as unknown as IWrappedEntity; } if (entity) { return entity.__helper!; } - return entity as unknown as IWrappedEntity; + return entity as unknown as IWrappedEntity; +} + +/** + * wraps entity type with WrappedEntity internal properties and helpers like init/isInitialized/populated/toJSON + * use `preferHelper = true` to have access to the internal `__` properties like `__meta` or `__em` + * @internal + */ +export function helper>(entity: T): IWrappedEntityInternal { + return (entity as Dictionary).__helper!; } diff --git a/packages/core/src/errors.ts b/packages/core/src/errors.ts index 92471cf4fc5f..6233b3db3846 100644 --- a/packages/core/src/errors.ts +++ b/packages/core/src/errors.ts @@ -106,7 +106,7 @@ export class ValidationError extends Error { return new ValidationError('Using global EntityManager instance methods for context specific actions is disallowed. If you need to work with the global instance\'s identity map, use `allowGlobalContext` configuration option or `fork()` instead.'); } - static cannotUseOperatorsInsideEmbeddables(className: string, propName: string, payload: Dictionary): ValidationError { + static cannotUseOperatorsInsideEmbeddables(className: string, propName: string, payload: unknown): ValidationError { return new ValidationError(`Using operators inside embeddables is not allowed, move the operator above. (property: ${className}.${propName}, payload: ${inspect(payload)})`); } diff --git a/packages/core/src/events/EventManager.ts b/packages/core/src/events/EventManager.ts index 192e1dbeb9af..9c1b4a3b100d 100644 --- a/packages/core/src/events/EventManager.ts +++ b/packages/core/src/events/EventManager.ts @@ -23,15 +23,15 @@ export class EventManager { }); } - dispatchEvent>(event: TransactionEventType, args: TransactionEventArgs): unknown; - dispatchEvent>(event: EventType.onInit, args: Partial>): unknown; - dispatchEvent>(event: EventType, args: Partial | FlushEventArgs>): Promise; - dispatchEvent>(event: EventType, args: Partial>): Promise | unknown { + dispatchEvent(event: TransactionEventType, args: TransactionEventArgs): unknown; + dispatchEvent(event: EventType.onInit, args: Partial>): unknown; + dispatchEvent(event: EventType, args: Partial | FlushEventArgs>): Promise; + dispatchEvent(event: EventType, args: Partial>): Promise | unknown { const listeners: AsyncFunction[] = []; const entity = (args as EventArgs).entity; // execute lifecycle hooks first - const hooks = (entity?.__meta!.hooks[event] || []) as AsyncFunction[]; + const hooks = ((entity as AnyEntity)?.__meta!.hooks[event] || []) as AsyncFunction[]; listeners.push(...hooks.map(hook => { const handler = typeof hook === 'function' ? hook : entity[hook!] as AsyncFunction; return handler!.bind(entity); @@ -52,7 +52,7 @@ export class EventManager { return Utils.runSerial(listeners, listener => listener(args)); } - hasListeners>(event: EventType, meta: EntityMetadata): boolean { + hasListeners(event: EventType, meta: EntityMetadata): boolean { const hasHooks = meta.hooks[event]?.length; if (hasHooks) { @@ -80,4 +80,4 @@ export class EventManager { } -type AnyEventArgs> = EventArgs | FlushEventArgs | TransactionEventArgs; +type AnyEventArgs = EventArgs | FlushEventArgs | TransactionEventArgs; diff --git a/packages/core/src/hydration/Hydrator.ts b/packages/core/src/hydration/Hydrator.ts index b9b8db62d0f5..7fa822711592 100644 --- a/packages/core/src/hydration/Hydrator.ts +++ b/packages/core/src/hydration/Hydrator.ts @@ -1,5 +1,5 @@ -import type { AnyEntity, EntityData, EntityMetadata, EntityProperty, IHydrator } from '../typings'; -import type { EntityFactory } from '../entity'; +import type { EntityData, EntityMetadata, EntityProperty, IHydrator } from '../typings'; +import type { EntityFactory } from '../entity/EntityFactory'; import type { Platform } from '../platforms/Platform'; import type { MetadataStorage } from '../metadata/MetadataStorage'; import type { Configuration } from '../utils/Configuration'; @@ -14,7 +14,7 @@ export abstract class Hydrator implements IHydrator { /** * @inheritDoc */ - hydrate>(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, type: 'full' | 'returning' | 'reference', newEntity = false, convertCustomTypes = false, schema?: string): void { + hydrate(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, type: 'full' | 'returning' | 'reference', newEntity = false, convertCustomTypes = false, schema?: string): void { const props = this.getProperties(meta, type); for (const prop of props) { @@ -25,13 +25,13 @@ export abstract class Hydrator implements IHydrator { /** * @inheritDoc */ - hydrateReference>(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, convertCustomTypes?: boolean, schema?: string): void { + hydrateReference(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, convertCustomTypes?: boolean, schema?: string): void { meta.primaryKeys.forEach(pk => { this.hydrateProperty(entity, meta.properties[pk], data, factory, false, convertCustomTypes); }); } - protected getProperties>(meta: EntityMetadata, type: 'full' | 'returning' | 'reference'): EntityProperty[] { + protected getProperties(meta: EntityMetadata, type: 'full' | 'returning' | 'reference'): EntityProperty[] { if (type === 'reference') { return meta.primaryKeys.map(pk => meta.properties[pk]); } @@ -43,7 +43,7 @@ export abstract class Hydrator implements IHydrator { return meta.hydrateProps; } - protected hydrateProperty>(entity: T, prop: EntityProperty, data: EntityData, factory: EntityFactory, newEntity?: boolean, convertCustomTypes?: boolean): void { + protected hydrateProperty(entity: T, prop: EntityProperty, data: EntityData, factory: EntityFactory, newEntity?: boolean, convertCustomTypes?: boolean): void { entity[prop.name] = data[prop.name]; } diff --git a/packages/core/src/hydration/ObjectHydrator.ts b/packages/core/src/hydration/ObjectHydrator.ts index b05b1a4ff52c..69a7d53973ee 100644 --- a/packages/core/src/hydration/ObjectHydrator.ts +++ b/packages/core/src/hydration/ObjectHydrator.ts @@ -1,4 +1,4 @@ -import type { AnyEntity, EntityData, EntityMetadata, EntityProperty } from '../typings'; +import type { EntityData, EntityMetadata, EntityProperty } from '../typings'; import { Hydrator } from './Hydrator'; import { Collection } from '../entity/Collection'; import { Reference } from '../entity/Reference'; @@ -21,7 +21,7 @@ export class ObjectHydrator extends Hydrator { /** * @inheritDoc */ - hydrate>(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, type: 'full' | 'returning' | 'reference', newEntity = false, convertCustomTypes = false, schema?: string): void { + hydrate(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, type: 'full' | 'returning' | 'reference', newEntity = false, convertCustomTypes = false, schema?: string): void { const hydrate = this.getEntityHydrator(meta, type); Utils.callCompiledFunction(hydrate, entity, data, factory, newEntity, convertCustomTypes, schema); } @@ -29,7 +29,7 @@ export class ObjectHydrator extends Hydrator { /** * @inheritDoc */ - hydrateReference>(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, convertCustomTypes = false, schema?: string): void { + hydrateReference(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, convertCustomTypes = false, schema?: string): void { const hydrate = this.getEntityHydrator(meta, 'reference'); Utils.callCompiledFunction(hydrate, entity, data, factory, false, convertCustomTypes, schema); } @@ -37,7 +37,7 @@ export class ObjectHydrator extends Hydrator { /** * @internal Highly performance-sensitive method. */ - getEntityHydrator>(meta: EntityMetadata, type: 'full' | 'returning' | 'reference'): EntityHydrator { + getEntityHydrator(meta: EntityMetadata, type: 'full' | 'returning' | 'reference'): EntityHydrator { const exists = this.hydrators[type].get(meta.className); if (exists) { diff --git a/packages/core/src/metadata/EntitySchema.ts b/packages/core/src/metadata/EntitySchema.ts index 9f993770904d..d1f9aaeb3523 100644 --- a/packages/core/src/metadata/EntitySchema.ts +++ b/packages/core/src/metadata/EntitySchema.ts @@ -4,8 +4,8 @@ import type { EmbeddedOptions, EnumOptions, IndexOptions, ManyToManyOptions, ManyToOneOptions, OneToManyOptions, OneToOneOptions, PrimaryKeyOptions, PropertyOptions, SerializedPrimaryKeyOptions, UniqueOptions, } from '../decorators'; -import type { EntityRepository } from '../entity'; -import { BaseEntity } from '../entity'; +import type { EntityRepository } from '../entity/EntityRepository'; +import { BaseEntity } from '../entity/BaseEntity'; import { Cascade, ReferenceType } from '../enums'; import { Type } from '../types'; import { Utils } from '../utils'; @@ -26,7 +26,7 @@ type Metadata = & ({ name: string } | { class: Constructor; name?: string }) & { properties?: { [K in keyof Omit as ExcludeFunctions, K>]-?: Property>, T> } }; -export class EntitySchema = AnyEntity, U extends AnyEntity | undefined = undefined> { +export class EntitySchema { private readonly _meta: EntityMetadata = new EntityMetadata(); private internal = false; @@ -44,7 +44,7 @@ export class EntitySchema = AnyEntity, U extends AnyEntit this._meta.root ??= this._meta; } - static fromMetadata = AnyEntity, U extends AnyEntity | undefined = undefined>(meta: EntityMetadata | DeepPartial>): EntitySchema { + static fromMetadata(meta: EntityMetadata | DeepPartial>): EntitySchema { const schema = new EntitySchema(meta as unknown as Metadata); schema.internal = true; @@ -88,7 +88,7 @@ export class EntitySchema = AnyEntity, U extends AnyEntit options.items = Utils.extractEnumValues(options.items()); } - // enum arrays are simple numeric/string arrays, the constrain is enforced in the custom type only + // enum arrays are simple numeric/string arrays, the constraint is enforced in the custom type only if (options.array && !options.customType) { options.customType = new EnumArrayType(`${this._meta.className}.${name}`, options.items); (options as EntityProperty).enum = false; @@ -116,7 +116,7 @@ export class EntitySchema = AnyEntity, U extends AnyEntit this.addProperty(name, type, options); } - addEmbedded(name: string & keyof T, options: EmbeddedOptions): void { + addEmbedded(name: string & keyof T, options: EmbeddedOptions): void { Utils.defaultValue(options, 'prefix', true); if (options.array) { @@ -131,7 +131,7 @@ export class EntitySchema = AnyEntity, U extends AnyEntit } as EntityProperty; } - addManyToOne(name: string & keyof T, type: TypeType, options: ManyToOneOptions): void { + addManyToOne(name: string & keyof T, type: TypeType, options: ManyToOneOptions): void { const prop = this.createProperty(ReferenceType.MANY_TO_ONE, options); Utils.defaultValue(prop, 'nullable', prop.cascade.includes(Cascade.REMOVE) || prop.cascade.includes(Cascade.ALL)); @@ -146,7 +146,7 @@ export class EntitySchema = AnyEntity, U extends AnyEntit this.addProperty(name, type, prop); } - addManyToMany(name: string & keyof T, type: TypeType, options: ManyToManyOptions): void { + addManyToMany(name: string & keyof T, type: TypeType, options: ManyToManyOptions): void { options.fixedOrder = options.fixedOrder || !!options.fixedOrderColumn; if (!options.owner && !options.mappedBy) { @@ -161,12 +161,12 @@ export class EntitySchema = AnyEntity, U extends AnyEntit this.addProperty(name, type, prop); } - addOneToMany(name: string & keyof T, type: TypeType, options: OneToManyOptions): void { + addOneToMany(name: string & keyof T, type: TypeType, options: OneToManyOptions): void { const prop = this.createProperty(ReferenceType.ONE_TO_MANY, options); this.addProperty(name, type, prop); } - addOneToOne(name: string & keyof T, type: TypeType, options: OneToOneOptions): void { + addOneToOne(name: string & keyof T, type: TypeType, options: OneToOneOptions): void { const prop = this.createProperty(ReferenceType.ONE_TO_ONE, options) as EntityProperty; Utils.defaultValue(prop, 'owner', !!prop.inversedBy || !prop.mappedBy); Utils.defaultValue(prop, 'nullable', !prop.owner || prop.cascade.includes(Cascade.REMOVE) || prop.cascade.includes(Cascade.ALL)); @@ -195,7 +195,7 @@ export class EntitySchema = AnyEntity, U extends AnyEntit this._meta.uniques.push(options as any); } - setCustomRepository(repository: () => Constructor>): void { + setCustomRepository(repository: () => Constructor>): void { this._meta.customRepository = repository; } @@ -264,16 +264,16 @@ export class EntitySchema = AnyEntity, U extends AnyEntit switch ((options as EntityProperty).reference) { case ReferenceType.ONE_TO_ONE: - this.addOneToOne(name as keyof T & string, options.type as string, options as OneToOneOptions); + this.addOneToOne(name as keyof T & string, options.type as string, options as OneToOneOptions); break; case ReferenceType.ONE_TO_MANY: - this.addOneToMany(name as keyof T & string, options.type as string, options as OneToManyOptions); + this.addOneToMany(name as keyof T & string, options.type as string, options as OneToManyOptions); break; case ReferenceType.MANY_TO_ONE: - this.addManyToOne(name as keyof T & string, options.type as string, options as ManyToOneOptions); + this.addManyToOne(name as keyof T & string, options.type as string, options as ManyToOneOptions); break; case ReferenceType.MANY_TO_MANY: - this.addManyToMany(name as keyof T & string, options.type as string, options as ManyToManyOptions); + this.addManyToMany(name as keyof T & string, options.type as string, options as ManyToManyOptions); break; case ReferenceType.EMBEDDED: this.addEmbedded(name as keyof T & string, options as EmbeddedOptions); diff --git a/packages/core/src/metadata/MetadataDiscovery.ts b/packages/core/src/metadata/MetadataDiscovery.ts index 3323cc6f73be..7502503c353b 100644 --- a/packages/core/src/metadata/MetadataDiscovery.ts +++ b/packages/core/src/metadata/MetadataDiscovery.ts @@ -184,11 +184,11 @@ export class MetadataDiscovery { } } - async discoverReferences(refs: Constructor[]): Promise { - const found: Constructor[] = []; + async discoverReferences(refs: Constructor[]): Promise[]> { + const found: Constructor[] = []; for (const entity of refs) { - const schema = this.getSchema(this.prepare(entity) as Constructor); + const schema = this.getSchema(this.prepare(entity) as Constructor); const meta = schema.init().meta; this.metadata.set(meta.className, meta); found.push(entity); @@ -214,7 +214,7 @@ export class MetadataDiscovery { return this.discovered.filter(meta => found.find(m => m.name === meta.className)); } - private prepare>(entity: EntityClass | EntityClassGroup | EntitySchema): EntityClass | EntitySchema { + private prepare(entity: EntityClass | EntityClassGroup | EntitySchema): EntityClass | EntitySchema { if ('schema' in entity && entity.schema instanceof EntitySchema) { return entity.schema; } @@ -230,7 +230,7 @@ export class MetadataDiscovery { return entity; } - private getSchema>(entity: Constructor | EntitySchema): EntitySchema { + private getSchema(entity: Constructor | EntitySchema): EntitySchema { if (entity instanceof EntitySchema) { return entity; } @@ -253,7 +253,7 @@ export class MetadataDiscovery { return schema; } - private async discoverEntity>(entity: EntityClass | EntityClassGroup | EntitySchema, path?: string): Promise { + private async discoverEntity(entity: EntityClass | EntityClassGroup | EntitySchema, path?: string): Promise { entity = this.prepare(entity); this.logger.log('discovery', `- processing entity ${colors.cyan((entity as EntityClass).name)}${colors.grey(path ? ` (${path})` : '')}`); const schema = this.getSchema(entity as Constructor); @@ -287,7 +287,7 @@ export class MetadataDiscovery { this.discovered.push(meta); } - private async saveToCache>(meta: EntityMetadata): Promise { + private async saveToCache(meta: EntityMetadata): Promise { if (!meta.useCache) { return; } diff --git a/packages/core/src/metadata/MetadataStorage.ts b/packages/core/src/metadata/MetadataStorage.ts index 8c4d60027e40..7604117c1b5c 100644 --- a/packages/core/src/metadata/MetadataStorage.ts +++ b/packages/core/src/metadata/MetadataStorage.ts @@ -1,4 +1,4 @@ -import type { AnyEntity, Dictionary, EntityData } from '../typings'; +import type { Dictionary, EntityData } from '../typings'; import { EntityMetadata } from '../typings'; import { Utils } from '../utils/Utils'; import { MetadataError } from '../errors'; @@ -17,8 +17,8 @@ export class MetadataStorage { } static getMetadata(): Dictionary; - static getMetadata = any>(entity: string, path: string): EntityMetadata; - static getMetadata = any>(entity?: string, path?: string): Dictionary | EntityMetadata { + static getMetadata(entity: string, path: string): EntityMetadata; + static getMetadata(entity?: string, path?: string): Dictionary | EntityMetadata { const key = entity && path ? entity + '-' + Utils.hash(path) : null; if (key && !MetadataStorage.metadata[key]) { @@ -73,7 +73,7 @@ export class MetadataStorage { return this.metadata[type]; } - get = any>(entity: string, init = false, validate = true): EntityMetadata { + get(entity: string, init = false, validate = true): EntityMetadata { if (validate && !init && !this.has(entity)) { throw MetadataError.missingMetadata(entity); } @@ -85,7 +85,7 @@ export class MetadataStorage { return this.metadata[entity]; } - find = any>(entity: string): EntityMetadata | undefined { + find(entity: string): EntityMetadata | undefined { return this.metadata[entity]; } diff --git a/packages/core/src/platforms/Platform.ts b/packages/core/src/platforms/Platform.ts index c7bba9b7a17b..c534b2cf77d0 100644 --- a/packages/core/src/platforms/Platform.ts +++ b/packages/core/src/platforms/Platform.ts @@ -2,7 +2,7 @@ import { clone } from '../utils/clone'; import { EntityRepository } from '../entity'; import type { NamingStrategy } from '../naming-strategy'; import { UnderscoreNamingStrategy } from '../naming-strategy'; -import type { AnyEntity, Constructor, EntityProperty, IEntityGenerator, IMigrator, IPrimaryKey, ISchemaGenerator, PopulateOptions, Primary, EntityMetadata, SimpleColumnMeta } from '../typings'; +import type { Constructor, EntityProperty, IEntityGenerator, IMigrator, IPrimaryKey, ISchemaGenerator, PopulateOptions, Primary, EntityMetadata, SimpleColumnMeta } from '../typings'; import { ExceptionConverter } from './ExceptionConverter'; import type { EntityManager } from '../EntityManager'; import type { Configuration } from '../utils/Configuration'; @@ -311,7 +311,7 @@ export abstract class Platform { return !marshall; } - getRepositoryClass(): Constructor> { + getRepositoryClass(): Constructor> { return EntityRepository; } @@ -394,7 +394,7 @@ export abstract class Platform { return false; } - shouldHaveColumn>(prop: EntityProperty, populate: PopulateOptions[] | boolean, includeFormulas = true): boolean { + shouldHaveColumn(prop: EntityProperty, populate: PopulateOptions[] | boolean, includeFormulas = true): boolean { if (prop.formula) { return includeFormulas && (!prop.lazy || populate === true || (populate !== false && populate.some(p => p.field === prop.name))); } diff --git a/packages/core/src/typings.ts b/packages/core/src/typings.ts index dc908891a64b..5b01a0097f64 100644 --- a/packages/core/src/typings.ts +++ b/packages/core/src/typings.ts @@ -95,7 +95,11 @@ export type ObjectQuery = ExpandObject & OperatorMap; export type FilterQuery = ObjectQuery | NonNullable>> | T | FilterQuery[]; export type QBFilterQuery = FilterQuery | Dictionary; -export interface IWrappedEntity, PK extends keyof T | unknown = PrimaryProperty, P extends string = string> { +export interface IWrappedEntity< + T extends object, + PK extends keyof T | unknown = PrimaryProperty, + P extends string = string, +> { isInitialized(): boolean; isTouched(): boolean; populated(populated?: boolean): void; @@ -109,7 +113,11 @@ export interface IWrappedEntity, PK extends keyof T | unk setSchema(schema?: string): void; } -export interface IWrappedEntityInternal, P extends string = string> extends IWrappedEntity { +export interface IWrappedEntityInternal< + T extends object, + PK extends keyof T | unknown = PrimaryProperty, + P extends string = string, +> extends IWrappedEntity { hasPrimaryKey(): boolean; getPrimaryKey(convertCustomTypes?: boolean): Primary | null; getPrimaryKeys(convertCustomTypes?: boolean): Primary[] | null; @@ -135,19 +143,16 @@ export interface IWrappedEntityInternal; populate?: PopulateOptions[] }; } -export type AnyEntity = Partial & { - [PrimaryKeyType]?: unknown; - [EntityRepositoryType]?: unknown; - __helper?: IWrappedEntityInternal; - __meta?: EntityMetadata; - __platform?: Platform; -}; +export type AnyEntity = Partial; // eslint-disable-next-line @typescript-eslint/ban-types -export type EntityClass> = Function & { prototype: T }; -export type EntityClassGroup> = { entity: EntityClass; schema: EntityMetadata | EntitySchema }; -export type EntityName> = string | EntityClass | EntitySchema; -export type GetRepository, U> = T[typeof EntityRepositoryType] extends EntityRepository | undefined ? NonNullable : U; +export type EntityClass = Function & { prototype: T }; +export type EntityClassGroup = { entity: EntityClass; schema: EntityMetadata | EntitySchema }; +export type EntityName = string | EntityClass | EntitySchema; + +// we need to restrict the type in the generic argument, otherwise inference don't work, so we use two types here +export type InferRepository = Entity[typeof EntityRepositoryType] extends EntityRepository | undefined ? NonNullable : Fallback; +export type GetRepository = Entity extends { [k: PropertyKey]: any } ? InferRepository : Fallback; export type EntityDataPropValue = T | Primary; type ExpandEntityProp = T extends Record @@ -210,7 +215,7 @@ export type EntityDTO = { [K in keyof T as ExcludeFunctions]: EntityDTO export type CheckCallback = (columns: Record) => string; -export interface CheckConstraint = any> { +export interface CheckConstraint { name?: string; property?: string; expression: string | CheckCallback; @@ -219,7 +224,7 @@ export interface CheckConstraint = any> { // eslint-disable-next-line @typescript-eslint/ban-types export type AnyString = string & {}; -export interface EntityProperty = any> { +export interface EntityProperty { name: string & keyof T; entity: () => EntityName; type: keyof typeof types | AnyString; @@ -293,7 +298,7 @@ export interface EntityProperty = any> { userDefined?: boolean; } -export class EntityMetadata = any> { +export class EntityMetadata { readonly propertyOrder = new Map(); @@ -348,7 +353,7 @@ export class EntityMetadata = any> { sync(initIndexes = false) { this.root ??= this; - const props = Object.values(this.properties).sort((a, b) => this.propertyOrder.get(a.name)! - this.propertyOrder.get(b.name)!); + const props = Object.values>(this.properties).sort((a, b) => this.propertyOrder.get(a.name)! - this.propertyOrder.get(b.name)!); this.props = [...props.filter(p => p.primary), ...props.filter(p => !p.primary)]; this.relations = this.props.filter(prop => prop.reference !== ReferenceType.SCALAR && prop.reference !== ReferenceType.EMBEDDED); this.bidirectionalRelations = this.relations.filter(prop => prop.mappedBy || prop.inversedBy); @@ -432,7 +437,7 @@ export interface SimpleColumnMeta { type: string; } -export interface EntityMetadata = any> { +export interface EntityMetadata { name?: string; // abstract classes do not have a name, but once discovery ends, we have only non-abstract classes stored className: string; tableName: string; @@ -467,7 +472,7 @@ export interface EntityMetadata = any> { indexes: { properties: (keyof T & string) | (keyof T & string)[]; name?: string; type?: string; options?: Dictionary; expression?: string }[]; uniques: { properties: (keyof T & string) | (keyof T & string)[]; name?: string; options?: Dictionary }[]; checks: CheckConstraint[]; - customRepository: () => Constructor>; + customRepository: () => Constructor>; hooks: { [K in EventType]?: (keyof T | EventSubscriber[EventType])[] }; prototype: T; class: Constructor; @@ -613,7 +618,7 @@ export type PopulateOptions = { children?: PopulateOptions[]; }; -type Loadable = Collection | Reference | readonly T[]; // we need to support raw arrays in embeddables too to allow population +type Loadable = Collection | Reference | readonly T[]; // we need to support raw arrays in embeddables too to allow population type ExtractType = T extends Loadable ? U : T; type StringKeys = T extends Collection @@ -650,7 +655,7 @@ export type ExpandProperty = T extends Reference ? NonNullable : NonNullable; -type LoadedLoadable = T extends Collection +type LoadedLoadable = T extends Collection ? T & LoadedCollection : (T extends Reference ? T & LoadedReference : T & E); @@ -667,18 +672,18 @@ export type Loaded = T & { : T[K] }; -export interface LoadedReference extends Reference> { +export interface LoadedReference extends Reference> { $: Defined; get(): Defined; } -export interface LoadedCollection extends Collection { +export interface LoadedCollection extends Collection { $: Collection; get(): Collection; getItems(check?: boolean): T[]; } -export type New, P extends string = string> = Loaded; +export type New = Loaded; export interface Highlighter { highlight(text: string): string; @@ -686,8 +691,8 @@ export interface Highlighter { export interface IMetadataStorage { getAll(): Dictionary; - get = any>(entity: string, init?: boolean, validate?: boolean): EntityMetadata; - find = any>(entity: string): EntityMetadata | undefined; + get(entity: string, init?: boolean, validate?: boolean): EntityMetadata; + find(entity: string): EntityMetadata | undefined; has(entity: string): boolean; set(entity: string, meta: EntityMetadata): EntityMetadata; reset(entity: string): void; @@ -699,7 +704,7 @@ export interface IHydrator { * Hydrates the whole entity. This process handles custom type conversions, creating missing Collection instances, * mapping FKs to entity instances, as well as merging those entities. */ - hydrate>( + hydrate( entity: T, meta: EntityMetadata, data: EntityData, @@ -713,7 +718,7 @@ export interface IHydrator { /** * Hydrates primary keys only */ - hydrateReference>(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, convertCustomTypes?: boolean, schema?: string): void; + hydrateReference(entity: T, meta: EntityMetadata, data: EntityData, factory: EntityFactory, convertCustomTypes?: boolean, schema?: string): void; } diff --git a/packages/core/src/unit-of-work/ChangeSet.ts b/packages/core/src/unit-of-work/ChangeSet.ts index a1fa785e46f0..b8db13a8e18c 100644 --- a/packages/core/src/unit-of-work/ChangeSet.ts +++ b/packages/core/src/unit-of-work/ChangeSet.ts @@ -1,6 +1,7 @@ -import type { EntityData, AnyEntity, EntityMetadata, EntityDictionary, Primary } from '../typings'; +import type { EntityData, EntityMetadata, EntityDictionary, Primary } from '../typings'; +import { helper } from '../entity/wrap'; -export class ChangeSet> { +export class ChangeSet { private primaryKey?: Primary | null; private serializedPrimaryKey?: string; @@ -8,16 +9,16 @@ export class ChangeSet> { constructor(public entity: T, public type: ChangeSetType, public payload: EntityDictionary, - private meta: EntityMetadata) { + public meta: EntityMetadata) { this.name = meta.className; this.rootName = meta.root.className; this.collection = meta.root.collection; - this.schema = entity.__helper!.__schema ?? meta.root.schema; + this.schema = helper(entity).__schema ?? meta.root.schema; } getPrimaryKey(object = false): Primary | null { if (!this.originalEntity) { - this.primaryKey ??= this.entity.__helper!.getPrimaryKey(true); + this.primaryKey ??= helper(this.entity).getPrimaryKey(true); } else if (this.meta.compositePK || object) { this.primaryKey = this.meta.primaryKeys.reduce((o, pk) => { o[pk] = (this.originalEntity as T)[pk]; @@ -31,13 +32,13 @@ export class ChangeSet> { } getSerializedPrimaryKey(): string | null { - this.serializedPrimaryKey ??= this.entity.__helper!.getSerializedPrimaryKey(); + this.serializedPrimaryKey ??= helper(this.entity).getSerializedPrimaryKey(); return this.serializedPrimaryKey; } } -export interface ChangeSet> { +export interface ChangeSet { name: string; rootName: string; collection: string; diff --git a/packages/core/src/unit-of-work/ChangeSetComputer.ts b/packages/core/src/unit-of-work/ChangeSetComputer.ts index b95f5617a2b0..86288f61bd78 100644 --- a/packages/core/src/unit-of-work/ChangeSetComputer.ts +++ b/packages/core/src/unit-of-work/ChangeSetComputer.ts @@ -6,6 +6,7 @@ import { ChangeSet, ChangeSetType } from './ChangeSet'; import type { Collection, EntityValidator } from '../entity'; import type { Platform } from '../platforms'; import { ReferenceType } from '../enums'; +import { helper } from '../entity'; export class ChangeSetComputer { @@ -17,14 +18,14 @@ export class ChangeSetComputer { private readonly platform: Platform, private readonly config: Configuration) { } - computeChangeSet>(entity: T): ChangeSet | null { - const meta = this.metadata.get(entity.constructor.name); + computeChangeSet(entity: T): ChangeSet | null { + const meta = this.metadata.get((entity as AnyEntity).constructor.name); if (meta.readonly) { return null; } - const type = entity.__helper!.__originalEntityData ? ChangeSetType.UPDATE : ChangeSetType.CREATE; + const type = helper(entity).__originalEntityData ? ChangeSetType.UPDATE : ChangeSetType.CREATE; const map = new Map(); // Execute `onCreate` and `onUpdate` on properties recursively, saves `onUpdate` results @@ -36,10 +37,10 @@ export class ChangeSetComputer { } const changeSet = new ChangeSet(entity, type, this.computePayload(entity), meta); - changeSet.originalEntity = entity.__helper!.__originalEntityData; + changeSet.originalEntity = helper(entity).__originalEntityData; if (this.config.get('validate')) { - this.validator.validate(changeSet.entity, changeSet.payload, meta); + this.validator.validate(changeSet.entity, changeSet.payload, meta); } for (const prop of meta.relations) { @@ -76,7 +77,7 @@ export class ChangeSetComputer { /** * Traverses entity graph and executes `onCreate` and `onUpdate` methods, assigning the values to given properties. */ - private processPropertyInitializers>(entity: T, prop: EntityProperty, type: ChangeSetType, map: Map, nested?: boolean): void { + private processPropertyInitializers(entity: T, prop: EntityProperty, type: ChangeSetType, map: Map, nested?: boolean): void { if (prop.onCreate && type === ChangeSetType.CREATE && entity[prop.name] == null) { entity[prop.name] = prop.onCreate(entity); } @@ -94,10 +95,10 @@ export class ChangeSetComputer { } } - private computePayload>(entity: T, ignoreUndefined = false): EntityData { + private computePayload(entity: T, ignoreUndefined = false): EntityData { const data = this.comparator.prepareEntity(entity); - const entityName = entity.__meta!.root.className; - const originalEntityData = entity.__helper!.__originalEntityData; + const entityName = helper(entity).__meta!.root.className; + const originalEntityData = helper(entity).__originalEntityData; if (originalEntityData) { const comparator = this.comparator.getEntityComparator(entityName); @@ -115,9 +116,9 @@ export class ChangeSetComputer { return data; } - private processProperty>(changeSet: ChangeSet, prop: EntityProperty, target?: unknown): void { + private processProperty(changeSet: ChangeSet, prop: EntityProperty, target?: unknown): void { if (!target) { - const targets = Utils.unwrapProperty(changeSet.entity, changeSet.entity.__meta!, prop); + const targets = Utils.unwrapProperty(changeSet.entity, changeSet.meta, prop); targets.forEach(([t]) => this.processProperty(changeSet, prop, t)); if (targets.length === 0) { @@ -138,14 +139,14 @@ export class ChangeSetComputer { } } - private processToOne>(prop: EntityProperty, changeSet: ChangeSet): void { + private processToOne(prop: EntityProperty, changeSet: ChangeSet): void { const isToOneOwner = prop.reference === ReferenceType.MANY_TO_ONE || (prop.reference === ReferenceType.ONE_TO_ONE && prop.owner); if (!isToOneOwner || prop.mapToPk) { return; } - const targets = Utils.unwrapProperty(changeSet.entity, changeSet.entity.__meta!, prop) as [AnyEntity, number[]][]; + const targets = Utils.unwrapProperty(changeSet.entity, changeSet.meta, prop) as [AnyEntity, number[]][]; targets.forEach(([target, idx]) => { if (!target.__helper!.hasPrimaryKey()) { @@ -154,7 +155,7 @@ export class ChangeSetComputer { }); } - private processToMany>(prop: EntityProperty, changeSet: ChangeSet): void { + private processToMany(prop: EntityProperty, changeSet: ChangeSet): void { const target = changeSet.entity[prop.name] as unknown as Collection; if (!target.isDirty()) { diff --git a/packages/core/src/unit-of-work/ChangeSetPersister.ts b/packages/core/src/unit-of-work/ChangeSetPersister.ts index 065f6f9f4e18..78028bc9a33e 100644 --- a/packages/core/src/unit-of-work/ChangeSetPersister.ts +++ b/packages/core/src/unit-of-work/ChangeSetPersister.ts @@ -1,7 +1,7 @@ import type { MetadataStorage } from '../metadata'; import type { AnyEntity, Dictionary, EntityData, EntityMetadata, EntityProperty, FilterQuery, IHydrator, IPrimaryKey } from '../typings'; -import type { EntityFactory, EntityValidator } from '../entity'; -import { EntityIdentifier } from '../entity'; +import type { EntityFactory, EntityValidator, Collection } from '../entity'; +import { EntityIdentifier, helper } from '../entity'; import type { ChangeSet } from './ChangeSet'; import { ChangeSetType } from './ChangeSet'; import type { QueryResult } from '../connections'; @@ -22,7 +22,7 @@ export class ChangeSetPersister { private readonly validator: EntityValidator, private readonly config: Configuration) { } - async executeInserts>(changeSets: ChangeSet[], options?: DriverMethodOptions, withSchema?: boolean): Promise { + async executeInserts(changeSets: ChangeSet[], options?: DriverMethodOptions, withSchema?: boolean): Promise { if (!withSchema) { return this.runForEachSchema(changeSets, 'executeInserts', options); } @@ -39,7 +39,7 @@ export class ChangeSetPersister { } } - async executeUpdates>(changeSets: ChangeSet[], batched: boolean, options?: DriverMethodOptions, withSchema?: boolean): Promise { + async executeUpdates(changeSets: ChangeSet[], batched: boolean, options?: DriverMethodOptions, withSchema?: boolean): Promise { if (!withSchema) { return this.runForEachSchema(changeSets, 'executeUpdates', options, batched); } @@ -56,13 +56,13 @@ export class ChangeSetPersister { } } - async executeDeletes>(changeSets: ChangeSet[], options?: DriverMethodOptions, withSchema?: boolean): Promise { + async executeDeletes(changeSets: ChangeSet[], options?: DriverMethodOptions, withSchema?: boolean): Promise { if (!withSchema) { return this.runForEachSchema(changeSets, 'executeDeletes', options); } const size = this.config.get('batchSize'); - const meta = changeSets[0].entity.__meta!; + const meta = changeSets[0].meta; const pk = Utils.getPrimaryKeyHash(meta.primaryKeys); for (let i = 0; i < changeSets.length; i += size) { @@ -73,7 +73,7 @@ export class ChangeSetPersister { } } - private async runForEachSchema>(changeSets: ChangeSet[], method: string, options?: DriverMethodOptions, ...args: unknown[]): Promise { + private async runForEachSchema(changeSets: ChangeSet[], method: string, options?: DriverMethodOptions, ...args: unknown[]): Promise { const groups = new Map[]>(); changeSets.forEach(cs => { const group = groups.get(cs.schema!) ?? []; @@ -87,7 +87,7 @@ export class ChangeSetPersister { } } - private processProperties>(changeSet: ChangeSet): void { + private processProperties(changeSet: ChangeSet): void { const meta = this.metadata.find(changeSet.name)!; for (const prop of meta.props) { @@ -99,8 +99,8 @@ export class ChangeSetPersister { } } - private async persistNewEntity>(meta: EntityMetadata, changeSet: ChangeSet, options?: DriverMethodOptions): Promise { - const wrapped = changeSet.entity.__helper!; + private async persistNewEntity(meta: EntityMetadata, changeSet: ChangeSet, options?: DriverMethodOptions): Promise { + const wrapped = helper(changeSet.entity); options = this.propagateSchemaFromMetadata(meta, options, { convertCustomTypes: false, }); @@ -122,7 +122,7 @@ export class ChangeSetPersister { changeSet.persisted = true; } - private async persistNewEntities>(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { + private async persistNewEntities(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { const size = this.config.get('batchSize'); for (let i = 0; i < changeSets.length; i += size) { @@ -135,7 +135,7 @@ export class ChangeSetPersister { } } - private propagateSchemaFromMetadata(meta: EntityMetadata, options?: DriverMethodOptions, additionalOptions?: Dictionary): DriverMethodOptions { + private propagateSchemaFromMetadata(meta: EntityMetadata, options?: DriverMethodOptions, additionalOptions?: Dictionary): DriverMethodOptions { return { ...options, ...additionalOptions, @@ -143,7 +143,7 @@ export class ChangeSetPersister { }; } - private async persistNewEntitiesBatch>(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { + private async persistNewEntitiesBatch(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { options = this.propagateSchemaFromMetadata(meta, options, { convertCustomTypes: false, processCollections: false, @@ -152,7 +152,7 @@ export class ChangeSetPersister { for (let i = 0; i < changeSets.length; i++) { const changeSet = changeSets[i]; - const wrapped = changeSet.entity.__helper!; + const wrapped = helper(changeSet.entity); if (!wrapped.hasPrimaryKey()) { const field = meta.getPrimaryProps()[0].fieldNames[0]; @@ -167,7 +167,7 @@ export class ChangeSetPersister { } } - private async persistManagedEntity>(changeSet: ChangeSet, options?: DriverMethodOptions): Promise { + private async persistManagedEntity(changeSet: ChangeSet, options?: DriverMethodOptions): Promise { const meta = this.metadata.find(changeSet.name)!; const res = await this.updateEntity(meta, changeSet, options); this.checkOptimisticLock(meta, changeSet, res); @@ -175,7 +175,7 @@ export class ChangeSetPersister { changeSet.persisted = true; } - private async persistManagedEntities>(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { + private async persistManagedEntities(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { const size = this.config.get('batchSize'); for (let i = 0; i < changeSets.length; i += size) { @@ -185,7 +185,7 @@ export class ChangeSetPersister { } } - private checkConcurrencyKeys>(meta: EntityMetadata, changeSet: ChangeSet, cond: Dictionary): void { + private checkConcurrencyKeys(meta: EntityMetadata, changeSet: ChangeSet, cond: Dictionary): void { const tmp: string[] = []; cond = Utils.isPlainObject(cond) ? cond : { [meta.primaryKeys[0]]: cond }; @@ -202,7 +202,7 @@ export class ChangeSetPersister { } } - private async persistManagedEntitiesBatch>(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { + private async persistManagedEntitiesBatch(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { await this.checkOptimisticLocks(meta, changeSets, options); options = this.propagateSchemaFromMetadata(meta, options, { convertCustomTypes: false, @@ -218,10 +218,10 @@ export class ChangeSetPersister { changeSets.forEach(cs => cs.persisted = true); } - private mapPrimaryKey>(meta: EntityMetadata, value: IPrimaryKey, changeSet: ChangeSet): void { + private mapPrimaryKey(meta: EntityMetadata, value: IPrimaryKey, changeSet: ChangeSet): void { const prop = meta.properties[meta.primaryKeys[0]]; const insertId = prop.customType ? prop.customType.convertToJSValue(value, this.platform) : value; - const wrapped = changeSet.entity.__helper!; + const wrapped = helper(changeSet.entity); if (!wrapped.hasPrimaryKey()) { wrapped.setPrimaryKey(insertId); @@ -238,26 +238,26 @@ export class ChangeSetPersister { /** * Sets populate flag to new entities so they are serialized like if they were loaded from the db */ - private markAsPopulated>(changeSet: ChangeSet, meta: EntityMetadata) { - changeSet.entity.__helper!.__schema = this.driver.getSchemaName(meta, changeSet); + private markAsPopulated(changeSet: ChangeSet, meta: EntityMetadata) { + helper(changeSet.entity).__schema = this.driver.getSchemaName(meta, changeSet); if (!this.config.get('populateAfterFlush')) { return; } - changeSet.entity.__helper!.populated(); + helper(changeSet.entity).populated(); meta.relations.forEach(prop => { const value = changeSet.entity[prop.name]; if (Utils.isEntity(value, true)) { (value as AnyEntity).__helper!.populated(); } else if (Utils.isCollection(value)) { - value.populated(); + (value as Collection).populated(); } }); } - private async updateEntity>(meta: EntityMetadata, changeSet: ChangeSet, options?: DriverMethodOptions): Promise> { + private async updateEntity(meta: EntityMetadata, changeSet: ChangeSet, options?: DriverMethodOptions): Promise> { options = this.propagateSchemaFromMetadata(meta, options, { convertCustomTypes: false, }); @@ -277,7 +277,7 @@ export class ChangeSetPersister { return this.driver.nativeUpdate(changeSet.name, cond as FilterQuery, changeSet.payload, options); } - private async checkOptimisticLocks>(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { + private async checkOptimisticLocks(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions): Promise { if (meta.concurrencyCheckKeys.size === 0 && (!meta.versionProperty || changeSets.every(cs => !cs.entity[meta.versionProperty]))) { return; } @@ -307,7 +307,7 @@ export class ChangeSetPersister { } } - private checkOptimisticLock>(meta: EntityMetadata, changeSet: ChangeSet, res?: QueryResult) { + private checkOptimisticLock(meta: EntityMetadata, changeSet: ChangeSet, res?: QueryResult) { if ((meta.versionProperty || meta.concurrencyCheckKeys.size > 0) && res && !res.affectedRows) { throw OptimisticLockError.lockFailed(changeSet.entity); } @@ -317,7 +317,7 @@ export class ChangeSetPersister { * This method also handles reloading of database default values for inserts, so we use * a single query in case of both versioning and default values is used. */ - private async reloadVersionValues>(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions) { + private async reloadVersionValues(meta: EntityMetadata, changeSets: ChangeSet[], options?: DriverMethodOptions) { const reloadProps = meta.versionProperty ? [meta.properties[meta.versionProperty]] : []; if (changeSets[0].type === ChangeSetType.CREATE) { @@ -330,7 +330,7 @@ export class ChangeSetPersister { } const pk = Utils.getPrimaryKeyHash(meta.primaryKeys); - const pks = changeSets.map(cs => cs.entity.__helper!.getPrimaryKey()); + const pks = changeSets.map(cs => helper(cs.entity).getPrimaryKey()); options = this.propagateSchemaFromMetadata(meta, options, { fields: reloadProps.map(prop => prop.fieldNames[0]), }); @@ -339,12 +339,12 @@ export class ChangeSetPersister { data.forEach(item => map.set(Utils.getCompositeKeyHash(item, meta, true, this.platform), item)); for (const changeSet of changeSets) { - const data = map.get(changeSet.entity.__helper!.getSerializedPrimaryKey()); + const data = map.get(helper(changeSet.entity).getSerializedPrimaryKey()); this.hydrator.hydrate(changeSet.entity, meta, data as EntityData, this.factory, 'returning', false, true); } } - private processProperty>(changeSet: ChangeSet, prop: EntityProperty): void { + private processProperty(changeSet: ChangeSet, prop: EntityProperty): void { const meta = this.metadata.find(changeSet.name)!; const values = Utils.unwrapProperty(changeSet.payload, meta, prop, true); // for object embeddables const value = changeSet.payload[prop.name] as unknown; // for inline embeddables @@ -369,10 +369,10 @@ export class ChangeSetPersister { * No need to handle composite keys here as they need to be set upfront. * We do need to map to the change set payload too, as it will be used in the originalEntityData for new entities. */ - private mapReturnedValues>(changeSet: ChangeSet, res: QueryResult, meta: EntityMetadata): void { + private mapReturnedValues(changeSet: ChangeSet, res: QueryResult, meta: EntityMetadata): void { if (this.platform.usesReturningStatement() && res.row && Utils.hasObjectKeys(res.row)) { const data = meta.props.reduce((ret, prop) => { - if (prop.primary && !changeSet.entity.__helper!.hasPrimaryKey()) { + if (prop.primary && !helper(changeSet.entity).hasPrimaryKey()) { this.mapPrimaryKey(meta, res.row![prop.fieldNames[0]], changeSet); return ret; } @@ -385,7 +385,7 @@ export class ChangeSetPersister { }, {} as Dictionary); if (Utils.hasObjectKeys(data)) { - this.hydrator.hydrate(changeSet.entity, meta, data as EntityData, this.factory, 'returning', false, true); + this.hydrator.hydrate(changeSet.entity, meta, data as EntityData, this.factory, 'returning', false, true); } } } diff --git a/packages/core/src/unit-of-work/IdentityMap.ts b/packages/core/src/unit-of-work/IdentityMap.ts index 552feb2d6e8c..601b35ca4678 100644 --- a/packages/core/src/unit-of-work/IdentityMap.ts +++ b/packages/core/src/unit-of-work/IdentityMap.ts @@ -4,12 +4,12 @@ export class IdentityMap { private readonly registry = new Map, Map>(); - store>(item: T) { - this.getStore(item.__meta!.root).set(this.getPkHash(item), item); + store(item: T) { + this.getStore((item as AnyEntity).__meta!.root).set(this.getPkHash(item), item); } - delete>(item: T) { - this.getStore(item.__meta!.root).delete(this.getPkHash(item)); + delete(item: T) { + this.getStore((item as AnyEntity).__meta!.root).delete(this.getPkHash(item)); } getByHash(meta: EntityMetadata, hash: string): T | undefined { @@ -17,15 +17,15 @@ export class IdentityMap { return store.has(hash) ? store.get(hash) : undefined; } - getStore>(meta: EntityMetadata): Map { - const store = this.registry.get(meta.class) as Map; + getStore(meta: EntityMetadata): Map { + const store = this.registry.get(meta.class as Constructor) as Map; if (store) { return store; } const newStore = new Map(); - this.registry.set(meta.class, newStore); + this.registry.set(meta.class as Constructor, newStore); return newStore; } @@ -77,9 +77,9 @@ export class IdentityMap { return store.has(id) ? store.get(id) : undefined; } - private getPkHash>(item: T): string { - const pkHash = item.__helper!.getSerializedPrimaryKey(); - const schema = item.__helper!.__schema || item.__meta!.root.schema; + private getPkHash(item: T): string { + const pkHash = (item as AnyEntity).__helper!.getSerializedPrimaryKey(); + const schema = (item as AnyEntity).__helper!.__schema || (item as AnyEntity).__meta!.root.schema; if (schema) { return schema + ':' + pkHash; diff --git a/packages/core/src/unit-of-work/UnitOfWork.ts b/packages/core/src/unit-of-work/UnitOfWork.ts index 73cfe9f9cf54..4640f65795a1 100644 --- a/packages/core/src/unit-of-work/UnitOfWork.ts +++ b/packages/core/src/unit-of-work/UnitOfWork.ts @@ -1,5 +1,5 @@ -import type { AnyEntity, EntityData, EntityMetadata, EntityProperty, FilterQuery, IPrimaryKeyValue, Primary } from '../typings'; -import { Collection, EntityIdentifier, Reference } from '../entity'; +import type { AnyEntity, Dictionary, EntityData, EntityMetadata, EntityProperty, FilterQuery, IPrimaryKeyValue, Primary } from '../typings'; +import { Collection, EntityIdentifier, helper, Reference } from '../entity'; import { ChangeSet, ChangeSetType } from './ChangeSet'; import { ChangeSetComputer } from './ChangeSetComputer'; import { ChangeSetPersister } from './ChangeSetPersister'; @@ -38,8 +38,8 @@ export class UnitOfWork { constructor(private readonly em: EntityManager) { } - merge>(entity: T, visited?: Set): void { - const wrapped = entity.__helper!; + merge(entity: T, visited?: Set): void { + const wrapped = helper(entity); wrapped.__em = this.em; wrapped.__populated = true; @@ -70,26 +70,26 @@ export class UnitOfWork { /** * @internal */ - registerManaged>(entity: T, data?: EntityData, options?: { refresh?: boolean; newEntity?: boolean; loaded?: boolean }): T { + registerManaged(entity: T, data?: EntityData, options?: { refresh?: boolean; newEntity?: boolean; loaded?: boolean }): T { this.identityMap.store(entity); if (options?.newEntity) { return entity; } - if (options?.loaded && entity.__helper!.__initialized && !entity.__helper!.__onLoadFired) { - this.loadedEntities.add(entity); + if (options?.loaded && helper(entity).__initialized && !helper(entity).__onLoadFired) { + this.loadedEntities.add(entity as AnyEntity); } - const helper = entity.__helper!; - helper.__em ??= this.em; + const wrapped = helper(entity); + wrapped.__em ??= this.em; - if (data && helper!.__initialized && (options?.refresh || !helper!.__originalEntityData)) { + if (data && wrapped!.__initialized && (options?.refresh || !wrapped!.__originalEntityData)) { // we can't use the `data` directly here as it can contain fetch joined data, that can't be used for diffing the state - helper!.__originalEntityData = this.comparator.prepareEntity(entity); - Object.keys(data).forEach(key => entity.__helper!.__loadedProperties.add(key)); - this.queuedActions.delete(helper.__meta.className); - helper.__touched = false; + wrapped!.__originalEntityData = this.comparator.prepareEntity(entity); + Object.keys(data).forEach(key => helper(entity).__loadedProperties.add(key)); + this.queuedActions.delete(wrapped.__meta.className); + wrapped.__touched = false; } return entity; @@ -102,7 +102,7 @@ export class UnitOfWork { for (const entity of this.loadedEntities) { if (this.eventManager.hasListeners(EventType.onLoad, entity.__meta!)) { await this.eventManager.dispatchEvent(EventType.onLoad, { entity, em: this.em }); - entity.__helper!.__onLoadFired = true; + helper(entity).__onLoadFired = true; } } @@ -112,7 +112,7 @@ export class UnitOfWork { /** * Returns entity from the identity map. For composite keys, you need to pass an array of PKs in the same order as they are defined in `meta.primaryKeys`. */ - getById>(entityName: string, id: Primary | Primary[], schema?: string): T | undefined { + getById(entityName: string, id: Primary | Primary[], schema?: string): T | undefined { if (id == null || (Array.isArray(id) && id.length === 0)) { return undefined; } @@ -128,7 +128,7 @@ export class UnitOfWork { return this.identityMap.getByHash(meta, hash); } - tryGetById>(entityName: string, where: FilterQuery, schema?: string, strict = true): T | null { + tryGetById(entityName: string, where: FilterQuery, schema?: string, strict = true): T | null { const pk = Utils.extractPK(where, this.metadata.find(entityName)!, strict); if (!pk) { @@ -148,24 +148,24 @@ export class UnitOfWork { /** * @deprecated use `uow.getOriginalEntityData(entity)` */ - getOriginalEntityData>(): AnyEntity[]; + getOriginalEntityData(): AnyEntity[]; /** * Returns stored snapshot of entity state that is used for change set computation. */ - getOriginalEntityData>(entity: T): EntityData | undefined; + getOriginalEntityData(entity: T): EntityData | undefined; /** * Returns stored snapshot of entity state that is used for change set computation. */ - getOriginalEntityData>(entity?: T): EntityData[] | EntityData | undefined { + getOriginalEntityData(entity?: T): EntityData[] | EntityData | undefined { if (!entity) { return this.identityMap.values().map(e => { return e.__helper!.__originalEntityData!; }); } - return entity.__helper!.__originalEntityData; + return helper(entity as T).__originalEntityData; } getPersistStack(): Set { @@ -188,7 +188,7 @@ export class UnitOfWork { return this.extraUpdates; } - shouldAutoFlush>(meta: EntityMetadata): boolean { + shouldAutoFlush(meta: EntityMetadata): boolean { if (this.insideHooks) { return false; } @@ -198,7 +198,7 @@ export class UnitOfWork { } for (const entity of this.identityMap.getStore(meta).values()) { - if (entity.__helper!.__initialized && entity.__helper!.isTouched()) { + if (helper(entity).__initialized && helper(entity).isTouched()) { return true; } } @@ -210,7 +210,7 @@ export class UnitOfWork { this.queuedActions.clear(); } - computeChangeSet>(entity: T): void { + computeChangeSet(entity: T): void { const cs = this.changeSetComputer.computeChangeSet(entity); if (!cs || this.checkUniqueProps(cs)) { @@ -222,11 +222,11 @@ export class UnitOfWork { this.changeSets.set(entity, cs); this.persistStack.delete(entity); this.queuedActions.delete(cs.name); - entity.__helper!.__originalEntityData = this.comparator.prepareEntity(entity); - entity.__helper!.__touched = false; + helper(entity).__originalEntityData = this.comparator.prepareEntity(entity); + helper(entity).__touched = false; } - recomputeSingleChangeSet>(entity: T): void { + recomputeSingleChangeSet(entity: T): void { const changeSet = this.changeSets.get(entity); if (!changeSet) { @@ -239,18 +239,18 @@ export class UnitOfWork { if (cs && !this.checkUniqueProps(changeSet)) { this.checkOrphanRemoval(cs); Object.assign(changeSet.payload, cs.payload); - entity.__helper!.__originalEntityData = this.comparator.prepareEntity(entity); - entity.__helper!.__touched = false; + helper(entity).__originalEntityData = this.comparator.prepareEntity(entity); + helper(entity).__touched = false; } } - persist>(entity: T, visited?: Set, options: { checkRemoveStack?: boolean; cascade?: boolean } = {}): void { + persist(entity: T, visited?: Set, options: { checkRemoveStack?: boolean; cascade?: boolean } = {}): void { if (options.checkRemoveStack && (this.removeStack.has(entity))) { return; } this.persistStack.add(entity); - this.queuedActions.add(entity.__meta!.className); + this.queuedActions.add(helper(entity).__meta.className); this.removeStack.delete(entity); if (options.cascade ?? true) { @@ -258,15 +258,15 @@ export class UnitOfWork { } } - remove>(entity: T, visited?: Set, options: { cascade?: boolean } = {}): void { + remove(entity: T, visited?: Set, options: { cascade?: boolean } = {}): void { this.removeStack.add(entity); - this.queuedActions.add(entity.__meta!.className); + this.queuedActions.add(helper(entity).__meta.className); this.persistStack.delete(entity); // remove from referencing relations (but don't remove FKs as PKs) - for (const prop of entity.__meta!.bidirectionalRelations) { + for (const prop of helper(entity).__meta.bidirectionalRelations) { const inverseProp = prop.mappedBy || prop.inversedBy; - const relation = Reference.unwrapReference(entity[prop.name]); + const relation = Reference.unwrapReference(entity[prop.name] as object); const prop2 = prop.targetMeta!.properties[inverseProp]; if (prop.reference === ReferenceType.ONE_TO_MANY && !prop2.primary && Utils.isCollection(relation)) { @@ -353,12 +353,12 @@ export class UnitOfWork { } } - async lock>(entity: T, options: LockOptions): Promise { - if (!this.getById(entity.constructor.name, entity.__helper!.__primaryKeys, entity.__helper!.__schema)) { + async lock(entity: T, options: LockOptions): Promise { + if (!this.getById((entity as Dictionary).constructor.name, helper(entity).__primaryKeys, helper(entity).__schema)) { throw ValidationError.entityNotManaged(entity); } - const meta = this.metadata.find(entity.constructor.name)!; + const meta = this.metadata.find((entity as Dictionary).constructor.name)!; if (options.lockMode === LockMode.OPTIMISTIC) { await this.lockOptimistic(entity, meta, options.lockVersion!); @@ -375,7 +375,7 @@ export class UnitOfWork { unsetIdentity(entity: AnyEntity): void { this.identityMap.delete(entity); - const wrapped = entity.__helper!; + const wrapped = helper(entity); wrapped.__meta.bidirectionalRelations .map(prop => [prop.name, prop.mappedBy || prop.inversedBy]) @@ -421,7 +421,7 @@ export class UnitOfWork { } for (const entity of this.orphanRemoveStack) { - if (!entity.__helper!.__processing) { + if (!helper(entity).__processing) { this.removeStack.add(entity); } } @@ -436,11 +436,11 @@ export class UnitOfWork { } for (const entity of this.removeStack) { - if (entity.__helper!.__processing) { + if (helper(entity).__processing) { continue; } - const deletePkHash = [entity.__helper!.getSerializedPrimaryKey(), ...this.expandUniqueProps(entity)]; + const deletePkHash = [helper(entity).getSerializedPrimaryKey(), ...this.expandUniqueProps(entity)]; let type = ChangeSetType.DELETE; for (const cs of inserts) { @@ -453,7 +453,7 @@ export class UnitOfWork { } } - scheduleExtraUpdate(changeSet: ChangeSet, props: EntityProperty[]): void { + scheduleExtraUpdate(changeSet: ChangeSet, props: EntityProperty[]): void { if (props.length === 0) { return; } @@ -480,24 +480,24 @@ export class UnitOfWork { return this.orphanRemoveStack; } - private findNewEntities>(entity: T, visited = new Set(), idx = 0): void { + private findNewEntities(entity: T, visited = new Set(), idx = 0): void { if (visited.has(entity)) { return; } visited.add(entity); - const wrapped = entity.__helper!; + const wrapped = helper(entity); - if (!wrapped.__initialized || entity.__helper!.__processing || this.removeStack.has(entity) || this.orphanRemoveStack.has(entity)) { + if (!wrapped.__initialized || wrapped.__processing || this.removeStack.has(entity) || this.orphanRemoveStack.has(entity)) { return; } this.initIdentifier(entity); - for (const prop of entity.__meta!.relations) { - const targets = Utils.unwrapProperty(entity, entity.__meta!, prop); + for (const prop of helper(entity).__meta.relations) { + const targets = Utils.unwrapProperty(entity, helper(entity).__meta, prop); targets.forEach(([target]) => { - const reference = Reference.unwrapReference(target as AnyEntity); + const reference = Reference.unwrapReference(target as object); this.processReference(entity, prop, reference, visited, idx); }); } @@ -510,46 +510,46 @@ export class UnitOfWork { } } - private checkUniqueProps>(changeSet: ChangeSet): boolean { + private checkUniqueProps(changeSet: ChangeSet): boolean { if (this.platform.allowsUniqueBatchUpdates() || changeSet.type !== ChangeSetType.UPDATE) { return false; } // when changing a unique nullable property (or a 1:1 relation), we can't do it in a single query as it would cause unique constraint violations - const uniqueProps = changeSet.entity.__meta!.uniqueProps.filter(prop => prop.nullable && changeSet.payload[prop.name] != null); + const uniqueProps = changeSet.meta.uniqueProps.filter(prop => prop.nullable && changeSet.payload[prop.name] != null); this.scheduleExtraUpdate(changeSet, uniqueProps); return changeSet.type === ChangeSetType.UPDATE && !Utils.hasObjectKeys(changeSet.payload); } - private expandUniqueProps>(entity: T): string[] { - return entity.__meta!.uniqueProps.map(prop => { + private expandUniqueProps(entity: T): string[] { + return helper(entity).__meta.uniqueProps.map(prop => { if (entity[prop.name]) { - return prop.reference === ReferenceType.SCALAR || prop.mapToPk ? entity[prop.name] : (entity[prop.name] as AnyEntity).__helper!.getSerializedPrimaryKey(); + return prop.reference === ReferenceType.SCALAR || prop.mapToPk ? entity[prop.name] : helper(entity[prop.name]).getSerializedPrimaryKey(); } return undefined; }).filter(i => i) as string[]; } - private checkOrphanRemoval>(changeSet: ChangeSet): void { + private checkOrphanRemoval(changeSet: ChangeSet): void { const meta = this.metadata.find(changeSet.name)!; const props = meta.relations.filter(prop => prop.reference === ReferenceType.ONE_TO_ONE); for (const prop of props) { // check diff, if we had a value on 1:1 before, and now it changed (nulled or replaced), we need to trigger orphan removal - const wrapped = changeSet.entity.__helper!; + const wrapped = helper(changeSet.entity); const data = wrapped.__originalEntityData; if (prop.orphanRemoval && data && data[prop.name] && prop.name in changeSet.payload) { const orphan = this.getById(prop.type, data[prop.name], wrapped.__schema); - this.scheduleOrphanRemoval(orphan); + this.scheduleOrphanRemoval(orphan as AnyEntity); } } } - private initIdentifier>(entity: T): void { - const wrapped = entity.__helper!; + private initIdentifier(entity: T): void { + const wrapped = helper(entity); if (wrapped.__identifier || wrapped.hasPrimaryKey()) { return; @@ -560,12 +560,12 @@ export class UnitOfWork { if (pk.reference === ReferenceType.SCALAR) { wrapped.__identifier = new EntityIdentifier(); } else { - this.initIdentifier(entity[pk.name]); + this.initIdentifier(entity[pk.name] as object); wrapped.__identifier = (entity[pk.name] as AnyEntity).__helper?.__identifier; } } - private processReference>(parent: T, prop: EntityProperty, reference: any, visited: Set, idx: number): void { + private processReference(parent: T, prop: EntityProperty, reference: any, visited: Set, idx: number): void { const isToOne = prop.reference === ReferenceType.MANY_TO_ONE || prop.reference === ReferenceType.ONE_TO_ONE; if (isToOne && Utils.isEntity(reference)) { @@ -577,7 +577,7 @@ export class UnitOfWork { .filter(item => !item.__helper!.__originalEntityData) .forEach(item => { // propagate schema from parent - item.__helper!.__schema ??= parent.__helper!.__schema; + item.__helper!.__schema ??= helper(parent).__schema; }); if (prop.reference === ReferenceType.MANY_TO_MANY && reference.isDirty()) { @@ -586,13 +586,13 @@ export class UnitOfWork { } } - private processToOneReference>(reference: any, visited: Set, idx: number): void { + private processToOneReference(reference: any, visited: Set, idx: number): void { if (!reference.__helper!.__managed) { this.findNewEntities(reference, visited, idx); } } - private processToManyReference>(collection: Collection, visited: Set, parent: T, prop: EntityProperty): void { + private processToManyReference(collection: Collection, visited: Set, parent: T, prop: EntityProperty): void { if (this.isCollectionSelfReferenced(collection, visited)) { this.extraUpdates.add([parent, prop.name, collection]); parent[prop.name as keyof T] = new Collection(parent) as unknown as T[keyof T]; @@ -605,8 +605,8 @@ export class UnitOfWork { .forEach(item => this.findNewEntities(item, visited)); } - private async runHooks>(type: EventType, changeSet: ChangeSet, sync = false): Promise { - const hasListeners = this.eventManager.hasListeners(type, changeSet.entity.__meta!); + private async runHooks(type: EventType, changeSet: ChangeSet, sync = false): Promise { + const hasListeners = this.eventManager.hasListeners(type, changeSet.meta); if (!hasListeners) { return; @@ -625,7 +625,7 @@ export class UnitOfWork { const current = this.comparator.prepareEntity(changeSet.entity) as T; const diff = this.comparator.diffEntities(changeSet.name, copy, current); Object.assign(changeSet.payload, diff); - const wrapped = changeSet.entity.__helper!; + const wrapped = helper(changeSet.entity); if (wrapped.__identifier && diff[wrapped.__meta.primaryKeys[0] as string]) { wrapped.__identifier.setValue(diff[wrapped.__meta.primaryKeys[0] as string] as IPrimaryKeyValue); @@ -635,7 +635,7 @@ export class UnitOfWork { } private postCommitCleanup(): void { - this.changeSets.forEach(cs => cs.entity.__helper!.__processing = false); + this.changeSets.forEach(cs => helper(cs.entity).__processing = false); this.persistStack.clear(); this.removeStack.clear(); this.orphanRemoveStack.clear(); @@ -647,7 +647,7 @@ export class UnitOfWork { this.insideHooks = false; } - private cascade>(entity: T, type: Cascade, visited = new Set(), options: { checkRemoveStack?: boolean; cascade?: boolean } = {}): void { + private cascade(entity: T, type: Cascade, visited = new Set(), options: { checkRemoveStack?: boolean; cascade?: boolean } = {}): void { if (visited.has(entity)) { return; } @@ -662,19 +662,19 @@ export class UnitOfWork { case Cascade.CANCEL_ORPHAN_REMOVAL: this.cancelOrphanRemoval(entity, visited); break; } - for (const prop of entity.__meta!.relations) { + for (const prop of helper(entity).__meta.relations) { this.cascadeReference(entity, prop, type, visited, options); } } - private cascadeReference>(entity: T, prop: EntityProperty, type: Cascade, visited: Set, options: { checkRemoveStack?: boolean }): void { + private cascadeReference(entity: T, prop: EntityProperty, type: Cascade, visited: Set, options: { checkRemoveStack?: boolean }): void { this.fixMissingReference(entity, prop); if (!this.shouldCascade(prop, type)) { return; } - const reference = Reference.unwrapReference(entity[prop.name]) as unknown as T | Collection; + const reference = Reference.unwrapReference(entity[prop.name] as object) as T | Collection; if ([ReferenceType.MANY_TO_ONE, ReferenceType.ONE_TO_ONE].includes(prop.reference) && Utils.isEntity(reference)) { return this.cascade(reference as T, type, visited, options); @@ -690,13 +690,13 @@ export class UnitOfWork { collection .getItems(false) - .filter(item => !requireFullyInitialized || item.__helper!.__initialized) + .filter(item => !requireFullyInitialized || helper(item).__initialized) .forEach(item => this.cascade(item, type, visited, options)); } } private isCollectionSelfReferenced(collection: Collection, visited: Set): boolean { - const filtered = collection.getItems(false).filter(item => !item.__helper!.__originalEntityData); + const filtered = collection.getItems(false).filter(item => !helper(item).__originalEntityData); return filtered.some(items => visited.has(items)); } @@ -713,7 +713,7 @@ export class UnitOfWork { return prop.cascade && (prop.cascade.includes(type) || prop.cascade.includes(Cascade.ALL)); } - private async lockPessimistic>(entity: T, options: LockOptions): Promise { + private async lockPessimistic(entity: T, options: LockOptions): Promise { if (!this.em.isInTransaction()) { throw ValidationError.transactionRequired(); } @@ -721,7 +721,7 @@ export class UnitOfWork { await this.em.getDriver().lockPessimistic(entity, { ctx: this.em.getTransactionContext(), ...options }); } - private async lockOptimistic>(entity: T, meta: EntityMetadata, version: number | Date): Promise { + private async lockOptimistic(entity: T, meta: EntityMetadata, version: number | Date): Promise { if (!meta.versionProperty) { throw OptimisticLockError.notVersioned(meta); } @@ -730,7 +730,7 @@ export class UnitOfWork { return; } - const wrapped = entity.__helper!; + const wrapped = helper(entity); if (!wrapped.__initialized) { await wrapped.init(); @@ -743,14 +743,14 @@ export class UnitOfWork { } } - private fixMissingReference>(entity: T, prop: EntityProperty): void { - const reference = Reference.unwrapReference(entity[prop.name]) as AnyEntity; + private fixMissingReference(entity: T, prop: EntityProperty): void { + const reference = Reference.unwrapReference(entity[prop.name] as object); if ([ReferenceType.MANY_TO_ONE, ReferenceType.ONE_TO_ONE].includes(prop.reference) && reference && !prop.mapToPk) { if (!Utils.isEntity(reference)) { entity[prop.name] = this.em.getReference(prop.type, reference as Primary, { wrapped: !!prop.wrappedReference }) as T[string & keyof T]; - } else if (!reference.__helper!.__initialized && !reference.__helper!.__em) { - const pk = reference.__helper!.getSerializedPrimaryKey(); + } else if (!helper(reference).__initialized && !helper(reference).__em) { + const pk = helper(reference).getSerializedPrimaryKey(); entity[prop.name] = this.em.getReference(prop.type, pk as Primary, { wrapped: !!prop.wrappedReference }) as T[string & keyof T]; } } @@ -824,13 +824,12 @@ export class UnitOfWork { } } - private async commitCreateChangeSets>(changeSets: ChangeSet[], ctx?: Transaction): Promise { + private async commitCreateChangeSets(changeSets: ChangeSet[], ctx?: Transaction): Promise { if (changeSets.length === 0) { return; } - const meta = changeSets[0].entity.__meta!; - const props = meta.relations.filter(prop => { + const props = changeSets[0].meta.relations.filter(prop => { return (prop.reference === ReferenceType.ONE_TO_ONE && prop.owner) || prop.reference === ReferenceType.MANY_TO_ONE; }); @@ -847,13 +846,13 @@ export class UnitOfWork { } } - private findExtraUpdates>(changeSet: ChangeSet, props: EntityProperty[]): void { + private findExtraUpdates(changeSet: ChangeSet, props: EntityProperty[]): void { for (const prop of props) { if (!changeSet.entity[prop.name]) { continue; } - const cs = this.changeSets.get(Reference.unwrapReference(changeSet.entity[prop.name])); + const cs = this.changeSets.get(Reference.unwrapReference(changeSet.entity[prop.name] as object)); const isScheduledForInsert = cs && cs.type === ChangeSetType.CREATE && !cs.persisted; if (isScheduledForInsert) { @@ -862,7 +861,7 @@ export class UnitOfWork { } } - private async commitUpdateChangeSets>(changeSets: ChangeSet[], ctx?: Transaction, batched = true): Promise { + private async commitUpdateChangeSets(changeSets: ChangeSet[], ctx?: Transaction, batched = true): Promise { if (changeSets.length === 0) { return; } @@ -874,13 +873,13 @@ export class UnitOfWork { await this.changeSetPersister.executeUpdates(changeSets, batched, { ctx }); for (const changeSet of changeSets) { - changeSet.entity.__helper!.__originalEntityData = this.comparator.prepareEntity(changeSet.entity); - changeSet.entity.__helper!.__touched = false; + helper(changeSet.entity).__originalEntityData = this.comparator.prepareEntity(changeSet.entity); + helper(changeSet.entity).__touched = false; await this.runHooks(EventType.afterUpdate, changeSet); } } - private async commitDeleteChangeSets>(changeSets: ChangeSet[], ctx?: Transaction): Promise { + private async commitDeleteChangeSets(changeSets: ChangeSet[], ctx?: Transaction): Promise { if (changeSets.length === 0) { return; } @@ -947,13 +946,13 @@ export class UnitOfWork { /** * Takes snapshots of all processed collections */ - private takeCollectionSnapshots>(entity: T, visited: Set) { + private takeCollectionSnapshots(entity: T, visited: Set) { if (visited.has(entity)) { return; } visited.add(entity); - entity.__meta?.relations.forEach(prop => { + helper(entity)?.__meta.relations.forEach(prop => { const value = entity[prop.name]; if (Utils.isCollection(value)) { diff --git a/packages/core/src/utils/Configuration.ts b/packages/core/src/utils/Configuration.ts index 124f0c89a915..38d9cc003cad 100644 --- a/packages/core/src/utils/Configuration.ts +++ b/packages/core/src/utils/Configuration.ts @@ -3,7 +3,7 @@ import { inspect } from 'util'; import type { NamingStrategy } from '../naming-strategy'; import type { CacheAdapter } from '../cache'; import { FileCacheAdapter, NullCacheAdapter } from '../cache'; -import type { EntityRepository } from '../entity'; +import type { EntityRepository } from '../entity/EntityRepository'; import type { AnyEntity, Constructor, diff --git a/packages/core/src/utils/EntityComparator.ts b/packages/core/src/utils/EntityComparator.ts index 8d7a7dd273d2..eb78d5124ed2 100644 --- a/packages/core/src/utils/EntityComparator.ts +++ b/packages/core/src/utils/EntityComparator.ts @@ -1,5 +1,5 @@ import { clone } from './clone'; -import type { AnyEntity, EntityData, EntityDictionary, EntityMetadata, EntityProperty, IMetadataStorage, Primary } from '../typings'; +import type { Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityProperty, IMetadataStorage, Primary } from '../typings'; import { ReferenceType } from '../enums'; import type { Platform } from '../platforms'; import { compareArrays, compareBuffers, compareObjects, equals, Utils } from './Utils'; @@ -35,15 +35,15 @@ export class EntityComparator { * Removes ORM specific code from entities and prepares it for serializing. Used before change set computation. * References will be mapped to primary keys, collections to arrays of primary keys. */ - prepareEntity>(entity: T): EntityData { - const generator = this.getSnapshotGenerator(entity.constructor.name); + prepareEntity(entity: T): EntityData { + const generator = this.getSnapshotGenerator((entity as Dictionary).constructor.name); return Utils.callCompiledFunction(generator, entity); } /** * Maps database columns to properties. */ - mapResult>(entityName: string, result: EntityDictionary): EntityData | null { + mapResult(entityName: string, result: EntityDictionary): EntityData | null { const mapper = this.getResultMapper(entityName); return Utils.callCompiledFunction(mapper, result); } @@ -51,7 +51,7 @@ export class EntityComparator { /** * @internal Highly performance-sensitive method. */ - getPkGetter>(meta: EntityMetadata) { + getPkGetter(meta: EntityMetadata) { const exists = this.pkGetters.get(meta.className); /* istanbul ignore next */ @@ -95,7 +95,7 @@ export class EntityComparator { /** * @internal Highly performance-sensitive method. */ - getPkGetterConverted>(meta: EntityMetadata) { + getPkGetterConverted(meta: EntityMetadata) { const exists = this.pkGettersConverted.get(meta.className); /* istanbul ignore next */ @@ -144,7 +144,7 @@ export class EntityComparator { /** * @internal Highly performance-sensitive method. */ - getPkSerializer>(meta: EntityMetadata) { + getPkSerializer(meta: EntityMetadata) { const exists = this.pkSerializers.get(meta.className); /* istanbul ignore next */ @@ -187,7 +187,7 @@ export class EntityComparator { /** * @internal Highly performance-sensitive method. */ - getSnapshotGenerator>(entityName: string): SnapshotGenerator { + getSnapshotGenerator(entityName: string): SnapshotGenerator { const exists = this.snapshotGenerators.get(entityName); if (exists) { @@ -224,7 +224,7 @@ export class EntityComparator { /** * @internal Highly performance-sensitive method. */ - getResultMapper>(entityName: string): ResultMapper { + getResultMapper(entityName: string): ResultMapper { const exists = this.mappers.get(entityName); if (exists) { @@ -460,7 +460,7 @@ export class EntityComparator { /** * @internal Highly performance-sensitive method. */ - getEntityComparator(entityName: string): Comparator { + getEntityComparator(entityName: string): Comparator { const exists = this.comparators.get(entityName); if (exists) { @@ -555,7 +555,7 @@ export class EntityComparator { /** * perf: used to generate list of comparable properties during discovery, so we speed up the runtime comparison */ - static isComparable>(prop: EntityProperty, root: EntityMetadata) { + static isComparable(prop: EntityProperty, root: EntityMetadata) { const virtual = prop.persist === false; const inverse = prop.reference === ReferenceType.ONE_TO_ONE && !prop.owner; const discriminator = prop.name === root.discriminatorColumn; diff --git a/packages/core/src/utils/QueryHelper.ts b/packages/core/src/utils/QueryHelper.ts index 7e32cbb96df1..75458919b0f0 100644 --- a/packages/core/src/utils/QueryHelper.ts +++ b/packages/core/src/utils/QueryHelper.ts @@ -1,10 +1,11 @@ import { Reference } from '../entity/Reference'; import { Utils } from './Utils'; -import type { AnyEntity, Dictionary, EntityMetadata, EntityProperty, FilterDef, ObjectQuery, FilterQuery } from '../typings'; +import type { Dictionary, EntityMetadata, EntityProperty, FilterDef, ObjectQuery, FilterQuery } from '../typings'; import { ARRAY_OPERATORS, GroupOperator, ReferenceType } from '../enums'; import type { Platform } from '../platforms'; import type { MetadataStorage } from '../metadata/MetadataStorage'; import { JsonType } from '../types/JsonType'; +import { helper } from '../entity/wrap'; export class QueryHelper { @@ -16,11 +17,11 @@ export class QueryHelper { } if (Utils.isEntity(params)) { - if (params.__meta!.compositePK) { - return params.__helper!.__primaryKeys; + if (helper(params).__meta.compositePK) { + return helper(params).__primaryKeys; } - return params.__helper!.getPrimaryKey(); + return helper(params).getPrimaryKey(); } if (params === undefined) { @@ -28,7 +29,7 @@ export class QueryHelper { } if (Array.isArray(params)) { - return params.map(item => QueryHelper.processParams(item)); + return (params as unknown[]).map(item => QueryHelper.processParams(item)); } if (Utils.isPlainObject(params)) { @@ -46,7 +47,7 @@ export class QueryHelper { return params; } - static inlinePrimaryKeyObjects>(where: Dictionary, meta: EntityMetadata, metadata: MetadataStorage, key?: string): boolean { + static inlinePrimaryKeyObjects(where: Dictionary, meta: EntityMetadata, metadata: MetadataStorage, key?: string): boolean { if (Array.isArray(where)) { where.forEach((item, i) => { if (this.inlinePrimaryKeyObjects(item, meta, metadata, key)) { @@ -84,7 +85,7 @@ export class QueryHelper { return false; } - static processWhere(options: ProcessWhereOptions): FilterQuery { + static processWhere(options: ProcessWhereOptions): FilterQuery { // eslint-disable-next-line prefer-const let { where, entityName, metadata, platform, aliased = true, convertCustomTypes = true, root = true } = options; const meta = metadata.find(entityName); diff --git a/packages/core/src/utils/Utils.ts b/packages/core/src/utils/Utils.ts index 128097d498d8..aa40db29dcf9 100644 --- a/packages/core/src/utils/Utils.ts +++ b/packages/core/src/utils/Utils.ts @@ -9,10 +9,11 @@ import { pathExists } from 'fs-extra'; import { createHash } from 'crypto'; import { recovery } from 'escaya'; import { clone } from './clone'; -import type { AnyEntity, Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityName, EntityProperty, IMetadataStorage, Primary } from '../typings'; +import type { Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityName, EntityProperty, IMetadataStorage, Primary } from '../typings'; import { GroupOperator, PlainObject, QueryOperator, ReferenceType } from '../enums'; import type { Collection } from '../entity'; import type { Platform } from '../platforms'; +import { helper } from '../entity/wrap'; export const ObjectBindingPattern = Symbol('ObjectBindingPattern'); @@ -342,7 +343,7 @@ export class Utils { return Array.from(data); } - return Array.isArray(data!) ? data : [data!]; + return Array.isArray(data!) ? data : [data as T]; } /** @@ -353,7 +354,7 @@ export class Utils { Object.keys(payload).forEach(key => { const value = payload[key]; delete payload[key]; - payload[from === key ? to : key] = value; + payload[from === key ? to : key as keyof T] = value; }, payload); } } @@ -428,13 +429,13 @@ export class Utils { /** * Extracts primary key from `data`. Accepts objects or primary keys directly. */ - static extractPK>(data: any, meta?: EntityMetadata, strict = false): Primary | string | null { + static extractPK(data: any, meta?: EntityMetadata, strict = false): Primary | string | null { if (Utils.isPrimaryKey(data)) { return data as Primary; } if (Utils.isEntity(data, true)) { - return data.__helper!.getPrimaryKey(); + return helper(data).getPrimaryKey(); } if (strict && meta && Utils.getObjectKeysSize(data) !== meta.primaryKeys.length) { @@ -452,7 +453,7 @@ export class Utils { return null; } - static getCompositeKeyHash>(data: EntityData, meta: EntityMetadata, convertCustomTypes = false, platform?: Platform): string { + static getCompositeKeyHash(data: EntityData, meta: EntityMetadata, convertCustomTypes = false, platform?: Platform): string { const pks = meta.primaryKeys.map(pk => { const value = data[pk as string]; const prop = meta.properties[pk]; @@ -479,7 +480,7 @@ export class Utils { return key.split(this.PK_SEPARATOR); } - static getPrimaryKeyValues>(entity: T, primaryKeys: string[], allowScalar = false, convertCustomTypes = false) { + static getPrimaryKeyValues(entity: T, primaryKeys: string[], allowScalar = false, convertCustomTypes = false) { if (allowScalar && primaryKeys.length === 1) { if (Utils.isEntity(entity[primaryKeys[0]], true)) { return entity[primaryKeys[0]].__helper!.getPrimaryKey(convertCustomTypes); @@ -505,7 +506,7 @@ export class Utils { }, [] as Primary[]); } - static getPrimaryKeyCond>(entity: T, primaryKeys: string[]): Record> | null { + static getPrimaryKeyCond(entity: T, primaryKeys: string[]): Record> | null { const cond = primaryKeys.reduce((o, pk) => { o[pk] = Utils.extractPK(entity[pk]); return o; @@ -518,7 +519,7 @@ export class Utils { return cond; } - static getPrimaryKeyCondFromArray>(pks: Primary[], meta: EntityMetadata): Record> { + static getPrimaryKeyCondFromArray(pks: Primary[], meta: EntityMetadata): Record> { return meta.getPrimaryProps().reduce((o, pk, idx) => { if (Array.isArray(pks[idx]) && pk.targetMeta) { o[pk.name] = pks[idx]; @@ -530,7 +531,7 @@ export class Utils { }, {} as any); } - static getOrderedPrimaryKeys>(id: Primary | Record>, meta: EntityMetadata, platform?: Platform, convertCustomTypes?: boolean): Primary[] { + static getOrderedPrimaryKeys(id: Primary | Record>, meta: EntityMetadata, platform?: Platform, convertCustomTypes?: boolean): Primary[] { const data = (Utils.isPrimaryKey(id) ? { [meta.primaryKeys[0]]: id } : id) as Record>; const pks = meta.primaryKeys.map((pk, idx) => { const prop = meta.properties[pk]; @@ -557,7 +558,7 @@ export class Utils { /** * Checks whether given object is an entity instance. */ - static isEntity(data: any, allowReference = false): data is T { + static isEntity(data: any, allowReference = false): data is T { if (!Utils.isObject(data)) { return false; } @@ -675,7 +676,7 @@ export class Utils { return ret; } - static isCollection(item: any): item is Collection { + static isCollection(item: any): item is Collection { return item?.__collection; } @@ -983,7 +984,7 @@ export class Utils { ret.push([target, i]); } }; - follow(entity); + follow(entity as Dictionary); return ret; } @@ -1033,7 +1034,7 @@ export class Utils { }); } - static tryRequire({ module, from, allowError, warning }: { module: string; warning: string; from?: string; allowError?: string }): T | undefined { + static tryRequire({ module, from, allowError, warning }: { module: string; warning: string; from?: string; allowError?: string }): T | undefined { allowError ??= `Cannot find module '${module}'`; from ??= process.cwd(); diff --git a/packages/knex/src/AbstractSqlDriver.ts b/packages/knex/src/AbstractSqlDriver.ts index 65233accf1f8..e324e914488c 100644 --- a/packages/knex/src/AbstractSqlDriver.ts +++ b/packages/knex/src/AbstractSqlDriver.ts @@ -5,7 +5,7 @@ import type { FindOneOptions, FindOptions, IDatabaseDriver, LockOptions, NativeInsertUpdateManyOptions, NativeInsertUpdateOptions, PopulateOptions, Primary, QueryOrderMap, QueryResult, RequiredEntityData, Transaction, } from '@mikro-orm/core'; -import { DatabaseDriver, EntityManagerType, LoadStrategy, QueryFlag, QueryHelper, ReferenceType, Utils } from '@mikro-orm/core'; +import { DatabaseDriver, EntityManagerType, helper, LoadStrategy, QueryFlag, QueryHelper, ReferenceType, Utils } from '@mikro-orm/core'; import type { AbstractSqlConnection } from './AbstractSqlConnection'; import type { AbstractSqlPlatform } from './AbstractSqlPlatform'; import { QueryBuilder } from './query/QueryBuilder'; @@ -35,7 +35,7 @@ export abstract class AbstractSqlDriver; } - async find(entityName: string, where: FilterQuery, options: FindOptions = {}): Promise[]> { + async find(entityName: string, where: FilterQuery, options: FindOptions = {}): Promise[]> { options = { populate: [], orderBy: [], ...options }; const meta = this.metadata.find(entityName)!; @@ -79,7 +79,7 @@ export abstract class AbstractSqlDriver(entityName: string, where: FilterQuery, options?: FindOneOptions): Promise | null> { + async findOne(entityName: string, where: FilterQuery, options?: FindOneOptions): Promise | null> { const opts = { populate: [], ...(options || {}) } as FindOptions; const meta = this.metadata.find(entityName)!; const populate = this.autoJoinOneToOneOwner(meta, opts.populate as unknown as PopulateOptions[], opts.fields); @@ -99,7 +99,7 @@ export abstract class AbstractSqlDriver(entityName: string, where: FilterQuery, options: FindOptions): Promise[]> { + async findVirtual(entityName: string, where: FilterQuery, options: FindOptions): Promise[]> { const meta = this.metadata.get(entityName); /* istanbul ignore next */ @@ -122,7 +122,7 @@ export abstract class AbstractSqlDriver[]; } - protected async wrapVirtualExpressionInSubquery(meta: EntityMetadata, expression: string, where: FilterQuery, options: FindOptions) { + protected async wrapVirtualExpressionInSubquery(meta: EntityMetadata, expression: string, where: FilterQuery, options: FindOptions) { const qb = this.createQueryBuilder(meta.className, options?.ctx, options.connectionType, options.convertCustomTypes) .limit(options?.limit, options?.offset); @@ -140,7 +140,7 @@ export abstract class AbstractSqlDriver this.mapResult(row, meta)!); } - mapResult(result: EntityData, meta: EntityMetadata, populate: PopulateOptions[] = [], qb?: QueryBuilder, map: Dictionary = {}): EntityData | null { + mapResult(result: EntityData, meta: EntityMetadata, populate: PopulateOptions[] = [], qb?: QueryBuilder, map: Dictionary = {}): EntityData | null { const ret = super.mapResult(result, meta); /* istanbul ignore if */ @@ -155,7 +155,7 @@ export abstract class AbstractSqlDriver>(result: EntityData, meta: EntityMetadata, populate: PopulateOptions[], qb: QueryBuilder, root: EntityData, map: Dictionary, parentJoinPath?: string) { + private mapJoinedProps(result: EntityData, meta: EntityMetadata, populate: PopulateOptions[], qb: QueryBuilder, root: EntityData, map: Dictionary, parentJoinPath?: string) { const joinedProps = this.joinedProps(meta, populate); joinedProps.forEach(p => { @@ -219,7 +219,7 @@ export abstract class AbstractSqlDriver>(meta: EntityMetadata, collection: EntityData[], relationPojo: EntityData): void { + private appendToCollection(meta: EntityMetadata, collection: EntityData[], relationPojo: EntityData): void { if (collection.length === 0) { return void collection.push(relationPojo); } @@ -233,7 +233,7 @@ export abstract class AbstractSqlDriver>(entityName: string, where: any, options: CountOptions = {}): Promise { + async count(entityName: string, where: any, options: CountOptions = {}): Promise { const meta = this.metadata.find(entityName); const qb = this.createQueryBuilder(entityName, options.ctx, options.connectionType, false) .groupBy(options.groupBy!) @@ -245,7 +245,7 @@ export abstract class AbstractSqlDriver>(entityName: string, data: EntityDictionary, options: NativeInsertUpdateOptions = {}): Promise> { + async nativeInsert(entityName: string, data: EntityDictionary, options: NativeInsertUpdateOptions = {}): Promise> { options.convertCustomTypes ??= true; const meta = this.metadata.find(entityName)!; const collections = this.extractManyToMany(entityName, data); @@ -267,7 +267,7 @@ export abstract class AbstractSqlDriver>(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { + async nativeInsertMany(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { options.processCollections ??= true; options.convertCustomTypes ??= true; const meta = this.metadata.get(entityName); @@ -336,7 +336,7 @@ export abstract class AbstractSqlDriver>(entityName: string, where: FilterQuery, data: EntityDictionary, options: NativeInsertUpdateOptions = {}): Promise> { + async nativeUpdate(entityName: string, where: FilterQuery, data: EntityDictionary, options: NativeInsertUpdateOptions = {}): Promise> { options.convertCustomTypes ??= true; const meta = this.metadata.find(entityName); const pks = this.getPrimaryKeyFields(entityName); @@ -363,7 +363,7 @@ export abstract class AbstractSqlDriver>(entityName: string, where: FilterQuery[], data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { + async nativeUpdateMany(entityName: string, where: FilterQuery[], data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { options.processCollections ??= true; options.convertCustomTypes ??= true; const meta = this.metadata.get(entityName); @@ -437,7 +437,7 @@ export abstract class AbstractSqlDriver>(entityName: string, where: FilterQuery | string | any, options: DeleteOptions = {}): Promise> { + async nativeDelete(entityName: string, where: FilterQuery | string | any, options: DeleteOptions = {}): Promise> { const meta = this.metadata.find(entityName); const pks = this.getPrimaryKeyFields(entityName); @@ -450,14 +450,14 @@ export abstract class AbstractSqlDriver, O extends AnyEntity>(coll: Collection, options?: DriverMethodOptions): Promise { - const wrapped = coll.owner.__helper!; + async syncCollection(coll: Collection, options?: DriverMethodOptions): Promise { + const wrapped = helper(coll.owner); const meta = wrapped.__meta; const pks = wrapped.getPrimaryKeys(true)!; const snap = coll.getSnapshot(); const includes = (arr: T[], item: T) => !!arr.find(i => Utils.equals(i, item)); - const snapshot = snap ? snap.map(item => item.__helper!.getPrimaryKeys(true)!) : []; - const current = coll.getItems(false).map(item => item.__helper!.getPrimaryKeys(true)!); + const snapshot = snap ? snap.map(item => helper(item).getPrimaryKeys(true)!) : []; + const current = coll.getItems(false).map(item => helper(item).getPrimaryKeys(true)!); const deleteDiff = snap ? snapshot.filter(item => !includes(current, item)) : true; const insertDiff = current.filter(item => !includes(snapshot, item)); const target = snapshot.filter(item => includes(current, item)).concat(...insertDiff); @@ -495,7 +495,7 @@ export abstract class AbstractSqlDriver(meta, coll.property, pks, deleteDiff, insertDiff, options)); } - async loadFromPivotTable(prop: EntityProperty, owners: Primary[][], where: FilterQuery = {} as FilterQuery, orderBy?: QueryOrderMap[], ctx?: Transaction, options?: FindOptions): Promise> { + async loadFromPivotTable(prop: EntityProperty, owners: Primary[][], where: FilterQuery = {} as FilterQuery, orderBy?: QueryOrderMap[], ctx?: Transaction, options?: FindOptions): Promise> { const pivotProp2 = this.getPivotInverseProperty(prop); const ownerMeta = this.metadata.find(pivotProp2.type)!; const pivotMeta = this.metadata.find(prop.pivotEntity)!; @@ -561,7 +561,7 @@ export abstract class AbstractSqlDriver(meta: EntityMetadata, populate: PopulateOptions[], fields: readonly EntityField[] = []): PopulateOptions[] { + protected autoJoinOneToOneOwner(meta: EntityMetadata, populate: PopulateOptions[], fields: readonly EntityField[] = []): PopulateOptions[] { if (!this.config.get('autoJoinOneToOneOwner')) { return populate; } @@ -585,7 +585,7 @@ export abstract class AbstractSqlDriver>(rawResults: EntityData[], meta: EntityMetadata): EntityData[] { + mergeJoinedResult(rawResults: EntityData[], meta: EntityMetadata): EntityData[] { // group by the root entity primary key first const map: Dictionary = {}; const res: EntityData[] = []; @@ -603,7 +603,7 @@ export abstract class AbstractSqlDriver>(qb: QueryBuilder, meta: EntityMetadata, explicitFields?: Field[], populate: PopulateOptions[] = [], parentTableAlias?: string, parentJoinPath?: string): Field[] { + protected getFieldsForJoinedLoad(qb: QueryBuilder, meta: EntityMetadata, explicitFields?: Field[], populate: PopulateOptions[] = [], parentTableAlias?: string, parentJoinPath?: string): Field[] { const fields: Field[] = []; const joinedProps = this.joinedProps(meta, populate); @@ -648,7 +648,7 @@ export abstract class AbstractSqlDriver>(qb: QueryBuilder, prop: EntityProperty, tableAlias?: string): Field[] { + mapPropToFieldNames(qb: QueryBuilder, prop: EntityProperty, tableAlias?: string): Field[] { const aliased = qb.ref(tableAlias ? `${tableAlias}__${prop.fieldNames[0]}` : prop.fieldNames[0]).toString(); if (prop.customType?.convertToJSValueSQL && tableAlias) { @@ -669,7 +669,7 @@ export abstract class AbstractSqlDriver>(entityName: string, ctx?: Transaction, preferredConnectionType?: ConnectionType, convertCustomTypes?: boolean): QueryBuilder { + createQueryBuilder(entityName: string, ctx?: Transaction, preferredConnectionType?: ConnectionType, convertCustomTypes?: boolean): QueryBuilder { const connectionType = this.resolveConnectionType({ ctx, connectionType: preferredConnectionType }); const qb = new QueryBuilder(entityName, this.metadata, this, ctx, undefined, connectionType); @@ -692,7 +692,7 @@ export abstract class AbstractSqlDriver>(entityName: string, data: EntityDictionary): EntityData { + protected extractManyToMany(entityName: string, data: EntityDictionary): EntityData { if (!this.metadata.has(entityName)) { return {}; } @@ -709,7 +709,7 @@ export abstract class AbstractSqlDriver>(meta: EntityMetadata | undefined, pks: Primary[], collections: EntityData, clear: boolean, options?: DriverMethodOptions) { + protected async processManyToMany(meta: EntityMetadata | undefined, pks: Primary[], collections: EntityData, clear: boolean, options?: DriverMethodOptions) { if (!meta) { return; } @@ -721,7 +721,7 @@ export abstract class AbstractSqlDriver, O extends AnyEntity>( + protected async updateCollectionDiff( meta: EntityMetadata, prop: EntityProperty, pks: Primary[], @@ -773,15 +773,15 @@ export abstract class AbstractSqlDriver>(entity: T, options: LockOptions): Promise { - const meta = entity.__helper!.__meta; - const qb = this.createQueryBuilder(entity.constructor.name, options.ctx).unsetFlag(QueryFlag.CONVERT_CUSTOM_TYPES).withSchema(options.schema ?? meta.schema); + async lockPessimistic(entity: T, options: LockOptions): Promise { + const meta = helper(entity).__meta; + const qb = this.createQueryBuilder((entity as object).constructor.name, options.ctx).unsetFlag(QueryFlag.CONVERT_CUSTOM_TYPES).withSchema(options.schema ?? meta.schema); const cond = Utils.getPrimaryKeyCond(entity, meta.primaryKeys); qb.select('1').where(cond!).setLockMode(options.lockMode, options.lockTableAliases); await this.rethrow(qb.execute()); } - protected buildJoinedPropsOrderBy>(entityName: string, qb: QueryBuilder, meta: EntityMetadata, populate: PopulateOptions[], parentPath?: string): QueryOrderMap[] { + protected buildJoinedPropsOrderBy(entityName: string, qb: QueryBuilder, meta: EntityMetadata, populate: PopulateOptions[], parentPath?: string): QueryOrderMap[] { const orderBy: QueryOrderMap[] = []; const joinedProps = this.joinedProps(meta, populate); @@ -806,7 +806,7 @@ export abstract class AbstractSqlDriver>(meta: EntityMetadata, populate: PopulateOptions[], joinedProps: PopulateOptions[], qb: QueryBuilder, fields?: Field[]): Field[] { + protected buildFields(meta: EntityMetadata, populate: PopulateOptions[], joinedProps: PopulateOptions[], qb: QueryBuilder, fields?: Field[]): Field[] { const lazyProps = meta.props.filter(prop => prop.lazy && !populate.some(p => p.field === prop.name || p.all)); const hasLazyFormulas = meta.props.some(p => p.lazy && p.formula); const requiresSQLConversion = meta.props.some(p => p.customType?.convertToJSValueSQL); diff --git a/packages/knex/src/AbstractSqlPlatform.ts b/packages/knex/src/AbstractSqlPlatform.ts index 6eee88a56513..65836d707d33 100644 --- a/packages/knex/src/AbstractSqlPlatform.ts +++ b/packages/knex/src/AbstractSqlPlatform.ts @@ -4,7 +4,6 @@ import { JsonProperty, Platform, Utils } from '@mikro-orm/core'; import { SqlEntityRepository } from './SqlEntityRepository'; import type { SchemaHelper } from './schema'; import { SchemaGenerator } from './schema'; -import type { SqlEntityManager } from './SqlEntityManager'; export abstract class AbstractSqlPlatform extends Platform { @@ -18,15 +17,15 @@ export abstract class AbstractSqlPlatform extends Platform { return true; } - getRepositoryClass(): Constructor> { - return SqlEntityRepository; + getRepositoryClass(): Constructor> { + return SqlEntityRepository as Constructor>; } getSchemaHelper(): SchemaHelper | undefined { return this.schemaHelper; } - getSchemaGenerator(driver: IDatabaseDriver, em?: SqlEntityManager): SchemaGenerator { + getSchemaGenerator(driver: IDatabaseDriver, em?: EntityManager): SchemaGenerator { /* istanbul ignore next */ return this.config.getCachedService(SchemaGenerator, em ?? driver as any); // cast as `any` to get around circular dependencies } diff --git a/packages/knex/src/SqlEntityManager.ts b/packages/knex/src/SqlEntityManager.ts index 95f58f641cd6..fbe90de16fd9 100644 --- a/packages/knex/src/SqlEntityManager.ts +++ b/packages/knex/src/SqlEntityManager.ts @@ -13,7 +13,7 @@ export class SqlEntityManager e /** * Creates a QueryBuilder instance */ - createQueryBuilder(entityName: EntityName, alias?: string, type?: ConnectionType): QueryBuilder { + createQueryBuilder(entityName: EntityName, alias?: string, type?: ConnectionType): QueryBuilder { entityName = Utils.className(entityName); const context = this.getContext(); @@ -23,7 +23,7 @@ export class SqlEntityManager e /** * Shortcut for `createQueryBuilder()` */ - qb(entityName: EntityName, alias?: string, type?: ConnectionType) { + qb(entityName: EntityName, alias?: string, type?: ConnectionType) { return this.createQueryBuilder(entityName, alias, type); } @@ -48,7 +48,7 @@ export class SqlEntityManager e return this.getDriver().execute(queryOrKnex, params, method, this.getTransactionContext()); } - getRepository, U extends EntityRepository = SqlEntityRepository>(entityName: EntityName): GetRepository { + getRepository = SqlEntityRepository>(entityName: EntityName): GetRepository { return super.getRepository(entityName); } diff --git a/packages/knex/src/SqlEntityRepository.ts b/packages/knex/src/SqlEntityRepository.ts index 11e1ea088a5b..e7afc738facc 100644 --- a/packages/knex/src/SqlEntityRepository.ts +++ b/packages/knex/src/SqlEntityRepository.ts @@ -4,7 +4,7 @@ import { EntityRepository } from '@mikro-orm/core'; import type { SqlEntityManager } from './SqlEntityManager'; import type { QueryBuilder } from './query'; -export class SqlEntityRepository extends EntityRepository { +export class SqlEntityRepository extends EntityRepository { constructor(protected readonly _em: SqlEntityManager, protected readonly entityName: EntityName) { diff --git a/packages/knex/src/query/QueryBuilder.ts b/packages/knex/src/query/QueryBuilder.ts index 9a768a0cc972..5cf68894ca4d 100644 --- a/packages/knex/src/query/QueryBuilder.ts +++ b/packages/knex/src/query/QueryBuilder.ts @@ -30,7 +30,7 @@ import type { Field, JoinOptions } from '../typings'; * const publisher = await qb.getSingleResult(); * ``` */ -export class QueryBuilder = AnyEntity> { +export class QueryBuilder { readonly alias: string; @@ -175,7 +175,7 @@ export class QueryBuilder = AnyEntity> { return this.joinAndSelect(field, alias, cond, 'leftJoin'); } - protected getFieldsForJoinedLoad>(prop: EntityProperty, alias: string): Field[] { + protected getFieldsForJoinedLoad(prop: EntityProperty, alias: string): Field[] { const fields: Field[] = []; prop.targetMeta!.props .filter(prop => this.platform.shouldHaveColumn(prop, this._populate)) @@ -503,7 +503,7 @@ export class QueryBuilder = AnyEntity> { return mapped; } - const mapped = this.driver.mapResult(res as unknown as T, meta, this._populate, this) as unknown as U; + const mapped = this.driver.mapResult(res, meta, this._populate, this) as unknown as U; await this.em?.storeCache(this._cache, cached!, mapped); return mapped; @@ -684,7 +684,7 @@ export class QueryBuilder = AnyEntity> { return prop; } - private prepareFields, U extends string | Knex.Raw>(fields: Field[], type: 'where' | 'groupBy' | 'sub-query' = 'where'): U[] { + private prepareFields(fields: Field[], type: 'where' | 'groupBy' | 'sub-query' = 'where'): U[] { const ret: Field[] = []; fields.forEach(field => { @@ -953,13 +953,13 @@ export class QueryBuilder = AnyEntity> { } -export interface RunQueryBuilder extends Omit, 'getResult' | 'getSingleResult' | 'getResultList' | 'where'> { +export interface RunQueryBuilder extends Omit, 'getResult' | 'getSingleResult' | 'getResultList' | 'where'> { where(cond: QBFilterQuery | string, params?: keyof typeof GroupOperator | any[], operator?: keyof typeof GroupOperator): this; execute>(method?: 'all' | 'get' | 'run', mapResults?: boolean): Promise; then, TResult2 = never>(onfulfilled?: ((value: QueryResult) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise>; } -export interface SelectQueryBuilder extends QueryBuilder { +export interface SelectQueryBuilder extends QueryBuilder { execute(method?: 'all' | 'get' | 'run', mapResults?: boolean): Promise; execute(method: 'all', mapResults?: boolean): Promise; execute(method: 'get', mapResults?: boolean): Promise; @@ -967,7 +967,7 @@ export interface SelectQueryBuilder extends QueryBuilder { then(onfulfilled?: ((value: T[]) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; } -export interface CountQueryBuilder extends QueryBuilder { +export interface CountQueryBuilder extends QueryBuilder { execute(method?: 'all' | 'get' | 'run', mapResults?: boolean): Promise; execute(method: 'all', mapResults?: boolean): Promise; execute(method: 'get', mapResults?: boolean): Promise; @@ -975,10 +975,10 @@ export interface CountQueryBuilder extends QueryBuilder { then(onfulfilled?: ((value: number) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; } -export interface InsertQueryBuilder extends RunQueryBuilder {} +export interface InsertQueryBuilder extends RunQueryBuilder {} -export interface UpdateQueryBuilder extends RunQueryBuilder {} +export interface UpdateQueryBuilder extends RunQueryBuilder {} -export interface DeleteQueryBuilder extends RunQueryBuilder {} +export interface DeleteQueryBuilder extends RunQueryBuilder {} -export interface TruncateQueryBuilder extends RunQueryBuilder {} +export interface TruncateQueryBuilder extends RunQueryBuilder {} diff --git a/packages/mariadb/src/MariaDbDriver.ts b/packages/mariadb/src/MariaDbDriver.ts index 83aa01c78242..ba29288498e2 100644 --- a/packages/mariadb/src/MariaDbDriver.ts +++ b/packages/mariadb/src/MariaDbDriver.ts @@ -1,4 +1,4 @@ -import type { AnyEntity, Configuration, EntityDictionary, NativeInsertUpdateManyOptions, QueryResult } from '@mikro-orm/core'; +import type { Configuration, EntityDictionary, NativeInsertUpdateManyOptions, QueryResult } from '@mikro-orm/core'; import { AbstractSqlDriver } from '@mikro-orm/knex'; import { MariaDbConnection } from './MariaDbConnection'; import { MariaDbPlatform } from './MariaDbPlatform'; @@ -9,7 +9,7 @@ export class MariaDbDriver extends AbstractSqlDriver { super(config, new MariaDbPlatform(), MariaDbConnection, ['knex', 'mariadb']); } - async nativeInsertMany>(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { + async nativeInsertMany(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { options.processCollections ??= true; const res = await super.nativeInsertMany(entityName, data, options); const pks = this.getPrimaryKeyFields(entityName); diff --git a/packages/migrations-mongodb/src/Migration.ts b/packages/migrations-mongodb/src/Migration.ts index d0124bc5ac67..0b23ab73419e 100644 --- a/packages/migrations-mongodb/src/Migration.ts +++ b/packages/migrations-mongodb/src/Migration.ts @@ -1,6 +1,6 @@ import type { Configuration, Transaction, EntityName } from '@mikro-orm/core'; import type { MongoDriver } from '@mikro-orm/mongodb'; -import type { Collection, ClientSession } from 'mongodb'; +import type { Collection, ClientSession, Document } from 'mongodb'; export abstract class Migration { @@ -27,7 +27,7 @@ export abstract class Migration { this.ctx = ctx; } - getCollection(entityName: EntityName): Collection { + getCollection(entityName: EntityName): Collection { return this.driver.getConnection().getCollection(entityName); } diff --git a/packages/mongodb/src/MongoConnection.ts b/packages/mongodb/src/MongoConnection.ts index dc45e08fc269..2f82f6df19f2 100644 --- a/packages/mongodb/src/MongoConnection.ts +++ b/packages/mongodb/src/MongoConnection.ts @@ -57,11 +57,11 @@ export class MongoConnection extends Connection { return this.client; } - getCollection(name: EntityName): Collection { + getCollection(name: EntityName): Collection { return this.db.collection(this.getCollectionName(name)); } - async createCollection(name: EntityName): Promise> { + async createCollection(name: EntityName): Promise> { return this.db.createCollection(this.getCollectionName(name)); } @@ -119,7 +119,7 @@ export class MongoConnection extends Connection { throw new Error(`${this.constructor.name} does not support generic execute method`); } - async find>(collection: string, where: FilterQuery, orderBy?: QueryOrderMap | QueryOrderMap[], limit?: number, offset?: number, fields?: string[], ctx?: Transaction): Promise[]> { + async find(collection: string, where: FilterQuery, orderBy?: QueryOrderMap | QueryOrderMap[], limit?: number, offset?: number, fields?: string[], ctx?: Transaction): Promise[]> { collection = this.getCollectionName(collection); const options: Dictionary = { session: ctx }; @@ -163,27 +163,27 @@ export class MongoConnection extends Connection { return res as EntityData[]; } - async insertOne(collection: string, data: Partial, ctx?: Transaction): Promise> { + async insertOne(collection: string, data: Partial, ctx?: Transaction): Promise> { return this.runQuery('insertOne', collection, data, undefined, ctx); } - async insertMany(collection: string, data: Partial[], ctx?: Transaction): Promise> { + async insertMany(collection: string, data: Partial[], ctx?: Transaction): Promise> { return this.runQuery('insertMany', collection, data, undefined, ctx); } - async updateMany(collection: string, where: FilterQuery, data: Partial, ctx?: Transaction): Promise> { + async updateMany(collection: string, where: FilterQuery, data: Partial, ctx?: Transaction): Promise> { return this.runQuery('updateMany', collection, data, where, ctx); } - async bulkUpdateMany(collection: string, where: FilterQuery[], data: Partial[], ctx?: Transaction): Promise> { + async bulkUpdateMany(collection: string, where: FilterQuery[], data: Partial[], ctx?: Transaction): Promise> { return this.runQuery('bulkUpdateMany', collection, data, where, ctx); } - async deleteMany(collection: string, where: FilterQuery, ctx?: Transaction): Promise> { + async deleteMany(collection: string, where: FilterQuery, ctx?: Transaction): Promise> { return this.runQuery('deleteMany', collection, undefined, where, ctx); } - async aggregate(collection: string, pipeline: any[], ctx?: Transaction): Promise { + async aggregate(collection: string, pipeline: any[], ctx?: Transaction): Promise { collection = this.getCollectionName(collection); const options: Dictionary = { session: ctx }; const query = `db.getCollection('${collection}').aggregate(${this.logObject(pipeline)}, ${this.logObject(options)}).toArray();`; @@ -194,7 +194,7 @@ export class MongoConnection extends Connection { return res; } - async countDocuments(collection: string, where: FilterQuery, ctx?: Transaction): Promise { + async countDocuments(collection: string, where: FilterQuery, ctx?: Transaction): Promise { return this.runQuery('countDocuments', collection, undefined, where, ctx); } @@ -241,7 +241,7 @@ export class MongoConnection extends Connection { await eventBroadcaster?.dispatchEvent(EventType.afterTransactionRollback, ctx); } - private async runQuery | number = QueryResult>(method: 'insertOne' | 'insertMany' | 'updateMany' | 'bulkUpdateMany' | 'deleteMany' | 'countDocuments', collection: string, data?: Partial | Partial[], where?: FilterQuery | FilterQuery[], ctx?: Transaction): Promise { + private async runQuery | number = QueryResult>(method: 'insertOne' | 'insertMany' | 'updateMany' | 'bulkUpdateMany' | 'deleteMany' | 'countDocuments', collection: string, data?: Partial | Partial[], where?: FilterQuery | FilterQuery[], ctx?: Transaction): Promise { collection = this.getCollectionName(collection); const logger = this.config.getLogger(); const options: Dictionary = { session: ctx }; @@ -262,7 +262,7 @@ export class MongoConnection extends Connection { res = await this.getCollection(collection).insertMany(data as OptionalUnlessRequiredId[], options); break; case 'updateMany': { - const payload = Object.keys(data!).some(k => k.startsWith('$')) ? data : this.createUpdatePayload(data); + const payload = Object.keys(data!).some(k => k.startsWith('$')) ? data : this.createUpdatePayload(data as object); query = log(() => `db.getCollection('${collection}').updateMany(${this.logObject(where)}, ${this.logObject(payload)}, ${this.logObject(options)});`); res = await this.getCollection(collection).updateMany(where as Filter, payload as UpdateFilter, options) as UpdateResult; break; @@ -298,7 +298,7 @@ export class MongoConnection extends Connection { return this.transformResult(res!) as U; } - private createUpdatePayload(row: T): { $set?: unknown[]; $unset?: unknown[] } { + private createUpdatePayload(row: T): { $set?: unknown[]; $unset?: unknown[] } { const doc: Dictionary = { $set: row }; const keys = Object.keys(row); const $unset: { $set?: unknown[]; $unset?: unknown[] } = {}; diff --git a/packages/mongodb/src/MongoDriver.ts b/packages/mongodb/src/MongoDriver.ts index cf121b757923..aa9ab533e935 100644 --- a/packages/mongodb/src/MongoDriver.ts +++ b/packages/mongodb/src/MongoDriver.ts @@ -1,7 +1,7 @@ import type { ClientSession } from 'mongodb'; import { ObjectId } from 'bson'; import type { - EntityData, AnyEntity, FilterQuery, Configuration, FindOneOptions, FindOptions, + EntityData, FilterQuery, Configuration, FindOneOptions, FindOptions, QueryResult, Transaction, IDatabaseDriver, EntityManager, Dictionary, PopulateOptions, CountOptions, EntityDictionary, EntityField, NativeInsertUpdateOptions, NativeInsertUpdateManyOptions, } from '@mikro-orm/core'; @@ -26,19 +26,19 @@ export class MongoDriver extends DatabaseDriver { return new MongoEntityManager(this.config, this, this.metadata, useContext) as unknown as EntityManager; } - async find, P extends string = never>(entityName: string, where: FilterQuery, options: FindOptions = {}): Promise[]> { + async find(entityName: string, where: FilterQuery, options: FindOptions = {}): Promise[]> { if (this.metadata.find(entityName)?.virtual) { return this.findVirtual(entityName, where, options); } const fields = this.buildFields(entityName, options.populate as unknown as PopulateOptions[] || [], options.fields); where = this.renameFields(entityName, where, true); - const res = await this.rethrow(this.getConnection('read').find(entityName, where, options.orderBy, options.limit, options.offset, fields, options.ctx)); + const res = await this.rethrow(this.getConnection('read').find(entityName, where as Dictionary, options.orderBy, options.limit, options.offset, fields, options.ctx)); - return res.map(r => this.mapResult(r, this.metadata.find(entityName))!); + return res.map(r => this.mapResult(r, this.metadata.find(entityName))!); } - async findOne, P extends string = never>(entityName: string, where: FilterQuery, options: FindOneOptions = { populate: [], orderBy: {} }): Promise | null> { + async findOne(entityName: string, where: FilterQuery, options: FindOneOptions = { populate: [], orderBy: {} }): Promise | null> { if (this.metadata.find(entityName)?.virtual) { const [item] = await this.findVirtual(entityName, where, options as FindOptions); return item ?? null; @@ -50,12 +50,12 @@ export class MongoDriver extends DatabaseDriver { const fields = this.buildFields(entityName, options.populate as unknown as PopulateOptions[] || [], options.fields); where = this.renameFields(entityName, where, true); - const res = await this.rethrow(this.getConnection('read').find(entityName, where, options.orderBy, 1, undefined, fields, options.ctx)); + const res = await this.rethrow(this.getConnection('read').find(entityName, where as Dictionary, options.orderBy, 1, undefined, fields, options.ctx)); return this.mapResult(res[0], this.metadata.find(entityName)!); } - async findVirtual(entityName: string, where: FilterQuery, options: FindOptions): Promise[]> { + async findVirtual(entityName: string, where: FilterQuery, options: FindOptions): Promise[]> { const meta = this.metadata.find(entityName)!; if (meta.expression instanceof Function) { @@ -67,28 +67,28 @@ export class MongoDriver extends DatabaseDriver { return super.findVirtual(entityName, where, options); } - async count>(entityName: string, where: FilterQuery, options: CountOptions = {}, ctx?: Transaction): Promise { + async count(entityName: string, where: FilterQuery, options: CountOptions = {}, ctx?: Transaction): Promise { where = this.renameFields(entityName, where, true); - return this.rethrow(this.getConnection('read').countDocuments(entityName, where, ctx)); + return this.rethrow(this.getConnection('read').countDocuments(entityName, where as object, ctx)); } - async nativeInsert>(entityName: string, data: EntityDictionary, options: NativeInsertUpdateOptions = {}): Promise> { + async nativeInsert(entityName: string, data: EntityDictionary, options: NativeInsertUpdateOptions = {}): Promise> { data = this.renameFields(entityName, data); - return this.rethrow(this.getConnection('write').insertOne(entityName, data as T, options.ctx)); + return this.rethrow(this.getConnection('write').insertOne(entityName, data, options.ctx)) as Promise>; } - async nativeInsertMany>(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { + async nativeInsertMany(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { data = data.map(d => this.renameFields(entityName, d)); const meta = this.metadata.find(entityName); /* istanbul ignore next */ const pk = meta?.getPrimaryProps()[0].fieldNames[0] ?? '_id'; - const res = await this.rethrow(this.getConnection('write').insertMany(entityName, data as any[], options.ctx)); + const res = await this.rethrow(this.getConnection('write').insertMany(entityName, data as any[], options.ctx)); res.rows = res.insertedIds!.map(id => ({ [pk]: id })); - return res; + return res as QueryResult; } - async nativeUpdate>(entityName: string, where: FilterQuery, data: EntityDictionary, options: NativeInsertUpdateOptions = {}): Promise> { + async nativeUpdate(entityName: string, where: FilterQuery, data: EntityDictionary, options: NativeInsertUpdateOptions = {}): Promise> { if (Utils.isPrimaryKey(where)) { where = this.buildFilterById(entityName, where as string); } @@ -96,22 +96,22 @@ export class MongoDriver extends DatabaseDriver { where = this.renameFields(entityName, where, true); data = this.renameFields(entityName, data); - return this.rethrow(this.getConnection('write').updateMany(entityName, where as FilterQuery, data as T, options.ctx)); + return this.rethrow(this.getConnection('write').updateMany(entityName, where as object, data, options.ctx)) as Promise>; } - async nativeUpdateMany>(entityName: string, where: FilterQuery[], data: EntityDictionary[], options: NativeInsertUpdateOptions = {}): Promise> { + async nativeUpdateMany(entityName: string, where: FilterQuery[], data: EntityDictionary[], options: NativeInsertUpdateOptions = {}): Promise> { data = data.map(row => this.renameFields(entityName, row)); - return this.rethrow(this.getConnection('write').bulkUpdateMany(entityName, where, data as T[], options.ctx)); + return this.rethrow(this.getConnection('write').bulkUpdateMany(entityName, where as FilterQuery, data as object[], options.ctx)) as Promise>; } - async nativeDelete>(entityName: string, where: FilterQuery, options: { ctx?: Transaction } = {}): Promise> { + async nativeDelete(entityName: string, where: FilterQuery, options: { ctx?: Transaction } = {}): Promise> { if (Utils.isPrimaryKey(where)) { where = this.buildFilterById(entityName, where as string); } where = this.renameFields(entityName, where, true); - return this.rethrow(this.getConnection('write').deleteMany(entityName, where, options.ctx)); + return this.rethrow(this.getConnection('write').deleteMany(entityName, where as object, options.ctx)) as Promise>; } async aggregate(entityName: string, pipeline: any[], ctx?: Transaction): Promise { @@ -207,7 +207,7 @@ export class MongoDriver extends DatabaseDriver { return data; } - private buildFilterById>(entityName: string, id: string): FilterQuery { + private buildFilterById(entityName: string, id: string): FilterQuery { const meta = this.metadata.find(entityName)!; if (meta.properties[meta.primaryKeys[0]].type.toLowerCase() === 'objectid') { @@ -217,7 +217,7 @@ export class MongoDriver extends DatabaseDriver { return { _id: id } as FilterQuery; } - protected buildFields, P extends string = never>(entityName: string, populate: PopulateOptions[], fields?: readonly EntityField[]): string[] | undefined { + protected buildFields(entityName: string, populate: PopulateOptions[], fields?: readonly EntityField[]): string[] | undefined { const meta = this.metadata.find(entityName); if (!meta) { diff --git a/packages/mongodb/src/MongoEntityManager.ts b/packages/mongodb/src/MongoEntityManager.ts index 4e711c9cbd0e..b5cdcaa51317 100644 --- a/packages/mongodb/src/MongoEntityManager.ts +++ b/packages/mongodb/src/MongoEntityManager.ts @@ -1,8 +1,8 @@ -import type { AnyEntity, EntityName, EntityRepository, GetRepository } from '@mikro-orm/core'; +import type { EntityName, EntityRepository, GetRepository } from '@mikro-orm/core'; import { EntityManager, Utils } from '@mikro-orm/core'; import type { MongoDriver } from './MongoDriver'; import type { MongoEntityRepository } from './MongoEntityRepository'; -import type { Collection } from 'mongodb'; +import type { Collection, Document } from 'mongodb'; /** * @inheritDoc @@ -17,11 +17,11 @@ export class MongoEntityManager extends Ent return this.getDriver().aggregate(entityName, pipeline); } - getCollection(entityName: EntityName): Collection { + getCollection(entityName: EntityName): Collection { return this.getConnection().getCollection(entityName); } - getRepository, U extends EntityRepository = MongoEntityRepository>(entityName: EntityName): GetRepository { + getRepository = MongoEntityRepository>(entityName: EntityName): GetRepository { return super.getRepository(entityName); } diff --git a/packages/mongodb/src/MongoEntityRepository.ts b/packages/mongodb/src/MongoEntityRepository.ts index da46b992dbf3..808364391f45 100644 --- a/packages/mongodb/src/MongoEntityRepository.ts +++ b/packages/mongodb/src/MongoEntityRepository.ts @@ -2,7 +2,7 @@ import type { EntityName } from '@mikro-orm/core'; import { EntityRepository } from '@mikro-orm/core'; import type { MongoEntityManager } from './MongoEntityManager'; -export class MongoEntityRepository extends EntityRepository { +export class MongoEntityRepository extends EntityRepository { constructor(protected readonly _em: MongoEntityManager, protected readonly entityName: EntityName) { diff --git a/packages/mongodb/src/MongoPlatform.ts b/packages/mongodb/src/MongoPlatform.ts index 8d400d6a2828..e741eae1a5c6 100644 --- a/packages/mongodb/src/MongoPlatform.ts +++ b/packages/mongodb/src/MongoPlatform.ts @@ -16,8 +16,8 @@ export class MongoPlatform extends Platform { return MongoNamingStrategy; } - getRepositoryClass(): Constructor> { - return MongoEntityRepository; + getRepositoryClass(): Constructor> { + return MongoEntityRepository as Constructor>; } getSchemaGenerator(driver: IDatabaseDriver, em?: EntityManager): MongoSchemaGenerator { diff --git a/packages/mysql/src/MySqlDriver.ts b/packages/mysql/src/MySqlDriver.ts index bbe8dee74160..909d0741911c 100644 --- a/packages/mysql/src/MySqlDriver.ts +++ b/packages/mysql/src/MySqlDriver.ts @@ -1,4 +1,4 @@ -import type { AnyEntity, Configuration, EntityDictionary, NativeInsertUpdateManyOptions, QueryResult } from '@mikro-orm/core'; +import type { Configuration, EntityDictionary, NativeInsertUpdateManyOptions, QueryResult } from '@mikro-orm/core'; import { AbstractSqlDriver } from '@mikro-orm/knex'; import { MySqlConnection } from './MySqlConnection'; import { MySqlPlatform } from './MySqlPlatform'; @@ -9,7 +9,7 @@ export class MySqlDriver extends AbstractSqlDriver { super(config, new MySqlPlatform(), MySqlConnection, ['knex', 'mysql2']); } - async nativeInsertMany>(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { + async nativeInsertMany(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { options.processCollections ??= true; const res = await super.nativeInsertMany(entityName, data, options); const pks = this.getPrimaryKeyFields(entityName); diff --git a/packages/seeder/src/Factory.ts b/packages/seeder/src/Factory.ts index 8dd683b860dd..bc8c739c7aa4 100644 --- a/packages/seeder/src/Factory.ts +++ b/packages/seeder/src/Factory.ts @@ -2,7 +2,7 @@ import type { Faker } from '@faker-js/faker'; import { faker } from '@faker-js/faker'; import type { RequiredEntityData, EntityData, EntityManager, Constructor } from '@mikro-orm/core'; -export abstract class Factory { +export abstract class Factory { abstract readonly model: Constructor; private eachFunction?: (entity: T) => void; diff --git a/packages/sqlite/src/SqliteDriver.ts b/packages/sqlite/src/SqliteDriver.ts index 95c9ce849000..4a9307ec0c9b 100644 --- a/packages/sqlite/src/SqliteDriver.ts +++ b/packages/sqlite/src/SqliteDriver.ts @@ -1,4 +1,4 @@ -import type { AnyEntity, Configuration, EntityDictionary, NativeInsertUpdateManyOptions, QueryResult } from '@mikro-orm/core'; +import type { Configuration, EntityDictionary, NativeInsertUpdateManyOptions, QueryResult } from '@mikro-orm/core'; import { AbstractSqlDriver } from '@mikro-orm/knex'; import { SqliteConnection } from './SqliteConnection'; import { SqlitePlatform } from './SqlitePlatform'; @@ -9,7 +9,7 @@ export class SqliteDriver extends AbstractSqlDriver { super(config, new SqlitePlatform(), SqliteConnection, ['knex', 'sqlite3']); } - async nativeInsertMany>(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { + async nativeInsertMany(entityName: string, data: EntityDictionary[], options: NativeInsertUpdateManyOptions = {}): Promise> { options.processCollections ??= true; const res = await super.nativeInsertMany(entityName, data, options); const pks = this.getPrimaryKeyFields(entityName); diff --git a/tests/DatabaseDriver.test.ts b/tests/DatabaseDriver.test.ts index 84b8ef1aac97..b3601ed7fb65 100644 --- a/tests/DatabaseDriver.test.ts +++ b/tests/DatabaseDriver.test.ts @@ -18,7 +18,7 @@ import { DatabaseDriver, EntityManager, EntityRepository, - LockMode, MikroORM, + LockMode, Platform, } from '@mikro-orm/core'; @@ -33,15 +33,15 @@ class Driver extends DatabaseDriver implements IDatabaseDriver { super(config, dependencies); } - async count(entityName: string, where: ObjectQuery, options: CountOptions): Promise { + async count(entityName: string, where: ObjectQuery, options: CountOptions): Promise { return 0; } - async find(entityName: string, where: ObjectQuery, options: FindOptions | undefined): Promise[]> { + async find(entityName: string, where: ObjectQuery, options: FindOptions | undefined): Promise[]> { return []; } - async findOne(entityName: string, where: ObjectQuery, options: FindOneOptions | undefined): Promise | null> { + async findOne(entityName: string, where: ObjectQuery, options: FindOneOptions | undefined): Promise | null> { return null; } diff --git a/tests/features/migrations/Migrator.mongo.test.ts b/tests/features/migrations/Migrator.mongo.test.ts index d1eab4fa5221..b7c4f5175b90 100644 --- a/tests/features/migrations/Migrator.mongo.test.ts +++ b/tests/features/migrations/Migrator.mongo.test.ts @@ -9,7 +9,7 @@ import { closeReplSets, initORMMongo, mockLogger } from '../../bootstrap'; class MigrationTest1 extends Migration { async up(): Promise { - await this.getCollection('Book').updateMany({}, { $set: { updatedAt: new Date() } }); + await this.getCollection('Book').updateMany({}, { $set: { updatedAt: new Date() } }); await this.driver.nativeDelete('Book', { foo: true }, { ctx: this.ctx }); } diff --git a/tests/features/reflection/TsMorphMetadataProvider.test.ts b/tests/features/reflection/TsMorphMetadataProvider.test.ts index 4c4fbbde9ab1..9b03d842548d 100644 --- a/tests/features/reflection/TsMorphMetadataProvider.test.ts +++ b/tests/features/reflection/TsMorphMetadataProvider.test.ts @@ -6,9 +6,9 @@ import { Author, Book, Publisher, BaseEntity, BaseEntity3, BookTagSchema, Test, import FooBar from './entities/FooBar'; // we need to define those to get around typescript issues with reflection (ts-morph would return `any` for the type otherwise) -export class Collection extends Collection_ { } -export class Reference extends Reference_ { } -export type IdentifiedReference, PK extends keyof T | unknown = PrimaryProperty> = true extends IsUnknown ? Reference : ({ [K in Cast]?: T[K] } & Reference); +export class Collection extends Collection_ { } +export class Reference extends Reference_ { } +export type IdentifiedReference> = true extends IsUnknown ? Reference : ({ [K in Cast]?: T[K] } & Reference); describe('TsMorphMetadataProvider', () => { diff --git a/tests/features/unit-of-work/EntityComparator.test.ts b/tests/features/unit-of-work/EntityComparator.test.ts index e1753f1e8479..fcca9c5ce91a 100644 --- a/tests/features/unit-of-work/EntityComparator.test.ts +++ b/tests/features/unit-of-work/EntityComparator.test.ts @@ -4,10 +4,11 @@ import type { EntityData, EntityFactory, EntityMetadata, EntityProperty, MetadataStorage, - Platform, Primary } from '@mikro-orm/core'; + Platform, Primary, +} from '@mikro-orm/core'; import { Collection, - Entity, EntityAssigner, + Entity, EntityAssigner, helper, MikroORM, PrimaryKey, Property, Reference, @@ -60,7 +61,7 @@ export class ObjectHydratorOld { return meta.hydrateProps; } - protected hydrateProperty(entity: T, prop: EntityProperty, data: EntityData, factory: EntityFactory, newEntity: boolean, convertCustomTypes: boolean): void { + protected hydrateProperty(entity: T, prop: EntityProperty, data: EntityData, factory: EntityFactory, newEntity: boolean, convertCustomTypes: boolean): void { if (prop.reference === ReferenceType.MANY_TO_ONE || prop.reference === ReferenceType.ONE_TO_ONE) { this.hydrateToOne(data[prop.name], entity, prop, factory); } else if (prop.reference === ReferenceType.ONE_TO_MANY || prop.reference === ReferenceType.MANY_TO_MANY) { @@ -94,7 +95,7 @@ export class ObjectHydratorOld { private hydrateEmbeddable>(entity: T, prop: EntityProperty, data: EntityData): void { const value: Dictionary = {}; - entity.__meta!.props.filter(p => p.embedded?.[0] === prop.name).forEach(childProp => { + helper(entity).__meta.props.filter(p => p.embedded?.[0] === prop.name).forEach(childProp => { value[childProp.embedded![1]] = data[childProp.name as any]; }); @@ -102,27 +103,27 @@ export class ObjectHydratorOld { Object.keys(value).forEach(k => entity[prop.name][k] = value[k]); } - private hydrateToMany(entity: T, prop: EntityProperty, value: any, factory: EntityFactory, newEntity?: boolean): void { + private hydrateToMany(entity: T, prop: EntityProperty, value: any, factory: EntityFactory, newEntity?: boolean): void { if (Array.isArray(value)) { const items = value.map((value: Primary | EntityData) => this.createCollectionItem(prop, value, factory, newEntity)); - const coll = Collection.create(entity, prop.name, items, !!newEntity); + const coll = Collection.create(entity, prop.name, items, !!newEntity); coll.setDirty(!!newEntity); } else if (!entity[prop.name]) { const items = this.platform.usesPivotTable() || !prop.owner ? undefined : []; - const coll = Collection.create(entity, prop.name, items, !!(value || newEntity)); + const coll = Collection.create(entity, prop.name, items, !!(value || newEntity)); coll.setDirty(false); } } - private hydrateToOne(value: any, entity: T, prop: EntityProperty, factory: EntityFactory): void { + private hydrateToOne(value: any, entity: T, prop: EntityProperty, factory: EntityFactory): void { if (typeof value === 'undefined') { return; } if (Utils.isPrimaryKey(value, true)) { - entity[prop.name] = Reference.wrapReference(factory.createReference(prop.type, value, { merge: true }), prop) as T[keyof T]; + entity[prop.name] = Reference.wrapReference(factory.createReference(prop.type, value, { merge: true }), prop); } else if (Utils.isObject>(value)) { - entity[prop.name] = Reference.wrapReference(factory.create(prop.type, value, { initialized: true, merge: true }), prop) as T[keyof T]; + entity[prop.name] = Reference.wrapReference(factory.create(prop.type, value, { initialized: true, merge: true }), prop); } else if (value === null) { entity[prop.name] = null; } @@ -132,7 +133,7 @@ export class ObjectHydratorOld { } } - private createCollectionItem(prop: EntityProperty, value: Primary | EntityData | T, factory: EntityFactory, newEntity?: boolean): T { + private createCollectionItem(prop: EntityProperty, value: Primary | EntityData | T, factory: EntityFactory, newEntity?: boolean): T { const meta = this.metadata.find(prop.type)!; if (Utils.isPrimaryKey(value, meta.compositePK)) { @@ -150,7 +151,7 @@ export class ObjectHydratorOld { export class EntityComparatorOld { - prepareEntity>(entity: T, metadata: MetadataStorage, platform: Platform): EntityData { + prepareEntity(entity: T, metadata: MetadataStorage, platform: Platform): EntityData { const meta = metadata.get(entity.constructor.name); const ret = {} as EntityData; @@ -197,13 +198,13 @@ export class EntityComparatorOld { /** * should be used only for `meta.comparableProps` that are defined based on the static `isComparable` helper */ - private shouldIgnoreProperty>(entity: T, prop: EntityProperty) { + private shouldIgnoreProperty(entity: T, prop: EntityProperty) { if (!(prop.name in entity)) { return true; } - const value = entity[prop.name]; - const noPkRef = Utils.isEntity(value, true) && !value.__helper!.hasPrimaryKey(); + const value = entity[prop.name] as object; + const noPkRef = Utils.isEntity(value, true) && !helper(value).hasPrimaryKey(); const noPkProp = prop.primary && value == null; // bidirectional 1:1 and m:1 fields are defined as setters, we need to check for `undefined` explicitly diff --git a/yarn.lock b/yarn.lock index dc090157908c..7ff99aaefb37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,150 +10,155 @@ "@jridgewell/gen-mapping" "^0.1.0" "@jridgewell/trace-mapping" "^0.3.9" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" - integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" + integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== dependencies: - "@babel/highlight" "^7.16.7" + "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.17.10": - version "7.18.5" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.18.5.tgz#acac0c839e317038c73137fbb6ef71a1d6238471" - integrity sha512-BxhE40PVCBxVEJsSBhB6UWyAuqJRxGsAw8BdHMJ3AKGydcwuWW4kOO3HmqBQAdcq/OP+/DlTVxLvsCzRTnZuGg== +"@babel/compat-data@^7.18.8": + version "7.18.13" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.18.13.tgz#6aff7b350a1e8c3e40b029e46cbe78e24a913483" + integrity sha512-5yUzC5LqyTFp2HLmDoxGQelcdYgSpP9xsnMWBphAscOdFrHSAVbLNzWiy32sVNDqJRDiJK6klfDnAgu6PAGSHw== "@babel/core@^7.11.6", "@babel/core@^7.12.3": - version "7.18.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.5.tgz#c597fa680e58d571c28dda9827669c78cdd7f000" - integrity sha512-MGY8vg3DxMnctw0LdvSEojOsumc70g0t18gNyUdAZqB1Rpd1Bqo/svHGvt+UJ6JcGX+DIekGFDxxIWofBxLCnQ== + version "7.18.13" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.13.tgz#9be8c44512751b05094a4d3ab05fc53a47ce00ac" + integrity sha512-ZisbOvRRusFktksHSG6pjj1CSvkPkcZq/KHD45LAkVP/oiHJkNBZWfpvlLmX8OtHDG8IuzsFlVRWo08w7Qxn0A== dependencies: "@ampproject/remapping" "^2.1.0" - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.18.2" - "@babel/helper-compilation-targets" "^7.18.2" - "@babel/helper-module-transforms" "^7.18.0" - "@babel/helpers" "^7.18.2" - "@babel/parser" "^7.18.5" - "@babel/template" "^7.16.7" - "@babel/traverse" "^7.18.5" - "@babel/types" "^7.18.4" + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.18.13" + "@babel/helper-compilation-targets" "^7.18.9" + "@babel/helper-module-transforms" "^7.18.9" + "@babel/helpers" "^7.18.9" + "@babel/parser" "^7.18.13" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.18.13" + "@babel/types" "^7.18.13" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.1" semver "^6.3.0" -"@babel/generator@^7.18.2", "@babel/generator@^7.7.2": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.2.tgz#33873d6f89b21efe2da63fe554460f3df1c5880d" - integrity sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw== +"@babel/generator@^7.18.13", "@babel/generator@^7.7.2": + version "7.18.13" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.13.tgz#59550cbb9ae79b8def15587bdfbaa388c4abf212" + integrity sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ== dependencies: - "@babel/types" "^7.18.2" - "@jridgewell/gen-mapping" "^0.3.0" + "@babel/types" "^7.18.13" + "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" -"@babel/helper-compilation-targets@^7.18.2": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.2.tgz#67a85a10cbd5fc7f1457fec2e7f45441dc6c754b" - integrity sha512-s1jnPotJS9uQnzFtiZVBUxe67CuBa679oWFHpxYYnTpRL/1ffhyX44R9uYiXoa/pLXcY9H2moJta0iaanlk/rQ== +"@babel/helper-compilation-targets@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.9.tgz#69e64f57b524cde3e5ff6cc5a9f4a387ee5563bf" + integrity sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg== dependencies: - "@babel/compat-data" "^7.17.10" - "@babel/helper-validator-option" "^7.16.7" + "@babel/compat-data" "^7.18.8" + "@babel/helper-validator-option" "^7.18.6" browserslist "^4.20.2" semver "^6.3.0" -"@babel/helper-environment-visitor@^7.16.7", "@babel/helper-environment-visitor@^7.18.2": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.2.tgz#8a6d2dedb53f6bf248e31b4baf38739ee4a637bd" - integrity sha512-14GQKWkX9oJzPiQQ7/J36FTXcD4kSp8egKjO9nINlSKiHITRA9q/R74qu8S9xlc/b/yjsJItQUeeh3xnGN0voQ== - -"@babel/helper-function-name@^7.17.9": - version "7.17.9" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz#136fcd54bc1da82fcb47565cf16fd8e444b1ff12" - integrity sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg== - dependencies: - "@babel/template" "^7.16.7" - "@babel/types" "^7.17.0" - -"@babel/helper-hoist-variables@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246" - integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-module-imports@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437" - integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-module-transforms@^7.18.0": - version "7.18.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.18.0.tgz#baf05dec7a5875fb9235bd34ca18bad4e21221cd" - integrity sha512-kclUYSUBIjlvnzN2++K9f2qzYKFgjmnmjwL4zlmU5f8ZtzgWe8s0rUPSTGy2HmK4P8T52MQsS+HTQAgZd3dMEA== - dependencies: - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-module-imports" "^7.16.7" - "@babel/helper-simple-access" "^7.17.7" - "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/helper-validator-identifier" "^7.16.7" - "@babel/template" "^7.16.7" - "@babel/traverse" "^7.18.0" - "@babel/types" "^7.18.0" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.17.12", "@babel/helper-plugin-utils@^7.8.0": - version "7.17.12" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.17.12.tgz#86c2347da5acbf5583ba0a10aed4c9bf9da9cf96" - integrity sha512-JDkf04mqtN3y4iAbO1hv9U2ARpPyPL1zqyWs/2WG1pgSq9llHFjStX5jdxb84himgJm+8Ng+x0oiWF/nw/XQKA== - -"@babel/helper-simple-access@^7.17.7": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.18.2.tgz#4dc473c2169ac3a1c9f4a51cfcd091d1c36fcff9" - integrity sha512-7LIrjYzndorDY88MycupkpQLKS1AFfsVRm2k/9PtKScSy5tZq0McZTj+DiMRynboZfIqOKvo03pmhTaUgiD6fQ== - dependencies: - "@babel/types" "^7.18.2" - -"@babel/helper-split-export-declaration@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b" - integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-validator-identifier@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" - integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== - -"@babel/helper-validator-option@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" - integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ== - -"@babel/helpers@^7.18.2": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.18.2.tgz#970d74f0deadc3f5a938bfa250738eb4ac889384" - integrity sha512-j+d+u5xT5utcQSzrh9p+PaJX94h++KN+ng9b9WEJq7pkUPAd61FGqhjuUEdfknb3E/uDBb7ruwEeKkIxNJPIrg== - dependencies: - "@babel/template" "^7.16.7" - "@babel/traverse" "^7.18.2" - "@babel/types" "^7.18.2" - -"@babel/highlight@^7.16.7": - version "7.17.12" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.17.12.tgz#257de56ee5afbd20451ac0a75686b6b404257351" - integrity sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg== - dependencies: - "@babel/helper-validator-identifier" "^7.16.7" +"@babel/helper-environment-visitor@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" + integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== + +"@babel/helper-function-name@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz#940e6084a55dee867d33b4e487da2676365e86b0" + integrity sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A== + dependencies: + "@babel/template" "^7.18.6" + "@babel/types" "^7.18.9" + +"@babel/helper-hoist-variables@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" + integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-module-imports@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e" + integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-module-transforms@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.18.9.tgz#5a1079c005135ed627442df31a42887e80fcb712" + integrity sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g== + dependencies: + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-simple-access" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/helper-validator-identifier" "^7.18.6" + "@babel/template" "^7.18.6" + "@babel/traverse" "^7.18.9" + "@babel/types" "^7.18.9" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.8.0": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz#4b8aea3b069d8cb8a72cdfe28ddf5ceca695ef2f" + integrity sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w== + +"@babel/helper-simple-access@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz#d6d8f51f4ac2978068df934b569f08f29788c7ea" + integrity sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-split-export-declaration@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" + integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-string-parser@^7.18.10": + version "7.18.10" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz#181f22d28ebe1b3857fa575f5c290b1aaf659b56" + integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw== + +"@babel/helper-validator-identifier@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076" + integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g== + +"@babel/helper-validator-option@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" + integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== + +"@babel/helpers@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.18.9.tgz#4bef3b893f253a1eced04516824ede94dcfe7ff9" + integrity sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ== + dependencies: + "@babel/template" "^7.18.6" + "@babel/traverse" "^7.18.9" + "@babel/types" "^7.18.9" + +"@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.7", "@babel/parser@^7.18.5": - version "7.18.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.5.tgz#337062363436a893a2d22faa60be5bb37091c83c" - integrity sha512-YZWVaglMiplo7v8f1oMQ5ZPQr0vn7HPeZXxXWsxXJRjGVrzUFn9OxFQl1sb5wzfootjA/yChhW84BV+383FSOw== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.18.13": + version "7.18.13" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.13.tgz#5b2dd21cae4a2c5145f1fbd8ca103f9313d3b7e4" + integrity sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -240,43 +245,44 @@ "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": - version "7.17.12" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.17.12.tgz#b54fc3be6de734a56b87508f99d6428b5b605a7b" - integrity sha512-TYY0SXFiO31YXtNg3HtFwNJHjLsAyIIhAhNWkQ5whPPS7HWUFlg9z0Ta4qAQNjQbP1wsSt/oKkmZ/4/WWdMUpw== - dependencies: - "@babel/helper-plugin-utils" "^7.17.12" - -"@babel/template@^7.16.7", "@babel/template@^7.3.3": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" - integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/parser" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/traverse@^7.18.0", "@babel/traverse@^7.18.2", "@babel/traverse@^7.18.5", "@babel/traverse@^7.7.2": - version "7.18.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.5.tgz#94a8195ad9642801837988ab77f36e992d9a20cd" - integrity sha512-aKXj1KT66sBj0vVzk6rEeAO6Z9aiiQ68wfDgge3nHhA/my6xMM/7HGQUNumKZaoa2qUPQ5whJG9aAifsxUKfLA== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.18.2" - "@babel/helper-environment-visitor" "^7.18.2" - "@babel/helper-function-name" "^7.17.9" - "@babel/helper-hoist-variables" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/parser" "^7.18.5" - "@babel/types" "^7.18.4" + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz#1c09cd25795c7c2b8a4ba9ae49394576d4133285" + integrity sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA== + dependencies: + "@babel/helper-plugin-utils" "^7.18.6" + +"@babel/template@^7.18.10", "@babel/template@^7.18.6", "@babel/template@^7.3.3": + version "7.18.10" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" + integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/parser" "^7.18.10" + "@babel/types" "^7.18.10" + +"@babel/traverse@^7.18.13", "@babel/traverse@^7.18.9", "@babel/traverse@^7.7.2": + version "7.18.13" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.13.tgz#5ab59ef51a997b3f10c4587d648b9696b6cb1a68" + integrity sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.18.13" + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-function-name" "^7.18.9" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/parser" "^7.18.13" + "@babel/types" "^7.18.13" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.16.7", "@babel/types@^7.17.0", "@babel/types@^7.18.0", "@babel/types@^7.18.2", "@babel/types@^7.18.4", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.18.4" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.4.tgz#27eae9b9fd18e9dccc3f9d6ad051336f307be354" - integrity sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw== +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.13", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.18.13" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.13.tgz#30aeb9e514f4100f7c1cb6e5ba472b30e48f519a" + integrity sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ== dependencies: - "@babel/helper-validator-identifier" "^7.16.7" + "@babel/helper-string-parser" "^7.18.10" + "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -638,13 +644,6 @@ terminal-link "^2.0.0" v8-to-istanbul "^9.0.1" -"@jest/schemas@^28.0.2": - version "28.0.2" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.0.2.tgz#08c30df6a8d07eafea0aef9fb222c5e26d72e613" - integrity sha512-YVDJZjd4izeTDkij00vHHAymNXQ6WWsdChFRK86qck6Jpr3DCL5W3Is3vslviRlP+bLuMYRLbdp98amMvqudhA== - dependencies: - "@sinclair/typebox" "^0.23.3" - "@jest/schemas@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.1.3.tgz#ad8b86a66f11f33619e3d7e1dcddd7f2d40ff905" @@ -702,18 +701,6 @@ slash "^3.0.0" write-file-atomic "^4.0.1" -"@jest/types@^28.1.1": - version "28.1.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.1.tgz#d059bbc80e6da6eda9f081f293299348bd78ee0b" - integrity sha512-vRXVqSg1VhDnB8bWcmvLzmg0Bt9CRKVgHPXqYwvWMX3TvAjeO+nRuK6+VdTKCtWOvYlmkF/HqNAL/z+N3B53Kw== - dependencies: - "@jest/schemas" "^28.0.2" - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^17.0.8" - chalk "^4.0.0" - "@jest/types@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.3.tgz#b05de80996ff12512bc5ceb1d208285a7d11748b" @@ -734,29 +721,29 @@ "@jridgewell/set-array" "^1.0.0" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/gen-mapping@^0.3.0": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz#cf92a983c83466b8c0ce9124fadeaf09f7c66ea9" - integrity sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg== +"@jridgewell/gen-mapping@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" + integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== dependencies: - "@jridgewell/set-array" "^1.0.0" + "@jridgewell/set-array" "^1.0.1" "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" "@jridgewell/resolve-uri@^3.0.3": - version "3.0.7" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz#30cd49820a962aff48c8fffc5cd760151fca61fe" - integrity sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA== + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== -"@jridgewell/set-array@^1.0.0": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea" - integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ== +"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== "@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.13" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz#b6461fb0c2964356c469e115f504c95ad97ab88c" - integrity sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w== + version "1.4.14" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== "@jridgewell/trace-mapping@0.3.9": version "0.3.9" @@ -766,18 +753,10 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.13": - version "0.3.14" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" - integrity sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" - -"@jridgewell/trace-mapping@^0.3.9": - version "0.3.13" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz#dcfe3e95f224c8fe97a87a5235defec999aa92ea" - integrity sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w== +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.13", "@jridgewell/trace-mapping@^0.3.9": + version "0.3.15" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz#aba35c48a38d3fd84b37e66c9c0423f9744f9774" + integrity sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g== dependencies: "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" @@ -1564,17 +1543,17 @@ semver "^7.3.5" "@npmcli/fs@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-2.1.0.tgz#f2a21c28386e299d1a9fae8051d35ad180e33109" - integrity sha512-DmfBvNXGaetMxj9LTp8NAN9vEidXURrf5ZTslQzEAi/6GbW+4yjaLFQc6Tue5cpZ9Frlk4OBo/Snf1Bh/S7qTQ== + version "2.1.2" + resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-2.1.2.tgz#a9e2541a4a2fec2e69c29b35e6060973da79b865" + integrity sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ== dependencies: "@gar/promisify" "^1.1.3" semver "^7.3.5" "@npmcli/git@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-3.0.1.tgz#049b99b1381a2ddf7dc56ba3e91eaf76ca803a8d" - integrity sha512-UU85F/T+F1oVn3IsB/L6k9zXIMpXBuUBE25QDH0SsURwT6IOBqkC7M16uqo2vVZIyji3X1K4XH9luip7YekH1A== + version "3.0.2" + resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-3.0.2.tgz#5c5de6b4d70474cf2d09af149ce42e4e1dacb931" + integrity sha512-CAcd08y3DWBJqJDpfuVL0uijlq5oaXaOJEKHKc4wqrjd00gkvTZB+nFuLn+doOOKddaQS9JfqtNoFCO2LCvA3w== dependencies: "@npmcli/promise-spawn" "^3.0.0" lru-cache "^7.4.4" @@ -1595,9 +1574,9 @@ npm-normalize-package-bin "^1.0.1" "@npmcli/map-workspaces@^2.0.3": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@npmcli/map-workspaces/-/map-workspaces-2.0.3.tgz#2d3c75119ee53246e9aa75bc469a55281cd5f08f" - integrity sha512-X6suAun5QyupNM8iHkNPh0AHdRC2rb1W+MTdMvvA/2ixgmqZwlq5cGUBgmKHUHT2LgrkKJMAXbfAoTxOigpK8Q== + version "2.0.4" + resolved "https://registry.yarnpkg.com/@npmcli/map-workspaces/-/map-workspaces-2.0.4.tgz#9e5e8ab655215a262aefabf139782b894e0504fc" + integrity sha512-bMo0aAfwhVwqoVM5UzX1DJnlvVvzDCHae821jv48L1EsrYwfOZChlqWYXEtto/+BkBXetPbEWgau++/brh4oVg== dependencies: "@npmcli/name-from-folder" "^1.0.1" glob "^8.0.1" @@ -1605,9 +1584,9 @@ read-package-json-fast "^2.0.3" "@npmcli/metavuln-calculator@^3.0.1": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@npmcli/metavuln-calculator/-/metavuln-calculator-3.1.0.tgz#b1c2f0991c4f2d992b1615a54d4358c05efc3702" - integrity sha512-Q5fbQqGDlYqk7kWrbg6E2j/mtqQjZop0ZE6735wYA1tYNHguIDjAuWs+kFb5rJCkLIlXllfapvsyotYKiZOTBA== + version "3.1.1" + resolved "https://registry.yarnpkg.com/@npmcli/metavuln-calculator/-/metavuln-calculator-3.1.1.tgz#9359bd72b400f8353f6a28a25c8457b562602622" + integrity sha512-n69ygIaqAedecLeVH3KnO39M6ZHiJ2dEv5A7DGvcqCB8q17BGUgW8QaanIkbWUo2aYGZqJaOORTLAlIvKjNDKA== dependencies: cacache "^16.0.0" json-parse-even-better-errors "^2.3.1" @@ -1623,9 +1602,9 @@ rimraf "^3.0.2" "@npmcli/move-file@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-2.0.0.tgz#417f585016081a0184cef3e38902cd917a9bbd02" - integrity sha512-UR6D5f4KEGWJV6BGPH3Qb2EtgH+t+1XQ1Tt85c7qicN6cezzuHPdZwwAxqZr4JLtnQu0LZsTza/5gmNmSl8XLg== + version "2.0.1" + resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-2.0.1.tgz#26f6bdc379d87f75e55739bab89db525b06100e4" + integrity sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ== dependencies: mkdirp "^1.0.4" rimraf "^3.0.2" @@ -1654,20 +1633,10 @@ dependencies: infer-owner "^1.0.4" -"@npmcli/run-script@^3.0.1": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-3.0.3.tgz#66afa6e0c4c3484056195f295fa6c1d1a45ddf58" - integrity sha512-ZXL6qgC5NjwfZJ2nET+ZSLEz/PJgJ/5CU90C2S66dZY4Jw73DasS4ZCXuy/KHWYP0imjJ4VtA+Gebb5BxxKp9Q== - dependencies: - "@npmcli/node-gyp" "^2.0.0" - "@npmcli/promise-spawn" "^3.0.0" - node-gyp "^8.4.1" - read-package-json-fast "^2.0.3" - "@npmcli/run-script@^4.1.0", "@npmcli/run-script@^4.1.3", "@npmcli/run-script@^4.1.7": - version "4.1.7" - resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-4.1.7.tgz#b1a2f57568eb738e45e9ea3123fb054b400a86f7" - integrity sha512-WXr/MyM4tpKA4BotB81NccGAv8B48lNH0gRoILucbcAhTQXLCoi6HflMV3KdXubIqvP9SuLsFn68Z7r4jl+ppw== + version "4.2.1" + resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-4.2.1.tgz#c07c5c71bc1c70a5f2a06b0d4da976641609b946" + integrity sha512-7dqywvVudPSrRCW5nTHpHgeWnbBtz8cFkOuKrecm6ih+oO9ciydhWt6OF7HlqupRRmB8Q/gECVdB9LMfToJbRg== dependencies: "@npmcli/node-gyp" "^2.0.0" "@npmcli/promise-spawn" "^3.0.0" @@ -1675,79 +1644,74 @@ read-package-json-fast "^2.0.3" which "^2.0.2" -"@nrwl/cli@14.5.4": - version "14.5.4" - resolved "https://registry.yarnpkg.com/@nrwl/cli/-/cli-14.5.4.tgz#86ac4fbcd1bf079b67c420376cf696b68fcc1200" - integrity sha512-UYr14hxeYV8p/zt6D6z33hljZJQROJAVxSC+mm72fyVvy88Gt0sQNLfMmOARXur0p/73PSLM0jJ2Sr7Ftsuu+A== +"@nrwl/cli@14.5.10": + version "14.5.10" + resolved "https://registry.yarnpkg.com/@nrwl/cli/-/cli-14.5.10.tgz#826c06a9a272523424f0c5690f5d745260ed1ea1" + integrity sha512-GpnnKGO3+HwlMmZSStbq1MOyoDJg2I0HN4nBqM3ltaQkfxGZv3erwRMOAT+8mba2MWbJJ2QQgASAYvTscNYjOQ== dependencies: - nx "14.5.4" + nx "14.5.10" -"@nrwl/tao@14.5.4": - version "14.5.4" - resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-14.5.4.tgz#a67097d424bcbf7073a1944ea1a0209c4f4f859c" - integrity sha512-a2GCuSE8WghjehuU3GVO63KZEnZXXQiqEg137yN/Na+PxwSu68XeaX53SLyzRskTV120YwBBy1YCTNzAZxxsjg== +"@nrwl/tao@14.5.10": + version "14.5.10" + resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-14.5.10.tgz#69c90f8b6e13f2bb521840a5903f7eb4884285ff" + integrity sha512-eWORRba0HlTNmOQFUxHqki0Z5yiRIq1Hl0taprmZpz2lgDXuzPIjGfAi5/ETy5+G5gkEyxFnCq7+SiMilPokwA== dependencies: - nx "14.5.4" + nx "14.5.10" "@octokit/auth-token@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-3.0.0.tgz#6f22c5fc56445c496628488ba6810131558fa4a9" - integrity sha512-MDNFUBcJIptB9At7HiV7VCvU3NcL4GnfCQaP8C5lrxWrRPMJBnemYtehaKSOlaM7AYxeRyj9etenu8LVpSpVaQ== + version "3.0.1" + resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-3.0.1.tgz#88bc2baf5d706cb258474e722a720a8365dff2ec" + integrity sha512-/USkK4cioY209wXRpund6HZzHo9GmjakpV9ycOkpMcMxMk7QVcVFVyCMtzvXYiHsB2crgDgrtNYSELYFBXhhaA== dependencies: - "@octokit/types" "^6.0.3" + "@octokit/types" "^7.0.0" "@octokit/core@^4.0.0": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@octokit/core/-/core-4.0.4.tgz#335d9b377691e3264ce57a9e5a1f6cda783e5838" - integrity sha512-sUpR/hc4Gc7K34o60bWC7WUH6Q7T6ftZ2dUmepSyJr9PRF76/qqkWjE2SOEzCqLA5W83SaISymwKtxks+96hPQ== + version "4.0.5" + resolved "https://registry.yarnpkg.com/@octokit/core/-/core-4.0.5.tgz#589e68c0a35d2afdcd41dafceab072c2fbc6ab5f" + integrity sha512-4R3HeHTYVHCfzSAi0C6pbGXV8UDI5Rk+k3G7kLVNckswN9mvpOzW9oENfjfH3nEmzg8y3AmKmzs8Sg6pLCeOCA== dependencies: "@octokit/auth-token" "^3.0.0" "@octokit/graphql" "^5.0.0" "@octokit/request" "^6.0.0" "@octokit/request-error" "^3.0.0" - "@octokit/types" "^6.0.3" + "@octokit/types" "^7.0.0" before-after-hook "^2.2.0" universal-user-agent "^6.0.0" "@octokit/endpoint@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-7.0.0.tgz#be758a1236d68d6bbb505e686dd50881c327a519" - integrity sha512-Kz/mIkOTjs9rV50hf/JK9pIDl4aGwAtT8pry6Rpy+hVXkAPhXanNQRxMoq6AeRgDCZR6t/A1zKniY2V1YhrzlQ== + version "7.0.1" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-7.0.1.tgz#cb0d03e62e8762f3c80e52b025179de81899a823" + integrity sha512-/wTXAJwt0HzJ2IeE4kQXO+mBScfzyCkI0hMtkIaqyXd9zg76OpOfNQfHL9FlaxAV2RsNiOXZibVWloy8EexENg== dependencies: - "@octokit/types" "^6.0.3" + "@octokit/types" "^7.0.0" is-plain-object "^5.0.0" universal-user-agent "^6.0.0" "@octokit/graphql@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-5.0.0.tgz#2cc6eb3bf8e0278656df1a7d0ca0d7591599e3b3" - integrity sha512-1ZZ8tX4lUEcLPvHagfIVu5S2xpHYXAmgN0+95eAOPoaVPzCfUXJtA5vASafcpWcO86ze0Pzn30TAx72aB2aguQ== + version "5.0.1" + resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-5.0.1.tgz#a06982514ad131fb6fbb9da968653b2233fade9b" + integrity sha512-sxmnewSwAixkP1TrLdE6yRG53eEhHhDTYUykUwdV9x8f91WcbhunIHk9x1PZLALdBZKRPUO2HRcm4kezZ79HoA== dependencies: "@octokit/request" "^6.0.0" - "@octokit/types" "^6.0.3" + "@octokit/types" "^7.0.0" universal-user-agent "^6.0.0" -"@octokit/openapi-types@^11.2.0": - version "11.2.0" - resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-11.2.0.tgz#b38d7fc3736d52a1e96b230c1ccd4a58a2f400a6" - integrity sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA== - -"@octokit/openapi-types@^12.10.0": - version "12.10.1" - resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.10.1.tgz#57b5cc6c7b4e55d8642c93d06401fb1af4839899" - integrity sha512-P+SukKanjFY0ZhsK6wSVnQmxTP2eVPPE8OPSNuxaMYtgVzwJZgfGdwlYjf4RlRU4vLEw4ts2fsE2icG4nZ5ddQ== +"@octokit/openapi-types@^13.4.0": + version "13.4.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-13.4.0.tgz#06fe8fda93bf21bdd397fe7ef8805249efda6c06" + integrity sha512-2mVzW0X1+HDO3jF80/+QFZNzJiTefELKbhMu6yaBYbp/1gSMkVDm4rT472gJljTokWUlXaaE63m7WrWENhMDLw== "@octokit/plugin-enterprise-rest@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-6.0.1.tgz#e07896739618dab8da7d4077c658003775f95437" integrity sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw== -"@octokit/plugin-paginate-rest@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-3.0.0.tgz#df779de686aeb21b5e776e4318defc33b0418566" - integrity sha512-fvw0Q5IXnn60D32sKeLIxgXCEZ7BTSAjJd8cFAE6QU5qUp0xo7LjFUjjX1J5D7HgN355CN4EXE4+Q1/96JaNUA== +"@octokit/plugin-paginate-rest@^4.0.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-4.1.0.tgz#670ac9ac369448c69a2371bfcd7e2b37d95534f2" + integrity sha512-2O5K5fpajYG5g62wjzHR7/cWYaCA88CextAW3vFP+yoIHD0KEdlVMHfM5/i5LyV+JMmqiYW7w5qfg46FR+McNw== dependencies: - "@octokit/types" "^6.39.0" + "@octokit/types" "^7.1.1" "@octokit/plugin-request-log@^1.0.4": version "1.0.4" @@ -1755,57 +1719,50 @@ integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== "@octokit/plugin-rest-endpoint-methods@^6.0.0": - version "6.1.2" - resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.1.2.tgz#bbf55cfc43acf177514441ecd1d26031006f73ed" - integrity sha512-sAfSKtLHNq0UQ2iFuI41I6m5SK6bnKFRJ5kUjDRVbmQXiRVi4aQiIcgG4cM7bt+bhSiWL4HwnTxDkWFlKeKClA== + version "6.3.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.3.0.tgz#81549334ce020169b84bd4a7fa2577e9d725d829" + integrity sha512-qEu2wn6E7hqluZwIEUnDxWROvKjov3zMIAi4H4d7cmKWNMeBprEXZzJe8pE5eStUYC1ysGhD0B7L6IeG1Rfb+g== dependencies: - "@octokit/types" "^6.40.0" + "@octokit/types" "^7.0.0" deprecation "^2.3.1" "@octokit/request-error@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-3.0.0.tgz#f527d178f115a3b62d76ce4804dd5bdbc0270a81" - integrity sha512-WBtpzm9lR8z4IHIMtOqr6XwfkGvMOOILNLxsWvDwtzm/n7f5AWuqJTXQXdDtOvPfTDrH4TPhEvW2qMlR4JFA2w== + version "3.0.1" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-3.0.1.tgz#3fd747913c06ab2195e52004a521889dadb4b295" + integrity sha512-ym4Bp0HTP7F3VFssV88WD1ZyCIRoE8H35pXSKwLeMizcdZAYc/t6N9X9Yr9n6t3aG9IH75XDnZ6UeZph0vHMWQ== dependencies: - "@octokit/types" "^6.0.3" + "@octokit/types" "^7.0.0" deprecation "^2.0.0" once "^1.4.0" "@octokit/request@^6.0.0": - version "6.2.0" - resolved "https://registry.yarnpkg.com/@octokit/request/-/request-6.2.0.tgz#9c25606df84e6f2ccbcc2c58e1d35438e20b688b" - integrity sha512-7IAmHnaezZrgUqtRShMlByJK33MT9ZDnMRgZjnRrRV9a/jzzFwKGz0vxhFU6i7VMLraYcQ1qmcAOin37Kryq+Q== + version "6.2.1" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-6.2.1.tgz#3ceeb22dab09a29595d96594b6720fc14495cf4e" + integrity sha512-gYKRCia3cpajRzDSU+3pt1q2OcuC6PK8PmFIyxZDWCzRXRSIBH8jXjFJ8ZceoygBIm0KsEUg4x1+XcYBz7dHPQ== dependencies: "@octokit/endpoint" "^7.0.0" "@octokit/request-error" "^3.0.0" - "@octokit/types" "^6.16.1" + "@octokit/types" "^7.0.0" is-plain-object "^5.0.0" node-fetch "^2.6.7" universal-user-agent "^6.0.0" "@octokit/rest@^19.0.3": - version "19.0.3" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-19.0.3.tgz#b9a4e8dc8d53e030d611c053153ee6045f080f02" - integrity sha512-5arkTsnnRT7/sbI4fqgSJ35KiFaN7zQm0uQiQtivNQLI8RQx8EHwJCajcTUwmaCMNDg7tdCvqAnc7uvHHPxrtQ== + version "19.0.4" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-19.0.4.tgz#fd8bed1cefffa486e9ae46a9dc608ce81bcfcbdd" + integrity sha512-LwG668+6lE8zlSYOfwPj4FxWdv/qFXYBpv79TWIQEpBLKA9D/IMcWsF/U9RGpA3YqMVDiTxpgVpEW3zTFfPFTA== dependencies: "@octokit/core" "^4.0.0" - "@octokit/plugin-paginate-rest" "^3.0.0" + "@octokit/plugin-paginate-rest" "^4.0.0" "@octokit/plugin-request-log" "^1.0.4" "@octokit/plugin-rest-endpoint-methods" "^6.0.0" -"@octokit/types@^6.0.3", "@octokit/types@^6.16.1": - version "6.34.0" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.34.0.tgz#c6021333334d1ecfb5d370a8798162ddf1ae8218" - integrity sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw== - dependencies: - "@octokit/openapi-types" "^11.2.0" - -"@octokit/types@^6.39.0", "@octokit/types@^6.40.0": - version "6.40.0" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.40.0.tgz#f2e665196d419e19bb4265603cf904a820505d0e" - integrity sha512-MFZOU5r8SwgJWDMhrLUSvyJPtVsqA6VnbVI3TNbsmw+Jnvrktzvq2fYES/6RiJA/5Ykdwq4mJmtlYUfW7CGjmw== +"@octokit/types@^7.0.0", "@octokit/types@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-7.1.1.tgz#a30fd6ca3279d59d532fa75583d65d93b7588e6d" + integrity sha512-Dx6cNTORyVaKY0Yeb9MbHksk79L8GXsihbG6PtWqTpkyA2TY1qBWE26EQXVG3dHwY9Femdd/WEeRUEiD0+H3TQ== dependencies: - "@octokit/openapi-types" "^12.10.0" + "@octokit/openapi-types" "^13.4.0" "@parcel/watcher@2.0.4": version "2.0.4" @@ -1826,19 +1783,14 @@ string-argv "~0.3.1" "@side/jest-runtime@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@side/jest-runtime/-/jest-runtime-1.0.0.tgz#adcef36e716f577f7b75a0853f067eff66acfae2" - integrity sha512-R171d+V4Qu/xaceDNJw3M/2W9ljkXvAZdnwiknUHq+Lm/TIcHDVGeYfLbvBgrQ2gMNsy2Bh+FJG7oBCKEPA/eQ== - -"@sinclair/typebox@^0.23.3": - version "0.23.5" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.23.5.tgz#93f7b9f4e3285a7a9ade7557d9a8d36809cbc47d" - integrity sha512-AFBVi/iT4g20DHoujvMH1aEDn8fGJh4xsRGCP6d8RpLPMqsNPvW01Jcn0QysXTsg++/xj25NmJsGyH9xug/wKg== + version "1.0.2" + resolved "https://registry.yarnpkg.com/@side/jest-runtime/-/jest-runtime-1.0.2.tgz#226ea7f0bc7d4828b7734b1b9821a865d92a9bd0" + integrity sha512-YlbLreG6Gs9zrVHQWzv+AbYH78J311yPaDpUZpAiNsSCeNmc/gbXNRK/AlzlX3UoR/X9CLZjHhsJt9htb1/vaQ== "@sinclair/typebox@^0.24.1": - version "0.24.20" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.20.tgz#11a657875de6008622d53f56e063a6347c51a6dd" - integrity sha512-kVaO5aEFZb33nPMTZBxiPEkY+slxiPtqC7QX8f9B3eGOMBvEfuMfxp9DSTTCsRJPumPKjrge4yagyssO4q6qzQ== + version "0.24.28" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.28.tgz#15aa0b416f82c268b1573ab653e4413c965fe794" + integrity sha512-dgJd3HLOkLmz4Bw50eZx/zJwtBq65nms3N9VBYu5LTjJ883oBFkTyXRlCB/ZGGwqYpJJHA5zW2Ibhl5ngITfow== "@sinonjs/commons@^1.7.0": version "1.8.3" @@ -1880,14 +1832,14 @@ integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== "@tsconfig/node12@^1.0.7": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.10.tgz#10fecee4a3be17357ce99b370bd81874044d8dbd" - integrity sha512-N+srakvPaYMGkwjNDx3ASx65Zl3QG8dJgVtIB+YMOkucU+zctlv/hdP5250VKdDHSDoW9PFZoCqbqNcAPjCjXA== + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== "@tsconfig/node14@^1.0.0": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.2.tgz#b09c08de2eb319ca2acab17a1b8028af110b24b3" - integrity sha512-YwrUA5ysDXHFYfL0Xed9x3sNS4P+aKlCOnnbqUa2E5HdQshHFleCJVrj1PlGTb4GgFUCDyte1v3JWLy2sz8Oqg== + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== "@tsconfig/node16@^1.0.2": version "1.0.3" @@ -1926,9 +1878,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.17.1" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.17.1.tgz#1a0e73e8c28c7e832656db372b779bfd2ef37314" - integrity sha512-kVzjari1s2YVi77D3w1yuvohV2idweYXMCDzqBiVNN63TcDWrIlTVOYpqVrvbbyOE/IyzBoTKF0fdnLPEORFxA== + version "7.18.0" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.0.tgz#8134fd78cb39567465be65b9fdc16d378095f41f" + integrity sha512-v4Vwdko+pgymgS+A2UIaJru93zQd85vIGWObM5ekZNdXCKtDYqATlEYnWgfo86Q6I1Lh0oXnksDnMU1cwmlPDw== dependencies: "@babel/types" "^7.3.0" @@ -1940,9 +1892,9 @@ "@types/node" "*" "@types/geojson@^7946.0.8": - version "7946.0.8" - resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.8.tgz#30744afdb385e2945e22f3b033f897f76b1f12ca" - integrity sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA== + version "7946.0.10" + resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.10.tgz#6dfbf5ea17142f7f9a043809f1cd4c448cb68249" + integrity sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA== "@types/graceful-fs@^4.1.3": version "4.1.5" @@ -2008,16 +1960,21 @@ version "2.0.0" resolved "https://codeload.github.com/types/mysql/tar.gz/c26b1bc2bac17010081455e3127a90fb2eafcec9" -"@types/node@*", "@types/node@>=12", "@types/node@^17.0.10": - version "17.0.42" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.42.tgz#d7e8f22700efc94d125103075c074396b5f41f9b" - integrity sha512-Q5BPGyGKcvQgAMbsr7qEGN/kIPN6zZecYYABeTDBizOsau+2NMdSVTar9UQw21A2+JyA2KRNDYaYrPB0Rpk2oQ== +"@types/node@*", "@types/node@>=12": + version "18.7.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.13.tgz#23e6c5168333480d454243378b69e861ab5c011a" + integrity sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw== "@types/node@17.0.18": version "17.0.18" resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.18.tgz#3b4fed5cfb58010e3a2be4b6e74615e4847f1074" integrity sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA== +"@types/node@^17.0.10": + version "17.0.45" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.45.tgz#2c0fafd78705e7a18b7906b5201a522719dc5190" + integrity sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw== + "@types/normalize-package-data@^2.4.0": version "2.4.1" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" @@ -2038,9 +1995,9 @@ pg-types "^2.2.0" "@types/prettier@^2.1.5": - version "2.6.3" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.6.3.tgz#68ada76827b0010d0db071f739314fa429943d0a" - integrity sha512-ymZk3LEC/fsut+/Q5qejp6R9O1rMxz3XaRHDV6kX8MrGAhOSPqVARbDi+EZvInBpw+BnCX3TD240byVkOfQsHg== + version "2.7.0" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.0.tgz#ea03e9f0376a4446f44797ca19d9c46c36e352dc" + integrity sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A== "@types/sqlstring@2.3.0": version "2.3.0" @@ -2073,9 +2030,9 @@ integrity sha512-56/MAlX5WMsPVbOg7tAxnYvNYMMWr/QJiIp6BxVSW3JJXUVzzOn64qW8TzQyMSqSUFM2+PVI4aUHcHOzIz/1tg== "@types/whatwg-url@^8.2.1": - version "8.2.1" - resolved "https://registry.yarnpkg.com/@types/whatwg-url/-/whatwg-url-8.2.1.tgz#f1aac222dab7c59e011663a0cb0a3117b2ef05d4" - integrity sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ== + version "8.2.2" + resolved "https://registry.yarnpkg.com/@types/whatwg-url/-/whatwg-url-8.2.2.tgz#749d5b3873e845897ada99be4448041d4cc39e63" + integrity sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA== dependencies: "@types/node" "*" "@types/webidl-conversions" "*" @@ -2086,9 +2043,9 @@ integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== "@types/yargs@^17.0.8": - version "17.0.10" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.10.tgz#591522fce85d8739bca7b8bb90d048e4478d186a" - integrity sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA== + version "17.0.11" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.11.tgz#5e10ca33e219807c0eee0f08b5efcba9b6a42c06" + integrity sha512-aB4y9UDUXTSMxmM4MH+YnuR0g5Cph3FLQBoWoMB21DSvFVAxRVEHEMx3TLh+zUZYMCQtKiqazz0Q4Rre31f/OA== dependencies: "@types/yargs-parser" "*" @@ -2195,12 +2152,7 @@ acorn-walk@^8.1.1: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== -acorn@^8.4.1, acorn@^8.7.1: - version "8.7.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" - integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== - -acorn@^8.8.0: +acorn@^8.4.1, acorn@^8.8.0: version "8.8.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8" integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w== @@ -2332,9 +2284,9 @@ are-we-there-yet@^2.0.0: readable-stream "^3.6.0" are-we-there-yet@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-3.0.0.tgz#ba20bd6b553e31d62fc8c31bd23d22b95734390d" - integrity sha512-0GWpv50YSOcLXaN6/FAKY3vfRbllXWV2xvfA/oKJF8pzFhWXPV+yjhJXDBbjscDYowv7Yw1A3uigpzn5iEGTyw== + version "3.0.1" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz#679df222b278c64f2cdba1175cdc00b0d96164bd" + integrity sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg== dependencies: delegates "^1.0.0" readable-stream "^3.6.0" @@ -2495,13 +2447,13 @@ better-sqlite3@7.6.2: prebuild-install "^7.1.0" bin-links@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-3.0.1.tgz#cc70ffb481988b22c527d3e6e454787876987a49" - integrity sha512-9vx+ypzVhASvHTS6K+YSGf7nwQdANoz7v6MTC0aCtYnOEZ87YvMf81aY737EZnGZdpbRM3sfWjO9oWkKmuIvyQ== + version "3.0.3" + resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-3.0.3.tgz#3842711ef3db2cd9f16a5f404a996a12db355a6e" + integrity sha512-zKdnMPWEdh4F5INR07/eBrodC7QrF5JKvqskjz/ZZRXg5YSAZIbn8zGhbhUrElzHBZ2fvEQdOU59RHcTG3GiwA== dependencies: cmd-shim "^5.0.0" mkdirp-infer-owner "^2.0.0" - npm-normalize-package-bin "^1.0.0" + npm-normalize-package-bin "^2.0.0" read-cmd-shim "^3.0.0" rimraf "^3.0.0" write-file-atomic "^4.0.0" @@ -2550,15 +2502,14 @@ braces@^3.0.2, braces@~3.0.2: fill-range "^7.0.1" browserslist@^4.20.2: - version "4.20.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.20.4.tgz#98096c9042af689ee1e0271333dbc564b8ce4477" - integrity sha512-ok1d+1WpnU24XYN7oC3QWgTyMhY/avPJ/r9T00xxvUOIparA/gc+UPUMaod3i+G6s+nI2nUb9xZ5k794uIwShw== + version "4.21.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.3.tgz#5df277694eb3c48bc5c4b05af3e8b7e09c5a6d1a" + integrity sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ== dependencies: - caniuse-lite "^1.0.30001349" - electron-to-chromium "^1.4.147" - escalade "^3.1.1" - node-releases "^2.0.5" - picocolors "^1.0.0" + caniuse-lite "^1.0.30001370" + electron-to-chromium "^1.4.202" + node-releases "^2.0.6" + update-browserslist-db "^1.0.5" bs-logger@0.x: version "0.2.6" @@ -2574,13 +2525,6 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" -bson@^4.6.3: - version "4.6.4" - resolved "https://registry.yarnpkg.com/bson/-/bson-4.6.4.tgz#e66d4a334f1ab230dfcfb9ec4ea9091476dd372e" - integrity sha512-TdQ3FzguAu5HKPPlr0kYQCyrYUYh8tFM+CMTpxjNzVzxeiJY00Rtuj3LXLHSgiGvmaWlZ8PE+4KyM2thqE38pQ== - dependencies: - buffer "^5.6.0" - bson@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/bson/-/bson-4.7.0.tgz#7874a60091ffc7a45c5dd2973b5cad7cded9718a" @@ -2653,9 +2597,9 @@ cacache@^15.2.0: unique-filename "^1.1.1" cacache@^16.0.0, cacache@^16.0.6, cacache@^16.1.0: - version "16.1.1" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-16.1.1.tgz#4e79fb91d3efffe0630d5ad32db55cc1b870669c" - integrity sha512-VDKN+LHyCQXaaYZ7rA/qtkURU+/yYhviUdvqEv2LT6QPZU8jpyzEkEVAcKlKLt5dJ5BRp11ym8lo3NKLluEPLg== + version "16.1.3" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-16.1.3.tgz#a02b9f34ecfaf9a78c9f4bc16fceb94d5d67a38e" + integrity sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ== dependencies: "@npmcli/fs" "^2.1.0" "@npmcli/move-file" "^2.0.0" @@ -2674,7 +2618,7 @@ cacache@^16.0.0, cacache@^16.0.6, cacache@^16.1.0: rimraf "^3.0.2" ssri "^9.0.0" tar "^6.1.11" - unique-filename "^1.1.1" + unique-filename "^2.0.0" callsites@^3.0.0: version "3.1.0" @@ -2700,10 +2644,10 @@ camelcase@^6.2.0, camelcase@^6.3.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001349: - version "1.0.30001352" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001352.tgz#cc6f5da3f983979ad1e2cdbae0505dccaa7c6a12" - integrity sha512-GUgH8w6YergqPQDGWhJGt8GDRnY0L/iJVQcU3eJ46GYf52R8tk0Wxp0PymuFVZboJYXGiCqwozAYZNRjVj6IcA== +caniuse-lite@^1.0.30001370: + version "1.0.30001383" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001383.tgz#aecf317ccd940690725ae3ae4f28293c5fb8050e" + integrity sha512-swMpEoTp5vDoGBZsYZX7L7nXHe6dsHxi9o6/LKf/f0LukVtnrxly5GVb/fWdCDTqi/yw6Km6tiJ0pmBacm0gbg== chalk@4.1.0: version "4.1.0" @@ -2782,9 +2726,9 @@ ci-info@^2.0.0: integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== ci-info@^3.2.0: - version "3.3.1" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.1.tgz#58331f6f472a25fe3a50a351ae3052936c2c7f32" - integrity sha512-SXgeMX9VwDe7iFFaEWkA5AstuER9YKqy4EhHqr4DVqkwmD9rpVimkMKWHdjn30Ja45txyjhSn63lVX69eVCckg== + version "3.3.2" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.2.tgz#6d2967ffa407466481c6c90b6e16b3098f080128" + integrity sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg== cjs-module-lexer@^1.0.0: version "1.2.2" @@ -2879,11 +2823,9 @@ co@^4.6.0: integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== code-block-writer@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-11.0.0.tgz#5956fb186617f6740e2c3257757fea79315dd7d4" - integrity sha512-GEqWvEWWsOvER+g9keO4ohFoD3ymwyCnqY3hoTr7GZipYFwEhMHJw+TtV0rfgRhNImM6QWZGO2XYjlJVyYT62w== - dependencies: - tslib "2.3.1" + version "11.0.3" + resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-11.0.3.tgz#9eec2993edfb79bfae845fbc093758c0a0b73b76" + integrity sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw== collect-v8-coverage@^1.0.0: version "1.0.1" @@ -2919,16 +2861,11 @@ color-support@^1.1.2, color-support@^1.1.3: resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== -colorette@2.0.19: +colorette@2.0.19, colorette@^2.0.16, colorette@^2.0.17: version "2.0.19" resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798" integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ== -colorette@^2.0.16, colorette@^2.0.17: - version "2.0.17" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.17.tgz#5dd4c0d15e2984b7433cb4a9f2ead45063b80c47" - integrity sha512-hJo+3Bkn0NCHybn9Tu35fIeoOKGOk5OCC32y4Hz2It+qlCO2Q3DeQ1hRn/tDDMQKRYUEzqsl7jbF6dYKjlE60g== - colors@~1.2.1: version "1.2.5" resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc" @@ -2943,9 +2880,9 @@ columnify@^1.6.0: wcwidth "^1.0.0" commander@^9.1.0, commander@^9.3.0: - version "9.3.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-9.3.0.tgz#f619114a5a2d2054e0d9ff1b31d5ccf89255e26b" - integrity sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw== + version "9.4.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.0.tgz#bc4a40918fefe52e22450c111ecd6b7acce6f11c" + integrity sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw== common-ancestor-path@^1.0.1: version "1.0.1" @@ -3102,12 +3039,12 @@ core-util-is@~1.0.0: integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== cosmiconfig-typescript-loader@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-2.0.1.tgz#5622bb1eb87d293570bcc3a57f406940e0960113" - integrity sha512-B9s6sX/omXq7I6gC6+YgLmrBFMJhPWew7ty/X5Tuwtd2zOSgWaUdXjkuVwbe3qqcdETo60+1nSVMekq//LIXVA== + version "2.0.2" + resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-2.0.2.tgz#7e7ce6064af041c910e1e43fb0fd9625cee56e93" + integrity sha512-KmE+bMjWMXJbkWCeY4FJX/npHuZPNr9XF9q9CIQ/bpFwi1qHfCmSiKarrCcRa0LO4fWjk93pVoeRtJAkTGcYNw== dependencies: cosmiconfig "^7" - ts-node "^10.8.0" + ts-node "^10.8.1" cosmiconfig@^7, cosmiconfig@^7.0.0: version "7.0.1" @@ -3213,12 +3150,7 @@ delegates@^1.0.0: resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ== -denque@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/denque/-/denque-2.0.1.tgz#bcef4c1b80dc32efe97515744f21a4229ab8934a" - integrity sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ== - -denque@^2.1.0: +denque@^2.0.1, denque@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== @@ -3319,10 +3251,10 @@ eastasianwidth@^0.2.0: resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -electron-to-chromium@^1.4.147: - version "1.4.152" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.152.tgz#7dedbe8f3dc1c597088982a203f392e60f7ee90a" - integrity sha512-jk4Ju5SGZAQQJ1iI4Rgru7dDlvkQPLpNPWH9gIZmwCD4YteA5Bbk1xPcPDUf5jUYs3e1e80RXdi8XgKQZaigeg== +electron-to-chromium@^1.4.202: + version "1.4.231" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.231.tgz#ae6de219c20aa690bc3d217ff151b208a9bd8ed6" + integrity sha512-E8WsUC60chToZUfxvVUXBb1U/mR/Df3GFX+mO3edtQnRTUt6L2XgpqBVWcGD/xrzQdINL1g/CEBPPn0YJ86Y6Q== emittery@^0.10.2: version "0.10.2" @@ -3495,16 +3427,7 @@ esm@^3.2.25: resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== -espree@^9.3.2: - version "9.3.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.2.tgz#f58f77bd334731182801ced3380a8cc859091596" - integrity sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA== - dependencies: - acorn "^8.7.1" - acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.3.0" - -espree@^9.3.3: +espree@^9.3.2, espree@^9.3.3: version "9.3.3" resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.3.tgz#2dd37c4162bb05f433ad3c1a52ddf8a49dc08e9d" integrity sha512-ORs1Rt/uQTqUKjDdGCyrtYxbazf5umATSf/K4qxjmZHORR6HJk+2s/2Pqe+Kk49HHINC/xNIrGfgh8sZcll0ng== @@ -3747,9 +3670,9 @@ flat@^5.0.2: integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== flatted@^3.1.0: - version "3.2.5" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" - integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== + version "3.2.7" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" + integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== fs-constants@^1.0.0: version "1.0.0" @@ -4009,9 +3932,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.15.0: - version "13.15.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.15.0.tgz#38113218c907d2f7e98658af246cef8b77e90bac" - integrity sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog== + version "13.17.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.17.0.tgz#902eb1e680a41da93945adbdcb5a9f361ba69bd4" + integrity sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw== dependencies: type-fest "^0.20.2" @@ -4120,9 +4043,9 @@ hosted-git-info@^4.0.0, hosted-git-info@^4.0.1: lru-cache "^6.0.0" hosted-git-info@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-5.0.0.tgz#df7a06678b4ebd722139786303db80fdf302ea56" - integrity sha512-rRnjWu0Bxj+nIfUOkz0695C0H6tRrN5iYIzYejb0tDEefe2AekHu/U5Kn9pEie5vsJqpNQU02az7TGSH3qpz4Q== + version "5.1.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-5.1.0.tgz#9786123f92ef3627f24abc3f15c20d98ec4a6594" + integrity sha512-Ek+QmMEqZF8XrbFdwoDjSbm7rT23pCgEMOJmz6GPk/s4yH//RQfNPArhIxbguNxROq/+5lNBwCDHMhA903Kx1Q== dependencies: lru-cache "^7.5.1" @@ -4308,11 +4231,6 @@ interpret@^2.2.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== -ip@^1.1.5: - version "1.1.8" - resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48" - integrity sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg== - ip@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.0.tgz#4cf4ab182fee2314c75ede1276f8c80b479936da" @@ -4337,10 +4255,10 @@ is-ci@^2.0.0: dependencies: ci-info "^2.0.0" -is-core-module@^2.5.0, is-core-module@^2.8.1: - version "2.9.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" - integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== +is-core-module@^2.5.0, is-core-module@^2.8.1, is-core-module@^2.9.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.10.0.tgz#9012ede0a91c69587e647514e1d5277019e728ed" + integrity sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg== dependencies: has "^1.0.3" @@ -4521,9 +4439,9 @@ istanbul-lib-source-maps@^4.0.0: source-map "^0.6.1" istanbul-reports@^3.1.3: - version "3.1.4" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.4.tgz#1b6f068ecbc6c331040aab5741991273e609e40c" - integrity sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw== + version "3.1.5" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.5.tgz#cc9a6ab25cb25659810e4785ed9d9fb742578bae" + integrity sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" @@ -4829,19 +4747,7 @@ jest-snapshot@^28.1.3: pretty-format "^28.1.3" semver "^7.3.5" -jest-util@^28.0.0: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.1.tgz#ff39e436a1aca397c0ab998db5a51ae2b7080d05" - integrity sha512-FktOu7ca1DZSyhPAxgxB6hfh2+9zMoJ7aEQA759Z6p45NuO8mWcqujH+UdHlCm/V6JTWwDztM2ITCzU1ijJAfw== - dependencies: - "@jest/types" "^28.1.1" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - -jest-util@^28.1.3: +jest-util@^28.0.0, jest-util@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.3.tgz#f4f932aa0074f0679943220ff9cbba7e497028b0" integrity sha512-XdqfpHwpcSRko/C35uLYFM2emRAltIIKZiJ9eAmhjsj0CqZMa0p1ib0R5fWIqGhn1a103DebTbpqIaP1qCQ6tQ== @@ -4990,14 +4896,14 @@ jsonparse@^1.2.0, jsonparse@^1.3.1: integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== just-diff-apply@^5.2.0: - version "5.3.1" - resolved "https://registry.yarnpkg.com/just-diff-apply/-/just-diff-apply-5.3.1.tgz#30f40809ffed55ad76dccf73fa9b85a76964c867" - integrity sha512-dgFenZnMsc1xGNqgdtgnh7DK+Oy352CE3VZLbzcbQpsBs9iI2K3M0IRrdgREZ72eItTjbl0suRyvKRdVQa9GbA== + version "5.4.1" + resolved "https://registry.yarnpkg.com/just-diff-apply/-/just-diff-apply-5.4.1.tgz#1debed059ad009863b4db0e8d8f333d743cdd83b" + integrity sha512-AAV5Jw7tsniWwih8Ly3fXxEZ06y+6p5TwQMsw0dzZ/wPKilzyDgdAnL0Ug4NNIquPUOh1vfFWEHbmXUqM5+o8g== just-diff@^5.0.1: - version "5.0.3" - resolved "https://registry.yarnpkg.com/just-diff/-/just-diff-5.0.3.tgz#4c9c514dec5526b25ab977590e3c39a0cf271554" - integrity sha512-a8p80xcpJ6sdurk5PxDKb4mav9MeKjA3zFKZpCWBIfvg8mznfnmb13MKZvlrwJ+Lhis0wM3uGAzE0ArhFHvIcg== + version "5.1.1" + resolved "https://registry.yarnpkg.com/just-diff/-/just-diff-5.1.1.tgz#8da6414342a5ed6d02ccd64f5586cbbed3146202" + integrity sha512-u8HXJ3HlNrTzY7zrYYKjNEfBlyjqhdBkoyTVdjtn7p02RJD5NvR8rIClzeGA7t+UYP1/7eAkWNLU0+P3QrEqKQ== kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" @@ -5237,9 +5143,9 @@ lru-cache@^6.0.0: yallist "^4.0.0" lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1: - version "7.10.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.10.1.tgz#db577f42a94c168f676b638d15da8fb073448cab" - integrity sha512-BQuhQxPuRl79J5zSXRP+uNzPOyZw2oFI9JLRQ80XswSvg21KMKNtQza9eF42rfI/3Z40RvzBdXgziEkudzjo8A== + version "7.14.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.14.0.tgz#21be64954a4680e303a09e9468f880b98a0b3c7f" + integrity sha512-EIRtP1GrSJny0dqb50QXRUNBxHJhcpxHC++M5tD7RYbvLLn5KVWKsbyswSSqDuU15UFi3bgTQIY8nhDMeF6aDQ== make-dir@^2.1.0: version "2.1.0" @@ -5262,9 +5168,9 @@ make-error@1.x, make-error@^1.1.1: integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== make-fetch-happen@^10.0.3, make-fetch-happen@^10.0.6: - version "10.1.7" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-10.1.7.tgz#b1402cb3c9fad92b380ff3a863cdae5414a42f76" - integrity sha512-J/2xa2+7zlIUKqfyXDCXFpH3ypxO4k3rgkZHPSZkyUYcBT/hM80M3oyKLM/9dVriZFiGeGGS2Ei+0v2zfhqj3Q== + version "10.2.1" + resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz#f5e3835c5e9817b617f2770870d9492d28678164" + integrity sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w== dependencies: agentkeepalive "^4.2.1" cacache "^16.1.0" @@ -5454,9 +5360,9 @@ minipass-fetch@^1.3.2: encoding "^0.1.12" minipass-fetch@^2.0.3: - version "2.1.0" - resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-2.1.0.tgz#ca1754a5f857a3be99a9271277246ac0b44c3ff8" - integrity sha512-H9U4UVBGXEyyWJnqYDCLp1PwD8XIkJ4akNHp1aGVI+2Ym7wQMlxDKi4IB4JbmyU+pl9pEs/cVrK6cOuvmbK4Sg== + version "2.1.2" + resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-2.1.2.tgz#95560b50c472d81a3bc76f20ede80eaed76d8add" + integrity sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA== dependencies: minipass "^3.1.6" minipass-sized "^1.0.3" @@ -5494,9 +5400,9 @@ minipass-sized@^1.0.3: minipass "^3.0.0" minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3, minipass@^3.1.6: - version "3.1.6" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" - integrity sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ== + version "3.3.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.4.tgz#ca99f95dd77c43c7a76bf51e6d200025eee0ffae" + integrity sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw== dependencies: yallist "^4.0.0" @@ -5533,24 +5439,16 @@ modify-values@^1.0.0: integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== moment-timezone@^0.5.34: - version "0.5.34" - resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.34.tgz#a75938f7476b88f155d3504a9343f7519d9a405c" - integrity sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg== + version "0.5.37" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.37.tgz#adf97f719c4e458fdb12e2b4e87b8bec9f4eef1e" + integrity sha512-uEDzDNFhfaywRl+vwXxffjjq1q0Vzr+fcQpQ1bU0kbzorfS7zVtZnCnGc8mhWmF39d4g4YriF6kwA75mJKE/Zg== dependencies: moment ">= 2.9.0" "moment@>= 2.9.0": - version "2.29.3" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.3.tgz#edd47411c322413999f7a5940d526de183c031f3" - integrity sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw== - -mongodb-connection-string-url@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz#f075c8d529e8d3916386018b8a396aed4f16e5ed" - integrity sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA== - dependencies: - "@types/whatwg-url" "^8.2.1" - whatwg-url "^11.0.0" + version "2.29.4" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" + integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== mongodb-connection-string-url@^2.5.3: version "2.5.3" @@ -5560,10 +5458,10 @@ mongodb-connection-string-url@^2.5.3: "@types/whatwg-url" "^8.2.1" whatwg-url "^11.0.0" -mongodb-memory-server-core@8.8.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/mongodb-memory-server-core/-/mongodb-memory-server-core-8.8.0.tgz#c45e3d60ed0299f3216407bce5a72d5121d1935c" - integrity sha512-pguLQes27cFhiqs/rRqINst1y2zCMGVNrVEREbvFtKaMTQUh40TU1XeOrVesqu1qYFGHYntYCOzlJueUtl62qQ== +mongodb-memory-server-core@8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/mongodb-memory-server-core/-/mongodb-memory-server-core-8.9.0.tgz#388c159a4f5b690cc67efcee29f88b18c3f47132" + integrity sha512-Ol9BrKij2QVMgtzQ/xl5+5FTonsBmB3L+krn0kfpfo+sHk5uTWvWkPwEpt+yU4cxY2M/yYfMZD8eXfvZz6yEtQ== dependencies: "@types/tmp" "^0.2.3" async-mutex "^0.3.2" @@ -5573,7 +5471,7 @@ mongodb-memory-server-core@8.8.0: get-port "^5.1.1" https-proxy-agent "^5.0.1" md5-file "^5.0.0" - mongodb "~4.7.0" + mongodb "~4.9.0" new-find-package-json "^2.0.0" semver "^7.3.7" tar-stream "^2.1.4" @@ -5583,14 +5481,14 @@ mongodb-memory-server-core@8.8.0: yauzl "^2.10.0" mongodb-memory-server@^8.8.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/mongodb-memory-server/-/mongodb-memory-server-8.8.0.tgz#f44543160e3de307447ed306beb5d763667a217e" - integrity sha512-1cy/N4RC7mH/T8Go6J/vbbOWg5d2YR3DZCnhrRJkhQMUQmEIdU62jqLTepViW7A2LKKweopkfb4PiKAFJV/Z1A== + version "8.9.0" + resolved "https://registry.yarnpkg.com/mongodb-memory-server/-/mongodb-memory-server-8.9.0.tgz#c73851ad73c87aec33414cfea5030c9267cfce24" + integrity sha512-+0bBBRggSdD7mbLGF8+iRFlfzdMvpQnyfk1aDgGqWjdhlLRVTxyTxyY5f+Zr/NA+bt5rehFn1EyCI46QhacUdg== dependencies: - mongodb-memory-server-core "8.8.0" + mongodb-memory-server-core "8.9.0" tslib "^2.4.0" -mongodb@4.9.0: +mongodb@4.9.0, mongodb@~4.9.0: version "4.9.0" resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-4.9.0.tgz#58618439b721f2d6f7d38bb10a4612e29d7f1c8a" integrity sha512-tJJEFJz7OQTQPZeVHZJIeSOjMRqc5eSyXTt86vSQENEErpkiG7279tM/GT5AVZ7TgXNh9HQxoa2ZkbrANz5GQw== @@ -5602,18 +5500,6 @@ mongodb@4.9.0: optionalDependencies: saslprep "^1.0.3" -mongodb@~4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-4.7.0.tgz#99f7323271d93659067695b60e7b4efee2de9bf0" - integrity sha512-HhVar6hsUeMAVlIbwQwWtV36iyjKd9qdhY+s4wcU8K6TOj4Q331iiMy+FoPuxEntDIijTYWivwFJkLv8q/ZgvA== - dependencies: - bson "^4.6.3" - denque "^2.0.1" - mongodb-connection-string-url "^2.5.2" - socks "^2.6.2" - optionalDependencies: - saslprep "^1.0.3" - ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -5689,9 +5575,9 @@ new-find-package-json@^2.0.0: debug "^4.3.4" node-abi@^3.3.0: - version "3.22.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.22.0.tgz#00b8250e86a0816576258227edbce7bbe0039362" - integrity sha512-u4uAs/4Zzmp/jjsD9cyFYDXeISfUWaAVWshPmDZOFOv4Xl4SbzTXm53I04C2uRueYJ+0t5PEtLH/owbn2Npf/w== + version "3.24.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.24.0.tgz#b9d03393a49f2c7e147d0c99f180e680c27c1599" + integrity sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw== dependencies: semver "^7.3.5" @@ -5717,7 +5603,7 @@ node-gyp-build@^4.3.0: resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.5.0.tgz#7a64eefa0b21112f89f58379da128ac177f20e40" integrity sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg== -node-gyp@8.x, node-gyp@^8.4.1: +node-gyp@8.x: version "8.4.1" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-8.4.1.tgz#3d49308fc31f768180957d6b5746845fbd429937" integrity sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w== @@ -5734,9 +5620,9 @@ node-gyp@8.x, node-gyp@^8.4.1: which "^2.0.2" node-gyp@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.0.0.tgz#e1da2067427f3eb5bb56820cb62bc6b1e4bd2089" - integrity sha512-Ma6p4s+XCTPxCuAMrOA/IJRmVy16R8Sdhtwl4PrCr7IBlj4cPawF0vg/l7nOT1jPbuNS7lIRJpBSvVsXwEZuzw== + version "9.1.0" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.1.0.tgz#c8d8e590678ea1f7b8097511dedf41fc126648f8" + integrity sha512-HkmN0ZpQJU7FLbJauJTHkHlSVAXlNGDAzH/VYFZGDOnFyn/Na3GlNJfkudmufOdS6/jNFhy88ObzL7ERz9es1g== dependencies: env-paths "^2.2.0" glob "^7.1.4" @@ -5754,10 +5640,10 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-releases@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.5.tgz#280ed5bc3eba0d96ce44897d8aee478bfb3d9666" - integrity sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q== +node-releases@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" + integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== nopt@^5.0.0: version "5.0.0" @@ -5787,9 +5673,9 @@ normalize-package-data@^3.0.0: validate-npm-package-license "^3.0.1" normalize-package-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-4.0.0.tgz#1122d5359af21d4cd08718b92b058a658594177c" - integrity sha512-m+GL22VXJKkKbw62ZaBBjv8u6IE3UI4Mh5QakIqs3fWiKe0Xyi6L97hakwZK41/LD4R/2ly71Bayx0NLMwLA/g== + version "4.0.1" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-4.0.1.tgz#b46b24e0616d06cadf9d5718b29b6d445a82a62c" + integrity sha512-EBk5QKKuocMJhB3BILuKhmaPjI8vNRSpIfO9woLC6NyHVkKKdVEdAO1mrT0ZfxNR1lKwCcTkuZfmGIFdizZ8Pg== dependencies: hosted-git-info "^5.0.0" is-core-module "^2.8.1" @@ -5806,13 +5692,20 @@ normalize-url@^6.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== -npm-bundled@^1.1.1, npm-bundled@^1.1.2: +npm-bundled@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.2.tgz#944c78789bd739035b70baa2ca5cc32b8d860bc1" integrity sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ== dependencies: npm-normalize-package-bin "^1.0.1" +npm-bundled@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-2.0.1.tgz#94113f7eb342cd7a67de1e789f896b04d2c600f4" + integrity sha512-gZLxXdjEzE/+mOstGDqR6b0EkhJ+kM6fxM6vUuckuctuVPh80Q6pw/rSZj9s4Gex9GxWtIicO1pc8DB9KZWudw== + dependencies: + npm-normalize-package-bin "^2.0.0" + npm-install-checks@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/npm-install-checks/-/npm-install-checks-5.0.0.tgz#5ff27d209a4e3542b8ac6b0c1db6063506248234" @@ -5820,11 +5713,16 @@ npm-install-checks@^5.0.0: dependencies: semver "^7.1.1" -npm-normalize-package-bin@^1.0.0, npm-normalize-package-bin@^1.0.1: +npm-normalize-package-bin@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== +npm-normalize-package-bin@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-2.0.0.tgz#9447a1adaaf89d8ad0abe24c6c84ad614a675fff" + integrity sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ== + npm-package-arg@8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-8.1.1.tgz#00ebf16ac395c63318e67ce66780a06db6df1b04" @@ -5835,61 +5733,39 @@ npm-package-arg@8.1.1: validate-npm-package-name "^3.0.0" npm-package-arg@^9.0.0, npm-package-arg@^9.0.1: - version "9.0.2" - resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-9.0.2.tgz#f3ef7b1b3b02e82564af2d5228b4c36567dcd389" - integrity sha512-v/miORuX8cndiOheW8p2moNuPJ7QhcFh9WGlTorruG8hXSA23vMTEp5hTCmDxic0nD8KHhj/NQgFuySD3GYY3g== + version "9.1.0" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-9.1.0.tgz#a60e9f1e7c03e4e3e4e994ea87fff8b90b522987" + integrity sha512-4J0GL+u2Nh6OnhvUKXRr2ZMG4lR8qtLp+kv7UiV00Y+nGiSxtttCyIRHCt5L5BNkXQld/RceYItau3MDOoGiBw== dependencies: hosted-git-info "^5.0.0" + proc-log "^2.0.1" semver "^7.3.5" validate-npm-package-name "^4.0.0" -npm-packlist@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-5.1.0.tgz#f3fd52903a021009913a133732022132eb355ce7" - integrity sha512-a04sqF6FbkyOAFA19AA0e94gS7Et5T2/IMj3VOT9nOF2RaRdVPQ1Q17Fb/HaDRFs+gbC7HOmhVZ29adpWgmDZg== - dependencies: - glob "^8.0.1" - ignore-walk "^5.0.1" - npm-bundled "^1.1.2" - npm-normalize-package-bin "^1.0.1" - -npm-packlist@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-5.1.1.tgz#79bcaf22a26b6c30aa4dd66b976d69cc286800e0" - integrity sha512-UfpSvQ5YKwctmodvPPkK6Fwk603aoVsf8AEbmVKAEECrfvL8SSe1A2YIwrJ6xmTHAITKPwwZsWo7WwEbNk0kxw== +npm-packlist@^5.1.0, npm-packlist@^5.1.1: + version "5.1.3" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-5.1.3.tgz#69d253e6fd664b9058b85005905012e00e69274b" + integrity sha512-263/0NGrn32YFYi4J533qzrQ/krmmrWwhKkzwTuM4f/07ug51odoaNjUexxO4vxlzURHcmYMH1QjvHjsNDKLVg== dependencies: glob "^8.0.1" ignore-walk "^5.0.1" - npm-bundled "^1.1.2" - npm-normalize-package-bin "^1.0.1" + npm-bundled "^2.0.0" + npm-normalize-package-bin "^2.0.0" npm-pick-manifest@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-7.0.1.tgz#76dda30a7cd6b99be822217a935c2f5eacdaca4c" - integrity sha512-IA8+tuv8KujbsbLQvselW2XQgmXWS47t3CB0ZrzsRZ82DbDfkcFunOaPm4X7qNuhMfq+FmV7hQT4iFVpHqV7mg== + version "7.0.2" + resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-7.0.2.tgz#1d372b4e7ea7c6712316c0e99388a73ed3496e84" + integrity sha512-gk37SyRmlIjvTfcYl6RzDbSmS9Y4TOBXfsPnoYqTHARNgWbyDiCSMLUpmALDj4jjcTZpURiEfsSHJj9k7EV4Rw== dependencies: npm-install-checks "^5.0.0" - npm-normalize-package-bin "^1.0.1" + npm-normalize-package-bin "^2.0.0" npm-package-arg "^9.0.0" semver "^7.3.5" -npm-registry-fetch@^13.0.0, npm-registry-fetch@^13.0.1: - version "13.1.1" - resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-13.1.1.tgz#26dc4b26d0a545886e807748032ba2aefaaae96b" - integrity sha512-5p8rwe6wQPLJ8dMqeTnA57Dp9Ox6GH9H60xkyJup07FmVlu3Mk7pf/kIIpl9gaN5bM8NM+UUx3emUWvDNTt39w== - dependencies: - make-fetch-happen "^10.0.6" - minipass "^3.1.6" - minipass-fetch "^2.0.3" - minipass-json-stream "^1.0.1" - minizlib "^2.1.2" - npm-package-arg "^9.0.1" - proc-log "^2.0.0" - -npm-registry-fetch@^13.3.0: - version "13.3.0" - resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-13.3.0.tgz#0ce10fa4a699a1e70685ecf41bbfb4150d74231b" - integrity sha512-10LJQ/1+VhKrZjIuY9I/+gQTvumqqlgnsCufoXETHAPFTS3+M+Z5CFhZRDHGavmJ6rOye3UvNga88vl8n1r6gg== +npm-registry-fetch@^13.0.0, npm-registry-fetch@^13.0.1, npm-registry-fetch@^13.3.0: + version "13.3.1" + resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-13.3.1.tgz#bb078b5fa6c52774116ae501ba1af2a33166af7e" + integrity sha512-eukJPi++DKRTjSBRcDZSDDsGqRK3ehbxfFUcgaRd0Yp6kRwOwh2WVn0r+8rMB4nnuzvAk6rQVzl6K5CkYOmnvw== dependencies: make-fetch-happen "^10.0.6" minipass "^3.1.6" @@ -5933,13 +5809,13 @@ npmlog@^6.0.0, npmlog@^6.0.2: gauge "^4.0.3" set-blocking "^2.0.0" -nx@14.5.4, "nx@>=14.5.4 < 16": - version "14.5.4" - resolved "https://registry.yarnpkg.com/nx/-/nx-14.5.4.tgz#58b6e8ee798733a6ab9aff2a19180c371482fa10" - integrity sha512-xv1nTaQP6kqVDE4PXcB1tLlgzNAPUHE/2vlqSLgxjNb6colKf0vrEZhVTjhnbqBeJiTb33gUx50bBXkurCkN5w== +nx@14.5.10, "nx@>=14.5.4 < 16": + version "14.5.10" + resolved "https://registry.yarnpkg.com/nx/-/nx-14.5.10.tgz#cc950bcc2d867f0aa4e86a508842a9299650fbb9" + integrity sha512-dqiV+zY32k98mfKFTgiQyYd9HYZmB1zoJj6gYniEuqzs6CKp8ZSpeRDaVQRxR6wEMvW9MSTA9kBg8sJ78W/NZg== dependencies: - "@nrwl/cli" "14.5.4" - "@nrwl/tao" "14.5.4" + "@nrwl/cli" "14.5.10" + "@nrwl/tao" "14.5.10" "@parcel/watcher" "2.0.4" chalk "4.1.0" chokidar "^3.5.1" @@ -6147,37 +6023,10 @@ packet-reader@1.0.0: resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== -pacote@^13.0.3: - version "13.6.0" - resolved "https://registry.yarnpkg.com/pacote/-/pacote-13.6.0.tgz#79ea3d3ae5a2b29e2994dcf18d75494e8d888032" - integrity sha512-zHmuCwG4+QKnj47LFlW3LmArwKoglx2k5xtADiMCivVWPgNRP5QyLDGOIjGjwOe61lhl1rO63m/VxT16pEHLWg== - dependencies: - "@npmcli/git" "^3.0.0" - "@npmcli/installed-package-contents" "^1.0.7" - "@npmcli/promise-spawn" "^3.0.0" - "@npmcli/run-script" "^3.0.1" - cacache "^16.0.0" - chownr "^2.0.0" - fs-minipass "^2.1.0" - infer-owner "^1.0.4" - minipass "^3.1.6" - mkdirp "^1.0.4" - npm-package-arg "^9.0.0" - npm-packlist "^5.1.0" - npm-pick-manifest "^7.0.0" - npm-registry-fetch "^13.0.1" - proc-log "^2.0.0" - promise-retry "^2.0.1" - read-package-json "^5.0.0" - read-package-json-fast "^2.0.3" - rimraf "^3.0.2" - ssri "^9.0.0" - tar "^6.1.11" - -pacote@^13.6.1: - version "13.6.1" - resolved "https://registry.yarnpkg.com/pacote/-/pacote-13.6.1.tgz#ac6cbd9032b4c16e5c1e0c60138dfe44e4cc589d" - integrity sha512-L+2BI1ougAPsFjXRyBhcKmfT016NscRFLv6Pz5EiNf1CCFJFU0pSKKQwsZTyAQB+sTuUL4TyFyp6J1Ork3dOqw== +pacote@^13.0.3, pacote@^13.6.1: + version "13.6.2" + resolved "https://registry.yarnpkg.com/pacote/-/pacote-13.6.2.tgz#0d444ba3618ab3e5cd330b451c22967bbd0ca48a" + integrity sha512-Gu8fU3GsvOPkak2CkbojR7vjs3k3P9cA6uazKTHdsdV0gpCEQq2opelnEv30KRQWgVzP5Vd/5umjcedma3MKtg== dependencies: "@npmcli/git" "^3.0.0" "@npmcli/installed-package-contents" "^1.0.7" @@ -6320,9 +6169,9 @@ pg-int8@1.0.1: integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== pg-pool@^3.5.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.5.1.tgz#f499ce76f9bf5097488b3b83b19861f28e4ed905" - integrity sha512-6iCR0wVrro6OOHFsyavV+i6KYL4lVNyYAB9RD18w66xSzN+d8b66HiwuP30Gp1SH5O9T82fckkzsRjlrhD0ioQ== + version "3.5.2" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.5.2.tgz#ed1bed1fb8d79f1c6fd5fb1c99e990fbf9ddf178" + integrity sha512-His3Fh17Z4eg7oANLob6ZvH8xIVen3phEZh2QuyrIl4dQSDVEabNducv6ysROKpDNPSD+12tONZVWfSgMvDD9w== pg-protocol@*, pg-protocol@^1.5.0: version "1.5.0" @@ -6464,17 +6313,7 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -pretty-format@^28.0.0: - version "28.1.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.1.tgz#f731530394e0f7fcd95aba6b43c50e02d86b95cb" - integrity sha512-wwJbVTGFHeucr5Jw2bQ9P+VYHyLdAqedFLEkdQUVaBF/eiidDwH5OpilINq4mEfhbCjLnirt6HTTDhv1HaTIQw== - dependencies: - "@jest/schemas" "^28.0.2" - ansi-regex "^5.0.1" - ansi-styles "^5.0.0" - react-is "^18.0.0" - -pretty-format@^28.1.3: +pretty-format@^28.0.0, pretty-format@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5" integrity sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q== @@ -6484,7 +6323,7 @@ pretty-format@^28.1.3: ansi-styles "^5.0.0" react-is "^18.0.0" -proc-log@^2.0.0: +proc-log@^2.0.0, proc-log@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-2.0.1.tgz#8f3f69a1f608de27878f91f5c688b225391cb685" integrity sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw== @@ -6586,14 +6425,14 @@ rc@^1.2.7: strip-json-comments "~2.0.1" react-is@^18.0.0: - version "18.1.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.1.0.tgz#61aaed3096d30eacf2a2127118b5b41387d32a67" - integrity sha512-Fl7FuabXsJnV5Q1qIOQwx/sagGF18kogb4gpfcG4gjLBWO0WDiiz1ko/ExayuxE7InyQkBLkxRFG5oxY6Uu3Kg== + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== read-cmd-shim@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-3.0.0.tgz#62b8c638225c61e6cc607f8f4b779f3b8238f155" - integrity sha512-KQDVjGqhZk92PPNRj9ZEXEuqg8bUobSKRw+q0YQ3TKI5xkce7bUJobL4Z/OtiEbAAv70yEpYIXp4iQ9L8oPVog== + version "3.0.1" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-3.0.1.tgz#868c235ec59d1de2db69e11aec885bc095aea087" + integrity sha512-kEmDUoYf/CDy8yZbLTmhB1X9kkjf9Q80PCNsDMb7ufrGd6zZSQA1+UyjrO+pZm5K/S4OXCWJeiIt1JA8kAsa6g== read-package-json-fast@^2.0.2, read-package-json-fast@^2.0.3: version "2.0.3" @@ -6604,14 +6443,14 @@ read-package-json-fast@^2.0.2, read-package-json-fast@^2.0.3: npm-normalize-package-bin "^1.0.1" read-package-json@^5.0.0, read-package-json@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-5.0.1.tgz#1ed685d95ce258954596b13e2e0e76c7d0ab4c26" - integrity sha512-MALHuNgYWdGW3gKzuNMuYtcSSZbGQm94fAp16xt8VsYTLBjUSc55bLMKe6gzpWue0Tfi6CBgwCSdDAqutGDhMg== + version "5.0.2" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-5.0.2.tgz#b8779ccfd169f523b67208a89cc912e3f663f3fa" + integrity sha512-BSzugrt4kQ/Z0krro8zhTwV1Kd79ue25IhNN/VtHFy1mG/6Tluyi+msc0UpwaoQzxSHa28mntAjIZY6kEgfR9Q== dependencies: glob "^8.0.1" json-parse-even-better-errors "^2.3.1" normalize-package-data "^4.0.0" - npm-normalize-package-bin "^1.0.1" + npm-normalize-package-bin "^2.0.0" read-pkg-up@^3.0.0: version "3.0.0" @@ -6765,11 +6604,11 @@ resolve.exports@^1.1.0: integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== resolve@^1.10.0, resolve@^1.20.0: - version "1.22.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" - integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== dependencies: - is-core-module "^2.8.1" + is-core-module "^2.9.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -6823,9 +6662,9 @@ run-parallel@^1.1.9: queue-microtask "^1.2.2" rxjs@^7.5.5: - version "7.5.5" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.5.tgz#2ebad89af0f560f460ad5cc4213219e1f7dd4e9f" - integrity sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw== + version "7.5.6" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.6.tgz#0446577557862afd6903517ce7cae79ecb9662bc" + integrity sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw== dependencies: tslib "^2.1.0" @@ -6987,15 +6826,7 @@ socks-proxy-agent@^7.0.0: debug "^4.3.3" socks "^2.6.2" -socks@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.6.2.tgz#ec042d7960073d40d94268ff3bb727dc685f111a" - integrity sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA== - dependencies: - ip "^1.1.5" - smart-buffer "^4.2.0" - -socks@^2.7.0: +socks@^2.6.2, socks@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/socks/-/socks-2.7.0.tgz#f9225acdb841e874dca25f870e9130990f3913d0" integrity sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA== @@ -7059,9 +6890,9 @@ spdx-expression-parse@^3.0.0: spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.11" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz#50c0d8c40a14ec1bf449bae69a0ea4685a9d9f95" - integrity sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g== + version "3.0.12" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz#69077835abe2710b65f03969898b6637b505a779" + integrity sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA== split2@^3.0.0: version "3.2.2" @@ -7464,7 +7295,7 @@ ts-morph@15.1.0: "@ts-morph/common" "~0.16.0" code-block-writer "^11.0.0" -ts-node@10.9.1: +ts-node@10.9.1, ts-node@^10.8.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== @@ -7483,25 +7314,6 @@ ts-node@10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" -ts-node@^10.8.0: - version "10.8.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.8.1.tgz#ea2bd3459011b52699d7e88daa55a45a1af4f066" - integrity sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g== - dependencies: - "@cspotcode/source-map-support" "^0.8.0" - "@tsconfig/node10" "^1.0.7" - "@tsconfig/node12" "^1.0.7" - "@tsconfig/node14" "^1.0.0" - "@tsconfig/node16" "^1.0.2" - acorn "^8.4.1" - acorn-walk "^8.1.1" - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" - yn "3.1.1" - tsconfig-paths@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.1.0.tgz#f8ef7d467f08ae3a695335bf1ece088c5538d2c1" @@ -7521,11 +7333,6 @@ tsconfig-paths@^3.9.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" - integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== - tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -7593,9 +7400,9 @@ type-fest@^0.8.1: integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== type-fest@^2.18.0: - version "2.18.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.18.0.tgz#fdef3a74e0a9e68ebe46054836650fb91ac3881e" - integrity sha512-pRS+/yrW5TjPPHNOvxhbNZexr2bS63WjrMU8a+VzEBhUi9Tz1pZeD+vQz3ut0svZ46P+SRqMEPnJmk2XnvNzTw== + version "2.19.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b" + integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== typedarray-to-buffer@^3.1.5: version "3.1.5" @@ -7609,20 +7416,15 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@4.7.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== - -typescript@^4.6.4: - version "4.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d" - integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA== +typescript@4.8.2, typescript@^4.6.4: + version "4.8.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" + integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw== uglify-js@^3.1.4: - version "3.16.0" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.0.tgz#b778ba0831ca102c1d8ecbdec2d2bdfcc7353190" - integrity sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw== + version "3.17.0" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.0.tgz#55bd6e9d19ce5eef0d5ad17cd1f587d85b180a85" + integrity sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg== umzug@3.2.1: version "3.2.1" @@ -7643,6 +7445,13 @@ unique-filename@^1.1.1: dependencies: unique-slug "^2.0.0" +unique-filename@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-2.0.1.tgz#e785f8675a9a7589e0ac77e0b5c34d2eaeac6da2" + integrity sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A== + dependencies: + unique-slug "^3.0.0" + unique-slug@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c" @@ -7650,6 +7459,13 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" +unique-slug@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-3.0.0.tgz#6d347cf57c8a7a7a6044aabd0e2d74e4d76dc7c9" + integrity sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w== + dependencies: + imurmurhash "^0.1.4" + universal-user-agent@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" @@ -7665,6 +7481,14 @@ upath@^2.0.1: resolved "https://registry.yarnpkg.com/upath/-/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b" integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w== +update-browserslist-db@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz#be06a5eedd62f107b7c19eb5bcefb194411abf38" + integrity sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -7861,9 +7685,9 @@ write-file-atomic@^3.0.0: typedarray-to-buffer "^3.1.5" write-file-atomic@^4.0.0, write-file-atomic@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.1.tgz#9faa33a964c1c85ff6f849b80b42a88c2c537c8f" - integrity sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ== + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== dependencies: imurmurhash "^0.1.4" signal-exit "^3.0.7" @@ -7950,7 +7774,7 @@ yargs-parser@20.2.4: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== -yargs-parser@21.0.1, yargs-parser@^21.0.0, yargs-parser@^21.0.1: +yargs-parser@21.0.1: version "21.0.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35" integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg== @@ -7968,6 +7792,11 @@ yargs-parser@^20.2.2, yargs-parser@^20.2.3: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== +yargs-parser@^21.0.0, yargs-parser@^21.0.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + yargs@15.4.1: version "15.4.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"