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!
17 lines (16 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBeanConfigObjectLiteral = void 0;
var typescript_1 = require("typescript");
var BeanRepository_1 = require("../../bean/BeanRepository");
function getBeanConfigObjectLiteral(contextDescriptor) {
var _a;
var contextBeans = (_a = BeanRepository_1.BeanRepository.contextIdToBeanDescriptorsMap.get(contextDescriptor.id)) !== null && _a !== void 0 ? _a : [];
var notNestedContextBeans = contextBeans.filter(function (it) { return it.nestedProperty === null; });
var objectLiteralMembers = notNestedContextBeans.map(function (bean) { return (typescript_1.factory.createPropertyAssignment(typescript_1.factory.createComputedPropertyName(typescript_1.factory.createStringLiteral(bean.classMemberName)), typescript_1.factory.createObjectLiteralExpression([
typescript_1.factory.createPropertyAssignment(typescript_1.factory.createIdentifier('scope'), typescript_1.factory.createStringLiteral(bean.scope)),
bean.isPublic && typescript_1.factory.createPropertyAssignment(typescript_1.factory.createIdentifier('isPublic'), typescript_1.factory.createTrue()),
].filter(function (it) { return Boolean(it); }), false))); });
return typescript_1.factory.createObjectLiteralExpression(objectLiteralMembers, true);
}
exports.getBeanConfigObjectLiteral = getBeanConfigObjectLiteral;