@mittwald/cli 1.0.0-alpha.11 → 1.0.0-alpha.14

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.
Files changed (127) hide show
  1. package/README.md +1136 -579
  2. package/dist/esm/DeleteBaseCommand.js +1 -1
  3. package/dist/esm/Helpers.d.ts +1 -0
  4. package/dist/esm/Helpers.js +7 -1
  5. package/dist/esm/Translator.d.ts +1 -0
  6. package/dist/esm/Translator.js +11 -0
  7. package/dist/esm/commands/app/install/wordpress.js +1 -1
  8. package/dist/esm/commands/context/set.js +4 -3
  9. package/dist/esm/commands/database/mysql/charsets.d.ts +14 -3
  10. package/dist/esm/commands/database/mysql/charsets.js +25 -2
  11. package/dist/esm/commands/database/mysql/create.d.ts +23 -0
  12. package/dist/esm/commands/database/mysql/create.js +103 -0
  13. package/dist/esm/commands/database/mysql/delete.d.ts +14 -0
  14. package/dist/esm/commands/database/mysql/delete.js +20 -0
  15. package/dist/esm/commands/database/mysql/dump.d.ts +15 -0
  16. package/dist/esm/commands/database/mysql/dump.js +70 -0
  17. package/dist/esm/commands/database/mysql/get.d.ts +14 -2
  18. package/dist/esm/commands/database/mysql/get.js +14 -5
  19. package/dist/esm/commands/database/mysql/list.d.ts +11 -3
  20. package/dist/esm/commands/database/mysql/list.js +23 -13
  21. package/dist/esm/commands/database/mysql/phpmyadmin.d.ts +8 -0
  22. package/dist/esm/commands/database/mysql/phpmyadmin.js +25 -0
  23. package/dist/esm/commands/database/mysql/port-forward.d.ts +14 -0
  24. package/dist/esm/commands/database/mysql/port-forward.js +44 -0
  25. package/dist/esm/commands/database/mysql/shell.d.ts +14 -0
  26. package/dist/esm/commands/database/mysql/shell.js +39 -0
  27. package/dist/esm/commands/database/mysql/user/get.d.ts +13 -2
  28. package/dist/esm/commands/database/mysql/user/get.js +18 -5
  29. package/dist/esm/commands/database/mysql/user/list.d.ts +13 -3
  30. package/dist/esm/commands/database/mysql/user/list.js +38 -2
  31. package/dist/esm/commands/database/mysql/versions.d.ts +13 -3
  32. package/dist/esm/commands/database/mysql/versions.js +19 -2
  33. package/dist/esm/commands/database/redis/get.d.ts +15 -2
  34. package/dist/esm/commands/database/redis/get.js +21 -5
  35. package/dist/esm/commands/database/redis/list.d.ts +13 -3
  36. package/dist/esm/commands/database/redis/list.js +26 -2
  37. package/dist/esm/commands/database/redis/shell.d.ts +13 -0
  38. package/dist/esm/commands/database/redis/shell.js +26 -0
  39. package/dist/esm/commands/database/redis/versions.d.ts +11 -3
  40. package/dist/esm/commands/database/redis/versions.js +12 -2
  41. package/dist/esm/commands/domain/virtualhost/create.js +1 -1
  42. package/dist/esm/commands/login/reset.js +1 -1
  43. package/dist/esm/commands/mail/address/create.d.ts +1 -1
  44. package/dist/esm/commands/mail/address/create.js +1 -1
  45. package/dist/esm/commands/org/delete.js +2 -3
  46. package/dist/esm/commands/org/invite/revoke.js +1 -1
  47. package/dist/esm/commands/org/invite.js +1 -1
  48. package/dist/esm/commands/org/list.js +4 -0
  49. package/dist/esm/commands/org/membership/revoke.js +1 -1
  50. package/dist/esm/commands/project/create.js +1 -1
  51. package/dist/esm/commands/project/get.js +8 -4
  52. package/dist/esm/commands/project/list-react.js +1 -1
  53. package/dist/esm/commands/user/api-token/create.js +1 -1
  54. package/dist/esm/commands/user/ssh-key/create.js +1 -1
  55. package/dist/esm/lib/database/common.d.ts +8 -0
  56. package/dist/esm/lib/database/common.js +17 -0
  57. package/dist/esm/lib/database/mysql/connect.d.ts +19 -0
  58. package/dist/esm/lib/database/mysql/connect.js +50 -0
  59. package/dist/esm/lib/database/mysql/flags.d.ts +10 -0
  60. package/dist/esm/lib/database/mysql/flags.js +48 -0
  61. package/dist/esm/lib/database/redis/connect.d.ts +8 -0
  62. package/dist/esm/lib/database/redis/connect.js +22 -0
  63. package/dist/esm/lib/database/redis/flags.d.ts +7 -0
  64. package/dist/esm/lib/database/redis/flags.js +35 -0
  65. package/dist/esm/lib/org/flags.js +2 -1
  66. package/dist/esm/rendering/process/components/ProcessConfirmation.d.ts +6 -0
  67. package/dist/esm/rendering/process/components/ProcessConfirmation.js +12 -0
  68. package/dist/esm/rendering/process/components/ProcessConfirmationStateSummary.d.ts +5 -0
  69. package/dist/esm/rendering/process/components/ProcessConfirmationStateSummary.js +18 -0
  70. package/dist/esm/rendering/process/components/ProcessError.d.ts +4 -0
  71. package/dist/esm/rendering/process/components/ProcessError.js +10 -0
  72. package/dist/esm/rendering/process/components/ProcessInput.d.ts +6 -0
  73. package/dist/esm/rendering/process/components/ProcessInput.js +15 -0
  74. package/dist/esm/rendering/process/components/ProcessInputStateSummary.d.ts +5 -0
  75. package/dist/esm/rendering/process/components/ProcessInputStateSummary.js +13 -0
  76. package/dist/esm/rendering/process/components/ProcessState.d.ts +5 -0
  77. package/dist/esm/rendering/process/components/ProcessState.js +8 -0
  78. package/dist/esm/rendering/process/components/ProcessStateIcon.d.ts +5 -0
  79. package/dist/esm/rendering/process/components/ProcessStateIcon.js +22 -0
  80. package/dist/esm/rendering/process/components/ProcessStateSummary.d.ts +5 -0
  81. package/dist/esm/rendering/process/components/ProcessStateSummary.js +27 -0
  82. package/dist/esm/rendering/process/components/ProcessValidationErrors.d.ts +7 -0
  83. package/dist/esm/rendering/process/components/ProcessValidationErrors.js +15 -0
  84. package/dist/esm/rendering/{react → process}/process.d.ts +5 -5
  85. package/dist/esm/rendering/{react → process}/process_fancy.d.ts +1 -12
  86. package/dist/esm/rendering/process/process_fancy.js +119 -0
  87. package/dist/esm/rendering/process/process_flags.d.ts +20 -0
  88. package/dist/esm/rendering/{react → process}/process_flags.js +13 -0
  89. package/dist/esm/rendering/{react → process}/process_quiet.d.ts +2 -2
  90. package/dist/esm/rendering/react/components/ErrorBox.d.ts +11 -0
  91. package/dist/esm/rendering/react/components/ErrorBox.js +45 -0
  92. package/dist/esm/rendering/react/components/{ProjectReadiness.js → Project/ProjectReadiness.js} +1 -1
  93. package/dist/esm/rendering/react/components/Project/ProjectStatus.d.ts +18 -0
  94. package/dist/esm/rendering/react/error.d.ts +6 -0
  95. package/dist/esm/rendering/react/error.js +9 -40
  96. package/package.json +25 -5
  97. package/dist/esm/commands/database/mysql/user/getMysqlUserPhpMyAdminUrl.d.ts +0 -3
  98. package/dist/esm/commands/database/mysql/user/getMysqlUserPhpMyAdminUrl.js +0 -7
  99. package/dist/esm/generated/database/getMysqlDatabase.d.ts +0 -16
  100. package/dist/esm/generated/database/getMysqlDatabase.js +0 -25
  101. package/dist/esm/generated/database/getMysqlUser.d.ts +0 -16
  102. package/dist/esm/generated/database/getMysqlUser.js +0 -25
  103. package/dist/esm/generated/database/getMysqlUserPhpMyAdminUrl.d.ts +0 -14
  104. package/dist/esm/generated/database/getMysqlUserPhpMyAdminUrl.js +0 -24
  105. package/dist/esm/generated/database/getRedisDatabase.d.ts +0 -16
  106. package/dist/esm/generated/database/getRedisDatabase.js +0 -25
  107. package/dist/esm/generated/database/listMysqlCharsets.d.ts +0 -13
  108. package/dist/esm/generated/database/listMysqlCharsets.js +0 -17
  109. package/dist/esm/generated/database/listMysqlDatabases.d.ts +0 -13
  110. package/dist/esm/generated/database/listMysqlDatabases.js +0 -24
  111. package/dist/esm/generated/database/listMysqlUsers.d.ts +0 -13
  112. package/dist/esm/generated/database/listMysqlUsers.js +0 -24
  113. package/dist/esm/generated/database/listMysqlVersions.d.ts +0 -13
  114. package/dist/esm/generated/database/listMysqlVersions.js +0 -17
  115. package/dist/esm/generated/database/listRedisDatabases.d.ts +0 -13
  116. package/dist/esm/generated/database/listRedisDatabases.js +0 -24
  117. package/dist/esm/generated/database/listRedisVersions.d.ts +0 -13
  118. package/dist/esm/generated/database/listRedisVersions.js +0 -17
  119. package/dist/esm/rendering/react/components/ProjectStatus.d.ts +0 -7
  120. package/dist/esm/rendering/react/process_fancy.js +0 -221
  121. package/dist/esm/rendering/react/process_flags.d.ts +0 -9
  122. /package/dist/esm/rendering/{react → process}/process.js +0 -0
  123. /package/dist/esm/rendering/{react → process}/process_quiet.js +0 -0
  124. /package/dist/esm/rendering/react/components/{ProjectEnabled.d.ts → Project/ProjectEnabled.d.ts} +0 -0
  125. /package/dist/esm/rendering/react/components/{ProjectEnabled.js → Project/ProjectEnabled.js} +0 -0
  126. /package/dist/esm/rendering/react/components/{ProjectReadiness.d.ts → Project/ProjectReadiness.d.ts} +0 -0
  127. /package/dist/esm/rendering/react/components/{ProjectStatus.js → Project/ProjectStatus.js} +0 -0
@@ -1,13 +0,0 @@
1
- import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
2
- import { ListBaseCommand } from "../../ListBaseCommand.js";
3
- export type PathParams = MittwaldAPIV2.Paths.V2RedisVersions.Get.Parameters.Path;
4
- export type Response = Awaited<ReturnType<MittwaldAPIV2Client["database"]["listRedisVersions"]>>;
5
- export declare abstract class GeneratedDatabaseListRedisVersions<TItem extends Record<string, unknown>> extends ListBaseCommand<typeof GeneratedDatabaseListRedisVersions, TItem, Response> {
6
- static description: string;
7
- static args: {};
8
- static flags: {
9
- [x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
10
- };
11
- getData(): Promise<Response>;
12
- protected mapParams(input: PathParams): Promise<PathParams> | PathParams;
13
- }
@@ -1,17 +0,0 @@
1
- import { ListBaseCommand } from "../../ListBaseCommand.js";
2
- export class GeneratedDatabaseListRedisVersions extends ListBaseCommand {
3
- static description = "List available Redis versions.";
4
- static args = {};
5
- static flags = {
6
- ...ListBaseCommand.baseFlags,
7
- };
8
- async getData() {
9
- const pathParams = {};
10
- return await this.apiClient.database.listRedisVersions({
11
- pathParameters: await this.mapParams(pathParams),
12
- });
13
- }
14
- mapParams(input) {
15
- return input;
16
- }
17
- }
@@ -1,7 +0,0 @@
1
- import { FC } from "react";
2
- import { MittwaldAPIV2 } from "@mittwald/api-client";
3
- interface Props {
4
- project: MittwaldAPIV2.Components.Schemas.ProjectProject | MittwaldAPIV2.Paths.V2Projects.Get.Responses.$200.Content.ApplicationJson[number];
5
- }
6
- export declare const ProjectStatus: FC<Props>;
7
- export {};
@@ -1,221 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { RunnableHandler, } from "./process.js";
4
- import { Header } from "./components/Header.js";
5
- import { Box, render, Text, useInput, useStdin } from "ink";
6
- import TextInput from "ink-text-input";
7
- import { isValidationError } from "../../lib/handleError.js";
8
- export class FancyProcessRenderer {
9
- title;
10
- started = false;
11
- currentHandler = null;
12
- constructor(title) {
13
- this.title = title;
14
- }
15
- start() {
16
- if (this.started) {
17
- return;
18
- }
19
- this.started = true;
20
- render(this.renderStart(), {}).unmount();
21
- }
22
- addStep(title) {
23
- this.start();
24
- if (this.currentHandler !== null) {
25
- this.currentHandler.abort();
26
- }
27
- title = _jsx(_Fragment, { children: title });
28
- const state = { type: "step", title, phase: "running" };
29
- const renderHandle = render(_jsx(ProcessState, { step: state }));
30
- this.currentHandler = new RunnableHandler(state, () => {
31
- renderHandle.rerender(_jsx(ProcessState, { step: state }));
32
- if (this.currentHandler?.done) {
33
- this.currentHandler = null;
34
- renderHandle.unmount();
35
- }
36
- });
37
- return this.currentHandler;
38
- }
39
- async runStep(title, fn) {
40
- const step = this.addStep(title);
41
- try {
42
- const result = await fn();
43
- step.complete();
44
- return result;
45
- }
46
- catch (err) {
47
- step.error(err);
48
- throw err;
49
- }
50
- }
51
- addInfo(title) {
52
- this.start();
53
- if (this.currentHandler !== null) {
54
- this.currentHandler.complete();
55
- }
56
- const state = { type: "info", title };
57
- render(_jsx(ProcessState, { step: state })).unmount();
58
- }
59
- addInput(question, mask) {
60
- this.start();
61
- if (this.currentHandler !== null) {
62
- this.currentHandler.complete();
63
- }
64
- const state = {
65
- type: "input",
66
- title: question,
67
- mask,
68
- };
69
- return new Promise((res) => {
70
- const onInput = (value) => {
71
- res(value);
72
- state.value = value;
73
- if (renderHandle) {
74
- renderHandle.rerender(_jsx(ProcessInput, { step: state, onSubmit: onInput }));
75
- renderHandle.unmount();
76
- }
77
- };
78
- const renderHandle = render(_jsx(ProcessInput, { step: state, onSubmit: onInput }));
79
- });
80
- }
81
- addConfirmation(question) {
82
- this.start();
83
- if (this.currentHandler !== null) {
84
- this.currentHandler.complete();
85
- }
86
- const state = {
87
- type: "confirm",
88
- title: question,
89
- confirmed: undefined,
90
- };
91
- return new Promise((res) => {
92
- const onConfirm = (confirmed) => {
93
- res(confirmed);
94
- state.confirmed = confirmed;
95
- if (renderHandle) {
96
- renderHandle.rerender(_jsx(ProcessConfirmation, { step: state, onConfirm: onConfirm }));
97
- renderHandle.unmount();
98
- }
99
- };
100
- const renderHandle = render(_jsx(ProcessConfirmation, { step: state, onConfirm: onConfirm }));
101
- });
102
- }
103
- complete(summary) {
104
- if (this.currentHandler) {
105
- this.currentHandler.complete();
106
- }
107
- render(_jsx(Box, { marginY: 1, marginX: 2, children: summary })).unmount();
108
- }
109
- error(err) {
110
- if (this.currentHandler) {
111
- this.currentHandler.error(err);
112
- }
113
- else {
114
- render(_jsx(Box, { marginY: 1, marginX: 2, borderStyle: "round", borderColor: "red", children: _jsxs(Text, { color: "red", children: ["Error: ", err?.toString()] }) })).unmount();
115
- }
116
- }
117
- renderStart() {
118
- return (_jsx(Box, { marginY: 1, marginX: 2, children: _jsx(Header, { title: this.title }) }));
119
- }
120
- }
121
- const ProcessStateIcon = ({ step }) => {
122
- if (step.type === "info") {
123
- return _jsxs(Text, { children: ["\u2139\uFE0F", " "] });
124
- }
125
- else if (step.type === "confirm" || step.type === "input") {
126
- return _jsx(Text, { children: "\u2753" });
127
- }
128
- else if (step.phase === "completed") {
129
- return _jsx(Text, { children: "\u2705" });
130
- }
131
- else if (step.phase === "aborted") {
132
- return _jsx(Text, { children: "\u23E9\uFE0F " });
133
- }
134
- else if (step.phase === "failed") {
135
- return _jsx(Text, { children: "\u274C" });
136
- }
137
- else {
138
- return _jsx(Text, { children: "\uD83D\uDD01 " });
139
- }
140
- };
141
- const ProcessInputStateSummary = ({ step }) => {
142
- if (step.value && step.mask) {
143
- return (_jsxs(_Fragment, { children: [_jsx(Text, { children: ": " }), _jsx(Text, { color: "blue", children: "[secret]" })] }));
144
- }
145
- if (step.value) {
146
- return (_jsxs(_Fragment, { children: [_jsx(Text, { children: ": " }), _jsx(Text, { color: "green", children: step.value })] }));
147
- }
148
- else {
149
- return _jsx(Text, { children: ": " });
150
- }
151
- };
152
- const InteractiveConfirmationDisabled = () => (_jsxs(Text, { color: "red", children: [" ", "interactive input required; start this command with --force or --quiet to disable interactive prompts"] }));
153
- const InteractiveInputDisabled = () => (_jsx(Text, { color: "red", children: "interactive input required; inspect this command's --help page to learn how to pass the required input non-interactively." }));
154
- const ProcessConfirmationStateSummary = ({ step }) => {
155
- const { isRawModeSupported } = useStdin();
156
- if (!isRawModeSupported) {
157
- return _jsx(InteractiveConfirmationDisabled, {});
158
- }
159
- if (step.confirmed) {
160
- return _jsx(Text, { color: "green", children: " confirmed" });
161
- }
162
- else if (step.confirmed === false) {
163
- return _jsx(Text, { color: "yellow", children: " not confirmed" });
164
- }
165
- else {
166
- return (_jsxs(_Fragment, { children: [_jsx(Text, { children: ": press " }), _jsx(Text, { color: "blue", children: "y" }), _jsx(Text, { children: " or " }), _jsx(Text, { color: "blue", children: "n" }), _jsxs(Text, { color: "gray", children: [" ", "(use the --force or --quiet flags to disable this prompt)"] })] }));
167
- }
168
- };
169
- const ProcessStateSummary = ({ step }) => {
170
- if (step.type === "info") {
171
- return _jsx(_Fragment, {});
172
- }
173
- else if (step.type === "confirm") {
174
- return _jsx(ProcessConfirmationStateSummary, { step: step });
175
- }
176
- else if (step.type === "input") {
177
- return _jsx(ProcessInputStateSummary, { step: step });
178
- }
179
- else if (step.phase === "completed") {
180
- return (_jsxs(_Fragment, { children: [_jsx(Text, { children: ". " }), _jsx(Text, { color: "green", children: "done" })] }));
181
- }
182
- else if (step.phase === "aborted") {
183
- return (_jsxs(_Fragment, { children: [_jsx(Text, { children: ". " }), _jsx(Text, { color: "yellow", children: "cancelled" })] }));
184
- }
185
- else if (step.phase === "failed") {
186
- return (_jsxs(_Fragment, { children: [_jsx(Text, { children: ". " }), _jsx(Text, { color: "red", children: "error" })] }));
187
- }
188
- else {
189
- return _jsx(Text, { children: "..." });
190
- }
191
- };
192
- const ProcessValidationErrors = ({ err, color = "red" }) => {
193
- const errorItems = err.validationErrors.map((e, idx) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { minWidth: e.path.length + 2, children: _jsxs(Text, { color: color, bold: true, children: [e.path, ":", " "] }) }), _jsx(Text, { color: color, children: e.message })] }, idx)));
194
- return (_jsxs(Box, { marginY: 1, marginX: 5, paddingX: 1, borderColor: color, borderStyle: "round", flexDirection: "column", width: 80, children: [_jsx(Text, { color: color, children: "Your input contained invalid data:" }), _jsx(Box, { flexDirection: "column", marginY: 1, children: errorItems }), _jsx(Text, { color: color, children: "Please correct the errors and try again. Consult this command's help page (by invoking it with the --help flag) for more information." })] }));
195
- };
196
- const ProcessError = ({ err }) => {
197
- if (isValidationError(err)) {
198
- return _jsx(ProcessValidationErrors, { err: err.response.data });
199
- }
200
- return (_jsxs(Box, { marginY: 1, marginX: 5, flexDirection: "column", children: [_jsx(Text, { color: "red", children: "An error occurred during this operation:" }), _jsx(Text, { color: "red", bold: true, children: err?.toString() })] }));
201
- };
202
- export const ProcessState = ({ step }) => {
203
- return (_jsxs(_Fragment, { children: [_jsxs(Box, { marginX: 2, children: [_jsx(ProcessStateIcon, { step: step }), _jsx(Text, { children: step.title }), _jsx(ProcessStateSummary, { step: step })] }), step.type === "step" && step.error ? (_jsx(ProcessError, { err: step.error })) : null] }));
204
- };
205
- export const ProcessConfirmation = ({ step, onConfirm }) => {
206
- const { isRawModeSupported } = useStdin();
207
- if (isRawModeSupported) {
208
- useInput((input) => {
209
- onConfirm(input === "y");
210
- });
211
- }
212
- return _jsx(ProcessState, { step: step });
213
- };
214
- export const ProcessInput = ({ step, onSubmit }) => {
215
- const [value, setValue] = useState("");
216
- if (!step.value) {
217
- const { isRawModeSupported } = useStdin();
218
- return (_jsx(_Fragment, { children: _jsxs(Box, { marginX: 2, children: [_jsx(ProcessStateIcon, { step: step }), _jsxs(Text, { children: [step.title, ": "] }), isRawModeSupported ? (_jsx(TextInput, { mask: step.mask ? "*" : undefined, value: value, onChange: setValue, onSubmit: onSubmit })) : (_jsx(InteractiveInputDisabled, {}))] }) }));
219
- }
220
- return _jsx(ProcessState, { step: step });
221
- };
@@ -1,9 +0,0 @@
1
- import { ProcessRenderer } from "./process.js";
2
- import { InferredFlags } from "@oclif/core/lib/interfaces/index.js";
3
- export declare const processFlags: {
4
- quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
5
- };
6
- export type ProcessFlags = InferredFlags<typeof processFlags>;
7
- export declare const makeProcessRenderer: (flags: {
8
- quiet: boolean;
9
- }, title: string) => ProcessRenderer;