@windrun-huaiin/backend-core 15.0.0 → 16.0.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 (340) hide show
  1. package/LICENSE +1 -1
  2. package/dist/app/api/stripe/checkout/route.js +2 -2
  3. package/dist/app/api/stripe/checkout/route.mjs +1 -1
  4. package/dist/app/api/stripe/customer-portal/route.js +2 -2
  5. package/dist/app/api/stripe/customer-portal/route.mjs +1 -1
  6. package/dist/app/api/user/anonymous/init/route.js +6 -6
  7. package/dist/app/api/user/anonymous/init/route.mjs +1 -1
  8. package/dist/app/api/webhook/clerk/user/route.js +4 -4
  9. package/dist/app/api/webhook/clerk/user/route.mjs +1 -1
  10. package/dist/app/api/webhook/stripe/route.js +2 -2
  11. package/dist/app/api/webhook/stripe/route.mjs +1 -1
  12. package/dist/auth/auth-middleware.js +3 -3
  13. package/dist/auth/auth-middleware.mjs +1 -1
  14. package/dist/auth/auth-utils.js +10 -10
  15. package/dist/auth/auth-utils.mjs +1 -1
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +44 -0
  19. package/dist/index.mjs +8 -1
  20. package/dist/lib/index.js +19 -0
  21. package/dist/lib/index.mjs +1 -1
  22. package/dist/lib/money-price-helper.js +3 -3
  23. package/dist/lib/money-price-helper.mjs +1 -1
  24. package/dist/lib/stripe-config.js +8 -8
  25. package/dist/lib/stripe-config.mjs +1 -1
  26. package/dist/lib/upstash/qstash.d.ts +20 -7
  27. package/dist/lib/upstash/qstash.d.ts.map +1 -1
  28. package/dist/lib/upstash/qstash.js +45 -19
  29. package/dist/lib/upstash/qstash.mjs +35 -9
  30. package/dist/lib/upstash/redis-counter.js +7 -7
  31. package/dist/lib/upstash/redis-counter.mjs +1 -1
  32. package/dist/lib/upstash/redis-favorite.js +9 -9
  33. package/dist/lib/upstash/redis-favorite.mjs +1 -1
  34. package/dist/lib/upstash/redis-like.js +9 -9
  35. package/dist/lib/upstash/redis-like.mjs +1 -1
  36. package/dist/lib/upstash/redis-lock.js +6 -6
  37. package/dist/lib/upstash/redis-lock.mjs +1 -1
  38. package/dist/lib/upstash/redis-structures.d.ts +83 -0
  39. package/dist/lib/upstash/redis-structures.d.ts.map +1 -1
  40. package/dist/lib/upstash/redis-structures.js +245 -25
  41. package/dist/lib/upstash/redis-structures.mjs +203 -2
  42. package/dist/lib/upstash-config.d.ts.map +1 -1
  43. package/dist/lib/upstash-config.js +90 -18
  44. package/dist/lib/upstash-config.mjs +80 -8
  45. package/dist/prisma/prisma-transaction-util.js +2 -2
  46. package/dist/prisma/prisma-transaction-util.mjs +1 -1
  47. package/dist/services/aggregate/anonymous.aggregate.service.js +6 -6
  48. package/dist/services/aggregate/anonymous.aggregate.service.mjs +1 -1
  49. package/dist/services/aggregate/billing.aggregate.service.js +21 -21
  50. package/dist/services/aggregate/billing.aggregate.service.mjs +1 -1
  51. package/dist/services/aggregate/user.aggregate.service.js +10 -10
  52. package/dist/services/aggregate/user.aggregate.service.mjs +1 -1
  53. package/dist/services/ai/abort.d.ts +2 -0
  54. package/dist/services/ai/abort.d.ts.map +1 -0
  55. package/dist/services/ai/abort.js +24 -0
  56. package/dist/services/ai/abort.mjs +22 -0
  57. package/dist/services/ai/env.d.ts +21 -0
  58. package/dist/services/ai/env.d.ts.map +1 -0
  59. package/dist/services/ai/env.js +85 -0
  60. package/dist/services/ai/env.mjs +80 -0
  61. package/dist/services/ai/error.d.ts +3 -0
  62. package/dist/services/ai/error.d.ts.map +1 -0
  63. package/dist/services/ai/error.js +54 -0
  64. package/dist/services/ai/error.mjs +52 -0
  65. package/dist/services/ai/index.d.ts +9 -0
  66. package/dist/services/ai/index.d.ts.map +1 -0
  67. package/dist/services/ai/index.js +30 -0
  68. package/dist/services/ai/index.mjs +7 -0
  69. package/dist/services/ai/message-builder.d.ts +4 -0
  70. package/dist/services/ai/message-builder.d.ts.map +1 -0
  71. package/dist/services/ai/message-builder.js +15 -0
  72. package/dist/services/ai/message-builder.mjs +13 -0
  73. package/dist/services/ai/mock.d.ts +30 -0
  74. package/dist/services/ai/mock.d.ts.map +1 -0
  75. package/dist/services/ai/mock.js +314 -0
  76. package/dist/services/ai/mock.mjs +308 -0
  77. package/dist/services/ai/openrouter-client.d.ts +12 -0
  78. package/dist/services/ai/openrouter-client.d.ts.map +1 -0
  79. package/dist/services/ai/openrouter-client.js +81 -0
  80. package/dist/services/ai/openrouter-client.mjs +78 -0
  81. package/dist/services/ai/route.d.ts +6 -0
  82. package/dist/services/ai/route.d.ts.map +1 -0
  83. package/dist/services/ai/route.js +178 -0
  84. package/dist/services/ai/route.mjs +173 -0
  85. package/dist/services/ai/types.d.ts +98 -0
  86. package/dist/services/ai/types.d.ts.map +1 -0
  87. package/dist/services/context/user-context-service.js +3 -3
  88. package/dist/services/context/user-context-service.mjs +1 -1
  89. package/dist/services/database/apilog.service.js +14 -14
  90. package/dist/services/database/apilog.service.mjs +1 -1
  91. package/dist/services/database/credit.service.js +20 -20
  92. package/dist/services/database/credit.service.mjs +1 -1
  93. package/dist/services/database/creditAuditLog.service.js +13 -13
  94. package/dist/services/database/creditAuditLog.service.mjs +1 -1
  95. package/dist/services/database/subscription.service.js +16 -16
  96. package/dist/services/database/subscription.service.mjs +1 -1
  97. package/dist/services/database/transaction.service.js +18 -18
  98. package/dist/services/database/transaction.service.mjs +1 -1
  99. package/dist/services/database/user.service.js +14 -14
  100. package/dist/services/database/user.service.mjs +1 -1
  101. package/dist/services/database/userBackup.service.js +15 -15
  102. package/dist/services/database/userBackup.service.mjs +1 -1
  103. package/dist/services/stripe/webhook-handler.js +13 -13
  104. package/dist/services/stripe/webhook-handler.mjs +3 -3
  105. package/package.json +14 -4
  106. package/src/index.ts +1 -0
  107. package/src/lib/upstash/qstash.ts +55 -15
  108. package/src/lib/upstash/redis-structures.ts +248 -0
  109. package/src/lib/upstash-config.ts +106 -4
  110. package/src/services/ai/abort.ts +26 -0
  111. package/src/services/ai/env.ts +120 -0
  112. package/src/services/ai/error.ts +64 -0
  113. package/src/services/ai/index.ts +8 -0
  114. package/src/services/ai/message-builder.ts +17 -0
  115. package/src/services/ai/mock.ts +378 -0
  116. package/src/services/ai/openrouter-client.ts +94 -0
  117. package/src/services/ai/route.ts +218 -0
  118. package/src/services/ai/types.ts +131 -0
  119. package/dist/_virtual/_commonjs-dynamic-modules.js +0 -7
  120. package/dist/_virtual/_commonjs-dynamic-modules.mjs +0 -5
  121. package/dist/_virtual/_commonjsHelpers.js +0 -10
  122. package/dist/_virtual/_commonjsHelpers.mjs +0 -7
  123. package/dist/_virtual/aes.js +0 -5
  124. package/dist/_virtual/aes.mjs +0 -3
  125. package/dist/_virtual/blowfish.js +0 -5
  126. package/dist/_virtual/blowfish.mjs +0 -3
  127. package/dist/_virtual/cipher-core.js +0 -5
  128. package/dist/_virtual/cipher-core.mjs +0 -3
  129. package/dist/_virtual/core.js +0 -5
  130. package/dist/_virtual/core.mjs +0 -3
  131. package/dist/_virtual/enc-base64.js +0 -5
  132. package/dist/_virtual/enc-base64.mjs +0 -3
  133. package/dist/_virtual/enc-base64url.js +0 -5
  134. package/dist/_virtual/enc-base64url.mjs +0 -3
  135. package/dist/_virtual/enc-utf16.js +0 -5
  136. package/dist/_virtual/enc-utf16.mjs +0 -3
  137. package/dist/_virtual/evpkdf.js +0 -5
  138. package/dist/_virtual/evpkdf.mjs +0 -3
  139. package/dist/_virtual/format-hex.js +0 -5
  140. package/dist/_virtual/format-hex.mjs +0 -3
  141. package/dist/_virtual/hmac.js +0 -5
  142. package/dist/_virtual/hmac.mjs +0 -3
  143. package/dist/_virtual/index.js +0 -11
  144. package/dist/_virtual/index.mjs +0 -7
  145. package/dist/_virtual/index2.js +0 -5
  146. package/dist/_virtual/index2.mjs +0 -3
  147. package/dist/_virtual/lib-typedarrays.js +0 -5
  148. package/dist/_virtual/lib-typedarrays.mjs +0 -3
  149. package/dist/_virtual/md5.js +0 -5
  150. package/dist/_virtual/md5.mjs +0 -3
  151. package/dist/_virtual/mode-cfb.js +0 -5
  152. package/dist/_virtual/mode-cfb.mjs +0 -3
  153. package/dist/_virtual/mode-ctr-gladman.js +0 -5
  154. package/dist/_virtual/mode-ctr-gladman.mjs +0 -3
  155. package/dist/_virtual/mode-ctr.js +0 -5
  156. package/dist/_virtual/mode-ctr.mjs +0 -3
  157. package/dist/_virtual/mode-ecb.js +0 -5
  158. package/dist/_virtual/mode-ecb.mjs +0 -3
  159. package/dist/_virtual/mode-ofb.js +0 -5
  160. package/dist/_virtual/mode-ofb.mjs +0 -3
  161. package/dist/_virtual/pad-ansix923.js +0 -5
  162. package/dist/_virtual/pad-ansix923.mjs +0 -3
  163. package/dist/_virtual/pad-iso10126.js +0 -5
  164. package/dist/_virtual/pad-iso10126.mjs +0 -3
  165. package/dist/_virtual/pad-iso97971.js +0 -5
  166. package/dist/_virtual/pad-iso97971.mjs +0 -3
  167. package/dist/_virtual/pad-nopadding.js +0 -5
  168. package/dist/_virtual/pad-nopadding.mjs +0 -3
  169. package/dist/_virtual/pad-zeropadding.js +0 -5
  170. package/dist/_virtual/pad-zeropadding.mjs +0 -3
  171. package/dist/_virtual/pbkdf2.js +0 -5
  172. package/dist/_virtual/pbkdf2.mjs +0 -3
  173. package/dist/_virtual/rabbit-legacy.js +0 -5
  174. package/dist/_virtual/rabbit-legacy.mjs +0 -3
  175. package/dist/_virtual/rabbit.js +0 -5
  176. package/dist/_virtual/rabbit.mjs +0 -3
  177. package/dist/_virtual/rc4.js +0 -5
  178. package/dist/_virtual/rc4.mjs +0 -3
  179. package/dist/_virtual/ripemd160.js +0 -5
  180. package/dist/_virtual/ripemd160.mjs +0 -3
  181. package/dist/_virtual/sha1.js +0 -5
  182. package/dist/_virtual/sha1.mjs +0 -3
  183. package/dist/_virtual/sha224.js +0 -5
  184. package/dist/_virtual/sha224.mjs +0 -3
  185. package/dist/_virtual/sha256.js +0 -5
  186. package/dist/_virtual/sha256.mjs +0 -3
  187. package/dist/_virtual/sha3.js +0 -5
  188. package/dist/_virtual/sha3.mjs +0 -3
  189. package/dist/_virtual/sha384.js +0 -5
  190. package/dist/_virtual/sha384.mjs +0 -3
  191. package/dist/_virtual/sha512.js +0 -5
  192. package/dist/_virtual/sha512.mjs +0 -3
  193. package/dist/_virtual/tripledes.js +0 -5
  194. package/dist/_virtual/tripledes.mjs +0 -3
  195. package/dist/_virtual/x64-core.js +0 -5
  196. package/dist/_virtual/x64-core.mjs +0 -3
  197. package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +0 -48
  198. package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs +0 -45
  199. package/dist/node_modules/.pnpm/@upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.js +0 -1848
  200. package/dist/node_modules/.pnpm/@upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.mjs +0 -1830
  201. package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.js +0 -5308
  202. package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.mjs +0 -5302
  203. package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/nodejs.js +0 -116
  204. package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/nodejs.mjs +0 -113
  205. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js +0 -248
  206. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.mjs +0 -246
  207. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.js +0 -485
  208. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.mjs +0 -483
  209. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.js +0 -906
  210. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.mjs +0 -904
  211. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.js +0 -818
  212. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.mjs +0 -816
  213. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.js +0 -146
  214. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.mjs +0 -144
  215. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.js +0 -158
  216. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.mjs +0 -156
  217. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.js +0 -159
  218. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.mjs +0 -157
  219. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.js +0 -146
  220. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.mjs +0 -144
  221. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.js +0 -77
  222. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.mjs +0 -75
  223. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.js +0 -153
  224. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.mjs +0 -151
  225. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.js +0 -62
  226. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.mjs +0 -60
  227. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.js +0 -86
  228. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.mjs +0 -84
  229. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.js +0 -278
  230. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.mjs +0 -276
  231. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.js +0 -91
  232. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.mjs +0 -89
  233. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.js +0 -127
  234. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.mjs +0 -125
  235. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.js +0 -69
  236. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.mjs +0 -67
  237. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js +0 -51
  238. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.mjs +0 -49
  239. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.js +0 -65
  240. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.mjs +0 -63
  241. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.js +0 -60
  242. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.mjs +0 -58
  243. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.js +0 -55
  244. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.mjs +0 -53
  245. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.js +0 -51
  246. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.mjs +0 -49
  247. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.js +0 -41
  248. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.mjs +0 -39
  249. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.js +0 -58
  250. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.mjs +0 -56
  251. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.js +0 -157
  252. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.mjs +0 -155
  253. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.js +0 -204
  254. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.mjs +0 -202
  255. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.js +0 -206
  256. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.mjs +0 -204
  257. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.js +0 -153
  258. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.mjs +0 -151
  259. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.js +0 -277
  260. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.mjs +0 -275
  261. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.js +0 -160
  262. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.mjs +0 -158
  263. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.js +0 -91
  264. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.mjs +0 -89
  265. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.js +0 -209
  266. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.mjs +0 -207
  267. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.js +0 -337
  268. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.mjs +0 -335
  269. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.js +0 -95
  270. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.mjs +0 -93
  271. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.js +0 -337
  272. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.mjs +0 -335
  273. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.js +0 -793
  274. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.mjs +0 -791
  275. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.js +0 -314
  276. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.mjs +0 -312
  277. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.js +0 -26
  278. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.mjs +0 -24
  279. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.js +0 -127
  280. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.mjs +0 -125
  281. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js +0 -20
  282. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.mjs +0 -18
  283. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.js +0 -31
  284. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.mjs +0 -29
  285. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.js +0 -18
  286. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.mjs +0 -14
  287. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.js +0 -82
  288. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.mjs +0 -80
  289. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.js +0 -103
  290. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.mjs +0 -101
  291. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.js +0 -7
  292. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.mjs +0 -3
  293. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.js +0 -38
  294. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.mjs +0 -33
  295. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.js +0 -27
  296. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.mjs +0 -23
  297. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.js +0 -21
  298. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.mjs +0 -16
  299. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.js +0 -22
  300. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.mjs +0 -18
  301. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.js +0 -111
  302. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.mjs +0 -107
  303. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.js +0 -61
  304. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.mjs +0 -57
  305. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.js +0 -16
  306. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.mjs +0 -12
  307. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.js +0 -40
  308. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.mjs +0 -36
  309. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.js +0 -15
  310. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.mjs +0 -13
  311. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js +0 -23
  312. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.mjs +0 -19
  313. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js +0 -30
  314. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.mjs +0 -26
  315. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js +0 -60
  316. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.mjs +0 -56
  317. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js +0 -35
  318. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.mjs +0 -31
  319. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js +0 -20
  320. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.mjs +0 -16
  321. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.js +0 -15
  322. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.mjs +0 -10
  323. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.js +0 -28
  324. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.mjs +0 -5
  325. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.js +0 -14
  326. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.mjs +0 -10
  327. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.js +0 -115
  328. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.mjs +0 -111
  329. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js +0 -42
  330. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.mjs +0 -19
  331. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js +0 -54
  332. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.mjs +0 -31
  333. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.js +0 -32
  334. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.mjs +0 -7
  335. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.js +0 -69
  336. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.mjs +0 -60
  337. package/dist/node_modules/.pnpm/neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.js +0 -422
  338. package/dist/node_modules/.pnpm/neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.mjs +0 -415
  339. package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.web.js +0 -6
  340. package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.web.mjs +0 -4
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var tslib_es6 = require('../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
3
+ var tslib = require('tslib');
4
4
  var upstashConfig = require('../upstash-config.js');
5
5
 
6
6
  /**
7
7
  * Set a plain string value with optional TTL (seconds).
8
8
  */
9
- const setString = (key, value, ttlSec) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
10
- return upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
9
+ const setString = (key, value, ttlSec) => tslib.__awaiter(void 0, void 0, void 0, function* () {
10
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
11
11
  if (ttlSec && ttlSec > 0) {
12
12
  yield redis.set(key, value, { ex: ttlSec });
13
13
  return true;
@@ -19,14 +19,38 @@ const setString = (key, value, ttlSec) => tslib_es6.__awaiter(void 0, void 0, vo
19
19
  /**
20
20
  * Get a plain string value. Returns null if Redis is unavailable or key missing.
21
21
  */
22
- const getString = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
22
+ const getString = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
23
23
  return upstashConfig.withRedis((redis) => redis.get(key));
24
24
  });
25
+ /**
26
+ * MGET plain string values. Missing keys are returned as null.
27
+ */
28
+ const mget = (keys) => tslib.__awaiter(void 0, void 0, void 0, function* () {
29
+ return upstashConfig.withRedis((redis) => {
30
+ if (keys.length === 0) {
31
+ return [];
32
+ }
33
+ return redis.mget(...keys);
34
+ });
35
+ });
36
+ /**
37
+ * MSET plain string values.
38
+ */
39
+ const mset = (entries) => tslib.__awaiter(void 0, void 0, void 0, function* () {
40
+ const keys = Object.keys(entries);
41
+ if (keys.length === 0) {
42
+ return true;
43
+ }
44
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
45
+ yield redis.mset(entries);
46
+ return true;
47
+ })).then((result) => result !== null && result !== void 0 ? result : false);
48
+ });
25
49
  /**
26
50
  * Store an object as JSON string with optional TTL (seconds).
27
51
  */
28
- const setJson = (key, value, ttlSec) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
29
- return upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
52
+ const setJson = (key, value, ttlSec) => tslib.__awaiter(void 0, void 0, void 0, function* () {
53
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
30
54
  const payload = JSON.stringify(value);
31
55
  if (ttlSec && ttlSec > 0) {
32
56
  yield redis.set(key, payload, { ex: ttlSec });
@@ -39,8 +63,8 @@ const setJson = (key, value, ttlSec) => tslib_es6.__awaiter(void 0, void 0, void
39
63
  /**
40
64
  * Get an object stored as JSON string. Returns null if missing or invalid JSON.
41
65
  */
42
- const getJson = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
43
- return upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
66
+ const getJson = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
67
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
44
68
  const payload = yield redis.get(key);
45
69
  if (!payload) {
46
70
  return null;
@@ -53,21 +77,96 @@ const getJson = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* (
53
77
  }
54
78
  }));
55
79
  });
80
+ /**
81
+ * MGET JSON values stored as strings. Missing or invalid values are returned as null.
82
+ */
83
+ const mgetJson = (keys) => tslib.__awaiter(void 0, void 0, void 0, function* () {
84
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
85
+ if (keys.length === 0) {
86
+ return [];
87
+ }
88
+ const payloads = yield redis.mget(...keys);
89
+ return payloads.map((payload) => {
90
+ if (!payload) {
91
+ return null;
92
+ }
93
+ try {
94
+ return JSON.parse(payload);
95
+ }
96
+ catch (_a) {
97
+ return null;
98
+ }
99
+ });
100
+ }));
101
+ });
102
+ /**
103
+ * MSET JSON values as strings.
104
+ */
105
+ const msetJson = (entries) => tslib.__awaiter(void 0, void 0, void 0, function* () {
106
+ const keys = Object.keys(entries);
107
+ if (keys.length === 0) {
108
+ return true;
109
+ }
110
+ const payloads = Object.fromEntries(Object.entries(entries).map(([key, value]) => [key, JSON.stringify(value)]));
111
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
112
+ yield redis.mset(payloads);
113
+ return true;
114
+ })).then((result) => result !== null && result !== void 0 ? result : false);
115
+ });
56
116
  /**
57
117
  * Delete a key. Returns false if Redis is unavailable.
58
118
  */
59
- const deleteKey = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
60
- const result = yield upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
119
+ const deleteKey = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
120
+ const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
61
121
  const deleted = yield redis.del(key);
62
122
  return deleted > 0;
63
123
  }));
64
124
  return result !== null && result !== void 0 ? result : false;
65
125
  });
126
+ /**
127
+ * DEL multiple keys. Returns deleted count, or null if Redis is unavailable.
128
+ */
129
+ const del = (keys) => tslib.__awaiter(void 0, void 0, void 0, function* () {
130
+ return upstashConfig.withRedis((redis) => {
131
+ if (keys.length === 0) {
132
+ return 0;
133
+ }
134
+ return redis.del(...keys);
135
+ });
136
+ });
137
+ /**
138
+ * EXISTS a key.
139
+ */
140
+ const exists = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
141
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
142
+ const count = yield redis.exists(key);
143
+ return count > 0;
144
+ }));
145
+ });
146
+ /**
147
+ * EXPIRE a key in seconds.
148
+ */
149
+ const expire = (key, ttlSec) => tslib.__awaiter(void 0, void 0, void 0, function* () {
150
+ if (ttlSec <= 0) {
151
+ return false;
152
+ }
153
+ const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
154
+ const changed = yield redis.expire(key, ttlSec);
155
+ return changed > 0;
156
+ }));
157
+ return result !== null && result !== void 0 ? result : false;
158
+ });
159
+ /**
160
+ * TTL for a key in seconds. Returns null if Redis is unavailable.
161
+ */
162
+ const ttl = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
163
+ return upstashConfig.withRedis((redis) => redis.ttl(key));
164
+ });
66
165
  /**
67
166
  * Set a hash field value.
68
167
  */
69
- const setHashField = (key, field, value) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
70
- const result = yield upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
168
+ const setHashField = (key, field, value) => tslib.__awaiter(void 0, void 0, void 0, function* () {
169
+ const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
71
170
  const changed = yield redis.hset(key, { [field]: value });
72
171
  return changed > 0;
73
172
  }));
@@ -76,14 +175,43 @@ const setHashField = (key, field, value) => tslib_es6.__awaiter(void 0, void 0,
76
175
  /**
77
176
  * Get a hash field value.
78
177
  */
79
- const getHashField = (key, field) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
178
+ const getHashField = (key, field) => tslib.__awaiter(void 0, void 0, void 0, function* () {
80
179
  return upstashConfig.withRedis((redis) => redis.hget(key, field));
81
180
  });
181
+ /**
182
+ * HMSET hash fields.
183
+ */
184
+ const hmset = (key, values) => tslib.__awaiter(void 0, void 0, void 0, function* () {
185
+ const fields = Object.keys(values);
186
+ if (fields.length === 0) {
187
+ return true;
188
+ }
189
+ const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
190
+ yield redis.hset(key, values);
191
+ return true;
192
+ }));
193
+ return result !== null && result !== void 0 ? result : false;
194
+ });
195
+ /**
196
+ * HMGET hash fields.
197
+ */
198
+ const hmget = (key, fields) => tslib.__awaiter(void 0, void 0, void 0, function* () {
199
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
200
+ if (fields.length === 0) {
201
+ return {};
202
+ }
203
+ const result = yield redis.hmget(key, ...fields);
204
+ if (!result) {
205
+ return Object.fromEntries(fields.map((field) => [field, null]));
206
+ }
207
+ return result;
208
+ }));
209
+ });
82
210
  /**
83
211
  * Store a hash field as JSON string.
84
212
  */
85
- const setHashJson = (key, field, value) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
86
- const result = yield upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
213
+ const setHashJson = (key, field, value) => tslib.__awaiter(void 0, void 0, void 0, function* () {
214
+ const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
87
215
  const payload = JSON.stringify(value);
88
216
  const changed = yield redis.hset(key, { [field]: payload });
89
217
  return changed > 0;
@@ -93,8 +221,8 @@ const setHashJson = (key, field, value) => tslib_es6.__awaiter(void 0, void 0, v
93
221
  /**
94
222
  * Get a hash field stored as JSON string.
95
223
  */
96
- const getHashJson = (key, field) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
97
- return upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
224
+ const getHashJson = (key, field) => tslib.__awaiter(void 0, void 0, void 0, function* () {
225
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
98
226
  const payload = yield redis.hget(key, field);
99
227
  if (!payload) {
100
228
  return null;
@@ -110,26 +238,90 @@ const getHashJson = (key, field) => tslib_es6.__awaiter(void 0, void 0, void 0,
110
238
  /**
111
239
  * Get all hash fields.
112
240
  */
113
- const getHashAll = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
114
- return upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
241
+ const getHashAll = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
242
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
115
243
  const result = yield redis.hgetall(key);
116
244
  return result !== null && result !== void 0 ? result : {};
117
245
  }));
118
246
  });
247
+ /**
248
+ * HEXISTS a hash field.
249
+ */
250
+ const hexists = (key, field) => tslib.__awaiter(void 0, void 0, void 0, function* () {
251
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
252
+ const exists = yield redis.hexists(key, field);
253
+ return exists > 0;
254
+ }));
255
+ });
256
+ /**
257
+ * HKEYS for a hash.
258
+ */
259
+ const hkeys = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
260
+ return upstashConfig.withRedis((redis) => redis.hkeys(key));
261
+ });
262
+ /**
263
+ * HLEN for a hash.
264
+ */
265
+ const hlen = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
266
+ return upstashConfig.withRedis((redis) => redis.hlen(key));
267
+ });
119
268
  /**
120
269
  * Remove a hash field.
121
270
  */
122
- const deleteHashField = (key, field) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
123
- const result = yield upstashConfig.withRedis((redis) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
271
+ const deleteHashField = (key, field) => tslib.__awaiter(void 0, void 0, void 0, function* () {
272
+ const result = yield upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
124
273
  const removed = yield redis.hdel(key, field);
125
274
  return removed > 0;
126
275
  }));
127
276
  return result !== null && result !== void 0 ? result : false;
128
277
  });
278
+ /**
279
+ * SADD members to a set. Returns count of newly added members, or null if Redis is unavailable.
280
+ */
281
+ const sadd = (key, members) => tslib.__awaiter(void 0, void 0, void 0, function* () {
282
+ return upstashConfig.withRedis((redis) => {
283
+ if (members.length === 0) {
284
+ return 0;
285
+ }
286
+ return redis.sadd(key, members[0], ...members.slice(1));
287
+ });
288
+ });
289
+ /**
290
+ * SREM members from a set. Returns count of removed members, or null if Redis is unavailable.
291
+ */
292
+ const srem = (key, members) => tslib.__awaiter(void 0, void 0, void 0, function* () {
293
+ return upstashConfig.withRedis((redis) => {
294
+ if (members.length === 0) {
295
+ return 0;
296
+ }
297
+ return redis.srem(key, ...members);
298
+ });
299
+ });
300
+ /**
301
+ * SISMEMBER for a set member.
302
+ */
303
+ const sismember = (key, member) => tslib.__awaiter(void 0, void 0, void 0, function* () {
304
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
305
+ const exists = yield redis.sismember(key, member);
306
+ return exists > 0;
307
+ }));
308
+ });
309
+ /**
310
+ * SMEMBERS for a set.
311
+ */
312
+ const smembers = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
313
+ return upstashConfig.withRedis((redis) => redis.smembers(key));
314
+ });
315
+ /**
316
+ * SCARD for a set.
317
+ */
318
+ const scard = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
319
+ return upstashConfig.withRedis((redis) => redis.scard(key));
320
+ });
129
321
  /**
130
322
  * Push values to a list. Returns list length or null if Redis is unavailable.
131
323
  */
132
- const pushList = (key_1, values_1, ...args_1) => tslib_es6.__awaiter(void 0, [key_1, values_1, ...args_1], void 0, function* (key, values, direction = 'right') {
324
+ const pushList = (key_1, values_1, ...args_1) => tslib.__awaiter(void 0, [key_1, values_1, ...args_1], void 0, function* (key, values, direction = 'right') {
133
325
  return upstashConfig.withRedis((redis) => {
134
326
  if (values.length === 0) {
135
327
  return redis.llen(key);
@@ -142,34 +334,62 @@ const pushList = (key_1, values_1, ...args_1) => tslib_es6.__awaiter(void 0, [ke
142
334
  /**
143
335
  * Pop a value from a list.
144
336
  */
145
- const popList = (key_1, ...args_1) => tslib_es6.__awaiter(void 0, [key_1, ...args_1], void 0, function* (key, direction = 'right') {
337
+ const popList = (key_1, ...args_1) => tslib.__awaiter(void 0, [key_1, ...args_1], void 0, function* (key, direction = 'right') {
146
338
  return upstashConfig.withRedis((redis) => direction === 'left' ? redis.lpop(key) : redis.rpop(key));
147
339
  });
148
340
  /**
149
341
  * Get a range from a list.
150
342
  */
151
- const rangeList = (key_1, ...args_1) => tslib_es6.__awaiter(void 0, [key_1, ...args_1], void 0, function* (key, start = 0, stop = -1) {
343
+ const rangeList = (key_1, ...args_1) => tslib.__awaiter(void 0, [key_1, ...args_1], void 0, function* (key, start = 0, stop = -1) {
152
344
  return upstashConfig.withRedis((redis) => redis.lrange(key, start, stop));
153
345
  });
154
346
  /**
155
347
  * Get list length.
156
348
  */
157
- const listLength = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
349
+ const listLength = (key) => tslib.__awaiter(void 0, void 0, void 0, function* () {
158
350
  return upstashConfig.withRedis((redis) => redis.llen(key));
159
351
  });
352
+ /**
353
+ * Execute a Redis pipeline and return the result array from exec().
354
+ */
355
+ const pipeline = (build) => tslib.__awaiter(void 0, void 0, void 0, function* () {
356
+ return upstashConfig.withRedis((redis) => tslib.__awaiter(void 0, void 0, void 0, function* () {
357
+ const pipeline = redis.pipeline();
358
+ return build(pipeline).exec();
359
+ }));
360
+ });
160
361
 
362
+ exports.del = del;
161
363
  exports.deleteHashField = deleteHashField;
162
364
  exports.deleteKey = deleteKey;
365
+ exports.exists = exists;
366
+ exports.expire = expire;
163
367
  exports.getHashAll = getHashAll;
164
368
  exports.getHashField = getHashField;
165
369
  exports.getHashJson = getHashJson;
166
370
  exports.getJson = getJson;
167
371
  exports.getString = getString;
372
+ exports.hexists = hexists;
373
+ exports.hkeys = hkeys;
374
+ exports.hlen = hlen;
375
+ exports.hmget = hmget;
376
+ exports.hmset = hmset;
168
377
  exports.listLength = listLength;
378
+ exports.mget = mget;
379
+ exports.mgetJson = mgetJson;
380
+ exports.mset = mset;
381
+ exports.msetJson = msetJson;
382
+ exports.pipeline = pipeline;
169
383
  exports.popList = popList;
170
384
  exports.pushList = pushList;
171
385
  exports.rangeList = rangeList;
386
+ exports.sadd = sadd;
387
+ exports.scard = scard;
172
388
  exports.setHashField = setHashField;
173
389
  exports.setHashJson = setHashJson;
174
390
  exports.setJson = setJson;
175
391
  exports.setString = setString;
392
+ exports.sismember = sismember;
393
+ exports.smembers = smembers;
394
+ exports.srem = srem;
395
+ exports.ttl = ttl;
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs';
1
+ import { __awaiter } from 'tslib';
2
2
  import { withRedis } from '../upstash-config.mjs';
3
3
 
4
4
  /**
@@ -20,6 +20,30 @@ const setString = (key, value, ttlSec) => __awaiter(void 0, void 0, void 0, func
20
20
  const getString = (key) => __awaiter(void 0, void 0, void 0, function* () {
21
21
  return withRedis((redis) => redis.get(key));
22
22
  });
23
+ /**
24
+ * MGET plain string values. Missing keys are returned as null.
25
+ */
26
+ const mget = (keys) => __awaiter(void 0, void 0, void 0, function* () {
27
+ return withRedis((redis) => {
28
+ if (keys.length === 0) {
29
+ return [];
30
+ }
31
+ return redis.mget(...keys);
32
+ });
33
+ });
34
+ /**
35
+ * MSET plain string values.
36
+ */
37
+ const mset = (entries) => __awaiter(void 0, void 0, void 0, function* () {
38
+ const keys = Object.keys(entries);
39
+ if (keys.length === 0) {
40
+ return true;
41
+ }
42
+ return withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
43
+ yield redis.mset(entries);
44
+ return true;
45
+ })).then((result) => result !== null && result !== void 0 ? result : false);
46
+ });
23
47
  /**
24
48
  * Store an object as JSON string with optional TTL (seconds).
25
49
  */
@@ -51,6 +75,42 @@ const getJson = (key) => __awaiter(void 0, void 0, void 0, function* () {
51
75
  }
52
76
  }));
53
77
  });
78
+ /**
79
+ * MGET JSON values stored as strings. Missing or invalid values are returned as null.
80
+ */
81
+ const mgetJson = (keys) => __awaiter(void 0, void 0, void 0, function* () {
82
+ return withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
83
+ if (keys.length === 0) {
84
+ return [];
85
+ }
86
+ const payloads = yield redis.mget(...keys);
87
+ return payloads.map((payload) => {
88
+ if (!payload) {
89
+ return null;
90
+ }
91
+ try {
92
+ return JSON.parse(payload);
93
+ }
94
+ catch (_a) {
95
+ return null;
96
+ }
97
+ });
98
+ }));
99
+ });
100
+ /**
101
+ * MSET JSON values as strings.
102
+ */
103
+ const msetJson = (entries) => __awaiter(void 0, void 0, void 0, function* () {
104
+ const keys = Object.keys(entries);
105
+ if (keys.length === 0) {
106
+ return true;
107
+ }
108
+ const payloads = Object.fromEntries(Object.entries(entries).map(([key, value]) => [key, JSON.stringify(value)]));
109
+ return withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
110
+ yield redis.mset(payloads);
111
+ return true;
112
+ })).then((result) => result !== null && result !== void 0 ? result : false);
113
+ });
54
114
  /**
55
115
  * Delete a key. Returns false if Redis is unavailable.
56
116
  */
@@ -61,6 +121,45 @@ const deleteKey = (key) => __awaiter(void 0, void 0, void 0, function* () {
61
121
  }));
62
122
  return result !== null && result !== void 0 ? result : false;
63
123
  });
124
+ /**
125
+ * DEL multiple keys. Returns deleted count, or null if Redis is unavailable.
126
+ */
127
+ const del = (keys) => __awaiter(void 0, void 0, void 0, function* () {
128
+ return withRedis((redis) => {
129
+ if (keys.length === 0) {
130
+ return 0;
131
+ }
132
+ return redis.del(...keys);
133
+ });
134
+ });
135
+ /**
136
+ * EXISTS a key.
137
+ */
138
+ const exists = (key) => __awaiter(void 0, void 0, void 0, function* () {
139
+ return withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
140
+ const count = yield redis.exists(key);
141
+ return count > 0;
142
+ }));
143
+ });
144
+ /**
145
+ * EXPIRE a key in seconds.
146
+ */
147
+ const expire = (key, ttlSec) => __awaiter(void 0, void 0, void 0, function* () {
148
+ if (ttlSec <= 0) {
149
+ return false;
150
+ }
151
+ const result = yield withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
152
+ const changed = yield redis.expire(key, ttlSec);
153
+ return changed > 0;
154
+ }));
155
+ return result !== null && result !== void 0 ? result : false;
156
+ });
157
+ /**
158
+ * TTL for a key in seconds. Returns null if Redis is unavailable.
159
+ */
160
+ const ttl = (key) => __awaiter(void 0, void 0, void 0, function* () {
161
+ return withRedis((redis) => redis.ttl(key));
162
+ });
64
163
  /**
65
164
  * Set a hash field value.
66
165
  */
@@ -77,6 +176,35 @@ const setHashField = (key, field, value) => __awaiter(void 0, void 0, void 0, fu
77
176
  const getHashField = (key, field) => __awaiter(void 0, void 0, void 0, function* () {
78
177
  return withRedis((redis) => redis.hget(key, field));
79
178
  });
179
+ /**
180
+ * HMSET hash fields.
181
+ */
182
+ const hmset = (key, values) => __awaiter(void 0, void 0, void 0, function* () {
183
+ const fields = Object.keys(values);
184
+ if (fields.length === 0) {
185
+ return true;
186
+ }
187
+ const result = yield withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
188
+ yield redis.hset(key, values);
189
+ return true;
190
+ }));
191
+ return result !== null && result !== void 0 ? result : false;
192
+ });
193
+ /**
194
+ * HMGET hash fields.
195
+ */
196
+ const hmget = (key, fields) => __awaiter(void 0, void 0, void 0, function* () {
197
+ return withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
198
+ if (fields.length === 0) {
199
+ return {};
200
+ }
201
+ const result = yield redis.hmget(key, ...fields);
202
+ if (!result) {
203
+ return Object.fromEntries(fields.map((field) => [field, null]));
204
+ }
205
+ return result;
206
+ }));
207
+ });
80
208
  /**
81
209
  * Store a hash field as JSON string.
82
210
  */
@@ -114,6 +242,27 @@ const getHashAll = (key) => __awaiter(void 0, void 0, void 0, function* () {
114
242
  return result !== null && result !== void 0 ? result : {};
115
243
  }));
116
244
  });
245
+ /**
246
+ * HEXISTS a hash field.
247
+ */
248
+ const hexists = (key, field) => __awaiter(void 0, void 0, void 0, function* () {
249
+ return withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
250
+ const exists = yield redis.hexists(key, field);
251
+ return exists > 0;
252
+ }));
253
+ });
254
+ /**
255
+ * HKEYS for a hash.
256
+ */
257
+ const hkeys = (key) => __awaiter(void 0, void 0, void 0, function* () {
258
+ return withRedis((redis) => redis.hkeys(key));
259
+ });
260
+ /**
261
+ * HLEN for a hash.
262
+ */
263
+ const hlen = (key) => __awaiter(void 0, void 0, void 0, function* () {
264
+ return withRedis((redis) => redis.hlen(key));
265
+ });
117
266
  /**
118
267
  * Remove a hash field.
119
268
  */
@@ -124,6 +273,49 @@ const deleteHashField = (key, field) => __awaiter(void 0, void 0, void 0, functi
124
273
  }));
125
274
  return result !== null && result !== void 0 ? result : false;
126
275
  });
276
+ /**
277
+ * SADD members to a set. Returns count of newly added members, or null if Redis is unavailable.
278
+ */
279
+ const sadd = (key, members) => __awaiter(void 0, void 0, void 0, function* () {
280
+ return withRedis((redis) => {
281
+ if (members.length === 0) {
282
+ return 0;
283
+ }
284
+ return redis.sadd(key, members[0], ...members.slice(1));
285
+ });
286
+ });
287
+ /**
288
+ * SREM members from a set. Returns count of removed members, or null if Redis is unavailable.
289
+ */
290
+ const srem = (key, members) => __awaiter(void 0, void 0, void 0, function* () {
291
+ return withRedis((redis) => {
292
+ if (members.length === 0) {
293
+ return 0;
294
+ }
295
+ return redis.srem(key, ...members);
296
+ });
297
+ });
298
+ /**
299
+ * SISMEMBER for a set member.
300
+ */
301
+ const sismember = (key, member) => __awaiter(void 0, void 0, void 0, function* () {
302
+ return withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
303
+ const exists = yield redis.sismember(key, member);
304
+ return exists > 0;
305
+ }));
306
+ });
307
+ /**
308
+ * SMEMBERS for a set.
309
+ */
310
+ const smembers = (key) => __awaiter(void 0, void 0, void 0, function* () {
311
+ return withRedis((redis) => redis.smembers(key));
312
+ });
313
+ /**
314
+ * SCARD for a set.
315
+ */
316
+ const scard = (key) => __awaiter(void 0, void 0, void 0, function* () {
317
+ return withRedis((redis) => redis.scard(key));
318
+ });
127
319
  /**
128
320
  * Push values to a list. Returns list length or null if Redis is unavailable.
129
321
  */
@@ -155,5 +347,14 @@ const rangeList = (key_1, ...args_1) => __awaiter(void 0, [key_1, ...args_1], vo
155
347
  const listLength = (key) => __awaiter(void 0, void 0, void 0, function* () {
156
348
  return withRedis((redis) => redis.llen(key));
157
349
  });
350
+ /**
351
+ * Execute a Redis pipeline and return the result array from exec().
352
+ */
353
+ const pipeline = (build) => __awaiter(void 0, void 0, void 0, function* () {
354
+ return withRedis((redis) => __awaiter(void 0, void 0, void 0, function* () {
355
+ const pipeline = redis.pipeline();
356
+ return build(pipeline).exec();
357
+ }));
358
+ });
158
359
 
159
- export { deleteHashField, deleteKey, getHashAll, getHashField, getHashJson, getJson, getString, listLength, popList, pushList, rangeList, setHashField, setHashJson, setJson, setString };
360
+ export { del, deleteHashField, deleteKey, exists, expire, getHashAll, getHashField, getHashJson, getJson, getString, hexists, hkeys, hlen, hmget, hmset, listLength, mget, mgetJson, mset, msetJson, pipeline, popList, pushList, rangeList, sadd, scard, setHashField, setHashJson, setJson, setString, sismember, smembers, srem, ttl };
@@ -1 +1 @@
1
- {"version":3,"file":"upstash-config.d.ts","sourceRoot":"","sources":["../../src/lib/upstash-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAoIzD;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,QAAO,KAAK,GAAG,IAEnC,CAAC;AAsDF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QAAO,YAAY,GAAG,IAE3C,CAAC;AAyCF,eAAO,MAAM,SAAS,GAAU,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAMzF,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,CAAC,EAChC,IAAI,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAC3C,OAAO,CAAC,CAAC,GAAG,IAAI,CAMlB,CAAC"}
1
+ {"version":3,"file":"upstash-config.d.ts","sourceRoot":"","sources":["../../src/lib/upstash-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAwOzD;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,QAAO,KAAK,GAAG,IAEnC,CAAC;AAwDF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QAAO,YAAY,GAAG,IAE3C,CAAC;AAyCF,eAAO,MAAM,SAAS,GAAU,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAMzF,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,CAAC,EAChC,IAAI,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAC3C,OAAO,CAAC,CAAC,GAAG,IAAI,CAMlB,CAAC"}