@upstash/redis 0.0.0-ci.fcd85d60 → 0.0.0-ci.ff7a0b135b28ff50a7e2634a78123684be3ed71f-20241105152627

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