UNPKG

surrogate

Version:

Object method hooks made easy

74 lines (73 loc) 2.73 kB
import type { NextForOptions, NextDecoratorOptions } from './interfaces'; type PropertyDecorator<T extends object> = (target: T, property: string, descriptor: PropertyDescriptor) => void; /** * @description Designate decorated methods as next handler. Handler type must be assigned * * @export * @decorator * @template T * @param {(NextForOptions<T> | NextForOptions<T>[])} nextOptions * @returns {PropertyDecorator<T>} */ export declare const NextFor: <T extends object>(nextOptions: NextForOptions<T> | NextForOptions<T>[]) => PropertyDecorator<T>; /** * Designate decorated methods as async pre hooks. * * @export * @decorator * @template T * @param {(NextDecoratorOptions<T> | NextDecoratorOptions<T>[])} nextOptions * @returns {PropertyDecorator<T>} */ export declare const NextAsyncPre: <T extends object>(nextOptions: NextDecoratorOptions<T> | NextDecoratorOptions<T>[]) => PropertyDecorator<T>; /** * Designate decorated methods as async post hooks. * * @export * @decorator * @template T * @param {(NextDecoratorOptions<T> | NextDecoratorOptions<T>[])} nextOptions * @returns {PropertyDecorator<T>} */ export declare const NextAsyncPost: <T extends object>(nextOptions: NextDecoratorOptions<T> | NextDecoratorOptions<T>[]) => PropertyDecorator<T>; /** * Designate decorated methods as async pre and post hooks. * * @export * @decorator * @template T * @param {(NextDecoratorOptions<T> | NextDecoratorOptions<T>[])} nextOptions * @returns {PropertyDecorator<T>} */ export declare const NextAsyncPreAndPost: <T extends object>(nextOptions: NextDecoratorOptions<T> | NextDecoratorOptions<T>[]) => PropertyDecorator<T>; /** * Designate decorated methods as pre hooks. * * @export * @decorator * @template T * @param {(NextDecoratorOptions<T> | NextDecoratorOptions<T>[])} nextOptions * @returns {PropertyDecorator<T>} */ export declare const NextPre: <T extends object>(nextOptions: NextDecoratorOptions<T> | NextDecoratorOptions<T>[]) => PropertyDecorator<T>; /** * Designate decorated methods as post hook * * @export * @decorator * @template T * @param {(NextDecoratorOptions<T> | NextDecoratorOptions<T>[])} nextOptions * @returns {PropertyDecorator<T>} */ export declare const NextPost: <T extends object>(nextOptions: NextDecoratorOptions<T> | NextDecoratorOptions<T>[]) => PropertyDecorator<T>; /** * Designate decorated methods as pre and post hooks. * * @export * @decorator * @template T * @param {(NextDecoratorOptions<T> | NextDecoratorOptions<T>[])} nextOptions * @returns {PropertyDecorator<T>} */ export declare const NextPreAndPost: <T extends object>(nextOptions: NextDecoratorOptions<T> | NextDecoratorOptions<T>[]) => PropertyDecorator<T>; export {};