1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

V5 bringing RESP3, Sentinel and TypeMapping to node-redis

RESP3 Support
   - Some commands responses in RESP3 aren't stable yet and therefore return an "untyped" ReplyUnion.
 
Sentinel

TypeMapping

Correctly types Multi commands

Note: some API changes to be further documented in v4-to-v5.md
This commit is contained in:
Shaya Potter
2024-10-15 17:46:52 +03:00
committed by GitHub
parent 2fc79bdfb3
commit b2d35c5286
1174 changed files with 45931 additions and 36274 deletions

View File

@@ -1,25 +1,31 @@
import { RedisCommandArguments } from '.';
import { BlobStringReply, Command } from '../RESP/types';
export type EventType =
'active-defrag-cycle'
| 'aof-fsync-always'
| 'aof-stat'
| 'aof-rewrite-diff-write'
| 'aof-rename'
| 'aof-write'
| 'aof-write-active-child'
| 'aof-write-alone'
| 'aof-write-pending-fsync'
| 'command'
| 'expire-cycle'
| 'eviction-cycle'
| 'eviction-del'
| 'fast-command'
| 'fork'
| 'rdb-unlink-temp-file';
export const LATENCY_EVENTS = {
ACTIVE_DEFRAG_CYCLE: 'active-defrag-cycle',
AOF_FSYNC_ALWAYS: 'aof-fsync-always',
AOF_STAT: 'aof-stat',
AOF_REWRITE_DIFF_WRITE: 'aof-rewrite-diff-write',
AOF_RENAME: 'aof-rename',
AOF_WRITE: 'aof-write',
AOF_WRITE_ACTIVE_CHILD: 'aof-write-active-child',
AOF_WRITE_ALONE: 'aof-write-alone',
AOF_WRITE_PENDING_FSYNC: 'aof-write-pending-fsync',
COMMAND: 'command',
EXPIRE_CYCLE: 'expire-cycle',
EVICTION_CYCLE: 'eviction-cycle',
EVICTION_DEL: 'eviction-del',
FAST_COMMAND: 'fast-command',
FORK: 'fork',
RDB_UNLINK_TEMP_FILE: 'rdb-unlink-temp-file'
} as const;
export function transformArguments(event: EventType): RedisCommandArguments {
export type LatencyEvent = typeof LATENCY_EVENTS[keyof typeof LATENCY_EVENTS];
export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments(event: LatencyEvent) {
return ['LATENCY', 'GRAPH', event];
}
export declare function transformReply(): string;
},
transformReply: undefined as unknown as () => BlobStringReply
} as const satisfies Command;