Commit 332bdf3e authored by nanahira's avatar nanahira

fix problems of reflector

parent 0ae07dd3
......@@ -11,7 +11,7 @@
"dependencies": {
"koishi-utils-schemagen": "^1.1.9",
"reflect-metadata": "^0.1.13",
"typed-reflector": "^1.0.2"
"typed-reflector": "^1.0.4"
},
"devDependencies": {
"@koishijs/plugin-adapter-onebot": "^4.0.0-beta.0",
......@@ -2943,9 +2943,9 @@
}
},
"node_modules/typed-reflector": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.2.tgz",
"integrity": "sha512-dyhBLKAbT0O/OEIJXQw+IqAH9ddFk0iV4gJP5XvcgcfJ0xxyx4krx1visZtH8YoFe86piRKgO9VPs/Ktzfdb0w==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.4.tgz",
"integrity": "sha512-5aO0A3DdhsLyC3OnwHvLSvfN+KjOtc7c+pPRlh3d0D55wOq9391SLaOgtVBSJYPyrLctFcSDsyG2Ku7lEaEjow==",
"dependencies": {
"reflect-metadata": "^0.1.13"
}
......@@ -5277,9 +5277,9 @@
}
},
"typed-reflector": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.2.tgz",
"integrity": "sha512-dyhBLKAbT0O/OEIJXQw+IqAH9ddFk0iV4gJP5XvcgcfJ0xxyx4krx1visZtH8YoFe86piRKgO9VPs/Ktzfdb0w==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/typed-reflector/-/typed-reflector-1.0.4.tgz",
"integrity": "sha512-5aO0A3DdhsLyC3OnwHvLSvfN+KjOtc7c+pPRlh3d0D55wOq9391SLaOgtVBSJYPyrLctFcSDsyG2Ku7lEaEjow==",
"requires": {
"reflect-metadata": "^0.1.13"
}
......
......@@ -270,10 +270,10 @@ export function KoishiPlugin<T = any>(
_handleServiceProvide(connect = true) {
// console.log(`Handling service provide`);
const providingServices = reflector.getArray(
KoishiServiceProvideSym,
originalClass,
);
const providingServices = [
...reflector.getArray(KoishiServiceProvideSym, originalClass),
...reflector.getArray(KoishiServiceProvideSym, this),
];
for (const key of providingServices) {
// console.log(`Processing ${key}`);
this.__ctx[key] = connect ? (this as any) : null;
......@@ -309,10 +309,10 @@ export function KoishiPlugin<T = any>(
constructor(...args: any[]) {
const originalCtx: Context = args[0];
const rawConfig = args[1];
const contextFilters = reflector.getArray(
KoishiOnContextScope,
originalClass,
);
const contextFilters = [
...reflector.getArray(KoishiOnContextScope, originalClass),
...reflector.getArray(KoishiOnContextScope, newClass),
];
const ctx = getContextFromFilters(originalCtx, contextFilters);
const config =
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