Commit 968035f1 authored by nanahira's avatar nanahira

bump things

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