Skip to content

Open-source Xbox-inspired desktop launcher for Xodus on Linux

TypeScript

feat: define component update plan and result bridge

domsvobodad04a81dc01a0
diff --git a/src/preload/index.cts b/src/preload/index.cts
index 8e43551..fca094d 100644
--- a/src/preload/index.cts
+++ b/src/preload/index.cts
@@ -100,6 +100,10 @@ const api: LauncherApi = {
ipcRenderer.on('keyring-state', listener);
return () => ipcRenderer.removeListener('keyring-state', listener);
},
+ planComponentUpdates: () => ipcRenderer.invoke('component-updates-plan'),
+ applyComponentUpdates: (planId: string) => ipcRenderer.invoke('component-updates-apply', planId),
+ getComponentUpdatesStatus: () => ipcRenderer.invoke('component-updates-status'),
+ retryComponentUpdate: (planId: string, itemId: string) => ipcRenderer.invoke('component-updates-retry', planId, itemId),
checkLauncherUpdate: () => ipcRenderer.invoke('check-launcher-update'),
installLauncherUpdate: () => ipcRenderer.invoke('install-launcher-update'),
restartLauncher: () => ipcRenderer.invoke('restart-launcher'),
diff --git a/src/shared/types.ts b/src/shared/types.ts
index fdcb993..1c4cc6e 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -232,6 +232,27 @@ export interface Settings {
firstRunCompleted?: boolean;
}
+export type ComponentUpdateOutcome = 'updated' | 'unchanged' | 'skipped' | 'stale' | 'committed-needs-attention' | 'failed-before-commit' | 'not-run' | 'deferred';
+export interface ComponentUpdatePlanItem {
+ id: string;
+ component: 'backend' | 'runtime' | 'launcher';
+ label: string;
+ currentVersion?: string;
+ targetVersion?: string;
+ state: 'ready' | 'unchanged' | 'skipped' | 'deferred';
+ reason?: string;
+}
+export interface ComponentUpdatePlan { id: string; createdAt: string; items: ComponentUpdatePlanItem[] }
+export interface ComponentUpdateItemResult {
+ id: string;
+ outcome: ComponentUpdateOutcome;
+ message?: string;
+ committed: boolean;
+ retryable: boolean;
+}
+export interface ComponentUpdateBatchResult { planId: string; items: ComponentUpdateItemResult[]; restartRequired: boolean }
+export interface ComponentUpdatesStatus { running: boolean; phase?: string; plan?: ComponentUpdatePlan; result?: ComponentUpdateBatchResult }
+
export interface LauncherUpdate {
currentVersion: string;
latestVersion?: string;
@@ -306,6 +327,7 @@ export interface AppSnapshot {
settings: Settings;
auth: AuthStatus;
launcherUpdate?: LauncherUpdate;
+ componentUpdates?: ComponentUpdatesStatus;
gameOperation?: GameOperation;
gameUpdates?: Record<string, GameUpdate>;
downloadProgressSupported?: boolean;
@@ -611,6 +633,10 @@ export interface LauncherApi {
startKeyring(): Promise<KeyringStatus>;
createKeyringCollection(): Promise<KeyringStatus>;
onKeyringStatus(callback: (status: KeyringStatus) => void): () => void;
+ planComponentUpdates(): Promise<ComponentUpdatePlan>;
+ applyComponentUpdates(planId: string): Promise<ComponentUpdateBatchResult>;
+ getComponentUpdatesStatus(): Promise<ComponentUpdatesStatus>;
+ retryComponentUpdate(planId: string, itemId: string): Promise<ComponentUpdateBatchResult>;
checkLauncherUpdate(): Promise<LauncherUpdate | undefined>;
installLauncherUpdate(): Promise<void>;
restartLauncher(): Promise<void>;