Interface ModelHooks<M, TAttributes>
interface ModelHooks<M extends Model = Model, TAttributes = any> { _UNSTABLE_afterBulkDestroy( options: DestroyOptions<TAttributes>, deletedCount: number, ): AsyncHookReturn; _UNSTABLE_beforeBulkDestroy( options: DestroyOptions<TAttributes>, ): AsyncHookReturn; afterAssociate( data: AfterAssociateEventData, options: AssociationOptions<any>, ): AsyncHookReturn; afterBulkCreate( instances: readonly M[], options: BulkCreateOptions<TAttributes>, ): AsyncHookReturn; afterBulkDestroy(options: DestroyOptions<TAttributes>): AsyncHookReturn; afterBulkRestore(options: RestoreOptions<TAttributes>): AsyncHookReturn; afterBulkUpdate(options: UpdateOptions<TAttributes>): AsyncHookReturn; afterCreate( attributes: M, options: CreateOptions<TAttributes>, ): AsyncHookReturn; afterDefinitionRefresh(): void; afterDestroy(instance: M, options: InstanceDestroyOptions): AsyncHookReturn; afterDestroyMany( instances: readonly M[], options: DestroyManyOptions, deletedCount: number, ): AsyncHookReturn; afterFind( instancesOrInstance: null | M | readonly M[], options: FindOptions<TAttributes>, ): AsyncHookReturn; afterRestore(instance: M, options: InstanceRestoreOptions): AsyncHookReturn; afterSave( instance: M, options: CreateOptions<TAttributes> | InstanceUpdateOptions<TAttributes>, ): AsyncHookReturn; afterSync(options: SyncOptions): AsyncHookReturn; afterUpdate( instance: M, options: InstanceUpdateOptions<TAttributes>, ): AsyncHookReturn; afterUpsert( attributes: [M, null | boolean], options: UpsertOptions<TAttributes>, ): AsyncHookReturn; afterValidate(instance: M, options: ValidationOptions): AsyncHookReturn; beforeAssociate( data: BeforeAssociateEventData, options: AssociationOptions<any>, ): AsyncHookReturn; beforeBulkCreate( instances: M[], options: BulkCreateOptions<TAttributes>, ): AsyncHookReturn; beforeBulkDestroy(options: DestroyOptions<TAttributes>): AsyncHookReturn; beforeBulkRestore(options: RestoreOptions<TAttributes>): AsyncHookReturn; beforeBulkUpdate(options: UpdateOptions<TAttributes>): AsyncHookReturn; beforeCount(options: CountOptions<TAttributes>): AsyncHookReturn; beforeCreate( attributes: M, options: CreateOptions<TAttributes>, ): AsyncHookReturn; beforeDefinitionRefresh(): void; beforeDestroy( instance: M, options: InstanceDestroyOptions, ): AsyncHookReturn; beforeDestroyMany( instances: M[], options: DestroyManyOptions, ): AsyncHookReturn; beforeFind(options: FindOptions<TAttributes>): AsyncHookReturn; beforeFindAfterExpandIncludeAll( options: FindOptions<TAttributes>, ): AsyncHookReturn; beforeFindAfterOptions(options: FindOptions<TAttributes>): AsyncHookReturn; beforeRestore( instance: M, options: InstanceRestoreOptions, ): AsyncHookReturn; beforeSave( instance: M, options: CreateOptions<TAttributes> | InstanceUpdateOptions<TAttributes>, ): AsyncHookReturn; beforeSync(options: SyncOptions): AsyncHookReturn; beforeUpdate( instance: M, options: InstanceUpdateOptions<TAttributes>, ): AsyncHookReturn; beforeUpsert( attributes: M, options: UpsertOptions<TAttributes>, ): AsyncHookReturn; beforeValidate(instance: M, options: ValidationOptions): AsyncHookReturn; validationFailed( instance: M, options: ValidationOptions, error: unknown, ): AsyncHookReturn;} Methods
_UNSTABLE_afterBulkDestroy
_UNSTABLE_beforeBulkDestroy
afterDefinitionRefresh
afterDefinitionRefresh(): void
beforeDefinitionRefresh
beforeDefinitionRefresh(): void
beforeFindAfterExpandIncludeAll
Runs after the definition of the model has changed because ModelDefinition#refreshAttributes was called.