Skip to content

feat!: remove deprecated Connection and ConnectionOptions#12022

Merged
alumni merged 5 commits intotypeorm:masterfrom
alumni:feat/remove-connection
Feb 21, 2026
Merged

feat!: remove deprecated Connection and ConnectionOptions#12022
alumni merged 5 commits intotypeorm:masterfrom
alumni:feat/remove-connection

Conversation

@alumni
Copy link
Copy Markdown
Collaborator

@alumni alumni commented Feb 20, 2026

Description of change

  • Remove Connection / ConnectionOptions which were deprecated in 0.3 in favor of DataSource / DataSourceOptions.
  • Rename e.g. PostgresConnectionOptions to PostgresDataSourceOptions which was omitted in 0.3 - these interfaces are not directly exported in the root of the package.
  • Remove deprecated methods of DataSource.
  • Migrate our own code (mostly tests) to use the replacements that were introduced in 0.3.

Fixes #12020

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • This pull request links relevant issues as Fixes #00000
  • There are new or updated tests validating the change (tests/**.test.ts)
  • Documentation has been updated to reflect this change (docs/docs/**.md)

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

User description

Description of change

  • Remove Connection / ConnectionOptions which were deprecated in 0.3 in favor of DataSource / DataSourceOptions.
  • Rename e.g. PostgresConnectionOptions to PostgresDataSourceOptions which was omitted in 0.3 - these interfaces are not directly exported in the root of the package.
  • Remove deprecated methods of DataSource.
  • Migrate our own code (mostly tests) to use the replacements that were introduced in 0.3.

TODO: add mention in the "migration to v1" doc.

Fixes #12020

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • This pull request links relevant issues as Fixes #00000
  • There are new or updated tests validating the change (tests/**.test.ts)
  • Documentation has been updated to reflect this change (docs/docs/**.md)

PR Type

Enhancement, Bug fix, Tests


Description

  • Remove deprecated Connection and ConnectionOptions classes that were superseded by DataSource and DataSourceOptions in v0.3

  • Rename all *ConnectionOptions interfaces to *DataSourceOptions across all database drivers (Postgres, MySQL, Oracle, MongoDB, SQLite, SQL Server, Spanner, CockroachDB, Aurora variants, and others)

  • Remove deprecated DataSource methods: isConnected getter, connect(), and close() methods - replaced by isInitialized, initialize(), and destroy()

  • Update deprecated function calls in globals.ts from .connect() to .initialize()

  • Migrate test suite to use new DataSource API, replacing Connection types and deprecated method calls (close()destroy(), connect()initialize())

  • Add comprehensive JSDoc @param annotations to driver methods for improved documentation

  • Reorganize imports alphabetically across driver files for consistency

  • Update type references in query runners and helper utilities to use new naming conventions


Diagram Walkthrough

flowchart LR
  A["Deprecated APIs<br/>Connection<br/>ConnectionOptions<br/>*ConnectionOptions"] -->|"Remove"| B["Removed from codebase"]
  C["DataSource<br/>DataSourceOptions<br/>*DataSourceOptions"] -->|"Rename & Update"| D["New standard APIs"]
  E["Deprecated Methods<br/>isConnected<br/>connect<br/>close"] -->|"Remove"| F["Use replacements<br/>isInitialized<br/>initialize<br/>destroy"]
  G["Test Suite"] -->|"Migrate"| H["Updated to use<br/>DataSource API"]
Loading

File Walkthrough

Relevant files
Tests
21 files
data-source.test.ts
Migrate connection tests to DataSource terminology             

test/functional/connection/data-source.test.ts

  • Renamed import from PostgresConnectionOptions to
    PostgresDataSourceOptions
  • Updated test suite name from "Connection" to "DataSource" and
    refactored variable names from connection/connections to
    dataSource/dataSources
  • Removed deprecated test cases and comments referencing reactive entity
    managers
  • Updated async/await patterns in test setup and teardown hooks
  • Fixed typo in comment from "open a close" to "open and close"
+109/-143
connection-manager.test.ts
Migrate connection manager tests to new DataSource API     

test/functional/connection-manager/connection-manager.test.ts

  • Removed ConnectionOptions type annotations from test code
  • Replaced deprecated isConnected property with isInitialized
  • Replaced deprecated close() method calls with destroy()
  • Replaced deprecated connect() method calls with initialize()
+30/-26 
data-source-options.test.ts
Rename postgres connection options tests to DataSource     

test/functional/driver/postgres/data-source-options.test.ts

  • Updated test descriptions from "connection options" to "DataSource
    options"
  • Renamed connections variable to dataSources throughout
  • Refactored async setup in before() hooks for better readability
  • Updated variable names in test assertions
+31/-32 
issue-6442.test.ts
Update issue 6442 test to use new DataSource API                 

test/github-issues/6442/issue-6442.test.ts

  • Renamed MysqlConnectionOptions to MysqlDataSourceOptions
  • Replaced deprecated close() method calls with destroy()
+5/-5     
issue-6900.test.ts
Update issue 6900 test to use DataSourceOptions naming     

test/github-issues/6900/issue-6900.test.ts

  • Renamed MongoConnectionOptions to MongoDataSourceOptions
  • Updated type casts to use new naming convention
+3/-3     
MockQueryResultCache.ts
Update MockQueryResultCache to use DataSourceOptions naming

test/functional/cache/provider/MockQueryResultCache.ts

  • Renamed PostgresConnectionOptions to PostgresDataSourceOptions
  • Renamed SqlServerConnectionOptions to SqlServerDataSourceOptions
  • Updated type union in constructor
+3/-3     
issue-4753.test.ts
Update issue 4753 test to use DataSourceOptions naming     

test/github-issues/4753/issue-4753.test.ts

  • Renamed MysqlConnectionOptions to MysqlDataSourceOptions
  • Updated type guard function parameter type
+3/-3     
issue-114.test.ts
Update issue 114 test to use DataSourceOptions naming       

test/github-issues/114/issue-114.test.ts

  • Renamed PostgresConnectionOptions to PostgresDataSourceOptions
  • Updated type cast in test assertion
+2/-2     
issue-2096.test.ts
Update issue 2096 test to use DataSourceOptions naming     

test/github-issues/2096/issue-2096.test.ts

  • Renamed MysqlConnectionOptions to MysqlDataSourceOptions
  • Updated type cast in test
+2/-2     
better-sqlite3-native-binding.test.ts
Update better-sqlite3 test to use DataSourceOptions naming

test/functional/driver/better-sqlite3/better-sqlite3-native-binding.test.ts

  • Renamed BetterSqlite3ConnectionOptions to
    BetterSqlite3DataSourceOptions
  • Updated type cast in test assertion
+2/-2     
issue-11423.test.ts
Update issue 11423 test to use DataSourceOptions naming   

test/github-issues/11423/issue-11423.test.ts

  • Renamed PostgresConnectionOptions to PostgresDataSourceOptions
  • Updated type cast in test setup
+2/-2     
issue-8796.test.ts
Migrate issue 8796 test from Connection to DataSource       

test/github-issues/8796/issue-8796.test.ts

  • Removed import of deprecated Connection class
  • Added import of DataSource class
  • Updated variable type from Connection[] to DataSource[]
  • Reorganized imports in alphabetical order
  • Fixed relative import path for entity
+5/-5     
issue-8723.test.ts
Migrate issue 8723 test from Connection to DataSource       

test/github-issues/8723/issue-8723.test.ts

  • Removed import of deprecated Connection class
  • Added import of DataSource class
  • Updated variable type from Connection[] to DataSource[]
  • Reorganized imports in alphabetical order
+4/-5     
helpers.ts
Update CTE helpers to use DataSource instead of Connection

test/functional/query-builder/cte/helpers.ts

  • Renamed Connection import to DataSource
  • Updated function parameter type from Connection to DataSource
  • Updated parameter name from conn to dataSource
+4/-3     
issue-8527.test.ts
Migrate issue 8527 test from Connection to DataSource       

test/github-issues/8527/issue-8527.test.ts

  • Removed import of deprecated Connection class
  • Added import of DataSource class
  • Updated variable type from Connection[] to DataSource[]
  • Reorganized imports in alphabetical order
+3/-4     
auto-save.test.ts
Update sqljs auto-save tests to use destroy method             

test/functional/sqljs/auto-save.test.ts

  • Replaced deprecated close() method calls with destroy()
+2/-2     
enable-query-timeout.test.ts
Update mysql test description to reference DataSource       

test/functional/driver/mysql/data-source-options/enable-query-timeout.test.ts

  • Updated test description from "connection options" to "DataSource
    options"
+1/-1     
issue-6958.test.ts
Update issue 6958 test to use destroy method                         

test/github-issues/6958/issue-6958.test.ts

  • Replaced deprecated close() method call with destroy()
+1/-1     
error-on-query-after-close.test.ts
Update sqlite error test to use destroy method                     

test/functional/sqlite/error-on-query-after-close.test.ts

  • Replaced deprecated close() method call with destroy()
+1/-1     
persistence-custom-column-names.test.ts
Update persistence test to use destroy method                       

test/functional/persistence/custom-column-names/persistence-custom-column-names.test.ts

  • Replaced deprecated close() method call with destroy()
+1/-1     
mssql-add-column-with-default-value.test.ts
Update mssql test to use destroy method                                   

test/other-issues/mssql-add-column-with-default-value/mssql-add-column-with-default-value.test.ts

  • Replaced deprecated close() method call with destroy()
+1/-1     
Enhancement
40 files
SqlServerDriver.ts
Rename SqlServerConnectionOptions to DataSourceOptions     

src/driver/sqlserver/SqlServerDriver.ts

  • Reorganized imports in alphabetical order
  • Renamed SqlServerConnectionOptions to SqlServerDataSourceOptions
    throughout the file
  • Added JSDoc @param annotations to multiple methods for better
    documentation
  • Removed empty JSDoc lines (lines with just *)
+62/-25 
PostgresDriver.ts
Rename PostgresConnectionOptions to DataSourceOptions       

src/driver/postgres/PostgresDriver.ts

  • Reorganized imports in alphabetical order
  • Renamed PostgresConnectionOptions to PostgresDataSourceOptions
    throughout the file
  • Added comprehensive JSDoc @param annotations to methods
  • Removed empty JSDoc lines for cleaner documentation
+53/-16 
MysqlDriver.ts
Rename MysqlConnectionOptions to DataSourceOptions             

src/driver/mysql/MysqlDriver.ts

  • Renamed MysqlConnectionOptions to MysqlDataSourceOptions throughout
    the file
  • Added JSDoc @param annotations to multiple methods
  • Removed empty JSDoc lines
+44/-5   
SpannerDriver.ts
Rename SpannerConnectionOptions to DataSourceOptions         

src/driver/spanner/SpannerDriver.ts

  • Reorganized imports in alphabetical order
  • Renamed SpannerConnectionOptions to SpannerDataSourceOptions
  • Changed connection parameter type from Connection to DataSource in
    constructor
  • Added JSDoc @param annotations to methods
  • Removed empty JSDoc lines
+53/-20 
OracleDriver.ts
Rename OracleConnectionOptions to DataSourceOptions           

src/driver/oracle/OracleDriver.ts

  • Reorganized imports in alphabetical order
  • Renamed OracleConnectionOptions to OracleDataSourceOptions throughout
    the file
  • Added comprehensive JSDoc @param annotations to methods
  • Removed empty JSDoc lines
+57/-25 
CockroachDriver.ts
Rename CockroachConnectionOptions to DataSourceOptions     

src/driver/cockroachdb/CockroachDriver.ts

  • Renamed CockroachConnectionOptions to CockroachDataSourceOptions
    throughout the file
  • Added JSDoc @param annotations to multiple methods
  • Removed empty JSDoc lines
+40/-5   
AuroraMysqlDriver.ts
Rename AuroraMysqlConnectionOptions to DataSourceOptions 

src/driver/aurora-mysql/AuroraMysqlDriver.ts

  • Renamed AuroraMysqlConnectionOptions to AuroraMysqlDataSourceOptions
    throughout the file
  • Added JSDoc @param annotations to multiple methods
  • Removed empty JSDoc lines
+40/-5   
ReactNativeDriver.ts
Rename ReactNativeConnectionOptions to DataSourceOptions 

src/driver/react-native/ReactNativeDriver.ts

  • Reorganized imports in alphabetical order
  • Renamed ReactNativeConnectionOptions to ReactNativeDataSourceOptions
  • Added JSDoc @param annotations to methods
  • Removed empty JSDoc lines
+48/-19 
MongoDriver.ts
Rename MongoConnectionOptions to DataSourceOptions             

src/driver/mongodb/MongoDriver.ts

  • Reorganized imports in alphabetical order
  • Renamed MongoConnectionOptions to MongoDataSourceOptions throughout
    the file
  • Added JSDoc @param annotations to methods
  • Removed empty JSDoc lines
+49/-20 
SapDriver.ts
Rename SapConnectionOptions to DataSourceOptions                 

src/driver/sap/SapDriver.ts

  • Renamed SapConnectionOptions to SapDataSourceOptions throughout the
    file
  • Added JSDoc @param annotations to multiple methods
  • Removed empty JSDoc lines
+31/-4   
AbstractSqliteDriver.ts
Add JSDoc annotations to AbstractSqliteDriver methods       

src/driver/sqlite-abstract/AbstractSqliteDriver.ts

  • Reorganized imports in alphabetical order
  • Added JSDoc @param annotations to multiple methods
  • Removed empty JSDoc lines
+46/-18 
globals.ts
Update deprecated functions to use initialize method         

src/globals.ts

  • Added JSDoc @param annotations to deprecated functions for better
    documentation
  • Updated .connect() method calls to .initialize() in createConnection
    and createConnections functions
  • Removed empty JSDoc lines
+22/-18 
BaseQueryRunner.ts
Update BaseQueryRunner with DataSourceOptions references 

src/query-runner/BaseQueryRunner.ts

  • Renamed imports from PostgresConnectionOptions and
    SqlServerConnectionOptions to their DataSourceOptions equivalents
  • Added comprehensive JSDoc @param annotations to multiple methods
  • Updated type casting to use new DataSourceOptions names
+50/-3   
BetterSqlite3Driver.ts
Rename BetterSqlite3ConnectionOptions to DataSourceOptions

src/driver/better-sqlite3/BetterSqlite3Driver.ts

  • Reorganized imports in alphabetical order
  • Renamed BetterSqlite3ConnectionOptions to
    BetterSqlite3DataSourceOptions
  • Added JSDoc @param annotations to methods
+12/-7   
DataSourceOptions.ts
Rename ConnectionOptions to DataSourceOptions throughout 

src/data-source/DataSourceOptions.ts

  • Renamed all *ConnectionOptions imports to *DataSourceOptions
  • Updated type union to use new *DataSourceOptions naming convention
  • Organized imports in alphabetical order
+36/-36 
SqljsDriver.ts
Update SqljsDriver to use DataSourceOptions naming             

src/driver/sqljs/SqljsDriver.ts

  • Renamed SqljsConnectionOptions to SqljsDataSourceOptions
  • Reorganized imports in alphabetical order
  • Added JSDoc parameter documentation for several methods
+16/-9   
SqliteDriver.ts
Update SqliteDriver to use DataSourceOptions naming           

src/driver/sqlite/SqliteDriver.ts

  • Renamed SqliteConnectionOptions to SqliteDataSourceOptions
  • Reorganized imports in alphabetical order
  • Added JSDoc parameter documentation for methods
+16/-7   
AuroraPostgresDriver.ts
Update AuroraPostgresDriver to use DataSourceOptions naming

src/driver/aurora-postgres/AuroraPostgresDriver.ts

  • Renamed AuroraPostgresConnectionOptions to
    AuroraPostgresDataSourceOptions
  • Reorganized imports in alphabetical order
  • Added JSDoc parameter documentation for methods
+15/-8   
NativescriptDriver.ts
Update NativescriptDriver to use DataSourceOptions naming

src/driver/nativescript/NativescriptDriver.ts

  • Renamed NativescriptConnectionOptions to NativescriptDataSourceOptions
  • Reorganized imports in alphabetical order
  • Added JSDoc parameter documentation
+7/-6     
QueryExpressionMap.ts
Update QueryExpressionMap to use DataSourceOptions naming

src/query-builder/QueryExpressionMap.ts

  • Renamed CockroachConnectionOptions to CockroachDataSourceOptions
  • Removed deprecated JSDoc comment marker
  • Added JSDoc parameter documentation for methods
+11/-3   
SqliteQueryRunner.ts
Update SqliteQueryRunner to use DataSourceOptions naming 

src/driver/sqlite/SqliteQueryRunner.ts

  • Renamed SqliteConnectionOptions to SqliteDataSourceOptions
  • Added JSDoc parameter documentation for query() method
+5/-2     
CordovaDriver.ts
Update CordovaDriver to use DataSourceOptions naming         

src/driver/cordova/CordovaDriver.ts

  • Renamed CordovaConnectionOptions to CordovaDataSourceOptions
  • Reorganized imports in alphabetical order
  • Added JSDoc parameter documentation
+6/-5     
CapacitorDriver.ts
Update CapacitorDriver to use DataSourceOptions naming     

src/driver/capacitor/CapacitorDriver.ts

  • Renamed CapacitorConnectionOptions to CapacitorDataSourceOptions
  • Reorganized imports in alphabetical order
  • Added JSDoc parameter documentation
+6/-5     
SqliteDataSourceOptions.ts
Rename SqliteConnectionOptions to SqliteDataSourceOptions

src/driver/sqlite/SqliteDataSourceOptions.ts

  • Renamed interface from SqliteConnectionOptions to
    SqliteDataSourceOptions
+1/-3     
BetterSqlite3DataSourceOptions.ts
Rename BetterSqlite3ConnectionOptions to DataSourceOptions

src/driver/better-sqlite3/BetterSqlite3DataSourceOptions.ts

  • Renamed interface from BetterSqlite3ConnectionOptions to
    BetterSqlite3DataSourceOptions
+1/-2     
ExpoDriver.ts
Update ExpoDriver to use DataSourceOptions naming               

src/driver/expo/ExpoDriver.ts

  • Renamed ExpoConnectionOptions to ExpoDataSourceOptions
  • Reorganized imports in alphabetical order
+5/-5     
SpannerDataSourceOptions.ts
Update Spanner options to use DataSourceOptions naming     

src/driver/spanner/SpannerDataSourceOptions.ts

  • Renamed BaseConnectionOptions import to BaseDataSourceOptions
  • Renamed interface from SpannerConnectionOptions to
    SpannerDataSourceOptions
+3/-3     
AuroraMysqlDataSourceOptions.ts
Rename AuroraMysqlConnectionOptions to DataSourceOptions 

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts

  • Renamed interface from AuroraMysqlConnectionOptions to
    AuroraMysqlDataSourceOptions
+1/-1     
OracleDataSourceOptions.ts
Rename OracleConnectionOptions to DataSourceOptions           

src/driver/oracle/OracleDataSourceOptions.ts

  • Renamed interface from OracleConnectionOptions to
    OracleDataSourceOptions
+1/-1     
AuroraPostgresDataSourceOptions.ts
Rename AuroraPostgresConnectionOptions to DataSourceOptions

src/driver/aurora-postgres/AuroraPostgresDataSourceOptions.ts

  • Renamed interface from AuroraPostgresConnectionOptions to
    AuroraPostgresDataSourceOptions
+1/-1     
NativescriptDataSourceOptions.ts
Rename NativescriptConnectionOptions to DataSourceOptions

src/driver/nativescript/NativescriptDataSourceOptions.ts

  • Renamed interface from NativescriptConnectionOptions to
    NativescriptDataSourceOptions
+1/-1     
CapacitorDataSourceOptions.ts
Rename CapacitorConnectionOptions to DataSourceOptions     

src/driver/capacitor/CapacitorDataSourceOptions.ts

  • Renamed interface from CapacitorConnectionOptions to
    CapacitorDataSourceOptions
+1/-1     
MysqlDataSourceOptions.ts
Rename MysqlConnectionOptions to DataSourceOptions             

src/driver/mysql/MysqlDataSourceOptions.ts

  • Renamed interface from MysqlConnectionOptions to
    MysqlDataSourceOptions
+1/-1     
ReactNativeDataSourceOptions.ts
Rename ReactNativeConnectionOptions to DataSourceOptions 

src/driver/react-native/ReactNativeDataSourceOptions.ts

  • Renamed interface from ReactNativeConnectionOptions to
    ReactNativeDataSourceOptions
+1/-1     
SqljsDataSourceOptions.ts
Rename SqljsConnectionOptions to DataSourceOptions             

src/driver/sqljs/SqljsDataSourceOptions.ts

  • Renamed interface from SqljsConnectionOptions to
    SqljsDataSourceOptions
+1/-1     
CordovaDataSourceOptions.ts
Rename CordovaConnectionOptions to DataSourceOptions         

src/driver/cordova/CordovaDataSourceOptions.ts

  • Renamed interface from CordovaConnectionOptions to
    CordovaDataSourceOptions
+1/-1     
CockroachDataSourceOptions.ts
Rename CockroachConnectionOptions to DataSourceOptions     

src/driver/cockroachdb/CockroachDataSourceOptions.ts

  • Renamed interface from CockroachConnectionOptions to
    CockroachDataSourceOptions
+1/-1     
ExpoDataSourceOptions.ts
Rename ExpoConnectionOptions to DataSourceOptions               

src/driver/expo/ExpoDataSourceOptions.ts

  • Renamed interface from ExpoConnectionOptions to ExpoDataSourceOptions
+1/-1     
SqlServerDataSourceOptions.ts
Rename SqlServerConnectionOptions to DataSourceOptions     

src/driver/sqlserver/SqlServerDataSourceOptions.ts

  • Renamed interface from SqlServerConnectionOptions to
    SqlServerDataSourceOptions
+1/-1     
PostgresDataSourceOptions.ts
Rename PostgresConnectionOptions to DataSourceOptions       

src/driver/postgres/PostgresDataSourceOptions.ts

  • Renamed interface from PostgresConnectionOptions to
    PostgresDataSourceOptions
+1/-1     
Formatting
2 files
DriverFactory.ts
Alphabetically organize driver factory imports and cases 

src/driver/DriverFactory.ts

  • Reorganized imports in alphabetical order
  • Reordered switch cases in create() method alphabetically by database
    type
  • Updated error message array to match new alphabetical ordering
+43/-43 
DatabaseType.ts
Alphabetically organize DatabaseType union members             

src/driver/types/DatabaseType.ts

  • Reorganized database type union members in alphabetical order
+14/-14 
Bug fix
1 files
DataSource.ts
Remove deprecated DataSource methods and properties           

src/data-source/DataSource.ts

  • Removed deprecated isConnected getter that aliased isInitialized
  • Removed deprecated connect() method that aliased initialize()
  • Removed deprecated close() method that aliased destroy()
  • Removed outdated JSDoc comment about Connection deprecation
  • Enhanced JSDoc documentation with return type annotations
+5/-32   
Additional files
8 files
app.ts +1/-1     
BaseConnectionOptions.ts +0/-8     
Connection.ts +0/-10   
ConnectionOptions.ts +0/-10   
AuroraMysqlConnection.ts +0/-24   
SapDataSourceOptions.ts +1/-1     
index.ts +0/-2     
issue-6115.test.ts +1/-1     

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects bot commented Feb 20, 2026

PR Code Suggestions ✨

Latest suggestions up to a6db51f

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix mismatched lifecycle hooks causing connection leaks

In the test suite, replace the after hook with afterEach to correctly pair with
the beforeEach hook, ensuring connections are closed after each test to prevent
leaks.

test/functional/data-source/data-source.test.ts [156-165]

 describe("working with repositories after connection is established successfully", () => {
     let dataSources: DataSource[]
     beforeEach(async () => {
         dataSources = await createTestingConnections({
             entities: [Post, Category],
             schemaCreate: true,
             dropSchema: true,
         })
     })
-    after(() => closeTestingConnections(dataSources))
+    afterEach(() => closeTestingConnections(dataSources))

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a bug in the test suite where a beforeEach hook is mismatched with an after hook, which would cause connection leaks and potential test flakiness.

Medium
Fix type alias naming

Avoid aliasing DataSource to the lowercase dataSource to maintain consistent
naming conventions and prevent confusion with variables. Use DataSource directly
for type annotations.

src/metadata/EmbeddedMetadata.ts [7-266]

-import { DataSource as dataSource } from "../data-source/DataSource"
+import { DataSource } from "../data-source/DataSource"
 ...
-build(connection: dataSource): this {
+build(connection: DataSource): this {
     this.embeddeds.forEach((embedded) => embedded.build(connection))
     this.prefix = this.buildPrefix(connection)
     this.parentPropertyNames = this.buildParentPropertyNames()
     return this
 }
 ...
-protected buildPrefix(connection: dataSource): string {
+protected buildPrefix(connection: DataSource): string {
     if (connection.driver.options.type === "mongodb")
         return this.propertyName
     ...
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies an inconsistent type alias dataSource that goes against common TypeScript naming conventions and the rest of the PR's changes, improving code consistency and readability.

Low
Normalize type naming conventions

Avoid aliasing DataSource to the lowercase dataSource to maintain consistent
naming conventions and prevent confusion with variables. Use DataSource directly
for type annotations.

src/entity-manager/EntityManagerFactory.ts [1-21]

-import { DataSource as dataSource } from "../data-source/DataSource"
+import { DataSource } from "../data-source/DataSource"
 ...
-create(connection: dataSource, queryRunner?: QueryRunner): EntityManager {
+create(connection: DataSource, queryRunner?: QueryRunner): EntityManager {
     if (connection.driver.options.type === "mongodb")
         return new MongoEntityManager(connection)
     ...
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies an inconsistent type alias dataSource that goes against common TypeScript naming conventions and the rest of the PR's changes, improving code consistency and readability.

Low
  • More

Previous suggestions

Suggestions up to commit 70d5968
CategorySuggestion                                                                                                                                    Impact
Possible issue
Release internally created runners

In storeInCache, ensure that any internally created QueryRunner is released in a
finally block to prevent connection leaks.

src/cache/DbQueryResultCache.ts [218-285]

 async storeInCache(
     options: QueryResultCacheOptions,
     savedCache: QueryResultCacheOptions,
     queryRunner?: QueryRunner,
 ): Promise<void> {
     const shouldCreateQueryRunner =
         queryRunner?.getReplicationMode() === "slave"
 
-    if (queryRunner === undefined || shouldCreateQueryRunner) {
+    const createdQueryRunner = queryRunner === undefined || shouldCreateQueryRunner
+    if (createdQueryRunner) {
         queryRunner = this.dataSource.createQueryRunner("master")
     }
 
-    let insertedValues: ObjectLiteral = options
-    if (this.dataSource.driver.options.type === "mssql") {
-        // todo: bad abstraction, re-implement this part, probably better if we create an entity metadata for cache table
-        insertedValues = {
-            identifier: new MssqlParameter(options.identifier, "nvarchar"),
-            query: new MssqlParameter(options.query, "nvarchar"),
-            time: options.time,
-            duration: options.duration,
-            result: options.result,
+    try {
+        let insertedValues: ObjectLiteral = options
+        if (this.dataSource.driver.options.type === "mssql") {
+            // todo: bad abstraction, re-implement this part, probably better if we create an entity metadata for cache table
+            insertedValues = {
+                identifier: new MssqlParameter(options.identifier, "nvarchar"),
+                query: new MssqlParameter(options.query, "nvarchar"),
+                time: options.time,
+                duration: options.duration,
+                result: options.result,
+            }
+        }
+        ...
+    } finally {
+        if (createdQueryRunner) {
+            await queryRunner!.release()
         }
     }
-    ...
 }
Suggestion importance[1-10]: 9

__

Why: This suggestion correctly identifies a significant connection leak bug where a QueryRunner created within the function is never released, which could exhaust the connection pool under load.

High
Close resources after each test

Replace after() with afterEach() to ensure database connections created in
beforeEach() are closed after each test, preventing resource leaks.

test/functional/data-source/data-source.test.ts [156-165]

 describe("working with repositories after connection is established successfully", () => {
     let dataSources: DataSource[]
     beforeEach(async () => {
         dataSources = await createTestingConnections({
             entities: [Post, Category],
             schemaCreate: true,
             dropSchema: true,
         })
     })
-    after(() => closeTestingConnections(dataSources))
+    afterEach(() => closeTestingConnections(dataSources))
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a test setup issue where resources created in beforeEach are not properly cleaned up, as after is used instead of afterEach, which can lead to resource leaks and flaky tests.

Low
Ensure per-test connection cleanup

Replace after() with afterEach() to ensure database connections created in
beforeEach() are closed after each test, preventing resource leaks.

test/functional/data-source/data-source.test.ts [299-318]

 describe("different names of the same content of the schema", () => {
     let dataSources: DataSource[]
     beforeEach(async () => {
         const dataSources1 = await createTestingConnections({
             name: "test",
             enabledDrivers: ["postgres"],
             entities: [CommentV1, GuestV1],
             schema: "test-schema",
             dropSchema: true,
         })
         const dataSources2 = await createTestingConnections({
             name: "another",
             enabledDrivers: ["postgres"],
             entities: [CommentV1, GuestV1],
             schema: "another-schema",
             dropSchema: true,
         })
         dataSources = [...dataSources1, ...dataSources2]
     })
-    after(() => closeTestingConnections(dataSources))
+    afterEach(() => closeTestingConnections(dataSources))
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a test setup issue where resources created in beforeEach are not properly cleaned up, as after is used instead of afterEach, which can lead to resource leaks and flaky tests.

Low
General
Clarify initialization error message

Update the error message to use the correct DataSource.initialize() syntax
instead of the misleading dataSource#initialize phrasing. This will make the
error message clearer for developers.

src/error/NoConnectionForRepositoryError.ts [6-13]

 export class NoConnectionForRepositoryError extends TypeORMError {
     constructor(dataSourceName: string) {
         super(
             `Cannot get a Repository for the "${dataSourceName}" DataSource, because connection with the database ` +
-                `is not established yet. Call dataSource#initialize method to establish connection.`,
+                `is not established yet. Call DataSource.initialize() to establish connection.`,
         )
     }
 }
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that the error message uses a confusing and incorrect format (dataSource#initialize) to refer to the initialization method. Correcting it to DataSource.initialize() provides a clearer and more accurate instruction to developers.

Low
Avoid confusing lowercase type alias

Avoid aliasing the DataSource type to the lowercase dataSource. Instead, use the
original DataSource type name in method signatures to follow convention and
improve clarity.

src/metadata/EmbeddedMetadata.ts [7-266]

-import { DataSource as dataSource } from "../data-source/DataSource"
+import { DataSource } from "../data-source/DataSource"
 ...
-build(connection: dataSource): this {
+build(connection: DataSource): this {
     this.embeddeds.forEach((embedded) => embedded.build(connection))
     this.prefix = this.buildPrefix(connection)
     this.parentPropertyNames = this.buildParentPropertyNames()
     this.columns = this.buildColumns()
     this.relations = this.buildRelations()
     this.relationIds = this.buildRelationIds()
     this.relationCounts = this.buildRelationCounts()
     this.listeners = this.buildListeners()
     this.indices = this.buildIndices()
     this.uniques = this.buildUniques()
     this.checks = this.buildChecks()
     this.exclusions = this.buildExclusions()
     return this
 }
 ...
-protected buildPrefix(connection: dataSource): string {
+protected buildPrefix(connection: DataSource): string {
     if (connection.driver.options.type === "mongodb")
         return this.propertyName
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly points out that aliasing a type DataSource to a lowercase name dataSource violates TypeScript conventions and harms readability, as it can be confused with a variable.

Low
Use canonical type naming

Replace the type alias dataSource with the canonical type name DataSource. This
change improves code readability and prevents potential confusion with variable
instances.

src/entity-manager/EntityManagerFactory.ts [1-21]

-import { DataSource as dataSource } from "../data-source/DataSource"
+import { DataSource } from "../data-source/DataSource"
 ...
-create(connection: dataSource, queryRunner?: QueryRunner): EntityManager {
+create(connection: DataSource, queryRunner?: QueryRunner): EntityManager {
     if (connection.driver.options.type === "mongodb")
         return new MongoEntityManager(connection)
     if (connection.driver.options.type === "sqljs")
         return new SqljsEntityManager(connection, queryRunner)
     return new EntityManager(connection, queryRunner)
 }
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies that aliasing the DataSource type to a lowercase name dataSource is unconventional and confusing. Adhering to the standard DataSource naming improves code clarity and maintainability.

Low
Suggestions up to commit 2ef1e59
CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix resource leak in tests

In the test suite, change the after hook to afterEach to match the beforeEach
hook. This prevents resource leaks by ensuring connections are closed after each
test, not just once at the end.

test/functional/connection/data-source.test.ts [156-168]

     describe("working with repositories after connection is established successfully", () => {
         let dataSources: DataSource[]
         beforeEach(async () => {
             dataSources = await createTestingConnections({
                 entities: [Post, Category],
                 schemaCreate: true,
                 dropSchema: true,
             })
         })
-        after(() => closeTestingConnections(dataSources))
+        afterEach(() => closeTestingConnections(dataSources))
 
         it("should be able to get simple entity repository", () =>
             dataSources.forEach((dataSource) => {
 ...
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a resource leak in the test suite due to a mismatch between beforeEach and after hooks, and the proposed fix of using afterEach is accurate and improves test reliability.

Medium
General
Improve connection initialization performance

Improve performance by initializing non-SQLite database connections in parallel
with Promise.all. Continue to initialize SQLite connections sequentially to
avoid known issues.

src/globals.ts [110-120]

 export async function createConnections(
     options: DataSourceOptions[],
 ): Promise<DataSource[]> {
     const connections = options.map((options) => {
         return getConnectionManager().create(options)
     })
-    // Do not use Promise.all or test 8522 will produce a dangling sqlite connection
-    for (const connection of connections) {
+    // Do not use Promise.all for sqlite connections or test 8522 will produce a dangling sqlite connection
+    const sqliteConnections = connections.filter(
+        (connection) => connection.driver.options.type === "sqlite",
+    )
+    const otherConnections = connections.filter(
+        (connection) => connection.driver.options.type !== "sqlite",
+    )
+
+    for (const connection of sqliteConnections) {
         await connection.initialize()
     }
+    await Promise.all(
+        otherConnections.map((connection) => connection.initialize()),
+    )
+
     return connections
 }
Suggestion importance[1-10]: 6

__

Why: The suggestion provides a valid performance optimization by parallelizing connection initializations for non-SQLite databases while respecting the existing constraint for SQLite, which is a thoughtful improvement.

Low

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects bot commented Feb 21, 2026

Code Review by Qodo

🐞 Bugs (19) 📘 Rule violations (19) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;quot;migration to v1&amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;amp;quot;migration to v1&amp;amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;quot;migration to v1&amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (9)
4. Empty JSDoc for run() 📘 Rule violation ✓ Correctness
Description
An empty JSDoc block with only an @param tag was added above the local run() helper, adding
noise without improving clarity. This violates the requirement to avoid extra AI-like comments and
keeps the file style unnecessarily verbose.
Code

src/driver/sqlite/SqliteDriver.ts[R156-159]

+        /**
+         *
+         * @param line
+         */
Evidence
PR Compliance ID 4 requires avoiding extra/AI-like comments; the added JSDoc block contains no
description and only an @param tag, making it pure comment noise.

Rule 4: Remove AI-generated noise
src/driver/sqlite/SqliteDriver.ts[155-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An empty JSDoc comment block was added above the local `run()` helper in `SqliteDriver`, containing no useful description and only an `@param` tag. This is comment noise and violates the &amp;amp;quot;Remove AI-generated noise&amp;amp;quot; compliance requirement.
## Issue Context
There is already a clear single-line comment explaining the purpose of `run()`, so the empty JSDoc adds verbosity without value.
## Fix Focus Areas
- src/driver/sqlite/SqliteDriver.ts[156-159]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;amp;quot;migration to v1&amp;amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;amp;amp;quot;migration to v1&amp;amp;amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;amp;quot;migration to v1&amp;amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;quot;migration to v1&amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Empty JSDoc for run() 📘 Rule violation ✓ Correctness
Description
An empty JSDoc block with only an @param tag was added above the local run() helper, adding
noise without improving clarity. This violates the requirement to avoid extra AI-like comments and
keeps the file style unnecessarily verbose.
Code

src/driver/sqlite/SqliteDriver.ts[R156-159]

+        /**
+         *
+         * @param line
+         */
Evidence
PR Compliance ID 4 requires avoiding extra/AI-like comments; the added JSDoc block contains no
description and only an @param tag, making it pure comment noise.

Rule 4: Remove AI-generated noise
src/driver/sqlite/SqliteDriver.ts[155-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An empty JSDoc comment block was added above the local `run()` helper in `SqliteDriver`, containing no useful description and only an `@param` tag. This is comment noise and violates the &amp;quot;Remove AI-generated noise&amp;quot; compliance requirement.
## Issue Context
There is already a clear single-line comment explaining the purpose of `run()`, so the empty JSDoc adds verbosity without value.
## Fix Focus Areas
- src/driver/sqlite/SqliteDriver.ts[156-159]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;quot;migration to v1&amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;amp;quot;migration to v1&amp;amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;quot;migration to v1&amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

✅ 13. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DataSource.connect()` was removed, but some public-facing strings/docs still recommend calling `connect()`.
### Issue Context
This PR intentionally removes deprecated `connect/close` in favor of `initialize/destroy`.
### Fix Focus Areas
- src/connection/ConnectionManager.ts[48-52]
- src/error/NoConnectionForRepositoryError.ts[6-12]
### Suggested change
- Replace “call connect method” with “call initialize()” in `ConnectionManager.create()` JSDoc.
- Update `NoConnectionForRepositoryError` message to say “Call dataSource.initialize()” (or “connection.initialize()” if you want to keep legacy wording), since `connect()` no longer exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. as any in DbQueryResultCache 📘 Rule violation ✓ Correctness
Description
this.dataSource.driver.options is cast to any, bypassing type safety and potentially hiding
schema-option typing issues. This conflicts with the requirement to avoid any-casts added/retained
in changed code.
Code

src/cache/DbQueryResultCache.ts[29]

+        const { schema } = this.dataSource.driver.options as any
Evidence
PR Compliance ID 4 disallows any-casts used to bypass types; the modified constructor line
explicitly uses as any when reading schema from driver options.

Rule 4: Remove AI-generated noise
src/cache/DbQueryResultCache.ts[29-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DbQueryResultCache` reads `schema` via `this.dataSource.driver.options as any`, which bypasses type checking.
## Issue Context
The PR compliance checklist disallows `any`-casts used to bypass types in changed code.
## Fix Focus Areas
- src/cache/DbQueryResultCache.ts[28-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


15. ConnectionOptions still exported 🐞 Bug ✓ Correctness
Description
After removing TypeORM’s ConnectionOptions export, the package root still exports a
ConnectionOptions type coming from the MongoDB driver typings, so `import { ConnectionOptions }
from "typeorm"` may still type-check but refer to the wrong type. This undermines the
breaking-change intent and can lead to confusing or incorrect typing during migration to
DataSourceOptions.
Code

src/index.ts[R143-147]

export { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader"
-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
export { ConnectionManager } from "./connection/ConnectionManager"
export { DataSourceOptions } from "./data-source/DataSourceOptions"
export { Driver } from "./driver/Driver"
Evidence
src/index.ts re-exports everything from the MongoDB typings module, and that module declares an
exported ConnectionOptions interface. The PR diff removes TypeORM’s own ConnectionOptions
export, so the remaining exported ConnectionOptions name at the package root will now resolve to
the MongoDB one instead of failing fast or guiding users to DataSourceOptions.

pr_files_diffs/src_index_ts.patch[6-18]
src/index.ts[128-141]
src/driver/mongodb/typings.ts[2557-2564]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
TypeORM’s root module (`src/index.ts`) still re-exports `ConnectionOptions` from `./driver/mongodb/typings`. After this PR removes TypeORM’s own `ConnectionOptions`, consumers may still be able to import `ConnectionOptions` from `typeorm`, but it will now refer to MongoDB’s driver `ConnectionOptions` instead of failing fast / guiding them to `DataSourceOptions`.
### Issue Context
The PR goal is to remove the deprecated `Connection` / `ConnectionOptions` in favor of `DataSource` / `DataSourceOptions`. Leaving an unrelated `ConnectionOptions` symbol in the root exports undermines that migration.
### Fix Focus Areas
- src/index.ts[128-147]
- src/driver/mongodb/typings.ts[2557-2575]
### Suggested approaches
1) Prefer: remove `export * from &amp;amp;amp;quot;./driver/mongodb/typings&amp;amp;amp;quot;` from the root and expose MongoDB typings via a dedicated subpath/barrel (or `export * as MongoDB from ...`) to prevent name collisions.
2) Alternative: in the MongoDB typings module, rename/alias the exported `ConnectionOptions` type to something explicit (e.g., `MongoConnectionOptions`) and avoid exporting `ConnectionOptions` at the root (this may require changing how typings are generated/committed).
### Acceptance criteria
- `ConnectionOptions` is no longer available as a root export from `typeorm`.
- MongoDB-specific typings remain accessible in a non-colliding way (namespaced or subpath).
- Build/typecheck succeeds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (23)
✅ 16. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DataSource.connect()` was removed, but some public-facing strings/docs still recommend calling `connect()`.
### Issue Context
This PR intentionally removes deprecated `connect/close` in favor of `initialize/destroy`.
### Fix Focus Areas
- src/connection/ConnectionManager.ts[48-52]
- src/error/NoConnectionForRepositoryError.ts[6-12]
### Suggested change
- Replace “call connect method” with “call initialize()” in `ConnectionManager.create()` JSDoc.
- Update `NoConnectionForRepositoryError` message to say “Call dataSource.initialize()” (or “connection.initialize()” if you want to keep legacy wording), since `connect()` no longer exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


17. as any in DbQueryResultCache 📘 Rule violation ✓ Correctness
Description
this.dataSource.driver.options is cast to any, bypassing type safety and potentially hiding
schema-option typing issues. This conflicts with the requirement to avoid any-casts added/retained
in changed code.
Code

src/cache/DbQueryResultCache.ts[29]

+        const { schema } = this.dataSource.driver.options as any
Evidence
PR Compliance ID 4 disallows any-casts used to bypass types; the modified constructor line
explicitly uses as any when reading schema from driver options.

Rule 4: Remove AI-generated noise
src/cache/DbQueryResultCache.ts[29-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DbQueryResultCache` reads `schema` via `this.dataSource.driver.options as any`, which bypasses type checking.
## Issue Context
The PR compliance checklist disallows `any`-casts used to bypass types in changed code.
## Fix Focus Areas
- src/cache/DbQueryResultCache.ts[28-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


18. ConnectionOptions still exported 🐞 Bug ✓ Correctness
Description
After removing TypeORM’s ConnectionOptions export, the package root still exports a
ConnectionOptions type coming from the MongoDB driver typings, so `import { ConnectionOptions }
from "typeorm"` may still type-check but refer to the wrong type. This undermines the
breaking-change intent and can lead to confusing or incorrect typing during migration to
DataSourceOptions.
Code

src/index.ts[R143-147]

export { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader"
-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
export { ConnectionManager } from "./connection/ConnectionManager"
export { DataSourceOptions } from "./data-source/DataSourceOptions"
export { Driver } from "./driver/Driver"
Evidence
src/index.ts re-exports everything from the MongoDB typings module, and that module declares an
exported ConnectionOptions interface. The PR diff removes TypeORM’s own ConnectionOptions
export, so the remaining exported ConnectionOptions name at the package root will now resolve to
the MongoDB one instead of failing fast or guiding users to DataSourceOptions.

pr_files_diffs/src_index_ts.patch[6-18]
src/index.ts[128-141]
src/driver/mongodb/typings.ts[2557-2564]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
TypeORM’s root module (`src/index.ts`) still re-exports `ConnectionOptions` from `./driver/mongodb/typings`. After this PR removes TypeORM’s own `ConnectionOptions`, consumers may still be able to import `ConnectionOptions` from `typeorm`, but it will now refer to MongoDB’s driver `ConnectionOptions` instead of failing fast / guiding them to `DataSourceOptions`.
### Issue Context
The PR goal is to remove the deprecated `Connection` / `ConnectionOptions` in favor of `DataSource` / `DataSourceOptions`. Leaving an unrelated `ConnectionOptions` symbol in the root exports undermines that migration.
### Fix Focus Areas
- src/index.ts[128-147]
- src/driver/mongodb/typings.ts[2557-2575]
### Suggested approaches
1) Prefer: remove `export * from &amp;amp;quot;./driver/mongodb/typings&amp;amp;quot;` from the root and expose MongoDB typings via a dedicated subpath/barrel (or `export * as MongoDB from ...`) to prevent name collisions.
2) Alternative: in the MongoDB typings module, rename/alias the exported `ConnectionOptions` type to something explicit (e.g., `MongoConnectionOptions`) and avoid exporting `ConnectionOptions` at the root (this may require changing how typings are generated/committed).
### Acceptance criteria
- `ConnectionOptions` is no longer available as a root export from `typeorm`.
- MongoDB-specific typings remain accessible in a non-colliding way (namespaced or subpath).
- Build/typecheck succeeds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


✅ 19. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DataSource.connect()` was removed, but some public-facing strings/docs still recommend calling `connect()`.
### Issue Context
This PR intentionally removes deprecated `connect/close` in favor of `initialize/destroy`.
### Fix Focus Areas
- src/connection/ConnectionManager.ts[48-52]
- src/error/NoConnectionForRepositoryError.ts[6-12]
### Suggested change
- Replace “call connect method” with “call initialize()” in `ConnectionManager.create()` JSDoc.
- Update `NoConnectionForRepositoryError` message to say “Call dataSource.initialize()” (or “connection.initialize()” if you want to keep legacy wording), since `connect()` no longer exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


20. Stale connect() in test comment 🐞 Bug ✓ Correctness
Description
A commented-out Aurora test block still calls connection.connect(), but this PR removes
DataSource.connect() (replaced by DataSource.initialize()). If a contributor uncomments these
tests (as the file suggests for Aurora manual testing), they will fail to compile/run.
Code

test/functional/connection-manager/connection-manager.test.ts[81]

          await connection.connect();
Evidence
The PR explicitly removes the deprecated DataSource.connect() method, but the edited test file
still contains await connection.connect() in the (commented) Aurora test snippets within the same
file/hunks, leaving misleading guidance for manual testing.

pr_files_diffs/src_data-source_DataSource_ts.patch
pr_files_diffs/test_functional_connection-manager_connection-manager_test_ts.patch
test/functional/connection-manager/connection-manager.test.ts[58-83]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A commented-out Aurora test block still uses `DataSource.connect()`, but the method was removed in this PR. If someone uncomments these tests for local/manual Aurora verification, they will immediately fail.
### Issue Context
The PR removes deprecated `DataSource.connect()` in favor of `DataSource.initialize()`.
### Fix Focus Areas
- test/functional/connection-manager/connection-manager.test.ts[58-106]
- src/data-source/DataSource.ts[279-323]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


✅ 21. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DataSource.connect()` was removed, but some public-facing strings/docs still recommend calling `connect()`.
### Issue Context
This PR intentionally removes deprecated `connect/close` in favor of `initialize/destroy`.
### Fix Focus Areas
- src/connection/ConnectionManager.ts[48-52]
- src/error/NoConnectionForRepositoryError.ts[6-12]
### Suggested change
- Replace “call connect method” with “call initialize()” in `ConnectionManager.create()` JSDoc.
- Update `NoConnectionForRepositoryError` message to say “Call dataSource.initialize()” (or “connection.initialize()” if you want to keep legacy wording), since `connect()` no longer exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


22. as any in DbQueryResultCache 📘 Rule violation ✓ Correctness
Description
this.dataSource.driver.options is cast to any, bypassing type safety and potentially hiding
schema-option typing issues. This conflicts with the requirement to avoid any-casts added/retained
in changed code.
Code

src/cache/DbQueryResultCache.ts[29]

+        const { schema } = this.dataSource.driver.options as any
Evidence
PR Compliance ID 4 disallows any-casts used to bypass types; the modified constructor line
explicitly uses as any when reading schema from driver options.

Rule 4: Remove AI-generated noise
src/cache/DbQueryResultCache.ts[29-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DbQueryResultCache` reads `schema` via `this.dataSource.driver.options as any`, which bypasses type checking.
## Issue Context
The PR compliance checklist disallows `any`-casts used to bypass types in changed code.
## Fix Focus Areas
- src/cache/DbQueryResultCache.ts[28-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


23. ConnectionOptions still exported 🐞 Bug ✓ Correctness
Description
After removing TypeORM’s ConnectionOptions export, the package root still exports a
ConnectionOptions type coming from the MongoDB driver typings, so `import { ConnectionOptions }
from "typeorm"` may still type-check but refer to the wrong type. This undermines the
breaking-change intent and can lead to confusing or incorrect typing during migration to
DataSourceOptions.
Code

src/index.ts[R143-147]

export { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader"
-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
export { ConnectionManager } from "./connection/ConnectionManager"
export { DataSourceOptions } from "./data-source/DataSourceOptions"
export { Driver } from "./driver/Driver"
Evidence
src/index.ts re-exports everything from the MongoDB typings module, and that module declares an
exported ConnectionOptions interface. The PR diff removes TypeORM’s own ConnectionOptions
export, so the remaining exported ConnectionOptions name at the package root will now resolve to
the MongoDB one instead of failing fast or guiding users to DataSourceOptions.

pr_files_diffs/src_index_ts.patch[6-18]
src/index.ts[128-141]
src/driver/mongodb/typings.ts[2557-2564]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
TypeORM’s root module (`src/index.ts`) still re-exports `ConnectionOptions` from `./driver/mongodb/typings`. After this PR removes TypeORM’s own `ConnectionOptions`, consumers may still be able to import `ConnectionOptions` from `typeorm`, but it will now refer to MongoDB’s driver `ConnectionOptions` instead of failing fast / guiding them to `DataSourceOptions`.
### Issue Context
The PR goal is to remove the deprecated `Connection` / `ConnectionOptions` in favor of `DataSource` / `DataSourceOptions`. Leaving an unrelated `ConnectionOptions` symbol in the root exports undermines that migration.
### Fix Focus Areas
- src/index.ts[128-147]
- src/driver/mongodb/typings.ts[2557-2575]
### Suggested approaches
1) Prefer: remove `export * from &amp;amp;amp;amp;quot;./driver/mongodb/typings&amp;amp;amp;amp;quot;` from the root and expose MongoDB typings via a dedicated subpath/barrel (or `export * as MongoDB from ...`) to prevent name collisions.
2) Alternative: in the MongoDB typings module, rename/alias the exported `ConnectionOptions` type to something explicit (e.g., `MongoConnectionOptions`) and avoid exporting `ConnectionOptions` at the root (this may require changing how typings are generated/committed).
### Acceptance criteria
- `ConnectionOptions` is no longer available as a root export from `typeorm`.
- MongoDB-specific typings remain accessible in a non-colliding way (namespaced or subpath).
- Build/typecheck succeeds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


✅ 24. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]
...

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 21, 2026

Coverage Status

coverage: 81.266% (+0.09%) from 81.176%
when pulling a6db51f on alumni:feat/remove-connection
into 1fa4129 on typeorm:master.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 21, 2026

commit: a6db51f

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;quot;migration to v1&amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. as any in DbQueryResultCache 📘 Rule violation ✓ Correctness ⭐ New
Description
this.dataSource.driver.options is cast to any, bypassing type safety and potentially hiding
schema-option typing issues. This conflicts with the requirement to avoid any-casts added/retained
in changed code.
Code

src/cache/DbQueryResultCache.ts[29]

+        const { schema } = this.dataSource.driver.options as any
Evidence
PR Compliance ID 4 disallows any-casts used to bypass types; the modified constructor line
explicitly uses as any when reading schema from driver options.

Rule 4: Remove AI-generated noise
src/cache/DbQueryResultCache.ts[29-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DbQueryResultCache` reads `schema` via `this.dataSource.driver.options as any`, which bypasses type checking.

## Issue Context
The PR compliance checklist disallows `any`-casts used to bypass types in changed code.

## Fix Focus Areas
- src/cache/DbQueryResultCache.ts[28-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. ConnectionOptions still exported 🐞 Bug ✓ Correctness ⭐ New
Description
After removing TypeORM’s ConnectionOptions export, the package root still exports a
ConnectionOptions type coming from the MongoDB driver typings, so `import { ConnectionOptions }
from "typeorm"` may still type-check but refer to the wrong type. This undermines the
breaking-change intent and can lead to confusing or incorrect typing during migration to
DataSourceOptions.
Code

src/index.ts[R143-147]

export { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader"
-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
export { ConnectionManager } from "./connection/ConnectionManager"
export { DataSourceOptions } from "./data-source/DataSourceOptions"
export { Driver } from "./driver/Driver"
Evidence
src/index.ts re-exports everything from the MongoDB typings module, and that module declares an
exported ConnectionOptions interface. The PR diff removes TypeORM’s own ConnectionOptions
export, so the remaining exported ConnectionOptions name at the package root will now resolve to
the MongoDB one instead of failing fast or guiding users to DataSourceOptions.

pr_files_diffs/src_index_ts.patch[6-18]
src/index.ts[128-141]
src/driver/mongodb/typings.ts[2557-2564]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
TypeORM’s root module (`src/index.ts`) still re-exports `ConnectionOptions` from `./driver/mongodb/typings`. After this PR removes TypeORM’s own `ConnectionOptions`, consumers may still be able to import `ConnectionOptions` from `typeorm`, but it will now refer to MongoDB’s driver `ConnectionOptions` instead of failing fast / guiding them to `DataSourceOptions`.

### Issue Context
The PR goal is to remove the deprecated `Connection` / `ConnectionOptions` in favor of `DataSource` / `DataSourceOptions`. Leaving an unrelated `ConnectionOptions` symbol in the root exports undermines that migration.

### Fix Focus Areas
- src/index.ts[128-147]
- src/driver/mongodb/typings.ts[2557-2575]

### Suggested approaches
1) Prefer: remove `export * from &quot;./driver/mongodb/typings&quot;` from the root and expose MongoDB typings via a dedicated subpath/barrel (or `export * as MongoDB from ...`) to prevent name collisions.
2) Alternative: in the MongoDB typings module, rename/alias the exported `ConnectionOptions` type to something explicit (e.g., `MongoConnectionOptions`) and avoid exporting `ConnectionOptions` at the root (this may require changing how typings are generated/committed).

### Acceptance criteria
- `ConnectionOptions` is no longer available as a root export from `typeorm`.
- MongoDB-specific typings remain accessible in a non-colliding way (namespaced or subpath).
- Build/typecheck succeeds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DataSource.connect()` was removed, but some public-facing strings/docs still recommend calling `connect()`.
### Issue Context
This PR intentionally removes deprecated `connect/close` in favor of `initialize/destroy`.
### Fix Focus Areas
- src/connection/ConnectionManager.ts[48-52]
- src/error/NoConnectionForRepositoryError.ts[6-12]
### Suggested change
- Replace “call connect method” with “call initialize()” in `ConnectionManager.create()` JSDoc.
- Update `NoConnectionForRepositoryError` message to say “Call dataSource.initialize()” (or “connection.initialize()” if you want to keep legacy wording), since `connect()` no longer exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link
Copy Markdown
Collaborator

@gioboa gioboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👏

@alumni alumni force-pushed the feat/remove-connection branch from 70d5968 to a6db51f Compare February 21, 2026 11:55
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (6) 📘 Rule violations (6) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Empty JSDoc for run() 📘 Rule violation ✓ Correctness ⭐ New
Description
An empty JSDoc block with only an @param tag was added above the local run() helper, adding
noise without improving clarity. This violates the requirement to avoid extra AI-like comments and
keeps the file style unnecessarily verbose.
Code

src/driver/sqlite/SqliteDriver.ts[R156-159]

+        /**
+         *
+         * @param line
+         */
Evidence
PR Compliance ID 4 requires avoiding extra/AI-like comments; the added JSDoc block contains no
description and only an @param tag, making it pure comment noise.

Rule 4: Remove AI-generated noise
src/driver/sqlite/SqliteDriver.ts[155-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An empty JSDoc comment block was added above the local `run()` helper in `SqliteDriver`, containing no useful description and only an `@param` tag. This is comment noise and violates the &quot;Remove AI-generated noise&quot; compliance requirement.

## Issue Context
There is already a clear single-line comment explaining the purpose of `run()`, so the empty JSDoc adds verbosity without value.

## Fix Focus Areas
- src/driver/sqlite/SqliteDriver.ts[156-159]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;quot;migration to v1&amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;amp;quot;migration to v1&amp;amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (1)
4. Docs missing for API removal 📘 Rule violation ✓ Correctness
Description
This PR removes user-facing exports (Connection/ConnectionOptions) but no documentation updates
are included. Users upgrading may not know how to migrate to DataSource/DataSourceOptions.
Code

src/index.ts[L146-148]

-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
Evidence
Compliance requires documentation updates for user-facing API/usage changes. The PR removes public
exports in src/index.ts, and the PR description explicitly notes documentation has not been
updated and includes a TODO to update the migration docs.

Rule 2: Docs updated for user-facing changes
src/index.ts[145-149]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing API exports (`Connection` / `ConnectionOptions`) were removed, but this PR does not include documentation changes to guide users to `DataSource` / `DataSourceOptions`.
## Issue Context
The PR description explicitly calls out a TODO to update the &amp;amp;quot;migration to v1&amp;amp;quot; documentation, and the docs checklist item is unchecked.
## Fix Focus Areas
- src/index.ts[145-149]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

5. Stale connect() in test comment 🐞 Bug ✓ Correctness ⭐ New
Description
A commented-out Aurora test block still calls connection.connect(), but this PR removes
DataSource.connect() (replaced by DataSource.initialize()). If a contributor uncomments these
tests (as the file suggests for Aurora manual testing), they will fail to compile/run.
Code

test/functional/connection-manager/connection-manager.test.ts[81]

            await connection.connect();
Evidence
The PR explicitly removes the deprecated DataSource.connect() method, but the edited test file
still contains await connection.connect() in the (commented) Aurora test snippets within the same
file/hunks, leaving misleading guidance for manual testing.

pr_files_diffs/src_data-source_DataSource_ts.patch
pr_files_diffs/test_functional_connection-manager_connection-manager_test_ts.patch
test/functional/connection-manager/connection-manager.test.ts[58-83]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
A commented-out Aurora test block still uses `DataSource.connect()`, but the method was removed in this PR. If someone uncomments these tests for local/manual Aurora verification, they will immediately fail.

### Issue Context
The PR removes deprecated `DataSource.connect()` in favor of `DataSource.initialize()`.

### Fix Focus Areas
- test/functional/connection-manager/connection-manager.test.ts[58-106]
- src/data-source/DataSource.ts[279-323]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


✅ 6. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DataSource.connect()` was removed, but some public-facing strings/docs still recommend calling `connect()`.
### Issue Context
This PR intentionally removes deprecated `connect/close` in favor of `initialize/destroy`.
### Fix Focus Areas
- src/connection/ConnectionManager.ts[48-52]
- src/error/NoConnectionForRepositoryError.ts[6-12]
### Suggested change
- Replace “call connect method” with “call initialize()” in `ConnectionManager.create()` JSDoc.
- Update `NoConnectionForRepositoryError` message to say “Call dataSource.initialize()” (or “connection.initialize()” if you want to keep legacy wording), since `connect()` no longer exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. as any in DbQueryResultCache 📘 Rule violation ✓ Correctness
Description
this.dataSource.driver.options is cast to any, bypassing type safety and potentially hiding
schema-option typing issues. This conflicts with the requirement to avoid any-casts added/retained
in changed code.
Code

src/cache/DbQueryResultCache.ts[29]

+        const { schema } = this.dataSource.driver.options as any
Evidence
PR Compliance ID 4 disallows any-casts used to bypass types; the modified constructor line
explicitly uses as any when reading schema from driver options.

Rule 4: Remove AI-generated noise
src/cache/DbQueryResultCache.ts[29-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DbQueryResultCache` reads `schema` via `this.dataSource.driver.options as any`, which bypasses type checking.
## Issue Context
The PR compliance checklist disallows `any`-casts used to bypass types in changed code.
## Fix Focus Areas
- src/cache/DbQueryResultCache.ts[28-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (5)
8. ConnectionOptions still exported 🐞 Bug ✓ Correctness
Description
After removing TypeORM’s ConnectionOptions export, the package root still exports a
ConnectionOptions type coming from the MongoDB driver typings, so `import { ConnectionOptions }
from "typeorm"` may still type-check but refer to the wrong type. This undermines the
breaking-change intent and can lead to confusing or incorrect typing during migration to
DataSourceOptions.
Code

src/index.ts[R143-147]

export { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader"
-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
export { ConnectionManager } from "./connection/ConnectionManager"
export { DataSourceOptions } from "./data-source/DataSourceOptions"
export { Driver } from "./driver/Driver"
Evidence
src/index.ts re-exports everything from the MongoDB typings module, and that module declares an
exported ConnectionOptions interface. The PR diff removes TypeORM’s own ConnectionOptions
export, so the remaining exported ConnectionOptions name at the package root will now resolve to
the MongoDB one instead of failing fast or guiding users to DataSourceOptions.

pr_files_diffs/src_index_ts.patch[6-18]
src/index.ts[128-141]
src/driver/mongodb/typings.ts[2557-2564]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
TypeORM’s root module (`src/index.ts`) still re-exports `ConnectionOptions` from `./driver/mongodb/typings`. After this PR removes TypeORM’s own `ConnectionOptions`, consumers may still be able to import `ConnectionOptions` from `typeorm`, but it will now refer to MongoDB’s driver `ConnectionOptions` instead of failing fast / guiding them to `DataSourceOptions`.
### Issue Context
The PR goal is to remove the deprecated `Connection` / `ConnectionOptions` in favor of `DataSource` / `DataSourceOptions`. Leaving an unrelated `ConnectionOptions` symbol in the root exports undermines that migration.
### Fix Focus Areas
- src/index.ts[128-147]
- src/driver/mongodb/typings.ts[2557-2575]
### Suggested approaches
1) Prefer: remove `export * from &amp;amp;quot;./driver/mongodb/typings&amp;amp;quot;` from the root and expose MongoDB typings via a dedicated subpath/barrel (or `export * as MongoDB from ...`) to prevent name collisions.
2) Alternative: in the MongoDB typings module, rename/alias the exported `ConnectionOptions` type to something explicit (e.g., `MongoConnectionOptions`) and avoid exporting `ConnectionOptions` at the root (this may require changing how typings are generated/committed).
### Acceptance criteria
- `ConnectionOptions` is no longer available as a root export from `typeorm`.
- MongoDB-specific typings remain accessible in a non-colliding way (namespaced or subpath).
- Build/typecheck succeeds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


✅ 9. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DataSource.connect()` was removed, but some public-facing strings/docs still recommend calling `connect()`.
### Issue Context
This PR intentionally removes deprecated `connect/close` in favor of `initialize/destroy`.
### Fix Focus Areas
- src/connection/ConnectionManager.ts[48-52]
- src/error/NoConnectionForRepositoryError.ts[6-12]
### Suggested change
- Replace “call connect method” with “call initialize()” in `ConnectionManager.create()` JSDoc.
- Update `NoConnectionForRepositoryError` message to say “Call dataSource.initialize()” (or “connection.initialize()” if you want to keep legacy wording), since `connect()` no longer exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. as any in DbQueryResultCache 📘 Rule violation ✓ Correctness
Description
this.dataSource.driver.options is cast to any, bypassing type safety and potentially hiding
schema-option typing issues. This conflicts with the requirement to avoid any-casts added/retained
in changed code.
Code

src/cache/DbQueryResultCache.ts[29]

+        const { schema } = this.dataSource.driver.options as any
Evidence
PR Compliance ID 4 disallows any-casts used to bypass types; the modified constructor line
explicitly uses as any when reading schema from driver options.

Rule 4: Remove AI-generated noise
src/cache/DbQueryResultCache.ts[29-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DbQueryResultCache` reads `schema` via `this.dataSource.driver.options as any`, which bypasses type checking.
## Issue Context
The PR compliance checklist disallows `any`-casts used to bypass types in changed code.
## Fix Focus Areas
- src/cache/DbQueryResultCache.ts[28-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. ConnectionOptions still exported 🐞 Bug ✓ Correctness
Description
After removing TypeORM’s ConnectionOptions export, the package root still exports a
ConnectionOptions type coming from the MongoDB driver typings, so `import { ConnectionOptions }
from "typeorm"` may still type-check but refer to the wrong type. This undermines the
breaking-change intent and can lead to confusing or incorrect typing during migration to
DataSourceOptions.
Code

src/index.ts[R143-147]

export { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader"
-export { ConnectionOptions } from "./connection/ConnectionOptions"
export { DataSource } from "./data-source/DataSource"
-export { Connection } from "./connection/Connection"
export { ConnectionManager } from "./connection/ConnectionManager"
export { DataSourceOptions } from "./data-source/DataSourceOptions"
export { Driver } from "./driver/Driver"
Evidence
src/index.ts re-exports everything from the MongoDB typings module, and that module declares an
exported ConnectionOptions interface. The PR diff removes TypeORM’s own ConnectionOptions
export, so the remaining exported ConnectionOptions name at the package root will now resolve to
the MongoDB one instead of failing fast or guiding users to DataSourceOptions.

pr_files_diffs/src_index_ts.patch[6-18]
src/index.ts[128-141]
src/driver/mongodb/typings.ts[2557-2564]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
TypeORM’s root module (`src/index.ts`) still re-exports `ConnectionOptions` from `./driver/mongodb/typings`. After this PR removes TypeORM’s own `ConnectionOptions`, consumers may still be able to import `ConnectionOptions` from `typeorm`, but it will now refer to MongoDB’s driver `ConnectionOptions` instead of failing fast / guiding them to `DataSourceOptions`.
### Issue Context
The PR goal is to remove the deprecated `Connection` / `ConnectionOptions` in favor of `DataSource` / `DataSourceOptions`. Leaving an unrelated `ConnectionOptions` symbol in the root exports undermines that migration.
### Fix Focus Areas
- src/index.ts[128-147]
- src/driver/mongodb/typings.ts[2557-2575]
### Suggested approaches
1) Prefer: remove `export * from &amp;quot;./driver/mongodb/typings&amp;quot;` from the root and expose MongoDB typings via a dedicated subpath/barrel (or `export * as MongoDB from ...`) to prevent name collisions.
2) Alternative: in the MongoDB typings module, rename/alias the exported `ConnectionOptions` type to something explicit (e.g., `MongoConnectionOptions`) and avoid exporting `ConnectionOptions` at the root (this may require changing how typings are generated/committed).
### Acceptance criteria
- `ConnectionOptions` is no longer available as a root export from `typeorm`.
- MongoDB-specific typings remain accessible in a non-colliding way (namespaced or subpath).
- Build/typecheck succeeds.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Stale connect() guidance 🐞 Bug ✓ Correctness
Description
After removing DataSource.connect(), some public-facing guidance (JSDoc and an exported error
message) still instructs users to call connect(). Users following these messages will now hit
compile/runtime failures and have a harder time diagnosing initialization issues.
Code

src/data-source/DataSource.ts[L288-297]

-    /**
-     * Performs connection to the database.
-     * This method should be called once on application bootstrap.
-     * This method not necessarily creates database connection (depend on database type),
-     * but it also can setup a connection pool with database to use.
-     * @deprecated use .initialize method instead
-     */
-    async connect(): Promise<this> {
-        return this.initialize()
-    }
Evidence
The PR removes DataSource.connect() (diff pointer), but ConnectionManager.create() still says to
"manually call connect" and NoConnectionForRepositoryError still says "Call connection#connect".
Meanwhile, the replacement is clearly initialize() (used by globals.createConnection), and
DataSource exposes initialize()/destroy() with no connect()/close() in between.

src/connection/ConnectionManager.ts[48-52]
src/error/NoConnectionForRepositoryError.ts[6-12]
src/globals.ts[90-99]
src/data-source/DataSource.ts[279-293]
src/index.ts[145-148]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`DataSource.connect()` was removed, but some public-facing strings/docs still recommend calling `connect()`.
### Issue Context
This PR intentionally removes deprecated `connect/close` in favor of `initialize/destroy`.
### Fix Focus Areas
- src/connection/ConnectionManager.ts[48-52]
- src/error/NoConnectionForRepositoryError.ts[6-12]
### Suggested change
- Replace “call connect method” with “call initialize()” in `ConnectionManager.create()` JSDoc.
- Update `NoConnectionForRepositoryError` message to say “Call dataSource.initialize()” (or “connection.initialize()” if you want to keep legacy wording), since `connect()` no longer exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@alumni alumni merged commit 0b6ce64 into typeorm:master Feb 21, 2026
95 of 97 checks passed
@pkuczynski pkuczynski added this to the 1.0 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Remove the Connection class and related items

5 participants