Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate associations to TypeScript (#14280)
* 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