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,qEAAiC,EAAE,CAAC;gBAElD,sBAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAC;;;KACrC;IACL,oBAAC;AAAD,CAvhCA,AAuhCC,IAAA;AAvhCY,sCAAa","file":"EntityManager.js","sourcesContent":["import {Connection} from \"../connection/Connection\";\nimport {FindManyOptions} from \"../find-options/FindManyOptions\";\nimport {ObjectType} from \"../common/ObjectType\";\nimport {EntityNotFoundError} from \"../error/EntityNotFoundError\";\nimport {QueryRunnerProviderAlreadyReleasedError} from \"../error/QueryRunnerProviderAlreadyReleasedError\";\nimport {FindOneOptions} from \"../find-options/FindOneOptions\";\nimport {DeepPartial} from \"../common/DeepPartial\";\nimport {RemoveOptions} from \"../repository/RemoveOptions\";\nimport {SaveOptions} from \"../repository/SaveOptions\";\nimport {NoNeedToReleaseEntityManagerError} from \"../error/NoNeedToReleaseEntityManagerError\";\nimport {MongoRepository} from \"../repository/MongoRepository\";\nimport {TreeRepository} from \"../repository/TreeRepository\";\nimport {Repository} from \"../repository/Repository\";\nimport {FindOptionsUtils} from \"../find-options/FindOptionsUtils\";\nimport {PlainObjectToNewEntityTransformer} from \"../query-builder/transformer/PlainObjectToNewEntityTransformer\";\nimport {PlainObjectToDatabaseEntityTransformer} from \"../query-builder/transformer/PlainObjectToDatabaseEntityTransformer\";\nimport {CustomRepositoryNotFoundError} from \"../error/CustomRepositoryNotFoundError\";\nimport {EntitySchema, getMetadataArgsStorage, ObjectLiteral} from \"../index\";\nimport {AbstractRepository} from \"../repository/AbstractRepository\";\nimport {CustomRepositoryCannotInheritRepositoryError} from \"../error/CustomRepositoryCannotInheritRepositoryError\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {RepositoryNotFoundError} from \"../error/RepositoryNotFoundError\";\nimport {RepositoryNotTreeError} from \"../error/RepositoryNotTreeError\";\nimport {RepositoryFactory} from \"../repository/RepositoryFactory\";\nimport {TreeRepositoryNotSupportedError} from \"../error/TreeRepositoryNotSupportedError\";\nimport {QueryDeepPartialEntity} from \"../query-builder/QueryPartialEntity\";\nimport {EntityPersistExecutor} from \"../persistence/EntityPersistExecutor\";\nimport {ObjectID} from \"../driver/mongodb/typings\";\nimport {InsertResult} from \"../query-builder/result/InsertResult\";\nimport {UpdateResult} from \"../query-builder/result/UpdateResult\";\nimport {DeleteResult} from \"../query-builder/result/DeleteResult\";\nimport {OracleDriver} from \"../driver/oracle/OracleDriver\";\nimport {FindConditions} from \"../find-options/FindConditions\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\n\n/**\n * Entity manager supposed to work with any entity, automatically find its repository and call its methods,\n * whatever entity type are you passing.\n */\nexport class EntityManager {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by this entity manager.\n */\n readonly connection: Connection;\n\n /**\n * Custom query runner to be used for operations in this entity manager.\n * Used only in non-global entity manager.\n */\n readonly queryRunner?: QueryRunner;\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Once created and then reused by en repositories.\n */\n protected repositories: Repository<any>[] = [];\n\n /**\n * Plain to object transformer used in create and merge operations.\n */\n protected plainObjectToEntityTransformer = new PlainObjectToNewEntityTransformer();\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: Connection, queryRunner?: QueryRunner) {\n this.connection = connection;\n if (queryRunner) {\n this.queryRunner = queryRunner;\n // dynamic: this.queryRunner = manager;\n ObjectUtils.assign(this.queryRunner, { manager: this });\n }\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Wraps given function execution (and all operations made there) in a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n\n /**\n * Wraps given function execution (and all operations made there) in a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n\n /**\n * Wraps given function execution (and all operations made there) in a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(\n isolationOrRunInTransaction: IsolationLevel | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>\n ): Promise<T> {\n\n const isolation = typeof isolationOrRunInTransaction === \"string\" ? isolationOrRunInTransaction : undefined;\n const runInTransaction = typeof isolationOrRunInTransaction === \"function\" ? isolationOrRunInTransaction : runInTransactionParam;\n\n if (!runInTransaction) {\n throw new Error(`Transaction method requires callback in second paramter if isolation level is supplied.`);\n }\n\n if (this.connection.driver instanceof MongoDriver)\n throw new Error(`Transactions aren't supported by MongoDB.`);\n\n if (this.queryRunner && this.queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError();\n\n if (this.queryRunner && this.queryRunner.isTransactionActive)\n throw new Error(`Cannot start transaction because its already started`);\n\n // if query runner is already defined in this class, it means this entity manager was already created for a single connection\n // if its not defined we create a new query runner - single connection where we'll execute all our operations\n const queryRunner = this.queryRunner || this.connection.createQueryRunner(\"master\");\n\n try {\n if (isolation) {\n await queryRunner.startTransaction(isolation);\n } else {\n await queryRunner.startTransaction();\n }\n const result = await runInTransaction(queryRunner.manager);\n await queryRunner.commitTransaction();\n return result;\n\n } catch (err) {\n try { // we throw original error even if rollback thrown an error\n await queryRunner.rollbackTransaction();\n } catch (rollbackError) { }\n throw err;\n\n } finally {\n if (!this.queryRunner) // if we used a new query runner provider then release it\n await queryRunner.release();\n }\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(query: string, parameters?: any[]): Promise<any> {\n return this.connection.query(query, parameters, this.queryRunner);\n }\n\n /**\n * Creates a new query builder that can be used to build a sql query.\n */\n createQueryBuilder<Entity>(entityClass: ObjectType<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;\n\n /**\n * Creates a new query builder that can be used to build a sql query.\n */\n createQueryBuilder<Entity>(entityClass: EntitySchema<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;\n\n /**\n * Creates a new query builder that can be used to build a sql query.\n */\n createQueryBuilder<Entity>(entityName: string, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;\n\n /**\n * Creates a new query builder that can be used to build a sql query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>;\n\n /**\n * Creates a new query builder that can be used to build a sql query.\n */\n createQueryBuilder<Entity>(entityClass?: ObjectType<Entity>|EntitySchema<Entity>|string|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (alias) {\n return this.connection.createQueryBuilder(entityClass as EntitySchema<Entity>|string, alias, queryRunner || this.queryRunner);\n\n } else {\n return this.connection.createQueryBuilder(entityClass as QueryRunner|undefined || queryRunner || this.queryRunner);\n }\n }\n\n /**\n * Checks if entity has an id.\n */\n hasId(entity: any): boolean;\n\n /**\n * Checks if entity of given schema name has an id.\n */\n hasId(target: Function|string, entity: any): boolean;\n\n /**\n * Checks if entity has an id by its Function type or schema name.\n */\n hasId(targetOrEntity: any|Function|string, maybeEntity?: any): boolean {\n const target = arguments.length === 2 ? targetOrEntity : targetOrEntity.constructor;\n const entity = arguments.length === 2 ? maybeEntity : targetOrEntity;\n const metadata = this.connection.getMetadata(target);\n return metadata.hasId(entity);\n }\n\n /**\n * Gets entity mixed id.\n */\n getId(entity: any): any;\n\n /**\n * Gets entity mixed id.\n */\n getId(target: Function|string, entity: any): any;\n\n /**\n * Gets entity mixed id.\n */\n getId(targetOrEntity: any|Function|string, maybeEntity?: any): any {\n const target = arguments.length === 2 ? targetOrEntity : targetOrEntity.constructor;\n const entity = arguments.length === 2 ? maybeEntity : targetOrEntity;\n const metadata = this.connection.getMetadata(target);\n return metadata.getEntityIdMixedMap(entity);\n }\n\n /**\n * Creates a new entity instance and copies all entity properties from this object into a new entity.\n * Note that it copies only properties that present in entity schema.\n */\n create<Entity>(entityClass: ObjectType<Entity>, plainObject?: DeepPartial<Entity>): Entity;\n\n /**\n * Creates a new entities and copies all entity properties from given objects into their new entities.\n * Note that it copies only properties that present in entity schema.\n */\n create<Entity>(entityClass: ObjectType<Entity>, plainObjects?: DeepPartial<Entity>[]): Entity[];\n\n /**\n * Creates a new entity instance and copies all entity properties from this object into a new entity.\n * Note that it copies only properties that present in entity schema.\n */\n create<Entity>(entitySchema: EntitySchema<Entity>, plainObject?: DeepPartial<Entity>): Entity;\n\n /**\n * Creates a new entities and copies all entity properties from given objects into their new entities.\n * Note that it copies only properties that present in entity schema.\n */\n create<Entity>(entitySchema: EntitySchema<Entity>, plainObjects?: DeepPartial<Entity>[]): Entity[];\n\n /**\n * Creates a new entity instance and copies all entity properties from this object into a new entity.\n * Note that it copies only properties that present in entity schema.\n */\n create<Entity>(entityName: string, plainObject?: DeepPartial<Entity>): Entity;\n\n /**\n * Creates a new entities and copies all entity properties from given objects into their new entities.\n * Note that it copies only properties that present in entity schema.\n */\n create<Entity>(entityName: string, plainObjects?: DeepPartial<Entity>[]): Entity[];\n\n /**\n * Creates a new entity instance or instances.\n * Can copy properties from the given object into new entities.\n */\n create<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, plainObjectOrObjects?: DeepPartial<Entity>|DeepPartial<Entity>[]): Entity|Entity[] {\n const metadata = this.connection.getMetadata(entityClass);\n\n if (!plainObjectOrObjects)\n return metadata.create(this.queryRunner);\n\n if (plainObjectOrObjects instanceof Array)\n return plainObjectOrObjects.map(plainEntityLike => this.create(entityClass as any, plainEntityLike));\n\n const mergeIntoEntity = metadata.create(this.queryRunner);\n this.plainObjectToEntityTransformer.transform(mergeIntoEntity, plainObjectOrObjects, metadata, true);\n return mergeIntoEntity;\n }\n\n /**\n * Merges two entities into one new entity.\n */\n merge<Entity>(entityClass: ObjectType<Entity>, mergeIntoEntity: Entity, ...entityLikes: DeepPartial<Entity>[]): Entity;\n\n /**\n * Merges two entities into one new entity.\n */\n merge<Entity>(entitySchema: EntitySchema<Entity>, mergeIntoEntity: Entity, ...entityLikes: DeepPartial<Entity>[]): Entity;\n\n /**\n * Merges two entities into one new entity.\n */\n merge<Entity>(entityName: string, mergeIntoEntity: Entity, ...entityLikes: DeepPartial<Entity>[]): Entity;\n\n /**\n * Merges two entities into one new entity.\n */\n merge<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, mergeIntoEntity: Entity, ...entityLikes: DeepPartial<Entity>[]): Entity { // todo: throw exception if entity manager is released\n const metadata = this.connection.getMetadata(entityClass);\n entityLikes.forEach(object => this.plainObjectToEntityTransformer.transform(mergeIntoEntity, object, metadata));\n return mergeIntoEntity;\n }\n\n /**\n * Creates a new entity from the given plan javascript object. If entity already exist in the database, then\n * it loads it (and everything related to it), replaces all values with the new ones from the given object\n * and returns this new entity. This new entity is actually a loaded from the db entity with all properties\n * replaced from the new object.\n */\n preload<Entity>(entityClass: ObjectType<Entity>, entityLike: DeepPartial<Entity>): Promise<Entity|undefined>;\n\n /**\n * Creates a new entity from the given plan javascript object. If entity already exist in the database, then\n * it loads it (and everything related to it), replaces all values with the new ones from the given object\n * and returns this new entity. This new entity is actually a loaded from the db entity with all properties\n * replaced from the new object.\n */\n preload<Entity>(entitySchema: EntitySchema<Entity>, entityLike: DeepPartial<Entity>): Promise<Entity|undefined>;\n\n /**\n * Creates a new entity from the given plan javascript object. If entity already exist in the database, then\n * it loads it (and everything related to it), replaces all values with the new ones from the given object\n * and returns this new entity. This new entity is actually a loaded from the db entity with all properties\n * replaced from the new object.\n */\n preload(entityName: string, entityLike: DeepPartial<any>): Promise<any|undefined>;\n\n /**\n * Creates a new entity from the given plan javascript object. If entity already exist in the database, then\n * it loads it (and everything related to it), replaces all values with the new ones from the given object\n * and returns this new entity. This new entity is actually a loaded from the db entity with all properties\n * replaced from the new object.\n */\n async preload<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, entityLike: DeepPartial<Entity>): Promise<Entity|undefined> {\n const metadata = this.connection.getMetadata(entityClass);\n const plainObjectToDatabaseEntityTransformer = new PlainObjectToDatabaseEntityTransformer(this.connection.manager);\n const transformedEntity = await plainObjectToDatabaseEntityTransformer.transform(entityLike, metadata);\n if (transformedEntity)\n return this.merge(entityClass as any, transformedEntity as Entity, entityLike);\n\n return undefined;\n }\n\n /**\n * Saves all given entities in the database.\n * If entities do not exist in the database then inserts, otherwise updates.\n */\n save<Entity>(entities: Entity[], options?: SaveOptions): Promise<Entity[]>;\n\n /**\n * Saves all given entities in the database.\n * If entities do not exist in the database then inserts, otherwise updates.\n */\n save<Entity>(entity: Entity, options?: SaveOptions): Promise<Entity>;\n\n /**\n * Saves all given entities in the database.\n * If entities do not exist in the database then inserts, otherwise updates.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: ObjectType<Entity>|EntitySchema<Entity>, entities: T[], options?: SaveOptions): Promise<T[]>;\n\n /**\n * Saves all given entities in the database.\n * If entities do not exist in the database then inserts, otherwise updates.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: ObjectType<Entity>|EntitySchema<Entity>, entity: T, options?: SaveOptions): Promise<T>;\n\n /**\n * Saves all given entities in the database.\n * If entities do not exist in the database then inserts, otherwise updates.\n */\n save<T>(targetOrEntity: string, entities: T[], options?: SaveOptions): Promise<T[]>;\n\n /**\n * Saves all given entities in the database.\n * If entities do not exist in the database then inserts, otherwise updates.\n */\n save<T>(targetOrEntity: string, entity: T, options?: SaveOptions): Promise<T>;\n\n /**\n * Saves a given entity in the database.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: (T|T[])|ObjectType<Entity>|EntitySchema<Entity>|string, maybeEntityOrOptions?: T|T[], maybeOptions?: SaveOptions): Promise<T|T[]> {\n\n // normalize mixed parameters\n let target = (arguments.length > 1 && (targetOrEntity instanceof Function || targetOrEntity instanceof EntitySchema || typeof targetOrEntity === \"string\")) ? targetOrEntity as Function|string : undefined;\n const entity: T|T[] = target ? maybeEntityOrOptions as T|T[] : targetOrEntity as T|T[];\n const options = target ? maybeOptions : maybeEntityOrOptions as SaveOptions;\n\n if (target instanceof EntitySchema)\n target = target.options.name;\n\n // if user passed empty array of entities then we don't need to do anything\n if (entity instanceof Array && entity.length === 0)\n return Promise.resolve(entity);\n\n // execute save operation\n return new EntityPersistExecutor(this.connection, this.queryRunner, \"save\", target, entity, options)\n .execute()\n .then(() => entity);\n }\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(entity: Entity, options?: RemoveOptions): Promise<Entity>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: ObjectType<Entity>, entity: Entity, options?: RemoveOptions): Promise<Entity>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: EntitySchema<Entity>, entity: Entity, options?: RemoveOptions): Promise<Entity>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: string, entity: Entity, options?: RemoveOptions): Promise<Entity>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(entity: Entity[], options?: RemoveOptions): Promise<Entity>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: ObjectType<Entity>, entity: Entity[], options?: RemoveOptions): Promise<Entity[]>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: EntitySchema<Entity>, entity: Entity[], options?: RemoveOptions): Promise<Entity[]>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: string, entity: Entity[], options?: RemoveOptions): Promise<Entity[]>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: (Entity|Entity[])|Function|string, maybeEntityOrOptions?: Entity|Entity[], maybeOptions?: RemoveOptions): Promise<Entity|Entity[]> {\n\n // normalize mixed parameters\n const target = (arguments.length > 1 && (targetOrEntity instanceof Function || typeof targetOrEntity === \"string\")) ? targetOrEntity as Function|string : undefined;\n const entity: Entity|Entity[] = target ? maybeEntityOrOptions as Entity|Entity[] : targetOrEntity as Entity|Entity[];\n const options = target ? maybeOptions : maybeEntityOrOptions as SaveOptions;\n\n // if user passed empty array of entities then we don't need to do anything\n if (entity instanceof Array && entity.length === 0)\n return Promise.resolve(entity);\n\n // execute save operation\n return new EntityPersistExecutor(this.connection, this.queryRunner, \"remove\", target, entity, options)\n .execute()\n .then(() => entity);\n }\n\n /**\n * Inserts a given entity into the database.\n * Unlike save method executes a primitive operation without cascades, relations and other operations included.\n * Executes fast and efficient INSERT query.\n * Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.\n * You can execute bulk inserts using this method.\n */\n async insert<Entity>(target: ObjectType<Entity>|EntitySchema<Entity>|string, entity: QueryDeepPartialEntity<Entity>|(QueryDeepPartialEntity<Entity>[])): Promise<InsertResult> {\n\n // TODO: Oracle does not support multiple values. Need to create another nice solution.\n if (this.connection.driver instanceof OracleDriver && entity instanceof Array) {\n const results = await Promise.all(entity.map(entity => this.insert(target, entity)));\n return results.reduce((mergedResult, result) => Object.assign(mergedResult, result), {} as InsertResult);\n }\n return this.createQueryBuilder()\n .insert()\n .into(target)\n .values(entity)\n .execute();\n }\n\n /**\n * Updates entity partially. Entity can be found by a given condition(s).\n * Unlike save method executes a primitive operation without cascades, relations and other operations included.\n * Executes fast and efficient UPDATE query.\n * Does not check if entity exist in the database.\n * Condition(s) cannot be empty.\n */\n update<Entity>(target: ObjectType<Entity>|EntitySchema<Entity>|string, criteria: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|any, partialEntity: QueryDeepPartialEntity<Entity>): Promise<UpdateResult> {\n\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (criteria instanceof Array && criteria.length === 0)) {\n\n return Promise.reject(new Error(`Empty criteria(s) are not allowed for the update method.`));\n }\n\n if (typeof criteria === \"string\" ||\n typeof criteria === \"number\" ||\n criteria instanceof Date ||\n criteria instanceof Array) {\n\n return this.createQueryBuilder()\n .update(target)\n .set(partialEntity)\n .whereInIds(criteria)\n .execute();\n\n } else {\n return this.createQueryBuilder()\n .update(target)\n .set(partialEntity)\n .where(criteria)\n .execute();\n }\n }\n\n /**\n * Deletes entities by a given condition(s).\n * Unlike save method executes a primitive operation without cascades, relations and other operations included.\n * Executes fast and efficient DELETE query.\n * Does not check if entity exist in the database.\n * Condition(s) cannot be empty.\n */\n delete<Entity>(targetOrEntity: ObjectType<Entity>|EntitySchema<Entity>|string, criteria: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|any): Promise<DeleteResult> {\n\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (criteria instanceof Array && criteria.length === 0)) {\n\n return Promise.reject(new Error(`Empty criteria(s) are not allowed for the delete method.`));\n }\n\n if (typeof criteria === \"string\" ||\n typeof criteria === \"number\" ||\n criteria instanceof Date ||\n criteria instanceof Array) {\n\n return this.createQueryBuilder()\n .delete()\n .from(targetOrEntity)\n .whereInIds(criteria)\n .execute();\n\n } else {\n return this.createQueryBuilder()\n .delete()\n .from(targetOrEntity)\n .where(criteria)\n .execute();\n }\n }\n\n /**\n * Counts entities that match given options.\n * Useful for pagination.\n */\n count<Entity>(entityClass: ObjectType<Entity>, options?: FindOneOptions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given options.\n * Useful for pagination.\n */\n count<Entity>(entityClass: EntitySchema<Entity>, options?: FindOneOptions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given options.\n * Useful for pagination.\n */\n count<Entity>(entityClass: string, options?: FindOneOptions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given conditions.\n * Useful for pagination.\n */\n count<Entity>(entityClass: ObjectType<Entity>, conditions?: FindConditions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given conditions.\n * Useful for pagination.\n */\n count<Entity>(entityClass: EntitySchema<Entity>, conditions?: FindConditions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given conditions.\n * Useful for pagination.\n */\n count<Entity>(entityClass: string, conditions?: FindConditions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given find options or conditions.\n * Useful for pagination.\n */\n async count<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, optionsOrConditions?: FindManyOptions<Entity>|any): Promise<number> {\n const metadata = this.connection.getMetadata(entityClass);\n const qb = this.createQueryBuilder(entityClass as any, FindOptionsUtils.extractFindManyOptionsAlias(optionsOrConditions) || metadata.name);\n return FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, optionsOrConditions).getCount();\n }\n\n /**\n * Finds entities that match given options.\n */\n find<Entity>(entityClass: ObjectType<Entity>, options?: FindManyOptions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given conditions.\n */\n find<Entity>(entityClass: ObjectType<Entity>, conditions?: FindConditions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given options.\n */\n find<Entity>(entitySchema: EntitySchema<Entity>, options?: FindManyOptions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given conditions.\n */\n find<Entity>(entitySchema: EntitySchema<Entity>, conditions?: FindConditions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given conditions.\n */\n find<Entity>(entityClass: string, options?: FindManyOptions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given conditions.\n */\n find<Entity>(entityClass: string, conditions?: FindConditions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given find options or conditions.\n */\n async find<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, optionsOrConditions?: FindManyOptions<Entity>|any): Promise<Entity[]> {\n const metadata = this.connection.getMetadata(entityClass);\n const qb = this.createQueryBuilder<Entity>(entityClass as any, FindOptionsUtils.extractFindManyOptionsAlias(optionsOrConditions) || metadata.name);\n\n if (!FindOptionsUtils.isFindManyOptions(optionsOrConditions) || optionsOrConditions.loadEagerRelations !== false)\n FindOptionsUtils.joinEagerRelations(qb, qb.alias, metadata);\n\n return FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, optionsOrConditions).getMany();\n }\n\n /**\n * Finds entities that match given find options.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n findAndCount<Entity>(entityClass: ObjectType<Entity>, options?: FindManyOptions<Entity>): Promise<[Entity[], number]>;\n\n /**\n * Finds entities that match given find options.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n findAndCount<Entity>(entityClass: EntitySchema<Entity>, options?: FindManyOptions<Entity>): Promise<[Entity[], number]>;\n\n /**\n * Finds entities that match given find options.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n findAndCount<Entity>(entityClass: string, options?: FindManyOptions<Entity>): Promise<[Entity[], number]>;\n\n /**\n * Finds entities that match given conditions.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n findAndCount<Entity>(entityClass: ObjectType<Entity>, conditions?: FindConditions<Entity>): Promise<[Entity[], number]>;\n\n /**\n * Finds entities that match given conditions.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n findAndCount<Entity>(entityClass: EntitySchema<Entity>, conditions?: FindConditions<Entity>): Promise<[Entity[], number]>;\n\n /**\n * Finds entities that match given conditions.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n findAndCount<Entity>(entityClass: string, conditions?: FindConditions<Entity>): Promise<[Entity[], number]>;\n\n /**\n * Finds entities that match given find options and conditions.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n async findAndCount<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, optionsOrConditions?: FindManyOptions<Entity>|any): Promise<[Entity[], number]> {\n const metadata = this.connection.getMetadata(entityClass);\n const qb = this.createQueryBuilder<Entity>(entityClass as any, FindOptionsUtils.extractFindManyOptionsAlias(optionsOrConditions) || metadata.name);\n\n if (!FindOptionsUtils.isFindManyOptions(optionsOrConditions) || optionsOrConditions.loadEagerRelations !== false)\n FindOptionsUtils.joinEagerRelations(qb, qb.alias, metadata);\n\n return FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, optionsOrConditions).getManyAndCount();\n }\n\n /**\n * Finds entities with ids.\n * Optionally find options can be applied.\n */\n findByIds<Entity>(entityClass: ObjectType<Entity>, ids: any[], options?: FindManyOptions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities with ids.\n * Optionally find options can be applied.\n */\n findByIds<Entity>(entityClass: EntitySchema<Entity>, ids: any[], options?: FindManyOptions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities with ids.\n * Optionally find options can be applied.\n */\n findByIds<Entity>(entityClass: string, ids: any[], options?: FindManyOptions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities with ids.\n * Optionally conditions can be applied.\n */\n findByIds<Entity>(entityClass: ObjectType<Entity>, ids: any[], conditions?: FindConditions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities with ids.\n * Optionally conditions can be applied.\n */\n findByIds<Entity>(entityClass: EntitySchema<Entity>, ids: any[], conditions?: FindConditions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities with ids.\n * Optionally conditions can be applied.\n */\n findByIds<Entity>(entityClass: string, ids: any[], conditions?: FindConditions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities with ids.\n * Optionally find options or conditions can be applied.\n */\n async findByIds<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, ids: any[], optionsOrConditions?: FindManyOptions<Entity>|any): Promise<Entity[]> {\n\n // if no ids passed, no need to execute a query - just return an empty array of values\n if (!ids.length)\n return Promise.resolve([]);\n const metadata = this.connection.getMetadata(entityClass);\n const qb = this.createQueryBuilder<Entity>(entityClass as any, FindOptionsUtils.extractFindManyOptionsAlias(optionsOrConditions) || metadata.name);\n FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, optionsOrConditions);\n\n if (!FindOptionsUtils.isFindManyOptions(optionsOrConditions) || optionsOrConditions.loadEagerRelations !== false)\n FindOptionsUtils.joinEagerRelations(qb, qb.alias, metadata);\n\n return qb.andWhereInIds(ids).getMany();\n }\n\n /**\n * Finds first entity that matches given find options.\n */\n findOne<Entity>(entityClass: ObjectType<Entity>, id?: string|number|Date|ObjectID, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given find options.\n */\n findOne<Entity>(entityClass: EntitySchema<Entity>, id?: string|number|Date|ObjectID, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given find options.\n */\n findOne<Entity>(entityClass: string, id?: string|number|Date|ObjectID, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given find options.\n */\n findOne<Entity>(entityClass: ObjectType<Entity>, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given find options.\n */\n findOne<Entity>(entityClass: EntitySchema<Entity>, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given find options.\n */\n findOne<Entity>(entityClass: string, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given conditions.\n */\n findOne<Entity>(entityClass: ObjectType<Entity>, conditions?: FindConditions<Entity>, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given conditions.\n */\n findOne<Entity>(entityClass: EntitySchema<Entity>, conditions?: FindConditions<Entity>, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given conditions.\n */\n findOne<Entity>(entityClass: string, conditions?: FindConditions<Entity>, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given conditions.\n */\n async findOne<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, idOrOptionsOrConditions?: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|FindOneOptions<Entity>|any, maybeOptions?: FindOneOptions<Entity>): Promise<Entity|undefined> {\n\n let findOptions: FindManyOptions<any>|FindOneOptions<any>|undefined = undefined;\n if (FindOptionsUtils.isFindOneOptions(idOrOptionsOrConditions)) {\n findOptions = idOrOptionsOrConditions;\n } else if (maybeOptions && FindOptionsUtils.isFindOneOptions(maybeOptions)) {\n findOptions = maybeOptions;\n }\n\n let options: ObjectLiteral|undefined = undefined;\n if (idOrOptionsOrConditions instanceof Object && !FindOptionsUtils.isFindOneOptions(idOrOptionsOrConditions))\n options = idOrOptionsOrConditions as ObjectLiteral;\n\n const metadata = this.connection.getMetadata(entityClass);\n let alias: string = metadata.name;\n if (findOptions && findOptions.join) {\n alias = findOptions.join.alias;\n\n } else if (maybeOptions && FindOptionsUtils.isFindOneOptions(maybeOptions) && maybeOptions.join) {\n alias = maybeOptions.join.alias;\n }\n const qb = this.createQueryBuilder<Entity>(entityClass as any, alias);\n\n if (!findOptions || findOptions.loadEagerRelations !== false)\n FindOptionsUtils.joinEagerRelations(qb, qb.alias, qb.expressionMap.mainAlias!.metadata);\n\n findOptions = {\n ...(findOptions || {}),\n take: 1,\n };\n\n FindOptionsUtils.applyOptionsToQueryBuilder(qb, findOptions);\n\n if (options) {\n qb.where(options);\n\n } else if (typeof idOrOptionsOrConditions === \"string\" || typeof idOrOptionsOrConditions === \"number\" || (idOrOptionsOrConditions as any) instanceof Date) {\n qb.andWhereInIds(metadata.ensureEntityIdMap(idOrOptionsOrConditions));\n }\n\n return qb.getOne();\n }\n\n /**\n * Finds first entity that matches given find options or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: ObjectType<Entity>, id?: string|number|Date|ObjectID, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given find options or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: EntitySchema<Entity>, id?: string|number|Date|ObjectID, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given find options or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: string, id?: string|number|Date|ObjectID, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given find options or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: ObjectType<Entity>, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given find options or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: EntitySchema<Entity>, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given find options or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: string, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given conditions or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: ObjectType<Entity>, conditions?: FindConditions<Entity>, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given conditions or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: EntitySchema<Entity>, conditions?: FindConditions<Entity>, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given conditions or rejects the returned promise on error.\n */\n findOneOrFail<Entity>(entityClass: string, conditions?: FindConditions<Entity>, options?: FindOneOptions<Entity>): Promise<Entity>;\n\n /**\n * Finds first entity that matches given conditions or rejects the returned promise on error.\n */\n async findOneOrFail<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string, idOrOptionsOrConditions?: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|FindOneOptions<Entity>|any, maybeOptions?: FindOneOptions<Entity>): Promise<Entity> {\n return this.findOne<Entity>(entityClass as any, idOrOptionsOrConditions as any, maybeOptions).then((value) => {\n if (value === undefined) {\n return Promise.reject(new EntityNotFoundError(entityClass, idOrOptionsOrConditions));\n }\n return Promise.resolve(value);\n });\n }\n\n /**\n * Clears all the data from the given table (truncates/drops it).\n *\n * Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.\n * @see https://stackoverflow.com/a/5972738/925151\n */\n async clear<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string): Promise<void> {\n const metadata = this.connection.getMetadata(entityClass);\n const queryRunner = this.queryRunner || this.connection.createQueryRunner(\"master\");\n try {\n return await queryRunner.clearTable(metadata.tablePath); // await is needed here because we are using finally\n\n } finally {\n if (!this.queryRunner)\n await queryRunner.release();\n }\n }\n\n /**\n * Increments some column by provided value of the entities matched given conditions.\n */\n async increment<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string,\n conditions: any,\n propertyPath: string,\n value: number | string): Promise<UpdateResult> {\n\n const metadata = this.connection.getMetadata(entityClass);\n const column = metadata.findColumnWithPropertyPath(propertyPath);\n if (!column)\n throw new Error(`Column ${propertyPath} was not found in ${metadata.targetName} entity.`);\n\n if (isNaN(Number(value)))\n throw new Error(`Value \"${value}\" is not a number.`);\n\n // convert possible embeded path \"social.likes\" into object { social: { like: () => value } }\n const values: QueryDeepPartialEntity<Entity> = propertyPath\n .split(\".\")\n .reduceRight(\n (value, key) => ({ [key]: value }) as any,\n () => this.connection.driver.escape(column.databaseName) + \" + \" + value\n );\n\n return this\n .createQueryBuilder<Entity>(entityClass as any, \"entity\")\n .update(entityClass)\n .set(values)\n .where(conditions)\n .execute();\n }\n\n /**\n * Decrements some column by provided value of the entities matched given conditions.\n */\n async decrement<Entity>(entityClass: ObjectType<Entity>|EntitySchema<Entity>|string,\n conditions: any,\n propertyPath: string,\n value: number | string): Promise<UpdateResult> {\n\n const metadata = this.connection.getMetadata(entityClass);\n const column = metadata.findColumnWithPropertyPath(propertyPath);\n if (!column)\n throw new Error(`Column ${propertyPath} was not found in ${metadata.targetName} entity.`);\n\n if (isNaN(Number(value)))\n throw new Error(`Value \"${value}\" is not a number.`);\n\n // convert possible embeded path \"social.likes\" into object { social: { like: () => value } }\n const values: QueryDeepPartialEntity<Entity> = propertyPath\n .split(\".\")\n .reduceRight(\n (value, key) => ({ [key]: value }) as any,\n () => this.connection.driver.escape(column.databaseName) + \" - \" + value\n );\n\n return this\n .createQueryBuilder<Entity>(entityClass as any, \"entity\")\n .update(entityClass)\n .set(values)\n .where(conditions)\n .execute();\n }\n\n /**\n * Gets repository for the given entity class or name.\n * If single database connection mode is used, then repository is obtained from the\n * repository aggregator, where each repository is individually created for this entity manager.\n * When single database connection is not used, repository is being obtained from the connection.\n */\n getRepository<Entity>(target: ObjectType<Entity>|EntitySchema<Entity>|string): Repository<Entity> {\n\n // throw exception if there is no repository with this target registered\n if (!this.connection.hasMetadata(target))\n throw new RepositoryNotFoundError(this.connection.name, target);\n\n // find already created repository instance and return it if found\n const metadata = this.connection.getMetadata(target);\n const repository = this.repositories.find(repository => repository.metadata === metadata);\n if (repository)\n return repository;\n\n // if repository was not found then create it, store its instance and return it\n const newRepository = new RepositoryFactory().create(this, metadata, this.queryRunner);\n this.repositories.push(newRepository);\n return newRepository;\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * If single database connection mode is used, then repository is obtained from the\n * repository aggregator, where each repository is individually created for this entity manager.\n * When single database connection is not used, repository is being obtained from the connection.\n */\n getTreeRepository<Entity>(target: ObjectType<Entity>|EntitySchema<Entity>|string): TreeRepository<Entity> {\n\n // tree tables aren't supported by some drivers (mongodb)\n if (this.connection.driver.treeSupport === false)\n throw new TreeRepositoryNotSupportedError(this.connection.driver);\n\n // check if repository is real tree repository\n const repository = this.getRepository(target);\n if (!(repository instanceof TreeRepository))\n throw new RepositoryNotTreeError(target);\n\n return repository;\n }\n\n /**\n * Gets mongodb repository for the given entity class.\n */\n getMongoRepository<Entity>(target: ObjectType<Entity>|EntitySchema<Entity>|string): MongoRepository<Entity> {\n return this.connection.getMongoRepository<Entity>(target);\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n const entityRepositoryMetadataArgs = getMetadataArgsStorage().entityRepositories.find(repository => {\n return repository.target === (customRepository instanceof Function ? customRepository : (customRepository as any).constructor);\n });\n if (!entityRepositoryMetadataArgs)\n throw new CustomRepositoryNotFoundError(customRepository);\n\n const entityMetadata = entityRepositoryMetadataArgs.entity ? this.connection.getMetadata(entityRepositoryMetadataArgs.entity) : undefined;\n const entityRepositoryInstance = new (entityRepositoryMetadataArgs.target as any)(this, entityMetadata);\n\n // NOTE: dynamic access to protected properties. We need this to prevent unwanted properties in those classes to be exposed,\n // however we need these properties for internal work of the class\n if (entityRepositoryInstance instanceof AbstractRepository) {\n if (!(entityRepositoryInstance as any)[\"manager\"])\n (entityRepositoryInstance as any)[\"manager\"] = this;\n }\n if (entityRepositoryInstance instanceof Repository) {\n if (!entityMetadata)\n throw new CustomRepositoryCannotInheritRepositoryError(customRepository);\n\n (entityRepositoryInstance as any)[\"manager\"] = this;\n (entityRepositoryInstance as any)[\"metadata\"] = entityMetadata;\n }\n\n return entityRepositoryInstance;\n }\n\n /**\n * Releases all resources used by entity manager.\n * This is used when entity manager is created with a single query runner,\n * and this single query runner needs to be released after job with entity manager is done.\n */\n async release(): Promise<void> {\n if (!this.queryRunner)\n throw new NoNeedToReleaseEntityManagerError();\n\n return this.queryRunner.release();\n }\n}\n"],"sourceRoot":".."}
\No newline at end of file