typeorm 0.3.18-dev.a4900ae → 0.3.18-dev.a939654

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/browser/data-source/DataSource.js +2 -0
  2. package/browser/data-source/DataSource.js.map +1 -1
  3. package/browser/driver/oracle/OracleConnectionOptions.d.ts +14 -0
  4. package/browser/driver/oracle/OracleConnectionOptions.js.map +1 -1
  5. package/browser/driver/oracle/OracleDriver.js +6 -0
  6. package/browser/driver/oracle/OracleDriver.js.map +1 -1
  7. package/browser/driver/sap/SapQueryRunner.js +12 -6
  8. package/browser/driver/sap/SapQueryRunner.js.map +1 -1
  9. package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1 -10
  10. package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
  11. package/browser/entity-manager/MongoEntityManager.js +4 -8
  12. package/browser/entity-manager/MongoEntityManager.js.map +1 -1
  13. package/browser/error/EntityNotFoundError.d.ts +2 -0
  14. package/browser/error/EntityNotFoundError.js +2 -0
  15. package/browser/error/EntityNotFoundError.js.map +1 -1
  16. package/browser/logger/AbstractLogger.js +1 -1
  17. package/browser/logger/AbstractLogger.js.map +1 -1
  18. package/browser/platform/BrowserPlatformTools.js +3 -2
  19. package/browser/platform/BrowserPlatformTools.js.map +1 -1
  20. package/browser/query-builder/InsertQueryBuilder.js +10 -6
  21. package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
  22. package/browser/query-builder/QueryBuilder.d.ts +5 -0
  23. package/browser/query-builder/QueryBuilder.js +14 -21
  24. package/browser/query-builder/QueryBuilder.js.map +1 -1
  25. package/browser/query-builder/SelectQueryBuilder.js +4 -0
  26. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  27. package/browser/query-builder/index.d.ts +1 -0
  28. package/browser/query-builder/index.js +17 -0
  29. package/browser/query-builder/index.js.map +1 -0
  30. package/browser/util/OrmUtils.d.ts +6 -0
  31. package/browser/util/OrmUtils.js +66 -0
  32. package/browser/util/OrmUtils.js.map +1 -1
  33. package/data-source/DataSource.js +2 -0
  34. package/data-source/DataSource.js.map +1 -1
  35. package/driver/oracle/OracleConnectionOptions.d.ts +14 -0
  36. package/driver/oracle/OracleConnectionOptions.js.map +1 -1
  37. package/driver/oracle/OracleDriver.js +6 -0
  38. package/driver/oracle/OracleDriver.js.map +1 -1
  39. package/driver/sap/SapQueryRunner.js +12 -6
  40. package/driver/sap/SapQueryRunner.js.map +1 -1
  41. package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1 -10
  42. package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
  43. package/entity-manager/MongoEntityManager.js +4 -8
  44. package/entity-manager/MongoEntityManager.js.map +1 -1
  45. package/error/EntityNotFoundError.d.ts +2 -0
  46. package/error/EntityNotFoundError.js +2 -0
  47. package/error/EntityNotFoundError.js.map +1 -1
  48. package/logger/AbstractLogger.js +1 -1
  49. package/logger/AbstractLogger.js.map +1 -1
  50. package/package.json +1 -1
  51. package/query-builder/InsertQueryBuilder.js +10 -6
  52. package/query-builder/InsertQueryBuilder.js.map +1 -1
  53. package/query-builder/QueryBuilder.d.ts +5 -0
  54. package/query-builder/QueryBuilder.js +14 -21
  55. package/query-builder/QueryBuilder.js.map +1 -1
  56. package/query-builder/SelectQueryBuilder.js +4 -0
  57. package/query-builder/SelectQueryBuilder.js.map +1 -1
  58. package/query-builder/index.d.ts +1 -0
  59. package/query-builder/index.js +21 -0
  60. package/query-builder/index.js.map +1 -0
  61. package/util/OrmUtils.d.ts +6 -0
  62. package/util/OrmUtils.js +66 -0
  63. package/util/OrmUtils.js.map +1 -1
@@ -13,6 +13,8 @@ import { ObjectUtils } from "../util/ObjectUtils";
13
13
  import { RelationIdLoader } from "../query-builder/RelationIdLoader";
14
14
  import { DriverUtils } from "../driver/DriverUtils";
15
15
  import { InstanceChecker } from "../util/InstanceChecker";
16
+ import { registerQueryBuilders } from "../query-builder";
17
+ registerQueryBuilders();
16
18
  /**
17
19
  * DataSource is a pre-defined connection configuration to a specific database.
18
20
  * You can have multiple data sources connected (with multiple connections in it),
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/data-source/DataSource.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAChF,OAAO,EACH,kCAAkC,EAClC,8BAA8B,EAC9B,2BAA2B,EAC3B,uCAAuC,EACvC,YAAY,GACf,MAAM,UAAU,CAAA;AAMjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAIlE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAA;AAErF,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,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAGzD;;;;;;;GAOG;AACH,MAAM,OAAO,UAAU;IAkFnB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,OAA0B;QArF7B,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAgDjD;;WAEG;QACM,eAAU,GAAyB,EAAE,CAAA;QAE9C;;WAEG;Q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AyB,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,cAAc,IAAI,eAAe,EAAE;YACxC,IACI,eAAe,CAAC,uBAAuB,CAAC,cAAc,CAAC,MAAM,CAAC,EAChE;gBACE,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;aAC5C;SACJ;IACL,CAAC;IAED;;OAEG;IACH,8BAA8B;QAC1B,IAAI,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACtC,MAAM,KAAK,GACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAGvB,CAAC,WAAW,CAAA;YACb,IAAI,KAAK,EAAE;gBACP,OAAO,KAAK,CAAA;aACf;SACJ;QACD,OAAO,OAAO,CAAA;IAClB,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 {\n CannotConnectAlreadyConnectedError,\n CannotExecuteNotConnectedError,\n EntityMetadataNotFoundError,\n QueryRunnerProviderAlreadyReleasedError,\n TypeORMError,\n} from \"../error\"\nimport { TreeRepository } from \"../repository/TreeRepository\"\nimport { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { Logger } from \"../logger/Logger\"\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 { 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 { RelationIdLoader } from \"../query-builder/RelationIdLoader\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\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 * All entity metadatas that are registered for this connection.\n * This is a copy of #.entityMetadatas property -> used for more performant searches.\n */\n readonly entityMetadatasMap = new Map<EntityTarget<any>, 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 // todo: we must update the database in the driver as well, if it was set by setOptions method\n // in the future we need to refactor the code and remove \"database\" from the driver, and instead\n // use database (and options) from a single place - data source.\n if (options.database) {\n this.driver.database = DriverUtils.buildDriverOptions(\n this.options,\n ).database\n }\n\n // todo: need to take a look if we need to update schema and other \"poor\" properties\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.destroy()\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 fake?: boolean\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 migrationExecutor.fake = (options && options.fake) || false\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 fake?: boolean\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 migrationExecutor.fake = (options && options.fake) || false\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 extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): 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 extends ObjectLiteral>(\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 extends ObjectLiteral>(\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<T = any>(\n query: string,\n parameters?: any[],\n queryRunner?: QueryRunner,\n ): Promise<T> {\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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n 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, undefined, 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 const metadataFromMap = this.entityMetadatasMap.get(target)\n if (metadataFromMap) return metadataFromMap\n\n for (let [_, metadata] of this.entityMetadatasMap) {\n if (\n InstanceChecker.isEntitySchema(target) &&\n metadata.name === target.options.name\n ) {\n return metadata\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target) {\n return metadata\n }\n } else {\n if (\n metadata.name === target ||\n metadata.tableName === target\n ) {\n return metadata\n }\n }\n }\n if (\n ObjectUtils.isObjectWithName(target) &&\n typeof target.name === \"string\"\n ) {\n if (target.name.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target.name) {\n return metadata\n }\n } else {\n if (\n metadata.name === target.name ||\n metadata.tableName === target.name\n ) {\n return metadata\n }\n }\n }\n }\n\n return undefined\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, {\n entityMetadatas: entityMetadatas,\n entityMetadatasMap: new Map(\n entityMetadatas.map((metadata) => [metadata.target, metadata]),\n ),\n })\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 /**\n * Get the replication mode SELECT queries should use for this datasource by default\n */\n defaultReplicationModeForReads(): ReplicationMode {\n if (\"replication\" in this.driver.options) {\n const value = (\n this.driver.options.replication as {\n defaultMode?: ReplicationMode\n }\n ).defaultMode\n if (value) {\n return value\n }\n }\n return \"slave\"\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/data-source/DataSource.ts"],"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AAC,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,cAAc,IAAI,eAAe,EAAE;YACxC,IACI,eAAe,CAAC,uBAAuB,CAAC,cAAc,CAAC,MAAM,CAAC,EAChE;gBACE,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;aAC5C;SACJ;IACL,CAAC;IAED;;OAEG;IACH,8BAA8B;QAC1B,IAAI,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACtC,MAAM,KAAK,GACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAGvB,CAAC,WAAW,CAAA;YACb,IAAI,KAAK,EAAE;gBACP,OAAO,KAAK,CAAA;aACf;SACJ;QACD,OAAO,OAAO,CAAA;IAClB,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 {\n CannotConnectAlreadyConnectedError,\n CannotExecuteNotConnectedError,\n EntityMetadataNotFoundError,\n QueryRunnerProviderAlreadyReleasedError,\n TypeORMError,\n} from \"../error\"\nimport { TreeRepository } from \"../repository/TreeRepository\"\nimport { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { Logger } from \"../logger/Logger\"\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 { 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 { RelationIdLoader } from \"../query-builder/RelationIdLoader\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { registerQueryBuilders } from \"../query-builder\"\n\nregisterQueryBuilders()\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 * All entity metadatas that are registered for this connection.\n * This is a copy of #.entityMetadatas property -> used for more performant searches.\n */\n readonly entityMetadatasMap = new Map<EntityTarget<any>, 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 // todo: we must update the database in the driver as well, if it was set by setOptions method\n // in the future we need to refactor the code and remove \"database\" from the driver, and instead\n // use database (and options) from a single place - data source.\n if (options.database) {\n this.driver.database = DriverUtils.buildDriverOptions(\n this.options,\n ).database\n }\n\n // todo: need to take a look if we need to update schema and other \"poor\" properties\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.destroy()\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 fake?: boolean\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 migrationExecutor.fake = (options && options.fake) || false\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 fake?: boolean\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 migrationExecutor.fake = (options && options.fake) || false\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 extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): 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 extends ObjectLiteral>(\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 extends ObjectLiteral>(\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<T = any>(\n query: string,\n parameters?: any[],\n queryRunner?: QueryRunner,\n ): Promise<T> {\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 extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n 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, undefined, 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 const metadataFromMap = this.entityMetadatasMap.get(target)\n if (metadataFromMap) return metadataFromMap\n\n for (let [_, metadata] of this.entityMetadatasMap) {\n if (\n InstanceChecker.isEntitySchema(target) &&\n metadata.name === target.options.name\n ) {\n return metadata\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target) {\n return metadata\n }\n } else {\n if (\n metadata.name === target ||\n metadata.tableName === target\n ) {\n return metadata\n }\n }\n }\n if (\n ObjectUtils.isObjectWithName(target) &&\n typeof target.name === \"string\"\n ) {\n if (target.name.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target.name) {\n return metadata\n }\n } else {\n if (\n metadata.name === target.name ||\n metadata.tableName === target.name\n ) {\n return metadata\n }\n }\n }\n }\n\n return undefined\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, {\n entityMetadatas: entityMetadatas,\n entityMetadatasMap: new Map(\n entityMetadatas.map((metadata) => [metadata.target, metadata]),\n ),\n })\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 /**\n * Get the replication mode SELECT queries should use for this datasource by default\n */\n defaultReplicationModeForReads(): ReplicationMode {\n if (\"replication\" in this.driver.options) {\n const value = (\n this.driver.options.replication as {\n defaultMode?: ReplicationMode\n }\n ).defaultMode\n if (value) {\n return value\n }\n }\n return \"slave\"\n }\n}\n"],"sourceRoot":".."}
@@ -1,5 +1,12 @@
1
1
  import { BaseDataSourceOptions } from "../../data-source/BaseDataSourceOptions";
2
2
  import { OracleConnectionCredentialsOptions } from "./OracleConnectionCredentialsOptions";
3
+ export interface OracleThickModeOptions {
4
+ binaryDir?: string;
5
+ configDir?: string;
6
+ driverName?: string;
7
+ errorUrl?: string;
8
+ libDir?: string;
9
+ }
3
10
  /**
4
11
  * Oracle-specific connection options.
5
12
  */
@@ -17,6 +24,13 @@ export interface OracleConnectionOptions extends BaseDataSourceOptions, OracleCo
17
24
  * This defaults to require("oracledb")
18
25
  */
19
26
  readonly driver?: any;
27
+ /**
28
+ * Utilize the thick driver. Starting from oracledb version 6, it's necessary to set this to true when opting for the thick client usage.
29
+ * Alternatively, an 'OracleThickModeOptions' object can be configured, which is used for the thick mode configuration by passing it to the 'node-oracledb' driver.
30
+ * For additional information, refer to the details provided in the following link:
31
+ * (https://node-oracledb.readthedocs.io/en/latest/api_manual/oracledb.html#oracledb.initOracleClient)
32
+ */
33
+ readonly thickMode?: boolean | OracleThickModeOptions;
20
34
  /**
21
35
  * A boolean determining whether to pass time values in UTC or local time. (default: false).
22
36
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/oracle/OracleConnectionOptions.ts"],"names":[],"mappings":"","file":"OracleConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { OracleConnectionCredentialsOptions } from \"./OracleConnectionCredentialsOptions\"\n\n/**\n * Oracle-specific connection options.\n */\nexport interface OracleConnectionOptions\n extends BaseDataSourceOptions,\n OracleConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"oracle\"\n\n /**\n * Schema name. By default is \"public\".\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to require(\"oracledb\")\n */\n readonly driver?: any\n\n /**\n * A boolean determining whether to pass time values in UTC or local time. (default: false).\n */\n readonly useUTC?: boolean\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: OracleConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: OracleConnectionCredentialsOptions[]\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/oracle/OracleConnectionOptions.ts"],"names":[],"mappings":"","file":"OracleConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { OracleConnectionCredentialsOptions } from \"./OracleConnectionCredentialsOptions\"\n\nexport interface OracleThickModeOptions {\n binaryDir?: string\n configDir?: string\n driverName?: string\n errorUrl?: string\n libDir?: string\n}\n\n/**\n * Oracle-specific connection options.\n */\nexport interface OracleConnectionOptions\n extends BaseDataSourceOptions,\n OracleConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"oracle\"\n\n /**\n * Schema name. By default is \"public\".\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to require(\"oracledb\")\n */\n readonly driver?: any\n\n /**\n * Utilize the thick driver. Starting from oracledb version 6, it's necessary to set this to true when opting for the thick client usage.\n * Alternatively, an 'OracleThickModeOptions' object can be configured, which is used for the thick mode configuration by passing it to the 'node-oracledb' driver.\n * For additional information, refer to the details provided in the following link:\n * (https://node-oracledb.readthedocs.io/en/latest/api_manual/oracledb.html#oracledb.initOracleClient)\n */\n readonly thickMode?: boolean | OracleThickModeOptions\n\n /**\n * A boolean determining whether to pass time values in UTC or local time. (default: false).\n */\n readonly useUTC?: boolean\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: OracleConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: OracleConnectionCredentialsOptions[]\n }\n}\n"],"sourceRoot":"../.."}
@@ -795,6 +795,12 @@ export class OracleDriver {
795
795
  catch (e) {
796
796
  throw new DriverPackageNotInstalledError("Oracle", "oracledb");
797
797
  }
798
+ const thickMode = this.options.thickMode;
799
+ if (thickMode) {
800
+ typeof thickMode === "object"
801
+ ? this.oracle.initOracleClient(thickMode)
802
+ : this.oracle.initOracleClient();
803
+ }
798
804
  }
799
805
  /**
800
806
  * Creates a new connection pool for a given database credentials.
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/oracle/OracleDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAO5E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAK1E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAK5D;;GAEG;AACH,MAAM,OAAO,YAAY;IAiOrB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,UAAsB;QAjNlC;;;WAGG;QACH,WAAM,GAAU,EAAE,CAAA;QAqBlB;;WAEG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;WAEG;QACH,gBAAW,GAAG,IAAI,CAAA;QAElB;;WAEG;QACH,uBAAkB,GAAG,QAAiB,CAAA;QAEtC;;;;;WAKG;QACH,uBAAkB,GAAiB;YAC/B,MAAM;YACN,OAAO;YACP,WAAW;YACX,UAAU;YACV,MAAM;YACN,KAAK;YACL,UAAU;YACV,QAAQ;YACR,SAAS;YACT,OAAO;YACP,KAAK;YACL,SAAS;YACT,SAAS;YACT,KAAK;YACL,UAAU;YACV,MAAM;YACN,kBA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,MAAM,CAAC,WAAW,EAAE,EAAE,aAAa,EAAE,CAAC,CAAA;SAChD;QAED,0CAA0C;QAC1C,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CACnC,EAAE,EACF;YACI,IAAI,EAAE,WAAW,CAAC,QAAQ;YAC1B,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,aAAa,EAAE,WAAW,CAAC,aAAa;SAC3C,EACD;YACI,OAAO,EAAE,OAAO,CAAC,QAAQ;SAC5B,EACD,OAAO,CAAC,KAAK,IAAI,EAAE,CACtB,CAAA;QAED,6DAA6D;QAC7D,+DAA+D;QAC/D,OAAO,IAAI,OAAO,CAAO,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE;YAClC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,GAAQ,EAAE,IAAS,EAAE,EAAE;gBAC9D,IAAI,GAAG;oBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;gBACzB,EAAE,CAAC,IAAI,CAAC,CAAA;YACZ,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,SAAS,CAAC,IAAS;QAC/B,OAAO,IAAI,OAAO,CAAO,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE;YAClC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;YAClD,IAAI,GAAG,SAAS,CAAA;QACpB,CAAC,CAAC,CAAA;IACN,CAAC;CACJ","file":"OracleDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { OracleQueryRunner } from \"./OracleQueryRunner\"\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/DataSource\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { OracleConnectionOptions } from \"./OracleConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { OracleConnectionCredentialsOptions } from \"./OracleConnectionCredentialsOptions\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\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 { TypeORMError } from \"../../error\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\nimport { OnDeleteType } from \"../../metadata/types/OnDeleteType\"\nimport { OnUpdateType } from \"../../metadata/types/OnUpdateType\"\n\n/**\n * Organizes communication with Oracle RDBMS.\n */\nexport class OracleDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by driver.\n */\n connection: DataSource\n\n /**\n * Underlying oracle library.\n */\n oracle: any\n\n /**\n * Pool for master database.\n */\n master: any\n\n /**\n * Pool for slave databases.\n * Used in replication.\n */\n slaves: any[] = []\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: OracleConnectionOptions\n\n /**\n * Database name used to perform all write queries.\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 = 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.techonthenet.com/oracle/datatypes.php\n * @see https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT012\n */\n supportedDataTypes: ColumnType[] = [\n \"char\",\n \"nchar\",\n \"nvarchar2\",\n \"varchar2\",\n \"long\",\n \"raw\",\n \"long raw\",\n \"number\",\n \"numeric\",\n \"float\",\n \"dec\",\n \"decimal\",\n \"integer\",\n \"int\",\n \"smallint\",\n \"real\",\n \"double precision\",\n \"date\",\n \"timestamp\",\n \"timestamp with time zone\",\n \"timestamp with local time zone\",\n \"interval year to month\",\n \"interval day to second\",\n \"bfile\",\n \"blob\",\n \"clob\",\n \"nclob\",\n \"rowid\",\n \"urowid\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[] = []\n\n /**\n * Returns list of supported onDelete types by driver.\n * https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/sql-language-reference.pdf\n * Oracle does not support NO ACTION, but NO ACTION is set by default in EntityMetadata\n */\n supportedOnDeleteTypes: OnDeleteType[] = [\n \"CASCADE\",\n \"SET NULL\",\n \"NO ACTION\",\n ]\n\n /**\n * Returns list of supported onUpdate types by driver.\n * Oracle does not have onUpdate option, but we allow NO ACTION since it is set by default in EntityMetadata\n */\n supportedOnUpdateTypes: OnUpdateType[] = [\"NO ACTION\"]\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 \"char\",\n \"nchar\",\n \"nvarchar2\",\n \"varchar2\",\n \"varchar\",\n \"raw\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\n \"number\",\n \"float\",\n \"timestamp\",\n \"timestamp with time zone\",\n \"timestamp with local time zone\",\n ]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\"number\"]\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 createDate: \"timestamp\",\n createDateDefault: \"CURRENT_TIMESTAMP\",\n updateDate: \"timestamp\",\n updateDateDefault: \"CURRENT_TIMESTAMP\",\n deleteDate: \"timestamp\",\n deleteDateNullable: true,\n version: \"number\",\n treeLevel: \"number\",\n migrationId: \"number\",\n migrationName: \"varchar2\",\n migrationTimestamp: \"number\",\n cacheId: \"number\",\n cacheIdentifier: \"varchar2\",\n cacheTime: \"number\",\n cacheDuration: \"number\",\n cacheQuery: \"clob\",\n cacheResult: \"clob\",\n metadataType: \"varchar2\",\n metadataDatabase: \"varchar2\",\n metadataSchema: \"varchar2\",\n metadataTable: \"varchar2\",\n metadataName: \"varchar2\",\n metadataValue: \"clob\",\n }\n\n /**\n * The prefix used for the parameters\n */\n parametersPrefix: string = \":\"\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 char: { length: 1 },\n nchar: { length: 1 },\n varchar: { length: 255 },\n varchar2: { length: 255 },\n nvarchar2: { length: 255 },\n raw: { length: 2000 },\n float: { precision: 126 },\n timestamp: { precision: 6 },\n \"timestamp with time zone\": { precision: 6 },\n \"timestamp with local time zone\": { precision: 6 },\n }\n\n /**\n * Max length allowed by Oracle for aliases.\n * @see https://docs.oracle.com/database/121/SQLRF/sql_elements008.htm#SQLRF51129\n * > The following list of rules applies to both quoted and nonquoted identifiers unless otherwise indicated\n * > Names must be from 1 to 30 bytes long with these exceptions:\n * > [...]\n *\n * Since Oracle 12.2 (with a compatible driver/client), the limit has been set to 128.\n * @see https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/Database-Object-Names-and-Qualifiers.html\n *\n * > If COMPATIBLE is set to a value of 12.2 or higher, then names must be from 1 to 128 bytes long with these exceptions\n */\n maxAliasLength = 29\n\n cteCapabilities: CteCapabilities = {\n enabled: true,\n }\n\n dummyTableName = \"DUAL\"\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as OracleConnectionOptions\n\n if (this.options.useUTC === true) {\n process.env.ORA_SDTZ = \"UTC\"\n }\n // load oracle package\n this.loadDependencies()\n\n this.database = DriverUtils.buildDriverOptions(\n this.options.replication\n ? this.options.replication.master\n : this.options,\n ).database\n this.schema = DriverUtils.buildDriverOptions(this.options).schema\n\n // Object.assign(connection.options, DriverUtils.buildDriverOptions(connection.options)); // todo: do it better way\n // validate options to make sure everything is set\n // if (!this.options.host)\n // throw new DriverOptionNotSetError(\"host\");\n // if (!this.options.username)\n // throw new DriverOptionNotSetError(\"username\");\n // if (!this.options.sid)\n // throw new DriverOptionNotSetError(\"sid\");\n //\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * Based on pooling options, it can either create connection immediately,\n * either create a pool and create connection when needed.\n */\n async connect(): Promise<void> {\n this.oracle.fetchAsString = [this.oracle.CLOB]\n this.oracle.fetchAsBuffer = [this.oracle.BLOB]\n if (this.options.replication) {\n this.slaves = await Promise.all(\n this.options.replication.slaves.map((slave) => {\n return this.createPool(this.options, slave)\n }),\n )\n this.master = await this.createPool(\n this.options,\n this.options.replication.master,\n )\n } else {\n this.master = await this.createPool(this.options, this.options)\n }\n\n if (!this.database || !this.schema) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n if (!this.database) {\n this.database = await queryRunner.getCurrentDatabase()\n }\n\n if (!this.schema) {\n this.schema = await queryRunner.getCurrentSchema()\n }\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 if (!this.master)\n return Promise.reject(new ConnectionIsNotSetError(\"oracle\"))\n\n await this.closePool(this.master)\n await Promise.all(this.slaves.map((slave) => this.closePool(slave)))\n this.master = undefined\n this.slaves = []\n }\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 OracleQueryRunner(this, mode)\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) => {\n if (typeof nativeParameters[key] === \"boolean\")\n return nativeParameters[key] ? 1 : 0\n return nativeParameters[key]\n },\n )\n if (!parameters || !Object.keys(parameters).length)\n return [sql, escapedParameters]\n\n const parameterIndexMap = new Map<string, number>()\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 if (parameterIndexMap.has(key)) {\n return this.parametersPrefix + parameterIndexMap.get(key)\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 if (typeof value === \"boolean\") {\n return value ? \"1\" : \"0\"\n }\n\n escapedParameters.push(value)\n parameterIndexMap.set(key, escapedParameters.length)\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 * Oracle does not support table schemas. One user can have only one schema.\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n let tablePath = [tableName]\n\n if (schema) {\n tablePath.unshift(schema)\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 = this.schema\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 if (parts.length === 3) {\n return {\n database: parts[0] || driverDatabase,\n schema: parts[1] || driverSchema,\n tableName: parts[2],\n }\n } else if (parts.length === 2) {\n return {\n database: driverDatabase,\n schema: parts[0] || driverSchema,\n tableName: parts[1],\n }\n } else {\n return {\n database: driverDatabase,\n schema: driverSchema,\n tableName: target,\n }\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 (value === null || value === undefined) return value\n\n if (columnMetadata.type === Boolean) {\n return value ? 1 : 0\n } else if (columnMetadata.type === \"date\") {\n if (typeof value === \"string\") value = value.replace(/[^0-9-]/g, \"\")\n return () =>\n `TO_DATE('${DateUtils.mixedDateToDateString(\n value,\n )}', 'YYYY-MM-DD')`\n } else if (\n columnMetadata.type === Date ||\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"timestamp with time zone\" ||\n columnMetadata.type === \"timestamp with local time zone\"\n ) {\n return DateUtils.mixedDateToDate(value)\n } else if (columnMetadata.type === \"simple-array\") {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(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 (columnMetadata.type === Boolean) {\n value = !!value\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (\n columnMetadata.type === Date ||\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"timestamp with time zone\" ||\n columnMetadata.type === \"timestamp with local time zone\"\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"json\") {\n value = JSON.parse(value)\n } else if (columnMetadata.type === \"simple-array\") {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(value)\n } else if (columnMetadata.type === Number) {\n // convert to number if number\n value = !isNaN(+value) ? parseInt(value) : 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 isArray?: boolean\n }): string {\n if (\n column.type === Number ||\n column.type === Boolean ||\n column.type === \"numeric\" ||\n column.type === \"dec\" ||\n column.type === \"decimal\" ||\n column.type === \"int\" ||\n column.type === \"integer\" ||\n column.type === \"smallint\"\n ) {\n return \"number\"\n } else if (\n column.type === \"real\" ||\n column.type === \"double precision\"\n ) {\n return \"float\"\n } else if (column.type === String || column.type === \"varchar\") {\n return \"varchar2\"\n } else if (column.type === Date) {\n return \"timestamp\"\n } else if ((column.type as any) === Buffer) {\n return \"blob\"\n } else if (column.type === \"uuid\") {\n return \"varchar2\"\n } else if (column.type === \"simple-array\") {\n return \"clob\"\n } else if (column.type === \"simple-json\") {\n return \"clob\"\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 (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 === null || 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.uniques.some(\n (uq) => uq.columns.length === 1 && uq.columns[0] === column,\n )\n }\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata | TableColumn): string {\n if (column.length) return column.length.toString()\n\n switch (column.type) {\n case String:\n case \"varchar\":\n case \"varchar2\":\n case \"nvarchar2\":\n return \"255\"\n case \"raw\":\n return \"2000\"\n case \"uuid\":\n return \"36\"\n default:\n return \"\"\n }\n }\n\n createFullType(column: TableColumn): string {\n let type = column.type\n\n // used 'getColumnLength()' method, because in Oracle column length is required for some data types.\n if (this.getColumnLength(column)) {\n type += `(${this.getColumnLength(column)})`\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.type === \"timestamp with time zone\") {\n type =\n \"TIMESTAMP\" +\n (column.precision !== null && column.precision !== undefined\n ? \"(\" + column.precision + \")\"\n : \"\") +\n \" WITH TIME ZONE\"\n } else if (column.type === \"timestamp with local time zone\") {\n type =\n \"TIMESTAMP\" +\n (column.precision !== null && column.precision !== undefined\n ? \"(\" + column.precision + \")\"\n : \"\") +\n \" WITH LOCAL TIME ZONE\"\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.master) {\n return fail(new TypeORMError(\"Driver not Connected\"))\n }\n\n this.master.getConnection(\n (err: any, connection: any, release: Function) => {\n if (err) return fail(err)\n ok(connection)\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.slaves.length) return this.obtainMasterConnection()\n\n return new Promise<any>((ok, fail) => {\n const random = Math.floor(Math.random() * this.slaves.length)\n\n this.slaves[random].getConnection((err: any, connection: any) => {\n if (err) return fail(err)\n ok(connection)\n })\n })\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertResult: ObjectLiteral) {\n if (!insertResult) return undefined\n\n return Object.keys(insertResult).reduce((map, key) => {\n const column = metadata.findColumnWithDatabaseName(key)\n if (column) {\n OrmUtils.mergeDeep(\n map,\n column.createValueMap(\n this.prepareHydratedValue(insertResult[key], column),\n ),\n )\n }\n return map\n }, {} as ObjectLiteral)\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 const isColumnChanged =\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n tableColumn.length !== this.getColumnLength(columnMetadata) ||\n tableColumn.precision !== columnMetadata.precision ||\n tableColumn.scale !== columnMetadata.scale ||\n // || tableColumn.comment !== columnMetadata.comment\n tableColumn.default !== this.normalizeDefault(columnMetadata) ||\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.asExpression !== columnMetadata.asExpression ||\n tableColumn.generatedType !== columnMetadata.generatedType ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n (columnMetadata.generationStrategy !== \"uuid\" &&\n tableColumn.isGenerated !== columnMetadata.isGenerated)\n\n // DEBUG SECTION\n // if (isColumnChanged) {\n // console.log(\"table:\", columnMetadata.entityMetadata.tableName)\n // console.log(\n // \"name:\",\n // tableColumn.name,\n // columnMetadata.databaseName,\n // )\n // console.log(\n // \"type:\",\n // tableColumn.type,\n // this.normalizeType(columnMetadata),\n // )\n // console.log(\n // \"length:\",\n // tableColumn.length,\n // columnMetadata.length,\n // )\n // console.log(\n // \"precision:\",\n // tableColumn.precision,\n // columnMetadata.precision,\n // )\n // console.log(\"scale:\", tableColumn.scale, columnMetadata.scale)\n // console.log(\n // \"comment:\",\n // tableColumn.comment,\n // columnMetadata.comment,\n // )\n // console.log(\n // \"default:\",\n // tableColumn.default,\n // this.normalizeDefault(columnMetadata),\n // )\n // console.log(\n // \"enum:\",\n // tableColumn.enum &&\n // columnMetadata.enum &&\n // !OrmUtils.isArraysEqual(\n // tableColumn.enum,\n // columnMetadata.enum.map((val) => val + \"\"),\n // ),\n // )\n // console.log(\n // \"onUpdate:\",\n // tableColumn.onUpdate,\n // columnMetadata.onUpdate,\n // )\n // console.log(\n // \"isPrimary:\",\n // tableColumn.isPrimary,\n // columnMetadata.isPrimary,\n // )\n // console.log(\n // \"isNullable:\",\n // tableColumn.isNullable,\n // columnMetadata.isNullable,\n // )\n // console.log(\n // \"asExpression:\",\n // tableColumn.asExpression,\n // columnMetadata.asExpression,\n // )\n // console.log(\n // \"generatedType:\",\n // tableColumn.generatedType,\n // columnMetadata.generatedType,\n // )\n // console.log(\n // \"isUnique:\",\n // tableColumn.isUnique,\n // this.normalizeIsUnique(columnMetadata),\n // )\n // console.log(\n // \"isGenerated:\",\n // tableColumn.isGenerated,\n // columnMetadata.isGenerated,\n // )\n // console.log(\"==========================================\")\n // }\n\n return isColumnChanged\n })\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return true\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 false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return this.parametersPrefix + (index + 1)\n }\n\n /**\n * Converts column type in to native oracle type.\n */\n columnTypeToNativeParameter(type: ColumnType): any {\n switch (this.normalizeType({ type: type as any })) {\n case \"number\":\n case \"numeric\":\n case \"int\":\n case \"integer\":\n case \"smallint\":\n case \"dec\":\n case \"decimal\":\n return this.oracle.NUMBER\n case \"char\":\n case \"nchar\":\n case \"nvarchar2\":\n case \"varchar2\":\n return this.oracle.STRING\n case \"blob\":\n return this.oracle.BLOB\n case \"clob\":\n return this.oracle.CLOB\n case \"date\":\n case \"timestamp\":\n case \"timestamp with time zone\":\n case \"timestamp with local time zone\":\n return this.oracle.DATE\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): void {\n try {\n const oracle = this.options.driver || PlatformTools.load(\"oracledb\")\n this.oracle = oracle\n } catch (e) {\n throw new DriverPackageNotInstalledError(\"Oracle\", \"oracledb\")\n }\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected async createPool(\n options: OracleConnectionOptions,\n credentials: OracleConnectionCredentialsOptions,\n ): Promise<any> {\n credentials = Object.assign(\n {},\n credentials,\n DriverUtils.buildDriverOptions(credentials),\n ) // todo: do it better way\n\n if (!credentials.connectString) {\n let address = `(PROTOCOL=TCP)`\n\n if (credentials.host) {\n address += `(HOST=${credentials.host})`\n }\n\n if (credentials.port) {\n address += `(PORT=${credentials.port})`\n }\n\n let connectData = `(SERVER=DEDICATED)`\n\n if (credentials.sid) {\n connectData += `(SID=${credentials.sid})`\n }\n\n if (credentials.serviceName) {\n connectData += `(SERVICE_NAME=${credentials.serviceName})`\n }\n\n const connectString = `(DESCRIPTION=(ADDRESS=${address})(CONNECT_DATA=${connectData}))`\n Object.assign(credentials, { connectString })\n }\n\n // build connection options for the driver\n const connectionOptions = Object.assign(\n {},\n {\n user: credentials.username,\n password: credentials.password,\n connectString: credentials.connectString,\n },\n {\n poolMax: options.poolSize,\n },\n options.extra || {},\n )\n\n // pooling is enabled either when its set explicitly to true,\n // either when its not defined at all (e.g. enabled by default)\n return new Promise<void>((ok, fail) => {\n this.oracle.createPool(connectionOptions, (err: any, pool: any) => {\n if (err) return fail(err)\n ok(pool)\n })\n })\n }\n\n /**\n * Closes connection pool.\n */\n protected async closePool(pool: any): Promise<void> {\n return new Promise<void>((ok, fail) => {\n pool.close((err: any) => (err ? fail(err) : ok()))\n pool = undefined\n })\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/oracle/OracleDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAO5E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAK1E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAK5D;;GAEG;AACH,MAAM,OAAO,YAAY;IAiOrB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,UAAsB;QAjNlC;;;WAGG;QACH,WAAM,GAAU,EAAE,CAAA;QAqBlB;;WAEG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;WAEG;QACH,gBAAW,GAAG,IAAI,CAAA;QAElB;;WAEG;QACH,uBAAkB,GAAG,QAAiB,CAAA;QAEtC;;;;;WAKG;QACH,uBAAkB,GAAiB;YAC/B,MAAM;YACN,OAAO;YACP,WAAW;YACX,UAAU;YACV,MAAM;YACN,KAAK;YACL,UAAU;YACV,QAAQ;YACR,SAAS;YACT,OAAO;YACP,KAAK;YACL,SAAS;YACT,SAAS;YACT,KAAK;YACL,UAAU;YACV,MAAM;YAC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CAAA;YAClD,IAAI,GAAG,SAAS,CAAA;QACpB,CAAC,CAAC,CAAA;IACN,CAAC;CACJ","file":"OracleDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { OracleQueryRunner } from \"./OracleQueryRunner\"\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/DataSource\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { OracleConnectionOptions } from \"./OracleConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { OracleConnectionCredentialsOptions } from \"./OracleConnectionCredentialsOptions\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\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 { TypeORMError } from \"../../error\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\nimport { OnDeleteType } from \"../../metadata/types/OnDeleteType\"\nimport { OnUpdateType } from \"../../metadata/types/OnUpdateType\"\n\n/**\n * Organizes communication with Oracle RDBMS.\n */\nexport class OracleDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by driver.\n */\n connection: DataSource\n\n /**\n * Underlying oracle library.\n */\n oracle: any\n\n /**\n * Pool for master database.\n */\n master: any\n\n /**\n * Pool for slave databases.\n * Used in replication.\n */\n slaves: any[] = []\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: OracleConnectionOptions\n\n /**\n * Database name used to perform all write queries.\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 = 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.techonthenet.com/oracle/datatypes.php\n * @see https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT012\n */\n supportedDataTypes: ColumnType[] = [\n \"char\",\n \"nchar\",\n \"nvarchar2\",\n \"varchar2\",\n \"long\",\n \"raw\",\n \"long raw\",\n \"number\",\n \"numeric\",\n \"float\",\n \"dec\",\n \"decimal\",\n \"integer\",\n \"int\",\n \"smallint\",\n \"real\",\n \"double precision\",\n \"date\",\n \"timestamp\",\n \"timestamp with time zone\",\n \"timestamp with local time zone\",\n \"interval year to month\",\n \"interval day to second\",\n \"bfile\",\n \"blob\",\n \"clob\",\n \"nclob\",\n \"rowid\",\n \"urowid\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[] = []\n\n /**\n * Returns list of supported onDelete types by driver.\n * https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/sql-language-reference.pdf\n * Oracle does not support NO ACTION, but NO ACTION is set by default in EntityMetadata\n */\n supportedOnDeleteTypes: OnDeleteType[] = [\n \"CASCADE\",\n \"SET NULL\",\n \"NO ACTION\",\n ]\n\n /**\n * Returns list of supported onUpdate types by driver.\n * Oracle does not have onUpdate option, but we allow NO ACTION since it is set by default in EntityMetadata\n */\n supportedOnUpdateTypes: OnUpdateType[] = [\"NO ACTION\"]\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 \"char\",\n \"nchar\",\n \"nvarchar2\",\n \"varchar2\",\n \"varchar\",\n \"raw\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\n \"number\",\n \"float\",\n \"timestamp\",\n \"timestamp with time zone\",\n \"timestamp with local time zone\",\n ]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\"number\"]\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 createDate: \"timestamp\",\n createDateDefault: \"CURRENT_TIMESTAMP\",\n updateDate: \"timestamp\",\n updateDateDefault: \"CURRENT_TIMESTAMP\",\n deleteDate: \"timestamp\",\n deleteDateNullable: true,\n version: \"number\",\n treeLevel: \"number\",\n migrationId: \"number\",\n migrationName: \"varchar2\",\n migrationTimestamp: \"number\",\n cacheId: \"number\",\n cacheIdentifier: \"varchar2\",\n cacheTime: \"number\",\n cacheDuration: \"number\",\n cacheQuery: \"clob\",\n cacheResult: \"clob\",\n metadataType: \"varchar2\",\n metadataDatabase: \"varchar2\",\n metadataSchema: \"varchar2\",\n metadataTable: \"varchar2\",\n metadataName: \"varchar2\",\n metadataValue: \"clob\",\n }\n\n /**\n * The prefix used for the parameters\n */\n parametersPrefix: string = \":\"\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 char: { length: 1 },\n nchar: { length: 1 },\n varchar: { length: 255 },\n varchar2: { length: 255 },\n nvarchar2: { length: 255 },\n raw: { length: 2000 },\n float: { precision: 126 },\n timestamp: { precision: 6 },\n \"timestamp with time zone\": { precision: 6 },\n \"timestamp with local time zone\": { precision: 6 },\n }\n\n /**\n * Max length allowed by Oracle for aliases.\n * @see https://docs.oracle.com/database/121/SQLRF/sql_elements008.htm#SQLRF51129\n * > The following list of rules applies to both quoted and nonquoted identifiers unless otherwise indicated\n * > Names must be from 1 to 30 bytes long with these exceptions:\n * > [...]\n *\n * Since Oracle 12.2 (with a compatible driver/client), the limit has been set to 128.\n * @see https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/Database-Object-Names-and-Qualifiers.html\n *\n * > If COMPATIBLE is set to a value of 12.2 or higher, then names must be from 1 to 128 bytes long with these exceptions\n */\n maxAliasLength = 29\n\n cteCapabilities: CteCapabilities = {\n enabled: true,\n }\n\n dummyTableName = \"DUAL\"\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as OracleConnectionOptions\n\n if (this.options.useUTC === true) {\n process.env.ORA_SDTZ = \"UTC\"\n }\n // load oracle package\n this.loadDependencies()\n\n this.database = DriverUtils.buildDriverOptions(\n this.options.replication\n ? this.options.replication.master\n : this.options,\n ).database\n this.schema = DriverUtils.buildDriverOptions(this.options).schema\n\n // Object.assign(connection.options, DriverUtils.buildDriverOptions(connection.options)); // todo: do it better way\n // validate options to make sure everything is set\n // if (!this.options.host)\n // throw new DriverOptionNotSetError(\"host\");\n // if (!this.options.username)\n // throw new DriverOptionNotSetError(\"username\");\n // if (!this.options.sid)\n // throw new DriverOptionNotSetError(\"sid\");\n //\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * Based on pooling options, it can either create connection immediately,\n * either create a pool and create connection when needed.\n */\n async connect(): Promise<void> {\n this.oracle.fetchAsString = [this.oracle.CLOB]\n this.oracle.fetchAsBuffer = [this.oracle.BLOB]\n if (this.options.replication) {\n this.slaves = await Promise.all(\n this.options.replication.slaves.map((slave) => {\n return this.createPool(this.options, slave)\n }),\n )\n this.master = await this.createPool(\n this.options,\n this.options.replication.master,\n )\n } else {\n this.master = await this.createPool(this.options, this.options)\n }\n\n if (!this.database || !this.schema) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n if (!this.database) {\n this.database = await queryRunner.getCurrentDatabase()\n }\n\n if (!this.schema) {\n this.schema = await queryRunner.getCurrentSchema()\n }\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 if (!this.master)\n return Promise.reject(new ConnectionIsNotSetError(\"oracle\"))\n\n await this.closePool(this.master)\n await Promise.all(this.slaves.map((slave) => this.closePool(slave)))\n this.master = undefined\n this.slaves = []\n }\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 OracleQueryRunner(this, mode)\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) => {\n if (typeof nativeParameters[key] === \"boolean\")\n return nativeParameters[key] ? 1 : 0\n return nativeParameters[key]\n },\n )\n if (!parameters || !Object.keys(parameters).length)\n return [sql, escapedParameters]\n\n const parameterIndexMap = new Map<string, number>()\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 if (parameterIndexMap.has(key)) {\n return this.parametersPrefix + parameterIndexMap.get(key)\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 if (typeof value === \"boolean\") {\n return value ? \"1\" : \"0\"\n }\n\n escapedParameters.push(value)\n parameterIndexMap.set(key, escapedParameters.length)\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 * Oracle does not support table schemas. One user can have only one schema.\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n let tablePath = [tableName]\n\n if (schema) {\n tablePath.unshift(schema)\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 = this.schema\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 if (parts.length === 3) {\n return {\n database: parts[0] || driverDatabase,\n schema: parts[1] || driverSchema,\n tableName: parts[2],\n }\n } else if (parts.length === 2) {\n return {\n database: driverDatabase,\n schema: parts[0] || driverSchema,\n tableName: parts[1],\n }\n } else {\n return {\n database: driverDatabase,\n schema: driverSchema,\n tableName: target,\n }\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 (value === null || value === undefined) return value\n\n if (columnMetadata.type === Boolean) {\n return value ? 1 : 0\n } else if (columnMetadata.type === \"date\") {\n if (typeof value === \"string\") value = value.replace(/[^0-9-]/g, \"\")\n return () =>\n `TO_DATE('${DateUtils.mixedDateToDateString(\n value,\n )}', 'YYYY-MM-DD')`\n } else if (\n columnMetadata.type === Date ||\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"timestamp with time zone\" ||\n columnMetadata.type === \"timestamp with local time zone\"\n ) {\n return DateUtils.mixedDateToDate(value)\n } else if (columnMetadata.type === \"simple-array\") {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(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 (columnMetadata.type === Boolean) {\n value = !!value\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (\n columnMetadata.type === Date ||\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"timestamp with time zone\" ||\n columnMetadata.type === \"timestamp with local time zone\"\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"json\") {\n value = JSON.parse(value)\n } else if (columnMetadata.type === \"simple-array\") {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(value)\n } else if (columnMetadata.type === Number) {\n // convert to number if number\n value = !isNaN(+value) ? parseInt(value) : 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 isArray?: boolean\n }): string {\n if (\n column.type === Number ||\n column.type === Boolean ||\n column.type === \"numeric\" ||\n column.type === \"dec\" ||\n column.type === \"decimal\" ||\n column.type === \"int\" ||\n column.type === \"integer\" ||\n column.type === \"smallint\"\n ) {\n return \"number\"\n } else if (\n column.type === \"real\" ||\n column.type === \"double precision\"\n ) {\n return \"float\"\n } else if (column.type === String || column.type === \"varchar\") {\n return \"varchar2\"\n } else if (column.type === Date) {\n return \"timestamp\"\n } else if ((column.type as any) === Buffer) {\n return \"blob\"\n } else if (column.type === \"uuid\") {\n return \"varchar2\"\n } else if (column.type === \"simple-array\") {\n return \"clob\"\n } else if (column.type === \"simple-json\") {\n return \"clob\"\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 (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 === null || 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.uniques.some(\n (uq) => uq.columns.length === 1 && uq.columns[0] === column,\n )\n }\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata | TableColumn): string {\n if (column.length) return column.length.toString()\n\n switch (column.type) {\n case String:\n case \"varchar\":\n case \"varchar2\":\n case \"nvarchar2\":\n return \"255\"\n case \"raw\":\n return \"2000\"\n case \"uuid\":\n return \"36\"\n default:\n return \"\"\n }\n }\n\n createFullType(column: TableColumn): string {\n let type = column.type\n\n // used 'getColumnLength()' method, because in Oracle column length is required for some data types.\n if (this.getColumnLength(column)) {\n type += `(${this.getColumnLength(column)})`\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.type === \"timestamp with time zone\") {\n type =\n \"TIMESTAMP\" +\n (column.precision !== null && column.precision !== undefined\n ? \"(\" + column.precision + \")\"\n : \"\") +\n \" WITH TIME ZONE\"\n } else if (column.type === \"timestamp with local time zone\") {\n type =\n \"TIMESTAMP\" +\n (column.precision !== null && column.precision !== undefined\n ? \"(\" + column.precision + \")\"\n : \"\") +\n \" WITH LOCAL TIME ZONE\"\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.master) {\n return fail(new TypeORMError(\"Driver not Connected\"))\n }\n\n this.master.getConnection(\n (err: any, connection: any, release: Function) => {\n if (err) return fail(err)\n ok(connection)\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.slaves.length) return this.obtainMasterConnection()\n\n return new Promise<any>((ok, fail) => {\n const random = Math.floor(Math.random() * this.slaves.length)\n\n this.slaves[random].getConnection((err: any, connection: any) => {\n if (err) return fail(err)\n ok(connection)\n })\n })\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertResult: ObjectLiteral) {\n if (!insertResult) return undefined\n\n return Object.keys(insertResult).reduce((map, key) => {\n const column = metadata.findColumnWithDatabaseName(key)\n if (column) {\n OrmUtils.mergeDeep(\n map,\n column.createValueMap(\n this.prepareHydratedValue(insertResult[key], column),\n ),\n )\n }\n return map\n }, {} as ObjectLiteral)\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 const isColumnChanged =\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n tableColumn.length !== this.getColumnLength(columnMetadata) ||\n tableColumn.precision !== columnMetadata.precision ||\n tableColumn.scale !== columnMetadata.scale ||\n // || tableColumn.comment !== columnMetadata.comment\n tableColumn.default !== this.normalizeDefault(columnMetadata) ||\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.asExpression !== columnMetadata.asExpression ||\n tableColumn.generatedType !== columnMetadata.generatedType ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n (columnMetadata.generationStrategy !== \"uuid\" &&\n tableColumn.isGenerated !== columnMetadata.isGenerated)\n\n // DEBUG SECTION\n // if (isColumnChanged) {\n // console.log(\"table:\", columnMetadata.entityMetadata.tableName)\n // console.log(\n // \"name:\",\n // tableColumn.name,\n // columnMetadata.databaseName,\n // )\n // console.log(\n // \"type:\",\n // tableColumn.type,\n // this.normalizeType(columnMetadata),\n // )\n // console.log(\n // \"length:\",\n // tableColumn.length,\n // columnMetadata.length,\n // )\n // console.log(\n // \"precision:\",\n // tableColumn.precision,\n // columnMetadata.precision,\n // )\n // console.log(\"scale:\", tableColumn.scale, columnMetadata.scale)\n // console.log(\n // \"comment:\",\n // tableColumn.comment,\n // columnMetadata.comment,\n // )\n // console.log(\n // \"default:\",\n // tableColumn.default,\n // this.normalizeDefault(columnMetadata),\n // )\n // console.log(\n // \"enum:\",\n // tableColumn.enum &&\n // columnMetadata.enum &&\n // !OrmUtils.isArraysEqual(\n // tableColumn.enum,\n // columnMetadata.enum.map((val) => val + \"\"),\n // ),\n // )\n // console.log(\n // \"onUpdate:\",\n // tableColumn.onUpdate,\n // columnMetadata.onUpdate,\n // )\n // console.log(\n // \"isPrimary:\",\n // tableColumn.isPrimary,\n // columnMetadata.isPrimary,\n // )\n // console.log(\n // \"isNullable:\",\n // tableColumn.isNullable,\n // columnMetadata.isNullable,\n // )\n // console.log(\n // \"asExpression:\",\n // tableColumn.asExpression,\n // columnMetadata.asExpression,\n // )\n // console.log(\n // \"generatedType:\",\n // tableColumn.generatedType,\n // columnMetadata.generatedType,\n // )\n // console.log(\n // \"isUnique:\",\n // tableColumn.isUnique,\n // this.normalizeIsUnique(columnMetadata),\n // )\n // console.log(\n // \"isGenerated:\",\n // tableColumn.isGenerated,\n // columnMetadata.isGenerated,\n // )\n // console.log(\"==========================================\")\n // }\n\n return isColumnChanged\n })\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return true\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 false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return this.parametersPrefix + (index + 1)\n }\n\n /**\n * Converts column type in to native oracle type.\n */\n columnTypeToNativeParameter(type: ColumnType): any {\n switch (this.normalizeType({ type: type as any })) {\n case \"number\":\n case \"numeric\":\n case \"int\":\n case \"integer\":\n case \"smallint\":\n case \"dec\":\n case \"decimal\":\n return this.oracle.NUMBER\n case \"char\":\n case \"nchar\":\n case \"nvarchar2\":\n case \"varchar2\":\n return this.oracle.STRING\n case \"blob\":\n return this.oracle.BLOB\n case \"clob\":\n return this.oracle.CLOB\n case \"date\":\n case \"timestamp\":\n case \"timestamp with time zone\":\n case \"timestamp with local time zone\":\n return this.oracle.DATE\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): void {\n try {\n const oracle = this.options.driver || PlatformTools.load(\"oracledb\")\n this.oracle = oracle\n } catch (e) {\n throw new DriverPackageNotInstalledError(\"Oracle\", \"oracledb\")\n }\n const thickMode = this.options.thickMode\n if (thickMode) {\n typeof thickMode === \"object\"\n ? this.oracle.initOracleClient(thickMode)\n : this.oracle.initOracleClient()\n }\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected async createPool(\n options: OracleConnectionOptions,\n credentials: OracleConnectionCredentialsOptions,\n ): Promise<any> {\n credentials = Object.assign(\n {},\n credentials,\n DriverUtils.buildDriverOptions(credentials),\n ) // todo: do it better way\n\n if (!credentials.connectString) {\n let address = `(PROTOCOL=TCP)`\n\n if (credentials.host) {\n address += `(HOST=${credentials.host})`\n }\n\n if (credentials.port) {\n address += `(PORT=${credentials.port})`\n }\n\n let connectData = `(SERVER=DEDICATED)`\n\n if (credentials.sid) {\n connectData += `(SID=${credentials.sid})`\n }\n\n if (credentials.serviceName) {\n connectData += `(SERVICE_NAME=${credentials.serviceName})`\n }\n\n const connectString = `(DESCRIPTION=(ADDRESS=${address})(CONNECT_DATA=${connectData}))`\n Object.assign(credentials, { connectString })\n }\n\n // build connection options for the driver\n const connectionOptions = Object.assign(\n {},\n {\n user: credentials.username,\n password: credentials.password,\n connectString: credentials.connectString,\n },\n {\n poolMax: options.poolSize,\n },\n options.extra || {},\n )\n\n // pooling is enabled either when its set explicitly to true,\n // either when its not defined at all (e.g. enabled by default)\n return new Promise<void>((ok, fail) => {\n this.oracle.createPool(connectionOptions, (err: any, pool: any) => {\n if (err) return fail(err)\n ok(pool)\n })\n })\n }\n\n /**\n * Closes connection pool.\n */\n protected async closePool(pool: any): Promise<void> {\n return new Promise<void>((ok, fail) => {\n pool.close((err: any) => (err ? fail(err) : ok()))\n pool = undefined\n })\n }\n}\n"],"sourceRoot":"../.."}
@@ -138,12 +138,18 @@ export class SapQueryRunner extends BaseQueryRunner {
138
138
  this.driver.connection.logger.logQuery(query, parameters, this);
139
139
  const queryStartTime = +new Date();
140
140
  const isInsertQuery = query.substr(0, 11) === "INSERT INTO";
141
- statement = databaseConnection.prepare(query);
142
- const raw = await new Promise((ok, fail) => {
143
- statement.exec(parameters, (err, raw) => err
144
- ? fail(new QueryFailedError(query, parameters, err))
145
- : ok(raw));
146
- });
141
+ if (parameters === null || parameters === void 0 ? void 0 : parameters.some(Array.isArray)) {
142
+ statement = await promisify(databaseConnection.prepare.bind(databaseConnection))(query);
143
+ }
144
+ let raw;
145
+ try {
146
+ raw = statement
147
+ ? await promisify(statement.exec.bind(statement))(parameters)
148
+ : await promisify(databaseConnection.exec.bind(databaseConnection))(query, parameters, {});
149
+ }
150
+ catch (err) {
151
+ throw new QueryFailedError(query, parameters, err);
152
+ }
147
153
  // log slow queries if maxQueryExecution time is set
148
154
  const maxQueryExecutionTime = this.driver.connection.options.maxQueryExecutionTime;
149
155
  const queryEndTime = +new Date();