feat(shared): reorder AppError constructor to (message, code, status), add singleton logger, retry and TTL cache utilities

This commit is contained in:
MythEclipse
2026-06-02 21:06:42 +07:00
parent 9045e7e347
commit 2d79d8aefd
50 changed files with 401 additions and 449 deletions
@@ -1,9 +1,9 @@
import type { WebSocket } from "ws";
import { createChildLogger } from "../../shared/logger/logger.js";
import type { MediaState } from "../voice-recording/mediaTypes.js";
import type {
AnalysisQueueStatus,
AttachmentRecord,
MediaState,
MessageRecord,
ModerationWsEvent,
} from "../message-capture/types.js";
@@ -171,33 +171,6 @@ export interface AnalysisResult {
evidence?: string[];
}
export type MediaMode = "music" | "screen";
export type MediaSourceKind =
| "url"
| "local"
| "youtube"
| "spotify"
| "search";
export type MediaQueueItemStatus = "queued" | "playing" | "failed";
export interface MediaQueueItem {
id: string;
mode: MediaMode;
source: string;
title: string;
kind: MediaSourceKind;
requestedBy: string;
addedAt: number;
status: MediaQueueItemStatus;
}
export interface MediaState {
playing: boolean;
musicVolume: number;
current: MediaQueueItem | null;
queue: MediaQueueItem[];
}
export type ModerationWsEvent =
| { type: "ui_state"; state: unknown }
| { type: "user_state"; users: unknown[] }
@@ -207,7 +180,7 @@ export type ModerationWsEvent =
| { type: "message_analyzed"; data: MessageRecord }
| { type: "attachment_created"; data: AttachmentRecord }
| { type: "analysis_queue_status"; data: AnalysisQueueStatus }
| { type: "media_state"; state: MediaState }
| { type: "media_state"; state: unknown }
| { type: "voice_recording_uploaded"; data: any };
export interface AnalysisQueueStatus {