typeorm 0.3.10-dev.e3aac27 → 0.3.10-dev.f24b262

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/browser/data-source/DataSource.d.ts +1 -1
  2. package/browser/data-source/DataSource.js.map +1 -1
  3. package/browser/driver/mongodb/typings.d.ts +2 -0
  4. package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +2 -0
  5. package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
  6. package/browser/entity-manager/EntityManager.d.ts +20 -20
  7. package/browser/entity-manager/EntityManager.js.map +1 -1
  8. package/browser/entity-schema/EntitySchemaColumnOptions.d.ts +4 -0
  9. package/browser/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
  10. package/browser/entity-schema/EntitySchemaTransformer.js +1 -0
  11. package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
  12. package/browser/find-options/FindOptionsUtils.d.ts +2 -1
  13. package/browser/find-options/FindOptionsUtils.js.map +1 -1
  14. package/browser/query-builder/DeleteQueryBuilder.d.ts +2 -2
  15. package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
  16. package/browser/query-builder/InsertQueryBuilder.d.ts +2 -2
  17. package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
  18. package/browser/query-builder/QueryBuilder.d.ts +3 -3
  19. package/browser/query-builder/QueryBuilder.js.map +1 -1
  20. package/browser/query-builder/QueryPartialEntity.d.ts +5 -2
  21. package/browser/query-builder/QueryPartialEntity.js.map +1 -1
  22. package/browser/query-builder/RelationIdLoader.js +15 -14
  23. package/browser/query-builder/RelationIdLoader.js.map +1 -1
  24. package/browser/query-builder/RelationQueryBuilder.d.ts +2 -1
  25. package/browser/query-builder/RelationQueryBuilder.js.map +1 -1
  26. package/browser/query-builder/SelectQueryBuilder.d.ts +5 -5
  27. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  28. package/browser/repository/BaseEntity.js.map +1 -1
  29. package/commands/InitCommand.js +5 -5
  30. package/commands/InitCommand.js.map +1 -1
  31. package/data-source/DataSource.d.ts +1 -1
  32. package/data-source/DataSource.js.map +1 -1
  33. package/driver/mongodb/typings.d.ts +2 -0
  34. package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +2 -0
  35. package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
  36. package/entity-manager/EntityManager.d.ts +20 -20
  37. package/entity-manager/EntityManager.js.map +1 -1
  38. package/entity-schema/EntitySchemaColumnOptions.d.ts +4 -0
  39. package/entity-schema/EntitySchemaColumnOptions.js.map +1 -1
  40. package/entity-schema/EntitySchemaTransformer.js +1 -0
  41. package/entity-schema/EntitySchemaTransformer.js.map +1 -1
  42. package/find-options/FindOptionsUtils.d.ts +2 -1
  43. package/find-options/FindOptionsUtils.js.map +1 -1
  44. package/package.json +1 -1
  45. package/query-builder/DeleteQueryBuilder.d.ts +2 -2
  46. package/query-builder/DeleteQueryBuilder.js.map +1 -1
  47. package/query-builder/InsertQueryBuilder.d.ts +2 -2
  48. package/query-builder/InsertQueryBuilder.js.map +1 -1
  49. package/query-builder/QueryBuilder.d.ts +3 -3
  50. package/query-builder/QueryBuilder.js.map +1 -1
  51. package/query-builder/QueryPartialEntity.d.ts +5 -2
  52. package/query-builder/QueryPartialEntity.js.map +1 -1
  53. package/query-builder/RelationIdLoader.js +15 -14
  54. package/query-builder/RelationIdLoader.js.map +1 -1
  55. package/query-builder/RelationQueryBuilder.d.ts +2 -1
  56. package/query-builder/RelationQueryBuilder.js.map +1 -1
  57. package/query-builder/SelectQueryBuilder.d.ts +5 -5
  58. package/query-builder/SelectQueryBuilder.js.map +1 -1
  59. package/repository/BaseEntity.js.map +1 -1
@@ -66,7 +66,7 @@ export declare class EntityManager {
66
66
  /**
67
67
  * Creates a new query builder that can be used to build a SQL query.
68
68
  */
69
- createQueryBuilder<Entity>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;
69
+ createQueryBuilder<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;
70
70
  /**
71
71
  * Creates a new query builder that can be used to build a SQL query.
72
72
  */
@@ -197,8 +197,8 @@ export declare class EntityManager {
197
197
  * Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.
198
198
  * You can execute bulk inserts using this method.
199
199
  */
200
- insert<Entity>(target: EntityTarget<Entity>, entity: QueryDeepPartialEntity<Entity> | QueryDeepPartialEntity<Entity>[]): Promise<InsertResult>;
201
- upsert<Entity>(target: EntityTarget<Entity>, entityOrEntities: QueryDeepPartialEntity<Entity> | QueryDeepPartialEntity<Entity>[], conflictPathsOrOptions: string[] | UpsertOptions<Entity>): Promise<InsertResult>;
200
+ insert<Entity extends ObjectLiteral>(target: EntityTarget<Entity>, entity: QueryDeepPartialEntity<Entity> | QueryDeepPartialEntity<Entity>[]): Promise<InsertResult>;
201
+ upsert<Entity extends ObjectLiteral>(target: EntityTarget<Entity>, entityOrEntities: QueryDeepPartialEntity<Entity> | QueryDeepPartialEntity<Entity>[], conflictPathsOrOptions: string[] | UpsertOptions<Entity>): Promise<InsertResult>;
202
202
  /**
203
203
  * Updates entity partially. Entity can be found by a given condition(s).
204
204
  * Unlike save method executes a primitive operation without cascades, relations and other operations included.
@@ -206,7 +206,7 @@ export declare class EntityManager {
206
206
  * Does not check if entity exist in the database.
207
207
  * Condition(s) cannot be empty.
208
208
  */
209
- update<Entity>(target: EntityTarget<Entity>, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | any, partialEntity: QueryDeepPartialEntity<Entity>): Promise<UpdateResult>;
209
+ update<Entity extends ObjectLiteral>(target: EntityTarget<Entity>, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | any, partialEntity: QueryDeepPartialEntity<Entity>): Promise<UpdateResult>;
210
210
  /**
211
211
  * Deletes entities by a given condition(s).
212
212
  * Unlike save method executes a primitive operation without cascades, relations and other operations included.
@@ -214,7 +214,7 @@ export declare class EntityManager {
214
214
  * Does not check if entity exist in the database.
215
215
  * Condition(s) cannot be empty.
216
216
  */
217
- delete<Entity>(targetOrEntity: EntityTarget<Entity>, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | any): Promise<DeleteResult>;
217
+ delete<Entity extends ObjectLiteral>(targetOrEntity: EntityTarget<Entity>, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | any): Promise<DeleteResult>;
218
218
  /**
219
219
  * Records the delete date of entities by a given condition(s).
220
220
  * Unlike save method executes a primitive operation without cascades, relations and other operations included.
@@ -235,32 +235,32 @@ export declare class EntityManager {
235
235
  * Counts entities that match given options.
236
236
  * Useful for pagination.
237
237
  */
238
- count<Entity>(entityClass: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<number>;
238
+ count<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<number>;
239
239
  /**
240
240
  * Counts entities that match given conditions.
241
241
  * Useful for pagination.
242
242
  */
243
- countBy<Entity>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<number>;
243
+ countBy<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<number>;
244
244
  /**
245
245
  * Finds entities that match given find options.
246
246
  */
247
- find<Entity>(entityClass: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<Entity[]>;
247
+ find<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<Entity[]>;
248
248
  /**
249
249
  * Finds entities that match given find options.
250
250
  */
251
- findBy<Entity>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity[]>;
251
+ findBy<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity[]>;
252
252
  /**
253
253
  * Finds entities that match given find options.
254
254
  * Also counts all entities that match given conditions,
255
255
  * but ignores pagination settings (from and take options).
256
256
  */
257
- findAndCount<Entity>(entityClass: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<[Entity[], number]>;
257
+ findAndCount<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, options?: FindManyOptions<Entity>): Promise<[Entity[], number]>;
258
258
  /**
259
259
  * Finds entities that match given WHERE conditions.
260
260
  * Also counts all entities that match given conditions,
261
261
  * but ignores pagination settings (from and take options).
262
262
  */
263
- findAndCountBy<Entity>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<[Entity[], number]>;
263
+ findAndCountBy<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<[Entity[], number]>;
264
264
  /**
265
265
  * Finds entities with ids.
266
266
  * Optionally find options or conditions can be applied.
@@ -271,17 +271,17 @@ export declare class EntityManager {
271
271
  * id: In([1, 2, 3])
272
272
  * })
273
273
  */
274
- findByIds<Entity>(entityClass: EntityTarget<Entity>, ids: any[]): Promise<Entity[]>;
274
+ findByIds<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, ids: any[]): Promise<Entity[]>;
275
275
  /**
276
276
  * Finds first entity by a given find options.
277
277
  * If entity was not found in the database - returns null.
278
278
  */
279
- findOne<Entity>(entityClass: EntityTarget<Entity>, options: FindOneOptions<Entity>): Promise<Entity | null>;
279
+ findOne<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, options: FindOneOptions<Entity>): Promise<Entity | null>;
280
280
  /**
281
281
  * Finds first entity that matches given where condition.
282
282
  * If entity was not found in the database - returns null.
283
283
  */
284
- findOneBy<Entity>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity | null>;
284
+ findOneBy<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity | null>;
285
285
  /**
286
286
  * Finds first entity that matches given id.
287
287
  * If entity was not found in the database - returns null.
@@ -292,17 +292,17 @@ export declare class EntityManager {
292
292
  * id: 1 // where "id" is your primary column name
293
293
  * })
294
294
  */
295
- findOneById<Entity>(entityClass: EntityTarget<Entity>, id: number | string | Date | ObjectID): Promise<Entity | null>;
295
+ findOneById<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, id: number | string | Date | ObjectID): Promise<Entity | null>;
296
296
  /**
297
297
  * Finds first entity by a given find options.
298
298
  * If entity was not found in the database - rejects with error.
299
299
  */
300
- findOneOrFail<Entity>(entityClass: EntityTarget<Entity>, options: FindOneOptions<Entity>): Promise<Entity>;
300
+ findOneOrFail<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, options: FindOneOptions<Entity>): Promise<Entity>;
301
301
  /**
302
302
  * Finds first entity that matches given where condition.
303
303
  * If entity was not found in the database - rejects with error.
304
304
  */
305
- findOneByOrFail<Entity>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity>;
305
+ findOneByOrFail<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]): Promise<Entity>;
306
306
  /**
307
307
  * Clears all the data from the given table (truncates/drops it).
308
308
  *
@@ -313,11 +313,11 @@ export declare class EntityManager {
313
313
  /**
314
314
  * Increments some column by provided value of the entities matched given conditions.
315
315
  */
316
- increment<Entity>(entityClass: EntityTarget<Entity>, conditions: any, propertyPath: string, value: number | string): Promise<UpdateResult>;
316
+ increment<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, conditions: any, propertyPath: string, value: number | string): Promise<UpdateResult>;
317
317
  /**
318
318
  * Decrements some column by provided value of the entities matched given conditions.
319
319
  */
320
- decrement<Entity>(entityClass: EntityTarget<Entity>, conditions: any, propertyPath: string, value: number | string): Promise<UpdateResult>;
320
+ decrement<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, conditions: any, propertyPath: string, value: number | string): Promise<UpdateResult>;
321
321
  /**
322
322
  * Gets repository for the given entity class or name.
323
323
  * If single database connection mode is used, then repository is obtained from the
@@ -341,7 +341,7 @@ export declare class EntityManager {
341
341
  * sets current EntityManager instance to it. Used to work with custom repositories
342
342
  * in transactions.
343
343
  */
344
- withRepository<Entity extends ObjectLiteral, R extends Repository<Entity>>(repository: R): R;
344
+ withRepository<Entity extends ObjectLiteral, R extends Repository<any>>(repository: R & Repository<Entity>): R;
345
345
  /**
346
346
  * Gets custom entity repository marked with @EntityRepository decorator.
347
347
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/entity-manager/EntityManager.ts"],"names":[],"mappings":";;;AAIA,sEAAkE;AAClE,8GAA0G;AAK1G,kGAA8F;AAC9F,mEAA+D;AAC/D,iEAA6D;AAC7D,yDAAqD;AACrD,uEAAmE;AACnE,sHAAkH;AAClH,gIAA4H;AAC5H,oCAKiB;AACjB,yEAAqE;AAIrE,gFAA4E;AAO5E,qDAAiD;AACjD,wCAAmD;AAEnD,6DAAyD;AAGzD;;;GAGG;AACH,MAAa,aAAa;IAsCtB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,UAAsB,EAAE,WAAyB;QAzCpD,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QAiBpD,4EAA4E;QAC5E,uBAAuB;QACvB,4EAA4E;QAE5E;;WAEG;QACO,iBAAY,GAAsB,EAAE,CAAA;QAE9C;;WAEG;QACO,qBAAgB,GAA0B,EAAE,CAAA;QAEtD;;WAEG;QACO,mCAA8B,GACpC,IAAI,qEAAiC,EAAE,CAAA;QAOvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B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,OAAO,wBAAwB,CAAA;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,qEAAiC,EAAE,CAAA;QAEpE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;CACJ;AAr2CD,sCAq2CC","file":"EntityManager.js","sourcesContent":["import { DataSource } from \"../data-source/DataSource\"\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 {\n CustomRepositoryCannotInheritRepositoryError,\n CustomRepositoryNotFoundError,\n TreeRepositoryNotSupportedError,\n TypeORMError,\n} from \"../error\"\nimport { AbstractRepository } from \"../repository/AbstractRepository\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\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 { FindOptionsWhere } from \"../find-options/FindOptionsWhere\"\nimport { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { getMetadataArgsStorage } from \"../globals\"\nimport { UpsertOptions } from \"../repository/UpsertOptions\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\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 readonly \"@instanceof\" = Symbol.for(\"EntityManager\")\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by this entity manager.\n */\n readonly connection: DataSource\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 repositories.\n */\n protected repositories: Repository<any>[] = []\n\n /**\n * Once created and then reused by repositories.\n */\n protected treeRepositories: TreeRepository<any>[] = []\n\n /**\n * Plain to object transformer used in create and merge operations.\n */\n protected plainObjectToEntityTransformer =\n new PlainObjectToNewEntityTransformer()\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource, 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>(\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): 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 isolationLevel: IsolationLevel,\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): 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:\n | IsolationLevel\n | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T> {\n const isolation =\n typeof isolationOrRunInTransaction === \"string\"\n ? isolationOrRunInTransaction\n : undefined\n const runInTransaction =\n typeof isolationOrRunInTransaction === \"function\"\n ? isolationOrRunInTransaction\n : runInTransactionParam\n\n if (!runInTransaction) {\n throw new TypeORMError(\n `Transaction method requires callback in second parameter if isolation level is supplied.`,\n )\n }\n\n if (this.queryRunner && this.queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError()\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 =\n this.queryRunner || this.connection.createQueryRunner()\n\n try {\n await queryRunner.startTransaction(isolation)\n const result = await runInTransaction(queryRunner.manager)\n await queryRunner.commitTransaction()\n return result\n } catch (err) {\n try {\n // we throw original error even if rollback thrown an error\n await queryRunner.rollbackTransaction()\n } catch (rollbackError) {}\n throw err\n } finally {\n if (!this.queryRunner)\n // 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>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): 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>(\n entityClass?: EntityTarget<Entity> | QueryRunner,\n alias?: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity> {\n if (alias) {\n return this.connection.createQueryBuilder(\n entityClass as EntityTarget<Entity>,\n alias,\n queryRunner || this.queryRunner,\n )\n } else {\n return this.connection.createQueryBuilder(\n (entityClass as QueryRunner | undefined) ||\n queryRunner ||\n this.queryRunner,\n )\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 =\n 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 =\n 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>(\n entityClass: EntityTarget<Entity>,\n plainObject?: DeepPartial<Entity>,\n ): 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>(\n entityClass: EntityTarget<Entity>,\n plainObjects?: DeepPartial<Entity>[],\n ): 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>(\n entityClass: EntityTarget<Entity>,\n plainObjectOrObjects?: DeepPartial<Entity> | DeepPartial<Entity>[],\n ): Entity | Entity[] {\n const metadata = this.connection.getMetadata(entityClass)\n\n if (!plainObjectOrObjects) return metadata.create(this.queryRunner)\n\n if (Array.isArray(plainObjectOrObjects))\n return (plainObjectOrObjects as DeepPartial<Entity>[]).map(\n (plainEntityLike) => this.create(entityClass, plainEntityLike),\n )\n\n const mergeIntoEntity = metadata.create(this.queryRunner)\n this.plainObjectToEntityTransformer.transform(\n mergeIntoEntity,\n plainObjectOrObjects,\n metadata,\n true,\n )\n return mergeIntoEntity\n }\n\n /**\n * Merges two entities into one new entity.\n */\n merge<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n mergeIntoEntity: Entity,\n ...entityLikes: DeepPartial<Entity>[]\n ): Entity {\n // todo: throw exception if entity manager is released\n const metadata = this.connection.getMetadata(entityClass)\n entityLikes.forEach((object) =>\n this.plainObjectToEntityTransformer.transform(\n mergeIntoEntity,\n object,\n metadata,\n ),\n )\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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n entityLike: DeepPartial<Entity>,\n ): Promise<Entity | undefined> {\n const metadata = this.connection.getMetadata(entityClass)\n const plainObjectToDatabaseEntityTransformer =\n new PlainObjectToDatabaseEntityTransformer(this.connection.manager)\n const transformedEntity =\n await plainObjectToDatabaseEntityTransformer.transform(\n entityLike,\n metadata,\n )\n if (transformedEntity)\n return this.merge(\n entityClass as any,\n transformedEntity as Entity,\n entityLike,\n )\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>>(\n targetOrEntity: EntityTarget<Entity>,\n entities: T[],\n options: SaveOptions & { reload: false },\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entities: T[],\n options?: SaveOptions,\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entity: T,\n options: SaveOptions & { reload: false },\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entity: T,\n options?: SaveOptions,\n ): Promise<T & Entity>\n\n /**\n * Saves a given entity in the database.\n */\n save<Entity extends ObjectLiteral, T extends DeepPartial<Entity>>(\n targetOrEntity: (T | T[]) | EntityTarget<Entity>,\n maybeEntityOrOptions?: T | T[],\n maybeOptions?: SaveOptions,\n ): Promise<T | T[]> {\n // normalize mixed parameters\n let target =\n arguments.length > 1 &&\n (typeof targetOrEntity === \"function\" ||\n InstanceChecker.isEntitySchema(targetOrEntity) ||\n typeof targetOrEntity === \"string\")\n ? (targetOrEntity as Function | string)\n : undefined\n const entity: T | T[] = target\n ? (maybeEntityOrOptions as T | T[])\n : (targetOrEntity as T | T[])\n const options = target\n ? maybeOptions\n : (maybeEntityOrOptions as SaveOptions)\n\n if (InstanceChecker.isEntitySchema(target)) 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(\n this.connection,\n this.queryRunner,\n \"save\",\n target,\n entity,\n options,\n )\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>(\n targetOrEntity: EntityTarget<Entity>,\n entity: Entity,\n options?: RemoveOptions,\n ): 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>(\n targetOrEntity: EntityTarget<Entity>,\n entity: Entity[],\n options?: RemoveOptions,\n ): Promise<Entity[]>\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity extends ObjectLiteral>(\n targetOrEntity: (Entity | Entity[]) | EntityTarget<Entity>,\n maybeEntityOrOptions?: Entity | Entity[],\n maybeOptions?: RemoveOptions,\n ): Promise<Entity | Entity[]> {\n // normalize mixed parameters\n const target =\n arguments.length > 1 &&\n (typeof targetOrEntity === \"function\" ||\n InstanceChecker.isEntitySchema(targetOrEntity) ||\n typeof targetOrEntity === \"string\")\n ? (targetOrEntity as Function | string)\n : undefined\n const entity: Entity | Entity[] = target\n ? (maybeEntityOrOptions as Entity | Entity[])\n : (targetOrEntity as Entity | Entity[])\n const options = target\n ? maybeOptions\n : (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(\n this.connection,\n this.queryRunner,\n \"remove\",\n target,\n entity,\n options,\n )\n .execute()\n .then(() => entity)\n }\n\n /**\n * Records the delete date of all given entities.\n */\n softRemove<Entity>(\n entities: Entity[],\n options?: SaveOptions,\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entities: T[],\n options?: SaveOptions,\n ): Promise<T[]>\n\n /**\n * Records the delete date of a given entity.\n */\n softRemove<Entity, T extends DeepPartial<Entity>>(\n targetOrEntity: EntityTarget<Entity>,\n entity: T,\n options?: SaveOptions,\n ): Promise<T>\n\n /**\n * Records the delete date of one or many given entities.\n */\n softRemove<Entity extends ObjectLiteral, T extends DeepPartial<Entity>>(\n targetOrEntity: (T | T[]) | EntityTarget<Entity>,\n maybeEntityOrOptions?: T | T[],\n maybeOptions?: SaveOptions,\n ): Promise<T | T[]> {\n // normalize mixed parameters\n let target =\n arguments.length > 1 &&\n (typeof targetOrEntity === \"function\" ||\n InstanceChecker.isEntitySchema(targetOrEntity) ||\n typeof targetOrEntity === \"string\")\n ? (targetOrEntity as Function | string)\n : undefined\n const entity: T | T[] = target\n ? (maybeEntityOrOptions as T | T[])\n : (targetOrEntity as T | T[])\n const options = target\n ? maybeOptions\n : (maybeEntityOrOptions as SaveOptions)\n\n if (InstanceChecker.isEntitySchema(target)) 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(\n this.connection,\n this.queryRunner,\n \"soft-remove\",\n target,\n entity,\n options,\n )\n .execute()\n .then(() => entity)\n }\n\n /**\n * Recovers all given entities.\n */\n recover<Entity>(\n entities: Entity[],\n options?: SaveOptions,\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entities: T[],\n options?: SaveOptions,\n ): Promise<T[]>\n\n /**\n * Recovers a given entity.\n */\n recover<Entity, T extends DeepPartial<Entity>>(\n targetOrEntity: EntityTarget<Entity>,\n entity: T,\n options?: SaveOptions,\n ): Promise<T>\n\n /**\n * Recovers one or many given entities.\n */\n recover<Entity extends ObjectLiteral, T extends DeepPartial<Entity>>(\n targetOrEntity: (T | T[]) | EntityTarget<Entity>,\n maybeEntityOrOptions?: T | T[],\n maybeOptions?: SaveOptions,\n ): Promise<T | T[]> {\n // normalize mixed parameters\n let target =\n arguments.length > 1 &&\n (typeof targetOrEntity === \"function\" ||\n InstanceChecker.isEntitySchema(targetOrEntity) ||\n typeof targetOrEntity === \"string\")\n ? (targetOrEntity as Function | string)\n : undefined\n const entity: T | T[] = target\n ? (maybeEntityOrOptions as T | T[])\n : (targetOrEntity as T | T[])\n const options = target\n ? maybeOptions\n : (maybeEntityOrOptions as SaveOptions)\n\n if (InstanceChecker.isEntitySchema(target)) 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(\n this.connection,\n this.queryRunner,\n \"recover\",\n target,\n entity,\n options,\n )\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>(\n target: EntityTarget<Entity>,\n entity:\n | QueryDeepPartialEntity<Entity>\n | QueryDeepPartialEntity<Entity>[],\n ): 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:\n | QueryDeepPartialEntity<Entity>\n | QueryDeepPartialEntity<Entity>[],\n conflictPathsOrOptions: string[] | UpsertOptions<Entity>,\n ): 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(\n options.conflictPaths,\n )\n\n const overwriteColumns = metadata.columns.filter(\n (col) =>\n !conflictColumns.includes(col) &&\n entities.some(\n (entity) =>\n typeof col.getEntityValue(entity) !== \"undefined\",\n ),\n )\n\n return this.createQueryBuilder()\n .insert()\n .into(target)\n .values(entities)\n .orUpdate(\n [...conflictColumns, ...overwriteColumns].map(\n (col) => col.databaseName,\n ),\n conflictColumns.map((col) => col.databaseName),\n {\n skipUpdateIfNoValuesChanged:\n 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>(\n target: EntityTarget<Entity>,\n criteria:\n | string\n | string[]\n | number\n | number[]\n | Date\n | Date[]\n | ObjectID\n | ObjectID[]\n | any,\n partialEntity: QueryDeepPartialEntity<Entity>,\n ): Promise<UpdateResult> {\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (\n criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (Array.isArray(criteria) && criteria.length === 0)\n ) {\n return Promise.reject(\n new TypeORMError(\n `Empty criteria(s) are not allowed for the update method.`,\n ),\n )\n }\n\n if (\n 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 } 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>(\n targetOrEntity: EntityTarget<Entity>,\n criteria:\n | string\n | string[]\n | number\n | number[]\n | Date\n | Date[]\n | ObjectID\n | ObjectID[]\n | any,\n ): Promise<DeleteResult> {\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (\n criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (Array.isArray(criteria) && criteria.length === 0)\n ) {\n return Promise.reject(\n new TypeORMError(\n `Empty criteria(s) are not allowed for the delete method.`,\n ),\n )\n }\n\n if (\n 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 } 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 extends ObjectLiteral>(\n targetOrEntity: EntityTarget<Entity>,\n criteria:\n | string\n | string[]\n | number\n | number[]\n | Date\n | Date[]\n | ObjectID\n | ObjectID[]\n | any,\n ): Promise<UpdateResult> {\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (\n criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (Array.isArray(criteria) && criteria.length === 0)\n ) {\n return Promise.reject(\n new TypeORMError(\n `Empty criteria(s) are not allowed for the delete method.`,\n ),\n )\n }\n\n if (\n 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 } 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 extends ObjectLiteral>(\n targetOrEntity: EntityTarget<Entity>,\n criteria:\n | string\n | string[]\n | number\n | number[]\n | Date\n | Date[]\n | ObjectID\n | ObjectID[]\n | any,\n ): Promise<UpdateResult> {\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (\n criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (Array.isArray(criteria) && criteria.length === 0)\n ) {\n return Promise.reject(\n new TypeORMError(\n `Empty criteria(s) are not allowed for the delete method.`,\n ),\n )\n }\n\n if (\n 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 } 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>(\n entityClass: EntityTarget<Entity>,\n options?: FindManyOptions<Entity>,\n ): Promise<number> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder(\n entityClass,\n FindOptionsUtils.extractFindManyOptionsAlias(options) ||\n metadata.name,\n )\n .setFindOptions(options || {})\n .getCount()\n }\n\n /**\n * Counts entities that match given conditions.\n * Useful for pagination.\n */\n countBy<Entity>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder(entityClass, metadata.name)\n .setFindOptions({ where })\n .getCount()\n }\n\n /**\n * Finds entities that match given find options.\n */\n async find<Entity>(\n entityClass: EntityTarget<Entity>,\n options?: FindManyOptions<Entity>,\n ): Promise<Entity[]> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n FindOptionsUtils.extractFindManyOptionsAlias(options) ||\n metadata.name,\n )\n .setFindOptions(options || {})\n .getMany()\n }\n\n /**\n * Finds entities that match given find options.\n */\n async findBy<Entity>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<Entity[]> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n metadata.name,\n )\n .setFindOptions({ where: where })\n .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>(\n entityClass: EntityTarget<Entity>,\n options?: FindManyOptions<Entity>,\n ): Promise<[Entity[], number]> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n FindOptionsUtils.extractFindManyOptionsAlias(options) ||\n metadata.name,\n )\n .setFindOptions(options || {})\n .getManyAndCount()\n }\n\n /**\n * Finds entities that match given WHERE conditions.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n findAndCountBy<Entity>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<[Entity[], number]> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n metadata.name,\n )\n .setFindOptions({ where })\n .getManyAndCount()\n }\n\n /**\n * Finds entities with ids.\n * Optionally find options or conditions can be applied.\n *\n * @deprecated use `findBy` method instead in conjunction with `In` operator, for example:\n *\n * .findBy({\n * id: In([1, 2, 3])\n * })\n */\n async findByIds<Entity>(\n entityClass: EntityTarget<Entity>,\n ids: any[],\n ): Promise<Entity[]> {\n // if no ids passed, no need to execute a query - just return an empty array of values\n if (!ids.length) return Promise.resolve([])\n\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n metadata.name,\n )\n .andWhereInIds(ids)\n .getMany()\n }\n\n /**\n * Finds first entity by a given find options.\n * If entity was not found in the database - returns null.\n */\n async findOne<Entity>(\n entityClass: EntityTarget<Entity>,\n options: FindOneOptions<Entity>,\n ): Promise<Entity | null> {\n const metadata = this.connection.getMetadata(entityClass)\n\n // prepare alias for built query\n let alias: string = metadata.name\n if (options && options.join) {\n alias = options.join.alias\n }\n\n if (!options.where) {\n throw new Error(\n `You must provide selection conditions in order to find a single row.`,\n )\n }\n\n // create query builder and apply find options\n return this.createQueryBuilder<Entity>(entityClass, alias)\n .setFindOptions({\n ...options,\n take: 1,\n })\n .getOne()\n }\n\n /**\n * Finds first entity that matches given where condition.\n * If entity was not found in the database - returns null.\n */\n async findOneBy<Entity>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<Entity | null> {\n const metadata = this.connection.getMetadata(entityClass)\n\n // create query builder and apply find options\n return this.createQueryBuilder<Entity>(entityClass, metadata.name)\n .setFindOptions({\n where,\n take: 1,\n })\n .getOne()\n }\n\n /**\n * Finds first entity that matches given id.\n * If entity was not found in the database - returns null.\n *\n * @deprecated use `findOneBy` method instead in conjunction with `In` operator, for example:\n *\n * .findOneBy({\n * id: 1 // where \"id\" is your primary column name\n * })\n */\n async findOneById<Entity>(\n entityClass: EntityTarget<Entity>,\n id: number | string | Date | ObjectID,\n ): Promise<Entity | null> {\n const metadata = this.connection.getMetadata(entityClass)\n\n // create query builder and apply find options\n return this.createQueryBuilder<Entity>(entityClass, metadata.name)\n .setFindOptions({\n take: 1,\n })\n .whereInIds(metadata.ensureEntityIdMap(id))\n .getOne()\n }\n\n /**\n * Finds first entity by a given find options.\n * If entity was not found in the database - rejects with error.\n */\n async findOneOrFail<Entity>(\n entityClass: EntityTarget<Entity>,\n options: FindOneOptions<Entity>,\n ): Promise<Entity> {\n return this.findOne<Entity>(entityClass as any, options).then(\n (value) => {\n if (value === null) {\n return Promise.reject(\n new EntityNotFoundError(entityClass, options),\n )\n }\n return Promise.resolve(value)\n },\n )\n }\n\n /**\n * Finds first entity that matches given where condition.\n * If entity was not found in the database - rejects with error.\n */\n async findOneByOrFail<Entity>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<Entity> {\n return this.findOneBy<Entity>(entityClass as any, where).then(\n (value) => {\n if (value === null) {\n return Promise.reject(\n new EntityNotFoundError(entityClass, where),\n )\n }\n return Promise.resolve(value)\n },\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 =\n this.queryRunner || this.connection.createQueryRunner()\n try {\n return await queryRunner.clearTable(metadata.tablePath) // await is needed here because we are using finally\n } finally {\n if (!this.queryRunner) 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>(\n entityClass: EntityTarget<Entity>,\n conditions: any,\n propertyPath: string,\n value: number | string,\n ): Promise<UpdateResult> {\n const metadata = this.connection.getMetadata(entityClass)\n const column = metadata.findColumnWithPropertyPath(propertyPath)\n if (!column)\n throw new TypeORMError(\n `Column ${propertyPath} was not found in ${metadata.targetName} entity.`,\n )\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 () =>\n this.connection.driver.escape(column.databaseName) +\n \" + \" +\n value,\n )\n\n return this.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>(\n entityClass: EntityTarget<Entity>,\n conditions: any,\n propertyPath: string,\n value: number | string,\n ): Promise<UpdateResult> {\n const metadata = this.connection.getMetadata(entityClass)\n const column = metadata.findColumnWithPropertyPath(propertyPath)\n if (!column)\n throw new TypeORMError(\n `Column ${propertyPath} was not found in ${metadata.targetName} entity.`,\n )\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 () =>\n this.connection.driver.escape(column.databaseName) +\n \" - \" +\n value,\n )\n\n return this.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 extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): Repository<Entity> {\n // find already created repository instance and return it if found\n const repository = this.repositories.find(\n (repository) => repository.target === target,\n )\n if (repository) return repository\n\n // if repository was not found then create it, store its instance and return it\n if (this.connection.driver.options.type === \"mongodb\") {\n const newRepository = new MongoRepository(\n target,\n this,\n this.queryRunner,\n )\n this.repositories.push(newRepository as any)\n return newRepository\n } else {\n const newRepository = new Repository<any>(\n target,\n this,\n this.queryRunner,\n )\n this.repositories.push(newRepository)\n return newRepository\n }\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 extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): TreeRepository<Entity> {\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 // find already created repository instance and return it if found\n const repository = this.treeRepositories.find(\n (repository) => repository.target === target,\n )\n if (repository) return repository\n\n // check if repository is real tree repository\n const newRepository = new TreeRepository(target, this, this.queryRunner)\n this.treeRepositories.push(newRepository)\n return newRepository\n }\n\n /**\n * Gets mongodb repository for the given entity class.\n */\n getMongoRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): MongoRepository<Entity> {\n return this.connection.getMongoRepository<Entity>(target)\n }\n\n /**\n * Creates a new repository instance out of a given Repository and\n * sets current EntityManager instance to it. Used to work with custom repositories\n * in transactions.\n */\n withRepository<Entity extends ObjectLiteral, R extends Repository<Entity>>(\n repository: R,\n ): R {\n const repositoryConstructor =\n repository.constructor as typeof Repository\n const { target, manager, queryRunner, ...otherRepositoryProperties } =\n repository\n return Object.assign(\n new repositoryConstructor(repository.target, this) as R,\n {\n ...otherRepositoryProperties,\n },\n )\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n *\n * @deprecated use Repository.extend to create custom repositories\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n const entityRepositoryMetadataArgs =\n getMetadataArgsStorage().entityRepositories.find((repository) => {\n return (\n repository.target ===\n (typeof customRepository === \"function\"\n ? customRepository\n : (customRepository as any).constructor)\n )\n })\n if (!entityRepositoryMetadataArgs)\n throw new CustomRepositoryNotFoundError(customRepository)\n\n const entityMetadata = entityRepositoryMetadataArgs.entity\n ? this.connection.getMetadata(entityRepositoryMetadataArgs.entity)\n : undefined\n const entityRepositoryInstance =\n new (entityRepositoryMetadataArgs.target as any)(\n this,\n entityMetadata,\n )\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 } else {\n if (!entityMetadata)\n throw new CustomRepositoryCannotInheritRepositoryError(\n 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) throw new NoNeedToReleaseEntityManagerError()\n\n return this.queryRunner.release()\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../../src/entity-manager/EntityManager.ts"],"names":[],"mappings":";;;AAIA,sEAAkE;AAClE,8GAA0G;AAK1G,kGAA8F;AAC9F,mEAA+D;AAC/D,iEAA6D;AAC7D,yDAAqD;AACrD,uEAAmE;AACnE,sHAAkH;AAClH,gIAA4H;AAC5H,oCAKiB;AACjB,yEAAqE;AAIrE,gFAA4E;AAO5E,qDAAiD;AACjD,wCAAmD;AAEnD,6DAAyD;AAGzD;;;GAGG;AACH,MAAa,aAAa;IAsCtB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,UAAsB,EAAE,WAAyB;QAzCpD,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QAiBpD,4EAA4E;QAC5E,uBAAuB;QACvB,4EAA4E;QAE5E;;WAEG;QACO,iBAAY,GAAsB,EAAE,CAAA;QAE9C;;WAEG;QACO,qBAAgB,GAA0B,EAAE,CAAA;QAEtD;;WAEG;QACO,mCAA8B,GACpC,IAAI,qEAAiC,EAAE,CAAA;QAOvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QA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;QAED,OAAO,wBAAwB,CAAA;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,qEAAiC,EAAE,CAAA;QAEpE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;CACJ;AAr2CD,sCAq2CC","file":"EntityManager.js","sourcesContent":["import { DataSource } from \"../data-source/DataSource\"\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 {\n CustomRepositoryCannotInheritRepositoryError,\n CustomRepositoryNotFoundError,\n TreeRepositoryNotSupportedError,\n TypeORMError,\n} from \"../error\"\nimport { AbstractRepository } from \"../repository/AbstractRepository\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\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 { FindOptionsWhere } from \"../find-options/FindOptionsWhere\"\nimport { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { getMetadataArgsStorage } from \"../globals\"\nimport { UpsertOptions } from \"../repository/UpsertOptions\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\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 readonly \"@instanceof\" = Symbol.for(\"EntityManager\")\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by this entity manager.\n */\n readonly connection: DataSource\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 repositories.\n */\n protected repositories: Repository<any>[] = []\n\n /**\n * Once created and then reused by repositories.\n */\n protected treeRepositories: TreeRepository<any>[] = []\n\n /**\n * Plain to object transformer used in create and merge operations.\n */\n protected plainObjectToEntityTransformer =\n new PlainObjectToNewEntityTransformer()\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource, 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>(\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): 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 isolationLevel: IsolationLevel,\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): 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:\n | IsolationLevel\n | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T> {\n const isolation =\n typeof isolationOrRunInTransaction === \"string\"\n ? isolationOrRunInTransaction\n : undefined\n const runInTransaction =\n typeof isolationOrRunInTransaction === \"function\"\n ? isolationOrRunInTransaction\n : runInTransactionParam\n\n if (!runInTransaction) {\n throw new TypeORMError(\n `Transaction method requires callback in second parameter if isolation level is supplied.`,\n )\n }\n\n if (this.queryRunner && this.queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError()\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 =\n this.queryRunner || this.connection.createQueryRunner()\n\n try {\n await queryRunner.startTransaction(isolation)\n const result = await runInTransaction(queryRunner.manager)\n await queryRunner.commitTransaction()\n return result\n } catch (err) {\n try {\n // we throw original error even if rollback thrown an error\n await queryRunner.rollbackTransaction()\n } catch (rollbackError) {}\n throw err\n } finally {\n if (!this.queryRunner)\n // 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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): 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 extends ObjectLiteral>(\n entityClass?: EntityTarget<Entity> | QueryRunner,\n alias?: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity> {\n if (alias) {\n return this.connection.createQueryBuilder(\n entityClass as EntityTarget<Entity>,\n alias,\n queryRunner || this.queryRunner,\n )\n } else {\n return this.connection.createQueryBuilder(\n (entityClass as QueryRunner | undefined) ||\n queryRunner ||\n this.queryRunner,\n )\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 =\n 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 =\n 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>(\n entityClass: EntityTarget<Entity>,\n plainObject?: DeepPartial<Entity>,\n ): 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>(\n entityClass: EntityTarget<Entity>,\n plainObjects?: DeepPartial<Entity>[],\n ): 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>(\n entityClass: EntityTarget<Entity>,\n plainObjectOrObjects?: DeepPartial<Entity> | DeepPartial<Entity>[],\n ): Entity | Entity[] {\n const metadata = this.connection.getMetadata(entityClass)\n\n if (!plainObjectOrObjects) return metadata.create(this.queryRunner)\n\n if (Array.isArray(plainObjectOrObjects))\n return (plainObjectOrObjects as DeepPartial<Entity>[]).map(\n (plainEntityLike) => this.create(entityClass, plainEntityLike),\n )\n\n const mergeIntoEntity = metadata.create(this.queryRunner)\n this.plainObjectToEntityTransformer.transform(\n mergeIntoEntity,\n plainObjectOrObjects,\n metadata,\n true,\n )\n return mergeIntoEntity\n }\n\n /**\n * Merges two entities into one new entity.\n */\n merge<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n mergeIntoEntity: Entity,\n ...entityLikes: DeepPartial<Entity>[]\n ): Entity {\n // todo: throw exception if entity manager is released\n const metadata = this.connection.getMetadata(entityClass)\n entityLikes.forEach((object) =>\n this.plainObjectToEntityTransformer.transform(\n mergeIntoEntity,\n object,\n metadata,\n ),\n )\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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n entityLike: DeepPartial<Entity>,\n ): Promise<Entity | undefined> {\n const metadata = this.connection.getMetadata(entityClass)\n const plainObjectToDatabaseEntityTransformer =\n new PlainObjectToDatabaseEntityTransformer(this.connection.manager)\n const transformedEntity =\n await plainObjectToDatabaseEntityTransformer.transform(\n entityLike,\n metadata,\n )\n if (transformedEntity)\n return this.merge(\n entityClass as any,\n transformedEntity as Entity,\n entityLike,\n )\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>>(\n targetOrEntity: EntityTarget<Entity>,\n entities: T[],\n options: SaveOptions & { reload: false },\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entities: T[],\n options?: SaveOptions,\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entity: T,\n options: SaveOptions & { reload: false },\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entity: T,\n options?: SaveOptions,\n ): Promise<T & Entity>\n\n /**\n * Saves a given entity in the database.\n */\n save<Entity extends ObjectLiteral, T extends DeepPartial<Entity>>(\n targetOrEntity: (T | T[]) | EntityTarget<Entity>,\n maybeEntityOrOptions?: T | T[],\n maybeOptions?: SaveOptions,\n ): Promise<T | T[]> {\n // normalize mixed parameters\n let target =\n arguments.length > 1 &&\n (typeof targetOrEntity === \"function\" ||\n InstanceChecker.isEntitySchema(targetOrEntity) ||\n typeof targetOrEntity === \"string\")\n ? (targetOrEntity as Function | string)\n : undefined\n const entity: T | T[] = target\n ? (maybeEntityOrOptions as T | T[])\n : (targetOrEntity as T | T[])\n const options = target\n ? maybeOptions\n : (maybeEntityOrOptions as SaveOptions)\n\n if (InstanceChecker.isEntitySchema(target)) 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(\n this.connection,\n this.queryRunner,\n \"save\",\n target,\n entity,\n options,\n )\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>(\n targetOrEntity: EntityTarget<Entity>,\n entity: Entity,\n options?: RemoveOptions,\n ): 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>(\n targetOrEntity: EntityTarget<Entity>,\n entity: Entity[],\n options?: RemoveOptions,\n ): Promise<Entity[]>\n\n /**\n * Removes a given entity from the database.\n */\n remove<Entity extends ObjectLiteral>(\n targetOrEntity: (Entity | Entity[]) | EntityTarget<Entity>,\n maybeEntityOrOptions?: Entity | Entity[],\n maybeOptions?: RemoveOptions,\n ): Promise<Entity | Entity[]> {\n // normalize mixed parameters\n const target =\n arguments.length > 1 &&\n (typeof targetOrEntity === \"function\" ||\n InstanceChecker.isEntitySchema(targetOrEntity) ||\n typeof targetOrEntity === \"string\")\n ? (targetOrEntity as Function | string)\n : undefined\n const entity: Entity | Entity[] = target\n ? (maybeEntityOrOptions as Entity | Entity[])\n : (targetOrEntity as Entity | Entity[])\n const options = target\n ? maybeOptions\n : (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(\n this.connection,\n this.queryRunner,\n \"remove\",\n target,\n entity,\n options,\n )\n .execute()\n .then(() => entity)\n }\n\n /**\n * Records the delete date of all given entities.\n */\n softRemove<Entity>(\n entities: Entity[],\n options?: SaveOptions,\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entities: T[],\n options?: SaveOptions,\n ): Promise<T[]>\n\n /**\n * Records the delete date of a given entity.\n */\n softRemove<Entity, T extends DeepPartial<Entity>>(\n targetOrEntity: EntityTarget<Entity>,\n entity: T,\n options?: SaveOptions,\n ): Promise<T>\n\n /**\n * Records the delete date of one or many given entities.\n */\n softRemove<Entity extends ObjectLiteral, T extends DeepPartial<Entity>>(\n targetOrEntity: (T | T[]) | EntityTarget<Entity>,\n maybeEntityOrOptions?: T | T[],\n maybeOptions?: SaveOptions,\n ): Promise<T | T[]> {\n // normalize mixed parameters\n let target =\n arguments.length > 1 &&\n (typeof targetOrEntity === \"function\" ||\n InstanceChecker.isEntitySchema(targetOrEntity) ||\n typeof targetOrEntity === \"string\")\n ? (targetOrEntity as Function | string)\n : undefined\n const entity: T | T[] = target\n ? (maybeEntityOrOptions as T | T[])\n : (targetOrEntity as T | T[])\n const options = target\n ? maybeOptions\n : (maybeEntityOrOptions as SaveOptions)\n\n if (InstanceChecker.isEntitySchema(target)) 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(\n this.connection,\n this.queryRunner,\n \"soft-remove\",\n target,\n entity,\n options,\n )\n .execute()\n .then(() => entity)\n }\n\n /**\n * Recovers all given entities.\n */\n recover<Entity>(\n entities: Entity[],\n options?: SaveOptions,\n ): 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>>(\n targetOrEntity: EntityTarget<Entity>,\n entities: T[],\n options?: SaveOptions,\n ): Promise<T[]>\n\n /**\n * Recovers a given entity.\n */\n recover<Entity, T extends DeepPartial<Entity>>(\n targetOrEntity: EntityTarget<Entity>,\n entity: T,\n options?: SaveOptions,\n ): Promise<T>\n\n /**\n * Recovers one or many given entities.\n */\n recover<Entity extends ObjectLiteral, T extends DeepPartial<Entity>>(\n targetOrEntity: (T | T[]) | EntityTarget<Entity>,\n maybeEntityOrOptions?: T | T[],\n maybeOptions?: SaveOptions,\n ): Promise<T | T[]> {\n // normalize mixed parameters\n let target =\n arguments.length > 1 &&\n (typeof targetOrEntity === \"function\" ||\n InstanceChecker.isEntitySchema(targetOrEntity) ||\n typeof targetOrEntity === \"string\")\n ? (targetOrEntity as Function | string)\n : undefined\n const entity: T | T[] = target\n ? (maybeEntityOrOptions as T | T[])\n : (targetOrEntity as T | T[])\n const options = target\n ? maybeOptions\n : (maybeEntityOrOptions as SaveOptions)\n\n if (InstanceChecker.isEntitySchema(target)) 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(\n this.connection,\n this.queryRunner,\n \"recover\",\n target,\n entity,\n options,\n )\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 extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n entity:\n | QueryDeepPartialEntity<Entity>\n | QueryDeepPartialEntity<Entity>[],\n ): Promise<InsertResult> {\n return this.createQueryBuilder()\n .insert()\n .into(target)\n .values(entity)\n .execute()\n }\n\n async upsert<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n entityOrEntities:\n | QueryDeepPartialEntity<Entity>\n | QueryDeepPartialEntity<Entity>[],\n conflictPathsOrOptions: string[] | UpsertOptions<Entity>,\n ): 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(\n options.conflictPaths,\n )\n\n const overwriteColumns = metadata.columns.filter(\n (col) =>\n !conflictColumns.includes(col) &&\n entities.some(\n (entity) =>\n typeof col.getEntityValue(entity) !== \"undefined\",\n ),\n )\n\n return this.createQueryBuilder()\n .insert()\n .into(target)\n .values(entities)\n .orUpdate(\n [...conflictColumns, ...overwriteColumns].map(\n (col) => col.databaseName,\n ),\n conflictColumns.map((col) => col.databaseName),\n {\n skipUpdateIfNoValuesChanged:\n 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 extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n criteria:\n | string\n | string[]\n | number\n | number[]\n | Date\n | Date[]\n | ObjectID\n | ObjectID[]\n | any,\n partialEntity: QueryDeepPartialEntity<Entity>,\n ): Promise<UpdateResult> {\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (\n criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (Array.isArray(criteria) && criteria.length === 0)\n ) {\n return Promise.reject(\n new TypeORMError(\n `Empty criteria(s) are not allowed for the update method.`,\n ),\n )\n }\n\n if (\n 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 } 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 extends ObjectLiteral>(\n targetOrEntity: EntityTarget<Entity>,\n criteria:\n | string\n | string[]\n | number\n | number[]\n | Date\n | Date[]\n | ObjectID\n | ObjectID[]\n | any,\n ): Promise<DeleteResult> {\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (\n criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (Array.isArray(criteria) && criteria.length === 0)\n ) {\n return Promise.reject(\n new TypeORMError(\n `Empty criteria(s) are not allowed for the delete method.`,\n ),\n )\n }\n\n if (\n 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 } 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 extends ObjectLiteral>(\n targetOrEntity: EntityTarget<Entity>,\n criteria:\n | string\n | string[]\n | number\n | number[]\n | Date\n | Date[]\n | ObjectID\n | ObjectID[]\n | any,\n ): Promise<UpdateResult> {\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (\n criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (Array.isArray(criteria) && criteria.length === 0)\n ) {\n return Promise.reject(\n new TypeORMError(\n `Empty criteria(s) are not allowed for the delete method.`,\n ),\n )\n }\n\n if (\n 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 } 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 extends ObjectLiteral>(\n targetOrEntity: EntityTarget<Entity>,\n criteria:\n | string\n | string[]\n | number\n | number[]\n | Date\n | Date[]\n | ObjectID\n | ObjectID[]\n | any,\n ): Promise<UpdateResult> {\n // if user passed empty criteria or empty list of criterias, then throw an error\n if (\n criteria === undefined ||\n criteria === null ||\n criteria === \"\" ||\n (Array.isArray(criteria) && criteria.length === 0)\n ) {\n return Promise.reject(\n new TypeORMError(\n `Empty criteria(s) are not allowed for the delete method.`,\n ),\n )\n }\n\n if (\n 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 } 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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n options?: FindManyOptions<Entity>,\n ): Promise<number> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder(\n entityClass,\n FindOptionsUtils.extractFindManyOptionsAlias(options) ||\n metadata.name,\n )\n .setFindOptions(options || {})\n .getCount()\n }\n\n /**\n * Counts entities that match given conditions.\n * Useful for pagination.\n */\n countBy<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder(entityClass, metadata.name)\n .setFindOptions({ where })\n .getCount()\n }\n\n /**\n * Finds entities that match given find options.\n */\n async find<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n options?: FindManyOptions<Entity>,\n ): Promise<Entity[]> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n FindOptionsUtils.extractFindManyOptionsAlias(options) ||\n metadata.name,\n )\n .setFindOptions(options || {})\n .getMany()\n }\n\n /**\n * Finds entities that match given find options.\n */\n async findBy<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<Entity[]> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n metadata.name,\n )\n .setFindOptions({ where: where })\n .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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n options?: FindManyOptions<Entity>,\n ): Promise<[Entity[], number]> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n FindOptionsUtils.extractFindManyOptionsAlias(options) ||\n metadata.name,\n )\n .setFindOptions(options || {})\n .getManyAndCount()\n }\n\n /**\n * Finds entities that match given WHERE conditions.\n * Also counts all entities that match given conditions,\n * but ignores pagination settings (from and take options).\n */\n findAndCountBy<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<[Entity[], number]> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n metadata.name,\n )\n .setFindOptions({ where })\n .getManyAndCount()\n }\n\n /**\n * Finds entities with ids.\n * Optionally find options or conditions can be applied.\n *\n * @deprecated use `findBy` method instead in conjunction with `In` operator, for example:\n *\n * .findBy({\n * id: In([1, 2, 3])\n * })\n */\n async findByIds<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n ids: any[],\n ): Promise<Entity[]> {\n // if no ids passed, no need to execute a query - just return an empty array of values\n if (!ids.length) return Promise.resolve([])\n\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder<Entity>(\n entityClass as any,\n metadata.name,\n )\n .andWhereInIds(ids)\n .getMany()\n }\n\n /**\n * Finds first entity by a given find options.\n * If entity was not found in the database - returns null.\n */\n async findOne<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n options: FindOneOptions<Entity>,\n ): Promise<Entity | null> {\n const metadata = this.connection.getMetadata(entityClass)\n\n // prepare alias for built query\n let alias: string = metadata.name\n if (options && options.join) {\n alias = options.join.alias\n }\n\n if (!options.where) {\n throw new Error(\n `You must provide selection conditions in order to find a single row.`,\n )\n }\n\n // create query builder and apply find options\n return this.createQueryBuilder<Entity>(entityClass, alias)\n .setFindOptions({\n ...options,\n take: 1,\n })\n .getOne()\n }\n\n /**\n * Finds first entity that matches given where condition.\n * If entity was not found in the database - returns null.\n */\n async findOneBy<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<Entity | null> {\n const metadata = this.connection.getMetadata(entityClass)\n\n // create query builder and apply find options\n return this.createQueryBuilder<Entity>(entityClass, metadata.name)\n .setFindOptions({\n where,\n take: 1,\n })\n .getOne()\n }\n\n /**\n * Finds first entity that matches given id.\n * If entity was not found in the database - returns null.\n *\n * @deprecated use `findOneBy` method instead in conjunction with `In` operator, for example:\n *\n * .findOneBy({\n * id: 1 // where \"id\" is your primary column name\n * })\n */\n async findOneById<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n id: number | string | Date | ObjectID,\n ): Promise<Entity | null> {\n const metadata = this.connection.getMetadata(entityClass)\n\n // create query builder and apply find options\n return this.createQueryBuilder<Entity>(entityClass, metadata.name)\n .setFindOptions({\n take: 1,\n })\n .whereInIds(metadata.ensureEntityIdMap(id))\n .getOne()\n }\n\n /**\n * Finds first entity by a given find options.\n * If entity was not found in the database - rejects with error.\n */\n async findOneOrFail<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n options: FindOneOptions<Entity>,\n ): Promise<Entity> {\n return this.findOne<Entity>(entityClass as any, options).then(\n (value) => {\n if (value === null) {\n return Promise.reject(\n new EntityNotFoundError(entityClass, options),\n )\n }\n return Promise.resolve(value)\n },\n )\n }\n\n /**\n * Finds first entity that matches given where condition.\n * If entity was not found in the database - rejects with error.\n */\n async findOneByOrFail<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<Entity> {\n return this.findOneBy<Entity>(entityClass as any, where).then(\n (value) => {\n if (value === null) {\n return Promise.reject(\n new EntityNotFoundError(entityClass, where),\n )\n }\n return Promise.resolve(value)\n },\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 =\n this.queryRunner || this.connection.createQueryRunner()\n try {\n return await queryRunner.clearTable(metadata.tablePath) // await is needed here because we are using finally\n } finally {\n if (!this.queryRunner) 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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n conditions: any,\n propertyPath: string,\n value: number | string,\n ): Promise<UpdateResult> {\n const metadata = this.connection.getMetadata(entityClass)\n const column = metadata.findColumnWithPropertyPath(propertyPath)\n if (!column)\n throw new TypeORMError(\n `Column ${propertyPath} was not found in ${metadata.targetName} entity.`,\n )\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 () =>\n this.connection.driver.escape(column.databaseName) +\n \" + \" +\n value,\n )\n\n return this.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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n conditions: any,\n propertyPath: string,\n value: number | string,\n ): Promise<UpdateResult> {\n const metadata = this.connection.getMetadata(entityClass)\n const column = metadata.findColumnWithPropertyPath(propertyPath)\n if (!column)\n throw new TypeORMError(\n `Column ${propertyPath} was not found in ${metadata.targetName} entity.`,\n )\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 () =>\n this.connection.driver.escape(column.databaseName) +\n \" - \" +\n value,\n )\n\n return this.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 extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): Repository<Entity> {\n // find already created repository instance and return it if found\n const repository = this.repositories.find(\n (repository) => repository.target === target,\n )\n if (repository) return repository\n\n // if repository was not found then create it, store its instance and return it\n if (this.connection.driver.options.type === \"mongodb\") {\n const newRepository = new MongoRepository(\n target,\n this,\n this.queryRunner,\n )\n this.repositories.push(newRepository as any)\n return newRepository\n } else {\n const newRepository = new Repository<any>(\n target,\n this,\n this.queryRunner,\n )\n this.repositories.push(newRepository)\n return newRepository\n }\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 extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): TreeRepository<Entity> {\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 // find already created repository instance and return it if found\n const repository = this.treeRepositories.find(\n (repository) => repository.target === target,\n )\n if (repository) return repository\n\n // check if repository is real tree repository\n const newRepository = new TreeRepository(target, this, this.queryRunner)\n this.treeRepositories.push(newRepository)\n return newRepository\n }\n\n /**\n * Gets mongodb repository for the given entity class.\n */\n getMongoRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): MongoRepository<Entity> {\n return this.connection.getMongoRepository<Entity>(target)\n }\n\n /**\n * Creates a new repository instance out of a given Repository and\n * sets current EntityManager instance to it. Used to work with custom repositories\n * in transactions.\n */\n withRepository<Entity extends ObjectLiteral, R extends Repository<any>>(\n repository: R & Repository<Entity>,\n ): R {\n const repositoryConstructor =\n repository.constructor as typeof Repository\n const { target, manager, queryRunner, ...otherRepositoryProperties } =\n repository\n return Object.assign(\n new repositoryConstructor(repository.target, this) as R,\n {\n ...otherRepositoryProperties,\n },\n )\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n *\n * @deprecated use Repository.extend to create custom repositories\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n const entityRepositoryMetadataArgs =\n getMetadataArgsStorage().entityRepositories.find((repository) => {\n return (\n repository.target ===\n (typeof customRepository === \"function\"\n ? customRepository\n : (customRepository as any).constructor)\n )\n })\n if (!entityRepositoryMetadataArgs)\n throw new CustomRepositoryNotFoundError(customRepository)\n\n const entityMetadata = entityRepositoryMetadataArgs.entity\n ? this.connection.getMetadata(entityRepositoryMetadataArgs.entity)\n : undefined\n const entityRepositoryInstance =\n new (entityRepositoryMetadataArgs.target as any)(\n this,\n entityMetadata,\n )\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 } else {\n if (!entityMetadata)\n throw new CustomRepositoryCannotInheritRepositoryError(\n 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) throw new NoNeedToReleaseEntityManagerError()\n\n return this.queryRunner.release()\n }\n}\n"],"sourceRoot":".."}
@@ -167,4 +167,8 @@ export interface EntitySchemaColumnOptions extends SpatialColumnOptions {
167
167
  * this column when reading or writing to the database.
168
168
  */
169
169
  transformer?: ValueTransformer | ValueTransformer[];
170
+ /**
171
+ * Name of the primary key constraint.
172
+ */
173
+ primaryKeyConstraintName?: string;
170
174
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../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 * 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 * Exact name of enum\n */\n enumName?: string\n\n /**\n * Generated column expression.\n */\n asExpression?: string\n\n /**\n * Generated column type.\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":".."}
1
+ {"version":3,"sources":["../../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 * 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 * Exact name of enum\n */\n enumName?: string\n\n /**\n * Generated column expression.\n */\n asExpression?: string\n\n /**\n * Generated column type.\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 /**\n * Name of the primary key constraint.\n */\n primaryKeyConstraintName?: string\n}\n"],"sourceRoot":".."}
@@ -62,6 +62,7 @@ class EntitySchemaTransformer {
62
62
  options: {
63
63
  type: regularColumn.type,
64
64
  name: regularColumn.objectId ? "_id" : regularColumn.name,
65
+ primaryKeyConstraintName: regularColumn.primaryKeyConstraintName,
65
66
  length: regularColumn.length,
66
67
  width: regularColumn.width,
67
68
  nullable: regularColumn.nullable,