1056 Commits

Author SHA1 Message Date
Lucian Mocanu
01dddfef97
fix: add stricter type-checking and improve event loop handling (#11540)
* refactor: minor type improvements

* chore: add type-checked eslint rules

* fix: enable no-misused-promises

* fix: enable no-floating-promises

* fix: enable await-thenable

* fix: enable require-await

* fix: enable no-misused-new

* refactor: enable no-namespace

* refactor: enable tseslint eslint recommended

* code review
2025-06-22 11:51:29 +02:00
Lucian Mocanu
abf8863a53
feat(sap): add support for REAL_VECTOR and HALF_VECTOR data types in SAP HANA Cloud (#11526)
* feat(sap): add support for REAL_VECTOR data type

* feat(sap): add support for HALF_VECTOR data type
2025-06-22 01:43:10 +02:00
Lucian Mocanu
f2d2236218
fix(oracle): pass duplicated parameters correctly to the client when executing a query (#11537) 2025-06-21 14:05:15 +02:00
Lucian Mocanu
ead4f98ee4
fix: improve async calls on disconnect (#11523) 2025-06-19 00:43:38 +02:00
Yevhen Komarov
63a3b9abc1
fix: multiple relations with same column name(s) generate invalid SELECT statement (#11400)
* fix: Multiple relations with same columns cause invalid SQL to be generated
Closes: #1668, #9788,  #9814, #10121, #10148, #11109, #11132, #11180

* refactor: extract cloneObject util

* fix: improve cloneObject

* test: remove duplicate tests

* test: transformed the test: add City, Country, and Order entities with composite foreign key relations,

* test: change to composite primary key

---------

Co-authored-by: Lucian Mocanu <alumni@users.noreply.github.com>
2025-06-17 18:38:16 +02:00
gongAll
ce23d4648e
fix(tree-entity): closure junction table primary key definition should match parent table (#11422)
* fix #9600 https://github.com/typeorm/typeorm/issues/9600

* implement tests.

* implement tests.

* implement tests.

* move tests fo functional tab.
implement remaining tests.
implement remaining fields.

* fix code rabbit detected errors.

* add MySQL-specific type checks to closure-table tests

* split closure-table tests for MySQL-specific scenarios

* remove redundant MySQL type checks from closure-table tests

* move MySQL-specific closure-table tests to a separate file

---------

Co-authored-by: Gonçalo Alves <goncalo.alves@knowledgeworks.pt>
Co-authored-by: gioboa <giorgiob.boa@gmail.com>
2025-06-17 09:08:08 +12:00
KimYeonghun
413f0a68c8
fix: handle limit(0) and offset(0) correctly in SelectQueryBuilder (#11507)
* fix: handle limit(0) and offset(0) correctly in SelectQueryBuilder

- Fix JavaScript falsy value issue where limit(0) was treated as undefined
- Now limit(0) correctly generates 'LIMIT 0' SQL clause instead of being ignored
- Add helper functions hasLimit/hasOffset to distinguish between undefined and 0
- Add comprehensive test cases for zero value handling in limit/offset/take/skip
- Prevents potential security issue where limit(0) returned all records

Fixes potential data exposure when limit(0) was intended to return empty result

* fix: prettier formatting

* test: expand test coverage for LIMIT/OFFSET edge cases and regression prevention
2025-06-05 14:40:58 +02:00
Sakura
a9c16ee66d
feat: add upsert support for Oracle, SQLServer and SAP HANA (#10974) 2025-06-05 08:45:45 +02:00
Denes Antonio de Souza
144634d4c0
feat(spanner): support insert returning (#11460)
* Update SpannerDriver.ts

* Update package.json

* Update package.json

* Update package.json

* Update package-lock.json

* Update package.json

* #11453

* Revert "Update package.json"

This reverts commit 20f24de10cda62ad0c9a368b14290fbb4f355b32.

* Revert "Update package.json"

This reverts commit bcf6678e95b57570ea526935bb7490c9b11a16da.

* Update package.json

* Revert "Update package-lock.json"

This reverts commit a003e5659336b38b8cade5f1605c17f7c3e59673.

* #11460

* #11460

* FIX/Spanner Numeric type value string

* #11460 Test functional spanner

* test: update returning tests

* refactor: simplify condition

* style: fix lint/format

* test: fix returning test for spanner

---------

Co-authored-by: Lucian Mocanu <alumni@users.noreply.github.com>
2025-05-13 22:45:53 +02:00
Christian Forgács
e9eaf79604
Fix/11466 mssql find operator (#11468)
* chore: enable driver `mssql` for test of issue #3113

* chore: add test case for #11298 to issue #11285 to prevent functionality of #11285

* fix: unhandled find operator with array value for mssql (#11466)

* fixup! fix: unhandled find operator with array value for mssql (#11466)

* Revert "chore: enable driver `mssql` for test of issue #3113"

This reverts commit a302d63eeac5892e920d97705b4230414ef81e6d.

* fixup! chore: add test case for #11298 to issue #11285 to prevent functionality of #11285

---------

Co-authored-by: Christian Forgács <christian@wunderbit.de>
2025-05-13 12:45:06 +12:00
Simon Garner
23bb1ee271
feat: add updateAll and deleteAll methods to EntityManager and Repository APIs (#11459)
* Add updateAll() methods

* Add deleteAll() methods

* Fix softDelete/restore error messages

* Add test for Repository.delete() with criteria

* Add test for Repository.deleteAll() method

* Move/rename “Repository > delete” test files

* Tweak comments

* Add tests for Repository update methods

* Add updateAll and deleteAll to EntityManager API docs

* Add updateAll and deleteAll to Repository API docs

* Fix tests
2025-05-13 12:33:44 +12:00
Eliya Cohen
c464ff87cb
feat: add tagged template for executing raw SQL queries (#11432)
* Added a new SQL tagged template feature for executing raw SQL queries with automatic parameter handling.

---------

Co-authored-by: Simon Garner <simon@equalogic.com>
2025-05-09 13:19:40 +12:00
Lucian Mocanu
fadad1a74c
fix: cleanup after streaming in sap hana (#11399) 2025-05-01 22:48:09 +02:00
Caíque de Castro Soares da Silva
61a6f971af
fix: prevent error when replication is undefined (#11423)
* fix: prevent error when replication is undefined

* fix format

* add test

* update test name

* fix test

* fix test

* skip test

* add unit test

* fix unit test

* fix unit test
2025-04-25 14:30:42 +02:00
Ievgen Makukh
fe71a0c3e4
perf(query-runner): use Date.now() intead of +new Date() (#10811)
* perf(query-runner): use Date.now() intead of +new Date()

* perf: use Date.now() instead of new Date().getTime()

---------

Co-authored-by: Lucian Mocanu <alumni@users.noreply.github.com>
Co-authored-by: Mike Guida <mike@mguida.com>
2025-04-15 13:18:22 -06:00
iliagrvch
046aebe696
feat: Add query timeout support for MySql (#10846)
Add "enableQueryTimeout" option to MysqlConnectionOptions. When enabled the value of "maxQueryExecutionTime" will be passed to mysql driver as query timeout.

---------

Co-authored-by: Mike Guida <mike@mguida.com>
2025-04-15 12:17:04 -06:00
Mike Guida
45577df8b7
test: remove unused type parameter from decorators (#11412)
Remove unused `type` parameter from functions supplied to decorators in tests and sample code. This resolves 477 eslint unused var warnings.

All changes are modifying functions in test or sample code of the following style:

1. `@OneToMany((type) => Entity, ...)` to `@OneToMany(() => Entity)`
2. `@ManyToOne((type) => Entity, ...)`
3. `@ManyToMany((type) => Entity, ...)`
4. `@OneToOne((type) => Entity, ...) `

Note that we don't actually ever call this function with an argument.
2025-04-14 09:25:31 -06:00
Pieter Wigboldus
7c5ea99b31
feat: generate ESM migrations via esm flag (#10802)
Including jsdoc for typehinting
Add esm as an option in the migrate cli
Update the documentation for the JS migrations

fixes #10801

Co-authored-by: Mike Guida <mike@mguida.com>
2025-04-04 12:05:33 -06:00
Yevhen Komarov
6ebae3b795
feat: add new foreign key decorator, and entity schemas options (#11144)
* feat: add new foreign key decorator, and entity schemas options

This new feature adds the ability to create foreign key constraints without entity relations, using `@ForeignKey()` decorator or entity schema options.

Closes: #4569
2025-04-04 10:22:40 +13:00
Benjamin Renoux
72c6991680
fix: incorrect table alias in insert orUpdate with Postgres driver (#11082)
* fix: resolve issues in insert query orUpdate method with postgres driver

This fix make use of table name alias in WHERE clause of onUpdate method with postgres driver to avoid throwing error

Closes: #11077

* test: update insert on conflict test

---------

Co-authored-by: Lucian Mocanu <alumni@users.noreply.github.com>
2025-04-02 02:31:52 +02:00
Lucian Mocanu
3d79786a92
fix: version detection for Postgres derived variants (#11375) 2025-04-01 21:54:27 +02:00
Lucian Mocanu
460ef023ba
fix(sap): normalize deprecated/removed data types in SAP HANA Cloud (#11356)
* fix(sap): SAP HANA Cloud data types

* fix(sap): fall back to regular index when fulltext is not supported

* fix: remove dead code
2025-04-01 20:54:54 +02:00
Lucian Mocanu
863caf1471
fix: sql escape issues identified by CodeQL (#11338)
* fix: sql escape issues identified by CodeQL

* fix: random generation in sample code
2025-04-01 10:38:36 +02:00
ertl
bcaa0bf071
fix: bulk insert NULL values in Oracle (#11363)
resolve issue with bulk insert of NULL values for non VARCHAR2 types in Oracle.
2025-03-31 21:35:03 -06:00
Lucian Mocanu
fb06662bea
build: setup SAP HANA tests (#11347)
* build: setup SAP HANA tests

* test: fix/skip failing SAP HANA tests

* fix(sap): rename schema
2025-03-29 22:35:44 +01:00
Lucian Mocanu
6ba408214e
build: improve test workflow (#11361) 2025-03-26 22:10:19 +01:00
Muhammad Ghayas Baig
834e85692f
fix: FindOptionsSelect to use correct type when property is an object (#11355)
* fix: FindOptionsSelectProperty or boolean when Property is object

* fix: add test cases for find options select

* fix: use simple-json for tests
2025-03-25 15:40:42 +05:00
Lucian Mocanu
00d5639efb
chore: update dependencies (#11339)
* style: sort package json

* chore: update dependencies

* fix: update dependencies added by the init command

* fix: restore node 16/18 compatibility

* docs: update package description

* chore: remove unused dependencies
2025-03-21 19:57:18 +02:00
Lucian Mocanu
8c2b2ae240
style: lint repository (#11346)
* style: lint uncommon rules

* style: fix `no-wrapper-object-types`

* fix: type errors after Object -> object change

* style: fix `prefer-const`

* build: add eslint/prettier exclusions
2025-03-20 22:15:39 +02:00
Mike Guida
de8eb04c72
build: run format in ci (#11342)
* style: run format on existing files

* build: run format in ci

* build: add format:ci to check formatting in ci
2025-03-20 20:27:09 +02:00
John Chan
b0ea913f4e
feat(postgres): support macaddr8 column type
Signed-off-by: John Chan <john.chan@sgwireless.com>
2025-03-19 16:13:12 +05:00
Oleg "OSA413" Sokolov
5d6d893662
test: fix and run tests on Windows (#11257)
* Skip tests that don't work on Windows

* Bring back tests on Windows

* Skip the test on all platforms exept Windows

* Make the test run only on Windows

* Add simple winodws test

* fix cli test on Windows

* let's see if this test passes on linux

* limit test to Windows and run format

* Add withPlatform test helper

* Mock platform in file path tests using withPlatform()

* Fix test: relative paths should not change on non-win32 platforms

* Lowercase relative path on non-win32 platform

* test: add better-sqlite3 and sqlite for Windows tests

---------

Co-authored-by: Simon Garner <simon@equalogic.com>
2025-03-14 16:01:46 +05:00
Lucian Mocanu
ae96f87923
fix: empty objects being hydrated when eager loading relations that have a @VirtualColumn (#10927) 2025-03-14 10:05:19 +01:00
Oleg "OSA413" Sokolov
deb0e81398
test: rename tests to better describe the case (#11280)
Fixes #10863
2025-03-12 21:40:55 +05:00
Dmitrii Tkachenko
72145b859d
fix: remove unnecessary import from JS migration (#11327)
* fix: omit ts import for js migration

* test: javascript template create

* test: remove TS from JS templates

* chore: update docs
2025-03-10 19:46:42 +02:00
Lucian Mocanu
27b4207c48
fix(sap): incorrect handling of simple array/json data type (#11322) 2025-03-06 14:00:33 +01:00
Lucian Mocanu
759cf7cf54 test: issue #11269 2025-03-03 15:35:06 +01:00
Lucian Mocanu
a08ebbdea0 test: improve nested transactions tests 2025-03-03 15:35:05 +01:00
Lucian Mocanu
3044e7a233 test: fix cockroach tests 2025-03-03 15:35:05 +01:00
Lucian Mocanu
71addb2ef4
refactor: use node:fs/promises (#11206)
* refactor: use fs promises

* refactor: remove del, update rimraf
2024-12-30 09:33:51 +01:00
Joel Stimson
19a6954d8b
chore: Lint on GitHub actions (#11177) 2024-12-18 11:44:18 +01:00
Oleg "OSA413" Sokolov
53f253d527
test: redo cockroachdb to service-container GHA and update its version to latest (24) (#11190) 2024-12-16 08:33:00 +01:00
jeisberg
83567f5334
fix: composite key save issue (#10672)
* chore(TypeORM): Create test case to uncover TypeORM composite key save issue

* chore(TypeORM): Revert package.json test script alteration

* fix the issue

* fixed regression in 1551

* fixed test to prevent issues with auto increment when inserting rows in a different order

* fixed test to prevent issues with auto increment when inserting rows in a different order

---------

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2024-02-02 13:41:37 +05:00
Niels Stinissen
d0b76703cc
feat: add postgres multirange column types (#10627)
* feat: add postgres multirange column types

Adds int4-, int8-, num-, ts-, tstz-, date-multirange column types for postgres
Update docs to include multirange column types
Update functional column-types-postgres test to test multirange column types

Closes: #10556

* style: run npm run format

---------

Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2024-01-26 11:33:16 +05:00
Alexey Pelykh
dd49a254dc
fix: don't escape indexPredicate (#10618)
* fix: don't escape indexPredicate

* style: npm run format
2024-01-26 11:26:12 +05:00
Markus Fürer
e22481904a
style: Enable some linter rules (#10592)
* style: 🚨 enable some linter rules

* Revert "style: 🚨 enable some linter rules"

This reverts commit 239fa2deb7aaf22cfac4bbb1369d6d973327efd4.

* revert:  revert role "prefer-const"

* revert:  enable linter warnings

* style: 🚨 enable rule "no-extra-boolean-cast"

* revert:  disable rule "no-empty"

* style: 🚨 add linter rule "no-useless-escape"

* style: 🚨 add linter rule "no-unsafe-optional-chaining"
2024-01-26 11:06:15 +05:00
ertl
7e85460f10
feat: add json type support for Oracle (#10611)
* refactor: remove oracle docker tests and update DEVELOPER.md

Since oracle runs at thin mode now. Now extra docker tests are needed

* chore: increase oracle version to 21c

* feat: add json column types to oracle

* fix: try to resolve pipeline issue to increase oracle waiting time

* fix: try remove networks from oracle to fix pipeline

* fix: add container name

* fix: add missing oracledb driver in package-lock.json

* fix: corrected tests

* fix: remove tests, since only work with old oracle db

* fix: correct tests

* fix: remove deprecated types

* fix: add missing grant for materialized views

* fix: oracle-isolation.ts test

* fix: issue-3363.ts test

* fix: schema in tests
2024-01-26 10:27:28 +05:00
Lucian Mocanu
c22e30f1d2
build: set TS compile target to ES2021 (#10595)
* build: set TS compile target to ES2021

* docs: update minimum supported node version

* build: use @tsconfig/node16
2024-01-04 09:57:12 +05:00
Dmitry Zotov
15bc8876f8
build: update CircleCI config & repair failing tests (#10590)
* updated CircleCI config

* fixed failing test

* fixed failing test

* fixed failing test

* fixed failing test

* fixed CockroachDB enum sync;
removed redundant await;
fixed failing tests;

* fixing failing tests

* fixing failing tests

* added check for empty commands

* fixed failing tests

* fixed failing tests

* fixed failing test
2024-01-03 13:32:17 +05:00
Nicolas ROGER
73ee70b331
fix: correctly keep query.data from ormOption for commit / rollback subscribers (#10151) 2024-01-02 13:01:50 +05:00