85 Commits

Author SHA1 Message Date
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
Oleg "OSA413" Sokolov
b535cbd1bf
style: Apply formatting (#11175) 2024-12-11 09:51:02 +01:00
Shu Nonaka
54d8d9efe9
fix: hangup when load relations with relationLoadStrategy: query (#10630)
* fix: createQueryBuilder to accept queryRunner
* fix: modify to use queryRunner when retrieving relations (#10481)
* test: add testcases
2024-01-26 11:28:19 +05:00
Umed Khudoiberdiev
ec27803f28 refactor: removing globals usages 2022-04-02 22:04:20 +05:00
Umed Khudoiberdiev
3b8a031ece
0.3.0 (#8616)
* added find options and new option relationLoadStrategy

* find now returns null instead of undefined; removed primary relations support; bugfixing; added some changes and tests from next branch;

* added typename to connection options; added data loader types, lot of deprecations; new es2020 emit by tsc; new custom repositories syntax

* applied lint fixing

* replaced some instanceof checks

* reverting docker compose image versions

* optimizing imports

* reverting back some instanceof checks to prevent compiler errors

* downgrading es compilation version

* docs: remove "primary" from relation options (#8619)

remove ex-line 26 for being deprecated in 0.3.0:
"* `primary: boolean` - Indicates whether this relation's column will be a primary column or not."

* Revert "reverting back some instanceof checks to prevent compiler errors"

This reverts commit 7bf12a39e2297d097aa2a42989afd0e9e4f49bb0.

* Revert "optimizing imports"

This reverts commit 7588ac14e4f1bf1a82e3b7883134b9c2c8ae5f3f.

* Revert "replaced some instanceof checks"

This reverts commit bfa5a2d706f697ed1c1beb38b4455c0d33121e5a.

* fixing few comments

* removing transaction decorators

* this test is invalid - it's not clear why the hell getTreeRepository will throw an error and it's not clear what kind of error its going to throw

* addded mixed list support in connection options

* trying to fix oracle length issue

* lintfix

* removed shorten usages

* added named entity target support to the connection

* fixing entity target support in relation options via entity schema

* debugging oracle issue

* fixed issue with alias not being shortened in many to many alias cases

* some day we'll have a prettier.

* fixing oracle tests

* fixing oracle failing test

* removed "null" support in where expressions; fixed softDelete and restore incorrect usages

* renamed FindConditions to FindOptionsWhere

* version bump

* docs: update loading relation in find method (v 0.3.0) (#8621)

* docs: update relation definition method

Update the method that allows loading a specific relation inside the find method.
This method is found on the one-to-one-relations page.
Change `const users = await userRepository.find({ relations: ["profile"] });` to `const users = await userRepository.find({ relations: {profile: true});`.

* fix formatting

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>

* docs: change relations option definition (#8620)

* docs: change relations option definition

change line 139 from 
`const users = await connection.getRepository(User).find({ relations: ["profile", "photos", "videos"] });`
to
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });`
to reflect version 0.3.0 changes

* docs: change relations option definition

Rectified a type on line 139
from:
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });`
to
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true} });`

* formatting

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>

* lint

* improved find options types

* fixed types and removed nonnever because it causes circual issue for some reason

* docs: update entitymanager definition (#8623)

* docs: update entitymanager definition

change the "What is EntityManager?" page to be up-to-date with v 0.3.0

1. line 6 changes from
`You can access the entity manager via 'getManager()' or from 'Connection'.`
to 
`You can access the entity manager via DataSource's manager.`

2. the import on `getManager` in line 10 becomes `Manager` that the user have configured beforehand:
`import {getManager} from "typeorm";`
becomes 
`import {Manager} from "./config/DataSource";`

3.change entityManager definition in line 13:
from
`const entityManager = getManager(); // you can also get it via getConnection().manager`
to
`const entityManager = Manager;`

* docs: update entitymanager definition

changed line 10 from: 
`import {Manager} from "./config/DataSource";`
to
`import {DataSource} from "typeorm";`

and changed line 13 and 14 from: 
`const entityManager = Manager;`
`const user = await entityManager.findOne(User, 1);`
to 
`const myDataSource = new DataSource({ /*...*/ });`
`const user = await myDataSource.manager.findOne(User, 1);`

for a simpler way of describing the origin of DataSource and how it works.

* In return type doesn't seem to work in all cases

* feat: mssql v7 support (#8592)

Adds support for v7 of the mssql library as v6 is EOL. This also makes use of the new toReadableStream method on requests to return a native stream where required.

* fix: prefix relation id columns contained in embedded entities (#6977) (#7432)

* fix: prefix relation id columns contained in embedded entities (#6977)

Searches embedded entity columns for relation ID column if relation column
is in embedded entity. If not found, creates new relation ID with embedded
metadata set to match the relation column.

fixes: #2254
fixes: #3132
fixes: #3226
fixes: #6977

* test: prefix subcounters sub-entity with "sub" to fit in 30 character identifier for oracle

Problem introduced with #6981

* fix: find by Date object in sqlite driver (#7538)

* fix: find by Date object in sqlite driver

In sqlite, Date objects are persisted as UtcDatetimeString.
But a Date object parameter was escaped with .toISOString(), making such queries impossible.
This commit aligns both transforms.
This bug does *not* apply to better-sql where you can only bind numbers, strings, bigints, buffers,
and null.
This is breaking for when the user inserted their dates manually as ISO and relied on this old
maltransformation, after this their find()s by Date won't work anymore.

BREAKING CHANGE: Change Date serialization in selects
Closes: #2286

* add failing test

* fix: find by Date object in sqlite driver (with query builder)

Also consider query builder parameter escaping

* test: add test for 3426

Co-authored-by: James Ward <james@notjam.es>

* manually ported changes from #7796

* updated changelog

* fixes after merge

* new findOne syntax

* new find* syntax

* new find* syntax

* lint

* tsc version bump

* tsc version bump and fixed mongodb issues

* moved date fns into non dev deps

* returned oracledb dep into place

* removed lock files

* returned lock files back

* eslint upgrade

* fixing mongodb issue

* fixing mongodb issue

* test: keep junction aliases short (#8637)

Tests a fix for an issue where junction aliases (e.g. in many-to-many relations)
are not unique because they are too long and thus truncated by the driver.

Closes: #8627
Related to: 76cee41dcf1c146d02715c7f48fed33672d28c67

* fixing mongodb issues

* fixing sqlite test

* fixing sqlite test

* fixing sqlite test

* fixing mongodb test

* fixing entity schema tests

* fixing entity schema tests

* merged latest master

* removed driver instanceof checks

* removed function instanceof checks

* removed Object instanceof checks

* removing instanceof checks...

* fixing instanceof checks

* added InstanceChecker to remove remaining instanceof checks

* fixed failing test

* linting

* fixing failing test

* version bump

* compiler fixes

* Connection type usages replace to DataSource

* updated dev deps

* updated deps, add prettier, removed oracledb due to m1 issue

* chalk downgrade

* fixing failing test

* applied prettier formatting

* replaced eslint to prettier

* okay I think we can call it lint

* fixing linting

* fixed prettier introduced compiler bug

* fixed failing test

* prettier;

* fixed failing test

* alias shortening only for junction tables;
fixed failing tests;

* changed aurora db names and reverted change of junction table name shorten algorithm

* format

* removed platform from docker compose

* made numeric parameters to not use parameters to prevent parameters number limit issue. Also enabled shorten only for junction tables

* fixing test

* fixing returning columns bugs

* fixing test

* fixed returning issue

* fixing merge conflicts

* updating documentation

* working on docs / improving api

* working on docs

* fixed isConnected issue

* re-worked commands

* commenting cli command tests for now

* commenting cli command tests for now

* removed platform

* returned Connection back

* refactor: export tree repository helper methods (#8753)

* Migrated protected tree methods to util class

* Added tree repository extend override

* Ran prettier format

* merge master into 0.3.0

Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de>

* working on documentation

Co-authored-by: Bilel Taktak <47742269+Parsath@users.noreply.github.com>
Co-authored-by: Salah Azzouz <52634440+Salah-Azzouz@users.noreply.github.com>
Co-authored-by: Daniel Hensby <dhensby@users.noreply.github.com>
Co-authored-by: Nebojša Cvetković <nebkat@gmail.com>
Co-authored-by: Philip Waritschlager <philip+github@waritschlager.de>
Co-authored-by: James Ward <james@notjam.es>
Co-authored-by: Felix Gohla <37421906+felix-gohla@users.noreply.github.com>
Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
Co-authored-by: Jimmy Chen <50786287+Q16solver@users.noreply.github.com>
Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de>
2022-03-17 21:01:45 +05:00
Umed Khudoiberdiev
c52ba29d94
chore: typescript version upgrade (#7422) 2021-02-25 19:57:14 +05:00
Umed Khudoiberdiev
5d5716f8dc fixing tests 2019-03-09 00:59:39 +05:00
Zotov Dmitry
4c20d2e160 working on tests;
bugfixes;
2019-02-15 13:10:32 +05:00
Umed Khudoiberdiev
f97efdacc4 fixes latest typescript compiler errors 2019-01-20 11:59:19 +05:00
Umed Khudoiberdiev
8e076bf94d fixed performance issues 2017-11-17 23:17:12 +05:00
Umed Khudoiberdiev
620703d351 removed useless "schemaCreate: true" from tests 2017-11-07 18:52:22 +05:00
Umed Khudoiberdiev
2b00cb6121 merged master into persistment 2017-11-03 23:02:18 +05:00
Umed Khudoiberdiev
8b537c6b44 fixed compiler errors caused by typescript 2.6 upgration; version bump 2017-11-03 01:26:08 +05:00
Umed Khudoiberdiev
6c39bffc0c refactoring persistence 2017-10-31 15:47:53 +05:00
Umed Khudoiberdiev
b0c37d67f4 refactoring persistence 2017-10-31 10:51:33 +05:00
Umed Khudoiberdiev
e14fce5524 refactoring persistence 2017-10-27 22:47:59 +05:00
Umed Khudoiberdiev
1f5c6e0bf1 refactoring persistence 2017-10-27 16:26:12 +05:00
Umed Khudoiberdiev
33732fb0c2 refactoring persistence 2017-10-25 15:50:26 +05:00
Umed Khudoiberdiev
a830280673 removed test because of removed cascade remove functionality 2017-10-23 20:44:26 +05:00
Umed Khudoiberdiev
77cc40bbe5 refactored connection and added docs about connection 2017-07-28 17:02:15 +05:00
Umed Khudoiberdiev
03ceaeade0 fixes #694 - added tscompiler check for unused vars 2017-07-25 12:53:22 +05:00
Umed Khudoiberdiev
9d0f60214e made persistment and hydrator to return null in properties with nullable columns; fixed tests 2017-06-27 18:02:34 +05:00
Umed Khudoiberdiev
bababca2c0 renamed persist into save in manager and repository 2017-05-19 14:53:34 +05:00
Zotov Dmitry
664f70dfb6 refactored query builder - refactored JOIN part 2017-03-09 18:30:58 +05:00
Umed Khudoiberdiev
540ffffafc implemented partial persist 2017-02-27 12:33:04 +05:00
Umed Khudoiberdiev
5f8bf5ee13 fixed tslint issues 2017-01-26 16:47:10 +05:00
Umed Khudoiberdiev
e07d1c101d removed tests of cascade remove in many to many because they are not valid anymore 2017-01-14 14:58:55 +05:00
Umed Khudoiberdiev
70336bce11 fixed test environment setup 2016-12-07 12:23:56 +05:00
Umed Khudoiberdiev
92d37d39de fixed issue when sqllite database does not take in count foreign keys + fixed all tests for sqlite + moved logic of creation transaction during database drop to its method because its driver-specific (issue when sqlite needs to execute queries of disabling foreign key checks before transaction start) 2016-12-02 17:18:26 +05:00
Umed Khudoiberdiev
2ec59ec7cc renamed query builder methods, removed "ON", removed parameters from inner/left joins 2016-11-29 14:03:49 +05:00
Umed Khudoiberdiev
57e13f689b added strictness to methods in the repository and query builder - now if they are returning undefined method signature has undefined in returned value 2016-11-29 12:41:00 +05:00
Umed Khudoiberdiev
c93d77c36e fixes #58 2016-11-28 23:32:40 +05:00
Umed Khudoiberdiev
08d4183adb cleanup 2016-11-24 13:01:56 +05:00
Umed Khudoiberdiev
0b0dbdebcc fixed issue when entity without id is requested during persistment 2016-11-23 23:09:28 +05:00
Umed Khudoiberdiev
d8d5aaf3d4 bugfixes 2016-11-22 15:37:14 +05:00
Umed Khudoiberdiev
c7aa4468c1 more experiments over new persistent mechanizm 2016-11-19 10:38:27 +05:00
Umed Khudoiberdiev
c087004a29 ugly experiments over new persistent mechanizm 2016-11-01 17:01:32 +05:00
Umed Khudoiberdiev
a1ff1419de reverted test configuration changes 2016-10-09 23:15:54 +05:00
Yannis Güdel
42770ebe67 remove console.log 2016-10-03 22:13:18 +02:00
Umed Khudoiberdiev
d8a806df7e deprecated entityDirectories and other *Directories in favour of entities, names without Directories prefixes. entities from directories now can be mixed into same entities array 2016-09-15 00:39:51 +05:00
Umed Khudoiberdiev
1c7df8454e fixed bad transaction; added missing exports to main file; 2016-09-14 00:23:13 +05:00
Umed Khudoiberdiev
ae2a9ef8c2 added primary keys and indices generation to junction tables 2016-09-07 20:01:29 +05:00
Umed Khudoiberdiev
40040133f9 added basic support of connection pooling 2016-08-23 19:42:05 +05:00
Umed Khudoiberdiev
8ee51c9fa8 fixed tests; fixed issue with column name in joins in query builder; refactored connection and driver options 2016-08-06 23:18:13 +05:00
Umed Khudoiberdiev
dc976f4d27 refactored connection manager and connection option classes 2016-08-05 22:21:07 +05:00
Umed Khudoiberdiev
ef41b93647 migration to ts.2.0 2016-08-04 19:00:31 +05:00
Umed Khudoiberdiev
a8266f076c more experiments over postgres driver 2016-08-03 16:33:07 +05:00
Umed Khudoiberdiev
15ae3b189a more experiments over postgres driver 2016-08-02 16:30:04 +05:00
Umed Khudoiberdiev
e27eae8834 experiments over posgres driver 2016-08-02 00:31:13 +05:00
Umed Khudoiberdiev
80b0cf1f61 test coverage cleanup 2016-07-30 12:02:18 +05:00