@upstash/redis 0.0.0-ci.a094ea5b → 0.0.0-ci.a1eecf417a1944a8b82f402809dd438d52cdf64a-20250506071248

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 (398) hide show
  1. package/README.md +36 -23
  2. package/chunk-GMXDO2TZ.mjs +4439 -0
  3. package/cloudflare.d.mts +55 -0
  4. package/cloudflare.d.ts +55 -0
  5. package/cloudflare.js +4551 -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 +4524 -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 +4571 -0
  14. package/nodejs.mjs +113 -0
  15. package/package.json +1 -101
  16. package/zmscore-CjoCv9kz.d.mts +3972 -0
  17. package/zmscore-CjoCv9kz.d.ts +3972 -0
  18. package/.releaserc +0 -14
  19. package/esm/package.json +0 -3
  20. package/esm/pkg/commands/append.js +0 -9
  21. package/esm/pkg/commands/bitcount.js +0 -16
  22. package/esm/pkg/commands/bitop.js +0 -9
  23. package/esm/pkg/commands/bitpos.js +0 -9
  24. package/esm/pkg/commands/command.js +0 -57
  25. package/esm/pkg/commands/dbsize.js +0 -9
  26. package/esm/pkg/commands/decr.js +0 -9
  27. package/esm/pkg/commands/decrby.js +0 -9
  28. package/esm/pkg/commands/del.js +0 -9
  29. package/esm/pkg/commands/echo.js +0 -9
  30. package/esm/pkg/commands/eval.js +0 -9
  31. package/esm/pkg/commands/evalsha.js +0 -9
  32. package/esm/pkg/commands/exists.js +0 -9
  33. package/esm/pkg/commands/expire.js +0 -9
  34. package/esm/pkg/commands/expireat.js +0 -9
  35. package/esm/pkg/commands/flushall.js +0 -13
  36. package/esm/pkg/commands/flushdb.js +0 -13
  37. package/esm/pkg/commands/get.js +0 -9
  38. package/esm/pkg/commands/getbit.js +0 -9
  39. package/esm/pkg/commands/getrange.js +0 -9
  40. package/esm/pkg/commands/getset.js +0 -9
  41. package/esm/pkg/commands/hdel.js +0 -9
  42. package/esm/pkg/commands/hexists.js +0 -9
  43. package/esm/pkg/commands/hget.js +0 -9
  44. package/esm/pkg/commands/hgetall.js +0 -33
  45. package/esm/pkg/commands/hincrby.js +0 -9
  46. package/esm/pkg/commands/hincrbyfloat.js +0 -9
  47. package/esm/pkg/commands/hkeys.js +0 -9
  48. package/esm/pkg/commands/hlen.js +0 -9
  49. package/esm/pkg/commands/hmget.js +0 -35
  50. package/esm/pkg/commands/hmset.js +0 -13
  51. package/esm/pkg/commands/hscan.js +0 -16
  52. package/esm/pkg/commands/hset.js +0 -13
  53. package/esm/pkg/commands/hsetnx.js +0 -9
  54. package/esm/pkg/commands/hstrlen.js +0 -9
  55. package/esm/pkg/commands/hvals.js +0 -9
  56. package/esm/pkg/commands/incr.js +0 -9
  57. package/esm/pkg/commands/incrby.js +0 -9
  58. package/esm/pkg/commands/incrbyfloat.js +0 -9
  59. package/esm/pkg/commands/keys.js +0 -9
  60. package/esm/pkg/commands/lindex.js +0 -6
  61. package/esm/pkg/commands/linsert.js +0 -6
  62. package/esm/pkg/commands/llen.js +0 -9
  63. package/esm/pkg/commands/lpop.js +0 -9
  64. package/esm/pkg/commands/lpos.js +0 -19
  65. package/esm/pkg/commands/lpush.js +0 -9
  66. package/esm/pkg/commands/lpushx.js +0 -9
  67. package/esm/pkg/commands/lrange.js +0 -6
  68. package/esm/pkg/commands/lrem.js +0 -6
  69. package/esm/pkg/commands/lset.js +0 -6
  70. package/esm/pkg/commands/ltrim.js +0 -6
  71. package/esm/pkg/commands/mget.js +0 -9
  72. package/esm/pkg/commands/mod.js +0 -115
  73. package/esm/pkg/commands/mset.js +0 -12
  74. package/esm/pkg/commands/msetnx.js +0 -9
  75. package/esm/pkg/commands/persist.js +0 -9
  76. package/esm/pkg/commands/pexpire.js +0 -9
  77. package/esm/pkg/commands/pexpireat.js +0 -9
  78. package/esm/pkg/commands/ping.js +0 -13
  79. package/esm/pkg/commands/psetex.js +0 -9
  80. package/esm/pkg/commands/pttl.js +0 -9
  81. package/esm/pkg/commands/publish.js +0 -9
  82. package/esm/pkg/commands/randomkey.js +0 -9
  83. package/esm/pkg/commands/rename.js +0 -9
  84. package/esm/pkg/commands/renamenx.js +0 -9
  85. package/esm/pkg/commands/rpop.js +0 -9
  86. package/esm/pkg/commands/rpush.js +0 -9
  87. package/esm/pkg/commands/rpushx.js +0 -9
  88. package/esm/pkg/commands/sadd.js +0 -9
  89. package/esm/pkg/commands/scan.js +0 -16
  90. package/esm/pkg/commands/scard.js +0 -9
  91. package/esm/pkg/commands/script_exists.js +0 -12
  92. package/esm/pkg/commands/script_flush.js +0 -16
  93. package/esm/pkg/commands/script_load.js +0 -9
  94. package/esm/pkg/commands/sdiff.js +0 -9
  95. package/esm/pkg/commands/sdiffstore.js +0 -9
  96. package/esm/pkg/commands/set.js +0 -24
  97. package/esm/pkg/commands/setbit.js +0 -9
  98. package/esm/pkg/commands/setex.js +0 -9
  99. package/esm/pkg/commands/setnx.js +0 -9
  100. package/esm/pkg/commands/setrange.js +0 -9
  101. package/esm/pkg/commands/sinter.js +0 -9
  102. package/esm/pkg/commands/sinterstore.js +0 -9
  103. package/esm/pkg/commands/sismember.js +0 -9
  104. package/esm/pkg/commands/smembers.js +0 -9
  105. package/esm/pkg/commands/smove.js +0 -9
  106. package/esm/pkg/commands/spop.js +0 -13
  107. package/esm/pkg/commands/srandmember.js +0 -13
  108. package/esm/pkg/commands/srem.js +0 -9
  109. package/esm/pkg/commands/sscan.js +0 -16
  110. package/esm/pkg/commands/strlen.js +0 -9
  111. package/esm/pkg/commands/sunion.js +0 -9
  112. package/esm/pkg/commands/sunionstore.js +0 -9
  113. package/esm/pkg/commands/time.js +0 -9
  114. package/esm/pkg/commands/touch.js +0 -9
  115. package/esm/pkg/commands/ttl.js +0 -9
  116. package/esm/pkg/commands/type.js +0 -9
  117. package/esm/pkg/commands/unlink.js +0 -9
  118. package/esm/pkg/commands/zadd.js +0 -26
  119. package/esm/pkg/commands/zcard.js +0 -9
  120. package/esm/pkg/commands/zcount.js +0 -9
  121. package/esm/pkg/commands/zincrby.js +0 -9
  122. package/esm/pkg/commands/zinterstore.js +0 -27
  123. package/esm/pkg/commands/zlexcount.js +0 -9
  124. package/esm/pkg/commands/zpopmax.js +0 -13
  125. package/esm/pkg/commands/zpopmin.js +0 -13
  126. package/esm/pkg/commands/zrange.js +0 -26
  127. package/esm/pkg/commands/zrank.js +0 -9
  128. package/esm/pkg/commands/zrem.js +0 -9
  129. package/esm/pkg/commands/zremrangebylex.js +0 -9
  130. package/esm/pkg/commands/zremrangebyrank.js +0 -9
  131. package/esm/pkg/commands/zremrangebyscore.js +0 -9
  132. package/esm/pkg/commands/zrevrank.js +0 -9
  133. package/esm/pkg/commands/zscan.js +0 -16
  134. package/esm/pkg/commands/zscore.js +0 -9
  135. package/esm/pkg/commands/zunionstore.js +0 -27
  136. package/esm/pkg/error.js +0 -9
  137. package/esm/pkg/http.js +0 -77
  138. package/esm/pkg/pipeline.js +0 -1134
  139. package/esm/pkg/redis.js +0 -1088
  140. package/esm/pkg/types.js +0 -1
  141. package/esm/pkg/util.js +0 -31
  142. package/esm/platforms/cloudflare.js +0 -62
  143. package/esm/platforms/fastly.js +0 -40
  144. package/esm/platforms/node_with_fetch.js +0 -60
  145. package/esm/platforms/nodejs.js +0 -59
  146. package/script/package.json +0 -3
  147. package/script/pkg/commands/append.js +0 -13
  148. package/script/pkg/commands/bitcount.js +0 -20
  149. package/script/pkg/commands/bitop.js +0 -13
  150. package/script/pkg/commands/bitpos.js +0 -13
  151. package/script/pkg/commands/command.js +0 -61
  152. package/script/pkg/commands/dbsize.js +0 -13
  153. package/script/pkg/commands/decr.js +0 -13
  154. package/script/pkg/commands/decrby.js +0 -13
  155. package/script/pkg/commands/del.js +0 -13
  156. package/script/pkg/commands/echo.js +0 -13
  157. package/script/pkg/commands/eval.js +0 -13
  158. package/script/pkg/commands/evalsha.js +0 -13
  159. package/script/pkg/commands/exists.js +0 -13
  160. package/script/pkg/commands/expire.js +0 -13
  161. package/script/pkg/commands/expireat.js +0 -13
  162. package/script/pkg/commands/flushall.js +0 -17
  163. package/script/pkg/commands/flushdb.js +0 -17
  164. package/script/pkg/commands/get.js +0 -13
  165. package/script/pkg/commands/getbit.js +0 -13
  166. package/script/pkg/commands/getrange.js +0 -13
  167. package/script/pkg/commands/getset.js +0 -13
  168. package/script/pkg/commands/hdel.js +0 -13
  169. package/script/pkg/commands/hexists.js +0 -13
  170. package/script/pkg/commands/hget.js +0 -13
  171. package/script/pkg/commands/hgetall.js +0 -37
  172. package/script/pkg/commands/hincrby.js +0 -13
  173. package/script/pkg/commands/hincrbyfloat.js +0 -13
  174. package/script/pkg/commands/hkeys.js +0 -13
  175. package/script/pkg/commands/hlen.js +0 -13
  176. package/script/pkg/commands/hmget.js +0 -39
  177. package/script/pkg/commands/hmset.js +0 -17
  178. package/script/pkg/commands/hscan.js +0 -20
  179. package/script/pkg/commands/hset.js +0 -17
  180. package/script/pkg/commands/hsetnx.js +0 -13
  181. package/script/pkg/commands/hstrlen.js +0 -13
  182. package/script/pkg/commands/hvals.js +0 -13
  183. package/script/pkg/commands/incr.js +0 -13
  184. package/script/pkg/commands/incrby.js +0 -13
  185. package/script/pkg/commands/incrbyfloat.js +0 -13
  186. package/script/pkg/commands/keys.js +0 -13
  187. package/script/pkg/commands/lindex.js +0 -10
  188. package/script/pkg/commands/linsert.js +0 -10
  189. package/script/pkg/commands/llen.js +0 -13
  190. package/script/pkg/commands/lpop.js +0 -13
  191. package/script/pkg/commands/lpos.js +0 -23
  192. package/script/pkg/commands/lpush.js +0 -13
  193. package/script/pkg/commands/lpushx.js +0 -13
  194. package/script/pkg/commands/lrange.js +0 -10
  195. package/script/pkg/commands/lrem.js +0 -10
  196. package/script/pkg/commands/lset.js +0 -10
  197. package/script/pkg/commands/ltrim.js +0 -10
  198. package/script/pkg/commands/mget.js +0 -13
  199. package/script/pkg/commands/mod.js +0 -131
  200. package/script/pkg/commands/mset.js +0 -16
  201. package/script/pkg/commands/msetnx.js +0 -13
  202. package/script/pkg/commands/persist.js +0 -13
  203. package/script/pkg/commands/pexpire.js +0 -13
  204. package/script/pkg/commands/pexpireat.js +0 -13
  205. package/script/pkg/commands/ping.js +0 -17
  206. package/script/pkg/commands/psetex.js +0 -13
  207. package/script/pkg/commands/pttl.js +0 -13
  208. package/script/pkg/commands/publish.js +0 -13
  209. package/script/pkg/commands/randomkey.js +0 -13
  210. package/script/pkg/commands/rename.js +0 -13
  211. package/script/pkg/commands/renamenx.js +0 -13
  212. package/script/pkg/commands/rpop.js +0 -13
  213. package/script/pkg/commands/rpush.js +0 -13
  214. package/script/pkg/commands/rpushx.js +0 -13
  215. package/script/pkg/commands/sadd.js +0 -13
  216. package/script/pkg/commands/scan.js +0 -20
  217. package/script/pkg/commands/scard.js +0 -13
  218. package/script/pkg/commands/script_exists.js +0 -16
  219. package/script/pkg/commands/script_flush.js +0 -20
  220. package/script/pkg/commands/script_load.js +0 -13
  221. package/script/pkg/commands/sdiff.js +0 -13
  222. package/script/pkg/commands/sdiffstore.js +0 -13
  223. package/script/pkg/commands/set.js +0 -28
  224. package/script/pkg/commands/setbit.js +0 -13
  225. package/script/pkg/commands/setex.js +0 -13
  226. package/script/pkg/commands/setnx.js +0 -13
  227. package/script/pkg/commands/setrange.js +0 -13
  228. package/script/pkg/commands/sinter.js +0 -13
  229. package/script/pkg/commands/sinterstore.js +0 -13
  230. package/script/pkg/commands/sismember.js +0 -13
  231. package/script/pkg/commands/smembers.js +0 -13
  232. package/script/pkg/commands/smove.js +0 -13
  233. package/script/pkg/commands/spop.js +0 -17
  234. package/script/pkg/commands/srandmember.js +0 -17
  235. package/script/pkg/commands/srem.js +0 -13
  236. package/script/pkg/commands/sscan.js +0 -20
  237. package/script/pkg/commands/strlen.js +0 -13
  238. package/script/pkg/commands/sunion.js +0 -13
  239. package/script/pkg/commands/sunionstore.js +0 -13
  240. package/script/pkg/commands/time.js +0 -13
  241. package/script/pkg/commands/touch.js +0 -13
  242. package/script/pkg/commands/ttl.js +0 -13
  243. package/script/pkg/commands/type.js +0 -13
  244. package/script/pkg/commands/unlink.js +0 -13
  245. package/script/pkg/commands/zadd.js +0 -30
  246. package/script/pkg/commands/zcard.js +0 -13
  247. package/script/pkg/commands/zcount.js +0 -13
  248. package/script/pkg/commands/zincrby.js +0 -13
  249. package/script/pkg/commands/zinterstore.js +0 -31
  250. package/script/pkg/commands/zlexcount.js +0 -13
  251. package/script/pkg/commands/zpopmax.js +0 -17
  252. package/script/pkg/commands/zpopmin.js +0 -17
  253. package/script/pkg/commands/zrange.js +0 -30
  254. package/script/pkg/commands/zrank.js +0 -13
  255. package/script/pkg/commands/zrem.js +0 -13
  256. package/script/pkg/commands/zremrangebylex.js +0 -13
  257. package/script/pkg/commands/zremrangebyrank.js +0 -13
  258. package/script/pkg/commands/zremrangebyscore.js +0 -13
  259. package/script/pkg/commands/zrevrank.js +0 -13
  260. package/script/pkg/commands/zscan.js +0 -20
  261. package/script/pkg/commands/zscore.js +0 -13
  262. package/script/pkg/commands/zunionstore.js +0 -31
  263. package/script/pkg/error.js +0 -13
  264. package/script/pkg/http.js +0 -81
  265. package/script/pkg/pipeline.js +0 -1138
  266. package/script/pkg/redis.js +0 -1092
  267. package/script/pkg/types.js +0 -2
  268. package/script/pkg/util.js +0 -35
  269. package/script/platforms/cloudflare.js +0 -89
  270. package/script/platforms/fastly.js +0 -67
  271. package/script/platforms/node_with_fetch.js +0 -87
  272. package/script/platforms/nodejs.js +0 -86
  273. package/types/pkg/commands/append.d.ts +0 -7
  274. package/types/pkg/commands/bitcount.d.ts +0 -8
  275. package/types/pkg/commands/bitop.d.ts +0 -12
  276. package/types/pkg/commands/bitpos.d.ts +0 -7
  277. package/types/pkg/commands/command.d.ts +0 -37
  278. package/types/pkg/commands/dbsize.d.ts +0 -7
  279. package/types/pkg/commands/decr.d.ts +0 -7
  280. package/types/pkg/commands/decrby.d.ts +0 -7
  281. package/types/pkg/commands/del.d.ts +0 -7
  282. package/types/pkg/commands/echo.d.ts +0 -7
  283. package/types/pkg/commands/eval.d.ts +0 -7
  284. package/types/pkg/commands/evalsha.d.ts +0 -7
  285. package/types/pkg/commands/exists.d.ts +0 -7
  286. package/types/pkg/commands/expire.d.ts +0 -7
  287. package/types/pkg/commands/expireat.d.ts +0 -7
  288. package/types/pkg/commands/flushall.d.ts +0 -9
  289. package/types/pkg/commands/flushdb.d.ts +0 -9
  290. package/types/pkg/commands/get.d.ts +0 -7
  291. package/types/pkg/commands/getbit.d.ts +0 -7
  292. package/types/pkg/commands/getrange.d.ts +0 -7
  293. package/types/pkg/commands/getset.d.ts +0 -7
  294. package/types/pkg/commands/hdel.d.ts +0 -7
  295. package/types/pkg/commands/hexists.d.ts +0 -7
  296. package/types/pkg/commands/hget.d.ts +0 -7
  297. package/types/pkg/commands/hgetall.d.ts +0 -7
  298. package/types/pkg/commands/hincrby.d.ts +0 -7
  299. package/types/pkg/commands/hincrbyfloat.d.ts +0 -7
  300. package/types/pkg/commands/hkeys.d.ts +0 -7
  301. package/types/pkg/commands/hlen.d.ts +0 -7
  302. package/types/pkg/commands/hmget.d.ts +0 -15
  303. package/types/pkg/commands/hmset.d.ts +0 -9
  304. package/types/pkg/commands/hscan.d.ts +0 -24
  305. package/types/pkg/commands/hset.d.ts +0 -9
  306. package/types/pkg/commands/hsetnx.d.ts +0 -7
  307. package/types/pkg/commands/hstrlen.d.ts +0 -7
  308. package/types/pkg/commands/hvals.d.ts +0 -7
  309. package/types/pkg/commands/incr.d.ts +0 -7
  310. package/types/pkg/commands/incrby.d.ts +0 -7
  311. package/types/pkg/commands/incrbyfloat.d.ts +0 -7
  312. package/types/pkg/commands/keys.d.ts +0 -7
  313. package/types/pkg/commands/lindex.d.ts +0 -4
  314. package/types/pkg/commands/linsert.d.ts +0 -9
  315. package/types/pkg/commands/llen.d.ts +0 -7
  316. package/types/pkg/commands/lpop.d.ts +0 -7
  317. package/types/pkg/commands/lpos.d.ts +0 -15
  318. package/types/pkg/commands/lpush.d.ts +0 -7
  319. package/types/pkg/commands/lpushx.d.ts +0 -7
  320. package/types/pkg/commands/lrange.d.ts +0 -4
  321. package/types/pkg/commands/lrem.d.ts +0 -4
  322. package/types/pkg/commands/lset.d.ts +0 -4
  323. package/types/pkg/commands/ltrim.d.ts +0 -4
  324. package/types/pkg/commands/mget.d.ts +0 -7
  325. package/types/pkg/commands/mod.d.ts +0 -115
  326. package/types/pkg/commands/mset.d.ts +0 -9
  327. package/types/pkg/commands/msetnx.d.ts +0 -9
  328. package/types/pkg/commands/persist.d.ts +0 -7
  329. package/types/pkg/commands/pexpire.d.ts +0 -7
  330. package/types/pkg/commands/pexpireat.d.ts +0 -7
  331. package/types/pkg/commands/ping.d.ts +0 -7
  332. package/types/pkg/commands/psetex.d.ts +0 -7
  333. package/types/pkg/commands/pttl.d.ts +0 -7
  334. package/types/pkg/commands/publish.d.ts +0 -7
  335. package/types/pkg/commands/randomkey.d.ts +0 -7
  336. package/types/pkg/commands/rename.d.ts +0 -7
  337. package/types/pkg/commands/renamenx.d.ts +0 -7
  338. package/types/pkg/commands/rpop.d.ts +0 -7
  339. package/types/pkg/commands/rpush.d.ts +0 -7
  340. package/types/pkg/commands/rpushx.d.ts +0 -7
  341. package/types/pkg/commands/sadd.d.ts +0 -7
  342. package/types/pkg/commands/scan.d.ts +0 -17
  343. package/types/pkg/commands/scard.d.ts +0 -7
  344. package/types/pkg/commands/script_exists.d.ts +0 -7
  345. package/types/pkg/commands/script_flush.d.ts +0 -14
  346. package/types/pkg/commands/script_load.d.ts +0 -7
  347. package/types/pkg/commands/sdiff.d.ts +0 -7
  348. package/types/pkg/commands/sdiffstore.d.ts +0 -7
  349. package/types/pkg/commands/set.d.ts +0 -26
  350. package/types/pkg/commands/setbit.d.ts +0 -7
  351. package/types/pkg/commands/setex.d.ts +0 -7
  352. package/types/pkg/commands/setnx.d.ts +0 -7
  353. package/types/pkg/commands/setrange.d.ts +0 -7
  354. package/types/pkg/commands/sinter.d.ts +0 -7
  355. package/types/pkg/commands/sinterstore.d.ts +0 -7
  356. package/types/pkg/commands/sismember.d.ts +0 -7
  357. package/types/pkg/commands/smembers.d.ts +0 -7
  358. package/types/pkg/commands/smove.d.ts +0 -7
  359. package/types/pkg/commands/spop.d.ts +0 -7
  360. package/types/pkg/commands/srandmember.d.ts +0 -7
  361. package/types/pkg/commands/srem.d.ts +0 -7
  362. package/types/pkg/commands/sscan.d.ts +0 -24
  363. package/types/pkg/commands/strlen.d.ts +0 -7
  364. package/types/pkg/commands/sunion.d.ts +0 -7
  365. package/types/pkg/commands/sunionstore.d.ts +0 -7
  366. package/types/pkg/commands/time.d.ts +0 -7
  367. package/types/pkg/commands/touch.d.ts +0 -7
  368. package/types/pkg/commands/ttl.d.ts +0 -7
  369. package/types/pkg/commands/type.d.ts +0 -8
  370. package/types/pkg/commands/unlink.d.ts +0 -7
  371. package/types/pkg/commands/zadd.d.ts +0 -35
  372. package/types/pkg/commands/zcard.d.ts +0 -7
  373. package/types/pkg/commands/zcount.d.ts +0 -7
  374. package/types/pkg/commands/zincrby.d.ts +0 -7
  375. package/types/pkg/commands/zinterstore.d.ts +0 -30
  376. package/types/pkg/commands/zlexcount.d.ts +0 -7
  377. package/types/pkg/commands/zpopmax.d.ts +0 -7
  378. package/types/pkg/commands/zpopmin.d.ts +0 -7
  379. package/types/pkg/commands/zrange.d.ts +0 -42
  380. package/types/pkg/commands/zrank.d.ts +0 -7
  381. package/types/pkg/commands/zrem.d.ts +0 -7
  382. package/types/pkg/commands/zremrangebylex.d.ts +0 -7
  383. package/types/pkg/commands/zremrangebyrank.d.ts +0 -7
  384. package/types/pkg/commands/zremrangebyscore.d.ts +0 -7
  385. package/types/pkg/commands/zrevrank.d.ts +0 -7
  386. package/types/pkg/commands/zscan.d.ts +0 -24
  387. package/types/pkg/commands/zscore.d.ts +0 -7
  388. package/types/pkg/commands/zunionstore.d.ts +0 -30
  389. package/types/pkg/error.d.ts +0 -6
  390. package/types/pkg/http.d.ts +0 -54
  391. package/types/pkg/pipeline.d.ts +0 -548
  392. package/types/pkg/redis.d.ts +0 -528
  393. package/types/pkg/types.d.ts +0 -1
  394. package/types/pkg/util.d.ts +0 -1
  395. package/types/platforms/cloudflare.d.ts +0 -42
  396. package/types/platforms/fastly.d.ts +0 -45
  397. package/types/platforms/node_with_fetch.d.ts +0 -82
  398. package/types/platforms/nodejs.d.ts +0 -81
@@ -0,0 +1,4439 @@
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
+ var EXCLUDE_COMMANDS = /* @__PURE__ */ new Set([
3180
+ "scan",
3181
+ "keys",
3182
+ "flushdb",
3183
+ "flushall",
3184
+ "dbsize",
3185
+ "hscan",
3186
+ "hgetall",
3187
+ "hkeys",
3188
+ "lrange",
3189
+ "sscan",
3190
+ "smembers",
3191
+ "xrange",
3192
+ "xrevrange",
3193
+ "zscan",
3194
+ "zrange"
3195
+ ]);
3196
+ function createAutoPipelineProxy(_redis, json) {
3197
+ const redis = _redis;
3198
+ if (!redis.autoPipelineExecutor) {
3199
+ redis.autoPipelineExecutor = new AutoPipelineExecutor(redis);
3200
+ }
3201
+ return new Proxy(redis, {
3202
+ get: (redis2, command) => {
3203
+ if (command === "pipelineCounter") {
3204
+ return redis2.autoPipelineExecutor.pipelineCounter;
3205
+ }
3206
+ if (command === "json") {
3207
+ return createAutoPipelineProxy(redis2, true);
3208
+ }
3209
+ const commandInRedisButNotPipeline = command in redis2 && !(command in redis2.autoPipelineExecutor.pipeline);
3210
+ const isCommandExcluded = EXCLUDE_COMMANDS.has(command);
3211
+ if (commandInRedisButNotPipeline || isCommandExcluded) {
3212
+ return redis2[command];
3213
+ }
3214
+ const isFunction = json ? typeof redis2.autoPipelineExecutor.pipeline.json[command] === "function" : typeof redis2.autoPipelineExecutor.pipeline[command] === "function";
3215
+ if (isFunction) {
3216
+ return (...args) => {
3217
+ return redis2.autoPipelineExecutor.withAutoPipeline((pipeline) => {
3218
+ if (json) {
3219
+ pipeline.json[command](
3220
+ ...args
3221
+ );
3222
+ } else {
3223
+ pipeline[command](...args);
3224
+ }
3225
+ });
3226
+ };
3227
+ }
3228
+ return redis2.autoPipelineExecutor.pipeline[command];
3229
+ }
3230
+ });
3231
+ }
3232
+ var AutoPipelineExecutor = class {
3233
+ pipelinePromises = /* @__PURE__ */ new WeakMap();
3234
+ activePipeline = null;
3235
+ indexInCurrentPipeline = 0;
3236
+ redis;
3237
+ pipeline;
3238
+ // only to make sure that proxy can work
3239
+ pipelineCounter = 0;
3240
+ // to keep track of how many times a pipeline was executed
3241
+ constructor(redis) {
3242
+ this.redis = redis;
3243
+ this.pipeline = redis.pipeline();
3244
+ }
3245
+ async withAutoPipeline(executeWithPipeline) {
3246
+ const pipeline = this.activePipeline ?? this.redis.pipeline();
3247
+ if (!this.activePipeline) {
3248
+ this.activePipeline = pipeline;
3249
+ this.indexInCurrentPipeline = 0;
3250
+ }
3251
+ const index = this.indexInCurrentPipeline++;
3252
+ executeWithPipeline(pipeline);
3253
+ const pipelineDone = this.deferExecution().then(() => {
3254
+ if (!this.pipelinePromises.has(pipeline)) {
3255
+ const pipelinePromise = pipeline.exec({ keepErrors: true });
3256
+ this.pipelineCounter += 1;
3257
+ this.pipelinePromises.set(pipeline, pipelinePromise);
3258
+ this.activePipeline = null;
3259
+ }
3260
+ return this.pipelinePromises.get(pipeline);
3261
+ });
3262
+ const results = await pipelineDone;
3263
+ const commandResult = results[index];
3264
+ if (commandResult.error) {
3265
+ throw new UpstashError(`Command failed: ${commandResult.error}`);
3266
+ }
3267
+ return commandResult.result;
3268
+ }
3269
+ async deferExecution() {
3270
+ await Promise.resolve();
3271
+ await Promise.resolve();
3272
+ }
3273
+ };
3274
+
3275
+ // pkg/commands/psubscribe.ts
3276
+ var PSubscribeCommand = class extends Command {
3277
+ constructor(cmd, opts) {
3278
+ const sseHeaders = {
3279
+ Accept: "text/event-stream",
3280
+ "Cache-Control": "no-cache",
3281
+ Connection: "keep-alive"
3282
+ };
3283
+ super([], {
3284
+ ...opts,
3285
+ headers: sseHeaders,
3286
+ path: ["psubscribe", ...cmd],
3287
+ streamOptions: {
3288
+ isStreaming: true,
3289
+ onMessage: opts?.streamOptions?.onMessage,
3290
+ signal: opts?.streamOptions?.signal
3291
+ }
3292
+ });
3293
+ }
3294
+ };
3295
+
3296
+ // pkg/commands/subscribe.ts
3297
+ var Subscriber = class extends EventTarget {
3298
+ subscriptions;
3299
+ client;
3300
+ listeners;
3301
+ constructor(client, channels, isPattern = false) {
3302
+ super();
3303
+ this.client = client;
3304
+ this.subscriptions = /* @__PURE__ */ new Map();
3305
+ this.listeners = /* @__PURE__ */ new Map();
3306
+ for (const channel of channels) {
3307
+ if (isPattern) {
3308
+ this.subscribeToPattern(channel);
3309
+ } else {
3310
+ this.subscribeToChannel(channel);
3311
+ }
3312
+ }
3313
+ }
3314
+ subscribeToChannel(channel) {
3315
+ const controller = new AbortController();
3316
+ const command = new SubscribeCommand([channel], {
3317
+ streamOptions: {
3318
+ signal: controller.signal,
3319
+ onMessage: (data) => this.handleMessage(data, false)
3320
+ }
3321
+ });
3322
+ command.exec(this.client).catch((error) => {
3323
+ if (error.name !== "AbortError") {
3324
+ this.dispatchToListeners("error", error);
3325
+ }
3326
+ });
3327
+ this.subscriptions.set(channel, {
3328
+ command,
3329
+ controller,
3330
+ isPattern: false
3331
+ });
3332
+ }
3333
+ subscribeToPattern(pattern) {
3334
+ const controller = new AbortController();
3335
+ const command = new PSubscribeCommand([pattern], {
3336
+ streamOptions: {
3337
+ signal: controller.signal,
3338
+ onMessage: (data) => this.handleMessage(data, true)
3339
+ }
3340
+ });
3341
+ command.exec(this.client).catch((error) => {
3342
+ if (error.name !== "AbortError") {
3343
+ this.dispatchToListeners("error", error);
3344
+ }
3345
+ });
3346
+ this.subscriptions.set(pattern, {
3347
+ command,
3348
+ controller,
3349
+ isPattern: true
3350
+ });
3351
+ }
3352
+ handleMessage(data, isPattern) {
3353
+ const messageData = data.replace(/^data:\s*/, "");
3354
+ const firstCommaIndex = messageData.indexOf(",");
3355
+ const secondCommaIndex = messageData.indexOf(",", firstCommaIndex + 1);
3356
+ const thirdCommaIndex = isPattern ? messageData.indexOf(",", secondCommaIndex + 1) : -1;
3357
+ if (firstCommaIndex !== -1 && secondCommaIndex !== -1) {
3358
+ const type = messageData.slice(0, firstCommaIndex);
3359
+ if (isPattern && type === "pmessage" && thirdCommaIndex !== -1) {
3360
+ const pattern = messageData.slice(firstCommaIndex + 1, secondCommaIndex);
3361
+ const channel = messageData.slice(secondCommaIndex + 1, thirdCommaIndex);
3362
+ const messageStr = messageData.slice(thirdCommaIndex + 1);
3363
+ try {
3364
+ const message = JSON.parse(messageStr);
3365
+ this.dispatchToListeners("pmessage", { pattern, channel, message });
3366
+ this.dispatchToListeners(`pmessage:${pattern}`, { pattern, channel, message });
3367
+ } catch (error) {
3368
+ this.dispatchToListeners("error", new Error(`Failed to parse message: ${error}`));
3369
+ }
3370
+ } else {
3371
+ const channel = messageData.slice(firstCommaIndex + 1, secondCommaIndex);
3372
+ const messageStr = messageData.slice(secondCommaIndex + 1);
3373
+ try {
3374
+ if (type === "subscribe" || type === "psubscribe" || type === "unsubscribe" || type === "punsubscribe") {
3375
+ const count = Number.parseInt(messageStr);
3376
+ this.dispatchToListeners(type, count);
3377
+ } else {
3378
+ const message = JSON.parse(messageStr);
3379
+ this.dispatchToListeners(type, { channel, message });
3380
+ this.dispatchToListeners(`${type}:${channel}`, { channel, message });
3381
+ }
3382
+ } catch (error) {
3383
+ this.dispatchToListeners("error", new Error(`Failed to parse message: ${error}`));
3384
+ }
3385
+ }
3386
+ }
3387
+ }
3388
+ dispatchToListeners(type, data) {
3389
+ const listeners = this.listeners.get(type);
3390
+ if (listeners) {
3391
+ for (const listener of listeners) {
3392
+ listener(data);
3393
+ }
3394
+ }
3395
+ }
3396
+ on(type, listener) {
3397
+ if (!this.listeners.has(type)) {
3398
+ this.listeners.set(type, /* @__PURE__ */ new Set());
3399
+ }
3400
+ this.listeners.get(type)?.add(listener);
3401
+ }
3402
+ removeAllListeners() {
3403
+ this.listeners.clear();
3404
+ }
3405
+ async unsubscribe(channels) {
3406
+ if (channels) {
3407
+ for (const channel of channels) {
3408
+ const subscription = this.subscriptions.get(channel);
3409
+ if (subscription) {
3410
+ try {
3411
+ subscription.controller.abort();
3412
+ } catch {
3413
+ }
3414
+ this.subscriptions.delete(channel);
3415
+ }
3416
+ }
3417
+ } else {
3418
+ for (const subscription of this.subscriptions.values()) {
3419
+ try {
3420
+ subscription.controller.abort();
3421
+ } catch {
3422
+ }
3423
+ }
3424
+ this.subscriptions.clear();
3425
+ this.removeAllListeners();
3426
+ }
3427
+ }
3428
+ getSubscribedChannels() {
3429
+ return [...this.subscriptions.keys()];
3430
+ }
3431
+ };
3432
+ var SubscribeCommand = class extends Command {
3433
+ constructor(cmd, opts) {
3434
+ const sseHeaders = {
3435
+ Accept: "text/event-stream",
3436
+ "Cache-Control": "no-cache",
3437
+ Connection: "keep-alive"
3438
+ };
3439
+ super([], {
3440
+ ...opts,
3441
+ headers: sseHeaders,
3442
+ path: ["subscribe", ...cmd],
3443
+ streamOptions: {
3444
+ isStreaming: true,
3445
+ onMessage: opts?.streamOptions?.onMessage,
3446
+ signal: opts?.streamOptions?.signal
3447
+ }
3448
+ });
3449
+ }
3450
+ };
3451
+
3452
+ // pkg/script.ts
3453
+ import Hex from "crypto-js/enc-hex.js";
3454
+ import sha1 from "crypto-js/sha1.js";
3455
+ var Script = class {
3456
+ script;
3457
+ sha1;
3458
+ redis;
3459
+ constructor(redis, script) {
3460
+ this.redis = redis;
3461
+ this.sha1 = this.digest(script);
3462
+ this.script = script;
3463
+ }
3464
+ /**
3465
+ * Send an `EVAL` command to redis.
3466
+ */
3467
+ async eval(keys, args) {
3468
+ return await this.redis.eval(this.script, keys, args);
3469
+ }
3470
+ /**
3471
+ * Calculates the sha1 hash of the script and then calls `EVALSHA`.
3472
+ */
3473
+ async evalsha(keys, args) {
3474
+ return await this.redis.evalsha(this.sha1, keys, args);
3475
+ }
3476
+ /**
3477
+ * Optimistically try to run `EVALSHA` first.
3478
+ * If the script is not loaded in redis, it will fall back and try again with `EVAL`.
3479
+ *
3480
+ * Following calls will be able to use the cached script
3481
+ */
3482
+ async exec(keys, args) {
3483
+ const res = await this.redis.evalsha(this.sha1, keys, args).catch(async (error) => {
3484
+ if (error instanceof Error && error.message.toLowerCase().includes("noscript")) {
3485
+ return await this.redis.eval(this.script, keys, args);
3486
+ }
3487
+ throw error;
3488
+ });
3489
+ return res;
3490
+ }
3491
+ /**
3492
+ * Compute the sha1 hash of the script and return its hex representation.
3493
+ */
3494
+ digest(s) {
3495
+ return Hex.stringify(sha1(s));
3496
+ }
3497
+ };
3498
+
3499
+ // pkg/scriptRo.ts
3500
+ import Hex2 from "crypto-js/enc-hex.js";
3501
+ import sha12 from "crypto-js/sha1.js";
3502
+ var ScriptRO = class {
3503
+ script;
3504
+ sha1;
3505
+ redis;
3506
+ constructor(redis, script) {
3507
+ this.redis = redis;
3508
+ this.sha1 = this.digest(script);
3509
+ this.script = script;
3510
+ }
3511
+ /**
3512
+ * Send an `EVAL_RO` command to redis.
3513
+ */
3514
+ async evalRo(keys, args) {
3515
+ return await this.redis.evalRo(this.script, keys, args);
3516
+ }
3517
+ /**
3518
+ * Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
3519
+ */
3520
+ async evalshaRo(keys, args) {
3521
+ return await this.redis.evalshaRo(this.sha1, keys, args);
3522
+ }
3523
+ /**
3524
+ * Optimistically try to run `EVALSHA_RO` first.
3525
+ * If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
3526
+ *
3527
+ * Following calls will be able to use the cached script
3528
+ */
3529
+ async exec(keys, args) {
3530
+ const res = await this.redis.evalshaRo(this.sha1, keys, args).catch(async (error) => {
3531
+ if (error instanceof Error && error.message.toLowerCase().includes("noscript")) {
3532
+ return await this.redis.evalRo(this.script, keys, args);
3533
+ }
3534
+ throw error;
3535
+ });
3536
+ return res;
3537
+ }
3538
+ /**
3539
+ * Compute the sha1 hash of the script and return its hex representation.
3540
+ */
3541
+ digest(s) {
3542
+ return Hex2.stringify(sha12(s));
3543
+ }
3544
+ };
3545
+
3546
+ // pkg/redis.ts
3547
+ var Redis = class {
3548
+ client;
3549
+ opts;
3550
+ enableTelemetry;
3551
+ enableAutoPipelining;
3552
+ /**
3553
+ * Create a new redis client
3554
+ *
3555
+ * @example
3556
+ * ```typescript
3557
+ * const redis = new Redis({
3558
+ * url: "<UPSTASH_REDIS_REST_URL>",
3559
+ * token: "<UPSTASH_REDIS_REST_TOKEN>",
3560
+ * });
3561
+ * ```
3562
+ */
3563
+ constructor(client, opts) {
3564
+ this.client = client;
3565
+ this.opts = opts;
3566
+ this.enableTelemetry = opts?.enableTelemetry ?? true;
3567
+ if (opts?.readYourWrites === false) {
3568
+ this.client.readYourWrites = false;
3569
+ }
3570
+ this.enableAutoPipelining = opts?.enableAutoPipelining ?? true;
3571
+ }
3572
+ get readYourWritesSyncToken() {
3573
+ return this.client.upstashSyncToken;
3574
+ }
3575
+ set readYourWritesSyncToken(session) {
3576
+ this.client.upstashSyncToken = session;
3577
+ }
3578
+ get json() {
3579
+ return {
3580
+ /**
3581
+ * @see https://redis.io/commands/json.arrappend
3582
+ */
3583
+ arrappend: (...args) => new JsonArrAppendCommand(args, this.opts).exec(this.client),
3584
+ /**
3585
+ * @see https://redis.io/commands/json.arrindex
3586
+ */
3587
+ arrindex: (...args) => new JsonArrIndexCommand(args, this.opts).exec(this.client),
3588
+ /**
3589
+ * @see https://redis.io/commands/json.arrinsert
3590
+ */
3591
+ arrinsert: (...args) => new JsonArrInsertCommand(args, this.opts).exec(this.client),
3592
+ /**
3593
+ * @see https://redis.io/commands/json.arrlen
3594
+ */
3595
+ arrlen: (...args) => new JsonArrLenCommand(args, this.opts).exec(this.client),
3596
+ /**
3597
+ * @see https://redis.io/commands/json.arrpop
3598
+ */
3599
+ arrpop: (...args) => new JsonArrPopCommand(args, this.opts).exec(this.client),
3600
+ /**
3601
+ * @see https://redis.io/commands/json.arrtrim
3602
+ */
3603
+ arrtrim: (...args) => new JsonArrTrimCommand(args, this.opts).exec(this.client),
3604
+ /**
3605
+ * @see https://redis.io/commands/json.clear
3606
+ */
3607
+ clear: (...args) => new JsonClearCommand(args, this.opts).exec(this.client),
3608
+ /**
3609
+ * @see https://redis.io/commands/json.del
3610
+ */
3611
+ del: (...args) => new JsonDelCommand(args, this.opts).exec(this.client),
3612
+ /**
3613
+ * @see https://redis.io/commands/json.forget
3614
+ */
3615
+ forget: (...args) => new JsonForgetCommand(args, this.opts).exec(this.client),
3616
+ /**
3617
+ * @see https://redis.io/commands/json.get
3618
+ */
3619
+ get: (...args) => new JsonGetCommand(args, this.opts).exec(this.client),
3620
+ /**
3621
+ * @see https://redis.io/commands/json.merge
3622
+ */
3623
+ merge: (...args) => new JsonMergeCommand(args, this.opts).exec(this.client),
3624
+ /**
3625
+ * @see https://redis.io/commands/json.mget
3626
+ */
3627
+ mget: (...args) => new JsonMGetCommand(args, this.opts).exec(this.client),
3628
+ /**
3629
+ * @see https://redis.io/commands/json.mset
3630
+ */
3631
+ mset: (...args) => new JsonMSetCommand(args, this.opts).exec(this.client),
3632
+ /**
3633
+ * @see https://redis.io/commands/json.numincrby
3634
+ */
3635
+ numincrby: (...args) => new JsonNumIncrByCommand(args, this.opts).exec(this.client),
3636
+ /**
3637
+ * @see https://redis.io/commands/json.nummultby
3638
+ */
3639
+ nummultby: (...args) => new JsonNumMultByCommand(args, this.opts).exec(this.client),
3640
+ /**
3641
+ * @see https://redis.io/commands/json.objkeys
3642
+ */
3643
+ objkeys: (...args) => new JsonObjKeysCommand(args, this.opts).exec(this.client),
3644
+ /**
3645
+ * @see https://redis.io/commands/json.objlen
3646
+ */
3647
+ objlen: (...args) => new JsonObjLenCommand(args, this.opts).exec(this.client),
3648
+ /**
3649
+ * @see https://redis.io/commands/json.resp
3650
+ */
3651
+ resp: (...args) => new JsonRespCommand(args, this.opts).exec(this.client),
3652
+ /**
3653
+ * @see https://redis.io/commands/json.set
3654
+ */
3655
+ set: (...args) => new JsonSetCommand(args, this.opts).exec(this.client),
3656
+ /**
3657
+ * @see https://redis.io/commands/json.strappend
3658
+ */
3659
+ strappend: (...args) => new JsonStrAppendCommand(args, this.opts).exec(this.client),
3660
+ /**
3661
+ * @see https://redis.io/commands/json.strlen
3662
+ */
3663
+ strlen: (...args) => new JsonStrLenCommand(args, this.opts).exec(this.client),
3664
+ /**
3665
+ * @see https://redis.io/commands/json.toggle
3666
+ */
3667
+ toggle: (...args) => new JsonToggleCommand(args, this.opts).exec(this.client),
3668
+ /**
3669
+ * @see https://redis.io/commands/json.type
3670
+ */
3671
+ type: (...args) => new JsonTypeCommand(args, this.opts).exec(this.client)
3672
+ };
3673
+ }
3674
+ /**
3675
+ * Wrap a new middleware around the HTTP client.
3676
+ */
3677
+ use = (middleware) => {
3678
+ const makeRequest = this.client.request.bind(this.client);
3679
+ this.client.request = (req) => middleware(req, makeRequest);
3680
+ };
3681
+ /**
3682
+ * Technically this is not private, we can hide it from intellisense by doing this
3683
+ */
3684
+ addTelemetry = (telemetry) => {
3685
+ if (!this.enableTelemetry) {
3686
+ return;
3687
+ }
3688
+ try {
3689
+ this.client.mergeTelemetry(telemetry);
3690
+ } catch {
3691
+ }
3692
+ };
3693
+ /**
3694
+ * Creates a new script.
3695
+ *
3696
+ * Scripts offer the ability to optimistically try to execute a script without having to send the
3697
+ * entire script to the server. If the script is loaded on the server, it tries again by sending
3698
+ * the entire script. Afterwards, the script is cached on the server.
3699
+ *
3700
+ * @param script - The script to create
3701
+ * @param opts - Optional options to pass to the script `{ readonly?: boolean }`
3702
+ * @returns A new script
3703
+ *
3704
+ * @example
3705
+ * ```ts
3706
+ * const redis = new Redis({...})
3707
+ *
3708
+ * const script = redis.createScript<string>("return ARGV[1];")
3709
+ * const arg1 = await script.eval([], ["Hello World"])
3710
+ * expect(arg1, "Hello World")
3711
+ * ```
3712
+ * @example
3713
+ * ```ts
3714
+ * const redis = new Redis({...})
3715
+ *
3716
+ * const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
3717
+ * const arg1 = await script.evalRo([], ["Hello World"])
3718
+ * expect(arg1, "Hello World")
3719
+ * ```
3720
+ */
3721
+ createScript(script, opts) {
3722
+ return opts?.readonly ? new ScriptRO(this, script) : new Script(this, script);
3723
+ }
3724
+ /**
3725
+ * Create a new pipeline that allows you to send requests in bulk.
3726
+ *
3727
+ * @see {@link Pipeline}
3728
+ */
3729
+ pipeline = () => new Pipeline({
3730
+ client: this.client,
3731
+ commandOptions: this.opts,
3732
+ multiExec: false
3733
+ });
3734
+ autoPipeline = () => {
3735
+ return createAutoPipelineProxy(this);
3736
+ };
3737
+ /**
3738
+ * Create a new transaction to allow executing multiple steps atomically.
3739
+ *
3740
+ * All the commands in a transaction are serialized and executed sequentially. A request sent by
3741
+ * another client will never be served in the middle of the execution of a Redis Transaction. This
3742
+ * guarantees that the commands are executed as a single isolated operation.
3743
+ *
3744
+ * @see {@link Pipeline}
3745
+ */
3746
+ multi = () => new Pipeline({
3747
+ client: this.client,
3748
+ commandOptions: this.opts,
3749
+ multiExec: true
3750
+ });
3751
+ /**
3752
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
3753
+ *
3754
+ * @example
3755
+ * ```typescript
3756
+ * redis.set("mykey", 0);
3757
+ * const result = await redis.bitfield("mykey")
3758
+ * .set("u4", 0, 16)
3759
+ * .incr("u4", "#1", 1)
3760
+ * .exec();
3761
+ * console.log(result); // [0, 1]
3762
+ * ```
3763
+ *
3764
+ * @see https://redis.io/commands/bitfield
3765
+ */
3766
+ bitfield = (...args) => new BitFieldCommand(args, this.client, this.opts);
3767
+ /**
3768
+ * @see https://redis.io/commands/append
3769
+ */
3770
+ append = (...args) => new AppendCommand(args, this.opts).exec(this.client);
3771
+ /**
3772
+ * @see https://redis.io/commands/bitcount
3773
+ */
3774
+ bitcount = (...args) => new BitCountCommand(args, this.opts).exec(this.client);
3775
+ /**
3776
+ * @see https://redis.io/commands/bitop
3777
+ */
3778
+ bitop = (op, destinationKey, sourceKey, ...sourceKeys) => new BitOpCommand([op, destinationKey, sourceKey, ...sourceKeys], this.opts).exec(
3779
+ this.client
3780
+ );
3781
+ /**
3782
+ * @see https://redis.io/commands/bitpos
3783
+ */
3784
+ bitpos = (...args) => new BitPosCommand(args, this.opts).exec(this.client);
3785
+ /**
3786
+ * @see https://redis.io/commands/copy
3787
+ */
3788
+ copy = (...args) => new CopyCommand(args, this.opts).exec(this.client);
3789
+ /**
3790
+ * @see https://redis.io/commands/dbsize
3791
+ */
3792
+ dbsize = () => new DBSizeCommand(this.opts).exec(this.client);
3793
+ /**
3794
+ * @see https://redis.io/commands/decr
3795
+ */
3796
+ decr = (...args) => new DecrCommand(args, this.opts).exec(this.client);
3797
+ /**
3798
+ * @see https://redis.io/commands/decrby
3799
+ */
3800
+ decrby = (...args) => new DecrByCommand(args, this.opts).exec(this.client);
3801
+ /**
3802
+ * @see https://redis.io/commands/del
3803
+ */
3804
+ del = (...args) => new DelCommand(args, this.opts).exec(this.client);
3805
+ /**
3806
+ * @see https://redis.io/commands/echo
3807
+ */
3808
+ echo = (...args) => new EchoCommand(args, this.opts).exec(this.client);
3809
+ /**
3810
+ * @see https://redis.io/commands/eval_ro
3811
+ */
3812
+ evalRo = (...args) => new EvalROCommand(args, this.opts).exec(this.client);
3813
+ /**
3814
+ * @see https://redis.io/commands/eval
3815
+ */
3816
+ eval = (...args) => new EvalCommand(args, this.opts).exec(this.client);
3817
+ /**
3818
+ * @see https://redis.io/commands/evalsha_ro
3819
+ */
3820
+ evalshaRo = (...args) => new EvalshaROCommand(args, this.opts).exec(this.client);
3821
+ /**
3822
+ * @see https://redis.io/commands/evalsha
3823
+ */
3824
+ evalsha = (...args) => new EvalshaCommand(args, this.opts).exec(this.client);
3825
+ /**
3826
+ * Generic method to execute any Redis command.
3827
+ */
3828
+ exec = (args) => new ExecCommand(args, this.opts).exec(this.client);
3829
+ /**
3830
+ * @see https://redis.io/commands/exists
3831
+ */
3832
+ exists = (...args) => new ExistsCommand(args, this.opts).exec(this.client);
3833
+ /**
3834
+ * @see https://redis.io/commands/expire
3835
+ */
3836
+ expire = (...args) => new ExpireCommand(args, this.opts).exec(this.client);
3837
+ /**
3838
+ * @see https://redis.io/commands/expireat
3839
+ */
3840
+ expireat = (...args) => new ExpireAtCommand(args, this.opts).exec(this.client);
3841
+ /**
3842
+ * @see https://redis.io/commands/flushall
3843
+ */
3844
+ flushall = (args) => new FlushAllCommand(args, this.opts).exec(this.client);
3845
+ /**
3846
+ * @see https://redis.io/commands/flushdb
3847
+ */
3848
+ flushdb = (...args) => new FlushDBCommand(args, this.opts).exec(this.client);
3849
+ /**
3850
+ * @see https://redis.io/commands/geoadd
3851
+ */
3852
+ geoadd = (...args) => new GeoAddCommand(args, this.opts).exec(this.client);
3853
+ /**
3854
+ * @see https://redis.io/commands/geopos
3855
+ */
3856
+ geopos = (...args) => new GeoPosCommand(args, this.opts).exec(this.client);
3857
+ /**
3858
+ * @see https://redis.io/commands/geodist
3859
+ */
3860
+ geodist = (...args) => new GeoDistCommand(args, this.opts).exec(this.client);
3861
+ /**
3862
+ * @see https://redis.io/commands/geohash
3863
+ */
3864
+ geohash = (...args) => new GeoHashCommand(args, this.opts).exec(this.client);
3865
+ /**
3866
+ * @see https://redis.io/commands/geosearch
3867
+ */
3868
+ geosearch = (...args) => new GeoSearchCommand(args, this.opts).exec(this.client);
3869
+ /**
3870
+ * @see https://redis.io/commands/geosearchstore
3871
+ */
3872
+ geosearchstore = (...args) => new GeoSearchStoreCommand(args, this.opts).exec(this.client);
3873
+ /**
3874
+ * @see https://redis.io/commands/get
3875
+ */
3876
+ get = (...args) => new GetCommand(args, this.opts).exec(this.client);
3877
+ /**
3878
+ * @see https://redis.io/commands/getbit
3879
+ */
3880
+ getbit = (...args) => new GetBitCommand(args, this.opts).exec(this.client);
3881
+ /**
3882
+ * @see https://redis.io/commands/getdel
3883
+ */
3884
+ getdel = (...args) => new GetDelCommand(args, this.opts).exec(this.client);
3885
+ /**
3886
+ * @see https://redis.io/commands/getex
3887
+ */
3888
+ getex = (...args) => new GetExCommand(args, this.opts).exec(this.client);
3889
+ /**
3890
+ * @see https://redis.io/commands/getrange
3891
+ */
3892
+ getrange = (...args) => new GetRangeCommand(args, this.opts).exec(this.client);
3893
+ /**
3894
+ * @see https://redis.io/commands/getset
3895
+ */
3896
+ getset = (key, value) => new GetSetCommand([key, value], this.opts).exec(this.client);
3897
+ /**
3898
+ * @see https://redis.io/commands/hdel
3899
+ */
3900
+ hdel = (...args) => new HDelCommand(args, this.opts).exec(this.client);
3901
+ /**
3902
+ * @see https://redis.io/commands/hexists
3903
+ */
3904
+ hexists = (...args) => new HExistsCommand(args, this.opts).exec(this.client);
3905
+ /**
3906
+ * @see https://redis.io/commands/hexpire
3907
+ */
3908
+ hexpire = (...args) => new HExpireCommand(args, this.opts).exec(this.client);
3909
+ /**
3910
+ * @see https://redis.io/commands/hexpireat
3911
+ */
3912
+ hexpireat = (...args) => new HExpireAtCommand(args, this.opts).exec(this.client);
3913
+ /**
3914
+ * @see https://redis.io/commands/hexpiretime
3915
+ */
3916
+ hexpiretime = (...args) => new HExpireTimeCommand(args, this.opts).exec(this.client);
3917
+ /**
3918
+ * @see https://redis.io/commands/httl
3919
+ */
3920
+ httl = (...args) => new HTtlCommand(args, this.opts).exec(this.client);
3921
+ /**
3922
+ * @see https://redis.io/commands/hpexpire
3923
+ */
3924
+ hpexpire = (...args) => new HPExpireCommand(args, this.opts).exec(this.client);
3925
+ /**
3926
+ * @see https://redis.io/commands/hpexpireat
3927
+ */
3928
+ hpexpireat = (...args) => new HPExpireAtCommand(args, this.opts).exec(this.client);
3929
+ /**
3930
+ * @see https://redis.io/commands/hpexpiretime
3931
+ */
3932
+ hpexpiretime = (...args) => new HPExpireTimeCommand(args, this.opts).exec(this.client);
3933
+ /**
3934
+ * @see https://redis.io/commands/hpttl
3935
+ */
3936
+ hpttl = (...args) => new HPTtlCommand(args, this.opts).exec(this.client);
3937
+ /**
3938
+ * @see https://redis.io/commands/hpersist
3939
+ */
3940
+ hpersist = (...args) => new HPersistCommand(args, this.opts).exec(this.client);
3941
+ /**
3942
+ * @see https://redis.io/commands/hget
3943
+ */
3944
+ hget = (...args) => new HGetCommand(args, this.opts).exec(this.client);
3945
+ /**
3946
+ * @see https://redis.io/commands/hgetall
3947
+ */
3948
+ hgetall = (...args) => new HGetAllCommand(args, this.opts).exec(this.client);
3949
+ /**
3950
+ * @see https://redis.io/commands/hincrby
3951
+ */
3952
+ hincrby = (...args) => new HIncrByCommand(args, this.opts).exec(this.client);
3953
+ /**
3954
+ * @see https://redis.io/commands/hincrbyfloat
3955
+ */
3956
+ hincrbyfloat = (...args) => new HIncrByFloatCommand(args, this.opts).exec(this.client);
3957
+ /**
3958
+ * @see https://redis.io/commands/hkeys
3959
+ */
3960
+ hkeys = (...args) => new HKeysCommand(args, this.opts).exec(this.client);
3961
+ /**
3962
+ * @see https://redis.io/commands/hlen
3963
+ */
3964
+ hlen = (...args) => new HLenCommand(args, this.opts).exec(this.client);
3965
+ /**
3966
+ * @see https://redis.io/commands/hmget
3967
+ */
3968
+ hmget = (...args) => new HMGetCommand(args, this.opts).exec(this.client);
3969
+ /**
3970
+ * @see https://redis.io/commands/hmset
3971
+ */
3972
+ hmset = (key, kv) => new HMSetCommand([key, kv], this.opts).exec(this.client);
3973
+ /**
3974
+ * @see https://redis.io/commands/hrandfield
3975
+ */
3976
+ hrandfield = (key, count, withValues) => new HRandFieldCommand([key, count, withValues], this.opts).exec(this.client);
3977
+ /**
3978
+ * @see https://redis.io/commands/hscan
3979
+ */
3980
+ hscan = (...args) => new HScanCommand(args, this.opts).exec(this.client);
3981
+ /**
3982
+ * @see https://redis.io/commands/hset
3983
+ */
3984
+ hset = (key, kv) => new HSetCommand([key, kv], this.opts).exec(this.client);
3985
+ /**
3986
+ * @see https://redis.io/commands/hsetnx
3987
+ */
3988
+ hsetnx = (key, field, value) => new HSetNXCommand([key, field, value], this.opts).exec(this.client);
3989
+ /**
3990
+ * @see https://redis.io/commands/hstrlen
3991
+ */
3992
+ hstrlen = (...args) => new HStrLenCommand(args, this.opts).exec(this.client);
3993
+ /**
3994
+ * @see https://redis.io/commands/hvals
3995
+ */
3996
+ hvals = (...args) => new HValsCommand(args, this.opts).exec(this.client);
3997
+ /**
3998
+ * @see https://redis.io/commands/incr
3999
+ */
4000
+ incr = (...args) => new IncrCommand(args, this.opts).exec(this.client);
4001
+ /**
4002
+ * @see https://redis.io/commands/incrby
4003
+ */
4004
+ incrby = (...args) => new IncrByCommand(args, this.opts).exec(this.client);
4005
+ /**
4006
+ * @see https://redis.io/commands/incrbyfloat
4007
+ */
4008
+ incrbyfloat = (...args) => new IncrByFloatCommand(args, this.opts).exec(this.client);
4009
+ /**
4010
+ * @see https://redis.io/commands/keys
4011
+ */
4012
+ keys = (...args) => new KeysCommand(args, this.opts).exec(this.client);
4013
+ /**
4014
+ * @see https://redis.io/commands/lindex
4015
+ */
4016
+ lindex = (...args) => new LIndexCommand(args, this.opts).exec(this.client);
4017
+ /**
4018
+ * @see https://redis.io/commands/linsert
4019
+ */
4020
+ linsert = (key, direction, pivot, value) => new LInsertCommand([key, direction, pivot, value], this.opts).exec(this.client);
4021
+ /**
4022
+ * @see https://redis.io/commands/llen
4023
+ */
4024
+ llen = (...args) => new LLenCommand(args, this.opts).exec(this.client);
4025
+ /**
4026
+ * @see https://redis.io/commands/lmove
4027
+ */
4028
+ lmove = (...args) => new LMoveCommand(args, this.opts).exec(this.client);
4029
+ /**
4030
+ * @see https://redis.io/commands/lpop
4031
+ */
4032
+ lpop = (...args) => new LPopCommand(args, this.opts).exec(this.client);
4033
+ /**
4034
+ * @see https://redis.io/commands/lmpop
4035
+ */
4036
+ lmpop = (...args) => new LmPopCommand(args, this.opts).exec(this.client);
4037
+ /**
4038
+ * @see https://redis.io/commands/lpos
4039
+ */
4040
+ lpos = (...args) => new LPosCommand(args, this.opts).exec(this.client);
4041
+ /**
4042
+ * @see https://redis.io/commands/lpush
4043
+ */
4044
+ lpush = (key, ...elements) => new LPushCommand([key, ...elements], this.opts).exec(this.client);
4045
+ /**
4046
+ * @see https://redis.io/commands/lpushx
4047
+ */
4048
+ lpushx = (key, ...elements) => new LPushXCommand([key, ...elements], this.opts).exec(this.client);
4049
+ /**
4050
+ * @see https://redis.io/commands/lrange
4051
+ */
4052
+ lrange = (...args) => new LRangeCommand(args, this.opts).exec(this.client);
4053
+ /**
4054
+ * @see https://redis.io/commands/lrem
4055
+ */
4056
+ lrem = (key, count, value) => new LRemCommand([key, count, value], this.opts).exec(this.client);
4057
+ /**
4058
+ * @see https://redis.io/commands/lset
4059
+ */
4060
+ lset = (key, index, value) => new LSetCommand([key, index, value], this.opts).exec(this.client);
4061
+ /**
4062
+ * @see https://redis.io/commands/ltrim
4063
+ */
4064
+ ltrim = (...args) => new LTrimCommand(args, this.opts).exec(this.client);
4065
+ /**
4066
+ * @see https://redis.io/commands/mget
4067
+ */
4068
+ mget = (...args) => new MGetCommand(args, this.opts).exec(this.client);
4069
+ /**
4070
+ * @see https://redis.io/commands/mset
4071
+ */
4072
+ mset = (kv) => new MSetCommand([kv], this.opts).exec(this.client);
4073
+ /**
4074
+ * @see https://redis.io/commands/msetnx
4075
+ */
4076
+ msetnx = (kv) => new MSetNXCommand([kv], this.opts).exec(this.client);
4077
+ /**
4078
+ * @see https://redis.io/commands/persist
4079
+ */
4080
+ persist = (...args) => new PersistCommand(args, this.opts).exec(this.client);
4081
+ /**
4082
+ * @see https://redis.io/commands/pexpire
4083
+ */
4084
+ pexpire = (...args) => new PExpireCommand(args, this.opts).exec(this.client);
4085
+ /**
4086
+ * @see https://redis.io/commands/pexpireat
4087
+ */
4088
+ pexpireat = (...args) => new PExpireAtCommand(args, this.opts).exec(this.client);
4089
+ /**
4090
+ * @see https://redis.io/commands/pfadd
4091
+ */
4092
+ pfadd = (...args) => new PfAddCommand(args, this.opts).exec(this.client);
4093
+ /**
4094
+ * @see https://redis.io/commands/pfcount
4095
+ */
4096
+ pfcount = (...args) => new PfCountCommand(args, this.opts).exec(this.client);
4097
+ /**
4098
+ * @see https://redis.io/commands/pfmerge
4099
+ */
4100
+ pfmerge = (...args) => new PfMergeCommand(args, this.opts).exec(this.client);
4101
+ /**
4102
+ * @see https://redis.io/commands/ping
4103
+ */
4104
+ ping = (args) => new PingCommand(args, this.opts).exec(this.client);
4105
+ /**
4106
+ * @see https://redis.io/commands/psetex
4107
+ */
4108
+ psetex = (key, ttl, value) => new PSetEXCommand([key, ttl, value], this.opts).exec(this.client);
4109
+ /**
4110
+ * @see https://redis.io/commands/psubscribe
4111
+ */
4112
+ psubscribe = (patterns) => {
4113
+ const patternArray = Array.isArray(patterns) ? patterns : [patterns];
4114
+ return new Subscriber(this.client, patternArray, true);
4115
+ };
4116
+ /**
4117
+ * @see https://redis.io/commands/pttl
4118
+ */
4119
+ pttl = (...args) => new PTtlCommand(args, this.opts).exec(this.client);
4120
+ /**
4121
+ * @see https://redis.io/commands/publish
4122
+ */
4123
+ publish = (...args) => new PublishCommand(args, this.opts).exec(this.client);
4124
+ /**
4125
+ * @see https://redis.io/commands/randomkey
4126
+ */
4127
+ randomkey = () => new RandomKeyCommand().exec(this.client);
4128
+ /**
4129
+ * @see https://redis.io/commands/rename
4130
+ */
4131
+ rename = (...args) => new RenameCommand(args, this.opts).exec(this.client);
4132
+ /**
4133
+ * @see https://redis.io/commands/renamenx
4134
+ */
4135
+ renamenx = (...args) => new RenameNXCommand(args, this.opts).exec(this.client);
4136
+ /**
4137
+ * @see https://redis.io/commands/rpop
4138
+ */
4139
+ rpop = (...args) => new RPopCommand(args, this.opts).exec(this.client);
4140
+ /**
4141
+ * @see https://redis.io/commands/rpush
4142
+ */
4143
+ rpush = (key, ...elements) => new RPushCommand([key, ...elements], this.opts).exec(this.client);
4144
+ /**
4145
+ * @see https://redis.io/commands/rpushx
4146
+ */
4147
+ rpushx = (key, ...elements) => new RPushXCommand([key, ...elements], this.opts).exec(this.client);
4148
+ /**
4149
+ * @see https://redis.io/commands/sadd
4150
+ */
4151
+ sadd = (key, member, ...members) => new SAddCommand([key, member, ...members], this.opts).exec(this.client);
4152
+ /**
4153
+ * @see https://redis.io/commands/scan
4154
+ */
4155
+ scan = (...args) => new ScanCommand(args, this.opts).exec(this.client);
4156
+ /**
4157
+ * @see https://redis.io/commands/scard
4158
+ */
4159
+ scard = (...args) => new SCardCommand(args, this.opts).exec(this.client);
4160
+ /**
4161
+ * @see https://redis.io/commands/script-exists
4162
+ */
4163
+ scriptExists = (...args) => new ScriptExistsCommand(args, this.opts).exec(this.client);
4164
+ /**
4165
+ * @see https://redis.io/commands/script-flush
4166
+ */
4167
+ scriptFlush = (...args) => new ScriptFlushCommand(args, this.opts).exec(this.client);
4168
+ /**
4169
+ * @see https://redis.io/commands/script-load
4170
+ */
4171
+ scriptLoad = (...args) => new ScriptLoadCommand(args, this.opts).exec(this.client);
4172
+ /**
4173
+ * @see https://redis.io/commands/sdiff
4174
+ */
4175
+ sdiff = (...args) => new SDiffCommand(args, this.opts).exec(this.client);
4176
+ /**
4177
+ * @see https://redis.io/commands/sdiffstore
4178
+ */
4179
+ sdiffstore = (...args) => new SDiffStoreCommand(args, this.opts).exec(this.client);
4180
+ /**
4181
+ * @see https://redis.io/commands/set
4182
+ */
4183
+ set = (key, value, opts) => new SetCommand([key, value, opts], this.opts).exec(this.client);
4184
+ /**
4185
+ * @see https://redis.io/commands/setbit
4186
+ */
4187
+ setbit = (...args) => new SetBitCommand(args, this.opts).exec(this.client);
4188
+ /**
4189
+ * @see https://redis.io/commands/setex
4190
+ */
4191
+ setex = (key, ttl, value) => new SetExCommand([key, ttl, value], this.opts).exec(this.client);
4192
+ /**
4193
+ * @see https://redis.io/commands/setnx
4194
+ */
4195
+ setnx = (key, value) => new SetNxCommand([key, value], this.opts).exec(this.client);
4196
+ /**
4197
+ * @see https://redis.io/commands/setrange
4198
+ */
4199
+ setrange = (...args) => new SetRangeCommand(args, this.opts).exec(this.client);
4200
+ /**
4201
+ * @see https://redis.io/commands/sinter
4202
+ */
4203
+ sinter = (...args) => new SInterCommand(args, this.opts).exec(this.client);
4204
+ /**
4205
+ * @see https://redis.io/commands/sinterstore
4206
+ */
4207
+ sinterstore = (...args) => new SInterStoreCommand(args, this.opts).exec(this.client);
4208
+ /**
4209
+ * @see https://redis.io/commands/sismember
4210
+ */
4211
+ sismember = (key, member) => new SIsMemberCommand([key, member], this.opts).exec(this.client);
4212
+ /**
4213
+ * @see https://redis.io/commands/smismember
4214
+ */
4215
+ smismember = (key, members) => new SMIsMemberCommand([key, members], this.opts).exec(this.client);
4216
+ /**
4217
+ * @see https://redis.io/commands/smembers
4218
+ */
4219
+ smembers = (...args) => new SMembersCommand(args, this.opts).exec(this.client);
4220
+ /**
4221
+ * @see https://redis.io/commands/smove
4222
+ */
4223
+ smove = (source, destination, member) => new SMoveCommand([source, destination, member], this.opts).exec(this.client);
4224
+ /**
4225
+ * @see https://redis.io/commands/spop
4226
+ */
4227
+ spop = (...args) => new SPopCommand(args, this.opts).exec(this.client);
4228
+ /**
4229
+ * @see https://redis.io/commands/srandmember
4230
+ */
4231
+ srandmember = (...args) => new SRandMemberCommand(args, this.opts).exec(this.client);
4232
+ /**
4233
+ * @see https://redis.io/commands/srem
4234
+ */
4235
+ srem = (key, ...members) => new SRemCommand([key, ...members], this.opts).exec(this.client);
4236
+ /**
4237
+ * @see https://redis.io/commands/sscan
4238
+ */
4239
+ sscan = (...args) => new SScanCommand(args, this.opts).exec(this.client);
4240
+ /**
4241
+ * @see https://redis.io/commands/strlen
4242
+ */
4243
+ strlen = (...args) => new StrLenCommand(args, this.opts).exec(this.client);
4244
+ /**
4245
+ * @see https://redis.io/commands/subscribe
4246
+ */
4247
+ subscribe = (channels) => {
4248
+ const channelArray = Array.isArray(channels) ? channels : [channels];
4249
+ return new Subscriber(this.client, channelArray);
4250
+ };
4251
+ /**
4252
+ * @see https://redis.io/commands/sunion
4253
+ */
4254
+ sunion = (...args) => new SUnionCommand(args, this.opts).exec(this.client);
4255
+ /**
4256
+ * @see https://redis.io/commands/sunionstore
4257
+ */
4258
+ sunionstore = (...args) => new SUnionStoreCommand(args, this.opts).exec(this.client);
4259
+ /**
4260
+ * @see https://redis.io/commands/time
4261
+ */
4262
+ time = () => new TimeCommand().exec(this.client);
4263
+ /**
4264
+ * @see https://redis.io/commands/touch
4265
+ */
4266
+ touch = (...args) => new TouchCommand(args, this.opts).exec(this.client);
4267
+ /**
4268
+ * @see https://redis.io/commands/ttl
4269
+ */
4270
+ ttl = (...args) => new TtlCommand(args, this.opts).exec(this.client);
4271
+ /**
4272
+ * @see https://redis.io/commands/type
4273
+ */
4274
+ type = (...args) => new TypeCommand(args, this.opts).exec(this.client);
4275
+ /**
4276
+ * @see https://redis.io/commands/unlink
4277
+ */
4278
+ unlink = (...args) => new UnlinkCommand(args, this.opts).exec(this.client);
4279
+ /**
4280
+ * @see https://redis.io/commands/xadd
4281
+ */
4282
+ xadd = (...args) => new XAddCommand(args, this.opts).exec(this.client);
4283
+ /**
4284
+ * @see https://redis.io/commands/xack
4285
+ */
4286
+ xack = (...args) => new XAckCommand(args, this.opts).exec(this.client);
4287
+ /**
4288
+ * @see https://redis.io/commands/xdel
4289
+ */
4290
+ xdel = (...args) => new XDelCommand(args, this.opts).exec(this.client);
4291
+ /**
4292
+ * @see https://redis.io/commands/xgroup
4293
+ */
4294
+ xgroup = (...args) => new XGroupCommand(args, this.opts).exec(this.client);
4295
+ /**
4296
+ * @see https://redis.io/commands/xread
4297
+ */
4298
+ xread = (...args) => new XReadCommand(args, this.opts).exec(this.client);
4299
+ /**
4300
+ * @see https://redis.io/commands/xreadgroup
4301
+ */
4302
+ xreadgroup = (...args) => new XReadGroupCommand(args, this.opts).exec(this.client);
4303
+ /**
4304
+ * @see https://redis.io/commands/xinfo
4305
+ */
4306
+ xinfo = (...args) => new XInfoCommand(args, this.opts).exec(this.client);
4307
+ /**
4308
+ * @see https://redis.io/commands/xlen
4309
+ */
4310
+ xlen = (...args) => new XLenCommand(args, this.opts).exec(this.client);
4311
+ /**
4312
+ * @see https://redis.io/commands/xpending
4313
+ */
4314
+ xpending = (...args) => new XPendingCommand(args, this.opts).exec(this.client);
4315
+ /**
4316
+ * @see https://redis.io/commands/xclaim
4317
+ */
4318
+ xclaim = (...args) => new XClaimCommand(args, this.opts).exec(this.client);
4319
+ /**
4320
+ * @see https://redis.io/commands/xautoclaim
4321
+ */
4322
+ xautoclaim = (...args) => new XAutoClaim(args, this.opts).exec(this.client);
4323
+ /**
4324
+ * @see https://redis.io/commands/xtrim
4325
+ */
4326
+ xtrim = (...args) => new XTrimCommand(args, this.opts).exec(this.client);
4327
+ /**
4328
+ * @see https://redis.io/commands/xrange
4329
+ */
4330
+ xrange = (...args) => new XRangeCommand(args, this.opts).exec(this.client);
4331
+ /**
4332
+ * @see https://redis.io/commands/xrevrange
4333
+ */
4334
+ xrevrange = (...args) => new XRevRangeCommand(args, this.opts).exec(this.client);
4335
+ /**
4336
+ * @see https://redis.io/commands/zadd
4337
+ */
4338
+ zadd = (...args) => {
4339
+ if ("score" in args[1]) {
4340
+ return new ZAddCommand([args[0], args[1], ...args.slice(2)], this.opts).exec(
4341
+ this.client
4342
+ );
4343
+ }
4344
+ return new ZAddCommand(
4345
+ [args[0], args[1], ...args.slice(2)],
4346
+ this.opts
4347
+ ).exec(this.client);
4348
+ };
4349
+ /**
4350
+ * @see https://redis.io/commands/zcard
4351
+ */
4352
+ zcard = (...args) => new ZCardCommand(args, this.opts).exec(this.client);
4353
+ /**
4354
+ * @see https://redis.io/commands/zcount
4355
+ */
4356
+ zcount = (...args) => new ZCountCommand(args, this.opts).exec(this.client);
4357
+ /**
4358
+ * @see https://redis.io/commands/zdiffstore
4359
+ */
4360
+ zdiffstore = (...args) => new ZDiffStoreCommand(args, this.opts).exec(this.client);
4361
+ /**
4362
+ * @see https://redis.io/commands/zincrby
4363
+ */
4364
+ zincrby = (key, increment, member) => new ZIncrByCommand([key, increment, member], this.opts).exec(this.client);
4365
+ /**
4366
+ * @see https://redis.io/commands/zinterstore
4367
+ */
4368
+ zinterstore = (...args) => new ZInterStoreCommand(args, this.opts).exec(this.client);
4369
+ /**
4370
+ * @see https://redis.io/commands/zlexcount
4371
+ */
4372
+ zlexcount = (...args) => new ZLexCountCommand(args, this.opts).exec(this.client);
4373
+ /**
4374
+ * @see https://redis.io/commands/zmscore
4375
+ */
4376
+ zmscore = (...args) => new ZMScoreCommand(args, this.opts).exec(this.client);
4377
+ /**
4378
+ * @see https://redis.io/commands/zpopmax
4379
+ */
4380
+ zpopmax = (...args) => new ZPopMaxCommand(args, this.opts).exec(this.client);
4381
+ /**
4382
+ * @see https://redis.io/commands/zpopmin
4383
+ */
4384
+ zpopmin = (...args) => new ZPopMinCommand(args, this.opts).exec(this.client);
4385
+ /**
4386
+ * @see https://redis.io/commands/zrange
4387
+ */
4388
+ zrange = (...args) => new ZRangeCommand(args, this.opts).exec(this.client);
4389
+ /**
4390
+ * @see https://redis.io/commands/zrank
4391
+ */
4392
+ zrank = (key, member) => new ZRankCommand([key, member], this.opts).exec(this.client);
4393
+ /**
4394
+ * @see https://redis.io/commands/zrem
4395
+ */
4396
+ zrem = (key, ...members) => new ZRemCommand([key, ...members], this.opts).exec(this.client);
4397
+ /**
4398
+ * @see https://redis.io/commands/zremrangebylex
4399
+ */
4400
+ zremrangebylex = (...args) => new ZRemRangeByLexCommand(args, this.opts).exec(this.client);
4401
+ /**
4402
+ * @see https://redis.io/commands/zremrangebyrank
4403
+ */
4404
+ zremrangebyrank = (...args) => new ZRemRangeByRankCommand(args, this.opts).exec(this.client);
4405
+ /**
4406
+ * @see https://redis.io/commands/zremrangebyscore
4407
+ */
4408
+ zremrangebyscore = (...args) => new ZRemRangeByScoreCommand(args, this.opts).exec(this.client);
4409
+ /**
4410
+ * @see https://redis.io/commands/zrevrank
4411
+ */
4412
+ zrevrank = (key, member) => new ZRevRankCommand([key, member], this.opts).exec(this.client);
4413
+ /**
4414
+ * @see https://redis.io/commands/zscan
4415
+ */
4416
+ zscan = (...args) => new ZScanCommand(args, this.opts).exec(this.client);
4417
+ /**
4418
+ * @see https://redis.io/commands/zscore
4419
+ */
4420
+ zscore = (key, member) => new ZScoreCommand([key, member], this.opts).exec(this.client);
4421
+ /**
4422
+ * @see https://redis.io/commands/zunion
4423
+ */
4424
+ zunion = (...args) => new ZUnionCommand(args, this.opts).exec(this.client);
4425
+ /**
4426
+ * @see https://redis.io/commands/zunionstore
4427
+ */
4428
+ zunionstore = (...args) => new ZUnionStoreCommand(args, this.opts).exec(this.client);
4429
+ };
4430
+
4431
+ // version.ts
4432
+ var VERSION = "v1.30.2";
4433
+
4434
+ export {
4435
+ error_exports,
4436
+ HttpClient,
4437
+ Redis,
4438
+ VERSION
4439
+ };