export { ZError } from './common/ZError.js'; export { SyncLocker } from './common/SyncLocker.js'; import { BaseController } from './common/base.controller.js'; export { ROLE_ANON } from './common/base.controller.js'; export { AsyncQueue, createAsyncQueue, createAsyncQueues } from './common/AsyncQueue.js'; import { RedisClient, ClientOpts } from 'redis'; type Callback = (...args: any[]) => void; declare class ZRedisClient { pub: RedisClient; sub: RedisClient; protected subscribeAsync: any; protected unsubscribeAsync: any; protected publishAsync: any; protected subscriptions: { [channel: string]: Callback[]; }; protected smembersAsync: any; protected sismemberAsync: any; protected hgetAsync: any; protected hlenAsync: any; protected pubsubAsync: any; protected incrAsync: any; protected decrAsync: any; constructor(opts?: ClientOpts); subscribe(topic: string, callback: Callback): Promise; unsubscribe(topic: string, callback?: Callback): Promise; publish(topic: string, data: any): Promise; exists(roomId: string): Promise; setex(key: string, value: string, seconds: number): Promise; expire(key: string, seconds: number): Promise; get(key: string): Promise; set(key: string, val: string): Promise; del(roomId: string): Promise; sadd(key: string, value: any): Promise; smembers(key: string): Promise; sismember(key: string, field: string): Promise; srem(key: string, value: any): Promise; scard(key: string): Promise; srandmember(key: string): Promise; sinter(...keys: string[]): Promise; zadd(key: string, value: any, member: string): Promise; zincrby(key: string, value: any, member: string): Promise; zrangebyscore(key: string, min: number, max: number): Promise; zcard(key: string): Promise; zcount(key: string, min: number, max: number): Promise; zrevrank(key: string, member: string): Promise; zscore(key: string, member: string): Promise; zrevrange(key: string, start: number, end: number): Promise; hset(key: string, field: string, value: string): Promise; hincrby(key: string, field: string, value: number): Promise; hget(key: string, field: string): Promise; hgetall(key: string): Promise<{ [key: string]: string; }>; hdel(key: string, field: string): Promise; hlen(key: string): Promise; incr(key: string): Promise; decr(key: string): Promise; protected handleSubscription: (channel: string, message: string) => void; } declare class RouterData { target?: any; method?: string; path?: string; fun?: Function; } declare class RouterMap { static decoratedRouters: Map; } declare function router(route?: string): (target: BaseController, name: string, value: PropertyDescriptor) => void; declare function role(roles?: string | string[]): (target: BaseController, name: string, value: PropertyDescriptor) => void; declare function permission(permissions?: string | string[]): (target: BaseController, name: string, value: PropertyDescriptor) => void; /** * If there is a dept modifier, you need to verify whether the department id exists. */ declare function dept(depts?: string | string[]): (target: BaseController, name: string, value: PropertyDescriptor) => void; /** * Singletonize a class * Usage: * @singleton * class Test {} * new Test() === new Test() // returns `true` * It can also be used without a decorator * const TestSingleton = singleton(Test) * new TestSingleton() === new TestSingleton() // returns `true` */ declare const SINGLETON_KEY: unique symbol; type Singleton any> = T & { [SINGLETON_KEY]: T extends new (...args: any[]) => infer I ? I : never; }; declare const singleton: any>(classTarget: T) => T; export { BaseController, RouterData, RouterMap, SINGLETON_KEY, type Singleton, ZRedisClient, dept, permission, role, router, singleton };