Commit 332bdf3e authored by nanahira's avatar nanahira

fix problems of reflector

parent 0ae07dd3
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"koishi-utils-schemagen": "^1.1.9", "koishi-utils-schemagen": "^1.1.9",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"typed-reflector": "^1.0.2" "typed-reflector": "^1.0.4"
}, },
"devDependencies": { "devDependencies": {
"@koishijs/plugin-adapter-onebot": "^4.0.0-beta.0", "@koishijs/plugin-adapter-onebot": "^4.0.0-beta.0",
...@@ -2943,9 +2943,9 @@ ...@@ -2943,9 +2943,9 @@
} }
}, },
"node_modules/typed-reflector": { "node_modules/typed-reflector": {
"version": "1.0.2", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.2.tgz", "resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.4.tgz",
"integrity": "sha512-dyhBLKAbT0O/OEIJXQw+IqAH9ddFk0iV4gJP5XvcgcfJ0xxyx4krx1visZtH8YoFe86piRKgO9VPs/Ktzfdb0w==", "integrity": "sha512-5aO0A3DdhsLyC3OnwHvLSvfN+KjOtc7c+pPRlh3d0D55wOq9391SLaOgtVBSJYPyrLctFcSDsyG2Ku7lEaEjow==",
"dependencies": { "dependencies": {
"reflect-metadata": "^0.1.13" "reflect-metadata": "^0.1.13"
} }
...@@ -5277,9 +5277,9 @@ ...@@ -5277,9 +5277,9 @@
} }
}, },
"typed-reflector": { "typed-reflector": {
"version": "1.0.2", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.2.tgz", "resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.4.tgz",
"integrity": "sha512-dyhBLKAbT0O/OEIJXQw+IqAH9ddFk0iV4gJP5XvcgcfJ0xxyx4krx1visZtH8YoFe86piRKgO9VPs/Ktzfdb0w==", "integrity": "sha512-5aO0A3DdhsLyC3OnwHvLSvfN+KjOtc7c+pPRlh3d0D55wOq9391SLaOgtVBSJYPyrLctFcSDsyG2Ku7lEaEjow==",
"requires": { "requires": {
"reflect-metadata": "^0.1.13" "reflect-metadata": "^0.1.13"
} }
......
...@@ -46,6 +46,6 @@ ...@@ -46,6 +46,6 @@
"dependencies": { "dependencies": {
"koishi-utils-schemagen": "^1.1.9", "koishi-utils-schemagen": "^1.1.9",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"typed-reflector": "^1.0.2" "typed-reflector": "^1.0.4"
} }
} }
...@@ -270,10 +270,10 @@ export function KoishiPlugin<T = any>( ...@@ -270,10 +270,10 @@ export function KoishiPlugin<T = any>(
_handleServiceProvide(connect = true) { _handleServiceProvide(connect = true) {
// console.log(`Handling service provide`); // console.log(`Handling service provide`);
const providingServices = reflector.getArray( const providingServices = [
KoishiServiceProvideSym, ...reflector.getArray(KoishiServiceProvideSym, originalClass),
originalClass, ...reflector.getArray(KoishiServiceProvideSym, this),
); ];
for (const key of providingServices) { for (const key of providingServices) {
// console.log(`Processing ${key}`); // console.log(`Processing ${key}`);
this.__ctx[key] = connect ? (this as any) : null; this.__ctx[key] = connect ? (this as any) : null;
...@@ -309,10 +309,10 @@ export function KoishiPlugin<T = any>( ...@@ -309,10 +309,10 @@ export function KoishiPlugin<T = any>(
constructor(...args: any[]) { constructor(...args: any[]) {
const originalCtx: Context = args[0]; const originalCtx: Context = args[0];
const rawConfig = args[1]; const rawConfig = args[1];
const contextFilters = reflector.getArray( const contextFilters = [
KoishiOnContextScope, ...reflector.getArray(KoishiOnContextScope, originalClass),
originalClass, ...reflector.getArray(KoishiOnContextScope, newClass),
); ];
const ctx = getContextFromFilters(originalCtx, contextFilters); const ctx = getContextFromFilters(originalCtx, contextFilters);
const config = const config =
typeof options.schema === 'function' typeof options.schema === 'function'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment