@mittwald/cli 1.0.0-alpha.19 → 1.0.0-alpha.21
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 +904 -83
- package/dist/esm/BaseCommand.js +1 -0
- package/dist/esm/commands/app/copy.d.ts +1 -0
- package/dist/esm/commands/app/copy.js +1 -0
- package/dist/esm/commands/app/dependency/list.js +1 -1
- package/dist/esm/commands/app/dependency/versions.js +1 -1
- package/dist/esm/commands/app/install/contao.d.ts +11 -0
- package/dist/esm/commands/app/install/contao.js +24 -0
- package/dist/esm/commands/app/install/joomla.d.ts +11 -0
- package/dist/esm/commands/app/install/joomla.js +23 -0
- package/dist/esm/commands/app/install/matomo.d.ts +11 -0
- package/dist/esm/commands/app/install/matomo.js +21 -0
- package/dist/esm/commands/app/install/node.d.ts +11 -0
- package/dist/esm/commands/app/install/node.js +13 -0
- package/dist/esm/commands/app/install/php.d.ts +11 -0
- package/dist/esm/commands/app/install/php.js +13 -0
- package/dist/esm/commands/app/install/shopware5.d.ts +11 -0
- package/dist/esm/commands/app/install/shopware5.js +26 -0
- package/dist/esm/commands/app/install/shopware6.d.ts +11 -0
- package/dist/esm/commands/app/install/shopware6.js +26 -0
- package/dist/esm/commands/app/install/typo3.d.ts +11 -0
- package/dist/esm/commands/app/install/typo3.js +22 -0
- package/dist/esm/commands/app/install/wordpress.d.ts +4 -16
- package/dist/esm/commands/app/install/wordpress.js +16 -107
- package/dist/esm/commands/app/list.d.ts +1 -1
- package/dist/esm/commands/app/list.js +1 -1
- package/dist/esm/commands/app/versions.js +1 -1
- package/dist/esm/commands/database/mysql/create.d.ts +1 -0
- package/dist/esm/commands/database/mysql/create.js +1 -1
- package/dist/esm/commands/database/mysql/list.d.ts +1 -1
- package/dist/esm/commands/database/mysql/list.js +1 -1
- package/dist/esm/commands/database/redis/create.d.ts +1 -0
- package/dist/esm/commands/database/redis/create.js +1 -1
- package/dist/esm/commands/database/redis/list.d.ts +1 -1
- package/dist/esm/commands/database/redis/list.js +1 -1
- package/dist/esm/commands/database/redis/versions.d.ts +2 -2
- package/dist/esm/commands/database/redis/versions.js +2 -2
- package/dist/esm/commands/domain/list.d.ts +1 -1
- package/dist/esm/commands/domain/list.js +1 -1
- package/dist/esm/commands/domain/ownership/list.d.ts +10 -3
- package/dist/esm/commands/domain/ownership/list.js +17 -3
- package/dist/esm/commands/domain/virtualhost/create.d.ts +1 -0
- package/dist/esm/commands/domain/virtualhost/create.js +1 -1
- package/dist/esm/commands/domain/virtualhost/list.d.ts +1 -0
- package/dist/esm/commands/domain/virtualhost/list.js +1 -1
- package/dist/esm/commands/mail/address/create.d.ts +1 -0
- package/dist/esm/commands/mail/address/create.js +1 -1
- package/dist/esm/commands/mail/address/list.d.ts +1 -1
- package/dist/esm/commands/mail/address/list.js +1 -1
- package/dist/esm/commands/org/delete.d.ts +1 -1
- package/dist/esm/commands/org/delete.js +1 -1
- package/dist/esm/commands/org/get.d.ts +1 -1
- package/dist/esm/commands/org/get.js +1 -1
- package/dist/esm/commands/org/invite/list.d.ts +1 -1
- package/dist/esm/commands/org/invite/list.js +1 -1
- package/dist/esm/commands/org/invite.d.ts +2 -2
- package/dist/esm/commands/org/invite.js +4 -17
- package/dist/esm/commands/org/membership/list.d.ts +1 -1
- package/dist/esm/commands/org/membership/list.js +1 -1
- package/dist/esm/commands/project/backup/create.d.ts +19 -0
- package/dist/esm/commands/project/backup/create.js +59 -0
- package/dist/esm/commands/project/backup/delete.d.ts +13 -0
- package/dist/esm/commands/project/backup/delete.js +21 -0
- package/dist/esm/commands/project/backup/download.d.ts +27 -0
- package/dist/esm/commands/project/backup/download.js +177 -0
- package/dist/esm/commands/project/backup/get.d.ts +11 -2
- package/dist/esm/commands/project/backup/get.js +26 -5
- package/dist/esm/commands/project/backup/list.d.ts +10 -10
- package/dist/esm/commands/project/backup/list.js +1 -1
- package/dist/esm/commands/project/backupschedule/list.d.ts +13 -7
- package/dist/esm/commands/project/backupschedule/list.js +15 -7
- package/dist/esm/commands/project/create.d.ts +3 -1
- package/dist/esm/commands/project/create.js +5 -8
- package/dist/esm/commands/project/cronjob/list.d.ts +1 -1
- package/dist/esm/commands/project/cronjob/list.js +1 -1
- package/dist/esm/commands/project/delete.d.ts +1 -1
- package/dist/esm/commands/project/delete.js +1 -1
- package/dist/esm/commands/project/filesystem/usage.d.ts +1 -1
- package/dist/esm/commands/project/filesystem/usage.js +1 -1
- package/dist/esm/commands/project/get.d.ts +1 -1
- package/dist/esm/commands/project/get.js +2 -2
- package/dist/esm/commands/project/list.d.ts +10 -2
- package/dist/esm/commands/project/list.js +10 -2
- package/dist/esm/commands/project/ssh.d.ts +1 -1
- package/dist/esm/commands/project/ssh.js +1 -1
- package/dist/esm/commands/project/update.d.ts +1 -1
- package/dist/esm/commands/project/update.js +1 -1
- package/dist/esm/lib/app/Installer.d.ts +21 -0
- package/dist/esm/lib/app/Installer.js +49 -0
- package/dist/esm/lib/app/flags.d.ts +25 -0
- package/dist/esm/lib/app/flags.js +190 -1
- package/dist/esm/lib/app/install.d.ts +4 -0
- package/dist/esm/lib/app/install.js +20 -0
- package/dist/esm/lib/app/{appVersionHelpers.d.ts → versions.d.ts} +3 -0
- package/dist/esm/lib/app/{appVersionHelpers.js → versions.js} +18 -0
- package/dist/esm/lib/app/wait.d.ts +3 -0
- package/dist/esm/lib/app/wait.js +19 -0
- package/dist/esm/lib/context_flags.d.ts +20 -9
- package/dist/esm/lib/context_flags.js +25 -2
- package/dist/esm/lib/database/mysql/flags.js +1 -1
- package/dist/esm/lib/database/redis/flags.js +1 -1
- package/dist/esm/lib/expires.d.ts +11 -0
- package/dist/esm/lib/expires.js +31 -0
- package/dist/esm/lib/handleError.js +3 -20
- package/dist/esm/lib/org/flags.d.ts +11 -3
- package/dist/esm/lib/password.d.ts +2 -0
- package/dist/esm/lib/password.js +20 -0
- package/dist/esm/lib/project/flags.d.ts +11 -3
- package/dist/esm/lib/project/hooks.d.ts +3 -0
- package/dist/esm/lib/project/hooks.js +11 -0
- package/dist/esm/lib/project/ingress.d.ts +2 -0
- package/dist/esm/lib/project/ingress.js +16 -0
- package/dist/esm/lib/project/shortId.d.ts +2 -0
- package/dist/esm/lib/project/shortId.js +11 -0
- package/dist/esm/lib/projectbackup/hooks.d.ts +5 -0
- package/dist/esm/lib/projectbackup/hooks.js +19 -0
- package/dist/esm/lib/server/flags.d.ts +11 -3
- package/dist/esm/lib/viewhelpers/size.d.ts +2 -1
- package/dist/esm/lib/viewhelpers/size.js +2 -2
- package/dist/esm/lib/wait.d.ts +4 -0
- package/dist/esm/lib/wait.js +13 -2
- package/dist/esm/rendering/process/components/ProcessStateSummary.js +3 -0
- package/dist/esm/rendering/process/process.d.ts +2 -0
- package/dist/esm/rendering/process/process.js +4 -0
- package/dist/esm/rendering/react/ExecRenderBaseCommand.js +11 -1
- package/dist/esm/rendering/react/components/ErrorBox.js +27 -1
- package/dist/esm/rendering/react/components/ProjectBackup/ProjectBackupDetails.d.ts +6 -0
- package/dist/esm/rendering/react/components/ProjectBackup/ProjectBackupDetails.js +29 -0
- package/dist/esm/rendering/react/components/ProjectBackup/ProjectBackupStatus.d.ts +6 -0
- package/dist/esm/rendering/react/components/ProjectBackup/ProjectBackupStatus.js +8 -0
- package/package.json +37 -3
- package/dist/esm/commands/project/backupschedule/get.d.ts +0 -3
- package/dist/esm/commands/project/backupschedule/get.js +0 -6
- package/dist/esm/commands/project/list-react.d.ts +0 -11
- package/dist/esm/commands/project/list-react.js +0 -42
- package/dist/esm/generated/backup/getProjectBackup.d.ts +0 -16
- package/dist/esm/generated/backup/getProjectBackup.js +0 -25
- package/dist/esm/generated/backup/getProjectBackupSchedule.d.ts +0 -16
- package/dist/esm/generated/backup/getProjectBackupSchedule.js +0 -25
- package/dist/esm/generated/backup/listProjectBackupSchedules.d.ts +0 -13
- package/dist/esm/generated/backup/listProjectBackupSchedules.js +0 -24
- package/dist/esm/generated/backup/listProjectBackups.d.ts +0 -13
- package/dist/esm/generated/backup/listProjectBackups.js +0 -24
- package/dist/esm/generated/domain/listDomainOwnerships.d.ts +0 -13
- package/dist/esm/generated/domain/listDomainOwnerships.js +0 -21
- /package/dist/esm/lib/app/{appHelpers.d.ts → uuid.d.ts} +0 -0
- /package/dist/esm/lib/app/{appHelpers.js → uuid.js} +0 -0
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { RenderBaseCommand } from "../../../rendering/react/RenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export default class Get extends RenderBaseCommand<typeof Get> {
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
"backup-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
10
|
+
};
|
|
11
|
+
protected render(): ReactNode;
|
|
3
12
|
}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { RenderBaseCommand } from "../../../rendering/react/RenderBaseCommand.js";
|
|
3
|
+
import { useProjectBackup } from "../../../lib/projectbackup/hooks.js";
|
|
4
|
+
import { Args } from "@oclif/core";
|
|
5
|
+
import { ProjectBackupDetails } from "../../../rendering/react/components/ProjectBackup/ProjectBackupDetails.js";
|
|
6
|
+
import { RenderJson } from "../../../rendering/react/json/RenderJson.js";
|
|
7
|
+
import { GetBaseCommand } from "../../../GetBaseCommand.js";
|
|
8
|
+
import { Box } from "ink";
|
|
9
|
+
export default class Get extends RenderBaseCommand {
|
|
10
|
+
static description = "show details of a backup.";
|
|
11
|
+
static args = {
|
|
12
|
+
"backup-id": Args.string({
|
|
13
|
+
required: true,
|
|
14
|
+
description: "The ID of the Backup to show.",
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
static flags = {
|
|
18
|
+
...GetBaseCommand.baseFlags,
|
|
19
|
+
};
|
|
20
|
+
render() {
|
|
21
|
+
const projectBackup = useProjectBackup(this.args["backup-id"]);
|
|
22
|
+
if (this.flags.output === "json") {
|
|
23
|
+
return _jsx(RenderJson, { name: "projectBackup", data: projectBackup });
|
|
24
|
+
}
|
|
25
|
+
return (_jsx(Box, { marginBottom: 1, children: _jsx(ProjectBackupDetails, { projectBackup: projectBackup }) }));
|
|
26
|
+
}
|
|
6
27
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2
|
|
1
|
+
import { Response, Simplify } from "@mittwald/api-client-commons";
|
|
2
|
+
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
3
3
|
import { SuccessfulResponse } from "../../../types.js";
|
|
4
4
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
5
5
|
import { ListColumns } from "../../../Formatter.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare class List extends ListBaseCommand<typeof List,
|
|
6
|
+
import BackupProjectBackup = MittwaldAPIV2.Components.Schemas.BackupProjectBackup;
|
|
7
|
+
type ListResponse = Response<BackupProjectBackup[]>;
|
|
8
|
+
type ListItem = Simplify<BackupProjectBackup>;
|
|
9
|
+
export declare class List extends ListBaseCommand<typeof List, ListItem, ListResponse> {
|
|
10
10
|
static description: string;
|
|
11
11
|
static args: {};
|
|
12
12
|
static flags: {
|
|
13
|
-
|
|
13
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string>;
|
|
14
14
|
};
|
|
15
|
-
protected mapData(data: SuccessfulResponse<
|
|
16
|
-
getData(): Promise<
|
|
17
|
-
protected getColumns(data:
|
|
15
|
+
protected mapData(data: SuccessfulResponse<ListResponse, 200>["data"]): ListItem[] | Promise<ListItem[]>;
|
|
16
|
+
getData(): Promise<ListResponse>;
|
|
17
|
+
protected getColumns(data: ListItem[]): ListColumns<ListItem>;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -12,7 +12,7 @@ export class List extends ListBaseCommand {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
async getData() {
|
|
15
|
-
const projectId = await withProjectId(this.apiClient, this.flags, {}, this.config);
|
|
15
|
+
const projectId = await withProjectId(this.apiClient, List, this.flags, {}, this.config);
|
|
16
16
|
return await this.apiClient.backup.listProjectBackups({
|
|
17
17
|
pathParameters: { projectId },
|
|
18
18
|
});
|
|
@@ -1,13 +1,19 @@
|
|
|
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 { GeneratedBackupListProjectBackupSchedules, Response } from "../../../generated/backup/listProjectBackupSchedules.js";
|
|
5
|
-
import { PathParams } from "../../../generated/backup/listProjectBackups.js";
|
|
6
4
|
import { ListColumns } from "../../../Formatter.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
6
|
+
import BackupProjectBackupSchedule = MittwaldAPIV2.Components.Schemas.BackupProjectBackupSchedule;
|
|
7
|
+
type ResponseItem = Simplify<BackupProjectBackupSchedule>;
|
|
8
|
+
type Response = Awaited<ReturnType<MittwaldAPIV2Client["backup"]["listProjectBackupSchedules"]>>;
|
|
9
|
+
export declare class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
10
|
+
static description: string;
|
|
11
|
+
static args: {};
|
|
12
|
+
static flags: {
|
|
13
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string>;
|
|
14
|
+
};
|
|
15
|
+
getData(): Promise<Response>;
|
|
16
|
+
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): BackupProjectBackupSchedule[];
|
|
11
17
|
protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
|
|
12
18
|
}
|
|
13
19
|
export {};
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
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 backup schedules belonging to a given project.";
|
|
5
|
+
static args = {};
|
|
6
|
+
static flags = {
|
|
7
|
+
...ListBaseCommand.baseFlags,
|
|
8
|
+
...projectFlags,
|
|
9
|
+
};
|
|
10
|
+
async getData() {
|
|
11
|
+
const projectId = await withProjectId(this.apiClient, List, this.flags, this.args, this.config);
|
|
12
|
+
return await this.apiClient.backup.listProjectBackupSchedules({
|
|
13
|
+
pathParameters: { projectId },
|
|
14
|
+
});
|
|
15
|
+
}
|
|
4
16
|
mapData(data) {
|
|
5
17
|
return data;
|
|
6
18
|
}
|
|
7
|
-
async mapParams(input) {
|
|
8
|
-
input.projectId = await normalizeProjectIdToUuid(this.apiClient, input.projectId);
|
|
9
|
-
return super.mapParams(input);
|
|
10
|
-
}
|
|
11
19
|
getColumns(data) {
|
|
12
20
|
const baseColumns = super.getColumns(data);
|
|
13
21
|
return {
|
|
@@ -6,9 +6,11 @@ export default class Create extends ExecRenderBaseCommand<typeof Create, {
|
|
|
6
6
|
static description: string;
|
|
7
7
|
static flags: {
|
|
8
8
|
description: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
9
|
-
wait: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
9
|
"update-context": import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
|
+
wait: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
11
|
+
"wait-timeout": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
12
|
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
13
|
+
"server-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string>;
|
|
12
14
|
};
|
|
13
15
|
protected exec(): Promise<{
|
|
14
16
|
projectId: string;
|
|
@@ -7,22 +7,19 @@ import { Text } from "ink";
|
|
|
7
7
|
import { Success } from "../../rendering/react/components/Success.js";
|
|
8
8
|
import { Value } from "../../rendering/react/components/Value.js";
|
|
9
9
|
import { makeProcessRenderer, processFlags, } from "../../rendering/process/process_flags.js";
|
|
10
|
-
import { waitUntil } from "../../lib/wait.js";
|
|
10
|
+
import { waitFlags, waitUntil } from "../../lib/wait.js";
|
|
11
11
|
import { Context } from "../../lib/context.js";
|
|
12
12
|
export default class Create extends ExecRenderBaseCommand {
|
|
13
|
-
static description = "
|
|
13
|
+
static description = "Create a new project";
|
|
14
14
|
static flags = {
|
|
15
15
|
...serverFlags,
|
|
16
16
|
...processFlags,
|
|
17
|
+
...waitFlags,
|
|
17
18
|
description: Flags.string({
|
|
18
19
|
char: "d",
|
|
19
20
|
required: true,
|
|
20
21
|
description: "A description for the project.",
|
|
21
22
|
}),
|
|
22
|
-
wait: Flags.boolean({
|
|
23
|
-
char: "w",
|
|
24
|
-
description: "Wait for the project to be ready.",
|
|
25
|
-
}),
|
|
26
23
|
"update-context": Flags.boolean({
|
|
27
24
|
description: "Update the CLI context to use the newly created project",
|
|
28
25
|
}),
|
|
@@ -31,7 +28,7 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
31
28
|
const { flags } = await this.parse(Create);
|
|
32
29
|
const { description } = flags;
|
|
33
30
|
const process = makeProcessRenderer(flags, "Creating project");
|
|
34
|
-
const serverId = await withServerId(this.apiClient, flags, {}, this.config);
|
|
31
|
+
const serverId = await withServerId(this.apiClient, Create, flags, {}, this.config);
|
|
35
32
|
const stepCreating = process.addStep(_jsx(Text, { children: "creating a new project" }));
|
|
36
33
|
const result = await this.apiClient.project.createProject({
|
|
37
34
|
pathParameters: { serverId },
|
|
@@ -52,7 +49,7 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
52
49
|
projectResponse.data.readiness === "ready") {
|
|
53
50
|
return true;
|
|
54
51
|
}
|
|
55
|
-
});
|
|
52
|
+
}, this.flags["wait-timeout"]);
|
|
56
53
|
stepWaiting.complete();
|
|
57
54
|
}
|
|
58
55
|
if (flags["update-context"]) {
|
|
@@ -10,7 +10,7 @@ export declare class List extends ListBaseCommand<typeof List, ResponseItem, Res
|
|
|
10
10
|
static description: string;
|
|
11
11
|
static args: {};
|
|
12
12
|
static flags: {
|
|
13
|
-
|
|
13
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string>;
|
|
14
14
|
};
|
|
15
15
|
getData(): Promise<Response>;
|
|
16
16
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): ResponseItem[] | Promise<ResponseItem[]>;
|
|
@@ -10,7 +10,7 @@ export class List extends ListBaseCommand {
|
|
|
10
10
|
};
|
|
11
11
|
async getData() {
|
|
12
12
|
const pathParams = {
|
|
13
|
-
projectId: await withProjectId(this.apiClient, this.flags, this.args, this.config),
|
|
13
|
+
projectId: await withProjectId(this.apiClient, List, this.flags, this.args, this.config),
|
|
14
14
|
};
|
|
15
15
|
return await this.apiClient.cronjob.listCronjobs({
|
|
16
16
|
pathParameters: pathParams,
|
|
@@ -7,7 +7,7 @@ export default class Delete extends DeleteBaseCommand<typeof Delete> {
|
|
|
7
7
|
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
8
8
|
};
|
|
9
9
|
static args: {
|
|
10
|
-
|
|
10
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
11
11
|
};
|
|
12
12
|
protected deleteResource(): Promise<void>;
|
|
13
13
|
protected mapResourceId(id: string): Promise<string>;
|
|
@@ -8,7 +8,7 @@ export default class Delete extends DeleteBaseCommand {
|
|
|
8
8
|
static flags = { ...DeleteBaseCommand.baseFlags };
|
|
9
9
|
static args = { ...projectArgs };
|
|
10
10
|
async deleteResource() {
|
|
11
|
-
const projectId = await withProjectId(this.apiClient, {}, this.args, this.config);
|
|
11
|
+
const projectId = await withProjectId(this.apiClient, Delete, {}, this.args, this.config);
|
|
12
12
|
const response = await this.apiClient.project.deleteProject({
|
|
13
13
|
pathParameters: { projectId },
|
|
14
14
|
});
|
|
@@ -8,7 +8,7 @@ export declare class Usage extends RenderBaseCommand<typeof Usage> {
|
|
|
8
8
|
human: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
9
|
};
|
|
10
10
|
static args: {
|
|
11
|
-
|
|
11
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
12
12
|
};
|
|
13
13
|
protected render(): ReactNode;
|
|
14
14
|
}
|
|
@@ -22,7 +22,7 @@ export class Usage extends RenderBaseCommand {
|
|
|
22
22
|
};
|
|
23
23
|
static args = { ...projectArgs };
|
|
24
24
|
render() {
|
|
25
|
-
const projectId = usePromise(() => withProjectId(this.apiClient, this.flags, this.args, this.config), []);
|
|
25
|
+
const projectId = usePromise(() => withProjectId(this.apiClient, Usage, this.flags, this.args, this.config), []);
|
|
26
26
|
const project = usePromise((id) => this.apiClient.project.getProject({ pathParameters: { id } }), [projectId]);
|
|
27
27
|
const projectDiskUsage = usePromise((id) => this.apiClient.projectFileSystem.getDiskUsage({
|
|
28
28
|
pathParameters: { projectId: id },
|
|
@@ -7,7 +7,7 @@ export declare class Get extends RenderBaseCommand<typeof Get> {
|
|
|
7
7
|
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
8
8
|
};
|
|
9
9
|
static args: {
|
|
10
|
-
|
|
10
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
11
11
|
};
|
|
12
12
|
protected formatter: GetFormatter;
|
|
13
13
|
protected render(): ReactNode;
|
|
@@ -66,12 +66,12 @@ const GetProject = ({ response }) => {
|
|
|
66
66
|
return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: sections }));
|
|
67
67
|
};
|
|
68
68
|
export class Get extends RenderBaseCommand {
|
|
69
|
-
static description = "Get a
|
|
69
|
+
static description = "Get details of a project";
|
|
70
70
|
static flags = { ...GetBaseCommand.baseFlags };
|
|
71
71
|
static args = { ...projectArgs };
|
|
72
72
|
formatter = new GetFormatter(new ComponentPrinter((r) => _jsx(GetProject, { response: r })));
|
|
73
73
|
render() {
|
|
74
|
-
const projectId = usePromise(() => withProjectId(this.apiClient, this.flags, this.args, this.config), []);
|
|
74
|
+
const projectId = usePromise(() => withProjectId(this.apiClient, Get, this.flags, this.args, this.config), []);
|
|
75
75
|
const projectResponse = usePromise((id) => this.apiClient.project.getProject({ pathParameters: { id } }), [projectId]);
|
|
76
76
|
assertStatus(projectResponse, 200);
|
|
77
77
|
if (this.flags.output === "json") {
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
2
|
import { ListColumns } from "../../Formatter.js";
|
|
3
|
-
import { MittwaldAPIV2, MittwaldAPIV2Client as MittwaldAPIClient } from "@mittwald/api-client";
|
|
3
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client, MittwaldAPIV2Client as MittwaldAPIClient } from "@mittwald/api-client";
|
|
4
4
|
import { GeneratedProjectListProjects } from "../../generated/project/listProjects.js";
|
|
5
5
|
import { SuccessfulResponse } from "../../types.js";
|
|
6
|
+
import { ListBaseCommand } from "../../ListBaseCommand.js";
|
|
6
7
|
type ProjectResponse = Awaited<ReturnType<MittwaldAPIClient["project"]["listProjects"]>>;
|
|
7
8
|
type ProjectResponseItem = Simplify<MittwaldAPIV2.Paths.V2Projects.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
8
|
-
|
|
9
|
+
type Response = Awaited<ReturnType<MittwaldAPIV2Client["project"]["listProjects"]>>;
|
|
10
|
+
export declare class List extends ListBaseCommand<typeof GeneratedProjectListProjects, ProjectResponseItem, Response> {
|
|
11
|
+
static description: string;
|
|
12
|
+
static args: {};
|
|
13
|
+
static flags: {
|
|
14
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
15
|
+
};
|
|
16
|
+
getData(): Promise<Response>;
|
|
9
17
|
protected mapData(data: SuccessfulResponse<ProjectResponse, 200>["data"]): ProjectResponseItem[];
|
|
10
18
|
protected getColumns(ignoredData: ProjectResponseItem[]): ListColumns<ProjectResponseItem>;
|
|
11
19
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { ListBaseCommand } from "../../ListBaseCommand.js";
|
|
2
|
+
export class List extends ListBaseCommand {
|
|
3
|
+
static description = "List all projects that you have access to";
|
|
4
|
+
static args = {};
|
|
5
|
+
static flags = {
|
|
6
|
+
...ListBaseCommand.baseFlags,
|
|
7
|
+
};
|
|
8
|
+
async getData() {
|
|
9
|
+
return await this.apiClient.project.listProjects();
|
|
10
|
+
}
|
|
3
11
|
mapData(data) {
|
|
4
12
|
return data;
|
|
5
13
|
}
|
|
@@ -2,7 +2,7 @@ import { BaseCommand } from "../../BaseCommand.js";
|
|
|
2
2
|
export default class Ssh extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
|
-
|
|
5
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
6
6
|
};
|
|
7
7
|
run(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -7,7 +7,7 @@ export default class Ssh extends BaseCommand {
|
|
|
7
7
|
static args = { ...projectArgs };
|
|
8
8
|
async run() {
|
|
9
9
|
const { args } = await this.parse(Ssh);
|
|
10
|
-
const id = await withProjectId(this.apiClient, {}, args, this.config);
|
|
10
|
+
const id = await withProjectId(this.apiClient, Ssh, {}, args, this.config);
|
|
11
11
|
const projectResponse = await this.apiClient.project.getProject({
|
|
12
12
|
pathParameters: { id },
|
|
13
13
|
});
|
|
@@ -2,7 +2,7 @@ import { BaseCommand } from "../../BaseCommand.js";
|
|
|
2
2
|
export default class Update extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
|
-
|
|
5
|
+
"project-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
6
6
|
};
|
|
7
7
|
run(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -5,7 +5,7 @@ export default class Update extends BaseCommand {
|
|
|
5
5
|
static args = { ...projectArgs };
|
|
6
6
|
async run() {
|
|
7
7
|
const { args } = await this.parse(Update);
|
|
8
|
-
const id = await withProjectId(this.apiClient, {}, args, this.config);
|
|
8
|
+
const id = await withProjectId(this.apiClient, Update, {}, args, this.config);
|
|
9
9
|
console.log("updating project ", id);
|
|
10
10
|
console.log("TODO: Implement me");
|
|
11
11
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ArgOutput, OutputFlags } from "@oclif/core/lib/interfaces/parser.js";
|
|
2
|
+
import { AvailableFlagName, RelevantFlagInput } from "./flags.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
5
|
+
import { Config } from "@oclif/core";
|
|
6
|
+
export interface AppInstallationResult {
|
|
7
|
+
appInstallationId: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class AppInstaller<TFlagName extends AvailableFlagName> {
|
|
10
|
+
readonly appId: string;
|
|
11
|
+
readonly appName: string;
|
|
12
|
+
readonly appSupportedFlags: readonly TFlagName[];
|
|
13
|
+
readonly description: string;
|
|
14
|
+
private static makeDescription;
|
|
15
|
+
constructor(appId: string, appName: string, appSupportedFlags: readonly TFlagName[]);
|
|
16
|
+
get flags(): RelevantFlagInput<readonly TFlagName[]>;
|
|
17
|
+
exec(apiClient: MittwaldAPIV2Client, args: ArgOutput, flags: OutputFlags<RelevantFlagInput<(TFlagName | "version" | "wait")[]>>, config: Config): Promise<AppInstallationResult>;
|
|
18
|
+
render(result: AppInstallationResult, flags: {
|
|
19
|
+
quiet: boolean;
|
|
20
|
+
}): React.ReactNode;
|
|
21
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { makeProcessRenderer } from "../../rendering/process/process_flags.js";
|
|
3
|
+
import { withProjectId } from "../project/flags.js";
|
|
4
|
+
import { autofillFlags, provideSupportedFlags, } from "./flags.js";
|
|
5
|
+
import { normalizeToAppVersionUuid } from "./versions.js";
|
|
6
|
+
import { triggerAppInstallation } from "./install.js";
|
|
7
|
+
import { waitUntilAppIsInstalled } from "./wait.js";
|
|
8
|
+
import { Success } from "../../rendering/react/components/Success.js";
|
|
9
|
+
export class AppInstaller {
|
|
10
|
+
appId;
|
|
11
|
+
appName;
|
|
12
|
+
appSupportedFlags;
|
|
13
|
+
description;
|
|
14
|
+
static makeDescription(appName) {
|
|
15
|
+
return `Creates new ${appName} Installation.`;
|
|
16
|
+
}
|
|
17
|
+
constructor(appId, appName, appSupportedFlags) {
|
|
18
|
+
this.appId = appId;
|
|
19
|
+
this.appName = appName;
|
|
20
|
+
this.appSupportedFlags = appSupportedFlags;
|
|
21
|
+
this.description = AppInstaller.makeDescription(appName);
|
|
22
|
+
}
|
|
23
|
+
get flags() {
|
|
24
|
+
return provideSupportedFlags(this.appSupportedFlags, this.appName);
|
|
25
|
+
}
|
|
26
|
+
async exec(apiClient, args, flags, config) {
|
|
27
|
+
const process = makeProcessRenderer(flags, `Installing ${this.appName}`);
|
|
28
|
+
const projectId = await withProjectId(apiClient, "flag", flags, args, config);
|
|
29
|
+
await autofillFlags(apiClient, process, this.appSupportedFlags, flags, projectId, this.appName);
|
|
30
|
+
const appVersion = await normalizeToAppVersionUuid(apiClient, flags.version, process, this.appId);
|
|
31
|
+
const [appInstallationId, eventId] = await triggerAppInstallation(apiClient, process, projectId, flags, appVersion);
|
|
32
|
+
let successText;
|
|
33
|
+
if (flags.wait) {
|
|
34
|
+
await waitUntilAppIsInstalled(apiClient, process, appInstallationId, eventId);
|
|
35
|
+
successText = `Your ${this.appName} installation is now complete. Have fun! 🎉`;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
successText = `Your ${this.appName} installation has started. Have fun when it's ready! 🎉`;
|
|
39
|
+
}
|
|
40
|
+
process.complete(_jsx(Success, { children: successText }));
|
|
41
|
+
return { appInstallationId };
|
|
42
|
+
}
|
|
43
|
+
render(result, flags) {
|
|
44
|
+
if (flags.quiet) {
|
|
45
|
+
return result.appInstallationId;
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
import { MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
2
|
+
import { ProcessRenderer } from "../../rendering/process/process.js";
|
|
3
|
+
import { ProcessFlags } from "../../rendering/process/process_flags.js";
|
|
4
|
+
import { BooleanFlag, FlagInput, OptionFlag, OutputFlags } from "@oclif/core/lib/interfaces/parser.js";
|
|
1
5
|
export declare const appInstallationFlags: {
|
|
2
6
|
"installation-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
3
7
|
};
|
|
8
|
+
export type AvailableFlagName = keyof AvailableFlags;
|
|
9
|
+
interface AvailableFlags {
|
|
10
|
+
version: OptionFlag<string>;
|
|
11
|
+
host: OptionFlag<string | undefined>;
|
|
12
|
+
"admin-user": OptionFlag<string | undefined>;
|
|
13
|
+
"admin-email": OptionFlag<string | undefined>;
|
|
14
|
+
"admin-pass": OptionFlag<string | undefined>;
|
|
15
|
+
"admin-firstname": OptionFlag<string | undefined>;
|
|
16
|
+
"admin-lastname": OptionFlag<string | undefined>;
|
|
17
|
+
"site-title": OptionFlag<string | undefined>;
|
|
18
|
+
"shop-email": OptionFlag<string | undefined>;
|
|
19
|
+
"shop-lang": OptionFlag<string | undefined>;
|
|
20
|
+
"shop-currency": OptionFlag<string | undefined>;
|
|
21
|
+
"install-mode": OptionFlag<string>;
|
|
22
|
+
wait: BooleanFlag<boolean | undefined>;
|
|
23
|
+
}
|
|
24
|
+
export type RelevantFlags<TFlags extends readonly AvailableFlagName[]> = ProcessFlags & Pick<AvailableFlags, TFlags[number]>;
|
|
25
|
+
export type RelevantFlagInput<TFlags extends readonly AvailableFlagName[]> = FlagInput<RelevantFlags<TFlags>>;
|
|
26
|
+
export declare function provideSupportedFlags<TFlagNames extends readonly AvailableFlagName[]>(requestedFlagNames: TFlagNames, appName: string): RelevantFlagInput<TFlagNames>;
|
|
27
|
+
export declare function autofillFlags(apiClient: MittwaldAPIV2Client, process: ProcessRenderer, necessaryFlags: readonly AvailableFlagName[], flags: Partial<OutputFlags<RelevantFlagInput<AvailableFlagName[]>>>, projectId: string, appName: string): Promise<void>;
|
|
28
|
+
export {};
|