diff --git a/bun.lockb b/bun.lockb index 54f18a4..665316b 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/examples/cloudflare-workers/package.json b/examples/cloudflare-workers/package.json index 24435e0..5b57d45 100644 --- a/examples/cloudflare-workers/package.json +++ b/examples/cloudflare-workers/package.json @@ -14,7 +14,7 @@ "deploy": "wrangler publish" }, "dependencies": { - "@upstash/ratelimit": "^1.0.3", - "@upstash/redis": "^1.20.6" + "@upstash/ratelimit": "latest", + "@upstash/redis": "latest" } } \ No newline at end of file diff --git a/examples/nextjs/app/api/route.ts b/examples/nextjs/app/api/route.ts index 51d6eb9..58b108e 100644 --- a/examples/nextjs/app/api/route.ts +++ b/examples/nextjs/app/api/route.ts @@ -13,7 +13,6 @@ const redis = new Redis({ // Create a new ratelimiter const ratelimit = new Ratelimit({ - // @ts-ignore redis, limiter: Ratelimit.slidingWindow(10, "10 s"), prefix: "@upstash/ratelimit", diff --git a/examples/nextjs/package.json b/examples/nextjs/package.json index c9614d2..2810874 100644 --- a/examples/nextjs/package.json +++ b/examples/nextjs/package.json @@ -9,8 +9,8 @@ "lint": "next lint" }, "dependencies": { - "@upstash/ratelimit": "^1.1.3", - "@upstash/redis": "^1.34.2", + "@upstash/ratelimit": "latest", + "@upstash/redis": "latest", "@vercel/functions": "^1.0.2", "next": "14.2.3", "react": "^18", @@ -30,4 +30,4 @@ }, "module": "index.ts", "type": "module" -} \ No newline at end of file +} diff --git a/package.json b/package.json index 15da8de..b79c379 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^8.4.0", - "@upstash/redis": "^1.31.5", + "@upstash/redis": "^1.34.3", "bun-types": "latest", "eslint": "^9.10.0", "eslint-plugin-unicorn": "^55.0.0", diff --git a/src/types.ts b/src/types.ts index 57cff85..5a993c1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,4 @@ -import type { Pipeline } from "@upstash/redis"; +import type { Redis as RedisCore } from "@upstash/redis"; import type { Geo } from "./analytics"; /** @@ -123,25 +123,17 @@ export type LimitOptions = { * This is all we need from the redis sdk. */ export type Redis = { - sadd: (key: string, ...members: TData[]) => Promise; + sadd: RedisCore["sadd"] - hset: (key: string, obj: { [key: string]: TValue }) => Promise; + hset: RedisCore["hset"] - eval: ( - ...args: [script: string, keys: string[], args: TArgs] - ) => Promise; + eval: RedisCore["eval"] - evalsha: ( - ...args: [sha1: string, keys: string[], args: TArgs] - ) => Promise; + evalsha: RedisCore["evalsha"] - scriptLoad: ( - ...args: [script: string] - ) => Promise; + scriptLoad: RedisCore["scriptLoad"] - smismember: ( - key: string, members: string[] - ) => Promise; + smismember: RedisCore["smismember"] - multi: () => Pipeline + multi: RedisCore["multi"] }