Skip to content

Conversation

@pkuczynski
Copy link
Collaborator

@pkuczynski pkuczynski commented Nov 21, 2025

Description of change

During merge from master correct node version matrix was lost. This PR restores it.

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 unit tests validating the change
  • Documentation has been updated to reflect this change

@pkuczynski pkuczynski self-assigned this Nov 21, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Comprehensive modernization PR updating Node.js support (>=20.9.0 or >=22.11.0), migrating from rimraf/glob to native fs.rm/tinyglobby, adding AsyncDisposable support to query runners, updating TypeScript targets to ES2023, refactoring ESLint and Prettier configs, and reformatting code across drivers and tests for consistency.

Changes

Cohort / File(s) Summary
CI & Engine Configuration
.github/workflows/tests-linux.yml, .github/workflows/tests.yml, ormconfig.sample.json
Updated test node-version matrices (18→20, 20→24), tightened CockroachDB job condition to >=22, enabled mssql driver (skip: false).
Core Dependencies & Engine
package.json
Bumped engine from >=16.13.0 to ^20.9.0 || >=22.11.0; updated devDependencies (mocha, prettier, sinon, ts-node, etc.); added eslint-plugin-chai-friendly and tinyglobby; migrated compile script from rimraf to gulp clean.
Documentation Updates
README.md, DEVELOPER.md, docs/docs/help/1-faq.md, docs/docs/query-runner.md
Updated ES2021→ES2023 support; refactored prerequisite/Docker guidance; replaced glob-based code examples; added async resource-management patterns; rewrote test template snippets.
Formatting & Style Config
.prettierrc.json, eslint.config.mjs
Reduced Prettier options to semi: false only; replaced ignores array with globalIgnores(), added chai-friendly plugin, removed no-unused-expressions rule, updated jsdoc to flat/recommended-typescript.
Build & Core Infrastructure
gulpfile.ts, src/cli.ts, src/commands/...
Replaced rimraf with fs.rm; removed legacy pack/publish tasks; updated CLI command registrations; bumped TypeScript targets to ES2023; reformatted InitCommand tsconfig templates.
Driver Property Declarations
src/driver/aurora-postgres/AuroraPostgresDriver.ts, src/driver/aurora-postgres/AuroraPostgresQueryRunner.ts, src/driver/better-sqlite3/BetterSqlite3Driver.ts, src/driver/sqlite/SqliteDriver.ts, src/driver/capacitor/CapacitorDriver.ts, src/driver/cordova/CordovaDriver.ts, src/driver/expo/ExpoDriver.ts, src/driver/expo/legacy/ExpoLegacyDriver.ts, src/driver/sqljs/SqljsDriver.ts, src/driver/mongodb/MongoRepository.ts
Converted concrete property declarations to TypeScript ambient declarations (declare keyword) or removed explicit public fields; no behavioral change.
Error Handling Refactoring
src/driver/aurora-mysql/AuroraMysqlDriver.ts, src/driver/cockroachdb/CockroachDriver.ts, src/driver/mysql/MysqlDriver.ts, src/driver/oracle/OracleDriver.ts, src/driver/postgres/PostgresDriver.ts
Replaced ternary error handling with explicit if/else blocks; added guards for falsy values in event handlers.
AsyncDisposable Interface Implementation
src/query-runner/BaseQueryRunner.ts, src/query-runner/QueryRunner.ts, src/driver/mongodb/MongoQueryRunner.ts
Added AsyncDisposable interface; implemented async Symbol.asyncDispose method; added abstract release() and commitTransaction() methods.
Tooling & Utility Migration
src/util/DirectoryExportedClassesLoader.ts, src/platform/BrowserDirectoryExportedClassesLoader.template, test/functional/multi-database/multi-database-basic-functionality/multi-database-basic-functionality.ts, test/github-issues/799/issue-799.ts, test/github-issues/8975/issue-8975.ts
Replaced glob/rimraf with tinyglobby/fs.rm imports; removed importJsonsFromDirectories function.
Query Runner & Entity Manager Formatting
src/driver/aurora-mysql/AuroraMysqlQueryRunner.ts, src/driver/cockroachdb/CockroachQueryRunner.ts, src/driver/oracle/OracleQueryRunner.ts, src/driver/postgres/PostgresQueryRunner.ts, src/driver/spanner/SpannerQueryRunner.ts, src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts, src/driver/sqlserver/SqlServerQueryRunner.ts, src/entity-manager/EntityManager.ts, src/metadata/EntityMetadata.ts, src/util/OrmUtils.ts
Consolidated multi-line query/reduce calls to single-line; reformatted type assertions and arrow functions.
Type Definition Reformatting
src/find-options/FindOptionsOrder.ts, src/find-options/FindOptionsRelations.ts, src/find-options/FindOptionsSelect.ts, src/find-options/FindOptionsWhere.ts, src/driver/mongodb/typings.ts, src/common/DeepPartial.ts, src/query-builder/QueryPartialEntity.ts
Adjusted indentation and line-breaks within conditional type definitions; no semantic changes.
Miscellaneous Driver/Metadata Formatting
src/driver/Query.ts, src/driver/sqlserver/MssqlParameter.ts, src/decorator/ForeignKey.ts, src/data-source/DataSource.ts, src/driver/cordova/CordovaQueryRunner.ts, src/metadata-builder/EntityMetadataBuilder.ts, src/metadata-builder/JunctionEntityMetadataBuilder.ts, src/migration/MigrationExecutor.ts, src/persistence/SubjectDatabaseEntityLoader.ts, src/query-builder/RelationIdLoader.ts, src/query-builder/SelectQueryBuilder.ts, src/repository/MongoRepository.ts, src/util/DepGraph.ts, src/platform/PlatformTools.ts
Line-wrapping and indentation adjustments; no functional changes.
Test Files — New & Async Disposal
test/functional/query-runner/async-dispose.ts, test/functional/query-runner/entity/Company.ts, test/functional/query-runner/entity/Employee.ts, test/functional/driver/sap/connection-pool.ts
Added new test entities (Company, Employee); added async-dispose functional test validating using-block query runner lifecycle.
Test Files — Formatting & Cleanup
test/functional/columns/virtual-columns/virtual-columns.ts, test/functional/driver/MongoDriver.ts, test/functional/multi-schema-and-database/custom-junction-database/custom-junction-database.ts, test/functional/multi-schema-and-database/custom-junction-schema/custom-junction-schema.ts, test/functional/query-builder/distinct-on/query-builder-distinct-on.ts, test/functional/query-runner/create-and-drop-database.ts, test/functional/query-runner/drop-foreign-key.ts, test/functional/query-runner/drop-index.ts, test/functional/query-runner/drop-unique-constraint.ts, test/functional/query-runner/stream.ts, test/functional/repository/basic-methods/repository-basic-methods.ts, test/functional/repository/clear/repository-clear.ts, test/functional/repository/find-methods/repostiory-find-methods.ts, test/functional/schema-builder/change-column.ts, test/functional/view-entity/general/view-entity-general.ts, test/functional/view-entity/mssql/view-entity-mssql.ts, test/functional/view-entity/mysql/view-entity-mysql.ts, test/functional/view-entity/oracle/view-entity-oracle.ts, test/functional/view-entity/postgres/view-entity-postgres.ts, test/functional/view-entity/sqlite/view-entity-sqlite.ts, test/github-issues/1465/entity/AccountActivationToken.ts, test/github-issues/2199/issue-2199.ts, test/github-issues/3105/issue-3105.ts, test/github-issues/3246/issue-3246.ts, test/github-issues/3837/issue-3837.ts, test/github-issues/7266/issue-7266.ts, test/github-issues/7558/issue-7758.ts, test/github-issues/8556/issue-8556.ts, test/github-issues/9534/issue-9534.ts, test/github-issues/9988/issue-9988.ts, test/other-issues/hydrate-performance/hydrate-performance.ts, test/unit/connection-options-reader/connection-options-reader.ts
Reformatted multi-line calls to single-line; updated assertion styles; added chai/register-should import; minor title fix.
Sample Code
sample/sample24-schemas/app.ts
Reformatted require calls within EntitySchema with trailing commas.
Version & Command Updates
src/commands/VersionCommand.ts, src/commands/CommandUtils.ts
Minor formatting adjustments in localNpmList assignment and importOrRequireFile call.

Sequence Diagram(s)

sequenceDiagram
    actor Code as Application Code
    participant QR as QueryRunner<br/>(AsyncDisposable)
    participant DB as Database
    participant Pool as Connection Pool

    rect rgba(100, 200, 100, 0.2)
    Note over Code,Pool: using block acquisition
    Code->>QR: createQueryRunner()
    QR->>Pool: acquire connection
    Pool-->>QR: connection
    end

    rect rgba(100, 150, 200, 0.2)
    Note over Code,Pool: execute operations
    Code->>QR: executeQuery()
    QR->>DB: query
    DB-->>QR: result
    Code->>QR: commitTransaction()
    QR->>DB: COMMIT
    DB-->>QR: ok
    end

    rect rgba(200, 100, 100, 0.2)
    Note over Code,QR: scope exit (using end)
    Code->>QR: [Symbol.asyncDispose]()
    QR->>QR: release()
    QR->>Pool: return connection
    Pool-->>QR: released
    QR-->>Code: Promise<void>
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Areas requiring extra attention:

  • package.json engine constraints & dependency bumps — Verify Node 20.9.0 and 22.11.0 compatibility across all downstream tooling; review peerDependencies against ecosystem constraints
  • AsyncDisposable interface implementation — Ensure QueryRunner subclasses properly override release() and commitTransaction(); validate using statement behavior in test/functional/query-runner/async-dispose.ts
  • ESLint config structural change (globalIgnores replacement) — Confirm new flat config format functions correctly with defineConfig and test runner integrations
  • Driver class declare keyword changes — Multiple driver files converted properties to ambient declarations; verify no runtime errors or missing initialization paths in subclasses
  • glob → tinyglobby migration — Check DirectoryExportedClassesLoader.ts and test file migrations for correctness of globSync API calls and behavior parity
  • Ternary → if/else refactoring in driver error handlers — Verify all error handling branches (fail/ok) match original ternary semantics across aurora-mysql, cockroachdb, mysql, postgres, oracle drivers
  • GitHub workflow node-version matrices — Confirm CockroachDB condition (>=22) and test matrix alignment (20, 24) do not break CI/CD

Possibly related PRs

Suggested reviewers

  • alumni
  • sgarner
  • mguida22
  • OSA413
  • michaelbromley

Poem

🐰 A hop through Node's greener lands,
From ancient eighteen to twenty-two so grand,
With declare keywords, AsyncDispose in hand,
No rimraf, no glob—tinyglobby commands,
Formatting polish, configs refined—
TypeORM's future, modernized and aligned! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat!: drop support for node 16 and 18' clearly and specifically describes the main change—updating Node.js version requirements. It is concise, uses standard conventional commit format, and directly matches the substantial changes throughout the PR (engine updates, Node version matrix changes, etc.). The breaking change indicator (!) is appropriately used.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkuczynski pkuczynski changed the base branch from master to next November 21, 2025 11:38
@qodo-free-for-open-source-projects
Copy link

qodo-free-for-open-source-projects bot commented Nov 21, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Silent error handling: The catch block at line 989 silently catches errors without logging or providing context
about the failure

Referred Code
} catch {
    throw new DriverPackageNotInstalledError("Oracle", "oracledb")

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 21, 2025

typeorm-sql-js-example

npm i https://pkg.pr.new/typeorm/typeorm@11787

commit: a85e164

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

qodo-free-for-open-source-projects bot commented Nov 21, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Correct invalid Node.js version in CI
Suggestion Impact:The suggestion was directly implemented. The commit changed the node-version from 222 to 22 in the .github/workflows/tests.yml file, exactly as suggested.

code diff:

-      node-version: 222
+      node-version: 22

Correct the invalid Node.js version 222 in the .github/workflows/tests.yml file
to a valid version like 22 to prevent CI job failure.

.github/workflows/tests.yml [109]

-node-version: 222
+node-version: 22

[Suggestion processed]

Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a typo in the Node.js version (222) within the CI configuration, which would cause the tests-windows job to fail.

Medium
Handle driver dependency loading error

Restore the catch block in loadDependencies to throw a
DriverPackageNotInstalledError if the oracledb driver fails to load, preventing
a subsequent TypeError.

src/driver/oracle/OracleDriver.ts [985-999]

+protected loadDependencies(): void {
+    try {
+        const oracle = this.options.driver || PlatformTools.load("oracledb")
+        this.oracle = oracle
+    } catch (e) {
+        throw new DriverPackageNotInstalledError("Oracle", "oracledb")
+    }
+    const thickMode = this.options.thickMode
+    if (thickMode) {
+        if (typeof thickMode === "object") {
+            this.oracle.initOracleClient(thickMode)
+        } else {
+            this.oracle.initOracleClient()
+        }
+    }
+}
 
-

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that removing the catch block's content introduces a critical bug where a missing oracledb driver would lead to a TypeError instead of a clear DriverPackageNotInstalledError.

Medium
Fix incorrect assertion in test

Fix the test by first inserting a valid Company record to prevent a foreign key
violation, allowing the test to correctly verify the transaction commit logic on
asyncDispose.

test/functional/query-runner/async-dispose.ts [39-62]

 it("should commit the transaction in progress", () =>
     Promise.all(
         dataSources.map(async (dataSource) => {
             let releaseSpy: sinon.SinonSpy | null = null
             let error: Error | null = null
 
             async function insertEmployee() {
                 await using queryRunner = dataSource.createQueryRunner()
                 releaseSpy = sinon.spy(queryRunner, "release")
                 await queryRunner.startTransaction("READ UNCOMMITTED")
+                await queryRunner.manager.save(Company, {
+                    id: 100,
+                    name: "Acme",
+                })
                 await queryRunner.sql`INSERT INTO "employee"("name", "companyId") VALUES ('John Doe', 100)`
             }
 
             try {
                 await insertEmployee()
             } catch (e) {
                 error = e
             }
 
-            expect(error).to.be.instanceOf(QueryFailedError)
-            expect((error as QueryFailedError).query).to.equal("COMMIT")
+            expect(error).to.be.null
             expect(releaseSpy).to.have.been.calledOnce
         }),
     ))

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a flaw in the test logic where it asserts on a COMMIT failure caused by a foreign key violation, rather than testing the successful commit path as intended.

Medium
Use compatible glob implementation for Node

Replace the incorrect usage of require("node:fs").globSync with the glob package
for compatibility and correctness in the documentation example.

docs/docs/help/1-faq.md [184-199]

-const { globSync } = require("node:fs")
+const { sync } = require("glob")
 const path = require("node:path")
 
 module.exports = {
     // ... your webpack configurations here...
     // Dynamically generate a `{ [name]: sourceFileName }` map for the `entry` option
     // change `src/db/migrations` to the relative path to your migration folder
-    entry: globSync(path.resolve("src/db/migrations/*.ts")).reduce(
+    entry: sync(path.resolve("src/db/migrations/*.ts")).reduce(
         (entries, filename) => {
             const migrationName = path.basename(filename, ".ts")
             return Object.assign({}, entries, {
                 [migrationName]: filename,
             })
         },
         {},
     ),

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that globSync is not a named export of node:fs and proposes a valid fix using the glob package, which was used previously.

Low
  • Update

@pkuczynski pkuczynski changed the title feat!: drop support for node 16 and 18 (#11382) ci: fix node versions matrix after bad merge from master Nov 21, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 21, 2025

Deploying typeorm with  Cloudflare Pages  Cloudflare Pages

Latest commit: a85e164
Status: ✅  Deploy successful!
Preview URL: https://6e90d388.typeorm.pages.dev
Branch Preview URL: https://ci-node-matrix.typeorm.pages.dev

View logs

@alumni
Copy link
Collaborator

alumni commented Nov 21, 2025

@pkuczynski For some reason the cli init command is installing the old version of typeorm which has peerDependencies: { mssql: "^9 || ^10 || ^11" }}, but in the next branch we only work with mssql@12.

So the question is: how did it work in the past? and why is it installing typeorm@0.3.27?

Later edit:

image

@pkuczynski pkuczynski changed the title ci: fix node versions matrix after bad merge from master test(cli): fix tests for init command Nov 21, 2025
Copy link
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.

👍great

@pkuczynski pkuczynski merged commit 61379da into next Nov 21, 2025
63 checks passed
@pkuczynski pkuczynski deleted the ci/node-matrix branch November 21, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants