From f26a596a78a5dab19ae47111647e1752fa30b2b7 Mon Sep 17 00:00:00 2001 From: emirsassan Date: Wed, 4 Jun 2025 21:35:58 +0300 Subject: [PATCH] temp solution to formatted --- apps/onelauncher/desktop/src/ext/specta.rs | 14 +- apps/onelauncher/frontend/src/bindings.gen.ts | 127 ++++++++++-------- 2 files changed, 82 insertions(+), 59 deletions(-) diff --git a/apps/onelauncher/desktop/src/ext/specta.rs b/apps/onelauncher/desktop/src/ext/specta.rs index 951373d5..624414b6 100644 --- a/apps/onelauncher/desktop/src/ext/specta.rs +++ b/apps/onelauncher/desktop/src/ext/specta.rs @@ -3,15 +3,21 @@ use std::path::Path; use std::process::Command; pub fn formatter(file: &Path) -> io::Result<()> { - Command::new("pnpm") + let result = Command::new("pnpm") .arg("eslint") .arg("--flag") .arg("unstable_ts_config") .arg("--fix") .arg(file) - .output() - .map(|_| ()) - .map_err(io::Error::other) + .output(); + + match result { + Ok(_) => Ok(()), + Err(e) => { + eprintln!("error running formatter on {}: {}", file.display(), e); + Ok(()) + } + } } const _: specta_typescript::FormatterFn = formatter; diff --git a/apps/onelauncher/frontend/src/bindings.gen.ts b/apps/onelauncher/frontend/src/bindings.gen.ts index 9b6eccee..6a4a1279 100644 --- a/apps/onelauncher/frontend/src/bindings.gen.ts +++ b/apps/onelauncher/frontend/src/bindings.gen.ts @@ -1,114 +1,131 @@ // This file has been generated by Specta. DO NOT EDIT. -import type { InferCommandOutput } from 'taurpc'; -import { createTauRPCProxy as createProxy } from 'taurpc'; +import { createTauRPCProxy as createProxy, type InferCommandOutput } from 'taurpc' +type TAURI_CHANNEL = (response: T) => void -type TAURI_CHANNEL = (response: T) => void; -export type ClusterError = { InvalidVersion: string } | 'MissingJavaVersion' | 'ClusterDownloading' | 'ClusterAlreadyRunning'; +export type ClusterError = { InvalidVersion: string } | "MissingJavaVersion" | "ClusterDownloading" | "ClusterAlreadyRunning" -export type ClusterStage = 'notready' | 'downloading' | 'repairing' | 'ready'; +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 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 CryptoError = { InvalidHash: { algorithm: HashAlgorithm; expected: string; actual: string } } | "InvalidAlgorithm" -export type DaoError = 'NotFound' | 'AlreadyExists' | { InvalidValue: [string, string] }; +export type DaoError = "NotFound" | "AlreadyExists" | { InvalidValue: [string, string] } -export type DirectoryError = 'BaseDir'; +export type DirectoryError = "BaseDir" -export type DiscordError = 'MissingClientId' | 'ConnectError'; +export type DiscordError = "MissingClientId" | "ConnectError" -export type GameLoader = 'vanilla' | 'forge' | 'neoforge' | 'quilt' | 'fabric' | 'legacyfabric'; +export type GameLoader = "vanilla" | "forge" | "neoforge" | "quilt" | "fabric" | "legacyfabric" -export type HashAlgorithm = 'Sha1' | 'Sha256' | 'Md5'; +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 IOError = { InvalidAbsolutePath: string } | { IOErrorWrapper: { path: string } } | "IOError" | "DeserializeError" | "AsyncZipError" -export type Icon = string; +export type Icon = string -export type IncompatiblePackageType = 'McVersion' | 'Loader'; +export type IncompatiblePackageType = "McVersion" | "Loader" -export type IngressError = 'NotFound'; +export type IngressError = "NotFound" -export interface IngressPayload { id: string; message: string; ingress_type: IngressType; percent: number | null; total: number } +export type 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 IngressType = { Download: { file_name: string } } | "JavaPrepare" | "JavaCheck" | "JavaLocate" | "MinecraftDownload" | { PrepareCluster: { cluster_name: string } } -export type JavaError = { ParseVersion: [string] } | 'Execute' | 'MissingJava'; +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 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 LauncherEvent = { Ingress: IngressPayload } | { Message: MessagePayload } | { Process: ProcessPayload } -export type MessageLevel = 'Info' | 'Warn' | 'Error'; +export type MessageLevel = "Info" | "Warn" | "Error" -export interface MessagePayload { level: MessageLevel; message: string } +export type MessagePayload = { level: MessageLevel; message: string } -export type MetadataError = 'FetchError' | { NotModdedManifest: GameLoader } | { NotVanillaManifest: GameLoader } | 'ParseError' | 'NoMatchingLoader' | 'NoMatchingVersion'; +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'; +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'; +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 { +export type 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`]. - */ - expires: string; +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`]. + */ +expires: string } -} +export type 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 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 type PackageError = 'NoPrimaryFile' | 'IsModPack' | { Incompatible: IncompatiblePackageType }; +export type Process = { pid: number; started_at: string; cluster_id: bigint; post_hook: string | null; account_id: string } -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 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 type ProcessPayload = { Starting: { command: string } } | { Started: { process: Process } } | { Stopped: { pid: number; exit_code: number } } | { Output: { pid: number; output: string } }; +export type Resolution = { width: number; height: number } -export interface Resolution { width: number; height: number } +export type 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 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 type SettingsOsExtra = Record -export interface SettingsOsExtra { enable_gamemode: boolean | null } +const ARGS_MAP = { 'onelauncher':'{"return_error":[],"open_dev_tools":[]}', 'core':'{"get_users":[],"get_user":["uuid"],"get_default_user":["fallback"],"get_cluster":["id"],"create_cluster":["options"],"get_profile_or_default":["name"],"remove_cluster":["id"],"set_default_user":["uuid"],"open_msa_login":[],"get_global_profile":[],"remove_user":["uuid"],"get_clusters":[]}', '':'{"send_event":["event"]}' } +export type Router = { 'onelauncher': { return_error: () => Promise, +open_dev_tools: () => Promise }, +'core': { get_clusters: () => Promise, +get_cluster: (id: bigint) => Promise, +remove_cluster: (id: bigint) => Promise, +create_cluster: (options: CreateCluster) => Promise, +get_profile_or_default: (name: string | null) => Promise, +get_global_profile: () => Promise, +get_users: () => Promise, +get_user: (uuid: string) => Promise, +remove_user: (uuid: string) => Promise, +get_default_user: (fallback: boolean | null) => Promise, +set_default_user: (uuid: string | null) => Promise, +open_msa_login: () => Promise }, +'': { send_event: (event: LauncherEvent) => Promise } }; +<<<<<<< Updated upstream const ARGS_MAP = { '': '{"send_event":["event"]}', 'onelauncher': '{"return_error":[],"open_dev_tools":[]}', 'core': '{"get_user":["uuid"],"get_default_user":["fallback"],"set_default_user":["uuid"],"get_global_profile":[],"get_clusters":[],"remove_cluster":["id"],"get_profile_or_default":["name"],"get_users":[],"remove_user":["uuid"],"open_msa_login":[],"create_cluster":["options"],"get_cluster":["id"]}' }; export interface Router { 'onelauncher': { return_error: () => Promise; open_dev_tools: () => Promise }; 'core': { get_clusters: () => Promise>; get_cluster: (id: bigint) => Promise; remove_cluster: (id: bigint) => Promise; create_cluster: (options: CreateCluster) => Promise; get_profile_or_default: (name: string | null) => Promise; get_global_profile: () => Promise; get_users: () => Promise>; get_user: (uuid: string) => Promise; remove_user: (uuid: string) => Promise; get_default_user: (fallback: boolean | null) => Promise; set_default_user: (uuid: string | null) => Promise; open_msa_login: () => Promise }; '': { send_event: (event: LauncherEvent) => Promise }; } +======= +>>>>>>> Stashed changes -export type { InferCommandOutput }; -export const createTauRPCProxy = () => createProxy(ARGS_MAP); +export type { InferCommandOutput } +export const createTauRPCProxy = () => createProxy(ARGS_MAP)