@mittwald/cli 1.0.0-alpha.22 → 1.0.0-alpha.24

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 CHANGED
@@ -188,7 +188,7 @@ USAGE
188
188
  * [`mw user api-token get APITOKENID`](#mw-user-api-token-get-apitokenid)
189
189
  * [`mw user api-token list`](#mw-user-api-token-list)
190
190
  * [`mw user api-token revoke ID`](#mw-user-api-token-revoke-id)
191
- * [`mw user get`](#mw-user-get)
191
+ * [`mw user get USER-ID`](#mw-user-get-user-id)
192
192
  * [`mw user session get TOKENID`](#mw-user-session-get-tokenid)
193
193
  * [`mw user session list`](#mw-user-session-list)
194
194
  * [`mw user ssh-key create`](#mw-user-ssh-key-create)
@@ -265,13 +265,15 @@ Creates new custom PHP installation.
265
265
 
266
266
  ```
267
267
  USAGE
268
- $ mw app create php [-p <value>] [-q] [--site-title <value>] [-w] [--json]
268
+ $ mw app create php --document-root <value> [-p <value>] [-q] [--site-title <value>] [-w] [--json]
269
269
 
270
270
  FLAGS
271
271
  -p, --project-id=<value> ID or short ID of a project; this flag is optional if a default project is set in the
272
272
  context
273
273
  -q, --quiet suppress process output and only display a machine-readable summary.
274
274
  -w, --wait Wait for your custom PHP to be ready.
275
+ --document-root=<value> (required) [default: /] The document root from which your custom PHP will be served
276
+ (relative to the installation path)
275
277
  --json
276
278
  --site-title=<value> Site Title for your custom PHP installation.
277
279
 
@@ -289,6 +291,13 @@ FLAG DESCRIPTIONS
289
291
  This flag controls if you want to see the process output or only a summary. When using mw non-interactively (e.g. in
290
292
  scripts), you can use this flag to easily get the IDs of created resources for further processing.
291
293
 
294
+ --document-root=<value>
295
+
296
+ The document root from which your custom PHP will be served (relative to the installation path)
297
+
298
+ This is the document root from which the files of your application will be served by the web server. This directory
299
+ is specified relative to the installation path.
300
+
292
301
  --site-title=<value> Site Title for your custom PHP installation.
293
302
 
294
303
  Site Title which will be displayed in the Tab and at the top of the Frontend of your custom PHP installation.
@@ -2283,23 +2292,30 @@ Get all deliveryboxes by project ID
2283
2292
 
2284
2293
  ```
2285
2294
  USAGE
2286
- $ mw mail deliverybox list --project-id <value> [--columns <value> | -x] [--sort <value>] [--filter <value>] [--output
2295
+ $ mw mail deliverybox list [-p <value>] [--columns <value> | -x] [--sort <value>] [--filter <value>] [--output
2287
2296
  csv|json|yaml | | [--csv | --no-truncate]] [--no-header | ]
2288
2297
 
2289
2298
  FLAGS
2290
- -x, --extended show extra columns
2291
- --columns=<value> only show provided columns (comma-separated)
2292
- --csv output is csv format [alias: --output=csv]
2293
- --filter=<value> filter property by partial string matching, ex: name=foo
2294
- --no-header hide table header from output
2295
- --no-truncate do not truncate output to fit screen
2296
- --output=<option> output in a more machine friendly format
2297
- <options: csv|json|yaml>
2298
- --project-id=<value> (required) Project ID the deliveryboxes are related to
2299
- --sort=<value> property to sort by (prepend '-' for descending)
2299
+ -p, --project-id=<value> ID or short ID of a project; this flag is optional if a default project is set in the
2300
+ context
2301
+ -x, --extended show extra columns
2302
+ --columns=<value> only show provided columns (comma-separated)
2303
+ --csv output is csv format [alias: --output=csv]
2304
+ --filter=<value> filter property by partial string matching, ex: name=foo
2305
+ --no-header hide table header from output
2306
+ --no-truncate do not truncate output to fit screen
2307
+ --output=<option> output in a more machine friendly format
2308
+ <options: csv|json|yaml>
2309
+ --sort=<value> property to sort by (prepend '-' for descending)
2300
2310
 
2301
2311
  DESCRIPTION
2302
2312
  Get all deliveryboxes by project ID
2313
+
2314
+ FLAG DESCRIPTIONS
2315
+ -p, --project-id=<value> ID or short ID of a project; this flag is optional if a default project is set in the context
2316
+
2317
+ May contain a short ID or a full ID of a project; you can also use the "mw context set --project-id=<VALUE>" command
2318
+ to persistently set a default project for all commands that accept this flag.
2303
2319
  ```
2304
2320
 
2305
2321
  ## `mw org delete [ORG-ID]`
@@ -3389,13 +3405,17 @@ FLAG DESCRIPTIONS
3389
3405
  scripts), you can use this flag to easily get the IDs of created resources for further processing.
3390
3406
  ```
3391
3407
 
3392
- ## `mw user get`
3408
+ ## `mw user get USER-ID`
3393
3409
 
3394
3410
  Get profile information for a user.
3395
3411
 
3396
3412
  ```
3397
3413
  USAGE
3398
- $ mw user get [-o json|yaml | | ]
3414
+ $ mw user get USER-ID [-o json|yaml | | ]
3415
+
3416
+ ARGUMENTS
3417
+ USER-ID [default: self] The user ID to get information for; defaults to the special value 'self', which references to
3418
+ the currently authenticated user.
3399
3419
 
3400
3420
  FLAGS
3401
3421
  -o, --output=<option> output in a more machine friendly format
@@ -1,10 +1,10 @@
1
1
  import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
2
2
  import React from "react";
3
3
  import { AppInstallationResult, AppInstaller } from "../../../lib/app/Installer.js";
4
- export declare const phpInstaller: AppInstaller<"site-title" | "wait">;
4
+ export declare const phpInstaller: AppInstaller<"site-title" | "document-root" | "wait">;
5
5
  export default class InstallPhp extends ExecRenderBaseCommand<typeof InstallPhp, AppInstallationResult> {
6
6
  static description: string;
7
- static flags: import("@oclif/core/lib/interfaces/parser.js").FlagInput<import("../../../lib/app/flags.js").RelevantFlags<readonly ("site-title" | "wait")[]>>;
7
+ static flags: import("@oclif/core/lib/interfaces/parser.js").FlagInput<import("../../../lib/app/flags.js").RelevantFlags<readonly ("site-title" | "document-root" | "wait")[]>>;
8
8
  protected exec(): Promise<{
9
9
  appInstallationId: string;
10
10
  }>;
@@ -1,6 +1,6 @@
1
1
  import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
2
2
  import { AppInstaller, } from "../../../lib/app/Installer.js";
3
- export const phpInstaller = new AppInstaller("34220303-cb87-4592-8a95-2eb20a97b2ac", "custom PHP", ["site-title", "wait"]);
3
+ export const phpInstaller = new AppInstaller("34220303-cb87-4592-8a95-2eb20a97b2ac", "custom PHP", ["document-root", "site-title", "wait"]);
4
4
  export default class InstallPhp extends ExecRenderBaseCommand {
5
5
  static description = phpInstaller.description;
6
6
  static flags = phpInstaller.flags;
@@ -1,12 +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 { GeneratedMailDeliveryboxList, PathParams, Response } from "../../../generated/mail/deliveryboxList.js";
5
4
  import { ListColumns } from "../../../Formatter.js";
5
+ import { ListBaseCommand } from "../../../ListBaseCommand.js";
6
6
  type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2ProjectsProjectIdDeliveryboxes.Get.Responses.$200.Content.ApplicationJson[number]>;
7
- export default class List extends GeneratedMailDeliveryboxList<ResponseItem> {
7
+ export type PathParams = MittwaldAPIV2.Paths.V2ProjectsProjectIdDeliveryboxes.Get.Parameters.Path;
8
+ export type Response = Awaited<ReturnType<MittwaldAPIV2Client["mail"]["deliveryboxList"]>>;
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>;
8
16
  protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.MailDeliverybox[];
9
- protected mapParams(input: PathParams): Promise<PathParams>;
10
17
  protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
11
18
  }
12
19
  export {};
@@ -1,15 +1,20 @@
1
- import { GeneratedMailDeliveryboxList, } from "../../../generated/mail/deliveryboxList.js";
2
- import { normalizeProjectIdToUuid } from "../../../Helpers.js";
3
1
  import { formatRelativeDate } from "../../../lib/viewhelpers/date.js";
4
- export default class List extends GeneratedMailDeliveryboxList {
2
+ import { ListBaseCommand } from "../../../ListBaseCommand.js";
3
+ import { projectFlags, withProjectId } from "../../../lib/project/flags.js";
4
+ export class List extends ListBaseCommand {
5
+ static description = "Get all deliveryboxes by project ID";
6
+ static args = {};
7
+ static flags = {
8
+ ...projectFlags,
9
+ ...ListBaseCommand.baseFlags,
10
+ };
11
+ async getData() {
12
+ const projectId = await withProjectId(this.apiClient, List, this.flags, this.args, this.config);
13
+ return await this.apiClient.mail.deliveryboxList({ projectId });
14
+ }
5
15
  mapData(data) {
6
- console.log(data);
7
16
  return data;
8
17
  }
9
- async mapParams(input) {
10
- input.projectId = await normalizeProjectIdToUuid(this.apiClient, input.projectId);
11
- return super.mapParams(input);
12
- }
13
18
  getColumns(data) {
14
19
  const baseColumns = super.getColumns(data);
15
20
  return {
@@ -1,3 +1,15 @@
1
- import { GeneratedUserGetUser } from "../../generated/user/getUser.js";
2
- export default class Get extends GeneratedUserGetUser {
1
+ import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
2
+ import { GetBaseCommand } from "../../GetBaseCommand.js";
3
+ export type PathParams = MittwaldAPIV2.Paths.V2UsersUserId.Get.Parameters.Path;
4
+ type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["user"]["getUser"]>>;
5
+ export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
6
+ static description: string;
7
+ static flags: {
8
+ [x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
9
+ };
10
+ static args: {
11
+ "user-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
12
+ };
13
+ protected getData(): Promise<APIResponse>;
3
14
  }
15
+ export {};
@@ -1,6 +1,20 @@
1
- /* eslint-disable */
2
- /* prettier-ignore */
3
- /* This file is auto-generated with acg (@mittwald/api-code-generator) */
4
- import { GeneratedUserGetUser } from "../../generated/user/getUser.js";
5
- export default class Get extends GeneratedUserGetUser {
1
+ import { GetBaseCommand } from "../../GetBaseCommand.js";
2
+ import { Args } from "@oclif/core";
3
+ export default class Get extends GetBaseCommand {
4
+ static description = "Get profile information for a user.";
5
+ static flags = {
6
+ ...GetBaseCommand.baseFlags,
7
+ };
8
+ static args = {
9
+ "user-id": Args.string({
10
+ description: "The user ID to get information for; defaults to the special value 'self', which references to the currently authenticated user.",
11
+ default: "self",
12
+ required: true,
13
+ }),
14
+ };
15
+ async getData() {
16
+ return await this.apiClient.user.getUser({
17
+ userId: this.args["user-id"],
18
+ });
19
+ }
6
20
  }
@@ -19,6 +19,7 @@ interface AvailableFlags {
19
19
  "shop-lang": OptionFlag<string | undefined>;
20
20
  "shop-currency": OptionFlag<string | undefined>;
21
21
  "install-mode": OptionFlag<string>;
22
+ "document-root": OptionFlag<string>;
22
23
  wait: BooleanFlag<boolean | undefined>;
23
24
  }
24
25
  export type RelevantFlags<TFlags extends readonly AvailableFlagName[]> = ProcessFlags & Pick<AvailableFlags, TFlags[number]>;
@@ -96,6 +96,12 @@ function buildFlagsWithDescription(appName) {
96
96
  options: ["composer", "symlink"],
97
97
  default: "composer",
98
98
  }),
99
+ "document-root": Flags.string({
100
+ required: true,
101
+ summary: `The document root from which your ${appName} will be served (relative to the installation path)`,
102
+ description: "This is the document root from which the files of your application will be served by the web server. This directory is specified relative to the installation path.",
103
+ default: "/",
104
+ }),
99
105
  wait: Flags.boolean({
100
106
  char: "w",
101
107
  description: `Wait for your ${appName} to be ready.`,
@@ -16,5 +16,28 @@ export async function triggerAppInstallation(apiClient, process, projectId, flag
16
16
  assertStatus(result, 201);
17
17
  return [result.data.id, result.headers["etag"]];
18
18
  });
19
+ await process.runStep("waiting for installation to be retrievable", async () => {
20
+ for (let attempts = 0; attempts < 10; attempts++) {
21
+ const result = await apiClient.app.getAppinstallation({
22
+ appInstallationId,
23
+ });
24
+ if (result.status === 200) {
25
+ return result.data;
26
+ }
27
+ await new Promise((resolve) => setTimeout(resolve, 100));
28
+ }
29
+ });
30
+ if ("document-root" in flags && flags["document-root"] !== "/") {
31
+ await process.runStep("setting document root", async () => {
32
+ const result = await apiClient.app.patchAppinstallation({
33
+ appInstallationId,
34
+ headers: { "if-event-reached": eventId },
35
+ data: {
36
+ customDocumentRoot: flags["document-root"],
37
+ },
38
+ });
39
+ assertStatus(result, 204);
40
+ });
41
+ }
19
42
  return [appInstallationId, eventId];
20
43
  }
@@ -20,6 +20,7 @@ export const AppInstallationDetails = ({ app, appInstallation }) => {
20
20
  Name: _jsx(Value, { children: app.name }),
21
21
  } })),
22
22
  "Installation Path": _jsx(Value, { children: appInstallation.installationPath }),
23
+ "Document root (in installation path)": (_jsx(Value, { children: appInstallation.customDocumentRoot ?? "/" })),
23
24
  Description: _jsx(Value, { children: appInstallation.description }),
24
25
  Status: customInstallation ? (_jsx(Text, { children: "custom application" })) : (_jsx(AppInstallationStatus, { appInstallation: appInstallation, desired: desiredAppVersion, current: currentAppVersion })),
25
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/cli",
3
- "version": "1.0.0-alpha.22",
3
+ "version": "1.0.0-alpha.24",
4
4
  "description": "Hand-crafted CLI for the mittwald API",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1,13 +0,0 @@
1
- import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
2
- import { ListBaseCommand } from "../../ListBaseCommand.js";
3
- export type PathParams = MittwaldAPIV2.Paths.V2ProjectsProjectIdDeliveryboxes.Get.Parameters.Path;
4
- export type Response = Awaited<ReturnType<MittwaldAPIV2Client["mail"]["deliveryboxList"]>>;
5
- export declare abstract class GeneratedMailDeliveryboxList<TItem extends Record<string, unknown>> extends ListBaseCommand<typeof GeneratedMailDeliveryboxList, TItem, Response> {
6
- static description: string;
7
- static args: {};
8
- static flags: {
9
- "project-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- };
11
- getData(): Promise<Response>;
12
- protected mapParams(input: PathParams): Promise<PathParams> | PathParams;
13
- }
@@ -1,22 +0,0 @@
1
- import { Flags } from "@oclif/core";
2
- import { ListBaseCommand } from "../../ListBaseCommand.js";
3
- export class GeneratedMailDeliveryboxList extends ListBaseCommand {
4
- static description = "Get all deliveryboxes by project ID";
5
- static args = {};
6
- static flags = {
7
- ...ListBaseCommand.baseFlags,
8
- "project-id": Flags.string({
9
- description: "Project ID the deliveryboxes are related to",
10
- required: true,
11
- }),
12
- };
13
- async getData() {
14
- const pathParams = {
15
- projectId: this.flags["project-id"],
16
- };
17
- return await this.apiClient.mail.deliveryboxList((await this.mapParams(pathParams)));
18
- }
19
- mapParams(input) {
20
- return input;
21
- }
22
- }
@@ -1,14 +0,0 @@
1
- import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
2
- import { GetBaseCommand } from "../../GetBaseCommand.js";
3
- export type PathParams = MittwaldAPIV2.Paths.V2UsersUserId.Get.Parameters.Path;
4
- type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["user"]["getUser"]>>;
5
- export declare abstract class GeneratedUserGetUser extends GetBaseCommand<typeof GeneratedUserGetUser, APIResponse> {
6
- static description: string;
7
- static flags: {
8
- [x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
9
- };
10
- static args: {};
11
- protected getData(): Promise<APIResponse>;
12
- protected mapParams(input: PathParams): Promise<PathParams> | PathParams;
13
- }
14
- export {};
@@ -1,16 +0,0 @@
1
- import { GetBaseCommand } from "../../GetBaseCommand.js";
2
- export class GeneratedUserGetUser extends GetBaseCommand {
3
- static description = "Get profile information for a user.";
4
- static flags = {
5
- ...GetBaseCommand.baseFlags,
6
- };
7
- static args = {};
8
- async getData() {
9
- return await this.apiClient.user.getUser({
10
- ...(await this.mapParams(this.args)),
11
- });
12
- }
13
- mapParams(input) {
14
- return input;
15
- }
16
- }