typeorm 0.2.43-dev.a5493fb → 0.2.44-dev.5a71803
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/driver/Driver.d.ts +2 -1
- package/browser/driver/Driver.js.map +1 -1
- package/browser/driver/expo/ExpoQueryRunner.js +69 -45
- package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/browser/driver/mysql/MysqlDriver.d.ts +6 -2
- package/browser/driver/mysql/MysqlDriver.js +42 -6
- package/browser/driver/mysql/MysqlDriver.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.js +12 -0
- package/browser/driver/sap/SapQueryRunner.js.map +1 -1
- package/browser/entity-manager/EntityManager.js +3 -1
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
- package/browser/entity-schema/EntitySchemaEmbeddedColumnOptions.d.ts +18 -0
- package/browser/entity-schema/EntitySchemaEmbeddedColumnOptions.js +8 -0
- package/browser/entity-schema/EntitySchemaEmbeddedColumnOptions.js.map +1 -0
- package/browser/entity-schema/EntitySchemaEmbeddedError.d.ts +6 -0
- package/browser/entity-schema/EntitySchemaEmbeddedError.js +18 -0
- package/browser/entity-schema/EntitySchemaEmbeddedError.js.map +1 -0
- package/browser/entity-schema/EntitySchemaOptions.d.ts +7 -1
- package/browser/entity-schema/EntitySchemaOptions.js.map +1 -1
- package/browser/entity-schema/EntitySchemaTransformer.d.ts +1 -0
- package/browser/entity-schema/EntitySchemaTransformer.js +217 -191
- package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/browser/error/ReturningStatementNotSupportedError.js +1 -1
- package/browser/error/ReturningStatementNotSupportedError.js.map +1 -1
- package/browser/index.d.ts +1 -0
- package/browser/index.js +1 -0
- package/browser/index.js.map +1 -1
- package/browser/metadata/EmbeddedMetadata.d.ts +1 -1
- package/browser/metadata/EmbeddedMetadata.js +3 -0
- package/browser/metadata/EmbeddedMetadata.js.map +1 -1
- package/browser/metadata-args/EmbeddedMetadataArgs.d.ts +2 -2
- package/browser/metadata-args/EmbeddedMetadataArgs.js.map +1 -1
- package/browser/metadata-builder/EntityMetadataBuilder.js +3 -1
- package/browser/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/browser/persistence/SubjectExecutor.d.ts +0 -2
- package/browser/persistence/SubjectExecutor.js +9 -100
- package/browser/persistence/SubjectExecutor.js.map +1 -1
- package/browser/query-builder/DeleteQueryBuilder.js +7 -10
- package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/InsertOrUpdateOptions.d.ts +3 -0
- package/browser/query-builder/InsertOrUpdateOptions.js +3 -0
- package/browser/query-builder/InsertOrUpdateOptions.js.map +1 -0
- package/browser/query-builder/InsertQueryBuilder.d.ts +2 -1
- package/browser/query-builder/InsertQueryBuilder.js +19 -5
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/query-builder/QueryBuilder.d.ts +2 -1
- package/browser/query-builder/QueryBuilder.js +2 -2
- package/browser/query-builder/QueryBuilder.js.map +1 -1
- package/browser/query-builder/QueryExpressionMap.d.ts +1 -0
- package/browser/query-builder/QueryExpressionMap.js.map +1 -1
- package/browser/query-builder/RelationLoader.js +1 -1
- package/browser/query-builder/RelationLoader.js.map +1 -1
- package/browser/query-builder/ReturningResultsEntityUpdator.js +4 -3
- package/browser/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
- package/browser/query-builder/SoftDeleteQueryBuilder.js +7 -12
- package/browser/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/UpdateQueryBuilder.js +7 -11
- package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/browser/repository/UpsertOptions.d.ts +4 -0
- package/browser/repository/UpsertOptions.js.map +1 -1
- package/browser/util/ImportUtils.js +2 -1
- package/browser/util/ImportUtils.js.map +1 -1
- package/driver/Driver.d.ts +2 -1
- package/driver/Driver.js.map +1 -1
- package/driver/expo/ExpoQueryRunner.js +69 -45
- package/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/driver/mysql/MysqlDriver.d.ts +6 -2
- package/driver/mysql/MysqlDriver.js +42 -6
- package/driver/mysql/MysqlDriver.js.map +1 -1
- package/driver/sap/SapQueryRunner.js +12 -0
- package/driver/sap/SapQueryRunner.js.map +1 -1
- package/entity-manager/EntityManager.js +3 -1
- package/entity-manager/EntityManager.js.map +1 -1
- package/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
- package/entity-schema/EntitySchemaEmbeddedColumnOptions.d.ts +18 -0
- package/entity-schema/EntitySchemaEmbeddedColumnOptions.js +11 -0
- package/entity-schema/EntitySchemaEmbeddedColumnOptions.js.map +1 -0
- package/entity-schema/EntitySchemaEmbeddedError.d.ts +6 -0
- package/entity-schema/EntitySchemaEmbeddedError.js +21 -0
- package/entity-schema/EntitySchemaEmbeddedError.js.map +1 -0
- package/entity-schema/EntitySchemaOptions.d.ts +7 -1
- package/entity-schema/EntitySchemaOptions.js.map +1 -1
- package/entity-schema/EntitySchemaTransformer.d.ts +1 -0
- package/entity-schema/EntitySchemaTransformer.js +217 -191
- package/entity-schema/EntitySchemaTransformer.js.map +1 -1
- package/error/ReturningStatementNotSupportedError.js +1 -1
- package/error/ReturningStatementNotSupportedError.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +2 -0
- package/metadata/EmbeddedMetadata.d.ts +1 -1
- package/metadata/EmbeddedMetadata.js +3 -0
- package/metadata/EmbeddedMetadata.js.map +1 -1
- package/metadata-args/EmbeddedMetadataArgs.d.ts +2 -2
- package/metadata-args/EmbeddedMetadataArgs.js.map +1 -1
- package/metadata-builder/EntityMetadataBuilder.js +3 -1
- package/metadata-builder/EntityMetadataBuilder.js.map +1 -1
- package/package.json +1 -1
- package/persistence/SubjectExecutor.d.ts +0 -2
- package/persistence/SubjectExecutor.js +9 -100
- package/persistence/SubjectExecutor.js.map +1 -1
- package/query-builder/DeleteQueryBuilder.js +7 -10
- package/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/query-builder/InsertOrUpdateOptions.d.ts +3 -0
- package/query-builder/InsertOrUpdateOptions.js +4 -0
- package/query-builder/InsertOrUpdateOptions.js.map +1 -0
- package/query-builder/InsertQueryBuilder.d.ts +2 -1
- package/query-builder/InsertQueryBuilder.js +19 -5
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/query-builder/QueryBuilder.d.ts +2 -1
- package/query-builder/QueryBuilder.js +2 -2
- package/query-builder/QueryBuilder.js.map +1 -1
- package/query-builder/QueryExpressionMap.d.ts +1 -0
- package/query-builder/QueryExpressionMap.js.map +1 -1
- package/query-builder/RelationLoader.js +5 -5
- package/query-builder/RelationLoader.js.map +1 -1
- package/query-builder/ReturningResultsEntityUpdator.js +4 -3
- package/query-builder/ReturningResultsEntityUpdator.js.map +1 -1
- package/query-builder/SoftDeleteQueryBuilder.js +7 -12
- package/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/query-builder/UpdateQueryBuilder.js +7 -11
- package/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/repository/UpsertOptions.d.ts +4 -0
- package/repository/UpsertOptions.js.map +1 -1
- package/util/ImportUtils.js +2 -1
- package/util/ImportUtils.js.map +1 -1
|
@@ -318,7 +318,9 @@ var EntityManager = /** @class */ (function () {
|
|
|
318
318
|
.insert()
|
|
319
319
|
.into(target)
|
|
320
320
|
.values(entities)
|
|
321
|
-
.orUpdate(__spreadArray(__spreadArray([], __read(conflictColumns), false), __read(overwriteColumns), false).map(function (col) { return col.databaseName; }), conflictColumns.map(function (col) { return col.databaseName; })
|
|
321
|
+
.orUpdate(__spreadArray(__spreadArray([], __read(conflictColumns), false), __read(overwriteColumns), false).map(function (col) { return col.databaseName; }), conflictColumns.map(function (col) { return col.databaseName; }), {
|
|
322
|
+
skipUpdateIfNoValuesChanged: options.skipUpdateIfNoValuesChanged
|
|
323
|
+
})
|
|
322
324
|
.execute()];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AAS,CAAC;gBAC5C,wBAAgC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;SAC3D;QACD,IAAI,wBAAwB,YAAY,UAAU,EAAE;YAChD,IAAI,CAAC,cAAc;gBACf,MAAM,IAAI,4CAA4C,CAAC,gBAAgB,CAAC,CAAC;YAE5E,wBAAgC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;YACnD,wBAAgC,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC;SAClE;QAED,OAAO,wBAAwB,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACG,+BAAO,GAAb;;;gBACI,IAAI,CAAC,IAAI,CAAC,WAAW;oBACjB,MAAM,IAAI,iCAAiC,EAAE,CAAC;gBAElD,sBAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAC;;;KACrC;IACL,oBAAC;AAAD,CA/+BA,AA++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 as DeepPartial<Entity>[]).map(plainEntityLike => this.create(entityClass, 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 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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AAC;SAC3D;QACD,IAAI,wBAAwB,YAAY,UAAU,EAAE;YAChD,IAAI,CAAC,cAAc;gBACf,MAAM,IAAI,4CAA4C,CAAC,gBAAgB,CAAC,CAAC;YAE5E,wBAAgC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;YACnD,wBAAgC,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC;SAClE;QAED,OAAO,wBAAwB,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACG,+BAAO,GAAb;;;gBACI,IAAI,CAAC,IAAI,CAAC,WAAW;oBACjB,MAAM,IAAI,iCAAiC,EAAE,CAAC;gBAElD,sBAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAC;;;KACrC;IACL,oBAAC;AAAD,CAl/BA,AAk/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 as DeepPartial<Entity>[]).map(plainEntityLike => this.create(entityClass, 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 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 skipUpdateIfNoValuesChanged: options.skipUpdateIfNoValuesChanged\n }\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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/entity-schema/EntitySchemaColumnOptions.ts"],"names":[],"mappings":"","file":"EntitySchemaColumnOptions.js","sourcesContent":["import {ColumnType} from \"../driver/types/ColumnTypes\";\nimport {ValueTransformer} from \"../decorator/options/ValueTransformer\";\nimport {SpatialColumnOptions} from \"../decorator/options/SpatialColumnOptions\";\n\nexport interface EntitySchemaColumnOptions extends SpatialColumnOptions {\n\n /**\n * Indicates if this column is a primary column.\n */\n primary?: boolean;\n\n /**\n * Indicates if this column is of type ObjectID\n */\n objectId?: boolean;\n\n /**\n * Indicates if this column is a created date column.\n */\n createDate?: boolean;\n\n /**\n * Indicates if this column is an update date column.\n */\n updateDate?: boolean;\n\n /**\n * Indicates if this column is a delete date column.\n */\n deleteDate?: boolean;\n\n /**\n * Indicates if this column is a version column.\n */\n version?: boolean;\n\n /**\n * Indicates if this column is a treeChildrenCount column.\n */\n treeChildrenCount?: boolean;\n\n /**\n * Indicates if this column is a treeLevel column.\n */\n treeLevel?: boolean;\n\n /**\n * Column type. Must be one of the value from the ColumnTypes class.\n */\n type: ColumnType;\n\n /**\n * Column name in the database.\n */\n name?: string;\n\n /**\n * Column type's length. For example type = \"string\" and length = 100 means that ORM will create a column with\n * type varchar(100).\n */\n length?: string | number;\n\n /**\n * Column type's display width. Used only on some column types in MySQL.\n * For example, INT(4) specifies an INT with a display width of four digits.\n */\n width?: number;\n\n /**\n * Indicates if column's value can be set to NULL.\n */\n nullable?: boolean;\n\n /**\n * Indicates if column value is not updated by \"save\" operation.\n * It means you'll be able to write this value only when you first time insert the object.\n * Default value is \"false\".\n *\n * @deprecated Please use the `update` option instead. Careful, it takes\n * the opposite value to readonly.\n *\n */\n readonly?: boolean;\n\n /**\n * Indicates if column value is updated by \"save\" operation.\n * If false you'll be able to write this value only when you first time insert the object.\n * Default value is \"true\".\n */\n update?: boolean;\n\n /**\n * Indicates if column is always selected by QueryBuilder and find operations.\n * Default value is \"true\".\n */\n select?: boolean;\n\n /**\n * Indicates if column is inserted by default.\n * Default value is \"true\".\n */\n insert?: boolean;\n\n /**\n * Specifies if this column will use AUTO_INCREMENT or not (e.g. generated number).\n */\n generated?: true|\"increment\"|\"uuid\"|\"rowid\";\n\n /**\n * Specifies if column's value must be unique or not.\n */\n unique?: boolean;\n\n /**\n * Extra column definition. Should be used only in emergency situations. Note that if you'll use this property\n * auto schema generation will not work properly anymore. Avoid using it.\n */\n columnDefinition?: string;\n\n /**\n * Column comment.\n */\n comment?: string;\n\n /**\n * Default database value.\n */\n default?: any;\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string;\n\n /**\n * The precision for a decimal (exact numeric) column (applies only for decimal column), which is the maximum\n * number of digits that are stored for the values.\n */\n precision?: number;\n\n /**\n * The scale for a decimal (exact numeric) column (applies only for decimal column), which represents the number\n * of digits to the right of the decimal point and must not be greater than precision.\n */\n scale?: number;\n\n /**\n * Puts ZEROFILL attribute on to numeric column. Works only for MySQL.\n * If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n */\n zerofill?: boolean;\n\n /**\n * Puts UNSIGNED attribute on to numeric column. Works only for MySQL.\n */\n unsigned?: boolean;\n\n /**\n * Defines a column character set.\n * Not supported by all database types.\n */\n charset?: string;\n\n /**\n * Defines a column collation.\n */\n collation?: string;\n\n /**\n * Array of possible enumerated values.\n */\n enum?: any[]|Object;\n\n /**\n * Generated column expression. Supports only in MySQL.\n */\n asExpression?: string;\n\n /**\n * Generated column type. Supports only in MySQL.\n */\n generatedType?: \"VIRTUAL\"|\"STORED\";\n\n /**\n * Return type of HSTORE column.\n * Returns value as string or as object.\n */\n hstoreType?: \"object\"|\"string\";\n\n /**\n * Indicates if this column is an array.\n * Can be simply set to true or array length can be specified.\n * Supported only by postgres.\n */\n array?: boolean;\n\n /**\n * Specifies a value transformer that is to be used to (un)marshal\n * this column when reading or writing to the database.\n */\n transformer?: ValueTransformer|ValueTransformer[];\n
|
|
1
|
+
{"version":3,"sources":["../browser/src/entity-schema/EntitySchemaColumnOptions.ts"],"names":[],"mappings":"","file":"EntitySchemaColumnOptions.js","sourcesContent":["import {ColumnType} from \"../driver/types/ColumnTypes\";\nimport {ValueTransformer} from \"../decorator/options/ValueTransformer\";\nimport {SpatialColumnOptions} from \"../decorator/options/SpatialColumnOptions\";\n\nexport interface EntitySchemaColumnOptions extends SpatialColumnOptions {\n\n /**\n * Indicates if this column is a primary column.\n */\n primary?: boolean;\n\n /**\n * Indicates if this column is of type ObjectID\n */\n objectId?: boolean;\n\n /**\n * Indicates if this column is a created date column.\n */\n createDate?: boolean;\n\n /**\n * Indicates if this column is an update date column.\n */\n updateDate?: boolean;\n\n /**\n * Indicates if this column is a delete date column.\n */\n deleteDate?: boolean;\n\n /**\n * Indicates if this column is a version column.\n */\n version?: boolean;\n\n /**\n * Indicates if this column is a treeChildrenCount column.\n */\n treeChildrenCount?: boolean;\n\n /**\n * Indicates if this column is a treeLevel column.\n */\n treeLevel?: boolean;\n\n /**\n * Column type. Must be one of the value from the ColumnTypes class.\n */\n type: ColumnType;\n\n /**\n * Column name in the database.\n */\n name?: string;\n\n /**\n * Column type's length. For example type = \"string\" and length = 100 means that ORM will create a column with\n * type varchar(100).\n */\n length?: string | number;\n\n /**\n * Column type's display width. Used only on some column types in MySQL.\n * For example, INT(4) specifies an INT with a display width of four digits.\n */\n width?: number;\n\n /**\n * Indicates if column's value can be set to NULL.\n */\n nullable?: boolean;\n\n /**\n * Indicates if column value is not updated by \"save\" operation.\n * It means you'll be able to write this value only when you first time insert the object.\n * Default value is \"false\".\n *\n * @deprecated Please use the `update` option instead. Careful, it takes\n * the opposite value to readonly.\n *\n */\n readonly?: boolean;\n\n /**\n * Indicates if column value is updated by \"save\" operation.\n * If false you'll be able to write this value only when you first time insert the object.\n * Default value is \"true\".\n */\n update?: boolean;\n\n /**\n * Indicates if column is always selected by QueryBuilder and find operations.\n * Default value is \"true\".\n */\n select?: boolean;\n\n /**\n * Indicates if column is inserted by default.\n * Default value is \"true\".\n */\n insert?: boolean;\n\n /**\n * Specifies if this column will use AUTO_INCREMENT or not (e.g. generated number).\n */\n generated?: true|\"increment\"|\"uuid\"|\"rowid\";\n\n /**\n * Specifies if column's value must be unique or not.\n */\n unique?: boolean;\n\n /**\n * Extra column definition. Should be used only in emergency situations. Note that if you'll use this property\n * auto schema generation will not work properly anymore. Avoid using it.\n */\n columnDefinition?: string;\n\n /**\n * Column comment.\n */\n comment?: string;\n\n /**\n * Default database value.\n */\n default?: any;\n\n /**\n * ON UPDATE trigger. Works only for MySQL.\n */\n onUpdate?: string;\n\n /**\n * The precision for a decimal (exact numeric) column (applies only for decimal column), which is the maximum\n * number of digits that are stored for the values.\n */\n precision?: number;\n\n /**\n * The scale for a decimal (exact numeric) column (applies only for decimal column), which represents the number\n * of digits to the right of the decimal point and must not be greater than precision.\n */\n scale?: number;\n\n /**\n * Puts ZEROFILL attribute on to numeric column. Works only for MySQL.\n * If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n */\n zerofill?: boolean;\n\n /**\n * Puts UNSIGNED attribute on to numeric column. Works only for MySQL.\n */\n unsigned?: boolean;\n\n /**\n * Defines a column character set.\n * Not supported by all database types.\n */\n charset?: string;\n\n /**\n * Defines a column collation.\n */\n collation?: string;\n\n /**\n * Array of possible enumerated values.\n */\n enum?: any[]|Object;\n\n /**\n * Generated column expression. Supports only in MySQL.\n */\n asExpression?: string;\n\n /**\n * Generated column type. Supports only in MySQL.\n */\n generatedType?: \"VIRTUAL\"|\"STORED\";\n\n /**\n * Return type of HSTORE column.\n * Returns value as string or as object.\n */\n hstoreType?: \"object\"|\"string\";\n\n /**\n * Indicates if this column is an array.\n * Can be simply set to true or array length can be specified.\n * Supported only by postgres.\n */\n array?: boolean;\n\n /**\n * Specifies a value transformer that is to be used to (un)marshal\n * this column when reading or writing to the database.\n */\n transformer?: ValueTransformer|ValueTransformer[];\n}\n"],"sourceRoot":".."}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EntitySchema } from "./EntitySchema";
|
|
2
|
+
export declare class EntitySchemaEmbeddedColumnOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Schema of embedded entity
|
|
5
|
+
*/
|
|
6
|
+
schema: EntitySchema;
|
|
7
|
+
/**
|
|
8
|
+
* Embedded column prefix.
|
|
9
|
+
* If set to empty string or false, then prefix is not set at all.
|
|
10
|
+
*/
|
|
11
|
+
prefix?: string | boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Indicates if this embedded is in array mode.
|
|
14
|
+
*
|
|
15
|
+
* This option works only in mongodb.
|
|
16
|
+
*/
|
|
17
|
+
array?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var EntitySchemaEmbeddedColumnOptions = /** @class */ (function () {
|
|
2
|
+
function EntitySchemaEmbeddedColumnOptions() {
|
|
3
|
+
}
|
|
4
|
+
return EntitySchemaEmbeddedColumnOptions;
|
|
5
|
+
}());
|
|
6
|
+
export { EntitySchemaEmbeddedColumnOptions };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=EntitySchemaEmbeddedColumnOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../browser/src/entity-schema/EntitySchemaEmbeddedColumnOptions.ts"],"names":[],"mappings":"AAEA;IAAA;IAkBA,CAAC;IAAD,wCAAC;AAAD,CAlBA,AAkBC,IAAA","file":"EntitySchemaEmbeddedColumnOptions.js","sourcesContent":["import { EntitySchema } from \"./EntitySchema\";\n\nexport class EntitySchemaEmbeddedColumnOptions {\n /**\n * Schema of embedded entity\n */\n schema: EntitySchema;\n\n /**\n * Embedded column prefix.\n * If set to empty string or false, then prefix is not set at all.\n */\n prefix?: string | boolean;\n\n /**\n * Indicates if this embedded is in array mode.\n *\n * This option works only in mongodb.\n */\n array?: boolean;\n}\n"],"sourceRoot":".."}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TypeORMError } from "../error";
|
|
2
|
+
export declare class EntitySchemaEmbeddedError extends TypeORMError {
|
|
3
|
+
static createEntitySchemaIsRequiredException(field: string): EntitySchemaEmbeddedError;
|
|
4
|
+
static createTargetIsRequired(field: string): EntitySchemaEmbeddedError;
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import { TypeORMError } from "../error";
|
|
3
|
+
var EntitySchemaEmbeddedError = /** @class */ (function (_super) {
|
|
4
|
+
__extends(EntitySchemaEmbeddedError, _super);
|
|
5
|
+
function EntitySchemaEmbeddedError(message) {
|
|
6
|
+
return _super.call(this, message) || this;
|
|
7
|
+
}
|
|
8
|
+
EntitySchemaEmbeddedError.createEntitySchemaIsRequiredException = function (field) {
|
|
9
|
+
return new EntitySchemaEmbeddedError("EntitySchema is required for " + field + " embedded field");
|
|
10
|
+
};
|
|
11
|
+
EntitySchemaEmbeddedError.createTargetIsRequired = function (field) {
|
|
12
|
+
return new EntitySchemaEmbeddedError("Target field is required for " + field + " embedded EntitySchema");
|
|
13
|
+
};
|
|
14
|
+
return EntitySchemaEmbeddedError;
|
|
15
|
+
}(TypeORMError));
|
|
16
|
+
export { EntitySchemaEmbeddedError };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=EntitySchemaEmbeddedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../browser/src/entity-schema/EntitySchemaEmbeddedError.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;IAA+C,6CAAY;IASvD,mCAAY,OAAe;eACvB,kBAAM,OAAO,CAAC;IAClB,CAAC;IAVM,+DAAqC,GAA5C,UAA6C,KAAa;QACtD,OAAO,IAAI,yBAAyB,CAAC,kCAAgC,KAAK,oBAAiB,CAAC,CAAC;IACjG,CAAC;IAEM,gDAAsB,GAA7B,UAA8B,KAAa;QACvC,OAAO,IAAI,yBAAyB,CAAC,kCAAgC,KAAK,2BAAwB,CAAC,CAAC;IACxG,CAAC;IAKL,gCAAC;AAAD,CAZA,AAYC,CAZ8C,YAAY,GAY1D","file":"EntitySchemaEmbeddedError.js","sourcesContent":["import { TypeORMError } from \"../error\";\n\nexport class EntitySchemaEmbeddedError extends TypeORMError {\n static createEntitySchemaIsRequiredException(field: string): EntitySchemaEmbeddedError {\n return new EntitySchemaEmbeddedError(`EntitySchema is required for ${field} embedded field`);\n }\n\n static createTargetIsRequired(field: string): EntitySchemaEmbeddedError {\n return new EntitySchemaEmbeddedError(`Target field is required for ${field} embedded EntitySchema`);\n }\n\n constructor(message: string) {\n super(message);\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection, SelectQueryBuilder } from "..";
|
|
1
|
+
import { Connection, EntitySchemaEmbeddedColumnOptions, SelectQueryBuilder } from "..";
|
|
2
2
|
import { EntitySchemaIndexOptions } from "./EntitySchemaIndexOptions";
|
|
3
3
|
import { EntitySchemaColumnOptions } from "./EntitySchemaColumnOptions";
|
|
4
4
|
import { EntitySchemaRelationOptions } from "./EntitySchemaRelationOptions";
|
|
@@ -71,6 +71,12 @@ export declare class EntitySchemaOptions<T> {
|
|
|
71
71
|
* Entity exclusion options.
|
|
72
72
|
*/
|
|
73
73
|
exclusions?: EntitySchemaExclusionOptions[];
|
|
74
|
+
/**
|
|
75
|
+
* Embedded Entities options
|
|
76
|
+
*/
|
|
77
|
+
embeddeds?: {
|
|
78
|
+
[P in keyof Partial<T>]: EntitySchemaEmbeddedColumnOptions;
|
|
79
|
+
};
|
|
74
80
|
/**
|
|
75
81
|
* Indicates if schema synchronization is enabled or disabled for this entity.
|
|
76
82
|
* If it will be set to false then schema sync will and migrations ignore this entity.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/entity-schema/EntitySchemaOptions.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH;IAAA;
|
|
1
|
+
{"version":3,"sources":["../browser/src/entity-schema/EntitySchemaOptions.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH;IAAA;IAsGA,CAAC;IAAD,0BAAC;AAAD,CAtGA,AAsGC,IAAA","file":"EntitySchemaOptions.js","sourcesContent":["import {Connection, EntitySchemaEmbeddedColumnOptions, SelectQueryBuilder} from \"..\";\nimport {EntitySchemaIndexOptions} from \"./EntitySchemaIndexOptions\";\nimport {EntitySchemaColumnOptions} from \"./EntitySchemaColumnOptions\";\nimport {EntitySchemaRelationOptions} from \"./EntitySchemaRelationOptions\";\nimport {OrderByCondition} from \"../find-options/OrderByCondition\";\nimport {TableType} from \"../metadata/types/TableTypes\";\nimport {EntitySchemaUniqueOptions} from \"./EntitySchemaUniqueOptions\";\nimport {EntitySchemaCheckOptions} from \"./EntitySchemaCheckOptions\";\nimport {EntitySchemaExclusionOptions} from \"./EntitySchemaExclusionOptions\";\n\n/**\n * Interface for entity metadata mappings stored inside \"schemas\" instead of models decorated by decorators.\n */\nexport class EntitySchemaOptions<T> {\n\n /**\n * Name of the schema it extends.\n */\n extends?: string;\n\n /**\n * Target bind to this entity schema. Optional.\n */\n target?: Function;\n\n /**\n * Entity name.\n */\n name: string;\n\n /**\n * Table name.\n */\n tableName?: string;\n\n /**\n * Database name. Used in MySql and Sql Server.\n */\n database?: string;\n\n /**\n * Schema name. Used in Postgres and Sql Server.\n */\n schema?: string;\n\n /**\n * Table type.\n */\n type?: TableType;\n\n /**\n * Specifies a property name by which queries will perform ordering by default when fetching rows.\n */\n orderBy?: OrderByCondition;\n\n /**\n * Entity column's options.\n */\n columns: {\n [P in keyof T]?: EntitySchemaColumnOptions;\n };\n\n /**\n * Entity relation's options.\n */\n relations?: {\n [P in keyof T]?: EntitySchemaRelationOptions;\n };\n\n /**\n * Entity indices options.\n */\n indices?: EntitySchemaIndexOptions[];\n\n /**\n * Entity uniques options.\n */\n uniques?: EntitySchemaUniqueOptions[];\n\n /**\n * Entity check options.\n */\n checks?: EntitySchemaCheckOptions[];\n\n /**\n * Entity exclusion options.\n */\n exclusions?: EntitySchemaExclusionOptions[];\n\n /**\n * Embedded Entities options\n */\n embeddeds?: {\n [P in keyof Partial<T>]: EntitySchemaEmbeddedColumnOptions;\n };\n\n /**\n * Indicates if schema synchronization is enabled or disabled for this entity.\n * If it will be set to false then schema sync will and migrations ignore this entity.\n * By default schema synchronization is enabled for all entities.\n */\n synchronize?: boolean;\n\n /**\n * If set to 'true' this option disables Sqlite's default behaviour of secretly creating\n * an integer primary key column named 'rowid' on table creation.\n * @see https://www.sqlite.org/withoutrowid.html.\n */\n withoutRowid?: boolean;\n\n /**\n * View expression.\n */\n expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n}\n"],"sourceRoot":".."}
|