Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency typeorm to v0.3.17 #976

Closed
wants to merge 1 commit into from
Closed

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Mar 31, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
typeorm (source) 0.2.41 -> 0.3.17 age adoption passing confidence

Release Notes

typeorm/typeorm (typeorm)

v0.3.17

Compare Source

Bug Fixes

v0.3.16

Compare Source

Bug Fixes
Features
Reverts

v0.3.15

Compare Source

Bug Fixes
  • make cache optional fields optional (#​9942) (159c60a)
  • prevent unique index identical to primary key (all sql dialects) (#​9940) (51eecc2)
  • SelectQueryBuilder builds incorrectly escaped alias in Oracle when used on entity with composite key (#​9668) (83c6c0e)
Features

v0.3.14

Compare Source

Bug Fixes
  • drop xml & yml connection option support. Addresses security issues in underlying dependency (#​9930) (7dac12c)
Features

v0.3.13

Compare Source

Bug Fixes
Features

v0.3.12

Compare Source

Bug Fixes
Features

v0.3.11

Compare Source

Fixes
Features

v0.3.10

Compare Source

Bug Fixes
Features

v0.3.9

Compare Source

v0.3.8

Compare Source

Bug Fixes
Features

v0.3.7

Compare Source

Bug Fixes
Features
Performance Improvements

v0.3.6

Compare Source

Features

v0.3.5

Compare Source

Bug Fixes

v0.3.4

Compare Source

Bug Fixes
Features

v0.3.3

Compare Source

Bug Fixes
  • improve initialization of custom repository (#​8782) (52a641c)
  • resolve entities correctly in datasource when globs are specified (#​8778) (a641c5d)
Features

v0.3.2

Compare Source

Bug Fixes
Features
Reverts

v0.3.1

Compare Source

Bug Fixes

v0.3.0

Compare Source

Changes in the version includes changes from the next branch and typeorm@next version.
They were pending their migration from 2018. Finally, they are in the master branch and master version.

Features
  • compilation target now is es2020. This requires Node.JS version 14+

  • TypeORM now properly works when installed within different node_modules contexts
    (often happen if TypeORM is a dependency of another library or TypeORM is heavily used in monorepo projects)

  • Connection was renamed to DataSource.
    Old Connection is still there, but now it's deprecated. It will be completely removed in next version.
    New API:

export const dataSource = new DataSource({
    // ... options ...
})

// load entities, establish db connection, sync schema, etc.
await dataSource.connect()

Previously, you could use new Connection(), createConnection(), getConnectionManager().create(), etc.
They all deprecated in favour of new syntax you can see above.

New way gives you more flexibility and simplicity in usage.

  • new custom repositories syntax:
export const UserRepository = myDataSource.getRepository(UserEntity).extend({
    findUsersWithPhotos() {
        return this.find({
            relations: {
                photos: true
            }
        })
    }
})

Old ways of custom repository creation were dropped.

  • added new option on relation load strategy called relationLoadStrategy.
    Relation load strategy is used on entity load and determines how relations must be loaded when you query entities and their relations from the database.
    Used on find* methods and QueryBuilder. Value can be set to join or query.

    • join - loads relations using SQL JOIN expression
    • query - executes separate SQL queries for each relation

Default is join, but default can be set in ConnectionOptions:

createConnection({
    /* ... */
    relationLoadStrategy: "query"
})

Also, it can be set per-query in find* methods:

userRepository.find({
    relations: {
        photos: true
    }
})

And QueryBuilder:

userRepository
    .createQueryBuilder()
    .setRelationLoadStrategy("query")

For queries returning big amount of data, we recommend to use query strategy,
because it can be a more performant approach to query relations.

  • added new findOneBy, findOneByOrFail, findBy, countBy, findAndCountBy methods to BaseEntity, EntityManager and Repository:
const users = await userRepository.findBy({
    name: "Michael"
})

Overall find* and count* method signatures where changed, read the "breaking changes" section for more info.

  • new select type signature in FindOptions (used in find* methods):
userRepository.find({
    select: {
        id: true,
        firstName: true,
        lastName: true,
    }
})

Also, now it's possible to specify select columns of the loaded relations:

userRepository.find({
    select: {
        id: true,
        firstName: true,
        lastName: true,
        photo: {
            id: true,
            filename: true,
            album: {
                id: true,
                name: true,
            }
        }
    }
})
  • new relations type signature in FindOptions (used in find* methods):
userRepository.find({
    relations: {
        contacts: true,
        photos: true,
    }
})

To load nested relations use a following signature:

userRepository.find({
    relations: {
        contacts: true,
        photos: {
            album: true,
        },
    }
})
  • new order type signature in FindOptions (used in find* methods):
userRepository.find({
    order: {
        id: "ASC"
    }
})

Now supports nested order by-s:

userRepository.find({
    order: {
        photos: {
            album: {
                name: "ASC"
            },
        },
    }
})
  • new where type signature in FindOptions (used in find* methods) now allows to build nested statements with conditional relations, for example:
userRepository.find({
    where: {
        photos: {
            album: {
                name: "profile"
            }
        }
    }
})

Gives you users who have photos in their "profile" album.

  • FindOperator-s can be applied for relations in where statement, for example:
userRepository.find({
    where: {
        photos: MoreThan(10),
    }
})

Gives you users with more than 10 photos.

  • boolean can be applied for relations in where statement, for example:
userRepository.find({
    where: {
        photos: true
    }
})
BREAKING CHANGES
  • minimal Node.JS version requirement now is 14+

  • drop ormconfig support. ormconfig still works if you use deprecated methods,
    however we do not recommend using it anymore, because it's support will be completely dropped in 0.4.0.
    If you want to have your connection options defined in a separate file, you can still do it like this:

import ormconfig from "./ormconfig.json"

const MyDataSource = new DataSource(require("./ormconfig.json"))

Or even more type-safe approach with resolveJsonModule in tsconfig.json enabled:

import ormconfig from "./ormconfig.json"

const MyDataSource = new DataSource(ormconfig)

But we do not recommend use this practice, because from 0.4.0 you'll only be able to specify entities / subscribers / migrations using direct references to entity classes / schemas (see "deprecations" section).

We won't be supporting all ormconfig extensions (e.g. json, js, ts, yaml, xml, env).

  • support for previously deprecated migrations:* commands was removed. Use migration:* commands instead.

  • all commands were re-worked. Please refer to new CLI documentation.

  • cli option from BaseConnectionOptions (now BaseDataSourceOptions options) was removed (since CLI commands were re-worked).

  • now migrations are running before schema synchronization if you have both pending migrations and schema synchronization pending
    (it works if you have both migrationsRun and synchronize enabled in connection options).

  • aurora-data-api driver now is called aurora-mysql

  • aurora-data-api-pg driver now is called aurora-postgres

  • EntityManager.connection is now EntityManager.dataSource

  • Repository now has a constructor (breaks classes extending Repository with custom constructor)

  • @TransactionRepository, @TransactionManager, @Transaction decorators were completely removed. These decorators do the things out of the TypeORM scope.

  • Only junction table names shortened.

MOTIVATION: We must shorten only table names generated by TypeORM.
It's user responsibility to name tables short if their RDBMS limit table name length
since it won't make sense to have table names as random hashes.
It's really better if user specify custom table name into @Entity decorator.
Also, for junction table it's possible to set a custom name using @JoinTable decorator.

  • findOne() signature without parameters was dropped.
    If you need a single row from the db you can use a following syntax:
const [user] = await userRepository.find()

This change was made to prevent user confusion.
See this issue for details.

  • findOne(id) signature was dropped. Use following syntax instead:
const user = await userRepository.findOneBy({
    id: id // where id is your column name
})

This change was made to provide a more type-safe approach for data querying.
Due to this change you might need to refactor the way you load entities using MongoDB driver.

  • findOne, findOneOrFail, find, count, findAndCount methods now only accept FindOptions as parameter,

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@codecov
Copy link

codecov bot commented Mar 31, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (7018c8f) 21.71% compared to head (a25942f) 21.71%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #976   +/-   ##
=======================================
  Coverage   21.71%   21.71%           
=======================================
  Files          14       14           
  Lines         175      175           
  Branches       24       24           
=======================================
  Hits           38       38           
  Misses        116      116           
  Partials       21       21           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@renovate renovate bot force-pushed the renovate/typeorm-0.x branch 12 times, most recently from e80f834 to 6da5ce7 Compare April 6, 2023 11:45
@renovate renovate bot changed the title Update dependency typeorm to v0.3.12 Update dependency typeorm to v0.3.13 Apr 6, 2023
@renovate renovate bot changed the title Update dependency typeorm to v0.3.13 Update dependency typeorm to v0.3.14 Apr 9, 2023
@renovate renovate bot force-pushed the renovate/typeorm-0.x branch 3 times, most recently from 5680a85 to e39a561 Compare April 15, 2023 15:33
@renovate renovate bot changed the title Update dependency typeorm to v0.3.14 Update dependency typeorm to v0.3.15 Apr 15, 2023
@renovate renovate bot changed the title Update dependency typeorm to v0.3.15 Update dependency typeorm to v0.3.16 May 9, 2023
@renovate renovate bot force-pushed the renovate/typeorm-0.x branch 5 times, most recently from 822c807 to c4836c9 Compare May 28, 2023 20:41
@renovate renovate bot changed the title Update dependency typeorm to v0.3.16 Update dependency typeorm to v0.3.17 Jun 20, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jun 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@renovate
Copy link
Contributor Author

renovate bot commented Aug 1, 2023

⚠ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: supermarket-api/package-lock.json
/usr/local/bin/docker: line 4: .: filename argument required
.: usage: . filename [arguments]
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/mongodb
npm ERR!   mongodb@"^4.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional mongodb@"^5.2.0" from [email protected]
npm ERR! node_modules/typeorm
npm ERR!   typeorm@"0.3.17" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/mongodb
npm ERR!   peerOptional mongodb@"^5.2.0" from [email protected]
npm ERR!   node_modules/typeorm
npm ERR!     typeorm@"0.3.17" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /tmp/worker/49937f/e25c56/cache/others/npm/_logs/2023-08-04T10_38_19_255Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /tmp/worker/49937f/e25c56/cache/others/npm/_logs/2023-08-04T10_38_19_255Z-debug-0.log

@renovate renovate bot force-pushed the renovate/typeorm-0.x branch 3 times, most recently from 7eec9bc to 446aaf9 Compare August 2, 2023 07:37
@sonarcloud
Copy link

sonarcloud bot commented Aug 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@oscrx oscrx deleted the branch master August 4, 2023 10:36
@oscrx oscrx closed this Aug 4, 2023
@oscrx oscrx deleted the renovate/typeorm-0.x branch August 4, 2023 10:39
@renovate
Copy link
Contributor Author

renovate bot commented Aug 4, 2023

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update (0.3.17). You will get a PR once a newer version is released. To ignore this dependency forever, add it to the ignoreDeps array of your Renovate config.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant