@upstash/redis 0.0.0-ci.e730ad54-20220901 → 0.0.0-ci.ea9f0853d6a86e6b7809a21bff609de1b6e9291d-20250414063537

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 (419) hide show
  1. package/README.md +36 -23
  2. package/chunk-Q222GATB.mjs +4421 -0
  3. package/cloudflare.d.mts +55 -0
  4. package/cloudflare.d.ts +55 -0
  5. package/cloudflare.js +4533 -0
  6. package/cloudflare.mjs +93 -0
  7. package/fastly.d.mts +48 -0
  8. package/fastly.d.ts +48 -0
  9. package/fastly.js +4506 -0
  10. package/fastly.mjs +66 -0
  11. package/nodejs.d.mts +73 -0
  12. package/nodejs.d.ts +73 -0
  13. package/nodejs.js +4553 -0
  14. package/nodejs.mjs +113 -0
  15. package/package.json +1 -63
  16. package/zmscore-CjoCv9kz.d.mts +3972 -0
  17. package/zmscore-CjoCv9kz.d.ts +3972 -0
  18. package/.releaserc +0 -14
  19. package/esm/deps/deno.land/x/base64@v0.2.1/base.js +0 -100
  20. package/esm/deps/deno.land/x/base64@v0.2.1/base64url.js +0 -9
  21. package/esm/deps/deno.land/x/sha1@v1.0.3/deps.js +0 -1
  22. package/esm/deps/deno.land/x/sha1@v1.0.3/mod.js +0 -191
  23. package/esm/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +0 -50
  24. package/esm/package.json +0 -3
  25. package/esm/pkg/commands/append.js +0 -9
  26. package/esm/pkg/commands/bitcount.js +0 -16
  27. package/esm/pkg/commands/bitop.js +0 -9
  28. package/esm/pkg/commands/bitpos.js +0 -9
  29. package/esm/pkg/commands/command.js +0 -57
  30. package/esm/pkg/commands/dbsize.js +0 -9
  31. package/esm/pkg/commands/decr.js +0 -9
  32. package/esm/pkg/commands/decrby.js +0 -9
  33. package/esm/pkg/commands/del.js +0 -9
  34. package/esm/pkg/commands/echo.js +0 -9
  35. package/esm/pkg/commands/eval.js +0 -9
  36. package/esm/pkg/commands/evalsha.js +0 -9
  37. package/esm/pkg/commands/exists.js +0 -9
  38. package/esm/pkg/commands/expire.js +0 -9
  39. package/esm/pkg/commands/expireat.js +0 -9
  40. package/esm/pkg/commands/flushall.js +0 -13
  41. package/esm/pkg/commands/flushdb.js +0 -13
  42. package/esm/pkg/commands/get.js +0 -9
  43. package/esm/pkg/commands/getbit.js +0 -9
  44. package/esm/pkg/commands/getrange.js +0 -9
  45. package/esm/pkg/commands/getset.js +0 -9
  46. package/esm/pkg/commands/hdel.js +0 -9
  47. package/esm/pkg/commands/hexists.js +0 -9
  48. package/esm/pkg/commands/hget.js +0 -9
  49. package/esm/pkg/commands/hgetall.js +0 -33
  50. package/esm/pkg/commands/hincrby.js +0 -9
  51. package/esm/pkg/commands/hincrbyfloat.js +0 -9
  52. package/esm/pkg/commands/hkeys.js +0 -9
  53. package/esm/pkg/commands/hlen.js +0 -9
  54. package/esm/pkg/commands/hmget.js +0 -35
  55. package/esm/pkg/commands/hmset.js +0 -13
  56. package/esm/pkg/commands/hscan.js +0 -16
  57. package/esm/pkg/commands/hset.js +0 -13
  58. package/esm/pkg/commands/hsetnx.js +0 -9
  59. package/esm/pkg/commands/hstrlen.js +0 -9
  60. package/esm/pkg/commands/hvals.js +0 -9
  61. package/esm/pkg/commands/incr.js +0 -9
  62. package/esm/pkg/commands/incrby.js +0 -9
  63. package/esm/pkg/commands/incrbyfloat.js +0 -9
  64. package/esm/pkg/commands/keys.js +0 -9
  65. package/esm/pkg/commands/lindex.js +0 -6
  66. package/esm/pkg/commands/linsert.js +0 -6
  67. package/esm/pkg/commands/llen.js +0 -9
  68. package/esm/pkg/commands/lpop.js +0 -9
  69. package/esm/pkg/commands/lpos.js +0 -19
  70. package/esm/pkg/commands/lpush.js +0 -9
  71. package/esm/pkg/commands/lpushx.js +0 -9
  72. package/esm/pkg/commands/lrange.js +0 -6
  73. package/esm/pkg/commands/lrem.js +0 -6
  74. package/esm/pkg/commands/lset.js +0 -6
  75. package/esm/pkg/commands/ltrim.js +0 -6
  76. package/esm/pkg/commands/mget.js +0 -9
  77. package/esm/pkg/commands/mod.js +0 -115
  78. package/esm/pkg/commands/mset.js +0 -12
  79. package/esm/pkg/commands/msetnx.js +0 -9
  80. package/esm/pkg/commands/persist.js +0 -9
  81. package/esm/pkg/commands/pexpire.js +0 -9
  82. package/esm/pkg/commands/pexpireat.js +0 -9
  83. package/esm/pkg/commands/ping.js +0 -13
  84. package/esm/pkg/commands/psetex.js +0 -9
  85. package/esm/pkg/commands/pttl.js +0 -9
  86. package/esm/pkg/commands/publish.js +0 -9
  87. package/esm/pkg/commands/randomkey.js +0 -9
  88. package/esm/pkg/commands/rename.js +0 -9
  89. package/esm/pkg/commands/renamenx.js +0 -9
  90. package/esm/pkg/commands/rpop.js +0 -9
  91. package/esm/pkg/commands/rpush.js +0 -9
  92. package/esm/pkg/commands/rpushx.js +0 -9
  93. package/esm/pkg/commands/sadd.js +0 -9
  94. package/esm/pkg/commands/scan.js +0 -19
  95. package/esm/pkg/commands/scard.js +0 -9
  96. package/esm/pkg/commands/script_exists.js +0 -12
  97. package/esm/pkg/commands/script_flush.js +0 -16
  98. package/esm/pkg/commands/script_load.js +0 -9
  99. package/esm/pkg/commands/sdiff.js +0 -9
  100. package/esm/pkg/commands/sdiffstore.js +0 -9
  101. package/esm/pkg/commands/set.js +0 -36
  102. package/esm/pkg/commands/setbit.js +0 -9
  103. package/esm/pkg/commands/setex.js +0 -9
  104. package/esm/pkg/commands/setnx.js +0 -9
  105. package/esm/pkg/commands/setrange.js +0 -9
  106. package/esm/pkg/commands/sinter.js +0 -9
  107. package/esm/pkg/commands/sinterstore.js +0 -9
  108. package/esm/pkg/commands/sismember.js +0 -9
  109. package/esm/pkg/commands/smembers.js +0 -9
  110. package/esm/pkg/commands/smove.js +0 -9
  111. package/esm/pkg/commands/spop.js +0 -13
  112. package/esm/pkg/commands/srandmember.js +0 -13
  113. package/esm/pkg/commands/srem.js +0 -9
  114. package/esm/pkg/commands/sscan.js +0 -16
  115. package/esm/pkg/commands/strlen.js +0 -9
  116. package/esm/pkg/commands/sunion.js +0 -9
  117. package/esm/pkg/commands/sunionstore.js +0 -9
  118. package/esm/pkg/commands/time.js +0 -9
  119. package/esm/pkg/commands/touch.js +0 -9
  120. package/esm/pkg/commands/ttl.js +0 -9
  121. package/esm/pkg/commands/type.js +0 -9
  122. package/esm/pkg/commands/unlink.js +0 -9
  123. package/esm/pkg/commands/zadd.js +0 -26
  124. package/esm/pkg/commands/zcard.js +0 -9
  125. package/esm/pkg/commands/zcount.js +0 -9
  126. package/esm/pkg/commands/zincrby.js +0 -9
  127. package/esm/pkg/commands/zinterstore.js +0 -27
  128. package/esm/pkg/commands/zlexcount.js +0 -9
  129. package/esm/pkg/commands/zmscore.js +0 -11
  130. package/esm/pkg/commands/zpopmax.js +0 -13
  131. package/esm/pkg/commands/zpopmin.js +0 -13
  132. package/esm/pkg/commands/zrange.js +0 -26
  133. package/esm/pkg/commands/zrank.js +0 -9
  134. package/esm/pkg/commands/zrem.js +0 -9
  135. package/esm/pkg/commands/zremrangebylex.js +0 -9
  136. package/esm/pkg/commands/zremrangebyrank.js +0 -9
  137. package/esm/pkg/commands/zremrangebyscore.js +0 -9
  138. package/esm/pkg/commands/zrevrank.js +0 -9
  139. package/esm/pkg/commands/zscan.js +0 -16
  140. package/esm/pkg/commands/zscore.js +0 -9
  141. package/esm/pkg/commands/zunionstore.js +0 -27
  142. package/esm/pkg/error.js +0 -9
  143. package/esm/pkg/http.js +0 -77
  144. package/esm/pkg/pipeline.js +0 -1144
  145. package/esm/pkg/redis.js +0 -1102
  146. package/esm/pkg/script.js +0 -77
  147. package/esm/pkg/types.js +0 -1
  148. package/esm/pkg/util.js +0 -31
  149. package/esm/platforms/cloudflare.js +0 -62
  150. package/esm/platforms/fastly.js +0 -40
  151. package/esm/platforms/node_with_fetch.js +0 -60
  152. package/esm/platforms/nodejs.js +0 -59
  153. package/script/deps/deno.land/x/base64@v0.2.1/base.js +0 -104
  154. package/script/deps/deno.land/x/base64@v0.2.1/base64url.js +0 -13
  155. package/script/deps/deno.land/x/sha1@v1.0.3/deps.js +0 -6
  156. package/script/deps/deno.land/x/sha1@v1.0.3/mod.js +0 -196
  157. package/script/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +0 -55
  158. package/script/package.json +0 -3
  159. package/script/pkg/commands/append.js +0 -13
  160. package/script/pkg/commands/bitcount.js +0 -20
  161. package/script/pkg/commands/bitop.js +0 -13
  162. package/script/pkg/commands/bitpos.js +0 -13
  163. package/script/pkg/commands/command.js +0 -61
  164. package/script/pkg/commands/dbsize.js +0 -13
  165. package/script/pkg/commands/decr.js +0 -13
  166. package/script/pkg/commands/decrby.js +0 -13
  167. package/script/pkg/commands/del.js +0 -13
  168. package/script/pkg/commands/echo.js +0 -13
  169. package/script/pkg/commands/eval.js +0 -13
  170. package/script/pkg/commands/evalsha.js +0 -13
  171. package/script/pkg/commands/exists.js +0 -13
  172. package/script/pkg/commands/expire.js +0 -13
  173. package/script/pkg/commands/expireat.js +0 -13
  174. package/script/pkg/commands/flushall.js +0 -17
  175. package/script/pkg/commands/flushdb.js +0 -17
  176. package/script/pkg/commands/get.js +0 -13
  177. package/script/pkg/commands/getbit.js +0 -13
  178. package/script/pkg/commands/getrange.js +0 -13
  179. package/script/pkg/commands/getset.js +0 -13
  180. package/script/pkg/commands/hdel.js +0 -13
  181. package/script/pkg/commands/hexists.js +0 -13
  182. package/script/pkg/commands/hget.js +0 -13
  183. package/script/pkg/commands/hgetall.js +0 -37
  184. package/script/pkg/commands/hincrby.js +0 -13
  185. package/script/pkg/commands/hincrbyfloat.js +0 -13
  186. package/script/pkg/commands/hkeys.js +0 -13
  187. package/script/pkg/commands/hlen.js +0 -13
  188. package/script/pkg/commands/hmget.js +0 -39
  189. package/script/pkg/commands/hmset.js +0 -17
  190. package/script/pkg/commands/hscan.js +0 -20
  191. package/script/pkg/commands/hset.js +0 -17
  192. package/script/pkg/commands/hsetnx.js +0 -13
  193. package/script/pkg/commands/hstrlen.js +0 -13
  194. package/script/pkg/commands/hvals.js +0 -13
  195. package/script/pkg/commands/incr.js +0 -13
  196. package/script/pkg/commands/incrby.js +0 -13
  197. package/script/pkg/commands/incrbyfloat.js +0 -13
  198. package/script/pkg/commands/keys.js +0 -13
  199. package/script/pkg/commands/lindex.js +0 -10
  200. package/script/pkg/commands/linsert.js +0 -10
  201. package/script/pkg/commands/llen.js +0 -13
  202. package/script/pkg/commands/lpop.js +0 -13
  203. package/script/pkg/commands/lpos.js +0 -23
  204. package/script/pkg/commands/lpush.js +0 -13
  205. package/script/pkg/commands/lpushx.js +0 -13
  206. package/script/pkg/commands/lrange.js +0 -10
  207. package/script/pkg/commands/lrem.js +0 -10
  208. package/script/pkg/commands/lset.js +0 -10
  209. package/script/pkg/commands/ltrim.js +0 -10
  210. package/script/pkg/commands/mget.js +0 -13
  211. package/script/pkg/commands/mod.js +0 -131
  212. package/script/pkg/commands/mset.js +0 -16
  213. package/script/pkg/commands/msetnx.js +0 -13
  214. package/script/pkg/commands/persist.js +0 -13
  215. package/script/pkg/commands/pexpire.js +0 -13
  216. package/script/pkg/commands/pexpireat.js +0 -13
  217. package/script/pkg/commands/ping.js +0 -17
  218. package/script/pkg/commands/psetex.js +0 -13
  219. package/script/pkg/commands/pttl.js +0 -13
  220. package/script/pkg/commands/publish.js +0 -13
  221. package/script/pkg/commands/randomkey.js +0 -13
  222. package/script/pkg/commands/rename.js +0 -13
  223. package/script/pkg/commands/renamenx.js +0 -13
  224. package/script/pkg/commands/rpop.js +0 -13
  225. package/script/pkg/commands/rpush.js +0 -13
  226. package/script/pkg/commands/rpushx.js +0 -13
  227. package/script/pkg/commands/sadd.js +0 -13
  228. package/script/pkg/commands/scan.js +0 -23
  229. package/script/pkg/commands/scard.js +0 -13
  230. package/script/pkg/commands/script_exists.js +0 -16
  231. package/script/pkg/commands/script_flush.js +0 -20
  232. package/script/pkg/commands/script_load.js +0 -13
  233. package/script/pkg/commands/sdiff.js +0 -13
  234. package/script/pkg/commands/sdiffstore.js +0 -13
  235. package/script/pkg/commands/set.js +0 -40
  236. package/script/pkg/commands/setbit.js +0 -13
  237. package/script/pkg/commands/setex.js +0 -13
  238. package/script/pkg/commands/setnx.js +0 -13
  239. package/script/pkg/commands/setrange.js +0 -13
  240. package/script/pkg/commands/sinter.js +0 -13
  241. package/script/pkg/commands/sinterstore.js +0 -13
  242. package/script/pkg/commands/sismember.js +0 -13
  243. package/script/pkg/commands/smembers.js +0 -13
  244. package/script/pkg/commands/smove.js +0 -13
  245. package/script/pkg/commands/spop.js +0 -17
  246. package/script/pkg/commands/srandmember.js +0 -17
  247. package/script/pkg/commands/srem.js +0 -13
  248. package/script/pkg/commands/sscan.js +0 -20
  249. package/script/pkg/commands/strlen.js +0 -13
  250. package/script/pkg/commands/sunion.js +0 -13
  251. package/script/pkg/commands/sunionstore.js +0 -13
  252. package/script/pkg/commands/time.js +0 -13
  253. package/script/pkg/commands/touch.js +0 -13
  254. package/script/pkg/commands/ttl.js +0 -13
  255. package/script/pkg/commands/type.js +0 -13
  256. package/script/pkg/commands/unlink.js +0 -13
  257. package/script/pkg/commands/zadd.js +0 -30
  258. package/script/pkg/commands/zcard.js +0 -13
  259. package/script/pkg/commands/zcount.js +0 -13
  260. package/script/pkg/commands/zincrby.js +0 -13
  261. package/script/pkg/commands/zinterstore.js +0 -31
  262. package/script/pkg/commands/zlexcount.js +0 -13
  263. package/script/pkg/commands/zmscore.js +0 -15
  264. package/script/pkg/commands/zpopmax.js +0 -17
  265. package/script/pkg/commands/zpopmin.js +0 -17
  266. package/script/pkg/commands/zrange.js +0 -30
  267. package/script/pkg/commands/zrank.js +0 -13
  268. package/script/pkg/commands/zrem.js +0 -13
  269. package/script/pkg/commands/zremrangebylex.js +0 -13
  270. package/script/pkg/commands/zremrangebyrank.js +0 -13
  271. package/script/pkg/commands/zremrangebyscore.js +0 -13
  272. package/script/pkg/commands/zrevrank.js +0 -13
  273. package/script/pkg/commands/zscan.js +0 -20
  274. package/script/pkg/commands/zscore.js +0 -13
  275. package/script/pkg/commands/zunionstore.js +0 -31
  276. package/script/pkg/error.js +0 -13
  277. package/script/pkg/http.js +0 -81
  278. package/script/pkg/pipeline.js +0 -1148
  279. package/script/pkg/redis.js +0 -1106
  280. package/script/pkg/script.js +0 -81
  281. package/script/pkg/types.js +0 -2
  282. package/script/pkg/util.js +0 -35
  283. package/script/platforms/cloudflare.js +0 -89
  284. package/script/platforms/fastly.js +0 -67
  285. package/script/platforms/node_with_fetch.js +0 -87
  286. package/script/platforms/nodejs.js +0 -86
  287. package/types/deps/deno.land/x/base64@v0.2.1/base.d.ts +0 -5
  288. package/types/deps/deno.land/x/base64@v0.2.1/base64url.d.ts +0 -1
  289. package/types/deps/deno.land/x/sha1@v1.0.3/deps.d.ts +0 -1
  290. package/types/deps/deno.land/x/sha1@v1.0.3/mod.d.ts +0 -26
  291. package/types/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.d.ts +0 -3
  292. package/types/pkg/commands/append.d.ts +0 -7
  293. package/types/pkg/commands/bitcount.d.ts +0 -8
  294. package/types/pkg/commands/bitop.d.ts +0 -12
  295. package/types/pkg/commands/bitpos.d.ts +0 -7
  296. package/types/pkg/commands/command.d.ts +0 -37
  297. package/types/pkg/commands/dbsize.d.ts +0 -7
  298. package/types/pkg/commands/decr.d.ts +0 -7
  299. package/types/pkg/commands/decrby.d.ts +0 -7
  300. package/types/pkg/commands/del.d.ts +0 -7
  301. package/types/pkg/commands/echo.d.ts +0 -7
  302. package/types/pkg/commands/eval.d.ts +0 -7
  303. package/types/pkg/commands/evalsha.d.ts +0 -7
  304. package/types/pkg/commands/exists.d.ts +0 -7
  305. package/types/pkg/commands/expire.d.ts +0 -7
  306. package/types/pkg/commands/expireat.d.ts +0 -7
  307. package/types/pkg/commands/flushall.d.ts +0 -9
  308. package/types/pkg/commands/flushdb.d.ts +0 -9
  309. package/types/pkg/commands/get.d.ts +0 -7
  310. package/types/pkg/commands/getbit.d.ts +0 -7
  311. package/types/pkg/commands/getrange.d.ts +0 -7
  312. package/types/pkg/commands/getset.d.ts +0 -7
  313. package/types/pkg/commands/hdel.d.ts +0 -7
  314. package/types/pkg/commands/hexists.d.ts +0 -7
  315. package/types/pkg/commands/hget.d.ts +0 -7
  316. package/types/pkg/commands/hgetall.d.ts +0 -7
  317. package/types/pkg/commands/hincrby.d.ts +0 -7
  318. package/types/pkg/commands/hincrbyfloat.d.ts +0 -7
  319. package/types/pkg/commands/hkeys.d.ts +0 -7
  320. package/types/pkg/commands/hlen.d.ts +0 -7
  321. package/types/pkg/commands/hmget.d.ts +0 -15
  322. package/types/pkg/commands/hmset.d.ts +0 -9
  323. package/types/pkg/commands/hscan.d.ts +0 -24
  324. package/types/pkg/commands/hset.d.ts +0 -9
  325. package/types/pkg/commands/hsetnx.d.ts +0 -7
  326. package/types/pkg/commands/hstrlen.d.ts +0 -7
  327. package/types/pkg/commands/hvals.d.ts +0 -7
  328. package/types/pkg/commands/incr.d.ts +0 -7
  329. package/types/pkg/commands/incrby.d.ts +0 -7
  330. package/types/pkg/commands/incrbyfloat.d.ts +0 -7
  331. package/types/pkg/commands/keys.d.ts +0 -7
  332. package/types/pkg/commands/lindex.d.ts +0 -4
  333. package/types/pkg/commands/linsert.d.ts +0 -9
  334. package/types/pkg/commands/llen.d.ts +0 -7
  335. package/types/pkg/commands/lpop.d.ts +0 -7
  336. package/types/pkg/commands/lpos.d.ts +0 -15
  337. package/types/pkg/commands/lpush.d.ts +0 -7
  338. package/types/pkg/commands/lpushx.d.ts +0 -7
  339. package/types/pkg/commands/lrange.d.ts +0 -4
  340. package/types/pkg/commands/lrem.d.ts +0 -4
  341. package/types/pkg/commands/lset.d.ts +0 -4
  342. package/types/pkg/commands/ltrim.d.ts +0 -4
  343. package/types/pkg/commands/mget.d.ts +0 -7
  344. package/types/pkg/commands/mod.d.ts +0 -115
  345. package/types/pkg/commands/mset.d.ts +0 -9
  346. package/types/pkg/commands/msetnx.d.ts +0 -9
  347. package/types/pkg/commands/persist.d.ts +0 -7
  348. package/types/pkg/commands/pexpire.d.ts +0 -7
  349. package/types/pkg/commands/pexpireat.d.ts +0 -7
  350. package/types/pkg/commands/ping.d.ts +0 -7
  351. package/types/pkg/commands/psetex.d.ts +0 -7
  352. package/types/pkg/commands/pttl.d.ts +0 -7
  353. package/types/pkg/commands/publish.d.ts +0 -7
  354. package/types/pkg/commands/randomkey.d.ts +0 -7
  355. package/types/pkg/commands/rename.d.ts +0 -7
  356. package/types/pkg/commands/renamenx.d.ts +0 -7
  357. package/types/pkg/commands/rpop.d.ts +0 -7
  358. package/types/pkg/commands/rpush.d.ts +0 -7
  359. package/types/pkg/commands/rpushx.d.ts +0 -7
  360. package/types/pkg/commands/sadd.d.ts +0 -7
  361. package/types/pkg/commands/scan.d.ts +0 -18
  362. package/types/pkg/commands/scard.d.ts +0 -7
  363. package/types/pkg/commands/script_exists.d.ts +0 -7
  364. package/types/pkg/commands/script_flush.d.ts +0 -14
  365. package/types/pkg/commands/script_load.d.ts +0 -7
  366. package/types/pkg/commands/sdiff.d.ts +0 -7
  367. package/types/pkg/commands/sdiffstore.d.ts +0 -7
  368. package/types/pkg/commands/set.d.ts +0 -55
  369. package/types/pkg/commands/setbit.d.ts +0 -7
  370. package/types/pkg/commands/setex.d.ts +0 -7
  371. package/types/pkg/commands/setnx.d.ts +0 -7
  372. package/types/pkg/commands/setrange.d.ts +0 -7
  373. package/types/pkg/commands/sinter.d.ts +0 -7
  374. package/types/pkg/commands/sinterstore.d.ts +0 -7
  375. package/types/pkg/commands/sismember.d.ts +0 -7
  376. package/types/pkg/commands/smembers.d.ts +0 -7
  377. package/types/pkg/commands/smove.d.ts +0 -7
  378. package/types/pkg/commands/spop.d.ts +0 -7
  379. package/types/pkg/commands/srandmember.d.ts +0 -7
  380. package/types/pkg/commands/srem.d.ts +0 -7
  381. package/types/pkg/commands/sscan.d.ts +0 -24
  382. package/types/pkg/commands/strlen.d.ts +0 -7
  383. package/types/pkg/commands/sunion.d.ts +0 -7
  384. package/types/pkg/commands/sunionstore.d.ts +0 -7
  385. package/types/pkg/commands/time.d.ts +0 -7
  386. package/types/pkg/commands/touch.d.ts +0 -7
  387. package/types/pkg/commands/ttl.d.ts +0 -7
  388. package/types/pkg/commands/type.d.ts +0 -8
  389. package/types/pkg/commands/unlink.d.ts +0 -7
  390. package/types/pkg/commands/zadd.d.ts +0 -35
  391. package/types/pkg/commands/zcard.d.ts +0 -7
  392. package/types/pkg/commands/zcount.d.ts +0 -7
  393. package/types/pkg/commands/zincrby.d.ts +0 -7
  394. package/types/pkg/commands/zinterstore.d.ts +0 -30
  395. package/types/pkg/commands/zlexcount.d.ts +0 -7
  396. package/types/pkg/commands/zmscore.d.ts +0 -7
  397. package/types/pkg/commands/zpopmax.d.ts +0 -7
  398. package/types/pkg/commands/zpopmin.d.ts +0 -7
  399. package/types/pkg/commands/zrange.d.ts +0 -42
  400. package/types/pkg/commands/zrank.d.ts +0 -7
  401. package/types/pkg/commands/zrem.d.ts +0 -7
  402. package/types/pkg/commands/zremrangebylex.d.ts +0 -7
  403. package/types/pkg/commands/zremrangebyrank.d.ts +0 -7
  404. package/types/pkg/commands/zremrangebyscore.d.ts +0 -7
  405. package/types/pkg/commands/zrevrank.d.ts +0 -7
  406. package/types/pkg/commands/zscan.d.ts +0 -24
  407. package/types/pkg/commands/zscore.d.ts +0 -7
  408. package/types/pkg/commands/zunionstore.d.ts +0 -30
  409. package/types/pkg/error.d.ts +0 -6
  410. package/types/pkg/http.d.ts +0 -54
  411. package/types/pkg/pipeline.d.ts +0 -552
  412. package/types/pkg/redis.d.ts +0 -534
  413. package/types/pkg/script.d.ts +0 -42
  414. package/types/pkg/types.d.ts +0 -1
  415. package/types/pkg/util.d.ts +0 -1
  416. package/types/platforms/cloudflare.d.ts +0 -42
  417. package/types/platforms/fastly.d.ts +0 -45
  418. package/types/platforms/node_with_fetch.d.ts +0 -82
  419. package/types/platforms/nodejs.d.ts +0 -81
@@ -0,0 +1,4421 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // pkg/error.ts
8
+ var error_exports = {};
9
+ __export(error_exports, {
10
+ UpstashError: () => UpstashError,
11
+ UrlError: () => UrlError
12
+ });
13
+ var UpstashError = class extends Error {
14
+ constructor(message) {
15
+ super(message);
16
+ this.name = "UpstashError";
17
+ }
18
+ };
19
+ var UrlError = class extends Error {
20
+ constructor(url) {
21
+ super(
22
+ `Upstash Redis client was passed an invalid URL. You should pass a URL starting with https. Received: "${url}". `
23
+ );
24
+ this.name = "UrlError";
25
+ }
26
+ };
27
+
28
+ // pkg/util.ts
29
+ function parseRecursive(obj) {
30
+ const parsed = Array.isArray(obj) ? obj.map((o) => {
31
+ try {
32
+ return parseRecursive(o);
33
+ } catch {
34
+ return o;
35
+ }
36
+ }) : JSON.parse(obj);
37
+ if (typeof parsed === "number" && parsed.toString() !== obj) {
38
+ return obj;
39
+ }
40
+ return parsed;
41
+ }
42
+ function parseResponse(result) {
43
+ try {
44
+ return parseRecursive(result);
45
+ } catch {
46
+ return result;
47
+ }
48
+ }
49
+ function deserializeScanResponse(result) {
50
+ return [result[0], ...parseResponse(result.slice(1))];
51
+ }
52
+ function mergeHeaders(...headers) {
53
+ const merged = {};
54
+ for (const header of headers) {
55
+ if (!header) continue;
56
+ for (const [key, value] of Object.entries(header)) {
57
+ if (value !== void 0 && value !== null) {
58
+ merged[key] = value;
59
+ }
60
+ }
61
+ }
62
+ return merged;
63
+ }
64
+
65
+ // pkg/http.ts
66
+ var HttpClient = class {
67
+ baseUrl;
68
+ headers;
69
+ options;
70
+ readYourWrites;
71
+ upstashSyncToken = "";
72
+ hasCredentials;
73
+ retry;
74
+ constructor(config) {
75
+ this.options = {
76
+ backend: config.options?.backend,
77
+ agent: config.agent,
78
+ responseEncoding: config.responseEncoding ?? "base64",
79
+ // default to base64
80
+ cache: config.cache,
81
+ signal: config.signal,
82
+ keepAlive: config.keepAlive ?? true
83
+ };
84
+ this.upstashSyncToken = "";
85
+ this.readYourWrites = config.readYourWrites ?? true;
86
+ this.baseUrl = (config.baseUrl || "").replace(/\/$/, "");
87
+ const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
88
+ if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
89
+ throw new UrlError(this.baseUrl);
90
+ }
91
+ this.headers = {
92
+ "Content-Type": "application/json",
93
+ ...config.headers
94
+ };
95
+ this.hasCredentials = Boolean(this.baseUrl && this.headers.authorization.split(" ")[1]);
96
+ if (this.options.responseEncoding === "base64") {
97
+ this.headers["Upstash-Encoding"] = "base64";
98
+ }
99
+ this.retry = typeof config.retry === "boolean" && !config.retry ? {
100
+ attempts: 1,
101
+ backoff: () => 0
102
+ } : {
103
+ attempts: config.retry?.retries ?? 5,
104
+ backoff: config.retry?.backoff ?? ((retryCount) => Math.exp(retryCount) * 50)
105
+ };
106
+ }
107
+ mergeTelemetry(telemetry) {
108
+ this.headers = merge(this.headers, "Upstash-Telemetry-Runtime", telemetry.runtime);
109
+ this.headers = merge(this.headers, "Upstash-Telemetry-Platform", telemetry.platform);
110
+ this.headers = merge(this.headers, "Upstash-Telemetry-Sdk", telemetry.sdk);
111
+ }
112
+ async request(req) {
113
+ const requestHeaders = mergeHeaders(this.headers, req.headers ?? {});
114
+ const requestUrl = [this.baseUrl, ...req.path ?? []].join("/");
115
+ const isEventStream = requestHeaders.Accept === "text/event-stream";
116
+ const requestOptions = {
117
+ //@ts-expect-error this should throw due to bun regression
118
+ cache: this.options.cache,
119
+ method: "POST",
120
+ headers: requestHeaders,
121
+ body: JSON.stringify(req.body),
122
+ keepalive: this.options.keepAlive,
123
+ agent: this.options.agent,
124
+ signal: req.signal ?? this.options.signal,
125
+ /**
126
+ * Fastly specific
127
+ */
128
+ backend: this.options.backend
129
+ };
130
+ if (!this.hasCredentials) {
131
+ console.warn(
132
+ "[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
133
+ );
134
+ }
135
+ if (this.readYourWrites) {
136
+ const newHeader = this.upstashSyncToken;
137
+ this.headers["upstash-sync-token"] = newHeader;
138
+ }
139
+ let res = null;
140
+ let error = null;
141
+ for (let i = 0; i <= this.retry.attempts; i++) {
142
+ try {
143
+ res = await fetch(requestUrl, requestOptions);
144
+ break;
145
+ } catch (error_) {
146
+ if (this.options.signal?.aborted) {
147
+ const myBlob = new Blob([
148
+ JSON.stringify({ result: this.options.signal.reason ?? "Aborted" })
149
+ ]);
150
+ const myOptions = {
151
+ status: 200,
152
+ statusText: this.options.signal.reason ?? "Aborted"
153
+ };
154
+ res = new Response(myBlob, myOptions);
155
+ break;
156
+ }
157
+ error = error_;
158
+ if (i < this.retry.attempts) {
159
+ await new Promise((r) => setTimeout(r, this.retry.backoff(i)));
160
+ }
161
+ }
162
+ }
163
+ if (!res) {
164
+ throw error ?? new Error("Exhausted all retries");
165
+ }
166
+ if (!res.ok) {
167
+ const body2 = await res.json();
168
+ throw new UpstashError(`${body2.error}, command was: ${JSON.stringify(req.body)}`);
169
+ }
170
+ if (this.readYourWrites) {
171
+ const headers = res.headers;
172
+ this.upstashSyncToken = headers.get("upstash-sync-token") ?? "";
173
+ }
174
+ if (isEventStream && req && req.onMessage && res.body) {
175
+ const reader = res.body.getReader();
176
+ const decoder = new TextDecoder();
177
+ (async () => {
178
+ try {
179
+ while (true) {
180
+ const { value, done } = await reader.read();
181
+ if (done) break;
182
+ const chunk = decoder.decode(value);
183
+ const lines = chunk.split("\n");
184
+ for (const line of lines) {
185
+ if (line.startsWith("data: ")) {
186
+ const data = line.slice(6);
187
+ req.onMessage?.(data);
188
+ }
189
+ }
190
+ }
191
+ } catch (error2) {
192
+ if (error2 instanceof Error && error2.name === "AbortError") {
193
+ } else {
194
+ console.error("Stream reading error:", error2);
195
+ }
196
+ } finally {
197
+ try {
198
+ await reader.cancel();
199
+ } catch {
200
+ }
201
+ }
202
+ })();
203
+ return { result: 1 };
204
+ }
205
+ const body = await res.json();
206
+ if (this.readYourWrites) {
207
+ const headers = res.headers;
208
+ this.upstashSyncToken = headers.get("upstash-sync-token") ?? "";
209
+ }
210
+ if (this.options.responseEncoding === "base64") {
211
+ if (Array.isArray(body)) {
212
+ return body.map(({ result: result2, error: error2 }) => ({
213
+ result: decode(result2),
214
+ error: error2
215
+ }));
216
+ }
217
+ const result = decode(body.result);
218
+ return { result, error: body.error };
219
+ }
220
+ return body;
221
+ }
222
+ };
223
+ function base64decode(b64) {
224
+ let dec = "";
225
+ try {
226
+ const binString = atob(b64);
227
+ const size = binString.length;
228
+ const bytes = new Uint8Array(size);
229
+ for (let i = 0; i < size; i++) {
230
+ bytes[i] = binString.charCodeAt(i);
231
+ }
232
+ dec = new TextDecoder().decode(bytes);
233
+ } catch {
234
+ dec = b64;
235
+ }
236
+ return dec;
237
+ }
238
+ function decode(raw) {
239
+ let result = void 0;
240
+ switch (typeof raw) {
241
+ case "undefined": {
242
+ return raw;
243
+ }
244
+ case "number": {
245
+ result = raw;
246
+ break;
247
+ }
248
+ case "object": {
249
+ if (Array.isArray(raw)) {
250
+ result = raw.map(
251
+ (v) => typeof v === "string" ? base64decode(v) : Array.isArray(v) ? v.map((element) => decode(element)) : v
252
+ );
253
+ } else {
254
+ result = null;
255
+ }
256
+ break;
257
+ }
258
+ case "string": {
259
+ result = raw === "OK" ? "OK" : base64decode(raw);
260
+ break;
261
+ }
262
+ default: {
263
+ break;
264
+ }
265
+ }
266
+ return result;
267
+ }
268
+ function merge(obj, key, value) {
269
+ if (!value) {
270
+ return obj;
271
+ }
272
+ obj[key] = obj[key] ? [obj[key], value].join(",") : value;
273
+ return obj;
274
+ }
275
+
276
+ // pkg/commands/command.ts
277
+ var defaultSerializer = (c) => {
278
+ switch (typeof c) {
279
+ case "string":
280
+ case "number":
281
+ case "boolean": {
282
+ return c;
283
+ }
284
+ default: {
285
+ return JSON.stringify(c);
286
+ }
287
+ }
288
+ };
289
+ var Command = class {
290
+ command;
291
+ serialize;
292
+ deserialize;
293
+ headers;
294
+ path;
295
+ onMessage;
296
+ isStreaming;
297
+ signal;
298
+ /**
299
+ * Create a new command instance.
300
+ *
301
+ * You can define a custom `deserialize` function. By default we try to deserialize as json.
302
+ */
303
+ constructor(command, opts) {
304
+ this.serialize = defaultSerializer;
305
+ this.deserialize = opts?.automaticDeserialization === void 0 || opts.automaticDeserialization ? opts?.deserialize ?? parseResponse : (x) => x;
306
+ this.command = command.map((c) => this.serialize(c));
307
+ this.headers = opts?.headers;
308
+ this.path = opts?.path;
309
+ this.onMessage = opts?.streamOptions?.onMessage;
310
+ this.isStreaming = opts?.streamOptions?.isStreaming ?? false;
311
+ this.signal = opts?.streamOptions?.signal;
312
+ if (opts?.latencyLogging) {
313
+ const originalExec = this.exec.bind(this);
314
+ this.exec = async (client) => {
315
+ const start = performance.now();
316
+ const result = await originalExec(client);
317
+ const end = performance.now();
318
+ const loggerResult = (end - start).toFixed(2);
319
+ console.log(
320
+ `Latency for \x1B[38;2;19;185;39m${this.command[0].toString().toUpperCase()}\x1B[0m: \x1B[38;2;0;255;255m${loggerResult} ms\x1B[0m`
321
+ );
322
+ return result;
323
+ };
324
+ }
325
+ }
326
+ /**
327
+ * Execute the command using a client.
328
+ */
329
+ async exec(client) {
330
+ const { result, error } = await client.request({
331
+ body: this.command,
332
+ path: this.path,
333
+ upstashSyncToken: client.upstashSyncToken,
334
+ headers: this.headers,
335
+ onMessage: this.onMessage,
336
+ isStreaming: this.isStreaming,
337
+ signal: this.signal
338
+ });
339
+ if (error) {
340
+ throw new UpstashError(error);
341
+ }
342
+ if (result === void 0) {
343
+ throw new TypeError("Request did not return a result");
344
+ }
345
+ return this.deserialize(result);
346
+ }
347
+ };
348
+
349
+ // pkg/commands/hrandfield.ts
350
+ function deserialize(result) {
351
+ if (result.length === 0) {
352
+ return null;
353
+ }
354
+ const obj = {};
355
+ for (let i = 0; i < result.length; i += 2) {
356
+ const key = result[i];
357
+ const value = result[i + 1];
358
+ try {
359
+ obj[key] = JSON.parse(value);
360
+ } catch {
361
+ obj[key] = value;
362
+ }
363
+ }
364
+ return obj;
365
+ }
366
+ var HRandFieldCommand = class extends Command {
367
+ constructor(cmd, opts) {
368
+ const command = ["hrandfield", cmd[0]];
369
+ if (typeof cmd[1] === "number") {
370
+ command.push(cmd[1]);
371
+ }
372
+ if (cmd[2]) {
373
+ command.push("WITHVALUES");
374
+ }
375
+ super(command, {
376
+ // @ts-expect-error to silence compiler
377
+ deserialize: cmd[2] ? (result) => deserialize(result) : opts?.deserialize,
378
+ ...opts
379
+ });
380
+ }
381
+ };
382
+
383
+ // pkg/commands/append.ts
384
+ var AppendCommand = class extends Command {
385
+ constructor(cmd, opts) {
386
+ super(["append", ...cmd], opts);
387
+ }
388
+ };
389
+
390
+ // pkg/commands/bitcount.ts
391
+ var BitCountCommand = class extends Command {
392
+ constructor([key, start, end], opts) {
393
+ const command = ["bitcount", key];
394
+ if (typeof start === "number") {
395
+ command.push(start);
396
+ }
397
+ if (typeof end === "number") {
398
+ command.push(end);
399
+ }
400
+ super(command, opts);
401
+ }
402
+ };
403
+
404
+ // pkg/commands/bitfield.ts
405
+ var BitFieldCommand = class {
406
+ constructor(args, client, opts, execOperation = (command) => command.exec(this.client)) {
407
+ this.client = client;
408
+ this.opts = opts;
409
+ this.execOperation = execOperation;
410
+ this.command = ["bitfield", ...args];
411
+ }
412
+ command;
413
+ chain(...args) {
414
+ this.command.push(...args);
415
+ return this;
416
+ }
417
+ get(...args) {
418
+ return this.chain("get", ...args);
419
+ }
420
+ set(...args) {
421
+ return this.chain("set", ...args);
422
+ }
423
+ incrby(...args) {
424
+ return this.chain("incrby", ...args);
425
+ }
426
+ overflow(overflow) {
427
+ return this.chain("overflow", overflow);
428
+ }
429
+ exec() {
430
+ const command = new Command(this.command, this.opts);
431
+ return this.execOperation(command);
432
+ }
433
+ };
434
+
435
+ // pkg/commands/bitop.ts
436
+ var BitOpCommand = class extends Command {
437
+ constructor(cmd, opts) {
438
+ super(["bitop", ...cmd], opts);
439
+ }
440
+ };
441
+
442
+ // pkg/commands/bitpos.ts
443
+ var BitPosCommand = class extends Command {
444
+ constructor(cmd, opts) {
445
+ super(["bitpos", ...cmd], opts);
446
+ }
447
+ };
448
+
449
+ // pkg/commands/copy.ts
450
+ var CopyCommand = class extends Command {
451
+ constructor([key, destinationKey, opts], commandOptions) {
452
+ super(["COPY", key, destinationKey, ...opts?.replace ? ["REPLACE"] : []], {
453
+ ...commandOptions,
454
+ deserialize(result) {
455
+ if (result > 0) {
456
+ return "COPIED";
457
+ }
458
+ return "NOT_COPIED";
459
+ }
460
+ });
461
+ }
462
+ };
463
+
464
+ // pkg/commands/dbsize.ts
465
+ var DBSizeCommand = class extends Command {
466
+ constructor(opts) {
467
+ super(["dbsize"], opts);
468
+ }
469
+ };
470
+
471
+ // pkg/commands/decr.ts
472
+ var DecrCommand = class extends Command {
473
+ constructor(cmd, opts) {
474
+ super(["decr", ...cmd], opts);
475
+ }
476
+ };
477
+
478
+ // pkg/commands/decrby.ts
479
+ var DecrByCommand = class extends Command {
480
+ constructor(cmd, opts) {
481
+ super(["decrby", ...cmd], opts);
482
+ }
483
+ };
484
+
485
+ // pkg/commands/del.ts
486
+ var DelCommand = class extends Command {
487
+ constructor(cmd, opts) {
488
+ super(["del", ...cmd], opts);
489
+ }
490
+ };
491
+
492
+ // pkg/commands/echo.ts
493
+ var EchoCommand = class extends Command {
494
+ constructor(cmd, opts) {
495
+ super(["echo", ...cmd], opts);
496
+ }
497
+ };
498
+
499
+ // pkg/commands/evalRo.ts
500
+ var EvalROCommand = class extends Command {
501
+ constructor([script, keys, args], opts) {
502
+ super(["eval_ro", script, keys.length, ...keys, ...args ?? []], opts);
503
+ }
504
+ };
505
+
506
+ // pkg/commands/eval.ts
507
+ var EvalCommand = class extends Command {
508
+ constructor([script, keys, args], opts) {
509
+ super(["eval", script, keys.length, ...keys, ...args ?? []], opts);
510
+ }
511
+ };
512
+
513
+ // pkg/commands/evalshaRo.ts
514
+ var EvalshaROCommand = class extends Command {
515
+ constructor([sha, keys, args], opts) {
516
+ super(["evalsha_ro", sha, keys.length, ...keys, ...args ?? []], opts);
517
+ }
518
+ };
519
+
520
+ // pkg/commands/evalsha.ts
521
+ var EvalshaCommand = class extends Command {
522
+ constructor([sha, keys, args], opts) {
523
+ super(["evalsha", sha, keys.length, ...keys, ...args ?? []], opts);
524
+ }
525
+ };
526
+
527
+ // pkg/commands/exec.ts
528
+ var ExecCommand = class extends Command {
529
+ constructor(cmd, opts) {
530
+ const normalizedCmd = cmd.map((arg) => typeof arg === "string" ? arg : String(arg));
531
+ super(normalizedCmd, opts);
532
+ }
533
+ };
534
+
535
+ // pkg/commands/exists.ts
536
+ var ExistsCommand = class extends Command {
537
+ constructor(cmd, opts) {
538
+ super(["exists", ...cmd], opts);
539
+ }
540
+ };
541
+
542
+ // pkg/commands/expire.ts
543
+ var ExpireCommand = class extends Command {
544
+ constructor(cmd, opts) {
545
+ super(["expire", ...cmd.filter(Boolean)], opts);
546
+ }
547
+ };
548
+
549
+ // pkg/commands/expireat.ts
550
+ var ExpireAtCommand = class extends Command {
551
+ constructor(cmd, opts) {
552
+ super(["expireat", ...cmd], opts);
553
+ }
554
+ };
555
+
556
+ // pkg/commands/flushall.ts
557
+ var FlushAllCommand = class extends Command {
558
+ constructor(args, opts) {
559
+ const command = ["flushall"];
560
+ if (args && args.length > 0 && args[0].async) {
561
+ command.push("async");
562
+ }
563
+ super(command, opts);
564
+ }
565
+ };
566
+
567
+ // pkg/commands/flushdb.ts
568
+ var FlushDBCommand = class extends Command {
569
+ constructor([opts], cmdOpts) {
570
+ const command = ["flushdb"];
571
+ if (opts?.async) {
572
+ command.push("async");
573
+ }
574
+ super(command, cmdOpts);
575
+ }
576
+ };
577
+
578
+ // pkg/commands/geo_add.ts
579
+ var GeoAddCommand = class extends Command {
580
+ constructor([key, arg1, ...arg2], opts) {
581
+ const command = ["geoadd", key];
582
+ if ("nx" in arg1 && arg1.nx) {
583
+ command.push("nx");
584
+ } else if ("xx" in arg1 && arg1.xx) {
585
+ command.push("xx");
586
+ }
587
+ if ("ch" in arg1 && arg1.ch) {
588
+ command.push("ch");
589
+ }
590
+ if ("latitude" in arg1 && arg1.latitude) {
591
+ command.push(arg1.longitude, arg1.latitude, arg1.member);
592
+ }
593
+ command.push(
594
+ ...arg2.flatMap(({ latitude, longitude, member }) => [longitude, latitude, member])
595
+ );
596
+ super(command, opts);
597
+ }
598
+ };
599
+
600
+ // pkg/commands/geo_dist.ts
601
+ var GeoDistCommand = class extends Command {
602
+ constructor([key, member1, member2, unit = "M"], opts) {
603
+ super(["GEODIST", key, member1, member2, unit], opts);
604
+ }
605
+ };
606
+
607
+ // pkg/commands/geo_hash.ts
608
+ var GeoHashCommand = class extends Command {
609
+ constructor(cmd, opts) {
610
+ const [key] = cmd;
611
+ const members = Array.isArray(cmd[1]) ? cmd[1] : cmd.slice(1);
612
+ super(["GEOHASH", key, ...members], opts);
613
+ }
614
+ };
615
+
616
+ // pkg/commands/geo_pos.ts
617
+ var GeoPosCommand = class extends Command {
618
+ constructor(cmd, opts) {
619
+ const [key] = cmd;
620
+ const members = Array.isArray(cmd[1]) ? cmd[1] : cmd.slice(1);
621
+ super(["GEOPOS", key, ...members], {
622
+ deserialize: (result) => transform(result),
623
+ ...opts
624
+ });
625
+ }
626
+ };
627
+ function transform(result) {
628
+ const final = [];
629
+ for (const pos of result) {
630
+ if (!pos?.[0] || !pos?.[1]) {
631
+ continue;
632
+ }
633
+ final.push({ lng: Number.parseFloat(pos[0]), lat: Number.parseFloat(pos[1]) });
634
+ }
635
+ return final;
636
+ }
637
+
638
+ // pkg/commands/geo_search.ts
639
+ var GeoSearchCommand = class extends Command {
640
+ constructor([key, centerPoint, shape, order, opts], commandOptions) {
641
+ const command = ["GEOSEARCH", key];
642
+ if (centerPoint.type === "FROMMEMBER" || centerPoint.type === "frommember") {
643
+ command.push(centerPoint.type, centerPoint.member);
644
+ }
645
+ if (centerPoint.type === "FROMLONLAT" || centerPoint.type === "fromlonlat") {
646
+ command.push(centerPoint.type, centerPoint.coordinate.lon, centerPoint.coordinate.lat);
647
+ }
648
+ if (shape.type === "BYRADIUS" || shape.type === "byradius") {
649
+ command.push(shape.type, shape.radius, shape.radiusType);
650
+ }
651
+ if (shape.type === "BYBOX" || shape.type === "bybox") {
652
+ command.push(shape.type, shape.rect.width, shape.rect.height, shape.rectType);
653
+ }
654
+ command.push(order);
655
+ if (opts?.count) {
656
+ command.push("COUNT", opts.count.limit, ...opts.count.any ? ["ANY"] : []);
657
+ }
658
+ const transform2 = (result) => {
659
+ if (!opts?.withCoord && !opts?.withDist && !opts?.withHash) {
660
+ return result.map((member) => {
661
+ try {
662
+ return { member: JSON.parse(member) };
663
+ } catch {
664
+ return { member };
665
+ }
666
+ });
667
+ }
668
+ return result.map((members) => {
669
+ let counter = 1;
670
+ const obj = {};
671
+ try {
672
+ obj.member = JSON.parse(members[0]);
673
+ } catch {
674
+ obj.member = members[0];
675
+ }
676
+ if (opts.withDist) {
677
+ obj.dist = Number.parseFloat(members[counter++]);
678
+ }
679
+ if (opts.withHash) {
680
+ obj.hash = members[counter++].toString();
681
+ }
682
+ if (opts.withCoord) {
683
+ obj.coord = {
684
+ long: Number.parseFloat(members[counter][0]),
685
+ lat: Number.parseFloat(members[counter][1])
686
+ };
687
+ }
688
+ return obj;
689
+ });
690
+ };
691
+ super(
692
+ [
693
+ ...command,
694
+ ...opts?.withCoord ? ["WITHCOORD"] : [],
695
+ ...opts?.withDist ? ["WITHDIST"] : [],
696
+ ...opts?.withHash ? ["WITHHASH"] : []
697
+ ],
698
+ {
699
+ deserialize: transform2,
700
+ ...commandOptions
701
+ }
702
+ );
703
+ }
704
+ };
705
+
706
+ // pkg/commands/geo_search_store.ts
707
+ var GeoSearchStoreCommand = class extends Command {
708
+ constructor([destination, key, centerPoint, shape, order, opts], commandOptions) {
709
+ const command = ["GEOSEARCHSTORE", destination, key];
710
+ if (centerPoint.type === "FROMMEMBER" || centerPoint.type === "frommember") {
711
+ command.push(centerPoint.type, centerPoint.member);
712
+ }
713
+ if (centerPoint.type === "FROMLONLAT" || centerPoint.type === "fromlonlat") {
714
+ command.push(centerPoint.type, centerPoint.coordinate.lon, centerPoint.coordinate.lat);
715
+ }
716
+ if (shape.type === "BYRADIUS" || shape.type === "byradius") {
717
+ command.push(shape.type, shape.radius, shape.radiusType);
718
+ }
719
+ if (shape.type === "BYBOX" || shape.type === "bybox") {
720
+ command.push(shape.type, shape.rect.width, shape.rect.height, shape.rectType);
721
+ }
722
+ command.push(order);
723
+ if (opts?.count) {
724
+ command.push("COUNT", opts.count.limit, ...opts.count.any ? ["ANY"] : []);
725
+ }
726
+ super([...command, ...opts?.storeDist ? ["STOREDIST"] : []], commandOptions);
727
+ }
728
+ };
729
+
730
+ // pkg/commands/get.ts
731
+ var GetCommand = class extends Command {
732
+ constructor(cmd, opts) {
733
+ super(["get", ...cmd], opts);
734
+ }
735
+ };
736
+
737
+ // pkg/commands/getbit.ts
738
+ var GetBitCommand = class extends Command {
739
+ constructor(cmd, opts) {
740
+ super(["getbit", ...cmd], opts);
741
+ }
742
+ };
743
+
744
+ // pkg/commands/getdel.ts
745
+ var GetDelCommand = class extends Command {
746
+ constructor(cmd, opts) {
747
+ super(["getdel", ...cmd], opts);
748
+ }
749
+ };
750
+
751
+ // pkg/commands/getex.ts
752
+ var GetExCommand = class extends Command {
753
+ constructor([key, opts], cmdOpts) {
754
+ const command = ["getex", key];
755
+ if (opts) {
756
+ if ("ex" in opts && typeof opts.ex === "number") {
757
+ command.push("ex", opts.ex);
758
+ } else if ("px" in opts && typeof opts.px === "number") {
759
+ command.push("px", opts.px);
760
+ } else if ("exat" in opts && typeof opts.exat === "number") {
761
+ command.push("exat", opts.exat);
762
+ } else if ("pxat" in opts && typeof opts.pxat === "number") {
763
+ command.push("pxat", opts.pxat);
764
+ } else if ("persist" in opts && opts.persist) {
765
+ command.push("persist");
766
+ }
767
+ }
768
+ super(command, cmdOpts);
769
+ }
770
+ };
771
+
772
+ // pkg/commands/getrange.ts
773
+ var GetRangeCommand = class extends Command {
774
+ constructor(cmd, opts) {
775
+ super(["getrange", ...cmd], opts);
776
+ }
777
+ };
778
+
779
+ // pkg/commands/getset.ts
780
+ var GetSetCommand = class extends Command {
781
+ constructor(cmd, opts) {
782
+ super(["getset", ...cmd], opts);
783
+ }
784
+ };
785
+
786
+ // pkg/commands/hdel.ts
787
+ var HDelCommand = class extends Command {
788
+ constructor(cmd, opts) {
789
+ super(["hdel", ...cmd], opts);
790
+ }
791
+ };
792
+
793
+ // pkg/commands/hexists.ts
794
+ var HExistsCommand = class extends Command {
795
+ constructor(cmd, opts) {
796
+ super(["hexists", ...cmd], opts);
797
+ }
798
+ };
799
+
800
+ // pkg/commands/hexpire.ts
801
+ var HExpireCommand = class extends Command {
802
+ constructor(cmd, opts) {
803
+ const [key, fields, seconds, option] = cmd;
804
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
805
+ super(
806
+ [
807
+ "hexpire",
808
+ key,
809
+ seconds,
810
+ ...option ? [option] : [],
811
+ "FIELDS",
812
+ fieldArray.length,
813
+ ...fieldArray
814
+ ],
815
+ opts
816
+ );
817
+ }
818
+ };
819
+
820
+ // pkg/commands/hexpireat.ts
821
+ var HExpireAtCommand = class extends Command {
822
+ constructor(cmd, opts) {
823
+ const [key, fields, timestamp, option] = cmd;
824
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
825
+ super(
826
+ [
827
+ "hexpireat",
828
+ key,
829
+ timestamp,
830
+ ...option ? [option] : [],
831
+ "FIELDS",
832
+ fieldArray.length,
833
+ ...fieldArray
834
+ ],
835
+ opts
836
+ );
837
+ }
838
+ };
839
+
840
+ // pkg/commands/hexpiretime.ts
841
+ var HExpireTimeCommand = class extends Command {
842
+ constructor(cmd, opts) {
843
+ const [key, fields] = cmd;
844
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
845
+ super(["hexpiretime", key, "FIELDS", fieldArray.length, ...fieldArray], opts);
846
+ }
847
+ };
848
+
849
+ // pkg/commands/hpersist.ts
850
+ var HPersistCommand = class extends Command {
851
+ constructor(cmd, opts) {
852
+ const [key, fields] = cmd;
853
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
854
+ super(["hpersist", key, "FIELDS", fieldArray.length, ...fieldArray], opts);
855
+ }
856
+ };
857
+
858
+ // pkg/commands/hpexpire.ts
859
+ var HPExpireCommand = class extends Command {
860
+ constructor(cmd, opts) {
861
+ const [key, fields, milliseconds, option] = cmd;
862
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
863
+ super(
864
+ [
865
+ "hpexpire",
866
+ key,
867
+ milliseconds,
868
+ ...option ? [option] : [],
869
+ "FIELDS",
870
+ fieldArray.length,
871
+ ...fieldArray
872
+ ],
873
+ opts
874
+ );
875
+ }
876
+ };
877
+
878
+ // pkg/commands/hpexpireat.ts
879
+ var HPExpireAtCommand = class extends Command {
880
+ constructor(cmd, opts) {
881
+ const [key, fields, timestamp, option] = cmd;
882
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
883
+ super(
884
+ [
885
+ "hpexpireat",
886
+ key,
887
+ timestamp,
888
+ ...option ? [option] : [],
889
+ "FIELDS",
890
+ fieldArray.length,
891
+ ...fieldArray
892
+ ],
893
+ opts
894
+ );
895
+ }
896
+ };
897
+
898
+ // pkg/commands/hpexpiretime.ts
899
+ var HPExpireTimeCommand = class extends Command {
900
+ constructor(cmd, opts) {
901
+ const [key, fields] = cmd;
902
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
903
+ super(["hpexpiretime", key, "FIELDS", fieldArray.length, ...fieldArray], opts);
904
+ }
905
+ };
906
+
907
+ // pkg/commands/hpttl.ts
908
+ var HPTtlCommand = class extends Command {
909
+ constructor(cmd, opts) {
910
+ const [key, fields] = cmd;
911
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
912
+ super(["hpttl", key, "FIELDS", fieldArray.length, ...fieldArray], opts);
913
+ }
914
+ };
915
+
916
+ // pkg/commands/hget.ts
917
+ var HGetCommand = class extends Command {
918
+ constructor(cmd, opts) {
919
+ super(["hget", ...cmd], opts);
920
+ }
921
+ };
922
+
923
+ // pkg/commands/hgetall.ts
924
+ function deserialize2(result) {
925
+ if (result.length === 0) {
926
+ return null;
927
+ }
928
+ const obj = {};
929
+ for (let i = 0; i < result.length; i += 2) {
930
+ const key = result[i];
931
+ const value = result[i + 1];
932
+ try {
933
+ const valueIsNumberAndNotSafeInteger = !Number.isNaN(Number(value)) && !Number.isSafeInteger(Number(value));
934
+ obj[key] = valueIsNumberAndNotSafeInteger ? value : JSON.parse(value);
935
+ } catch {
936
+ obj[key] = value;
937
+ }
938
+ }
939
+ return obj;
940
+ }
941
+ var HGetAllCommand = class extends Command {
942
+ constructor(cmd, opts) {
943
+ super(["hgetall", ...cmd], {
944
+ deserialize: (result) => deserialize2(result),
945
+ ...opts
946
+ });
947
+ }
948
+ };
949
+
950
+ // pkg/commands/hincrby.ts
951
+ var HIncrByCommand = class extends Command {
952
+ constructor(cmd, opts) {
953
+ super(["hincrby", ...cmd], opts);
954
+ }
955
+ };
956
+
957
+ // pkg/commands/hincrbyfloat.ts
958
+ var HIncrByFloatCommand = class extends Command {
959
+ constructor(cmd, opts) {
960
+ super(["hincrbyfloat", ...cmd], opts);
961
+ }
962
+ };
963
+
964
+ // pkg/commands/hkeys.ts
965
+ var HKeysCommand = class extends Command {
966
+ constructor([key], opts) {
967
+ super(["hkeys", key], opts);
968
+ }
969
+ };
970
+
971
+ // pkg/commands/hlen.ts
972
+ var HLenCommand = class extends Command {
973
+ constructor(cmd, opts) {
974
+ super(["hlen", ...cmd], opts);
975
+ }
976
+ };
977
+
978
+ // pkg/commands/hmget.ts
979
+ function deserialize3(fields, result) {
980
+ if (result.every((field) => field === null)) {
981
+ return null;
982
+ }
983
+ const obj = {};
984
+ for (const [i, field] of fields.entries()) {
985
+ try {
986
+ obj[field] = JSON.parse(result[i]);
987
+ } catch {
988
+ obj[field] = result[i];
989
+ }
990
+ }
991
+ return obj;
992
+ }
993
+ var HMGetCommand = class extends Command {
994
+ constructor([key, ...fields], opts) {
995
+ super(["hmget", key, ...fields], {
996
+ deserialize: (result) => deserialize3(fields, result),
997
+ ...opts
998
+ });
999
+ }
1000
+ };
1001
+
1002
+ // pkg/commands/hmset.ts
1003
+ var HMSetCommand = class extends Command {
1004
+ constructor([key, kv], opts) {
1005
+ super(["hmset", key, ...Object.entries(kv).flatMap(([field, value]) => [field, value])], opts);
1006
+ }
1007
+ };
1008
+
1009
+ // pkg/commands/hscan.ts
1010
+ var HScanCommand = class extends Command {
1011
+ constructor([key, cursor, cmdOpts], opts) {
1012
+ const command = ["hscan", key, cursor];
1013
+ if (cmdOpts?.match) {
1014
+ command.push("match", cmdOpts.match);
1015
+ }
1016
+ if (typeof cmdOpts?.count === "number") {
1017
+ command.push("count", cmdOpts.count);
1018
+ }
1019
+ super(command, {
1020
+ deserialize: deserializeScanResponse,
1021
+ ...opts
1022
+ });
1023
+ }
1024
+ };
1025
+
1026
+ // pkg/commands/hset.ts
1027
+ var HSetCommand = class extends Command {
1028
+ constructor([key, kv], opts) {
1029
+ super(["hset", key, ...Object.entries(kv).flatMap(([field, value]) => [field, value])], opts);
1030
+ }
1031
+ };
1032
+
1033
+ // pkg/commands/hsetnx.ts
1034
+ var HSetNXCommand = class extends Command {
1035
+ constructor(cmd, opts) {
1036
+ super(["hsetnx", ...cmd], opts);
1037
+ }
1038
+ };
1039
+
1040
+ // pkg/commands/hstrlen.ts
1041
+ var HStrLenCommand = class extends Command {
1042
+ constructor(cmd, opts) {
1043
+ super(["hstrlen", ...cmd], opts);
1044
+ }
1045
+ };
1046
+
1047
+ // pkg/commands/httl.ts
1048
+ var HTtlCommand = class extends Command {
1049
+ constructor(cmd, opts) {
1050
+ const [key, fields] = cmd;
1051
+ const fieldArray = Array.isArray(fields) ? fields : [fields];
1052
+ super(["httl", key, "FIELDS", fieldArray.length, ...fieldArray], opts);
1053
+ }
1054
+ };
1055
+
1056
+ // pkg/commands/hvals.ts
1057
+ var HValsCommand = class extends Command {
1058
+ constructor(cmd, opts) {
1059
+ super(["hvals", ...cmd], opts);
1060
+ }
1061
+ };
1062
+
1063
+ // pkg/commands/incr.ts
1064
+ var IncrCommand = class extends Command {
1065
+ constructor(cmd, opts) {
1066
+ super(["incr", ...cmd], opts);
1067
+ }
1068
+ };
1069
+
1070
+ // pkg/commands/incrby.ts
1071
+ var IncrByCommand = class extends Command {
1072
+ constructor(cmd, opts) {
1073
+ super(["incrby", ...cmd], opts);
1074
+ }
1075
+ };
1076
+
1077
+ // pkg/commands/incrbyfloat.ts
1078
+ var IncrByFloatCommand = class extends Command {
1079
+ constructor(cmd, opts) {
1080
+ super(["incrbyfloat", ...cmd], opts);
1081
+ }
1082
+ };
1083
+
1084
+ // pkg/commands/json_arrappend.ts
1085
+ var JsonArrAppendCommand = class extends Command {
1086
+ constructor(cmd, opts) {
1087
+ super(["JSON.ARRAPPEND", ...cmd], opts);
1088
+ }
1089
+ };
1090
+
1091
+ // pkg/commands/json_arrindex.ts
1092
+ var JsonArrIndexCommand = class extends Command {
1093
+ constructor(cmd, opts) {
1094
+ super(["JSON.ARRINDEX", ...cmd], opts);
1095
+ }
1096
+ };
1097
+
1098
+ // pkg/commands/json_arrinsert.ts
1099
+ var JsonArrInsertCommand = class extends Command {
1100
+ constructor(cmd, opts) {
1101
+ super(["JSON.ARRINSERT", ...cmd], opts);
1102
+ }
1103
+ };
1104
+
1105
+ // pkg/commands/json_arrlen.ts
1106
+ var JsonArrLenCommand = class extends Command {
1107
+ constructor(cmd, opts) {
1108
+ super(["JSON.ARRLEN", cmd[0], cmd[1] ?? "$"], opts);
1109
+ }
1110
+ };
1111
+
1112
+ // pkg/commands/json_arrpop.ts
1113
+ var JsonArrPopCommand = class extends Command {
1114
+ constructor(cmd, opts) {
1115
+ super(["JSON.ARRPOP", ...cmd], opts);
1116
+ }
1117
+ };
1118
+
1119
+ // pkg/commands/json_arrtrim.ts
1120
+ var JsonArrTrimCommand = class extends Command {
1121
+ constructor(cmd, opts) {
1122
+ const path = cmd[1] ?? "$";
1123
+ const start = cmd[2] ?? 0;
1124
+ const stop = cmd[3] ?? 0;
1125
+ super(["JSON.ARRTRIM", cmd[0], path, start, stop], opts);
1126
+ }
1127
+ };
1128
+
1129
+ // pkg/commands/json_clear.ts
1130
+ var JsonClearCommand = class extends Command {
1131
+ constructor(cmd, opts) {
1132
+ super(["JSON.CLEAR", ...cmd], opts);
1133
+ }
1134
+ };
1135
+
1136
+ // pkg/commands/json_del.ts
1137
+ var JsonDelCommand = class extends Command {
1138
+ constructor(cmd, opts) {
1139
+ super(["JSON.DEL", ...cmd], opts);
1140
+ }
1141
+ };
1142
+
1143
+ // pkg/commands/json_forget.ts
1144
+ var JsonForgetCommand = class extends Command {
1145
+ constructor(cmd, opts) {
1146
+ super(["JSON.FORGET", ...cmd], opts);
1147
+ }
1148
+ };
1149
+
1150
+ // pkg/commands/json_get.ts
1151
+ var JsonGetCommand = class extends Command {
1152
+ constructor(cmd, opts) {
1153
+ const command = ["JSON.GET"];
1154
+ if (typeof cmd[1] === "string") {
1155
+ command.push(...cmd);
1156
+ } else {
1157
+ command.push(cmd[0]);
1158
+ if (cmd[1]) {
1159
+ if (cmd[1].indent) {
1160
+ command.push("INDENT", cmd[1].indent);
1161
+ }
1162
+ if (cmd[1].newline) {
1163
+ command.push("NEWLINE", cmd[1].newline);
1164
+ }
1165
+ if (cmd[1].space) {
1166
+ command.push("SPACE", cmd[1].space);
1167
+ }
1168
+ }
1169
+ command.push(...cmd.slice(2));
1170
+ }
1171
+ super(command, opts);
1172
+ }
1173
+ };
1174
+
1175
+ // pkg/commands/json_merge.ts
1176
+ var JsonMergeCommand = class extends Command {
1177
+ constructor(cmd, opts) {
1178
+ const command = ["JSON.MERGE", ...cmd];
1179
+ super(command, opts);
1180
+ }
1181
+ };
1182
+
1183
+ // pkg/commands/json_mget.ts
1184
+ var JsonMGetCommand = class extends Command {
1185
+ constructor(cmd, opts) {
1186
+ super(["JSON.MGET", ...cmd[0], cmd[1]], opts);
1187
+ }
1188
+ };
1189
+
1190
+ // pkg/commands/json_mset.ts
1191
+ var JsonMSetCommand = class extends Command {
1192
+ constructor(cmd, opts) {
1193
+ const command = ["JSON.MSET"];
1194
+ for (const c of cmd) {
1195
+ command.push(c.key, c.path, c.value);
1196
+ }
1197
+ super(command, opts);
1198
+ }
1199
+ };
1200
+
1201
+ // pkg/commands/json_numincrby.ts
1202
+ var JsonNumIncrByCommand = class extends Command {
1203
+ constructor(cmd, opts) {
1204
+ super(["JSON.NUMINCRBY", ...cmd], opts);
1205
+ }
1206
+ };
1207
+
1208
+ // pkg/commands/json_nummultby.ts
1209
+ var JsonNumMultByCommand = class extends Command {
1210
+ constructor(cmd, opts) {
1211
+ super(["JSON.NUMMULTBY", ...cmd], opts);
1212
+ }
1213
+ };
1214
+
1215
+ // pkg/commands/json_objkeys.ts
1216
+ var JsonObjKeysCommand = class extends Command {
1217
+ constructor(cmd, opts) {
1218
+ super(["JSON.OBJKEYS", ...cmd], opts);
1219
+ }
1220
+ };
1221
+
1222
+ // pkg/commands/json_objlen.ts
1223
+ var JsonObjLenCommand = class extends Command {
1224
+ constructor(cmd, opts) {
1225
+ super(["JSON.OBJLEN", ...cmd], opts);
1226
+ }
1227
+ };
1228
+
1229
+ // pkg/commands/json_resp.ts
1230
+ var JsonRespCommand = class extends Command {
1231
+ constructor(cmd, opts) {
1232
+ super(["JSON.RESP", ...cmd], opts);
1233
+ }
1234
+ };
1235
+
1236
+ // pkg/commands/json_set.ts
1237
+ var JsonSetCommand = class extends Command {
1238
+ constructor(cmd, opts) {
1239
+ const command = ["JSON.SET", cmd[0], cmd[1], cmd[2]];
1240
+ if (cmd[3]) {
1241
+ if (cmd[3].nx) {
1242
+ command.push("NX");
1243
+ } else if (cmd[3].xx) {
1244
+ command.push("XX");
1245
+ }
1246
+ }
1247
+ super(command, opts);
1248
+ }
1249
+ };
1250
+
1251
+ // pkg/commands/json_strappend.ts
1252
+ var JsonStrAppendCommand = class extends Command {
1253
+ constructor(cmd, opts) {
1254
+ super(["JSON.STRAPPEND", ...cmd], opts);
1255
+ }
1256
+ };
1257
+
1258
+ // pkg/commands/json_strlen.ts
1259
+ var JsonStrLenCommand = class extends Command {
1260
+ constructor(cmd, opts) {
1261
+ super(["JSON.STRLEN", ...cmd], opts);
1262
+ }
1263
+ };
1264
+
1265
+ // pkg/commands/json_toggle.ts
1266
+ var JsonToggleCommand = class extends Command {
1267
+ constructor(cmd, opts) {
1268
+ super(["JSON.TOGGLE", ...cmd], opts);
1269
+ }
1270
+ };
1271
+
1272
+ // pkg/commands/json_type.ts
1273
+ var JsonTypeCommand = class extends Command {
1274
+ constructor(cmd, opts) {
1275
+ super(["JSON.TYPE", ...cmd], opts);
1276
+ }
1277
+ };
1278
+
1279
+ // pkg/commands/keys.ts
1280
+ var KeysCommand = class extends Command {
1281
+ constructor(cmd, opts) {
1282
+ super(["keys", ...cmd], opts);
1283
+ }
1284
+ };
1285
+
1286
+ // pkg/commands/lindex.ts
1287
+ var LIndexCommand = class extends Command {
1288
+ constructor(cmd, opts) {
1289
+ super(["lindex", ...cmd], opts);
1290
+ }
1291
+ };
1292
+
1293
+ // pkg/commands/linsert.ts
1294
+ var LInsertCommand = class extends Command {
1295
+ constructor(cmd, opts) {
1296
+ super(["linsert", ...cmd], opts);
1297
+ }
1298
+ };
1299
+
1300
+ // pkg/commands/llen.ts
1301
+ var LLenCommand = class extends Command {
1302
+ constructor(cmd, opts) {
1303
+ super(["llen", ...cmd], opts);
1304
+ }
1305
+ };
1306
+
1307
+ // pkg/commands/lmove.ts
1308
+ var LMoveCommand = class extends Command {
1309
+ constructor(cmd, opts) {
1310
+ super(["lmove", ...cmd], opts);
1311
+ }
1312
+ };
1313
+
1314
+ // pkg/commands/lmpop.ts
1315
+ var LmPopCommand = class extends Command {
1316
+ constructor(cmd, opts) {
1317
+ const [numkeys, keys, direction, count] = cmd;
1318
+ super(["LMPOP", numkeys, ...keys, direction, ...count ? ["COUNT", count] : []], opts);
1319
+ }
1320
+ };
1321
+
1322
+ // pkg/commands/lpop.ts
1323
+ var LPopCommand = class extends Command {
1324
+ constructor(cmd, opts) {
1325
+ super(["lpop", ...cmd], opts);
1326
+ }
1327
+ };
1328
+
1329
+ // pkg/commands/lpos.ts
1330
+ var LPosCommand = class extends Command {
1331
+ constructor(cmd, opts) {
1332
+ const args = ["lpos", cmd[0], cmd[1]];
1333
+ if (typeof cmd[2]?.rank === "number") {
1334
+ args.push("rank", cmd[2].rank);
1335
+ }
1336
+ if (typeof cmd[2]?.count === "number") {
1337
+ args.push("count", cmd[2].count);
1338
+ }
1339
+ if (typeof cmd[2]?.maxLen === "number") {
1340
+ args.push("maxLen", cmd[2].maxLen);
1341
+ }
1342
+ super(args, opts);
1343
+ }
1344
+ };
1345
+
1346
+ // pkg/commands/lpush.ts
1347
+ var LPushCommand = class extends Command {
1348
+ constructor(cmd, opts) {
1349
+ super(["lpush", ...cmd], opts);
1350
+ }
1351
+ };
1352
+
1353
+ // pkg/commands/lpushx.ts
1354
+ var LPushXCommand = class extends Command {
1355
+ constructor(cmd, opts) {
1356
+ super(["lpushx", ...cmd], opts);
1357
+ }
1358
+ };
1359
+
1360
+ // pkg/commands/lrange.ts
1361
+ var LRangeCommand = class extends Command {
1362
+ constructor(cmd, opts) {
1363
+ super(["lrange", ...cmd], opts);
1364
+ }
1365
+ };
1366
+
1367
+ // pkg/commands/lrem.ts
1368
+ var LRemCommand = class extends Command {
1369
+ constructor(cmd, opts) {
1370
+ super(["lrem", ...cmd], opts);
1371
+ }
1372
+ };
1373
+
1374
+ // pkg/commands/lset.ts
1375
+ var LSetCommand = class extends Command {
1376
+ constructor(cmd, opts) {
1377
+ super(["lset", ...cmd], opts);
1378
+ }
1379
+ };
1380
+
1381
+ // pkg/commands/ltrim.ts
1382
+ var LTrimCommand = class extends Command {
1383
+ constructor(cmd, opts) {
1384
+ super(["ltrim", ...cmd], opts);
1385
+ }
1386
+ };
1387
+
1388
+ // pkg/commands/mget.ts
1389
+ var MGetCommand = class extends Command {
1390
+ constructor(cmd, opts) {
1391
+ const keys = Array.isArray(cmd[0]) ? cmd[0] : cmd;
1392
+ super(["mget", ...keys], opts);
1393
+ }
1394
+ };
1395
+
1396
+ // pkg/commands/mset.ts
1397
+ var MSetCommand = class extends Command {
1398
+ constructor([kv], opts) {
1399
+ super(["mset", ...Object.entries(kv).flatMap(([key, value]) => [key, value])], opts);
1400
+ }
1401
+ };
1402
+
1403
+ // pkg/commands/msetnx.ts
1404
+ var MSetNXCommand = class extends Command {
1405
+ constructor([kv], opts) {
1406
+ super(["msetnx", ...Object.entries(kv).flat()], opts);
1407
+ }
1408
+ };
1409
+
1410
+ // pkg/commands/persist.ts
1411
+ var PersistCommand = class extends Command {
1412
+ constructor(cmd, opts) {
1413
+ super(["persist", ...cmd], opts);
1414
+ }
1415
+ };
1416
+
1417
+ // pkg/commands/pexpire.ts
1418
+ var PExpireCommand = class extends Command {
1419
+ constructor(cmd, opts) {
1420
+ super(["pexpire", ...cmd], opts);
1421
+ }
1422
+ };
1423
+
1424
+ // pkg/commands/pexpireat.ts
1425
+ var PExpireAtCommand = class extends Command {
1426
+ constructor(cmd, opts) {
1427
+ super(["pexpireat", ...cmd], opts);
1428
+ }
1429
+ };
1430
+
1431
+ // pkg/commands/pfadd.ts
1432
+ var PfAddCommand = class extends Command {
1433
+ constructor(cmd, opts) {
1434
+ super(["pfadd", ...cmd], opts);
1435
+ }
1436
+ };
1437
+
1438
+ // pkg/commands/pfcount.ts
1439
+ var PfCountCommand = class extends Command {
1440
+ constructor(cmd, opts) {
1441
+ super(["pfcount", ...cmd], opts);
1442
+ }
1443
+ };
1444
+
1445
+ // pkg/commands/pfmerge.ts
1446
+ var PfMergeCommand = class extends Command {
1447
+ constructor(cmd, opts) {
1448
+ super(["pfmerge", ...cmd], opts);
1449
+ }
1450
+ };
1451
+
1452
+ // pkg/commands/ping.ts
1453
+ var PingCommand = class extends Command {
1454
+ constructor(cmd, opts) {
1455
+ const command = ["ping"];
1456
+ if (cmd?.[0] !== void 0) {
1457
+ command.push(cmd[0]);
1458
+ }
1459
+ super(command, opts);
1460
+ }
1461
+ };
1462
+
1463
+ // pkg/commands/psetex.ts
1464
+ var PSetEXCommand = class extends Command {
1465
+ constructor(cmd, opts) {
1466
+ super(["psetex", ...cmd], opts);
1467
+ }
1468
+ };
1469
+
1470
+ // pkg/commands/pttl.ts
1471
+ var PTtlCommand = class extends Command {
1472
+ constructor(cmd, opts) {
1473
+ super(["pttl", ...cmd], opts);
1474
+ }
1475
+ };
1476
+
1477
+ // pkg/commands/publish.ts
1478
+ var PublishCommand = class extends Command {
1479
+ constructor(cmd, opts) {
1480
+ super(["publish", ...cmd], opts);
1481
+ }
1482
+ };
1483
+
1484
+ // pkg/commands/randomkey.ts
1485
+ var RandomKeyCommand = class extends Command {
1486
+ constructor(opts) {
1487
+ super(["randomkey"], opts);
1488
+ }
1489
+ };
1490
+
1491
+ // pkg/commands/rename.ts
1492
+ var RenameCommand = class extends Command {
1493
+ constructor(cmd, opts) {
1494
+ super(["rename", ...cmd], opts);
1495
+ }
1496
+ };
1497
+
1498
+ // pkg/commands/renamenx.ts
1499
+ var RenameNXCommand = class extends Command {
1500
+ constructor(cmd, opts) {
1501
+ super(["renamenx", ...cmd], opts);
1502
+ }
1503
+ };
1504
+
1505
+ // pkg/commands/rpop.ts
1506
+ var RPopCommand = class extends Command {
1507
+ constructor(cmd, opts) {
1508
+ super(["rpop", ...cmd], opts);
1509
+ }
1510
+ };
1511
+
1512
+ // pkg/commands/rpush.ts
1513
+ var RPushCommand = class extends Command {
1514
+ constructor(cmd, opts) {
1515
+ super(["rpush", ...cmd], opts);
1516
+ }
1517
+ };
1518
+
1519
+ // pkg/commands/rpushx.ts
1520
+ var RPushXCommand = class extends Command {
1521
+ constructor(cmd, opts) {
1522
+ super(["rpushx", ...cmd], opts);
1523
+ }
1524
+ };
1525
+
1526
+ // pkg/commands/sadd.ts
1527
+ var SAddCommand = class extends Command {
1528
+ constructor(cmd, opts) {
1529
+ super(["sadd", ...cmd], opts);
1530
+ }
1531
+ };
1532
+
1533
+ // pkg/commands/scan.ts
1534
+ var ScanCommand = class extends Command {
1535
+ constructor([cursor, opts], cmdOpts) {
1536
+ const command = ["scan", cursor];
1537
+ if (opts?.match) {
1538
+ command.push("match", opts.match);
1539
+ }
1540
+ if (typeof opts?.count === "number") {
1541
+ command.push("count", opts.count);
1542
+ }
1543
+ if (opts?.type && opts.type.length > 0) {
1544
+ command.push("type", opts.type);
1545
+ }
1546
+ super(command, {
1547
+ deserialize: deserializeScanResponse,
1548
+ ...cmdOpts
1549
+ });
1550
+ }
1551
+ };
1552
+
1553
+ // pkg/commands/scard.ts
1554
+ var SCardCommand = class extends Command {
1555
+ constructor(cmd, opts) {
1556
+ super(["scard", ...cmd], opts);
1557
+ }
1558
+ };
1559
+
1560
+ // pkg/commands/script_exists.ts
1561
+ var ScriptExistsCommand = class extends Command {
1562
+ constructor(hashes, opts) {
1563
+ super(["script", "exists", ...hashes], {
1564
+ deserialize: (result) => result,
1565
+ ...opts
1566
+ });
1567
+ }
1568
+ };
1569
+
1570
+ // pkg/commands/script_flush.ts
1571
+ var ScriptFlushCommand = class extends Command {
1572
+ constructor([opts], cmdOpts) {
1573
+ const cmd = ["script", "flush"];
1574
+ if (opts?.sync) {
1575
+ cmd.push("sync");
1576
+ } else if (opts?.async) {
1577
+ cmd.push("async");
1578
+ }
1579
+ super(cmd, cmdOpts);
1580
+ }
1581
+ };
1582
+
1583
+ // pkg/commands/script_load.ts
1584
+ var ScriptLoadCommand = class extends Command {
1585
+ constructor(args, opts) {
1586
+ super(["script", "load", ...args], opts);
1587
+ }
1588
+ };
1589
+
1590
+ // pkg/commands/sdiff.ts
1591
+ var SDiffCommand = class extends Command {
1592
+ constructor(cmd, opts) {
1593
+ super(["sdiff", ...cmd], opts);
1594
+ }
1595
+ };
1596
+
1597
+ // pkg/commands/sdiffstore.ts
1598
+ var SDiffStoreCommand = class extends Command {
1599
+ constructor(cmd, opts) {
1600
+ super(["sdiffstore", ...cmd], opts);
1601
+ }
1602
+ };
1603
+
1604
+ // pkg/commands/set.ts
1605
+ var SetCommand = class extends Command {
1606
+ constructor([key, value, opts], cmdOpts) {
1607
+ const command = ["set", key, value];
1608
+ if (opts) {
1609
+ if ("nx" in opts && opts.nx) {
1610
+ command.push("nx");
1611
+ } else if ("xx" in opts && opts.xx) {
1612
+ command.push("xx");
1613
+ }
1614
+ if ("get" in opts && opts.get) {
1615
+ command.push("get");
1616
+ }
1617
+ if ("ex" in opts && typeof opts.ex === "number") {
1618
+ command.push("ex", opts.ex);
1619
+ } else if ("px" in opts && typeof opts.px === "number") {
1620
+ command.push("px", opts.px);
1621
+ } else if ("exat" in opts && typeof opts.exat === "number") {
1622
+ command.push("exat", opts.exat);
1623
+ } else if ("pxat" in opts && typeof opts.pxat === "number") {
1624
+ command.push("pxat", opts.pxat);
1625
+ } else if ("keepTtl" in opts && opts.keepTtl) {
1626
+ command.push("keepTtl");
1627
+ }
1628
+ }
1629
+ super(command, cmdOpts);
1630
+ }
1631
+ };
1632
+
1633
+ // pkg/commands/setbit.ts
1634
+ var SetBitCommand = class extends Command {
1635
+ constructor(cmd, opts) {
1636
+ super(["setbit", ...cmd], opts);
1637
+ }
1638
+ };
1639
+
1640
+ // pkg/commands/setex.ts
1641
+ var SetExCommand = class extends Command {
1642
+ constructor(cmd, opts) {
1643
+ super(["setex", ...cmd], opts);
1644
+ }
1645
+ };
1646
+
1647
+ // pkg/commands/setnx.ts
1648
+ var SetNxCommand = class extends Command {
1649
+ constructor(cmd, opts) {
1650
+ super(["setnx", ...cmd], opts);
1651
+ }
1652
+ };
1653
+
1654
+ // pkg/commands/setrange.ts
1655
+ var SetRangeCommand = class extends Command {
1656
+ constructor(cmd, opts) {
1657
+ super(["setrange", ...cmd], opts);
1658
+ }
1659
+ };
1660
+
1661
+ // pkg/commands/sinter.ts
1662
+ var SInterCommand = class extends Command {
1663
+ constructor(cmd, opts) {
1664
+ super(["sinter", ...cmd], opts);
1665
+ }
1666
+ };
1667
+
1668
+ // pkg/commands/sinterstore.ts
1669
+ var SInterStoreCommand = class extends Command {
1670
+ constructor(cmd, opts) {
1671
+ super(["sinterstore", ...cmd], opts);
1672
+ }
1673
+ };
1674
+
1675
+ // pkg/commands/sismember.ts
1676
+ var SIsMemberCommand = class extends Command {
1677
+ constructor(cmd, opts) {
1678
+ super(["sismember", ...cmd], opts);
1679
+ }
1680
+ };
1681
+
1682
+ // pkg/commands/smembers.ts
1683
+ var SMembersCommand = class extends Command {
1684
+ constructor(cmd, opts) {
1685
+ super(["smembers", ...cmd], opts);
1686
+ }
1687
+ };
1688
+
1689
+ // pkg/commands/smismember.ts
1690
+ var SMIsMemberCommand = class extends Command {
1691
+ constructor(cmd, opts) {
1692
+ super(["smismember", cmd[0], ...cmd[1]], opts);
1693
+ }
1694
+ };
1695
+
1696
+ // pkg/commands/smove.ts
1697
+ var SMoveCommand = class extends Command {
1698
+ constructor(cmd, opts) {
1699
+ super(["smove", ...cmd], opts);
1700
+ }
1701
+ };
1702
+
1703
+ // pkg/commands/spop.ts
1704
+ var SPopCommand = class extends Command {
1705
+ constructor([key, count], opts) {
1706
+ const command = ["spop", key];
1707
+ if (typeof count === "number") {
1708
+ command.push(count);
1709
+ }
1710
+ super(command, opts);
1711
+ }
1712
+ };
1713
+
1714
+ // pkg/commands/srandmember.ts
1715
+ var SRandMemberCommand = class extends Command {
1716
+ constructor([key, count], opts) {
1717
+ const command = ["srandmember", key];
1718
+ if (typeof count === "number") {
1719
+ command.push(count);
1720
+ }
1721
+ super(command, opts);
1722
+ }
1723
+ };
1724
+
1725
+ // pkg/commands/srem.ts
1726
+ var SRemCommand = class extends Command {
1727
+ constructor(cmd, opts) {
1728
+ super(["srem", ...cmd], opts);
1729
+ }
1730
+ };
1731
+
1732
+ // pkg/commands/sscan.ts
1733
+ var SScanCommand = class extends Command {
1734
+ constructor([key, cursor, opts], cmdOpts) {
1735
+ const command = ["sscan", key, cursor];
1736
+ if (opts?.match) {
1737
+ command.push("match", opts.match);
1738
+ }
1739
+ if (typeof opts?.count === "number") {
1740
+ command.push("count", opts.count);
1741
+ }
1742
+ super(command, {
1743
+ deserialize: deserializeScanResponse,
1744
+ ...cmdOpts
1745
+ });
1746
+ }
1747
+ };
1748
+
1749
+ // pkg/commands/strlen.ts
1750
+ var StrLenCommand = class extends Command {
1751
+ constructor(cmd, opts) {
1752
+ super(["strlen", ...cmd], opts);
1753
+ }
1754
+ };
1755
+
1756
+ // pkg/commands/sunion.ts
1757
+ var SUnionCommand = class extends Command {
1758
+ constructor(cmd, opts) {
1759
+ super(["sunion", ...cmd], opts);
1760
+ }
1761
+ };
1762
+
1763
+ // pkg/commands/sunionstore.ts
1764
+ var SUnionStoreCommand = class extends Command {
1765
+ constructor(cmd, opts) {
1766
+ super(["sunionstore", ...cmd], opts);
1767
+ }
1768
+ };
1769
+
1770
+ // pkg/commands/time.ts
1771
+ var TimeCommand = class extends Command {
1772
+ constructor(opts) {
1773
+ super(["time"], opts);
1774
+ }
1775
+ };
1776
+
1777
+ // pkg/commands/touch.ts
1778
+ var TouchCommand = class extends Command {
1779
+ constructor(cmd, opts) {
1780
+ super(["touch", ...cmd], opts);
1781
+ }
1782
+ };
1783
+
1784
+ // pkg/commands/ttl.ts
1785
+ var TtlCommand = class extends Command {
1786
+ constructor(cmd, opts) {
1787
+ super(["ttl", ...cmd], opts);
1788
+ }
1789
+ };
1790
+
1791
+ // pkg/commands/type.ts
1792
+ var TypeCommand = class extends Command {
1793
+ constructor(cmd, opts) {
1794
+ super(["type", ...cmd], opts);
1795
+ }
1796
+ };
1797
+
1798
+ // pkg/commands/unlink.ts
1799
+ var UnlinkCommand = class extends Command {
1800
+ constructor(cmd, opts) {
1801
+ super(["unlink", ...cmd], opts);
1802
+ }
1803
+ };
1804
+
1805
+ // pkg/commands/xack.ts
1806
+ var XAckCommand = class extends Command {
1807
+ constructor([key, group, id], opts) {
1808
+ const ids = Array.isArray(id) ? [...id] : [id];
1809
+ super(["XACK", key, group, ...ids], opts);
1810
+ }
1811
+ };
1812
+
1813
+ // pkg/commands/xadd.ts
1814
+ var XAddCommand = class extends Command {
1815
+ constructor([key, id, entries, opts], commandOptions) {
1816
+ const command = ["XADD", key];
1817
+ if (opts) {
1818
+ if (opts.nomkStream) {
1819
+ command.push("NOMKSTREAM");
1820
+ }
1821
+ if (opts.trim) {
1822
+ command.push(opts.trim.type, opts.trim.comparison, opts.trim.threshold);
1823
+ if (opts.trim.limit !== void 0) {
1824
+ command.push("LIMIT", opts.trim.limit);
1825
+ }
1826
+ }
1827
+ }
1828
+ command.push(id);
1829
+ for (const [k, v] of Object.entries(entries)) {
1830
+ command.push(k, v);
1831
+ }
1832
+ super(command, commandOptions);
1833
+ }
1834
+ };
1835
+
1836
+ // pkg/commands/xautoclaim.ts
1837
+ var XAutoClaim = class extends Command {
1838
+ constructor([key, group, consumer, minIdleTime, start, options], opts) {
1839
+ const commands = [];
1840
+ if (options?.count) {
1841
+ commands.push("COUNT", options.count);
1842
+ }
1843
+ if (options?.justId) {
1844
+ commands.push("JUSTID");
1845
+ }
1846
+ super(["XAUTOCLAIM", key, group, consumer, minIdleTime, start, ...commands], opts);
1847
+ }
1848
+ };
1849
+
1850
+ // pkg/commands/xclaim.ts
1851
+ var XClaimCommand = class extends Command {
1852
+ constructor([key, group, consumer, minIdleTime, id, options], opts) {
1853
+ const ids = Array.isArray(id) ? [...id] : [id];
1854
+ const commands = [];
1855
+ if (options?.idleMS) {
1856
+ commands.push("IDLE", options.idleMS);
1857
+ }
1858
+ if (options?.idleMS) {
1859
+ commands.push("TIME", options.timeMS);
1860
+ }
1861
+ if (options?.retryCount) {
1862
+ commands.push("RETRYCOUNT", options.retryCount);
1863
+ }
1864
+ if (options?.force) {
1865
+ commands.push("FORCE");
1866
+ }
1867
+ if (options?.justId) {
1868
+ commands.push("JUSTID");
1869
+ }
1870
+ if (options?.lastId) {
1871
+ commands.push("LASTID", options.lastId);
1872
+ }
1873
+ super(["XCLAIM", key, group, consumer, minIdleTime, ...ids, ...commands], opts);
1874
+ }
1875
+ };
1876
+
1877
+ // pkg/commands/xdel.ts
1878
+ var XDelCommand = class extends Command {
1879
+ constructor([key, ids], opts) {
1880
+ const cmds = Array.isArray(ids) ? [...ids] : [ids];
1881
+ super(["XDEL", key, ...cmds], opts);
1882
+ }
1883
+ };
1884
+
1885
+ // pkg/commands/xgroup.ts
1886
+ var XGroupCommand = class extends Command {
1887
+ constructor([key, opts], commandOptions) {
1888
+ const command = ["XGROUP"];
1889
+ switch (opts.type) {
1890
+ case "CREATE": {
1891
+ command.push("CREATE", key, opts.group, opts.id);
1892
+ if (opts.options) {
1893
+ if (opts.options.MKSTREAM) {
1894
+ command.push("MKSTREAM");
1895
+ }
1896
+ if (opts.options.ENTRIESREAD !== void 0) {
1897
+ command.push("ENTRIESREAD", opts.options.ENTRIESREAD.toString());
1898
+ }
1899
+ }
1900
+ break;
1901
+ }
1902
+ case "CREATECONSUMER": {
1903
+ command.push("CREATECONSUMER", key, opts.group, opts.consumer);
1904
+ break;
1905
+ }
1906
+ case "DELCONSUMER": {
1907
+ command.push("DELCONSUMER", key, opts.group, opts.consumer);
1908
+ break;
1909
+ }
1910
+ case "DESTROY": {
1911
+ command.push("DESTROY", key, opts.group);
1912
+ break;
1913
+ }
1914
+ case "SETID": {
1915
+ command.push("SETID", key, opts.group, opts.id);
1916
+ if (opts.options?.ENTRIESREAD !== void 0) {
1917
+ command.push("ENTRIESREAD", opts.options.ENTRIESREAD.toString());
1918
+ }
1919
+ break;
1920
+ }
1921
+ default: {
1922
+ throw new Error("Invalid XGROUP");
1923
+ }
1924
+ }
1925
+ super(command, commandOptions);
1926
+ }
1927
+ };
1928
+
1929
+ // pkg/commands/xinfo.ts
1930
+ var XInfoCommand = class extends Command {
1931
+ constructor([key, options], opts) {
1932
+ const cmds = [];
1933
+ if (options.type === "CONSUMERS") {
1934
+ cmds.push("CONSUMERS", key, options.group);
1935
+ } else {
1936
+ cmds.push("GROUPS", key);
1937
+ }
1938
+ super(["XINFO", ...cmds], opts);
1939
+ }
1940
+ };
1941
+
1942
+ // pkg/commands/xlen.ts
1943
+ var XLenCommand = class extends Command {
1944
+ constructor(cmd, opts) {
1945
+ super(["XLEN", ...cmd], opts);
1946
+ }
1947
+ };
1948
+
1949
+ // pkg/commands/xpending.ts
1950
+ var XPendingCommand = class extends Command {
1951
+ constructor([key, group, start, end, count, options], opts) {
1952
+ const consumers = options?.consumer === void 0 ? [] : Array.isArray(options.consumer) ? [...options.consumer] : [options.consumer];
1953
+ super(
1954
+ [
1955
+ "XPENDING",
1956
+ key,
1957
+ group,
1958
+ ...options?.idleTime ? ["IDLE", options.idleTime] : [],
1959
+ start,
1960
+ end,
1961
+ count,
1962
+ ...consumers
1963
+ ],
1964
+ opts
1965
+ );
1966
+ }
1967
+ };
1968
+
1969
+ // pkg/commands/xrange.ts
1970
+ function deserialize4(result) {
1971
+ const obj = {};
1972
+ for (const e of result) {
1973
+ for (let i = 0; i < e.length; i += 2) {
1974
+ const streamId = e[i];
1975
+ const entries = e[i + 1];
1976
+ if (!(streamId in obj)) {
1977
+ obj[streamId] = {};
1978
+ }
1979
+ for (let j = 0; j < entries.length; j += 2) {
1980
+ const field = entries[j];
1981
+ const value = entries[j + 1];
1982
+ try {
1983
+ obj[streamId][field] = JSON.parse(value);
1984
+ } catch {
1985
+ obj[streamId][field] = value;
1986
+ }
1987
+ }
1988
+ }
1989
+ }
1990
+ return obj;
1991
+ }
1992
+ var XRangeCommand = class extends Command {
1993
+ constructor([key, start, end, count], opts) {
1994
+ const command = ["XRANGE", key, start, end];
1995
+ if (typeof count === "number") {
1996
+ command.push("COUNT", count);
1997
+ }
1998
+ super(command, {
1999
+ deserialize: (result) => deserialize4(result),
2000
+ ...opts
2001
+ });
2002
+ }
2003
+ };
2004
+
2005
+ // pkg/commands/xread.ts
2006
+ var UNBALANCED_XREAD_ERR = "ERR Unbalanced XREAD list of streams: for each stream key an ID or '$' must be specified";
2007
+ var XReadCommand = class extends Command {
2008
+ constructor([key, id, options], opts) {
2009
+ if (Array.isArray(key) && Array.isArray(id) && key.length !== id.length) {
2010
+ throw new Error(UNBALANCED_XREAD_ERR);
2011
+ }
2012
+ const commands = [];
2013
+ if (typeof options?.count === "number") {
2014
+ commands.push("COUNT", options.count);
2015
+ }
2016
+ if (typeof options?.blockMS === "number") {
2017
+ commands.push("BLOCK", options.blockMS);
2018
+ }
2019
+ commands.push(
2020
+ "STREAMS",
2021
+ ...Array.isArray(key) ? [...key] : [key],
2022
+ ...Array.isArray(id) ? [...id] : [id]
2023
+ );
2024
+ super(["XREAD", ...commands], opts);
2025
+ }
2026
+ };
2027
+
2028
+ // pkg/commands/xreadgroup.ts
2029
+ var UNBALANCED_XREADGROUP_ERR = "ERR Unbalanced XREADGROUP list of streams: for each stream key an ID or '$' must be specified";
2030
+ var XReadGroupCommand = class extends Command {
2031
+ constructor([group, consumer, key, id, options], opts) {
2032
+ if (Array.isArray(key) && Array.isArray(id) && key.length !== id.length) {
2033
+ throw new Error(UNBALANCED_XREADGROUP_ERR);
2034
+ }
2035
+ const commands = [];
2036
+ if (typeof options?.count === "number") {
2037
+ commands.push("COUNT", options.count);
2038
+ }
2039
+ if (typeof options?.blockMS === "number") {
2040
+ commands.push("BLOCK", options.blockMS);
2041
+ }
2042
+ if (typeof options?.NOACK === "boolean" && options.NOACK) {
2043
+ commands.push("NOACK");
2044
+ }
2045
+ commands.push(
2046
+ "STREAMS",
2047
+ ...Array.isArray(key) ? [...key] : [key],
2048
+ ...Array.isArray(id) ? [...id] : [id]
2049
+ );
2050
+ super(["XREADGROUP", "GROUP", group, consumer, ...commands], opts);
2051
+ }
2052
+ };
2053
+
2054
+ // pkg/commands/xrevrange.ts
2055
+ var XRevRangeCommand = class extends Command {
2056
+ constructor([key, end, start, count], opts) {
2057
+ const command = ["XREVRANGE", key, end, start];
2058
+ if (typeof count === "number") {
2059
+ command.push("COUNT", count);
2060
+ }
2061
+ super(command, {
2062
+ deserialize: (result) => deserialize5(result),
2063
+ ...opts
2064
+ });
2065
+ }
2066
+ };
2067
+ function deserialize5(result) {
2068
+ const obj = {};
2069
+ for (const e of result) {
2070
+ for (let i = 0; i < e.length; i += 2) {
2071
+ const streamId = e[i];
2072
+ const entries = e[i + 1];
2073
+ if (!(streamId in obj)) {
2074
+ obj[streamId] = {};
2075
+ }
2076
+ for (let j = 0; j < entries.length; j += 2) {
2077
+ const field = entries[j];
2078
+ const value = entries[j + 1];
2079
+ try {
2080
+ obj[streamId][field] = JSON.parse(value);
2081
+ } catch {
2082
+ obj[streamId][field] = value;
2083
+ }
2084
+ }
2085
+ }
2086
+ }
2087
+ return obj;
2088
+ }
2089
+
2090
+ // pkg/commands/xtrim.ts
2091
+ var XTrimCommand = class extends Command {
2092
+ constructor([key, options], opts) {
2093
+ const { limit, strategy, threshold, exactness = "~" } = options;
2094
+ super(["XTRIM", key, strategy, exactness, threshold, ...limit ? ["LIMIT", limit] : []], opts);
2095
+ }
2096
+ };
2097
+
2098
+ // pkg/commands/zadd.ts
2099
+ var ZAddCommand = class extends Command {
2100
+ constructor([key, arg1, ...arg2], opts) {
2101
+ const command = ["zadd", key];
2102
+ if ("nx" in arg1 && arg1.nx) {
2103
+ command.push("nx");
2104
+ } else if ("xx" in arg1 && arg1.xx) {
2105
+ command.push("xx");
2106
+ }
2107
+ if ("ch" in arg1 && arg1.ch) {
2108
+ command.push("ch");
2109
+ }
2110
+ if ("incr" in arg1 && arg1.incr) {
2111
+ command.push("incr");
2112
+ }
2113
+ if ("lt" in arg1 && arg1.lt) {
2114
+ command.push("lt");
2115
+ } else if ("gt" in arg1 && arg1.gt) {
2116
+ command.push("gt");
2117
+ }
2118
+ if ("score" in arg1 && "member" in arg1) {
2119
+ command.push(arg1.score, arg1.member);
2120
+ }
2121
+ command.push(...arg2.flatMap(({ score, member }) => [score, member]));
2122
+ super(command, opts);
2123
+ }
2124
+ };
2125
+
2126
+ // pkg/commands/zcard.ts
2127
+ var ZCardCommand = class extends Command {
2128
+ constructor(cmd, opts) {
2129
+ super(["zcard", ...cmd], opts);
2130
+ }
2131
+ };
2132
+
2133
+ // pkg/commands/zcount.ts
2134
+ var ZCountCommand = class extends Command {
2135
+ constructor(cmd, opts) {
2136
+ super(["zcount", ...cmd], opts);
2137
+ }
2138
+ };
2139
+
2140
+ // pkg/commands/zincrby.ts
2141
+ var ZIncrByCommand = class extends Command {
2142
+ constructor(cmd, opts) {
2143
+ super(["zincrby", ...cmd], opts);
2144
+ }
2145
+ };
2146
+
2147
+ // pkg/commands/zinterstore.ts
2148
+ var ZInterStoreCommand = class extends Command {
2149
+ constructor([destination, numKeys, keyOrKeys, opts], cmdOpts) {
2150
+ const command = ["zinterstore", destination, numKeys];
2151
+ if (Array.isArray(keyOrKeys)) {
2152
+ command.push(...keyOrKeys);
2153
+ } else {
2154
+ command.push(keyOrKeys);
2155
+ }
2156
+ if (opts) {
2157
+ if ("weights" in opts && opts.weights) {
2158
+ command.push("weights", ...opts.weights);
2159
+ } else if ("weight" in opts && typeof opts.weight === "number") {
2160
+ command.push("weights", opts.weight);
2161
+ }
2162
+ if ("aggregate" in opts) {
2163
+ command.push("aggregate", opts.aggregate);
2164
+ }
2165
+ }
2166
+ super(command, cmdOpts);
2167
+ }
2168
+ };
2169
+
2170
+ // pkg/commands/zlexcount.ts
2171
+ var ZLexCountCommand = class extends Command {
2172
+ constructor(cmd, opts) {
2173
+ super(["zlexcount", ...cmd], opts);
2174
+ }
2175
+ };
2176
+
2177
+ // pkg/commands/zpopmax.ts
2178
+ var ZPopMaxCommand = class extends Command {
2179
+ constructor([key, count], opts) {
2180
+ const command = ["zpopmax", key];
2181
+ if (typeof count === "number") {
2182
+ command.push(count);
2183
+ }
2184
+ super(command, opts);
2185
+ }
2186
+ };
2187
+
2188
+ // pkg/commands/zpopmin.ts
2189
+ var ZPopMinCommand = class extends Command {
2190
+ constructor([key, count], opts) {
2191
+ const command = ["zpopmin", key];
2192
+ if (typeof count === "number") {
2193
+ command.push(count);
2194
+ }
2195
+ super(command, opts);
2196
+ }
2197
+ };
2198
+
2199
+ // pkg/commands/zrange.ts
2200
+ var ZRangeCommand = class extends Command {
2201
+ constructor([key, min, max, opts], cmdOpts) {
2202
+ const command = ["zrange", key, min, max];
2203
+ if (opts?.byScore) {
2204
+ command.push("byscore");
2205
+ }
2206
+ if (opts?.byLex) {
2207
+ command.push("bylex");
2208
+ }
2209
+ if (opts?.rev) {
2210
+ command.push("rev");
2211
+ }
2212
+ if (opts?.count !== void 0 && opts.offset !== void 0) {
2213
+ command.push("limit", opts.offset, opts.count);
2214
+ }
2215
+ if (opts?.withScores) {
2216
+ command.push("withscores");
2217
+ }
2218
+ super(command, cmdOpts);
2219
+ }
2220
+ };
2221
+
2222
+ // pkg/commands/zrank.ts
2223
+ var ZRankCommand = class extends Command {
2224
+ constructor(cmd, opts) {
2225
+ super(["zrank", ...cmd], opts);
2226
+ }
2227
+ };
2228
+
2229
+ // pkg/commands/zrem.ts
2230
+ var ZRemCommand = class extends Command {
2231
+ constructor(cmd, opts) {
2232
+ super(["zrem", ...cmd], opts);
2233
+ }
2234
+ };
2235
+
2236
+ // pkg/commands/zremrangebylex.ts
2237
+ var ZRemRangeByLexCommand = class extends Command {
2238
+ constructor(cmd, opts) {
2239
+ super(["zremrangebylex", ...cmd], opts);
2240
+ }
2241
+ };
2242
+
2243
+ // pkg/commands/zremrangebyrank.ts
2244
+ var ZRemRangeByRankCommand = class extends Command {
2245
+ constructor(cmd, opts) {
2246
+ super(["zremrangebyrank", ...cmd], opts);
2247
+ }
2248
+ };
2249
+
2250
+ // pkg/commands/zremrangebyscore.ts
2251
+ var ZRemRangeByScoreCommand = class extends Command {
2252
+ constructor(cmd, opts) {
2253
+ super(["zremrangebyscore", ...cmd], opts);
2254
+ }
2255
+ };
2256
+
2257
+ // pkg/commands/zrevrank.ts
2258
+ var ZRevRankCommand = class extends Command {
2259
+ constructor(cmd, opts) {
2260
+ super(["zrevrank", ...cmd], opts);
2261
+ }
2262
+ };
2263
+
2264
+ // pkg/commands/zscan.ts
2265
+ var ZScanCommand = class extends Command {
2266
+ constructor([key, cursor, opts], cmdOpts) {
2267
+ const command = ["zscan", key, cursor];
2268
+ if (opts?.match) {
2269
+ command.push("match", opts.match);
2270
+ }
2271
+ if (typeof opts?.count === "number") {
2272
+ command.push("count", opts.count);
2273
+ }
2274
+ super(command, {
2275
+ deserialize: deserializeScanResponse,
2276
+ ...cmdOpts
2277
+ });
2278
+ }
2279
+ };
2280
+
2281
+ // pkg/commands/zscore.ts
2282
+ var ZScoreCommand = class extends Command {
2283
+ constructor(cmd, opts) {
2284
+ super(["zscore", ...cmd], opts);
2285
+ }
2286
+ };
2287
+
2288
+ // pkg/commands/zunion.ts
2289
+ var ZUnionCommand = class extends Command {
2290
+ constructor([numKeys, keyOrKeys, opts], cmdOpts) {
2291
+ const command = ["zunion", numKeys];
2292
+ if (Array.isArray(keyOrKeys)) {
2293
+ command.push(...keyOrKeys);
2294
+ } else {
2295
+ command.push(keyOrKeys);
2296
+ }
2297
+ if (opts) {
2298
+ if ("weights" in opts && opts.weights) {
2299
+ command.push("weights", ...opts.weights);
2300
+ } else if ("weight" in opts && typeof opts.weight === "number") {
2301
+ command.push("weights", opts.weight);
2302
+ }
2303
+ if ("aggregate" in opts) {
2304
+ command.push("aggregate", opts.aggregate);
2305
+ }
2306
+ if (opts.withScores) {
2307
+ command.push("withscores");
2308
+ }
2309
+ }
2310
+ super(command, cmdOpts);
2311
+ }
2312
+ };
2313
+
2314
+ // pkg/commands/zunionstore.ts
2315
+ var ZUnionStoreCommand = class extends Command {
2316
+ constructor([destination, numKeys, keyOrKeys, opts], cmdOpts) {
2317
+ const command = ["zunionstore", destination, numKeys];
2318
+ if (Array.isArray(keyOrKeys)) {
2319
+ command.push(...keyOrKeys);
2320
+ } else {
2321
+ command.push(keyOrKeys);
2322
+ }
2323
+ if (opts) {
2324
+ if ("weights" in opts && opts.weights) {
2325
+ command.push("weights", ...opts.weights);
2326
+ } else if ("weight" in opts && typeof opts.weight === "number") {
2327
+ command.push("weights", opts.weight);
2328
+ }
2329
+ if ("aggregate" in opts) {
2330
+ command.push("aggregate", opts.aggregate);
2331
+ }
2332
+ }
2333
+ super(command, cmdOpts);
2334
+ }
2335
+ };
2336
+
2337
+ // pkg/commands/zdiffstore.ts
2338
+ var ZDiffStoreCommand = class extends Command {
2339
+ constructor(cmd, opts) {
2340
+ super(["zdiffstore", ...cmd], opts);
2341
+ }
2342
+ };
2343
+
2344
+ // pkg/commands/zmscore.ts
2345
+ var ZMScoreCommand = class extends Command {
2346
+ constructor(cmd, opts) {
2347
+ const [key, members] = cmd;
2348
+ super(["zmscore", key, ...members], opts);
2349
+ }
2350
+ };
2351
+
2352
+ // pkg/pipeline.ts
2353
+ var Pipeline = class {
2354
+ client;
2355
+ commands;
2356
+ commandOptions;
2357
+ multiExec;
2358
+ constructor(opts) {
2359
+ this.client = opts.client;
2360
+ this.commands = [];
2361
+ this.commandOptions = opts.commandOptions;
2362
+ this.multiExec = opts.multiExec ?? false;
2363
+ if (this.commandOptions?.latencyLogging) {
2364
+ const originalExec = this.exec.bind(this);
2365
+ this.exec = async (options) => {
2366
+ const start = performance.now();
2367
+ const result = await (options ? originalExec(options) : originalExec());
2368
+ const end = performance.now();
2369
+ const loggerResult = (end - start).toFixed(2);
2370
+ console.log(
2371
+ `Latency for \x1B[38;2;19;185;39m${this.multiExec ? ["MULTI-EXEC"] : ["PIPELINE"].toString().toUpperCase()}\x1B[0m: \x1B[38;2;0;255;255m${loggerResult} ms\x1B[0m`
2372
+ );
2373
+ return result;
2374
+ };
2375
+ }
2376
+ }
2377
+ exec = async (options) => {
2378
+ if (this.commands.length === 0) {
2379
+ throw new Error("Pipeline is empty");
2380
+ }
2381
+ const path = this.multiExec ? ["multi-exec"] : ["pipeline"];
2382
+ const res = await this.client.request({
2383
+ path,
2384
+ body: Object.values(this.commands).map((c) => c.command)
2385
+ });
2386
+ return options?.keepErrors ? res.map(({ error, result }, i) => {
2387
+ return {
2388
+ error,
2389
+ result: this.commands[i].deserialize(result)
2390
+ };
2391
+ }) : res.map(({ error, result }, i) => {
2392
+ if (error) {
2393
+ throw new UpstashError(
2394
+ `Command ${i + 1} [ ${this.commands[i].command[0]} ] failed: ${error}`
2395
+ );
2396
+ }
2397
+ return this.commands[i].deserialize(result);
2398
+ });
2399
+ };
2400
+ /**
2401
+ * Returns the length of pipeline before the execution
2402
+ */
2403
+ length() {
2404
+ return this.commands.length;
2405
+ }
2406
+ /**
2407
+ * Pushes a command into the pipeline and returns a chainable instance of the
2408
+ * pipeline
2409
+ */
2410
+ chain(command) {
2411
+ this.commands.push(command);
2412
+ return this;
2413
+ }
2414
+ /**
2415
+ * @see https://redis.io/commands/append
2416
+ */
2417
+ append = (...args) => this.chain(new AppendCommand(args, this.commandOptions));
2418
+ /**
2419
+ * @see https://redis.io/commands/bitcount
2420
+ */
2421
+ bitcount = (...args) => this.chain(new BitCountCommand(args, this.commandOptions));
2422
+ /**
2423
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
2424
+ *
2425
+ * @example
2426
+ * ```typescript
2427
+ * redis.set("mykey", 0);
2428
+ * const result = await redis.pipeline()
2429
+ * .bitfield("mykey")
2430
+ * .set("u4", 0, 16)
2431
+ * .incr("u4", "#1", 1)
2432
+ * .exec();
2433
+ * console.log(result); // [[0, 1]]
2434
+ * ```
2435
+ *
2436
+ * @see https://redis.io/commands/bitfield
2437
+ */
2438
+ bitfield = (...args) => new BitFieldCommand(args, this.client, this.commandOptions, this.chain.bind(this));
2439
+ /**
2440
+ * @see https://redis.io/commands/bitop
2441
+ */
2442
+ bitop = (op, destinationKey, sourceKey, ...sourceKeys) => this.chain(
2443
+ new BitOpCommand([op, destinationKey, sourceKey, ...sourceKeys], this.commandOptions)
2444
+ );
2445
+ /**
2446
+ * @see https://redis.io/commands/bitpos
2447
+ */
2448
+ bitpos = (...args) => this.chain(new BitPosCommand(args, this.commandOptions));
2449
+ /**
2450
+ * @see https://redis.io/commands/copy
2451
+ */
2452
+ copy = (...args) => this.chain(new CopyCommand(args, this.commandOptions));
2453
+ /**
2454
+ * @see https://redis.io/commands/zdiffstore
2455
+ */
2456
+ zdiffstore = (...args) => this.chain(new ZDiffStoreCommand(args, this.commandOptions));
2457
+ /**
2458
+ * @see https://redis.io/commands/dbsize
2459
+ */
2460
+ dbsize = () => this.chain(new DBSizeCommand(this.commandOptions));
2461
+ /**
2462
+ * @see https://redis.io/commands/decr
2463
+ */
2464
+ decr = (...args) => this.chain(new DecrCommand(args, this.commandOptions));
2465
+ /**
2466
+ * @see https://redis.io/commands/decrby
2467
+ */
2468
+ decrby = (...args) => this.chain(new DecrByCommand(args, this.commandOptions));
2469
+ /**
2470
+ * @see https://redis.io/commands/del
2471
+ */
2472
+ del = (...args) => this.chain(new DelCommand(args, this.commandOptions));
2473
+ /**
2474
+ * @see https://redis.io/commands/echo
2475
+ */
2476
+ echo = (...args) => this.chain(new EchoCommand(args, this.commandOptions));
2477
+ /**
2478
+ * @see https://redis.io/commands/eval_ro
2479
+ */
2480
+ evalRo = (...args) => this.chain(new EvalROCommand(args, this.commandOptions));
2481
+ /**
2482
+ * @see https://redis.io/commands/eval
2483
+ */
2484
+ eval = (...args) => this.chain(new EvalCommand(args, this.commandOptions));
2485
+ /**
2486
+ * @see https://redis.io/commands/evalsha_ro
2487
+ */
2488
+ evalshaRo = (...args) => this.chain(new EvalshaROCommand(args, this.commandOptions));
2489
+ /**
2490
+ * @see https://redis.io/commands/evalsha
2491
+ */
2492
+ evalsha = (...args) => this.chain(new EvalshaCommand(args, this.commandOptions));
2493
+ /**
2494
+ * @see https://redis.io/commands/exists
2495
+ */
2496
+ exists = (...args) => this.chain(new ExistsCommand(args, this.commandOptions));
2497
+ /**
2498
+ * @see https://redis.io/commands/expire
2499
+ */
2500
+ expire = (...args) => this.chain(new ExpireCommand(args, this.commandOptions));
2501
+ /**
2502
+ * @see https://redis.io/commands/expireat
2503
+ */
2504
+ expireat = (...args) => this.chain(new ExpireAtCommand(args, this.commandOptions));
2505
+ /**
2506
+ * @see https://redis.io/commands/flushall
2507
+ */
2508
+ flushall = (args) => this.chain(new FlushAllCommand(args, this.commandOptions));
2509
+ /**
2510
+ * @see https://redis.io/commands/flushdb
2511
+ */
2512
+ flushdb = (...args) => this.chain(new FlushDBCommand(args, this.commandOptions));
2513
+ /**
2514
+ * @see https://redis.io/commands/geoadd
2515
+ */
2516
+ geoadd = (...args) => this.chain(new GeoAddCommand(args, this.commandOptions));
2517
+ /**
2518
+ * @see https://redis.io/commands/geodist
2519
+ */
2520
+ geodist = (...args) => this.chain(new GeoDistCommand(args, this.commandOptions));
2521
+ /**
2522
+ * @see https://redis.io/commands/geopos
2523
+ */
2524
+ geopos = (...args) => this.chain(new GeoPosCommand(args, this.commandOptions));
2525
+ /**
2526
+ * @see https://redis.io/commands/geohash
2527
+ */
2528
+ geohash = (...args) => this.chain(new GeoHashCommand(args, this.commandOptions));
2529
+ /**
2530
+ * @see https://redis.io/commands/geosearch
2531
+ */
2532
+ geosearch = (...args) => this.chain(new GeoSearchCommand(args, this.commandOptions));
2533
+ /**
2534
+ * @see https://redis.io/commands/geosearchstore
2535
+ */
2536
+ geosearchstore = (...args) => this.chain(new GeoSearchStoreCommand(args, this.commandOptions));
2537
+ /**
2538
+ * @see https://redis.io/commands/get
2539
+ */
2540
+ get = (...args) => this.chain(new GetCommand(args, this.commandOptions));
2541
+ /**
2542
+ * @see https://redis.io/commands/getbit
2543
+ */
2544
+ getbit = (...args) => this.chain(new GetBitCommand(args, this.commandOptions));
2545
+ /**
2546
+ * @see https://redis.io/commands/getdel
2547
+ */
2548
+ getdel = (...args) => this.chain(new GetDelCommand(args, this.commandOptions));
2549
+ /**
2550
+ * @see https://redis.io/commands/getex
2551
+ */
2552
+ getex = (...args) => this.chain(new GetExCommand(args, this.commandOptions));
2553
+ /**
2554
+ * @see https://redis.io/commands/getrange
2555
+ */
2556
+ getrange = (...args) => this.chain(new GetRangeCommand(args, this.commandOptions));
2557
+ /**
2558
+ * @see https://redis.io/commands/getset
2559
+ */
2560
+ getset = (key, value) => this.chain(new GetSetCommand([key, value], this.commandOptions));
2561
+ /**
2562
+ * @see https://redis.io/commands/hdel
2563
+ */
2564
+ hdel = (...args) => this.chain(new HDelCommand(args, this.commandOptions));
2565
+ /**
2566
+ * @see https://redis.io/commands/hexists
2567
+ */
2568
+ hexists = (...args) => this.chain(new HExistsCommand(args, this.commandOptions));
2569
+ /**
2570
+ * @see https://redis.io/commands/hexpire
2571
+ */
2572
+ hexpire = (...args) => this.chain(new HExpireCommand(args, this.commandOptions));
2573
+ /**
2574
+ * @see https://redis.io/commands/hexpireat
2575
+ */
2576
+ hexpireat = (...args) => this.chain(new HExpireAtCommand(args, this.commandOptions));
2577
+ /**
2578
+ * @see https://redis.io/commands/hexpiretime
2579
+ */
2580
+ hexpiretime = (...args) => this.chain(new HExpireTimeCommand(args, this.commandOptions));
2581
+ /**
2582
+ * @see https://redis.io/commands/httl
2583
+ */
2584
+ httl = (...args) => this.chain(new HTtlCommand(args, this.commandOptions));
2585
+ /**
2586
+ * @see https://redis.io/commands/hpexpire
2587
+ */
2588
+ hpexpire = (...args) => this.chain(new HPExpireCommand(args, this.commandOptions));
2589
+ /**
2590
+ * @see https://redis.io/commands/hpexpireat
2591
+ */
2592
+ hpexpireat = (...args) => this.chain(new HPExpireAtCommand(args, this.commandOptions));
2593
+ /**
2594
+ * @see https://redis.io/commands/hpexpiretime
2595
+ */
2596
+ hpexpiretime = (...args) => this.chain(new HPExpireTimeCommand(args, this.commandOptions));
2597
+ /**
2598
+ * @see https://redis.io/commands/hpttl
2599
+ */
2600
+ hpttl = (...args) => this.chain(new HPTtlCommand(args, this.commandOptions));
2601
+ /**
2602
+ * @see https://redis.io/commands/hpersist
2603
+ */
2604
+ hpersist = (...args) => this.chain(new HPersistCommand(args, this.commandOptions));
2605
+ /**
2606
+ * @see https://redis.io/commands/hget
2607
+ */
2608
+ hget = (...args) => this.chain(new HGetCommand(args, this.commandOptions));
2609
+ /**
2610
+ * @see https://redis.io/commands/hgetall
2611
+ */
2612
+ hgetall = (...args) => this.chain(new HGetAllCommand(args, this.commandOptions));
2613
+ /**
2614
+ * @see https://redis.io/commands/hincrby
2615
+ */
2616
+ hincrby = (...args) => this.chain(new HIncrByCommand(args, this.commandOptions));
2617
+ /**
2618
+ * @see https://redis.io/commands/hincrbyfloat
2619
+ */
2620
+ hincrbyfloat = (...args) => this.chain(new HIncrByFloatCommand(args, this.commandOptions));
2621
+ /**
2622
+ * @see https://redis.io/commands/hkeys
2623
+ */
2624
+ hkeys = (...args) => this.chain(new HKeysCommand(args, this.commandOptions));
2625
+ /**
2626
+ * @see https://redis.io/commands/hlen
2627
+ */
2628
+ hlen = (...args) => this.chain(new HLenCommand(args, this.commandOptions));
2629
+ /**
2630
+ * @see https://redis.io/commands/hmget
2631
+ */
2632
+ hmget = (...args) => this.chain(new HMGetCommand(args, this.commandOptions));
2633
+ /**
2634
+ * @see https://redis.io/commands/hmset
2635
+ */
2636
+ hmset = (key, kv) => this.chain(new HMSetCommand([key, kv], this.commandOptions));
2637
+ /**
2638
+ * @see https://redis.io/commands/hrandfield
2639
+ */
2640
+ hrandfield = (key, count, withValues) => this.chain(new HRandFieldCommand([key, count, withValues], this.commandOptions));
2641
+ /**
2642
+ * @see https://redis.io/commands/hscan
2643
+ */
2644
+ hscan = (...args) => this.chain(new HScanCommand(args, this.commandOptions));
2645
+ /**
2646
+ * @see https://redis.io/commands/hset
2647
+ */
2648
+ hset = (key, kv) => this.chain(new HSetCommand([key, kv], this.commandOptions));
2649
+ /**
2650
+ * @see https://redis.io/commands/hsetnx
2651
+ */
2652
+ hsetnx = (key, field, value) => this.chain(new HSetNXCommand([key, field, value], this.commandOptions));
2653
+ /**
2654
+ * @see https://redis.io/commands/hstrlen
2655
+ */
2656
+ hstrlen = (...args) => this.chain(new HStrLenCommand(args, this.commandOptions));
2657
+ /**
2658
+ * @see https://redis.io/commands/hvals
2659
+ */
2660
+ hvals = (...args) => this.chain(new HValsCommand(args, this.commandOptions));
2661
+ /**
2662
+ * @see https://redis.io/commands/incr
2663
+ */
2664
+ incr = (...args) => this.chain(new IncrCommand(args, this.commandOptions));
2665
+ /**
2666
+ * @see https://redis.io/commands/incrby
2667
+ */
2668
+ incrby = (...args) => this.chain(new IncrByCommand(args, this.commandOptions));
2669
+ /**
2670
+ * @see https://redis.io/commands/incrbyfloat
2671
+ */
2672
+ incrbyfloat = (...args) => this.chain(new IncrByFloatCommand(args, this.commandOptions));
2673
+ /**
2674
+ * @see https://redis.io/commands/keys
2675
+ */
2676
+ keys = (...args) => this.chain(new KeysCommand(args, this.commandOptions));
2677
+ /**
2678
+ * @see https://redis.io/commands/lindex
2679
+ */
2680
+ lindex = (...args) => this.chain(new LIndexCommand(args, this.commandOptions));
2681
+ /**
2682
+ * @see https://redis.io/commands/linsert
2683
+ */
2684
+ linsert = (key, direction, pivot, value) => this.chain(new LInsertCommand([key, direction, pivot, value], this.commandOptions));
2685
+ /**
2686
+ * @see https://redis.io/commands/llen
2687
+ */
2688
+ llen = (...args) => this.chain(new LLenCommand(args, this.commandOptions));
2689
+ /**
2690
+ * @see https://redis.io/commands/lmove
2691
+ */
2692
+ lmove = (...args) => this.chain(new LMoveCommand(args, this.commandOptions));
2693
+ /**
2694
+ * @see https://redis.io/commands/lpop
2695
+ */
2696
+ lpop = (...args) => this.chain(new LPopCommand(args, this.commandOptions));
2697
+ /**
2698
+ * @see https://redis.io/commands/lmpop
2699
+ */
2700
+ lmpop = (...args) => this.chain(new LmPopCommand(args, this.commandOptions));
2701
+ /**
2702
+ * @see https://redis.io/commands/lpos
2703
+ */
2704
+ lpos = (...args) => this.chain(new LPosCommand(args, this.commandOptions));
2705
+ /**
2706
+ * @see https://redis.io/commands/lpush
2707
+ */
2708
+ lpush = (key, ...elements) => this.chain(new LPushCommand([key, ...elements], this.commandOptions));
2709
+ /**
2710
+ * @see https://redis.io/commands/lpushx
2711
+ */
2712
+ lpushx = (key, ...elements) => this.chain(new LPushXCommand([key, ...elements], this.commandOptions));
2713
+ /**
2714
+ * @see https://redis.io/commands/lrange
2715
+ */
2716
+ lrange = (...args) => this.chain(new LRangeCommand(args, this.commandOptions));
2717
+ /**
2718
+ * @see https://redis.io/commands/lrem
2719
+ */
2720
+ lrem = (key, count, value) => this.chain(new LRemCommand([key, count, value], this.commandOptions));
2721
+ /**
2722
+ * @see https://redis.io/commands/lset
2723
+ */
2724
+ lset = (key, index, value) => this.chain(new LSetCommand([key, index, value], this.commandOptions));
2725
+ /**
2726
+ * @see https://redis.io/commands/ltrim
2727
+ */
2728
+ ltrim = (...args) => this.chain(new LTrimCommand(args, this.commandOptions));
2729
+ /**
2730
+ * @see https://redis.io/commands/mget
2731
+ */
2732
+ mget = (...args) => this.chain(new MGetCommand(args, this.commandOptions));
2733
+ /**
2734
+ * @see https://redis.io/commands/mset
2735
+ */
2736
+ mset = (kv) => this.chain(new MSetCommand([kv], this.commandOptions));
2737
+ /**
2738
+ * @see https://redis.io/commands/msetnx
2739
+ */
2740
+ msetnx = (kv) => this.chain(new MSetNXCommand([kv], this.commandOptions));
2741
+ /**
2742
+ * @see https://redis.io/commands/persist
2743
+ */
2744
+ persist = (...args) => this.chain(new PersistCommand(args, this.commandOptions));
2745
+ /**
2746
+ * @see https://redis.io/commands/pexpire
2747
+ */
2748
+ pexpire = (...args) => this.chain(new PExpireCommand(args, this.commandOptions));
2749
+ /**
2750
+ * @see https://redis.io/commands/pexpireat
2751
+ */
2752
+ pexpireat = (...args) => this.chain(new PExpireAtCommand(args, this.commandOptions));
2753
+ /**
2754
+ * @see https://redis.io/commands/pfadd
2755
+ */
2756
+ pfadd = (...args) => this.chain(new PfAddCommand(args, this.commandOptions));
2757
+ /**
2758
+ * @see https://redis.io/commands/pfcount
2759
+ */
2760
+ pfcount = (...args) => this.chain(new PfCountCommand(args, this.commandOptions));
2761
+ /**
2762
+ * @see https://redis.io/commands/pfmerge
2763
+ */
2764
+ pfmerge = (...args) => this.chain(new PfMergeCommand(args, this.commandOptions));
2765
+ /**
2766
+ * @see https://redis.io/commands/ping
2767
+ */
2768
+ ping = (args) => this.chain(new PingCommand(args, this.commandOptions));
2769
+ /**
2770
+ * @see https://redis.io/commands/psetex
2771
+ */
2772
+ psetex = (key, ttl, value) => this.chain(new PSetEXCommand([key, ttl, value], this.commandOptions));
2773
+ /**
2774
+ * @see https://redis.io/commands/pttl
2775
+ */
2776
+ pttl = (...args) => this.chain(new PTtlCommand(args, this.commandOptions));
2777
+ /**
2778
+ * @see https://redis.io/commands/publish
2779
+ */
2780
+ publish = (...args) => this.chain(new PublishCommand(args, this.commandOptions));
2781
+ /**
2782
+ * @see https://redis.io/commands/randomkey
2783
+ */
2784
+ randomkey = () => this.chain(new RandomKeyCommand(this.commandOptions));
2785
+ /**
2786
+ * @see https://redis.io/commands/rename
2787
+ */
2788
+ rename = (...args) => this.chain(new RenameCommand(args, this.commandOptions));
2789
+ /**
2790
+ * @see https://redis.io/commands/renamenx
2791
+ */
2792
+ renamenx = (...args) => this.chain(new RenameNXCommand(args, this.commandOptions));
2793
+ /**
2794
+ * @see https://redis.io/commands/rpop
2795
+ */
2796
+ rpop = (...args) => this.chain(new RPopCommand(args, this.commandOptions));
2797
+ /**
2798
+ * @see https://redis.io/commands/rpush
2799
+ */
2800
+ rpush = (key, ...elements) => this.chain(new RPushCommand([key, ...elements], this.commandOptions));
2801
+ /**
2802
+ * @see https://redis.io/commands/rpushx
2803
+ */
2804
+ rpushx = (key, ...elements) => this.chain(new RPushXCommand([key, ...elements], this.commandOptions));
2805
+ /**
2806
+ * @see https://redis.io/commands/sadd
2807
+ */
2808
+ sadd = (key, member, ...members) => this.chain(new SAddCommand([key, member, ...members], this.commandOptions));
2809
+ /**
2810
+ * @see https://redis.io/commands/scan
2811
+ */
2812
+ scan = (...args) => this.chain(new ScanCommand(args, this.commandOptions));
2813
+ /**
2814
+ * @see https://redis.io/commands/scard
2815
+ */
2816
+ scard = (...args) => this.chain(new SCardCommand(args, this.commandOptions));
2817
+ /**
2818
+ * @see https://redis.io/commands/script-exists
2819
+ */
2820
+ scriptExists = (...args) => this.chain(new ScriptExistsCommand(args, this.commandOptions));
2821
+ /**
2822
+ * @see https://redis.io/commands/script-flush
2823
+ */
2824
+ scriptFlush = (...args) => this.chain(new ScriptFlushCommand(args, this.commandOptions));
2825
+ /**
2826
+ * @see https://redis.io/commands/script-load
2827
+ */
2828
+ scriptLoad = (...args) => this.chain(new ScriptLoadCommand(args, this.commandOptions));
2829
+ /*)*
2830
+ * @see https://redis.io/commands/sdiff
2831
+ */
2832
+ sdiff = (...args) => this.chain(new SDiffCommand(args, this.commandOptions));
2833
+ /**
2834
+ * @see https://redis.io/commands/sdiffstore
2835
+ */
2836
+ sdiffstore = (...args) => this.chain(new SDiffStoreCommand(args, this.commandOptions));
2837
+ /**
2838
+ * @see https://redis.io/commands/set
2839
+ */
2840
+ set = (key, value, opts) => this.chain(new SetCommand([key, value, opts], this.commandOptions));
2841
+ /**
2842
+ * @see https://redis.io/commands/setbit
2843
+ */
2844
+ setbit = (...args) => this.chain(new SetBitCommand(args, this.commandOptions));
2845
+ /**
2846
+ * @see https://redis.io/commands/setex
2847
+ */
2848
+ setex = (key, ttl, value) => this.chain(new SetExCommand([key, ttl, value], this.commandOptions));
2849
+ /**
2850
+ * @see https://redis.io/commands/setnx
2851
+ */
2852
+ setnx = (key, value) => this.chain(new SetNxCommand([key, value], this.commandOptions));
2853
+ /**
2854
+ * @see https://redis.io/commands/setrange
2855
+ */
2856
+ setrange = (...args) => this.chain(new SetRangeCommand(args, this.commandOptions));
2857
+ /**
2858
+ * @see https://redis.io/commands/sinter
2859
+ */
2860
+ sinter = (...args) => this.chain(new SInterCommand(args, this.commandOptions));
2861
+ /**
2862
+ * @see https://redis.io/commands/sinterstore
2863
+ */
2864
+ sinterstore = (...args) => this.chain(new SInterStoreCommand(args, this.commandOptions));
2865
+ /**
2866
+ * @see https://redis.io/commands/sismember
2867
+ */
2868
+ sismember = (key, member) => this.chain(new SIsMemberCommand([key, member], this.commandOptions));
2869
+ /**
2870
+ * @see https://redis.io/commands/smembers
2871
+ */
2872
+ smembers = (...args) => this.chain(new SMembersCommand(args, this.commandOptions));
2873
+ /**
2874
+ * @see https://redis.io/commands/smismember
2875
+ */
2876
+ smismember = (key, members) => this.chain(new SMIsMemberCommand([key, members], this.commandOptions));
2877
+ /**
2878
+ * @see https://redis.io/commands/smove
2879
+ */
2880
+ smove = (source, destination, member) => this.chain(new SMoveCommand([source, destination, member], this.commandOptions));
2881
+ /**
2882
+ * @see https://redis.io/commands/spop
2883
+ */
2884
+ spop = (...args) => this.chain(new SPopCommand(args, this.commandOptions));
2885
+ /**
2886
+ * @see https://redis.io/commands/srandmember
2887
+ */
2888
+ srandmember = (...args) => this.chain(new SRandMemberCommand(args, this.commandOptions));
2889
+ /**
2890
+ * @see https://redis.io/commands/srem
2891
+ */
2892
+ srem = (key, ...members) => this.chain(new SRemCommand([key, ...members], this.commandOptions));
2893
+ /**
2894
+ * @see https://redis.io/commands/sscan
2895
+ */
2896
+ sscan = (...args) => this.chain(new SScanCommand(args, this.commandOptions));
2897
+ /**
2898
+ * @see https://redis.io/commands/strlen
2899
+ */
2900
+ strlen = (...args) => this.chain(new StrLenCommand(args, this.commandOptions));
2901
+ /**
2902
+ * @see https://redis.io/commands/sunion
2903
+ */
2904
+ sunion = (...args) => this.chain(new SUnionCommand(args, this.commandOptions));
2905
+ /**
2906
+ * @see https://redis.io/commands/sunionstore
2907
+ */
2908
+ sunionstore = (...args) => this.chain(new SUnionStoreCommand(args, this.commandOptions));
2909
+ /**
2910
+ * @see https://redis.io/commands/time
2911
+ */
2912
+ time = () => this.chain(new TimeCommand(this.commandOptions));
2913
+ /**
2914
+ * @see https://redis.io/commands/touch
2915
+ */
2916
+ touch = (...args) => this.chain(new TouchCommand(args, this.commandOptions));
2917
+ /**
2918
+ * @see https://redis.io/commands/ttl
2919
+ */
2920
+ ttl = (...args) => this.chain(new TtlCommand(args, this.commandOptions));
2921
+ /**
2922
+ * @see https://redis.io/commands/type
2923
+ */
2924
+ type = (...args) => this.chain(new TypeCommand(args, this.commandOptions));
2925
+ /**
2926
+ * @see https://redis.io/commands/unlink
2927
+ */
2928
+ unlink = (...args) => this.chain(new UnlinkCommand(args, this.commandOptions));
2929
+ /**
2930
+ * @see https://redis.io/commands/zadd
2931
+ */
2932
+ zadd = (...args) => {
2933
+ if ("score" in args[1]) {
2934
+ return this.chain(
2935
+ new ZAddCommand([args[0], args[1], ...args.slice(2)], this.commandOptions)
2936
+ );
2937
+ }
2938
+ return this.chain(
2939
+ new ZAddCommand(
2940
+ [args[0], args[1], ...args.slice(2)],
2941
+ this.commandOptions
2942
+ )
2943
+ );
2944
+ };
2945
+ /**
2946
+ * @see https://redis.io/commands/xadd
2947
+ */
2948
+ xadd = (...args) => this.chain(new XAddCommand(args, this.commandOptions));
2949
+ /**
2950
+ * @see https://redis.io/commands/xack
2951
+ */
2952
+ xack = (...args) => this.chain(new XAckCommand(args, this.commandOptions));
2953
+ /**
2954
+ * @see https://redis.io/commands/xdel
2955
+ */
2956
+ xdel = (...args) => this.chain(new XDelCommand(args, this.commandOptions));
2957
+ /**
2958
+ * @see https://redis.io/commands/xgroup
2959
+ */
2960
+ xgroup = (...args) => this.chain(new XGroupCommand(args, this.commandOptions));
2961
+ /**
2962
+ * @see https://redis.io/commands/xread
2963
+ */
2964
+ xread = (...args) => this.chain(new XReadCommand(args, this.commandOptions));
2965
+ /**
2966
+ * @see https://redis.io/commands/xreadgroup
2967
+ */
2968
+ xreadgroup = (...args) => this.chain(new XReadGroupCommand(args, this.commandOptions));
2969
+ /**
2970
+ * @see https://redis.io/commands/xinfo
2971
+ */
2972
+ xinfo = (...args) => this.chain(new XInfoCommand(args, this.commandOptions));
2973
+ /**
2974
+ * @see https://redis.io/commands/xlen
2975
+ */
2976
+ xlen = (...args) => this.chain(new XLenCommand(args, this.commandOptions));
2977
+ /**
2978
+ * @see https://redis.io/commands/xpending
2979
+ */
2980
+ xpending = (...args) => this.chain(new XPendingCommand(args, this.commandOptions));
2981
+ /**
2982
+ * @see https://redis.io/commands/xclaim
2983
+ */
2984
+ xclaim = (...args) => this.chain(new XClaimCommand(args, this.commandOptions));
2985
+ /**
2986
+ * @see https://redis.io/commands/xautoclaim
2987
+ */
2988
+ xautoclaim = (...args) => this.chain(new XAutoClaim(args, this.commandOptions));
2989
+ /**
2990
+ * @see https://redis.io/commands/xtrim
2991
+ */
2992
+ xtrim = (...args) => this.chain(new XTrimCommand(args, this.commandOptions));
2993
+ /**
2994
+ * @see https://redis.io/commands/xrange
2995
+ */
2996
+ xrange = (...args) => this.chain(new XRangeCommand(args, this.commandOptions));
2997
+ /**
2998
+ * @see https://redis.io/commands/xrevrange
2999
+ */
3000
+ xrevrange = (...args) => this.chain(new XRevRangeCommand(args, this.commandOptions));
3001
+ /**
3002
+ * @see https://redis.io/commands/zcard
3003
+ */
3004
+ zcard = (...args) => this.chain(new ZCardCommand(args, this.commandOptions));
3005
+ /**
3006
+ * @see https://redis.io/commands/zcount
3007
+ */
3008
+ zcount = (...args) => this.chain(new ZCountCommand(args, this.commandOptions));
3009
+ /**
3010
+ * @see https://redis.io/commands/zincrby
3011
+ */
3012
+ zincrby = (key, increment, member) => this.chain(new ZIncrByCommand([key, increment, member], this.commandOptions));
3013
+ /**
3014
+ * @see https://redis.io/commands/zinterstore
3015
+ */
3016
+ zinterstore = (...args) => this.chain(new ZInterStoreCommand(args, this.commandOptions));
3017
+ /**
3018
+ * @see https://redis.io/commands/zlexcount
3019
+ */
3020
+ zlexcount = (...args) => this.chain(new ZLexCountCommand(args, this.commandOptions));
3021
+ /**
3022
+ * @see https://redis.io/commands/zmscore
3023
+ */
3024
+ zmscore = (...args) => this.chain(new ZMScoreCommand(args, this.commandOptions));
3025
+ /**
3026
+ * @see https://redis.io/commands/zpopmax
3027
+ */
3028
+ zpopmax = (...args) => this.chain(new ZPopMaxCommand(args, this.commandOptions));
3029
+ /**
3030
+ * @see https://redis.io/commands/zpopmin
3031
+ */
3032
+ zpopmin = (...args) => this.chain(new ZPopMinCommand(args, this.commandOptions));
3033
+ /**
3034
+ * @see https://redis.io/commands/zrange
3035
+ */
3036
+ zrange = (...args) => this.chain(new ZRangeCommand(args, this.commandOptions));
3037
+ /**
3038
+ * @see https://redis.io/commands/zrank
3039
+ */
3040
+ zrank = (key, member) => this.chain(new ZRankCommand([key, member], this.commandOptions));
3041
+ /**
3042
+ * @see https://redis.io/commands/zrem
3043
+ */
3044
+ zrem = (key, ...members) => this.chain(new ZRemCommand([key, ...members], this.commandOptions));
3045
+ /**
3046
+ * @see https://redis.io/commands/zremrangebylex
3047
+ */
3048
+ zremrangebylex = (...args) => this.chain(new ZRemRangeByLexCommand(args, this.commandOptions));
3049
+ /**
3050
+ * @see https://redis.io/commands/zremrangebyrank
3051
+ */
3052
+ zremrangebyrank = (...args) => this.chain(new ZRemRangeByRankCommand(args, this.commandOptions));
3053
+ /**
3054
+ * @see https://redis.io/commands/zremrangebyscore
3055
+ */
3056
+ zremrangebyscore = (...args) => this.chain(new ZRemRangeByScoreCommand(args, this.commandOptions));
3057
+ /**
3058
+ * @see https://redis.io/commands/zrevrank
3059
+ */
3060
+ zrevrank = (key, member) => this.chain(new ZRevRankCommand([key, member], this.commandOptions));
3061
+ /**
3062
+ * @see https://redis.io/commands/zscan
3063
+ */
3064
+ zscan = (...args) => this.chain(new ZScanCommand(args, this.commandOptions));
3065
+ /**
3066
+ * @see https://redis.io/commands/zscore
3067
+ */
3068
+ zscore = (key, member) => this.chain(new ZScoreCommand([key, member], this.commandOptions));
3069
+ /**
3070
+ * @see https://redis.io/commands/zunionstore
3071
+ */
3072
+ zunionstore = (...args) => this.chain(new ZUnionStoreCommand(args, this.commandOptions));
3073
+ /**
3074
+ * @see https://redis.io/commands/zunion
3075
+ */
3076
+ zunion = (...args) => this.chain(new ZUnionCommand(args, this.commandOptions));
3077
+ /**
3078
+ * @see https://redis.io/commands/?group=json
3079
+ */
3080
+ get json() {
3081
+ return {
3082
+ /**
3083
+ * @see https://redis.io/commands/json.arrappend
3084
+ */
3085
+ arrappend: (...args) => this.chain(new JsonArrAppendCommand(args, this.commandOptions)),
3086
+ /**
3087
+ * @see https://redis.io/commands/json.arrindex
3088
+ */
3089
+ arrindex: (...args) => this.chain(new JsonArrIndexCommand(args, this.commandOptions)),
3090
+ /**
3091
+ * @see https://redis.io/commands/json.arrinsert
3092
+ */
3093
+ arrinsert: (...args) => this.chain(new JsonArrInsertCommand(args, this.commandOptions)),
3094
+ /**
3095
+ * @see https://redis.io/commands/json.arrlen
3096
+ */
3097
+ arrlen: (...args) => this.chain(new JsonArrLenCommand(args, this.commandOptions)),
3098
+ /**
3099
+ * @see https://redis.io/commands/json.arrpop
3100
+ */
3101
+ arrpop: (...args) => this.chain(new JsonArrPopCommand(args, this.commandOptions)),
3102
+ /**
3103
+ * @see https://redis.io/commands/json.arrtrim
3104
+ */
3105
+ arrtrim: (...args) => this.chain(new JsonArrTrimCommand(args, this.commandOptions)),
3106
+ /**
3107
+ * @see https://redis.io/commands/json.clear
3108
+ */
3109
+ clear: (...args) => this.chain(new JsonClearCommand(args, this.commandOptions)),
3110
+ /**
3111
+ * @see https://redis.io/commands/json.del
3112
+ */
3113
+ del: (...args) => this.chain(new JsonDelCommand(args, this.commandOptions)),
3114
+ /**
3115
+ * @see https://redis.io/commands/json.forget
3116
+ */
3117
+ forget: (...args) => this.chain(new JsonForgetCommand(args, this.commandOptions)),
3118
+ /**
3119
+ * @see https://redis.io/commands/json.get
3120
+ */
3121
+ get: (...args) => this.chain(new JsonGetCommand(args, this.commandOptions)),
3122
+ /**
3123
+ * @see https://redis.io/commands/json.merge
3124
+ */
3125
+ merge: (...args) => this.chain(new JsonMergeCommand(args, this.commandOptions)),
3126
+ /**
3127
+ * @see https://redis.io/commands/json.mget
3128
+ */
3129
+ mget: (...args) => this.chain(new JsonMGetCommand(args, this.commandOptions)),
3130
+ /**
3131
+ * @see https://redis.io/commands/json.mset
3132
+ */
3133
+ mset: (...args) => this.chain(new JsonMSetCommand(args, this.commandOptions)),
3134
+ /**
3135
+ * @see https://redis.io/commands/json.numincrby
3136
+ */
3137
+ numincrby: (...args) => this.chain(new JsonNumIncrByCommand(args, this.commandOptions)),
3138
+ /**
3139
+ * @see https://redis.io/commands/json.nummultby
3140
+ */
3141
+ nummultby: (...args) => this.chain(new JsonNumMultByCommand(args, this.commandOptions)),
3142
+ /**
3143
+ * @see https://redis.io/commands/json.objkeys
3144
+ */
3145
+ objkeys: (...args) => this.chain(new JsonObjKeysCommand(args, this.commandOptions)),
3146
+ /**
3147
+ * @see https://redis.io/commands/json.objlen
3148
+ */
3149
+ objlen: (...args) => this.chain(new JsonObjLenCommand(args, this.commandOptions)),
3150
+ /**
3151
+ * @see https://redis.io/commands/json.resp
3152
+ */
3153
+ resp: (...args) => this.chain(new JsonRespCommand(args, this.commandOptions)),
3154
+ /**
3155
+ * @see https://redis.io/commands/json.set
3156
+ */
3157
+ set: (...args) => this.chain(new JsonSetCommand(args, this.commandOptions)),
3158
+ /**
3159
+ * @see https://redis.io/commands/json.strappend
3160
+ */
3161
+ strappend: (...args) => this.chain(new JsonStrAppendCommand(args, this.commandOptions)),
3162
+ /**
3163
+ * @see https://redis.io/commands/json.strlen
3164
+ */
3165
+ strlen: (...args) => this.chain(new JsonStrLenCommand(args, this.commandOptions)),
3166
+ /**
3167
+ * @see https://redis.io/commands/json.toggle
3168
+ */
3169
+ toggle: (...args) => this.chain(new JsonToggleCommand(args, this.commandOptions)),
3170
+ /**
3171
+ * @see https://redis.io/commands/json.type
3172
+ */
3173
+ type: (...args) => this.chain(new JsonTypeCommand(args, this.commandOptions))
3174
+ };
3175
+ }
3176
+ };
3177
+
3178
+ // pkg/auto-pipeline.ts
3179
+ function createAutoPipelineProxy(_redis, json) {
3180
+ const redis = _redis;
3181
+ if (!redis.autoPipelineExecutor) {
3182
+ redis.autoPipelineExecutor = new AutoPipelineExecutor(redis);
3183
+ }
3184
+ return new Proxy(redis, {
3185
+ get: (redis2, command) => {
3186
+ if (command === "pipelineCounter") {
3187
+ return redis2.autoPipelineExecutor.pipelineCounter;
3188
+ }
3189
+ if (command === "json") {
3190
+ return createAutoPipelineProxy(redis2, true);
3191
+ }
3192
+ const commandInRedisButNotPipeline = command in redis2 && !(command in redis2.autoPipelineExecutor.pipeline);
3193
+ if (commandInRedisButNotPipeline) {
3194
+ return redis2[command];
3195
+ }
3196
+ const isFunction = json ? typeof redis2.autoPipelineExecutor.pipeline.json[command] === "function" : typeof redis2.autoPipelineExecutor.pipeline[command] === "function";
3197
+ if (isFunction) {
3198
+ return (...args) => {
3199
+ return redis2.autoPipelineExecutor.withAutoPipeline((pipeline) => {
3200
+ if (json) {
3201
+ pipeline.json[command](
3202
+ ...args
3203
+ );
3204
+ } else {
3205
+ pipeline[command](...args);
3206
+ }
3207
+ });
3208
+ };
3209
+ }
3210
+ return redis2.autoPipelineExecutor.pipeline[command];
3211
+ }
3212
+ });
3213
+ }
3214
+ var AutoPipelineExecutor = class {
3215
+ pipelinePromises = /* @__PURE__ */ new WeakMap();
3216
+ activePipeline = null;
3217
+ indexInCurrentPipeline = 0;
3218
+ redis;
3219
+ pipeline;
3220
+ // only to make sure that proxy can work
3221
+ pipelineCounter = 0;
3222
+ // to keep track of how many times a pipeline was executed
3223
+ constructor(redis) {
3224
+ this.redis = redis;
3225
+ this.pipeline = redis.pipeline();
3226
+ }
3227
+ async withAutoPipeline(executeWithPipeline) {
3228
+ const pipeline = this.activePipeline ?? this.redis.pipeline();
3229
+ if (!this.activePipeline) {
3230
+ this.activePipeline = pipeline;
3231
+ this.indexInCurrentPipeline = 0;
3232
+ }
3233
+ const index = this.indexInCurrentPipeline++;
3234
+ executeWithPipeline(pipeline);
3235
+ const pipelineDone = this.deferExecution().then(() => {
3236
+ if (!this.pipelinePromises.has(pipeline)) {
3237
+ const pipelinePromise = pipeline.exec({ keepErrors: true });
3238
+ this.pipelineCounter += 1;
3239
+ this.pipelinePromises.set(pipeline, pipelinePromise);
3240
+ this.activePipeline = null;
3241
+ }
3242
+ return this.pipelinePromises.get(pipeline);
3243
+ });
3244
+ const results = await pipelineDone;
3245
+ const commandResult = results[index];
3246
+ if (commandResult.error) {
3247
+ throw new UpstashError(`Command failed: ${commandResult.error}`);
3248
+ }
3249
+ return commandResult.result;
3250
+ }
3251
+ async deferExecution() {
3252
+ await Promise.resolve();
3253
+ await Promise.resolve();
3254
+ }
3255
+ };
3256
+
3257
+ // pkg/commands/psubscribe.ts
3258
+ var PSubscribeCommand = class extends Command {
3259
+ constructor(cmd, opts) {
3260
+ const sseHeaders = {
3261
+ Accept: "text/event-stream",
3262
+ "Cache-Control": "no-cache",
3263
+ Connection: "keep-alive"
3264
+ };
3265
+ super([], {
3266
+ ...opts,
3267
+ headers: sseHeaders,
3268
+ path: ["psubscribe", ...cmd],
3269
+ streamOptions: {
3270
+ isStreaming: true,
3271
+ onMessage: opts?.streamOptions?.onMessage,
3272
+ signal: opts?.streamOptions?.signal
3273
+ }
3274
+ });
3275
+ }
3276
+ };
3277
+
3278
+ // pkg/commands/subscribe.ts
3279
+ var Subscriber = class extends EventTarget {
3280
+ subscriptions;
3281
+ client;
3282
+ listeners;
3283
+ constructor(client, channels, isPattern = false) {
3284
+ super();
3285
+ this.client = client;
3286
+ this.subscriptions = /* @__PURE__ */ new Map();
3287
+ this.listeners = /* @__PURE__ */ new Map();
3288
+ for (const channel of channels) {
3289
+ if (isPattern) {
3290
+ this.subscribeToPattern(channel);
3291
+ } else {
3292
+ this.subscribeToChannel(channel);
3293
+ }
3294
+ }
3295
+ }
3296
+ subscribeToChannel(channel) {
3297
+ const controller = new AbortController();
3298
+ const command = new SubscribeCommand([channel], {
3299
+ streamOptions: {
3300
+ signal: controller.signal,
3301
+ onMessage: (data) => this.handleMessage(data, false)
3302
+ }
3303
+ });
3304
+ command.exec(this.client).catch((error) => {
3305
+ if (error.name !== "AbortError") {
3306
+ this.dispatchToListeners("error", error);
3307
+ }
3308
+ });
3309
+ this.subscriptions.set(channel, {
3310
+ command,
3311
+ controller,
3312
+ isPattern: false
3313
+ });
3314
+ }
3315
+ subscribeToPattern(pattern) {
3316
+ const controller = new AbortController();
3317
+ const command = new PSubscribeCommand([pattern], {
3318
+ streamOptions: {
3319
+ signal: controller.signal,
3320
+ onMessage: (data) => this.handleMessage(data, true)
3321
+ }
3322
+ });
3323
+ command.exec(this.client).catch((error) => {
3324
+ if (error.name !== "AbortError") {
3325
+ this.dispatchToListeners("error", error);
3326
+ }
3327
+ });
3328
+ this.subscriptions.set(pattern, {
3329
+ command,
3330
+ controller,
3331
+ isPattern: true
3332
+ });
3333
+ }
3334
+ handleMessage(data, isPattern) {
3335
+ const messageData = data.replace(/^data:\s*/, "");
3336
+ const firstCommaIndex = messageData.indexOf(",");
3337
+ const secondCommaIndex = messageData.indexOf(",", firstCommaIndex + 1);
3338
+ const thirdCommaIndex = isPattern ? messageData.indexOf(",", secondCommaIndex + 1) : -1;
3339
+ if (firstCommaIndex !== -1 && secondCommaIndex !== -1) {
3340
+ const type = messageData.slice(0, firstCommaIndex);
3341
+ if (isPattern && type === "pmessage" && thirdCommaIndex !== -1) {
3342
+ const pattern = messageData.slice(firstCommaIndex + 1, secondCommaIndex);
3343
+ const channel = messageData.slice(secondCommaIndex + 1, thirdCommaIndex);
3344
+ const messageStr = messageData.slice(thirdCommaIndex + 1);
3345
+ try {
3346
+ const message = JSON.parse(messageStr);
3347
+ this.dispatchToListeners("pmessage", { pattern, channel, message });
3348
+ this.dispatchToListeners(`pmessage:${pattern}`, { pattern, channel, message });
3349
+ } catch (error) {
3350
+ this.dispatchToListeners("error", new Error(`Failed to parse message: ${error}`));
3351
+ }
3352
+ } else {
3353
+ const channel = messageData.slice(firstCommaIndex + 1, secondCommaIndex);
3354
+ const messageStr = messageData.slice(secondCommaIndex + 1);
3355
+ try {
3356
+ if (type === "subscribe" || type === "psubscribe" || type === "unsubscribe" || type === "punsubscribe") {
3357
+ const count = Number.parseInt(messageStr);
3358
+ this.dispatchToListeners(type, count);
3359
+ } else {
3360
+ const message = JSON.parse(messageStr);
3361
+ this.dispatchToListeners(type, { channel, message });
3362
+ this.dispatchToListeners(`${type}:${channel}`, { channel, message });
3363
+ }
3364
+ } catch (error) {
3365
+ this.dispatchToListeners("error", new Error(`Failed to parse message: ${error}`));
3366
+ }
3367
+ }
3368
+ }
3369
+ }
3370
+ dispatchToListeners(type, data) {
3371
+ const listeners = this.listeners.get(type);
3372
+ if (listeners) {
3373
+ for (const listener of listeners) {
3374
+ listener(data);
3375
+ }
3376
+ }
3377
+ }
3378
+ on(type, listener) {
3379
+ if (!this.listeners.has(type)) {
3380
+ this.listeners.set(type, /* @__PURE__ */ new Set());
3381
+ }
3382
+ this.listeners.get(type)?.add(listener);
3383
+ }
3384
+ removeAllListeners() {
3385
+ this.listeners.clear();
3386
+ }
3387
+ async unsubscribe(channels) {
3388
+ if (channels) {
3389
+ for (const channel of channels) {
3390
+ const subscription = this.subscriptions.get(channel);
3391
+ if (subscription) {
3392
+ try {
3393
+ subscription.controller.abort();
3394
+ } catch {
3395
+ }
3396
+ this.subscriptions.delete(channel);
3397
+ }
3398
+ }
3399
+ } else {
3400
+ for (const subscription of this.subscriptions.values()) {
3401
+ try {
3402
+ subscription.controller.abort();
3403
+ } catch {
3404
+ }
3405
+ }
3406
+ this.subscriptions.clear();
3407
+ this.removeAllListeners();
3408
+ }
3409
+ }
3410
+ getSubscribedChannels() {
3411
+ return [...this.subscriptions.keys()];
3412
+ }
3413
+ };
3414
+ var SubscribeCommand = class extends Command {
3415
+ constructor(cmd, opts) {
3416
+ const sseHeaders = {
3417
+ Accept: "text/event-stream",
3418
+ "Cache-Control": "no-cache",
3419
+ Connection: "keep-alive"
3420
+ };
3421
+ super([], {
3422
+ ...opts,
3423
+ headers: sseHeaders,
3424
+ path: ["subscribe", ...cmd],
3425
+ streamOptions: {
3426
+ isStreaming: true,
3427
+ onMessage: opts?.streamOptions?.onMessage,
3428
+ signal: opts?.streamOptions?.signal
3429
+ }
3430
+ });
3431
+ }
3432
+ };
3433
+
3434
+ // pkg/script.ts
3435
+ import Hex from "crypto-js/enc-hex.js";
3436
+ import sha1 from "crypto-js/sha1.js";
3437
+ var Script = class {
3438
+ script;
3439
+ sha1;
3440
+ redis;
3441
+ constructor(redis, script) {
3442
+ this.redis = redis;
3443
+ this.sha1 = this.digest(script);
3444
+ this.script = script;
3445
+ }
3446
+ /**
3447
+ * Send an `EVAL` command to redis.
3448
+ */
3449
+ async eval(keys, args) {
3450
+ return await this.redis.eval(this.script, keys, args);
3451
+ }
3452
+ /**
3453
+ * Calculates the sha1 hash of the script and then calls `EVALSHA`.
3454
+ */
3455
+ async evalsha(keys, args) {
3456
+ return await this.redis.evalsha(this.sha1, keys, args);
3457
+ }
3458
+ /**
3459
+ * Optimistically try to run `EVALSHA` first.
3460
+ * If the script is not loaded in redis, it will fall back and try again with `EVAL`.
3461
+ *
3462
+ * Following calls will be able to use the cached script
3463
+ */
3464
+ async exec(keys, args) {
3465
+ const res = await this.redis.evalsha(this.sha1, keys, args).catch(async (error) => {
3466
+ if (error instanceof Error && error.message.toLowerCase().includes("noscript")) {
3467
+ return await this.redis.eval(this.script, keys, args);
3468
+ }
3469
+ throw error;
3470
+ });
3471
+ return res;
3472
+ }
3473
+ /**
3474
+ * Compute the sha1 hash of the script and return its hex representation.
3475
+ */
3476
+ digest(s) {
3477
+ return Hex.stringify(sha1(s));
3478
+ }
3479
+ };
3480
+
3481
+ // pkg/scriptRo.ts
3482
+ import Hex2 from "crypto-js/enc-hex.js";
3483
+ import sha12 from "crypto-js/sha1.js";
3484
+ var ScriptRO = class {
3485
+ script;
3486
+ sha1;
3487
+ redis;
3488
+ constructor(redis, script) {
3489
+ this.redis = redis;
3490
+ this.sha1 = this.digest(script);
3491
+ this.script = script;
3492
+ }
3493
+ /**
3494
+ * Send an `EVAL_RO` command to redis.
3495
+ */
3496
+ async evalRo(keys, args) {
3497
+ return await this.redis.evalRo(this.script, keys, args);
3498
+ }
3499
+ /**
3500
+ * Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
3501
+ */
3502
+ async evalshaRo(keys, args) {
3503
+ return await this.redis.evalshaRo(this.sha1, keys, args);
3504
+ }
3505
+ /**
3506
+ * Optimistically try to run `EVALSHA_RO` first.
3507
+ * If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
3508
+ *
3509
+ * Following calls will be able to use the cached script
3510
+ */
3511
+ async exec(keys, args) {
3512
+ const res = await this.redis.evalshaRo(this.sha1, keys, args).catch(async (error) => {
3513
+ if (error instanceof Error && error.message.toLowerCase().includes("noscript")) {
3514
+ return await this.redis.evalRo(this.script, keys, args);
3515
+ }
3516
+ throw error;
3517
+ });
3518
+ return res;
3519
+ }
3520
+ /**
3521
+ * Compute the sha1 hash of the script and return its hex representation.
3522
+ */
3523
+ digest(s) {
3524
+ return Hex2.stringify(sha12(s));
3525
+ }
3526
+ };
3527
+
3528
+ // pkg/redis.ts
3529
+ var Redis = class {
3530
+ client;
3531
+ opts;
3532
+ enableTelemetry;
3533
+ enableAutoPipelining;
3534
+ /**
3535
+ * Create a new redis client
3536
+ *
3537
+ * @example
3538
+ * ```typescript
3539
+ * const redis = new Redis({
3540
+ * url: "<UPSTASH_REDIS_REST_URL>",
3541
+ * token: "<UPSTASH_REDIS_REST_TOKEN>",
3542
+ * });
3543
+ * ```
3544
+ */
3545
+ constructor(client, opts) {
3546
+ this.client = client;
3547
+ this.opts = opts;
3548
+ this.enableTelemetry = opts?.enableTelemetry ?? true;
3549
+ if (opts?.readYourWrites === false) {
3550
+ this.client.readYourWrites = false;
3551
+ }
3552
+ this.enableAutoPipelining = opts?.enableAutoPipelining ?? true;
3553
+ }
3554
+ get readYourWritesSyncToken() {
3555
+ return this.client.upstashSyncToken;
3556
+ }
3557
+ set readYourWritesSyncToken(session) {
3558
+ this.client.upstashSyncToken = session;
3559
+ }
3560
+ get json() {
3561
+ return {
3562
+ /**
3563
+ * @see https://redis.io/commands/json.arrappend
3564
+ */
3565
+ arrappend: (...args) => new JsonArrAppendCommand(args, this.opts).exec(this.client),
3566
+ /**
3567
+ * @see https://redis.io/commands/json.arrindex
3568
+ */
3569
+ arrindex: (...args) => new JsonArrIndexCommand(args, this.opts).exec(this.client),
3570
+ /**
3571
+ * @see https://redis.io/commands/json.arrinsert
3572
+ */
3573
+ arrinsert: (...args) => new JsonArrInsertCommand(args, this.opts).exec(this.client),
3574
+ /**
3575
+ * @see https://redis.io/commands/json.arrlen
3576
+ */
3577
+ arrlen: (...args) => new JsonArrLenCommand(args, this.opts).exec(this.client),
3578
+ /**
3579
+ * @see https://redis.io/commands/json.arrpop
3580
+ */
3581
+ arrpop: (...args) => new JsonArrPopCommand(args, this.opts).exec(this.client),
3582
+ /**
3583
+ * @see https://redis.io/commands/json.arrtrim
3584
+ */
3585
+ arrtrim: (...args) => new JsonArrTrimCommand(args, this.opts).exec(this.client),
3586
+ /**
3587
+ * @see https://redis.io/commands/json.clear
3588
+ */
3589
+ clear: (...args) => new JsonClearCommand(args, this.opts).exec(this.client),
3590
+ /**
3591
+ * @see https://redis.io/commands/json.del
3592
+ */
3593
+ del: (...args) => new JsonDelCommand(args, this.opts).exec(this.client),
3594
+ /**
3595
+ * @see https://redis.io/commands/json.forget
3596
+ */
3597
+ forget: (...args) => new JsonForgetCommand(args, this.opts).exec(this.client),
3598
+ /**
3599
+ * @see https://redis.io/commands/json.get
3600
+ */
3601
+ get: (...args) => new JsonGetCommand(args, this.opts).exec(this.client),
3602
+ /**
3603
+ * @see https://redis.io/commands/json.merge
3604
+ */
3605
+ merge: (...args) => new JsonMergeCommand(args, this.opts).exec(this.client),
3606
+ /**
3607
+ * @see https://redis.io/commands/json.mget
3608
+ */
3609
+ mget: (...args) => new JsonMGetCommand(args, this.opts).exec(this.client),
3610
+ /**
3611
+ * @see https://redis.io/commands/json.mset
3612
+ */
3613
+ mset: (...args) => new JsonMSetCommand(args, this.opts).exec(this.client),
3614
+ /**
3615
+ * @see https://redis.io/commands/json.numincrby
3616
+ */
3617
+ numincrby: (...args) => new JsonNumIncrByCommand(args, this.opts).exec(this.client),
3618
+ /**
3619
+ * @see https://redis.io/commands/json.nummultby
3620
+ */
3621
+ nummultby: (...args) => new JsonNumMultByCommand(args, this.opts).exec(this.client),
3622
+ /**
3623
+ * @see https://redis.io/commands/json.objkeys
3624
+ */
3625
+ objkeys: (...args) => new JsonObjKeysCommand(args, this.opts).exec(this.client),
3626
+ /**
3627
+ * @see https://redis.io/commands/json.objlen
3628
+ */
3629
+ objlen: (...args) => new JsonObjLenCommand(args, this.opts).exec(this.client),
3630
+ /**
3631
+ * @see https://redis.io/commands/json.resp
3632
+ */
3633
+ resp: (...args) => new JsonRespCommand(args, this.opts).exec(this.client),
3634
+ /**
3635
+ * @see https://redis.io/commands/json.set
3636
+ */
3637
+ set: (...args) => new JsonSetCommand(args, this.opts).exec(this.client),
3638
+ /**
3639
+ * @see https://redis.io/commands/json.strappend
3640
+ */
3641
+ strappend: (...args) => new JsonStrAppendCommand(args, this.opts).exec(this.client),
3642
+ /**
3643
+ * @see https://redis.io/commands/json.strlen
3644
+ */
3645
+ strlen: (...args) => new JsonStrLenCommand(args, this.opts).exec(this.client),
3646
+ /**
3647
+ * @see https://redis.io/commands/json.toggle
3648
+ */
3649
+ toggle: (...args) => new JsonToggleCommand(args, this.opts).exec(this.client),
3650
+ /**
3651
+ * @see https://redis.io/commands/json.type
3652
+ */
3653
+ type: (...args) => new JsonTypeCommand(args, this.opts).exec(this.client)
3654
+ };
3655
+ }
3656
+ /**
3657
+ * Wrap a new middleware around the HTTP client.
3658
+ */
3659
+ use = (middleware) => {
3660
+ const makeRequest = this.client.request.bind(this.client);
3661
+ this.client.request = (req) => middleware(req, makeRequest);
3662
+ };
3663
+ /**
3664
+ * Technically this is not private, we can hide it from intellisense by doing this
3665
+ */
3666
+ addTelemetry = (telemetry) => {
3667
+ if (!this.enableTelemetry) {
3668
+ return;
3669
+ }
3670
+ try {
3671
+ this.client.mergeTelemetry(telemetry);
3672
+ } catch {
3673
+ }
3674
+ };
3675
+ /**
3676
+ * Creates a new script.
3677
+ *
3678
+ * Scripts offer the ability to optimistically try to execute a script without having to send the
3679
+ * entire script to the server. If the script is loaded on the server, it tries again by sending
3680
+ * the entire script. Afterwards, the script is cached on the server.
3681
+ *
3682
+ * @param script - The script to create
3683
+ * @param opts - Optional options to pass to the script `{ readonly?: boolean }`
3684
+ * @returns A new script
3685
+ *
3686
+ * @example
3687
+ * ```ts
3688
+ * const redis = new Redis({...})
3689
+ *
3690
+ * const script = redis.createScript<string>("return ARGV[1];")
3691
+ * const arg1 = await script.eval([], ["Hello World"])
3692
+ * expect(arg1, "Hello World")
3693
+ * ```
3694
+ * @example
3695
+ * ```ts
3696
+ * const redis = new Redis({...})
3697
+ *
3698
+ * const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
3699
+ * const arg1 = await script.evalRo([], ["Hello World"])
3700
+ * expect(arg1, "Hello World")
3701
+ * ```
3702
+ */
3703
+ createScript(script, opts) {
3704
+ return opts?.readonly ? new ScriptRO(this, script) : new Script(this, script);
3705
+ }
3706
+ /**
3707
+ * Create a new pipeline that allows you to send requests in bulk.
3708
+ *
3709
+ * @see {@link Pipeline}
3710
+ */
3711
+ pipeline = () => new Pipeline({
3712
+ client: this.client,
3713
+ commandOptions: this.opts,
3714
+ multiExec: false
3715
+ });
3716
+ autoPipeline = () => {
3717
+ return createAutoPipelineProxy(this);
3718
+ };
3719
+ /**
3720
+ * Create a new transaction to allow executing multiple steps atomically.
3721
+ *
3722
+ * All the commands in a transaction are serialized and executed sequentially. A request sent by
3723
+ * another client will never be served in the middle of the execution of a Redis Transaction. This
3724
+ * guarantees that the commands are executed as a single isolated operation.
3725
+ *
3726
+ * @see {@link Pipeline}
3727
+ */
3728
+ multi = () => new Pipeline({
3729
+ client: this.client,
3730
+ commandOptions: this.opts,
3731
+ multiExec: true
3732
+ });
3733
+ /**
3734
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
3735
+ *
3736
+ * @example
3737
+ * ```typescript
3738
+ * redis.set("mykey", 0);
3739
+ * const result = await redis.bitfield("mykey")
3740
+ * .set("u4", 0, 16)
3741
+ * .incr("u4", "#1", 1)
3742
+ * .exec();
3743
+ * console.log(result); // [0, 1]
3744
+ * ```
3745
+ *
3746
+ * @see https://redis.io/commands/bitfield
3747
+ */
3748
+ bitfield = (...args) => new BitFieldCommand(args, this.client, this.opts);
3749
+ /**
3750
+ * @see https://redis.io/commands/append
3751
+ */
3752
+ append = (...args) => new AppendCommand(args, this.opts).exec(this.client);
3753
+ /**
3754
+ * @see https://redis.io/commands/bitcount
3755
+ */
3756
+ bitcount = (...args) => new BitCountCommand(args, this.opts).exec(this.client);
3757
+ /**
3758
+ * @see https://redis.io/commands/bitop
3759
+ */
3760
+ bitop = (op, destinationKey, sourceKey, ...sourceKeys) => new BitOpCommand([op, destinationKey, sourceKey, ...sourceKeys], this.opts).exec(
3761
+ this.client
3762
+ );
3763
+ /**
3764
+ * @see https://redis.io/commands/bitpos
3765
+ */
3766
+ bitpos = (...args) => new BitPosCommand(args, this.opts).exec(this.client);
3767
+ /**
3768
+ * @see https://redis.io/commands/copy
3769
+ */
3770
+ copy = (...args) => new CopyCommand(args, this.opts).exec(this.client);
3771
+ /**
3772
+ * @see https://redis.io/commands/dbsize
3773
+ */
3774
+ dbsize = () => new DBSizeCommand(this.opts).exec(this.client);
3775
+ /**
3776
+ * @see https://redis.io/commands/decr
3777
+ */
3778
+ decr = (...args) => new DecrCommand(args, this.opts).exec(this.client);
3779
+ /**
3780
+ * @see https://redis.io/commands/decrby
3781
+ */
3782
+ decrby = (...args) => new DecrByCommand(args, this.opts).exec(this.client);
3783
+ /**
3784
+ * @see https://redis.io/commands/del
3785
+ */
3786
+ del = (...args) => new DelCommand(args, this.opts).exec(this.client);
3787
+ /**
3788
+ * @see https://redis.io/commands/echo
3789
+ */
3790
+ echo = (...args) => new EchoCommand(args, this.opts).exec(this.client);
3791
+ /**
3792
+ * @see https://redis.io/commands/eval_ro
3793
+ */
3794
+ evalRo = (...args) => new EvalROCommand(args, this.opts).exec(this.client);
3795
+ /**
3796
+ * @see https://redis.io/commands/eval
3797
+ */
3798
+ eval = (...args) => new EvalCommand(args, this.opts).exec(this.client);
3799
+ /**
3800
+ * @see https://redis.io/commands/evalsha_ro
3801
+ */
3802
+ evalshaRo = (...args) => new EvalshaROCommand(args, this.opts).exec(this.client);
3803
+ /**
3804
+ * @see https://redis.io/commands/evalsha
3805
+ */
3806
+ evalsha = (...args) => new EvalshaCommand(args, this.opts).exec(this.client);
3807
+ /**
3808
+ * Generic method to execute any Redis command.
3809
+ */
3810
+ exec = (args) => new ExecCommand(args, this.opts).exec(this.client);
3811
+ /**
3812
+ * @see https://redis.io/commands/exists
3813
+ */
3814
+ exists = (...args) => new ExistsCommand(args, this.opts).exec(this.client);
3815
+ /**
3816
+ * @see https://redis.io/commands/expire
3817
+ */
3818
+ expire = (...args) => new ExpireCommand(args, this.opts).exec(this.client);
3819
+ /**
3820
+ * @see https://redis.io/commands/expireat
3821
+ */
3822
+ expireat = (...args) => new ExpireAtCommand(args, this.opts).exec(this.client);
3823
+ /**
3824
+ * @see https://redis.io/commands/flushall
3825
+ */
3826
+ flushall = (args) => new FlushAllCommand(args, this.opts).exec(this.client);
3827
+ /**
3828
+ * @see https://redis.io/commands/flushdb
3829
+ */
3830
+ flushdb = (...args) => new FlushDBCommand(args, this.opts).exec(this.client);
3831
+ /**
3832
+ * @see https://redis.io/commands/geoadd
3833
+ */
3834
+ geoadd = (...args) => new GeoAddCommand(args, this.opts).exec(this.client);
3835
+ /**
3836
+ * @see https://redis.io/commands/geopos
3837
+ */
3838
+ geopos = (...args) => new GeoPosCommand(args, this.opts).exec(this.client);
3839
+ /**
3840
+ * @see https://redis.io/commands/geodist
3841
+ */
3842
+ geodist = (...args) => new GeoDistCommand(args, this.opts).exec(this.client);
3843
+ /**
3844
+ * @see https://redis.io/commands/geohash
3845
+ */
3846
+ geohash = (...args) => new GeoHashCommand(args, this.opts).exec(this.client);
3847
+ /**
3848
+ * @see https://redis.io/commands/geosearch
3849
+ */
3850
+ geosearch = (...args) => new GeoSearchCommand(args, this.opts).exec(this.client);
3851
+ /**
3852
+ * @see https://redis.io/commands/geosearchstore
3853
+ */
3854
+ geosearchstore = (...args) => new GeoSearchStoreCommand(args, this.opts).exec(this.client);
3855
+ /**
3856
+ * @see https://redis.io/commands/get
3857
+ */
3858
+ get = (...args) => new GetCommand(args, this.opts).exec(this.client);
3859
+ /**
3860
+ * @see https://redis.io/commands/getbit
3861
+ */
3862
+ getbit = (...args) => new GetBitCommand(args, this.opts).exec(this.client);
3863
+ /**
3864
+ * @see https://redis.io/commands/getdel
3865
+ */
3866
+ getdel = (...args) => new GetDelCommand(args, this.opts).exec(this.client);
3867
+ /**
3868
+ * @see https://redis.io/commands/getex
3869
+ */
3870
+ getex = (...args) => new GetExCommand(args, this.opts).exec(this.client);
3871
+ /**
3872
+ * @see https://redis.io/commands/getrange
3873
+ */
3874
+ getrange = (...args) => new GetRangeCommand(args, this.opts).exec(this.client);
3875
+ /**
3876
+ * @see https://redis.io/commands/getset
3877
+ */
3878
+ getset = (key, value) => new GetSetCommand([key, value], this.opts).exec(this.client);
3879
+ /**
3880
+ * @see https://redis.io/commands/hdel
3881
+ */
3882
+ hdel = (...args) => new HDelCommand(args, this.opts).exec(this.client);
3883
+ /**
3884
+ * @see https://redis.io/commands/hexists
3885
+ */
3886
+ hexists = (...args) => new HExistsCommand(args, this.opts).exec(this.client);
3887
+ /**
3888
+ * @see https://redis.io/commands/hexpire
3889
+ */
3890
+ hexpire = (...args) => new HExpireCommand(args, this.opts).exec(this.client);
3891
+ /**
3892
+ * @see https://redis.io/commands/hexpireat
3893
+ */
3894
+ hexpireat = (...args) => new HExpireAtCommand(args, this.opts).exec(this.client);
3895
+ /**
3896
+ * @see https://redis.io/commands/hexpiretime
3897
+ */
3898
+ hexpiretime = (...args) => new HExpireTimeCommand(args, this.opts).exec(this.client);
3899
+ /**
3900
+ * @see https://redis.io/commands/httl
3901
+ */
3902
+ httl = (...args) => new HTtlCommand(args, this.opts).exec(this.client);
3903
+ /**
3904
+ * @see https://redis.io/commands/hpexpire
3905
+ */
3906
+ hpexpire = (...args) => new HPExpireCommand(args, this.opts).exec(this.client);
3907
+ /**
3908
+ * @see https://redis.io/commands/hpexpireat
3909
+ */
3910
+ hpexpireat = (...args) => new HPExpireAtCommand(args, this.opts).exec(this.client);
3911
+ /**
3912
+ * @see https://redis.io/commands/hpexpiretime
3913
+ */
3914
+ hpexpiretime = (...args) => new HPExpireTimeCommand(args, this.opts).exec(this.client);
3915
+ /**
3916
+ * @see https://redis.io/commands/hpttl
3917
+ */
3918
+ hpttl = (...args) => new HPTtlCommand(args, this.opts).exec(this.client);
3919
+ /**
3920
+ * @see https://redis.io/commands/hpersist
3921
+ */
3922
+ hpersist = (...args) => new HPersistCommand(args, this.opts).exec(this.client);
3923
+ /**
3924
+ * @see https://redis.io/commands/hget
3925
+ */
3926
+ hget = (...args) => new HGetCommand(args, this.opts).exec(this.client);
3927
+ /**
3928
+ * @see https://redis.io/commands/hgetall
3929
+ */
3930
+ hgetall = (...args) => new HGetAllCommand(args, this.opts).exec(this.client);
3931
+ /**
3932
+ * @see https://redis.io/commands/hincrby
3933
+ */
3934
+ hincrby = (...args) => new HIncrByCommand(args, this.opts).exec(this.client);
3935
+ /**
3936
+ * @see https://redis.io/commands/hincrbyfloat
3937
+ */
3938
+ hincrbyfloat = (...args) => new HIncrByFloatCommand(args, this.opts).exec(this.client);
3939
+ /**
3940
+ * @see https://redis.io/commands/hkeys
3941
+ */
3942
+ hkeys = (...args) => new HKeysCommand(args, this.opts).exec(this.client);
3943
+ /**
3944
+ * @see https://redis.io/commands/hlen
3945
+ */
3946
+ hlen = (...args) => new HLenCommand(args, this.opts).exec(this.client);
3947
+ /**
3948
+ * @see https://redis.io/commands/hmget
3949
+ */
3950
+ hmget = (...args) => new HMGetCommand(args, this.opts).exec(this.client);
3951
+ /**
3952
+ * @see https://redis.io/commands/hmset
3953
+ */
3954
+ hmset = (key, kv) => new HMSetCommand([key, kv], this.opts).exec(this.client);
3955
+ /**
3956
+ * @see https://redis.io/commands/hrandfield
3957
+ */
3958
+ hrandfield = (key, count, withValues) => new HRandFieldCommand([key, count, withValues], this.opts).exec(this.client);
3959
+ /**
3960
+ * @see https://redis.io/commands/hscan
3961
+ */
3962
+ hscan = (...args) => new HScanCommand(args, this.opts).exec(this.client);
3963
+ /**
3964
+ * @see https://redis.io/commands/hset
3965
+ */
3966
+ hset = (key, kv) => new HSetCommand([key, kv], this.opts).exec(this.client);
3967
+ /**
3968
+ * @see https://redis.io/commands/hsetnx
3969
+ */
3970
+ hsetnx = (key, field, value) => new HSetNXCommand([key, field, value], this.opts).exec(this.client);
3971
+ /**
3972
+ * @see https://redis.io/commands/hstrlen
3973
+ */
3974
+ hstrlen = (...args) => new HStrLenCommand(args, this.opts).exec(this.client);
3975
+ /**
3976
+ * @see https://redis.io/commands/hvals
3977
+ */
3978
+ hvals = (...args) => new HValsCommand(args, this.opts).exec(this.client);
3979
+ /**
3980
+ * @see https://redis.io/commands/incr
3981
+ */
3982
+ incr = (...args) => new IncrCommand(args, this.opts).exec(this.client);
3983
+ /**
3984
+ * @see https://redis.io/commands/incrby
3985
+ */
3986
+ incrby = (...args) => new IncrByCommand(args, this.opts).exec(this.client);
3987
+ /**
3988
+ * @see https://redis.io/commands/incrbyfloat
3989
+ */
3990
+ incrbyfloat = (...args) => new IncrByFloatCommand(args, this.opts).exec(this.client);
3991
+ /**
3992
+ * @see https://redis.io/commands/keys
3993
+ */
3994
+ keys = (...args) => new KeysCommand(args, this.opts).exec(this.client);
3995
+ /**
3996
+ * @see https://redis.io/commands/lindex
3997
+ */
3998
+ lindex = (...args) => new LIndexCommand(args, this.opts).exec(this.client);
3999
+ /**
4000
+ * @see https://redis.io/commands/linsert
4001
+ */
4002
+ linsert = (key, direction, pivot, value) => new LInsertCommand([key, direction, pivot, value], this.opts).exec(this.client);
4003
+ /**
4004
+ * @see https://redis.io/commands/llen
4005
+ */
4006
+ llen = (...args) => new LLenCommand(args, this.opts).exec(this.client);
4007
+ /**
4008
+ * @see https://redis.io/commands/lmove
4009
+ */
4010
+ lmove = (...args) => new LMoveCommand(args, this.opts).exec(this.client);
4011
+ /**
4012
+ * @see https://redis.io/commands/lpop
4013
+ */
4014
+ lpop = (...args) => new LPopCommand(args, this.opts).exec(this.client);
4015
+ /**
4016
+ * @see https://redis.io/commands/lmpop
4017
+ */
4018
+ lmpop = (...args) => new LmPopCommand(args, this.opts).exec(this.client);
4019
+ /**
4020
+ * @see https://redis.io/commands/lpos
4021
+ */
4022
+ lpos = (...args) => new LPosCommand(args, this.opts).exec(this.client);
4023
+ /**
4024
+ * @see https://redis.io/commands/lpush
4025
+ */
4026
+ lpush = (key, ...elements) => new LPushCommand([key, ...elements], this.opts).exec(this.client);
4027
+ /**
4028
+ * @see https://redis.io/commands/lpushx
4029
+ */
4030
+ lpushx = (key, ...elements) => new LPushXCommand([key, ...elements], this.opts).exec(this.client);
4031
+ /**
4032
+ * @see https://redis.io/commands/lrange
4033
+ */
4034
+ lrange = (...args) => new LRangeCommand(args, this.opts).exec(this.client);
4035
+ /**
4036
+ * @see https://redis.io/commands/lrem
4037
+ */
4038
+ lrem = (key, count, value) => new LRemCommand([key, count, value], this.opts).exec(this.client);
4039
+ /**
4040
+ * @see https://redis.io/commands/lset
4041
+ */
4042
+ lset = (key, index, value) => new LSetCommand([key, index, value], this.opts).exec(this.client);
4043
+ /**
4044
+ * @see https://redis.io/commands/ltrim
4045
+ */
4046
+ ltrim = (...args) => new LTrimCommand(args, this.opts).exec(this.client);
4047
+ /**
4048
+ * @see https://redis.io/commands/mget
4049
+ */
4050
+ mget = (...args) => new MGetCommand(args, this.opts).exec(this.client);
4051
+ /**
4052
+ * @see https://redis.io/commands/mset
4053
+ */
4054
+ mset = (kv) => new MSetCommand([kv], this.opts).exec(this.client);
4055
+ /**
4056
+ * @see https://redis.io/commands/msetnx
4057
+ */
4058
+ msetnx = (kv) => new MSetNXCommand([kv], this.opts).exec(this.client);
4059
+ /**
4060
+ * @see https://redis.io/commands/persist
4061
+ */
4062
+ persist = (...args) => new PersistCommand(args, this.opts).exec(this.client);
4063
+ /**
4064
+ * @see https://redis.io/commands/pexpire
4065
+ */
4066
+ pexpire = (...args) => new PExpireCommand(args, this.opts).exec(this.client);
4067
+ /**
4068
+ * @see https://redis.io/commands/pexpireat
4069
+ */
4070
+ pexpireat = (...args) => new PExpireAtCommand(args, this.opts).exec(this.client);
4071
+ /**
4072
+ * @see https://redis.io/commands/pfadd
4073
+ */
4074
+ pfadd = (...args) => new PfAddCommand(args, this.opts).exec(this.client);
4075
+ /**
4076
+ * @see https://redis.io/commands/pfcount
4077
+ */
4078
+ pfcount = (...args) => new PfCountCommand(args, this.opts).exec(this.client);
4079
+ /**
4080
+ * @see https://redis.io/commands/pfmerge
4081
+ */
4082
+ pfmerge = (...args) => new PfMergeCommand(args, this.opts).exec(this.client);
4083
+ /**
4084
+ * @see https://redis.io/commands/ping
4085
+ */
4086
+ ping = (args) => new PingCommand(args, this.opts).exec(this.client);
4087
+ /**
4088
+ * @see https://redis.io/commands/psetex
4089
+ */
4090
+ psetex = (key, ttl, value) => new PSetEXCommand([key, ttl, value], this.opts).exec(this.client);
4091
+ /**
4092
+ * @see https://redis.io/commands/psubscribe
4093
+ */
4094
+ psubscribe = (patterns) => {
4095
+ const patternArray = Array.isArray(patterns) ? patterns : [patterns];
4096
+ return new Subscriber(this.client, patternArray, true);
4097
+ };
4098
+ /**
4099
+ * @see https://redis.io/commands/pttl
4100
+ */
4101
+ pttl = (...args) => new PTtlCommand(args, this.opts).exec(this.client);
4102
+ /**
4103
+ * @see https://redis.io/commands/publish
4104
+ */
4105
+ publish = (...args) => new PublishCommand(args, this.opts).exec(this.client);
4106
+ /**
4107
+ * @see https://redis.io/commands/randomkey
4108
+ */
4109
+ randomkey = () => new RandomKeyCommand().exec(this.client);
4110
+ /**
4111
+ * @see https://redis.io/commands/rename
4112
+ */
4113
+ rename = (...args) => new RenameCommand(args, this.opts).exec(this.client);
4114
+ /**
4115
+ * @see https://redis.io/commands/renamenx
4116
+ */
4117
+ renamenx = (...args) => new RenameNXCommand(args, this.opts).exec(this.client);
4118
+ /**
4119
+ * @see https://redis.io/commands/rpop
4120
+ */
4121
+ rpop = (...args) => new RPopCommand(args, this.opts).exec(this.client);
4122
+ /**
4123
+ * @see https://redis.io/commands/rpush
4124
+ */
4125
+ rpush = (key, ...elements) => new RPushCommand([key, ...elements], this.opts).exec(this.client);
4126
+ /**
4127
+ * @see https://redis.io/commands/rpushx
4128
+ */
4129
+ rpushx = (key, ...elements) => new RPushXCommand([key, ...elements], this.opts).exec(this.client);
4130
+ /**
4131
+ * @see https://redis.io/commands/sadd
4132
+ */
4133
+ sadd = (key, member, ...members) => new SAddCommand([key, member, ...members], this.opts).exec(this.client);
4134
+ /**
4135
+ * @see https://redis.io/commands/scan
4136
+ */
4137
+ scan = (...args) => new ScanCommand(args, this.opts).exec(this.client);
4138
+ /**
4139
+ * @see https://redis.io/commands/scard
4140
+ */
4141
+ scard = (...args) => new SCardCommand(args, this.opts).exec(this.client);
4142
+ /**
4143
+ * @see https://redis.io/commands/script-exists
4144
+ */
4145
+ scriptExists = (...args) => new ScriptExistsCommand(args, this.opts).exec(this.client);
4146
+ /**
4147
+ * @see https://redis.io/commands/script-flush
4148
+ */
4149
+ scriptFlush = (...args) => new ScriptFlushCommand(args, this.opts).exec(this.client);
4150
+ /**
4151
+ * @see https://redis.io/commands/script-load
4152
+ */
4153
+ scriptLoad = (...args) => new ScriptLoadCommand(args, this.opts).exec(this.client);
4154
+ /**
4155
+ * @see https://redis.io/commands/sdiff
4156
+ */
4157
+ sdiff = (...args) => new SDiffCommand(args, this.opts).exec(this.client);
4158
+ /**
4159
+ * @see https://redis.io/commands/sdiffstore
4160
+ */
4161
+ sdiffstore = (...args) => new SDiffStoreCommand(args, this.opts).exec(this.client);
4162
+ /**
4163
+ * @see https://redis.io/commands/set
4164
+ */
4165
+ set = (key, value, opts) => new SetCommand([key, value, opts], this.opts).exec(this.client);
4166
+ /**
4167
+ * @see https://redis.io/commands/setbit
4168
+ */
4169
+ setbit = (...args) => new SetBitCommand(args, this.opts).exec(this.client);
4170
+ /**
4171
+ * @see https://redis.io/commands/setex
4172
+ */
4173
+ setex = (key, ttl, value) => new SetExCommand([key, ttl, value], this.opts).exec(this.client);
4174
+ /**
4175
+ * @see https://redis.io/commands/setnx
4176
+ */
4177
+ setnx = (key, value) => new SetNxCommand([key, value], this.opts).exec(this.client);
4178
+ /**
4179
+ * @see https://redis.io/commands/setrange
4180
+ */
4181
+ setrange = (...args) => new SetRangeCommand(args, this.opts).exec(this.client);
4182
+ /**
4183
+ * @see https://redis.io/commands/sinter
4184
+ */
4185
+ sinter = (...args) => new SInterCommand(args, this.opts).exec(this.client);
4186
+ /**
4187
+ * @see https://redis.io/commands/sinterstore
4188
+ */
4189
+ sinterstore = (...args) => new SInterStoreCommand(args, this.opts).exec(this.client);
4190
+ /**
4191
+ * @see https://redis.io/commands/sismember
4192
+ */
4193
+ sismember = (key, member) => new SIsMemberCommand([key, member], this.opts).exec(this.client);
4194
+ /**
4195
+ * @see https://redis.io/commands/smismember
4196
+ */
4197
+ smismember = (key, members) => new SMIsMemberCommand([key, members], this.opts).exec(this.client);
4198
+ /**
4199
+ * @see https://redis.io/commands/smembers
4200
+ */
4201
+ smembers = (...args) => new SMembersCommand(args, this.opts).exec(this.client);
4202
+ /**
4203
+ * @see https://redis.io/commands/smove
4204
+ */
4205
+ smove = (source, destination, member) => new SMoveCommand([source, destination, member], this.opts).exec(this.client);
4206
+ /**
4207
+ * @see https://redis.io/commands/spop
4208
+ */
4209
+ spop = (...args) => new SPopCommand(args, this.opts).exec(this.client);
4210
+ /**
4211
+ * @see https://redis.io/commands/srandmember
4212
+ */
4213
+ srandmember = (...args) => new SRandMemberCommand(args, this.opts).exec(this.client);
4214
+ /**
4215
+ * @see https://redis.io/commands/srem
4216
+ */
4217
+ srem = (key, ...members) => new SRemCommand([key, ...members], this.opts).exec(this.client);
4218
+ /**
4219
+ * @see https://redis.io/commands/sscan
4220
+ */
4221
+ sscan = (...args) => new SScanCommand(args, this.opts).exec(this.client);
4222
+ /**
4223
+ * @see https://redis.io/commands/strlen
4224
+ */
4225
+ strlen = (...args) => new StrLenCommand(args, this.opts).exec(this.client);
4226
+ /**
4227
+ * @see https://redis.io/commands/subscribe
4228
+ */
4229
+ subscribe = (channels) => {
4230
+ const channelArray = Array.isArray(channels) ? channels : [channels];
4231
+ return new Subscriber(this.client, channelArray);
4232
+ };
4233
+ /**
4234
+ * @see https://redis.io/commands/sunion
4235
+ */
4236
+ sunion = (...args) => new SUnionCommand(args, this.opts).exec(this.client);
4237
+ /**
4238
+ * @see https://redis.io/commands/sunionstore
4239
+ */
4240
+ sunionstore = (...args) => new SUnionStoreCommand(args, this.opts).exec(this.client);
4241
+ /**
4242
+ * @see https://redis.io/commands/time
4243
+ */
4244
+ time = () => new TimeCommand().exec(this.client);
4245
+ /**
4246
+ * @see https://redis.io/commands/touch
4247
+ */
4248
+ touch = (...args) => new TouchCommand(args, this.opts).exec(this.client);
4249
+ /**
4250
+ * @see https://redis.io/commands/ttl
4251
+ */
4252
+ ttl = (...args) => new TtlCommand(args, this.opts).exec(this.client);
4253
+ /**
4254
+ * @see https://redis.io/commands/type
4255
+ */
4256
+ type = (...args) => new TypeCommand(args, this.opts).exec(this.client);
4257
+ /**
4258
+ * @see https://redis.io/commands/unlink
4259
+ */
4260
+ unlink = (...args) => new UnlinkCommand(args, this.opts).exec(this.client);
4261
+ /**
4262
+ * @see https://redis.io/commands/xadd
4263
+ */
4264
+ xadd = (...args) => new XAddCommand(args, this.opts).exec(this.client);
4265
+ /**
4266
+ * @see https://redis.io/commands/xack
4267
+ */
4268
+ xack = (...args) => new XAckCommand(args, this.opts).exec(this.client);
4269
+ /**
4270
+ * @see https://redis.io/commands/xdel
4271
+ */
4272
+ xdel = (...args) => new XDelCommand(args, this.opts).exec(this.client);
4273
+ /**
4274
+ * @see https://redis.io/commands/xgroup
4275
+ */
4276
+ xgroup = (...args) => new XGroupCommand(args, this.opts).exec(this.client);
4277
+ /**
4278
+ * @see https://redis.io/commands/xread
4279
+ */
4280
+ xread = (...args) => new XReadCommand(args, this.opts).exec(this.client);
4281
+ /**
4282
+ * @see https://redis.io/commands/xreadgroup
4283
+ */
4284
+ xreadgroup = (...args) => new XReadGroupCommand(args, this.opts).exec(this.client);
4285
+ /**
4286
+ * @see https://redis.io/commands/xinfo
4287
+ */
4288
+ xinfo = (...args) => new XInfoCommand(args, this.opts).exec(this.client);
4289
+ /**
4290
+ * @see https://redis.io/commands/xlen
4291
+ */
4292
+ xlen = (...args) => new XLenCommand(args, this.opts).exec(this.client);
4293
+ /**
4294
+ * @see https://redis.io/commands/xpending
4295
+ */
4296
+ xpending = (...args) => new XPendingCommand(args, this.opts).exec(this.client);
4297
+ /**
4298
+ * @see https://redis.io/commands/xclaim
4299
+ */
4300
+ xclaim = (...args) => new XClaimCommand(args, this.opts).exec(this.client);
4301
+ /**
4302
+ * @see https://redis.io/commands/xautoclaim
4303
+ */
4304
+ xautoclaim = (...args) => new XAutoClaim(args, this.opts).exec(this.client);
4305
+ /**
4306
+ * @see https://redis.io/commands/xtrim
4307
+ */
4308
+ xtrim = (...args) => new XTrimCommand(args, this.opts).exec(this.client);
4309
+ /**
4310
+ * @see https://redis.io/commands/xrange
4311
+ */
4312
+ xrange = (...args) => new XRangeCommand(args, this.opts).exec(this.client);
4313
+ /**
4314
+ * @see https://redis.io/commands/xrevrange
4315
+ */
4316
+ xrevrange = (...args) => new XRevRangeCommand(args, this.opts).exec(this.client);
4317
+ /**
4318
+ * @see https://redis.io/commands/zadd
4319
+ */
4320
+ zadd = (...args) => {
4321
+ if ("score" in args[1]) {
4322
+ return new ZAddCommand([args[0], args[1], ...args.slice(2)], this.opts).exec(
4323
+ this.client
4324
+ );
4325
+ }
4326
+ return new ZAddCommand(
4327
+ [args[0], args[1], ...args.slice(2)],
4328
+ this.opts
4329
+ ).exec(this.client);
4330
+ };
4331
+ /**
4332
+ * @see https://redis.io/commands/zcard
4333
+ */
4334
+ zcard = (...args) => new ZCardCommand(args, this.opts).exec(this.client);
4335
+ /**
4336
+ * @see https://redis.io/commands/zcount
4337
+ */
4338
+ zcount = (...args) => new ZCountCommand(args, this.opts).exec(this.client);
4339
+ /**
4340
+ * @see https://redis.io/commands/zdiffstore
4341
+ */
4342
+ zdiffstore = (...args) => new ZDiffStoreCommand(args, this.opts).exec(this.client);
4343
+ /**
4344
+ * @see https://redis.io/commands/zincrby
4345
+ */
4346
+ zincrby = (key, increment, member) => new ZIncrByCommand([key, increment, member], this.opts).exec(this.client);
4347
+ /**
4348
+ * @see https://redis.io/commands/zinterstore
4349
+ */
4350
+ zinterstore = (...args) => new ZInterStoreCommand(args, this.opts).exec(this.client);
4351
+ /**
4352
+ * @see https://redis.io/commands/zlexcount
4353
+ */
4354
+ zlexcount = (...args) => new ZLexCountCommand(args, this.opts).exec(this.client);
4355
+ /**
4356
+ * @see https://redis.io/commands/zmscore
4357
+ */
4358
+ zmscore = (...args) => new ZMScoreCommand(args, this.opts).exec(this.client);
4359
+ /**
4360
+ * @see https://redis.io/commands/zpopmax
4361
+ */
4362
+ zpopmax = (...args) => new ZPopMaxCommand(args, this.opts).exec(this.client);
4363
+ /**
4364
+ * @see https://redis.io/commands/zpopmin
4365
+ */
4366
+ zpopmin = (...args) => new ZPopMinCommand(args, this.opts).exec(this.client);
4367
+ /**
4368
+ * @see https://redis.io/commands/zrange
4369
+ */
4370
+ zrange = (...args) => new ZRangeCommand(args, this.opts).exec(this.client);
4371
+ /**
4372
+ * @see https://redis.io/commands/zrank
4373
+ */
4374
+ zrank = (key, member) => new ZRankCommand([key, member], this.opts).exec(this.client);
4375
+ /**
4376
+ * @see https://redis.io/commands/zrem
4377
+ */
4378
+ zrem = (key, ...members) => new ZRemCommand([key, ...members], this.opts).exec(this.client);
4379
+ /**
4380
+ * @see https://redis.io/commands/zremrangebylex
4381
+ */
4382
+ zremrangebylex = (...args) => new ZRemRangeByLexCommand(args, this.opts).exec(this.client);
4383
+ /**
4384
+ * @see https://redis.io/commands/zremrangebyrank
4385
+ */
4386
+ zremrangebyrank = (...args) => new ZRemRangeByRankCommand(args, this.opts).exec(this.client);
4387
+ /**
4388
+ * @see https://redis.io/commands/zremrangebyscore
4389
+ */
4390
+ zremrangebyscore = (...args) => new ZRemRangeByScoreCommand(args, this.opts).exec(this.client);
4391
+ /**
4392
+ * @see https://redis.io/commands/zrevrank
4393
+ */
4394
+ zrevrank = (key, member) => new ZRevRankCommand([key, member], this.opts).exec(this.client);
4395
+ /**
4396
+ * @see https://redis.io/commands/zscan
4397
+ */
4398
+ zscan = (...args) => new ZScanCommand(args, this.opts).exec(this.client);
4399
+ /**
4400
+ * @see https://redis.io/commands/zscore
4401
+ */
4402
+ zscore = (key, member) => new ZScoreCommand([key, member], this.opts).exec(this.client);
4403
+ /**
4404
+ * @see https://redis.io/commands/zunion
4405
+ */
4406
+ zunion = (...args) => new ZUnionCommand(args, this.opts).exec(this.client);
4407
+ /**
4408
+ * @see https://redis.io/commands/zunionstore
4409
+ */
4410
+ zunionstore = (...args) => new ZUnionStoreCommand(args, this.opts).exec(this.client);
4411
+ };
4412
+
4413
+ // version.ts
4414
+ var VERSION = "v1.30.2";
4415
+
4416
+ export {
4417
+ error_exports,
4418
+ HttpClient,
4419
+ Redis,
4420
+ VERSION
4421
+ };