UNPKG

@decaf-ts/db-decorators

Version:

Agnostic database decorators and repository

35 lines (34 loc) 1.29 kB
import { OperationHandler } from "./types"; import { OperationKeys } from "./constants"; import { IRepository } from "../interfaces/IRepository"; import { Model } from "@decaf-ts/decorator-validation"; /** * @summary Holds the registered operation handlers * * @class OperationsRegistry * @implements IRegistry<OperationHandler<any>> * * @see OperationHandler * * @category Operations */ export declare class OperationsRegistry { private readonly cache; /** * @summary retrieves an {@link OperationHandler} if it exists * @param {string} target * @param {string} propKey * @param {string} operation * @param accum * @return {OperationHandler | undefined} */ get<T extends Model, V extends IRepository<T>, Y>(target: string | Record<string, any>, propKey: string, operation: string, accum?: OperationHandler<T, V, Y>[]): OperationHandler<T, V, Y>[] | undefined; /** * @summary Registers an {@link OperationHandler} * @param {OperationHandler} handler * @param {string} operation * @param {{}} target * @param {string | symbol} propKey */ register<T extends Model, V extends IRepository<T>, Y>(handler: OperationHandler<T, V, Y>, operation: OperationKeys, target: T, propKey: string | symbol): void; }