This commit is contained in:
2023-06-08 22:47:46 +08:00
parent 2002dd4749
commit 7b5ba18d89
11 changed files with 193 additions and 34 deletions

18
server/task.ts Normal file
View File

@@ -0,0 +1,18 @@
import { Task } from "../task.ts";
import { TaskEventData } from "../task_manager.ts";
import { 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 };
new_export_zip_task: { gid: number; output?: string };
};
export type TaskClientSocketData = DiscriminatedUnion<"type", EventMap> | {
type: "close";
} | { type: "task_list" };