You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix graph
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { RedisArgument, Command, ArrayReply, BlobStringReply, NumberReply, NullReply, TuplesReply } from '@redis/client/dist/lib/RESP/types';
|
import { RedisArgument, ArrayReply, BlobStringReply, NumberReply, NullReply, TuplesReply, UnwrapReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
type Headers = ArrayReply<BlobStringReply>;
|
type Headers = ArrayReply<BlobStringReply>;
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ export default {
|
|||||||
FIRST_KEY_INDEX: 1,
|
FIRST_KEY_INDEX: 1,
|
||||||
IS_READ_ONLY: false,
|
IS_READ_ONLY: false,
|
||||||
transformArguments: transformQueryArguments.bind(undefined, 'GRAPH.QUERY'),
|
transformArguments: transformQueryArguments.bind(undefined, 'GRAPH.QUERY'),
|
||||||
transformReply(reply: QueryRawReply) {
|
transformReply(reply: UnwrapReply<QueryRawReply>) {
|
||||||
return reply.length === 1 ? {
|
return reply.length === 1 ? {
|
||||||
headers: undefined,
|
headers: undefined,
|
||||||
data: undefined,
|
data: undefined,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { RedisArgument, ArrayReply, TuplesReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
import { RedisArgument, ArrayReply, TuplesReply, BlobStringReply, UnwrapReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
type SlowLogRawReply = ArrayReply<TuplesReply<[
|
type SlowLogRawReply = ArrayReply<TuplesReply<[
|
||||||
timestamp: BlobStringReply,
|
timestamp: BlobStringReply,
|
||||||
@@ -13,12 +13,15 @@ export default {
|
|||||||
transformArguments(key: RedisArgument) {
|
transformArguments(key: RedisArgument) {
|
||||||
return ['GRAPH.SLOWLOG', key];
|
return ['GRAPH.SLOWLOG', key];
|
||||||
},
|
},
|
||||||
transformReply(reply: SlowLogRawReply) {
|
transformReply(reply: UnwrapReply<SlowLogRawReply>) {
|
||||||
return reply.map(([timestamp, command, query, took]) => ({
|
return reply.map(log => {
|
||||||
timestamp: Number(timestamp),
|
const [timestamp, command, query, took] = log as unknown as UnwrapReply<typeof log>;
|
||||||
command,
|
return {
|
||||||
query,
|
timestamp: Number(timestamp),
|
||||||
took: Number(took)
|
command,
|
||||||
}));
|
query,
|
||||||
|
took: Number(took)
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} as const satisfies Command;
|
} as const satisfies Command;
|
||||||
|
Reference in New Issue
Block a user