11import { RedisClientOptions , RedisClientType } from '../client' ;
22import { CommandOptions } from '../client/commands-queue' ;
3- import { Command , CommandArguments , CommanderConfig , CommandSignature , /*CommandPolicies, CommandWithPoliciesSignature,*/ TypeMapping , RedisArgument , RedisFunction , RedisFunctions , RedisModules , RedisScript , RedisScripts , ReplyUnion , RespVersions } from '../RESP/types' ;
3+ import { Command , CommandArguments , CommanderConfig , TypeMapping , RedisArgument , RedisFunction , RedisFunctions , RedisModules , RedisScript , RedisScripts , ReplyUnion , RespVersions } from '../RESP/types' ;
44import COMMANDS from '../commands' ;
55import { EventEmitter } from 'node:events' ;
66import { attachConfig , functionArgumentsPrefix , getTransformReply , scriptArgumentsPrefix } from '../commander' ;
@@ -13,6 +13,8 @@ import { ClientSideCacheConfig, PooledClientSideCacheProvider } from '../client/
1313import { BasicCommandParser } from '../client/parser' ;
1414import { ASKING_CMD } from '../commands/ASKING' ;
1515import SingleEntryCache from '../single-entry-cache'
16+ import { WithCommands , WithFunctions , WithModules , WithScripts } from '../client' ;
17+
1618interface ClusterCommander <
1719 M extends RedisModules ,
1820 F extends RedisFunctions ,
@@ -103,50 +105,6 @@ export interface RedisClusterOptions<
103105 clientSideCache ?: PooledClientSideCacheProvider | ClientSideCacheConfig ;
104106}
105107
106- // remove once request & response policies are ready
107- type ClusterCommand <
108- NAME extends PropertyKey ,
109- COMMAND extends Command
110- > = COMMAND [ 'NOT_KEYED_COMMAND' ] extends true ? (
111- COMMAND [ 'IS_FORWARD_COMMAND' ] extends true ? NAME : never
112- ) : NAME ;
113-
114- // CommandWithPoliciesSignature<(typeof COMMANDS)[P], RESP, TYPE_MAPPING, POLICIES>
115- type WithCommands <
116- RESP extends RespVersions ,
117- TYPE_MAPPING extends TypeMapping
118- > = {
119- [ P in keyof typeof COMMANDS as ClusterCommand < P , ( typeof COMMANDS ) [ P ] > ] : CommandSignature < ( typeof COMMANDS ) [ P ] , RESP , TYPE_MAPPING > ;
120- } ;
121-
122- type WithModules <
123- M extends RedisModules ,
124- RESP extends RespVersions ,
125- TYPE_MAPPING extends TypeMapping
126- > = {
127- [ P in keyof M ] : {
128- [ C in keyof M [ P ] as ClusterCommand < C , M [ P ] [ C ] > ] : CommandSignature < M [ P ] [ C ] , RESP , TYPE_MAPPING > ;
129- } ;
130- } ;
131-
132- type WithFunctions <
133- F extends RedisFunctions ,
134- RESP extends RespVersions ,
135- TYPE_MAPPING extends TypeMapping
136- > = {
137- [ L in keyof F ] : {
138- [ C in keyof F [ L ] as ClusterCommand < C , F [ L ] [ C ] > ] : CommandSignature < F [ L ] [ C ] , RESP , TYPE_MAPPING > ;
139- } ;
140- } ;
141-
142- type WithScripts <
143- S extends RedisScripts ,
144- RESP extends RespVersions ,
145- TYPE_MAPPING extends TypeMapping
146- > = {
147- [ P in keyof S as ClusterCommand < P , S [ P ] > ] : CommandSignature < S [ P ] , RESP , TYPE_MAPPING > ;
148- } ;
149-
150108export type RedisClusterType <
151109 M extends RedisModules = { } ,
152110 F extends RedisFunctions = { } ,
0 commit comments