typeorm 0.3.3-dev.f010205 → 0.3.3
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/cli-ts-node-commonjs.js +0 -0
- package/browser/cli-ts-node-esm.js +0 -0
- package/browser/data-source/DataSource.js +12 -4
- package/browser/data-source/DataSource.js.map +1 -1
- package/browser/driver/Driver.d.ts +2 -0
- package/browser/driver/Driver.js.map +1 -1
- package/browser/driver/aurora-mysql/AuroraMysqlDriver.d.ts +2 -0
- package/browser/driver/aurora-mysql/AuroraMysqlDriver.js +3 -0
- package/browser/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachDriver.d.ts +2 -0
- package/browser/driver/cockroachdb/CockroachDriver.js +6 -0
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/mongodb/MongoDriver.d.ts +2 -0
- package/browser/driver/mongodb/MongoDriver.js +3 -0
- package/browser/driver/mongodb/MongoDriver.js.map +1 -1
- package/browser/driver/mysql/MysqlDriver.d.ts +2 -0
- package/browser/driver/mysql/MysqlDriver.js +14 -2
- package/browser/driver/mysql/MysqlDriver.js.map +1 -1
- package/browser/driver/oracle/OracleDriver.d.ts +2 -0
- package/browser/driver/oracle/OracleDriver.js +3 -0
- package/browser/driver/oracle/OracleDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresDriver.d.ts +2 -0
- package/browser/driver/postgres/PostgresDriver.js +6 -0
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/sap/SapDriver.d.ts +2 -0
- package/browser/driver/sap/SapDriver.js +3 -0
- package/browser/driver/sap/SapDriver.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +2 -0
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +4 -0
- package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/browser/driver/sqlserver/SqlServerDriver.d.ts +2 -0
- package/browser/driver/sqlserver/SqlServerDriver.js +5 -0
- package/browser/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/browser/driver/types/CteCapabilities.d.ts +18 -0
- package/browser/driver/types/CteCapabilities.js +3 -0
- package/browser/driver/types/CteCapabilities.js.map +1 -0
- package/browser/query-builder/DeleteQueryBuilder.js +1 -0
- package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.js +1 -0
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/query-builder/QueryBuilder.d.ts +7 -0
- package/browser/query-builder/QueryBuilder.js +64 -0
- package/browser/query-builder/QueryBuilder.js.map +1 -1
- package/browser/query-builder/QueryBuilderCte.d.ts +17 -0
- package/browser/query-builder/QueryBuilderCte.js +3 -0
- package/browser/query-builder/QueryBuilderCte.js.map +1 -0
- package/browser/query-builder/QueryExpressionMap.d.ts +7 -0
- package/browser/query-builder/QueryExpressionMap.js +8 -0
- package/browser/query-builder/QueryExpressionMap.js.map +1 -1
- package/browser/query-builder/SelectQueryBuilder.js +1 -0
- package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
- package/browser/query-builder/SoftDeleteQueryBuilder.js +1 -0
- package/browser/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/browser/query-builder/UpdateQueryBuilder.js +1 -0
- package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/browser/repository/BaseEntity.d.ts +2 -2
- package/browser/repository/BaseEntity.js.map +1 -1
- package/browser/repository/Repository.js +1 -4
- package/browser/repository/Repository.js.map +1 -1
- package/browser/repository/TreeRepository.js +1 -4
- package/browser/repository/TreeRepository.js.map +1 -1
- package/cli-ts-node-commonjs.js +0 -0
- package/cli-ts-node-esm.js +0 -0
- package/cli.js +0 -0
- package/data-source/DataSource.js +12 -4
- package/data-source/DataSource.js.map +1 -1
- package/driver/Driver.d.ts +2 -0
- package/driver/Driver.js.map +1 -1
- package/driver/aurora-mysql/AuroraMysqlDriver.d.ts +2 -0
- package/driver/aurora-mysql/AuroraMysqlDriver.js +3 -0
- package/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
- package/driver/cockroachdb/CockroachDriver.d.ts +2 -0
- package/driver/cockroachdb/CockroachDriver.js +6 -0
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/mongodb/MongoDriver.d.ts +2 -0
- package/driver/mongodb/MongoDriver.js +3 -0
- package/driver/mongodb/MongoDriver.js.map +1 -1
- package/driver/mysql/MysqlDriver.d.ts +2 -0
- package/driver/mysql/MysqlDriver.js +14 -2
- package/driver/mysql/MysqlDriver.js.map +1 -1
- package/driver/oracle/OracleDriver.d.ts +2 -0
- package/driver/oracle/OracleDriver.js +3 -0
- package/driver/oracle/OracleDriver.js.map +1 -1
- package/driver/postgres/PostgresDriver.d.ts +2 -0
- package/driver/postgres/PostgresDriver.js +6 -0
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/sap/SapDriver.d.ts +2 -0
- package/driver/sap/SapDriver.js +3 -0
- package/driver/sap/SapDriver.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +2 -0
- package/driver/sqlite-abstract/AbstractSqliteDriver.js +4 -0
- package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
- package/driver/sqlserver/SqlServerDriver.d.ts +2 -0
- package/driver/sqlserver/SqlServerDriver.js +5 -0
- package/driver/sqlserver/SqlServerDriver.js.map +1 -1
- package/driver/types/CteCapabilities.d.ts +18 -0
- package/driver/types/CteCapabilities.js +4 -0
- package/driver/types/CteCapabilities.js.map +1 -0
- package/package.json +261 -1
- package/query-builder/DeleteQueryBuilder.js +1 -0
- package/query-builder/DeleteQueryBuilder.js.map +1 -1
- package/query-builder/InsertQueryBuilder.js +1 -0
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/query-builder/QueryBuilder.d.ts +7 -0
- package/query-builder/QueryBuilder.js +64 -0
- package/query-builder/QueryBuilder.js.map +1 -1
- package/query-builder/QueryBuilderCte.d.ts +17 -0
- package/query-builder/QueryBuilderCte.js +4 -0
- package/query-builder/QueryBuilderCte.js.map +1 -0
- package/query-builder/QueryExpressionMap.d.ts +7 -0
- package/query-builder/QueryExpressionMap.js +8 -0
- package/query-builder/QueryExpressionMap.js.map +1 -1
- package/query-builder/SelectQueryBuilder.js +1 -0
- package/query-builder/SelectQueryBuilder.js.map +1 -1
- package/query-builder/SoftDeleteQueryBuilder.js +1 -0
- package/query-builder/SoftDeleteQueryBuilder.js.map +1 -1
- package/query-builder/UpdateQueryBuilder.js +1 -0
- package/query-builder/UpdateQueryBuilder.js.map +1 -1
- package/repository/BaseEntity.d.ts +2 -2
- package/repository/BaseEntity.js.map +1 -1
- package/repository/Repository.js +1 -4
- package/repository/Repository.js.map +1 -1
- package/repository/TreeRepository.js +1 -4
- package/repository/TreeRepository.js.map +1 -1
|
File without changes
|
|
File without changes
|
|
@@ -98,6 +98,15 @@ export class DataSource {
|
|
|
98
98
|
*/
|
|
99
99
|
setOptions(options) {
|
|
100
100
|
Object.assign(this.options, options);
|
|
101
|
+
if (options.logger || options.logging) {
|
|
102
|
+
this.logger = new LoggerFactory().create(options.logger || this.options.logger, options.logging || this.options.logging);
|
|
103
|
+
}
|
|
104
|
+
if (options.namingStrategy) {
|
|
105
|
+
this.namingStrategy = options.namingStrategy;
|
|
106
|
+
}
|
|
107
|
+
if (options.cache) {
|
|
108
|
+
this.queryResultCache = new QueryResultCacheFactory(this).create();
|
|
109
|
+
}
|
|
101
110
|
return this;
|
|
102
111
|
}
|
|
103
112
|
/**
|
|
@@ -434,10 +443,9 @@ export class DataSource {
|
|
|
434
443
|
// validate all created entity metadatas to make sure user created entities are valid and correct
|
|
435
444
|
entityMetadataValidator.validateMany(this.entityMetadatas.filter((metadata) => metadata.tableType !== "view"), this.driver);
|
|
436
445
|
// set current data source to the entities
|
|
437
|
-
for (let
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
entity.useDataSource(this);
|
|
446
|
+
for (let entityMetadata of entityMetadatas) {
|
|
447
|
+
if (InstanceChecker.isBaseEntityConstructor(entityMetadata.target)) {
|
|
448
|
+
entityMetadata.target.useDataSource(this);
|
|
441
449
|
}
|
|
442
450
|
}
|
|
443
451
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/data-source/DataSource.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAA;AACxF,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAA;AAKhG,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAA;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAIlE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAA;AAErF,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAA;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAG1E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAA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,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,CAAA;QAE9D,6BAA6B;QAC7B,MAAM,mBAAmB,GAAG,WAAW,CAAC,gBAAgB,CACpD,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAChC,CAAA;QACD,MAAM,UAAU,GAAG,MAAM,yBAAyB,CAAC,eAAe,CAC9D,mBAAmB,CACtB,CAAA;QACD,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;QAEpD,iGAAiG;QACjG,uBAAuB,CAAC,YAAY,CAChC,IAAI,CAAC,eAAe,CAAC,MAAM,CACvB,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,KAAK,MAAM,CAC9C,EACD,IAAI,CAAC,MAAM,CACd,CAAA;QAED,0CAA0C;QAC1C,KAAK,IAAI,SAAS,IAAI,iBAAiB,EAAE;YACrC,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAA;YAC3C,IAAI,eAAe,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE;gBACjD,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;aAC7B;SACJ;IACL,CAAC;CACJ","file":"DataSource.js","sourcesContent":["import { Driver } from \"../driver/Driver\"\nimport { Repository } from \"../repository/Repository\"\nimport { EntitySubscriberInterface } from \"../subscriber/EntitySubscriberInterface\"\nimport { EntityTarget } from \"../common/EntityTarget\"\nimport { ObjectType } from \"../common/ObjectType\"\nimport { EntityManager } from \"../entity-manager/EntityManager\"\nimport { DefaultNamingStrategy } from \"../naming-strategy/DefaultNamingStrategy\"\nimport { CannotExecuteNotConnectedError } from \"../error/CannotExecuteNotConnectedError\"\nimport { CannotConnectAlreadyConnectedError } from \"../error/CannotConnectAlreadyConnectedError\"\nimport { TreeRepository } from \"../repository/TreeRepository\"\nimport { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { Logger } from \"../logger/Logger\"\nimport { EntityMetadataNotFoundError } from \"../error/EntityMetadataNotFoundError\"\nimport { MigrationInterface } from \"../migration/MigrationInterface\"\nimport { MigrationExecutor } from \"../migration/MigrationExecutor\"\nimport { Migration } from \"../migration/Migration\"\nimport { MongoRepository } from \"../repository/MongoRepository\"\nimport { MongoEntityManager } from \"../entity-manager/MongoEntityManager\"\nimport { EntityMetadataValidator } from \"../metadata-builder/EntityMetadataValidator\"\nimport { DataSourceOptions } from \"./DataSourceOptions\"\nimport { QueryRunnerProviderAlreadyReleasedError } from \"../error/QueryRunnerProviderAlreadyReleasedError\"\nimport { EntityManagerFactory } from \"../entity-manager/EntityManagerFactory\"\nimport { DriverFactory } from \"../driver/DriverFactory\"\nimport { ConnectionMetadataBuilder } from \"../connection/ConnectionMetadataBuilder\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\nimport { LoggerFactory } from \"../logger/LoggerFactory\"\nimport { QueryResultCacheFactory } from \"../cache/QueryResultCacheFactory\"\nimport { QueryResultCache } from \"../cache/QueryResultCache\"\nimport { SqljsEntityManager } from \"../entity-manager/SqljsEntityManager\"\nimport { RelationLoader } from \"../query-builder/RelationLoader\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport { ReplicationMode } from \"../driver/types/ReplicationMode\"\nimport { TypeORMError } from \"../error/TypeORMError\"\nimport { RelationIdLoader } from \"../query-builder/RelationIdLoader\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\n\n/**\n * DataSource is a pre-defined connection configuration to a specific database.\n * You can have multiple data sources connected (with multiple connections in it),\n * connected to multiple databases in your application.\n *\n * Before, it was called `Connection`, but now `Connection` is deprecated\n * because `Connection` isn't the best name for what it's actually is.\n */\nexport class DataSource {\n readonly \"@instanceof\" = Symbol.for(\"DataSource\")\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n *\n * @deprecated we don't need names anymore since we are going to drop all related methods relying on this property.\n */\n readonly name: string\n\n /**\n * Connection options.\n */\n readonly options: DataSourceOptions\n\n /**\n * Indicates if DataSource is initialized or not.\n */\n readonly isInitialized: boolean\n\n /**\n * Database driver used by this connection.\n */\n driver: Driver\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager\n\n /**\n * Naming strategy used in the connection.\n */\n namingStrategy: NamingStrategyInterface\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string\n\n /**\n * Logger used to log orm events.\n */\n logger: Logger\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = []\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = []\n\n /**\n * Used to work with query result cache.\n */\n queryResultCache?: QueryResultCache\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader\n\n readonly relationIdLoader: RelationIdLoader\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: DataSourceOptions) {\n this.name = options.name || \"default\"\n this.options = options\n this.logger = new LoggerFactory().create(\n this.options.logger,\n this.options.logging,\n )\n this.driver = new DriverFactory().create(this)\n this.manager = this.createEntityManager()\n this.namingStrategy =\n options.namingStrategy || new DefaultNamingStrategy()\n this.metadataTableName = options.metadataTableName || \"typeorm_metadata\"\n this.queryResultCache = options.cache\n ? new QueryResultCacheFactory(this).create()\n : undefined\n this.relationLoader = new RelationLoader(this)\n this.relationIdLoader = new RelationIdLoader(this)\n this.isInitialized = false\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n Indicates if DataSource is initialized or not.\n *\n * @deprecated use .isInitialized instead\n */\n get isConnected() {\n return this.isInitialized\n }\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(\n `MongoEntityManager is only available for MongoDB databases.`,\n )\n\n return this.manager as MongoEntityManager\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!InstanceChecker.isSqljsEntityManager(this.manager))\n throw new TypeORMError(\n `SqljsEntityManager is only available for Sqljs databases.`,\n )\n\n return this.manager\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n /**\n * Updates current connection options with provided options.\n */\n setOptions(options: Partial<DataSourceOptions>): this {\n Object.assign(this.options, options)\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async initialize(): Promise<this> {\n if (this.isInitialized)\n throw new CannotConnectAlreadyConnectedError(this.name)\n\n // connect to the database via its driver\n await this.driver.connect()\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache) await this.queryResultCache.connect()\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isInitialized: true })\n\n try {\n // build all metadatas registered in the current connection\n await this.buildMetadatas()\n\n await this.driver.afterConnect()\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema) await this.dropDatabase()\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({\n transaction: this.options.migrationsTransactionMode,\n })\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize) await this.synchronize()\n } catch (error) {\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.close()\n throw error\n }\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n *\n * @deprecated use .initialize method instead\n */\n async connect(): Promise<this> {\n return this.initialize()\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async destroy(): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n await this.driver.disconnect()\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache) await this.queryResultCache.disconnect()\n\n ObjectUtils.assign(this, { isInitialized: false })\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n *\n * @deprecated use .destroy method instead\n */\n async close(): Promise<void> {\n return this.destroy()\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n if (dropBeforeSync) await this.dropDatabase()\n\n const schemaBuilder = this.driver.createSchemaBuilder()\n await schemaBuilder.build()\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner()\n try {\n if (\n this.driver.options.type === \"mssql\" ||\n DriverUtils.isMySQLFamily(this.driver) ||\n this.driver.options.type === \"aurora-mysql\" ||\n DriverUtils.isSQLiteFamily(this.driver)\n ) {\n const databases: string[] = []\n this.entityMetadatas.forEach((metadata) => {\n if (\n metadata.database &&\n databases.indexOf(metadata.database) === -1\n )\n databases.push(metadata.database)\n })\n if (databases.length === 0 && this.driver.database) {\n databases.push(this.driver.database)\n }\n\n if (databases.length === 0) {\n await queryRunner.clearDatabase()\n } else {\n for (const database of databases) {\n await queryRunner.clearDatabase(database)\n }\n }\n } else {\n await queryRunner.clearDatabase()\n }\n } finally {\n await queryRunner.release()\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n }): Promise<Migration[]> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n (options && options.transaction) || \"all\"\n\n const successMigrations =\n await migrationExecutor.executePendingMigrations()\n return successMigrations\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n }): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n (options && options.transaction) || \"all\"\n\n await migrationExecutor.undoLastMigration()\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isInitialized) {\n throw new CannotExecuteNotConnectedError(this.name)\n }\n const migrationExecutor = new MigrationExecutor(this)\n return await migrationExecutor.showMigrations()\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target)\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target)\n if (!metadata) throw new EntityMetadataNotFoundError(target)\n\n return metadata\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity>(target: EntityTarget<Entity>): Repository<Entity> {\n return this.manager.getRepository(target)\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity>(\n target: EntityTarget<Entity>,\n ): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target)\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity>(\n target: EntityTarget<Entity>,\n ): MongoRepository<Entity> {\n if (!(this.driver.options.type === \"mongodb\"))\n throw new TypeORMError(\n `You can use getMongoRepository only for MongoDB connections.`,\n )\n\n return this.manager.getRepository(target) as any\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n *\n * @deprecated use Repository.extend function to create a custom repository\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository)\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationLevel: IsolationLevel,\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationOrRunInTransaction:\n | IsolationLevel\n | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>,\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any,\n )\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(\n query: string,\n parameters?: any[],\n queryRunner?: QueryRunner,\n ): Promise<any> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Queries aren't supported by MongoDB.`)\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError()\n\n const usedQueryRunner = queryRunner || this.createQueryRunner()\n\n try {\n return await usedQueryRunner.query(query, parameters) // await is needed here because we are using finally\n } finally {\n if (!queryRunner) await usedQueryRunner.release()\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(\n entityOrRunner?: EntityTarget<Entity> | QueryRunner,\n alias?: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`)\n\n if (alias) {\n alias = DriverUtils.buildAlias(this.driver, alias)\n const metadata = this.getMetadata(\n entityOrRunner as EntityTarget<Entity>,\n )\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias)\n } else {\n return new SelectQueryBuilder(\n this,\n entityOrRunner as QueryRunner | undefined,\n )\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode)\n const manager = this.createEntityManager(queryRunner)\n Object.assign(queryRunner, { manager: manager })\n return queryRunner\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(\n entityTarget: EntityTarget<any>,\n relationPropertyPath: string,\n ) {\n const relationMetadata =\n this.getMetadata(entityTarget).findRelationWithPropertyPath(\n relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`,\n )\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(\n `Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`,\n )\n\n return relationMetadata.junctionEntityMetadata\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner)\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(\n target: EntityTarget<any>,\n ): EntityMetadata | undefined {\n return this.entityMetadatas.find((metadata) => {\n if (metadata.target === target) return true\n if (InstanceChecker.isEntitySchema(target)) {\n return metadata.name === target.options.name\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n return metadata.tablePath === target\n } else {\n return (\n metadata.name === target ||\n metadata.tableName === target\n )\n }\n }\n if (\n ObjectUtils.isObject(target) &&\n typeof target.name === \"string\"\n ) {\n if (target.name.indexOf(\".\") !== -1) {\n return metadata.tablePath === target.name\n } else {\n return (\n metadata.name === target.name ||\n metadata.tableName === target.name\n )\n }\n }\n\n return false\n })\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this)\n const entityMetadataValidator = new EntityMetadataValidator()\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const flattenedSubscribers = ObjectUtils.mixedListToArray(\n this.options.subscribers || [],\n )\n const subscribers = await connectionMetadataBuilder.buildSubscribers(\n flattenedSubscribers,\n )\n ObjectUtils.assign(this, { subscribers: subscribers })\n\n // build entity metadatas\n const flattenedEntities = ObjectUtils.mixedListToArray(\n this.options.entities || [],\n )\n const entityMetadatas =\n await connectionMetadataBuilder.buildEntityMetadatas(\n flattenedEntities,\n )\n ObjectUtils.assign(this, { entityMetadatas: entityMetadatas })\n\n // create migration instances\n const flattenedMigrations = ObjectUtils.mixedListToArray(\n this.options.migrations || [],\n )\n const migrations = await connectionMetadataBuilder.buildMigrations(\n flattenedMigrations,\n )\n ObjectUtils.assign(this, { migrations: migrations })\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(\n this.entityMetadatas.filter(\n (metadata) => metadata.tableType !== \"view\",\n ),\n this.driver,\n )\n\n // set current data source to the entities\n for (let entityKey in flattenedEntities) {\n const entity = flattenedEntities[entityKey]\n if (InstanceChecker.isBaseEntityConstructor(entity)) {\n entity.useDataSource(this)\n }\n }\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/data-source/DataSource.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAA;AACxF,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAA;AAKhG,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAA;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAIlE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAA;AAErF,OAAO,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAA;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAG1E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,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,CAAC,CAAA;aAC5C;SACJ;IACL,CAAC;CACJ","file":"DataSource.js","sourcesContent":["import { Driver } from \"../driver/Driver\"\nimport { Repository } from \"../repository/Repository\"\nimport { EntitySubscriberInterface } from \"../subscriber/EntitySubscriberInterface\"\nimport { EntityTarget } from \"../common/EntityTarget\"\nimport { ObjectType } from \"../common/ObjectType\"\nimport { EntityManager } from \"../entity-manager/EntityManager\"\nimport { DefaultNamingStrategy } from \"../naming-strategy/DefaultNamingStrategy\"\nimport { CannotExecuteNotConnectedError } from \"../error/CannotExecuteNotConnectedError\"\nimport { CannotConnectAlreadyConnectedError } from \"../error/CannotConnectAlreadyConnectedError\"\nimport { TreeRepository } from \"../repository/TreeRepository\"\nimport { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { Logger } from \"../logger/Logger\"\nimport { EntityMetadataNotFoundError } from \"../error/EntityMetadataNotFoundError\"\nimport { MigrationInterface } from \"../migration/MigrationInterface\"\nimport { MigrationExecutor } from \"../migration/MigrationExecutor\"\nimport { Migration } from \"../migration/Migration\"\nimport { MongoRepository } from \"../repository/MongoRepository\"\nimport { MongoEntityManager } from \"../entity-manager/MongoEntityManager\"\nimport { EntityMetadataValidator } from \"../metadata-builder/EntityMetadataValidator\"\nimport { DataSourceOptions } from \"./DataSourceOptions\"\nimport { QueryRunnerProviderAlreadyReleasedError } from \"../error/QueryRunnerProviderAlreadyReleasedError\"\nimport { EntityManagerFactory } from \"../entity-manager/EntityManagerFactory\"\nimport { DriverFactory } from \"../driver/DriverFactory\"\nimport { ConnectionMetadataBuilder } from \"../connection/ConnectionMetadataBuilder\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\nimport { LoggerFactory } from \"../logger/LoggerFactory\"\nimport { QueryResultCacheFactory } from \"../cache/QueryResultCacheFactory\"\nimport { QueryResultCache } from \"../cache/QueryResultCache\"\nimport { SqljsEntityManager } from \"../entity-manager/SqljsEntityManager\"\nimport { RelationLoader } from \"../query-builder/RelationLoader\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport { ReplicationMode } from \"../driver/types/ReplicationMode\"\nimport { TypeORMError } from \"../error/TypeORMError\"\nimport { RelationIdLoader } from \"../query-builder/RelationIdLoader\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\n\n/**\n * DataSource is a pre-defined connection configuration to a specific database.\n * You can have multiple data sources connected (with multiple connections in it),\n * connected to multiple databases in your application.\n *\n * Before, it was called `Connection`, but now `Connection` is deprecated\n * because `Connection` isn't the best name for what it's actually is.\n */\nexport class DataSource {\n readonly \"@instanceof\" = Symbol.for(\"DataSource\")\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n *\n * @deprecated we don't need names anymore since we are going to drop all related methods relying on this property.\n */\n readonly name: string\n\n /**\n * Connection options.\n */\n readonly options: DataSourceOptions\n\n /**\n * Indicates if DataSource is initialized or not.\n */\n readonly isInitialized: boolean\n\n /**\n * Database driver used by this connection.\n */\n driver: Driver\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager\n\n /**\n * Naming strategy used in the connection.\n */\n namingStrategy: NamingStrategyInterface\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string\n\n /**\n * Logger used to log orm events.\n */\n logger: Logger\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = []\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = []\n\n /**\n * Used to work with query result cache.\n */\n queryResultCache?: QueryResultCache\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader\n\n readonly relationIdLoader: RelationIdLoader\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: DataSourceOptions) {\n this.name = options.name || \"default\"\n this.options = options\n this.logger = new LoggerFactory().create(\n this.options.logger,\n this.options.logging,\n )\n this.driver = new DriverFactory().create(this)\n this.manager = this.createEntityManager()\n this.namingStrategy =\n options.namingStrategy || new DefaultNamingStrategy()\n this.metadataTableName = options.metadataTableName || \"typeorm_metadata\"\n this.queryResultCache = options.cache\n ? new QueryResultCacheFactory(this).create()\n : undefined\n this.relationLoader = new RelationLoader(this)\n this.relationIdLoader = new RelationIdLoader(this)\n this.isInitialized = false\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n Indicates if DataSource is initialized or not.\n *\n * @deprecated use .isInitialized instead\n */\n get isConnected() {\n return this.isInitialized\n }\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(\n `MongoEntityManager is only available for MongoDB databases.`,\n )\n\n return this.manager as MongoEntityManager\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!InstanceChecker.isSqljsEntityManager(this.manager))\n throw new TypeORMError(\n `SqljsEntityManager is only available for Sqljs databases.`,\n )\n\n return this.manager\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n /**\n * Updates current connection options with provided options.\n */\n setOptions(options: Partial<DataSourceOptions>): this {\n Object.assign(this.options, options)\n\n if (options.logger || options.logging) {\n this.logger = new LoggerFactory().create(\n options.logger || this.options.logger,\n options.logging || this.options.logging,\n )\n }\n\n if (options.namingStrategy) {\n this.namingStrategy = options.namingStrategy\n }\n\n if (options.cache) {\n this.queryResultCache = new QueryResultCacheFactory(this).create()\n }\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async initialize(): Promise<this> {\n if (this.isInitialized)\n throw new CannotConnectAlreadyConnectedError(this.name)\n\n // connect to the database via its driver\n await this.driver.connect()\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache) await this.queryResultCache.connect()\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isInitialized: true })\n\n try {\n // build all metadatas registered in the current connection\n await this.buildMetadatas()\n\n await this.driver.afterConnect()\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema) await this.dropDatabase()\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({\n transaction: this.options.migrationsTransactionMode,\n })\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize) await this.synchronize()\n } catch (error) {\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.close()\n throw error\n }\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n *\n * @deprecated use .initialize method instead\n */\n async connect(): Promise<this> {\n return this.initialize()\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async destroy(): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n await this.driver.disconnect()\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache) await this.queryResultCache.disconnect()\n\n ObjectUtils.assign(this, { isInitialized: false })\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n *\n * @deprecated use .destroy method instead\n */\n async close(): Promise<void> {\n return this.destroy()\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n if (dropBeforeSync) await this.dropDatabase()\n\n const schemaBuilder = this.driver.createSchemaBuilder()\n await schemaBuilder.build()\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner()\n try {\n if (\n this.driver.options.type === \"mssql\" ||\n DriverUtils.isMySQLFamily(this.driver) ||\n this.driver.options.type === \"aurora-mysql\" ||\n DriverUtils.isSQLiteFamily(this.driver)\n ) {\n const databases: string[] = []\n this.entityMetadatas.forEach((metadata) => {\n if (\n metadata.database &&\n databases.indexOf(metadata.database) === -1\n )\n databases.push(metadata.database)\n })\n if (databases.length === 0 && this.driver.database) {\n databases.push(this.driver.database)\n }\n\n if (databases.length === 0) {\n await queryRunner.clearDatabase()\n } else {\n for (const database of databases) {\n await queryRunner.clearDatabase(database)\n }\n }\n } else {\n await queryRunner.clearDatabase()\n }\n } finally {\n await queryRunner.release()\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n }): Promise<Migration[]> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n (options && options.transaction) || \"all\"\n\n const successMigrations =\n await migrationExecutor.executePendingMigrations()\n return successMigrations\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n }): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n (options && options.transaction) || \"all\"\n\n await migrationExecutor.undoLastMigration()\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isInitialized) {\n throw new CannotExecuteNotConnectedError(this.name)\n }\n const migrationExecutor = new MigrationExecutor(this)\n return await migrationExecutor.showMigrations()\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target)\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target)\n if (!metadata) throw new EntityMetadataNotFoundError(target)\n\n return metadata\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity>(target: EntityTarget<Entity>): Repository<Entity> {\n return this.manager.getRepository(target)\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity>(\n target: EntityTarget<Entity>,\n ): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target)\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity>(\n target: EntityTarget<Entity>,\n ): MongoRepository<Entity> {\n if (!(this.driver.options.type === \"mongodb\"))\n throw new TypeORMError(\n `You can use getMongoRepository only for MongoDB connections.`,\n )\n\n return this.manager.getRepository(target) as any\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n *\n * @deprecated use Repository.extend function to create a custom repository\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository)\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationLevel: IsolationLevel,\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationOrRunInTransaction:\n | IsolationLevel\n | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>,\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any,\n )\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query(\n query: string,\n parameters?: any[],\n queryRunner?: QueryRunner,\n ): Promise<any> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Queries aren't supported by MongoDB.`)\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError()\n\n const usedQueryRunner = queryRunner || this.createQueryRunner()\n\n try {\n return await usedQueryRunner.query(query, parameters) // await is needed here because we are using finally\n } finally {\n if (!queryRunner) await usedQueryRunner.release()\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity>(\n entityOrRunner?: EntityTarget<Entity> | QueryRunner,\n alias?: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`)\n\n if (alias) {\n alias = DriverUtils.buildAlias(this.driver, alias)\n const metadata = this.getMetadata(\n entityOrRunner as EntityTarget<Entity>,\n )\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias)\n } else {\n return new SelectQueryBuilder(\n this,\n entityOrRunner as QueryRunner | undefined,\n )\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode)\n const manager = this.createEntityManager(queryRunner)\n Object.assign(queryRunner, { manager: manager })\n return queryRunner\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(\n entityTarget: EntityTarget<any>,\n relationPropertyPath: string,\n ) {\n const relationMetadata =\n this.getMetadata(entityTarget).findRelationWithPropertyPath(\n relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`,\n )\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(\n `Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`,\n )\n\n return relationMetadata.junctionEntityMetadata\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner)\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(\n target: EntityTarget<any>,\n ): EntityMetadata | undefined {\n return this.entityMetadatas.find((metadata) => {\n if (metadata.target === target) return true\n if (InstanceChecker.isEntitySchema(target)) {\n return metadata.name === target.options.name\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n return metadata.tablePath === target\n } else {\n return (\n metadata.name === target ||\n metadata.tableName === target\n )\n }\n }\n if (\n ObjectUtils.isObject(target) &&\n typeof target.name === \"string\"\n ) {\n if (target.name.indexOf(\".\") !== -1) {\n return metadata.tablePath === target.name\n } else {\n return (\n metadata.name === target.name ||\n metadata.tableName === target.name\n )\n }\n }\n\n return false\n })\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this)\n const entityMetadataValidator = new EntityMetadataValidator()\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const flattenedSubscribers = ObjectUtils.mixedListToArray(\n this.options.subscribers || [],\n )\n const subscribers = await connectionMetadataBuilder.buildSubscribers(\n flattenedSubscribers,\n )\n ObjectUtils.assign(this, { subscribers: subscribers })\n\n // build entity metadatas\n const flattenedEntities = ObjectUtils.mixedListToArray(\n this.options.entities || [],\n )\n const entityMetadatas =\n await connectionMetadataBuilder.buildEntityMetadatas(\n flattenedEntities,\n )\n ObjectUtils.assign(this, { entityMetadatas: entityMetadatas })\n\n // create migration instances\n const flattenedMigrations = ObjectUtils.mixedListToArray(\n this.options.migrations || [],\n )\n const migrations = await connectionMetadataBuilder.buildMigrations(\n flattenedMigrations,\n )\n ObjectUtils.assign(this, { migrations: migrations })\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(\n this.entityMetadatas.filter(\n (metadata) => metadata.tableType !== \"view\",\n ),\n this.driver,\n )\n\n // set current data source to the entities\n for (let entityMetadata of entityMetadatas) {\n if (\n InstanceChecker.isBaseEntityConstructor(entityMetadata.target)\n ) {\n entityMetadata.target.useDataSource(this)\n }\n }\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -2,6 +2,7 @@ import { QueryRunner } from "../query-runner/QueryRunner";
|
|
|
2
2
|
import { ColumnMetadata } from "../metadata/ColumnMetadata";
|
|
3
3
|
import { ObjectLiteral } from "../common/ObjectLiteral";
|
|
4
4
|
import { ColumnType } from "./types/ColumnTypes";
|
|
5
|
+
import { CteCapabilities } from "./types/CteCapabilities";
|
|
5
6
|
import { MappedColumnTypes } from "./types/MappedColumnTypes";
|
|
6
7
|
import { SchemaBuilder } from "../schema-builder/SchemaBuilder";
|
|
7
8
|
import { DataTypeDefaults } from "./types/DataTypeDefaults";
|
|
@@ -82,6 +83,7 @@ export interface Driver {
|
|
|
82
83
|
* Max length allowed by the DBMS for aliases (execution of queries).
|
|
83
84
|
*/
|
|
84
85
|
maxAliasLength?: number;
|
|
86
|
+
cteCapabilities: CteCapabilities;
|
|
85
87
|
/**
|
|
86
88
|
* Performs connection to the database.
|
|
87
89
|
* Depend on driver type it may create a connection pool.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/driver/Driver.ts"],"names":[],"mappings":"","file":"Driver.js","sourcesContent":["import { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { ColumnType } from \"./types/ColumnTypes\"\nimport { MappedColumnTypes } from \"./types/MappedColumnTypes\"\nimport { SchemaBuilder } from \"../schema-builder/SchemaBuilder\"\nimport { DataTypeDefaults } from \"./types/DataTypeDefaults\"\nimport { BaseDataSourceOptions } from \"../data-source/BaseDataSourceOptions\"\nimport { TableColumn } from \"../schema-builder/table/TableColumn\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { ReplicationMode } from \"./types/ReplicationMode\"\nimport { Table } from \"../schema-builder/table/Table\"\nimport { View } from \"../schema-builder/view/View\"\nimport { TableForeignKey } from \"../schema-builder/table/TableForeignKey\"\nimport { UpsertType } from \"./types/UpsertType\"\n\nexport type ReturningType = \"insert\" | \"update\" | \"delete\"\n\n/**\n * Driver organizes TypeORM communication with specific database management system.\n */\nexport interface Driver {\n /**\n * Connection options.\n */\n options: BaseDataSourceOptions\n\n /**\n * Database name used to perform all write queries.\n *\n * todo: probably move into query runner.\n */\n database?: string\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport: boolean\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport: \"simple\" | \"nested\" | \"none\"\n\n /**\n * Gets list of supported column data types by a driver.\n */\n supportedDataTypes: ColumnType[]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertType?: UpsertType\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[]\n\n /**\n * Orm has special columns and we need to know what database column types should be for those types.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes\n\n /**\n * Max length allowed by the DBMS for aliases (execution of queries).\n */\n maxAliasLength?: number\n\n /**\n * Performs connection to the database.\n * Depend on driver type it may create a connection pool.\n */\n connect(): Promise<void>\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void>\n\n /**\n * Closes connection with database and releases all resources.\n */\n disconnect(): Promise<void>\n\n /**\n * Synchronizes database schema (creates tables, indices, etc).\n */\n createSchemaBuilder(): SchemaBuilder\n\n /**\n * Creates a query runner used for common queries.\n */\n createQueryRunner(mode: ReplicationMode): QueryRunner\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]]\n\n /**\n * Escapes a table name, column name or an alias.\n *\n * todo: probably escape should be able to handle dots in the names and automatically escape them\n */\n escape(name: string): string\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { tableName: string; schema?: string; database?: string }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, column: ColumnMetadata): any\n\n /**\n * Prepares given value to a value to be persisted, based on its column type.\n */\n prepareHydratedValue(value: any, column: ColumnMetadata): any\n\n /**\n * Transforms type of the given column to a database column type.\n */\n normalizeType(column: {\n type?: ColumnType | string\n length?: number | string\n precision?: number | null\n scale?: number\n isArray?: boolean\n }): string\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any>\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any>\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(\n metadata: EntityMetadata,\n insertResult: any,\n entityIndex?: number,\n entityNum?: number,\n ): ObjectLiteral | undefined\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[]\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(returningType: ReturningType): boolean\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/driver/Driver.ts"],"names":[],"mappings":"","file":"Driver.js","sourcesContent":["import { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { ColumnType } from \"./types/ColumnTypes\"\nimport { CteCapabilities } from \"./types/CteCapabilities\"\nimport { MappedColumnTypes } from \"./types/MappedColumnTypes\"\nimport { SchemaBuilder } from \"../schema-builder/SchemaBuilder\"\nimport { DataTypeDefaults } from \"./types/DataTypeDefaults\"\nimport { BaseDataSourceOptions } from \"../data-source/BaseDataSourceOptions\"\nimport { TableColumn } from \"../schema-builder/table/TableColumn\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { ReplicationMode } from \"./types/ReplicationMode\"\nimport { Table } from \"../schema-builder/table/Table\"\nimport { View } from \"../schema-builder/view/View\"\nimport { TableForeignKey } from \"../schema-builder/table/TableForeignKey\"\nimport { UpsertType } from \"./types/UpsertType\"\n\nexport type ReturningType = \"insert\" | \"update\" | \"delete\"\n\n/**\n * Driver organizes TypeORM communication with specific database management system.\n */\nexport interface Driver {\n /**\n * Connection options.\n */\n options: BaseDataSourceOptions\n\n /**\n * Database name used to perform all write queries.\n *\n * todo: probably move into query runner.\n */\n database?: string\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport: boolean\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport: \"simple\" | \"nested\" | \"none\"\n\n /**\n * Gets list of supported column data types by a driver.\n */\n supportedDataTypes: ColumnType[]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertType?: UpsertType\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[]\n\n /**\n * Orm has special columns and we need to know what database column types should be for those types.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes\n\n /**\n * Max length allowed by the DBMS for aliases (execution of queries).\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities\n\n /**\n * Performs connection to the database.\n * Depend on driver type it may create a connection pool.\n */\n connect(): Promise<void>\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void>\n\n /**\n * Closes connection with database and releases all resources.\n */\n disconnect(): Promise<void>\n\n /**\n * Synchronizes database schema (creates tables, indices, etc).\n */\n createSchemaBuilder(): SchemaBuilder\n\n /**\n * Creates a query runner used for common queries.\n */\n createQueryRunner(mode: ReplicationMode): QueryRunner\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]]\n\n /**\n * Escapes a table name, column name or an alias.\n *\n * todo: probably escape should be able to handle dots in the names and automatically escape them\n */\n escape(name: string): string\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { tableName: string; schema?: string; database?: string }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, column: ColumnMetadata): any\n\n /**\n * Prepares given value to a value to be persisted, based on its column type.\n */\n prepareHydratedValue(value: any, column: ColumnMetadata): any\n\n /**\n * Transforms type of the given column to a database column type.\n */\n normalizeType(column: {\n type?: ColumnType | string\n length?: number | string\n precision?: number | null\n scale?: number\n isArray?: boolean\n }): string\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any>\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any>\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(\n metadata: EntityMetadata,\n insertResult: any,\n entityIndex?: number,\n entityNum?: number,\n ): ObjectLiteral | undefined\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[]\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(returningType: ReturningType): boolean\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string\n}\n"],"sourceRoot":".."}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Driver } from "../Driver";
|
|
2
|
+
import { CteCapabilities } from "../types/CteCapabilities";
|
|
2
3
|
import { AuroraMysqlQueryRunner } from "./AuroraMysqlQueryRunner";
|
|
3
4
|
import { ObjectLiteral } from "../../common/ObjectLiteral";
|
|
4
5
|
import { ColumnMetadata } from "../../metadata/ColumnMetadata";
|
|
@@ -108,6 +109,7 @@ export declare class AuroraMysqlDriver implements Driver {
|
|
|
108
109
|
* @see https://dev.mysql.com/doc/refman/5.5/en/identifiers.html
|
|
109
110
|
*/
|
|
110
111
|
maxAliasLength: number;
|
|
112
|
+
cteCapabilities: CteCapabilities;
|
|
111
113
|
constructor(connection: DataSource);
|
|
112
114
|
/**
|
|
113
115
|
* Performs connection to the database.
|
|
@@ -241,6 +241,9 @@ export class AuroraMysqlDriver {
|
|
|
241
241
|
* @see https://dev.mysql.com/doc/refman/5.5/en/identifiers.html
|
|
242
242
|
*/
|
|
243
243
|
this.maxAliasLength = 63;
|
|
244
|
+
this.cteCapabilities = {
|
|
245
|
+
enabled: false,
|
|
246
|
+
};
|
|
244
247
|
this.connection = connection;
|
|
245
248
|
this.options = connection.options;
|
|
246
249
|
// load mysql package
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/driver/aurora-mysql/AuroraMysqlDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAQ5E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,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A0E;YAC1E,mBAAmB,GAAG,mBAAmB,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;YACjE,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;SACxD;QAED,OAAO,mBAAmB,KAAK,aAAa,CAAA;IAChD,CAAC;IAED;;OAEG;IACO,aAAa,CAAC,OAAgB;QACpC,IAAI,CAAC,OAAO;YAAE,OAAO,OAAO,CAAA;QAE5B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA,CAAC,wCAAwC;QAEjF,OAAO,OAAO,CAAA;IAClB,CAAC;CACJ","file":"AuroraMysqlDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { AuroraMysqlQueryRunner } from \"./AuroraMysqlQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { DateUtils } from \"../../util/DateUtils\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { AuroraMysqlConnectionOptions } from \"./AuroraMysqlConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { AuroraMysqlConnectionCredentialsOptions } from \"./AuroraMysqlConnectionCredentialsOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\n\n/**\n * Organizes communication with MySQL DBMS.\n */\nexport class AuroraMysqlDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n connection: DataSource\n\n /**\n * Aurora Data API underlying library.\n */\n DataApiDriver: any\n\n client: any\n\n /**\n * Connection pool.\n * Used in non-replication mode.\n */\n pool: any\n\n /**\n * Pool cluster used in replication mode.\n */\n poolCluster: any\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: AuroraMysqlConnectionOptions\n\n /**\n * Database name used to perform all write queries.\n */\n database?: string\n\n /**\n * Schema name used to performn all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = true\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"nested\" as const\n\n /**\n * Gets list of supported column data types by a driver.\n *\n * @see https://www.tutorialspoint.com/mysql/mysql-data-types.htm\n * @see https://dev.mysql.com/doc/refman/8.0/en/data-types.html\n */\n supportedDataTypes: ColumnType[] = [\n // numeric types\n \"bit\",\n \"int\",\n \"integer\", // synonym for int\n \"tinyint\",\n \"smallint\",\n \"mediumint\",\n \"bigint\",\n \"float\",\n \"double\",\n \"double precision\", // synonym for double\n \"real\", // synonym for double\n \"decimal\",\n \"dec\", // synonym for decimal\n \"numeric\", // synonym for decimal\n \"fixed\", // synonym for decimal\n \"bool\", // synonym for tinyint\n \"boolean\", // synonym for tinyint\n // date and time types\n \"date\",\n \"datetime\",\n \"timestamp\",\n \"time\",\n \"year\",\n // string types\n \"char\",\n \"nchar\", // synonym for national char\n \"national char\",\n \"varchar\",\n \"nvarchar\", // synonym for national varchar\n \"national varchar\",\n \"blob\",\n \"text\",\n \"tinyblob\",\n \"tinytext\",\n \"mediumblob\",\n \"mediumtext\",\n \"longblob\",\n \"longtext\",\n \"enum\",\n \"set\",\n \"binary\",\n \"varbinary\",\n // json data type\n \"json\",\n // spatial data types\n \"geometry\",\n \"point\",\n \"linestring\",\n \"polygon\",\n \"multipoint\",\n \"multilinestring\",\n \"multipolygon\",\n \"geometrycollection\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n readonly supportedUpsertType = \"on-duplicate-key-update\"\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = [\n \"geometry\",\n \"point\",\n \"linestring\",\n \"polygon\",\n \"multipoint\",\n \"multilinestring\",\n \"multipolygon\",\n \"geometrycollection\",\n ]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = [\n \"char\",\n \"varchar\",\n \"nvarchar\",\n \"binary\",\n \"varbinary\",\n ]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withWidthColumnTypes: ColumnType[] = [\n \"bit\",\n \"tinyint\",\n \"smallint\",\n \"mediumint\",\n \"int\",\n \"integer\",\n \"bigint\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n \"time\",\n \"datetime\",\n \"timestamp\",\n ]\n\n /**\n * Gets list of column data types that supports scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n ]\n\n /**\n * Gets list of column data types that supports UNSIGNED and ZEROFILL attributes.\n */\n unsignedAndZerofillTypes: ColumnType[] = [\n \"int\",\n \"integer\",\n \"smallint\",\n \"tinyint\",\n \"mediumint\",\n \"bigint\",\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n ]\n\n /**\n * ORM has special columns and we need to know what database column types should be for those columns.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"datetime\",\n createDatePrecision: 6,\n createDateDefault: \"CURRENT_TIMESTAMP(6)\",\n updateDate: \"datetime\",\n updateDatePrecision: 6,\n updateDateDefault: \"CURRENT_TIMESTAMP(6)\",\n deleteDate: \"datetime\",\n deleteDatePrecision: 6,\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"varchar\",\n migrationTimestamp: \"bigint\",\n cacheId: \"int\",\n cacheIdentifier: \"varchar\",\n cacheTime: \"bigint\",\n cacheDuration: \"int\",\n cacheQuery: \"text\",\n cacheResult: \"text\",\n metadataType: \"varchar\",\n metadataDatabase: \"varchar\",\n metadataSchema: \"varchar\",\n metadataTable: \"varchar\",\n metadataName: \"varchar\",\n metadataValue: \"text\",\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults = {\n varchar: { length: 255 },\n nvarchar: { length: 255 },\n \"national varchar\": { length: 255 },\n char: { length: 1 },\n binary: { length: 1 },\n varbinary: { length: 255 },\n decimal: { precision: 10, scale: 0 },\n dec: { precision: 10, scale: 0 },\n numeric: { precision: 10, scale: 0 },\n fixed: { precision: 10, scale: 0 },\n float: { precision: 12 },\n double: { precision: 22 },\n time: { precision: 0 },\n datetime: { precision: 0 },\n timestamp: { precision: 0 },\n bit: { width: 1 },\n int: { width: 11 },\n integer: { width: 11 },\n tinyint: { width: 4 },\n smallint: { width: 6 },\n mediumint: { width: 9 },\n bigint: { width: 20 },\n }\n\n /**\n * Max length allowed by MySQL for aliases.\n * @see https://dev.mysql.com/doc/refman/5.5/en/identifiers.html\n */\n maxAliasLength = 63\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as AuroraMysqlConnectionOptions\n\n // load mysql package\n this.loadDependencies()\n\n this.client = new this.DataApiDriver(\n this.options.region,\n this.options.secretArn,\n this.options.resourceArn,\n this.options.database,\n (query: string, parameters?: any[]) =>\n this.connection.logger.logQuery(query, parameters),\n this.options.serviceConfigOptions,\n this.options.formatOptions,\n )\n\n this.database = DriverUtils.buildDriverOptions(this.options).database\n\n // validate options to make sure everything is set\n // todo: revisit validation with replication in mind\n // if (!(this.options.host || (this.options.extra && this.options.extra.socketPath)) && !this.options.socketPath)\n // throw new DriverOptionNotSetError(\"socketPath and host\");\n // if (!this.options.username)\n // throw new DriverOptionNotSetError(\"username\");\n // if (!this.options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // todo: check what is going on when connection is setup without database and how to connect to a database then?\n // todo: provide options to auto-create a database if it does not exist yet\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n if (!this.database) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n this.database = await queryRunner.getCurrentDatabase()\n\n await queryRunner.release()\n }\n }\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {}\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new RdbmsSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return new AuroraMysqlQueryRunner(\n this,\n new this.DataApiDriver(\n this.options.region,\n this.options.secretArn,\n this.options.resourceArn,\n this.options.database,\n (query: string, parameters?: any[]) =>\n this.connection.logger.logQuery(query, parameters),\n this.options.serviceConfigOptions,\n this.options.formatOptions,\n ),\n )\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n const escapedParameters: any[] = Object.keys(nativeParameters).map(\n (key) => nativeParameters[key],\n )\n if (!parameters || !Object.keys(parameters).length)\n return [sql, escapedParameters]\n\n sql = sql.replace(\n /:(\\.\\.\\.)?([A-Za-z0-9_.]+)/g,\n (full, isArray: string, key: string): string => {\n if (!parameters.hasOwnProperty(key)) {\n return full\n }\n\n let value: any = parameters[key]\n\n if (isArray) {\n return value\n .map((v: any) => {\n escapedParameters.push(v)\n return this.createParameter(\n key,\n escapedParameters.length - 1,\n )\n })\n .join(\", \")\n }\n\n if (typeof value === \"function\") {\n return value()\n }\n\n escapedParameters.push(value)\n return this.createParameter(key, escapedParameters.length - 1)\n },\n ) // todo: make replace only in value statements, otherwise problems\n return [sql, escapedParameters]\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return \"`\" + columnName + \"`\"\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n let tablePath = [tableName]\n\n if (database) {\n tablePath.unshift(database)\n }\n\n return tablePath.join(\".\")\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { database?: string; schema?: string; tableName: string } {\n const driverDatabase = this.database\n const driverSchema = undefined\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n const parsed = this.parseTableName(target.name)\n\n return {\n database: target.database || parsed.database || driverDatabase,\n schema: target.schema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n const parsed = this.parseTableName(target.referencedTableName)\n\n return {\n database:\n target.referencedDatabase ||\n parsed.database ||\n driverDatabase,\n schema:\n target.referencedSchema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isEntityMetadata(target)) {\n // EntityMetadata tableName is never a path\n\n return {\n database: target.database || driverDatabase,\n schema: target.schema || driverSchema,\n tableName: target.tableName,\n }\n }\n\n const parts = target.split(\".\")\n\n return {\n database:\n (parts.length > 1 ? parts[0] : undefined) || driverDatabase,\n schema: driverSchema,\n tableName: parts.length > 1 ? parts[1] : parts[0],\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n\n if (\n !this.options.formatOptions ||\n this.options.formatOptions.castParameters !== false\n ) {\n return this.client.preparePersistentValue(value, columnMetadata)\n }\n\n if (value === null || value === undefined) return value\n\n if (columnMetadata.type === Boolean) {\n return value === true ? 1 : 0\n } else if (columnMetadata.type === \"date\") {\n return DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n return DateUtils.mixedDateToTimeString(value)\n } else if (columnMetadata.type === \"json\") {\n return JSON.stringify(value)\n } else if (\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date\n ) {\n return DateUtils.mixedDateToDate(value)\n } else if (\n columnMetadata.type === \"simple-array\" ||\n columnMetadata.type === \"set\"\n ) {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(value)\n } else if (\n columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\"\n ) {\n return \"\" + value\n }\n\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (value === null || value === undefined)\n return columnMetadata.transformer\n ? ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n : value\n\n if (\n !this.options.formatOptions ||\n this.options.formatOptions.castParameters !== false\n ) {\n return this.client.prepareHydratedValue(value, columnMetadata)\n }\n\n if (\n columnMetadata.type === Boolean ||\n columnMetadata.type === \"bool\" ||\n columnMetadata.type === \"boolean\"\n ) {\n value = value ? true : false\n } else if (\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"json\") {\n value = typeof value === \"string\" ? JSON.parse(value) : value\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (\n columnMetadata.type === \"simple-array\" ||\n columnMetadata.type === \"set\"\n ) {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(value)\n } else if (\n (columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\") &&\n columnMetadata.enum &&\n !isNaN(value) &&\n columnMetadata.enum.indexOf(parseInt(value)) >= 0\n ) {\n // convert to number if that exists in possible enum options\n value = parseInt(value)\n }\n\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n if (column.type === Number || column.type === \"integer\") {\n return \"int\"\n } else if (column.type === String) {\n return \"varchar\"\n } else if (column.type === Date) {\n return \"datetime\"\n } else if ((column.type as any) === Buffer) {\n return \"blob\"\n } else if (column.type === Boolean) {\n return \"tinyint\"\n } else if (column.type === \"uuid\") {\n return \"varchar\"\n } else if (\n column.type === \"simple-array\" ||\n column.type === \"simple-json\"\n ) {\n return \"text\"\n } else if (column.type === \"simple-enum\") {\n return \"enum\"\n } else if (\n column.type === \"double precision\" ||\n column.type === \"real\"\n ) {\n return \"double\"\n } else if (\n column.type === \"dec\" ||\n column.type === \"numeric\" ||\n column.type === \"fixed\"\n ) {\n return \"decimal\"\n } else if (column.type === \"bool\" || column.type === \"boolean\") {\n return \"tinyint\"\n } else if (\n column.type === \"nvarchar\" ||\n column.type === \"national varchar\"\n ) {\n return \"varchar\"\n } else if (column.type === \"nchar\" || column.type === \"national char\") {\n return \"char\"\n } else {\n return (column.type as string) || \"\"\n }\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n const defaultValue = columnMetadata.default\n\n if (defaultValue === null) {\n return undefined\n }\n\n if (\n (columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\") &&\n defaultValue !== undefined\n ) {\n return `'${defaultValue}'`\n }\n\n if (columnMetadata.type === \"set\" && defaultValue !== undefined) {\n return `'${DateUtils.simpleArrayToString(defaultValue)}'`\n }\n\n if (typeof defaultValue === \"number\") {\n return `${defaultValue}`\n }\n\n if (typeof defaultValue === \"boolean\") {\n return defaultValue ? \"1\" : \"0\"\n }\n\n if (typeof defaultValue === \"function\") {\n return defaultValue()\n }\n\n if (typeof defaultValue === \"string\") {\n return `'${defaultValue}'`\n }\n\n if (defaultValue === undefined) {\n return undefined\n }\n\n return `${defaultValue}`\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n return column.entityMetadata.indices.some(\n (idx) =>\n idx.isUnique &&\n idx.columns.length === 1 &&\n idx.columns[0] === column,\n )\n }\n\n /**\n * Returns default column lengths, which is required on column creation.\n */\n getColumnLength(column: ColumnMetadata | TableColumn): string {\n if (column.length) return column.length.toString()\n\n /**\n * fix https://github.com/typeorm/typeorm/issues/1139\n */\n if (column.generationStrategy === \"uuid\") return \"36\"\n\n switch (column.type) {\n case String:\n case \"varchar\":\n case \"nvarchar\":\n case \"national varchar\":\n return \"255\"\n case \"varbinary\":\n return \"255\"\n default:\n return \"\"\n }\n }\n\n /**\n * Creates column type definition including length, precision and scale\n */\n createFullType(column: TableColumn): string {\n let type = column.type\n\n // used 'getColumnLength()' method, because MySQL requires column length for `varchar`, `nvarchar` and `varbinary` data types\n if (this.getColumnLength(column)) {\n type += `(${this.getColumnLength(column)})`\n } else if (column.width) {\n type += `(${column.width})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined &&\n column.scale !== null &&\n column.scale !== undefined\n ) {\n type += `(${column.precision},${column.scale})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined\n ) {\n type += `(${column.precision})`\n }\n\n if (column.isArray) type += \" array\"\n\n return type\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return new Promise<any>((ok, fail) => {\n if (this.poolCluster) {\n this.poolCluster.getConnection(\n \"MASTER\",\n (err: any, dbConnection: any) => {\n err\n ? fail(err)\n : ok(this.prepareDbConnection(dbConnection))\n },\n )\n } else if (this.pool) {\n this.pool.getConnection((err: any, dbConnection: any) => {\n err ? fail(err) : ok(this.prepareDbConnection(dbConnection))\n })\n } else {\n fail(\n new TypeORMError(\n `Connection is not established with mysql database`,\n ),\n )\n }\n })\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n if (!this.poolCluster) return this.obtainMasterConnection()\n\n return new Promise<any>((ok, fail) => {\n this.poolCluster.getConnection(\n \"SLAVE*\",\n (err: any, dbConnection: any) => {\n err ? fail(err) : ok(this.prepareDbConnection(dbConnection))\n },\n )\n })\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(\n metadata: EntityMetadata,\n insertResult: any,\n entityIndex: number,\n ) {\n const generatedMap = metadata.generatedColumns.reduce(\n (map, generatedColumn) => {\n let value: any\n if (\n generatedColumn.generationStrategy === \"increment\" &&\n insertResult.insertId\n ) {\n // NOTE: When multiple rows is inserted by a single INSERT statement,\n // `insertId` is the value generated for the first inserted row only.\n value = insertResult.insertId + entityIndex\n // } else if (generatedColumn.generationStrategy === \"uuid\") {\n // console.log(\"getting db value:\", generatedColumn.databaseName);\n // value = generatedColumn.getEntityValue(uuidMap);\n }\n\n return OrmUtils.mergeDeep(\n map,\n generatedColumn.createValueMap(value),\n )\n },\n {} as ObjectLiteral,\n )\n\n return Object.keys(generatedMap).length > 0 ? generatedMap : undefined\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n return columnMetadatas.filter((columnMetadata) => {\n const tableColumn = tableColumns.find(\n (c) => c.name === columnMetadata.databaseName,\n )\n if (!tableColumn) return false // we don't need new columns, we only need exist and changed\n\n // console.log(\"table:\", columnMetadata.entityMetadata.tableName);\n // console.log(\"name:\", tableColumn.name, columnMetadata.databaseName);\n // console.log(\"type:\", tableColumn.type, this.normalizeType(columnMetadata));\n // console.log(\"length:\", tableColumn.length, columnMetadata.length);\n // console.log(\"width:\", tableColumn.width, columnMetadata.width);\n // console.log(\"precision:\", tableColumn.precision, columnMetadata.precision);\n // console.log(\"scale:\", tableColumn.scale, columnMetadata.scale);\n // console.log(\"zerofill:\", tableColumn.zerofill, columnMetadata.zerofill);\n // console.log(\"unsigned:\", tableColumn.unsigned, columnMetadata.unsigned);\n // console.log(\"asExpression:\", tableColumn.asExpression, columnMetadata.asExpression);\n // console.log(\"generatedType:\", tableColumn.generatedType, columnMetadata.generatedType);\n // console.log(\"comment:\", tableColumn.comment, this.escapeComment(columnMetadata.comment));\n // console.log(\"default:\", tableColumn.default, columnMetadata.default);\n // console.log(\"enum:\", tableColumn.enum, columnMetadata.enum);\n // console.log(\"default changed:\", !this.compareDefaultValues(this.normalizeDefault(columnMetadata), tableColumn.default));\n // console.log(\"onUpdate:\", tableColumn.onUpdate, columnMetadata.onUpdate);\n // console.log(\"isPrimary:\", tableColumn.isPrimary, columnMetadata.isPrimary);\n // console.log(\"isNullable:\", tableColumn.isNullable, columnMetadata.isNullable);\n // console.log(\"isUnique:\", tableColumn.isUnique, this.normalizeIsUnique(columnMetadata));\n // console.log(\"isGenerated:\", tableColumn.isGenerated, columnMetadata.isGenerated);\n // console.log((columnMetadata.generationStrategy !== \"uuid\" && tableColumn.isGenerated !== columnMetadata.isGenerated));\n // console.log(\"==========================================\");\n\n let columnMetadataLength = columnMetadata.length\n if (\n !columnMetadataLength &&\n columnMetadata.generationStrategy === \"uuid\"\n ) {\n // fixing #3374\n columnMetadataLength = this.getColumnLength(columnMetadata)\n }\n\n return (\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n tableColumn.length !== columnMetadataLength ||\n tableColumn.width !== columnMetadata.width ||\n tableColumn.precision !== columnMetadata.precision ||\n tableColumn.scale !== columnMetadata.scale ||\n tableColumn.zerofill !== columnMetadata.zerofill ||\n tableColumn.unsigned !== columnMetadata.unsigned ||\n tableColumn.asExpression !== columnMetadata.asExpression ||\n tableColumn.generatedType !== columnMetadata.generatedType ||\n tableColumn.comment !==\n this.escapeComment(columnMetadata.comment) ||\n !this.compareDefaultValues(\n this.normalizeDefault(columnMetadata),\n tableColumn.default,\n ) ||\n (tableColumn.enum &&\n columnMetadata.enum &&\n !OrmUtils.isArraysEqual(\n tableColumn.enum,\n columnMetadata.enum.map((val) => val + \"\"),\n )) ||\n tableColumn.onUpdate !== columnMetadata.onUpdate ||\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n (columnMetadata.generationStrategy !== \"uuid\" &&\n tableColumn.isGenerated !== columnMetadata.isGenerated)\n )\n })\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return true\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"?\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): void {\n const DataApiDriver =\n this.options.driver ||\n PlatformTools.load(\"typeorm-aurora-data-api-driver\")\n this.DataApiDriver = DataApiDriver\n\n // Driver uses rollup for publishing, which has issues when using typeorm in combination with webpack\n // See https://github.com/webpack/webpack/issues/4742#issuecomment-295556787\n this.DataApiDriver = this.DataApiDriver.default || this.DataApiDriver\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected createConnectionOptions(\n options: AuroraMysqlConnectionOptions,\n credentials: AuroraMysqlConnectionCredentialsOptions,\n ): Promise<any> {\n credentials = Object.assign(\n {},\n credentials,\n DriverUtils.buildDriverOptions(credentials),\n ) // todo: do it better way\n\n // build connection options for the driver\n return Object.assign(\n {},\n {\n resourceArn: options.resourceArn,\n secretArn: options.secretArn,\n database: options.database,\n region: options.region,\n type: options.type,\n },\n {\n host: credentials.host,\n user: credentials.username,\n password: credentials.password,\n database: credentials.database,\n port: credentials.port,\n ssl: options.ssl,\n },\n\n options.extra || {},\n )\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected async createPool(connectionOptions: any): Promise<any> {\n return {}\n }\n\n /**\n * Attaches all required base handlers to a database connection, such as the unhandled error handler.\n */\n private prepareDbConnection(connection: any): any {\n const { logger } = this.connection\n /**\n * Attaching an error handler to connection errors is essential, as, otherwise, errors raised will go unhandled and\n * cause the hosting app to crash.\n */\n if (connection.listeners(\"error\").length === 0) {\n connection.on(\"error\", (error: any) =>\n logger.log(\n \"warn\",\n `MySQL connection raised an error. ${error}`,\n ),\n )\n }\n return connection\n }\n\n /**\n * Checks if \"DEFAULT\" values in the column metadata and in the database are equal.\n */\n protected compareDefaultValues(\n columnMetadataValue: string | undefined,\n databaseValue: string | undefined,\n ): boolean {\n if (\n typeof columnMetadataValue === \"string\" &&\n typeof databaseValue === \"string\"\n ) {\n // we need to cut out \"'\" because in mysql we can understand returned value is a string or a function\n // as result compare cannot understand if default is really changed or not\n columnMetadataValue = columnMetadataValue.replace(/^'+|'+$/g, \"\")\n databaseValue = databaseValue.replace(/^'+|'+$/g, \"\")\n }\n\n return columnMetadataValue === databaseValue\n }\n\n /**\n * Escapes a given comment.\n */\n protected escapeComment(comment?: string) {\n if (!comment) return comment\n\n comment = comment.replace(/\\u0000/g, \"\") // Null bytes aren't allowed in comments\n\n return comment\n }\n}\n"],"sourceRoot":"../.."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/driver/aurora-mysql/AuroraMysqlDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAQ5E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAgS1B,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,UAAsB;QAxPlC;;WAEG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;WAEG;QACH,gBAAW,GAAG,IAAI,CAAA;QAElB;;WAEG;QACH,uBAAkB,GAAG,QAAiB,CAAA;QAEtC;;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,aAAa,CAAC,OAAgB;QACpC,IAAI,CAAC,OAAO;YAAE,OAAO,OAAO,CAAA;QAE5B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA,CAAC,wCAAwC;QAEjF,OAAO,OAAO,CAAA;IAClB,CAAC;CACJ","file":"AuroraMysqlDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { AuroraMysqlQueryRunner } from \"./AuroraMysqlQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { DateUtils } from \"../../util/DateUtils\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { AuroraMysqlConnectionOptions } from \"./AuroraMysqlConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { AuroraMysqlConnectionCredentialsOptions } from \"./AuroraMysqlConnectionCredentialsOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\n\n/**\n * Organizes communication with MySQL DBMS.\n */\nexport class AuroraMysqlDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n connection: DataSource\n\n /**\n * Aurora Data API underlying library.\n */\n DataApiDriver: any\n\n client: any\n\n /**\n * Connection pool.\n * Used in non-replication mode.\n */\n pool: any\n\n /**\n * Pool cluster used in replication mode.\n */\n poolCluster: any\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: AuroraMysqlConnectionOptions\n\n /**\n * Database name used to perform all write queries.\n */\n database?: string\n\n /**\n * Schema name used to performn all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = true\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"nested\" as const\n\n /**\n * Gets list of supported column data types by a driver.\n *\n * @see https://www.tutorialspoint.com/mysql/mysql-data-types.htm\n * @see https://dev.mysql.com/doc/refman/8.0/en/data-types.html\n */\n supportedDataTypes: ColumnType[] = [\n // numeric types\n \"bit\",\n \"int\",\n \"integer\", // synonym for int\n \"tinyint\",\n \"smallint\",\n \"mediumint\",\n \"bigint\",\n \"float\",\n \"double\",\n \"double precision\", // synonym for double\n \"real\", // synonym for double\n \"decimal\",\n \"dec\", // synonym for decimal\n \"numeric\", // synonym for decimal\n \"fixed\", // synonym for decimal\n \"bool\", // synonym for tinyint\n \"boolean\", // synonym for tinyint\n // date and time types\n \"date\",\n \"datetime\",\n \"timestamp\",\n \"time\",\n \"year\",\n // string types\n \"char\",\n \"nchar\", // synonym for national char\n \"national char\",\n \"varchar\",\n \"nvarchar\", // synonym for national varchar\n \"national varchar\",\n \"blob\",\n \"text\",\n \"tinyblob\",\n \"tinytext\",\n \"mediumblob\",\n \"mediumtext\",\n \"longblob\",\n \"longtext\",\n \"enum\",\n \"set\",\n \"binary\",\n \"varbinary\",\n // json data type\n \"json\",\n // spatial data types\n \"geometry\",\n \"point\",\n \"linestring\",\n \"polygon\",\n \"multipoint\",\n \"multilinestring\",\n \"multipolygon\",\n \"geometrycollection\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n readonly supportedUpsertType = \"on-duplicate-key-update\"\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = [\n \"geometry\",\n \"point\",\n \"linestring\",\n \"polygon\",\n \"multipoint\",\n \"multilinestring\",\n \"multipolygon\",\n \"geometrycollection\",\n ]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = [\n \"char\",\n \"varchar\",\n \"nvarchar\",\n \"binary\",\n \"varbinary\",\n ]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withWidthColumnTypes: ColumnType[] = [\n \"bit\",\n \"tinyint\",\n \"smallint\",\n \"mediumint\",\n \"int\",\n \"integer\",\n \"bigint\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n \"time\",\n \"datetime\",\n \"timestamp\",\n ]\n\n /**\n * Gets list of column data types that supports scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n ]\n\n /**\n * Gets list of column data types that supports UNSIGNED and ZEROFILL attributes.\n */\n unsignedAndZerofillTypes: ColumnType[] = [\n \"int\",\n \"integer\",\n \"smallint\",\n \"tinyint\",\n \"mediumint\",\n \"bigint\",\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n ]\n\n /**\n * ORM has special columns and we need to know what database column types should be for those columns.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"datetime\",\n createDatePrecision: 6,\n createDateDefault: \"CURRENT_TIMESTAMP(6)\",\n updateDate: \"datetime\",\n updateDatePrecision: 6,\n updateDateDefault: \"CURRENT_TIMESTAMP(6)\",\n deleteDate: \"datetime\",\n deleteDatePrecision: 6,\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"varchar\",\n migrationTimestamp: \"bigint\",\n cacheId: \"int\",\n cacheIdentifier: \"varchar\",\n cacheTime: \"bigint\",\n cacheDuration: \"int\",\n cacheQuery: \"text\",\n cacheResult: \"text\",\n metadataType: \"varchar\",\n metadataDatabase: \"varchar\",\n metadataSchema: \"varchar\",\n metadataTable: \"varchar\",\n metadataName: \"varchar\",\n metadataValue: \"text\",\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults = {\n varchar: { length: 255 },\n nvarchar: { length: 255 },\n \"national varchar\": { length: 255 },\n char: { length: 1 },\n binary: { length: 1 },\n varbinary: { length: 255 },\n decimal: { precision: 10, scale: 0 },\n dec: { precision: 10, scale: 0 },\n numeric: { precision: 10, scale: 0 },\n fixed: { precision: 10, scale: 0 },\n float: { precision: 12 },\n double: { precision: 22 },\n time: { precision: 0 },\n datetime: { precision: 0 },\n timestamp: { precision: 0 },\n bit: { width: 1 },\n int: { width: 11 },\n integer: { width: 11 },\n tinyint: { width: 4 },\n smallint: { width: 6 },\n mediumint: { width: 9 },\n bigint: { width: 20 },\n }\n\n /**\n * Max length allowed by MySQL for aliases.\n * @see https://dev.mysql.com/doc/refman/5.5/en/identifiers.html\n */\n maxAliasLength = 63\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as AuroraMysqlConnectionOptions\n\n // load mysql package\n this.loadDependencies()\n\n this.client = new this.DataApiDriver(\n this.options.region,\n this.options.secretArn,\n this.options.resourceArn,\n this.options.database,\n (query: string, parameters?: any[]) =>\n this.connection.logger.logQuery(query, parameters),\n this.options.serviceConfigOptions,\n this.options.formatOptions,\n )\n\n this.database = DriverUtils.buildDriverOptions(this.options).database\n\n // validate options to make sure everything is set\n // todo: revisit validation with replication in mind\n // if (!(this.options.host || (this.options.extra && this.options.extra.socketPath)) && !this.options.socketPath)\n // throw new DriverOptionNotSetError(\"socketPath and host\");\n // if (!this.options.username)\n // throw new DriverOptionNotSetError(\"username\");\n // if (!this.options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // todo: check what is going on when connection is setup without database and how to connect to a database then?\n // todo: provide options to auto-create a database if it does not exist yet\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n if (!this.database) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n this.database = await queryRunner.getCurrentDatabase()\n\n await queryRunner.release()\n }\n }\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {}\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new RdbmsSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return new AuroraMysqlQueryRunner(\n this,\n new this.DataApiDriver(\n this.options.region,\n this.options.secretArn,\n this.options.resourceArn,\n this.options.database,\n (query: string, parameters?: any[]) =>\n this.connection.logger.logQuery(query, parameters),\n this.options.serviceConfigOptions,\n this.options.formatOptions,\n ),\n )\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n const escapedParameters: any[] = Object.keys(nativeParameters).map(\n (key) => nativeParameters[key],\n )\n if (!parameters || !Object.keys(parameters).length)\n return [sql, escapedParameters]\n\n sql = sql.replace(\n /:(\\.\\.\\.)?([A-Za-z0-9_.]+)/g,\n (full, isArray: string, key: string): string => {\n if (!parameters.hasOwnProperty(key)) {\n return full\n }\n\n let value: any = parameters[key]\n\n if (isArray) {\n return value\n .map((v: any) => {\n escapedParameters.push(v)\n return this.createParameter(\n key,\n escapedParameters.length - 1,\n )\n })\n .join(\", \")\n }\n\n if (typeof value === \"function\") {\n return value()\n }\n\n escapedParameters.push(value)\n return this.createParameter(key, escapedParameters.length - 1)\n },\n ) // todo: make replace only in value statements, otherwise problems\n return [sql, escapedParameters]\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return \"`\" + columnName + \"`\"\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n let tablePath = [tableName]\n\n if (database) {\n tablePath.unshift(database)\n }\n\n return tablePath.join(\".\")\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { database?: string; schema?: string; tableName: string } {\n const driverDatabase = this.database\n const driverSchema = undefined\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n const parsed = this.parseTableName(target.name)\n\n return {\n database: target.database || parsed.database || driverDatabase,\n schema: target.schema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n const parsed = this.parseTableName(target.referencedTableName)\n\n return {\n database:\n target.referencedDatabase ||\n parsed.database ||\n driverDatabase,\n schema:\n target.referencedSchema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isEntityMetadata(target)) {\n // EntityMetadata tableName is never a path\n\n return {\n database: target.database || driverDatabase,\n schema: target.schema || driverSchema,\n tableName: target.tableName,\n }\n }\n\n const parts = target.split(\".\")\n\n return {\n database:\n (parts.length > 1 ? parts[0] : undefined) || driverDatabase,\n schema: driverSchema,\n tableName: parts.length > 1 ? parts[1] : parts[0],\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n\n if (\n !this.options.formatOptions ||\n this.options.formatOptions.castParameters !== false\n ) {\n return this.client.preparePersistentValue(value, columnMetadata)\n }\n\n if (value === null || value === undefined) return value\n\n if (columnMetadata.type === Boolean) {\n return value === true ? 1 : 0\n } else if (columnMetadata.type === \"date\") {\n return DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n return DateUtils.mixedDateToTimeString(value)\n } else if (columnMetadata.type === \"json\") {\n return JSON.stringify(value)\n } else if (\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date\n ) {\n return DateUtils.mixedDateToDate(value)\n } else if (\n columnMetadata.type === \"simple-array\" ||\n columnMetadata.type === \"set\"\n ) {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(value)\n } else if (\n columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\"\n ) {\n return \"\" + value\n }\n\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (value === null || value === undefined)\n return columnMetadata.transformer\n ? ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n : value\n\n if (\n !this.options.formatOptions ||\n this.options.formatOptions.castParameters !== false\n ) {\n return this.client.prepareHydratedValue(value, columnMetadata)\n }\n\n if (\n columnMetadata.type === Boolean ||\n columnMetadata.type === \"bool\" ||\n columnMetadata.type === \"boolean\"\n ) {\n value = value ? true : false\n } else if (\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"json\") {\n value = typeof value === \"string\" ? JSON.parse(value) : value\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (\n columnMetadata.type === \"simple-array\" ||\n columnMetadata.type === \"set\"\n ) {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(value)\n } else if (\n (columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\") &&\n columnMetadata.enum &&\n !isNaN(value) &&\n columnMetadata.enum.indexOf(parseInt(value)) >= 0\n ) {\n // convert to number if that exists in possible enum options\n value = parseInt(value)\n }\n\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n if (column.type === Number || column.type === \"integer\") {\n return \"int\"\n } else if (column.type === String) {\n return \"varchar\"\n } else if (column.type === Date) {\n return \"datetime\"\n } else if ((column.type as any) === Buffer) {\n return \"blob\"\n } else if (column.type === Boolean) {\n return \"tinyint\"\n } else if (column.type === \"uuid\") {\n return \"varchar\"\n } else if (\n column.type === \"simple-array\" ||\n column.type === \"simple-json\"\n ) {\n return \"text\"\n } else if (column.type === \"simple-enum\") {\n return \"enum\"\n } else if (\n column.type === \"double precision\" ||\n column.type === \"real\"\n ) {\n return \"double\"\n } else if (\n column.type === \"dec\" ||\n column.type === \"numeric\" ||\n column.type === \"fixed\"\n ) {\n return \"decimal\"\n } else if (column.type === \"bool\" || column.type === \"boolean\") {\n return \"tinyint\"\n } else if (\n column.type === \"nvarchar\" ||\n column.type === \"national varchar\"\n ) {\n return \"varchar\"\n } else if (column.type === \"nchar\" || column.type === \"national char\") {\n return \"char\"\n } else {\n return (column.type as string) || \"\"\n }\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n const defaultValue = columnMetadata.default\n\n if (defaultValue === null) {\n return undefined\n }\n\n if (\n (columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\") &&\n defaultValue !== undefined\n ) {\n return `'${defaultValue}'`\n }\n\n if (columnMetadata.type === \"set\" && defaultValue !== undefined) {\n return `'${DateUtils.simpleArrayToString(defaultValue)}'`\n }\n\n if (typeof defaultValue === \"number\") {\n return `${defaultValue}`\n }\n\n if (typeof defaultValue === \"boolean\") {\n return defaultValue ? \"1\" : \"0\"\n }\n\n if (typeof defaultValue === \"function\") {\n return defaultValue()\n }\n\n if (typeof defaultValue === \"string\") {\n return `'${defaultValue}'`\n }\n\n if (defaultValue === undefined) {\n return undefined\n }\n\n return `${defaultValue}`\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n return column.entityMetadata.indices.some(\n (idx) =>\n idx.isUnique &&\n idx.columns.length === 1 &&\n idx.columns[0] === column,\n )\n }\n\n /**\n * Returns default column lengths, which is required on column creation.\n */\n getColumnLength(column: ColumnMetadata | TableColumn): string {\n if (column.length) return column.length.toString()\n\n /**\n * fix https://github.com/typeorm/typeorm/issues/1139\n */\n if (column.generationStrategy === \"uuid\") return \"36\"\n\n switch (column.type) {\n case String:\n case \"varchar\":\n case \"nvarchar\":\n case \"national varchar\":\n return \"255\"\n case \"varbinary\":\n return \"255\"\n default:\n return \"\"\n }\n }\n\n /**\n * Creates column type definition including length, precision and scale\n */\n createFullType(column: TableColumn): string {\n let type = column.type\n\n // used 'getColumnLength()' method, because MySQL requires column length for `varchar`, `nvarchar` and `varbinary` data types\n if (this.getColumnLength(column)) {\n type += `(${this.getColumnLength(column)})`\n } else if (column.width) {\n type += `(${column.width})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined &&\n column.scale !== null &&\n column.scale !== undefined\n ) {\n type += `(${column.precision},${column.scale})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined\n ) {\n type += `(${column.precision})`\n }\n\n if (column.isArray) type += \" array\"\n\n return type\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return new Promise<any>((ok, fail) => {\n if (this.poolCluster) {\n this.poolCluster.getConnection(\n \"MASTER\",\n (err: any, dbConnection: any) => {\n err\n ? fail(err)\n : ok(this.prepareDbConnection(dbConnection))\n },\n )\n } else if (this.pool) {\n this.pool.getConnection((err: any, dbConnection: any) => {\n err ? fail(err) : ok(this.prepareDbConnection(dbConnection))\n })\n } else {\n fail(\n new TypeORMError(\n `Connection is not established with mysql database`,\n ),\n )\n }\n })\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n if (!this.poolCluster) return this.obtainMasterConnection()\n\n return new Promise<any>((ok, fail) => {\n this.poolCluster.getConnection(\n \"SLAVE*\",\n (err: any, dbConnection: any) => {\n err ? fail(err) : ok(this.prepareDbConnection(dbConnection))\n },\n )\n })\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(\n metadata: EntityMetadata,\n insertResult: any,\n entityIndex: number,\n ) {\n const generatedMap = metadata.generatedColumns.reduce(\n (map, generatedColumn) => {\n let value: any\n if (\n generatedColumn.generationStrategy === \"increment\" &&\n insertResult.insertId\n ) {\n // NOTE: When multiple rows is inserted by a single INSERT statement,\n // `insertId` is the value generated for the first inserted row only.\n value = insertResult.insertId + entityIndex\n // } else if (generatedColumn.generationStrategy === \"uuid\") {\n // console.log(\"getting db value:\", generatedColumn.databaseName);\n // value = generatedColumn.getEntityValue(uuidMap);\n }\n\n return OrmUtils.mergeDeep(\n map,\n generatedColumn.createValueMap(value),\n )\n },\n {} as ObjectLiteral,\n )\n\n return Object.keys(generatedMap).length > 0 ? generatedMap : undefined\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n return columnMetadatas.filter((columnMetadata) => {\n const tableColumn = tableColumns.find(\n (c) => c.name === columnMetadata.databaseName,\n )\n if (!tableColumn) return false // we don't need new columns, we only need exist and changed\n\n // console.log(\"table:\", columnMetadata.entityMetadata.tableName);\n // console.log(\"name:\", tableColumn.name, columnMetadata.databaseName);\n // console.log(\"type:\", tableColumn.type, this.normalizeType(columnMetadata));\n // console.log(\"length:\", tableColumn.length, columnMetadata.length);\n // console.log(\"width:\", tableColumn.width, columnMetadata.width);\n // console.log(\"precision:\", tableColumn.precision, columnMetadata.precision);\n // console.log(\"scale:\", tableColumn.scale, columnMetadata.scale);\n // console.log(\"zerofill:\", tableColumn.zerofill, columnMetadata.zerofill);\n // console.log(\"unsigned:\", tableColumn.unsigned, columnMetadata.unsigned);\n // console.log(\"asExpression:\", tableColumn.asExpression, columnMetadata.asExpression);\n // console.log(\"generatedType:\", tableColumn.generatedType, columnMetadata.generatedType);\n // console.log(\"comment:\", tableColumn.comment, this.escapeComment(columnMetadata.comment));\n // console.log(\"default:\", tableColumn.default, columnMetadata.default);\n // console.log(\"enum:\", tableColumn.enum, columnMetadata.enum);\n // console.log(\"default changed:\", !this.compareDefaultValues(this.normalizeDefault(columnMetadata), tableColumn.default));\n // console.log(\"onUpdate:\", tableColumn.onUpdate, columnMetadata.onUpdate);\n // console.log(\"isPrimary:\", tableColumn.isPrimary, columnMetadata.isPrimary);\n // console.log(\"isNullable:\", tableColumn.isNullable, columnMetadata.isNullable);\n // console.log(\"isUnique:\", tableColumn.isUnique, this.normalizeIsUnique(columnMetadata));\n // console.log(\"isGenerated:\", tableColumn.isGenerated, columnMetadata.isGenerated);\n // console.log((columnMetadata.generationStrategy !== \"uuid\" && tableColumn.isGenerated !== columnMetadata.isGenerated));\n // console.log(\"==========================================\");\n\n let columnMetadataLength = columnMetadata.length\n if (\n !columnMetadataLength &&\n columnMetadata.generationStrategy === \"uuid\"\n ) {\n // fixing #3374\n columnMetadataLength = this.getColumnLength(columnMetadata)\n }\n\n return (\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n tableColumn.length !== columnMetadataLength ||\n tableColumn.width !== columnMetadata.width ||\n tableColumn.precision !== columnMetadata.precision ||\n tableColumn.scale !== columnMetadata.scale ||\n tableColumn.zerofill !== columnMetadata.zerofill ||\n tableColumn.unsigned !== columnMetadata.unsigned ||\n tableColumn.asExpression !== columnMetadata.asExpression ||\n tableColumn.generatedType !== columnMetadata.generatedType ||\n tableColumn.comment !==\n this.escapeComment(columnMetadata.comment) ||\n !this.compareDefaultValues(\n this.normalizeDefault(columnMetadata),\n tableColumn.default,\n ) ||\n (tableColumn.enum &&\n columnMetadata.enum &&\n !OrmUtils.isArraysEqual(\n tableColumn.enum,\n columnMetadata.enum.map((val) => val + \"\"),\n )) ||\n tableColumn.onUpdate !== columnMetadata.onUpdate ||\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n (columnMetadata.generationStrategy !== \"uuid\" &&\n tableColumn.isGenerated !== columnMetadata.isGenerated)\n )\n })\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return true\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"?\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): void {\n const DataApiDriver =\n this.options.driver ||\n PlatformTools.load(\"typeorm-aurora-data-api-driver\")\n this.DataApiDriver = DataApiDriver\n\n // Driver uses rollup for publishing, which has issues when using typeorm in combination with webpack\n // See https://github.com/webpack/webpack/issues/4742#issuecomment-295556787\n this.DataApiDriver = this.DataApiDriver.default || this.DataApiDriver\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected createConnectionOptions(\n options: AuroraMysqlConnectionOptions,\n credentials: AuroraMysqlConnectionCredentialsOptions,\n ): Promise<any> {\n credentials = Object.assign(\n {},\n credentials,\n DriverUtils.buildDriverOptions(credentials),\n ) // todo: do it better way\n\n // build connection options for the driver\n return Object.assign(\n {},\n {\n resourceArn: options.resourceArn,\n secretArn: options.secretArn,\n database: options.database,\n region: options.region,\n type: options.type,\n },\n {\n host: credentials.host,\n user: credentials.username,\n password: credentials.password,\n database: credentials.database,\n port: credentials.port,\n ssl: options.ssl,\n },\n\n options.extra || {},\n )\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected async createPool(connectionOptions: any): Promise<any> {\n return {}\n }\n\n /**\n * Attaches all required base handlers to a database connection, such as the unhandled error handler.\n */\n private prepareDbConnection(connection: any): any {\n const { logger } = this.connection\n /**\n * Attaching an error handler to connection errors is essential, as, otherwise, errors raised will go unhandled and\n * cause the hosting app to crash.\n */\n if (connection.listeners(\"error\").length === 0) {\n connection.on(\"error\", (error: any) =>\n logger.log(\n \"warn\",\n `MySQL connection raised an error. ${error}`,\n ),\n )\n }\n return connection\n }\n\n /**\n * Checks if \"DEFAULT\" values in the column metadata and in the database are equal.\n */\n protected compareDefaultValues(\n columnMetadataValue: string | undefined,\n databaseValue: string | undefined,\n ): boolean {\n if (\n typeof columnMetadataValue === \"string\" &&\n typeof databaseValue === \"string\"\n ) {\n // we need to cut out \"'\" because in mysql we can understand returned value is a string or a function\n // as result compare cannot understand if default is really changed or not\n columnMetadataValue = columnMetadataValue.replace(/^'+|'+$/g, \"\")\n databaseValue = databaseValue.replace(/^'+|'+$/g, \"\")\n }\n\n return columnMetadataValue === databaseValue\n }\n\n /**\n * Escapes a given comment.\n */\n protected escapeComment(comment?: string) {\n if (!comment) return comment\n\n comment = comment.replace(/\\u0000/g, \"\") // Null bytes aren't allowed in comments\n\n return comment\n }\n}\n"],"sourceRoot":"../.."}
|