Documentation
    Preparing search index...

    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: M | readonly M[] | null,
            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, boolean | null],
            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: WritableDeep<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: WritableDeep<FindOptions<TAttributes>>,
        ): AsyncHookReturn;
        beforeFindAfterExpandIncludeAll(
            options: WritableDeep<FindOptions<TAttributes>>,
        ): AsyncHookReturn;
        beforeFindAfterOptions(
            options: WritableDeep<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;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index