typeorm 0.3.21-dev.bdd7bc8 → 0.3.21-dev.c293bd2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/data-source/DataSource.d.ts +2 -0
- package/browser/data-source/DataSource.js +2 -0
- package/browser/data-source/DataSource.js.map +1 -1
- package/browser/decorator/relations/OneToOne.d.ts +4 -4
- package/browser/decorator/relations/OneToOne.js +2 -2
- package/browser/decorator/relations/OneToOne.js.map +1 -1
- package/browser/driver/aurora-mysql/AuroraMysqlConnectionCredentialsOptions.d.ts +1 -1
- package/browser/driver/aurora-mysql/AuroraMysqlConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachConnectionCredentialsOptions.d.ts +1 -1
- package/browser/driver/cockroachdb/CockroachConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachConnectionOptions.d.ts +1 -1
- package/browser/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
- package/browser/driver/mongodb/MongoConnectionOptions.d.ts +1 -1
- package/browser/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/browser/driver/mysql/MysqlConnectionCredentialsOptions.d.ts +1 -1
- package/browser/driver/mysql/MysqlConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/mysql/MysqlConnectionOptions.d.ts +1 -1
- package/browser/driver/mysql/MysqlConnectionOptions.js.map +1 -1
- package/browser/driver/oracle/OracleConnectionCredentialsOptions.d.ts +1 -1
- package/browser/driver/oracle/OracleConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/oracle/OracleConnectionOptions.d.ts +1 -1
- package/browser/driver/oracle/OracleConnectionOptions.js.map +1 -1
- package/browser/driver/postgres/PostgresConnectionCredentialsOptions.d.ts +1 -1
- package/browser/driver/postgres/PostgresConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/postgres/PostgresConnectionOptions.d.ts +1 -1
- package/browser/driver/postgres/PostgresConnectionOptions.js.map +1 -1
- package/browser/driver/spanner/SpannerConnectionCredentialsOptions.d.ts +1 -1
- package/browser/driver/spanner/SpannerConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/spanner/SpannerConnectionOptions.d.ts +1 -1
- package/browser/driver/spanner/SpannerConnectionOptions.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerConnectionCredentialsOptions.d.ts +1 -1
- package/browser/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerConnectionOptions.d.ts +1 -1
- package/browser/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
- package/browser/entity-manager/EntityManager.d.ts +2 -0
- package/browser/entity-manager/EntityManager.js +4 -2
- package/browser/entity-manager/EntityManager.js.map +1 -1
- package/browser/repository/Repository.d.ts +2 -0
- package/browser/repository/Repository.js +2 -0
- package/browser/repository/Repository.js.map +1 -1
- package/data-source/DataSource.d.ts +2 -0
- package/data-source/DataSource.js +2 -0
- package/data-source/DataSource.js.map +1 -1
- package/decorator/relations/OneToOne.d.ts +4 -4
- package/decorator/relations/OneToOne.js +2 -2
- package/decorator/relations/OneToOne.js.map +1 -1
- package/driver/aurora-mysql/AuroraMysqlConnectionCredentialsOptions.d.ts +1 -1
- package/driver/aurora-mysql/AuroraMysqlConnectionCredentialsOptions.js.map +1 -1
- package/driver/cockroachdb/CockroachConnectionCredentialsOptions.d.ts +1 -1
- package/driver/cockroachdb/CockroachConnectionCredentialsOptions.js.map +1 -1
- package/driver/cockroachdb/CockroachConnectionOptions.d.ts +1 -1
- package/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
- package/driver/mongodb/MongoConnectionOptions.d.ts +1 -1
- package/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/driver/mysql/MysqlConnectionCredentialsOptions.d.ts +1 -1
- package/driver/mysql/MysqlConnectionCredentialsOptions.js.map +1 -1
- package/driver/mysql/MysqlConnectionOptions.d.ts +1 -1
- package/driver/mysql/MysqlConnectionOptions.js.map +1 -1
- package/driver/oracle/OracleConnectionCredentialsOptions.d.ts +1 -1
- package/driver/oracle/OracleConnectionCredentialsOptions.js.map +1 -1
- package/driver/oracle/OracleConnectionOptions.d.ts +1 -1
- package/driver/oracle/OracleConnectionOptions.js.map +1 -1
- package/driver/postgres/PostgresConnectionCredentialsOptions.d.ts +1 -1
- package/driver/postgres/PostgresConnectionCredentialsOptions.js.map +1 -1
- package/driver/postgres/PostgresConnectionOptions.d.ts +1 -1
- package/driver/postgres/PostgresConnectionOptions.js.map +1 -1
- package/driver/spanner/SpannerConnectionCredentialsOptions.d.ts +1 -1
- package/driver/spanner/SpannerConnectionCredentialsOptions.js.map +1 -1
- package/driver/spanner/SpannerConnectionOptions.d.ts +1 -1
- package/driver/spanner/SpannerConnectionOptions.js.map +1 -1
- package/driver/sqlserver/SqlServerConnectionCredentialsOptions.d.ts +1 -1
- package/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
- package/driver/sqlserver/SqlServerConnectionOptions.d.ts +1 -1
- package/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
- package/entity-manager/EntityManager.d.ts +2 -0
- package/entity-manager/EntityManager.js +4 -2
- package/entity-manager/EntityManager.js.map +1 -1
- package/package.json +1 -1
- package/repository/Repository.d.ts +2 -0
- package/repository/Repository.js +2 -0
- package/repository/Repository.js.map +1 -1
|
@@ -93,7 +93,7 @@ export interface SpannerConnectionOptions extends BaseConnectionOptions, Spanner
|
|
|
93
93
|
*/
|
|
94
94
|
readonly master: SpannerConnectionCredentialsOptions;
|
|
95
95
|
/**
|
|
96
|
-
* List of read-from
|
|
96
|
+
* List of read-from servers (slaves).
|
|
97
97
|
*/
|
|
98
98
|
readonly slaves: SpannerConnectionCredentialsOptions[];
|
|
99
99
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/driver/spanner/SpannerConnectionOptions.ts"],"names":[],"mappings":"","file":"SpannerConnectionOptions.js","sourcesContent":["import { BaseConnectionOptions } from \"../../connection/BaseConnectionOptions\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { SpannerConnectionCredentialsOptions } from \"./SpannerConnectionCredentialsOptions\"\n\n/**\n * Spanner specific connection options.\n */\nexport interface SpannerConnectionOptions\n extends BaseConnectionOptions,\n SpannerConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"spanner\"\n\n /**\n * The driver object\n * This defaults to require(\"@google-cloud/spanner\").\n */\n readonly driver?: any\n\n // todo\n readonly database?: string\n\n // todo\n readonly schema?: string\n\n /**\n * The charset for the connection. This is called \"collation\" in the SQL-level of MySQL (like utf8_general_ci).\n * If a SQL-level charset is specified (like utf8mb4) then the default collation for that charset is used.\n * Default: 'UTF8_GENERAL_CI'\n */\n readonly charset?: string\n\n /**\n * The timezone configured on the MySQL server.\n * This is used to type cast server date/time values to JavaScript Date object and vice versa.\n * This can be 'local', 'Z', or an offset in the form +HH:MM or -HH:MM. (Default: 'local')\n */\n readonly timezone?: string\n\n /**\n * The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10000)\n */\n readonly connectTimeout?: number\n\n /**\n * The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10000)\n * This difference between connectTimeout and acquireTimeout is subtle and is described in the mysqljs/mysql docs\n * https://github.com/mysqljs/mysql/tree/master#pool-options\n */\n readonly acquireTimeout?: number\n\n /**\n * Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default: false)\n */\n readonly insecureAuth?: boolean\n\n /**\n * When dealing with big numbers (BIGINT and DECIMAL columns) in the database, you should enable this option (Default: false)\n */\n readonly supportBigNumbers?: boolean\n\n /**\n * Enabling both supportBigNumbers and bigNumberStrings forces big numbers (BIGINT and DECIMAL columns) to be always\n * returned as JavaScript String objects (Default: false). Enabling supportBigNumbers but leaving bigNumberStrings\n * disabled will return big numbers as String objects only when they cannot be accurately represented with\n * [JavaScript Number objects](http://ecma262-5.com/ELS5_HTML.htm#Section_8.5) (which happens when they exceed the [-2^53, +2^53] range),\n * otherwise they will be returned as Number objects. This option is ignored if supportBigNumbers is disabled.\n */\n readonly bigNumberStrings?: boolean\n\n /**\n * Force date types (TIMESTAMP, DATETIME, DATE) to be returned as strings rather then inflated into JavaScript Date objects.\n * Can be true/false or an array of type names to keep as strings.\n */\n readonly dateStrings?: boolean | string[]\n\n /**\n * Prints protocol details to stdout. Can be true/false or an array of packet type names that should be printed.\n * (Default: false)\n */\n readonly debug?: boolean | string[]\n\n /**\n * Generates stack traces on Error to include call site of library entrance (\"long stack traces\").\n * Slight performance penalty for most calls. (Default: true)\n */\n readonly trace?: boolean\n\n /**\n * Allow multiple mysql statements per query. Be careful with this, it could increase the scope of SQL injection attacks.\n * (Default: false)\n */\n readonly multipleStatements?: boolean\n\n /**\n * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.\n * (Default: true)\n */\n readonly legacySpatialSupport?: boolean\n\n /**\n * List of connection flags to use other than the default ones. It is also possible to blacklist default ones.\n * For more information, check https://github.com/mysqljs/mysql#connection-flags.\n */\n readonly flags?: string[]\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: SpannerConnectionCredentialsOptions\n\n /**\n * List of read-from
|
|
1
|
+
{"version":3,"sources":["../browser/src/driver/spanner/SpannerConnectionOptions.ts"],"names":[],"mappings":"","file":"SpannerConnectionOptions.js","sourcesContent":["import { BaseConnectionOptions } from \"../../connection/BaseConnectionOptions\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { SpannerConnectionCredentialsOptions } from \"./SpannerConnectionCredentialsOptions\"\n\n/**\n * Spanner specific connection options.\n */\nexport interface SpannerConnectionOptions\n extends BaseConnectionOptions,\n SpannerConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"spanner\"\n\n /**\n * The driver object\n * This defaults to require(\"@google-cloud/spanner\").\n */\n readonly driver?: any\n\n // todo\n readonly database?: string\n\n // todo\n readonly schema?: string\n\n /**\n * The charset for the connection. This is called \"collation\" in the SQL-level of MySQL (like utf8_general_ci).\n * If a SQL-level charset is specified (like utf8mb4) then the default collation for that charset is used.\n * Default: 'UTF8_GENERAL_CI'\n */\n readonly charset?: string\n\n /**\n * The timezone configured on the MySQL server.\n * This is used to type cast server date/time values to JavaScript Date object and vice versa.\n * This can be 'local', 'Z', or an offset in the form +HH:MM or -HH:MM. (Default: 'local')\n */\n readonly timezone?: string\n\n /**\n * The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10000)\n */\n readonly connectTimeout?: number\n\n /**\n * The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10000)\n * This difference between connectTimeout and acquireTimeout is subtle and is described in the mysqljs/mysql docs\n * https://github.com/mysqljs/mysql/tree/master#pool-options\n */\n readonly acquireTimeout?: number\n\n /**\n * Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default: false)\n */\n readonly insecureAuth?: boolean\n\n /**\n * When dealing with big numbers (BIGINT and DECIMAL columns) in the database, you should enable this option (Default: false)\n */\n readonly supportBigNumbers?: boolean\n\n /**\n * Enabling both supportBigNumbers and bigNumberStrings forces big numbers (BIGINT and DECIMAL columns) to be always\n * returned as JavaScript String objects (Default: false). Enabling supportBigNumbers but leaving bigNumberStrings\n * disabled will return big numbers as String objects only when they cannot be accurately represented with\n * [JavaScript Number objects](http://ecma262-5.com/ELS5_HTML.htm#Section_8.5) (which happens when they exceed the [-2^53, +2^53] range),\n * otherwise they will be returned as Number objects. This option is ignored if supportBigNumbers is disabled.\n */\n readonly bigNumberStrings?: boolean\n\n /**\n * Force date types (TIMESTAMP, DATETIME, DATE) to be returned as strings rather then inflated into JavaScript Date objects.\n * Can be true/false or an array of type names to keep as strings.\n */\n readonly dateStrings?: boolean | string[]\n\n /**\n * Prints protocol details to stdout. Can be true/false or an array of packet type names that should be printed.\n * (Default: false)\n */\n readonly debug?: boolean | string[]\n\n /**\n * Generates stack traces on Error to include call site of library entrance (\"long stack traces\").\n * Slight performance penalty for most calls. (Default: true)\n */\n readonly trace?: boolean\n\n /**\n * Allow multiple mysql statements per query. Be careful with this, it could increase the scope of SQL injection attacks.\n * (Default: false)\n */\n readonly multipleStatements?: boolean\n\n /**\n * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.\n * (Default: true)\n */\n readonly legacySpatialSupport?: boolean\n\n /**\n * List of connection flags to use other than the default ones. It is also possible to blacklist default ones.\n * For more information, check https://github.com/mysqljs/mysql#connection-flags.\n */\n readonly flags?: string[]\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: SpannerConnectionCredentialsOptions\n\n /**\n * List of read-from servers (slaves).\n */\n readonly slaves: SpannerConnectionCredentialsOptions[]\n\n /**\n * If true, PoolCluster will attempt to reconnect when connection fails. (Default: true)\n */\n readonly canRetry?: boolean\n\n /**\n * If connection fails, node's errorCount increases.\n * When errorCount is greater than removeNodeErrorCount, remove a node in the PoolCluster. (Default: 5)\n */\n readonly removeNodeErrorCount?: number\n\n /**\n * If connection fails, specifies the number of milliseconds before another connection attempt will be made.\n * If set to 0, then node will be removed instead and never re-used. (Default: 0)\n */\n readonly restoreNodeTimeout?: number\n\n /**\n * Determines how slaves are selected:\n * RR: Select one alternately (Round-Robin).\n * RANDOM: Select the node by random function.\n * ORDER: Select the first node available unconditionally.\n */\n readonly selector?: \"RR\" | \"RANDOM\" | \"ORDER\"\n\n /**\n * Default connection pool to use for SELECT queries\n * @default \"slave\"\n */\n readonly defaultMode?: ReplicationMode\n }\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
|
|
@@ -12,7 +12,7 @@ export type SqlServerConnectionCredentialsAuthenticationOptions = DefaultAuthent
|
|
|
12
12
|
*/
|
|
13
13
|
export interface SqlServerConnectionCredentialsOptions {
|
|
14
14
|
/**
|
|
15
|
-
* Connection url where
|
|
15
|
+
* Connection url where the connection is performed.
|
|
16
16
|
*/
|
|
17
17
|
readonly url?: string;
|
|
18
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/driver/sqlserver/SqlServerConnectionCredentialsOptions.ts"],"names":[],"mappings":"","file":"SqlServerConnectionCredentialsOptions.js","sourcesContent":["import { DefaultAuthentication } from \"./authentication/DefaultAuthentication\"\nimport { AzureActiveDirectoryAccessTokenAuthentication } from \"./authentication/AzureActiveDirectoryAccessTokenAuthentication\"\nimport { AzureActiveDirectoryDefaultAuthentication } from \"./authentication/AzureActiveDirectoryDefaultAuthentication\"\nimport { AzureActiveDirectoryMsiAppServiceAuthentication } from \"./authentication/AzureActiveDirectoryMsiAppServiceAuthentication\"\nimport { AzureActiveDirectoryMsiVmAuthentication } from \"./authentication/AzureActiveDirectoryMsiVmAuthentication\"\nimport { AzureActiveDirectoryPasswordAuthentication } from \"./authentication/AzureActiveDirectoryPasswordAuthentication\"\nimport { AzureActiveDirectoryServicePrincipalSecret } from \"./authentication/AzureActiveDirectoryServicePrincipalSecret\"\nimport { NtlmAuthentication } from \"./authentication/NtlmAuthentication\"\n\nexport type SqlServerConnectionCredentialsAuthenticationOptions =\n | DefaultAuthentication\n | NtlmAuthentication\n | AzureActiveDirectoryAccessTokenAuthentication\n | AzureActiveDirectoryDefaultAuthentication\n | AzureActiveDirectoryMsiAppServiceAuthentication\n | AzureActiveDirectoryMsiVmAuthentication\n | AzureActiveDirectoryPasswordAuthentication\n | AzureActiveDirectoryServicePrincipalSecret\n\n/**\n * SqlServer specific connection credential options.\n */\nexport interface SqlServerConnectionCredentialsOptions {\n /**\n * Connection url where
|
|
1
|
+
{"version":3,"sources":["../browser/src/driver/sqlserver/SqlServerConnectionCredentialsOptions.ts"],"names":[],"mappings":"","file":"SqlServerConnectionCredentialsOptions.js","sourcesContent":["import { DefaultAuthentication } from \"./authentication/DefaultAuthentication\"\nimport { AzureActiveDirectoryAccessTokenAuthentication } from \"./authentication/AzureActiveDirectoryAccessTokenAuthentication\"\nimport { AzureActiveDirectoryDefaultAuthentication } from \"./authentication/AzureActiveDirectoryDefaultAuthentication\"\nimport { AzureActiveDirectoryMsiAppServiceAuthentication } from \"./authentication/AzureActiveDirectoryMsiAppServiceAuthentication\"\nimport { AzureActiveDirectoryMsiVmAuthentication } from \"./authentication/AzureActiveDirectoryMsiVmAuthentication\"\nimport { AzureActiveDirectoryPasswordAuthentication } from \"./authentication/AzureActiveDirectoryPasswordAuthentication\"\nimport { AzureActiveDirectoryServicePrincipalSecret } from \"./authentication/AzureActiveDirectoryServicePrincipalSecret\"\nimport { NtlmAuthentication } from \"./authentication/NtlmAuthentication\"\n\nexport type SqlServerConnectionCredentialsAuthenticationOptions =\n | DefaultAuthentication\n | NtlmAuthentication\n | AzureActiveDirectoryAccessTokenAuthentication\n | AzureActiveDirectoryDefaultAuthentication\n | AzureActiveDirectoryMsiAppServiceAuthentication\n | AzureActiveDirectoryMsiVmAuthentication\n | AzureActiveDirectoryPasswordAuthentication\n | AzureActiveDirectoryServicePrincipalSecret\n\n/**\n * SqlServer specific connection credential options.\n */\nexport interface SqlServerConnectionCredentialsOptions {\n /**\n * Connection url where the connection is performed.\n */\n readonly url?: string\n\n /**\n * Database host.\n */\n readonly host?: string\n\n /**\n * Database host port.\n */\n readonly port?: number\n\n /**\n * Database name to connect to.\n */\n readonly database?: string\n\n /**\n * Database username.\n */\n readonly username?: string\n\n /**\n * Database password.\n */\n readonly password?: string\n\n /**\n * Authentication settings\n * It overrides username and password, when passed.\n */\n readonly authentication?: SqlServerConnectionCredentialsAuthenticationOptions\n\n /**\n * Once you set domain, driver will connect to SQL Server using domain login.\n * @see SqlServerConnectionCredentialsOptions.authentication\n * @see NtlmAuthentication\n * @deprecated\n */\n readonly domain?: string\n}\n"],"sourceRoot":"../.."}
|
|
@@ -239,7 +239,7 @@ export interface SqlServerConnectionOptions extends BaseDataSourceOptions, SqlSe
|
|
|
239
239
|
*/
|
|
240
240
|
readonly master: SqlServerConnectionCredentialsOptions;
|
|
241
241
|
/**
|
|
242
|
-
* List of read-from
|
|
242
|
+
* List of read-from servers (slaves).
|
|
243
243
|
*/
|
|
244
244
|
readonly slaves: SqlServerConnectionCredentialsOptions[];
|
|
245
245
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/driver/sqlserver/SqlServerConnectionOptions.ts"],"names":[],"mappings":"","file":"SqlServerConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { SqlServerConnectionCredentialsOptions } from \"./SqlServerConnectionCredentialsOptions\"\n\n/**\n * Microsoft Sql Server specific connection options.\n */\nexport interface SqlServerConnectionOptions\n extends BaseDataSourceOptions,\n SqlServerConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"mssql\"\n\n /**\n * Connection timeout in ms (default: 15000).\n */\n readonly connectionTimeout?: number\n\n /**\n * Request timeout in ms (default: 15000). NOTE: msnodesqlv8 driver doesn't support timeouts < 1 second.\n */\n readonly requestTimeout?: number\n\n /**\n * Stream recordsets/rows instead of returning them all at once as an argument of callback (default: false).\n * You can also enable streaming for each request independently (request.stream = true).\n * Always set to true if you plan to work with large amount of rows.\n */\n readonly stream?: boolean\n\n /**\n * Database schema.\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to `require(\"mssql\")`\n */\n readonly driver?: any\n\n /**\n * An optional object/dictionary with the any of the properties\n */\n readonly pool?: {\n /**\n * Maximum number of resources to create at any given time. (default=1)\n */\n readonly max?: number\n\n /**\n * Minimum number of resources to keep in pool at any given time. If this is set >= max, the pool will silently\n * set the min to equal max. (default=0)\n */\n readonly min?: number\n\n /**\n * Maximum number of queued requests allowed, additional acquire calls will be callback with an err in a future\n * cycle of the event loop.\n */\n readonly maxWaitingClients?: number\n\n /**\n * Max milliseconds an acquire call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer.\n */\n readonly acquireTimeoutMillis?: number\n\n /**\n * If true the oldest resources will be first to be allocated. If false the most recently released resources will\n * be the first to be allocated. This in effect turns the pool's behaviour from a queue into a stack. boolean,\n * (default true)\n */\n readonly fifo?: boolean\n\n /**\n * Int between 1 and x - if set, borrowers can specify their relative priority in the queue if no resources\n * are available. see example. (default 1)\n */\n readonly priorityRange?: number\n\n /**\n * How often to run eviction checks. Default: 0 (does not run).\n */\n readonly evictionRunIntervalMillis?: number\n\n /**\n * Number of resources to check each eviction run. Default: 3.\n */\n readonly numTestsPerRun?: number\n\n /**\n * Amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object\n * evictor (if any), with the extra condition that at least \"min idle\" object instances remain in the pool.\n * Default -1 (nothing can get evicted)\n */\n readonly softIdleTimeoutMillis?: number\n\n /**\n * The minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due\n * to idle time. Supercedes softIdleTimeoutMillis Default: 30000\n */\n readonly idleTimeoutMillis?: number\n\n /*\n * Function handling errors thrown by drivers pool.\n * Defaults to logging error with `warn` level.\n */\n readonly errorHandler?: (err: any) => any\n }\n\n /**\n * Extra options\n */\n readonly options?: {\n /**\n * The named instance to connect to\n */\n readonly instanceName?: string\n\n /**\n * By default, if the database requestion by options.database cannot be accessed, the connection will fail with\n * an error. However, if options.fallbackToDefaultDb is set to true, then the user's default database will\n * be used instead (Default: false).\n */\n readonly fallbackToDefaultDb?: boolean\n\n /**\n * If true, SET ANSI_NULL_DFLT_ON ON will be set in the initial sql. This means new columns will be nullable by\n * default. See the T-SQL documentation for more details. (Default: true).\n */\n readonly enableAnsiNullDefault?: boolean\n\n /**\n * The number of milliseconds before the attempt to connect is considered failed (default: 15000).\n */\n readonly connectTimeout?: number\n\n /**\n * The number of milliseconds before the cancel (abort) of a request is considered failed (default: 5000).\n */\n readonly cancelTimeout?: number\n\n /**\n * The size of TDS packets (subject to negotiation with the server). Should be a power of 2. (default: 4096).\n */\n readonly packetSize?: number\n\n /**\n * A boolean determining whether to pass time values in UTC or local time. (default: false).\n */\n readonly useUTC?: boolean\n\n /**\n * A boolean determining whether to rollback a transaction automatically if any error is encountered during\n * the given transaction's execution. This sets the value for SET XACT_ABORT during the initial SQL phase\n * of a connection (documentation).\n */\n readonly abortTransactionOnError?: boolean\n\n /**\n * A string indicating which network interface (ip address) to use when connecting to SQL Server.\n */\n readonly localAddress?: string\n\n /**\n * A boolean determining whether to return rows as arrays or key-value collections. (default: false).\n */\n readonly useColumnNames?: boolean\n\n /**\n * A boolean, controlling whether the column names returned will have the first letter converted to lower case\n * (true) or not. This value is ignored if you provide a columnNameReplacer. (default: false).\n */\n readonly camelCaseColumns?: boolean\n\n /**\n * A boolean, controlling whatever to disable RETURNING / OUTPUT statements.\n */\n readonly disableOutputReturning?: boolean\n\n /**\n * A boolean, controlling whether MssqlParameter types char, varchar, and text are converted to their unicode equivalents, nchar, nvarchar, and ntext.\n * (default: false, meaning that char/varchar/text parameters will be converted to nchar/nvarchar/ntext)\n */\n readonly disableAsciiToUnicodeParamConversion?: boolean\n\n /**\n * Debug options\n */\n readonly debug?: {\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet details\n * (default: false).\n */\n readonly packet?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet data details\n * (default: false).\n */\n readonly data?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet payload details\n * (default: false).\n */\n readonly payload?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing token stream tokens\n * (default: false).\n */\n readonly token?: boolean\n }\n\n /**\n * The default isolation level that transactions will be run with. The isolation levels are available\n * from require('tedious').ISOLATION_LEVEL. (default: READ_COMMITTED).\n */\n readonly isolation?:\n | \"READ_UNCOMMITTED\"\n | \"READ_COMMITTED\"\n | \"REPEATABLE_READ\"\n | \"SERIALIZABLE\"\n | \"SNAPSHOT\"\n\n /**\n * The default isolation level for new connections. All out-of-transaction queries are executed with this\n * setting. The isolation levels are available from require('tedious').ISOLATION_LEVEL .\n */\n readonly connectionIsolationLevel?:\n | \"READ_UNCOMMITTED\"\n | \"READ_COMMITTED\"\n | \"REPEATABLE_READ\"\n | \"SERIALIZABLE\"\n | \"SNAPSHOT\"\n\n /**\n * A boolean, determining whether the connection will request read only access from a SQL Server\n * Availability Group. For more information, see here. (default: false).\n */\n readonly readOnlyIntent?: boolean\n\n /**\n * A boolean determining whether or not the connection will be encrypted. Set to true if you're on\n * Windows Azure. (default: true).\n */\n readonly encrypt?: boolean\n\n /**\n * When encryption is used, an object may be supplied that will be used for the first argument when calling\n * tls.createSecurePair (default: {}).\n */\n readonly cryptoCredentialsDetails?: any\n\n /**\n * A boolean, that when true will expose received rows in Requests' done* events. See done, doneInProc and\n * doneProc. (default: false)\n * Caution: If many row are received, enabling this option could result in excessive memory usage.\n */\n readonly rowCollectionOnDone?: boolean\n\n /**\n * A boolean, that when true will expose received rows in Requests' completion callback. See new Request. (default: false)\n * Caution: If many row are received, enabling this option could result in excessive memory usage.\n */\n readonly rowCollectionOnRequestCompletion?: boolean\n\n /**\n * The version of TDS to use. If server doesn't support specified version, negotiated version is used instead.\n * The versions are available from require('tedious').TDS_VERSION. (default: 7_4).\n */\n readonly tdsVersion?: string\n\n /**\n * A boolean, that when true will abort a query when an overflow or divide-by-zero error occurs during query execution.\n */\n readonly enableArithAbort?: boolean\n\n /**\n * Application name used for identifying a specific application in profiling, logging or tracing tools of SQL Server.\n * (default: node-mssql)\n */\n readonly appName?: string\n\n /**\n * A boolean, controlling whether encryption occurs if there is no verifiable server certificate.\n * (default: false)\n */\n readonly trustServerCertificate?: boolean\n }\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: SqlServerConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: SqlServerConnectionCredentialsOptions[]\n\n /**\n * Default connection pool to use for SELECT queries\n * @default \"slave\"\n */\n readonly defaultMode?: ReplicationMode\n }\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/driver/sqlserver/SqlServerConnectionOptions.ts"],"names":[],"mappings":"","file":"SqlServerConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { SqlServerConnectionCredentialsOptions } from \"./SqlServerConnectionCredentialsOptions\"\n\n/**\n * Microsoft Sql Server specific connection options.\n */\nexport interface SqlServerConnectionOptions\n extends BaseDataSourceOptions,\n SqlServerConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"mssql\"\n\n /**\n * Connection timeout in ms (default: 15000).\n */\n readonly connectionTimeout?: number\n\n /**\n * Request timeout in ms (default: 15000). NOTE: msnodesqlv8 driver doesn't support timeouts < 1 second.\n */\n readonly requestTimeout?: number\n\n /**\n * Stream recordsets/rows instead of returning them all at once as an argument of callback (default: false).\n * You can also enable streaming for each request independently (request.stream = true).\n * Always set to true if you plan to work with large amount of rows.\n */\n readonly stream?: boolean\n\n /**\n * Database schema.\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to `require(\"mssql\")`\n */\n readonly driver?: any\n\n /**\n * An optional object/dictionary with the any of the properties\n */\n readonly pool?: {\n /**\n * Maximum number of resources to create at any given time. (default=1)\n */\n readonly max?: number\n\n /**\n * Minimum number of resources to keep in pool at any given time. If this is set >= max, the pool will silently\n * set the min to equal max. (default=0)\n */\n readonly min?: number\n\n /**\n * Maximum number of queued requests allowed, additional acquire calls will be callback with an err in a future\n * cycle of the event loop.\n */\n readonly maxWaitingClients?: number\n\n /**\n * Max milliseconds an acquire call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer.\n */\n readonly acquireTimeoutMillis?: number\n\n /**\n * If true the oldest resources will be first to be allocated. If false the most recently released resources will\n * be the first to be allocated. This in effect turns the pool's behaviour from a queue into a stack. boolean,\n * (default true)\n */\n readonly fifo?: boolean\n\n /**\n * Int between 1 and x - if set, borrowers can specify their relative priority in the queue if no resources\n * are available. see example. (default 1)\n */\n readonly priorityRange?: number\n\n /**\n * How often to run eviction checks. Default: 0 (does not run).\n */\n readonly evictionRunIntervalMillis?: number\n\n /**\n * Number of resources to check each eviction run. Default: 3.\n */\n readonly numTestsPerRun?: number\n\n /**\n * Amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object\n * evictor (if any), with the extra condition that at least \"min idle\" object instances remain in the pool.\n * Default -1 (nothing can get evicted)\n */\n readonly softIdleTimeoutMillis?: number\n\n /**\n * The minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due\n * to idle time. Supercedes softIdleTimeoutMillis Default: 30000\n */\n readonly idleTimeoutMillis?: number\n\n /*\n * Function handling errors thrown by drivers pool.\n * Defaults to logging error with `warn` level.\n */\n readonly errorHandler?: (err: any) => any\n }\n\n /**\n * Extra options\n */\n readonly options?: {\n /**\n * The named instance to connect to\n */\n readonly instanceName?: string\n\n /**\n * By default, if the database requestion by options.database cannot be accessed, the connection will fail with\n * an error. However, if options.fallbackToDefaultDb is set to true, then the user's default database will\n * be used instead (Default: false).\n */\n readonly fallbackToDefaultDb?: boolean\n\n /**\n * If true, SET ANSI_NULL_DFLT_ON ON will be set in the initial sql. This means new columns will be nullable by\n * default. See the T-SQL documentation for more details. (Default: true).\n */\n readonly enableAnsiNullDefault?: boolean\n\n /**\n * The number of milliseconds before the attempt to connect is considered failed (default: 15000).\n */\n readonly connectTimeout?: number\n\n /**\n * The number of milliseconds before the cancel (abort) of a request is considered failed (default: 5000).\n */\n readonly cancelTimeout?: number\n\n /**\n * The size of TDS packets (subject to negotiation with the server). Should be a power of 2. (default: 4096).\n */\n readonly packetSize?: number\n\n /**\n * A boolean determining whether to pass time values in UTC or local time. (default: false).\n */\n readonly useUTC?: boolean\n\n /**\n * A boolean determining whether to rollback a transaction automatically if any error is encountered during\n * the given transaction's execution. This sets the value for SET XACT_ABORT during the initial SQL phase\n * of a connection (documentation).\n */\n readonly abortTransactionOnError?: boolean\n\n /**\n * A string indicating which network interface (ip address) to use when connecting to SQL Server.\n */\n readonly localAddress?: string\n\n /**\n * A boolean determining whether to return rows as arrays or key-value collections. (default: false).\n */\n readonly useColumnNames?: boolean\n\n /**\n * A boolean, controlling whether the column names returned will have the first letter converted to lower case\n * (true) or not. This value is ignored if you provide a columnNameReplacer. (default: false).\n */\n readonly camelCaseColumns?: boolean\n\n /**\n * A boolean, controlling whatever to disable RETURNING / OUTPUT statements.\n */\n readonly disableOutputReturning?: boolean\n\n /**\n * A boolean, controlling whether MssqlParameter types char, varchar, and text are converted to their unicode equivalents, nchar, nvarchar, and ntext.\n * (default: false, meaning that char/varchar/text parameters will be converted to nchar/nvarchar/ntext)\n */\n readonly disableAsciiToUnicodeParamConversion?: boolean\n\n /**\n * Debug options\n */\n readonly debug?: {\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet details\n * (default: false).\n */\n readonly packet?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet data details\n * (default: false).\n */\n readonly data?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet payload details\n * (default: false).\n */\n readonly payload?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing token stream tokens\n * (default: false).\n */\n readonly token?: boolean\n }\n\n /**\n * The default isolation level that transactions will be run with. The isolation levels are available\n * from require('tedious').ISOLATION_LEVEL. (default: READ_COMMITTED).\n */\n readonly isolation?:\n | \"READ_UNCOMMITTED\"\n | \"READ_COMMITTED\"\n | \"REPEATABLE_READ\"\n | \"SERIALIZABLE\"\n | \"SNAPSHOT\"\n\n /**\n * The default isolation level for new connections. All out-of-transaction queries are executed with this\n * setting. The isolation levels are available from require('tedious').ISOLATION_LEVEL .\n */\n readonly connectionIsolationLevel?:\n | \"READ_UNCOMMITTED\"\n | \"READ_COMMITTED\"\n | \"REPEATABLE_READ\"\n | \"SERIALIZABLE\"\n | \"SNAPSHOT\"\n\n /**\n * A boolean, determining whether the connection will request read only access from a SQL Server\n * Availability Group. For more information, see here. (default: false).\n */\n readonly readOnlyIntent?: boolean\n\n /**\n * A boolean determining whether or not the connection will be encrypted. Set to true if you're on\n * Windows Azure. (default: true).\n */\n readonly encrypt?: boolean\n\n /**\n * When encryption is used, an object may be supplied that will be used for the first argument when calling\n * tls.createSecurePair (default: {}).\n */\n readonly cryptoCredentialsDetails?: any\n\n /**\n * A boolean, that when true will expose received rows in Requests' done* events. See done, doneInProc and\n * doneProc. (default: false)\n * Caution: If many row are received, enabling this option could result in excessive memory usage.\n */\n readonly rowCollectionOnDone?: boolean\n\n /**\n * A boolean, that when true will expose received rows in Requests' completion callback. See new Request. (default: false)\n * Caution: If many row are received, enabling this option could result in excessive memory usage.\n */\n readonly rowCollectionOnRequestCompletion?: boolean\n\n /**\n * The version of TDS to use. If server doesn't support specified version, negotiated version is used instead.\n * The versions are available from require('tedious').TDS_VERSION. (default: 7_4).\n */\n readonly tdsVersion?: string\n\n /**\n * A boolean, that when true will abort a query when an overflow or divide-by-zero error occurs during query execution.\n */\n readonly enableArithAbort?: boolean\n\n /**\n * Application name used for identifying a specific application in profiling, logging or tracing tools of SQL Server.\n * (default: node-mssql)\n */\n readonly appName?: string\n\n /**\n * A boolean, controlling whether encryption occurs if there is no verifiable server certificate.\n * (default: false)\n */\n readonly trustServerCertificate?: boolean\n }\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: SqlServerConnectionCredentialsOptions\n\n /**\n * List of read-from servers (slaves).\n */\n readonly slaves: SqlServerConnectionCredentialsOptions[]\n\n /**\n * Default connection pool to use for SELECT queries\n * @default \"slave\"\n */\n readonly defaultMode?: ReplicationMode\n }\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
|
|
@@ -63,6 +63,8 @@ export declare class EntityManager {
|
|
|
63
63
|
transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;
|
|
64
64
|
/**
|
|
65
65
|
* Executes raw SQL query and returns raw database results.
|
|
66
|
+
*
|
|
67
|
+
* @see [Official docs](https://typeorm.io/entity-manager-api) for examples.
|
|
66
68
|
*/
|
|
67
69
|
query<T = any>(query: string, parameters?: any[]): Promise<T>;
|
|
68
70
|
/**
|
|
@@ -87,6 +87,8 @@ export class EntityManager {
|
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Executes raw SQL query and returns raw database results.
|
|
90
|
+
*
|
|
91
|
+
* @see [Official docs](https://typeorm.io/entity-manager-api) for examples.
|
|
90
92
|
*/
|
|
91
93
|
async query(query, parameters) {
|
|
92
94
|
return this.connection.query(query, parameters, this.queryRunner);
|
|
@@ -690,7 +692,7 @@ export class EntityManager {
|
|
|
690
692
|
throw new TypeORMError(`Column ${propertyPath} was not found in ${metadata.targetName} entity.`);
|
|
691
693
|
if (isNaN(Number(value)))
|
|
692
694
|
throw new TypeORMError(`Value "${value}" is not a number.`);
|
|
693
|
-
// convert possible
|
|
695
|
+
// convert possible embedded path "social.likes" into object { social: { like: () => value } }
|
|
694
696
|
const values = propertyPath
|
|
695
697
|
.split(".")
|
|
696
698
|
.reduceRight((value, key) => ({ [key]: value }), () => this.connection.driver.escape(column.databaseName) +
|
|
@@ -712,7 +714,7 @@ export class EntityManager {
|
|
|
712
714
|
throw new TypeORMError(`Column ${propertyPath} was not found in ${metadata.targetName} entity.`);
|
|
713
715
|
if (isNaN(Number(value)))
|
|
714
716
|
throw new TypeORMError(`Value "${value}" is not a number.`);
|
|
715
|
-
// convert possible
|
|
717
|
+
// convert possible embedded path "social.likes" into object { social: { like: () => value } }
|
|
716
718
|
const values = propertyPath
|
|
717
719
|
.split(".")
|
|
718
720
|
.reduceRight((value, key) => ({ [key]: value }), () => this.connection.driver.escape(column.databaseName) +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/entity-manager/EntityManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAA;AAK1G,OAAO,EAAE,iCA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AC,SAAS,CAAC,GAAG,IAAI,CAAA;QAC3D,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,cAAc;gBACf,MAAM,IAAI,4CAA4C,CAClD,gBAAgB,CACnB,CACJ;YAAC,wBAAgC,CAAC,SAAS,CAAC,GAAG,IAAI,CACnD;YAAC,wBAAgC,CAAC,UAAU,CAAC,GAAG,cAAc,CAAA;QACnE,CAAC;QAED,OAAO,wBAAwB,CAAA;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,iCAAiC,EAAE,CAAA;QAEpE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;CACJ","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\"\nimport { PickKeysByType } from \"../common/PickKeysByType\"\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 * Created as a future replacement for the #repositories to provide a bit more perf optimization.\n */\n protected repositories = new Map<EntityTarget<any>, 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<T = any>(query: string, parameters?: any[]): Promise<T> {\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, EntityLike extends DeepPartial<Entity>>(\n entityClass: EntityTarget<Entity>,\n plainObject?: EntityLike,\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, EntityLike extends DeepPartial<Entity>>(\n entityClass: EntityTarget<Entity>,\n plainObjects?: EntityLike[],\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, EntityLike extends DeepPartial<Entity>>(\n entityClass: EntityTarget<Entity>,\n plainObjectOrObjects?: EntityLike | EntityLike[],\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 EntityLike[]).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 Array.isArray(options.conflictPaths)\n ? options.conflictPaths\n : Object.keys(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 indexPredicate: options.indexPredicate,\n upsertType:\n options.upsertType ||\n this.connection.driver.supportedUpsertTypes[0],\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 * Checks whether any entity exists with the given options.\n */\n exists<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n options?: FindManyOptions<Entity>,\n ): Promise<boolean> {\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 .getExists()\n }\n\n /**\n * Checks whether any entity exists with the given conditions.\n */\n async existsBy<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<boolean> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder(entityClass, metadata.name)\n .setFindOptions({ where })\n .getExists()\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 * Return the SUM of a column\n */\n sum<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n columnName: PickKeysByType<Entity, number>,\n where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number | null> {\n return this.callAggregateFun(entityClass, \"SUM\", columnName, where)\n }\n\n /**\n * Return the AVG of a column\n */\n average<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n columnName: PickKeysByType<Entity, number>,\n where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number | null> {\n return this.callAggregateFun(entityClass, \"AVG\", columnName, where)\n }\n\n /**\n * Return the MIN of a column\n */\n minimum<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n columnName: PickKeysByType<Entity, number>,\n where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number | null> {\n return this.callAggregateFun(entityClass, \"MIN\", columnName, where)\n }\n\n /**\n * Return the MAX of a column\n */\n maximum<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n columnName: PickKeysByType<Entity, number>,\n where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number | null> {\n return this.callAggregateFun(entityClass, \"MAX\", columnName, where)\n }\n\n private async callAggregateFun<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n fnName: \"SUM\" | \"AVG\" | \"MIN\" | \"MAX\",\n columnName: PickKeysByType<Entity, number>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[] = {},\n ): Promise<number | null> {\n const metadata = this.connection.getMetadata(entityClass)\n const column = metadata.columns.find(\n (item) => item.propertyPath === columnName,\n )\n if (!column) {\n throw new TypeORMError(\n `Column \"${columnName}\" was not found in table \"${metadata.name}\"`,\n )\n }\n\n const result = await this.createQueryBuilder(entityClass, metadata.name)\n .setFindOptions({ where })\n .select(\n `${fnName}(${this.connection.driver.escape(\n column.databaseName,\n )})`,\n fnName,\n )\n .getRawOne()\n return result[fnName] === null ? null : parseFloat(result[fnName])\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 repoFromMap = this.repositories.get(target)\n if (repoFromMap) return repoFromMap\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.set(target, newRepository)\n return newRepository\n } else {\n const newRepository = new Repository<any>(\n target,\n this,\n this.queryRunner,\n )\n this.repositories.set(target, 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":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/entity-manager/EntityManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAA;AAK1G,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAA;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,gEAAgE,CAAA;AAClH,OAAO,EAAE,sCAAsC,EAAE,MAAM,qEAAqE,CAAA;AAC5H,OAAO,EACH,4CAA4C,EAC5C,6BAA6B,EAC7B,+BAA+B,EAC/B,YAAY,GACf,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAIrE,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ataSource } 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\"\nimport { PickKeysByType } from \"../common/PickKeysByType\"\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 * Created as a future replacement for the #repositories to provide a bit more perf optimization.\n */\n protected repositories = new Map<EntityTarget<any>, 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 * @see [Official docs](https://typeorm.io/entity-manager-api) for examples.\n */\n async query<T = any>(query: string, parameters?: any[]): Promise<T> {\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, EntityLike extends DeepPartial<Entity>>(\n entityClass: EntityTarget<Entity>,\n plainObject?: EntityLike,\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, EntityLike extends DeepPartial<Entity>>(\n entityClass: EntityTarget<Entity>,\n plainObjects?: EntityLike[],\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, EntityLike extends DeepPartial<Entity>>(\n entityClass: EntityTarget<Entity>,\n plainObjectOrObjects?: EntityLike | EntityLike[],\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 EntityLike[]).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 Array.isArray(options.conflictPaths)\n ? options.conflictPaths\n : Object.keys(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 indexPredicate: options.indexPredicate,\n upsertType:\n options.upsertType ||\n this.connection.driver.supportedUpsertTypes[0],\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 * Checks whether any entity exists with the given options.\n */\n exists<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n options?: FindManyOptions<Entity>,\n ): Promise<boolean> {\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 .getExists()\n }\n\n /**\n * Checks whether any entity exists with the given conditions.\n */\n async existsBy<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<boolean> {\n const metadata = this.connection.getMetadata(entityClass)\n return this.createQueryBuilder(entityClass, metadata.name)\n .setFindOptions({ where })\n .getExists()\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 * Return the SUM of a column\n */\n sum<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n columnName: PickKeysByType<Entity, number>,\n where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number | null> {\n return this.callAggregateFun(entityClass, \"SUM\", columnName, where)\n }\n\n /**\n * Return the AVG of a column\n */\n average<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n columnName: PickKeysByType<Entity, number>,\n where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number | null> {\n return this.callAggregateFun(entityClass, \"AVG\", columnName, where)\n }\n\n /**\n * Return the MIN of a column\n */\n minimum<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n columnName: PickKeysByType<Entity, number>,\n where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number | null> {\n return this.callAggregateFun(entityClass, \"MIN\", columnName, where)\n }\n\n /**\n * Return the MAX of a column\n */\n maximum<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n columnName: PickKeysByType<Entity, number>,\n where?: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[],\n ): Promise<number | null> {\n return this.callAggregateFun(entityClass, \"MAX\", columnName, where)\n }\n\n private async callAggregateFun<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n fnName: \"SUM\" | \"AVG\" | \"MIN\" | \"MAX\",\n columnName: PickKeysByType<Entity, number>,\n where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[] = {},\n ): Promise<number | null> {\n const metadata = this.connection.getMetadata(entityClass)\n const column = metadata.columns.find(\n (item) => item.propertyPath === columnName,\n )\n if (!column) {\n throw new TypeORMError(\n `Column \"${columnName}\" was not found in table \"${metadata.name}\"`,\n )\n }\n\n const result = await this.createQueryBuilder(entityClass, metadata.name)\n .setFindOptions({ where })\n .select(\n `${fnName}(${this.connection.driver.escape(\n column.databaseName,\n )})`,\n fnName,\n )\n .getRawOne()\n return result[fnName] === null ? null : parseFloat(result[fnName])\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 embedded 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 embedded 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 repoFromMap = this.repositories.get(target)\n if (repoFromMap) return repoFromMap\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.set(target, newRepository)\n return newRepository\n } else {\n const newRepository = new Repository<any>(\n target,\n this,\n this.queryRunner,\n )\n this.repositories.set(target, 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":".."}
|
|
@@ -300,6 +300,8 @@ export declare class Repository<Entity extends ObjectLiteral> {
|
|
|
300
300
|
/**
|
|
301
301
|
* Executes a raw SQL query and returns a raw database results.
|
|
302
302
|
* Raw query execution is supported only by relational databases (MongoDB is not supported).
|
|
303
|
+
*
|
|
304
|
+
* @see [Official docs](https://typeorm.io/repository-api) for examples.
|
|
303
305
|
*/
|
|
304
306
|
query(query: string, parameters?: any[]): Promise<any>;
|
|
305
307
|
/**
|
|
@@ -288,6 +288,8 @@ export class Repository {
|
|
|
288
288
|
/**
|
|
289
289
|
* Executes a raw SQL query and returns a raw database results.
|
|
290
290
|
* Raw query execution is supported only by relational databases (MongoDB is not supported).
|
|
291
|
+
*
|
|
292
|
+
* @see [Official docs](https://typeorm.io/repository-api) for examples.
|
|
291
293
|
*/
|
|
292
294
|
query(query, parameters) {
|
|
293
295
|
return this.manager.query(query, parameters);
|