@upstash/ratelimit
Advanced tools
Comparing version 0.0.0-ci.83783060c0ea8611b51e2859446139ff81848e1c-20241006175725 to 0.0.0-ci.942fb8d4eb8e5aba7ee8c6829881b0d27b71599a-20241206000550
import { Aggregate } from '@upstash/core-analytics'; | ||
import { Pipeline } from '@upstash/redis'; | ||
import { Redis as Redis$2 } from '@upstash/redis'; | ||
@@ -21,3 +21,3 @@ /** | ||
type RegionContext = { | ||
redis: Redis; | ||
redis: Redis$1; | ||
cache?: EphemeralCache; | ||
@@ -94,3 +94,2 @@ }; | ||
}; | ||
type IsDenied = 0 | 1; | ||
type DeniedValue = string | undefined; | ||
@@ -104,16 +103,3 @@ type LimitOptions = { | ||
}; | ||
/** | ||
* This is all we need from the redis sdk. | ||
*/ | ||
type Redis = { | ||
sadd: <TData>(key: string, ...members: TData[]) => Promise<number>; | ||
hset: <TValue>(key: string, obj: { | ||
[key: string]: TValue; | ||
}) => Promise<number>; | ||
eval: <TArgs extends unknown[], TData = unknown>(...args: [script: string, keys: string[], args: TArgs]) => Promise<TData>; | ||
evalsha: <TArgs extends unknown[], TData = unknown>(...args: [sha1: string, keys: string[], args: TArgs]) => Promise<TData>; | ||
scriptLoad: (...args: [script: string]) => Promise<string>; | ||
smismember: (key: string, members: string[]) => Promise<IsDenied[]>; | ||
multi: () => Pipeline; | ||
}; | ||
type Redis$1 = Redis$2; | ||
@@ -138,3 +124,3 @@ type Geo = { | ||
type AnalyticsConfig = { | ||
redis: Redis; | ||
redis: Redis$1; | ||
prefix?: string; | ||
@@ -266,3 +252,3 @@ }; | ||
protected readonly timeout: number; | ||
protected readonly primaryRedis: Redis; | ||
protected readonly primaryRedis: Redis$1; | ||
protected readonly analytics?: Analytics; | ||
@@ -392,3 +378,3 @@ protected readonly enableProtection: boolean; | ||
*/ | ||
redis: Redis[]; | ||
redis: Redis$1[]; | ||
/** | ||
@@ -520,2 +506,3 @@ * The ratelimiter function to use. | ||
type Redis = Pick<Redis$1, "get" | "set">; | ||
type RegionRatelimitConfig = { | ||
@@ -753,3 +740,3 @@ /** | ||
*/ | ||
declare const updateIpDenyList: (redis: Redis, prefix: string, threshold: number, ttl?: number) => Promise<unknown[]>; | ||
declare const updateIpDenyList: (redis: Redis$1, prefix: string, threshold: number, ttl?: number) => Promise<unknown[]>; | ||
/** | ||
@@ -764,3 +751,3 @@ * Disables the ip deny list by removing the ip deny list from the all | ||
*/ | ||
declare const disableIpDenyList: (redis: Redis, prefix: string) => Promise<unknown[]>; | ||
declare const disableIpDenyList: (redis: Redis$1, prefix: string) => Promise<unknown[]>; | ||
@@ -767,0 +754,0 @@ type ipDenyList_ThresholdError = ThresholdError; |
@@ -603,3 +603,3 @@ "use strict"; | ||
transaction.del(ipDenyList); | ||
transaction.sadd(ipDenyList, ...allIps); | ||
transaction.sadd(ipDenyList, allIps.at(0), ...allIps.slice(1)); | ||
transaction.sdiffstore(ipDenyList, ipDenyList, allDenyLists); | ||
@@ -929,3 +929,3 @@ transaction.sunionstore(allDenyLists, allDenyLists, ipDenyList); | ||
const members = [identifier, req?.ip, req?.userAgent, req?.country]; | ||
return members.filter((item) => Boolean(item)); | ||
return members.filter(Boolean); | ||
}; | ||
@@ -932,0 +932,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
{ "name": "@upstash/ratelimit", "version": "v0.0.0-ci.83783060c0ea8611b51e2859446139ff81848e1c-20241006175725", "main": "./dist/index.js", "types": "./dist/index.d.ts", "files": [ "dist" ], "scripts": { "build": "tsup", "test": "bun test src --coverage", "fmt": "prettier --write .", "lint": "eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^8.4.0", "@upstash/redis": "^1.31.5", "bun-types": "latest", "eslint": "^9.10.0", "eslint-plugin-unicorn": "^55.0.0", "tsup": "^7.2.0", "turbo": "^1.10.15", "typescript": "^5.0.0" }, "license": "MIT", "dependencies": { "@upstash/core-analytics": "^0.0.10" } } | ||
{ "name": "@upstash/ratelimit", "version": "v0.0.0-ci.942fb8d4eb8e5aba7ee8c6829881b0d27b71599a-20241206000550", "main": "./dist/index.js", "types": "./dist/index.d.ts", "files": [ "dist" ], "scripts": { "build": "tsup", "test": "bun test src --coverage", "fmt": "prettier --write .", "lint": "eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^8.4.0", "bun-types": "latest", "eslint": "^9.10.0", "eslint-plugin-unicorn": "^55.0.0", "tsup": "^7.2.0", "turbo": "^1.10.15", "typescript": "^5.0.0" }, "peerDependencies": { "@upstash/redis": "^1.34.3" }, "license": "MIT", "dependencies": { "@upstash/core-analytics": "^0.0.10" } } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
7
382789
2
3917