@mittwald/cli 1.0.0-alpha.8 → 1.0.0-alpha.9
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 +129 -117
- package/dist/esm/BaseCommand.d.ts +1 -1
- package/dist/esm/DeleteBaseCommand.d.ts +6 -9
- package/dist/esm/DeleteBaseCommand.js +27 -21
- package/dist/esm/ExtendedBaseCommand.d.ts +1 -1
- package/dist/esm/Formatter.d.ts +5 -2
- package/dist/esm/Formatter.js +7 -2
- package/dist/esm/GetBaseCommand.d.ts +1 -1
- package/dist/esm/Helpers.d.ts +1 -0
- package/dist/esm/Helpers.js +7 -1
- package/dist/esm/ListBaseCommand.d.ts +1 -1
- package/dist/esm/ListBaseCommand.js +2 -2
- package/dist/esm/Printer.d.ts +6 -7
- package/dist/esm/Printer.js +3 -3
- package/dist/esm/Translator.d.ts +1 -0
- package/dist/esm/Translator.js +12 -1
- package/dist/esm/commands/app/delete.d.ts +1 -1
- package/dist/esm/commands/app/delete.js +1 -1
- package/dist/esm/commands/app/dependency/listSystemsoftwareversions.d.ts +1 -1
- package/dist/esm/commands/app/install/wordpress.d.ts +1 -2
- package/dist/esm/commands/app/install/wordpress.js +5 -9
- package/dist/esm/commands/app/list.d.ts +1 -1
- package/dist/esm/commands/app/versions.d.ts +1 -1
- package/dist/esm/commands/context/get.d.ts +10 -0
- package/dist/esm/commands/context/get.js +39 -0
- package/dist/esm/commands/context/set.d.ts +11 -0
- package/dist/esm/commands/context/set.js +37 -0
- package/dist/esm/commands/conversation/close.d.ts +1 -1
- package/dist/esm/commands/conversation/create.d.ts +1 -1
- package/dist/esm/commands/conversation/list.js +2 -2
- package/dist/esm/commands/conversation/reply.d.ts +1 -1
- package/dist/esm/commands/conversation/show.d.ts +1 -1
- package/dist/esm/commands/conversation/show.js +7 -7
- package/dist/esm/commands/conversation/show2.js +6 -3
- package/dist/esm/commands/domain/list.d.ts +12 -4
- package/dist/esm/commands/domain/list.js +16 -2
- package/dist/esm/commands/domain/virtualhost/list.js +10 -7
- package/dist/esm/commands/login/reset.d.ts +12 -0
- package/dist/esm/commands/login/reset.js +39 -0
- package/dist/esm/commands/login/status.d.ts +1 -1
- package/dist/esm/commands/login/token.d.ts +2 -1
- package/dist/esm/commands/login/token.js +1 -0
- package/dist/esm/commands/mail/address/create.d.ts +12 -4
- package/dist/esm/commands/mail/address/create.js +35 -26
- package/dist/esm/commands/mail/address/delete.d.ts +1 -0
- package/dist/esm/commands/mail/address/list.d.ts +11 -3
- package/dist/esm/commands/mail/address/list.js +23 -7
- package/dist/esm/commands/mail/deliverybox/list.d.ts +1 -1
- package/dist/esm/commands/mail/deliverybox/list.js +2 -2
- package/dist/esm/commands/org/list.js +1 -1
- package/dist/esm/commands/project/backup/list.d.ts +12 -5
- package/dist/esm/commands/project/backup/list.js +17 -9
- package/dist/esm/commands/project/create.d.ts +12 -4
- package/dist/esm/commands/project/create.js +32 -26
- package/dist/esm/commands/project/cronjob/execution/get.d.ts +15 -2
- package/dist/esm/commands/project/cronjob/execution/get.js +26 -5
- package/dist/esm/commands/project/cronjob/execution/list.d.ts +11 -4
- package/dist/esm/commands/project/cronjob/execution/list.js +27 -7
- package/dist/esm/commands/project/cronjob/execution/logs.d.ts +15 -0
- package/dist/esm/commands/project/cronjob/execution/logs.js +74 -0
- package/dist/esm/commands/project/cronjob/list.d.ts +12 -4
- package/dist/esm/commands/project/cronjob/list.js +24 -5
- package/dist/esm/commands/project/delete.d.ts +2 -1
- package/dist/esm/commands/project/delete.js +5 -11
- package/dist/esm/commands/project/filesystem/usage.d.ts +13 -3
- package/dist/esm/commands/project/filesystem/usage.js +51 -9
- package/dist/esm/commands/project/get.d.ts +13 -3
- package/dist/esm/commands/project/get.js +76 -9
- package/dist/esm/commands/project/invite/list-own.js +2 -2
- package/dist/esm/commands/project/invite/list.d.ts +1 -1
- package/dist/esm/commands/project/invite/list.js +2 -2
- package/dist/esm/commands/project/{list2.d.ts → list-react.d.ts} +3 -1
- package/dist/esm/commands/project/list-react.js +42 -0
- package/dist/esm/commands/project/membership/list-own.js +2 -2
- package/dist/esm/commands/project/membership/list.d.ts +1 -1
- package/dist/esm/commands/project/membership/list.js +2 -2
- package/dist/esm/commands/project/ssh.d.ts +2 -2
- package/dist/esm/commands/project/ssh.js +3 -8
- package/dist/esm/commands/project/update.d.ts +2 -2
- package/dist/esm/commands/project/update.js +6 -9
- package/dist/esm/commands/user/api-token/create.d.ts +9 -3
- package/dist/esm/commands/user/api-token/create.js +33 -15
- package/dist/esm/commands/user/api-token/list.js +4 -2
- package/dist/esm/commands/user/api-token/revoke.d.ts +8 -3
- package/dist/esm/commands/user/api-token/revoke.js +6 -6
- package/dist/esm/commands/user/session/list.js +4 -2
- package/dist/esm/commands/user/ssh-key/create.d.ts +6 -3
- package/dist/esm/commands/user/ssh-key/create.js +35 -18
- package/dist/esm/commands/user/ssh-key/delete.d.ts +5 -4
- package/dist/esm/commands/user/ssh-key/delete.js +7 -26
- package/dist/esm/lib/bytes.d.ts +1 -0
- package/dist/esm/lib/bytes.js +16 -0
- package/dist/esm/lib/context.d.ts +16 -0
- package/dist/esm/lib/context.js +42 -0
- package/dist/esm/lib/context_flags.d.ts +18 -0
- package/dist/esm/lib/context_flags.js +42 -0
- package/dist/esm/lib/project/flags.d.ts +5 -0
- package/dist/esm/lib/project/flags.js +3 -0
- package/dist/esm/lib/server/flags.d.ts +5 -0
- package/dist/esm/lib/server/flags.js +3 -0
- package/dist/esm/lib/viewhelpers/date.d.ts +2 -1
- package/dist/esm/lib/viewhelpers/date.js +9 -2
- package/dist/esm/lib/viewhelpers/removeLineBreaks.d.ts +1 -0
- package/dist/esm/lib/viewhelpers/removeLineBreaks.js +1 -0
- package/dist/esm/rendering/lib/getTerminalWidth.d.ts +1 -0
- package/dist/esm/rendering/lib/getTerminalWidth.js +2 -0
- package/dist/esm/rendering/react/ComponentPrinter.d.ts +7 -0
- package/dist/esm/rendering/react/ComponentPrinter.js +13 -0
- package/dist/esm/rendering/react/ExecRenderBaseCommand.d.ts +8 -0
- package/dist/esm/rendering/react/ExecRenderBaseCommand.js +15 -0
- package/dist/esm/rendering/react/RenderBaseCommand.d.ts +12 -0
- package/dist/esm/rendering/react/RenderBaseCommand.js +36 -4
- package/dist/esm/rendering/react/components/ByteFormat.d.ts +4 -0
- package/dist/esm/rendering/react/components/ByteFormat.js +12 -0
- package/dist/esm/rendering/react/components/{ConversationMessage.js → Conversation/ConversationMessage.js} +1 -1
- package/dist/esm/rendering/react/components/Conversation/ConversationMessages.d.ts +8 -0
- package/dist/esm/rendering/react/components/Conversation/ConversationMessages.js +13 -0
- package/dist/esm/rendering/react/components/{ConversationMeta.js → Conversation/ConversationMeta.js} +7 -3
- package/dist/esm/rendering/react/components/CreatedAt.d.ts +8 -0
- package/dist/esm/rendering/react/components/CreatedAt.js +10 -0
- package/dist/esm/rendering/react/components/Filename.d.ts +4 -0
- package/dist/esm/rendering/react/components/Filename.js +5 -0
- package/dist/esm/rendering/react/components/FormattedDate.d.ts +7 -0
- package/dist/esm/rendering/react/components/FormattedDate.js +18 -0
- package/dist/esm/rendering/react/components/Header.d.ts +2 -2
- package/dist/esm/rendering/react/components/IDAndShortID.d.ts +7 -0
- package/dist/esm/rendering/react/components/IDAndShortID.js +6 -0
- package/dist/esm/rendering/react/components/JSONView.d.ts +7 -0
- package/dist/esm/rendering/react/components/JSONView.js +3 -0
- package/dist/esm/rendering/react/components/ListItem.d.ts +3 -0
- package/dist/esm/rendering/react/components/ListItem.js +5 -0
- package/dist/esm/rendering/react/components/Note.d.ts +10 -0
- package/dist/esm/rendering/react/components/Note.js +8 -0
- package/dist/esm/rendering/react/components/ProjectEnabled.d.ts +6 -0
- package/dist/esm/rendering/react/components/ProjectEnabled.js +9 -0
- package/dist/esm/rendering/react/components/ProjectReadiness.d.ts +7 -0
- package/dist/esm/rendering/react/components/ProjectReadiness.js +16 -0
- package/dist/esm/rendering/react/components/ProjectStatus.d.ts +7 -0
- package/dist/esm/rendering/react/components/ProjectStatus.js +8 -0
- package/dist/esm/rendering/react/components/Render.d.ts +6 -0
- package/dist/esm/rendering/react/components/Render.js +5 -0
- package/dist/esm/rendering/react/components/SingleResult.d.ts +10 -0
- package/dist/esm/rendering/react/components/SingleResult.js +15 -0
- package/dist/esm/rendering/react/components/Success.d.ts +9 -0
- package/dist/esm/rendering/react/components/Success.js +6 -0
- package/dist/esm/rendering/react/components/Table/BodyCell.d.ts +7 -0
- package/dist/esm/rendering/react/components/Table/BodyCell.js +7 -0
- package/dist/esm/rendering/react/components/Table/BodyRow.d.ts +7 -0
- package/dist/esm/rendering/react/components/Table/BodyRow.js +7 -0
- package/dist/esm/rendering/react/components/Table/BodyRows.d.ts +7 -0
- package/dist/esm/rendering/react/components/Table/BodyRows.js +6 -0
- package/dist/esm/rendering/react/components/Table/CellData.d.ts +6 -0
- package/dist/esm/rendering/react/components/Table/CellData.js +32 -0
- package/dist/esm/rendering/react/components/Table/CellLayout.d.ts +8 -0
- package/dist/esm/rendering/react/components/Table/CellLayout.js +17 -0
- package/dist/esm/rendering/react/components/Table/HeaderCell.d.ts +7 -0
- package/dist/esm/rendering/react/components/Table/HeaderCell.js +7 -0
- package/dist/esm/rendering/react/components/Table/HeaderRow.d.ts +8 -0
- package/dist/esm/rendering/react/components/Table/HeaderRow.js +7 -0
- package/dist/esm/rendering/react/components/Table/RowLayout.d.ts +5 -0
- package/dist/esm/rendering/react/components/Table/RowLayout.js +3 -0
- package/dist/esm/rendering/react/components/Table/Table.d.ts +10 -0
- package/dist/esm/rendering/react/components/Table/Table.js +21 -0
- package/dist/esm/rendering/react/components/Table/context.d.ts +9 -0
- package/dist/esm/rendering/react/components/Table/context.js +7 -0
- package/dist/esm/rendering/react/components/Table/index.d.ts +1 -0
- package/dist/esm/rendering/react/components/Table/index.js +1 -0
- package/dist/esm/rendering/react/components/Table/model/Cell.d.ts +19 -0
- package/dist/esm/rendering/react/components/Table/model/Cell.js +24 -0
- package/dist/esm/rendering/react/components/Table/model/Column.d.ts +16 -0
- package/dist/esm/rendering/react/components/Table/model/Column.js +35 -0
- package/dist/esm/rendering/react/components/Table/model/ColumnName.d.ts +7 -0
- package/dist/esm/rendering/react/components/Table/model/ColumnName.js +17 -0
- package/dist/esm/rendering/react/components/Table/model/ColumnOptions.d.ts +25 -0
- package/dist/esm/rendering/react/components/Table/model/ColumnOptions.js +41 -0
- package/dist/esm/rendering/react/components/Table/model/Row.d.ts +14 -0
- package/dist/esm/rendering/react/components/Table/model/Row.js +37 -0
- package/dist/esm/rendering/react/components/Table/model/Table.d.ts +19 -0
- package/dist/esm/rendering/react/components/Table/model/Table.js +48 -0
- package/dist/esm/rendering/react/components/Table/model/index.d.ts +5 -0
- package/dist/esm/rendering/react/components/Table/model/index.js +5 -0
- package/dist/esm/rendering/react/components/Value.d.ts +5 -0
- package/dist/esm/rendering/react/components/Value.js +8 -0
- package/dist/esm/rendering/react/components/WithoutLineBreaks.d.ts +2 -0
- package/dist/esm/rendering/react/components/WithoutLineBreaks.js +7 -0
- package/dist/esm/rendering/react/context.d.ts +3 -2
- package/dist/esm/rendering/react/context.js +4 -1
- package/dist/esm/rendering/react/json/JsonCollectionProvider.d.ts +2 -0
- package/dist/esm/rendering/react/json/JsonCollectionProvider.js +10 -0
- package/dist/esm/rendering/react/json/JsonRenderer.d.ts +2 -0
- package/dist/esm/rendering/react/json/JsonRenderer.js +14 -0
- package/dist/esm/rendering/react/json/RenderJson.d.ts +7 -0
- package/dist/esm/rendering/react/json/RenderJson.js +19 -0
- package/dist/esm/rendering/react/json/context.d.ts +5 -0
- package/dist/esm/rendering/react/json/context.js +4 -0
- package/dist/esm/rendering/react/json/lib/unpackJsonData.d.ts +1 -0
- package/dist/esm/rendering/react/json/lib/unpackJsonData.js +5 -0
- package/dist/esm/rendering/react/lib/observable-value/ObservableValue.d.ts +10 -0
- package/dist/esm/rendering/react/lib/observable-value/ObservableValue.js +25 -0
- package/dist/esm/rendering/react/lib/observable-value/types.d.ts +2 -0
- package/dist/esm/rendering/react/lib/observable-value/types.js +1 -0
- package/dist/esm/rendering/react/lib/observable-value/useWatchObservableValue.d.ts +2 -0
- package/dist/esm/rendering/react/lib/observable-value/useWatchObservableValue.js +9 -0
- package/dist/esm/rendering/react/measure/MeasureChildren.d.ts +8 -0
- package/dist/esm/rendering/react/measure/MeasureChildren.js +19 -0
- package/dist/esm/rendering/react/measure/MeasureContextProvider.d.ts +2 -0
- package/dist/esm/rendering/react/measure/MeasureContextProvider.js +10 -0
- package/dist/esm/rendering/react/measure/MeasureRenderer.d.ts +2 -0
- package/dist/esm/rendering/react/measure/MeasureRenderer.js +22 -0
- package/dist/esm/rendering/react/measure/context.d.ts +18 -0
- package/dist/esm/rendering/react/measure/context.js +48 -0
- package/dist/esm/rendering/react/process.d.ts +42 -0
- package/dist/esm/rendering/react/process.js +24 -0
- package/dist/esm/rendering/react/process_fancy.d.ts +28 -0
- package/dist/esm/rendering/react/process_fancy.js +213 -0
- package/dist/esm/rendering/react/process_flags.d.ts +9 -0
- package/dist/esm/rendering/react/process_flags.js +15 -0
- package/dist/esm/rendering/react/process_quiet.d.ts +12 -0
- package/dist/esm/rendering/react/process_quiet.js +29 -0
- package/dist/esm/rendering/setup/FlagSupportedSetup.d.ts +2 -0
- package/dist/esm/rendering/setup/TableRenderSetup.d.ts +10 -12
- package/dist/esm/rendering/setup/TableRenderSetup.js +19 -6
- package/dist/esm/rendering/setup/usePromiseSetup.d.ts +4 -3
- package/package.json +52 -21
- package/.deps/client.tgz +0 -0
- package/.deps/commons.tgz +0 -0
- package/dist/esm/commands/project/filesystem/directories.d.ts +0 -3
- package/dist/esm/commands/project/filesystem/directories.js +0 -6
- package/dist/esm/commands/project/filesystem/file-content.d.ts +0 -3
- package/dist/esm/commands/project/filesystem/file-content.js +0 -6
- package/dist/esm/commands/project/filesystem/files.d.ts +0 -16
- package/dist/esm/commands/project/filesystem/files.js +0 -25
- package/dist/esm/commands/project/list1.d.ts +0 -7
- package/dist/esm/commands/project/list1.js +0 -18
- package/dist/esm/commands/project/list2.js +0 -26
- package/dist/esm/generated/cronjob/listCronjobs.d.ts +0 -13
- package/dist/esm/generated/cronjob/listCronjobs.js +0 -24
- package/dist/esm/generated/cronjob/listExecutions.d.ts +0 -13
- package/dist/esm/generated/cronjob/listExecutions.js +0 -24
- package/dist/esm/generated/domain/ingressListAccessible.d.ts +0 -13
- package/dist/esm/generated/domain/ingressListAccessible.js +0 -17
- package/dist/esm/generated/domain/ingressListForProject.d.ts +0 -13
- package/dist/esm/generated/domain/ingressListForProject.js +0 -24
- package/dist/esm/generated/domain/listDomains.d.ts +0 -13
- package/dist/esm/generated/domain/listDomains.js +0 -24
- package/dist/esm/generated/projectFileSystem/getDirectories.d.ts +0 -14
- package/dist/esm/generated/projectFileSystem/getDirectories.js +0 -24
- package/dist/esm/generated/projectFileSystem/getDiskUsage.d.ts +0 -14
- package/dist/esm/generated/projectFileSystem/getDiskUsage.js +0 -24
- package/dist/esm/generated/projectFileSystem/getFileContent.d.ts +0 -14
- package/dist/esm/generated/projectFileSystem/getFileContent.js +0 -24
- package/dist/esm/generated/projectFileSystem/getJwt.d.ts +0 -14
- package/dist/esm/generated/projectFileSystem/getJwt.js +0 -24
- package/dist/esm/generated/projectFileSystem/listFiles.d.ts +0 -13
- package/dist/esm/generated/projectFileSystem/listFiles.js +0 -24
- package/dist/esm/rendering/oclif/components/table.d.ts +0 -11
- package/dist/esm/rendering/oclif/components/table.js +0 -49
- package/dist/esm/rendering/react/components/Table.d.ts +0 -7
- package/dist/esm/rendering/react/components/Table.js +0 -4
- /package/dist/esm/rendering/react/components/{ConversationMessage.d.ts → Conversation/ConversationMessage.d.ts} +0 -0
- /package/dist/esm/rendering/react/components/{ConversationMeta.d.ts → Conversation/ConversationMeta.d.ts} +0 -0
- /package/dist/esm/rendering/react/components/{ConversationStatusUpdate.d.ts → Conversation/ConversationStatusUpdate.d.ts} +0 -0
- /package/dist/esm/rendering/react/components/{ConversationStatusUpdate.js → Conversation/ConversationStatusUpdate.js} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BaseCommand } from "../../../BaseCommand.js";
|
|
2
|
-
export default class AppCreateWordpress extends BaseCommand
|
|
2
|
+
export default class AppCreateWordpress extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
"project-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
6
5
|
version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
6
|
host: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
7
|
"admin-user": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { Flags, ux } from "@oclif/core";
|
|
2
2
|
import { BaseCommand } from "../../../BaseCommand.js";
|
|
3
3
|
import { getAppUuidFromAppName } from "../../../lib/app/appHelpers.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getAppVersionUuidFromAppVersion, getLatestAvailableAppVersionForApp, } from "../../../lib/app/appVersionHelpers.js";
|
|
5
5
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
6
|
-
import {
|
|
6
|
+
import { projectFlags, withProjectId } from "../../../lib/project/flags.js";
|
|
7
7
|
export default class AppCreateWordpress extends BaseCommand {
|
|
8
8
|
static description = "Creates new WordPress Installation.";
|
|
9
9
|
static flags = {
|
|
10
|
-
|
|
11
|
-
char: "p",
|
|
12
|
-
required: true,
|
|
13
|
-
description: "ID of the Project, in which the App will be created.",
|
|
14
|
-
}),
|
|
10
|
+
...projectFlags,
|
|
15
11
|
version: Flags.string({
|
|
16
12
|
required: false,
|
|
17
13
|
description: "Version of the App to be created - Defaults to latest",
|
|
@@ -43,10 +39,10 @@ export default class AppCreateWordpress extends BaseCommand {
|
|
|
43
39
|
};
|
|
44
40
|
async run() {
|
|
45
41
|
ux.action.start("requesting installation for WordPress");
|
|
46
|
-
const { flags } = await this.parse(AppCreateWordpress);
|
|
42
|
+
const { flags, args } = await this.parse(AppCreateWordpress);
|
|
47
43
|
const app = "WordPress";
|
|
48
44
|
const appUuid = await getAppUuidFromAppName(this.apiClient, app);
|
|
49
|
-
const projectId = await
|
|
45
|
+
const projectId = await withProjectId(this.apiClient, flags, args, this.config);
|
|
50
46
|
let appVersion;
|
|
51
47
|
if (flags.version) {
|
|
52
48
|
appVersion = await getAppVersionUuidFromAppVersion(this.apiClient, appUuid, flags.version);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
|
-
export default class List extends BaseCommand
|
|
2
|
+
export default class List extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
project: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
2
|
import { MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
|
-
export default class AppVersions extends BaseCommand
|
|
3
|
+
export default class AppVersions extends BaseCommand {
|
|
4
4
|
static description: string;
|
|
5
5
|
static args: {
|
|
6
6
|
app: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RenderBaseCommand } from "../../rendering/react/RenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export declare class Get extends RenderBaseCommand<typeof Get> {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static flags: {
|
|
7
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
8
|
+
};
|
|
9
|
+
protected render(): ReactNode;
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { RenderBaseCommand } from "../../rendering/react/RenderBaseCommand.js";
|
|
3
|
+
import { Context } from "../../lib/context.js";
|
|
4
|
+
import { SingleResult } from "../../rendering/react/components/SingleResult.js";
|
|
5
|
+
import { Value } from "../../rendering/react/components/Value.js";
|
|
6
|
+
import { usePromise } from "@mittwald/react-use-promise";
|
|
7
|
+
import { Note } from "../../rendering/react/components/Note.js";
|
|
8
|
+
import { Box } from "ink";
|
|
9
|
+
import { Set } from "./set.js";
|
|
10
|
+
import { RenderJson } from "../../rendering/react/json/RenderJson.js";
|
|
11
|
+
import { useRenderContext } from "../../rendering/react/context.js";
|
|
12
|
+
const GetContext = ({ ctx }) => {
|
|
13
|
+
const rows = {};
|
|
14
|
+
const { renderAsJson } = useRenderContext();
|
|
15
|
+
const values = {};
|
|
16
|
+
for (const key of ["project-id", "server-id", "org-id"]) {
|
|
17
|
+
const value = usePromise(ctx.getContextValue.bind(ctx), [key]);
|
|
18
|
+
if (value) {
|
|
19
|
+
rows[`--${key}`] = _jsx(Value, { children: value });
|
|
20
|
+
values[key] = value;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
rows[`--${key}`] = _jsx(Value, { notSet: true });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (renderAsJson) {
|
|
27
|
+
return _jsx(RenderJson, { name: "context", data: values });
|
|
28
|
+
}
|
|
29
|
+
return (_jsx(_Fragment, { children: _jsxs(Box, { flexDirection: "column", children: [_jsx(SingleResult, { title: "Current CLI context", rows: rows }), _jsxs(Note, { marginY: 1, children: ["Use the ", _jsx(Value, { children: "mw context set" }), " command to set one of the values listed above."] })] }) }));
|
|
30
|
+
};
|
|
31
|
+
export class Get extends RenderBaseCommand {
|
|
32
|
+
static summary = "Print an overview of currently set context parameters";
|
|
33
|
+
static description = Set.description;
|
|
34
|
+
static flags = { ...RenderBaseCommand.buildFlags() };
|
|
35
|
+
render() {
|
|
36
|
+
const ctx = new Context(this.config);
|
|
37
|
+
return _jsx(GetContext, { ctx: ctx });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
|
+
export declare class Set extends BaseCommand {
|
|
3
|
+
static summary: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
+
"server-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
|
+
"org-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { Context } from "../../lib/context.js";
|
|
3
|
+
import { BaseCommand } from "../../BaseCommand.js";
|
|
4
|
+
import { normalizeProjectIdToUuid, normalizeServerIdToUuid, } from "../../Helpers.js";
|
|
5
|
+
export class Set extends BaseCommand {
|
|
6
|
+
static summary = "Set context values for the current project, org or server";
|
|
7
|
+
static description = "The context allows you to persistently set values for common parameters, like --project-id or --server-id, so you don't have to specify them on every command.";
|
|
8
|
+
static flags = {
|
|
9
|
+
"project-id": Flags.string({
|
|
10
|
+
description: "ID or short ID of a project",
|
|
11
|
+
}),
|
|
12
|
+
"server-id": Flags.string({
|
|
13
|
+
description: "ID or short ID of a server",
|
|
14
|
+
}),
|
|
15
|
+
"org-id": Flags.string({
|
|
16
|
+
description: "ID or short ID of an organization",
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
const { flags } = await this.parse(Set);
|
|
21
|
+
const ctx = new Context(this.config);
|
|
22
|
+
if (flags["project-id"]) {
|
|
23
|
+
const projectId = await normalizeProjectIdToUuid(this.apiClient, flags["project-id"]);
|
|
24
|
+
await ctx.setProjectId(projectId);
|
|
25
|
+
this.log(`Set project ID to ${projectId}`);
|
|
26
|
+
}
|
|
27
|
+
if (flags["server-id"]) {
|
|
28
|
+
const serverId = await normalizeServerIdToUuid(this.apiClient, flags["server-id"]);
|
|
29
|
+
await ctx.setServerId(serverId);
|
|
30
|
+
this.log(`Set server ID to ${serverId}`);
|
|
31
|
+
}
|
|
32
|
+
if (flags["org-id"]) {
|
|
33
|
+
await ctx.setOrgId(flags["org-id"]);
|
|
34
|
+
this.log(`Set organization ID to ${flags["org-id"]}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
|
-
export default class Close extends BaseCommand
|
|
2
|
+
export default class Close extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
5
|
id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
|
-
export default class Create extends BaseCommand
|
|
2
|
+
export default class Create extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
title: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GeneratedConversationListConversations, } from "../../generated/conversation/listConversations.js";
|
|
2
|
-
import {
|
|
2
|
+
import { formatRelativeDate } from "../../lib/viewhelpers/date.js";
|
|
3
3
|
export default class List extends GeneratedConversationListConversations {
|
|
4
4
|
mapData(data) {
|
|
5
5
|
return data;
|
|
@@ -19,7 +19,7 @@ export default class List extends GeneratedConversationListConversations {
|
|
|
19
19
|
title: {},
|
|
20
20
|
created: {
|
|
21
21
|
header: "Created",
|
|
22
|
-
get: (row) =>
|
|
22
|
+
get: (row) => formatRelativeDate(new Date(`${row.createdAt}`)) +
|
|
23
23
|
" by " +
|
|
24
24
|
(row.createdBy ? row.createdBy.clearName : "unknown"),
|
|
25
25
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
|
-
export default class Reply extends BaseCommand
|
|
2
|
+
export default class Reply extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
5
|
id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
|
-
export default class Show extends BaseCommand
|
|
2
|
+
export default class Show extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
5
|
id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
@@ -2,7 +2,7 @@ import { BaseCommand } from "../../BaseCommand.js";
|
|
|
2
2
|
import { Args } from "@oclif/core";
|
|
3
3
|
import { normalizeConversationIdToUuid } from "../../Helpers.js";
|
|
4
4
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
5
|
-
import {
|
|
5
|
+
import { formatRelativeDate } from "../../lib/viewhelpers/date.js";
|
|
6
6
|
import { marked } from "marked";
|
|
7
7
|
import TerminalRenderer from "marked-terminal";
|
|
8
8
|
import chalk from "chalk";
|
|
@@ -33,7 +33,7 @@ export default class Show extends BaseCommand {
|
|
|
33
33
|
printKeyValues({
|
|
34
34
|
Title: conv.title,
|
|
35
35
|
ID: conv.shortId,
|
|
36
|
-
Opened: `${
|
|
36
|
+
Opened: `${formatRelativeDate(conv.createdAt)} by ${conv.createdBy ? conv.createdBy.clearName : "Unknown User"}`,
|
|
37
37
|
Status: conv.status,
|
|
38
38
|
});
|
|
39
39
|
console.log();
|
|
@@ -47,7 +47,7 @@ export default class Show extends BaseCommand {
|
|
|
47
47
|
const metaColor = chalk.gray;
|
|
48
48
|
for (const msg of messagesResponse.data) {
|
|
49
49
|
if (msg.type === "MESSAGE") {
|
|
50
|
-
console.log(chalk.whiteBright.underline(`${msg.createdBy?.clearName}, ${
|
|
50
|
+
console.log(chalk.whiteBright.underline(`${msg.createdBy?.clearName}, ${formatRelativeDate(msg.createdAt)}`));
|
|
51
51
|
const rendered = marked(msg.messageContent ?? "")
|
|
52
52
|
.trim()
|
|
53
53
|
.split("\n")
|
|
@@ -59,16 +59,16 @@ export default class Show extends BaseCommand {
|
|
|
59
59
|
else {
|
|
60
60
|
switch (msg.messageContent) {
|
|
61
61
|
case "CONVERSATION_CREATED":
|
|
62
|
-
console.log(metaColor(`CREATED, ${
|
|
62
|
+
console.log(metaColor(`CREATED, ${formatRelativeDate(msg.createdAt)}`));
|
|
63
63
|
break;
|
|
64
64
|
case "STATUS_OPEN":
|
|
65
|
-
console.log(metaColor(`REOPENED, ${
|
|
65
|
+
console.log(metaColor(`REOPENED, ${formatRelativeDate(msg.createdAt)}`));
|
|
66
66
|
break;
|
|
67
67
|
case "STATUS_CLOSED":
|
|
68
|
-
console.log(metaColor(`CLOSED, ${
|
|
68
|
+
console.log(metaColor(`CLOSED, ${formatRelativeDate(msg.createdAt)}`));
|
|
69
69
|
break;
|
|
70
70
|
default:
|
|
71
|
-
console.log(metaColor(`${msg.messageContent}, ${
|
|
71
|
+
console.log(metaColor(`${msg.messageContent}, ${formatRelativeDate(msg.createdAt)}`));
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
console.log();
|
|
@@ -6,13 +6,14 @@ import { RenderBaseCommand } from "../../rendering/react/RenderBaseCommand.js";
|
|
|
6
6
|
import { useRenderContext } from "../../rendering/react/context.js";
|
|
7
7
|
import { UsePromiseRenderSetup } from "../../rendering/setup/usePromiseSetup.js";
|
|
8
8
|
import { Box } from "ink";
|
|
9
|
-
import { ConversationMeta } from "../../rendering/react/components/ConversationMeta.js";
|
|
9
|
+
import { ConversationMeta } from "../../rendering/react/components/Conversation/ConversationMeta.js";
|
|
10
10
|
import { Args } from "@oclif/core";
|
|
11
|
-
import {
|
|
11
|
+
import { ConversationMessages } from "../../rendering/react/components/Conversation/ConversationMessages.js";
|
|
12
12
|
const usePromiseSetup = new UsePromiseRenderSetup();
|
|
13
13
|
export default class Show extends RenderBaseCommand {
|
|
14
14
|
static flags = {
|
|
15
15
|
...usePromiseSetup.flags,
|
|
16
|
+
...RenderBaseCommand.buildFlags(),
|
|
16
17
|
};
|
|
17
18
|
static args = {
|
|
18
19
|
conversationId: Args.string({
|
|
@@ -22,6 +23,7 @@ export default class Show extends RenderBaseCommand {
|
|
|
22
23
|
render() {
|
|
23
24
|
const { apiClient } = useRenderContext();
|
|
24
25
|
const { conversationId } = this.args;
|
|
26
|
+
const usePromiseOptions = usePromiseSetup.getSetup(this.flags);
|
|
25
27
|
const response = usePromise(apiClient.conversation.listMessagesByConversation, [
|
|
26
28
|
{
|
|
27
29
|
pathParameters: {
|
|
@@ -30,8 +32,9 @@ export default class Show extends RenderBaseCommand {
|
|
|
30
32
|
},
|
|
31
33
|
], {
|
|
32
34
|
loaderId: "listMessagesByConversation",
|
|
35
|
+
...usePromiseOptions,
|
|
33
36
|
});
|
|
34
37
|
assertStatus(response, 200);
|
|
35
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Suspense, { fallback: null, children: _jsx(ConversationMeta, { id: conversationId }) }), _jsx(
|
|
38
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Suspense, { fallback: null, children: _jsx(ConversationMeta, { id: conversationId }) }), _jsx(ConversationMessages, { messages: response.data })] }));
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
|
+
import { ListBaseCommand } from "../../ListBaseCommand.js";
|
|
3
4
|
import { SuccessfulResponse } from "../../types.js";
|
|
4
|
-
import { GeneratedDomainListDomains, Response } from "../../generated/domain/listDomains.js";
|
|
5
5
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2ProjectsProjectIdDomains.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
|
-
export
|
|
7
|
-
|
|
6
|
+
export type PathParams = MittwaldAPIV2.Paths.V2ProjectsProjectIdDomains.Get.Parameters.Path;
|
|
7
|
+
export type Response = Awaited<ReturnType<MittwaldAPIV2Client["domain"]["listDomains"]>>;
|
|
8
|
+
export declare class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
9
|
+
static description: string;
|
|
10
|
+
static args: {};
|
|
11
|
+
static flags: {
|
|
12
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any> | import("@oclif/core/lib/interfaces/parser.js").OptionFlag<unknown>;
|
|
13
|
+
};
|
|
14
|
+
getData(): Promise<Response>;
|
|
15
|
+
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): ResponseItem[] | Promise<ResponseItem[]>;
|
|
8
16
|
}
|
|
9
17
|
export {};
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ListBaseCommand } from "../../ListBaseCommand.js";
|
|
2
|
+
import { projectFlags, withProjectId } from "../../lib/project/flags.js";
|
|
3
|
+
export class List extends ListBaseCommand {
|
|
4
|
+
static description = "List Domains belonging to a Project.";
|
|
5
|
+
static args = {};
|
|
6
|
+
static flags = {
|
|
7
|
+
...ListBaseCommand.baseFlags,
|
|
8
|
+
...projectFlags,
|
|
9
|
+
};
|
|
10
|
+
async getData() {
|
|
11
|
+
const projectId = await withProjectId(this.apiClient, this.flags, this.args, this.config);
|
|
12
|
+
const pathParams = { projectId };
|
|
13
|
+
return await this.apiClient.domain.listDomains({
|
|
14
|
+
pathParameters: pathParams,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
3
17
|
mapData(data) {
|
|
4
18
|
return data;
|
|
5
19
|
}
|
|
@@ -8,11 +8,13 @@ export class List extends ListBaseCommand {
|
|
|
8
8
|
"project-id": Flags.string({
|
|
9
9
|
description: "Project ID to filter by; if omitted this will list virtual hosts in all projects you have access to.",
|
|
10
10
|
required: false,
|
|
11
|
-
})
|
|
11
|
+
}),
|
|
12
12
|
};
|
|
13
13
|
async getData() {
|
|
14
14
|
if (this.flags["project-id"]) {
|
|
15
|
-
return await this.apiClient.domain.ingressListForProject({
|
|
15
|
+
return await this.apiClient.domain.ingressListForProject({
|
|
16
|
+
pathParameters: { projectId: this.flags["project-id"] },
|
|
17
|
+
});
|
|
16
18
|
}
|
|
17
19
|
return await this.apiClient.domain.ingressListAccessible({});
|
|
18
20
|
}
|
|
@@ -29,7 +31,8 @@ export class List extends ListBaseCommand {
|
|
|
29
31
|
projectId: { header: "Project ID" },
|
|
30
32
|
hostname: {},
|
|
31
33
|
paths: {
|
|
32
|
-
get: r => r.paths
|
|
34
|
+
get: (r) => r.paths
|
|
35
|
+
.map((p) => {
|
|
33
36
|
if ("directory" in p.target) {
|
|
34
37
|
return `${p.path} -> directory (${p.target.directory})`;
|
|
35
38
|
}
|
|
@@ -37,13 +40,13 @@ export class List extends ListBaseCommand {
|
|
|
37
40
|
return `${p.path} -> url (${p.target.url})`;
|
|
38
41
|
}
|
|
39
42
|
return `${p.path} -> app (${p.target.installationId})`;
|
|
40
|
-
})
|
|
43
|
+
})
|
|
44
|
+
.join("\n"),
|
|
41
45
|
},
|
|
42
46
|
ips: {
|
|
43
47
|
header: "IP addresses",
|
|
44
|
-
get: r => r.ips.v4.join(", ")
|
|
45
|
-
}
|
|
48
|
+
get: (r) => r.ips.v4.join(", "),
|
|
49
|
+
},
|
|
46
50
|
};
|
|
47
51
|
}
|
|
48
|
-
;
|
|
49
52
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
|
+
type ResetResult = {
|
|
3
|
+
deleted: boolean;
|
|
4
|
+
};
|
|
5
|
+
export default class Reset extends ExecRenderBaseCommand<typeof Reset, ResetResult> {
|
|
6
|
+
static description: string;
|
|
7
|
+
protected authenticationRequired: boolean;
|
|
8
|
+
protected exec(): Promise<ResetResult>;
|
|
9
|
+
protected render(): null;
|
|
10
|
+
private tokenFileExists;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
3
|
+
import { ExecRenderBaseCommand } from "../../rendering/react/ExecRenderBaseCommand.js";
|
|
4
|
+
import { Box, Text } from "ink";
|
|
5
|
+
import { Note } from "../../rendering/react/components/Note.js";
|
|
6
|
+
import { FancyProcessRenderer } from "../../rendering/react/process_fancy.js";
|
|
7
|
+
import { Filename } from "../../rendering/react/components/Filename.js";
|
|
8
|
+
export default class Reset extends ExecRenderBaseCommand {
|
|
9
|
+
static description = "Reset your local authentication state";
|
|
10
|
+
authenticationRequired = false;
|
|
11
|
+
async exec() {
|
|
12
|
+
const process = new FancyProcessRenderer("Resetting authentication state");
|
|
13
|
+
process.start();
|
|
14
|
+
if (await this.tokenFileExists()) {
|
|
15
|
+
const step = process.addStep(_jsxs(Text, { children: ["Deleting token file ", _jsx(Filename, { filename: this.getTokenFilename() })] }));
|
|
16
|
+
await fs.rm(this.getTokenFilename(), { force: true });
|
|
17
|
+
step.complete();
|
|
18
|
+
process.complete(_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Authentication state successfully reset" }), _jsx(Note, { children: "Please keep in mind that this does not invalidate the token on the server. Invalidate your API token using the mStudio web interface, or using the 'mw user api-token revoke' command." })] }));
|
|
19
|
+
return { deleted: true };
|
|
20
|
+
}
|
|
21
|
+
process.complete(_jsx(Text, { children: "No token file found, nothing to do" }));
|
|
22
|
+
return { deleted: false };
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
async tokenFileExists() {
|
|
28
|
+
try {
|
|
29
|
+
await fs.access(this.getTokenFilename());
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
|
-
export default class Token extends BaseCommand
|
|
2
|
+
export default class Token extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
overwrite: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
6
6
|
};
|
|
7
|
+
authenticationRequired: boolean;
|
|
7
8
|
run(): Promise<void>;
|
|
8
9
|
private tokenFileExists;
|
|
9
10
|
}
|
|
@@ -9,6 +9,7 @@ export default class Token extends BaseCommand {
|
|
|
9
9
|
description: "overwrite existing token file",
|
|
10
10
|
}),
|
|
11
11
|
};
|
|
12
|
+
authenticationRequired = false;
|
|
12
13
|
async run() {
|
|
13
14
|
const { flags } = await this.parse(Token);
|
|
14
15
|
if ((await this.tokenFileExists()) && !flags.overwrite) {
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export default class Create extends ExecRenderBaseCommand<typeof Create, {
|
|
4
|
+
addressId: string;
|
|
5
|
+
}> {
|
|
3
6
|
static description: string;
|
|
4
7
|
static flags: {
|
|
5
|
-
projectId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
6
8
|
address: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
9
|
"catch-all": import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
8
10
|
"enable-spam-protection": import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
11
|
quota: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
13
|
};
|
|
11
|
-
|
|
14
|
+
protected exec(): Promise<{
|
|
15
|
+
addressId: string;
|
|
16
|
+
}>;
|
|
17
|
+
protected render(executionResult: {
|
|
18
|
+
addressId: string;
|
|
19
|
+
}): ReactNode;
|
|
12
20
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Flags, ux } from "@oclif/core";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flags } from "@oclif/core";
|
|
4
3
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
5
|
-
|
|
4
|
+
import { projectFlags, withProjectId } from "../../../lib/project/flags.js";
|
|
5
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
6
|
+
import { makeProcessRenderer, processFlags, } from "../../../rendering/react/process_flags.js";
|
|
7
|
+
import { Text } from "ink";
|
|
8
|
+
import { Success } from "../../../rendering/react/components/Success.js";
|
|
9
|
+
export default class Create extends ExecRenderBaseCommand {
|
|
6
10
|
static description = "Create a new mail address";
|
|
7
11
|
static flags = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
description: "Project ID or short ID",
|
|
11
|
-
required: true,
|
|
12
|
-
}),
|
|
12
|
+
...projectFlags,
|
|
13
|
+
...processFlags,
|
|
13
14
|
address: Flags.string({
|
|
14
15
|
char: "a",
|
|
15
16
|
description: "Mail address",
|
|
@@ -28,25 +29,33 @@ export default class Create extends BaseCommand {
|
|
|
28
29
|
default: 1024,
|
|
29
30
|
}),
|
|
30
31
|
};
|
|
31
|
-
async
|
|
32
|
+
async exec() {
|
|
32
33
|
const { flags } = await this.parse(Create);
|
|
33
|
-
const projectId = await
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const response = await
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
const projectId = await withProjectId(this.apiClient, flags, {}, this.config);
|
|
35
|
+
const process = makeProcessRenderer(flags, "Creating a new mail address");
|
|
36
|
+
const password = await process.addInput(_jsx(Text, { children: "Mailbox password" }), true);
|
|
37
|
+
const response = await process.runStep("creating mail address", async () => {
|
|
38
|
+
const response = await this.apiClient.mail.mailaddressCreate({
|
|
39
|
+
pathParameters: { projectId },
|
|
40
|
+
data: {
|
|
41
|
+
address: flags.address,
|
|
42
|
+
isCatchAll: flags["catch-all"],
|
|
43
|
+
mailbox: {
|
|
44
|
+
password,
|
|
45
|
+
quotaInBytes: flags.quota * 1024 * 1024,
|
|
46
|
+
enableSpamProtection: flags["enable-spam-protection"],
|
|
47
|
+
},
|
|
45
48
|
},
|
|
46
|
-
}
|
|
49
|
+
});
|
|
50
|
+
assertStatus(response, 201);
|
|
51
|
+
return response;
|
|
47
52
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
process.complete(_jsx(Success, { children: "Your mail address was successfully created." }));
|
|
54
|
+
return { addressId: response.data.id };
|
|
55
|
+
}
|
|
56
|
+
render(executionResult) {
|
|
57
|
+
if (this.flags.quiet) {
|
|
58
|
+
return executionResult.addressId;
|
|
59
|
+
}
|
|
51
60
|
}
|
|
52
61
|
}
|
|
@@ -4,6 +4,7 @@ export default class Delete extends DeleteBaseCommand<typeof Delete> {
|
|
|
4
4
|
static resourceName: string;
|
|
5
5
|
static flags: {
|
|
6
6
|
force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
7
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
7
8
|
};
|
|
8
9
|
static args: {
|
|
9
10
|
id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
3
|
import { SuccessfulResponse } from "../../../types.js";
|
|
4
|
-
import { GeneratedMailMailaddressList, Response, PathParams } from "../../../generated/mail/mailaddressList.js";
|
|
5
4
|
import { ListColumns } from "../../../Formatter.js";
|
|
5
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
6
6
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2ProjectsProjectIdMailaddresses.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
7
|
-
export
|
|
7
|
+
export type PathParams = MittwaldAPIV2.Paths.V2ProjectsProjectIdMailaddresses.Get.Parameters.Path;
|
|
8
|
+
export type Response = Awaited<ReturnType<MittwaldAPIV2Client["mail"]["mailaddressList"]>>;
|
|
9
|
+
export declare class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
10
|
+
static description: string;
|
|
11
|
+
static args: {};
|
|
12
|
+
static flags: {
|
|
13
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any> | import("@oclif/core/lib/interfaces/parser.js").OptionFlag<unknown>;
|
|
14
|
+
};
|
|
15
|
+
getData(): Promise<Response>;
|
|
8
16
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.MailMailAddress[];
|
|
9
17
|
protected mapParams(input: PathParams): Promise<PathParams>;
|
|
10
18
|
protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
|