style: fix Biome dead-code warnings from oRPC migration (CI lint gate)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { RPCHandler } from "@orpc/server/node";
|
||||
import { onError } from "@orpc/server";
|
||||
import { RPCHandler } from "@orpc/server/node";
|
||||
import express, {
|
||||
type Express,
|
||||
type NextFunction,
|
||||
@@ -9,8 +9,8 @@ import express, {
|
||||
import helmet from "helmet";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { createHealthRouter } from "../modules/health/index.js";
|
||||
import { errorHandler } from "../shared/middlewares/index.js";
|
||||
import { appRouter } from "../orpc/router";
|
||||
import { errorHandler } from "../shared/middlewares/index.js";
|
||||
|
||||
// Auth removed — dashboard is public.
|
||||
// All data APIs (dashboard, messages, moderation, media, voice, recordings,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { createServer, type Server } from "node:http";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { createORPCWebSocketServer } from "../orpc/ws.js";
|
||||
import { config } from "../shared/config/index.js";
|
||||
import { initializeDatabase } from "../shared/database/index.js";
|
||||
import { createORPCWebSocketServer } from "../orpc/ws.js";
|
||||
import { startRedisBridge } from "../ws/redis-bridge.js";
|
||||
import { createWebSocketServer } from "../ws/server.js";
|
||||
import { createHttpApp } from "./app.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { and, desc, eq, type SQL, sql } from "drizzle-orm";
|
||||
import { desc, eq } from "drizzle-orm";
|
||||
import { getDatabase } from "../../shared/database/index.js";
|
||||
import { pgChatbotMessagesTable, pgMessagesTable } from "../../shared/index.js";
|
||||
import { pgChatbotMessagesTable } from "../../shared/index.js";
|
||||
import { createChildLogger } from "../../shared/logger/index.js";
|
||||
|
||||
const logger = createChildLogger("chatbot.repository");
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
pgUserReputationsTable,
|
||||
pgVoiceRecordingsTable,
|
||||
} from "../../shared/index.js";
|
||||
import { tools } from "./chatbot.toolDefs.js";
|
||||
|
||||
/**
|
||||
* Executor for the chatbot's server-watcher tools. The tool *definitions*
|
||||
@@ -430,7 +429,7 @@ async function moderationTimeline(
|
||||
return JSON.stringify(rows);
|
||||
}
|
||||
|
||||
async function corrections(guildId?: string, limit = 10): Promise<string> {
|
||||
async function corrections(_guildId?: string, limit = 10): Promise<string> {
|
||||
const db = getDatabase();
|
||||
const rows = await db
|
||||
.select({
|
||||
|
||||
@@ -5,8 +5,17 @@ import { chatRequestSchema } from "../modules/chatbot/chatbot.schema";
|
||||
import { chatbotService } from "../modules/chatbot/chatbot.service";
|
||||
// ── Service imports ──────────────────────────────────────────────
|
||||
import { dashboardService } from "../modules/dashboard/dashboard.service";
|
||||
import { mediaLoopSchema, mediaQueueSchema } from "../modules/media/media.schema";
|
||||
import { getStatus, queue, setLoop, skip, stop } from "../modules/media/media.service";
|
||||
import {
|
||||
mediaLoopSchema,
|
||||
mediaQueueSchema,
|
||||
} from "../modules/media/media.schema";
|
||||
import {
|
||||
getStatus,
|
||||
queue,
|
||||
setLoop,
|
||||
skip,
|
||||
stop,
|
||||
} from "../modules/media/media.service";
|
||||
import { messageQuerySchema } from "../modules/messages/messages.schema";
|
||||
import { messagesService } from "../modules/messages/messages.service";
|
||||
import { moderationService } from "../modules/moderation/moderation.service";
|
||||
@@ -27,7 +36,9 @@ import { publishCommandNoReply } from "../shared/redis/index";
|
||||
const dashboardRouter = {
|
||||
stats: os.handler(() => dashboardService.getStats()),
|
||||
activity: os
|
||||
.input(z.object({ days: z.coerce.number().int().min(1).max(90).default(14) }))
|
||||
.input(
|
||||
z.object({ days: z.coerce.number().int().min(1).max(90).default(14) }),
|
||||
)
|
||||
.handler(({ input }) => dashboardService.getActivity(input.days)),
|
||||
users: os
|
||||
.input(
|
||||
@@ -152,9 +163,7 @@ const moderationRouter = {
|
||||
// ── Media ────────────────────────────────────────────────────────
|
||||
const mediaRouter = {
|
||||
status: os.handler(() => getStatus()),
|
||||
queue: os
|
||||
.input(mediaQueueSchema)
|
||||
.handler(async ({ input }) => {
|
||||
queue: os.input(mediaQueueSchema).handler(async ({ input }) => {
|
||||
await queue(input.source, input.mode);
|
||||
return getStatus();
|
||||
}),
|
||||
@@ -166,9 +175,7 @@ const mediaRouter = {
|
||||
await stop();
|
||||
return getStatus();
|
||||
}),
|
||||
loop: os
|
||||
.input(mediaLoopSchema)
|
||||
.handler(async ({ input }) => {
|
||||
loop: os.input(mediaLoopSchema).handler(async ({ input }) => {
|
||||
await setLoop(input.loop);
|
||||
return getStatus();
|
||||
}),
|
||||
@@ -220,9 +227,7 @@ const recordingsRouter = {
|
||||
cursor: input.cursor,
|
||||
}),
|
||||
),
|
||||
delete: os
|
||||
.input(z.object({ id: z.string() }))
|
||||
.handler(async ({ input }) => {
|
||||
delete: os.input(z.object({ id: z.string() })).handler(async ({ input }) => {
|
||||
await recordingsService.deleteById(input.id);
|
||||
return { ok: true };
|
||||
}),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { IncomingMessage, Server } from "node:http";
|
||||
import type { Duplex } from "node:stream";
|
||||
import { RPCHandler } from "@orpc/server/ws";
|
||||
import { onError } from "@orpc/server";
|
||||
import { RPCHandler } from "@orpc/server/ws";
|
||||
import { WebSocketServer } from "ws";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { appRouter } from "./router";
|
||||
@@ -24,7 +24,9 @@ const logger = createChildLogger("orpc.ws");
|
||||
*/
|
||||
export function createORPCWebSocketServer(server: Server): WebSocketServer {
|
||||
const handler = new RPCHandler(appRouter, {
|
||||
interceptors: [onError((error) => logger.error({ error }, "oRPC WS error"))],
|
||||
interceptors: [
|
||||
onError((error) => logger.error({ error }, "oRPC WS error")),
|
||||
],
|
||||
});
|
||||
|
||||
const wss = new WebSocketServer({ noServer: true, perMessageDeflate: false });
|
||||
|
||||
@@ -30,7 +30,7 @@ describe("chatbot tool definitions", () => {
|
||||
] as const) {
|
||||
const tool = byName.get(name);
|
||||
expect(tool, `missing tool ${name}`).toBeDefined();
|
||||
expect(tool!.function.parameters.required).toContain(required);
|
||||
expect(tool?.function.parameters.required).toContain(required);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user