@mittwald/cli 1.0.0-alpha.15 → 1.0.0-alpha.17
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
package/dist/esm/Translator.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
1
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
2
|
+
import AppAppVersion = MittwaldAPIV2.Components.Schemas.AppAppVersion;
|
|
3
|
+
import AppApp = MittwaldAPIV2.Components.Schemas.AppApp;
|
|
2
4
|
export declare function getProjectUuidFromShortId(apiClient: MittwaldAPIV2Client, shortId: string): Promise<string>;
|
|
3
5
|
export declare function getServerUuidFromShortId(apiClient: MittwaldAPIV2Client, shortId: string): Promise<string>;
|
|
4
6
|
export declare function getCustomerUuidFromCustomerNumber(apiClient: MittwaldAPIV2Client, shortId: string): Promise<string>;
|
|
5
7
|
export declare function getConversationUuidFromShortId(apiClient: MittwaldAPIV2Client, shortId: string): Promise<string>;
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function getAppVersionFromUuid(apiClient: MittwaldAPIV2Client, appId: string, appVersionId: string): Promise<
|
|
8
|
+
export declare function getAppFromUuid(apiClient: MittwaldAPIV2Client, uuid: string): Promise<AppApp>;
|
|
9
|
+
export declare function getAppVersionFromUuid(apiClient: MittwaldAPIV2Client, appId: string, appVersionId: string): Promise<AppAppVersion>;
|
package/dist/esm/Translator.js
CHANGED
|
@@ -47,7 +47,7 @@ export async function getConversationUuidFromShortId(apiClient, shortId) {
|
|
|
47
47
|
}
|
|
48
48
|
throw new Error("Access Denied.");
|
|
49
49
|
}
|
|
50
|
-
export async function
|
|
50
|
+
export async function getAppFromUuid(apiClient, uuid) {
|
|
51
51
|
if (!isUuid(uuid)) {
|
|
52
52
|
throw new Error("Given UUID not valid.");
|
|
53
53
|
}
|
|
@@ -57,7 +57,7 @@ export async function getAppNameFromUuid(apiClient, uuid) {
|
|
|
57
57
|
return item.id === uuid;
|
|
58
58
|
});
|
|
59
59
|
if (foundApp) {
|
|
60
|
-
return foundApp
|
|
60
|
+
return foundApp;
|
|
61
61
|
}
|
|
62
62
|
throw new Error("App not found.");
|
|
63
63
|
}
|
|
@@ -68,8 +68,6 @@ export async function getAppVersionFromUuid(apiClient, appId, appVersionId) {
|
|
|
68
68
|
const appVersion = await apiClient.app.getAppversion({
|
|
69
69
|
pathParameters: { appId: appId, appVersionId: appVersionId },
|
|
70
70
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
throw new Error("AppVersion not found.");
|
|
71
|
+
assertStatus(appVersion, 200);
|
|
72
|
+
return appVersion.data;
|
|
75
73
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
type Result = {
|
|
4
|
+
appInstallationId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class Copy extends ExecRenderBaseCommand<typeof Copy, Result> {
|
|
7
|
+
static args: {
|
|
8
|
+
"installation-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
static flags: {
|
|
11
|
+
description: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
protected exec(): Promise<Result>;
|
|
15
|
+
protected render(executionResult: Result): ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ExecRenderBaseCommand } from "../../rendering/react/ExecRenderBaseCommand.js";
|
|
3
|
+
import { appInstallationFlags } from "../../lib/app/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
|
+
export class Copy extends ExecRenderBaseCommand {
|
|
9
|
+
static args = { ...appInstallationFlags };
|
|
10
|
+
static flags = {
|
|
11
|
+
...processFlags,
|
|
12
|
+
description: Flags.string({
|
|
13
|
+
summary: "set a description for the new app installation",
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
async exec() {
|
|
18
|
+
const { "installation-id": id } = this.args;
|
|
19
|
+
const { description } = this.flags;
|
|
20
|
+
const p = makeProcessRenderer(this.flags, "Copying app installation");
|
|
21
|
+
const result = await p.runStep("requesting app copy", async () => {
|
|
22
|
+
const r = await this.apiClient.app.requestAppinstallationCopy({
|
|
23
|
+
pathParameters: { id },
|
|
24
|
+
data: {
|
|
25
|
+
description,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
assertStatus(r, 201);
|
|
29
|
+
return r.data;
|
|
30
|
+
});
|
|
31
|
+
p.complete(_jsx(Success, { children: "App successfully copied; have fun! \uD83D\uDE80" }));
|
|
32
|
+
return { appInstallationId: result.id };
|
|
33
|
+
}
|
|
34
|
+
render(executionResult) {
|
|
35
|
+
if (this.flags.quiet) {
|
|
36
|
+
return executionResult.appInstallationId;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
|
+
import { SuccessfulResponse } from "../../../types.js";
|
|
4
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
5
|
+
import { ListColumns } from "../../../Formatter.js";
|
|
6
|
+
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2Systemsoftwares.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
7
|
+
type Response = Awaited<ReturnType<MittwaldAPIV2Client["app"]["listSystemsoftwares"]>>;
|
|
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>;
|
|
13
|
+
};
|
|
14
|
+
getData(): Promise<Response>;
|
|
15
|
+
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.AppSystemSoftware[];
|
|
16
|
+
protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
2
|
+
export class List extends ListBaseCommand {
|
|
3
|
+
static description = "get all available dependencies";
|
|
4
|
+
static args = {};
|
|
5
|
+
static flags = {
|
|
6
|
+
...ListBaseCommand.baseFlags,
|
|
7
|
+
};
|
|
8
|
+
async getData() {
|
|
9
|
+
return await this.apiClient.app.listSystemsoftwares({
|
|
10
|
+
pathParameters: {},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
mapData(data) {
|
|
14
|
+
data.sort((a, b) => a.tags[0].localeCompare(b.tags[0]) || a.name.localeCompare(b.name));
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
getColumns(data) {
|
|
18
|
+
const baseColumns = super.getColumns(data);
|
|
19
|
+
return {
|
|
20
|
+
id: baseColumns.id,
|
|
21
|
+
name: {},
|
|
22
|
+
tags: {
|
|
23
|
+
get: (item) => item.tags.join(", "),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export default class Update extends ExecRenderBaseCommand<typeof Update, void> {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static args: {
|
|
6
|
+
"installation-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static examples: {
|
|
9
|
+
description: string;
|
|
10
|
+
command: string;
|
|
11
|
+
}[];
|
|
12
|
+
static flags: {
|
|
13
|
+
set: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
|
+
"update-policy": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
15
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
protected exec(): Promise<void>;
|
|
18
|
+
private getVersions;
|
|
19
|
+
protected render(): ReactNode;
|
|
20
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
3
|
+
import { appInstallationFlags } from "../../../lib/app/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 { Range, SemVer } from "semver";
|
|
9
|
+
import { Value } from "../../../rendering/react/components/Value.js";
|
|
10
|
+
import { Text } from "ink";
|
|
11
|
+
export default class Update extends ExecRenderBaseCommand {
|
|
12
|
+
static summary = "Update the dependencies of an app";
|
|
13
|
+
static args = { ...appInstallationFlags };
|
|
14
|
+
static examples = [
|
|
15
|
+
{
|
|
16
|
+
description: "Update Node.js version to newest available from the 18.x branch",
|
|
17
|
+
command: "<%= config.bin %> <%= command.id %> $APP_ID --set node=~18",
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
static flags = {
|
|
21
|
+
...processFlags,
|
|
22
|
+
set: Flags.string({
|
|
23
|
+
summary: "set a dependency to a specific version",
|
|
24
|
+
description: `\
|
|
25
|
+
The format is <dependency>=<version>, where <dependency> is the name of the dependency (use the "<%= config.bin %> app dependency list" command to get a list of available dependencies) and <version> is a semver constraint.
|
|
26
|
+
|
|
27
|
+
This flag may be specified multiple times to update multiple dependencies.`,
|
|
28
|
+
multiple: true,
|
|
29
|
+
required: true,
|
|
30
|
+
}),
|
|
31
|
+
"update-policy": Flags.string({
|
|
32
|
+
summary: "set the update policy for the configured dependencies",
|
|
33
|
+
default: "patchLevel",
|
|
34
|
+
options: ["none", "inheritedFromApp", "patchLevel", "all"],
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
async exec() {
|
|
38
|
+
const appInstallationId = this.args["installation-id"];
|
|
39
|
+
const updatePolicy = this.flags["update-policy"];
|
|
40
|
+
const process = makeProcessRenderer(this.flags, "Updating app dependencies");
|
|
41
|
+
const systemSoftwares = await process.runStep("fetching system softwares", async () => {
|
|
42
|
+
const r = await this.apiClient.app.listSystemsoftwares();
|
|
43
|
+
assertStatus(r, 200);
|
|
44
|
+
return r.data;
|
|
45
|
+
});
|
|
46
|
+
const versionsToUpdate = {};
|
|
47
|
+
for (const s of this.flags.set) {
|
|
48
|
+
const [software, versionSpec] = s.split("=");
|
|
49
|
+
const parsedVersionSpec = new Range(versionSpec);
|
|
50
|
+
if (!parsedVersionSpec) {
|
|
51
|
+
throw new Error(`version spec ${versionSpec} is not a valid semver constraint`);
|
|
52
|
+
}
|
|
53
|
+
const systemSoftware = systemSoftwares.find((s) => s.name.toLowerCase() === software.toLowerCase());
|
|
54
|
+
if (!systemSoftware) {
|
|
55
|
+
throw new Error(`unknown system software ${software}`);
|
|
56
|
+
}
|
|
57
|
+
const versions = await this.getVersions(process, systemSoftware);
|
|
58
|
+
const version = await process.runStep(`determining version for ${software}`, async () => {
|
|
59
|
+
const exactMatch = versions.find((v) => v.externalVersion === versionSpec);
|
|
60
|
+
if (exactMatch) {
|
|
61
|
+
return exactMatch;
|
|
62
|
+
}
|
|
63
|
+
const version = versions.find((v) => parsedVersionSpec.test(v.externalVersion));
|
|
64
|
+
if (!version) {
|
|
65
|
+
const available = versions.map((v) => v.externalVersion).join(", ");
|
|
66
|
+
throw new Error(`unknown version ${versionSpec} for ${software}; available versions are: ${available}`);
|
|
67
|
+
}
|
|
68
|
+
return version;
|
|
69
|
+
});
|
|
70
|
+
process.addInfo(_jsxs(Text, { children: ["selected ", _jsx(Value, { children: systemSoftware.name }), " version:", " ", _jsx(Value, { children: version.externalVersion })] }));
|
|
71
|
+
versionsToUpdate[systemSoftware.id] = {
|
|
72
|
+
systemSoftwareVersion: version.id,
|
|
73
|
+
updatePolicy,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
await process.runStep("updating app dependencies", async () => {
|
|
77
|
+
const r = await this.apiClient.app.patchAppinstallation({
|
|
78
|
+
pathParameters: { appInstallationId },
|
|
79
|
+
data: {
|
|
80
|
+
systemSoftware: versionsToUpdate,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
assertStatus(r, 204);
|
|
84
|
+
});
|
|
85
|
+
process.complete(_jsx(Success, { children: "The dependencies of this app were successfully updated!" }));
|
|
86
|
+
}
|
|
87
|
+
async getVersions(p, systemSoftware) {
|
|
88
|
+
const versions = await p.runStep(`fetching versions for ${systemSoftware.name}`, async () => {
|
|
89
|
+
const r = await this.apiClient.app.listSystemsoftwareversions({
|
|
90
|
+
pathParameters: { systemSoftwareId: systemSoftware.id },
|
|
91
|
+
});
|
|
92
|
+
assertStatus(r, 200);
|
|
93
|
+
return r.data;
|
|
94
|
+
});
|
|
95
|
+
versions.sort((a, b) => {
|
|
96
|
+
return (new SemVer(a.externalVersion).compare(new SemVer(b.externalVersion)) *
|
|
97
|
+
-1);
|
|
98
|
+
});
|
|
99
|
+
return versions;
|
|
100
|
+
}
|
|
101
|
+
render() {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
4
|
+
import { SuccessfulResponse } from "../../../types.js";
|
|
5
|
+
import { ListColumns } from "../../../Formatter.js";
|
|
6
|
+
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2SystemsoftwareSystemSoftwareIdVersions.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
7
|
+
type Response = Awaited<ReturnType<MittwaldAPIV2Client["app"]["listSystemsoftwareversions"]>>;
|
|
8
|
+
export declare class Versions extends ListBaseCommand<typeof Versions, ResponseItem, Response> {
|
|
9
|
+
static description: string;
|
|
10
|
+
static args: {
|
|
11
|
+
systemsoftware: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
static flags: {
|
|
14
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
15
|
+
};
|
|
16
|
+
getData(): Promise<Response>;
|
|
17
|
+
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.AppSystemSoftwareVersion[];
|
|
18
|
+
protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { assertStatus } from "@mittwald/api-client-commons";
|
|
2
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
3
|
+
import { SemVer } from "semver";
|
|
4
|
+
import { Args } from "@oclif/core";
|
|
5
|
+
export class Versions extends ListBaseCommand {
|
|
6
|
+
static description = "get all available versions of a particular dependency";
|
|
7
|
+
static args = {
|
|
8
|
+
systemsoftware: Args.string({
|
|
9
|
+
description: "name of the systemsoftware for which to list versions",
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static flags = {
|
|
14
|
+
...ListBaseCommand.baseFlags,
|
|
15
|
+
};
|
|
16
|
+
async getData() {
|
|
17
|
+
const systemSoftwareName = this.args["systemsoftware"];
|
|
18
|
+
const systemSoftwares = await this.apiClient.app.listSystemsoftwares({});
|
|
19
|
+
assertStatus(systemSoftwares, 200);
|
|
20
|
+
const systemSoftware = systemSoftwares.data.find((s) => s.name.toLowerCase() === systemSoftwareName.toLowerCase());
|
|
21
|
+
if (!systemSoftware) {
|
|
22
|
+
throw new Error(`system software ${systemSoftwareName} not found`);
|
|
23
|
+
}
|
|
24
|
+
return await this.apiClient.app.listSystemsoftwareversions({
|
|
25
|
+
pathParameters: { systemSoftwareId: systemSoftware.id },
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
mapData(data) {
|
|
29
|
+
data.sort((a, b) => new SemVer(a.externalVersion).compare(b.externalVersion));
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
getColumns(data) {
|
|
33
|
+
const baseColumns = super.getColumns(data);
|
|
34
|
+
return {
|
|
35
|
+
id: baseColumns.id,
|
|
36
|
+
externalVersion: { header: "Version" },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -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 flags: {
|
|
6
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
7
|
+
};
|
|
8
|
+
static args: {
|
|
9
|
+
"installation-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
protected render(): ReactNode;
|
|
3
12
|
}
|
|
@@ -1,6 +1,20 @@
|
|
|
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 { RenderJson } from "../../rendering/react/json/RenderJson.js";
|
|
4
|
+
import { GetBaseCommand } from "../../GetBaseCommand.js";
|
|
5
|
+
import { AppInstallationDetails } from "../../rendering/react/components/AppInstallation/AppInstallationDetails.js";
|
|
6
|
+
import { useApp, useAppInstallation } from "../../lib/app/hooks.js";
|
|
7
|
+
import { appInstallationFlags } from "../../lib/app/flags.js";
|
|
8
|
+
export default class Get extends RenderBaseCommand {
|
|
9
|
+
static description = "Get details about an app installation";
|
|
10
|
+
static flags = { ...GetBaseCommand.baseFlags };
|
|
11
|
+
static args = { ...appInstallationFlags };
|
|
12
|
+
render() {
|
|
13
|
+
const appInstallation = useAppInstallation(this.args["installation-id"]);
|
|
14
|
+
const app = useApp(appInstallation.appId);
|
|
15
|
+
if (this.flags.output === "json") {
|
|
16
|
+
return _jsx(RenderJson, { name: "appInstallation", data: appInstallation });
|
|
17
|
+
}
|
|
18
|
+
return (_jsx(AppInstallationDetails, { appInstallation: appInstallation, app: app }));
|
|
19
|
+
}
|
|
6
20
|
}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
+
import { ListBaseCommand } from "../../ListBaseCommand.js";
|
|
3
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
4
|
+
import { SuccessfulResponse } from "../../types.js";
|
|
5
|
+
import { ListColumns } from "../../Formatter.js";
|
|
6
|
+
import AppApp = MittwaldAPIV2.Components.Schemas.AppApp;
|
|
7
|
+
import AppAppVersion = MittwaldAPIV2.Components.Schemas.AppAppVersion;
|
|
8
|
+
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2ProjectsProjectIdAppinstallations.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
9
|
+
type Response = Awaited<ReturnType<MittwaldAPIV2Client["app"]["listAppinstallations"]>>;
|
|
10
|
+
type ExtendedResponseItem = ResponseItem & {
|
|
11
|
+
app: AppApp;
|
|
12
|
+
appVersionCurrent: AppAppVersion | undefined;
|
|
13
|
+
appVersionDesired: AppAppVersion;
|
|
14
|
+
};
|
|
15
|
+
export default class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
3
16
|
static description: string;
|
|
4
17
|
static flags: {
|
|
5
|
-
|
|
6
|
-
sort: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined>;
|
|
7
|
-
filter: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined>;
|
|
8
|
-
csv: import("@oclif/core/lib/interfaces/parser.js").Flag<boolean>;
|
|
9
|
-
output: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined>;
|
|
10
|
-
extended: import("@oclif/core/lib/interfaces/parser.js").Flag<boolean>;
|
|
11
|
-
'no-truncate': import("@oclif/core/lib/interfaces/parser.js").Flag<boolean>;
|
|
12
|
-
'no-header': import("@oclif/core/lib/interfaces/parser.js").Flag<boolean>;
|
|
18
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any> | import("@oclif/core/lib/interfaces/parser.js").OptionFlag<unknown>;
|
|
13
19
|
};
|
|
14
|
-
|
|
20
|
+
protected getData(): Promise<Response>;
|
|
21
|
+
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): Promise<ExtendedResponseItem[]>;
|
|
22
|
+
protected getColumns(): ListColumns<ExtendedResponseItem>;
|
|
15
23
|
}
|
|
24
|
+
export {};
|
|
@@ -1,58 +1,72 @@
|
|
|
1
|
-
import { ux } from "@oclif/core";
|
|
2
1
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
3
|
-
import {
|
|
4
|
-
import { getAppNameFromUuid, getAppVersionFromUuid } from "../../Translator.js";
|
|
2
|
+
import { getAppFromUuid, getAppVersionFromUuid } from "../../Translator.js";
|
|
5
3
|
import { projectFlags, withProjectId } from "../../lib/project/flags.js";
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { ListBaseCommand } from "../../ListBaseCommand.js";
|
|
5
|
+
export default class List extends ListBaseCommand {
|
|
6
|
+
static description = "List installed apps in a project.";
|
|
8
7
|
static flags = {
|
|
9
|
-
...
|
|
8
|
+
...ListBaseCommand.baseFlags,
|
|
10
9
|
...projectFlags,
|
|
11
10
|
};
|
|
12
|
-
async
|
|
13
|
-
const
|
|
14
|
-
const projectId = await withProjectId(this.apiClient, flags, {}, this.config);
|
|
11
|
+
async getData() {
|
|
12
|
+
const projectId = await withProjectId(this.apiClient, this.flags, this.args, this.config);
|
|
15
13
|
const apps = await this.apiClient.app.listAppinstallations({
|
|
16
14
|
pathParameters: { projectId },
|
|
17
15
|
});
|
|
18
16
|
assertStatus(apps, 200);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const relevantAppInfo = await Promise.all(apps.data.map(async (app) => {
|
|
17
|
+
return apps;
|
|
18
|
+
}
|
|
19
|
+
mapData(data) {
|
|
20
|
+
return Promise.all(data.map(async (item) => {
|
|
24
21
|
return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
...item,
|
|
23
|
+
app: await getAppFromUuid(this.apiClient, item.appId),
|
|
24
|
+
appVersionCurrent: item.appVersion.current
|
|
25
|
+
? await getAppVersionFromUuid(this.apiClient, item.appId, item.appVersion.current)
|
|
26
|
+
: undefined,
|
|
27
|
+
appVersionDesired: await getAppVersionFromUuid(this.apiClient, item.appId, item.appVersion.desired),
|
|
30
28
|
};
|
|
31
29
|
}));
|
|
32
|
-
|
|
30
|
+
}
|
|
31
|
+
getColumns() {
|
|
32
|
+
return {
|
|
33
33
|
id: {
|
|
34
34
|
header: "ID",
|
|
35
35
|
minWidth: 36,
|
|
36
36
|
},
|
|
37
|
-
description: {
|
|
38
|
-
header: "Description",
|
|
39
|
-
minWidth: 36,
|
|
40
|
-
},
|
|
37
|
+
description: {},
|
|
41
38
|
app: {
|
|
42
39
|
header: "Application",
|
|
43
40
|
minWidth: 8,
|
|
41
|
+
get: (i) => i.app.name,
|
|
44
42
|
},
|
|
45
43
|
appVersion: {
|
|
46
44
|
header: "Version",
|
|
47
|
-
|
|
45
|
+
get: (i) => {
|
|
46
|
+
if (i.appVersionCurrent?.id === i.appVersionDesired.id) {
|
|
47
|
+
return i.appVersionDesired.externalVersion;
|
|
48
|
+
}
|
|
49
|
+
if (!i.appVersionCurrent) {
|
|
50
|
+
return i.appVersionDesired.externalVersion;
|
|
51
|
+
}
|
|
52
|
+
return `${i.appVersionCurrent.externalVersion} => ${i.appVersionDesired.externalVersion}`;
|
|
53
|
+
},
|
|
48
54
|
},
|
|
49
|
-
|
|
50
|
-
header: "
|
|
51
|
-
|
|
55
|
+
status: {
|
|
56
|
+
header: "Status",
|
|
57
|
+
get: (i) => {
|
|
58
|
+
if (i.appVersionCurrent?.id === i.appVersionDesired.id) {
|
|
59
|
+
return "up-to-date";
|
|
60
|
+
}
|
|
61
|
+
if (!i.appVersionCurrent) {
|
|
62
|
+
return "installing";
|
|
63
|
+
}
|
|
64
|
+
return "updating";
|
|
65
|
+
},
|
|
52
66
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
67
|
+
installationPath: {
|
|
68
|
+
header: "Installed in",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
57
71
|
}
|
|
58
72
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeleteBaseCommand } from "../../DeleteBaseCommand.js";
|
|
2
|
+
export default class Uninstall extends DeleteBaseCommand<typeof Uninstall> {
|
|
3
|
+
static description: string;
|
|
4
|
+
static resourceName: string;
|
|
5
|
+
static args: {
|
|
6
|
+
"installation-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
protected deleteResource(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Args } from "@oclif/core";
|
|
2
|
+
import { assertStatus } from "@mittwald/api-client-commons";
|
|
3
|
+
import { DeleteBaseCommand } from "../../DeleteBaseCommand.js";
|
|
4
|
+
export default class Uninstall extends DeleteBaseCommand {
|
|
5
|
+
static description = "Uninstall an app";
|
|
6
|
+
static resourceName = "app installation";
|
|
7
|
+
static args = {
|
|
8
|
+
"installation-id": Args.string({
|
|
9
|
+
description: "ID of the app installation to delete",
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
async deleteResource() {
|
|
14
|
+
const appInstallationId = this.args["installation-id"];
|
|
15
|
+
const response = await this.apiClient.app.uninstallAppinstallation({
|
|
16
|
+
pathParameters: { appInstallationId },
|
|
17
|
+
});
|
|
18
|
+
assertStatus(response, 204);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
type Result = {
|
|
4
|
+
databaseId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class Create extends ExecRenderBaseCommand<typeof Create, Result> {
|
|
7
|
+
static summary: string;
|
|
8
|
+
static flags: {
|
|
9
|
+
description: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
10
|
+
version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
persistent: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
12
|
+
"max-memory": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
+
"max-memory-policy": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
15
|
+
};
|
|
16
|
+
protected exec(): Promise<Result>;
|
|
17
|
+
protected render({ databaseId }: Result): ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export {};
|