@upstash/redis 0.0.0-ci.a094ea5b → 0.0.0-ci.a37d29ff68c6d235b92a2288360dc563c2f31f89-20241021061213

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