UNPKG

dependency-injection-cat

Version:

DI Cat is a truly clean DI-container, which allows you not to pollute your business logic with decorators from DI/IOC libraries!

31 lines (30 loc) 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BeanDependenciesRepository = void 0; var BeanDependenciesRepository = /** @class */ (function () { function BeanDependenciesRepository() { } BeanDependenciesRepository.registerBeanDependency = function (beanDescriptor, dependencyDescriptor) { var _a, _b; var dependenciesMap = (_a = this.beanDependenciesRepository.get(dependencyDescriptor.contextName)) !== null && _a !== void 0 ? _a : new Map(); if (!this.beanDependenciesRepository.has(dependencyDescriptor.contextName)) { this.beanDependenciesRepository.set(dependencyDescriptor.contextName, dependenciesMap); } var beanDependencyDescriptors = (_b = dependenciesMap.get(beanDescriptor)) !== null && _b !== void 0 ? _b : null; if (beanDependencyDescriptors === null) { beanDependencyDescriptors = []; dependenciesMap.set(beanDescriptor, beanDependencyDescriptors); } beanDependencyDescriptors.push(dependencyDescriptor); }; BeanDependenciesRepository.getBeanDescriptorMapByContextName = function (contextName) { var _a; return (_a = this.beanDependenciesRepository.get(contextName)) !== null && _a !== void 0 ? _a : null; }; BeanDependenciesRepository.clearBeanDependenciesByContextDescriptor = function (contextDescriptor) { this.beanDependenciesRepository.delete(contextDescriptor.name); }; BeanDependenciesRepository.beanDependenciesRepository = new Map(); return BeanDependenciesRepository; }()); exports.BeanDependenciesRepository = BeanDependenciesRepository;