UNPKG

1.24 kBTypeScriptView Raw
1import 'reflect-metadata';
2import { HookMeta } from './hook-meta';
3import { HookOptions } from './hook-options';
4import { SequelizeHooks } from 'sequelize/types/lib/hooks';
5import { ModelCtor } from '../../model/model/model';
6/**
7 * Installs hooks on the specified models
8 */
9export declare function installHooks(models: ModelCtor[]): void;
10/**
11 * Implementation for hook decorator functions. These are polymorphic. When
12 * called with a single argument (IHookOptions) they return a decorator
13 * factory function. When called with multiple arguments, they add the hook
14 * to the model’s metadata.
15 */
16export declare function implementHookDecorator(hookType: keyof SequelizeHooks, args: any[]): Function | void;
17/**
18 * Adds hook meta data for specified model
19 * @throws if applied to a non-static method
20 * @throws if the hook method name is reserved
21 */
22export declare function addHook(target: any, hookType: keyof SequelizeHooks, methodName: string, options?: HookOptions): void;
23/**
24 * Returns hooks meta data from specified class
25 */
26export declare function getHooks(target: any): HookMeta[] | undefined;
27/**
28 * Saves hooks meta data for the specified class
29 */
30export declare function setHooks(target: any, hooks: HookMeta[]): void;