UNPKG

dino-core

Version:

A dependency injection framework for NodeJS applications

62 lines (61 loc) 1.97 kB
import { Component } from './component'; /** * A repository represent a component that is responsibility is to access in a * collection like data required by the application. * * When contextScan is set to true, classes extending this class will be * automatically discovered and injected on the application context. * * As of now Repositories are just stereotypes that define responsibilities plan is to * extend the behaviour and add transactional nature to the methods defined on the * implementing classes. * * @typedef Repository * @public */ export declare class Repository extends Component { getTypeName(): string; /** * Execution method that allows to initiate the resources required for the transactional * environment * * @protected */ protected beginTransaction(): void; /** * Execution method that allows to complete the initiated transaction * * @protected */ protected completeTransaction(): void; /** * Execution method that allows to rollback the initiated transaction * * @protected */ protected rollbackTransaction(): void; /** * Execution method that allows to clean-up resources used for the transaction * * @protected */ protected cleanupTransactionResources(): void; /** * Defines if an injectable is transactional or not. By default this method checks if any * methods have been defined to require a transaction, in this case returns true, otherwise false. * * @returns {Boolean} true if the injectable is transactional, false otherwise * * @public */ transactional(): boolean; /** * Allows to define the methods that should be treated as requiring transactions. * * @returns {Array<String>} an array containing the names of the methods that should * be wrapped in a transaction * * @public */ enableTransactionOn(): string[]; }