koatty_container
Advanced tools
Comparing version 1.3.6 to 1.3.7
@@ -215,16 +215,14 @@ "use strict"; | ||
// class methods | ||
const methods = Util_1.getMethodNames(target, true).filter((m) => !["constructor", "init"].includes(m)); | ||
const methods = Util_1.getMethodNames(target, true).filter((m) => !["constructor", "init", "__before", "__after"].includes(m)); | ||
// tslint:disable-next-line: no-unused-expression | ||
process.env.APP_DEBUG && koatty_logger_1.DefaultLogger.Warn(`The ${target.name} class has a default AOP method, @BeforeEach and @AfterEach maybe not take effect`); | ||
methods.forEach((element) => { | ||
if (element !== "__before" && element !== "__after") { | ||
// tslint:disable-next-line: no-unused-expression | ||
process.env.APP_DEBUG && koatty_logger_1.DefaultLogger.Custom("think", "", `Register inject default AOP ${target.name} method: ${element} => __before`); | ||
if (helper.isFunction(instance.__before)) { | ||
defineAOPProperty(target, element, "__before", AOPType.Before); | ||
} | ||
if (helper.isFunction(instance.__after)) { | ||
defineAOPProperty(target, element, "__after", AOPType.After); | ||
} | ||
// tslint:disable-next-line: no-unused-expression | ||
process.env.APP_DEBUG && koatty_logger_1.DefaultLogger.Custom("think", "", `Register inject default AOP ${target.name} method: ${element} => __before`); | ||
if (helper.isFunction(instance.__before)) { | ||
defineAOPProperty(target, element, "__before", AOPType.Before); | ||
} | ||
if (helper.isFunction(instance.__after)) { | ||
defineAOPProperty(target, element, "__after", AOPType.After); | ||
} | ||
}); | ||
@@ -258,8 +256,6 @@ } | ||
} | ||
// tslint:disable-next-line: no-invalid-this | ||
return Reflect.apply(oldMethod, this, props); | ||
return oldMethod(props); | ||
} | ||
else { | ||
// tslint:disable-next-line: no-invalid-this | ||
const res = await Reflect.apply(oldMethod, this, props); | ||
const res = await oldMethod(props); | ||
if (aopName) { | ||
@@ -266,0 +262,0 @@ if (aopName === "__after") { |
{ | ||
"name": "koatty_container", | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"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
84480
1692