@upstash/ratelimit 0.1.0-alpha.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.
@@ -0,0 +1,25 @@
1
+ export declare type Redis = {
2
+ eval: <TArgs extends unknown[], TData = unknown>(...args: [script: string, keys: string[], args: TArgs]) => Promise<unknown>;
3
+ };
4
+ export declare type Context = {
5
+ redis: Redis;
6
+ };
7
+ export declare type RatelimitResponse = {
8
+ /**
9
+ * Whether the request may pass(true) or exceeded the limit(false)
10
+ */
11
+ success: boolean;
12
+ /**
13
+ * Maximum number of requests allowed within a window.
14
+ */
15
+ limit: number;
16
+ /**
17
+ * How many requests the user has left within the current window.
18
+ */
19
+ remaining: number;
20
+ /**
21
+ * Unix timestamp in milliseconds when the limits are reset.
22
+ */
23
+ reset: number;
24
+ };
25
+ export declare type Ratelimiter = (ctx: Context, identifier: string) => Promise<RatelimitResponse>;