198 Commits

Author SHA1 Message Date
Lucian Mocanu
c16ef63db7
chore: update dependencies (#11666) 2025-09-19 18:34:39 +02:00
dependabot[bot]
797a8f5e81
build(deps): bump brace-expansion in /sample/playground (#11522)
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 2.0.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-19 15:13:54 +02:00
dependabot[bot]
39ab7cce97
build(deps): bump sha.js from 2.4.11 to 2.4.12 in /sample/playground (#11617)
Bumps [sha.js](https://github.com/crypto-browserify/sha.js) from 2.4.11 to 2.4.12.
- [Changelog](https://github.com/browserify/sha.js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crypto-browserify/sha.js/compare/v2.4.11...v2.4.12)

---
updated-dependencies:
- dependency-name: sha.js
  dependency-version: 2.4.12
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-29 14:31:36 +03:00
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
ead4f98ee4
fix: improve async calls on disconnect (#11523) 2025-06-19 00:43:38 +02:00
Naor Peled
274bdf2e1a
feat: publish PR releases using pkg.pr.new 2025-05-02 23:09:42 +03: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
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
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
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
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
mptr
f6a3ce732d
feat: support for the latest mongodb v5 (#9925)
* fix: add support for mongodb driver v5

This new fix allow support to mongodb driver v5

Closes: #7907

* refactor: remove callback from MongoDriver connect

* fix: check for propertyName in transform

* fix: add support for mongodb driver v5

This new fix allow support to mongodb driver v5

Closes: #7907

* feat: mongodb 5.2.0 typings

* fix: instanceof ObjectId check

Instanceof check now no longer references to just the
type but the loaded class ref instead.

* test: fix test name to mongodb v5

---------

Co-authored-by: Matheus Melo Antiquera <matheusantiquera@finchsolucoes.com.br>
Co-authored-by: tgrassl <grassl.timon@gmail.com>
Co-authored-by: Matheus Melo Antiquera <matheus.melo.a@hotmail.com>
2023-04-15 13:30:01 +05:00
AlexMesser
62518ae122
feat: Cloud Spanner support (#8730)
* working on Cloud Spanner driver implementation

* working on DDL synchronization

* working on DDL synchronization

* fixed failing test

* working on VIEW implementation

* fixed query parameters

* lint

* added transaction support;
added streaming support;

* fixed column types

* fixes after merge

* prettier

* added support for generated columns

* added escaping for distinct alias

* working on generated columns

* changed failing test

* updated tests for Spanner;
bugfixes;

* updated tests for Spanner;
bugfixes;

* updated tests for Spanner;
bugfixes;

* fixed failing test

* fixed failing test

* fixing failing tests

* fixing failing tests

* fixing failing tests

* added support for typeorm-generated uuid;
fixed caching;

* fixing failing tests

* fixing failing tests

* fixing failing tests

* fixing failing tests

* fixing failing tests

* fixing failing tests

* debugging failing test

* debugging failing test

* fixed bug in @PrimaryColumn decorator

* fixed failing tests

* fixed VIEW functionality;
fixed failing tests;

* updated docs
2022-04-12 17:31:57 +05:00
Umed Khudoiberdiev
2205a1a6a5 remove globals usages 2022-04-02 21:40:13 +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
Bitcollage
5608956730
refactor: remove spaces for consistency (#8751) 2022-03-15 15:29:07 +05:00
spotykatch
93383bd2ee
feat: separate update events into update, soft-remove, and recover (#8403)
Closes: #8398

BREAKING CHANGE: update listeners and subscriber no longer triggered by soft-remove and recover
2022-02-15 18:05:05 +05:00
Umed Khudoiberdiev
c52ba29d94
chore: typescript version upgrade (#7422) 2021-02-25 19:57:14 +05:00
beqa7137
08cc076b1e
docs: update image.json (#6015)
I think that's a typo
2020-05-15 07:52:19 +03:00
Umed Khudoiberdiev
ec9034125d
feat: SAP Hana support (#5246)
* basic impl

* finished basic table metadata queries;

* implemented data types;

* working on data types;

* added test for column length;

* working on indices

* working on query runner

* working on schema builder

* removed SAP HANA client from dependencies

* fixed SAP uuid

* working on falling tests;

* working on falling tests;

* added docker configuration for sap hana

* simplifying sample entity

* implemented pool;

* trying to add SAP Hana to Circle CI

* trying to add SAP Hana to Circle CI

* trying to add SAP Hana to Circle CI

* testing CircleCI config

* testing CircleCI config

* added sap tests for ci

* changed sap port

* ci experiments

* ci experiments

* removing ci, adding docs

* removing ci

* minor fixes;

* fixed falling test;

Co-authored-by: AlexMesser <dmzt08@gmail.com>
2019-12-23 19:35:54 +05:00
Vitalii Zurian
3c3ec34f26 docs: array initializers should be avoided (#5233)
* Update Category.ts

Array initialisers should be avoided

* Update app.ts
2019-12-20 23:35:23 +05:00
Mike Guida
336bfb6f24 docs: clarify comments on many-to-many sample (#4912) 2019-10-18 13:37:18 +05:00
Zotov Dmitry
3bbd65cd00 working on tests;
bugfixes;
2019-02-13 23:23:04 +05:00
Vladimir Poluch
ebfbb009e2 fix(postgres,mysql): better support for enum and enum array 2019-01-13 16:08:46 +01:00
Umed Khudoiberdiev
1606ab8afb refactored entity schemas 2018-02-27 18:45:44 +05:00
Umed Khudoiberdiev
42d6c88031 added basic support for tree tables - closure tables, nested set, materialized path 2017-12-17 22:01:27 +05:00
Umed Khudoiberdiev
2a0ae48dac removed class table inheritance support 2017-12-07 15:58:28 +05:00
Umed Khudoiberdiev
843fbcc886 changed how cascades should be defined via relation options 2017-11-20 13:48:14 +05:00
Umed Khudoiberdiev
b0c37d67f4 refactoring persistence 2017-10-31 10:51:33 +05:00
Umed Khudoiberdiev
e834336730 fixed broken tests used deprecated removed methods 2017-09-27 12:12:42 +05:00
Umed Khudoiberdiev
a7f55ac8c2 added some decorator reference docs 2017-08-12 01:02:39 +05:00
Umed Khudoiberdiev
2f037e3af7 fixed tslint issues and monogdb issue 2017-08-01 17:30:13 +05:00
Zotov Dmitry
cd3efb406f removed generated and generationStrategy parameters from column options; 2017-08-01 13:33:15 +05:00
Umed Khudoiberdiev
77cc40bbe5 refactored connection and added docs about connection 2017-07-28 17:02:15 +05:00
Umed Khudoiberdiev
b2be4b4e5e added different logging strategies 2017-07-27 15:29:57 +05:00
Umed Khudoiberdiev
3ecd594b81 added different logging strategies 2017-07-26 21:25:46 +05:00
Umed Khudoiberdiev
03ceaeade0 fixes #694 - added tscompiler check for unused vars 2017-07-25 12:53:22 +05:00
Umed Khudoiberdiev
d7d91d503c fixing failing tests 2017-07-03 18:37:52 +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
580d70dcf2 fixed down migrations generation, changed migration interface signature 2017-06-20 13:25:17 +05:00
Umed Khudoiberdiev
5f403335d6 drivers refactoring; renamed mongoEntityManager to simply mongoManager 2017-06-19 11:30:35 +05:00
Umed Khudoiberdiev
e1c08a2410 fixes #537 and fixed issues with schema sync of "default" value 2017-06-16 19:29:00 +05:00
Umed Khudoiberdiev
f1c566f2ef refactored column types - now databases support their own column types individually 2017-06-15 11:46:42 +05:00
Umed Khudoiberdiev
34bbd9a3ad refactored connection options - created interface for each type of database driver (for future database-specific connection options). 2017-06-09 01:42:39 +05:00
Umed Khudoiberdiev
365055c6ff removed naming strategy stuff, refactoring connection 2017-06-08 14:51:38 +05:00
Umed Khudoiberdiev
20ebb08f2c trying to fix monogdb issues persisting single package 2017-05-20 11:21:42 +05:00
Umed Khudoiberdiev
4f31158576 added third custom repository support 2017-05-19 19:07:20 +05:00
Umed Khudoiberdiev
3baa57be3e refactored entity metadata and repositories - switched delegation process 2017-05-19 18:46:23 +05:00
Umed Khudoiberdiev
bababca2c0 renamed persist into save in manager and repository 2017-05-19 14:53:34 +05:00