feat(cli): list, get and restore trashed items with wmill trash (#11125)

* feat(cli): list, get and restore trashed items from the CLI

* docs(cli): tell agents a sync push deletion is restorable with wmill trash

* refactor(cli): share the ApiError formatting and type trash flags as integers
This commit is contained in:
Ruben Fiszel
2026-09-14 20:06:56 +00:00
committed by GitHub
parent 91e6dc39ce
commit a95e950529
13 changed files with 471 additions and 80 deletions
+17
View File
@@ -353,6 +353,23 @@ export function formatTimestamp(ts: string): string {
return new Date(ts).toISOString().replace("T", " ").substring(0, 19);
}
/**
* "<status text>: <body>" for an error thrown by the generated API client,
* undefined for anything else. Backend source references such as
* `(flows.rs:1400)` are stripped from the body.
*/
export function apiErrorMessage(e: unknown): string | undefined {
if (!(e && typeof e === "object" && "name" in e && e.name === "ApiError")) {
return undefined;
}
const { body, statusText } = e as { body?: unknown; statusText?: string };
const bodyStr =
typeof body === "object" && body !== null
? JSON.stringify(body)
: String(body ?? "");
return statusText + ": " + bodyStr.replace(/\s*[@(]\w+\.rs:\d+[:\d]*\)?/g, "");
}
/**
* Validate that required arguments are present when no -d data was provided.
* Fetches the schema from the API and checks required fields.