Files
WT-Offline/apps/launcher/src/shared/schemas/maintenance.ts
T
N0VAN0M4LY 5a78b1fdf8 fix(copies): honor confirmed Steam locations
Bind confirmation to the selected copy and data paths throughout installation, launch, and maintenance. Validate redirected runtime data paths and recheck original files before refreshing an in-place backup.

Verified by type checking and build. The acceptance checklist covers directory links and Steam confirmation.
2026-11-30 15:23:17 +08:00

37 lines
1.3 KiB
TypeScript

import { z } from 'zod';
import { CopyIdSchema } from './install.ts';
export const MaintenanceOperationSchema = z.enum(['check', 'repair', 'update', 'compact', 'delete', 'confirm-steam']);
export const MaintenanceRequestSchema = z.object({
id: CopyIdSchema,
operation: MaintenanceOperationSchema,
deleteData: z.boolean().default(false),
steamLocations: z.object({
copyPath: z.string().min(1),
dataPath: z.string().min(1),
}).optional(),
});
export const MaintenanceInfoSchema = z.object({
sourceVersion: z.string().nullable(),
updateAvailable: z.boolean(),
spaceSavingAvailable: z.boolean(),
steamConfirmationRequired: z.boolean(),
steamLocations: z.object({
copyPath: z.string(),
dataPath: z.string(),
copyInSteam: z.boolean(),
dataInSteam: z.boolean(),
}).nullable(),
});
export const MaintenanceProgressSchema = z.object({
id: CopyIdSchema,
operation: MaintenanceOperationSchema,
phase: z.enum(['checking', 'copying', 'applying']),
doneBytes: z.number().nonnegative(),
totalBytes: z.number().nonnegative(),
});
export type MaintenanceRequest = z.output<typeof MaintenanceRequestSchema>;
export type MaintenanceInfo = z.output<typeof MaintenanceInfoSchema>;
export type MaintenanceProgress = z.output<typeof MaintenanceProgressSchema>;