koatty_container
Advanced tools
Comparing version 1.7.4 to 1.7.5
@@ -5,2 +5,4 @@ # Changelog | ||
### [1.7.5](https://github.com/koatty/koatty_container/compare/v1.7.4...v1.7.5) (2022-02-22) | ||
### [1.7.4](https://github.com/koatty/koatty_container/compare/v1.7.4-0...v1.7.4) (2022-02-21) | ||
@@ -7,0 +9,0 @@ |
/*! | ||
* @Author: richen | ||
* @Date: 2022-02-21 17:03:24 | ||
* @Date: 2022-02-22 12:10:36 | ||
* @License: BSD (3-Clause) | ||
@@ -5,0 +5,0 @@ * @Copyright (c) - <richenlin(at)gmail.com> |
/*! | ||
* @Author: richen | ||
* @Date: 2022-02-21 17:03:11 | ||
* @Date: 2022-02-22 12:10:26 | ||
* @License: BSD (3-Clause) | ||
@@ -310,3 +310,3 @@ * @Copyright (c) - <richenlin(at)gmail.com> | ||
// tslint:disable-next-line: no-unused-expression | ||
if (app && app.once) { | ||
if (app === null || app === void 0 ? void 0 : app.once) { | ||
app.once("appReady", () => { | ||
@@ -492,23 +492,22 @@ // lazy inject autowired | ||
const allMethods = getMethodNames(target); | ||
const methods = allMethods.filter((m) => !["constructor", "init", "__before", "__after"].includes(m) && target.prototype.hasOwnProperty(m)); | ||
if (allMethods.includes("__before") || allMethods.includes("__after")) { | ||
const methods = allMethods.filter((m) => !['constructor', 'init', '__before', '__after'].includes(m)); | ||
let hasDefault = false; | ||
if (allMethods.includes('__before') || allMethods.includes('__after')) { | ||
// inject default AOP method | ||
injectDefaultAOP(target, instance, methods); | ||
hasDefault = true; | ||
} | ||
else { | ||
const classMetaData = container.getClassMetadata(TAGGED_CLS, TAGGED_AOP, target); | ||
if (classMetaData) { | ||
const { type, name, method } = classMetaData; | ||
if (name && [exports.AOPType.Before, exports.AOPType.BeforeEach, exports.AOPType.After, exports.AOPType.AfterEach].includes(type)) { | ||
methods.forEach((element) => { | ||
if ([exports.AOPType.Before, exports.AOPType.After].includes(type) && method === element) { | ||
// Logger.Debug(`Register inject AOP ${target.name} method: ${element} => ${type}`); | ||
defineAOPProperty(target, element, name, type); | ||
const { type, name, method } = classMetaData || {}; | ||
if (name && [exports.AOPType.Before, exports.AOPType.BeforeEach, exports.AOPType.After, exports.AOPType.AfterEach].includes(type)) { | ||
methods.forEach((element) => { | ||
if (element === method) { | ||
if (hasDefault && (type === exports.AOPType.BeforeEach || type === exports.AOPType.AfterEach)) { | ||
return; | ||
} | ||
else { | ||
// Logger.Debug(`Register inject AOP ${target.name} method: ${element} => ${type}`); | ||
defineAOPProperty(target, element, name, type); | ||
} | ||
}); | ||
} | ||
// Logger.Debug(`Register inject AOP ${target.name} method: ${element} => ${type}`); | ||
defineAOPProperty(target, element, name, type); | ||
} | ||
}); | ||
} | ||
@@ -515,0 +514,0 @@ } |
{ | ||
"name": "koatty_container", | ||
"version": "1.7.4", | ||
"version": "1.7.5", | ||
"description": "IOC Container for Koatty.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
{ | ||
"name": "koatty_container", | ||
"version": "1.7.4", | ||
"version": "1.7.5", | ||
"description": "IOC Container for Koatty.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119619
2511