Commit 968035f1 authored by nanahira's avatar nanahira

bump things

parent 28a716ab
......@@ -7,3 +7,4 @@ export * from './src/plugin-operators';
export * from './src/plugin-factory';
export * from './src/def/interfaces';
export * from 'schemastery-gen';
export * from 'koishi-decorators/dist/src/def/select';
......@@ -11,7 +11,7 @@
"dependencies": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"koishi-decorators": "^2.1.6",
"koishi-decorators": "^2.1.7",
"lodash": "^4.17.21",
"minato-decorators": "^2.0.7",
"reflect-metadata": "^0.1.13",
......@@ -38,7 +38,7 @@
"ws": "^8.2.3"
},
"peerDependencies": {
"koishi": "^4.7.4",
"koishi": "^4.7.5",
"schemastery": "^3.4.3"
}
},
......@@ -1028,15 +1028,15 @@
}
},
"node_modules/@koishijs/core": {
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.4.tgz",
"integrity": "sha512-S4pPaO05WC0htkQVcTMTluBZv4g8sEEBJ2ItHN2zJA8syet3iKJidT+s2gYt8d2rBo0Ndlvo1gBLGLNl/Zc9yg==",
"version": "4.7.5",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.5.tgz",
"integrity": "sha512-So8tBtSTVIq8dTGs/0o92Om3bQhgYUhmzVhnYTqJbx+kW3kSowl/ORiBhJFK3GR6Dj+JyKLptsqQNE4DjZdNhw==",
"peer": true,
"dependencies": {
"@koishijs/utils": "^5.4.5",
"cordis": "^1.3.3",
"cordis": "^1.5.5",
"fastest-levenshtein": "^1.0.12",
"minato": "^1.1.0"
"minato": "^1.2.1"
},
"engines": {
"node": ">=12.0.0"
......@@ -2298,9 +2298,9 @@
"peer": true
},
"node_modules/cordis": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.3.3.tgz",
"integrity": "sha512-mpyBWAEVYX8/YHoGWIqaOjrOk6DmtrOWZfsBSinNR+nDBlB39Ks6aC1B5oZ7AdnVoRE2ZYBCGecoHrlxcRxd6w==",
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.5.5.tgz",
"integrity": "sha512-vCw6FA+OLO5e40so5XjhRnIw1ldGH1L74q/wlnuckqFtIq8teYkfnnmlNTS24RJNcgPz2DWdbVgCnoc+5Lc+UQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.1.2"
......@@ -4766,13 +4766,13 @@
}
},
"node_modules/koishi": {
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.4.tgz",
"integrity": "sha512-VVHf3TyFsTuKrB8IZffxwmwiGx+zyhDo+DNNEFQjvomgqFdGEceAnLxNIf10K48aB1CDmkmi37b6uaURi4Z1Hw==",
"version": "4.7.5",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.5.tgz",
"integrity": "sha512-Q+czD5hZIsikYwdoKUOZFZIuvXoamikXK6iX4FXnHUPsoXX16PjqX3D1sBKd9JLVMA49KSAGoFW0fN9IMHykYw==",
"peer": true,
"dependencies": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.7.4",
"@koishijs/core": "^4.7.5",
"@koishijs/utils": "^5.4.5",
"@types/koa": "*",
"@types/koa__router": "*",
......@@ -4781,7 +4781,7 @@
"file-type": "^16.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"ns-require": "^1.1.2",
"ns-require": "^1.1.4",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"portfinder": "^1.0.28",
......@@ -4793,9 +4793,9 @@
}
},
"node_modules/koishi-decorators": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.6.tgz",
"integrity": "sha512-G1NN31fCIOafKkDME4YBzgHZ6J3b/CjsKr2AszZw9rmH6j7qHbs3PxXrkEK7zFSvTJh1RLHR2gDMhxqC7A3zTQ==",
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.7.tgz",
"integrity": "sha512-OoExVOdpVEmv8FywtdjR8JUPQtBz1P2rabkIfmt3SQpp3jrkm67EgdQNH+Nw8+6CfSDukMP3+/xWsA64VE5VEQ==",
"dependencies": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
......@@ -4806,7 +4806,7 @@
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"koishi": "^4.7.4"
"koishi": "^4.7.5"
}
},
"node_modules/leven": {
......@@ -5003,13 +5003,13 @@
}
},
"node_modules/minato": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.1.0.tgz",
"integrity": "sha512-by1KMWxWlzq0iDV7tMkqS3thDRzYNQoS2ECfX5HRpMGaPQJqSgm5aY9IAky7knwAMoW3cMxQ/IhpvEShQqyj6A==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.2.1.tgz",
"integrity": "sha512-BYY18rr82aXAAVtMKkN4yDFsTUtsAmeDmyTRVOXG3mEzG74sNF5TU1nVT1QSC9dpvAcCFFs/vZO2rJoC8vSetQ==",
"peer": true,
"dependencies": {
"cosmokit": "^1.1.2",
"ns-require": "^1.1.2"
"ns-require": "^1.1.4"
}
},
"node_modules/minato-decorators": {
......@@ -5133,9 +5133,9 @@
}
},
"node_modules/ns-require": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/ns-require/-/ns-require-1.1.2.tgz",
"integrity": "sha512-GUF6I1hWDsGx1cA9FW27KIRAlkMel2UZagR39dVNPAPBgwWK1Ez0XB96WEz2OFcwHsCORI9h75dEZueHqZ/1pA==",
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/ns-require/-/ns-require-1.1.4.tgz",
"integrity": "sha512-Zk25pQj4u5i6DS0vaNO5aSSXewybVqqVVjz8AOxFy9DNPtmu3jlexMz6kUXLV2oB+X6iQeAnHXSzj5Qz/IeDaQ==",
"peer": true
},
"node_modules/nwsapi": {
......@@ -7704,15 +7704,15 @@
}
},
"@koishijs/core": {
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.4.tgz",
"integrity": "sha512-S4pPaO05WC0htkQVcTMTluBZv4g8sEEBJ2ItHN2zJA8syet3iKJidT+s2gYt8d2rBo0Ndlvo1gBLGLNl/Zc9yg==",
"version": "4.7.5",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.7.5.tgz",
"integrity": "sha512-So8tBtSTVIq8dTGs/0o92Om3bQhgYUhmzVhnYTqJbx+kW3kSowl/ORiBhJFK3GR6Dj+JyKLptsqQNE4DjZdNhw==",
"peer": true,
"requires": {
"@koishijs/utils": "^5.4.5",
"cordis": "^1.3.3",
"cordis": "^1.5.5",
"fastest-levenshtein": "^1.0.12",
"minato": "^1.1.0"
"minato": "^1.2.1"
}
},
"@koishijs/plugin-adapter-onebot": {
......@@ -8729,9 +8729,9 @@
"peer": true
},
"cordis": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.3.3.tgz",
"integrity": "sha512-mpyBWAEVYX8/YHoGWIqaOjrOk6DmtrOWZfsBSinNR+nDBlB39Ks6aC1B5oZ7AdnVoRE2ZYBCGecoHrlxcRxd6w==",
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/cordis/-/cordis-1.5.5.tgz",
"integrity": "sha512-vCw6FA+OLO5e40so5XjhRnIw1ldGH1L74q/wlnuckqFtIq8teYkfnnmlNTS24RJNcgPz2DWdbVgCnoc+5Lc+UQ==",
"peer": true,
"requires": {
"cosmokit": "^1.1.2"
......@@ -10588,13 +10588,13 @@
}
},
"koishi": {
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.4.tgz",
"integrity": "sha512-VVHf3TyFsTuKrB8IZffxwmwiGx+zyhDo+DNNEFQjvomgqFdGEceAnLxNIf10K48aB1CDmkmi37b6uaURi4Z1Hw==",
"version": "4.7.5",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.7.5.tgz",
"integrity": "sha512-Q+czD5hZIsikYwdoKUOZFZIuvXoamikXK6iX4FXnHUPsoXX16PjqX3D1sBKd9JLVMA49KSAGoFW0fN9IMHykYw==",
"peer": true,
"requires": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.7.4",
"@koishijs/core": "^4.7.5",
"@koishijs/utils": "^5.4.5",
"@types/koa": "*",
"@types/koa__router": "*",
......@@ -10603,7 +10603,7 @@
"file-type": "^16.5.3",
"koa": "^2.13.4",
"koa-bodyparser": "^4.3.0",
"ns-require": "^1.1.2",
"ns-require": "^1.1.4",
"parseurl": "^1.3.3",
"path-to-regexp": "^6.2.1",
"portfinder": "^1.0.28",
......@@ -10612,9 +10612,9 @@
}
},
"koishi-decorators": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.6.tgz",
"integrity": "sha512-G1NN31fCIOafKkDME4YBzgHZ6J3b/CjsKr2AszZw9rmH6j7qHbs3PxXrkEK7zFSvTJh1RLHR2gDMhxqC7A3zTQ==",
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.1.7.tgz",
"integrity": "sha512-OoExVOdpVEmv8FywtdjR8JUPQtBz1P2rabkIfmt3SQpp3jrkm67EgdQNH+Nw8+6CfSDukMP3+/xWsA64VE5VEQ==",
"requires": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
......@@ -10773,13 +10773,13 @@
"dev": true
},
"minato": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.1.0.tgz",
"integrity": "sha512-by1KMWxWlzq0iDV7tMkqS3thDRzYNQoS2ECfX5HRpMGaPQJqSgm5aY9IAky7knwAMoW3cMxQ/IhpvEShQqyj6A==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/minato/-/minato-1.2.1.tgz",
"integrity": "sha512-BYY18rr82aXAAVtMKkN4yDFsTUtsAmeDmyTRVOXG3mEzG74sNF5TU1nVT1QSC9dpvAcCFFs/vZO2rJoC8vSetQ==",
"peer": true,
"requires": {
"cosmokit": "^1.1.2",
"ns-require": "^1.1.2"
"ns-require": "^1.1.4"
}
},
"minato-decorators": {
......@@ -10876,9 +10876,9 @@
}
},
"ns-require": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/ns-require/-/ns-require-1.1.2.tgz",
"integrity": "sha512-GUF6I1hWDsGx1cA9FW27KIRAlkMel2UZagR39dVNPAPBgwWK1Ez0XB96WEz2OFcwHsCORI9h75dEZueHqZ/1pA==",
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/ns-require/-/ns-require-1.1.4.tgz",
"integrity": "sha512-Zk25pQj4u5i6DS0vaNO5aSSXewybVqqVVjz8AOxFy9DNPtmu3jlexMz6kUXLV2oB+X6iQeAnHXSzj5Qz/IeDaQ==",
"peer": true
},
"nwsapi": {
......
......@@ -50,7 +50,7 @@
"dependencies": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"koishi-decorators": "^2.1.6",
"koishi-decorators": "^2.1.7",
"lodash": "^4.17.21",
"minato-decorators": "^2.0.7",
"reflect-metadata": "^0.1.13",
......@@ -75,7 +75,7 @@
"testEnvironment": "node"
},
"peerDependencies": {
"koishi": "^4.7.4",
"koishi": "^4.7.5",
"schemastery": "^3.4.3"
}
}
import 'reflect-metadata';
import { App, Context, Flatten, Keys, Schema, Selection, Tables } from 'koishi';
import { App, Context, Flatten, Keys, Schema, Tables } from 'koishi';
import { Metadata } from './meta/metadata.decorators';
import {
Condition,
......@@ -14,7 +14,12 @@ import {
ServiceName,
SystemInjectFun,
} from './def';
import { CallbackLayer, TopLevelAction } from 'koishi-decorators';
import {
CallbackLayer,
TopLevelAction,
Selection,
selectContext,
} from 'koishi-decorators';
import { ModelClassType, ModelRegistrar } from 'minato-decorators';
import { ClassType } from 'schemastery-gen';
......@@ -89,7 +94,7 @@ const InjectSystem = (fun: SystemInjectFun) =>
export const InjectContext = (select?: Selection) =>
InjectSystem((obj) => {
if (select) {
return obj.__ctx.select(select);
return selectContext(obj.__ctx, select);
} else {
return obj.__ctx;
}
......@@ -116,7 +121,7 @@ export function UsingService(
} else {
const dec = CallbackLayer((ctx, cb) => {
ctx.plugin({
name: `${ctx.state.id}_${key.toString()}`,
name: `${ctx.state.runtime.uid}_${key.toString()}`,
using: services,
apply: cb,
});
......
import { Context, Dict, Selection } from 'koishi';
import { Context, Dict } from 'koishi';
import { PluginMeta } from '../register';
import { Selection } from 'koishi-decorators';
export * from 'koishi-decorators/dist/src/def/interfaces';
......
......@@ -3,7 +3,7 @@ import { PluginClass } from '../../def';
import { BasePlugin, PartialDeep } from '../../base-plugin';
import { LifecycleEvents } from '../../register';
import { ClonePlugin } from '../../utility/clone-plugin';
import { Apply, UseEvent } from 'koishi-decorators';
import { Apply, selectContext, UseEvent } from 'koishi-decorators';
export class MappingPluginBase<
M extends Dict<PluginClass>,
......@@ -33,7 +33,7 @@ export class MappingPluginBase<
const config = this._getPluginConfig(key);
if (config == null) continue;
const ctx =
typeof config === 'object' ? this.ctx.select(config) : this.ctx;
typeof config === 'object' ? selectContext(this.ctx, config) : this.ctx;
const clonedPlugin = ClonePlugin(
plugin,
`${this.constructor.name}_${plugin.name}_dict_${key}`,
......
import { ClonePlugin } from '../utility/clone-plugin';
import { Selection } from 'koishi';
import { selectContext, Selection } from 'koishi-decorators';
import { BasePlugin } from '../base-plugin';
import {
ClassPluginConfig,
......@@ -39,7 +39,11 @@ export class MultiInstancePluginFramework<InnerPlugin extends PluginClass>
(instance) => this.instances.push(instance),
);
const instanceConfig = this.config.instances[i];
this.ctx.select(instanceConfig).plugin(clonedInnerPlugin, instanceConfig);
const instanceContext =
typeof instanceConfig === 'object'
? selectContext(this.ctx, instanceConfig)
: this.ctx;
instanceContext.plugin(clonedInnerPlugin, instanceConfig);
}
}
......
......@@ -2,7 +2,7 @@ import { DefinePlugin } from '../src/register';
import { RegisterSchema, SchemaProperty } from 'schemastery-gen';
import { BasePlugin } from '../src/base-plugin';
import { UseCommand } from 'koishi-decorators';
import { MultiInstancePlugin } from '../src/plugin-operators/multi-plugin';
import { MultiInstancePlugin } from '../src/plugin-operators';
import { App, Schema } from 'koishi';
class MessageConfig {
......
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