@upstash/redis 0.0.0-ci.ce266dce → 0.0.0-ci.cfa9c86e-20230504

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +20 -18
  2. package/esm/deps/deno.land/x/base64@v0.2.1/base.js +100 -0
  3. package/esm/deps/deno.land/x/base64@v0.2.1/base64url.js +9 -0
  4. package/esm/deps/deno.land/x/sha1@v1.0.3/deps.js +1 -0
  5. package/esm/deps/deno.land/x/sha1@v1.0.3/mod.js +191 -0
  6. package/esm/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +50 -0
  7. package/esm/pkg/commands/command.js +12 -3
  8. package/esm/pkg/commands/getdel.js +9 -0
  9. package/esm/pkg/commands/hgetall.js +0 -4
  10. package/esm/pkg/commands/hrandfield.js +39 -0
  11. package/esm/pkg/commands/json_arrappend.js +9 -0
  12. package/esm/pkg/commands/json_arrindex.js +9 -0
  13. package/esm/pkg/commands/json_arrinsert.js +9 -0
  14. package/esm/pkg/commands/json_arrlen.js +9 -0
  15. package/esm/pkg/commands/json_arrpop.js +9 -0
  16. package/esm/pkg/commands/json_arrtrim.js +12 -0
  17. package/esm/pkg/commands/json_clear.js +9 -0
  18. package/esm/pkg/commands/json_del.js +9 -0
  19. package/esm/pkg/commands/json_forget.js +9 -0
  20. package/esm/pkg/commands/json_get.js +30 -0
  21. package/esm/pkg/commands/json_mget.js +9 -0
  22. package/esm/pkg/commands/json_numincrby.js +9 -0
  23. package/esm/pkg/commands/json_nummultby.js +9 -0
  24. package/esm/pkg/commands/json_objkeys.js +9 -0
  25. package/esm/pkg/commands/json_objlen.js +9 -0
  26. package/esm/pkg/commands/json_resp.js +9 -0
  27. package/esm/pkg/commands/json_set.js +18 -0
  28. package/esm/pkg/commands/json_strappend.js +9 -0
  29. package/esm/pkg/commands/json_strlen.js +9 -0
  30. package/esm/pkg/commands/json_toggle.js +9 -0
  31. package/esm/pkg/commands/json_type.js +9 -0
  32. package/esm/pkg/commands/lmove.js +9 -0
  33. package/esm/pkg/commands/lpos.js +19 -0
  34. package/esm/pkg/commands/mod.js +26 -0
  35. package/esm/pkg/commands/scan.js +3 -0
  36. package/esm/pkg/commands/sdiffstore.js +1 -1
  37. package/esm/pkg/commands/set.js +16 -4
  38. package/esm/pkg/commands/smismember.js +9 -0
  39. package/esm/pkg/commands/zdiffstore.js +9 -0
  40. package/esm/pkg/commands/zmscore.js +10 -0
  41. package/esm/pkg/commands/zrange.js +6 -0
  42. package/esm/pkg/http.js +92 -2
  43. package/esm/pkg/pipeline.js +172 -6
  44. package/esm/pkg/redis.js +223 -2
  45. package/esm/pkg/script.js +77 -0
  46. package/esm/platforms/cloudflare.js +10 -2
  47. package/esm/platforms/fastly.js +6 -0
  48. package/esm/platforms/node_with_fetch.js +26 -1
  49. package/esm/platforms/nodejs.js +24 -1
  50. package/esm/version.js +1 -0
  51. package/package.json +41 -54
  52. package/script/deps/deno.land/x/base64@v0.2.1/base.js +104 -0
  53. package/script/deps/deno.land/x/base64@v0.2.1/base64url.js +13 -0
  54. package/script/deps/deno.land/x/sha1@v1.0.3/deps.js +6 -0
  55. package/script/deps/deno.land/x/sha1@v1.0.3/mod.js +196 -0
  56. package/script/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +55 -0
  57. package/script/pkg/commands/command.js +12 -3
  58. package/script/pkg/commands/getdel.js +13 -0
  59. package/script/pkg/commands/hgetall.js +0 -4
  60. package/script/pkg/commands/hrandfield.js +43 -0
  61. package/script/pkg/commands/json_arrappend.js +13 -0
  62. package/script/pkg/commands/json_arrindex.js +13 -0
  63. package/script/pkg/commands/json_arrinsert.js +13 -0
  64. package/script/pkg/commands/json_arrlen.js +13 -0
  65. package/script/pkg/commands/json_arrpop.js +13 -0
  66. package/script/pkg/commands/json_arrtrim.js +16 -0
  67. package/script/pkg/commands/json_clear.js +13 -0
  68. package/script/pkg/commands/json_del.js +13 -0
  69. package/script/pkg/commands/json_forget.js +13 -0
  70. package/script/pkg/commands/json_get.js +34 -0
  71. package/script/pkg/commands/json_mget.js +13 -0
  72. package/script/pkg/commands/json_numincrby.js +13 -0
  73. package/script/pkg/commands/json_nummultby.js +13 -0
  74. package/script/pkg/commands/json_objkeys.js +13 -0
  75. package/script/pkg/commands/json_objlen.js +13 -0
  76. package/script/pkg/commands/json_resp.js +13 -0
  77. package/script/pkg/commands/json_set.js +22 -0
  78. package/script/pkg/commands/json_strappend.js +13 -0
  79. package/script/pkg/commands/json_strlen.js +13 -0
  80. package/script/pkg/commands/json_toggle.js +13 -0
  81. package/script/pkg/commands/json_type.js +13 -0
  82. package/script/pkg/commands/lmove.js +13 -0
  83. package/script/pkg/commands/lpos.js +23 -0
  84. package/script/pkg/commands/mod.js +26 -0
  85. package/script/pkg/commands/scan.js +3 -0
  86. package/script/pkg/commands/sdiffstore.js +1 -1
  87. package/script/pkg/commands/set.js +16 -4
  88. package/script/pkg/commands/smismember.js +13 -0
  89. package/script/pkg/commands/zdiffstore.js +13 -0
  90. package/script/pkg/commands/zmscore.js +14 -0
  91. package/script/pkg/commands/zrange.js +6 -0
  92. package/script/pkg/http.js +92 -2
  93. package/script/pkg/pipeline.js +171 -5
  94. package/script/pkg/redis.js +222 -1
  95. package/script/pkg/script.js +81 -0
  96. package/script/platforms/cloudflare.js +10 -2
  97. package/script/platforms/fastly.js +6 -0
  98. package/script/platforms/node_with_fetch.js +26 -1
  99. package/script/platforms/nodejs.js +24 -1
  100. package/script/version.js +4 -0
  101. package/types/deps/deno.land/x/base64@v0.2.1/base.d.ts +5 -0
  102. package/types/deps/deno.land/x/base64@v0.2.1/base64url.d.ts +1 -0
  103. package/types/deps/deno.land/x/sha1@v1.0.3/deps.d.ts +1 -0
  104. package/types/deps/deno.land/x/sha1@v1.0.3/mod.d.ts +26 -0
  105. package/types/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.d.ts +3 -0
  106. package/types/pkg/commands/bitop.d.ts +0 -1
  107. package/types/pkg/commands/bitpos.d.ts +1 -1
  108. package/types/pkg/commands/command.d.ts +5 -5
  109. package/types/pkg/commands/getdel.d.ts +7 -0
  110. package/types/pkg/commands/hdel.d.ts +1 -1
  111. package/types/pkg/commands/hrandfield.d.ts +9 -0
  112. package/types/pkg/commands/json_arrappend.d.ts +7 -0
  113. package/types/pkg/commands/json_arrindex.d.ts +13 -0
  114. package/types/pkg/commands/json_arrinsert.d.ts +7 -0
  115. package/types/pkg/commands/json_arrlen.d.ts +7 -0
  116. package/types/pkg/commands/json_arrpop.d.ts +7 -0
  117. package/types/pkg/commands/json_arrtrim.d.ts +7 -0
  118. package/types/pkg/commands/json_clear.d.ts +7 -0
  119. package/types/pkg/commands/json_del.d.ts +7 -0
  120. package/types/pkg/commands/json_forget.d.ts +7 -0
  121. package/types/pkg/commands/json_get.d.ts +15 -0
  122. package/types/pkg/commands/json_mget.d.ts +7 -0
  123. package/types/pkg/commands/json_numincrby.d.ts +7 -0
  124. package/types/pkg/commands/json_nummultby.d.ts +7 -0
  125. package/types/pkg/commands/json_objkeys.d.ts +7 -0
  126. package/types/pkg/commands/json_objlen.d.ts +7 -0
  127. package/types/pkg/commands/json_resp.d.ts +7 -0
  128. package/types/pkg/commands/json_set.d.ts +18 -0
  129. package/types/pkg/commands/json_strappend.d.ts +7 -0
  130. package/types/pkg/commands/json_strlen.d.ts +7 -0
  131. package/types/pkg/commands/json_toggle.d.ts +7 -0
  132. package/types/pkg/commands/json_type.d.ts +7 -0
  133. package/types/pkg/commands/lmove.d.ts +12 -0
  134. package/types/pkg/commands/lpop.d.ts +1 -1
  135. package/types/pkg/commands/lpos.d.ts +15 -0
  136. package/types/pkg/commands/mget.d.ts +1 -1
  137. package/types/pkg/commands/mod.d.ts +26 -0
  138. package/types/pkg/commands/rpop.d.ts +2 -2
  139. package/types/pkg/commands/scan.d.ts +2 -1
  140. package/types/pkg/commands/script_flush.d.ts +1 -1
  141. package/types/pkg/commands/sdiffstore.d.ts +1 -1
  142. package/types/pkg/commands/set.d.ts +31 -2
  143. package/types/pkg/commands/smembers.d.ts +2 -2
  144. package/types/pkg/commands/smismember.d.ts +7 -0
  145. package/types/pkg/commands/spop.d.ts +2 -2
  146. package/types/pkg/commands/type.d.ts +1 -1
  147. package/types/pkg/commands/zadd.d.ts +4 -4
  148. package/types/pkg/commands/zdiffstore.d.ts +7 -0
  149. package/types/pkg/commands/zinterstore.d.ts +1 -1
  150. package/types/pkg/commands/zmscore.d.ts +7 -0
  151. package/types/pkg/commands/zrange.d.ts +8 -1
  152. package/types/pkg/commands/zunionstore.d.ts +1 -1
  153. package/types/pkg/http.d.ts +44 -7
  154. package/types/pkg/pipeline.d.ts +73 -10
  155. package/types/pkg/redis.d.ts +161 -18
  156. package/types/pkg/script.d.ts +42 -0
  157. package/types/pkg/types.d.ts +27 -1
  158. package/types/platforms/cloudflare.d.ts +9 -8
  159. package/types/platforms/fastly.d.ts +3 -7
  160. package/types/platforms/node_with_fetch.d.ts +3 -22
  161. package/types/platforms/nodejs.d.ts +4 -7
  162. package/types/version.d.ts +1 -0
@@ -17,6 +17,7 @@ export * from "./flushall.js";
17
17
  export * from "./flushdb.js";
18
18
  export * from "./get.js";
19
19
  export * from "./getbit.js";
20
+ export * from "./getdel.js";
20
21
  export * from "./getrange.js";
21
22
  export * from "./getset.js";
22
23
  export * from "./hdel.js";
@@ -29,6 +30,7 @@ export * from "./hkeys.js";
29
30
  export * from "./hlen.js";
30
31
  export * from "./hmget.js";
31
32
  export * from "./hmset.js";
33
+ export * from "./hrandfield.js";
32
34
  export * from "./hscan.js";
33
35
  export * from "./hset.js";
34
36
  export * from "./hsetnx.js";
@@ -37,11 +39,34 @@ export * from "./hvals.js";
37
39
  export * from "./incr.js";
38
40
  export * from "./incrby.js";
39
41
  export * from "./incrbyfloat.js";
42
+ export * from "./json_arrappend.js";
43
+ export * from "./json_arrindex.js";
44
+ export * from "./json_arrinsert.js";
45
+ export * from "./json_arrlen.js";
46
+ export * from "./json_arrpop.js";
47
+ export * from "./json_arrtrim.js";
48
+ export * from "./json_clear.js";
49
+ export * from "./json_del.js";
50
+ export * from "./json_forget.js";
51
+ export * from "./json_get.js";
52
+ export * from "./json_mget.js";
53
+ export * from "./json_numincrby.js";
54
+ export * from "./json_nummultby.js";
55
+ export * from "./json_objkeys.js";
56
+ export * from "./json_objlen.js";
57
+ export * from "./json_resp.js";
58
+ export * from "./json_set.js";
59
+ export * from "./json_strappend.js";
60
+ export * from "./json_strlen.js";
61
+ export * from "./json_toggle.js";
62
+ export * from "./json_type.js";
40
63
  export * from "./keys.js";
41
64
  export * from "./lindex.js";
42
65
  export * from "./linsert.js";
43
66
  export * from "./llen.js";
67
+ export * from "./lmove.js";
44
68
  export * from "./lpop.js";
69
+ export * from "./lpos.js";
45
70
  export * from "./lpush.js";
46
71
  export * from "./lpushx.js";
47
72
  export * from "./lrange.js";
@@ -81,6 +106,7 @@ export * from "./sinter.js";
81
106
  export * from "./sinterstore.js";
82
107
  export * from "./sismember.js";
83
108
  export * from "./smembers.js";
109
+ export * from "./smismember.js";
84
110
  export * from "./smove.js";
85
111
  export * from "./spop.js";
86
112
  export * from "./srandmember.js";
@@ -2,6 +2,6 @@ import { Command, CommandOptions } from "./command.js";
2
2
  /**
3
3
  * @see https://redis.io/commands/rpop
4
4
  */
5
- export declare class RPopCommand<TData = string> extends Command<unknown | null, TData | null> {
6
- constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
5
+ export declare class RPopCommand<TData extends unknown | unknown[] = string> extends Command<unknown | null, TData | null> {
6
+ constructor(cmd: [key: string, count?: number], opts?: CommandOptions<unknown | null, TData | null>);
7
7
  }
@@ -1,7 +1,8 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type ScanCommandOptions = {
2
+ export type ScanCommandOptions = {
3
3
  match?: string;
4
4
  count?: number;
5
+ type?: string;
5
6
  };
6
7
  /**
7
8
  * @see https://redis.io/commands/scan
@@ -1,5 +1,5 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type ScriptFlushCommandOptions = {
2
+ export type ScriptFlushCommandOptions = {
3
3
  sync: true;
4
4
  async?: never;
5
5
  } | {
@@ -1,6 +1,6 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
2
  /**
3
- * @see https://redis.io/commands/sdiffstpre
3
+ * @see https://redis.io/commands/sdiffstore
4
4
  */
5
5
  export declare class SDiffStoreCommand extends Command<number, number> {
6
6
  constructor(cmd: [destination: string, ...keys: string[]], opts?: CommandOptions<number, number>);
@@ -1,13 +1,42 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type SetCommandOptions = ({
2
+ export type SetCommandOptions = {
3
+ get: boolean;
4
+ } | ({
3
5
  ex: number;
4
6
  px?: never;
7
+ exat?: never;
8
+ pxat?: never;
9
+ keepTtl?: never;
5
10
  } | {
6
11
  ex?: never;
7
12
  px: number;
13
+ exat?: never;
14
+ pxat?: never;
15
+ keepTtl?: never;
8
16
  } | {
9
17
  ex?: never;
10
18
  px?: never;
19
+ exat: number;
20
+ pxat?: never;
21
+ keepTtl?: never;
22
+ } | {
23
+ ex?: never;
24
+ px?: never;
25
+ exat?: never;
26
+ pxat: number;
27
+ keepTtl?: never;
28
+ } | {
29
+ ex?: never;
30
+ px?: never;
31
+ exat?: never;
32
+ pxat?: never;
33
+ keepTtl: true;
34
+ } | {
35
+ ex?: never;
36
+ px?: never;
37
+ exat?: never;
38
+ pxat?: never;
39
+ keepTtl?: never;
11
40
  }) & ({
12
41
  nx: true;
13
42
  xx?: never;
@@ -21,6 +50,6 @@ export declare type SetCommandOptions = ({
21
50
  /**
22
51
  * @see https://redis.io/commands/set
23
52
  */
24
- export declare class SetCommand<TData, TResult = "OK"> extends Command<TResult, TData> {
53
+ export declare class SetCommand<TData, TResult = TData | "OK" | null> extends Command<TResult, TData | "OK" | null> {
25
54
  constructor([key, value, opts]: [key: string, value: TData, opts?: SetCommandOptions], cmdOpts?: CommandOptions<TResult, TData>);
26
55
  }
@@ -2,6 +2,6 @@ import { Command, CommandOptions } from "./command.js";
2
2
  /**
3
3
  * @see https://redis.io/commands/smembers
4
4
  */
5
- export declare class SMembersCommand<TData = string> extends Command<unknown[], TData[]> {
6
- constructor(cmd: [key: string], opts?: CommandOptions<unknown[], TData[]>);
5
+ export declare class SMembersCommand<TData extends unknown[] = string[]> extends Command<unknown[], TData> {
6
+ constructor(cmd: [key: string], opts?: CommandOptions<unknown[], TData>);
7
7
  }
@@ -0,0 +1,7 @@
1
+ import { Command, CommandOptions } from "./command.js";
2
+ /**
3
+ * @see https://redis.io/commands/smismember
4
+ */
5
+ export declare class SMIsMemberCommand<TMembers extends unknown[]> extends Command<("0" | "1")[], (0 | 1)[]> {
6
+ constructor(cmd: [key: string, members: TMembers], opts?: CommandOptions<("0" | "1")[], (0 | 1)[]>);
7
+ }
@@ -2,6 +2,6 @@ import { Command, CommandOptions } from "./command.js";
2
2
  /**
3
3
  * @see https://redis.io/commands/spop
4
4
  */
5
- export declare class SPopCommand<TData> extends Command<string | null, TData | null> {
6
- constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | null, TData | null>);
5
+ export declare class SPopCommand<TData> extends Command<string | string[] | null, TData | null> {
6
+ constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | string[] | null, TData | null>);
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type Type = "string" | "list" | "set" | "zset" | "hash" | "none";
2
+ export type Type = "string" | "list" | "set" | "zset" | "hash" | "none";
3
3
  /**
4
4
  * @see https://redis.io/commands/type
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type ZAddCommandOptions = ({
2
+ export type ZAddCommandOptions = ({
3
3
  nx: true;
4
4
  xx?: never;
5
5
  } | {
@@ -11,10 +11,10 @@ export declare type ZAddCommandOptions = ({
11
11
  }) & {
12
12
  ch?: true;
13
13
  };
14
- export declare type ZAddCommandOptionsWithIncr = ZAddCommandOptions & {
14
+ export type ZAddCommandOptionsWithIncr = ZAddCommandOptions & {
15
15
  incr: true;
16
16
  };
17
- export declare type ScoreMember<TData> = {
17
+ export type ScoreMember<TData> = {
18
18
  score: number;
19
19
  member: TData;
20
20
  };
@@ -30,6 +30,6 @@ export declare class ZAddCommand<TData = string> extends Command<number | null,
30
30
  constructor(cmd: [
31
31
  key: string,
32
32
  opts: ZAddCommandOptions | ZAddCommandOptionsWithIncr,
33
- ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
33
+ ...scoreMemberPairs: ScoreMember<TData>[]
34
34
  ], opts?: CommandOptions<number | null, number | null>);
35
35
  }
@@ -0,0 +1,7 @@
1
+ import { Command, CommandOptions } from "./command.js";
2
+ /**
3
+ * @see https://redis.io/commands/zdiffstore
4
+ */
5
+ export declare class ZDiffStoreCommand extends Command<number, number> {
6
+ constructor(cmd: [destination: string, numkeys: number, ...keys: string[]], opts?: CommandOptions<number, number>);
7
+ }
@@ -1,5 +1,5 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type ZInterStoreCommandOptions = {
2
+ export type ZInterStoreCommandOptions = {
3
3
  aggregate?: "sum" | "min" | "max";
4
4
  } & ({
5
5
  weight: number;
@@ -0,0 +1,7 @@
1
+ import { Command, CommandOptions } from "./command.js";
2
+ /**
3
+ * @see https://redis.io/commands/zmscore
4
+ */
5
+ export declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] | null> {
6
+ constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
7
+ }
@@ -1,6 +1,7 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type ZRangeCommandOptions = {
2
+ export type ZRangeCommandOptions = {
3
3
  withScores?: boolean;
4
+ rev?: boolean;
4
5
  } & ({
5
6
  byScore: true;
6
7
  byLex?: never;
@@ -10,6 +11,12 @@ export declare type ZRangeCommandOptions = {
10
11
  } | {
11
12
  byScore?: never;
12
13
  byLex?: never;
14
+ }) & ({
15
+ offset: number;
16
+ count: number;
17
+ } | {
18
+ offset?: never;
19
+ count?: never;
13
20
  });
14
21
  /**
15
22
  * @see https://redis.io/commands/zrange
@@ -1,5 +1,5 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type ZUnionStoreCommandOptions = {
2
+ export type ZUnionStoreCommandOptions = {
3
3
  aggregate?: "sum" | "min" | "max";
4
4
  } & ({
5
5
  weight: number;
@@ -1,18 +1,20 @@
1
- export declare type UpstashRequest = {
1
+ import { Telemetry } from "./types.js";
2
+ type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
3
+ export type UpstashRequest = {
2
4
  path?: string[];
3
5
  /**
4
6
  * Request body will be serialized to json
5
7
  */
6
8
  body?: unknown;
7
9
  };
8
- export declare type UpstashResponse<TResult> = {
10
+ export type UpstashResponse<TResult> = {
9
11
  result?: TResult;
10
12
  error?: string;
11
13
  };
12
14
  export interface Requester {
13
15
  request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
14
16
  }
15
- export declare type RetryConfig = false | {
17
+ export type RetryConfig = false | {
16
18
  /**
17
19
  * The number of retries to attempt before giving up.
18
20
  *
@@ -29,26 +31,61 @@ export declare type RetryConfig = false | {
29
31
  */
30
32
  backoff?: (retryCount: number) => number;
31
33
  };
32
- declare type Options = {
34
+ export type Options = {
33
35
  backend?: string;
34
36
  };
35
- export declare type HttpClientConfig = {
37
+ export type RequesterConfig = {
38
+ /**
39
+ * Configure the retry behaviour in case of network errors
40
+ */
41
+ retry?: RetryConfig;
42
+ /**
43
+ * Due to the nature of dynamic and custom data, it is possible to write data to redis that is not
44
+ * valid json and will therefore cause errors when deserializing. This used to happen very
45
+ * frequently with non-utf8 data, such as emojis.
46
+ *
47
+ * By default we will therefore encode the data as base64 on the server, before sending it to the
48
+ * client. The client will then decode the base64 data and parse it as utf8.
49
+ *
50
+ * For very large entries, this can add a few milliseconds, so if you are sure that your data is
51
+ * valid utf8, you can disable this behaviour by setting this option to false.
52
+ *
53
+ * Here's what the response body looks like:
54
+ *
55
+ * ```json
56
+ * {
57
+ * result?: "base64-encoded",
58
+ * error?: string
59
+ * }
60
+ * ```
61
+ *
62
+ * @default "base64"
63
+ */
64
+ responseEncoding?: false | "base64";
65
+ };
66
+ export type HttpClientConfig = {
36
67
  headers?: Record<string, string>;
37
68
  baseUrl: string;
38
69
  options?: Options;
39
70
  retry?: RetryConfig;
40
- };
71
+ agent?: any;
72
+ cache?: CacheSetting;
73
+ } & RequesterConfig;
41
74
  export declare class HttpClient implements Requester {
42
75
  baseUrl: string;
43
76
  headers: Record<string, string>;
44
- readonly options?: {
77
+ readonly options: {
45
78
  backend?: string;
79
+ agent: any;
80
+ responseEncoding?: false | "base64";
81
+ cache?: CacheSetting;
46
82
  };
47
83
  readonly retry: {
48
84
  attempts: number;
49
85
  backoff: (retryCount: number) => number;
50
86
  };
51
87
  constructor(config: HttpClientConfig);
88
+ mergeTelemetry(telemetry: Telemetry): void;
52
89
  request<TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>>;
53
90
  }
54
91
  export {};
@@ -1,4 +1,4 @@
1
- import { DelCommand, ExistsCommand, FlushAllCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
1
+ import { DelCommand, ExistsCommand, FlushAllCommand, JsonArrAppendCommand, JsonArrIndexCommand, JsonArrInsertCommand, JsonArrLenCommand, JsonArrPopCommand, JsonArrTrimCommand, JsonClearCommand, JsonDelCommand, JsonForgetCommand, JsonGetCommand, JsonMGetCommand, JsonNumIncrByCommand, JsonNumMultByCommand, JsonObjKeysCommand, JsonObjLenCommand, JsonRespCommand, JsonSetCommand, JsonStrAppendCommand, JsonStrLenCommand, JsonToggleCommand, JsonTypeCommand, MGetCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
2
2
  import { CommandOptions } from "./commands/command.js";
3
3
  import { Requester } from "./http.js";
4
4
  import { CommandArgs } from "./types.js";
@@ -18,7 +18,7 @@ import { CommandArgs } from "./types.js";
18
18
  * **Examples:**
19
19
  *
20
20
  * ```ts
21
- * const p = redis.pipeline()
21
+ * const p = redis.pipeline() // or redis.multi()
22
22
  * p.set("key","value")
23
23
  * p.get("key")
24
24
  * const res = await p.exec()
@@ -44,7 +44,12 @@ export declare class Pipeline {
44
44
  private client;
45
45
  private commands;
46
46
  private commandOptions?;
47
- constructor(client: Requester, commandOptions?: CommandOptions<any, any>);
47
+ private multiExec;
48
+ constructor(opts: {
49
+ client: Requester;
50
+ commandOptions?: CommandOptions<any, any>;
51
+ multiExec?: boolean;
52
+ });
48
53
  /**
49
54
  * Send the pipeline request to upstash.
50
55
  *
@@ -79,7 +84,11 @@ export declare class Pipeline {
79
84
  /**
80
85
  * @see https://redis.io/commands/bitpos
81
86
  */
82
- bitpos: (key: string, start: number, end: number) => this;
87
+ bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => this;
88
+ /**
89
+ * @see https://redis.io/commands/zdiffstore
90
+ */
91
+ zdiffstore: (destination: string, numkeys: number, ...keys: string[]) => this;
83
92
  /**
84
93
  * @see https://redis.io/commands/dbsize
85
94
  */
@@ -138,6 +147,10 @@ export declare class Pipeline {
138
147
  * @see https://redis.io/commands/getbit
139
148
  */
140
149
  getbit: (key: string, offset: number) => this;
150
+ /**
151
+ * @see https://redis.io/commands/getdel
152
+ */
153
+ getdel: <TData>(key: string) => this;
141
154
  /**
142
155
  * @see https://redis.io/commands/getrange
143
156
  */
@@ -149,7 +162,7 @@ export declare class Pipeline {
149
162
  /**
150
163
  * @see https://redis.io/commands/hdel
151
164
  */
152
- hdel: (key: string, field: string) => this;
165
+ hdel: (key: string, ...fields: string[]) => this;
153
166
  /**
154
167
  * @see https://redis.io/commands/hexists
155
168
  */
@@ -188,6 +201,10 @@ export declare class Pipeline {
188
201
  hmset: <TData>(key: string, kv: {
189
202
  [field: string]: TData;
190
203
  }) => this;
204
+ /**
205
+ * @see https://redis.io/commands/hrandfield
206
+ */
207
+ hrandfield: <TData extends string | string[] | Record<string, unknown>>(key: string, count?: number, withValues?: boolean) => this;
191
208
  /**
192
209
  * @see https://redis.io/commands/hscan
193
210
  */
@@ -238,10 +255,22 @@ export declare class Pipeline {
238
255
  * @see https://redis.io/commands/llen
239
256
  */
240
257
  llen: (key: string) => this;
258
+ /**
259
+ * @see https://redis.io/commands/lmove
260
+ */
261
+ lmove: <TData = string>(source: string, destination: string, whereFrom: "left" | "right", whereTo: "left" | "right") => this;
241
262
  /**
242
263
  * @see https://redis.io/commands/lpop
243
264
  */
244
- lpop: <TData>(key: string) => this;
265
+ lpop: <TData>(key: string, count?: number | undefined) => this;
266
+ /**
267
+ * @see https://redis.io/commands/lpos
268
+ */
269
+ lpos: <TData>(key: string, element: unknown, opts?: {
270
+ rank?: number | undefined;
271
+ count?: number | undefined;
272
+ maxLen?: number | undefined;
273
+ } | undefined) => this;
245
274
  /**
246
275
  * @see https://redis.io/commands/lpush
247
276
  */
@@ -269,7 +298,7 @@ export declare class Pipeline {
269
298
  /**
270
299
  * @see https://redis.io/commands/mget
271
300
  */
272
- mget: <TData extends unknown[]>(args_0: string, ...args_1: string[]) => this;
301
+ mget: <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) => this;
273
302
  /**
274
303
  * @see https://redis.io/commands/mset
275
304
  */
@@ -325,7 +354,7 @@ export declare class Pipeline {
325
354
  /**
326
355
  * @see https://redis.io/commands/rpop
327
356
  */
328
- rpop: <TData = string>(key: string) => this;
357
+ rpop: <TData = string>(key: string, count?: number | undefined) => this;
329
358
  /**
330
359
  * @see https://redis.io/commands/rpush
331
360
  */
@@ -366,7 +395,7 @@ export declare class Pipeline {
366
395
  /**
367
396
  * @see https://redis.io/commands/set
368
397
  */
369
- set: <TData>(key: string, value: TData, opts?: SetCommandOptions | undefined) => this;
398
+ set: <TData>(key: string, value: TData, opts?: SetCommandOptions) => this;
370
399
  /**
371
400
  * @see https://redis.io/commands/setbit
372
401
  */
@@ -398,7 +427,11 @@ export declare class Pipeline {
398
427
  /**
399
428
  * @see https://redis.io/commands/smembers
400
429
  */
401
- smembers: (key: string) => this;
430
+ smembers: <TData extends unknown[] = string[]>(key: string) => this;
431
+ /**
432
+ * @see https://redis.io/commands/smismember
433
+ */
434
+ smismember: <TMembers extends unknown[]>(key: string, members: TMembers) => this;
402
435
  /**
403
436
  * @see https://redis.io/commands/smove
404
437
  */
@@ -475,6 +508,10 @@ export declare class Pipeline {
475
508
  * @see https://redis.io/commands/zlexcount
476
509
  */
477
510
  zlexcount: (key: string, min: string, max: string) => this;
511
+ /**
512
+ * @see https://redis.io/commands/zmscore
513
+ */
514
+ zmscore: (key: string, members: unknown[]) => this;
478
515
  /**
479
516
  * @see https://redis.io/commands/zpopmax
480
517
  */
@@ -537,4 +574,30 @@ export declare class Pipeline {
537
574
  * @see https://redis.io/commands/zunionstore
538
575
  */
539
576
  zunionstore: (destination: string, numKeys: number, keys: string[], opts?: import("./commands/zunionstore.js").ZUnionStoreCommandOptions | undefined) => this;
577
+ /**
578
+ * @see https://redis.io/commands/?group=json
579
+ */
580
+ get json(): {
581
+ arrappend: (...args: CommandArgs<typeof JsonArrAppendCommand>) => Pipeline;
582
+ arrindex: (...args: CommandArgs<typeof JsonArrIndexCommand>) => Pipeline;
583
+ arrinsert: (...args: CommandArgs<typeof JsonArrInsertCommand>) => Pipeline;
584
+ arrlen: (...args: CommandArgs<typeof JsonArrLenCommand>) => Pipeline;
585
+ arrpop: (...args: CommandArgs<typeof JsonArrPopCommand>) => Pipeline;
586
+ arrtrim: (...args: CommandArgs<typeof JsonArrTrimCommand>) => Pipeline;
587
+ clear: (...args: CommandArgs<typeof JsonClearCommand>) => Pipeline;
588
+ del: (...args: CommandArgs<typeof JsonDelCommand>) => Pipeline;
589
+ forget: (...args: CommandArgs<typeof JsonForgetCommand>) => Pipeline;
590
+ get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline;
591
+ mget: (...args: CommandArgs<typeof JsonMGetCommand>) => Pipeline;
592
+ numincrby: (...args: CommandArgs<typeof JsonNumIncrByCommand>) => Pipeline;
593
+ nummultby: (...args: CommandArgs<typeof JsonNumMultByCommand>) => Pipeline;
594
+ objkeys: (...args: CommandArgs<typeof JsonObjKeysCommand>) => Pipeline;
595
+ objlen: (...args: CommandArgs<typeof JsonObjLenCommand>) => Pipeline;
596
+ resp: (...args: CommandArgs<typeof JsonRespCommand>) => Pipeline;
597
+ set: (...args: CommandArgs<typeof JsonSetCommand>) => Pipeline;
598
+ strappend: (...args: CommandArgs<typeof JsonStrAppendCommand>) => Pipeline;
599
+ strlen: (...args: CommandArgs<typeof JsonStrLenCommand>) => Pipeline;
600
+ toggle: (...args: CommandArgs<typeof JsonToggleCommand>) => Pipeline;
601
+ type: (...args: CommandArgs<typeof JsonTypeCommand>) => Pipeline;
602
+ };
540
603
  }