From 418f1f9ac848eefdb06538b4992c5431635feb6c Mon Sep 17 00:00:00 2001 From: Leibale Date: Thu, 13 Jul 2023 14:13:23 -0400 Subject: [PATCH] fix graph --- packages/graph/lib/commands/QUERY.ts | 4 ++-- packages/graph/lib/commands/SLOWLOG.ts | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/graph/lib/commands/QUERY.ts b/packages/graph/lib/commands/QUERY.ts index b86382a49d..c77406ff4f 100644 --- a/packages/graph/lib/commands/QUERY.ts +++ b/packages/graph/lib/commands/QUERY.ts @@ -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; @@ -89,7 +89,7 @@ export default { FIRST_KEY_INDEX: 1, IS_READ_ONLY: false, transformArguments: transformQueryArguments.bind(undefined, 'GRAPH.QUERY'), - transformReply(reply: QueryRawReply) { + transformReply(reply: UnwrapReply) { return reply.length === 1 ? { headers: undefined, data: undefined, diff --git a/packages/graph/lib/commands/SLOWLOG.ts b/packages/graph/lib/commands/SLOWLOG.ts index b0271ccae6..52927f6040 100644 --- a/packages/graph/lib/commands/SLOWLOG.ts +++ b/packages/graph/lib/commands/SLOWLOG.ts @@ -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 ({ - timestamp: Number(timestamp), - command, - query, - took: Number(took) - })); + transformReply(reply: UnwrapReply) { + return reply.map(log => { + const [timestamp, command, query, took] = log as unknown as UnwrapReply; + return { + timestamp: Number(timestamp), + command, + query, + took: Number(took) + }; + }); } } as const satisfies Command;