UNPKG

tsioc

Version:

tsioc is AOP, Ioc container, via typescript decorator

47 lines (45 loc) 2.29 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var ActionComposite_1 = require("./ActionComposite"); var CoreActions_1 = require("./CoreActions"); var index_1 = require("../factories/index"); var index_2 = require("../../utils/index"); var BindParameterProviderAction = /** @class */ (function (_super) { __extends(BindParameterProviderAction, _super); function BindParameterProviderAction() { return _super.call(this, CoreActions_1.CoreActions.bindParameterProviders) || this; } BindParameterProviderAction.prototype.working = function (container, data) { var target = data.target; var type = data.targetType; var propertyKey = data.propertyKey; var lifeScope = container.getLifeScope(); var matchs = lifeScope.getMethodDecorators(function (surm) { return surm.actions.includes(CoreActions_1.CoreActions.bindParameterProviders) && index_1.hasOwnMethodMetadata(surm.name, type); }); var providers = []; matchs.forEach(function (surm) { var methodmtas = index_1.getOwnMethodMetadata(surm.name, type); var metadatas = methodmtas[propertyKey]; if (metadatas && index_2.isArray(metadatas) && metadatas.length > 0) { metadatas.forEach(function (meta) { if (meta.providers && meta.providers.length > 0) { providers = providers.concat(meta.providers); } }); } }); data.execResult = providers; }; return BindParameterProviderAction; }(ActionComposite_1.ActionComposite)); exports.BindParameterProviderAction = BindParameterProviderAction; //# sourceMappingURL=../../sourcemaps/core/actions/BindParameterProviderAction.js.map