@upstash/redis 0.0.0-ci.e730ad54-20220901 → 0.0.0-ci.e9ff702fe7d2dd2495b4383b5432fe9b93f5a6e7-20250729064656

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