不要怂,就是干,撸起袖子干!

Commit ba9a2f65 by Eike Lurz Committed by Pedro Augusto de Paula Barbosa

fix(types): adds 'hooks' to CreateOptions (#11736)

1 parent 91153938
import { ColumnOptions, Model, ModelCtor } from '../model';
import { ColumnOptions, Model, ModelCtor, Hookable } from '../model';
export abstract class Association<S extends Model = Model, T extends Model = Model> {
public associationType: string;
......@@ -42,17 +42,7 @@ export interface ForeignKeyOptions extends ColumnOptions {
/**
* Options provided when associating models
*/
export interface AssociationOptions {
/**
* Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade.
* For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks
* for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking
* any hooks.
*
* @default false
*/
hooks?: boolean;
export interface AssociationOptions extends Hookable {
/**
* The alias of this model, in singular form. See also the `name` option passed to `sequelize.define`. If
* you create multiple associations between the same tables, you should provide an alias to be able to
......
export interface ValidationOptions {
import { Hookable } from "./model";
export interface ValidationOptions extends Hookable {
/**
* An array of strings. All properties that are in this array will not be validated
*/
......@@ -7,9 +9,4 @@ export interface ValidationOptions {
* An array of strings. Only the properties that are in this array will be validated
*/
fields?: string[];
/**
* Run before and after validate hooks.
* @default true.
*/
hooks?: boolean;
}
......@@ -20,6 +20,7 @@ import {
WhereAttributeHash,
WhereOperators,
ModelCtor,
Hookable,
} from './model';
import { ModelManager } from './model-manager';
import * as Op from './operators';
......@@ -46,7 +47,7 @@ export interface SyncAlterOptions {
/**
* Sync Options
*/
export interface SyncOptions extends Logging {
export interface SyncOptions extends Logging, Hookable {
/**
* If force is true, each DAO will do DROP TABLE IF EXISTS ..., before it tries to create its own table
*/
......@@ -74,13 +75,9 @@ export interface SyncOptions extends Logging {
*/
searchPath?: string;
/**
* If hooks is true then beforeSync, afterSync, beforeBulkSync, afterBulkSync hooks will be called
*/
hooks?: boolean;
}
export interface DefaultSetOptions {}
export interface DefaultSetOptions { }
/**
* Connection Pool options
......@@ -170,7 +167,7 @@ export interface Config {
};
}
export type Dialect = 'mysql' | 'postgres' | 'sqlite' | 'mariadb' | 'mssql';
export type Dialect = 'mysql' | 'postgres' | 'sqlite' | 'mariadb' | 'mssql';
export interface RetryOptions {
match?: (RegExp | string | Function)[];
......@@ -380,7 +377,7 @@ export interface Options extends Logging {
retry?: RetryOptions;
}
export interface QueryOptionsTransactionRequired {}
export interface QueryOptionsTransactionRequired { }
/**
* This is the main class, the entry point to sequelize. To use it, you just need to
......@@ -1080,7 +1077,7 @@ export class Sequelize extends Hooks {
* Returns the database name.
*/
public getDatabaseName() : string;
public getDatabaseName(): string;
/**
* Returns an instance of QueryInterface.
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!