New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koishi-core

Package Overview
Dependencies
Maintainers
1
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koishi-core - npm Package Compare versions

Comparing version 1.10.0 to 1.10.1

24

dist/command.js

@@ -171,7 +171,9 @@ "use strict";

async execute(argv, next = koishi_utils_1.noop) {
const { meta, options = {}, args = [], unknown = [] } = argv;
this.app.emitEvent(meta, 'before-command', argv);
const options = argv.options || (argv.options = {});
const unknown = argv.unknown || (argv.unknown = []);
const args = argv.args || (argv.args = []);
this.app.emitEvent(argv.meta, 'before-command', argv);
// show help when use `-h, --help` or when there is no action
if (!this._action || options.help && !this.config.noHelpOption) {
return this.context.runCommand('help', meta, [this.name]);
return this.context.runCommand('help', argv.meta, [this.name]);
}

@@ -182,7 +184,7 @@ // check argument count

if (nextArg === null || nextArg === void 0 ? void 0 : nextArg.required) {
return this._sendHint(CommandHint.INSUFFICIENT_ARGUMENTS, meta);
return this._sendHint(CommandHint.INSUFFICIENT_ARGUMENTS, argv.meta);
}
const finalArg = this._argsDef[this._argsDef.length - 1];
if (args.length > this._argsDef.length && !finalArg.noSegment && !finalArg.variadic) {
return this._sendHint(CommandHint.REDUNANT_ARGUMENTS, meta);
return this._sendHint(CommandHint.REDUNANT_ARGUMENTS, argv.meta);
}

@@ -192,3 +194,3 @@ }

if (this.config.checkUnknown && unknown.length) {
return this._sendHint(CommandHint.UNKNOWN_OPTIONS, meta, unknown.join(', '));
return this._sendHint(CommandHint.UNKNOWN_OPTIONS, argv.meta, unknown.join(', '));
}

@@ -201,12 +203,12 @@ // check required options

if (absent) {
return this._sendHint(CommandHint.REQUIRED_OPTIONS, meta, absent.rawName);
return this._sendHint(CommandHint.REQUIRED_OPTIONS, argv.meta, absent.rawName);
}
}
// check authority and usage
const code = this._checkUser(meta, options);
const code = this._checkUser(argv.meta, options);
if (code)
return this._sendHint(code, meta);
return this._sendHint(code, argv.meta);
// execute command
this.context.logger('koishi:command').debug('execute %s', this.name);
this.app.emitEvent(meta, 'command', argv);
this.app.emitEvent(argv.meta, 'command', argv);
let skipped = false;

@@ -220,3 +222,3 @@ argv.next = (_next) => {

if (!skipped)
this.app.emitEvent(meta, 'after-command', argv);
this.app.emitEvent(argv.meta, 'after-command', argv);
}

@@ -223,0 +225,0 @@ catch (error) {

@@ -89,3 +89,3 @@ import { Observed } from 'koishi-utils';

_options?: InjectConfig<T>;
_manager?: DatabaseManager;
_managers?: DatabaseManager[];
}

@@ -92,0 +92,0 @@ export interface AbstractDatabase {

@@ -65,2 +65,3 @@ "use strict";

subdatabase._options = (_b = unknownOptions[name]) !== null && _b !== void 0 ? _b : {};
subdatabase._managers = [];
}

@@ -79,10 +80,4 @@ exports.registerDatabase = registerDatabase;

optionMap = Subdatabase._options;
if (Subdatabase._manager) {
// inject after application was created
Subdatabase._manager.injectMethods(name, table, methods);
methodMap = {};
}
else {
methodMap = Subdatabase._methods;
}
methodMap = Subdatabase._methods;
Subdatabase._managers.forEach(manager => manager.injectMethods(name, table, methods));
}

@@ -123,3 +118,3 @@ methodMap[table] = { ...methodMap[table], ...methods };

this.database[type] = subdatabase;
Subdatabase._manager = this;
Subdatabase._managers.push(this);
for (const table in Subdatabase._methods) {

@@ -126,0 +121,0 @@ this.injectMethods(type, table, Subdatabase._methods[table]);

{
"name": "koishi-core",
"description": "Core features for Koishi",
"version": "1.10.0",
"version": "1.10.1",
"main": "dist/index.js",

@@ -38,4 +38,4 @@ "typings": "dist/index.d.ts",

"get-port": "^5.1.1",
"koishi-database-memory": "^1.1.3",
"koishi-test-utils": "^3.1.2"
"koishi-database-memory": "^1.1.4",
"koishi-test-utils": "^3.1.3"
},

@@ -42,0 +42,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc