UNPKG

@valkey/client

Version:

The source code and documentation for this package are in the main [node-redis](https://github.com/redis/node-redis) repo.

219 lines (218 loc) 9.71 kB
import { ValkeyCommandArgument, ValkeyCommandArguments } from "."; export declare function transformBooleanReply(reply: number): boolean; export declare function transformBooleanArrayReply(reply: Array<number>): Array<boolean>; export type BitValue = 0 | 1; export interface ScanOptions { MATCH?: string; COUNT?: number; } export declare function pushScanArguments(args: ValkeyCommandArguments, cursor: number, options?: ScanOptions): ValkeyCommandArguments; export declare function transformNumberInfinityReply(reply: ValkeyCommandArgument): number; export declare function transformNumberInfinityNullReply(reply: ValkeyCommandArgument | null): number | null; export declare function transformNumberInfinityNullArrayReply(reply: Array<ValkeyCommandArgument | null>): Array<number | null>; export declare function transformNumberInfinityArgument(num: number): string; export declare function transformStringNumberInfinityArgument(num: ValkeyCommandArgument | number): ValkeyCommandArgument; export declare function transformTuplesReply(reply: Array<ValkeyCommandArgument>): Record<string, ValkeyCommandArgument>; export interface StreamMessageReply { id: ValkeyCommandArgument; message: Record<string, ValkeyCommandArgument>; } export declare function transformStreamMessageReply([id, message,]: Array<any>): StreamMessageReply; export declare function transformStreamMessageNullReply(reply: Array<any>): StreamMessageReply | null; export type StreamMessagesReply = Array<StreamMessageReply>; export declare function transformStreamMessagesReply(reply: Array<any>): StreamMessagesReply; export type StreamMessagesNullReply = Array<StreamMessageReply | null>; export declare function transformStreamMessagesNullReply(reply: Array<any>): StreamMessagesNullReply; export type StreamsMessagesReply = Array<{ name: ValkeyCommandArgument; messages: StreamMessagesReply; }> | null; export declare function transformStreamsMessagesReply(reply: Array<any> | null): StreamsMessagesReply | null; export interface ZMember { score: number; value: ValkeyCommandArgument; } export declare function transformSortedSetMemberNullReply(reply: [ValkeyCommandArgument, ValkeyCommandArgument] | []): ZMember | null; export declare function transformSortedSetMemberReply(reply: [ValkeyCommandArgument, ValkeyCommandArgument]): ZMember; export declare function transformSortedSetWithScoresReply(reply: Array<ValkeyCommandArgument>): Array<ZMember>; export type SortedSetSide = "MIN" | "MAX"; export interface ZMPopOptions { COUNT?: number; } export declare function transformZMPopArguments(args: ValkeyCommandArguments, keys: ValkeyCommandArgument | Array<ValkeyCommandArgument>, side: SortedSetSide, options?: ZMPopOptions): ValkeyCommandArguments; export type ListSide = "LEFT" | "RIGHT"; export interface LMPopOptions { COUNT?: number; } export declare function transformLMPopArguments(args: ValkeyCommandArguments, keys: ValkeyCommandArgument | Array<ValkeyCommandArgument>, side: ListSide, options?: LMPopOptions): ValkeyCommandArguments; type GeoCountArgument = number | { value: number; ANY?: true; }; export declare function pushGeoCountArgument(args: ValkeyCommandArguments, count: GeoCountArgument | undefined): ValkeyCommandArguments; export type GeoUnits = "m" | "km" | "mi" | "ft"; export interface GeoCoordinates { longitude: string | number; latitude: string | number; } type GeoSearchFromMember = string; export type GeoSearchFrom = GeoSearchFromMember | GeoCoordinates; interface GeoSearchByRadius { radius: number; unit: GeoUnits; } interface GeoSearchByBox { width: number; height: number; unit: GeoUnits; } export type GeoSearchBy = GeoSearchByRadius | GeoSearchByBox; export interface GeoSearchOptions { SORT?: "ASC" | "DESC"; COUNT?: GeoCountArgument; } export declare function pushGeoSearchArguments(args: ValkeyCommandArguments, key: ValkeyCommandArgument, from: GeoSearchFrom, by: GeoSearchBy, options?: GeoSearchOptions): ValkeyCommandArguments; export declare function pushGeoRadiusArguments(args: ValkeyCommandArguments, key: ValkeyCommandArgument, from: GeoSearchFrom, radius: number, unit: GeoUnits, options?: GeoSearchOptions): ValkeyCommandArguments; export interface GeoRadiusStoreOptions extends GeoSearchOptions { STOREDIST?: boolean; } export declare function pushGeoRadiusStoreArguments(args: ValkeyCommandArguments, key: ValkeyCommandArgument, from: GeoSearchFrom, radius: number, unit: GeoUnits, destination: ValkeyCommandArgument, options?: GeoRadiusStoreOptions): ValkeyCommandArguments; export declare enum GeoReplyWith { DISTANCE = "WITHDIST", HASH = "WITHHASH", COORDINATES = "WITHCOORD" } export interface GeoReplyWithMember { member: string; distance?: number; hash?: string; coordinates?: { longitude: string; latitude: string; }; } export declare function transformGeoMembersWithReply(reply: Array<Array<any>>, replyWith: Array<GeoReplyWith>): Array<GeoReplyWithMember>; export declare function transformEXAT(EXAT: number | Date): string; export declare function transformPXAT(PXAT: number | Date): string; export interface EvalOptions { keys?: Array<string>; arguments?: Array<string>; } export declare function evalFirstKeyIndex(options?: EvalOptions): string | undefined; export declare function pushEvalArguments(args: Array<string>, options?: EvalOptions): Array<string>; export declare function pushVerdictArguments(args: ValkeyCommandArguments, value: ValkeyCommandArgument | Array<ValkeyCommandArgument>): ValkeyCommandArguments; export declare function pushVerdictNumberArguments(args: ValkeyCommandArguments, value: number | Array<number>): ValkeyCommandArguments; export declare function pushVerdictArgument(args: ValkeyCommandArguments, value: ValkeyCommandArgument | Array<ValkeyCommandArgument>): ValkeyCommandArguments; export declare function pushOptionalVerdictArgument(args: ValkeyCommandArguments, name: ValkeyCommandArgument, value: undefined | ValkeyCommandArgument | Array<ValkeyCommandArgument>): ValkeyCommandArguments; export declare enum CommandFlags { WRITE = "write",// command may result in modifications READONLY = "readonly",// command will never modify keys DENYOOM = "denyoom",// reject command if currently out of memory ADMIN = "admin",// server admin command PUBSUB = "pubsub",// pubsub-related command NOSCRIPT = "noscript",// deny this command from scripts RANDOM = "random",// command has random results, dangerous for scripts SORT_FOR_SCRIPT = "sort_for_script",// if called from script, sort output LOADING = "loading",// allow command while database is loading STALE = "stale",// allow command while replica has stale data SKIP_MONITOR = "skip_monitor",// do not show this command in MONITOR ASKING = "asking",// cluster related - accept even if importing FAST = "fast",// command operates in constant or log(N) time. Used for latency monitoring. MOVABLEKEYS = "movablekeys" } export declare enum CommandCategories { KEYSPACE = "@keyspace", READ = "@read", WRITE = "@write", SET = "@set", SORTEDSET = "@sortedset", LIST = "@list", HASH = "@hash", STRING = "@string", BITMAP = "@bitmap", HYPERLOGLOG = "@hyperloglog", GEO = "@geo", STREAM = "@stream", PUBSUB = "@pubsub", ADMIN = "@admin", FAST = "@fast", SLOW = "@slow", BLOCKING = "@blocking", DANGEROUS = "@dangerous", CONNECTION = "@connection", TRANSACTION = "@transaction", SCRIPTING = "@scripting" } export type CommandRawReply = [ name: string, arity: number, flags: Array<CommandFlags>, firstKeyIndex: number, lastKeyIndex: number, step: number, categories: Array<CommandCategories> ]; export type CommandReply = { name: string; arity: number; flags: Set<CommandFlags>; firstKeyIndex: number; lastKeyIndex: number; step: number; categories: Set<CommandCategories>; }; export declare function transformCommandReply(this: void, [name, arity, flags, firstKeyIndex, lastKeyIndex, step, categories,]: CommandRawReply): CommandReply; export declare enum ValkeyFunctionFlags { NO_WRITES = "no-writes", ALLOW_OOM = "allow-oom", ALLOW_STALE = "allow-stale", NO_CLUSTER = "no-cluster" } export type FunctionListRawItemReply = [ "library_name", string, "engine", string, "functions", Array<[ "name", string, "description", string | null, "flags", Array<ValkeyFunctionFlags> ]> ]; export interface FunctionListItemReply { libraryName: string; engine: string; functions: Array<{ name: string; description: string | null; flags: Array<ValkeyFunctionFlags>; }>; } export declare function transformFunctionListItemReply(reply: FunctionListRawItemReply): FunctionListItemReply; export interface SortOptions { BY?: string; LIMIT?: { offset: number; count: number; }; GET?: string | Array<string>; DIRECTION?: "ASC" | "DESC"; ALPHA?: true; } export declare function pushSortArguments(args: ValkeyCommandArguments, options?: SortOptions): ValkeyCommandArguments; export interface SlotRange { start: number; end: number; } export declare function pushSlotRangesArguments(args: ValkeyCommandArguments, ranges: SlotRange | Array<SlotRange>): ValkeyCommandArguments; export type RawRangeReply = [start: number, end: number]; export interface RangeReply { start: number; end: number; } export declare function transformRangeReply([start, end]: RawRangeReply): RangeReply; export {};