@upstash/redis 0.0.0-ci.fcd85d60 → 0.0.0-ci.fe7ec0544f213f3f58bb19e23dfafafab828c00c-20241107145222

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