@mittwald/cli 1.0.0-alpha.44 → 1.0.0-alpha.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/rendering/react/components/Error/APIError.d.ts +2 -2
- package/dist/rendering/react/components/Error/APIError.js +14 -2
- package/dist/rendering/react/components/Error/GenericError.js +2 -2
- package/dist/rendering/react/components/ErrorBox.js +2 -2
- package/dist/rendering/react/components/Value.d.ts +1 -0
- package/dist/rendering/react/components/Value.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1997,7 +1997,7 @@ EXAMPLES
|
|
|
1997
1997
|
$ mw autocomplete --refresh-cache
|
|
1998
1998
|
```
|
|
1999
1999
|
|
|
2000
|
-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.0.
|
|
2000
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.0.18/src/commands/autocomplete/index.ts)_
|
|
2001
2001
|
|
|
2002
2002
|
## `mw backup create`
|
|
2003
2003
|
|
|
@@ -3768,7 +3768,7 @@ DESCRIPTION
|
|
|
3768
3768
|
Display help for mw.
|
|
3769
3769
|
```
|
|
3770
3770
|
|
|
3771
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.
|
|
3771
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.22/src/commands/help.ts)_
|
|
3772
3772
|
|
|
3773
3773
|
## `mw login reset`
|
|
3774
3774
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import ErrorStack from "./ErrorStack.js";
|
|
4
4
|
import ErrorText from "./ErrorText.js";
|
|
5
5
|
import ErrorBox from "./ErrorBox.js";
|
|
6
|
+
import { SingleResultTable } from "../SingleResult.js";
|
|
7
|
+
import { Value } from "../Value.js";
|
|
6
8
|
function RequestHeaders({ headers }) {
|
|
7
9
|
const lines = headers.trim().split("\r\n");
|
|
8
10
|
const requestLine = lines.shift();
|
|
@@ -19,11 +21,21 @@ function HttpMessages({ err }) {
|
|
|
19
21
|
const response = err.response ? (_jsx(Response, { status: err.response.status, statusText: err.response.statusText, body: err.response.data, headers: err.response.headers })) : (_jsx(Text, { children: "no response received" }));
|
|
20
22
|
return (_jsxs(Box, { marginX: 2, marginY: 1, flexDirection: "column", rowGap: 1, children: [_jsx(RequestHeaders, { headers: err.request._header }), response] }));
|
|
21
23
|
}
|
|
24
|
+
function ErrorDetails({ err }) {
|
|
25
|
+
const errorBody = err.response?.data;
|
|
26
|
+
return (_jsx(SingleResultTable, { rows: {
|
|
27
|
+
Request: (_jsxs(Value, { bold: true, children: [err.config?.method?.toUpperCase(), " ", err.config?.url] })),
|
|
28
|
+
Response: (_jsxs(Value, { bold: true, children: [err.response?.status, " ", err.response?.statusText] })),
|
|
29
|
+
"Error Type": _jsx(Value, { bold: true, children: errorBody?.type }),
|
|
30
|
+
Message: _jsx(Value, { bold: true, children: errorBody?.message }),
|
|
31
|
+
"Trace ID": _jsx(Value, { bold: true, children: errorBody?.params?.["traceId"] }),
|
|
32
|
+
} }));
|
|
33
|
+
}
|
|
22
34
|
/**
|
|
23
35
|
* Render an API client error to the terminal. In the case of an API client
|
|
24
36
|
* error, the error message will be displayed, as well as (when enabled) the
|
|
25
37
|
* request and response headers and body.
|
|
26
38
|
*/
|
|
27
39
|
export default function APIError({ err, withStack, withHTTPMessages, }) {
|
|
28
|
-
return (_jsxs(
|
|
40
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(ErrorBox, { children: [_jsx(ErrorText, { bold: true, underline: true, children: "API CLIENT ERROR" }), _jsxs(ErrorText, { children: ["An error occurred while communicating with the API: ", err.message] }), _jsx(ErrorDetails, { err: err }), _jsx(Text, { children: JSON.stringify(err.response?.data, undefined, 2) })] }), withHTTPMessages === "full" ? _jsx(HttpMessages, { err: err }) : undefined, withStack && "stack" in err ? _jsx(ErrorStack, { err: err }) : undefined] }));
|
|
29
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "ink";
|
|
3
3
|
import ErrorStack from "./ErrorStack.js";
|
|
4
4
|
import ErrorText from "./ErrorText.js";
|
|
@@ -9,5 +9,5 @@ const issueURL = "https://github.com/mittwald/cli/issues/new";
|
|
|
9
9
|
* have a specific rendering function.
|
|
10
10
|
*/
|
|
11
11
|
export default function GenericError({ err, withStack, withIssue = true, title = "Error", }) {
|
|
12
|
-
return (_jsxs(
|
|
12
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(ErrorBox, { children: [_jsx(ErrorText, { bold: true, underline: true, children: title.toUpperCase() }), _jsx(ErrorText, { children: "An error occurred while executing this command:" }), _jsx(Box, { marginX: 2, children: _jsx(ErrorText, { children: err.toString() }) }), withIssue ? (_jsxs(ErrorText, { children: ["If you believe this to be a bug, please open an issue at ", issueURL, "."] })) : undefined] }), withStack && "stack" in err ? _jsx(ErrorStack, { err: err }) : undefined] }));
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { FailedFlagValidationError, RequiredArgsError, } from "@oclif/core/lib/parser/errors.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AxiosError } from "@mittwald/api-client-commons";
|
|
4
4
|
import InteractiveInputRequiredError from "../../../lib/error/InteractiveInputRequiredError.js";
|
|
5
5
|
import UnexpectedShortIDPassedError from "../../../lib/error/UnexpectedShortIDPassedError.js";
|
|
6
6
|
import GenericError from "./Error/GenericError.js";
|
|
@@ -21,7 +21,7 @@ export const ErrorBox = ({ err }) => {
|
|
|
21
21
|
else if (err instanceof RequiredArgsError) {
|
|
22
22
|
return _jsx(InvalidArgsError, { err: err });
|
|
23
23
|
}
|
|
24
|
-
else if (err instanceof
|
|
24
|
+
else if (err instanceof AxiosError) {
|
|
25
25
|
return _jsx(APIError, { err: err, withStack: true, withHTTPMessages: "body" });
|
|
26
26
|
}
|
|
27
27
|
else if (err instanceof InteractiveInputRequiredError) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from "ink";
|
|
3
|
-
export const Value = ({ children, notSet }) => {
|
|
3
|
+
export const Value = ({ children, notSet, bold }) => {
|
|
4
4
|
if (notSet || children === undefined) {
|
|
5
5
|
return _jsx(Text, { color: "gray", children: "not set" });
|
|
6
6
|
}
|
|
7
|
-
return _jsx(Text, { color: "blue", children: children });
|
|
7
|
+
return (_jsx(Text, { color: "blue", bold: bold, children: children }));
|
|
8
8
|
};
|