From a8c978a94a8a28182ce7da9a82ff99a2efc37e87 Mon Sep 17 00:00:00 2001
From: chronark <dev@chronark.com>
Date: Mon, 13 Jan 2025 15:51:48 +0100
Subject: [PATCH 1/2] fix: ratelimits ui filters and logs ordering

---
 .../ratelimits/[namespaceId]/logs/filter.tsx  | 20 +++++++++++--------
 internal/clickhouse/src/ratelimits.ts         |  3 +++
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/filter.tsx b/apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/filter.tsx
index a55a75651..4d6494d39 100644
--- a/apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/filter.tsx
+++ b/apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/filter.tsx
@@ -1,7 +1,7 @@
 "use client";
 import { ArrayInput } from "@/components/array-input";
 import { cn } from "@/lib/utils";
-import { Button } from "@unkey/ui";
+import { Button, buttonVariants } from "@unkey/ui";
 import {
   CalendarIcon,
   CalendarRange,
@@ -193,20 +193,22 @@ export const Filters: React.FC = () => {
               }
               timeInputLabel="Select Time"
               calendarProps={{
-                disabled: { before: new Date() },
+                disabled: { after: new Date() },
                 showOutsideDays: true,
               }}
               timeInputProps={{
                 className: "w-[100px]",
               }}
             >
-              <Button className="text-xs font-medium w-full justify-start gap-0">
-                <span className="mr-1 text-xs font-medium">From:</span>
+              <div
+                className={cn("text-xs font-medium w-full items-center gap-0", buttonVariants())}
+              >
+                <span className="mr-1  font-medium">From:</span>
 
                 {after ? format(after, "PPp") : format(new Date(), "PPp")}
 
                 <CalendarIcon className="mr-2 h-4 w-4 ml-auto" />
-              </Button>
+              </div>
             </DateTimePicker>
             <div className="flex items-center w-full gap-2">
               <DateTimePicker
@@ -225,13 +227,15 @@ export const Filters: React.FC = () => {
                   className: "w-[130px]",
                 }}
               >
-                <Button className="text-xs font-medium w-full justify-start gap-0">
-                  <span className="mr-1 text-xs font-medium">Until:</span>
+                <div
+                  className={cn("text-xs font-medium w-full items-center gap-0", buttonVariants())}
+                >
+                  <span className="mr-1  font-medium">Until:</span>
 
                   {before ? format(before, "PPp") : format(new Date(), "PPp")}
 
                   <CalendarIcon className="mr-2 h-4 w-4 ml-auto" />
-                </Button>
+                </div>
               </DateTimePicker>
             </div>
 
diff --git a/internal/clickhouse/src/ratelimits.ts b/internal/clickhouse/src/ratelimits.ts
index 57d41b63b..78649b877 100644
--- a/internal/clickhouse/src/ratelimits.ts
+++ b/internal/clickhouse/src/ratelimits.ts
@@ -163,6 +163,7 @@ const getRatelimitLogsParameters = z.object({
     .optional()
     .default(() => Date.now()),
   limit: z.number().optional().default(100),
+  passed: z.boolean().optional(),
 });
 
 export function getRatelimitLogs(ch: Querier) {
@@ -180,6 +181,8 @@ export function getRatelimitLogs(ch: Querier) {
       ${args.identifier ? "AND multiSearchAny(identifier, {identifier: Array(String)}) > 0" : ""}
       AND time >= {start: Int64}
       AND time <= {end: Int64}
+      ${typeof args.passed !== "undefined" ? "passed = {passed:Boolean}" : ""}
+    ORDER BY time DESC
     LIMIT {limit: Int64}
 ;`,
       params: getRatelimitLogsParameters,

From 893baea01b73101c86a875c6d1b894a038734f8c Mon Sep 17 00:00:00 2001
From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com>
Date: Mon, 13 Jan 2025 14:55:51 +0000
Subject: [PATCH 2/2] [autofix.ci] apply automated fixes

---
 packages/api/package.json       | 11 ++---------
 packages/hono/package.json      | 11 ++---------
 packages/nextjs/package.json    | 11 ++---------
 packages/ratelimit/package.json | 12 ++----------
 4 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/packages/api/package.json b/packages/api/package.json
index 95020dad7..c6fef3285 100644
--- a/packages/api/package.json
+++ b/packages/api/package.json
@@ -9,19 +9,12 @@
   "publishConfig": {
     "access": "public"
   },
-  "keywords": [
-    "unkey",
-    "client",
-    "api"
-  ],
+  "keywords": ["unkey", "client", "api"],
   "bugs": {
     "url": "https://github.com/unkeyed/unkey/issues"
   },
   "homepage": "https://github.com/unkeyed/unkey#readme",
-  "files": [
-    "./dist/**",
-    "README.md"
-  ],
+  "files": ["./dist/**", "README.md"],
   "author": "Andreas Thomas <andreas@chronark.com>",
   "scripts": {
     "generate": "openapi-typescript https://api.unkey.dev/openapi.json -o ./src/openapi.d.ts",
diff --git a/packages/hono/package.json b/packages/hono/package.json
index d5b421df2..eaba9a4e8 100644
--- a/packages/hono/package.json
+++ b/packages/hono/package.json
@@ -8,19 +8,12 @@
   "publishConfig": {
     "access": "public"
   },
-  "keywords": [
-    "unkey",
-    "client",
-    "api",
-    "hono"
-  ],
+  "keywords": ["unkey", "client", "api", "hono"],
   "bugs": {
     "url": "https://github.com/unkeyed/unkey/issues"
   },
   "homepage": "https://github.com/unkeyed/unkey#readme",
-  "files": [
-    "./dist/**"
-  ],
+  "files": ["./dist/**"],
   "author": "Andreas Thomas <andreas@chronark.com>",
   "scripts": {
     "build": "tsup",
diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json
index fc63e2e1e..4786b6ec4 100644
--- a/packages/nextjs/package.json
+++ b/packages/nextjs/package.json
@@ -8,19 +8,12 @@
   "publishConfig": {
     "access": "public"
   },
-  "keywords": [
-    "unkey",
-    "client",
-    "api"
-  ],
+  "keywords": ["unkey", "client", "api"],
   "bugs": {
     "url": "https://github.com/unkeyed/unkey/issues"
   },
   "homepage": "https://github.com/unkeyed/unkey#readme",
-  "files": [
-    "./dist/**",
-    "README.md"
-  ],
+  "files": ["./dist/**", "README.md"],
   "author": "Andreas Thomas <andreas@chronark.com>",
   "scripts": {
     "build": "tsup"
diff --git a/packages/ratelimit/package.json b/packages/ratelimit/package.json
index dee44c38e..dbedb47d4 100644
--- a/packages/ratelimit/package.json
+++ b/packages/ratelimit/package.json
@@ -9,20 +9,12 @@
   "publishConfig": {
     "access": "public"
   },
-  "keywords": [
-    "unkey",
-    "ratelimit",
-    "global",
-    "serverless"
-  ],
+  "keywords": ["unkey", "ratelimit", "global", "serverless"],
   "bugs": {
     "url": "https://github.com/unkeyed/unkey/issues"
   },
   "homepage": "https://github.com/unkeyed/unkey#readme",
-  "files": [
-    "./dist/**",
-    "README.md"
-  ],
+  "files": ["./dist/**", "README.md"],
   "author": "Andreas Thomas <andreas@unkey.dev>",
   "scripts": {
     "build": "tsup"