fix: resolve all biome lint errors and type issues
- Add file-level biome-ignore for noExplicitAny in prisma-facade.ts (intentional any for Prisma API compatibility surface) - Fix noNonNullAssertion errors in cached-db.ts (redis null-guard fixes) - Auto-fix formatting + organizeImports across modified files - 0 tsc errors, 0 biome errors, 583 tests passing
This commit is contained in:
1 parent
d1807ca814
commit
7f7971f578
7 files changed
+34
-37
No files matched your search
+3
-4
@@ -1,16 +1,15 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import NextAuth from "next-auth";
|
||||
import Credentials from "next-auth/providers/credentials";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { env } from "@/env";
|
||||
import { getCachedJwtVersion } from "@/lib/auth/jwt-version-cache";
|
||||
import { cachedQuery } from "@/lib/cached-db";
|
||||
import { invalidateKey } from "@/lib/cached-db";
|
||||
import { LaravelEncrypter } from "@/lib/auth/laravel-encrypter";
|
||||
import { checkLogin } from "@/lib/auth/password";
|
||||
import { verifyTotp } from "@/lib/auth/totp";
|
||||
import { cachedQuery, invalidateKey } from "@/lib/cached-db";
|
||||
import { db } from "@/lib/db";
|
||||
import { logger } from "@/lib/logger";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { db } from "@/lib/db";
|
||||
import { clientIp, rateLimit } from "@/lib/rate-limit";
|
||||
import { siteSettings } from "@/lib/services/site-settings";
|
||||
|
||||
|
||||
+15
-10
@@ -1,7 +1,7 @@
|
||||
import "server-only";
|
||||
|
||||
import { redis } from "@/lib/redis";
|
||||
import { logger } from "@/lib/logger";
|
||||
import { redis } from "@/lib/redis";
|
||||
|
||||
const DEFAULT_CACHE_TTL = 60;
|
||||
|
||||
@@ -24,7 +24,10 @@ export async function cachedQuery<T>(
|
||||
return JSON.parse(cached) as T;
|
||||
}
|
||||
} catch (err) {
|
||||
logger.warn("[cache] read failed, falling back to DB", { key: cacheKey, error: String(err) });
|
||||
logger.warn("[cache] read failed, falling back to DB", {
|
||||
key: cacheKey,
|
||||
error: String(err),
|
||||
});
|
||||
}
|
||||
|
||||
const result = await queryFn();
|
||||
@@ -42,15 +45,17 @@ export async function cachedQuery<T>(
|
||||
}
|
||||
|
||||
/** Invalidate cache keys matching a glob pattern. */
|
||||
export function invalidateCache(pattern: string): Promise<number> {
|
||||
if (!isRedisAvailable()) return Promise.resolve(0);
|
||||
return redis?.keys(pattern).then((keys) =>
|
||||
keys.length > 0 ? redis!.del(...keys) : 0,
|
||||
) ?? Promise.resolve(0);
|
||||
export async function invalidateCache(pattern: string): Promise<number> {
|
||||
if (!isRedisAvailable()) return 0;
|
||||
const r = redis;
|
||||
if (!r) return 0;
|
||||
const keys = await r.keys(pattern);
|
||||
return keys.length > 0 ? r.del(...keys) : 0;
|
||||
}
|
||||
|
||||
/** Invalidate a single cache key immediately. */
|
||||
export function invalidateKey(key: string): Promise<number> {
|
||||
if (!isRedisAvailable()) return Promise.resolve(0);
|
||||
return redis!.del(key);
|
||||
export async function invalidateKey(key: string): Promise<number> {
|
||||
if (!isRedisAvailable()) return 0;
|
||||
if (!redis) return 0;
|
||||
return redis.del(key);
|
||||
}
|
||||
Reference in new issue
Block a user