@upstash/redis 1.40.0 → 1.41.0

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 (475) hide show
  1. package/README.md +5 -0
  2. package/{chunk-RLVWMRRX.mjs → chunk-CGMWROAN.mjs} +557 -4
  3. package/cloudflare.d.mts +2 -2
  4. package/cloudflare.d.ts +2 -2
  5. package/cloudflare.js +557 -4
  6. package/cloudflare.mjs +1 -1
  7. package/docs/advanced.mdx +83 -0
  8. package/docs/commands/array/arcount.mdx +28 -0
  9. package/docs/commands/array/ardel.mdx +30 -0
  10. package/docs/commands/array/ardelrange.mdx +32 -0
  11. package/docs/commands/array/arget.mdx +33 -0
  12. package/docs/commands/array/argetrange.mdx +38 -0
  13. package/docs/commands/array/argrep.mdx +69 -0
  14. package/docs/commands/array/arinfo.mdx +49 -0
  15. package/docs/commands/array/arinsert.mdx +32 -0
  16. package/docs/commands/array/arlastitems.mdx +40 -0
  17. package/docs/commands/array/arlen.mdx +28 -0
  18. package/docs/commands/array/armget.mdx +31 -0
  19. package/docs/commands/array/armset.mdx +31 -0
  20. package/docs/commands/array/arnext.mdx +25 -0
  21. package/docs/commands/array/arop.mdx +44 -0
  22. package/docs/commands/array/arring.mdx +36 -0
  23. package/docs/commands/array/arscan.mdx +42 -0
  24. package/docs/commands/array/arseek.mdx +34 -0
  25. package/docs/commands/array/arset.mdx +35 -0
  26. package/docs/commands/auth/echo.mdx +24 -0
  27. package/docs/commands/auth/ping.mdx +21 -0
  28. package/docs/commands/bitmap/bitcount.mdx +39 -0
  29. package/docs/commands/bitmap/bitop.mdx +142 -0
  30. package/docs/commands/bitmap/bitpos.mdx +39 -0
  31. package/docs/commands/bitmap/getbit.mdx +28 -0
  32. package/docs/commands/bitmap/setbit.mdx +31 -0
  33. package/docs/commands/connection/client_setinfo.mdx +91 -0
  34. package/docs/commands/functions/call.mdx +72 -0
  35. package/docs/commands/functions/call_ro.mdx +57 -0
  36. package/docs/commands/functions/delete.mdx +22 -0
  37. package/docs/commands/functions/flush.mdx +16 -0
  38. package/docs/commands/functions/list.mdx +72 -0
  39. package/docs/commands/functions/load.mdx +64 -0
  40. package/docs/commands/functions/stats.mdx +46 -0
  41. package/docs/commands/generic/del.mdx +29 -0
  42. package/docs/commands/generic/exists.mdx +26 -0
  43. package/docs/commands/generic/expire.mdx +29 -0
  44. package/docs/commands/generic/expireat.mdx +29 -0
  45. package/docs/commands/generic/keys.mdx +32 -0
  46. package/docs/commands/generic/persist.mdx +23 -0
  47. package/docs/commands/generic/pexpire.mdx +28 -0
  48. package/docs/commands/generic/pexpireat.mdx +29 -0
  49. package/docs/commands/generic/pttl.mdx +23 -0
  50. package/docs/commands/generic/randomkey.mdx +21 -0
  51. package/docs/commands/generic/rename.mdx +28 -0
  52. package/docs/commands/generic/renamenx.mdx +28 -0
  53. package/docs/commands/generic/scan.mdx +38 -0
  54. package/docs/commands/generic/touch.mdx +23 -0
  55. package/docs/commands/generic/ttl.mdx +23 -0
  56. package/docs/commands/generic/type.mdx +27 -0
  57. package/docs/commands/generic/unlink.mdx +29 -0
  58. package/docs/commands/hash/hdel.mdx +28 -0
  59. package/docs/commands/hash/hexists.mdx +30 -0
  60. package/docs/commands/hash/hexpire.mdx +49 -0
  61. package/docs/commands/hash/hexpireat.mdx +48 -0
  62. package/docs/commands/hash/hexpiretime.mdx +35 -0
  63. package/docs/commands/hash/hget.mdx +29 -0
  64. package/docs/commands/hash/hgetall.mdx +27 -0
  65. package/docs/commands/hash/hgetdel.mdx +67 -0
  66. package/docs/commands/hash/hgetex.mdx +123 -0
  67. package/docs/commands/hash/hincrby.mdx +34 -0
  68. package/docs/commands/hash/hincrbyfloat.mdx +34 -0
  69. package/docs/commands/hash/hkeys.mdx +28 -0
  70. package/docs/commands/hash/hlen.mdx +28 -0
  71. package/docs/commands/hash/hmget.mdx +33 -0
  72. package/docs/commands/hash/hpersist.mdx +37 -0
  73. package/docs/commands/hash/hpexpire.mdx +50 -0
  74. package/docs/commands/hash/hpexpireat.mdx +48 -0
  75. package/docs/commands/hash/hpexpiretime.mdx +35 -0
  76. package/docs/commands/hash/hpttl.mdx +35 -0
  77. package/docs/commands/hash/hrandfield.mdx +57 -0
  78. package/docs/commands/hash/hscan.mdx +65 -0
  79. package/docs/commands/hash/hset.mdx +32 -0
  80. package/docs/commands/hash/hsetex.mdx +186 -0
  81. package/docs/commands/hash/hsetnx.mdx +30 -0
  82. package/docs/commands/hash/hstrlen.mdx +28 -0
  83. package/docs/commands/hash/httl.mdx +35 -0
  84. package/docs/commands/hash/hvals.mdx +29 -0
  85. package/docs/commands/json/arrappend.mdx +35 -0
  86. package/docs/commands/json/arrindex.mdx +37 -0
  87. package/docs/commands/json/arrinsert.mdx +34 -0
  88. package/docs/commands/json/arrlen.mdx +26 -0
  89. package/docs/commands/json/arrpop.mdx +36 -0
  90. package/docs/commands/json/arrtrim.mdx +34 -0
  91. package/docs/commands/json/clear.mdx +30 -0
  92. package/docs/commands/json/del.mdx +26 -0
  93. package/docs/commands/json/forget.mdx +26 -0
  94. package/docs/commands/json/get.mdx +53 -0
  95. package/docs/commands/json/merge.mdx +32 -0
  96. package/docs/commands/json/mget.mdx +27 -0
  97. package/docs/commands/json/mset.mdx +26 -0
  98. package/docs/commands/json/numincrby.mdx +33 -0
  99. package/docs/commands/json/nummultby.mdx +33 -0
  100. package/docs/commands/json/objkeys.mdx +27 -0
  101. package/docs/commands/json/objlen.mdx +27 -0
  102. package/docs/commands/json/set.mdx +42 -0
  103. package/docs/commands/json/strappend.mdx +32 -0
  104. package/docs/commands/json/strlen.mdx +26 -0
  105. package/docs/commands/json/toggle.mdx +28 -0
  106. package/docs/commands/json/type.mdx +28 -0
  107. package/docs/commands/list/lindex.mdx +32 -0
  108. package/docs/commands/list/linsert.mdx +41 -0
  109. package/docs/commands/list/llen.mdx +26 -0
  110. package/docs/commands/list/lmove.mdx +34 -0
  111. package/docs/commands/list/lpop.mdx +37 -0
  112. package/docs/commands/list/lpos.mdx +56 -0
  113. package/docs/commands/list/lpush.mdx +32 -0
  114. package/docs/commands/list/lpushx.mdx +38 -0
  115. package/docs/commands/list/lrange.mdx +37 -0
  116. package/docs/commands/list/lrem.mdx +33 -0
  117. package/docs/commands/list/lset.mdx +34 -0
  118. package/docs/commands/list/ltrim.mdx +33 -0
  119. package/docs/commands/list/rpop.mdx +37 -0
  120. package/docs/commands/list/rpush.mdx +32 -0
  121. package/docs/commands/list/rpushx.mdx +38 -0
  122. package/docs/commands/overview.mdx +692 -0
  123. package/docs/commands/pubsub/psubscribe.mdx +36 -0
  124. package/docs/commands/pubsub/publish.mdx +27 -0
  125. package/docs/commands/pubsub/subscribe.mdx +28 -0
  126. package/docs/commands/scripts/eval.mdx +36 -0
  127. package/docs/commands/scripts/eval_ro.mdx +36 -0
  128. package/docs/commands/scripts/evalsha.mdx +36 -0
  129. package/docs/commands/scripts/evalsha_ro.mdx +36 -0
  130. package/docs/commands/scripts/script_exists.mdx +26 -0
  131. package/docs/commands/scripts/script_flush.mdx +28 -0
  132. package/docs/commands/scripts/script_load.mdx +28 -0
  133. package/docs/commands/server/dbsize.mdx +22 -0
  134. package/docs/commands/server/flushall.mdx +25 -0
  135. package/docs/commands/server/flushdb.mdx +25 -0
  136. package/docs/commands/set/sadd.mdx +32 -0
  137. package/docs/commands/set/scard.mdx +26 -0
  138. package/docs/commands/set/sdiff.mdx +27 -0
  139. package/docs/commands/set/sdiffstore.mdx +32 -0
  140. package/docs/commands/set/sinter.mdx +27 -0
  141. package/docs/commands/set/sinterstore.mdx +33 -0
  142. package/docs/commands/set/sismember.mdx +30 -0
  143. package/docs/commands/set/smembers.mdx +25 -0
  144. package/docs/commands/set/smismember.mdx +31 -0
  145. package/docs/commands/set/smove.mdx +34 -0
  146. package/docs/commands/set/spop.mdx +36 -0
  147. package/docs/commands/set/srandmember.mdx +36 -0
  148. package/docs/commands/set/srem.mdx +29 -0
  149. package/docs/commands/set/sscan.mdx +39 -0
  150. package/docs/commands/set/sunion.mdx +27 -0
  151. package/docs/commands/set/sunionstore.mdx +33 -0
  152. package/docs/commands/stream/xack.mdx +37 -0
  153. package/docs/commands/stream/xackdel.mdx +211 -0
  154. package/docs/commands/stream/xadd.mdx +137 -0
  155. package/docs/commands/stream/xautoclaim.mdx +80 -0
  156. package/docs/commands/stream/xclaim.mdx +84 -0
  157. package/docs/commands/stream/xdel.mdx +34 -0
  158. package/docs/commands/stream/xdelex.mdx +119 -0
  159. package/docs/commands/stream/xgroup.mdx +141 -0
  160. package/docs/commands/stream/xinfo.mdx +77 -0
  161. package/docs/commands/stream/xlen.mdx +22 -0
  162. package/docs/commands/stream/xpending.mdx +75 -0
  163. package/docs/commands/stream/xrange.mdx +59 -0
  164. package/docs/commands/stream/xread.mdx +65 -0
  165. package/docs/commands/stream/xreadgroup.mdx +87 -0
  166. package/docs/commands/stream/xrevrange.mdx +65 -0
  167. package/docs/commands/stream/xtrim.mdx +75 -0
  168. package/docs/commands/string/append.mdx +28 -0
  169. package/docs/commands/string/decr.mdx +27 -0
  170. package/docs/commands/string/decrby.mdx +30 -0
  171. package/docs/commands/string/get.mdx +34 -0
  172. package/docs/commands/string/getdel.mdx +29 -0
  173. package/docs/commands/string/getrange.mdx +34 -0
  174. package/docs/commands/string/getset.mdx +28 -0
  175. package/docs/commands/string/incr.mdx +27 -0
  176. package/docs/commands/string/incrby.mdx +30 -0
  177. package/docs/commands/string/incrbyfloat.mdx +30 -0
  178. package/docs/commands/string/mget.mdx +31 -0
  179. package/docs/commands/string/mset.mdx +32 -0
  180. package/docs/commands/string/msetnx.mdx +29 -0
  181. package/docs/commands/string/set.mdx +79 -0
  182. package/docs/commands/string/setrange.mdx +38 -0
  183. package/docs/commands/string/strlen.mdx +26 -0
  184. package/docs/commands/transaction.mdx +22 -0
  185. package/docs/commands/zset/zadd.mdx +102 -0
  186. package/docs/commands/zset/zcard.mdx +31 -0
  187. package/docs/commands/zset/zcount.mdx +47 -0
  188. package/docs/commands/zset/zdiffstore.mdx +33 -0
  189. package/docs/commands/zset/zincrby.mdx +37 -0
  190. package/docs/commands/zset/zinterstore.mdx +98 -0
  191. package/docs/commands/zset/zlexcount.mdx +43 -0
  192. package/docs/commands/zset/zmscore.mdx +34 -0
  193. package/docs/commands/zset/zpopmax.mdx +25 -0
  194. package/docs/commands/zset/zpopmin.mdx +25 -0
  195. package/docs/commands/zset/zrange.mdx +85 -0
  196. package/docs/commands/zset/zrank.mdx +29 -0
  197. package/docs/commands/zset/zrem.mdx +33 -0
  198. package/docs/commands/zset/zremrangebylex.mdx +32 -0
  199. package/docs/commands/zset/zremrangebyrank.mdx +32 -0
  200. package/docs/commands/zset/zremrangebyscore.mdx +32 -0
  201. package/docs/commands/zset/zrevrank.mdx +29 -0
  202. package/docs/commands/zset/zscan.mdx +58 -0
  203. package/docs/commands/zset/zscore.mdx +34 -0
  204. package/docs/commands/zset/zunionstore.mdx +98 -0
  205. package/docs/deployment.mdx +117 -0
  206. package/docs/developing.mdx +118 -0
  207. package/docs/getstarted.mdx +68 -0
  208. package/docs/overview.mdx +29 -0
  209. package/docs/pipelining/auto-pipeline.mdx +108 -0
  210. package/docs/pipelining/pipeline-transaction.mdx +65 -0
  211. package/docs/retries.mdx +24 -0
  212. package/docs/troubleshooting.mdx +80 -0
  213. package/{error-BNzLTXJG.d.mts → error-4e36-PC0.d.mts} +838 -8
  214. package/{error-BNzLTXJG.d.ts → error-4e36-PC0.d.ts} +838 -8
  215. package/fastly.d.mts +2 -2
  216. package/fastly.d.ts +2 -2
  217. package/fastly.js +557 -4
  218. package/fastly.mjs +1 -1
  219. package/nodejs.d.mts +34 -2
  220. package/nodejs.d.ts +34 -2
  221. package/nodejs.js +586 -4
  222. package/nodejs.mjs +30 -1
  223. package/package.json +16 -5
  224. package/src/pkg/auto-pipeline.ts +284 -0
  225. package/src/pkg/commands/append.ts +12 -0
  226. package/src/pkg/commands/arcount.ts +14 -0
  227. package/src/pkg/commands/ardel.ts +19 -0
  228. package/src/pkg/commands/ardelrange.ts +19 -0
  229. package/src/pkg/commands/arget.ts +17 -0
  230. package/src/pkg/commands/argetrange.ts +20 -0
  231. package/src/pkg/commands/argrep.ts +109 -0
  232. package/src/pkg/commands/arinfo.ts +88 -0
  233. package/src/pkg/commands/arinsert.ts +24 -0
  234. package/src/pkg/commands/arlastitems.ts +29 -0
  235. package/src/pkg/commands/arlen.ts +23 -0
  236. package/src/pkg/commands/armget.ts +18 -0
  237. package/src/pkg/commands/armset.ts +26 -0
  238. package/src/pkg/commands/arnext.ts +20 -0
  239. package/src/pkg/commands/arop.ts +48 -0
  240. package/src/pkg/commands/arring.ts +23 -0
  241. package/src/pkg/commands/arscan.ts +44 -0
  242. package/src/pkg/commands/arseek.ts +17 -0
  243. package/src/pkg/commands/arset.ts +20 -0
  244. package/src/pkg/commands/bitcount.ts +30 -0
  245. package/src/pkg/commands/bitfield.ts +50 -0
  246. package/src/pkg/commands/bitop.ts +35 -0
  247. package/src/pkg/commands/bitpos.ts +15 -0
  248. package/src/pkg/commands/client_setinfo.ts +17 -0
  249. package/src/pkg/commands/command.ts +142 -0
  250. package/src/pkg/commands/copy.ts +22 -0
  251. package/src/pkg/commands/dbsize.ts +12 -0
  252. package/src/pkg/commands/decr.ts +12 -0
  253. package/src/pkg/commands/decrby.ts +12 -0
  254. package/src/pkg/commands/del.ts +12 -0
  255. package/src/pkg/commands/echo.ts +12 -0
  256. package/src/pkg/commands/eval.ts +18 -0
  257. package/src/pkg/commands/evalRo.ts +18 -0
  258. package/src/pkg/commands/evalsha.ts +18 -0
  259. package/src/pkg/commands/evalshaRo.ts +18 -0
  260. package/src/pkg/commands/exec.ts +23 -0
  261. package/src/pkg/commands/exists.ts +12 -0
  262. package/src/pkg/commands/expire.ts +13 -0
  263. package/src/pkg/commands/expireat.ts +16 -0
  264. package/src/pkg/commands/fcall.ts +15 -0
  265. package/src/pkg/commands/fcall_ro.ts +18 -0
  266. package/src/pkg/commands/flushall.ts +15 -0
  267. package/src/pkg/commands/flushdb.ts +15 -0
  268. package/src/pkg/commands/function_delete.ts +12 -0
  269. package/src/pkg/commands/function_flush.ts +12 -0
  270. package/src/pkg/commands/function_list.ts +77 -0
  271. package/src/pkg/commands/function_load.ts +31 -0
  272. package/src/pkg/commands/function_stats.ts +42 -0
  273. package/src/pkg/commands/geo_add.ts +54 -0
  274. package/src/pkg/commands/geo_dist.ts +19 -0
  275. package/src/pkg/commands/geo_hash.ts +23 -0
  276. package/src/pkg/commands/geo_pos.ts +39 -0
  277. package/src/pkg/commands/geo_search.ts +140 -0
  278. package/src/pkg/commands/geo_search_store.ts +69 -0
  279. package/src/pkg/commands/get.ts +15 -0
  280. package/src/pkg/commands/getbit.ts +12 -0
  281. package/src/pkg/commands/getdel.ts +15 -0
  282. package/src/pkg/commands/getex.ts +36 -0
  283. package/src/pkg/commands/getrange.ts +15 -0
  284. package/src/pkg/commands/getset.ts +15 -0
  285. package/src/pkg/commands/hdel.ts +12 -0
  286. package/src/pkg/commands/hexists.ts +12 -0
  287. package/src/pkg/commands/hexpire.ts +30 -0
  288. package/src/pkg/commands/hexpireat.ts +30 -0
  289. package/src/pkg/commands/hexpiretime.ts +13 -0
  290. package/src/pkg/commands/hget.ts +18 -0
  291. package/src/pkg/commands/hgetall.ts +44 -0
  292. package/src/pkg/commands/hgetdel.ts +30 -0
  293. package/src/pkg/commands/hgetex.ts +56 -0
  294. package/src/pkg/commands/hincrby.ts +15 -0
  295. package/src/pkg/commands/hincrbyfloat.ts +15 -0
  296. package/src/pkg/commands/hkeys.ts +12 -0
  297. package/src/pkg/commands/hlen.ts +12 -0
  298. package/src/pkg/commands/hmget.ts +53 -0
  299. package/src/pkg/commands/hmset.ts +14 -0
  300. package/src/pkg/commands/hpersist.ts +13 -0
  301. package/src/pkg/commands/hpexpire.ts +30 -0
  302. package/src/pkg/commands/hpexpireat.ts +30 -0
  303. package/src/pkg/commands/hpexpiretime.ts +13 -0
  304. package/src/pkg/commands/hpttl.ts +13 -0
  305. package/src/pkg/commands/hrandfield.ts +52 -0
  306. package/src/pkg/commands/hscan.ts +31 -0
  307. package/src/pkg/commands/hset.ts +15 -0
  308. package/src/pkg/commands/hsetex.ts +59 -0
  309. package/src/pkg/commands/hsetnx.ts +15 -0
  310. package/src/pkg/commands/hstrlen.ts +12 -0
  311. package/src/pkg/commands/httl.ts +13 -0
  312. package/src/pkg/commands/hvals.ts +12 -0
  313. package/src/pkg/commands/incr.ts +12 -0
  314. package/src/pkg/commands/incrby.ts +12 -0
  315. package/src/pkg/commands/incrbyfloat.ts +12 -0
  316. package/src/pkg/commands/json_arrappend.ts +18 -0
  317. package/src/pkg/commands/json_arrindex.ts +15 -0
  318. package/src/pkg/commands/json_arrinsert.ts +18 -0
  319. package/src/pkg/commands/json_arrlen.ts +15 -0
  320. package/src/pkg/commands/json_arrpop.ts +15 -0
  321. package/src/pkg/commands/json_arrtrim.ts +19 -0
  322. package/src/pkg/commands/json_clear.ts +12 -0
  323. package/src/pkg/commands/json_del.ts +12 -0
  324. package/src/pkg/commands/json_forget.ts +12 -0
  325. package/src/pkg/commands/json_get.ts +45 -0
  326. package/src/pkg/commands/json_merge.ts +18 -0
  327. package/src/pkg/commands/json_mget.ts +12 -0
  328. package/src/pkg/commands/json_mset.ts +27 -0
  329. package/src/pkg/commands/json_numincrby.ts +15 -0
  330. package/src/pkg/commands/json_nummultby.ts +15 -0
  331. package/src/pkg/commands/json_objkeys.ts +15 -0
  332. package/src/pkg/commands/json_objlen.ts +15 -0
  333. package/src/pkg/commands/json_resp.ts +11 -0
  334. package/src/pkg/commands/json_set.ts +35 -0
  335. package/src/pkg/commands/json_strappend.ts +15 -0
  336. package/src/pkg/commands/json_strlen.ts +15 -0
  337. package/src/pkg/commands/json_toggle.ts +12 -0
  338. package/src/pkg/commands/json_type.ts +12 -0
  339. package/src/pkg/commands/keys.ts +12 -0
  340. package/src/pkg/commands/lindex.ts +11 -0
  341. package/src/pkg/commands/linsert.ts +10 -0
  342. package/src/pkg/commands/llen.ts +12 -0
  343. package/src/pkg/commands/lmove.ts +20 -0
  344. package/src/pkg/commands/lmpop.ts +19 -0
  345. package/src/pkg/commands/lpop.ts +18 -0
  346. package/src/pkg/commands/lpos.ts +26 -0
  347. package/src/pkg/commands/lpush.ts +12 -0
  348. package/src/pkg/commands/lpushx.ts +12 -0
  349. package/src/pkg/commands/lrange.ts +11 -0
  350. package/src/pkg/commands/lrem.ts +10 -0
  351. package/src/pkg/commands/lset.ts +8 -0
  352. package/src/pkg/commands/ltrim.ts +8 -0
  353. package/src/pkg/commands/mget.ts +15 -0
  354. package/src/pkg/commands/mod.ts +222 -0
  355. package/src/pkg/commands/mset.ts +12 -0
  356. package/src/pkg/commands/msetnx.ts +12 -0
  357. package/src/pkg/commands/persist.ts +12 -0
  358. package/src/pkg/commands/pexpire.ts +16 -0
  359. package/src/pkg/commands/pexpireat.ts +16 -0
  360. package/src/pkg/commands/pfadd.ts +11 -0
  361. package/src/pkg/commands/pfcount.ts +11 -0
  362. package/src/pkg/commands/pfmerge.ts +11 -0
  363. package/src/pkg/commands/ping.ts +15 -0
  364. package/src/pkg/commands/psetex.ts +14 -0
  365. package/src/pkg/commands/psubscribe.ts +26 -0
  366. package/src/pkg/commands/pttl.ts +12 -0
  367. package/src/pkg/commands/publish.ts +12 -0
  368. package/src/pkg/commands/randomkey.ts +12 -0
  369. package/src/pkg/commands/rename.ts +12 -0
  370. package/src/pkg/commands/renamenx.ts +12 -0
  371. package/src/pkg/commands/rpop.ts +21 -0
  372. package/src/pkg/commands/rpush.ts +12 -0
  373. package/src/pkg/commands/rpushx.ts +12 -0
  374. package/src/pkg/commands/sadd.ts +15 -0
  375. package/src/pkg/commands/scan.ts +63 -0
  376. package/src/pkg/commands/scard.ts +11 -0
  377. package/src/pkg/commands/script_exists.ts +15 -0
  378. package/src/pkg/commands/script_flush.ts +22 -0
  379. package/src/pkg/commands/script_load.ts +12 -0
  380. package/src/pkg/commands/sdiff.ts +11 -0
  381. package/src/pkg/commands/sdiffstore.ts +14 -0
  382. package/src/pkg/commands/search/command-builder.ts +162 -0
  383. package/src/pkg/commands/search/index.ts +4 -0
  384. package/src/pkg/commands/search/schema-builder.ts +320 -0
  385. package/src/pkg/commands/search/search.ts +218 -0
  386. package/src/pkg/commands/search/types.ts +1029 -0
  387. package/src/pkg/commands/search/utils.ts +275 -0
  388. package/src/pkg/commands/set.ts +52 -0
  389. package/src/pkg/commands/setbit.ts +15 -0
  390. package/src/pkg/commands/setex.ts +11 -0
  391. package/src/pkg/commands/setnx.ts +11 -0
  392. package/src/pkg/commands/setrange.ts +15 -0
  393. package/src/pkg/commands/sinter.ts +11 -0
  394. package/src/pkg/commands/sintercard.ts +19 -0
  395. package/src/pkg/commands/sinterstore.ts +14 -0
  396. package/src/pkg/commands/sismember.ts +11 -0
  397. package/src/pkg/commands/smembers.ts +12 -0
  398. package/src/pkg/commands/smismember.ts +17 -0
  399. package/src/pkg/commands/smove.ts +14 -0
  400. package/src/pkg/commands/spop.ts +18 -0
  401. package/src/pkg/commands/srandmember.ts +18 -0
  402. package/src/pkg/commands/srem.ts +11 -0
  403. package/src/pkg/commands/sscan.ts +31 -0
  404. package/src/pkg/commands/strlen.ts +12 -0
  405. package/src/pkg/commands/subscribe.ts +254 -0
  406. package/src/pkg/commands/sunion.ts +12 -0
  407. package/src/pkg/commands/sunionstore.ts +15 -0
  408. package/src/pkg/commands/time.ts +10 -0
  409. package/src/pkg/commands/touch.ts +12 -0
  410. package/src/pkg/commands/ttl.ts +12 -0
  411. package/src/pkg/commands/type.ts +13 -0
  412. package/src/pkg/commands/types.ts +201 -0
  413. package/src/pkg/commands/unlink.ts +12 -0
  414. package/src/pkg/commands/vector/index.ts +11 -0
  415. package/src/pkg/commands/vector/types.ts +63 -0
  416. package/src/pkg/commands/vector/utils.ts +67 -0
  417. package/src/pkg/commands/vector/vector.ts +131 -0
  418. package/src/pkg/commands/vector_add.ts +18 -0
  419. package/src/pkg/commands/vector_count.ts +11 -0
  420. package/src/pkg/commands/vector_create.ts +28 -0
  421. package/src/pkg/commands/vector_del.ts +13 -0
  422. package/src/pkg/commands/vector_drop.ts +13 -0
  423. package/src/pkg/commands/vector_get.ts +18 -0
  424. package/src/pkg/commands/vector_info.ts +25 -0
  425. package/src/pkg/commands/vector_query.ts +24 -0
  426. package/src/pkg/commands/xack.ts +16 -0
  427. package/src/pkg/commands/xackdel.ts +21 -0
  428. package/src/pkg/commands/xadd.ts +70 -0
  429. package/src/pkg/commands/xautoclaim.ts +31 -0
  430. package/src/pkg/commands/xclaim.ts +56 -0
  431. package/src/pkg/commands/xdel.ts +16 -0
  432. package/src/pkg/commands/xdelex.ts +25 -0
  433. package/src/pkg/commands/xgroup.ts +101 -0
  434. package/src/pkg/commands/xinfo.ts +28 -0
  435. package/src/pkg/commands/xlen.ts +12 -0
  436. package/src/pkg/commands/xpending.ts +44 -0
  437. package/src/pkg/commands/xrange.ts +49 -0
  438. package/src/pkg/commands/xread.ts +78 -0
  439. package/src/pkg/commands/xreadgroup.ts +74 -0
  440. package/src/pkg/commands/xrevrange.ts +48 -0
  441. package/src/pkg/commands/xtrim.ts +25 -0
  442. package/src/pkg/commands/zadd.ts +54 -0
  443. package/src/pkg/commands/zcard.ts +12 -0
  444. package/src/pkg/commands/zcount.ts +14 -0
  445. package/src/pkg/commands/zdiffstore.ts +15 -0
  446. package/src/pkg/commands/zincrby.ts +14 -0
  447. package/src/pkg/commands/zinterstore.ts +51 -0
  448. package/src/pkg/commands/zlexcount.ts +11 -0
  449. package/src/pkg/commands/zmscore.ts +16 -0
  450. package/src/pkg/commands/zpopmax.ts +18 -0
  451. package/src/pkg/commands/zpopmin.ts +18 -0
  452. package/src/pkg/commands/zrange.ts +72 -0
  453. package/src/pkg/commands/zrank.ts +14 -0
  454. package/src/pkg/commands/zrem.ts +11 -0
  455. package/src/pkg/commands/zremrangebylex.ts +11 -0
  456. package/src/pkg/commands/zremrangebyrank.ts +14 -0
  457. package/src/pkg/commands/zremrangebyscore.ts +18 -0
  458. package/src/pkg/commands/zrevrank.ts +14 -0
  459. package/src/pkg/commands/zscan.ts +31 -0
  460. package/src/pkg/commands/zscore.ts +15 -0
  461. package/src/pkg/commands/zunion.ts +54 -0
  462. package/src/pkg/commands/zunionstore.ts +52 -0
  463. package/src/pkg/error.ts +28 -0
  464. package/src/pkg/http.ts +458 -0
  465. package/src/pkg/index.ts +1 -0
  466. package/src/pkg/pipeline.ts +2041 -0
  467. package/src/pkg/redis.ts +2130 -0
  468. package/src/pkg/script.ts +100 -0
  469. package/src/pkg/scriptRo.ts +98 -0
  470. package/src/pkg/types.ts +35 -0
  471. package/src/pkg/util.ts +115 -0
  472. package/src/platforms/cloudflare.ts +162 -0
  473. package/src/platforms/fastly.ts +105 -0
  474. package/src/platforms/nodejs.ts +231 -0
  475. package/src/version.ts +1 -0
@@ -0,0 +1,254 @@
1
+ import type { CommandOptions } from "./command";
2
+ import { Command } from "./command";
3
+ import type { Requester } from "../http";
4
+ import { PSubscribeCommand } from "./psubscribe";
5
+ import type { RedisOptions } from "../types";
6
+
7
+ type SubscriptionInfo = {
8
+ command: SubscribeCommand;
9
+ controller: AbortController;
10
+ isPattern: boolean;
11
+ };
12
+
13
+ type BaseMessageData<TMessage> = {
14
+ channel: string;
15
+ message: TMessage;
16
+ };
17
+
18
+ type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
19
+ pattern: string;
20
+ };
21
+
22
+ type SubscriptionCountEvent = number;
23
+
24
+ type MessageEventMap<TMessage> = {
25
+ message: BaseMessageData<TMessage>;
26
+ subscribe: SubscriptionCountEvent;
27
+ unsubscribe: SubscriptionCountEvent;
28
+ pmessage: PatternMessageData<TMessage>;
29
+ psubscribe: SubscriptionCountEvent;
30
+ punsubscribe: SubscriptionCountEvent;
31
+ error: Error;
32
+ [key: `message:${string}`]: BaseMessageData<TMessage>;
33
+ [key: `pmessage:${string}`]: PatternMessageData<TMessage>;
34
+ };
35
+
36
+ type EventType = keyof MessageEventMap<any>;
37
+
38
+ type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
39
+
40
+ export class Subscriber<TMessage = any> extends EventTarget {
41
+ private subscriptions: Map<string, SubscriptionInfo>;
42
+ private client: Requester;
43
+ private listeners: Map<string, Set<Listener<TMessage, any>>>;
44
+ private opts?: Pick<RedisOptions, "automaticDeserialization">;
45
+
46
+ constructor(
47
+ client: Requester,
48
+ channels: string[],
49
+ isPattern: boolean = false,
50
+ opts?: Pick<RedisOptions, "automaticDeserialization">
51
+ ) {
52
+ super();
53
+ this.client = client;
54
+ this.subscriptions = new Map();
55
+ this.listeners = new Map();
56
+ this.opts = opts;
57
+
58
+ for (const channel of channels) {
59
+ if (isPattern) {
60
+ this.subscribeToPattern(channel);
61
+ } else {
62
+ this.subscribeToChannel(channel);
63
+ }
64
+ }
65
+ }
66
+
67
+ private subscribeToChannel(channel: string) {
68
+ const controller = new AbortController();
69
+
70
+ const command = new SubscribeCommand([channel], {
71
+ streamOptions: {
72
+ signal: controller.signal,
73
+ onMessage: (data: string) => this.handleMessage(data, false),
74
+ },
75
+ });
76
+
77
+ command.exec(this.client).catch((error) => {
78
+ if (error.name !== "AbortError") {
79
+ this.dispatchToListeners("error", error);
80
+ }
81
+ });
82
+
83
+ this.subscriptions.set(channel, {
84
+ command,
85
+ controller,
86
+ isPattern: false,
87
+ });
88
+ }
89
+
90
+ private subscribeToPattern(pattern: string) {
91
+ const controller = new AbortController();
92
+
93
+ const command = new PSubscribeCommand([pattern], {
94
+ streamOptions: {
95
+ signal: controller.signal,
96
+ onMessage: (data: string) => this.handleMessage(data, true),
97
+ },
98
+ });
99
+
100
+ command.exec(this.client).catch((error) => {
101
+ if (error.name !== "AbortError") {
102
+ this.dispatchToListeners("error", error);
103
+ }
104
+ });
105
+
106
+ this.subscriptions.set(pattern, {
107
+ command,
108
+ controller,
109
+ isPattern: true,
110
+ });
111
+ }
112
+
113
+ private handleMessage(data: string, isPattern: boolean) {
114
+ // Remove "data:" prefix and parse the message
115
+ const messageData = data.replace(/^data:\s*/, "");
116
+ const firstCommaIndex = messageData.indexOf(",");
117
+ const secondCommaIndex = messageData.indexOf(",", firstCommaIndex + 1);
118
+ const thirdCommaIndex = isPattern ? messageData.indexOf(",", secondCommaIndex + 1) : -1;
119
+
120
+ if (firstCommaIndex !== -1 && secondCommaIndex !== -1) {
121
+ const type = messageData.slice(0, firstCommaIndex);
122
+
123
+ if (isPattern && type === "pmessage" && thirdCommaIndex !== -1) {
124
+ // Handle pmessage format: pmessage,pattern,channel,message
125
+ const pattern = messageData.slice(firstCommaIndex + 1, secondCommaIndex);
126
+ const channel = messageData.slice(secondCommaIndex + 1, thirdCommaIndex);
127
+ const messageStr = messageData.slice(thirdCommaIndex + 1);
128
+
129
+ try {
130
+ const message =
131
+ this.opts?.automaticDeserialization === false ? messageStr : JSON.parse(messageStr);
132
+
133
+ this.dispatchToListeners("pmessage", { pattern, channel, message });
134
+ this.dispatchToListeners(`pmessage:${pattern}`, { pattern, channel, message });
135
+ } catch (error) {
136
+ this.dispatchToListeners("error", new Error(`Failed to parse message: ${error}`));
137
+ }
138
+ } else {
139
+ // Handle regular message format: message,channel,message
140
+ const channel = messageData.slice(firstCommaIndex + 1, secondCommaIndex);
141
+ const messageStr = messageData.slice(secondCommaIndex + 1);
142
+
143
+ try {
144
+ if (
145
+ type === "subscribe" ||
146
+ type === "psubscribe" ||
147
+ type === "unsubscribe" ||
148
+ type === "punsubscribe"
149
+ ) {
150
+ // For subscription events, just emit the count
151
+ const count = Number.parseInt(messageStr);
152
+ this.dispatchToListeners(type, count);
153
+ } else {
154
+ const message =
155
+ this.opts?.automaticDeserialization === false
156
+ ? messageStr
157
+ : parseWithTryCatch(messageStr);
158
+
159
+ this.dispatchToListeners(type, { channel, message });
160
+ this.dispatchToListeners(`${type}:${channel}`, { channel, message });
161
+ }
162
+ } catch (error) {
163
+ this.dispatchToListeners("error", new Error(`Failed to parse message: ${error}`));
164
+ }
165
+ }
166
+ }
167
+ }
168
+
169
+ private dispatchToListeners(type: string, data: any) {
170
+ const listeners = this.listeners.get(type);
171
+ if (listeners) {
172
+ for (const listener of listeners) {
173
+ listener(data);
174
+ }
175
+ }
176
+ }
177
+
178
+ on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void {
179
+ if (!this.listeners.has(type)) {
180
+ this.listeners.set(type, new Set());
181
+ }
182
+ this.listeners.get(type)?.add(listener);
183
+ }
184
+
185
+ removeAllListeners(): void {
186
+ this.listeners.clear();
187
+ }
188
+
189
+ async unsubscribe(channels?: string[]) {
190
+ if (channels) {
191
+ for (const channel of channels) {
192
+ const subscription = this.subscriptions.get(channel);
193
+ if (subscription) {
194
+ try {
195
+ subscription.controller.abort();
196
+ } catch {
197
+ // ignore
198
+ }
199
+ this.subscriptions.delete(channel);
200
+ }
201
+ }
202
+ } else {
203
+ for (const subscription of this.subscriptions.values()) {
204
+ try {
205
+ subscription.controller.abort();
206
+ } catch {
207
+ // ignore
208
+ }
209
+ }
210
+ this.subscriptions.clear();
211
+ this.removeAllListeners();
212
+ }
213
+ }
214
+
215
+ getSubscribedChannels(): string[] {
216
+ return [...this.subscriptions.keys()];
217
+ }
218
+ }
219
+
220
+ /**
221
+ * @see https://redis.io/commands/subscribe
222
+ * @see node_modules/@upstash/redis/docs/commands/pubsub/subscribe.mdx
223
+ */
224
+ export class SubscribeCommand extends Command<number, number> {
225
+ constructor(
226
+ cmd: [...channels: string[]],
227
+ opts?: CommandOptions<number, number> & { signal?: AbortSignal }
228
+ ) {
229
+ const sseHeaders = {
230
+ Accept: "text/event-stream",
231
+ "Cache-Control": "no-cache",
232
+ Connection: "keep-alive",
233
+ };
234
+
235
+ super([], {
236
+ ...opts,
237
+ headers: sseHeaders,
238
+ path: ["subscribe", ...cmd],
239
+ streamOptions: {
240
+ isStreaming: true,
241
+ onMessage: opts?.streamOptions?.onMessage,
242
+ signal: opts?.streamOptions?.signal,
243
+ },
244
+ });
245
+ }
246
+ }
247
+
248
+ const parseWithTryCatch = (str: string) => {
249
+ try {
250
+ return JSON.parse(str);
251
+ } catch {
252
+ return str;
253
+ }
254
+ };
@@ -0,0 +1,12 @@
1
+ import type { CommandOptions } from "./command";
2
+ import { Command } from "./command";
3
+
4
+ /**
5
+ * @see https://redis.io/commands/sunion
6
+ * @see node_modules/@upstash/redis/docs/commands/set/sunion.mdx
7
+ */
8
+ export class SUnionCommand<TData> extends Command<string[], TData[]> {
9
+ constructor(cmd: [key: string, ...keys: string[]], opts?: CommandOptions<string[], TData[]>) {
10
+ super(["sunion", ...cmd], opts);
11
+ }
12
+ }
@@ -0,0 +1,15 @@
1
+ import type { CommandOptions } from "./command";
2
+ import { Command } from "./command";
3
+
4
+ /**
5
+ * @see https://redis.io/commands/sunionstore
6
+ * @see node_modules/@upstash/redis/docs/commands/set/sunionstore.mdx
7
+ */
8
+ export class SUnionStoreCommand extends Command<number, number> {
9
+ constructor(
10
+ cmd: [destination: string, key: string, ...keys: string[]],
11
+ opts?: CommandOptions<number, number>
12
+ ) {
13
+ super(["sunionstore", ...cmd], opts);
14
+ }
15
+ }
@@ -0,0 +1,10 @@
1
+ import type { CommandOptions } from "./command";
2
+ import { Command } from "./command";
3
+ /**
4
+ * @see https://redis.io/commands/time
5
+ */
6
+ export class TimeCommand extends Command<[number, number], [number, number]> {
7
+ constructor(opts?: CommandOptions<[number, number], [number, number]>) {
8
+ super(["time"], opts);
9
+ }
10
+ }
@@ -0,0 +1,12 @@
1
+ import type { CommandOptions } from "./command";
2
+ import { Command } from "./command";
3
+
4
+ /**
5
+ * @see https://redis.io/commands/touch
6
+ * @see node_modules/@upstash/redis/docs/commands/generic/touch.mdx
7
+ */
8
+ export class TouchCommand extends Command<number, number> {
9
+ constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>) {
10
+ super(["touch", ...cmd], opts);
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import type { CommandOptions } from "./command";
2
+ import { Command } from "./command";
3
+
4
+ /**
5
+ * @see https://redis.io/commands/ttl
6
+ * @see node_modules/@upstash/redis/docs/commands/generic/ttl.mdx
7
+ */
8
+ export class TtlCommand extends Command<number, number> {
9
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>) {
10
+ super(["ttl", ...cmd], opts);
11
+ }
12
+ }
@@ -0,0 +1,13 @@
1
+ import type { CommandOptions } from "./command";
2
+ import { Command } from "./command";
3
+
4
+ export type Type = "string" | "list" | "set" | "zset" | "hash" | "none";
5
+ /**
6
+ * @see https://redis.io/commands/type
7
+ * @see node_modules/@upstash/redis/docs/commands/generic/type.mdx
8
+ */
9
+ export class TypeCommand extends Command<Type, Type> {
10
+ constructor(cmd: [key: string], opts?: CommandOptions<Type, Type>) {
11
+ super(["type", ...cmd], opts);
12
+ }
13
+ }
@@ -0,0 +1,201 @@
1
+ export { type AppendCommand } from "./append";
2
+ export { type ArCountCommand } from "./arcount";
3
+ export { type ArDelCommand } from "./ardel";
4
+ export { type ArDelRangeCommand } from "./ardelrange";
5
+ export { type ArGetCommand } from "./arget";
6
+ export { type ArGetRangeCommand } from "./argetrange";
7
+ export {
8
+ type ArGrepCommand,
9
+ type ArGrepOptions,
10
+ type ArGrepPredicate,
11
+ type ArGrepResult,
12
+ } from "./argrep";
13
+ export { type ArInfoCommand, type ArInfoOptions, type ArInfoResult } from "./arinfo";
14
+ export { type ArInsertCommand } from "./arinsert";
15
+ export { type ArLastItemsCommand, type ArLastItemsOptions } from "./arlastitems";
16
+ export { type ArLenCommand } from "./arlen";
17
+ export { type ArMGetCommand } from "./armget";
18
+ export { type ArMSetCommand, type ArMSetValues } from "./armset";
19
+ export { type ArNextCommand } from "./arnext";
20
+ export { type ArOpCommand, type ArOpOperation } from "./arop";
21
+ export { type ArRingCommand } from "./arring";
22
+ export { type ArScanCommand, type ArScanOptions } from "./arscan";
23
+ export { type ArSeekCommand } from "./arseek";
24
+ export { type ArSetCommand } from "./arset";
25
+ export { type BitCountCommand } from "./bitcount";
26
+ export { type BitOpCommand } from "./bitop";
27
+ export { type BitPosCommand } from "./bitpos";
28
+ export { type ClientSetInfoCommand, type ClientSetInfoAttribute } from "./client_setinfo";
29
+ export { type CopyCommand } from "./copy";
30
+ export { type DBSizeCommand } from "./dbsize";
31
+ export { type DecrCommand } from "./decr";
32
+ export { type DecrByCommand } from "./decrby";
33
+ export { type DelCommand } from "./del";
34
+ export { type EchoCommand } from "./echo";
35
+ export { type EvalROCommand } from "./evalRo";
36
+ export { type EvalCommand } from "./eval";
37
+ export { type EvalshaROCommand } from "./evalshaRo";
38
+ export { type EvalshaCommand } from "./evalsha";
39
+ export { type ExistsCommand } from "./exists";
40
+ export { type ExpireCommand, type ExpireOption } from "./expire";
41
+ export { type ExpireAtCommand } from "./expireat";
42
+ export { type FlushAllCommand } from "./flushall";
43
+ export { type FlushDBCommand } from "./flushdb";
44
+ export { type GeoAddCommand, GeoAddCommandOptions, GeoMember } from "./geo_add";
45
+ export { type GeoDistCommand } from "./geo_dist";
46
+ export { type GeoHashCommand } from "./geo_hash";
47
+ export { type GeoPosCommand } from "./geo_pos";
48
+ export { type GeoSearchCommand } from "./geo_search";
49
+ export { type GeoSearchStoreCommand } from "./geo_search_store";
50
+ export { type GetCommand } from "./get";
51
+ export { type GetBitCommand } from "./getbit";
52
+ export { type GetDelCommand } from "./getdel";
53
+ export { type GetExCommand } from "./getex";
54
+ export { type GetRangeCommand } from "./getrange";
55
+ export { type GetSetCommand } from "./getset";
56
+ export { type HDelCommand } from "./hdel";
57
+ export { type HExistsCommand } from "./hexists";
58
+ export { type HExpireCommand } from "./hexpire";
59
+ export { type HExpireAtCommand } from "./hexpireat";
60
+ export { type HExpireTimeCommand } from "./hexpiretime";
61
+ export { type HTtlCommand } from "./httl";
62
+ export { type HPExpireCommand } from "./hpexpire";
63
+ export { type HPExpireAtCommand } from "./hpexpireat";
64
+ export { type HPExpireTimeCommand } from "./hpexpiretime";
65
+ export { type HPTtlCommand } from "./hpttl";
66
+ export { type HPersistCommand } from "./hpersist";
67
+ export { type HGetCommand } from "./hget";
68
+ export { type HGetAllCommand } from "./hgetall";
69
+ export { type HGetDelCommand } from "./hgetdel";
70
+ export { type HGetExCommand } from "./hgetex";
71
+ export { type HIncrByCommand } from "./hincrby";
72
+ export { type HIncrByFloatCommand } from "./hincrbyfloat";
73
+ export { type HKeysCommand } from "./hkeys";
74
+ export { type HLenCommand } from "./hlen";
75
+ export { type HMGetCommand } from "./hmget";
76
+ export { type HMSetCommand } from "./hmset";
77
+ export { type HRandFieldCommand } from "./hrandfield";
78
+ export { type HScanCommand } from "./hscan";
79
+ export { type HSetCommand } from "./hset";
80
+ export { type HSetExCommand } from "./hsetex";
81
+ export { type HSetNXCommand } from "./hsetnx";
82
+ export { type HStrLenCommand } from "./hstrlen";
83
+ export { type HValsCommand } from "./hvals";
84
+ export { type IncrCommand } from "./incr";
85
+ export { type IncrByCommand } from "./incrby";
86
+ export { type IncrByFloatCommand } from "./incrbyfloat";
87
+ export { type JsonArrAppendCommand } from "./json_arrappend";
88
+ export { type JsonArrIndexCommand } from "./json_arrindex";
89
+ export { type JsonArrInsertCommand } from "./json_arrinsert";
90
+ export { type JsonArrLenCommand } from "./json_arrlen";
91
+ export { type JsonArrPopCommand } from "./json_arrpop";
92
+ export { type JsonArrTrimCommand } from "./json_arrtrim";
93
+ export { type JsonClearCommand } from "./json_clear";
94
+ export { type JsonDelCommand } from "./json_del";
95
+ export { type JsonForgetCommand } from "./json_forget";
96
+ export { type JsonGetCommand } from "./json_get";
97
+ export { type JsonMergeCommand } from "./json_merge";
98
+ export { type JsonMGetCommand } from "./json_mget";
99
+ export { type JsonNumIncrByCommand } from "./json_numincrby";
100
+ export { type JsonNumMultByCommand } from "./json_nummultby";
101
+ export { type JsonObjKeysCommand } from "./json_objkeys";
102
+ export { type JsonObjLenCommand } from "./json_objlen";
103
+ export { type JsonRespCommand } from "./json_resp";
104
+ export { type JsonSetCommand } from "./json_set";
105
+ export { type JsonStrAppendCommand } from "./json_strappend";
106
+ export { type JsonStrLenCommand } from "./json_strlen";
107
+ export { type JsonToggleCommand } from "./json_toggle";
108
+ export { type JsonTypeCommand } from "./json_type";
109
+ export { type KeysCommand } from "./keys";
110
+ export { type LIndexCommand } from "./lindex";
111
+ export { type LInsertCommand } from "./linsert";
112
+ export { type LLenCommand } from "./llen";
113
+ export { type LMoveCommand } from "./lmove";
114
+ export { type LPopCommand } from "./lpop";
115
+ export { type LPushCommand } from "./lpush";
116
+ export { type LPushXCommand } from "./lpushx";
117
+ export { type LRangeCommand } from "./lrange";
118
+ export { type LRemCommand } from "./lrem";
119
+ export { type LSetCommand } from "./lset";
120
+ export { type LTrimCommand } from "./ltrim";
121
+ export { type MGetCommand } from "./mget";
122
+ export { type MSetCommand } from "./mset";
123
+ export { type MSetNXCommand } from "./msetnx";
124
+ export { type PersistCommand } from "./persist";
125
+ export { type PExpireCommand } from "./pexpire";
126
+ export { type PExpireAtCommand } from "./pexpireat";
127
+ export { type PingCommand } from "./ping";
128
+ export { type PSetEXCommand } from "./psetex";
129
+ export { type PTtlCommand } from "./pttl";
130
+ export { type PublishCommand } from "./publish";
131
+ export { type RandomKeyCommand } from "./randomkey";
132
+ export { type RenameCommand } from "./rename";
133
+ export { type RenameNXCommand } from "./renamenx";
134
+ export { type RPopCommand } from "./rpop";
135
+ export { type RPushCommand } from "./rpush";
136
+ export { type RPushXCommand } from "./rpushx";
137
+ export { type SAddCommand } from "./sadd";
138
+ export { type ScanCommand, ScanCommandOptions } from "./scan";
139
+ export { type SCardCommand } from "./scard";
140
+ export { type ScriptExistsCommand } from "./script_exists";
141
+ export { type ScriptFlushCommand } from "./script_flush";
142
+ export { type ScriptLoadCommand } from "./script_load";
143
+ export { type SDiffCommand } from "./sdiff";
144
+ export { type SDiffStoreCommand } from "./sdiffstore";
145
+ export { type SetCommand, SetCommandOptions } from "./set";
146
+ export { type SetBitCommand } from "./setbit";
147
+ export { type SetExCommand } from "./setex";
148
+ export { type SetNxCommand } from "./setnx";
149
+ export { type SetRangeCommand } from "./setrange";
150
+ export { type SInterCommand } from "./sinter";
151
+ export { type SInterCardCommand } from "./sintercard";
152
+ export { type SInterStoreCommand } from "./sinterstore";
153
+ export { type SIsMemberCommand } from "./sismember";
154
+ export { type SMembersCommand } from "./smembers";
155
+ export { type SMIsMemberCommand } from "./smismember";
156
+ export { type SMoveCommand } from "./smove";
157
+ export { type SPopCommand } from "./spop";
158
+ export { type SRandMemberCommand } from "./srandmember";
159
+ export { type SRemCommand } from "./srem";
160
+ export { type SScanCommand } from "./sscan";
161
+ export { type StrLenCommand } from "./strlen";
162
+ export { type SUnionCommand } from "./sunion";
163
+ export { type SUnionStoreCommand } from "./sunionstore";
164
+ export { type TimeCommand } from "./time";
165
+ export { type TouchCommand } from "./touch";
166
+ export { type TtlCommand } from "./ttl";
167
+ export { Type, type TypeCommand } from "./type";
168
+ export { type UnlinkCommand } from "./unlink";
169
+ export { type VectorAddCommand } from "./vector_add";
170
+ export { type VectorCountCommand } from "./vector_count";
171
+ export { type VectorCreateCommand } from "./vector_create";
172
+ export { type VectorDelCommand } from "./vector_del";
173
+ export { type VectorDropCommand } from "./vector_drop";
174
+ export { type VectorGetCommand } from "./vector_get";
175
+ export { type VectorInfoCommand } from "./vector_info";
176
+ export { type VectorQueryCommand } from "./vector_query";
177
+ export { type XAddCommand } from "./xadd";
178
+ export { type XAckDelCommand } from "./xackdel";
179
+ export { type XDelExCommand } from "./xdelex";
180
+ export { type XRangeCommand } from "./xrange";
181
+ export { ScoreMember, ZAddCommandOptions, type ZAddCommand } from "./zadd";
182
+ export { type ZCardCommand } from "./zcard";
183
+ export { type ZCountCommand } from "./zcount";
184
+ export { type ZDiffStoreCommand } from "./zdiffstore";
185
+ export { type ZIncrByCommand } from "./zincrby";
186
+ export { type ZInterStoreCommand, ZInterStoreCommandOptions } from "./zinterstore";
187
+ export { type ZLexCountCommand } from "./zlexcount";
188
+ export { type ZMScoreCommand } from "./zmscore";
189
+ export { type ZPopMaxCommand } from "./zpopmax";
190
+ export { type ZPopMinCommand } from "./zpopmin";
191
+ export { type ZRangeCommand, ZRangeCommandOptions } from "./zrange";
192
+ export { type ZRankCommand } from "./zrank";
193
+ export { type ZRemCommand } from "./zrem";
194
+ export { type ZRemRangeByLexCommand } from "./zremrangebylex";
195
+ export { type ZRemRangeByRankCommand } from "./zremrangebyrank";
196
+ export { type ZRemRangeByScoreCommand } from "./zremrangebyscore";
197
+ export { type ZRevRankCommand } from "./zrevrank";
198
+ export { type ZScanCommand } from "./zscan";
199
+ export { type ZScoreCommand } from "./zscore";
200
+ export { type ZUnionCommand, ZUnionCommandOptions } from "./zunion";
201
+ export { type ZUnionStoreCommand, ZUnionStoreCommandOptions } from "./zunionstore";
@@ -0,0 +1,12 @@
1
+ import type { CommandOptions } from "./command";
2
+ import { Command } from "./command";
3
+
4
+ /**
5
+ * @see https://redis.io/commands/unlink
6
+ * @see node_modules/@upstash/redis/docs/commands/generic/unlink.mdx
7
+ */
8
+ export class UnlinkCommand extends Command<number, number> {
9
+ constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>) {
10
+ super(["unlink", ...cmd], opts);
11
+ }
12
+ }
@@ -0,0 +1,11 @@
1
+ export { VectorIndex } from "./vector";
2
+ export type { CreateVectorIndexParameters, VectorIndexParameters } from "./vector";
3
+ export type {
4
+ VectorCreateOptions,
5
+ VectorIndexInfo,
6
+ VectorInput,
7
+ VectorMetric,
8
+ VectorQueryOptions,
9
+ VectorQueryProfile,
10
+ VectorQueryResult,
11
+ } from "./types";
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Distance metric used by a vector index.
3
+ */
4
+ export type VectorMetric = "COSINE" | "EUCLIDEAN" | "DOT";
5
+
6
+ /**
7
+ * Speed / recall trade-off for `VECTOR.QUERY`.
8
+ *
9
+ * @default "BALANCED"
10
+ */
11
+ export type VectorQueryProfile = "FAST" | "BALANCED" | "PRECISE";
12
+
13
+ /**
14
+ * A vector to add or query with. Accepts:
15
+ * - `number[]`: sent as `VALUES <n> <f1> ... <fn>`
16
+ * - `Float32Array`: encoded as little-endian FP32 and sent as `BASE64-FP32 <b64>`
17
+ * - `{ base64: string }`: a base64-encoded little-endian FP32 blob, sent as-is with `BASE64-FP32`
18
+ * (e.g. the `encoding_format: "base64"` output of embedding providers)
19
+ */
20
+ export type VectorInput = number[] | Float32Array | { base64: string };
21
+
22
+ export type VectorCreateOptions = {
23
+ /**
24
+ * Number of dimensions of the vectors stored in the index. Must be between 1 and 32768.
25
+ */
26
+ dimension: number;
27
+ /**
28
+ * Distance metric used to compare vectors.
29
+ */
30
+ metric: VectorMetric;
31
+ /**
32
+ * When `true`, creating an index that already exists with the same dimension and metric
33
+ * succeeds (returns `0`) instead of throwing.
34
+ */
35
+ existsOk?: boolean;
36
+ };
37
+
38
+ export type VectorQueryOptions = {
39
+ /**
40
+ * The query vector.
41
+ */
42
+ vector: VectorInput;
43
+ /**
44
+ * Number of nearest neighbours to return. Must be between 1 and 1000.
45
+ */
46
+ topK: number;
47
+ /**
48
+ * Speed / recall trade-off.
49
+ *
50
+ * @default "BALANCED"
51
+ */
52
+ profile?: VectorQueryProfile;
53
+ };
54
+
55
+ export type VectorQueryResult = {
56
+ id: string;
57
+ score: number;
58
+ };
59
+
60
+ export type VectorIndexInfo = {
61
+ dimension: number;
62
+ metric: VectorMetric;
63
+ };