Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit ba9a2f65
authored
Jan 21, 2020
by
Eike Lurz
Committed by
Pedro Augusto de Paula Barbosa
Jan 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(types): adds 'hooks' to CreateOptions (#11736)
1 parent
91153938
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
27 deletions
types/lib/associations/base.d.ts
types/lib/instance-validator.d.ts
types/lib/model.d.ts
types/lib/sequelize.d.ts
types/lib/associations/base.d.ts
View file @
ba9a2f6
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
...
...
types/lib/instance-validator.d.ts
View file @
ba9a2f6
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
;
}
types/lib/model.d.ts
View file @
ba9a2f6
This diff is collapsed.
Click to expand it.
types/lib/sequelize.d.ts
View file @
ba9a2f6
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment