mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
* feat: report partial backups with warnings * chore: rebase * chore: remove un-used size prop
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { EventEmitter } from "node:events";
|
|
import type { TypedEmitter } from "tiny-typed-emitter";
|
|
|
|
/**
|
|
* Event payloads for the SSE system
|
|
*/
|
|
interface ServerEvents {
|
|
"backup:started": (data: { scheduleId: number; volumeName: string; repositoryName: string }) => void;
|
|
"backup:progress": (data: {
|
|
scheduleId: number;
|
|
volumeName: string;
|
|
repositoryName: string;
|
|
seconds_elapsed: number;
|
|
percent_done: number;
|
|
total_files: number;
|
|
files_done: number;
|
|
total_bytes: number;
|
|
bytes_done: number;
|
|
current_files: string[];
|
|
}) => void;
|
|
"backup:completed": (data: {
|
|
scheduleId: number;
|
|
volumeName: string;
|
|
repositoryName: string;
|
|
status: "success" | "error" | "stopped" | "warning";
|
|
}) => void;
|
|
"volume:mounted": (data: { volumeName: string }) => void;
|
|
"volume:unmounted": (data: { volumeName: string }) => void;
|
|
"volume:updated": (data: { volumeName: string }) => void;
|
|
"volume:status_changed": (data: { volumeName: string; status: string }) => void;
|
|
}
|
|
|
|
/**
|
|
* Global event emitter for server-side events
|
|
* Use this to emit events that should be broadcasted to connected clients via SSE
|
|
*/
|
|
export const serverEvents = new EventEmitter() as TypedEmitter<ServerEvents>;
|