@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,1848 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('../../../../../../_virtual/index.js');
4
- require('../../../../neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.js');
5
- var verify = require('../../../../jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js');
6
-
7
- // src/receiver.ts
8
-
9
- // src/client/api/base.ts
10
- var BaseProvider = class {
11
- baseUrl;
12
- token;
13
- owner;
14
- constructor(baseUrl, token, owner) {
15
- this.baseUrl = baseUrl;
16
- this.token = token;
17
- this.owner = owner;
18
- }
19
- getUrl() {
20
- return `${this.baseUrl}/${this.getRoute().join("/")}`;
21
- }
22
- };
23
-
24
- // src/client/api/llm.ts
25
- var LLMProvider = class extends BaseProvider {
26
- apiKind = "llm";
27
- organization;
28
- method = "POST";
29
- constructor(baseUrl, token, owner, organization) {
30
- super(baseUrl, token, owner);
31
- this.organization = organization;
32
- }
33
- getRoute() {
34
- return this.owner === "anthropic" ? ["v1", "messages"] : ["v1", "chat", "completions"];
35
- }
36
- getHeaders(options) {
37
- if (this.owner === "upstash" && !options.analytics) {
38
- return { "content-type": "application/json" };
39
- }
40
- const header = this.owner === "anthropic" ? "x-api-key" : "authorization";
41
- const headerValue = this.owner === "anthropic" ? this.token : `Bearer ${this.token}`;
42
- const headers = {
43
- [header]: headerValue,
44
- "content-type": "application/json"
45
- };
46
- if (this.owner === "openai" && this.organization) {
47
- headers["OpenAI-Organization"] = this.organization;
48
- }
49
- if (this.owner === "anthropic") {
50
- headers["anthropic-version"] = "2023-06-01";
51
- }
52
- return headers;
53
- }
54
- /**
55
- * Checks if callback exists and adds analytics in place if it's set.
56
- *
57
- * @param request
58
- * @param options
59
- */
60
- onFinish(providerInfo, options) {
61
- if (options.analytics) {
62
- return updateWithAnalytics(providerInfo, options.analytics);
63
- }
64
- return providerInfo;
65
- }
66
- };
67
- var upstash = () => {
68
- return new LLMProvider("https://qstash.upstash.io/llm", "", "upstash");
69
- };
70
-
71
- // src/client/api/utils.ts
72
- var getProviderInfo = (api, upstashToken) => {
73
- const { name, provider, ...parameters } = api;
74
- const finalProvider = provider ?? upstash();
75
- if (finalProvider.owner === "upstash" && !finalProvider.token) {
76
- finalProvider.token = upstashToken;
77
- }
78
- if (!finalProvider.baseUrl)
79
- throw new TypeError("baseUrl cannot be empty or undefined!");
80
- if (!finalProvider.token)
81
- throw new TypeError("token cannot be empty or undefined!");
82
- if (finalProvider.apiKind !== name) {
83
- throw new TypeError(
84
- `Unexpected api name. Expected '${finalProvider.apiKind}', received ${name}`
85
- );
86
- }
87
- const providerInfo = {
88
- url: finalProvider.getUrl(),
89
- baseUrl: finalProvider.baseUrl,
90
- route: finalProvider.getRoute(),
91
- appendHeaders: finalProvider.getHeaders(parameters),
92
- owner: finalProvider.owner,
93
- method: finalProvider.method
94
- };
95
- return finalProvider.onFinish(providerInfo, parameters);
96
- };
97
- var safeJoinHeaders = (headers, record) => {
98
- const joinedHeaders = new Headers(record);
99
- for (const [header, value] of headers.entries()) {
100
- joinedHeaders.set(header, value);
101
- }
102
- return joinedHeaders;
103
- };
104
- var processApi = (request, headers, upstashToken) => {
105
- if (!request.api) {
106
- request.headers = headers;
107
- return request;
108
- }
109
- const { url, appendHeaders, owner, method } = getProviderInfo(request.api, upstashToken);
110
- if (request.api.name === "llm") {
111
- const callback = request.callback;
112
- if (!callback) {
113
- throw new TypeError("Callback cannot be undefined when using LLM api.");
114
- }
115
- return {
116
- ...request,
117
- method: request.method ?? method,
118
- headers: safeJoinHeaders(headers, appendHeaders),
119
- ...owner === "upstash" && !request.api.analytics ? { api: { name: "llm" }, url: void 0, callback } : { url, api: void 0 }
120
- };
121
- } else {
122
- return {
123
- ...request,
124
- method: request.method ?? method,
125
- headers: safeJoinHeaders(headers, appendHeaders),
126
- url,
127
- api: void 0
128
- };
129
- }
130
- };
131
- function updateWithAnalytics(providerInfo, analytics) {
132
- switch (analytics.name) {
133
- case "helicone": {
134
- providerInfo.appendHeaders["Helicone-Auth"] = `Bearer ${analytics.token}`;
135
- if (providerInfo.owner === "upstash") {
136
- updateProviderInfo(providerInfo, "https://qstash.helicone.ai", [
137
- "llm",
138
- ...providerInfo.route
139
- ]);
140
- } else {
141
- providerInfo.appendHeaders["Helicone-Target-Url"] = providerInfo.baseUrl;
142
- updateProviderInfo(providerInfo, "https://gateway.helicone.ai", providerInfo.route);
143
- }
144
- return providerInfo;
145
- }
146
- default: {
147
- throw new Error("Unknown analytics provider");
148
- }
149
- }
150
- }
151
- function updateProviderInfo(providerInfo, baseUrl, route) {
152
- providerInfo.baseUrl = baseUrl;
153
- providerInfo.route = route;
154
- providerInfo.url = `${baseUrl}/${route.join("/")}`;
155
- }
156
-
157
- // src/client/error.ts
158
- var RATELIMIT_STATUS = 429;
159
- var QstashError = class extends Error {
160
- status;
161
- constructor(message, status) {
162
- super(message);
163
- this.name = "QstashError";
164
- this.status = status;
165
- }
166
- };
167
- var QstashRatelimitError = class extends QstashError {
168
- limit;
169
- remaining;
170
- reset;
171
- constructor(args) {
172
- super(`Exceeded burst rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
173
- this.name = "QstashRatelimitError";
174
- this.limit = args.limit;
175
- this.remaining = args.remaining;
176
- this.reset = args.reset;
177
- }
178
- };
179
- var QstashChatRatelimitError = class extends QstashError {
180
- limitRequests;
181
- limitTokens;
182
- remainingRequests;
183
- remainingTokens;
184
- resetRequests;
185
- resetTokens;
186
- constructor(args) {
187
- super(`Exceeded chat rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
188
- this.name = "QstashChatRatelimitError";
189
- this.limitRequests = args["limit-requests"];
190
- this.limitTokens = args["limit-tokens"];
191
- this.remainingRequests = args["remaining-requests"];
192
- this.remainingTokens = args["remaining-tokens"];
193
- this.resetRequests = args["reset-requests"];
194
- this.resetTokens = args["reset-tokens"];
195
- }
196
- };
197
- var QstashDailyRatelimitError = class extends QstashError {
198
- limit;
199
- remaining;
200
- reset;
201
- constructor(args) {
202
- super(`Exceeded daily rate limit. ${JSON.stringify(args)}`, RATELIMIT_STATUS);
203
- this.name = "QstashDailyRatelimitError";
204
- this.limit = args.limit;
205
- this.remaining = args.remaining;
206
- this.reset = args.reset;
207
- }
208
- };
209
- var QstashEmptyArrayError = class extends QstashError {
210
- constructor(parameterName) {
211
- super(
212
- `Empty array provided for query parameter "${parameterName}". This would result in no filter being applied, which could affect all resources.`
213
- );
214
- this.name = "QstashEmptyArrayError";
215
- }
216
- };
217
-
218
- // src/client/utils.ts
219
- var DEFAULT_BULK_COUNT = 100;
220
- var isIgnoredHeader = (header) => {
221
- const lowerCaseHeader = header.toLowerCase();
222
- return lowerCaseHeader.startsWith("content-type") || lowerCaseHeader.startsWith("upstash-");
223
- };
224
- function prefixHeaders(headers) {
225
- const keysToBePrefixed = [...headers.keys()].filter((key) => !isIgnoredHeader(key));
226
- for (const key of keysToBePrefixed) {
227
- const value = headers.get(key);
228
- if (value !== null) {
229
- headers.set(`Upstash-Forward-${key}`, value);
230
- }
231
- headers.delete(key);
232
- }
233
- return headers;
234
- }
235
- function wrapWithGlobalHeaders(headers, globalHeaders, telemetryHeaders) {
236
- if (!globalHeaders) {
237
- return headers;
238
- }
239
- const finalHeaders = new Headers(globalHeaders);
240
- headers.forEach((value, key) => {
241
- finalHeaders.set(key, value);
242
- });
243
- telemetryHeaders?.forEach((value, key) => {
244
- if (!value)
245
- return;
246
- finalHeaders.append(key, value);
247
- });
248
- return finalHeaders;
249
- }
250
- function processHeaders(request) {
251
- const headers = prefixHeaders(new Headers(request.headers));
252
- headers.set("Upstash-Method", request.method ?? "POST");
253
- if (request.delay !== void 0) {
254
- if (typeof request.delay === "string") {
255
- headers.set("Upstash-Delay", request.delay);
256
- } else {
257
- headers.set("Upstash-Delay", `${request.delay.toFixed(0)}s`);
258
- }
259
- }
260
- if (request.notBefore !== void 0) {
261
- headers.set("Upstash-Not-Before", request.notBefore.toFixed(0));
262
- }
263
- if (request.deduplicationId !== void 0) {
264
- headers.set("Upstash-Deduplication-Id", request.deduplicationId);
265
- }
266
- if (request.contentBasedDeduplication) {
267
- headers.set("Upstash-Content-Based-Deduplication", "true");
268
- }
269
- if (request.retries !== void 0) {
270
- headers.set("Upstash-Retries", request.retries.toFixed(0));
271
- }
272
- if (request.retryDelay !== void 0) {
273
- headers.set("Upstash-Retry-Delay", request.retryDelay);
274
- }
275
- if (request.callback !== void 0) {
276
- headers.set("Upstash-Callback", request.callback);
277
- }
278
- if (request.failureCallback !== void 0) {
279
- headers.set("Upstash-Failure-Callback", request.failureCallback);
280
- }
281
- if (request.timeout !== void 0) {
282
- if (typeof request.timeout === "string") {
283
- headers.set("Upstash-Timeout", request.timeout);
284
- } else {
285
- headers.set("Upstash-Timeout", `${request.timeout}s`);
286
- }
287
- }
288
- if (request.flowControl?.key) {
289
- const parallelism = request.flowControl.parallelism?.toString();
290
- const rate = (request.flowControl.rate ?? request.flowControl.ratePerSecond)?.toString();
291
- const period = typeof request.flowControl.period === "number" ? `${request.flowControl.period}s` : request.flowControl.period;
292
- const controlValue = [
293
- parallelism ? `parallelism=${parallelism}` : void 0,
294
- rate ? `rate=${rate}` : void 0,
295
- period ? `period=${period}` : void 0
296
- ].filter(Boolean);
297
- if (controlValue.length === 0) {
298
- throw new QstashError("Provide at least one of parallelism or ratePerSecond for flowControl");
299
- }
300
- headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
301
- headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
302
- }
303
- if (request.label !== void 0) {
304
- headers.set("Upstash-Label", request.label);
305
- }
306
- if (request.redact !== void 0) {
307
- const redactParts = [];
308
- if (request.redact.body) {
309
- redactParts.push("body");
310
- }
311
- if (request.redact.header !== void 0) {
312
- if (request.redact.header === true) {
313
- redactParts.push("header");
314
- } else if (Array.isArray(request.redact.header) && request.redact.header.length > 0) {
315
- for (const headerName of request.redact.header) {
316
- redactParts.push(`header[${headerName}]`);
317
- }
318
- }
319
- }
320
- if (redactParts.length > 0) {
321
- headers.set("Upstash-Redact-Fields", redactParts.join(","));
322
- }
323
- }
324
- return headers;
325
- }
326
- function getRequestPath(request) {
327
- const nonApiPath = request.url ?? request.urlGroup ?? request.topic;
328
- if (nonApiPath)
329
- return nonApiPath;
330
- if (request.api?.name === "llm")
331
- return `api/llm`;
332
- if (request.api?.name === "email") {
333
- const providerInfo = getProviderInfo(request.api, "not-needed");
334
- return providerInfo.baseUrl;
335
- }
336
- throw new QstashError(`Failed to infer request path for ${JSON.stringify(request)}`);
337
- }
338
- function buildBulkActionFilterPayload(request) {
339
- const cursor = "cursor" in request ? request.cursor : void 0;
340
- if ("all" in request) {
341
- const count2 = "count" in request ? request.count ?? DEFAULT_BULK_COUNT : DEFAULT_BULK_COUNT;
342
- return { count: count2, cursor };
343
- }
344
- if ("dlqIds" in request) {
345
- const ids = request.dlqIds;
346
- if (Array.isArray(ids) && ids.length === 0) {
347
- throw new QstashError(
348
- "Empty dlqIds array provided. If you intend to target all DLQ messages, use { all: true } explicitly."
349
- );
350
- }
351
- return { dlqIds: ids, cursor };
352
- }
353
- if ("messageIds" in request && request.messageIds) {
354
- if (request.messageIds.length === 0) {
355
- throw new QstashError(
356
- "Empty messageIds array provided. If you intend to target all messages, use { all: true } explicitly."
357
- );
358
- }
359
- return { messageIds: request.messageIds, cursor };
360
- }
361
- const count = "count" in request ? request.count ?? DEFAULT_BULK_COUNT : DEFAULT_BULK_COUNT;
362
- return {
363
- ...renameUrlGroup(request.filter),
364
- count,
365
- cursor
366
- };
367
- }
368
- function renameUrlGroup(filter) {
369
- const { urlGroup, api, ...rest } = filter;
370
- return { ...rest, ...urlGroup === void 0 ? {} : { topicName: urlGroup } };
371
- }
372
- function normalizeCursor(response) {
373
- const cursor = response.cursor;
374
- return { ...response, cursor: cursor || void 0 };
375
- }
376
- function getRuntime() {
377
- if (typeof process === "object" && typeof process.versions == "object" && process.versions.bun)
378
- return `bun@${process.versions.bun}`;
379
- if (typeof EdgeRuntime === "string")
380
- return "edge-light";
381
- else if (typeof process === "object" && typeof process.version === "string")
382
- return `node@${process.version}`;
383
- return "";
384
- }
385
- function getSafeEnvironment() {
386
- return typeof process === "undefined" ? {} : process.env;
387
- }
388
-
389
- // src/client/multi-region/utils.ts
390
- var VALID_REGIONS = ["EU_CENTRAL_1", "US_EAST_1"];
391
- var DEFAULT_QSTASH_URL = "https://qstash.upstash.io";
392
- var getRegionFromEnvironment = (environment) => {
393
- const region = environment.QSTASH_REGION;
394
- return normalizeRegionHeader(region);
395
- };
396
- function readEnvironmentVariables(environmentVariables, environment, region) {
397
- const result = {};
398
- for (const variable of environmentVariables) {
399
- const key = region ? `${region}_${variable}` : variable;
400
- result[variable] = environment[key];
401
- }
402
- return result;
403
- }
404
- function readClientEnvironmentVariables(environment, region) {
405
- return readEnvironmentVariables(["QSTASH_URL", "QSTASH_TOKEN"], environment, region);
406
- }
407
- function readReceiverEnvironmentVariables(environment, region) {
408
- return readEnvironmentVariables(
409
- ["QSTASH_CURRENT_SIGNING_KEY", "QSTASH_NEXT_SIGNING_KEY"],
410
- environment,
411
- region
412
- );
413
- }
414
- function normalizeRegionHeader(region) {
415
- if (!region) {
416
- return void 0;
417
- }
418
- region = region.replaceAll("-", "_").toUpperCase();
419
- if (VALID_REGIONS.includes(region)) {
420
- return region;
421
- }
422
- console.warn(
423
- `[Upstash QStash] Invalid UPSTASH_REGION header value: "${region}". Expected one of: ${VALID_REGIONS.join(
424
- ", "
425
- )}.`
426
- );
427
- return void 0;
428
- }
429
-
430
- // src/client/multi-region/incoming.ts
431
- var getReceiverSigningKeys = ({
432
- environment,
433
- regionFromHeader,
434
- config
435
- }) => {
436
- if (config?.currentSigningKey && config.nextSigningKey) {
437
- return {
438
- currentSigningKey: config.currentSigningKey,
439
- nextSigningKey: config.nextSigningKey
440
- };
441
- }
442
- const regionEnvironment = getRegionFromEnvironment(environment);
443
- if (regionEnvironment) {
444
- const regionHeader = normalizeRegionHeader(regionFromHeader);
445
- if (regionHeader) {
446
- const regionCreds = readReceiverEnvironmentVariables(environment, regionHeader);
447
- if (regionCreds.QSTASH_CURRENT_SIGNING_KEY && regionCreds.QSTASH_NEXT_SIGNING_KEY) {
448
- return {
449
- currentSigningKey: regionCreds.QSTASH_CURRENT_SIGNING_KEY,
450
- nextSigningKey: regionCreds.QSTASH_NEXT_SIGNING_KEY,
451
- region: regionHeader
452
- };
453
- } else {
454
- console.warn(
455
- `[Upstash QStash] Signing keys not found for region "${regionHeader}". Falling back to default signing keys.`
456
- );
457
- }
458
- } else {
459
- console.warn(
460
- `[Upstash QStash] Invalid UPSTASH_REGION header value: "${regionFromHeader}". Expected one of: EU-CENTRAL-1, US-EAST-1. Falling back to default signing keys.`
461
- );
462
- }
463
- }
464
- const defaultCreds = readReceiverEnvironmentVariables(environment);
465
- if (defaultCreds.QSTASH_CURRENT_SIGNING_KEY && defaultCreds.QSTASH_NEXT_SIGNING_KEY) {
466
- return {
467
- currentSigningKey: defaultCreds.QSTASH_CURRENT_SIGNING_KEY,
468
- nextSigningKey: defaultCreds.QSTASH_NEXT_SIGNING_KEY
469
- };
470
- }
471
- };
472
-
473
- // src/client/multi-region/outgoing.ts
474
- var getClientCredentials = (clientCredentialConfig) => {
475
- const credentials = resolveCredentials(clientCredentialConfig);
476
- return verifyCredentials(credentials);
477
- };
478
- var resolveCredentials = ({
479
- environment,
480
- config
481
- }) => {
482
- if (config?.baseUrl && config.token) {
483
- return {
484
- baseUrl: config.baseUrl,
485
- token: config.token
486
- };
487
- }
488
- const region = getRegionFromEnvironment(environment);
489
- if (region) {
490
- const regionCreds = readClientEnvironmentVariables(environment, region);
491
- if (regionCreds.QSTASH_URL && regionCreds.QSTASH_TOKEN) {
492
- return {
493
- baseUrl: regionCreds.QSTASH_URL,
494
- token: regionCreds.QSTASH_TOKEN,
495
- region
496
- };
497
- } else {
498
- console.warn(
499
- `[Upstash QStash] QSTASH_REGION is set to "${region}" but credentials are missing. Expected ${region}_QSTASH_URL and ${region}_QSTASH_TOKEN. Falling back to default credentials.`
500
- );
501
- }
502
- }
503
- const defaultCreds = readClientEnvironmentVariables(environment);
504
- return {
505
- baseUrl: config?.baseUrl ?? defaultCreds.QSTASH_URL ?? DEFAULT_QSTASH_URL,
506
- token: config?.token ?? defaultCreds.QSTASH_TOKEN ?? ""
507
- };
508
- };
509
- var verifyCredentials = (credentials) => {
510
- const token = credentials.token;
511
- let baseUrl = credentials.baseUrl;
512
- baseUrl = baseUrl.replace(/\/$/, "");
513
- if (baseUrl === "https://qstash.upstash.io/v2/publish") {
514
- baseUrl = DEFAULT_QSTASH_URL;
515
- }
516
- if (!token) {
517
- console.warn(
518
- "[Upstash QStash] client token is not set. Either pass a token or set QSTASH_TOKEN env variable."
519
- );
520
- }
521
- return { baseUrl, token };
522
- };
523
-
524
- // src/receiver.ts
525
- var SignatureError = class extends Error {
526
- constructor(message) {
527
- super(message);
528
- this.name = "SignatureError";
529
- }
530
- };
531
- var Receiver = class {
532
- currentSigningKey;
533
- nextSigningKey;
534
- constructor(config) {
535
- this.currentSigningKey = config?.currentSigningKey;
536
- this.nextSigningKey = config?.nextSigningKey;
537
- }
538
- /**
539
- * Verify the signature of a request.
540
- *
541
- * Tries to verify the signature with the current signing key.
542
- * If that fails, maybe because you have rotated the keys recently, it will
543
- * try to verify the signature with the next signing key.
544
- *
545
- * If that fails, the signature is invalid and a `SignatureError` is thrown.
546
- */
547
- async verify(request) {
548
- const environment = getSafeEnvironment();
549
- const signingKeys = getReceiverSigningKeys({
550
- environment,
551
- regionFromHeader: request.upstashRegion,
552
- config: {
553
- currentSigningKey: this.currentSigningKey,
554
- nextSigningKey: this.nextSigningKey
555
- }
556
- });
557
- if (!signingKeys) {
558
- throw new Error(
559
- "[Upstash QStash] No signing keys available for verification. See the warning above for more details."
560
- );
561
- }
562
- let payload;
563
- try {
564
- payload = await this.verifyWithKey(signingKeys.currentSigningKey, request);
565
- } catch {
566
- payload = await this.verifyWithKey(signingKeys.nextSigningKey, request);
567
- }
568
- this.verifyBodyAndUrl(payload, request);
569
- return true;
570
- }
571
- /**
572
- * Verify signature with a specific signing key
573
- */
574
- async verifyWithKey(key, request) {
575
- const jwt = await verify.jwtVerify(request.signature, new TextEncoder().encode(key), {
576
- issuer: "Upstash",
577
- clockTolerance: request.clockTolerance
578
- }).catch((error) => {
579
- throw new SignatureError(error.message);
580
- });
581
- return jwt.payload;
582
- }
583
- verifyBodyAndUrl(payload, request) {
584
- const p = payload;
585
- if (request.url !== void 0 && p.sub !== request.url) {
586
- throw new SignatureError(`invalid subject: ${p.sub}, want: ${request.url}`);
587
- }
588
- const bodyHash = index.default.SHA256(request.body).toString(index.default.enc.Base64url);
589
- const padding = new RegExp(/=+$/);
590
- if (p.body.replace(padding, "") !== bodyHash.replace(padding, "")) {
591
- throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${bodyHash}`);
592
- }
593
- }
594
- };
595
-
596
- // src/client/dlq.ts
597
- var DLQ = class {
598
- http;
599
- constructor(http) {
600
- this.http = http;
601
- }
602
- /**
603
- * List messages in the dlq
604
- *
605
- * Can be called with:
606
- * - Filters: `listMessages({ filter: { url: "https://example.com" } })`
607
- * - DLQ IDs: `listMessages({ dlqIds: ["id1", "id2"] })`
608
- * - No filter (list all): `listMessages()`
609
- */
610
- async listMessages(options = {}) {
611
- const query = {
612
- count: options.count,
613
- ..."dlqIds" in options ? { dlqIds: options.dlqIds } : { ...renameUrlGroup(options.filter ?? {}), cursor: options.cursor }
614
- };
615
- const messagesPayload = await this.http.request({
616
- method: "GET",
617
- path: ["v2", "dlq"],
618
- query
619
- });
620
- return {
621
- messages: messagesPayload.messages.map((message) => {
622
- return {
623
- ...message,
624
- urlGroup: message.topicName,
625
- ratePerSecond: "rate" in message ? message.rate : void 0
626
- };
627
- }),
628
- cursor: messagesPayload.cursor
629
- };
630
- }
631
- /**
632
- * Remove messages from the dlq.
633
- *
634
- * Can be called with:
635
- * - A single dlqId: `delete("id")`
636
- * - An array of dlqIds: `delete(["id1", "id2"])`
637
- * - An object with dlqIds: `delete({ dlqIds: ["id1", "id2"] })`
638
- * - A filter object: `delete({ filter: { url: "https://example.com", label: "label" } })`
639
- * - All messages: `delete({ all: true })`
640
- *
641
- * Pass `count` to limit the number of messages processed per call (defaults to 100).
642
- * Call in a loop until cursor is undefined:
643
- *
644
- * ```ts
645
- * let cursor: string | undefined;
646
- * do {
647
- * const result = await dlq.delete({ all: true, count: 100, cursor });
648
- * cursor = result.cursor;
649
- * } while (cursor);
650
- * ```
651
- */
652
- async delete(request) {
653
- if (typeof request === "string") {
654
- await this.http.request({
655
- method: "DELETE",
656
- path: ["v2", "dlq", request],
657
- parseResponseAsJson: false
658
- });
659
- return { deleted: 1 };
660
- }
661
- if (Array.isArray(request) && request.length === 0)
662
- return { deleted: 0 };
663
- const filters = Array.isArray(request) ? { dlqIds: request } : request;
664
- return await this.http.request({
665
- method: "DELETE",
666
- path: ["v2", "dlq"],
667
- query: buildBulkActionFilterPayload(filters)
668
- });
669
- }
670
- /**
671
- * Remove multiple messages from the dlq using their `dlqId`s
672
- *
673
- * @deprecated Use `delete` instead
674
- */
675
- async deleteMany(request) {
676
- return await this.delete(request);
677
- }
678
- /**
679
- * Retry messages from the dlq.
680
- *
681
- * Can be called with:
682
- * - A single dlqId: `retry("id")`
683
- * - An array of dlqIds: `retry(["id1", "id2"])`
684
- * - An object with dlqIds: `retry({ dlqIds: ["id1", "id2"] })`
685
- * - A filter object: `retry({ filter: { url: "https://example.com", label: "label" } })`
686
- * - All messages: `retry({ all: true })`
687
- *
688
- * Pass `count` to limit the number of messages processed per call (defaults to 100).
689
- * Call in a loop until cursor is undefined:
690
- *
691
- * ```ts
692
- * let cursor: string | undefined;
693
- * do {
694
- * const result = await dlq.retry({ all: true, count: 100, cursor });
695
- * cursor = result.cursor;
696
- * } while (cursor);
697
- * ```
698
- */
699
- async retry(request) {
700
- if (typeof request === "string")
701
- request = [request];
702
- if (Array.isArray(request) && request.length === 0)
703
- return { responses: [] };
704
- const filters = Array.isArray(request) ? { dlqIds: request } : request;
705
- return normalizeCursor(
706
- await this.http.request({
707
- method: "POST",
708
- path: ["v2", "dlq", "retry"],
709
- query: buildBulkActionFilterPayload(filters)
710
- })
711
- );
712
- }
713
- };
714
-
715
- // src/client/flow-control.ts
716
- var FlowControlApi = class {
717
- http;
718
- constructor(http) {
719
- this.http = http;
720
- }
721
- /**
722
- * Get a single flow control by key.
723
- */
724
- async get(flowControlKey) {
725
- return await this.http.request({
726
- method: "GET",
727
- path: ["v2", "flowControl", flowControlKey]
728
- });
729
- }
730
- /**
731
- * Get the global parallelism info.
732
- */
733
- async getGlobalParallelism() {
734
- const response = await this.http.request({
735
- method: "GET",
736
- path: ["v2", "globalParallelism"]
737
- });
738
- return {
739
- parallelismMax: response.parallelismMax ?? 0,
740
- parallelismCount: response.parallelismCount ?? 0
741
- };
742
- }
743
- /**
744
- * Pause message delivery for a flow-control key.
745
- *
746
- * Messages already in the waitlist will remain there.
747
- * New incoming messages will be added directly to the waitlist.
748
- */
749
- async pause(flowControlKey) {
750
- await this.http.request({
751
- method: "POST",
752
- path: ["v2", "flowControl", flowControlKey, "pause"],
753
- parseResponseAsJson: false
754
- });
755
- }
756
- /**
757
- * Resume message delivery for a flow-control key.
758
- */
759
- async resume(flowControlKey) {
760
- await this.http.request({
761
- method: "POST",
762
- path: ["v2", "flowControl", flowControlKey, "resume"],
763
- parseResponseAsJson: false
764
- });
765
- }
766
- /**
767
- * Pin a processing configuration for a flow-control key.
768
- *
769
- * While pinned, the system ignores configurations provided by incoming
770
- * messages and uses the pinned configuration instead.
771
- */
772
- async pin(flowControlKey, options) {
773
- await this.http.request({
774
- method: "POST",
775
- path: ["v2", "flowControl", flowControlKey, "pin"],
776
- query: {
777
- parallelism: options.parallelism,
778
- rate: options.rate,
779
- period: options.period
780
- },
781
- parseResponseAsJson: false
782
- });
783
- }
784
- /**
785
- * Remove the pinned configuration for a flow-control key.
786
- *
787
- * After unpinning, the system resumes updating the configuration
788
- * based on incoming messages.
789
- */
790
- async unpin(flowControlKey, options) {
791
- await this.http.request({
792
- method: "POST",
793
- path: ["v2", "flowControl", flowControlKey, "unpin"],
794
- query: {
795
- parallelism: options.parallelism,
796
- rate: options.rate
797
- },
798
- parseResponseAsJson: false
799
- });
800
- }
801
- /**
802
- * Reset the rate configuration state for a flow-control key.
803
- *
804
- * Clears the current rate count and immediately ends the current period.
805
- * The current timestamp becomes the start of the new rate period.
806
- */
807
- async resetRate(flowControlKey) {
808
- await this.http.request({
809
- method: "POST",
810
- path: ["v2", "flowControl", flowControlKey, "resetRate"],
811
- parseResponseAsJson: false
812
- });
813
- }
814
- };
815
-
816
- // src/client/http.ts
817
- var HttpClient = class {
818
- baseUrl;
819
- authorization;
820
- options;
821
- retry;
822
- headers;
823
- telemetryHeaders;
824
- constructor(config) {
825
- this.baseUrl = config.baseUrl.replace(/\/$/, "");
826
- this.authorization = config.authorization;
827
- this.retry = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
828
- typeof config.retry === "boolean" && !config.retry ? {
829
- attempts: 1,
830
- backoff: () => 0
831
- } : {
832
- attempts: config.retry?.retries ?? 5,
833
- backoff: config.retry?.backoff ?? ((retryCount) => Math.exp(retryCount) * 50)
834
- };
835
- this.headers = config.headers;
836
- this.telemetryHeaders = config.telemetryHeaders;
837
- }
838
- async request(request) {
839
- const { response } = await this.requestWithBackoff(request);
840
- if (request.parseResponseAsJson === false) {
841
- return void 0;
842
- }
843
- return await response.json();
844
- }
845
- async *requestStream(request) {
846
- const { response } = await this.requestWithBackoff(request);
847
- if (!response.body) {
848
- throw new Error("No response body");
849
- }
850
- const body = response.body;
851
- const reader = body.getReader();
852
- const decoder = new TextDecoder();
853
- try {
854
- while (true) {
855
- const { done, value } = await reader.read();
856
- if (done) {
857
- break;
858
- }
859
- const chunkText = decoder.decode(value, { stream: true });
860
- const chunks = chunkText.split("\n").filter(Boolean);
861
- for (const chunk of chunks) {
862
- if (chunk.startsWith("data: ")) {
863
- const data = chunk.slice(6);
864
- if (data === "[DONE]") {
865
- break;
866
- }
867
- yield JSON.parse(data);
868
- }
869
- }
870
- }
871
- } finally {
872
- await reader.cancel();
873
- }
874
- }
875
- requestWithBackoff = async (request) => {
876
- const [url, requestOptions] = this.processRequest(request);
877
- let response = void 0;
878
- let error = void 0;
879
- for (let index = 0; index <= this.retry.attempts; index++) {
880
- try {
881
- response = await fetch(url.toString(), requestOptions);
882
- break;
883
- } catch (error_) {
884
- error = error_;
885
- if (index < this.retry.attempts) {
886
- await new Promise((r) => setTimeout(r, this.retry.backoff(index)));
887
- }
888
- }
889
- }
890
- if (!response) {
891
- throw error ?? new Error("Exhausted all retries");
892
- }
893
- await this.checkResponse(response);
894
- return {
895
- response,
896
- error
897
- };
898
- };
899
- processRequest = (request) => {
900
- const headers = new Headers(request.headers);
901
- if (!headers.has("Authorization")) {
902
- headers.set("Authorization", this.authorization);
903
- }
904
- const requestOptions = {
905
- method: request.method,
906
- headers,
907
- body: request.body,
908
- keepalive: request.keepalive
909
- };
910
- const url = new URL([request.baseUrl ?? this.baseUrl, ...request.path].join("/"));
911
- if (request.query) {
912
- for (const [key, value] of Object.entries(request.query)) {
913
- if (value === void 0)
914
- continue;
915
- if (Array.isArray(value)) {
916
- if (value.length === 0) {
917
- throw new QstashEmptyArrayError(key);
918
- }
919
- for (const item of value) {
920
- url.searchParams.append(key, item);
921
- }
922
- } else if (value instanceof Date) {
923
- url.searchParams.set(key, value.getTime().toString());
924
- } else {
925
- url.searchParams.set(key, value.toString());
926
- }
927
- }
928
- }
929
- return [url.toString(), requestOptions];
930
- };
931
- async checkResponse(response) {
932
- if (response.status === 429) {
933
- if (response.headers.get("x-ratelimit-limit-requests")) {
934
- throw new QstashChatRatelimitError({
935
- "limit-requests": response.headers.get("x-ratelimit-limit-requests"),
936
- "limit-tokens": response.headers.get("x-ratelimit-limit-tokens"),
937
- "remaining-requests": response.headers.get("x-ratelimit-remaining-requests"),
938
- "remaining-tokens": response.headers.get("x-ratelimit-remaining-tokens"),
939
- "reset-requests": response.headers.get("x-ratelimit-reset-requests"),
940
- "reset-tokens": response.headers.get("x-ratelimit-reset-tokens")
941
- });
942
- } else if (response.headers.get("RateLimit-Limit")) {
943
- throw new QstashDailyRatelimitError({
944
- limit: response.headers.get("RateLimit-Limit"),
945
- remaining: response.headers.get("RateLimit-Remaining"),
946
- reset: response.headers.get("RateLimit-Reset")
947
- });
948
- }
949
- throw new QstashRatelimitError({
950
- limit: response.headers.get("Burst-RateLimit-Limit"),
951
- remaining: response.headers.get("Burst-RateLimit-Remaining"),
952
- reset: response.headers.get("Burst-RateLimit-Reset")
953
- });
954
- }
955
- if (response.status < 200 || response.status >= 300) {
956
- const body = await response.text();
957
- throw new QstashError(
958
- body.length > 0 ? body : `Error: status=${response.status}`,
959
- response.status
960
- );
961
- }
962
- }
963
- };
964
-
965
- // src/client/llm/providers.ts
966
- var setupAnalytics = (analytics, providerApiKey, providerBaseUrl, provider) => {
967
- if (!analytics)
968
- return {};
969
- switch (analytics.name) {
970
- case "helicone": {
971
- switch (provider) {
972
- case "upstash": {
973
- return {
974
- baseURL: "https://qstash.helicone.ai/llm/v1/chat/completions",
975
- defaultHeaders: {
976
- "Helicone-Auth": `Bearer ${analytics.token}`,
977
- Authorization: `Bearer ${providerApiKey}`
978
- }
979
- };
980
- }
981
- default: {
982
- return {
983
- baseURL: "https://gateway.helicone.ai/v1/chat/completions",
984
- defaultHeaders: {
985
- "Helicone-Auth": `Bearer ${analytics.token}`,
986
- "Helicone-Target-Url": providerBaseUrl,
987
- Authorization: `Bearer ${providerApiKey}`
988
- }
989
- };
990
- }
991
- }
992
- }
993
- default: {
994
- throw new Error("Unknown analytics provider");
995
- }
996
- }
997
- };
998
-
999
- // src/client/llm/chat.ts
1000
- var Chat = class _Chat {
1001
- http;
1002
- token;
1003
- constructor(http, token) {
1004
- this.http = http;
1005
- this.token = token;
1006
- }
1007
- static toChatRequest(request) {
1008
- const messages = [];
1009
- messages.push(
1010
- { role: "system", content: request.system },
1011
- { role: "user", content: request.user }
1012
- );
1013
- const chatRequest = { ...request, messages };
1014
- return chatRequest;
1015
- }
1016
- /**
1017
- * Calls the Upstash completions api given a ChatRequest.
1018
- *
1019
- * Returns a ChatCompletion or a stream of ChatCompletionChunks
1020
- * if stream is enabled.
1021
- *
1022
- * @param request ChatRequest with messages
1023
- * @returns Chat completion or stream
1024
- */
1025
- create = async (request) => {
1026
- if (request.provider.owner != "upstash")
1027
- return this.createThirdParty(request);
1028
- const body = JSON.stringify(request);
1029
- let baseUrl = void 0;
1030
- let headers = {
1031
- "Content-Type": "application/json",
1032
- Authorization: `Bearer ${this.token}`,
1033
- ..."stream" in request && request.stream ? {
1034
- Connection: "keep-alive",
1035
- Accept: "text/event-stream",
1036
- "Cache-Control": "no-cache"
1037
- } : {}
1038
- };
1039
- if (request.analytics) {
1040
- const { baseURL, defaultHeaders } = setupAnalytics(
1041
- { name: "helicone", token: request.analytics.token },
1042
- this.getAuthorizationToken(),
1043
- request.provider.baseUrl,
1044
- "upstash"
1045
- );
1046
- headers = { ...headers, ...defaultHeaders };
1047
- baseUrl = baseURL;
1048
- }
1049
- const path = request.analytics ? [] : ["llm", "v1", "chat", "completions"];
1050
- return "stream" in request && request.stream ? this.http.requestStream({
1051
- path,
1052
- method: "POST",
1053
- headers,
1054
- baseUrl,
1055
- body
1056
- }) : this.http.request({
1057
- path,
1058
- method: "POST",
1059
- headers,
1060
- baseUrl,
1061
- body
1062
- });
1063
- };
1064
- /**
1065
- * Calls the Upstash completions api given a ChatRequest.
1066
- *
1067
- * Returns a ChatCompletion or a stream of ChatCompletionChunks
1068
- * if stream is enabled.
1069
- *
1070
- * @param request ChatRequest with messages
1071
- * @returns Chat completion or stream
1072
- */
1073
- createThirdParty = async (request) => {
1074
- const { baseUrl, token, owner, organization } = request.provider;
1075
- if (owner === "upstash")
1076
- throw new Error("Upstash is not 3rd party provider!");
1077
- delete request.provider;
1078
- delete request.system;
1079
- const analytics = request.analytics;
1080
- delete request.analytics;
1081
- const body = JSON.stringify(request);
1082
- const isAnalyticsEnabled = analytics?.name && analytics.token;
1083
- const analyticsConfig = analytics?.name && analytics.token ? setupAnalytics({ name: analytics.name, token: analytics.token }, token, baseUrl, owner) : { defaultHeaders: void 0, baseURL: baseUrl };
1084
- const isStream = "stream" in request && request.stream;
1085
- const headers = {
1086
- "Content-Type": "application/json",
1087
- Authorization: `Bearer ${token}`,
1088
- ...organization ? {
1089
- "OpenAI-Organization": organization
1090
- } : {},
1091
- ...isStream ? {
1092
- Connection: "keep-alive",
1093
- Accept: "text/event-stream",
1094
- "Cache-Control": "no-cache"
1095
- } : {},
1096
- ...analyticsConfig.defaultHeaders
1097
- };
1098
- const response = await this.http[isStream ? "requestStream" : "request"]({
1099
- path: isAnalyticsEnabled ? [] : ["v1", "chat", "completions"],
1100
- method: "POST",
1101
- headers,
1102
- body,
1103
- baseUrl: analyticsConfig.baseURL
1104
- });
1105
- return response;
1106
- };
1107
- // Helper method to get the authorization token
1108
- getAuthorizationToken() {
1109
- const authHeader = String(this.http.authorization);
1110
- const match = /Bearer (.+)/.exec(authHeader);
1111
- if (!match) {
1112
- throw new Error("Invalid authorization header format");
1113
- }
1114
- return match[1];
1115
- }
1116
- /**
1117
- * Calls the Upstash completions api given a PromptRequest.
1118
- *
1119
- * Returns a ChatCompletion or a stream of ChatCompletionChunks
1120
- * if stream is enabled.
1121
- *
1122
- * @param request PromptRequest with system and user messages.
1123
- * Note that system parameter shouldn't be passed in the case of
1124
- * mistralai/Mistral-7B-Instruct-v0.2 model.
1125
- * @returns Chat completion or stream
1126
- */
1127
- prompt = async (request) => {
1128
- const chatRequest = _Chat.toChatRequest(request);
1129
- return this.create(chatRequest);
1130
- };
1131
- };
1132
-
1133
- // src/client/messages.ts
1134
- var Messages = class {
1135
- http;
1136
- constructor(http) {
1137
- this.http = http;
1138
- }
1139
- /**
1140
- * Get a message
1141
- */
1142
- async get(messageId) {
1143
- const messagePayload = await this.http.request({
1144
- method: "GET",
1145
- path: ["v2", "messages", messageId]
1146
- });
1147
- const message = {
1148
- ...messagePayload,
1149
- urlGroup: messagePayload.topicName,
1150
- ratePerSecond: "rate" in messagePayload ? messagePayload.rate : void 0
1151
- };
1152
- return message;
1153
- }
1154
- /**
1155
- * Cancel messages.
1156
- *
1157
- * Can be called with:
1158
- * - A single messageId: `cancel("id")`
1159
- * - An array of messageIds: `cancel(["id1", "id2"])`
1160
- * - A filter object: `cancel({ filter: { flowControlKey: "key", label: "label" } })`
1161
- * - All messages: `cancel({ all: true })`
1162
- *
1163
- * Pass `count` to limit the number of messages processed per call (defaults to 100).
1164
- * Call in a loop until `cancelled` is 0:
1165
- *
1166
- * ```ts
1167
- * let cancelled: number;
1168
- * do {
1169
- * const result = await messages.cancel({ all: true, count: 100 });
1170
- * cancelled = result.cancelled;
1171
- * } while (cancelled > 0);
1172
- * ```
1173
- */
1174
- async cancel(request) {
1175
- if (typeof request === "string") {
1176
- return await this.http.request({
1177
- method: "DELETE",
1178
- path: ["v2", "messages", request]
1179
- });
1180
- }
1181
- if (Array.isArray(request) && request.length === 0)
1182
- return { cancelled: 0 };
1183
- const filters = Array.isArray(request) ? { messageIds: request } : request;
1184
- return await this.http.request({
1185
- method: "DELETE",
1186
- path: ["v2", "messages"],
1187
- query: buildBulkActionFilterPayload(filters)
1188
- });
1189
- }
1190
- /**
1191
- * Delete a message.
1192
- *
1193
- * @deprecated Use `cancel(messageId: string)` instead
1194
- */
1195
- async delete(messageId) {
1196
- await this.http.request({
1197
- method: "DELETE",
1198
- path: ["v2", "messages", messageId],
1199
- parseResponseAsJson: false
1200
- });
1201
- }
1202
- /**
1203
- * Cancel multiple messages by their messageIds.
1204
- *
1205
- * @deprecated Use `cancel(messageIds: string[])` instead
1206
- */
1207
- async deleteMany(messageIds) {
1208
- const result = await this.cancel(messageIds);
1209
- return result.cancelled;
1210
- }
1211
- /**
1212
- * Cancel all messages
1213
- * @deprecated Use `cancel({all: true})` to cancel all
1214
- */
1215
- async deleteAll() {
1216
- const result = await this.cancel({ all: true });
1217
- return result.cancelled;
1218
- }
1219
- };
1220
-
1221
- // src/client/queue.ts
1222
- var Queue = class {
1223
- http;
1224
- queueName;
1225
- constructor(http, queueName) {
1226
- this.http = http;
1227
- this.queueName = queueName;
1228
- }
1229
- /**
1230
- * Create or update the queue
1231
- */
1232
- async upsert(request) {
1233
- if (!this.queueName) {
1234
- throw new Error("Please provide a queue name to the Queue constructor");
1235
- }
1236
- const body = {
1237
- queueName: this.queueName,
1238
- parallelism: request.parallelism ?? 1,
1239
- paused: request.paused ?? false
1240
- };
1241
- await this.http.request({
1242
- method: "POST",
1243
- path: ["v2", "queues"],
1244
- headers: {
1245
- "Content-Type": "application/json"
1246
- },
1247
- body: JSON.stringify(body),
1248
- parseResponseAsJson: false
1249
- });
1250
- }
1251
- /**
1252
- * Get the queue details
1253
- */
1254
- async get() {
1255
- if (!this.queueName) {
1256
- throw new Error("Please provide a queue name to the Queue constructor");
1257
- }
1258
- return await this.http.request({
1259
- method: "GET",
1260
- path: ["v2", "queues", this.queueName]
1261
- });
1262
- }
1263
- /**
1264
- * List queues
1265
- */
1266
- async list() {
1267
- return await this.http.request({
1268
- method: "GET",
1269
- path: ["v2", "queues"]
1270
- });
1271
- }
1272
- /**
1273
- * Delete the queue
1274
- */
1275
- async delete() {
1276
- if (!this.queueName) {
1277
- throw new Error("Please provide a queue name to the Queue constructor");
1278
- }
1279
- await this.http.request({
1280
- method: "DELETE",
1281
- path: ["v2", "queues", this.queueName],
1282
- parseResponseAsJson: false
1283
- });
1284
- }
1285
- /**
1286
- * Enqueue a message to a queue.
1287
- */
1288
- async enqueue(request) {
1289
- if (!this.queueName) {
1290
- throw new Error("Please provide a queue name to the Queue constructor");
1291
- }
1292
- const headers = wrapWithGlobalHeaders(
1293
- processHeaders(request),
1294
- this.http.headers,
1295
- this.http.telemetryHeaders
1296
- );
1297
- const destination = getRequestPath(request);
1298
- const response = await this.http.request({
1299
- path: ["v2", "enqueue", this.queueName, destination],
1300
- body: request.body,
1301
- headers,
1302
- method: "POST"
1303
- });
1304
- return response;
1305
- }
1306
- /**
1307
- * Enqueue a message to a queue, serializing the body to JSON.
1308
- */
1309
- async enqueueJSON(request) {
1310
- const headers = prefixHeaders(new Headers(request.headers));
1311
- headers.set("Content-Type", "application/json");
1312
- const upstashToken = String(this.http.authorization).split("Bearer ")[1];
1313
- const nonApiRequest = processApi(request, headers, upstashToken);
1314
- const response = await this.enqueue({
1315
- ...nonApiRequest,
1316
- body: JSON.stringify(nonApiRequest.body)
1317
- });
1318
- return response;
1319
- }
1320
- /**
1321
- * Pauses the queue.
1322
- *
1323
- * A paused queue will not deliver messages until
1324
- * it is resumed.
1325
- */
1326
- async pause() {
1327
- if (!this.queueName) {
1328
- throw new Error("Please provide a queue name to the Queue constructor");
1329
- }
1330
- await this.http.request({
1331
- method: "POST",
1332
- path: ["v2", "queues", this.queueName, "pause"],
1333
- parseResponseAsJson: false
1334
- });
1335
- }
1336
- /**
1337
- * Resumes the queue.
1338
- */
1339
- async resume() {
1340
- if (!this.queueName) {
1341
- throw new Error("Please provide a queue name to the Queue constructor");
1342
- }
1343
- await this.http.request({
1344
- method: "POST",
1345
- path: ["v2", "queues", this.queueName, "resume"],
1346
- parseResponseAsJson: false
1347
- });
1348
- }
1349
- };
1350
-
1351
- // src/client/schedules.ts
1352
- var Schedules = class {
1353
- http;
1354
- constructor(http) {
1355
- this.http = http;
1356
- }
1357
- /**
1358
- * Create a schedule
1359
- */
1360
- async create(request) {
1361
- const headers = prefixHeaders(new Headers(request.headers));
1362
- if (!headers.has("Content-Type")) {
1363
- headers.set("Content-Type", "application/json");
1364
- }
1365
- headers.set("Upstash-Cron", request.cron);
1366
- if (request.method !== void 0) {
1367
- headers.set("Upstash-Method", request.method);
1368
- }
1369
- if (request.delay !== void 0) {
1370
- if (typeof request.delay === "string") {
1371
- headers.set("Upstash-Delay", request.delay);
1372
- } else {
1373
- headers.set("Upstash-Delay", `${request.delay.toFixed(0)}s`);
1374
- }
1375
- }
1376
- if (request.retries !== void 0) {
1377
- headers.set("Upstash-Retries", request.retries.toFixed(0));
1378
- }
1379
- if (request.retryDelay !== void 0) {
1380
- headers.set("Upstash-Retry-Delay", request.retryDelay);
1381
- }
1382
- if (request.callback !== void 0) {
1383
- headers.set("Upstash-Callback", request.callback);
1384
- }
1385
- if (request.failureCallback !== void 0) {
1386
- headers.set("Upstash-Failure-Callback", request.failureCallback);
1387
- }
1388
- if (request.timeout !== void 0) {
1389
- if (typeof request.timeout === "string") {
1390
- headers.set("Upstash-Timeout", request.timeout);
1391
- } else {
1392
- headers.set("Upstash-Timeout", `${request.timeout}s`);
1393
- }
1394
- }
1395
- if (request.scheduleId !== void 0) {
1396
- headers.set("Upstash-Schedule-Id", request.scheduleId);
1397
- }
1398
- if (request.queueName !== void 0) {
1399
- headers.set("Upstash-Queue-Name", request.queueName);
1400
- }
1401
- if (request.flowControl?.key) {
1402
- const parallelism = request.flowControl.parallelism?.toString();
1403
- const rate = (request.flowControl.rate ?? request.flowControl.ratePerSecond)?.toString();
1404
- const period = typeof request.flowControl.period === "number" ? `${request.flowControl.period}s` : request.flowControl.period;
1405
- const controlValue = [
1406
- parallelism ? `parallelism=${parallelism}` : void 0,
1407
- rate ? `rate=${rate}` : void 0,
1408
- period ? `period=${period}` : void 0
1409
- ].filter(Boolean);
1410
- if (controlValue.length === 0) {
1411
- throw new QstashError(
1412
- "Provide at least one of parallelism or ratePerSecond for flowControl"
1413
- );
1414
- }
1415
- headers.set("Upstash-Flow-Control-Key", request.flowControl.key);
1416
- headers.set("Upstash-Flow-Control-Value", controlValue.join(", "));
1417
- }
1418
- if (request.label !== void 0) {
1419
- headers.set("Upstash-Label", request.label);
1420
- }
1421
- if (request.redact !== void 0) {
1422
- const redactParts = [];
1423
- if (request.redact.body) {
1424
- redactParts.push("body");
1425
- }
1426
- if (request.redact.header !== void 0) {
1427
- if (request.redact.header === true) {
1428
- redactParts.push("header");
1429
- } else if (Array.isArray(request.redact.header) && request.redact.header.length > 0) {
1430
- for (const headerName of request.redact.header) {
1431
- redactParts.push(`header[${headerName}]`);
1432
- }
1433
- }
1434
- }
1435
- if (redactParts.length > 0) {
1436
- headers.set("Upstash-Redact-Fields", redactParts.join(","));
1437
- }
1438
- }
1439
- return await this.http.request({
1440
- method: "POST",
1441
- headers: wrapWithGlobalHeaders(headers, this.http.headers, this.http.telemetryHeaders),
1442
- path: ["v2", "schedules", request.destination],
1443
- body: request.body
1444
- });
1445
- }
1446
- /**
1447
- * Get a schedule
1448
- */
1449
- async get(scheduleId) {
1450
- const schedule = await this.http.request({
1451
- method: "GET",
1452
- path: ["v2", "schedules", scheduleId]
1453
- });
1454
- if ("rate" in schedule)
1455
- schedule.ratePerSecond = schedule.rate;
1456
- return schedule;
1457
- }
1458
- /**
1459
- * List your schedules
1460
- */
1461
- async list() {
1462
- const schedules = await this.http.request({
1463
- method: "GET",
1464
- path: ["v2", "schedules"]
1465
- });
1466
- for (const schedule of schedules) {
1467
- if ("rate" in schedule)
1468
- schedule.ratePerSecond = schedule.rate;
1469
- }
1470
- return schedules;
1471
- }
1472
- /**
1473
- * Delete a schedule
1474
- */
1475
- async delete(scheduleId) {
1476
- return await this.http.request({
1477
- method: "DELETE",
1478
- path: ["v2", "schedules", scheduleId],
1479
- parseResponseAsJson: false
1480
- });
1481
- }
1482
- /**
1483
- * Pauses the schedule.
1484
- *
1485
- * A paused schedule will not deliver messages until
1486
- * it is resumed.
1487
- */
1488
- async pause({ schedule }) {
1489
- await this.http.request({
1490
- method: "PATCH",
1491
- path: ["v2", "schedules", schedule, "pause"],
1492
- parseResponseAsJson: false
1493
- });
1494
- }
1495
- /**
1496
- * Resumes the schedule.
1497
- */
1498
- async resume({ schedule }) {
1499
- await this.http.request({
1500
- method: "PATCH",
1501
- path: ["v2", "schedules", schedule, "resume"],
1502
- parseResponseAsJson: false
1503
- });
1504
- }
1505
- };
1506
-
1507
- // src/client/url-groups.ts
1508
- var UrlGroups = class {
1509
- http;
1510
- constructor(http) {
1511
- this.http = http;
1512
- }
1513
- /**
1514
- * Create a new url group with the given name and endpoints
1515
- */
1516
- async addEndpoints(request) {
1517
- await this.http.request({
1518
- method: "POST",
1519
- path: ["v2", "topics", request.name, "endpoints"],
1520
- headers: { "Content-Type": "application/json" },
1521
- body: JSON.stringify({ endpoints: request.endpoints }),
1522
- parseResponseAsJson: false
1523
- });
1524
- }
1525
- /**
1526
- * Remove endpoints from a url group.
1527
- */
1528
- async removeEndpoints(request) {
1529
- await this.http.request({
1530
- method: "DELETE",
1531
- path: ["v2", "topics", request.name, "endpoints"],
1532
- headers: { "Content-Type": "application/json" },
1533
- body: JSON.stringify({ endpoints: request.endpoints }),
1534
- parseResponseAsJson: false
1535
- });
1536
- }
1537
- /**
1538
- * Get a list of all url groups.
1539
- */
1540
- async list() {
1541
- return await this.http.request({
1542
- method: "GET",
1543
- path: ["v2", "topics"]
1544
- });
1545
- }
1546
- /**
1547
- * Get a single url group
1548
- */
1549
- async get(name) {
1550
- return await this.http.request({
1551
- method: "GET",
1552
- path: ["v2", "topics", name]
1553
- });
1554
- }
1555
- /**
1556
- * Delete a url group
1557
- */
1558
- async delete(name) {
1559
- return await this.http.request({
1560
- method: "DELETE",
1561
- path: ["v2", "topics", name],
1562
- parseResponseAsJson: false
1563
- });
1564
- }
1565
- };
1566
-
1567
- // version.ts
1568
- var VERSION = "2.10.1";
1569
-
1570
- // src/client/client.ts
1571
- var Client = class {
1572
- http;
1573
- token;
1574
- constructor(config) {
1575
- const environment = getSafeEnvironment();
1576
- const { baseUrl, token } = getClientCredentials({ environment, config });
1577
- const enableTelemetry = environment.UPSTASH_DISABLE_TELEMETRY ? false : config?.enableTelemetry ?? true;
1578
- const isCloudflare = typeof caches !== "undefined" && "default" in caches;
1579
- const telemetryHeaders = new Headers(
1580
- enableTelemetry ? {
1581
- "Upstash-Telemetry-Sdk": `upstash-qstash-js@${VERSION}`,
1582
- "Upstash-Telemetry-Platform": isCloudflare ? "cloudflare" : environment.VERCEL ? "vercel" : environment.AWS_REGION ? "aws" : "",
1583
- "Upstash-Telemetry-Runtime": getRuntime()
1584
- } : {}
1585
- );
1586
- this.http = new HttpClient({
1587
- retry: config?.retry,
1588
- baseUrl,
1589
- authorization: `Bearer ${token}`,
1590
- //@ts-expect-error caused by undici and bunjs type overlap
1591
- headers: prefixHeaders(new Headers(config?.headers ?? {})),
1592
- //@ts-expect-error caused by undici and bunjs type overlap
1593
- telemetryHeaders
1594
- });
1595
- this.token = token;
1596
- }
1597
- /**
1598
- * Access the urlGroup API.
1599
- *
1600
- * Create, read, update or delete urlGroups.
1601
- */
1602
- get urlGroups() {
1603
- return new UrlGroups(this.http);
1604
- }
1605
- /**
1606
- * Deprecated. Use urlGroups instead.
1607
- *
1608
- * Access the topic API.
1609
- *
1610
- * Create, read, update or delete topics.
1611
- */
1612
- get topics() {
1613
- return this.urlGroups;
1614
- }
1615
- /**
1616
- * Access the dlq API.
1617
- *
1618
- * List or remove messages from the DLQ.
1619
- */
1620
- get dlq() {
1621
- return new DLQ(this.http);
1622
- }
1623
- /**
1624
- * Access the message API.
1625
- *
1626
- * Read or cancel messages.
1627
- */
1628
- get messages() {
1629
- return new Messages(this.http);
1630
- }
1631
- /**
1632
- * Access the schedule API.
1633
- *
1634
- * Create, read or delete schedules.
1635
- */
1636
- get schedules() {
1637
- return new Schedules(this.http);
1638
- }
1639
- /**
1640
- * Access the flow control API.
1641
- *
1642
- * List, get, or reset flow controls.
1643
- */
1644
- get flowControl() {
1645
- return new FlowControlApi(this.http);
1646
- }
1647
- /**
1648
- * Access the workflow API.
1649
- *
1650
- * cancel workflows.
1651
- *
1652
- * @deprecated as of version 2.7.17. Will be removed in qstash-js 3.0.0.
1653
- * Please use @upstash/workflow instead https://github.com/upstash/workflow-js
1654
- * Migration Guide: https://upstash.com/docs/workflow/migration
1655
- */
1656
- get workflow() {
1657
- return new Workflow(this.http);
1658
- }
1659
- /**
1660
- * Access the queue API.
1661
- *
1662
- * Create, read, update or delete queues.
1663
- */
1664
- queue(request) {
1665
- return new Queue(this.http, request?.queueName);
1666
- }
1667
- /**
1668
- * Access the Chat API.
1669
- *
1670
- * @deprecated This will be removed in qstash-js 3.0.0. Please use an alternative SDK for interacting with LLMs.
1671
- *
1672
- * Use the create or prompt methods.
1673
- */
1674
- chat() {
1675
- return new Chat(this.http, this.token);
1676
- }
1677
- async publish(request) {
1678
- const headers = wrapWithGlobalHeaders(
1679
- processHeaders(request),
1680
- this.http.headers,
1681
- this.http.telemetryHeaders
1682
- );
1683
- const response = await this.http.request({
1684
- path: ["v2", "publish", getRequestPath(request)],
1685
- body: request.body,
1686
- headers,
1687
- method: "POST"
1688
- });
1689
- return response;
1690
- }
1691
- /**
1692
- * publishJSON is a utility wrapper around `publish` that automatically serializes the body
1693
- * and sets the `Content-Type` header to `application/json`.
1694
- */
1695
- async publishJSON(request) {
1696
- const headers = prefixHeaders(new Headers(request.headers));
1697
- headers.set("Content-Type", "application/json");
1698
- const upstashToken = String(this.http.authorization).split("Bearer ")[1];
1699
- const nonApiRequest = processApi(request, headers, upstashToken);
1700
- const response = await this.publish({
1701
- ...nonApiRequest,
1702
- body: JSON.stringify(nonApiRequest.body)
1703
- });
1704
- return response;
1705
- }
1706
- /**
1707
- * Batch publish messages to QStash.
1708
- */
1709
- async batch(request) {
1710
- const messages = [];
1711
- for (const message of request) {
1712
- const headers = wrapWithGlobalHeaders(
1713
- processHeaders(message),
1714
- this.http.headers,
1715
- this.http.telemetryHeaders
1716
- );
1717
- const headerEntries = Object.fromEntries(headers.entries());
1718
- messages.push({
1719
- destination: getRequestPath(message),
1720
- headers: headerEntries,
1721
- body: message.body,
1722
- ...message.queueName && { queue: message.queueName }
1723
- });
1724
- }
1725
- const response = await this.http.request({
1726
- path: ["v2", "batch"],
1727
- body: JSON.stringify(messages),
1728
- headers: {
1729
- "Content-Type": "application/json"
1730
- },
1731
- method: "POST"
1732
- });
1733
- const arrayResposne = Array.isArray(response) ? response : [response];
1734
- return arrayResposne;
1735
- }
1736
- /**
1737
- * Batch publish messages to QStash, serializing each body to JSON.
1738
- */
1739
- async batchJSON(request) {
1740
- const batchPayload = request.map((message) => {
1741
- if ("body" in message) {
1742
- message.body = JSON.stringify(message.body);
1743
- }
1744
- const upstashToken = String(this.http.authorization).split("Bearer ")[1];
1745
- const nonApiMessage = processApi(message, new Headers(message.headers), upstashToken);
1746
- nonApiMessage.headers.set("Content-Type", "application/json");
1747
- return nonApiMessage;
1748
- });
1749
- const response = await this.batch(batchPayload);
1750
- return response;
1751
- }
1752
- /**
1753
- * Retrieve your logs.
1754
- *
1755
- * The logs endpoint is paginated and returns only 100 logs at a time.
1756
- * If you want to receive more logs, you can use the cursor to paginate.
1757
- *
1758
- * The cursor is a unix timestamp with millisecond precision
1759
- *
1760
- * @example
1761
- * ```ts
1762
- * let cursor = Date.now()
1763
- * const logs: Log[] = []
1764
- * while (cursor > 0) {
1765
- * const res = await qstash.logs({ cursor })
1766
- * logs.push(...res.logs)
1767
- * cursor = res.cursor ?? 0
1768
- * }
1769
- * ```
1770
- */
1771
- async logs(request = {}) {
1772
- const query = {
1773
- count: request.count,
1774
- ..."messageIds" in request ? { messageIds: request.messageIds } : { ...renameUrlGroup(request.filter ?? {}), cursor: request.cursor }
1775
- };
1776
- const responsePayload = await this.http.request({
1777
- path: ["v2", "events"],
1778
- method: "GET",
1779
- query
1780
- });
1781
- const logs = responsePayload.events.map((event) => ({ ...event, urlGroup: event.topicName }));
1782
- return { cursor: responsePayload.cursor, logs, events: logs };
1783
- }
1784
- /**
1785
- * @deprecated Will be removed in the next major release. Use the `logs` method instead.
1786
- *
1787
- * Retrieve your logs.
1788
- *
1789
- * The logs endpoint is paginated and returns only 100 logs at a time.
1790
- * If you want to receive more logs, you can use the cursor to paginate.
1791
- *
1792
- * The cursor is a unix timestamp with millisecond precision
1793
- *
1794
- * @example
1795
- * ```ts
1796
- * let cursor = Date.now()
1797
- * const logs: Log[] = []
1798
- * while (cursor > 0) {
1799
- * const res = await qstash.logs({ cursor })
1800
- * logs.push(...res.logs)
1801
- * cursor = res.cursor ?? 0
1802
- * }
1803
- * ```
1804
- */
1805
- async events(request) {
1806
- return await this.logs(request);
1807
- }
1808
- };
1809
-
1810
- // src/client/workflow/index.ts
1811
- var Workflow = class {
1812
- http;
1813
- constructor(http) {
1814
- this.http = http;
1815
- }
1816
- /**
1817
- * Cancel an ongoing workflow
1818
- *
1819
- * @param workflowRunId run id of the workflow to delete
1820
- * @returns true if workflow is succesfully deleted. Otherwise throws QStashError
1821
- */
1822
- async cancel(workflowRunId) {
1823
- const result = await this.http.request({
1824
- path: ["v2", "workflows", "runs", `${workflowRunId}?cancel=true`],
1825
- method: "DELETE",
1826
- parseResponseAsJson: false
1827
- });
1828
- return result ?? true;
1829
- }
1830
- };
1831
-
1832
- exports.BaseProvider = BaseProvider;
1833
- exports.Chat = Chat;
1834
- exports.Client = Client;
1835
- exports.FlowControlApi = FlowControlApi;
1836
- exports.Messages = Messages;
1837
- exports.QstashChatRatelimitError = QstashChatRatelimitError;
1838
- exports.QstashDailyRatelimitError = QstashDailyRatelimitError;
1839
- exports.QstashEmptyArrayError = QstashEmptyArrayError;
1840
- exports.QstashError = QstashError;
1841
- exports.QstashRatelimitError = QstashRatelimitError;
1842
- exports.Receiver = Receiver;
1843
- exports.Schedules = Schedules;
1844
- exports.SignatureError = SignatureError;
1845
- exports.UrlGroups = UrlGroups;
1846
- exports.Workflow = Workflow;
1847
- exports.setupAnalytics = setupAnalytics;
1848
- exports.upstash = upstash;