Files
eh-downloader/server/task.ts
2023-07-14 14:46:10 +00:00

21 lines
700 B
TypeScript

import type { Task } from "../task.ts";
import type { TaskEventData } from "../task_manager.ts";
import type { DownloadConfig } from "../tasks/download.ts";
import type { ExportZipConfig } from "../tasks/export_zip.ts";
import type { DiscriminatedUnion } from "../utils.ts";
export type TaskServerSocketData = TaskEventData | { type: "close" } | {
type: "tasks";
tasks: Task[];
running: number[];
};
type EventMap = {
new_download_task: { gid: number; token: string; cfg?: DownloadConfig };
new_export_zip_task: { gid: number; cfg?: ExportZipConfig };
};
export type TaskClientSocketData = DiscriminatedUnion<"type", EventMap> | {
type: "close";
} | { type: "task_list" };