From be4b797900e0d454dc0d3a7217b53ee8322e01a5 Mon Sep 17 00:00:00 2001 From: Lukas Hroch Date: Thu, 13 Oct 2022 10:31:31 +0100 Subject: [PATCH 1/2] fix(ci): update md linter - fix dead links - re-lint --- README.md | 292 +++++++++++++++++++++++++--------------------- package-lock.json | 268 ++++++++++++++++++++---------------------- package.json | 2 +- 3 files changed, 286 insertions(+), 276 deletions(-) diff --git a/README.md b/README.md index cec531bb..89c36674 100644 --- a/README.md +++ b/README.md @@ -3,38 +3,60 @@ [![Build Status](https://github.com/RobinBuschmann/sequelize-typescript/workflows/Node.js%20CI/badge.svg)](https://github.com/RobinBuschmann/sequelize-typescript/actions?query=workflow%3A%22Node.js+CI%22) [![codecov](https://codecov.io/gh/RobinBuschmann/sequelize-typescript/branch/master/graph/badge.svg)](https://codecov.io/gh/RobinBuschmann/sequelize-typescript) [![NPM](https://img.shields.io/npm/v/sequelize-typescript.svg)](https://www.npmjs.com/package/sequelize-typescript) -[![Dependency Status](https://img.shields.io/david/RobinBuschmann/sequelize-typescript.svg)](https://www.npmjs.com/package/sequelize-typescript) Decorators and some other features for sequelize (v6). -- [Installation](#installation) -- [Model Definition](#model-definition) - - [`@Table` API](#table-api) - - [`@Column` API](#column-api) -- [Usage](#usage) - - [Configuration](#configuration) - - [globs](#globs) - - [Model-path resolving](#model-path-resolving) -- [Model association](#model-association) - - [One-to-many](#one-to-many) - - [Many-to-many](#many-to-many) - - [One-to-one](#one-to-one) - - [`@ForeignKey`, `@BelongsTo`, `@HasMany`, `@HasOne`, `@BelongsToMany` API](#foreignkey-belongsto-hasmany-hasone-belongstomany-api) - - [Generated getter and setter](#type-safe-usage-of-auto-generated-functions) - - [Multiple relations of same models](#multiple-relations-of-same-models) -- [Indexes](#indexes) - - [`@Index` API](#index) - - [`createIndexDecorator()` API](#createindexdecorator) -- [Repository mode](#repository-mode) - - [How to enable repository mode?](#how-to-enable-repository-mode) - - [How to use repository mode?](#how-to-use-repository-mode) - - [How to use associations with repository mode?](#how-to-use-associations-with-repository-mode) - - [Limitations of repository mode](#limitations-of-repository-mode) -- [Model validation](#model-validation) -- [Scopes](#scopes) -- [Hooks](#hooks) -- [Why `() => Model`?](#user-content-why---model) -- [Recommendations and limitations](#recommendations-and-limitations) +- [sequelize-typescript](#sequelize-typescript) + - [Installation](#installation) + - [Sequelize Options](#sequelize-options) + - [Scopes Options](#scopes-options) + - [Model definition](#model-definition) + - [Less strict](#less-strict) + - [More strict](#more-strict) + - [`@Table`](#table) + - [Table API](#table-api) + - [Primary key](#primary-key) + - [`@CreatedAt`, `@UpdatedAt`, `@DeletedAt`](#createdat-updatedat-deletedat) + - [`@Column`](#column) + - [Column API](#column-api) + - [_Shortcuts_](#shortcuts) + - [Type inference](#type-inference) + - [Accessors](#accessors) + - [Usage](#usage) + - [Configuration](#configuration) + - [globs](#globs) + - [Model-path resolving](#model-path-resolving) + - [Build and create](#build-and-create) + - [Find and update](#find-and-update) + - [Model association](#model-association) + - [One-to-many](#one-to-many) + - [Many-to-many](#many-to-many) + - [Type safe _through_-table instance access](#type-safe-through-table-instance-access) + - [One-to-one](#one-to-one) + - [`@ForeignKey`, `@BelongsTo`, `@HasMany`, `@HasOne`, `@BelongsToMany` API](#foreignkey-belongsto-hasmany-hasone-belongstomany-api) + - [Multiple relations of same models](#multiple-relations-of-same-models) + - [Type safe usage of auto generated functions](#type-safe-usage-of-auto-generated-functions) + - [Indexes](#indexes) + - [`@Index`](#index) + - [Index API](#index-api) + - [`createIndexDecorator()`](#createindexdecorator) + - [Repository mode](#repository-mode) + - [How to enable repository mode?](#how-to-enable-repository-mode) + - [How to use repository mode?](#how-to-use-repository-mode) + - [How to use associations with repository mode?](#how-to-use-associations-with-repository-mode) + - [Limitations of repository mode](#limitations-of-repository-mode) + - [Model validation](#model-validation) + - [Exceptions](#exceptions) + - [Example](#example) + - [Scopes](#scopes) + - [`@DefaultScope` and `@Scopes`](#defaultscope-and-scopes) + - [Hooks](#hooks) + - [Why `() => Model`?](#why---model) + - [Recommendations and limitations](#recommendations-and-limitations) + - [One Sequelize instance per model (without repository mode)](#one-sequelize-instance-per-model-without-repository-mode) + - [One model class per file](#one-model-class-per-file) + - [Minification](#minification) + - [Contributing](#contributing) ## Installation @@ -79,25 +101,25 @@ instead of deprecated way: ## Model definition ```typescript -import { Table, Column, Model, HasMany } from 'sequelize-typescript' +import { Table, Column, Model, HasMany } from 'sequelize-typescript'; @Table class Person extends Model { @Column - name: string + name: string; @Column - birthday: Date + birthday: Date; @HasMany(() => Hobby) - hobbies: Hobby[] + hobbies: Hobby[]; } ``` ### Less strict ```typescript -import { Table, Model } from 'sequelize-typescript' +import { Table, Model } from 'sequelize-typescript'; @Table class Person extends Model {} @@ -106,12 +128,12 @@ class Person extends Model {} ### More strict ```typescript -import { Optional } from 'sequelize' -import { Table, Model } from 'sequelize-typescript' +import { Optional } from 'sequelize'; +import { Table, Model } from 'sequelize-typescript'; interface PersonAttributes { - id: number - name: string + id: number; + name: string; } interface PersonCreationAttributes extends Optional {} @@ -250,11 +272,11 @@ Get/set accessors do work as well class Person extends Model { @Column get name(): string { - return 'My name is ' + this.getDataValue('name') + return 'My name is ' + this.getDataValue('name'); } set name(value: string) { - this.setDataValue('name', value) + this.setDataValue('name', value); } } ``` @@ -269,7 +291,7 @@ Except for minor variations _sequelize-typescript_ will work like pure sequelize To make the defined models available, you have to configure a `Sequelize` instance from `sequelize-typescript`(!). ```typescript -import { Sequelize } from 'sequelize-typescript' +import { Sequelize } from 'sequelize-typescript'; const sequelize = new Sequelize({ database: 'some_db', @@ -277,8 +299,8 @@ const sequelize = new Sequelize({ username: 'root', password: '', storage: ':memory:', - models: [__dirname + '/models'] // or [Player, Team], -}) + models: [__dirname + '/models'], // or [Player, Team], +}); ``` Before you can use your models you have to tell sequelize where they can be found. So either set `models` in the @@ -286,8 +308,8 @@ sequelize config or add the required models later on by calling `sequelize.addMo `sequelize.addModels([__dirname + '/models'])`: ```typescript -sequelize.addModels([Person]) -sequelize.addModels(['path/to/models']) +sequelize.addModels([Person]); +sequelize.addModels(['path/to/models']); ``` ### globs @@ -371,17 +393,17 @@ export default class User extends Model {} Instantiation and inserts can be achieved in the good old sequelize way ```typescript -const person = Person.build({ name: 'bob', age: 99 }) -person.save() +const person = Person.build({ name: 'bob', age: 99 }); +person.save(); -Person.create({ name: 'bob', age: 99 }) +Person.create({ name: 'bob', age: 99 }); ``` but _sequelize-typescript_ also makes it possible to create instances with `new`: ```typescript -const person = new Person({ name: 'bob', age: 99 }) -person.save() +const person = new Person({ name: 'bob', age: 99 }); +person.save(); ``` ### Find and update @@ -391,16 +413,16 @@ Finding and updating entries does also work like using native sequelize. So see ```typescript Person.findOne().then((person) => { - person.age = 100 - return person.save() -}) + person.age = 100; + return person.save(); +}); Person.update( { - name: 'bobby' + name: 'bobby', }, { where: { id: 1 } } -).then(() => {}) +).then(() => {}); ``` ## Model association @@ -414,26 +436,26 @@ and `@ForeignKey` annotations. @Table class Player extends Model { @Column - name: string + name: string; @Column - num: number + num: number; @ForeignKey(() => Team) @Column - teamId: number + teamId: number; @BelongsTo(() => Team) - team: Team + team: Team; } @Table class Team extends Model { @Column - name: string + name: string; @HasMany(() => Player) - players: Player[] + players: Player[]; } ``` @@ -441,8 +463,8 @@ That's all, _sequelize-typescript_ does everything else for you. So when retriev ```typescript Team.findOne({ include: [Player] }).then((team) => { - team.players.forEach((player) => console.log(`Player ${player.name}`)) -}) + team.players.forEach((player) => console.log(`Player ${player.name}`)); +}); ``` the players will also be resolved (when passing `include: Player` to the find options) @@ -453,24 +475,24 @@ the players will also be resolved (when passing `include: Player` to the find op @Table class Book extends Model { @BelongsToMany(() => Author, () => BookAuthor) - authors: Author[] + authors: Author[]; } @Table class Author extends Model { @BelongsToMany(() => Book, () => BookAuthor) - books: Book[] + books: Book[]; } @Table class BookAuthor extends Model { @ForeignKey(() => Book) @Column - bookId: number + bookId: number; @ForeignKey(() => Author) @Column - authorId: number + authorId: number; } ``` @@ -521,26 +543,26 @@ So if you define a model with multiple relations like class Book extends Model { @ForeignKey(() => Person) @Column - authorId: number + authorId: number; @BelongsTo(() => Person) - author: Person + author: Person; @ForeignKey(() => Person) @Column - proofreaderId: number + proofreaderId: number; @BelongsTo(() => Person) - proofreader: Person + proofreader: Person; } @Table class Person extends Model { @HasMany(() => Book) - writtenBooks: Book[] + writtenBooks: Book[]; @HasMany(() => Book) - proofedBooks: Book[] + proofedBooks: Book[]; } ``` @@ -577,32 +599,32 @@ functions. @Table class ModelA extends Model { @HasMany(() => ModelB) - bs: ModelB[] + bs: ModelB[]; } @Table class ModelB extends Model { @BelongsTo(() => ModelA) - a: ModelA + a: ModelA; } ``` To use them, pass the property key of the respective relation as the first parameter: ```typescript -const modelA = new ModelA() +const modelA = new ModelA(); modelA .$set('bs', [ /* instance */ ]) - .then(/* ... */) -modelA.$add('b' /* instance */).then(/* ... */) -modelA.$get('bs').then(/* ... */) -modelA.$count('bs').then(/* ... */) -modelA.$has('bs').then(/* ... */) -modelA.$remove('bs' /* instance */).then(/* ... */) -modelA.$create('bs' /* value */).then(/* ... */) + .then(/* ... */); +modelA.$add('b' /* instance */).then(/* ... */); +modelA.$get('bs').then(/* ... */); +modelA.$count('bs').then(/* ... */); +modelA.$has('bs').then(/* ... */); +modelA.$remove('bs' /* instance */).then(/* ... */); +modelA.$create('bs' /* value */).then(/* ... */); ``` ## Indexes @@ -616,11 +638,11 @@ The `@Index` annotation can be used without passing any parameters. class Person extends Model { @Index // Define an index with default name @Column - name: string + name: string; @Index // Define another index @Column - birthday: Date + birthday: Date; } ``` @@ -632,11 +654,11 @@ an object literal (see [indexes define option](https://sequelize.org/v5/manual/m class Person extends Model { @Index('my-index') // Define a multi-field index on name and birthday @Column - name: string + name: string; @Index('my-index') // Add birthday as the second field to my-index @Column - birthday: Date + birthday: Date; @Index({ // index options @@ -652,13 +674,13 @@ class Person extends Model { // index field options length: 10, order: 'ASC', - collate: 'NOCASE' + collate: 'NOCASE', }) @Column - jobTitle: string + jobTitle: string; @Column - isEmployee: boolean + isEmployee: boolean; } ``` @@ -675,7 +697,7 @@ class Person extends Model { The `createIndexDecorator()` function can be used to create a decorator for an index with options specified with an object literal supplied as the argument. Fields are added to the index by decorating properties. ```typescript -const SomeIndex = createIndexDecorator() +const SomeIndex = createIndexDecorator(); const JobIndex = createIndexDecorator({ // index options name: 'job-index', @@ -686,36 +708,36 @@ const JobIndex = createIndexDecorator({ concurrently: true, using: 'BTREE', operator: 'text_pattern_ops', - prefix: 'test-' -}) + prefix: 'test-', +}); @Table class Person extends Model { @SomeIndex // Add name to SomeIndex @Column - name: string + name: string; @SomeIndex // Add birthday to SomeIndex @Column - birthday: Date + birthday: Date; @JobIndex({ // index field options length: 10, order: 'ASC', - collate: 'NOCASE' + collate: 'NOCASE', }) @Column - jobTitle: string + jobTitle: string; @Column - isEmployee: boolean + isEmployee: boolean; } ``` ## Repository mode -With `sequelize-typescript@1` comes a repository mode. See [docs](#repository-mode-1) for details. +With `sequelize-typescript@1` comes a repository mode. See [docs](#repository-mode) for details. The repository mode makes it possible to separate static operations like `find`, `create`, ... from model definitions. It also empowers models so that they can be used with multiple sequelize instances. @@ -736,10 +758,10 @@ const sequelize = new Sequelize({ Retrieve repository to create instances or perform search operations: ```typescript -const userRepository = sequelize.getRepository(User) +const userRepository = sequelize.getRepository(User); -const luke = await userRepository.create({ name: 'Luke Skywalker' }) -const luke = await userRepository.findOne({ where: { name: 'luke' } }) +const luke = await userRepository.create({ name: 'Luke Skywalker' }); +const luke = await userRepository.findOne({ where: { name: 'luke' } }); ``` ### How to use associations with repository mode? @@ -747,11 +769,11 @@ const luke = await userRepository.findOne({ where: { name: 'luke' } }) For now one need to use the repositories within the include options in order to retrieve or create related data: ```typescript -const userRepository = sequelize.getRepository(User) -const addressRepository = sequelize.getRepository(Address) +const userRepository = sequelize.getRepository(User); +const addressRepository = sequelize.getRepository(Address); -userRepository.find({ include: [addressRepository] }) -userRepository.create({ name: 'Bear' }, { include: [addressRepository] }) +userRepository.find({ include: [addressRepository] }); +userRepository.create({ name: 'Bear' }, { include: [addressRepository] }); ``` > ⚠️ This will change in the future: One will be able to refer the model classes instead of the repositories. @@ -764,12 +786,12 @@ Nested scopes and includes in general won't work when using `@Scope` annotation @Scopes(() => ({ // includes withAddress: { - include: [() => Address] + include: [() => Address], }, // nested scopes withAddressIncludingLatLng: { - include: [() => Address.scope('withLatLng')] - } + include: [() => Address.scope('withLatLng')], + }, })) @Table class User extends Model {} @@ -799,55 +821,55 @@ The following validators cannot simply be translated from sequelize validator to ### Example ```typescript -const HEX_REGEX = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ +const HEX_REGEX = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/; @Table export class Shoe extends Model { @IsUUID(4) @PrimaryKey @Column - id: string + id: string; @Equals('lala') @Column - readonly key: string + readonly key: string; @Contains('Special') @Column - special: string + special: string; @Length({ min: 3, max: 15 }) @Column - brand: string + brand: string; @IsUrl @Column - brandUrl: string + brandUrl: string; @Is('HexColor', (value) => { if (!HEX_REGEX.test(value)) { - throw new Error(`"${value}" is not a hex color value.`) + throw new Error(`"${value}" is not a hex color value.`); } }) @Column - primaryColor: string + primaryColor: string; @Is(function hexColor(value: string): void { if (!HEX_REGEX.test(value)) { - throw new Error(`"${value}" is not a hex color value.`) + throw new Error(`"${value}" is not a hex color value.`); } }) @Column - secondaryColor: string + secondaryColor: string; @Is(HEX_REGEX) @Column - tertiaryColor: string + tertiaryColor: string; @IsDate @IsBefore('2017-02-27') @Column - producedAt: Date + producedAt: Date; } ``` @@ -860,36 +882,36 @@ sequelize (See sequelize [docs](https://sequelize.org/master/manual/scopes.html) ```typescript @DefaultScope(() => ({ - attributes: ['id', 'primaryColor', 'secondaryColor', 'producedAt'] + attributes: ['id', 'primaryColor', 'secondaryColor', 'producedAt'], })) @Scopes(() => ({ full: { - include: [Manufacturer] + include: [Manufacturer], }, yellow: { - where: { primaryColor: 'yellow' } - } + where: { primaryColor: 'yellow' }, + }, })) @Table export class ShoeWithScopes extends Model { @Column - readonly secretKey: string + readonly secretKey: string; @Column - primaryColor: string + primaryColor: string; @Column - secondaryColor: string + secondaryColor: string; @Column - producedAt: Date + producedAt: Date; @ForeignKey(() => Manufacturer) @Column - manufacturerId: number + manufacturerId: number; @BelongsTo(() => Manufacturer) - manufacturer: Manufacturer + manufacturer: Manufacturer; } ``` @@ -905,19 +927,19 @@ The name of the method cannot be the same as the name of the hook (for example, @Table export class Person extends Model { @Column - name: string + name: string; @BeforeUpdate @BeforeCreate static makeUpperCase(instance: Person) { // this will be called when an instance is created or updated - instance.name = instance.name.toLocaleUpperCase() + instance.name = instance.name.toLocaleUpperCase(); } @BeforeCreate static addUnicorn(instance: Person) { // this will also be called when an instance is created - instance.name += ' 🦄' + instance.name += ' 🦄'; } } ``` @@ -933,7 +955,7 @@ this issue. ### One Sequelize instance per model (without repository mode) -Unless you are using the [repository mode](#repository-mode-1), you won't be able to add one and the same model to multiple +Unless you are using the [repository mode](#repository-mode), you won't be able to add one and the same model to multiple Sequelize instances with differently configured connections. So that one model will only work for one connection. ### One model class per file diff --git a/package-lock.json b/package-lock.json index 7dcad03f..c6916bde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "has-flag": "5.0.1", "husky": "8.0.1", "lodash": "4.17.21", - "markdownlint-cli": "0.31.1", + "markdownlint-cli": "0.32.2", "mocha": "9.2.2", "moment": "2.29.4", "mysql2": "2.3.3", @@ -2803,9 +2803,9 @@ } }, "node_modules/commander": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.0.0.tgz", - "integrity": "sha512-JJfP2saEKbQqvW+FI93OYUB4ByV5cizMpFMiiJI8xDbBvQvSkIk0VvQdn1CZ8mqAO8Loq2h0gYTYtDFUZUeERw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", + "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==", "dev": true, "engines": { "node": "^12.20.0 || >=14" @@ -3687,10 +3687,13 @@ } }, "node_modules/entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", + "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", "dev": true, + "engines": { + "node": ">=0.12" + }, "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } @@ -6403,9 +6406,9 @@ } }, "node_modules/jsonc-parser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", - "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.1.0.tgz", + "integrity": "sha512-DRf0QjnNeCUds3xTjKlQQ3DpJD51GvDjJfnxUVWg6PZTo2otSm+slzNAxU/35hF8/oJIKoG9slq30JYOsF2azg==", "dev": true }, "node_modules/jsonfile": { @@ -6504,9 +6507,9 @@ "dev": true }, "node_modules/linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", + "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", "dev": true, "dependencies": { "uc.micro": "^1.0.1" @@ -6741,14 +6744,14 @@ } }, "node_modules/markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz", + "integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==", "dev": true, "dependencies": { "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", + "entities": "~3.0.1", + "linkify-it": "^4.0.1", "mdurl": "^1.0.1", "uc.micro": "^1.0.5" }, @@ -6763,39 +6766,39 @@ "dev": true }, "node_modules/markdownlint": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.25.1.tgz", - "integrity": "sha512-AG7UkLzNa1fxiOv5B+owPsPhtM4D6DoODhsJgiaNg1xowXovrYgOnLqAgOOFQpWOlHFVQUzjMY5ypNNTeov92g==", + "version": "0.26.2", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.26.2.tgz", + "integrity": "sha512-2Am42YX2Ex5SQhRq35HxYWDfz1NLEOZWWN25nqd2h3AHRKsGRE+Qg1gt1++exW792eXTrR4jCNHfShfWk9Nz8w==", "dev": true, "dependencies": { - "markdown-it": "12.3.2" + "markdown-it": "13.0.1" }, "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/markdownlint-cli": { - "version": "0.31.1", - "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.31.1.tgz", - "integrity": "sha512-keIOMwQn+Ch7MoBwA+TdkyVMuxAeZFEGmIIlvwgV0Z1TGS5MxPnRr29XCLhkNzCHU+uNKGjU+VEjLX+Z9kli6g==", + "version": "0.32.2", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.32.2.tgz", + "integrity": "sha512-xmJT1rGueUgT4yGNwk6D0oqQr90UJ7nMyakXtqjgswAkEhYYqjHew9RY8wDbOmh2R270IWjuKSeZzHDEGPAUkQ==", "dev": true, "dependencies": { - "commander": "~9.0.0", + "commander": "~9.4.0", "get-stdin": "~9.0.0", - "glob": "~7.2.0", + "glob": "~8.0.3", "ignore": "~5.2.0", "js-yaml": "^4.1.0", - "jsonc-parser": "~3.0.0", - "markdownlint": "~0.25.1", - "markdownlint-rule-helpers": "~0.16.0", - "minimatch": "~3.0.5", - "run-con": "~1.2.10" + "jsonc-parser": "~3.1.0", + "markdownlint": "~0.26.2", + "markdownlint-rule-helpers": "~0.17.2", + "minimatch": "~5.1.0", + "run-con": "~1.2.11" }, "bin": { "markdownlint": "markdownlint.js" }, "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/markdownlint-cli/node_modules/argparse": { @@ -6804,36 +6807,13 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/markdownlint-cli/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/markdownlint-cli/node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/markdownlint-cli/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" + "balanced-match": "^1.0.0" } }, "node_modules/markdownlint-cli/node_modules/js-yaml": { @@ -6848,16 +6828,31 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/markdownlint-cli/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/markdownlint-rule-helpers": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.16.0.tgz", - "integrity": "sha512-oEacRUVeTJ5D5hW1UYd2qExYI0oELdYK72k1TKGvIeYJIbqQWAz476NAc7LNixSySUhcNl++d02DvX0ccDk9/w==", - "dev": true + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.17.2.tgz", + "integrity": "sha512-XaeoW2NYSlWxMCZM2B3H7YTG6nlaLfkEZWMBhr4hSPlq9MuY2sy83+Xr89jXOqZMZYjvi5nBCGoFh7hHoPKZmA==", + "dev": true, + "engines": { + "node": ">=12" + } }, "node_modules/mdurl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "dev": true }, "node_modules/meow": { @@ -9611,14 +9606,14 @@ } }, "node_modules/run-con": { - "version": "1.2.10", - "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.10.tgz", - "integrity": "sha512-n7PZpYmMM26ZO21dd8y3Yw1TRtGABjRtgPSgFS/nhzfvbJMXFtJhJVyEgayMiP+w/23craJjsnfDvx4W4ue/HQ==", + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.11.tgz", + "integrity": "sha512-NEMGsUT+cglWkzEr4IFK21P4Jca45HqiAbIIZIBdX5+UZTB24Mb/21iNGgz9xZa8tL6vbW7CXmq7MFN42+VjNQ==", "dev": true, "dependencies": { "deep-extend": "^0.6.0", - "ini": "~2.0.0", - "minimist": "^1.2.5", + "ini": "~3.0.0", + "minimist": "^1.2.6", "strip-json-comments": "~3.1.1" }, "bin": { @@ -9626,12 +9621,12 @@ } }, "node_modules/run-con/node_modules/ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-3.0.1.tgz", + "integrity": "sha512-it4HyVAUTKBc6m8e1iXWvXSTdndF7HbdN713+kvLrymxTaU4AUBWrJ4vEooP+V7fexnVD3LKcBshjGGPefSMUQ==", "dev": true, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/run-parallel": { @@ -13301,9 +13296,9 @@ } }, "commander": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.0.0.tgz", - "integrity": "sha512-JJfP2saEKbQqvW+FI93OYUB4ByV5cizMpFMiiJI8xDbBvQvSkIk0VvQdn1CZ8mqAO8Loq2h0gYTYtDFUZUeERw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", + "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==", "dev": true }, "commondir": { @@ -13987,9 +13982,9 @@ } }, "entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", + "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", "dev": true }, "env-paths": { @@ -15983,9 +15978,9 @@ } }, "jsonc-parser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", - "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.1.0.tgz", + "integrity": "sha512-DRf0QjnNeCUds3xTjKlQQ3DpJD51GvDjJfnxUVWg6PZTo2otSm+slzNAxU/35hF8/oJIKoG9slq30JYOsF2azg==", "dev": true }, "jsonfile": { @@ -16061,9 +16056,9 @@ "dev": true }, "linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", + "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", "dev": true, "requires": { "uc.micro": "^1.0.1" @@ -16245,14 +16240,14 @@ "dev": true }, "markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz", + "integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==", "dev": true, "requires": { "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", + "entities": "~3.0.1", + "linkify-it": "^4.0.1", "mdurl": "^1.0.1", "uc.micro": "^1.0.5" }, @@ -16266,30 +16261,30 @@ } }, "markdownlint": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.25.1.tgz", - "integrity": "sha512-AG7UkLzNa1fxiOv5B+owPsPhtM4D6DoODhsJgiaNg1xowXovrYgOnLqAgOOFQpWOlHFVQUzjMY5ypNNTeov92g==", + "version": "0.26.2", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.26.2.tgz", + "integrity": "sha512-2Am42YX2Ex5SQhRq35HxYWDfz1NLEOZWWN25nqd2h3AHRKsGRE+Qg1gt1++exW792eXTrR4jCNHfShfWk9Nz8w==", "dev": true, "requires": { - "markdown-it": "12.3.2" + "markdown-it": "13.0.1" } }, "markdownlint-cli": { - "version": "0.31.1", - "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.31.1.tgz", - "integrity": "sha512-keIOMwQn+Ch7MoBwA+TdkyVMuxAeZFEGmIIlvwgV0Z1TGS5MxPnRr29XCLhkNzCHU+uNKGjU+VEjLX+Z9kli6g==", + "version": "0.32.2", + "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.32.2.tgz", + "integrity": "sha512-xmJT1rGueUgT4yGNwk6D0oqQr90UJ7nMyakXtqjgswAkEhYYqjHew9RY8wDbOmh2R270IWjuKSeZzHDEGPAUkQ==", "dev": true, "requires": { - "commander": "~9.0.0", + "commander": "~9.4.0", "get-stdin": "~9.0.0", - "glob": "~7.2.0", + "glob": "~8.0.3", "ignore": "~5.2.0", "js-yaml": "^4.1.0", - "jsonc-parser": "~3.0.0", - "markdownlint": "~0.25.1", - "markdownlint-rule-helpers": "~0.16.0", - "minimatch": "~3.0.5", - "run-con": "~1.2.10" + "jsonc-parser": "~3.1.0", + "markdownlint": "~0.26.2", + "markdownlint-rule-helpers": "~0.17.2", + "minimatch": "~5.1.0", + "run-con": "~1.2.11" }, "dependencies": { "argparse": { @@ -16298,29 +16293,13 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "dependencies": { - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - } + "balanced-match": "^1.0.0" } }, "js-yaml": { @@ -16331,19 +16310,28 @@ "requires": { "argparse": "^2.0.1" } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } } } }, "markdownlint-rule-helpers": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.16.0.tgz", - "integrity": "sha512-oEacRUVeTJ5D5hW1UYd2qExYI0oELdYK72k1TKGvIeYJIbqQWAz476NAc7LNixSySUhcNl++d02DvX0ccDk9/w==", + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.17.2.tgz", + "integrity": "sha512-XaeoW2NYSlWxMCZM2B3H7YTG6nlaLfkEZWMBhr4hSPlq9MuY2sy83+Xr89jXOqZMZYjvi5nBCGoFh7hHoPKZmA==", "dev": true }, "mdurl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "dev": true }, "meow": { @@ -18385,21 +18373,21 @@ "dev": true }, "run-con": { - "version": "1.2.10", - "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.10.tgz", - "integrity": "sha512-n7PZpYmMM26ZO21dd8y3Yw1TRtGABjRtgPSgFS/nhzfvbJMXFtJhJVyEgayMiP+w/23craJjsnfDvx4W4ue/HQ==", + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.11.tgz", + "integrity": "sha512-NEMGsUT+cglWkzEr4IFK21P4Jca45HqiAbIIZIBdX5+UZTB24Mb/21iNGgz9xZa8tL6vbW7CXmq7MFN42+VjNQ==", "dev": true, "requires": { "deep-extend": "^0.6.0", - "ini": "~2.0.0", - "minimist": "^1.2.5", + "ini": "~3.0.0", + "minimist": "^1.2.6", "strip-json-comments": "~3.1.1" }, "dependencies": { "ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-3.0.1.tgz", + "integrity": "sha512-it4HyVAUTKBc6m8e1iXWvXSTdndF7HbdN713+kvLrymxTaU4AUBWrJ4vEooP+V7fexnVD3LKcBshjGGPefSMUQ==", "dev": true } } diff --git a/package.json b/package.json index 3aec4339..1a8f4e80 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "has-flag": "5.0.1", "husky": "8.0.1", "lodash": "4.17.21", - "markdownlint-cli": "0.31.1", + "markdownlint-cli": "0.32.2", "mocha": "9.2.2", "moment": "2.29.4", "mysql2": "2.3.3", From d6582fadd74822152076e720135003ab027bcfc3 Mon Sep 17 00:00:00 2001 From: Lukas Hroch Date: Thu, 13 Oct 2022 17:42:30 +0100 Subject: [PATCH 2/2] fix(docs): badge links & toc --- README.md | 85 ++++++++++++++++++++----------------------------------- 1 file changed, 31 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 89c36674..be9411d9 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,39 @@ # sequelize-typescript -[![Build Status](https://github.com/RobinBuschmann/sequelize-typescript/workflows/Node.js%20CI/badge.svg)](https://github.com/RobinBuschmann/sequelize-typescript/actions?query=workflow%3A%22Node.js+CI%22) -[![codecov](https://codecov.io/gh/RobinBuschmann/sequelize-typescript/branch/master/graph/badge.svg)](https://codecov.io/gh/RobinBuschmann/sequelize-typescript) +[![Build Status](https://github.com/sequelize/sequelize-typescript/workflows/Node.js%20CI/badge.svg)](https://github.com/sequelize/sequelize-typescript/actions?query=workflow%3A%22Node.js+CI%22) +[![codecov](https://codecov.io/gh/sequelize/sequelize-typescript/branch/master/graph/badge.svg)](https://codecov.io/gh/sequelize/sequelize-typescript) [![NPM](https://img.shields.io/npm/v/sequelize-typescript.svg)](https://www.npmjs.com/package/sequelize-typescript) Decorators and some other features for sequelize (v6). -- [sequelize-typescript](#sequelize-typescript) - - [Installation](#installation) - - [Sequelize Options](#sequelize-options) - - [Scopes Options](#scopes-options) - - [Model definition](#model-definition) - - [Less strict](#less-strict) - - [More strict](#more-strict) - - [`@Table`](#table) - - [Table API](#table-api) - - [Primary key](#primary-key) - - [`@CreatedAt`, `@UpdatedAt`, `@DeletedAt`](#createdat-updatedat-deletedat) - - [`@Column`](#column) - - [Column API](#column-api) - - [_Shortcuts_](#shortcuts) - - [Type inference](#type-inference) - - [Accessors](#accessors) - - [Usage](#usage) - - [Configuration](#configuration) - - [globs](#globs) - - [Model-path resolving](#model-path-resolving) - - [Build and create](#build-and-create) - - [Find and update](#find-and-update) - - [Model association](#model-association) - - [One-to-many](#one-to-many) - - [Many-to-many](#many-to-many) - - [Type safe _through_-table instance access](#type-safe-through-table-instance-access) - - [One-to-one](#one-to-one) - - [`@ForeignKey`, `@BelongsTo`, `@HasMany`, `@HasOne`, `@BelongsToMany` API](#foreignkey-belongsto-hasmany-hasone-belongstomany-api) - - [Multiple relations of same models](#multiple-relations-of-same-models) - - [Type safe usage of auto generated functions](#type-safe-usage-of-auto-generated-functions) - - [Indexes](#indexes) - - [`@Index`](#index) - - [Index API](#index-api) - - [`createIndexDecorator()`](#createindexdecorator) - - [Repository mode](#repository-mode) - - [How to enable repository mode?](#how-to-enable-repository-mode) - - [How to use repository mode?](#how-to-use-repository-mode) - - [How to use associations with repository mode?](#how-to-use-associations-with-repository-mode) - - [Limitations of repository mode](#limitations-of-repository-mode) - - [Model validation](#model-validation) - - [Exceptions](#exceptions) - - [Example](#example) - - [Scopes](#scopes) - - [`@DefaultScope` and `@Scopes`](#defaultscope-and-scopes) - - [Hooks](#hooks) - - [Why `() => Model`?](#why---model) - - [Recommendations and limitations](#recommendations-and-limitations) - - [One Sequelize instance per model (without repository mode)](#one-sequelize-instance-per-model-without-repository-mode) - - [One model class per file](#one-model-class-per-file) - - [Minification](#minification) - - [Contributing](#contributing) +- [Installation](#installation) +- [Model Definition](#model-definition) + - [`@Table` API](#table-api) + - [`@Column` API](#column-api) +- [Usage](#usage) + - [Configuration](#configuration) + - [globs](#globs) + - [Model-path resolving](#model-path-resolving) +- [Model association](#model-association) + - [One-to-many](#one-to-many) + - [Many-to-many](#many-to-many) + - [One-to-one](#one-to-one) + - [`@ForeignKey`, `@BelongsTo`, `@HasMany`, `@HasOne`, `@BelongsToMany` API](#foreignkey-belongsto-hasmany-hasone-belongstomany-api) + - [Generated getter and setter](#type-safe-usage-of-auto-generated-functions) + - [Multiple relations of same models](#multiple-relations-of-same-models) +- [Indexes](#indexes) + - [`@Index` API](#index) + - [`createIndexDecorator()` API](#createindexdecorator) +- [Repository mode](#repository-mode) + - [How to enable repository mode?](#how-to-enable-repository-mode) + - [How to use repository mode?](#how-to-use-repository-mode) + - [How to use associations with repository mode?](#how-to-use-associations-with-repository-mode) + - [Limitations of repository mode](#limitations-of-repository-mode) +- [Model validation](#model-validation) +- [Scopes](#scopes) +- [Hooks](#hooks) +- [Why `() => Model`?](#why---model) +- [Recommendations and limitations](#recommendations-and-limitations) ## Installation @@ -244,7 +221,7 @@ used together with the @Column annotation to make some attribute options easier | --------------------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | | `@AllowNull(allowNull?: boolean)` | sets `attribute.allowNull` (default is `true`) | | `@AutoIncrement` | sets `attribute.autoIncrement=true` | -| `@Unique(options? UniqueOptions)` | sets `attribute.unique=true` | [UniqueOptions](https://github.com/RobinBuschmann/sequelize-typescript/blob/master/src/model/column/column-options/unique.ts#L3) | +| `@Unique(options? UniqueOptions)` | sets `attribute.unique=true` | [UniqueOptions](https://github.com/sequelize/sequelize-typescript/blob/master/src/model/column/column-options/unique.ts#L3) | | `@Default(value: any)` | sets `attribute.defaultValue` to specified value | | `@PrimaryKey` | sets `attribute.primaryKey=true` | | `@Comment(value: string)` | sets `attribute.comment` to specified string |