Commit d7486f3e authored by nanahira's avatar nanahira

bump and kick lodash

parent 5c14fa72
#!/bin/bash
npm install --save \
lodash
npm install --save-dev \
@types/node \
@types/lodash \
typescript \
'@typescript-eslint/eslint-plugin@^4.28.2' \
'@typescript-eslint/parser@^4.28.2 '\
'eslint@^7.30.0' \
'eslint-config-prettier@^8.3.0' \
'eslint-plugin-prettier@^3.4.0' \
prettier
This diff is collapsed.
......@@ -33,7 +33,7 @@
"peerDependencies": {
"@nestjs/common": "^9.0.3 || ^8.0.0",
"@nestjs/core": "^9.0.3 || ^8.0.0",
"koishi": "^4.11.0",
"koishi": "^4.11.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
......@@ -43,7 +43,6 @@
"@types/jest": "^29.2.0",
"@types/koa": "^2.13.4",
"@types/koa-bodyparser": "^4.3.7",
"@types/lodash": "^4.14.175",
"@types/node": "^16.10.2",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^4.32.0",
......@@ -66,8 +65,7 @@
"@types/ws": "^8.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"koishi-thirdeye": "^11.1.20",
"lodash": "^4.17.21",
"koishi-thirdeye": "^11.1.21",
"typed-reflector": "^1.0.11",
"ws": "^8.7.0"
},
......
......@@ -12,7 +12,6 @@ import {
KoishiCommandInterceptorRegistration,
KoishiModuleOptions,
} from '../utility/koishi.interfaces';
import _ from 'lodash';
import { KoishiContextService } from './koishi-context.service';
import { Module } from '@nestjs/core/injector/module';
import { KoishiMetadataFetcherService } from '../koishi-metadata-fetcher/koishi-metadata-fetcher.service';
......@@ -22,6 +21,7 @@ import { registerAtLeastEach } from '../utility/take-first-value';
import { koishiRegistrar } from 'koishi-thirdeye/dist/src/registrar';
import { CommandConfigExtended } from 'koishi-thirdeye/dist/src/def';
import { map } from 'rxjs';
import { uniq } from '../utility/utility';
@Injectable()
export class KoishiMetascanService {
......@@ -111,20 +111,15 @@ export class KoishiMetascanService {
fun: (ctx: Context, instance: any) => T,
): T[] {
const modules = Array.from(this.moduleContainer.values());
return _.flatten(
modules.map((module) => {
const moduleCtx = this.ctxService.getModuleCtx(ctx, module);
const allProviders = this.getAllActiveProvidersFromModule(module);
return allProviders.map((provider) => {
const instance = provider.instance;
const providerCtx = this.ctxService.getProviderCtx(
moduleCtx,
instance,
);
return fun(providerCtx, instance);
});
}),
);
return modules.flatMap((module) => {
const moduleCtx = this.ctxService.getModuleCtx(ctx, module);
const allProviders = this.getAllActiveProvidersFromModule(module);
return allProviders.map((provider) => {
const instance = provider.instance;
const providerCtx = this.ctxService.getProviderCtx(moduleCtx, instance);
return fun(providerCtx, instance);
});
});
}
preRegisterContext(ctx: Context) {
......@@ -138,7 +133,7 @@ export class KoishiMetascanService {
key: string,
command: Command,
) {
const interceptorDefs: KoishiCommandInterceptorRegistration[] = _.uniq(
const interceptorDefs: KoishiCommandInterceptorRegistration[] = uniq(
this.metaFetcher.getPropertyMetadataArray(
KoishiCommandInterceptorDef,
instance,
......
export function uniq<T>(arr: T[]) {
return [...new Set(arr)];
}
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