import type { Nullable, UnknownObject } from "../utils"; export interface IRedisTunnel { readonly hash: NRedisTunnel.Hash; readonly hashMulti: NRedisTunnel.HashMulti; readonly keys: NRedisTunnel.Keys; readonly set: NRedisTunnel.Set; readonly streams: NRedisTunnel.Streams; } export namespace NRedisTunnel { export type Repository = { hash: Hash; hashMulti: HashMulti; keys: Keys; set: Set; }; export type Hash = { hsetWithExpire( id: string, info: T, ttl: number ): Promise; hset(id: string, data: T): Promise; hgetall(id: string): Promise>; getHashById(id: string): Promise; }; export type Keys = { checkOne(id: string): Promise; getAll(id: string): Promise; rename(oldKey: string, newKey: string): Promise<"OK">; delete(id: string): Promise; }; export type HashMulti = { hmset( id: string, field: keyof T, value: T[keyof T] ): Promise; hset( id: string, field: keyof T, value: T[keyof T] ): Promise; }; export type Set = { get(id: string): Promise>; add(id: string, value: string[]): Promise; addWithTTl(id: string, value: string[], ttl: number): Promise; update(id: string, value: string[]): Promise; remove(id: string, item: string | string[]): Promise; }; export type Streams = { addExpiredStream(name: string, item: T, ttl: number): Promise; addExpiredStreams(item: T[], ttl: number): Promise; }; }