Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/api/db/[query]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { authorize } from '@/app/lib/auth/authorize';
/**
* Suggestion helper: generate user-friendly tips based on error details
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function getSuggestion(details: string): string {
if (!details) return "Check your query and try again.";

Expand Down
18 changes: 10 additions & 8 deletions app/components/DbConsole.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// @ts-nocheck
'use client';
import React, { useRef, useState, useEffect } from "react";
import { useKeyboardShortcuts } from "../hooks/KeyBoardShortcuts";
import { createShortcuts } from "../config/shortcuts";
import { DatabaseTarget, DatabaseQueryResponse, SchemaMetadata } from "@/app/types/database";
import { DatabaseTarget, DatabaseQueryResponse, SchemaMetadata, TableMetadata, ColumnMetadata, IndexMetadata, RelationshipMetadata } from "@/app/types/database";

import {
exportToCSV,
Expand Down Expand Up @@ -235,11 +234,11 @@ export default function DbConsole() {

const searchLower = schemaSearchTerm.toLowerCase();
return schema.tables.filter(
(table: any) =>
(table: TableMetadata) =>
table.name.toLowerCase().includes(searchLower) ||
table.schema.toLowerCase().includes(searchLower) ||
table.description?.toLowerCase().includes(searchLower) ||
table.columns.some((col: any) => col.name.toLowerCase().includes(searchLower))
table.columns.some((col: ColumnMetadata) => col.name.toLowerCase().includes(searchLower))
);
};

Expand Down Expand Up @@ -576,7 +575,7 @@ export default function DbConsole() {
</tr>
</thead>
<tbody className="divide-y divide-gray-100 dark:divide-gray-700">
{table.columns.map((column: any, colIndex: number) => (
{table.columns.map((column: ColumnMetadata, colIndex: number) => (
<tr
key={colIndex}
className="hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors duration-150"
Expand Down Expand Up @@ -621,7 +620,7 @@ export default function DbConsole() {
</span>
)}
{column.constraints.map(
(constraint: any, constraintIndex: number) => (
(constraint: string, constraintIndex: number) => (
<span
key={constraintIndex}
className="bg-purple-100 dark:bg-purple-900 text-purple-800 dark:text-purple-200 px-2 py-1 rounded-md text-xs font-medium"
Expand Down Expand Up @@ -658,7 +657,7 @@ export default function DbConsole() {
Indexes ({table.indexes.length})
</h5>
<div className="space-y-2">
{table.indexes.map((index: any, indexIndex: number) => (
{table.indexes.map((index: IndexMetadata, indexIndex: number) => (
<div
key={indexIndex}
className="bg-indigo-50 dark:bg-indigo-900/30 border border-indigo-200 dark:border-indigo-700 rounded-lg p-3"
Expand Down Expand Up @@ -715,7 +714,7 @@ export default function DbConsole() {
Database Relationships ({schema.relationships.length})
</h4>
<div className="space-y-3">
{schema.relationships.map((rel: any, index: number) => (
{schema.relationships.map((rel: RelationshipMetadata, index: number) => (
<div
key={index}
className="bg-gradient-to-r from-purple-50 to-indigo-50 dark:from-purple-900/20 dark:to-indigo-900/20 border border-purple-200 dark:border-purple-700 rounded-xl p-4"
Expand Down Expand Up @@ -888,6 +887,7 @@ export default function DbConsole() {
localStorage.setItem("darkMode", next ? "1" : "0");
} catch (e) {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.warn('Failed to persist darkMode', e);
}
}
Expand All @@ -903,6 +903,7 @@ export default function DbConsole() {
document.body.classList.toggle("dark", shouldDark);
} catch (e) {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.warn('Failed to read darkMode', e);
}
}
Expand Down Expand Up @@ -937,6 +938,7 @@ export default function DbConsole() {
}
} catch (e) {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.warn('Failed to read darkMode', e);
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/lib/auth/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ async function createRedisClient() {
if (!url) return null;
const client = createClient({ url });
client.on('error', err => {
// eslint-disable-next-line no-console
console.error('Redis error:', err);
});
try {
await client.connect();
return client;
} catch {
// eslint-disable-next-line no-console
console.warn('Redis unavailable, using in-memory store');
return null;
}
Expand Down
5 changes: 5 additions & 0 deletions app/lib/fetchWithRetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export async function fetchWithRetry(
circuitBreakerState.open = false;
circuitBreakerState.failureCount = 0;
circuitBreakerState.lastFailureTime = null;
// eslint-disable-next-line no-console
console.info('[Circuit Breaker] Reset after cooldown');
} else {
// Circuit breaker open - reject immediately
Expand All @@ -99,6 +100,7 @@ export async function fetchWithRetry(
retryDelayBaseMs,
maxRetryDelayMs
);
// eslint-disable-next-line no-console
console.warn(
`[fetchWithRetry] Attempt ${attempt + 1} failed with status ${response.status}. Retrying in ${delay.toFixed(0)}ms...`
);
Expand All @@ -110,6 +112,7 @@ export async function fetchWithRetry(
circuitBreakerState.lastFailureTime = Date.now();
if (circuitBreakerState.failureCount >= circuitBreakerThreshold) {
circuitBreakerState.open = true;
// eslint-disable-next-line no-console
console.error(
'[Circuit Breaker] Opened due to repeated failures'
);
Expand All @@ -136,6 +139,7 @@ export async function fetchWithRetry(
retryDelayBaseMs,
maxRetryDelayMs
);
// eslint-disable-next-line no-console
console.warn(
`[fetchWithRetry] Attempt ${attempt + 1} failed with error: ${error instanceof Error ? error.message : error}. Retrying in ${delay.toFixed(0)}ms...`
);
Expand All @@ -147,6 +151,7 @@ export async function fetchWithRetry(
circuitBreakerState.lastFailureTime = Date.now();
if (circuitBreakerState.failureCount >= circuitBreakerThreshold) {
circuitBreakerState.open = true;
// eslint-disable-next-line no-console
console.error('[Circuit Breaker] Opened due to repeated failures');
}
throw error;
Expand Down
Loading