typeorm 0.2.42-dev.0626ed1 → 0.2.42-dev.90a8deb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/browser/connection/Connection.d.ts +2 -2
  2. package/browser/connection/Connection.js +1 -1
  3. package/browser/connection/Connection.js.map +1 -1
  4. package/browser/entity-manager/EntityManager.d.ts +2 -2
  5. package/browser/entity-manager/EntityManager.js +1 -1
  6. package/browser/entity-manager/EntityManager.js.map +1 -1
  7. package/browser/query-builder/DeleteQueryBuilder.d.ts +1 -1
  8. package/browser/query-builder/DeleteQueryBuilder.js +1 -1
  9. package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
  10. package/browser/query-builder/InsertQueryBuilder.d.ts +1 -1
  11. package/browser/query-builder/InsertQueryBuilder.js +1 -1
  12. package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
  13. package/browser/query-builder/QueryBuilder.d.ts +1 -1
  14. package/browser/query-builder/QueryBuilder.js.map +1 -1
  15. package/browser/query-builder/RelationQueryBuilder.d.ts +1 -1
  16. package/browser/query-builder/RelationQueryBuilder.js +1 -1
  17. package/browser/query-builder/RelationQueryBuilder.js.map +1 -1
  18. package/browser/query-builder/SelectQueryBuilder.d.ts +1 -1
  19. package/browser/query-builder/SelectQueryBuilder.js +1 -1
  20. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  21. package/browser/query-builder/SoftDeleteQueryBuilder.d.ts +1 -1
  22. package/browser/query-builder/SoftDeleteQueryBuilder.js +1 -1
  23. package/browser/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
  24. package/browser/query-builder/UpdateQueryBuilder.d.ts +1 -1
  25. package/browser/query-builder/UpdateQueryBuilder.js +1 -1
  26. package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
  27. package/browser/repository/AbstractRepository.d.ts +2 -2
  28. package/browser/repository/AbstractRepository.js +2 -2
  29. package/browser/repository/AbstractRepository.js.map +1 -1
  30. package/browser/repository/BaseEntity.d.ts +1 -1
  31. package/browser/repository/BaseEntity.js +1 -1
  32. package/browser/repository/BaseEntity.js.map +1 -1
  33. package/browser/repository/Repository.d.ts +1 -1
  34. package/browser/repository/Repository.js +1 -1
  35. package/browser/repository/Repository.js.map +1 -1
  36. package/commands/QueryCommand.d.ts +1 -1
  37. package/commands/QueryCommand.js +1 -1
  38. package/commands/QueryCommand.js.map +1 -1
  39. package/connection/Connection.d.ts +2 -2
  40. package/connection/Connection.js +1 -1
  41. package/connection/Connection.js.map +1 -1
  42. package/entity-manager/EntityManager.d.ts +2 -2
  43. package/entity-manager/EntityManager.js +1 -1
  44. package/entity-manager/EntityManager.js.map +1 -1
  45. package/package.json +1 -1
  46. package/query-builder/DeleteQueryBuilder.d.ts +1 -1
  47. package/query-builder/DeleteQueryBuilder.js +1 -1
  48. package/query-builder/DeleteQueryBuilder.js.map +1 -1
  49. package/query-builder/InsertQueryBuilder.d.ts +1 -1
  50. package/query-builder/InsertQueryBuilder.js +1 -1
  51. package/query-builder/InsertQueryBuilder.js.map +1 -1
  52. package/query-builder/QueryBuilder.d.ts +1 -1
  53. package/query-builder/QueryBuilder.js.map +1 -1
  54. package/query-builder/RelationQueryBuilder.d.ts +1 -1
  55. package/query-builder/RelationQueryBuilder.js +1 -1
  56. package/query-builder/RelationQueryBuilder.js.map +1 -1
  57. package/query-builder/SelectQueryBuilder.d.ts +1 -1
  58. package/query-builder/SelectQueryBuilder.js +1 -1
  59. package/query-builder/SelectQueryBuilder.js.map +1 -1
  60. package/query-builder/SoftDeleteQueryBuilder.d.ts +1 -1
  61. package/query-builder/SoftDeleteQueryBuilder.js +1 -1
  62. package/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
  63. package/query-builder/UpdateQueryBuilder.d.ts +1 -1
  64. package/query-builder/UpdateQueryBuilder.js +1 -1
  65. package/query-builder/UpdateQueryBuilder.js.map +1 -1
  66. package/repository/AbstractRepository.d.ts +2 -2
  67. package/repository/AbstractRepository.js +2 -2
  68. package/repository/AbstractRepository.js.map +1 -1
  69. package/repository/BaseEntity.d.ts +1 -1
  70. package/repository/BaseEntity.js +1 -1
  71. package/repository/BaseEntity.js.map +1 -1
  72. package/repository/Repository.d.ts +1 -1
  73. package/repository/Repository.js +1 -1
  74. package/repository/Repository.js.map +1 -1
@@ -169,11 +169,11 @@ export declare class Connection {
169
169
  */
170
170
  query(query: string, parameters?: any[], queryRunner?: QueryRunner): Promise<any>;
171
171
  /**
172
- * Creates a new query builder that can be used to build a sql query.
172
+ * Creates a new query builder that can be used to build a SQL query.
173
173
  */
174
174
  createQueryBuilder<Entity>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;
175
175
  /**
176
- * Creates a new query builder that can be used to build a sql query.
176
+ * Creates a new query builder that can be used to build a SQL query.
177
177
  */
178
178
  createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>;
179
179
  /**
@@ -423,7 +423,7 @@ var Connection = /** @class */ (function () {
423
423
  });
424
424
  };
425
425
  /**
426
- * Creates a new query builder that can be used to build a sql query.
426
+ * Creates a new query builder that can be used to build a SQL query.
427
427
  */
428
428
  Connection.prototype.createQueryBuilder = function (entityOrRunner, alias, queryRunner) {
429
429
  if (this instanceof MongoEntityManager)
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/connection/Connection.ts"],"names":[],"mappings":";AAMA,OAAO,EAAC,qBAAqB,EAAC,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAC,8BAA8B,EAAC,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAC,kCAAkC,EAAC,MAAM,6CAA6C,CAAC;AAK/F,OAAO,EAAC,2BAA2B,EAAC,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAGjE,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAA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,iGAAiG;QACjG,uBAAuB,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,SAAS,KAAK,MAAM,EAA7B,CAA6B,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9H,CAAC;IACL,iBAAC;AAAD,CAxdA,AAwdC,IAAA","file":"Connection.js","sourcesContent":["import {Driver} from \"../driver/Driver\";\nimport {Repository} from \"../repository/Repository\";\nimport {EntitySubscriberInterface} from \"../subscriber/EntitySubscriberInterface\";\nimport {EntityTarget} from \"../common/EntityTarget\";\nimport {ObjectType} from \"../common/ObjectType\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\nimport {DefaultNamingStrategy} from \"../naming-strategy/DefaultNamingStrategy\";\nimport {CannotExecuteNotConnectedError} from \"../error/CannotExecuteNotConnectedError\";\nimport {CannotConnectAlreadyConnectedError} from \"../error/CannotConnectAlreadyConnectedError\";\nimport {TreeRepository} from \"../repository/TreeRepository\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Logger} from \"../logger/Logger\";\nimport {EntityMetadataNotFoundError} from \"../error/EntityMetadataNotFoundError\";\nimport {MigrationInterface} from \"../migration/MigrationInterface\";\nimport {MigrationExecutor} from \"../migration/MigrationExecutor\";\nimport {Migration} from \"../migration/Migration\";\nimport {MongoRepository} from \"../repository/MongoRepository\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoEntityManager} from \"../entity-manager/MongoEntityManager\";\nimport {EntityMetadataValidator} from \"../metadata-builder/EntityMetadataValidator\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {QueryRunnerProviderAlreadyReleasedError} from \"../error/QueryRunnerProviderAlreadyReleasedError\";\nimport {EntityManagerFactory} from \"../entity-manager/EntityManagerFactory\";\nimport {DriverFactory} from \"../driver/DriverFactory\";\nimport {ConnectionMetadataBuilder} from \"./ConnectionMetadataBuilder\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {LoggerFactory} from \"../logger/LoggerFactory\";\nimport {QueryResultCacheFactory} from \"../cache/QueryResultCacheFactory\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\nimport {SqljsEntityManager} from \"../entity-manager/SqljsEntityManager\";\nimport {RelationLoader} from \"../query-builder/RelationLoader\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\nimport {ReplicationMode} from \"../driver/types/ReplicationMode\";\nimport { TypeORMError } from \"../error/TypeORMError\";\n\n/**\n * Connection is a single database ORM connection to a specific database.\n * Its not required to be a database connection, depend on database type it can create connection pool.\n * You can have multiple connections to multiple databases in your application.\n */\nexport class Connection {\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n */\n readonly name: string;\n\n /**\n * Connection options.\n */\n readonly options: ConnectionOptions;\n\n /**\n * Indicates if connection is initialized or not.\n */\n readonly isConnected: boolean;\n\n /**\n * Database driver used by this connection.\n */\n readonly driver: Driver;\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager;\n\n /**\n * Naming strategy used in the connection.\n */\n readonly namingStrategy: NamingStrategyInterface;\n\n /**\n * Logger used to log orm events.\n */\n readonly logger: Logger;\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = [];\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = [];\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = [];\n\n /**\n * Used to work with query result cache.\n */\n readonly queryResultCache?: QueryResultCache;\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: ConnectionOptions) {\n this.name = options.name || \"default\";\n this.options = options;\n this.logger = new LoggerFactory().create(this.options.logger, this.options.logging);\n this.driver = new DriverFactory().create(this);\n this.manager = this.createEntityManager();\n this.namingStrategy = options.namingStrategy || new DefaultNamingStrategy();\n this.queryResultCache = options.cache ? new QueryResultCacheFactory(this).create() : undefined;\n this.relationLoader = new RelationLoader(this);\n this.isConnected = false;\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!(this.manager instanceof MongoEntityManager))\n throw new TypeORMError(`MongoEntityManager is only available for MongoDB databases.`);\n\n return this.manager as MongoEntityManager;\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!(this.manager instanceof SqljsEntityManager))\n throw new TypeORMError(`SqljsEntityManager is only available for Sqljs databases.`);\n\n return this.manager as SqljsEntityManager;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async connect(): Promise<this> {\n if (this.isConnected)\n throw new CannotConnectAlreadyConnectedError(this.name);\n\n // connect to the database via its driver\n await this.driver.connect();\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache)\n await this.queryResultCache.connect();\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isConnected: true });\n\n try {\n\n // build all metadatas registered in the current connection\n this.buildMetadatas();\n\n await this.driver.afterConnect();\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema)\n await this.dropDatabase();\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize)\n await this.synchronize();\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({ transaction: this.options.migrationsTransactionMode });\n\n } catch (error) {\n\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.close();\n throw error;\n }\n\n return this;\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async close(): Promise<void> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n await this.driver.disconnect();\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache)\n await this.queryResultCache.disconnect();\n\n ObjectUtils.assign(this, { isConnected: false });\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n if (dropBeforeSync)\n await this.dropDatabase();\n\n const schemaBuilder = this.driver.createSchemaBuilder();\n await schemaBuilder.build();\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner();\n try {\n if (this.driver instanceof SqlServerDriver || this.driver instanceof MysqlDriver || this.driver instanceof AuroraDataApiDriver) {\n const databases: string[] = this.driver.database ? [this.driver.database] : [];\n this.entityMetadatas.forEach(metadata => {\n if (metadata.database && databases.indexOf(metadata.database) === -1)\n databases.push(metadata.database);\n });\n\n for (const database of databases) {\n await queryRunner.clearDatabase(database);\n }\n } else {\n await queryRunner.clearDatabase();\n }\n } finally {\n await queryRunner.release();\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<Migration[]> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n const successMigrations = await migrationExecutor.executePendingMigrations();\n return successMigrations;\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n await migrationExecutor.undoLastMigration();\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isConnected) {\n throw new CannotExecuteNotConnectedError(this.name);\n }\n const migrationExecutor = new MigrationExecutor(this);\n return await migrationExecutor.showMigrations();\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target);\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target);\n if (!metadata)\n throw new EntityMetadataNotFoundError(target);\n\n return metadata;\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity>(target: EntityTarget<Entity>): Repository<Entity> {\n return this.manager.getRepository(target);\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity>(target: EntityTarget<Entity>): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target);\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity>(target: EntityTarget<Entity>): MongoRepository<Entity> {\n if (!(this.driver instanceof MongoDriver))\n throw new TypeORMError(`You can use getMongoRepository only for MongoDB connections.`);\n\n return this.manager.getRepository(target) as any;\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository);\n }\n\n /**\n * Wraps given function execution (and all operations made there) into 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 async transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(\n isolationOrRunInTransaction: IsolationLevel | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any\n );\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(query: string, parameters?: any[], queryRunner?: QueryRunner): Promise<any> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Queries aren't supported by MongoDB.`);\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError();\n\n const usedQueryRunner = queryRunner || this.createQueryRunner();\n\n try {\n return await usedQueryRunner.query(query, parameters); // await is needed here because we are using finally\n\n } finally {\n if (!queryRunner)\n await usedQueryRunner.release();\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a sql query.\n */\n createQueryBuilder<Entity>(entityClass: EntityTarget<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(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>(entityOrRunner?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`);\n\n if (alias) {\n const metadata = this.getMetadata(entityOrRunner as EntityTarget<Entity>);\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias);\n\n } else {\n return new SelectQueryBuilder(this, entityOrRunner as QueryRunner|undefined);\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode);\n const manager = this.createEntityManager(queryRunner);\n Object.assign(queryRunner, { manager: manager });\n return queryRunner;\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(entityTarget: EntityTarget<any>, relationPropertyPath: string) {\n const relationMetadata = this.getMetadata(entityTarget).findRelationWithPropertyPath(relationPropertyPath);\n if (!relationMetadata)\n throw new TypeORMError(`Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`);\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(`Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`);\n\n return relationMetadata.junctionEntityMetadata;\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner);\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(target: EntityTarget<any>): EntityMetadata|undefined {\n return this.entityMetadatas.find(metadata => {\n if (metadata.target === target)\n return true;\n if (target instanceof EntitySchema) {\n return metadata.name === target.options.name;\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n return metadata.tablePath === target;\n } else {\n return metadata.name === target || metadata.tableName === target;\n }\n }\n\n return false;\n });\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected buildMetadatas(): void {\n\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this);\n const entityMetadataValidator = new EntityMetadataValidator();\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const subscribers = connectionMetadataBuilder.buildSubscribers(this.options.subscribers || []);\n ObjectUtils.assign(this, { subscribers: subscribers });\n\n // build entity metadatas\n const entityMetadatas = connectionMetadataBuilder.buildEntityMetadatas(this.options.entities || []);\n ObjectUtils.assign(this, { entityMetadatas: entityMetadatas });\n\n // create migration instances\n const migrations = connectionMetadataBuilder.buildMigrations(this.options.migrations || []);\n ObjectUtils.assign(this, { migrations: migrations });\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(this.entityMetadatas.filter(metadata => metadata.tableType !== \"view\"), this.driver);\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/connection/Connection.ts"],"names":[],"mappings":";AAMA,OAAO,EAAC,qBAAqB,EAAC,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAC,8BAA8B,EAAC,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAC,kCAAkC,EAAC,MAAM,6CAA6C,CAAC;AAK/F,OAAO,EAAC,2BAA2B,EAAC,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAGjE,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,uBAAuB,EAAC,MAAM,6CAA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,eAAe,CAAC,MAAM,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,SAAS,KAAK,MAAM,EAA7B,CAA6B,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9H,CAAC;IACL,iBAAC;AAAD,CAxdA,AAwdC,IAAA","file":"Connection.js","sourcesContent":["import {Driver} from \"../driver/Driver\";\nimport {Repository} from \"../repository/Repository\";\nimport {EntitySubscriberInterface} from \"../subscriber/EntitySubscriberInterface\";\nimport {EntityTarget} from \"../common/EntityTarget\";\nimport {ObjectType} from \"../common/ObjectType\";\nimport {EntityManager} from \"../entity-manager/EntityManager\";\nimport {DefaultNamingStrategy} from \"../naming-strategy/DefaultNamingStrategy\";\nimport {CannotExecuteNotConnectedError} from \"../error/CannotExecuteNotConnectedError\";\nimport {CannotConnectAlreadyConnectedError} from \"../error/CannotConnectAlreadyConnectedError\";\nimport {TreeRepository} from \"../repository/TreeRepository\";\nimport {NamingStrategyInterface} from \"../naming-strategy/NamingStrategyInterface\";\nimport {EntityMetadata} from \"../metadata/EntityMetadata\";\nimport {Logger} from \"../logger/Logger\";\nimport {EntityMetadataNotFoundError} from \"../error/EntityMetadataNotFoundError\";\nimport {MigrationInterface} from \"../migration/MigrationInterface\";\nimport {MigrationExecutor} from \"../migration/MigrationExecutor\";\nimport {Migration} from \"../migration/Migration\";\nimport {MongoRepository} from \"../repository/MongoRepository\";\nimport {MongoDriver} from \"../driver/mongodb/MongoDriver\";\nimport {MongoEntityManager} from \"../entity-manager/MongoEntityManager\";\nimport {EntityMetadataValidator} from \"../metadata-builder/EntityMetadataValidator\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {QueryRunnerProviderAlreadyReleasedError} from \"../error/QueryRunnerProviderAlreadyReleasedError\";\nimport {EntityManagerFactory} from \"../entity-manager/EntityManagerFactory\";\nimport {DriverFactory} from \"../driver/DriverFactory\";\nimport {ConnectionMetadataBuilder} from \"./ConnectionMetadataBuilder\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SelectQueryBuilder} from \"../query-builder/SelectQueryBuilder\";\nimport {LoggerFactory} from \"../logger/LoggerFactory\";\nimport {QueryResultCacheFactory} from \"../cache/QueryResultCacheFactory\";\nimport {QueryResultCache} from \"../cache/QueryResultCache\";\nimport {SqljsEntityManager} from \"../entity-manager/SqljsEntityManager\";\nimport {RelationLoader} from \"../query-builder/RelationLoader\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {MysqlDriver} from \"../driver/mysql/MysqlDriver\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {AuroraDataApiDriver} from \"../driver/aurora-data-api/AuroraDataApiDriver\";\nimport {ReplicationMode} from \"../driver/types/ReplicationMode\";\nimport { TypeORMError } from \"../error/TypeORMError\";\n\n/**\n * Connection is a single database ORM connection to a specific database.\n * Its not required to be a database connection, depend on database type it can create connection pool.\n * You can have multiple connections to multiple databases in your application.\n */\nexport class Connection {\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n */\n readonly name: string;\n\n /**\n * Connection options.\n */\n readonly options: ConnectionOptions;\n\n /**\n * Indicates if connection is initialized or not.\n */\n readonly isConnected: boolean;\n\n /**\n * Database driver used by this connection.\n */\n readonly driver: Driver;\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager;\n\n /**\n * Naming strategy used in the connection.\n */\n readonly namingStrategy: NamingStrategyInterface;\n\n /**\n * Logger used to log orm events.\n */\n readonly logger: Logger;\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = [];\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = [];\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = [];\n\n /**\n * Used to work with query result cache.\n */\n readonly queryResultCache?: QueryResultCache;\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader;\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: ConnectionOptions) {\n this.name = options.name || \"default\";\n this.options = options;\n this.logger = new LoggerFactory().create(this.options.logger, this.options.logging);\n this.driver = new DriverFactory().create(this);\n this.manager = this.createEntityManager();\n this.namingStrategy = options.namingStrategy || new DefaultNamingStrategy();\n this.queryResultCache = options.cache ? new QueryResultCacheFactory(this).create() : undefined;\n this.relationLoader = new RelationLoader(this);\n this.isConnected = false;\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!(this.manager instanceof MongoEntityManager))\n throw new TypeORMError(`MongoEntityManager is only available for MongoDB databases.`);\n\n return this.manager as MongoEntityManager;\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!(this.manager instanceof SqljsEntityManager))\n throw new TypeORMError(`SqljsEntityManager is only available for Sqljs databases.`);\n\n return this.manager as SqljsEntityManager;\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async connect(): Promise<this> {\n if (this.isConnected)\n throw new CannotConnectAlreadyConnectedError(this.name);\n\n // connect to the database via its driver\n await this.driver.connect();\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache)\n await this.queryResultCache.connect();\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isConnected: true });\n\n try {\n\n // build all metadatas registered in the current connection\n this.buildMetadatas();\n\n await this.driver.afterConnect();\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema)\n await this.dropDatabase();\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize)\n await this.synchronize();\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({ transaction: this.options.migrationsTransactionMode });\n\n } catch (error) {\n\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.close();\n throw error;\n }\n\n return this;\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async close(): Promise<void> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n await this.driver.disconnect();\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache)\n await this.queryResultCache.disconnect();\n\n ObjectUtils.assign(this, { isConnected: false });\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n if (dropBeforeSync)\n await this.dropDatabase();\n\n const schemaBuilder = this.driver.createSchemaBuilder();\n await schemaBuilder.build();\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner();\n try {\n if (this.driver instanceof SqlServerDriver || this.driver instanceof MysqlDriver || this.driver instanceof AuroraDataApiDriver) {\n const databases: string[] = this.driver.database ? [this.driver.database] : [];\n this.entityMetadatas.forEach(metadata => {\n if (metadata.database && databases.indexOf(metadata.database) === -1)\n databases.push(metadata.database);\n });\n\n for (const database of databases) {\n await queryRunner.clearDatabase(database);\n }\n } else {\n await queryRunner.clearDatabase();\n }\n } finally {\n await queryRunner.release();\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<Migration[]> {\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n const successMigrations = await migrationExecutor.executePendingMigrations();\n return successMigrations;\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: { transaction?: \"all\" | \"none\" | \"each\" }): Promise<void> {\n\n if (!this.isConnected)\n throw new CannotExecuteNotConnectedError(this.name);\n\n const migrationExecutor = new MigrationExecutor(this);\n migrationExecutor.transaction = (options && options.transaction) || \"all\";\n\n await migrationExecutor.undoLastMigration();\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isConnected) {\n throw new CannotExecuteNotConnectedError(this.name);\n }\n const migrationExecutor = new MigrationExecutor(this);\n return await migrationExecutor.showMigrations();\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target);\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target);\n if (!metadata)\n throw new EntityMetadataNotFoundError(target);\n\n return metadata;\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity>(target: EntityTarget<Entity>): Repository<Entity> {\n return this.manager.getRepository(target);\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity>(target: EntityTarget<Entity>): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target);\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity>(target: EntityTarget<Entity>): MongoRepository<Entity> {\n if (!(this.driver instanceof MongoDriver))\n throw new TypeORMError(`You can use getMongoRepository only for MongoDB connections.`);\n\n return this.manager.getRepository(target) as any;\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository);\n }\n\n /**\n * Wraps given function execution (and all operations made there) into 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 async transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;\n async transaction<T>(\n isolationOrRunInTransaction: IsolationLevel | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any\n );\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(query: string, parameters?: any[], queryRunner?: QueryRunner): Promise<any> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Queries aren't supported by MongoDB.`);\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError();\n\n const usedQueryRunner = queryRunner || this.createQueryRunner();\n\n try {\n return await usedQueryRunner.query(query, parameters); // await is needed here because we are using finally\n\n } finally {\n if (!queryRunner)\n await usedQueryRunner.release();\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(entityClass: EntityTarget<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(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>(entityOrRunner?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (this instanceof MongoEntityManager)\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`);\n\n if (alias) {\n const metadata = this.getMetadata(entityOrRunner as EntityTarget<Entity>);\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias);\n\n } else {\n return new SelectQueryBuilder(this, entityOrRunner as QueryRunner|undefined);\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode);\n const manager = this.createEntityManager(queryRunner);\n Object.assign(queryRunner, { manager: manager });\n return queryRunner;\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(entityTarget: EntityTarget<any>, relationPropertyPath: string) {\n const relationMetadata = this.getMetadata(entityTarget).findRelationWithPropertyPath(relationPropertyPath);\n if (!relationMetadata)\n throw new TypeORMError(`Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`);\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(`Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`);\n\n return relationMetadata.junctionEntityMetadata;\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner);\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(target: EntityTarget<any>): EntityMetadata|undefined {\n return this.entityMetadatas.find(metadata => {\n if (metadata.target === target)\n return true;\n if (target instanceof EntitySchema) {\n return metadata.name === target.options.name;\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n return metadata.tablePath === target;\n } else {\n return metadata.name === target || metadata.tableName === target;\n }\n }\n\n return false;\n });\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected buildMetadatas(): void {\n\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this);\n const entityMetadataValidator = new EntityMetadataValidator();\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const subscribers = connectionMetadataBuilder.buildSubscribers(this.options.subscribers || []);\n ObjectUtils.assign(this, { subscribers: subscribers });\n\n // build entity metadatas\n const entityMetadatas = connectionMetadataBuilder.buildEntityMetadatas(this.options.entities || []);\n ObjectUtils.assign(this, { entityMetadatas: entityMetadatas });\n\n // create migration instances\n const migrations = connectionMetadataBuilder.buildMigrations(this.options.migrations || []);\n ObjectUtils.assign(this, { migrations: migrations });\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(this.entityMetadatas.filter(metadata => metadata.tableType !== \"view\"), this.driver);\n }\n}\n"],"sourceRoot":".."}
@@ -58,11 +58,11 @@ export declare class EntityManager {
58
58
  */
59
59
  query(query: string, parameters?: any[]): Promise<any>;
60
60
  /**
61
- * Creates a new query builder that can be used to build a sql query.
61
+ * Creates a new query builder that can be used to build a SQL query.
62
62
  */
63
63
  createQueryBuilder<Entity>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;
64
64
  /**
65
- * Creates a new query builder that can be used to build a sql query.
65
+ * Creates a new query builder that can be used to build a SQL query.
66
66
  */
67
67
  createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>;
68
68
  /**
@@ -124,7 +124,7 @@ var EntityManager = /** @class */ (function () {
124
124
  });
125
125
  };
126
126
  /**
127
- * Creates a new query builder that can be used to build a sql query.
127
+ * Creates a new query builder that can be used to build a SQL query.
128
128
  */
129
129
  EntityManager.prototype.createQueryBuilder = function (entityClass, alias, queryRunner) {
130
130
  if (alias) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/entity-manager/EntityManager.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAC,uCAAuC,EAAC,MAAM,kDAAkD,CAAC;AAKzG,OAAO,EAAC,iCAAiC,EAAC,MAAM,4CAA4C,CAAC;AAE7F,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAC,iCAAiC,EAAC,MAAM,gEAAgE,CAAC;AACjH,OAAO,EAAC,sCAAsC,EAAC,MAAM,qEAAqE,CAAC;AAC3H,OAAO,EAAC,6BAA6B,EAAC,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAC,4CAA4C,EAAC,MAAM,uDAAuD,CAAC;AAGnH,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAC,sBAAsB,EAAC,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAC,+BAA+B,EAAC,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAC,qBAAqB,EAAC,MAAM,sCAAsC,CAAC;AAO3E,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAC,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAClD,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CA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C,IAAI,CAAC,WAAW;oBACjB,MAAM,IAAI,iCAAiC,EAAE,CAAC;gBAElD,sBAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAC;;;KACrC;IACL,oBAAC;AAAD,CA9/BA,AA8/BC,IAAA","file":"EntityManager.js","sourcesContent":["import {Connection} from \"../connection/Connection\";\nimport {FindManyOptions} from \"../find-options/FindManyOptions\";\nimport {EntityTarget} from \"../common/EntityTarget\";\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 {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 {FindConditions} from \"../find-options/FindConditions\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {getMetadataArgsStorage} from \"../globals\";\nimport {TypeORMError} from \"../error\";\nimport {UpsertOptions} from \"../repository/UpsertOptions\";\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 TypeORMError(`Transaction method requires callback in second paramter if isolation level is supplied.`);\n }\n\n if (this.connection.driver instanceof MongoDriver)\n throw new TypeORMError(`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 TypeORMError(`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();\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: EntityTarget<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(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?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (alias) {\n return this.connection.createQueryBuilder(entityClass as EntityTarget<Entity>, 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: EntityTarget<any>, entity: any): any;\n\n /**\n * Gets entity mixed id.\n */\n getId(targetOrEntity: any|EntityTarget<any>, 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: EntityTarget<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: EntityTarget<Entity>, 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: EntityTarget<Entity>, 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 (Array.isArray(plainObjectOrObjects))\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: EntityTarget<Entity>, 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 plain 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: EntityTarget<Entity>, 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: EntityTarget<Entity>, entities: T[], options: SaveOptions & { reload: false }): 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: EntityTarget<Entity>, entities: T[], options?: SaveOptions): Promise<(T & Entity)[]>;\n\n /**\n * Saves a given entity in the database.\n * If entity does not exist in the database then inserts, otherwise updates.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options: SaveOptions & { reload: false }): Promise<T>;\n\n /**\n * Saves a given entity in the database.\n * If entity does not exist in the database then inserts, otherwise updates.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options?: SaveOptions): Promise<T & Entity>;\n\n /**\n * Saves a given entity in the database.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: (T|T[])|EntityTarget<Entity>, 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 (Array.isArray(entity) && 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: EntityTarget<Entity>, 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: EntityTarget<Entity>, entity: Entity[], options?: RemoveOptions): Promise<Entity[]>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: (Entity|Entity[])|EntityTarget<Entity>, 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 (Array.isArray(entity) && 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 * Records the delete date of all given entities.\n */\n softRemove<Entity>(entities: Entity[], options?: SaveOptions): Promise<Entity[]>;\n\n /**\n * Records the delete date of a given entity.\n */\n softRemove<Entity>(entity: Entity, options?: SaveOptions): Promise<Entity>;\n\n /**\n * Records the delete date of all given entities.\n */\n softRemove<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entities: T[], options?: SaveOptions): Promise<T[]>;\n\n /**\n * Records the delete date of a given entity.\n */\n softRemove<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options?: SaveOptions): Promise<T>;\n\n /**\n * Records the delete date of one or many given entities.\n */\n softRemove<Entity, T extends DeepPartial<Entity>>(targetOrEntity: (T|T[])|EntityTarget<Entity>, 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 (Array.isArray(entity) && entity.length === 0)\n return Promise.resolve(entity);\n\n // execute soft-remove operation\n return new EntityPersistExecutor(this.connection, this.queryRunner, \"soft-remove\", target, entity, options)\n .execute()\n .then(() => entity);\n }\n\n /**\n * Recovers all given entities.\n */\n recover<Entity>(entities: Entity[], options?: SaveOptions): Promise<Entity[]>;\n\n /**\n * Recovers a given entity.\n */\n recover<Entity>(entity: Entity, options?: SaveOptions): Promise<Entity>;\n\n /**\n * Recovers all given entities.\n */\n recover<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entities: T[], options?: SaveOptions): Promise<T[]>;\n\n /**\n * Recovers a given entity.\n */\n recover<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options?: SaveOptions): Promise<T>;\n\n /**\n * Recovers one or many given entities.\n */\n recover<Entity, T extends DeepPartial<Entity>>(targetOrEntity: (T|T[])|EntityTarget<Entity>, 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 (Array.isArray(entity) && entity.length === 0)\n return Promise.resolve(entity);\n\n // execute recover operation\n return new EntityPersistExecutor(this.connection, this.queryRunner, \"recover\", 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: EntityTarget<Entity>, entity: QueryDeepPartialEntity<Entity>|(QueryDeepPartialEntity<Entity>[])): Promise<InsertResult> {\n return this.createQueryBuilder()\n .insert()\n .into(target)\n .values(entity)\n .execute();\n }\n\n async upsert<Entity>(\n target: EntityTarget<Entity>,\n entityOrEntities: QueryDeepPartialEntity<Entity> | (QueryDeepPartialEntity<Entity>[]),\n conflictPathsOrOptions: string[] | UpsertOptions<Entity>): Promise<InsertResult> {\n const metadata = this.connection.getMetadata(target);\n\n let options: UpsertOptions<Entity>;\n\n if (Array.isArray(conflictPathsOrOptions)) {\n options = {\n conflictPaths: conflictPathsOrOptions\n };\n } else {\n options = conflictPathsOrOptions;\n }\n\n const uniqueColumnConstraints = [\n metadata.primaryColumns,\n ...metadata.indices.filter(ix => ix.isUnique).map(ix => ix.columns),\n ...metadata.uniques.map(uq => uq.columns)\n ];\n\n const useIndex = uniqueColumnConstraints.find((ix) =>\n ix.length === options.conflictPaths.length &&\n options.conflictPaths.every((conflictPropertyPath) => ix.some((col) => col.propertyPath === conflictPropertyPath))\n );\n\n if (useIndex == null) {\n throw new TypeORMError(`An upsert requires conditions that have a unique constraint but none was found for conflict properties: ${options.conflictPaths.join(\", \")}`);\n }\n\n let entities: QueryDeepPartialEntity<Entity>[];\n\n if (!Array.isArray(entityOrEntities)) {\n entities = [entityOrEntities];\n } else {\n entities = entityOrEntities;\n }\n\n const conflictColumns = metadata.mapPropertyPathsToColumns(options.conflictPaths);\n\n const overwriteColumns = metadata.columns\n .filter((col) => (!conflictColumns.includes(col)) && entities.some(entity => typeof col.getEntityValue(entity) !== \"undefined\"));\n\n return this.createQueryBuilder()\n .insert()\n .into(target)\n .values(entities)\n .orUpdate(\n [...conflictColumns, ...overwriteColumns].map((col) => col.databaseName),\n conflictColumns.map((col) => col.databaseName)\n )\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: EntityTarget<Entity>, 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 (Array.isArray(criteria) && criteria.length === 0)) {\n\n return Promise.reject(new TypeORMError(`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 Array.isArray(criteria)) {\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: EntityTarget<Entity>, 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 (Array.isArray(criteria) && criteria.length === 0)) {\n\n return Promise.reject(new TypeORMError(`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 Array.isArray(criteria)) {\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 * Records the delete date of 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 softDelete<Entity>(targetOrEntity: EntityTarget<Entity>, criteria: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|any): 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 (Array.isArray(criteria) && criteria.length === 0)) {\n\n return Promise.reject(new TypeORMError(`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 Array.isArray(criteria)) {\n\n return this.createQueryBuilder()\n .softDelete()\n .from(targetOrEntity)\n .whereInIds(criteria)\n .execute();\n\n } else {\n return this.createQueryBuilder()\n .softDelete()\n .from(targetOrEntity)\n .where(criteria)\n .execute();\n }\n }\n\n /**\n * Restores 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 restore<Entity>(targetOrEntity: EntityTarget<Entity>, criteria: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|any): 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 (Array.isArray(criteria) && criteria.length === 0)) {\n\n return Promise.reject(new TypeORMError(`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 Array.isArray(criteria)) {\n\n return this.createQueryBuilder()\n .restore()\n .from(targetOrEntity)\n .whereInIds(criteria)\n .execute();\n\n } else {\n return this.createQueryBuilder()\n .restore()\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: EntityTarget<Entity>, options?: FindOneOptions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given options.\n * Useful for pagination.\n */\n count<Entity>(entityClass: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given conditions.\n * Useful for pagination.\n */\n count<Entity>(entityClass: EntityTarget<Entity>, 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: EntityTarget<Entity>, optionsOrConditions?: FindConditions<Entity>|FindOneOptions<Entity>|FindManyOptions<Entity>): Promise<number> {\n const metadata = this.connection.getMetadata(entityClass);\n const qb = this.createQueryBuilder(entityClass, 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: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given conditions.\n */\n find<Entity>(entityClass: EntityTarget<Entity>, conditions?: FindConditions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given find options or conditions.\n */\n async find<Entity>(entityClass: EntityTarget<Entity>, optionsOrConditions?: FindManyOptions<Entity>|FindConditions<Entity>): Promise<Entity[]> {\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.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: EntityTarget<Entity>, 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: EntityTarget<Entity>, 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: EntityTarget<Entity>, optionsOrConditions?: FindConditions<Entity>|FindManyOptions<Entity>): 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 FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, optionsOrConditions);\n\n if (!FindOptionsUtils.isFindManyOptions(optionsOrConditions) || optionsOrConditions.loadEagerRelations !== false)\n FindOptionsUtils.joinEagerRelations(qb, qb.alias, metadata);\n\n return qb.getManyAndCount();\n }\n\n /**\n * Finds entities with ids.\n * Optionally find options can be applied.\n */\n findByIds<Entity>(entityClass: EntityTarget<Entity>, 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: EntityTarget<Entity>, 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: EntityTarget<Entity>, ids: any[], optionsOrConditions?: FindConditions<Entity>|FindManyOptions<Entity>): 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: EntityTarget<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: EntityTarget<Entity>, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given conditions.\n */\n findOne<Entity>(entityClass: EntityTarget<Entity>, 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: EntityTarget<Entity>, idOrOptionsOrConditions?: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|FindOneOptions<Entity>|FindConditions<Entity>, 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 const passedId = typeof idOrOptionsOrConditions === \"string\" || typeof idOrOptionsOrConditions === \"number\" || (idOrOptionsOrConditions as any) instanceof Date;\n\n if (!passedId) {\n findOptions = {\n ...(findOptions || {}),\n take: 1,\n };\n }\n\n FindOptionsUtils.applyOptionsToQueryBuilder(qb, findOptions);\n\n if (!findOptions || findOptions.loadEagerRelations !== false) {\n FindOptionsUtils.joinEagerRelations(qb, qb.alias, qb.expressionMap.mainAlias!.metadata);\n }\n\n if (options) {\n qb.where(options);\n\n } else if (passedId) {\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: EntityTarget<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: EntityTarget<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: EntityTarget<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 async findOneOrFail<Entity>(entityClass: EntityTarget<Entity>, idOrOptionsOrConditions?: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|FindOneOptions<Entity>|FindConditions<Entity>, 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: EntityTarget<Entity>): Promise<void> {\n const metadata = this.connection.getMetadata(entityClass);\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\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: EntityTarget<Entity>,\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 TypeORMError(`Column ${propertyPath} was not found in ${metadata.targetName} entity.`);\n\n if (isNaN(Number(value)))\n throw new TypeORMError(`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: EntityTarget<Entity>,\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 TypeORMError(`Column ${propertyPath} was not found in ${metadata.targetName} entity.`);\n\n if (isNaN(Number(value)))\n throw new TypeORMError(`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: EntityTarget<Entity>): 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: EntityTarget<Entity>): 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: EntityTarget<Entity>): 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":".."}
1
+ {"version":3,"sources":["../browser/src/entity-manager/EntityManager.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAC,uCAA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\";\nimport {FindManyOptions} from \"../find-options/FindManyOptions\";\nimport {EntityTarget} from \"../common/EntityTarget\";\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 {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 {FindConditions} from \"../find-options/FindConditions\";\nimport {IsolationLevel} from \"../driver/types/IsolationLevel\";\nimport {ObjectUtils} from \"../util/ObjectUtils\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {getMetadataArgsStorage} from \"../globals\";\nimport {TypeORMError} from \"../error\";\nimport {UpsertOptions} from \"../repository/UpsertOptions\";\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 TypeORMError(`Transaction method requires callback in second paramter if isolation level is supplied.`);\n }\n\n if (this.connection.driver instanceof MongoDriver)\n throw new TypeORMError(`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 TypeORMError(`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();\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: EntityTarget<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(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?: EntityTarget<Entity>|QueryRunner, alias?: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity> {\n if (alias) {\n return this.connection.createQueryBuilder(entityClass as EntityTarget<Entity>, 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: EntityTarget<any>, entity: any): any;\n\n /**\n * Gets entity mixed id.\n */\n getId(targetOrEntity: any|EntityTarget<any>, 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: EntityTarget<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: EntityTarget<Entity>, 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: EntityTarget<Entity>, 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 (Array.isArray(plainObjectOrObjects))\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: EntityTarget<Entity>, 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 plain 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: EntityTarget<Entity>, 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: EntityTarget<Entity>, entities: T[], options: SaveOptions & { reload: false }): 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: EntityTarget<Entity>, entities: T[], options?: SaveOptions): Promise<(T & Entity)[]>;\n\n /**\n * Saves a given entity in the database.\n * If entity does not exist in the database then inserts, otherwise updates.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options: SaveOptions & { reload: false }): Promise<T>;\n\n /**\n * Saves a given entity in the database.\n * If entity does not exist in the database then inserts, otherwise updates.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options?: SaveOptions): Promise<T & Entity>;\n\n /**\n * Saves a given entity in the database.\n */\n save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: (T|T[])|EntityTarget<Entity>, 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 (Array.isArray(entity) && 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: EntityTarget<Entity>, 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: EntityTarget<Entity>, entity: Entity[], options?: RemoveOptions): Promise<Entity[]>;\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity>(targetOrEntity: (Entity|Entity[])|EntityTarget<Entity>, 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 (Array.isArray(entity) && 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 * Records the delete date of all given entities.\n */\n softRemove<Entity>(entities: Entity[], options?: SaveOptions): Promise<Entity[]>;\n\n /**\n * Records the delete date of a given entity.\n */\n softRemove<Entity>(entity: Entity, options?: SaveOptions): Promise<Entity>;\n\n /**\n * Records the delete date of all given entities.\n */\n softRemove<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entities: T[], options?: SaveOptions): Promise<T[]>;\n\n /**\n * Records the delete date of a given entity.\n */\n softRemove<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options?: SaveOptions): Promise<T>;\n\n /**\n * Records the delete date of one or many given entities.\n */\n softRemove<Entity, T extends DeepPartial<Entity>>(targetOrEntity: (T|T[])|EntityTarget<Entity>, 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 (Array.isArray(entity) && entity.length === 0)\n return Promise.resolve(entity);\n\n // execute soft-remove operation\n return new EntityPersistExecutor(this.connection, this.queryRunner, \"soft-remove\", target, entity, options)\n .execute()\n .then(() => entity);\n }\n\n /**\n * Recovers all given entities.\n */\n recover<Entity>(entities: Entity[], options?: SaveOptions): Promise<Entity[]>;\n\n /**\n * Recovers a given entity.\n */\n recover<Entity>(entity: Entity, options?: SaveOptions): Promise<Entity>;\n\n /**\n * Recovers all given entities.\n */\n recover<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entities: T[], options?: SaveOptions): Promise<T[]>;\n\n /**\n * Recovers a given entity.\n */\n recover<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options?: SaveOptions): Promise<T>;\n\n /**\n * Recovers one or many given entities.\n */\n recover<Entity, T extends DeepPartial<Entity>>(targetOrEntity: (T|T[])|EntityTarget<Entity>, 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 (Array.isArray(entity) && entity.length === 0)\n return Promise.resolve(entity);\n\n // execute recover operation\n return new EntityPersistExecutor(this.connection, this.queryRunner, \"recover\", 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: EntityTarget<Entity>, entity: QueryDeepPartialEntity<Entity>|(QueryDeepPartialEntity<Entity>[])): Promise<InsertResult> {\n return this.createQueryBuilder()\n .insert()\n .into(target)\n .values(entity)\n .execute();\n }\n\n async upsert<Entity>(\n target: EntityTarget<Entity>,\n entityOrEntities: QueryDeepPartialEntity<Entity> | (QueryDeepPartialEntity<Entity>[]),\n conflictPathsOrOptions: string[] | UpsertOptions<Entity>): Promise<InsertResult> {\n const metadata = this.connection.getMetadata(target);\n\n let options: UpsertOptions<Entity>;\n\n if (Array.isArray(conflictPathsOrOptions)) {\n options = {\n conflictPaths: conflictPathsOrOptions\n };\n } else {\n options = conflictPathsOrOptions;\n }\n\n const uniqueColumnConstraints = [\n metadata.primaryColumns,\n ...metadata.indices.filter(ix => ix.isUnique).map(ix => ix.columns),\n ...metadata.uniques.map(uq => uq.columns)\n ];\n\n const useIndex = uniqueColumnConstraints.find((ix) =>\n ix.length === options.conflictPaths.length &&\n options.conflictPaths.every((conflictPropertyPath) => ix.some((col) => col.propertyPath === conflictPropertyPath))\n );\n\n if (useIndex == null) {\n throw new TypeORMError(`An upsert requires conditions that have a unique constraint but none was found for conflict properties: ${options.conflictPaths.join(\", \")}`);\n }\n\n let entities: QueryDeepPartialEntity<Entity>[];\n\n if (!Array.isArray(entityOrEntities)) {\n entities = [entityOrEntities];\n } else {\n entities = entityOrEntities;\n }\n\n const conflictColumns = metadata.mapPropertyPathsToColumns(options.conflictPaths);\n\n const overwriteColumns = metadata.columns\n .filter((col) => (!conflictColumns.includes(col)) && entities.some(entity => typeof col.getEntityValue(entity) !== \"undefined\"));\n\n return this.createQueryBuilder()\n .insert()\n .into(target)\n .values(entities)\n .orUpdate(\n [...conflictColumns, ...overwriteColumns].map((col) => col.databaseName),\n conflictColumns.map((col) => col.databaseName)\n )\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: EntityTarget<Entity>, 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 (Array.isArray(criteria) && criteria.length === 0)) {\n\n return Promise.reject(new TypeORMError(`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 Array.isArray(criteria)) {\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: EntityTarget<Entity>, 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 (Array.isArray(criteria) && criteria.length === 0)) {\n\n return Promise.reject(new TypeORMError(`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 Array.isArray(criteria)) {\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 * Records the delete date of 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 softDelete<Entity>(targetOrEntity: EntityTarget<Entity>, criteria: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|any): 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 (Array.isArray(criteria) && criteria.length === 0)) {\n\n return Promise.reject(new TypeORMError(`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 Array.isArray(criteria)) {\n\n return this.createQueryBuilder()\n .softDelete()\n .from(targetOrEntity)\n .whereInIds(criteria)\n .execute();\n\n } else {\n return this.createQueryBuilder()\n .softDelete()\n .from(targetOrEntity)\n .where(criteria)\n .execute();\n }\n }\n\n /**\n * Restores 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 restore<Entity>(targetOrEntity: EntityTarget<Entity>, criteria: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|any): 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 (Array.isArray(criteria) && criteria.length === 0)) {\n\n return Promise.reject(new TypeORMError(`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 Array.isArray(criteria)) {\n\n return this.createQueryBuilder()\n .restore()\n .from(targetOrEntity)\n .whereInIds(criteria)\n .execute();\n\n } else {\n return this.createQueryBuilder()\n .restore()\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: EntityTarget<Entity>, options?: FindOneOptions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given options.\n * Useful for pagination.\n */\n count<Entity>(entityClass: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<number>;\n\n /**\n * Counts entities that match given conditions.\n * Useful for pagination.\n */\n count<Entity>(entityClass: EntityTarget<Entity>, 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: EntityTarget<Entity>, optionsOrConditions?: FindConditions<Entity>|FindOneOptions<Entity>|FindManyOptions<Entity>): Promise<number> {\n const metadata = this.connection.getMetadata(entityClass);\n const qb = this.createQueryBuilder(entityClass, 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: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given conditions.\n */\n find<Entity>(entityClass: EntityTarget<Entity>, conditions?: FindConditions<Entity>): Promise<Entity[]>;\n\n /**\n * Finds entities that match given find options or conditions.\n */\n async find<Entity>(entityClass: EntityTarget<Entity>, optionsOrConditions?: FindManyOptions<Entity>|FindConditions<Entity>): Promise<Entity[]> {\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.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: EntityTarget<Entity>, 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: EntityTarget<Entity>, 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: EntityTarget<Entity>, optionsOrConditions?: FindConditions<Entity>|FindManyOptions<Entity>): 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 FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, optionsOrConditions);\n\n if (!FindOptionsUtils.isFindManyOptions(optionsOrConditions) || optionsOrConditions.loadEagerRelations !== false)\n FindOptionsUtils.joinEagerRelations(qb, qb.alias, metadata);\n\n return qb.getManyAndCount();\n }\n\n /**\n * Finds entities with ids.\n * Optionally find options can be applied.\n */\n findByIds<Entity>(entityClass: EntityTarget<Entity>, 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: EntityTarget<Entity>, 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: EntityTarget<Entity>, ids: any[], optionsOrConditions?: FindConditions<Entity>|FindManyOptions<Entity>): 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: EntityTarget<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: EntityTarget<Entity>, options?: FindOneOptions<Entity>): Promise<Entity|undefined>;\n\n /**\n * Finds first entity that matches given conditions.\n */\n findOne<Entity>(entityClass: EntityTarget<Entity>, 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: EntityTarget<Entity>, idOrOptionsOrConditions?: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|FindOneOptions<Entity>|FindConditions<Entity>, 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 const passedId = typeof idOrOptionsOrConditions === \"string\" || typeof idOrOptionsOrConditions === \"number\" || (idOrOptionsOrConditions as any) instanceof Date;\n\n if (!passedId) {\n findOptions = {\n ...(findOptions || {}),\n take: 1,\n };\n }\n\n FindOptionsUtils.applyOptionsToQueryBuilder(qb, findOptions);\n\n if (!findOptions || findOptions.loadEagerRelations !== false) {\n FindOptionsUtils.joinEagerRelations(qb, qb.alias, qb.expressionMap.mainAlias!.metadata);\n }\n\n if (options) {\n qb.where(options);\n\n } else if (passedId) {\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: EntityTarget<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: EntityTarget<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: EntityTarget<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 async findOneOrFail<Entity>(entityClass: EntityTarget<Entity>, idOrOptionsOrConditions?: string|string[]|number|number[]|Date|Date[]|ObjectID|ObjectID[]|FindOneOptions<Entity>|FindConditions<Entity>, 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: EntityTarget<Entity>): Promise<void> {\n const metadata = this.connection.getMetadata(entityClass);\n const queryRunner = this.queryRunner || this.connection.createQueryRunner();\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: EntityTarget<Entity>,\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 TypeORMError(`Column ${propertyPath} was not found in ${metadata.targetName} entity.`);\n\n if (isNaN(Number(value)))\n throw new TypeORMError(`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: EntityTarget<Entity>,\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 TypeORMError(`Column ${propertyPath} was not found in ${metadata.targetName} entity.`);\n\n if (isNaN(Number(value)))\n throw new TypeORMError(`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: EntityTarget<Entity>): 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: EntityTarget<Entity>): 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: EntityTarget<Entity>): 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":".."}
@@ -12,7 +12,7 @@ import { DeleteResult } from "./result/DeleteResult";
12
12
  export declare class DeleteQueryBuilder<Entity> extends QueryBuilder<Entity> implements WhereExpressionBuilder {
13
13
  constructor(connectionOrQueryBuilder: Connection | QueryBuilder<any>, queryRunner?: QueryRunner);
14
14
  /**
15
- * Gets generated sql query without parameters being replaced.
15
+ * Gets generated SQL query without parameters being replaced.
16
16
  */
17
17
  getQuery(): string;
18
18
  /**
@@ -23,7 +23,7 @@ var DeleteQueryBuilder = /** @class */ (function (_super) {
23
23
  // Public Implemented Methods
24
24
  // -------------------------------------------------------------------------
25
25
  /**
26
- * Gets generated sql query without parameters being replaced.
26
+ * Gets generated SQL query without parameters being replaced.
27
27
  */
28
28
  DeleteQueryBuilder.prototype.getQuery = function () {
29
29
  var sql = this.createComment();