import type { Archon } from '@modrinth/api-client' import type { ComputedRef, Reactive, Ref } from 'vue' import { createContext } from '.' export type BackupTaskState = { progress: number state: Archon.Backups.v1.BackupState } export type BackupProgressEntry = { file?: BackupTaskState create?: BackupTaskState restore?: BackupTaskState } export type BackupsState = Map export interface FilesystemAuth { url: string token: string } export interface ModrinthServerContext { readonly serverId: string readonly server: Ref // Websocket state readonly isConnected: Ref readonly powerState: Ref readonly isServerRunning: ComputedRef readonly backupsState: Reactive markBackupCancelled: (backupId: string) => void // Filesystem state readonly fsAuth: Ref readonly fsOps: Ref readonly fsQueuedOps: Ref refreshFsAuth: () => Promise } export const [injectModrinthServerContext, provideModrinthServerContext] = createContext('[id].vue', 'modrinthServerContext')