@koishijs/core
Advanced tools
Comparing version 4.10.4 to 4.10.5
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
import { Fragment, Context, Render, Session, Schema, segment, Events, Logger } from '@satorijs/core'; | ||
import { Database, Driver, Result, Update } from '@minatojs/core'; | ||
import { Database, Driver, Update } from '@minatojs/core'; | ||
import { Disposable, GetEvents, Parameters, ReturnType, ThisType } from 'cordis'; | ||
@@ -72,10 +72,10 @@ import { version } from '../package.json'; | ||
constructor(app: Context); | ||
getUser<T extends string, K extends User.Field>(platform: T, id: string, modifier?: Driver.Cursor<K>): Promise<Result<User, K> & Record<T, string>>; | ||
getUser<T extends string, K extends User.Field>(platform: T, ids: string[], modifier?: Driver.Cursor<K>): Promise<Result<User, K>[]>; | ||
getUser<T extends string, K extends User.Field>(platform: T, id: string, modifier?: Driver.Cursor<K>): Promise<Pick<User, K> & Record<T, string>>; | ||
getUser<T extends string, K extends User.Field>(platform: T, ids: string[], modifier?: Driver.Cursor<K>): Promise<Pick<User, K>[]>; | ||
setUser(platform: string, id: string, data: Update<User>): Promise<void>; | ||
createUser(platform: string, id: string, data: Partial<User>): Promise<User>; | ||
getChannel<K extends Channel.Field>(platform: string, id: string, modifier?: Driver.Cursor<K>): Promise<Result<Channel, K | 'id' | 'platform'>>; | ||
getChannel<K extends Channel.Field>(platform: string, ids: string[], modifier?: Driver.Cursor<K>): Promise<Result<Channel, K>[]>; | ||
getChannel<K extends Channel.Field>(platform: string, id: string, modifier?: Driver.Cursor<K>): Promise<Pick<Channel, K | 'id' | 'platform'>>; | ||
getChannel<K extends Channel.Field>(platform: string, ids: string[], modifier?: Driver.Cursor<K>): Promise<Pick<Channel, K>[]>; | ||
getSelfIds(type?: string, assignees?: string[]): Dict<string[]>; | ||
getAssignedChannels<K extends Channel.Field>(fields?: K[], assignMap?: Dict<string[]>): Promise<Result<Channel, K>[]>; | ||
getAssignedChannels<K extends Channel.Field>(fields?: K[], assignMap?: Dict<string[]>): Promise<Pick<Channel, K>[]>; | ||
setChannel(platform: string, id: string, data: Update<Channel>): Promise<void>; | ||
@@ -91,6 +91,6 @@ createChannel(platform: string, id: string, data: Partial<Channel>): Promise<Channel>; | ||
middleware(middleware: Middleware, prepend?: boolean): () => boolean; | ||
match(pattern: string | RegExp, response: Fragment, options?: Internal.MatchOptions & { | ||
match(pattern: string | RegExp, response: Fragment, options?: Matcher.Options & { | ||
i18n?: false; | ||
}): () => boolean; | ||
match(pattern: string, response: string, options: Internal.MatchOptions & { | ||
match(pattern: string, response: string, options: Matcher.Options & { | ||
i18n: true; | ||
@@ -123,2 +123,15 @@ }): () => boolean; | ||
} | ||
export interface Matcher extends Matcher.Options { | ||
context: Context; | ||
pattern: string | RegExp; | ||
response: Matcher.Response; | ||
} | ||
export namespace Matcher { | ||
type Response = Fragment | ((session: Session, params: [string, ...string[]]) => Awaitable<Fragment>); | ||
interface Options { | ||
i18n?: boolean; | ||
appel?: boolean; | ||
fuzzy?: boolean; | ||
} | ||
} | ||
export namespace Internal { | ||
@@ -129,12 +142,2 @@ interface Config { | ||
} | ||
interface Matcher extends MatchOptions { | ||
context: Context; | ||
pattern: string | RegExp; | ||
response: Fragment; | ||
} | ||
interface MatchOptions { | ||
i18n?: boolean; | ||
appel?: boolean; | ||
fuzzy?: boolean; | ||
} | ||
} | ||
@@ -151,3 +154,3 @@ export class Internal { | ||
_components: Dict<Component>; | ||
_matchers: Set<Internal.Matcher>; | ||
_matchers: Set<Matcher>; | ||
constructor(ctx: Context, config: Internal.Config); | ||
@@ -157,3 +160,4 @@ protected get caller(): Context; | ||
component(name: string, component: Component): () => boolean; | ||
match(pattern: string | RegExp, response: Fragment, options: Internal.MatchOptions): () => boolean; | ||
match(pattern: string | RegExp, response: Matcher.Response, options: Matcher.Options): () => boolean; | ||
private _executeMatcher; | ||
prepare(): void; | ||
@@ -473,3 +477,3 @@ private _resolvePrefixes; | ||
sendQueued(content: Fragment, delay?: number): Promise<string[]>; | ||
resolveValue<T>(source: T | ((session: Session) => T)): T; | ||
resolveValue<T, R extends any[]>(source: T | ((session: Session, ...args: R) => T), ...args: R): T; | ||
getChannel<K extends Channel.Field = never>(id?: string, fields?: K[]): Promise<Channel>; | ||
@@ -491,3 +495,3 @@ observeChannel<T extends Channel.Field = never>(fields?: Iterable<T>): Promise<Channel.Observed<T | G>>; | ||
transform(elements: segment[]): Promise<segment[]>; | ||
response?: Fragment; | ||
response?: () => Promise<Fragment>; | ||
} | ||
@@ -494,0 +498,0 @@ namespace Session { |
{ | ||
"name": "@koishijs/core", | ||
"description": "Core Features for Koishi", | ||
"version": "4.10.4", | ||
"version": "4.10.5", | ||
"main": "lib/index.cjs", | ||
@@ -34,8 +34,8 @@ "module": "lib/index.mjs", | ||
"@koishijs/utils": "^6.2.6", | ||
"@minatojs/core": "^2.0.1", | ||
"@satorijs/core": "^1.4.3", | ||
"@minatojs/core": "^2.0.3", | ||
"@satorijs/core": "^1.4.4", | ||
"cordis": "^2.6.0", | ||
"cosmokit": "^1.3.3", | ||
"cosmokit": "^1.3.4", | ||
"fastest-levenshtein": "^1.0.16" | ||
} | ||
} |
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
478114
4863
Updated@minatojs/core@^2.0.3
Updated@satorijs/core@^1.4.4
Updatedcosmokit@^1.3.4