114 lines
6.8 KiB
TypeScript
114 lines
6.8 KiB
TypeScript
// This file has been generated by Specta. DO NOT EDIT.
|
|
|
|
import type { InferCommandOutput } from 'taurpc';
|
|
import { createTauRPCProxy as createProxy } from 'taurpc';
|
|
|
|
type TAURI_CHANNEL<T> = (response: T) => void;
|
|
|
|
export type ClusterError = { InvalidVersion: string } | 'MissingJavaVersion' | 'ClusterDownloading' | 'ClusterAlreadyRunning';
|
|
|
|
export type ClusterStage = 'notready' | 'downloading' | 'repairing' | 'ready';
|
|
|
|
export interface CreateCluster { name: string; mc_version: string; mc_loader: GameLoader; mc_loader_version: string | null; icon: Icon | null }
|
|
|
|
export type CryptoError = { InvalidHash: { algorithm: HashAlgorithm; expected: string; actual: string } } | 'InvalidAlgorithm';
|
|
|
|
export type DaoError = 'NotFound' | 'AlreadyExists' | { InvalidValue: [string, string] };
|
|
|
|
export type DirectoryError = 'BaseDir';
|
|
|
|
export type DiscordError = 'MissingClientId' | 'ConnectError';
|
|
|
|
export type GameLoader = 'vanilla' | 'forge' | 'neoforge' | 'quilt' | 'fabric' | 'legacyfabric';
|
|
|
|
export type HashAlgorithm = 'Sha1' | 'Sha256' | 'Md5';
|
|
|
|
/**
|
|
* A wrapper around generic and unhelpful [`std::io::Error`] messages.
|
|
*/
|
|
export type IOError = { InvalidAbsolutePath: string } | { IOErrorWrapper: { path: string } } | 'IOError' | 'DeserializeError' | 'AsyncZipError';
|
|
|
|
export type Icon = string;
|
|
|
|
export type IncompatiblePackageType = 'McVersion' | 'Loader';
|
|
|
|
export type IngressError = 'NotFound';
|
|
|
|
export interface IngressPayload { id: string; message: string; ingress_type: IngressType; percent: number | null; total: number }
|
|
|
|
export type IngressType = { Download: { file_name: string } } | 'JavaPrepare' | 'JavaCheck' | 'JavaLocate' | 'MinecraftDownload' | { PrepareCluster: { cluster_name: string } };
|
|
|
|
export type JavaError = { ParseVersion: [string] } | 'Execute' | 'MissingJava';
|
|
|
|
export type LauncherError = { type: 'DirError'; data: DirectoryError } | { type: 'IOError'; data: IOError } | { type: 'IngressError'; data: IngressError } | { type: 'JavaError'; data: JavaError } | { type: 'CryptoError'; data: CryptoError } | { type: 'DiscordError'; data: DiscordError } | { type: 'MetadataError'; data: MetadataError } | { type: 'ClusterError'; data: ClusterError } | { type: 'MinecraftAuthError'; data: MinecraftAuthError } | { type: 'ProcessError'; data: ProcessError } | { type: 'PackageError'; data: PackageError } | { type: 'DaoError'; data: DaoError } | { type: 'SerdeError' } | { type: 'AnyhowError' } | { type: 'DbError' } | { type: 'ReqwestError' } | { type: 'InterpulseError' } | { type: 'RegexError' } | { type: 'SemaphoreError' } | { type: 'UrlError' } | { type: 'TauriError' };
|
|
|
|
export type LauncherEvent = { Ingress: IngressPayload } | { Message: MessagePayload } | { Process: ProcessPayload };
|
|
|
|
export type MessageLevel = 'Info' | 'Warn' | 'Error';
|
|
|
|
export interface MessagePayload { level: MessageLevel; message: string }
|
|
|
|
export type MetadataError = 'FetchError' | { NotModdedManifest: GameLoader } | { NotVanillaManifest: GameLoader } | 'ParseError' | 'NoMatchingLoader' | 'NoMatchingVersion';
|
|
|
|
/**
|
|
* Wrapper around all `Error`s that can occur during the Microsoft authentication process.
|
|
*/
|
|
export type MinecraftAuthError = 'PublicKeyReading' | 'PKCS8Error' | { SerializeError: { step: MinecraftAuthStep } } | { DeserializeError: { step: MinecraftAuthStep; raw: string } } | { RequestError: { step: MinecraftAuthStep } } | { SigningError: { step: MinecraftAuthStep } } | 'HashError' | 'SessionIdError';
|
|
|
|
/**
|
|
* An ordered list of all MSA authentication steps.
|
|
*/
|
|
export type MinecraftAuthStep = 'DeviceToken' | 'SisuAuthenicate' | 'OAuthToken' | 'RefreshOAuthToken' | 'SisuAuthorize' | 'XstsAuthorize' | 'MinecraftToken' | 'MinecraftEntitlements' | 'MinecraftProfile';
|
|
|
|
/**
|
|
* A structure of all needed Minecraft credentials for logging in and account management.
|
|
*/
|
|
export interface MinecraftCredentials {
|
|
/**
|
|
* The uuid of the credentials.
|
|
*/
|
|
id: string;
|
|
/**
|
|
* The username of the Minecraft account.
|
|
*/
|
|
username: string;
|
|
/**
|
|
* The access token as a String.
|
|
*/
|
|
access_token: string;
|
|
/**
|
|
* The refresh token as a string for [`MinecraftState#refresh`].
|
|
*/
|
|
refresh_token: string;
|
|
/**
|
|
* The time that the access token expires as a [`DateTime<Utc>`].
|
|
*/
|
|
expires: string;
|
|
|
|
}
|
|
|
|
export interface Model { id: bigint; folder_name: string; stage: ClusterStage; created_at: string; group_id: bigint | null; name: string; mc_version: string; mc_loader: GameLoader; mc_loader_version: string | null; last_played: string | null; overall_played: bigint | null; icon_url: Icon | null; setting_profile_name: string | null; linked_pack_id: string | null; linked_pack_version: string | null }
|
|
|
|
export type PackageError = 'NoPrimaryFile' | 'IsModPack' | { Incompatible: IncompatiblePackageType };
|
|
|
|
export interface Process { pid: number; started_at: string; cluster_id: bigint; post_hook: string | null; account_id: string }
|
|
|
|
export type ProcessError = { HookUnsuccessful: number } | 'NoPid';
|
|
|
|
export type ProcessPayload = { Starting: { command: string } } | { Started: { process: Process } } | { Stopped: { pid: number; exit_code: number } } | { Output: { pid: number; output: string } };
|
|
|
|
export interface Resolution { width: number; height: number }
|
|
|
|
export interface SettingProfileModel { name: string; java_id: bigint | null; res: Resolution | null; force_fullscreen: boolean | null; mem_max: number | null; launch_args: string | null; launch_env: string | null; hook_pre: string | null; hook_wrapper: string | null; hook_post: string | null; os_extra: SettingsOsExtra | null }
|
|
|
|
export interface SettingsOsExtra { enable_gamemode: boolean | null }
|
|
|
|
const ARGS_MAP = { 'core': '{"get_cluster":["id"],"remove_cluster":["id"],"get_profile_or_default":["name"],"get_clusters":[],"remove_user":["uuid"],"get_global_profile":[],"get_users":[],"get_default_user":["fallback"],"create_cluster":["options"],"open_msa_login":[],"get_user":["uuid"],"set_default_user":["uuid"]}', 'oneclient': '{"open_dev_tools":[],"return_error":[]}', '': '{"send_event":["event"]}' };
|
|
export interface Router {
|
|
'core': { get_clusters: () => Promise<Array<Model>>; get_cluster: (id: bigint) => Promise<Model | null>; remove_cluster: (id: bigint) => Promise<null>; create_cluster: (options: CreateCluster) => Promise<Model>; get_profile_or_default: (name: string | null) => Promise<SettingProfileModel>; get_global_profile: () => Promise<SettingProfileModel>; get_users: () => Promise<Array<MinecraftCredentials>>; get_user: (uuid: string) => Promise<MinecraftCredentials | null>; remove_user: (uuid: string) => Promise<null>; get_default_user: (fallback: boolean | null) => Promise<MinecraftCredentials | null>; set_default_user: (uuid: string | null) => Promise<null>; open_msa_login: () => Promise<MinecraftCredentials | null> };
|
|
'oneclient': { return_error: () => Promise<null>; open_dev_tools: () => Promise<void> };
|
|
'': { send_event: (event: LauncherEvent) => Promise<void> };
|
|
}
|
|
|
|
export type { InferCommandOutput };
|
|
export const createTauRPCProxy = () => createProxy<Router>(ARGS_MAP);
|