Initial Tessera backup vault (M0–M2)
Scaffold Rust workspace, React canvas, vault engine, hub API, providers, agent wormhole path, and Docker compose per SPEC.
This commit is contained in:
57
web/src/api.ts
Normal file
57
web/src/api.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
export type Snapshot = {
|
||||
id: string;
|
||||
taken_at: string;
|
||||
orbit_name: string;
|
||||
size_bytes: number;
|
||||
};
|
||||
|
||||
export type Orbit = {
|
||||
id: string;
|
||||
name: string;
|
||||
provider: string;
|
||||
last_status: string;
|
||||
dry_run: boolean;
|
||||
schedule?: string | null;
|
||||
};
|
||||
|
||||
export async function fetchSnapshots(): Promise<Snapshot[]> {
|
||||
const r = await fetch("/api/v1/snapshots");
|
||||
if (!r.ok) throw new Error("snapshots");
|
||||
return r.json();
|
||||
}
|
||||
|
||||
export async function fetchOrbits(): Promise<Orbit[]> {
|
||||
const r = await fetch("/api/v1/orbits");
|
||||
if (!r.ok) throw new Error("orbits");
|
||||
return r.json();
|
||||
}
|
||||
|
||||
export async function startPairing(): Promise<{ code: string; expires_at: string }> {
|
||||
const r = await fetch("/api/v1/wormhole/pairing", { method: "POST" });
|
||||
return r.json();
|
||||
}
|
||||
|
||||
export async function runOrbit(id: string): Promise<void> {
|
||||
await fetch(`/api/v1/orbits/${id}/run`, { method: "POST" });
|
||||
}
|
||||
|
||||
export async function startReconstitute(snapshotId: string, target: string): Promise<{
|
||||
session_id: string;
|
||||
session: { seconds_remaining: number; state: string };
|
||||
}> {
|
||||
const r = await fetch("/api/v1/reconstitute", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ snapshot_id: snapshotId, target_path: target }),
|
||||
});
|
||||
return r.json();
|
||||
}
|
||||
|
||||
export async function abortReconstitute(sessionId: string): Promise<void> {
|
||||
await fetch(`/api/v1/reconstitute/${sessionId}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
export async function pollReconstitute(sessionId: string) {
|
||||
const r = await fetch(`/api/v1/reconstitute/${sessionId}`);
|
||||
return r.json();
|
||||
}
|
||||
Reference in New Issue
Block a user