+ Loading rate limits data… +
+ ) + } + if (error) { + return ( ++ Error loading rate limits: {error} +
+ ) + } + if (!data) { + return ( ++ No rate limits data available. +
+ ) + } + + return ( +| + Endpoint(s) + | ++ Bucket + | ++ Sustained (rpm) + | ++ Burst (rps) + | +
|---|---|---|---|
|
+ {endpointDisplay}
+ {overflow > 0 && (
+
+ +{overflow} more
+
+ )}
+ |
+
+ {t.bucket}
+ |
+ + {t.rpm} + | ++ {t.rps} + | +
+ No buckets match the search "{pathSearchDebounced.trim()}". +
+ )} +- No buckets match the search "{pathSearchDebounced.trim()}". + No buckets match the search "{pathSearchDebounced.trim()} + ".
)} diff --git a/src/lib/rate-limits/csv-provider.ts b/src/lib/rate-limits/csv-provider.ts index 261f6fbce1..5d951cf64f 100644 --- a/src/lib/rate-limits/csv-provider.ts +++ b/src/lib/rate-limits/csv-provider.ts @@ -3,7 +3,14 @@ import * as fs from "fs" import * as path from "path" -import type { EndpointRow, Env, GetThresholdsOptions, RateLimitsProvider, ThresholdRow, Tier } from "./types" +import type { + EndpointRow, + Env, + GetThresholdsOptions, + RateLimitsProvider, + ThresholdRow, + Tier, +} from "./types" import { ENV_FROM_CSV, TIER_FROM_CSV } from "./types" const ENDPOINTS_CSV = "bucket-to-endpoints-20260204-1941.csv" @@ -43,7 +50,9 @@ export interface CsvProviderOptions { siteDir?: string } -export function createCsvProvider(options?: CsvProviderOptions): RateLimitsProvider { +export function createCsvProvider( + options?: CsvProviderOptions, +): RateLimitsProvider { const dataDir = getDataDir(options?.siteDir) const endpointsPath = path.join(dataDir, ENDPOINTS_CSV) const thresholdsPath = path.join(dataDir, THRESHOLDS_CSV) @@ -53,7 +62,12 @@ export function createCsvProvider(options?: CsvProviderOptions): RateLimitsProvi const raw = fs.readFileSync(endpointsPath, "utf-8") const rows = parseCsv(raw) const [header, ...dataRows] = rows - if (!header || header[0] !== "Method" || header[1] !== "Path" || header[2] !== "Bucket") { + if ( + !header || + header[0] !== "Method" || + header[1] !== "Path" || + header[2] !== "Bucket" + ) { throw new Error(`Unexpected endpoints CSV header: ${header?.join(",")}`) } return dataRows @@ -61,7 +75,9 @@ export function createCsvProvider(options?: CsvProviderOptions): RateLimitsProvi .map((r) => ({ method: r[0], path: r[1], bucket: r[2] })) }, - async getThresholds(options?: GetThresholdsOptions): Promise