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

@koishijs/core

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@koishijs/core - npm Package Compare versions

Comparing version 4.17.7 to 4.17.8

40

lib/index.d.ts

@@ -7,6 +7,6 @@ import * as utils from '@koishijs/utils';

import { Driver, FlatKeys, FlatPick, Update, Eval } from 'minato';
import { Fragment, h, Schema, Universal, Bot, HTTP } from '@satorijs/core';
import { Fragment, EventOptions, h, Schema, Universal, Bot, HTTP } from '@satorijs/core';
import { LocaleTree } from '@koishijs/i18n-utils';
import { Disposable, GetEvents, Parameters, ReturnType, ThisType } from 'cordis';
import { version } from '../package.json';
import { version } from '../package';
export interface Context {

@@ -142,3 +142,3 @@ [minato.Types]: Types;

private ctx;
_hooks: [Context, Middleware][];
_hooks: [Context, Middleware, EventOptions][];
_sessions: Dict<Session>;

@@ -150,3 +150,3 @@ _userCache: SharedCache<User.Observed<keyof User>>;

protected get caller(): Context;
middleware(middleware: Middleware, prepend?: boolean): any;
middleware(middleware: Middleware, options?: boolean | EventOptions): any;
match(pattern: string | RegExp, response: Matcher.Response, options: Matcher.Options): () => void;

@@ -225,10 +225,8 @@ private _executeMatcher;

}
declare module '@satorijs/core' {
interface Context {
permissions: Permissions;
}
interface Events {
'internal/permission'(): void;
}
export interface Context {
permissions: Permissions;
}
export interface Events {
'internal/permission'(): void;
}
export namespace Permissions {

@@ -653,18 +651,2 @@ type Links<P extends string> = undefined | string[] | ((data: MatchResult<P>) => undefined | string[]);

}
declare module '@satorijs/core' {
interface Context {
schema: SchemaService;
}
interface Events {
'internal/schema'(name: string): void;
}
}
export class SchemaService {
ctx: Context;
_data: Dict<Schema>;
constructor(ctx: Context);
extend(name: string, schema: Schema, order?: number): void;
get(name: string): Schema;
set(name: string, schema: Schema): void;
}
export type EffectScope = cordis.EffectScope<Context>;

@@ -691,3 +673,3 @@ export type ForkScope = cordis.ForkScope<Context>;

};
export interface Events<C extends Context = Context> extends satori.Events<C> {
export interface Events<C extends Context = Context> extends cordis.Events<C> {
}

@@ -705,4 +687,6 @@ export interface Context {

get options(): any;
/** @deprecated */
waterfall<K extends keyof GetEvents<this>>(name: K, ...args: Parameters<GetEvents<this>[K]>): Promisify<ReturnType<GetEvents<this>[K]>>;
waterfall<K extends keyof GetEvents<this>>(thisArg: ThisType<GetEvents<this>[K]>, name: K, ...args: Parameters<GetEvents<this>[K]>): Promisify<ReturnType<GetEvents<this>[K]>>;
/** @deprecated */
chain<K extends keyof GetEvents<this>>(name: K, ...args: Parameters<GetEvents<this>[K]>): ReturnType<GetEvents<this>[K]>;

@@ -709,0 +693,0 @@ chain<K extends keyof GetEvents<this>>(thisArg: ThisType<GetEvents<this>[K]>, name: K, ...args: Parameters<GetEvents<this>[K]>): ReturnType<GetEvents<this>[K]>;

{
"name": "@koishijs/core",
"description": "Core Features for Koishi",
"version": "4.17.7",
"version": "4.17.8",
"main": "lib/index.cjs",

@@ -36,8 +36,8 @@ "module": "lib/index.mjs",

"@koishijs/utils": "^7.2.1",
"@satorijs/core": "^4.1.0",
"cordis": "^3.15.3",
"@satorijs/core": "^4.1.1",
"cordis": "^3.16.1",
"cosmokit": "^1.6.2",
"fastest-levenshtein": "^1.0.16",
"minato": "^3.3.0"
"minato": "^3.4.0"
}
}

@@ -11,3 +11,2 @@ import { defineProperty, Promisify, Time } from 'cosmokit'

import { Processor } from './middleware'
import { SchemaService } from './schema'
import { Permissions } from './permission'

@@ -42,3 +41,3 @@ import { KoishiDatabase } from './database'

export interface Events<C extends Context = Context> extends satori.Events<C> {}
export interface Events<C extends Context = Context> extends cordis.Events<C> {}

@@ -64,3 +63,2 @@ export interface Context {

this.provide('i18n', new I18n(this, this.config.i18n), true)
this.provide('schema', new SchemaService(this), true)
this.provide('permissions', new Permissions(this), true)

@@ -85,2 +83,3 @@ this.provide('model', undefined, true)

/* eslint-disable max-len */
/** @deprecated */
waterfall<K extends keyof GetEvents<this>>(name: K, ...args: Parameters<GetEvents<this>[K]>): Promisify<ReturnType<GetEvents<this>[K]>>

@@ -98,2 +97,3 @@ waterfall<K extends keyof GetEvents<this>>(thisArg: ThisType<GetEvents<this>[K]>, name: K, ...args: Parameters<GetEvents<this>[K]>): Promisify<ReturnType<GetEvents<this>[K]>>

/** @deprecated */
chain<K extends keyof GetEvents<this>>(name: K, ...args: Parameters<GetEvents<this>[K]>): ReturnType<GetEvents<this>[K]>

@@ -100,0 +100,0 @@ chain<K extends keyof GetEvents<this>>(thisArg: ThisType<GetEvents<this>[K]>, name: K, ...args: Parameters<GetEvents<this>[K]>): ReturnType<GetEvents<this>[K]>

import { defineProperty } from 'cosmokit'
import { Eval } from 'minato'
import { Schema } from '@satorijs/core'
import { Channel, User } from './database'

@@ -108,1 +109,62 @@ import { Context } from './context'

}
declare global {
interface Schemastery<S, T> {
computed(options?: Computed.Options): Schema<Computed<S>, Computed<T>>
}
namespace Schemastery {
interface Static {
path(options?: Path.Options): Schema<string>
filter(): Schema<Computed<boolean>>
computed<X>(inner: X, options?: Computed.Options): Schema<Computed<TypeS<X>>, Computed<TypeT<X>>>
dynamic(name: string): Schema
}
namespace Path {
interface Options {
filters?: Filter[]
allowCreate?: boolean
}
type Filter = FileFilter | 'file' | 'directory'
interface FileFilter {
name: string
extensions: string[]
}
}
}
}
Schema.dynamic = function dynamic(name) {
return Schema.any().role('dynamic', { name }) as never
}
Schema.filter = function filter() {
return Schema.any().role('filter')
}
Schema.computed = function computed(inner, options = {}) {
return Schema.union([
Schema.from(inner),
Schema.object({
$switch: Schema.object({
branches: Schema.array(Schema.object({
case: Schema.any(),
then: Schema.from(inner),
})),
default: Schema.from(inner),
}),
}).hidden(),
Schema.any().hidden(),
]).role('computed', options)
}
Schema.path = function path(options = {}) {
return Schema.string().role('path', options)
}
Schema.prototype.computed = function computed(this: Schema, options = {}) {
return Schema.computed(this, options).default(this.meta.default)
}

@@ -11,3 +11,2 @@ // @ts-ignore

export * from './middleware'
export * from './schema'
export * from './session'

@@ -14,0 +13,0 @@ export * from './permission'

import { coerce, makeArray, Random } from '@koishijs/utils'
import { Awaitable, defineProperty, Dict, Time } from 'cosmokit'
import { Fragment, h } from '@satorijs/core'
import { EventOptions, Fragment, h } from '@satorijs/core'
import { Context } from './context'

@@ -65,3 +65,3 @@ import { Channel, User } from './database'

export class Processor {
_hooks: [Context, Middleware][] = []
_hooks: [Context, Middleware, EventOptions][] = []
_sessions: Dict<Session> = Object.create(null)

@@ -140,4 +140,7 @@ _userCache = new SharedCache<User.Observed<keyof User>>()

middleware(middleware: Middleware, prepend = false) {
return this.caller.lifecycle.register('middleware', this._hooks, middleware, prepend)
middleware(middleware: Middleware, options?: boolean | EventOptions) {
if (typeof options !== 'object') {
options = { prepend: options }
}
return this.caller.lifecycle.register('middleware', this._hooks, middleware, options)
}

@@ -144,0 +147,0 @@

@@ -9,3 +9,3 @@ import { Logger } from '@satorijs/core'

declare module '@satorijs/core' {
declare module './context' {
interface Context {

@@ -12,0 +12,0 @@ permissions: Permissions

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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