@kotori-bot/core
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,11 +0,13 @@ | ||
import { LocaleType } from '@kotori-bot/i18n'; | ||
export declare const OFFICIAL_MODULES_SCOPE = "@kotori-bot/"; | ||
export declare const PLUGIN_PREFIX = "kotori-plugin-"; | ||
export declare const DATABASE_PREFIX = "kotori-plugin-database-"; | ||
export declare const ADAPTER_PREFIX = "kotori-plugin-adapter-"; | ||
export declare const LOAD_MODULE_MAX_TIME: number; | ||
export declare const LOAD_MODULE_SLEEP_TIME = 150; | ||
export declare const DEFAULT_LANG: LocaleType; | ||
export declare const DEFAULT_ROOT_DIR = "./"; | ||
export declare const DEFAULT_MODULES_DIR = "./modules"; | ||
export declare const DEFAULT_COMMAND_PREFIX = "/"; | ||
export declare const DEFAULT_ENV = "dev"; | ||
export declare const CUSTOM_PREFIX = "kotori-plugin-custom-"; | ||
export declare const DEFAULT_CORE_CONFIG: { | ||
global: { | ||
lang: "en_US" | "en_GB" | "en_AU" | "zh_CN" | "zh_HK" | "zh_TW" | "zh_SG" | "es_ES" | "es_MX" | "ar_EG" | "ar_AE" | "ru_RU" | "fr_FR" | "fr_CA" | "de_DE" | "de_CH" | "it_IT" | "it_CH" | "hi_IN" | "pt_BR" | "pt_PT" | "tr_TR" | "ja_JP" | "id_ID" | "uk_UA" | "vi_VN" | "th_TH" | "sv_SE" | "nb_NO" | "da_DK" | "fi_FI" | "he_IL" | "sk_SK" | "bg_BG" | "lt_LT" | "sl_SI" | "sr_RS" | "mk_MK" | "sq_AL" | "et_EE" | "mt_MT"; | ||
'command-prefix': string; | ||
}; | ||
adapter: {}; | ||
plugin: {}; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_ENV = exports.DEFAULT_COMMAND_PREFIX = exports.DEFAULT_MODULES_DIR = exports.DEFAULT_ROOT_DIR = exports.DEFAULT_LANG = exports.LOAD_MODULE_SLEEP_TIME = exports.LOAD_MODULE_MAX_TIME = exports.ADAPTER_PREFIX = exports.PLUGIN_PREFIX = exports.OFFICIAL_MODULES_SCOPE = void 0; | ||
exports.DEFAULT_CORE_CONFIG = exports.CUSTOM_PREFIX = exports.ADAPTER_PREFIX = exports.DATABASE_PREFIX = exports.PLUGIN_PREFIX = exports.OFFICIAL_MODULES_SCOPE = void 0; | ||
const i18n_1 = require("@kotori-bot/i18n"); | ||
exports.OFFICIAL_MODULES_SCOPE = '@kotori-bot/'; | ||
exports.PLUGIN_PREFIX = 'kotori-plugin-'; | ||
exports.DATABASE_PREFIX = `${exports.PLUGIN_PREFIX}database-`; | ||
exports.ADAPTER_PREFIX = `${exports.PLUGIN_PREFIX}adapter-`; | ||
exports.LOAD_MODULE_MAX_TIME = 10 * 1000; | ||
exports.LOAD_MODULE_SLEEP_TIME = 150; | ||
exports.DEFAULT_LANG = 'en_US'; | ||
exports.DEFAULT_ROOT_DIR = './'; | ||
exports.DEFAULT_MODULES_DIR = './modules'; | ||
exports.DEFAULT_COMMAND_PREFIX = '/'; | ||
exports.DEFAULT_ENV = 'dev'; | ||
exports.CUSTOM_PREFIX = `${exports.PLUGIN_PREFIX}custom-`; | ||
exports.DEFAULT_CORE_CONFIG = { | ||
global: { | ||
lang: i18n_1.DEFAULT_LANG, | ||
'command-prefix': '/' | ||
}, | ||
adapter: {}, | ||
plugin: {} | ||
}; |
@@ -1,7 +0,8 @@ | ||
import Context from './context'; | ||
export * from './components/adapter'; | ||
export * from './components/api'; | ||
export * from './components/elements'; | ||
export * from './context'; | ||
export * from './components'; | ||
export * from './service'; | ||
export * from './utils/command'; | ||
export * from './utils/errror'; | ||
export * from './utils/commandError'; | ||
export * from './utils/container'; | ||
export * from './consts'; | ||
@@ -11,8 +12,1 @@ export * from './types'; | ||
export * from 'tsukiko'; | ||
export declare class ContextInstance { | ||
protected constructor(); | ||
private static instance; | ||
protected static setInstance(ctx: Context): void; | ||
static getInstance(): Context; | ||
static getMixin(): any; | ||
} |
@@ -17,9 +17,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ContextInstance = void 0; | ||
const tools_1 = require("@kotori-bot/tools"); | ||
__exportStar(require("./components/adapter"), exports); | ||
__exportStar(require("./components/api"), exports); | ||
__exportStar(require("./components/elements"), exports); | ||
__exportStar(require("./context"), exports); | ||
__exportStar(require("./components"), exports); | ||
__exportStar(require("./service"), exports); | ||
__exportStar(require("./utils/command"), exports); | ||
__exportStar(require("./utils/errror"), exports); | ||
__exportStar(require("./utils/commandError"), exports); | ||
__exportStar(require("./utils/container"), exports); | ||
__exportStar(require("./consts"), exports); | ||
@@ -29,17 +29,1 @@ __exportStar(require("./types"), exports); | ||
__exportStar(require("tsukiko"), exports); | ||
class ContextInstance { | ||
constructor() { | ||
(0, tools_1.none)(); | ||
} | ||
static instance = {}; | ||
static setInstance(ctx) { | ||
this.instance = ctx; | ||
} | ||
static getInstance() { | ||
return this.instance; | ||
} | ||
static getMixin() { | ||
return Object.assign(ContextInstance.getInstance() /* , Context */); | ||
} | ||
} | ||
exports.ContextInstance = ContextInstance; |
@@ -1,19 +0,15 @@ | ||
import type { DevErrorExtra } from '../types'; | ||
import CommandExtra from './commandExtra'; | ||
type KotoriErrorType = 'DatabaseError' | 'ModuleError' | 'CoreError' | 'UnknownError' | 'CommandError' | 'DevError'; | ||
type KotoriErrorLevel = 'debug' | 'normal' | 'log'; | ||
/// <reference types="node" /> | ||
type KotoriErrorType = 'DatabaseError' | 'ModuleError' | 'UnknownError' | 'DevError'; | ||
interface KotoriErrorImpl { | ||
readonly name: KotoriErrorType; | ||
readonly level: KotoriErrorLevel; | ||
readonly extend: () => typeof KotoriError; | ||
} | ||
export declare class KotoriError<T extends object = object> extends Error implements KotoriErrorImpl { | ||
constructor(message?: string, extra?: T, type?: KotoriErrorType, level?: KotoriErrorLevel); | ||
constructor(message?: string, extra?: T, type?: KotoriErrorType); | ||
readonly extra?: T; | ||
readonly name: KotoriErrorType; | ||
readonly level: KotoriErrorLevel; | ||
extend(): typeof KotoriError<T>; | ||
} | ||
export declare const ModuleError: { | ||
new (message?: string, extra?: object | undefined, type?: KotoriErrorType, level?: KotoriErrorLevel): KotoriError<object>; | ||
new (message?: string, extra?: object | undefined, type?: KotoriErrorType): KotoriError<object>; | ||
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; | ||
@@ -23,16 +19,4 @@ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; | ||
}; | ||
export declare const CoreError: { | ||
new (message?: string, extra?: object | undefined, type?: KotoriErrorType, level?: KotoriErrorLevel): KotoriError<object>; | ||
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; | ||
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; | ||
stackTraceLimit: number; | ||
}; | ||
export declare const CommandError: { | ||
new (message?: string, extra?: CommandExtra | undefined, type?: KotoriErrorType, level?: KotoriErrorLevel): KotoriError<CommandExtra>; | ||
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; | ||
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; | ||
stackTraceLimit: number; | ||
}; | ||
export declare const DevError: { | ||
new (message?: string, extra?: DevErrorExtra | undefined, type?: KotoriErrorType, level?: KotoriErrorLevel): KotoriError<DevErrorExtra>; | ||
new (message?: string, extra?: object | undefined, type?: KotoriErrorType): KotoriError<object>; | ||
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; | ||
@@ -39,0 +23,0 @@ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DevError = exports.CommandError = exports.CoreError = exports.ModuleError = exports.KotoriError = void 0; | ||
exports.DevError = exports.ModuleError = exports.KotoriError = void 0; | ||
class KotoriError extends Error { | ||
constructor(message, extra, type = 'UnknownError', level = 'debug') { | ||
constructor(message, extra, type = 'UnknownError') { | ||
super(message); | ||
this.name = type; | ||
this.level = level; | ||
this.extra = extra; | ||
@@ -13,8 +12,7 @@ } | ||
name; | ||
level; | ||
extend() { | ||
const { message: fatherMessage, name: fatherType, level: fatherLevel, extra: fatherExtra } = this; | ||
// const newConstructor: typeof KotoriError = Object.create(KotoriError); | ||
const { message: fatherMessage, name: fatherType, extra: fatherExtra } = this; | ||
// const newClass: typeof KotoriError = Object.create(KotoriError); | ||
return new Proxy((KotoriError), { | ||
construct(Constructor, params) { | ||
construct(Class, params) { | ||
const args = params; | ||
@@ -24,5 +22,4 @@ args[0] = `${fatherMessage} ${args[0]}`; | ||
args[2] = args[2] ?? fatherType; | ||
args[3] = args[3] ?? fatherLevel; | ||
return new Constructor(...args); | ||
}, | ||
return new Class(...args); | ||
} | ||
}); | ||
@@ -32,6 +29,4 @@ } | ||
exports.KotoriError = KotoriError; | ||
exports.ModuleError = new KotoriError(undefined, undefined, 'ModuleError', 'normal').extend(); | ||
exports.CoreError = new KotoriError(undefined, undefined, 'CoreError', 'normal').extend(); | ||
exports.CommandError = new KotoriError(undefined, undefined, 'CommandError', 'normal').extend(); | ||
exports.DevError = new KotoriError(undefined, undefined, 'DevError', 'debug').extend(); | ||
exports.ModuleError = new KotoriError(undefined, undefined, 'ModuleError').extend(); | ||
exports.DevError = new KotoriError(undefined, undefined, 'DevError').extend(); | ||
exports.default = KotoriError; |
{ | ||
"name": "@kotori-bot/core", | ||
"version": "v1.1.0", | ||
"version": "v1.2.0", | ||
"description": "Kotori Core", | ||
@@ -9,8 +9,10 @@ "main": "lib/index.js", | ||
"keywords": [ | ||
"kotori", | ||
"chatbot", | ||
"bot", | ||
"kotori" | ||
"bot" | ||
], | ||
"files": [ | ||
"lib" | ||
"lib", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
@@ -26,7 +28,8 @@ "bugs": { | ||
"dependencies": { | ||
"@types/minimist": "^1.2.5", | ||
"minimist": "^1.2.8", | ||
"tsukiko": "^1.2.1", | ||
"@kotori-bot/i18n": "^1.1.2", | ||
"@kotori-bot/tools": "^1.1.0", | ||
"@kotori-bot/logger": "^1.0.0" | ||
"@kotori-bot/i18n": "^v1.2.0", | ||
"@kotori-bot/tools": "^v1.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
61
1
6
2
105917
5
1879
2
+ Added@types/minimist@^1.2.5
+ Addedminimist@^1.2.8
+ Added@types/minimist@1.2.5(transitive)
+ Addedminimist@1.2.8(transitive)
- Removed@kotori-bot/logger@^1.0.0
- Removed@kotori-bot/logger@1.3.2(transitive)
- Removeddayjs@1.11.13(transitive)
- Removedfast-safe-stringify@2.1.1(transitive)
Updated@kotori-bot/i18n@^v1.2.0
Updated@kotori-bot/tools@^v1.2.0