mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-22 00:02:38 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user