@mittwald/cli 1.0.0-alpha.14 → 1.0.0-alpha.16
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 +148 -414
- package/dist/esm/Translator.d.ts +5 -3
- package/dist/esm/Translator.js +4 -6
- package/dist/esm/commands/app/copy.d.ts +17 -0
- package/dist/esm/commands/app/copy.js +39 -0
- package/dist/esm/commands/app/dependency/list.d.ts +18 -0
- package/dist/esm/commands/app/dependency/list.js +27 -0
- package/dist/esm/commands/app/dependency/update.d.ts +20 -0
- package/dist/esm/commands/app/dependency/update.js +104 -0
- package/dist/esm/commands/app/dependency/versions.d.ts +20 -0
- package/dist/esm/commands/app/dependency/versions.js +39 -0
- package/dist/esm/commands/app/get.d.ts +11 -2
- package/dist/esm/commands/app/get.js +19 -5
- package/dist/esm/commands/app/list.d.ts +20 -11
- package/dist/esm/commands/app/list.js +46 -32
- package/dist/esm/commands/app/uninstall.d.ts +9 -0
- package/dist/esm/commands/app/uninstall.js +20 -0
- package/dist/esm/commands/database/redis/create.d.ts +19 -0
- package/dist/esm/commands/database/redis/create.js +83 -0
- package/dist/esm/commands/database/redis/versions.d.ts +3 -1
- package/dist/esm/commands/database/redis/versions.js +11 -0
- package/dist/esm/commands/org/invite/list-own.d.ts +3 -2
- package/dist/esm/commands/org/membership/list-own.d.ts +3 -2
- package/dist/esm/lib/app/flags.d.ts +3 -0
- package/dist/esm/lib/app/flags.js +7 -0
- package/dist/esm/lib/app/hooks.d.ts +11 -0
- package/dist/esm/lib/app/hooks.js +44 -0
- package/dist/esm/rendering/react/components/AppInstallation/AppInstallationDetails.d.ts +8 -0
- package/dist/esm/rendering/react/components/AppInstallation/AppInstallationDetails.js +29 -0
- package/dist/esm/rendering/react/components/AppInstallation/AppInstallationStatus.d.ts +9 -0
- package/dist/esm/rendering/react/components/AppInstallation/AppInstallationStatus.js +12 -0
- package/dist/esm/rendering/react/components/AppInstallation/AppSystemSoftware.d.ts +6 -0
- package/dist/esm/rendering/react/components/AppInstallation/AppSystemSoftware.js +18 -0
- package/package.json +6 -3
- package/dist/esm/commands/app/delete.d.ts +0 -12
- package/dist/esm/commands/app/delete.js +0 -45
- package/dist/esm/commands/app/dependency/getSystemsoftware.d.ts +0 -3
- package/dist/esm/commands/app/dependency/getSystemsoftware.js +0 -6
- package/dist/esm/commands/app/dependency/getSystemsoftwareversion.d.ts +0 -3
- package/dist/esm/commands/app/dependency/getSystemsoftwareversion.js +0 -6
- package/dist/esm/commands/app/dependency/listSystemsoftwares.d.ts +0 -9
- package/dist/esm/commands/app/dependency/listSystemsoftwares.js +0 -6
- package/dist/esm/commands/app/dependency/listSystemsoftwareversions.d.ts +0 -9
- package/dist/esm/commands/app/dependency/listSystemsoftwareversions.js +0 -6
- package/dist/esm/commands/article/get.d.ts +0 -3
- package/dist/esm/commands/article/get.js +0 -6
- package/dist/esm/commands/article/list.d.ts +0 -9
- package/dist/esm/commands/article/list.js +0 -6
- package/dist/esm/commands/contract/getBaseItemOfContract.d.ts +0 -3
- package/dist/esm/commands/contract/getBaseItemOfContract.js +0 -6
- package/dist/esm/commands/contract/getDetailOfContract.d.ts +0 -3
- package/dist/esm/commands/contract/getDetailOfContract.js +0 -6
- package/dist/esm/commands/contract/getDetailOfContractByDomain.d.ts +0 -3
- package/dist/esm/commands/contract/getDetailOfContractByDomain.js +0 -6
- package/dist/esm/commands/contract/getDetailOfContractByProject.d.ts +0 -3
- package/dist/esm/commands/contract/getDetailOfContractByProject.js +0 -6
- package/dist/esm/commands/contract/getDetailOfContractByServer.d.ts +0 -3
- package/dist/esm/commands/contract/getDetailOfContractByServer.js +0 -6
- package/dist/esm/commands/contract/getDetailOfContractItem.d.ts +0 -3
- package/dist/esm/commands/contract/getDetailOfContractItem.js +0 -6
- package/dist/esm/commands/contract/getNextTerminationDateForItem.d.ts +0 -3
- package/dist/esm/commands/contract/getNextTerminationDateForItem.js +0 -6
- package/dist/esm/commands/contract/invoiceDetailOfInvoice.d.ts +0 -3
- package/dist/esm/commands/contract/invoiceDetailOfInvoice.js +0 -6
- package/dist/esm/commands/contract/invoiceGetDetailOfInvoiceSettings.d.ts +0 -3
- package/dist/esm/commands/contract/invoiceGetDetailOfInvoiceSettings.js +0 -6
- package/dist/esm/commands/contract/invoiceListCustomerInvoices.d.ts +0 -9
- package/dist/esm/commands/contract/invoiceListCustomerInvoices.js +0 -6
- package/dist/esm/commands/contract/listContracts.d.ts +0 -9
- package/dist/esm/commands/contract/listContracts.js +0 -6
- package/dist/esm/commands/contract/orderGetOrder.d.ts +0 -3
- package/dist/esm/commands/contract/orderGetOrder.js +0 -6
- package/dist/esm/commands/contract/orderListCustomerOrders.d.ts +0 -9
- package/dist/esm/commands/contract/orderListCustomerOrders.js +0 -6
- package/dist/esm/commands/contract/orderListProjectOrders.d.ts +0 -9
- package/dist/esm/commands/contract/orderListProjectOrders.js +0 -6
- package/dist/esm/generated/app/getApp.d.ts +0 -16
- package/dist/esm/generated/app/getApp.js +0 -25
- package/dist/esm/generated/app/getAppinstallation.d.ts +0 -16
- package/dist/esm/generated/app/getAppinstallation.js +0 -25
- package/dist/esm/generated/app/getAppversion.d.ts +0 -16
- package/dist/esm/generated/app/getAppversion.js +0 -29
- package/dist/esm/generated/app/getSystemsoftware.d.ts +0 -16
- package/dist/esm/generated/app/getSystemsoftware.js +0 -25
- package/dist/esm/generated/app/getSystemsoftwareversion.d.ts +0 -16
- package/dist/esm/generated/app/getSystemsoftwareversion.js +0 -29
- package/dist/esm/generated/app/listAppinstallations.d.ts +0 -13
- package/dist/esm/generated/app/listAppinstallations.js +0 -24
- package/dist/esm/generated/app/listApps.d.ts +0 -13
- package/dist/esm/generated/app/listApps.js +0 -17
- package/dist/esm/generated/app/listAppversions.d.ts +0 -13
- package/dist/esm/generated/app/listAppversions.js +0 -24
- package/dist/esm/generated/app/listSystemsoftwares.d.ts +0 -13
- package/dist/esm/generated/app/listSystemsoftwares.js +0 -17
- package/dist/esm/generated/app/listSystemsoftwareversions.d.ts +0 -13
- package/dist/esm/generated/app/listSystemsoftwareversions.js +0 -24
- package/dist/esm/generated/app/retrieveStatus.d.ts +0 -14
- package/dist/esm/generated/app/retrieveStatus.js +0 -24
- package/dist/esm/generated/article/getArticle.d.ts +0 -16
- package/dist/esm/generated/article/getArticle.js +0 -25
- package/dist/esm/generated/article/listArticles.d.ts +0 -13
- package/dist/esm/generated/article/listArticles.js +0 -17
- package/dist/esm/generated/contract/getBaseItemOfContract.d.ts +0 -14
- package/dist/esm/generated/contract/getBaseItemOfContract.js +0 -24
- package/dist/esm/generated/contract/getDetailOfContract.d.ts +0 -16
- package/dist/esm/generated/contract/getDetailOfContract.js +0 -25
- package/dist/esm/generated/contract/getDetailOfContractByDomain.d.ts +0 -14
- package/dist/esm/generated/contract/getDetailOfContractByDomain.js +0 -24
- package/dist/esm/generated/contract/getDetailOfContractByProject.d.ts +0 -14
- package/dist/esm/generated/contract/getDetailOfContractByProject.js +0 -24
- package/dist/esm/generated/contract/getDetailOfContractByServer.d.ts +0 -14
- package/dist/esm/generated/contract/getDetailOfContractByServer.js +0 -24
- package/dist/esm/generated/contract/getDetailOfContractItem.d.ts +0 -16
- package/dist/esm/generated/contract/getDetailOfContractItem.js +0 -29
- package/dist/esm/generated/contract/getNextTerminationDateForItem.d.ts +0 -15
- package/dist/esm/generated/contract/getNextTerminationDateForItem.js +0 -28
- package/dist/esm/generated/contract/invoiceDetailOfInvoice.d.ts +0 -16
- package/dist/esm/generated/contract/invoiceDetailOfInvoice.js +0 -29
- package/dist/esm/generated/contract/invoiceGetDetailOfInvoiceSettings.d.ts +0 -14
- package/dist/esm/generated/contract/invoiceGetDetailOfInvoiceSettings.js +0 -24
- package/dist/esm/generated/contract/invoiceListCustomerInvoices.d.ts +0 -13
- package/dist/esm/generated/contract/invoiceListCustomerInvoices.js +0 -24
- package/dist/esm/generated/contract/listContracts.d.ts +0 -13
- package/dist/esm/generated/contract/listContracts.js +0 -24
- package/dist/esm/generated/contract/orderGetOrder.d.ts +0 -16
- package/dist/esm/generated/contract/orderGetOrder.js +0 -25
- package/dist/esm/generated/contract/orderListCustomerOrders.d.ts +0 -13
- package/dist/esm/generated/contract/orderListCustomerOrders.js +0 -24
- package/dist/esm/generated/contract/orderListProjectOrders.d.ts +0 -13
- package/dist/esm/generated/contract/orderListProjectOrders.js +0 -24
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
3
|
+
import { projectFlags, withProjectId } from "../../../lib/project/flags.js";
|
|
4
|
+
import { makeProcessRenderer, processFlags, } from "../../../rendering/process/process_flags.js";
|
|
5
|
+
import { Flags } from "@oclif/core";
|
|
6
|
+
import { assertStatus } from "@mittwald/api-client-commons";
|
|
7
|
+
import { Success } from "../../../rendering/react/components/Success.js";
|
|
8
|
+
import { Value } from "../../../rendering/react/components/Value.js";
|
|
9
|
+
export class Create extends ExecRenderBaseCommand {
|
|
10
|
+
static summary = "Create a new Redis database";
|
|
11
|
+
static flags = {
|
|
12
|
+
...projectFlags,
|
|
13
|
+
...processFlags,
|
|
14
|
+
description: Flags.string({
|
|
15
|
+
char: "d",
|
|
16
|
+
summary: "a description for the database",
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
version: Flags.string({
|
|
20
|
+
summary: "the Redis version to use",
|
|
21
|
+
description: 'Use the "database redis versions" command to list available versions',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
persistent: Flags.boolean({
|
|
25
|
+
summary: "enable persistent storage for the Redis database",
|
|
26
|
+
allowNo: true,
|
|
27
|
+
default: true,
|
|
28
|
+
}),
|
|
29
|
+
"max-memory": Flags.string({
|
|
30
|
+
summary: "the maximum memory for the Redis database",
|
|
31
|
+
description: 'This specifies the maximum memory; you should provide a number, followed by one of the IEC suffixes, like "Ki", "Mi" or "Gi"',
|
|
32
|
+
}),
|
|
33
|
+
"max-memory-policy": Flags.string({
|
|
34
|
+
summary: "the Redis eviction policy",
|
|
35
|
+
description: "See https://redis.io/docs/reference/eviction/#eviction-policies for details",
|
|
36
|
+
options: [
|
|
37
|
+
"noeviction",
|
|
38
|
+
"allkeys-lru",
|
|
39
|
+
"allkeys-lfu",
|
|
40
|
+
"volatile-lru",
|
|
41
|
+
"volatile-lfu",
|
|
42
|
+
"allkeys-random",
|
|
43
|
+
"volatile-random",
|
|
44
|
+
"volatile-ttl",
|
|
45
|
+
],
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
async exec() {
|
|
49
|
+
const p = makeProcessRenderer(this.flags, "Creating a new Redis database");
|
|
50
|
+
const projectId = await withProjectId(this.apiClient, this.flags, this.args, this.config);
|
|
51
|
+
const { description, version, "max-memory": maxMemory, "max-memory-policy": maxMemoryPolicy, persistent, } = this.flags;
|
|
52
|
+
const db = await p.runStep("creating Redis database", async () => {
|
|
53
|
+
const r = await this.apiClient.database.createRedisDatabase({
|
|
54
|
+
pathParameters: { projectId },
|
|
55
|
+
data: {
|
|
56
|
+
description,
|
|
57
|
+
version,
|
|
58
|
+
configuration: {
|
|
59
|
+
maxMemory,
|
|
60
|
+
maxMemoryPolicy,
|
|
61
|
+
persistent,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
assertStatus(r, 201);
|
|
66
|
+
return r.data;
|
|
67
|
+
});
|
|
68
|
+
const database = await p.runStep("fetching database", async () => {
|
|
69
|
+
const r = await this.apiClient.database.getRedisDatabase({
|
|
70
|
+
pathParameters: { id: db.id },
|
|
71
|
+
});
|
|
72
|
+
assertStatus(r, 200);
|
|
73
|
+
return r.data;
|
|
74
|
+
});
|
|
75
|
+
p.complete(_jsxs(Success, { children: ["The database ", _jsx(Value, { children: database.name }), " was successfully created."] }));
|
|
76
|
+
return { databaseId: db.id };
|
|
77
|
+
}
|
|
78
|
+
render({ databaseId }) {
|
|
79
|
+
if (this.flags.quiet) {
|
|
80
|
+
return databaseId;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Simplify } from "@mittwald/api-client-commons";
|
|
|
2
2
|
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
3
|
import { SuccessfulResponse } from "../../../types.js";
|
|
4
4
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
5
|
+
import { ListColumns } from "../../../Formatter.js";
|
|
5
6
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2RedisVersions.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
7
|
export type PathParams = MittwaldAPIV2.Paths.V2RedisVersions.Get.Parameters.Path;
|
|
7
8
|
export type Response = Awaited<ReturnType<MittwaldAPIV2Client["database"]["listRedisVersions"]>>;
|
|
@@ -9,9 +10,10 @@ export default class List extends ListBaseCommand<typeof List, ResponseItem, Res
|
|
|
9
10
|
static description: string;
|
|
10
11
|
static args: {};
|
|
11
12
|
static flags: {
|
|
12
|
-
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
13
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any> | import("@oclif/core/lib/interfaces/parser.js").OptionFlag<unknown>;
|
|
13
14
|
};
|
|
14
15
|
getData(): Promise<Response>;
|
|
15
16
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.DatabaseRedisVersion[];
|
|
17
|
+
protected getColumns(): ListColumns<ResponseItem>;
|
|
16
18
|
}
|
|
17
19
|
export {};
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
2
|
+
import { projectFlags, withProjectId } from "../../../lib/project/flags.js";
|
|
2
3
|
export default class List extends ListBaseCommand {
|
|
3
4
|
static description = "List available Redis versions.";
|
|
4
5
|
static args = {};
|
|
5
6
|
static flags = {
|
|
6
7
|
...ListBaseCommand.baseFlags,
|
|
8
|
+
...projectFlags,
|
|
7
9
|
};
|
|
8
10
|
async getData() {
|
|
11
|
+
const projectId = await withProjectId(this.apiClient, this.flags, this.args, this.config);
|
|
9
12
|
return await this.apiClient.database.listRedisVersions({
|
|
10
13
|
pathParameters: {},
|
|
14
|
+
queryParameters: { projectId },
|
|
11
15
|
});
|
|
12
16
|
}
|
|
13
17
|
mapData(data) {
|
|
14
18
|
return data;
|
|
15
19
|
}
|
|
20
|
+
getColumns() {
|
|
21
|
+
return {
|
|
22
|
+
id: { header: "ID" },
|
|
23
|
+
name: {},
|
|
24
|
+
version: { get: (item) => item.number },
|
|
25
|
+
};
|
|
26
|
+
}
|
|
16
27
|
}
|
|
@@ -19,7 +19,7 @@ export declare class List extends ListBaseCommand<typeof List, ResponseItem, Res
|
|
|
19
19
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): Promise<(MittwaldAPIV2.Components.Schemas.MembershipCustomerInvite | {
|
|
20
20
|
org: {
|
|
21
21
|
activeSuspension?: {
|
|
22
|
-
createdAt
|
|
22
|
+
createdAt: string;
|
|
23
23
|
} | undefined;
|
|
24
24
|
avatarRefId?: string | undefined;
|
|
25
25
|
categoryId?: string | undefined;
|
|
@@ -27,13 +27,14 @@ export declare class List extends ListBaseCommand<typeof List, ResponseItem, Res
|
|
|
27
27
|
customerId: string;
|
|
28
28
|
customerNumber: string;
|
|
29
29
|
executingUserRoles?: MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
|
|
30
|
+
isBanned?: boolean | undefined;
|
|
30
31
|
isInDefaultOfPayment?: boolean | undefined;
|
|
31
32
|
memberCount: number;
|
|
32
33
|
name: string;
|
|
33
34
|
owner?: MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
|
|
34
35
|
projectCount: number;
|
|
35
36
|
vatId?: string | undefined;
|
|
36
|
-
vatIdValidationState?: "
|
|
37
|
+
vatIdValidationState?: "unspecified" | "pending" | "valid" | "invalid" | undefined;
|
|
37
38
|
};
|
|
38
39
|
avatarRefId: string;
|
|
39
40
|
customerId: string;
|
|
@@ -20,7 +20,7 @@ export declare class ListOwn extends ListBaseCommand<typeof ListOwn, ResponseIte
|
|
|
20
20
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): Promise<(MittwaldAPIV2.Components.Schemas.MembershipCustomerMembership | {
|
|
21
21
|
org: {
|
|
22
22
|
activeSuspension?: {
|
|
23
|
-
createdAt
|
|
23
|
+
createdAt: string;
|
|
24
24
|
} | undefined;
|
|
25
25
|
avatarRefId?: string | undefined;
|
|
26
26
|
categoryId?: string | undefined;
|
|
@@ -28,13 +28,14 @@ export declare class ListOwn extends ListBaseCommand<typeof ListOwn, ResponseIte
|
|
|
28
28
|
customerId: string;
|
|
29
29
|
customerNumber: string;
|
|
30
30
|
executingUserRoles?: MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
|
|
31
|
+
isBanned?: boolean | undefined;
|
|
31
32
|
isInDefaultOfPayment?: boolean | undefined;
|
|
32
33
|
memberCount: number;
|
|
33
34
|
name: string;
|
|
34
35
|
owner?: MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
|
|
35
36
|
projectCount: number;
|
|
36
37
|
vatId?: string | undefined;
|
|
37
|
-
vatIdValidationState?: "
|
|
38
|
+
vatIdValidationState?: "unspecified" | "pending" | "valid" | "invalid" | undefined;
|
|
38
39
|
};
|
|
39
40
|
customerId: string;
|
|
40
41
|
expiresAt?: string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
+
import AppSystemSoftware = MittwaldAPIV2.Components.Schemas.AppSystemSoftware;
|
|
3
|
+
import AppSystemSoftwareVersion = MittwaldAPIV2.Components.Schemas.AppSystemSoftwareVersion;
|
|
4
|
+
import AppAppVersion = MittwaldAPIV2.Components.Schemas.AppAppVersion;
|
|
5
|
+
import AppApp = MittwaldAPIV2.Components.Schemas.AppApp;
|
|
6
|
+
import AppAppInstallation = MittwaldAPIV2.Components.Schemas.AppAppInstallation;
|
|
7
|
+
export declare function useApp(appId: string): AppApp;
|
|
8
|
+
export declare function useAppInstallation(appInstallationId: string): AppAppInstallation;
|
|
9
|
+
export declare function useAppVersion(appId: string, appVersionId: string): AppAppVersion;
|
|
10
|
+
export declare function useSystemSoftware(systemSoftwareId: string): AppSystemSoftware;
|
|
11
|
+
export declare function useSystemSoftwareVersion(systemSoftwareId: string, systemSoftwareVersionId: string): AppSystemSoftwareVersion;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { usePromise } from "@mittwald/react-use-promise";
|
|
2
|
+
import { assertStatus } from "@mittwald/api-client-commons";
|
|
3
|
+
import { useRenderContext } from "../../rendering/react/context.js";
|
|
4
|
+
export function useApp(appId) {
|
|
5
|
+
const { apiClient } = useRenderContext();
|
|
6
|
+
const app = usePromise((id) => apiClient.app.getApp({ pathParameters: { appId: id } }), [appId]);
|
|
7
|
+
assertStatus(app, 200);
|
|
8
|
+
return app.data;
|
|
9
|
+
}
|
|
10
|
+
export function useAppInstallation(appInstallationId) {
|
|
11
|
+
const { apiClient } = useRenderContext();
|
|
12
|
+
const appInstallation = usePromise((id) => apiClient.app.getAppinstallation({
|
|
13
|
+
pathParameters: { appInstallationId: id },
|
|
14
|
+
}), [appInstallationId]);
|
|
15
|
+
assertStatus(appInstallation, 200);
|
|
16
|
+
return appInstallation.data;
|
|
17
|
+
}
|
|
18
|
+
export function useAppVersion(appId, appVersionId) {
|
|
19
|
+
const { apiClient } = useRenderContext();
|
|
20
|
+
const appVersion = usePromise((appId, appVersionId) => apiClient.app.getAppversion({
|
|
21
|
+
pathParameters: { appId, appVersionId },
|
|
22
|
+
}), [appId, appVersionId]);
|
|
23
|
+
assertStatus(appVersion, 200);
|
|
24
|
+
return appVersion.data;
|
|
25
|
+
}
|
|
26
|
+
export function useSystemSoftware(systemSoftwareId) {
|
|
27
|
+
const { apiClient } = useRenderContext();
|
|
28
|
+
const systemSoftware = usePromise((id) => apiClient.app.getSystemsoftware({
|
|
29
|
+
pathParameters: { systemSoftwareId: id },
|
|
30
|
+
}), [systemSoftwareId]);
|
|
31
|
+
assertStatus(systemSoftware, 200);
|
|
32
|
+
return systemSoftware.data;
|
|
33
|
+
}
|
|
34
|
+
export function useSystemSoftwareVersion(systemSoftwareId, systemSoftwareVersionId) {
|
|
35
|
+
const { apiClient } = useRenderContext();
|
|
36
|
+
const systemSoftwareVersion = usePromise((systemSoftwareId, systemSoftwareVersionId) => apiClient.app.getSystemsoftwareversion({
|
|
37
|
+
pathParameters: {
|
|
38
|
+
systemSoftwareId,
|
|
39
|
+
systemSoftwareVersionId,
|
|
40
|
+
},
|
|
41
|
+
}), [systemSoftwareId, systemSoftwareVersionId]);
|
|
42
|
+
assertStatus(systemSoftwareVersion, 200);
|
|
43
|
+
return systemSoftwareVersion.data;
|
|
44
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
3
|
+
import AppAppInstallation = MittwaldAPIV2.Components.Schemas.AppAppInstallation;
|
|
4
|
+
import AppApp = MittwaldAPIV2.Components.Schemas.AppApp;
|
|
5
|
+
export declare const AppInstallationDetails: FC<{
|
|
6
|
+
appInstallation: AppAppInstallation;
|
|
7
|
+
app: AppApp;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAppVersion } from "../../../../lib/app/hooks.js";
|
|
3
|
+
import { Value } from "../Value.js";
|
|
4
|
+
import { AppInstallationStatus } from "./AppInstallationStatus.js";
|
|
5
|
+
import { SingleResult, SingleResultTable } from "../SingleResult.js";
|
|
6
|
+
import { AppSystemSoftware } from "./AppSystemSoftware.js";
|
|
7
|
+
import { Box } from "ink";
|
|
8
|
+
export const AppInstallationDetails = ({ app, appInstallation }) => {
|
|
9
|
+
const desiredAppVersion = useAppVersion(app.id, appInstallation.appVersion.desired);
|
|
10
|
+
const currentAppVersion = appInstallation.appVersion.current
|
|
11
|
+
? useAppVersion(app.id, appInstallation.appVersion.current)
|
|
12
|
+
: undefined;
|
|
13
|
+
const rows = {
|
|
14
|
+
"Installation ID": _jsx(Value, { children: appInstallation.id }),
|
|
15
|
+
App: (_jsx(SingleResultTable, { rows: {
|
|
16
|
+
ID: _jsx(Value, { children: app.id }),
|
|
17
|
+
Name: _jsx(Value, { children: app.name }),
|
|
18
|
+
} })),
|
|
19
|
+
"Installation Path": _jsx(Value, { children: appInstallation.installationPath }),
|
|
20
|
+
Description: _jsx(Value, { children: appInstallation.description }),
|
|
21
|
+
Status: (_jsx(AppInstallationStatus, { appInstallation: appInstallation, desired: desiredAppVersion, current: currentAppVersion })),
|
|
22
|
+
};
|
|
23
|
+
const title = (_jsxs(_Fragment, { children: ["APP INSTALLATION: ", _jsx(Value, { children: app.name }), " in", " ", _jsx(Value, { children: appInstallation.installationPath })] }));
|
|
24
|
+
const sections = [
|
|
25
|
+
_jsx(SingleResult, { title: title, rows: rows }, "primary"),
|
|
26
|
+
_jsx(AppSystemSoftware, { appInstallation: appInstallation }, "systemsoftware"),
|
|
27
|
+
];
|
|
28
|
+
return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: sections }));
|
|
29
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
3
|
+
import AppAppInstallation = MittwaldAPIV2.Components.Schemas.AppAppInstallation;
|
|
4
|
+
import AppAppVersion = MittwaldAPIV2.Components.Schemas.AppAppVersion;
|
|
5
|
+
export declare const AppInstallationStatus: FC<{
|
|
6
|
+
appInstallation: AppAppInstallation;
|
|
7
|
+
desired: AppAppVersion;
|
|
8
|
+
current: AppAppVersion | undefined;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Value } from "../Value.js";
|
|
3
|
+
import { Text } from "ink";
|
|
4
|
+
export const AppInstallationStatus = ({ desired, current }) => {
|
|
5
|
+
if (!current) {
|
|
6
|
+
return (_jsxs(Text, { children: ["installing version ", _jsx(Value, { children: desired.externalVersion })] }));
|
|
7
|
+
}
|
|
8
|
+
if (current.id === desired.id) {
|
|
9
|
+
return (_jsxs(Text, { children: ["up-to-date at version ", _jsx(Value, { children: current.externalVersion })] }));
|
|
10
|
+
}
|
|
11
|
+
return (_jsxs(Text, { children: ["upgrading from version ", _jsx(Value, { children: current.externalVersion }), ", desired version is ", _jsx(Value, { children: desired.externalVersion })] }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Header } from "../Header.js";
|
|
3
|
+
import { useSystemSoftware, useSystemSoftwareVersion, } from "../../../../lib/app/hooks.js";
|
|
4
|
+
import { Value } from "../Value.js";
|
|
5
|
+
import { SingleResult } from "../SingleResult.js";
|
|
6
|
+
import { Text } from "ink";
|
|
7
|
+
export const AppSystemSoftware = ({ appInstallation, }) => {
|
|
8
|
+
if (!appInstallation.systemSoftware) {
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(Header, { title: "System software" }), _jsx(Text, { children: "No system software defined" })] }));
|
|
10
|
+
}
|
|
11
|
+
const rows = {};
|
|
12
|
+
for (const systemSoftwareDef of appInstallation.systemSoftware || []) {
|
|
13
|
+
const systemSoftware = useSystemSoftware(systemSoftwareDef.systemSoftwareId);
|
|
14
|
+
const systemSoftwareVersion = useSystemSoftwareVersion(systemSoftware.id, systemSoftwareDef.systemSoftwareVersion.desired);
|
|
15
|
+
rows[systemSoftware.name] = (_jsxs(Text, { children: [_jsx(Value, { children: systemSoftwareVersion.externalVersion }), " (update policy:", " ", _jsx(Value, { children: systemSoftwareDef.updatePolicy }), ")"] }));
|
|
16
|
+
}
|
|
17
|
+
return _jsx(SingleResult, { title: "System software", rows: rows });
|
|
18
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.16",
|
|
4
4
|
"description": "Hand-crafted CLI for the mittwald API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"bin"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@mittwald/api-client": "^2.0.
|
|
48
|
-
"@mittwald/api-client-commons": "^3.0
|
|
47
|
+
"@mittwald/api-client": "^2.0.8",
|
|
48
|
+
"@mittwald/api-client-commons": "^3.1.0",
|
|
49
49
|
"@mittwald/react-use-promise": "^1.2.2",
|
|
50
50
|
"@oclif/core": "^2.8.5",
|
|
51
51
|
"@oclif/plugin-help": "^5.2.9",
|
|
@@ -68,6 +68,9 @@
|
|
|
68
68
|
"semver": "^7.5.4",
|
|
69
69
|
"tempfile": "^5.0.0"
|
|
70
70
|
},
|
|
71
|
+
"resolutions": {
|
|
72
|
+
"@mittwald/api-client-commons": "^3.1.0"
|
|
73
|
+
},
|
|
71
74
|
"devDependencies": {
|
|
72
75
|
"@types/chalk": "^2.2.0",
|
|
73
76
|
"@types/copyfiles": "^2.4.1",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
|
-
export default class Delete extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
static args: {
|
|
5
|
-
id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
6
|
-
};
|
|
7
|
-
static flags: {
|
|
8
|
-
force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
private confirmDeletion;
|
|
12
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Args, Flags, ux } from "@oclif/core";
|
|
2
|
-
import { BaseCommand } from "../../BaseCommand.js";
|
|
3
|
-
import { assertStatus } from "@mittwald/api-client-commons";
|
|
4
|
-
import { isUuid } from "../../Helpers.js";
|
|
5
|
-
export default class Delete extends BaseCommand {
|
|
6
|
-
static description = "Delete an app";
|
|
7
|
-
static args = {
|
|
8
|
-
id: Args.string({
|
|
9
|
-
required: true,
|
|
10
|
-
description: "ID of the app to be deleted.",
|
|
11
|
-
}),
|
|
12
|
-
};
|
|
13
|
-
static flags = {
|
|
14
|
-
force: Flags.boolean({
|
|
15
|
-
char: "f",
|
|
16
|
-
description: "delete without prompting for confirmation",
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
async run() {
|
|
20
|
-
const { args, flags } = await this.parse(Delete);
|
|
21
|
-
const { id } = args;
|
|
22
|
-
if (!isUuid(id)) {
|
|
23
|
-
throw new Error("AppID does not seem to be valid");
|
|
24
|
-
}
|
|
25
|
-
if (!(await this.confirmDeletion(flags.force))) {
|
|
26
|
-
this.log("aborting.");
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
ux.action.start("deleting app");
|
|
30
|
-
const project = await this.apiClient.app.uninstallAppinstallation({
|
|
31
|
-
pathParameters: { appInstallationId: id },
|
|
32
|
-
});
|
|
33
|
-
assertStatus(project, 204);
|
|
34
|
-
ux.action.stop(`deleted app ${id}`);
|
|
35
|
-
}
|
|
36
|
-
async confirmDeletion(force) {
|
|
37
|
-
if (force) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
const promptResult = await ux.prompt("Are you sure you want to delete this app? y/n", {
|
|
41
|
-
type: "single",
|
|
42
|
-
});
|
|
43
|
-
return promptResult === "y";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedAppGetSystemsoftware } from "../../../generated/app/getSystemsoftware.js";
|
|
5
|
-
export default class Get extends GeneratedAppGetSystemsoftware {
|
|
6
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedAppGetSystemsoftwareversion } from "../../../generated/app/getSystemsoftwareversion.js";
|
|
5
|
-
export default class Get extends GeneratedAppGetSystemsoftwareversion {
|
|
6
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
3
|
-
import { SuccessfulResponse } from "../../../types.js";
|
|
4
|
-
import { GeneratedAppListSystemsoftwares, Response } from "../../../generated/app/listSystemsoftwares.js";
|
|
5
|
-
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2Systemsoftwares.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
|
-
export default class List extends GeneratedAppListSystemsoftwares<ResponseItem> {
|
|
7
|
-
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.AppSystemSoftware[];
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
3
|
-
import { SuccessfulResponse } from "../../../types.js";
|
|
4
|
-
import { GeneratedAppListSystemsoftwareversions, Response } from "../../../generated/app/listSystemsoftwareversions.js";
|
|
5
|
-
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2SystemsoftwareSystemSoftwareIdVersions.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
|
-
export default class List extends GeneratedAppListSystemsoftwareversions<ResponseItem> {
|
|
7
|
-
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.AppSystemSoftwareVersion[];
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedArticleGetArticle } from "../../generated/article/getArticle.js";
|
|
5
|
-
export default class Get extends GeneratedArticleGetArticle {
|
|
6
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
3
|
-
import { SuccessfulResponse } from "../../types.js";
|
|
4
|
-
import { GeneratedArticleListArticles, Response } from "../../generated/article/listArticles.js";
|
|
5
|
-
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2Articles.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
|
-
export default class List extends GeneratedArticleListArticles<ResponseItem> {
|
|
7
|
-
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.ArticleReadableArticle[];
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedContractGetBaseItemOfContract } from "../../generated/contract/getBaseItemOfContract.js";
|
|
5
|
-
export default class Get extends GeneratedContractGetBaseItemOfContract {
|
|
6
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedContractGetDetailOfContract } from "../../generated/contract/getDetailOfContract.js";
|
|
5
|
-
export default class Get extends GeneratedContractGetDetailOfContract {
|
|
6
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedContractGetDetailOfContractByDomain } from "../../generated/contract/getDetailOfContractByDomain.js";
|
|
5
|
-
export default class Get extends GeneratedContractGetDetailOfContractByDomain {
|
|
6
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedContractGetDetailOfContractByProject } from "../../generated/contract/getDetailOfContractByProject.js";
|
|
5
|
-
export default class Get extends GeneratedContractGetDetailOfContractByProject {
|
|
6
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedContractGetDetailOfContractByServer } from "../../generated/contract/getDetailOfContractByServer.js";
|
|
5
|
-
export default class Get extends GeneratedContractGetDetailOfContractByServer {
|
|
6
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedContractGetDetailOfContractItem } from "../../generated/contract/getDetailOfContractItem.js";
|
|
5
|
-
export default class Get extends GeneratedContractGetDetailOfContractItem {
|
|
6
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
/* This file is auto-generated with acg (@mittwald/api-code-generator) */
|
|
4
|
-
import { GeneratedContractGetNextTerminationDateForItem } from "../../generated/contract/getNextTerminationDateForItem.js";
|
|
5
|
-
export default class Get extends GeneratedContractGetNextTerminationDateForItem {
|
|
6
|
-
}
|