From a3f728b5bad2d6580732719c4a46917d139ac20d Mon Sep 17 00:00:00 2001 From: Gilles Soulier Date: Thu, 4 Jun 2026 20:57:16 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20types=20JSON=20canoniques=20partag?= =?UTF-8?q?=C3=A9s=20(snapshot,=20execution,=20machine)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- shared/types.ts | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 shared/types.ts diff --git a/shared/types.ts b/shared/types.ts new file mode 100644 index 0000000..d51ae8a --- /dev/null +++ b/shared/types.ts @@ -0,0 +1,56 @@ +// shared/types.ts +export type OsFamily = "debian" | "ubuntu" | "unknown"; +export type MachineStatus = "unknown" | "ok" | "updates_available" | "error" | "running"; +export type AptProxyMode = "direct" | "runtime"; +export type ActionType = "apt_full_upgrade" | "reboot"; +export type ExecutionStatus = "ok" | "warning" | "error"; + +export interface AptPackage { + name: string; + currentVersion: string | null; + targetVersion: string; + origin: string | null; +} + +export interface UpdateSnapshot { + machineId: string; + hostname: string; + os: { family: OsFamily; version: string }; + checkedAt: string; // ISO 8601 + status: MachineStatus; + apt: { + enabled: boolean; + count: number; + rebootRequired: boolean; + packages: AptPackage[]; + }; + rawHints?: { logImportantLines: string[] }; +} + +export interface ExecutionResult { + executionId: string; + machineId: string; + startedAt: string; + finishedAt: string; + mode: "manual"; + action: ActionType; + status: ExecutionStatus; + rebootRequiredAfterRun: boolean; + importantLogLines: string[]; + rawLogRef: string; + reportRef: string; +} + +/** Vue machine renvoyée par l'API — NE CONTIENT JAMAIS de secret. */ +export interface MachineView { + id: string; + name: string; + hostname: string; + port: number; + osFamily: OsFamily; + username: string; + aptProxyMode: AptProxyMode; + aptProxyUrl: string | null; + status: MachineStatus; + lastCheckedAt: string | null; +}