1- import { TSchema } from "@sinclair/typebox" ;
1+ import { StaticEncode , TSchema } from "@sinclair/typebox" ;
22import { RedisCommand } from "../command" ;
3- import { RedisSet , Value } from "../key" ;
3+ import { RedisSet } from "../key" ;
44
55/**
66 * Add one or more members to a set
77 */
88export function SADD < T extends TSchema > (
99 key : RedisSet < T > ,
10- ...members : [ Value < T > , ...Value < T > [ ] ]
10+ ...members : [ StaticEncode < T > , ...StaticEncode < T > [ ] ]
1111) {
1212 return new RedisCommand < number > ( [
1313 "SADD" ,
@@ -29,7 +29,7 @@ export function SCARD<T extends TSchema>(key: RedisSet<T>) {
2929export function SDIFF < T extends TSchema > (
3030 ...keys : [ RedisSet < T > , ...RedisSet < T > [ ] ]
3131) {
32- return new RedisCommand < Value < T > [ ] > (
32+ return new RedisCommand < StaticEncode < T > [ ] > (
3333 [ "SDIFF" , ...keys . map ( ( key ) => key . name ) ] ,
3434 ( reply : unknown [ ] ) => reply . map ( ( value ) => keys [ 0 ] . decode ( value ) ) ,
3535 ) ;
@@ -41,7 +41,7 @@ export function SDIFF<T extends TSchema>(
4141export function SINTER < T extends TSchema > (
4242 ...keys : [ RedisSet < T > , ...RedisSet < T > [ ] ]
4343) {
44- return new RedisCommand < Value < T > [ ] > (
44+ return new RedisCommand < StaticEncode < T > [ ] > (
4545 [ "SINTER" , ...keys . map ( ( key ) => key . name ) ] ,
4646 ( reply : unknown [ ] ) => reply . map ( ( value ) => keys [ 0 ] . decode ( value ) ) ,
4747 ) ;
@@ -52,7 +52,7 @@ export function SINTER<T extends TSchema>(
5252 */
5353export function SISMEMBER < T extends TSchema > (
5454 key : RedisSet < T > ,
55- member : Value < T > ,
55+ member : StaticEncode < T > ,
5656) {
5757 return new RedisCommand < boolean > (
5858 [ "SISMEMBER" , key . name , key . encode ( member ) ] ,
@@ -64,7 +64,7 @@ export function SISMEMBER<T extends TSchema>(
6464 * Get all members in a set
6565 */
6666export function SMEMBERS < T extends TSchema > ( key : RedisSet < T > ) {
67- return new RedisCommand < Value < T > [ ] > (
67+ return new RedisCommand < StaticEncode < T > [ ] > (
6868 [ "SMEMBERS" , key . name ] ,
6969 ( reply : unknown [ ] ) => reply . map ( ( value ) => key . decode ( value ) ) ,
7070 ) ;
@@ -75,18 +75,18 @@ export function SMEMBERS<T extends TSchema>(key: RedisSet<T>) {
7575 */
7676export function SPOP < T extends TSchema > (
7777 key : RedisSet < T > ,
78- ) : RedisCommand < Value < T > | undefined > ;
78+ ) : RedisCommand < StaticEncode < T > | undefined > ;
7979
8080/**
8181 * Remove and return one or multiple random members from a set
8282 */
8383export function SPOP < T extends TSchema > (
8484 key : RedisSet < T > ,
8585 count : number ,
86- ) : RedisCommand < Value < T > [ ] > ;
86+ ) : RedisCommand < StaticEncode < T > [ ] > ;
8787
8888export function SPOP < T extends TSchema > ( key : RedisSet < T > , count ?: number ) {
89- return new RedisCommand < Value < T > | Value < T > [ ] | undefined > (
89+ return new RedisCommand < StaticEncode < T > | StaticEncode < T > [ ] | undefined > (
9090 count ? [ "SPOP" , key . name , count . toString ( ) ] : [ "SPOP" , key . name ] ,
9191 ( reply ) => {
9292 if ( reply === null ) return undefined ;
@@ -102,7 +102,7 @@ export function SPOP<T extends TSchema>(key: RedisSet<T>, count?: number) {
102102 */
103103export function SREM < T extends TSchema > (
104104 key : RedisSet < T > ,
105- ...members : Value < T > [ ]
105+ ...members : StaticEncode < T > [ ]
106106) {
107107 return new RedisCommand < number > ( [
108108 "SREM" ,
@@ -115,7 +115,7 @@ export function SREM<T extends TSchema>(
115115 * Return the union of multiple sets
116116 */
117117export function SUNION < T extends TSchema > ( ...keys : RedisSet < T > [ ] ) {
118- return new RedisCommand < Value < T > [ ] > (
118+ return new RedisCommand < StaticEncode < T > [ ] > (
119119 [ "SUNION" , ...keys . map ( ( key ) => key . name ) ] ,
120120 ( reply : unknown [ ] ) => reply . map ( ( value ) => keys [ 0 ] . decode ( value ) ) ,
121121 ) ;
0 commit comments