Skip to content

Commit

Permalink
refactor: migrate associations to TypeScript (#14280)
Browse files Browse the repository at this point in the history
* refactor: migrate associations to ts (wip)

* refactor: migrate has-one to ts

* refactor: migrate belongs-to association to TS

* refactor: fix typing errors in has-one, belongs-to

* refactor: migrate has-many to ts

* refactor: migrate has-many to ts

* refactor: finish migrating has-many.ts

* refactor: migrate association/index.ts

* refactor: continue association migration to ts

* build: accept @typeparam, @internal typedoc tags

* feat: improve typings of hasOne.set

* fix: make HasOneGetAssociationMixin's output nullable

* fix: improve typing of BelongsTo set method

* feat: update hasMany

* refactor: complete typing associations

* fix: fix failing tests

* refactor: migrate sequelize export to esm

* fix: fix associations based on unit tests

* fix: fix associations based on intergration tests

* test: add test to prevent duplicate associations aliases

* fix: fix Sequelize typings

* test: unify groupedLimit m-n test with the integration one

* feat: forbid instanciating Association/ManyAssociation

* docs: revert accidental comment removal

* fix: normalize includes before merging them

* fix: replace query generator trying to create a new association

* refactor: revert changes to reduce noise

* test: fix mssql query generator test

* feat: forbid users from instantiating association Classes

* fix: dedupe BelongsToMany association

* fix: use isSameModel to compare models

* feat: improve error message for 'this association was already created'

* fix: continue work to fix tests

* feat: fix associations based on unit tests

* refactor: migrate mixin.js to typescript

* refactor: rename 'mixin.ts' -> 'define-association-methods.ts'

* fix: fix accidental usage of _.eq instead of _.isEqual

* test: fix m:n tests

* refactor: move association definitions methods inside their classes

* refactor: continue refactoring associations

* feat: improve association deduplication

* fix: remove accidental export

* test: support 'cause' property when checking error message

* fix: normalize belongs to many opts, improve error msg

* feat: print error cause on systems without support

* test: fix belongs to many tests

* fix: continue fixing based on tests

* fix: normalize the right timestamps option

* feat: add Model.{getInitialModel,withoutScope}, rename schema+(un)?scope

* fix: add deprecation IDs

* feat: improve 'invalid scope' error message

* fix: new batch of fixes

* fix: make association.get return Map for multiple

* docs: remove todos

* fix: fix failing tests

* fix: rollback test update

* test: fix mariadb/mysql test

* test: fix test

* test: fix mysql8 test

* feat(types): strongly type association mixins

* test: migrate association.test to ts

* test: migrate belongs-to test

* feat(types): strongly type belongsToMany FKs

* test: test deep through options version

* test: test sourceKey/targetKey typing

* test: migrate has-one unit test to typescript

* test: migrate has-many unit tests to ts

* test: migrate belongs-to-many unit test to ts

* test: fix test

* test: fix support.js

* test: test two associations sharing the same pair

* docs: update tsdoc of associations

* feat: refactor associations to support 'inverse' option

* feat: remove onUpdate, onDelete, inverse.{onUpdate,onDelete}

They already exist as foreignKey.{onDelete,onUpdate}, otherkey.{onDelete,onUpdate}

* fix: make CASCADE default onDelete for non-null FKs

* refactor: normalize otherKey option

* feat: rename constraints, foreignKeyConstraint to foreignKeyConstraints

* fix: fix wrong scope option being passed to belongsTo

* feat: support 'inverse' in belongs-to

* feat: force all self-associations to be named

* fix: simplify the name of foreignKeys on through models

* fix: special case through models in order by

* test: fix tests

* test: fix broken test

* fix: fix sqlite treating allowNull undefined as false

* test: improve sql minifier

* feat: use through model name in groupedLimit through include

* refactor: remove unnecessary changes

* test: mute type error due to missing typing

* refactor: update comments

* refactor: update comment

* test: update unit tests

Co-authored-by: Fauzan "Evan Edrok" 0x <fncolon@pm.me>
Co-authored-by: Rik Smale <13023439+WikiRik@users.noreply.github.com>
  • Loading branch information
3 people committed May 23, 2022
1 parent f859326 commit 428a85b
Show file tree
Hide file tree
Showing 95 changed files with 7,943 additions and 6,762 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"semver": "^7.3.5",
"sequelize-pool": "^7.1.0",
"toposort-class": "^1.0.1",
"type-fest": "^2.12.2",
"uuid": "^8.3.2",
"validator": "^13.7.0",
"wkx": "^0.5.0"
Expand Down
110 changes: 0 additions & 110 deletions src/associations/base.d.ts

This file was deleted.

140 changes: 0 additions & 140 deletions src/associations/base.js

This file was deleted.

0 comments on commit 428a85b

Please sign in to comment.