1
1
import { RedisClientOptions , RedisClientType } from '../client' ;
2
2
import { 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' ;
4
4
import COMMANDS from '../commands' ;
5
5
import { EventEmitter } from 'node:events' ;
6
6
import { attachConfig , functionArgumentsPrefix , getTransformReply , scriptArgumentsPrefix } from '../commander' ;
@@ -13,6 +13,8 @@ import { ClientSideCacheConfig, PooledClientSideCacheProvider } from '../client/
13
13
import { BasicCommandParser } from '../client/parser' ;
14
14
import { ASKING_CMD } from '../commands/ASKING' ;
15
15
import SingleEntryCache from '../single-entry-cache'
16
+ import { WithCommands , WithFunctions , WithModules , WithScripts } from '../client' ;
17
+
16
18
interface ClusterCommander <
17
19
M extends RedisModules ,
18
20
F extends RedisFunctions ,
@@ -103,50 +105,6 @@ export interface RedisClusterOptions<
103
105
clientSideCache ?: PooledClientSideCacheProvider | ClientSideCacheConfig ;
104
106
}
105
107
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
-
150
108
export type RedisClusterType <
151
109
M extends RedisModules = { } ,
152
110
F extends RedisFunctions = { } ,
0 commit comments