Merge pull request #30807 from bduff9/patch-1

Added beforeSave and afterSave to hook definitions
This commit is contained in:
Mine Starks
2018-11-28 07:27:28 -08:00
committed by GitHub
+8 -5
View File
@@ -2295,8 +2295,8 @@ declare namespace sequelize {
* interfaces.
*
* beforeValidate, afterValidate, beforeBulkCreate, beforeBulkDestroy, beforeBulkUpdate, beforeCreate,
* beforeDestroy, beforeUpdate, afterCreate, afterDestroy, afterUpdate, afterBulkCreate, afterBulkDestroy and
* afterBulkUpdate.
* beforeDestroy, beforeSave, beforeUpdate, afterCreate, afterDestroy, afterSave, afterUpdate, afterBulkCreate,
* afterBulkDestroy and afterBulkUpdate.
*/
interface HooksDefineOptions<TInstance> {
@@ -2310,6 +2310,8 @@ declare namespace sequelize {
afterDelete?: (instance: TInstance, options: Object, fn?: Function) => any;
beforeUpdate?: (instance: TInstance, options: Object, fn?: Function) => any;
afterUpdate?: (instance: TInstance, options: Object, fn?: Function) => any;
beforeSave?: (instance: TInstance, options: Object, fn?: Function) => any;
afterSave?: (instance: TInstance, options: Object, fn?: Function) => any;
beforeBulkCreate?: (instances: TInstance[], options: Object, fn?: Function) => any;
afterBulkCreate?: (instances: TInstance[], options: Object, fn?: Function) => any;
beforeBulkDestroy?: (options: Object, fn?: Function) => any;
@@ -5272,9 +5274,10 @@ declare namespace sequelize {
/**
* An object of hook function that are called before and after certain lifecycle events.
* The possible hooks are: beforeValidate, afterValidate, beforeBulkCreate, beforeBulkDestroy,
* beforeBulkUpdate, beforeCreate, beforeDestroy, beforeUpdate, afterCreate, afterDestroy, afterUpdate,
* afterBulkCreate, afterBulkDestory and afterBulkUpdate. See Hooks for more information about hook
* functions and their signatures. Each property can either be a function, or an array of functions.
* beforeBulkUpdate, beforeCreate, beforeDestroy, beforeSave, beforeUpdate, afterCreate, afterDestroy,
* afterSave, afterUpdate, afterBulkCreate, afterBulkDestory and afterBulkUpdate.
* See Hooks for more information about hook functions and their signatures. Each property can either
* be a function, or an array of functions.
*/
hooks?: HooksDefineOptions<TInstance>;